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

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 (62) hide show
  1. package/bundles/simpleangularcontrols-sac-common.umd.js +1096 -707
  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 +30 -22
  7. package/controls/checkbox/radiobutton.d.ts +61 -26
  8. package/controls/datetime/date.d.ts +28 -27
  9. package/controls/datetime/datetime.d.ts +27 -27
  10. package/controls/datetime/time.d.ts +26 -26
  11. package/controls/dialog/dialog.d.ts +31 -43
  12. package/controls/layout/formlayout.d.ts +4 -0
  13. package/controls/list/buildvaluestring.d.ts +6 -0
  14. package/controls/list/buildvaluestring.ngfactory.d.ts +1 -0
  15. package/controls/list/dropdown.d.ts +9 -51
  16. package/controls/list/dropdownoptions.d.ts +38 -0
  17. package/controls/list/dropdownoptions.ngfactory.d.ts +1 -0
  18. package/controls/static/formcontainer.d.ts +11 -3
  19. package/controls/tooltip/tooltip.d.ts +33 -51
  20. package/esm2015/common/basedatetimecontrol.js +178 -30
  21. package/esm2015/common/basemodelcontrol.js +57 -46
  22. package/esm2015/controls/checkbox/radiobutton.js +94 -45
  23. package/esm2015/controls/datetime/date.js +43 -41
  24. package/esm2015/controls/datetime/datetime.js +42 -41
  25. package/esm2015/controls/datetime/time.js +42 -41
  26. package/esm2015/controls/dialog/dialog.js +41 -83
  27. package/esm2015/controls/layout/formlayout.js +7 -6
  28. package/esm2015/controls/list/buildvaluestring.js +18 -0
  29. package/esm2015/controls/list/buildvaluestring.ngfactory.js +7 -0
  30. package/esm2015/controls/list/dropdown.js +16 -114
  31. package/esm2015/controls/list/dropdownoptions.js +72 -0
  32. package/esm2015/controls/list/dropdownoptions.ngfactory.js +7 -0
  33. package/esm2015/controls/static/formcontainer.js +16 -6
  34. package/esm2015/controls/tooltip/tooltip.js +60 -250
  35. package/esm2015/interfaces/ISacConfigurationService.js +1 -1
  36. package/esm2015/public_api.js +3 -2
  37. package/esm2015/services/sac-configuration.service.js +7 -5
  38. package/esm2015/utilities/enums.js +5 -1
  39. package/esm2015/utilities/popuphelper.js +343 -0
  40. package/esm2015/utilities/popuphelper.ngfactory.js +7 -0
  41. package/esm2015/validation/equals.validator.js +14 -0
  42. package/esm2015/validation/equals.validator.ngfactory.js +7 -0
  43. package/esm2015/validation/notequals.validator.js +14 -0
  44. package/esm2015/validation/notequals.validator.ngfactory.js +7 -0
  45. package/esm2015/validation/validation.class.js +30 -6
  46. package/fesm2015/simpleangularcontrols-sac-common.js +1071 -702
  47. package/fesm2015/simpleangularcontrols-sac-common.js.map +1 -1
  48. package/interfaces/ISacConfigurationService.d.ts +4 -0
  49. package/package.json +1 -1
  50. package/public_api.d.ts +2 -1
  51. package/services/sac-configuration.service.d.ts +8 -0
  52. package/simpleangularcontrols-sac-common-10.0.0-rc.12.tgz +0 -0
  53. package/simpleangularcontrols-sac-common.metadata.json +1 -1
  54. package/utilities/enums.d.ts +3 -1
  55. package/utilities/popuphelper.d.ts +83 -0
  56. package/utilities/popuphelper.ngfactory.d.ts +1 -0
  57. package/validation/equals.validator.d.ts +2 -0
  58. package/validation/equals.validator.ngfactory.d.ts +1 -0
  59. package/validation/notequals.validator.d.ts +2 -0
  60. package/validation/notequals.validator.ngfactory.d.ts +1 -0
  61. package/validation/validation.class.d.ts +19 -0
  62. package/simpleangularcontrols-sac-common-10.0.0-rc.11.tgz +0 -0
@@ -1,6 +1,6 @@
1
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
2
  import { Observable, of } from 'rxjs';
3
+ import { NgControl, FormControlName, FormGroupDirective, Validators, FormGroup, NgForm } from '@angular/forms';
4
4
  import { HttpClient } from '@angular/common/http';
5
5
  import moment_, { ISO_8601 } from 'moment';
6
6
  import { MaskedRange } from 'imask';
@@ -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
  */
@@ -1560,8 +1563,6 @@ function createGuid() {
1560
1563
  * Abstract Klasse für SacBaseModelControl. Implements ControlValueAccessor, Validator, OnInit
1561
1564
  */
1562
1565
  class SacBaseModelControl {
1563
- // #endregion Properties
1564
- // #region Constructors
1565
1566
  /**
1566
1567
  * Constructor
1567
1568
  * @param formlayout SacFormLayoutCommon to define scoped layout settings
@@ -1569,11 +1570,13 @@ class SacBaseModelControl {
1569
1570
  */
1570
1571
  constructor(formlayout, injector) {
1571
1572
  this.injector = injector;
1572
- // #region Properties
1573
1573
  /**
1574
1574
  * Inline Errors für das Control
1575
1575
  */
1576
1576
  this._inlineerrorenabled = null;
1577
+ /**
1578
+ * Label Text
1579
+ */
1577
1580
  this._label = '';
1578
1581
  /**
1579
1582
  * Boolean Property dirty; default Wert - false
@@ -1595,6 +1598,10 @@ class SacBaseModelControl {
1595
1598
  * Form layout instance if exists
1596
1599
  */
1597
1600
  this.formlayout = null;
1601
+ /**
1602
+ * ControlHeight enum for use in HTML markup
1603
+ */
1604
+ this.ControlHeight = ControlHeight;
1598
1605
  /**
1599
1606
  * Defines the standard height of the components
1600
1607
  */
@@ -1647,10 +1654,6 @@ class SacBaseModelControl {
1647
1654
  * Name des Controls
1648
1655
  */
1649
1656
  this.name = createGuid();
1650
- /**
1651
- * ControlHeight enum for use in HTML markup
1652
- */
1653
- this.ControlHeight = ControlHeight;
1654
1657
  /**
1655
1658
  * Leere Implementation von "propagateChange". Muss gemacht werden, damit kein Fehler entsteht
1656
1659
  */
@@ -1659,43 +1662,16 @@ class SacBaseModelControl {
1659
1662
  * Leere Implementation von "propagateTouch". Muss gemacht werden, damit kein Fehler entsteht
1660
1663
  */
1661
1664
  this.propagateTouch = () => { };
1665
+ /**
1666
+ * 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!
1667
+ */
1668
+ this.splitlabelandhelptext = null;
1662
1669
  this.formlayout = formlayout;
1663
1670
  this.validationKeyService = injector.get(SACVALIDATIONKEY_SERVICE, new SacDefaultValidationKeyService());
1664
1671
  this.lngResourceService = injector.get(SACLOCALISATION_SERVICE, new SacDefaultLocalisationService(this.validationKeyService));
1665
1672
  this.configurationService = injector.get(SACCONFIGURATION_SERVICE, new SacDefaultConfigurationService());
1666
1673
  this.iconService = injector.get(SACICON_SERVICE, new SacDefaultIconService());
1667
1674
  }
1668
- // #endregion Constructors
1669
- // #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
1675
  /**
1700
1676
  * Get Icon for Helptext Tooltip
1701
1677
  */
@@ -1717,6 +1693,17 @@ class SacBaseModelControl {
1717
1693
  get inlineerrorenabled() {
1718
1694
  return this._inlineerrorenabled;
1719
1695
  }
1696
+ /**
1697
+ * Aktiviert oder Deaktiviert die Inline Errors für das Control
1698
+ */
1699
+ set inlineerrorenabled(value) {
1700
+ if (value === null || value === undefined) {
1701
+ this._inlineerrorenabled = null;
1702
+ }
1703
+ else {
1704
+ this._inlineerrorenabled = convertToBoolean(value);
1705
+ }
1706
+ }
1720
1707
  /**
1721
1708
  * Methode ergibt boolean Wert wenn Form invalid oder nicht invalid ist
1722
1709
  */
@@ -1754,6 +1741,13 @@ class SacBaseModelControl {
1754
1741
  get label() {
1755
1742
  return this._label;
1756
1743
  }
1744
+ /**
1745
+ * Definiert den Label Text
1746
+ */
1747
+ set label(v) {
1748
+ this._label = v;
1749
+ this.UpdateLabelToControl();
1750
+ }
1757
1751
  /**
1758
1752
  * returns an object with all label sizes. These values can then be transferred to corresponding CSS classes using a pipe
1759
1753
  */
@@ -1782,8 +1776,17 @@ class SacBaseModelControl {
1782
1776
  get value() {
1783
1777
  return this._value;
1784
1778
  }
1785
- // #endregion Public Getters And Setters
1786
- // #region Public Methods
1779
+ /**
1780
+ * Set Methode für NgModel Binding in Html Markup
1781
+ * Input wird benötigt, damit der Wert auch über das Markup gesetzt werden kann.
1782
+ */
1783
+ set value(v) {
1784
+ if (this.disabled) {
1785
+ return;
1786
+ }
1787
+ this._value = this.ConvertInputValue(v);
1788
+ this.propagateChange(this._value);
1789
+ }
1787
1790
  /**
1788
1791
  * Methode ergibt Error anhand von gegebenen Kriterien
1789
1792
  */
@@ -1846,6 +1849,8 @@ class SacBaseModelControl {
1846
1849
  this.setIsAdaptiveLabel();
1847
1850
  // set method to display helptext
1848
1851
  this.setHelpTextMode();
1852
+ // set SplitMode for Labels
1853
+ this.setLabelSplitMode();
1849
1854
  this.OnClassInit();
1850
1855
  }
1851
1856
  /**
@@ -1899,8 +1904,6 @@ class SacBaseModelControl {
1899
1904
  writeValue(value) {
1900
1905
  this._value = value;
1901
1906
  }
1902
- // #endregion Public Abstract Methods
1903
- // #region Protected Methods
1904
1907
  /**
1905
1908
  * Method can Overwriten in Parent Classes
1906
1909
  * @param value Wert welcher in den korrekten Typ konvertiert werden soll
@@ -1927,8 +1930,6 @@ class SacBaseModelControl {
1927
1930
  this.ngControl.updateValueAndValidity({ onlySelf: true });
1928
1931
  }
1929
1932
  }
1930
- // #endregion Protected Methods
1931
- // #region Private Methods
1932
1933
  UpdateLabelToControl() {
1933
1934
  // HACK: Add addition property to FormControl. Can be fixed if solution for ticket: https://github.com/angular/angular/issues/19686
1934
1935
  if (this.ngControl) {
@@ -2038,6 +2039,18 @@ class SacBaseModelControl {
2038
2039
  }
2039
2040
  }
2040
2041
  }
2042
+ setLabelSplitMode() {
2043
+ var _a;
2044
+ if (!this.splitlabelandhelptext) {
2045
+ if ((_a = this.formlayout) === null || _a === void 0 ? void 0 : _a.splitlabelandhelptext) {
2046
+ this.splitlabelandhelptext = this.formlayout.splitlabelandhelptext;
2047
+ }
2048
+ else {
2049
+ this.splitlabelandhelptext =
2050
+ this.configurationService.SplitLabelAndHelptext;
2051
+ }
2052
+ }
2053
+ }
2041
2054
  }
2042
2055
  SacBaseModelControl.decorators = [
2043
2056
  { type: Directive }
@@ -2061,6 +2074,7 @@ SacBaseModelControl.propDecorators = {
2061
2074
  labelSizeXs: [{ type: Input }],
2062
2075
  labelSizeXxl: [{ type: Input }],
2063
2076
  name: [{ type: Input }],
2077
+ splitlabelandhelptext: [{ type: Input }],
2064
2078
  inlineerrorenabled: [{ type: Input }],
2065
2079
  label: [{ type: Input }],
2066
2080
  value: [{ type: Input }]
@@ -2168,6 +2182,19 @@ function emailValidator(validationMessage, validationMessageSummary) {
2168
2182
  };
2169
2183
  }
2170
2184
 
2185
+ function equalsValueValidator(requiredvalue, validationMessage, validationMessageSummary) {
2186
+ return (control) => {
2187
+ if (control.value !== requiredvalue) {
2188
+ const parameters = new Map();
2189
+ parameters.set('EQUALSVALUE', requiredvalue);
2190
+ return CreateValidationError('equals', validationMessage, validationMessageSummary, parameters);
2191
+ }
2192
+ else {
2193
+ return null;
2194
+ }
2195
+ };
2196
+ }
2197
+
2171
2198
  // #region Variables
2172
2199
  /**
2173
2200
  * Moment
@@ -2381,6 +2408,19 @@ function multilanguageRequiredAnyValidator(languages, validationMessage, validat
2381
2408
  };
2382
2409
  }
2383
2410
 
2411
+ function notEqualsValueValidator(invalidValue, validationMessage, validationMessageSummary) {
2412
+ return (control) => {
2413
+ if (control.value === invalidValue) {
2414
+ const parameters = new Map();
2415
+ parameters.set('EQUALSVALUE', invalidValue);
2416
+ return CreateValidationError('notequals', validationMessage, validationMessageSummary, parameters);
2417
+ }
2418
+ else {
2419
+ return null;
2420
+ }
2421
+ };
2422
+ }
2423
+
2384
2424
  function patternValidator(pattern, validationMessage, validationMessageSummary) {
2385
2425
  return (control) => {
2386
2426
  const validator = Validators.pattern(pattern);
@@ -2406,15 +2446,10 @@ function requiredValidator(validationMessage, validationMessageSummary) {
2406
2446
  };
2407
2447
  }
2408
2448
 
2409
- /**
2410
- * Moment
2411
- */
2412
- const moment$1 = moment_;
2413
2449
  /**
2414
2450
  * Klasse mit Standard Validatoren
2415
2451
  */
2416
2452
  class Validation {
2417
- // #region Public Static Methods
2418
2453
  /**
2419
2454
  * 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
2455
  * @param errorType Typ den Fehler
@@ -2436,6 +2471,18 @@ class Validation {
2436
2471
  static email(validationMessage, validationMessageSummary) {
2437
2472
  return emailValidator(validationMessage, validationMessageSummary);
2438
2473
  }
2474
+ /**
2475
+ * Validator validate if value is the requiredValue
2476
+ * @param requiredValue Value that control should have
2477
+ * @param control Control to be validate
2478
+ * @param fieldName Label of control
2479
+ * @param validationMessage validation message near the control
2480
+ * @param validationMessageSummary validation inside the validation summary
2481
+
2482
+ */
2483
+ static equals(requiredValue, validationMessage, validationMessageSummary) {
2484
+ return equalsValueValidator(requiredValue, validationMessage, validationMessageSummary);
2485
+ }
2439
2486
  /**
2440
2487
  * Validator der prüft ob der Wert ein Datum ist.
2441
2488
  * @param control Control mit IDateTimeControl Interface implementierung
@@ -2556,6 +2603,17 @@ class Validation {
2556
2603
  static multilanguageRequiredAny(languages, validationMessage, validationMessageSummary) {
2557
2604
  return multilanguageRequiredAnyValidator(languages, validationMessage, validationMessageSummary);
2558
2605
  }
2606
+ /**
2607
+ * Validator validate if value is not the invalidValue
2608
+ * @param invalidValue Value that control doesn't should have
2609
+ * @param control Control to be validate
2610
+ * @param fieldName Label of control
2611
+ * @param validationMessage validation message near the control
2612
+ * @param validationMessageSummary validation inside the validation summary
2613
+ */
2614
+ static notequals(invalidValue, validationMessage, validationMessageSummary) {
2615
+ return notEqualsValueValidator(invalidValue, validationMessage, validationMessageSummary);
2616
+ }
2559
2617
  /**
2560
2618
  * Validierung mit einem RegEx Pattern
2561
2619
  * @param control Control das validiert werden soll.
@@ -2577,7 +2635,11 @@ class Validation {
2577
2635
  static required(validationMessage, validationMessageSummary) {
2578
2636
  return requiredValidator(validationMessage, validationMessageSummary);
2579
2637
  }
2580
- }
2638
+ }
2639
+ /**
2640
+ * Moment
2641
+ */
2642
+ const moment$1 = moment_;
2581
2643
 
2582
2644
  /**
2583
2645
  * Basis Komponente für SacRadiobuttonsCommon. Extends SacBaseModelControl
@@ -2692,62 +2754,67 @@ SacRadiobuttonsCommon.propDecorators = {
2692
2754
  * Basis Komponente für SacRadiobutton.
2693
2755
  */
2694
2756
  class SacRadiobuttonCommon {
2757
+ // #endregion Properties
2758
+ // #region Constructors
2695
2759
  /**
2696
2760
  * Konstruktor
2697
2761
  * @param SacRadioButtons
2762
+ * @param formlayout SacFormLayoutCommon to define scoped layout settings
2763
+ * @param injector Injector for injecting services
2698
2764
  */
2699
- constructor(sacRadioButtons) {
2765
+ constructor(sacRadioButtons, formlayout, injector) {
2700
2766
  this.sacRadioButtons = sacRadioButtons;
2767
+ this.injector = injector;
2768
+ // #region Properties
2701
2769
  /**
2702
- * ControlHeight enum for use in HTML markup
2770
+ * Boolean Property zum Ausblenden des Controls; default Wert - false
2703
2771
  */
2704
- this.ControlHeight = ControlHeight;
2772
+ this._hidden = false;
2705
2773
  /**
2706
- * Output Event
2774
+ * Form layout instance if exists
2707
2775
  */
2708
- this.onselectitem = new EventEmitter();
2776
+ this.formlayout = null;
2709
2777
  /**
2710
- * Boolean Property zum Ausblenden des Controls; default Wert - false
2778
+ * public public public public public public public public public public public public public ControlHeight enum for use in HTML markup
2711
2779
  */
2712
- this._hidden = false;
2780
+ this.ControlHeight = ControlHeight;
2713
2781
  /**
2714
2782
  * Unique Index für RadioButton
2715
2783
  */
2716
2784
  this._index = null;
2785
+ /**
2786
+ * Text to support the user during input.
2787
+ */
2788
+ this.helptext = '';
2789
+ /**
2790
+ * Output Event
2791
+ */
2792
+ this.onselectitem = new EventEmitter();
2793
+ this.formlayout = formlayout;
2794
+ this.configurationService = injector.get(SACCONFIGURATION_SERVICE, new SacDefaultConfigurationService());
2795
+ this.iconService = injector.get(SACICON_SERVICE, new SacDefaultIconService());
2717
2796
  // Registration des Controls in SacRadioButtons Container
2718
2797
  this.sacRadioButtons.RegisterRadioButton(this);
2719
2798
  }
2799
+ // #endregion Constructors
2800
+ // #region Public Getters And Setters
2720
2801
  /**
2721
- * Methode ergibt Boolean, ob Control disabled ist
2802
+ * Get Icon for Helptext Tooltip
2722
2803
  */
2723
- get isDisabled() {
2724
- return this.disabled || this.sacRadioButtons.disabled;
2804
+ get HelptextTooltipIcon() {
2805
+ return this.iconService.GenericHelptextIcon;
2725
2806
  }
2726
2807
  /**
2727
- * Setter für hidden Property
2808
+ * define the control height from parent control
2728
2809
  */
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;
2810
+ get componentHeight() {
2811
+ return this.sacRadioButtons.componentHeight;
2743
2812
  }
2744
2813
  /**
2745
2814
  * Getter für Unique Index
2746
2815
  */
2747
2816
  get getIndex() {
2748
- if (this._index === null &&
2749
- this.sacRadioButtons !== null &&
2750
- this.sacRadioButtons !== undefined) {
2817
+ if (this._index === null && this.sacRadioButtons !== null && this.sacRadioButtons !== undefined) {
2751
2818
  this._index = this.sacRadioButtons.GetRadionButtonIndex();
2752
2819
  }
2753
2820
  return this._index;
@@ -2758,22 +2825,32 @@ class SacRadiobuttonCommon {
2758
2825
  get getName() {
2759
2826
  return this.sacRadioButtons.name;
2760
2827
  }
2828
+ get hidden() {
2829
+ return this._hidden;
2830
+ }
2761
2831
  /**
2762
- * define the control height from parent control
2832
+ * Setter für hidden Property
2763
2833
  */
2764
- get componentHeight() {
2765
- return this.sacRadioButtons.componentHeight;
2834
+ set hidden(v) {
2835
+ if (v === null || v === undefined || typeof v === 'boolean') {
2836
+ this._hidden = v;
2837
+ }
2838
+ else {
2839
+ this._hidden = v === 'true';
2840
+ }
2841
+ // Model Reset falls RadioButton selektiert war
2842
+ if (this._hidden && this.checked) {
2843
+ this.sacRadioButtons.SelectItem(null);
2844
+ }
2766
2845
  }
2767
- //#endregion
2768
- //#region Control Events
2769
2846
  /**
2770
- * Event wenn die Komponente zerstört wird
2847
+ * Methode ergibt Boolean, ob Control disabled ist
2771
2848
  */
2772
- ngOnDestroy() {
2773
- // De-Registration des Controls in SacRadioButtons Container
2774
- this.sacRadioButtons.UnregisterRadioButton(this);
2849
+ get isDisabled() {
2850
+ return this.disabled || this.sacRadioButtons.disabled;
2775
2851
  }
2776
- //#endregion
2852
+ // #endregion Public Getters And Setters
2853
+ // #region Public Methods
2777
2854
  /**
2778
2855
  * Event bei Änderungen
2779
2856
  */
@@ -2783,29 +2860,58 @@ class SacRadiobuttonCommon {
2783
2860
  this.onselectitem.emit();
2784
2861
  }
2785
2862
  }
2863
+ /**
2864
+ * Event wenn die Komponente zerstört wird
2865
+ */
2866
+ ngOnDestroy() {
2867
+ // De-Registration des Controls in SacRadioButtons Container
2868
+ this.sacRadioButtons.UnregisterRadioButton(this);
2869
+ }
2870
+ ngOnInit() {
2871
+ // set method to display helptext
2872
+ this.setHelpTextMode();
2873
+ }
2874
+ // #endregion Public Methods
2875
+ // #region Private Methods
2876
+ /**
2877
+ * Set mode for helptext. Can be tooltip or text
2878
+ */
2879
+ setHelpTextMode() {
2880
+ var _a;
2881
+ if (!this.helptextmode) {
2882
+ if ((_a = this.formlayout) === null || _a === void 0 ? void 0 : _a.helptextmode) {
2883
+ this.helptextmode = this.formlayout.helptextmode;
2884
+ }
2885
+ else {
2886
+ this.helptextmode = this.configurationService.HelptextMode;
2887
+ }
2888
+ }
2889
+ }
2786
2890
  }
2787
2891
  SacRadiobuttonCommon.decorators = [
2788
2892
  { type: Directive }
2789
2893
  ];
2790
2894
  SacRadiobuttonCommon.ctorParameters = () => [
2791
- { type: SacRadiobuttonsCommon }
2895
+ { type: SacRadiobuttonsCommon },
2896
+ { type: SacFormLayoutCommon, decorators: [{ type: Host }] },
2897
+ { type: Injector }
2792
2898
  ];
2793
2899
  SacRadiobuttonCommon.propDecorators = {
2794
- value: [{ type: Input }],
2795
- label: [{ type: Input }],
2796
2900
  checked: [{ type: Input }],
2797
2901
  disabled: [{ type: Input }],
2902
+ helptext: [{ type: Input }],
2903
+ helptextmode: [{ type: Input }],
2904
+ label: [{ type: Input }],
2905
+ labeltemplate: [{ type: Input }],
2798
2906
  onselectitem: [{ type: Output }],
2799
- hidden: [{ type: Input }],
2800
- labeltemplate: [{ type: Input }]
2907
+ value: [{ type: Input }],
2908
+ hidden: [{ type: Input }]
2801
2909
  };
2802
2910
 
2803
2911
  /**
2804
2912
  * Base Komponente für Dialog
2805
2913
  */
2806
2914
  class SacDialogCommon {
2807
- // #endregion
2808
- // #region Constructor
2809
2915
  /**
2810
2916
  * Konstruktor
2811
2917
  * Inject des Formulars
@@ -2822,11 +2928,6 @@ class SacDialogCommon {
2822
2928
  * Die akzeptabel keywordssind: 'small', 'large', 'extralarge', 'medium', ''.
2823
2929
  */
2824
2930
  this._size = '';
2825
- // #region Properties
2826
- /**
2827
- * Input Property. Erhält den Title des Dialog. Default Value: 'Dialog'.
2828
- */
2829
- this.title = 'Dialog';
2830
2931
  /**
2831
2932
  * Das input property akzeptiert boolen Wert. Definiert ob das Dialog darf durch ESC geschlossen werden. Default ist true.
2832
2933
  */
@@ -2835,26 +2936,22 @@ class SacDialogCommon {
2835
2936
  * Das input property akzeptiert boolen Wert. Definiert ob das Dialog darf durch click außerhalb des Dialog-Fenster geschlossen werden. Default ist true.
2836
2937
  */
2837
2938
  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
2939
  /**
2843
2940
  * Steuert ob im Header des Dialogs ein Button angezeigt wird.
2844
2941
  */
2845
2942
  this.closebutton = true;
2846
2943
  /**
2847
- * Input Property. Erhält die Breite des Dialog
2944
+ * Output Emitter. Wird aufgerufen, wenn das Wert des _show property geändert ist - damait das Dialog geöfnet/geschlossen wird.
2848
2945
  */
2849
- this.width = null;
2946
+ this.isvisibleChange = new EventEmitter();
2850
2947
  /**
2851
- * Definiert eine feste Höhe beim Dialog.
2948
+ * Input Property. Erhält den Namen des Dialog - benutzt für das ID. Default Value: ''
2852
2949
  */
2853
- this.height = null;
2950
+ this.name = '';
2854
2951
  /**
2855
- * Output Emitter. Wird aufgerufen, wenn das Wert des _show property geändert ist - damait das Dialog geöfnet/geschlossen wird.
2952
+ * Input Property. Erhält den Title des Dialog. Default Value: 'Dialog'.
2856
2953
  */
2857
- this.isvisibleChange = new EventEmitter();
2954
+ this.title = 'Dialog';
2858
2955
  }
2859
2956
  /**
2860
2957
  * Implementation als Setter, da mit ngIf das Element bei Unsichtbarkeit UNDEFINED ist.
@@ -2863,14 +2960,10 @@ class SacDialogCommon {
2863
2960
  this.dialogElement = content;
2864
2961
  }
2865
2962
  /**
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.
2963
+ * Getter. Ergibt das boolen Wert des _show property
2870
2964
  */
2871
- set size(v) {
2872
- v = v.toLowerCase();
2873
- this._size = v;
2965
+ get isvisible() {
2966
+ return this._show;
2874
2967
  }
2875
2968
  /**
2876
2969
  * Setter. Erhält das boolen Wert des _show property
@@ -2891,77 +2984,40 @@ class SacDialogCommon {
2891
2984
  this._show = v;
2892
2985
  }
2893
2986
  /**
2894
- * Getter. Ergibt das boolen Wert des _show property
2987
+ * Das Input akzeptiert sowohl default size-css-Klassen als auch custom Klassen.
2988
+ * case insensitive.
2989
+ * Die akzeptabel default-size-Klassen sind: 'small', 'large', 'extralarge', 'medium', ''.
2990
+ * Wenn size ist NICHT gesetzt (oder 'medium' oder ''), default ist in medium size: max-width 500px.
2895
2991
  */
2896
- get isvisible() {
2897
- return this._show;
2992
+ set size(v) {
2993
+ this._size = v;
2898
2994
  }
2899
2995
  /**
2900
- * Die Funktion prüft ob es ein default css classe für Size des Dialog durch den size Input gesetzt wurde.
2996
+ * Getter for ChangeDetector.
2901
2997
  */
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;
2998
+ get ChangeDetector() {
2999
+ return this.cdRef;
2922
3000
  }
2923
- // #endregion
2924
3001
  /**
2925
- * Methode wenn Componente entfernt wird
3002
+ * Die Methode setz den Wert des _show property auf false
2926
3003
  */
2927
- ngOnDestroy() {
3004
+ hide() {
2928
3005
  if (this.hasSetBodyTag && document.body.classList.contains('modal-open')) {
2929
3006
  document.body.classList.remove('modal-open');
2930
3007
  this.hasSetBodyTag = false;
2931
3008
  }
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
- }
3009
+ this._show = false;
2944
3010
  this.isvisibleChange.emit(this._show);
2945
3011
  }
2946
3012
  /**
2947
- * Die Methode setz den Wert des _show property auf false
3013
+ * Methode wenn Componente entfernt wird
2948
3014
  */
2949
- hide() {
3015
+ ngOnDestroy() {
2950
3016
  if (this.hasSetBodyTag && document.body.classList.contains('modal-open')) {
2951
3017
  document.body.classList.remove('modal-open');
2952
3018
  this.hasSetBodyTag = false;
2953
3019
  }
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
3020
  }
2963
- // #endregion
2964
- // #region Host Actions
2965
3021
  /**
2966
3022
  * Allow Close by Click outside Dialog
2967
3023
  */
@@ -2983,6 +3039,18 @@ class SacDialogCommon {
2983
3039
  this.hide();
2984
3040
  }
2985
3041
  }
3042
+ /**
3043
+ * Die Methode setz den Wert des _show property auf true
3044
+ */
3045
+ show() {
3046
+ this._show = true;
3047
+ if (!this.hasSetBodyTag &&
3048
+ !document.body.classList.contains('modal-open')) {
3049
+ document.body.classList.add('modal-open');
3050
+ this.hasSetBodyTag = true;
3051
+ }
3052
+ this.isvisibleChange.emit(this._show);
3053
+ }
2986
3054
  }
2987
3055
  SacDialogCommon.decorators = [
2988
3056
  { type: Directive }
@@ -2991,17 +3059,15 @@ SacDialogCommon.ctorParameters = () => [
2991
3059
  { type: ChangeDetectorRef }
2992
3060
  ];
2993
3061
  SacDialogCommon.propDecorators = {
2994
- dialogElementSetter: [{ type: ViewChild, args: ['dialog', { static: false },] }],
2995
- title: [{ type: Input }],
2996
3062
  allowesc: [{ type: Input }],
2997
3063
  backdrop: [{ type: Input }],
2998
- name: [{ type: Input }],
2999
3064
  closebutton: [{ type: Input }],
3000
- width: [{ type: Input }],
3001
- height: [{ type: Input }],
3002
- size: [{ type: Input }],
3003
3065
  isvisibleChange: [{ type: Output }],
3066
+ name: [{ type: Input }],
3067
+ title: [{ type: Input }],
3068
+ dialogElementSetter: [{ type: ViewChild, args: ['dialog', { static: false },] }],
3004
3069
  isvisible: [{ type: Input }],
3070
+ size: [{ type: Input }],
3005
3071
  onClick: [{ type: HostListener, args: ['click', ['$event'],] }],
3006
3072
  onKeydownHandler: [{ type: HostListener, args: ['document:keydown', ['$event'],] }]
3007
3073
  };
@@ -3191,13 +3257,28 @@ SacBaseSelectControl.propDecorators = {
3191
3257
  groupitems: [{ type: Input }]
3192
3258
  };
3193
3259
 
3194
- // #region Classes
3260
+ /**
3261
+ * Function um ein Key Value Pair für das Dropdown zu erzeugen
3262
+ * @param id ID
3263
+ * @param value Wert der an das Element gebunden werden soll
3264
+ */
3265
+ function _buildValueString(id, value) {
3266
+ // Wenn ID null ist Object zurückgeben
3267
+ if (id == null) {
3268
+ return `${value}`;
3269
+ }
3270
+ // Mapping Objekt zu String
3271
+ if (value && typeof value === 'object') {
3272
+ value = 'Object';
3273
+ }
3274
+ // String als ID
3275
+ return `${id}: ${value}`.slice(0, 50);
3276
+ }
3277
+
3195
3278
  /**
3196
3279
  * Base Dropdown Komponente
3197
3280
  */
3198
3281
  class SacDropdownCommon extends SacBaseSelectControl {
3199
- // #endregion Properties
3200
- // #region Constructors
3201
3282
  /**
3202
3283
  * Constructor
3203
3284
  * @param formlayout SacFormLayoutCommon to define scoped layout settings
@@ -3209,11 +3290,18 @@ class SacDropdownCommon extends SacBaseSelectControl {
3209
3290
  super(formlayout, injector);
3210
3291
  this.renderer = renderer;
3211
3292
  this.elementRef = elementRef;
3212
- // #region Properties
3213
3293
  /**
3214
3294
  * compareWith-Funktion
3215
3295
  */
3216
3296
  this._compareWith = Object.is;
3297
+ /**
3298
+ * Counter vom OptionID; default Wert = 0
3299
+ */
3300
+ this._optionIdCounter = 0;
3301
+ /**
3302
+ * OptionMap
3303
+ */
3304
+ this._optionMap = new Map();
3217
3305
  /**
3218
3306
  * Label Text für Empty Item
3219
3307
  */
@@ -3230,17 +3318,7 @@ class SacDropdownCommon extends SacBaseSelectControl {
3230
3318
  * Resource Key für Validation Message Required in Validation Summary
3231
3319
  */
3232
3320
  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
3321
  }
3242
- // #endregion Constructors
3243
- // #region Public Getters And Setters
3244
3322
  /**
3245
3323
  * compareWith-Funktion
3246
3324
  */
@@ -3250,8 +3328,6 @@ class SacDropdownCommon extends SacBaseSelectControl {
3250
3328
  }
3251
3329
  this._compareWith = fn;
3252
3330
  }
3253
- // #endregion Public Getters And Setters
3254
- // #region Public Methods
3255
3331
  /**
3256
3332
  * Registriert das OptionID-Counter als String
3257
3333
  */
@@ -3286,6 +3362,12 @@ class SacDropdownCommon extends SacBaseSelectControl {
3286
3362
  if (this.isrequired) {
3287
3363
  error = Validation.required(this.validationmessagerequired, this.validationmessagesummaryrequired)(c);
3288
3364
  }
3365
+ if (error) {
3366
+ return error;
3367
+ }
3368
+ if (this.isrequired && this.emptyvalue !== null) {
3369
+ error = Validation.notequals(this.emptyvalue, this.validationmessagerequired, this.validationmessagesummaryrequired)(c);
3370
+ }
3289
3371
  return error;
3290
3372
  }
3291
3373
  /**
@@ -3296,8 +3378,6 @@ class SacDropdownCommon extends SacBaseSelectControl {
3296
3378
  this.setSelectedValue(value);
3297
3379
  super.writeValue(value);
3298
3380
  }
3299
- // #endregion Public Methods
3300
- // #region Private Methods
3301
3381
  /**
3302
3382
  * ID extrahieren
3303
3383
  * @param valueString String bei welchem die ID Extrahiert werden soll
@@ -3360,13 +3440,12 @@ SacDropdownCommon.propDecorators = {
3360
3440
  validationmessagerequired: [{ type: Input }],
3361
3441
  validationmessagesummaryrequired: [{ type: Input }],
3362
3442
  comparewith: [{ type: Input }]
3363
- };
3443
+ };
3444
+
3364
3445
  /**
3365
3446
  * SacDropdownOption-Klasse
3366
3447
  */
3367
3448
  class SacDropdownOptionCommon {
3368
- // #endregion Properties
3369
- // #region Constructors
3370
3449
  /**
3371
3450
  * Konstruktor
3372
3451
  * @param _element Referenz auf HTML Element
@@ -3377,7 +3456,6 @@ class SacDropdownOptionCommon {
3377
3456
  this._element = _element;
3378
3457
  this._renderer = _renderer;
3379
3458
  this._dropdown = _dropdown;
3380
- // #region Properties
3381
3459
  /**
3382
3460
  * ID-String
3383
3461
  */
@@ -3386,8 +3464,6 @@ class SacDropdownOptionCommon {
3386
3464
  this.id = this._dropdown.registerOption();
3387
3465
  }
3388
3466
  }
3389
- // #endregion Constructors
3390
- // #region Public Getters And Setters
3391
3467
  /**
3392
3468
  * Option ngValue
3393
3469
  */
@@ -3406,8 +3482,6 @@ class SacDropdownOptionCommon {
3406
3482
  set value(value) {
3407
3483
  this._setElementValue(value);
3408
3484
  }
3409
- // #endregion Public Getters And Setters
3410
- // #region Public Methods
3411
3485
  /**
3412
3486
  * Den Wert vom Option-Element einstellen
3413
3487
  * @param value Wert
@@ -3435,27 +3509,7 @@ SacDropdownOptionCommon.ctorParameters = () => [
3435
3509
  SacDropdownOptionCommon.propDecorators = {
3436
3510
  ngValue: [{ type: Input }],
3437
3511
  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
3512
+ };
3459
3513
 
3460
3514
  // tsco:ignore
3461
3515
  // #endregion Interfaces
@@ -5272,70 +5326,486 @@ SacPagingCommon.propDecorators = {
5272
5326
  };
5273
5327
 
5274
5328
  /**
5275
- * Moment
5276
- */
5277
- const moment$2 = moment_;
5278
- /**
5279
- * Base Klasse für Date/Time Controls
5329
+ * Enum für Tooltip Positionen
5280
5330
  */
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
- /**
5307
- * Resource Key für Validation Message DateTimeFormat bei Control
5308
- */
5309
- this.validationmessagedatetimeformat = this.validationKeyService.ValidationErrorDatetimeFormat;
5310
- /**
5311
- * Resource Key für Validation Message DateTimeFormat in Validation Summary
5312
- */
5313
- this.validationmessagedatetimeformatsummary = this.validationKeyService.ValidationErrorSummaryDatetimeFormat;
5314
- /**
5315
- * Resource Key für Validation Message Required bei Control
5316
- */
5317
- this.validationmessagerequired = this.validationKeyService.ValidationErrorRequired;
5318
- /**
5319
- * Resource Key für Validation Message Required in Validation Summary
5320
- */
5321
- this.validationmessagerequiredsummary = this.validationKeyService.ValidationErrorSummaryRequired;
5331
+ var TooltipPosition;
5332
+ (function (TooltipPosition) {
5333
+ TooltipPosition[TooltipPosition["none"] = 0] = "none";
5334
+ // tslint:disable-next-line:no-bitwise
5335
+ TooltipPosition[TooltipPosition["top"] = 1] = "top";
5336
+ // tslint:disable-next-line:no-bitwise
5337
+ TooltipPosition[TooltipPosition["right"] = 2] = "right";
5338
+ // tslint:disable-next-line:no-bitwise
5339
+ TooltipPosition[TooltipPosition["bottom"] = 4] = "bottom";
5340
+ // tslint:disable-next-line:no-bitwise
5341
+ TooltipPosition[TooltipPosition["left"] = 8] = "left";
5342
+ // tslint:disable-next-line:no-bitwise
5343
+ TooltipPosition[TooltipPosition["topend"] = 16] = "topend";
5344
+ // tslint:disable-next-line:no-bitwise
5345
+ TooltipPosition[TooltipPosition["bottomend"] = 32] = "bottomend";
5346
+ })(TooltipPosition || (TooltipPosition = {}));
5347
+
5348
+ class PopUpHelper {
5349
+ // #region Public Methods
5350
+ getContainerHeight(referenceContainer, referenceIsContainer) {
5351
+ if (referenceContainer) {
5352
+ return referenceIsContainer
5353
+ ? referenceContainer.nativeElement.firstElementChild.clientHeight
5354
+ : referenceContainer.nativeElement.offsetHeight;
5355
+ }
5356
+ else {
5357
+ return 0;
5358
+ }
5322
5359
  }
5323
- // #endregion Constructors
5324
- // #region Public Getters And Setters
5325
- /**
5326
- * Das Input bekommt das value von typ string
5327
- */
5328
- set valuestring(v) {
5329
- this._valueAsString = v;
5330
- let date = moment$2(v, [this.GetDateTimeFormatString()], true);
5331
- date = this.ModifyParsedDateTimeValue(date).utc();
5332
- if (date.isValid()) {
5333
- this.value = date.toDate();
5360
+ getContainerWidth(referenceContainer, referenceIsContainer) {
5361
+ if (referenceContainer) {
5362
+ return referenceIsContainer
5363
+ ? referenceContainer.nativeElement.firstElementChild.clientWidth
5364
+ : referenceContainer.nativeElement.offsetWidth;
5334
5365
  }
5335
5366
  else {
5336
- this.value = null;
5367
+ return 0;
5337
5368
  }
5338
5369
  }
5370
+ /**
5371
+ * Get Position who the popup would be positioned
5372
+ *
5373
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5374
+ * @param popupcontentcontainer Element Reference to container of popup
5375
+ * @param popupOffset Offset for popup positioning
5376
+ * @param allowedPositions Allowed Positions for the popup
5377
+ * @returns Returns the position where the popup should be displayed
5378
+ */
5379
+ getDisplayPosition(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, allowedPositions, referenceIsContainer) {
5380
+ const validPositions = this.validatePositions(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, referenceIsContainer);
5381
+ // tslint:disable-next-line:no-bitwise
5382
+ if (this.hasPosition(allowedPositions, TooltipPosition.right) && validPositions & TooltipPosition.right) {
5383
+ return TooltipPosition.right;
5384
+ }
5385
+ // tslint:disable-next-line:no-bitwise
5386
+ if (this.hasPosition(allowedPositions, TooltipPosition.top) && validPositions & TooltipPosition.top) {
5387
+ return TooltipPosition.top;
5388
+ }
5389
+ // tslint:disable-next-line:no-bitwise
5390
+ if (this.hasPosition(allowedPositions, TooltipPosition.left) && validPositions & TooltipPosition.left) {
5391
+ return TooltipPosition.left;
5392
+ }
5393
+ // tslint:disable-next-line:no-bitwise
5394
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottom) && validPositions & TooltipPosition.bottom) {
5395
+ return TooltipPosition.bottom;
5396
+ }
5397
+ if (this.hasPosition(allowedPositions, TooltipPosition.topend) && validPositions & TooltipPosition.topend) {
5398
+ return TooltipPosition.topend;
5399
+ }
5400
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottomend) &&
5401
+ validPositions & TooltipPosition.bottomend) {
5402
+ return TooltipPosition.bottomend;
5403
+ }
5404
+ // Get Auto Position or Default
5405
+ if (this.isAutoPosition(allowedPositions)) {
5406
+ // tslint:disable-next-line:no-bitwise
5407
+ if (validPositions & TooltipPosition.right) {
5408
+ return TooltipPosition.right;
5409
+ }
5410
+ // tslint:disable-next-line:no-bitwise
5411
+ if (validPositions & TooltipPosition.top) {
5412
+ return TooltipPosition.top;
5413
+ }
5414
+ // tslint:disable-next-line:no-bitwise
5415
+ if (validPositions & TooltipPosition.left) {
5416
+ return TooltipPosition.left;
5417
+ }
5418
+ // tslint:disable-next-line:no-bitwise
5419
+ if (validPositions & TooltipPosition.bottom) {
5420
+ return TooltipPosition.bottom;
5421
+ }
5422
+ return TooltipPosition.right;
5423
+ }
5424
+ else {
5425
+ return this.getPosition(allowedPositions);
5426
+ }
5427
+ }
5428
+ /**
5429
+ * Calculates the height of the popup
5430
+ *
5431
+ * @param container Element Reference to container of popup
5432
+ */
5433
+ getPopupHeight(container) {
5434
+ var _a;
5435
+ if (container) {
5436
+ return (_a = container.nativeElement.firstElementChild.clientHeight) !== null && _a !== void 0 ? _a : 0;
5437
+ }
5438
+ else {
5439
+ return 0;
5440
+ }
5441
+ }
5442
+ /**
5443
+ * Calculates the width of the popup
5444
+ *
5445
+ * @param container Element Reference to container of popup
5446
+ */
5447
+ getPopupWidth(container) {
5448
+ if (container) {
5449
+ return container.nativeElement.firstElementChild.clientWidth;
5450
+ }
5451
+ else {
5452
+ return 0;
5453
+ }
5454
+ }
5455
+ /**
5456
+ * Returns the defined position for the tooltip
5457
+ *
5458
+ * @param allowedPositions Allowed positions defined in markup for popup
5459
+ */
5460
+ getPosition(allowedPositions) {
5461
+ if (this.hasPosition(allowedPositions, TooltipPosition.left)) {
5462
+ return TooltipPosition.left;
5463
+ }
5464
+ if (this.hasPosition(allowedPositions, TooltipPosition.top)) {
5465
+ return TooltipPosition.top;
5466
+ }
5467
+ if (this.hasPosition(allowedPositions, TooltipPosition.right)) {
5468
+ return TooltipPosition.right;
5469
+ }
5470
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottom)) {
5471
+ return TooltipPosition.bottom;
5472
+ }
5473
+ if (this.hasPosition(allowedPositions, TooltipPosition.topend)) {
5474
+ return TooltipPosition.topend;
5475
+ }
5476
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottomend)) {
5477
+ return TooltipPosition.bottomend;
5478
+ }
5479
+ // Default Position if empty
5480
+ return TooltipPosition.right;
5481
+ }
5482
+ /**
5483
+ * Calculates the position of the tooltip from links
5484
+ *
5485
+ * @param controlReference Element Reference to angular component
5486
+ * @param popupContainer Element Reference to container of popup
5487
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5488
+ * @param popupOffset Offset for popup positioning
5489
+ * @param requestedPosition Requested Position by Control
5490
+ */
5491
+ getPositionLeft(referenceContainer, popupContainer, controlReference, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer) {
5492
+ if (referenceContainer !== null && referenceContainer !== undefined) {
5493
+ const item = referenceContainer.nativeElement;
5494
+ if (item.children.length >= 1) {
5495
+ const childItem = referenceIsContainer ? item.firstElementChild : item;
5496
+ const contentPosition = childItem.getBoundingClientRect();
5497
+ switch (this.getDisplayPosition(referenceContainer, popupContainer, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer)) {
5498
+ case TooltipPosition.top:
5499
+ case TooltipPosition.bottom:
5500
+ return (contentPosition.left + contentPosition.width / 2 - this.getPopupWidth(popupContainer) / 2);
5501
+ case TooltipPosition.topend:
5502
+ case TooltipPosition.bottomend:
5503
+ return contentPosition.left + contentPosition.width - this.getPopupWidth(popupContainer);
5504
+ case TooltipPosition.right:
5505
+ return contentPosition.left + contentPosition.width + arrowWidth / 2;
5506
+ case TooltipPosition.left:
5507
+ return contentPosition.left - this.getPopupWidth(popupContainer) + (arrowWidth / 2) * -1;
5508
+ }
5509
+ return referenceContainer.nativeElement.offsetTop;
5510
+ }
5511
+ else {
5512
+ return referenceContainer.nativeElement.offsetTop;
5513
+ }
5514
+ }
5515
+ else {
5516
+ return controlReference.nativeElement.offsetLeft;
5517
+ }
5518
+ }
5519
+ /**
5520
+ * Calculates the position of the tooltip from the top
5521
+ *
5522
+ * @param controlReference Element Reference to angular component
5523
+ * @param popupContainer Element Reference to container of popup
5524
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5525
+ * @param popupOffset Offset for popup positioning
5526
+ * @param requestedPosition Requested Position by Control
5527
+ */
5528
+ getPositionTop(referenceContainer, popupContainer, controlReference, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer) {
5529
+ if (referenceContainer !== null && referenceContainer !== undefined) {
5530
+ const item = referenceContainer.nativeElement;
5531
+ if (item.children.length >= 1) {
5532
+ const childItem = referenceIsContainer ? item.firstElementChild : item;
5533
+ const contentPosition = childItem.getBoundingClientRect();
5534
+ // Get Position with Scroll (Scrollbars inside page should be substracted)
5535
+ const contentPositionTop = childItem.offsetTop +
5536
+ this.getOffsetTopParent(childItem.offsetParent) +
5537
+ this.getScrollTopParent(childItem.parentElement);
5538
+ switch (this.getDisplayPosition(referenceContainer, popupContainer, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer)) {
5539
+ case TooltipPosition.top:
5540
+ case TooltipPosition.topend:
5541
+ return contentPositionTop - this.getPopupHeight(popupContainer) + (arrowHeight / 2) * -1;
5542
+ case TooltipPosition.right:
5543
+ case TooltipPosition.left:
5544
+ return (contentPositionTop + contentPosition.height / 2 - this.getPopupHeight(popupContainer) / 2);
5545
+ case TooltipPosition.bottom:
5546
+ case TooltipPosition.bottomend:
5547
+ return contentPositionTop + contentPosition.height + arrowHeight / 2;
5548
+ }
5549
+ return (childItem.clientTop +
5550
+ childItem.offsetTop -
5551
+ (this.getPopupHeight(popupContainer) / 2 - childItem.offsetHeight / 2));
5552
+ }
5553
+ else {
5554
+ return referenceContainer.nativeElement.offsetTop;
5555
+ }
5556
+ }
5557
+ else {
5558
+ return controlReference.nativeElement.offsetTop;
5559
+ }
5560
+ }
5561
+ /**
5562
+ * Returns whether the position has been configured
5563
+ *
5564
+ * @param allowedPositions Positions that allowed by control
5565
+ * @param requestedPosition Position to be checked
5566
+ */
5567
+ hasPosition(allowedPositions, requestedPosition) {
5568
+ const positions = allowedPositions.split('|');
5569
+ if (requestedPosition === TooltipPosition.right && positions.indexOf('right') >= 0) {
5570
+ return true;
5571
+ }
5572
+ if (requestedPosition === TooltipPosition.top && positions.indexOf('top') >= 0) {
5573
+ return true;
5574
+ }
5575
+ if (requestedPosition === TooltipPosition.left && positions.indexOf('left') >= 0) {
5576
+ return true;
5577
+ }
5578
+ if (requestedPosition === TooltipPosition.bottom && positions.indexOf('bottom') >= 0) {
5579
+ return true;
5580
+ }
5581
+ if (requestedPosition === TooltipPosition.topend && positions.indexOf('topend') >= 0) {
5582
+ return true;
5583
+ }
5584
+ if (requestedPosition === TooltipPosition.bottomend && positions.indexOf('bottomend') >= 0) {
5585
+ return true;
5586
+ }
5587
+ return false;
5588
+ }
5589
+ /**
5590
+ * Defines whether AutoPosition is active
5591
+ * @param positionProperty List of allowed positions
5592
+ */
5593
+ isAutoPosition(positionProperty) {
5594
+ const positions = positionProperty.split('|');
5595
+ return positions.indexOf('auto') >= 0;
5596
+ }
5597
+ /**
5598
+ * Checks whether the position is valid or whether the tooltip on the position has space
5599
+ */
5600
+ validatePositions(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, referenceIsContainer) {
5601
+ // Check if Container is false
5602
+ if (popupcontentcontainer === undefined) {
5603
+ return TooltipPosition.right;
5604
+ }
5605
+ let allowedPositions = TooltipPosition.none;
5606
+ const basePosition = referenceIsContainer
5607
+ ? referenceContainer.nativeElement.firstElementChild.getBoundingClientRect()
5608
+ : referenceContainer.nativeElement.getBoundingClientRect();
5609
+ const tooltipRect = popupcontentcontainer.nativeElement.firstElementChild.getBoundingClientRect();
5610
+ const leftPosOk = basePosition.left - tooltipRect.width + arrowWidth * -1 > 0;
5611
+ const rightPosOk = basePosition.right + tooltipRect.width + arrowWidth < window.innerWidth;
5612
+ const topPosOk = basePosition.top - tooltipRect.height + arrowHeight > 0;
5613
+ const bottomPosOk = basePosition.bottom + tooltipRect.height + arrowHeight < window.innerHeight;
5614
+ const leftHalfPosOk = basePosition.left - tooltipRect.width / 2 > 0;
5615
+ const rightHalfPosOk = basePosition.right + tooltipRect.width / 2 < window.innerWidth;
5616
+ const topHalfPosOk = basePosition.top - tooltipRect.height / 2 > 0;
5617
+ const bottomHalfPosOk = basePosition.bottom + tooltipRect.height / 2 < window.innerHeight;
5618
+ if (leftPosOk && topPosOk) {
5619
+ // tslint:disable-next-line:no-bitwise
5620
+ allowedPositions = allowedPositions | TooltipPosition.topend;
5621
+ }
5622
+ if (leftPosOk && bottomPosOk) {
5623
+ // tslint:disable-next-line:no-bitwise
5624
+ allowedPositions = allowedPositions | TooltipPosition.bottomend;
5625
+ }
5626
+ if (leftPosOk && topHalfPosOk && bottomHalfPosOk) {
5627
+ // tslint:disable-next-line:no-bitwise
5628
+ allowedPositions = allowedPositions | TooltipPosition.left;
5629
+ }
5630
+ if (rightPosOk && topHalfPosOk && bottomHalfPosOk) {
5631
+ // tslint:disable-next-line:no-bitwise
5632
+ allowedPositions = allowedPositions | TooltipPosition.right;
5633
+ }
5634
+ if (topPosOk && leftHalfPosOk && rightHalfPosOk) {
5635
+ // tslint:disable-next-line:no-bitwise
5636
+ allowedPositions = allowedPositions | TooltipPosition.top;
5637
+ }
5638
+ if (bottomPosOk && leftHalfPosOk && rightHalfPosOk) {
5639
+ // tslint:disable-next-line:no-bitwise
5640
+ allowedPositions = allowedPositions | TooltipPosition.bottom;
5641
+ }
5642
+ return allowedPositions;
5643
+ }
5644
+ // #endregion Public Methods
5645
+ // #region Private Methods
5646
+ /**
5647
+ * Calculates the top of the page inside all elements
5648
+ * @param element HTML Element
5649
+ * @returns summarized top value for absolute position
5650
+ */
5651
+ getOffsetTopParent(element) {
5652
+ if (element === null) {
5653
+ return 0;
5654
+ }
5655
+ if (!element.offsetParent) {
5656
+ return element.offsetTop;
5657
+ }
5658
+ const parentValue = this.getOffsetTopParent(element.offsetParent);
5659
+ let offset = element.offsetTop;
5660
+ return parentValue + offset;
5661
+ }
5662
+ /**
5663
+ * Caclulate Scrollbars inside tree
5664
+ * @param element HTML Element
5665
+ * @param [isFixed=false] Invert Scroll Position value when style is fixed to preserve negative values
5666
+ * @returns Scroll top value of element with all childs
5667
+ */
5668
+ getScrollTopParent(element, isFixed = false) {
5669
+ if (element === null) {
5670
+ return 0;
5671
+ }
5672
+ // Body Scroll should not be calculated
5673
+ if (!element.parentElement) {
5674
+ return isFixed ? element.scrollTop : 0;
5675
+ }
5676
+ let isCurrentFixed = false;
5677
+ if (window.getComputedStyle(element).getPropertyValue('position') === 'fixed') {
5678
+ isCurrentFixed = true;
5679
+ }
5680
+ const parentValue = this.getScrollTopParent(element.parentElement, isFixed || isCurrentFixed);
5681
+ if (isFixed) {
5682
+ return parentValue + element.scrollTop;
5683
+ }
5684
+ else {
5685
+ return parentValue + element.scrollTop * -1;
5686
+ }
5687
+ }
5688
+ }
5689
+
5690
+ /**
5691
+ * Base Klasse für Date/Time Controls
5692
+ */
5693
+ class SacBaseDateTimeControl extends SacBaseModelControl {
5694
+ // #endregion Properties
5695
+ // #region Constructors
5696
+ /**
5697
+ * Constructor
5698
+ * @param formlayout SacFormLayoutCommon to define scoped layout settings
5699
+ * @param injector Injector for injecting services
5700
+ * @param elementRef reference to html element
5701
+ */
5702
+ constructor(formlayout, injector, elementRef, cdRef) {
5703
+ super(formlayout, injector);
5704
+ this.elementRef = elementRef;
5705
+ this.cdRef = cdRef;
5706
+ // #region Properties
5707
+ /**
5708
+ * Helper class to display tooltip on correct position
5709
+ */
5710
+ this.popupHelper = new PopUpHelper();
5711
+ /**
5712
+ * das property enthielt das Value als string. Default ist ''
5713
+ */
5714
+ this._valueAsString = '';
5715
+ /**
5716
+ * Property for enum in Angular HTML template
5717
+ */
5718
+ this.TooltipPosition = TooltipPosition;
5719
+ /**
5720
+ * Definiert ob der Date Selector angezeigt wird
5721
+ */
5722
+ this._showselector = false;
5723
+ /**
5724
+ * Definiert das Control als Required
5725
+ */
5726
+ this.isrequired = false;
5727
+ /**
5728
+ * Moment JS Instance
5729
+ */
5730
+ this.moment = moment_;
5731
+ /**
5732
+ * Arrow Item of Picker Element. Required to set the position of arrow correctly
5733
+ */
5734
+ this.pickerPosition = TooltipPosition;
5735
+ /**
5736
+ * TextBox Placeholder
5737
+ */
5738
+ this.placeholder = null;
5739
+ /**
5740
+ * Position of the picker arrow at the left
5741
+ */
5742
+ this.posArrowLeft = null;
5743
+ /**
5744
+ * Position of the picker arrow at the top
5745
+ */
5746
+ this.posArrowTop = null;
5747
+ /**
5748
+ * Position of the picker at the left
5749
+ */
5750
+ this.posPopupLeft = 0;
5751
+ /**
5752
+ * Position of the picker at the top
5753
+ */
5754
+ this.posPopupTop = 0;
5755
+ /**
5756
+ * Position of the datetime picker. Values: left|top|right|bottom|auto
5757
+ *
5758
+ * Value 'auto' can be combined with another value.
5759
+ */
5760
+ this.position = 'bottomend|topend';
5761
+ /**
5762
+ * Resource Key für Validation Message DateTimeFormat bei Control
5763
+ */
5764
+ this.validationmessagedatetimeformat = this.validationKeyService.ValidationErrorDatetimeFormat;
5765
+ /**
5766
+ * Resource Key für Validation Message DateTimeFormat in Validation Summary
5767
+ */
5768
+ this.validationmessagedatetimeformatsummary = this.validationKeyService.ValidationErrorSummaryDatetimeFormat;
5769
+ /**
5770
+ * Resource Key für Validation Message Required bei Control
5771
+ */
5772
+ this.validationmessagerequired = this.validationKeyService.ValidationErrorRequired;
5773
+ /**
5774
+ * Resource Key für Validation Message Required in Validation Summary
5775
+ */
5776
+ this.validationmessagerequiredsummary = this.validationKeyService.ValidationErrorSummaryRequired;
5777
+ // #endregion Protected Methods
5778
+ // #region Private Methods
5779
+ /**
5780
+ * method if content has changed and proportions need to be reset in the UI.
5781
+ */
5782
+ this.onContentChange = () => {
5783
+ // Do nothing if is not visible
5784
+ if (!this._showselector) {
5785
+ return;
5786
+ }
5787
+ setTimeout(() => {
5788
+ this.getPositionLeft();
5789
+ this.getPositionTop();
5790
+ });
5791
+ };
5792
+ }
5793
+ // #endregion Constructors
5794
+ // #region Public Getters And Setters
5795
+ /**
5796
+ * Setter for the name of the container for the tooltip. Is required as the tooltip can be hidden via ngIf.
5797
+ */
5798
+ set picker(picker) {
5799
+ if (picker !== undefined) {
5800
+ document.body.appendChild(picker.nativeElement);
5801
+ }
5802
+ this.pickercontainer = picker;
5803
+ this.onContentChange();
5804
+ this.cdRef.detectChanges();
5805
+ }
5806
+ get tooltop() {
5807
+ return this.pickercontainer;
5808
+ }
5339
5809
  /**
5340
5810
  * getter für valuestring
5341
5811
  */
@@ -5344,12 +5814,30 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5344
5814
  return this._valueAsString;
5345
5815
  }
5346
5816
  else {
5347
- const date = moment$2.utc(this.value);
5817
+ const date = this.moment.utc(this.value);
5348
5818
  return date.local().format(this.GetDateTimeFormatString());
5349
5819
  }
5350
5820
  }
5351
- // #endregion Public Getters And Setters
5352
- // #region Public Methods
5821
+ /**
5822
+ * Das Input bekommt das value von typ string
5823
+ */
5824
+ set valuestring(v) {
5825
+ this._valueAsString = v;
5826
+ let date = this.moment(v, [this.GetDateTimeFormatString()], true);
5827
+ date = this.ModifyParsedDateTimeValue(date).utc();
5828
+ if (date.isValid()) {
5829
+ this.value = date.toDate();
5830
+ }
5831
+ else {
5832
+ this.value = null;
5833
+ }
5834
+ }
5835
+ /**
5836
+ * Returns the position of the tooltip
5837
+ */
5838
+ GetPickerPosition() {
5839
+ return this.popupHelper.getDisplayPosition(this.pickerbutton, this.pickercontainer, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5840
+ }
5353
5841
  /**
5354
5842
  * JSON Date String in ein UTC DateTime Object konvertieren, welches vom Control verwendete werden kann
5355
5843
  */
@@ -5361,14 +5849,37 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5361
5849
  const hours = date.getUTCHours();
5362
5850
  const minutes = date.getUTCMinutes();
5363
5851
  const seconds = date.getUTCSeconds();
5364
- return moment$2(Date.UTC(year, month, day, hours, minutes, seconds));
5852
+ return this.moment(Date.UTC(year, month, day, hours, minutes, seconds));
5853
+ }
5854
+ /**
5855
+ * Calculates the height of the tooltip
5856
+ */
5857
+ getPickerHeight() {
5858
+ return this.popupHelper.getPopupHeight(this.pickercontainer);
5859
+ }
5860
+ /**
5861
+ * Calculates the width of the picker
5862
+ */
5863
+ getPickerWidth() {
5864
+ return this.popupHelper.getPopupWidth(this.pickercontainer);
5865
+ }
5866
+ ngDoCheck() {
5867
+ // this.onContentChange();
5868
+ }
5869
+ ngOnDestroy() {
5870
+ // Unregister Event Listener
5871
+ window.removeEventListener('scroll', this.onContentChange, true);
5872
+ window.removeEventListener('resize', this.onContentChange, true);
5365
5873
  }
5366
5874
  /**
5367
5875
  * Init Event
5368
5876
  */
5369
- ngAfterViewInit() {
5370
- super.ngAfterViewInit();
5371
- this.SetDateTimeFormat();
5877
+ ngOnInit() {
5878
+ super.ngOnInit();
5879
+ this.setDateTimeFormat();
5880
+ // Register Event Listener
5881
+ window.addEventListener('scroll', this.onContentChange, true);
5882
+ window.addEventListener('resize', this.onContentChange, true);
5372
5883
  }
5373
5884
  /**
5374
5885
  * setzt das value von typ string zu property valuestring
@@ -5402,13 +5913,59 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5402
5913
  }
5403
5914
  super.writeValue(this._value);
5404
5915
  }
5405
- // #endregion Public Abstract Methods
5406
- // #region Private Methods
5407
- SetDateTimeFormat() {
5916
+ // #endregion Public Methods
5917
+ // #region Protected Methods
5918
+ getArrowHeight() {
5919
+ return this.pickerarrow ? this.pickerarrow.nativeElement.offsetHeight : 0;
5920
+ }
5921
+ getArrowWidth() {
5922
+ return this.pickerarrow ? this.pickerarrow.nativeElement.offsetWidth : 0;
5923
+ }
5924
+ /**
5925
+ * Calculates the position of the tooltip from links
5926
+ */
5927
+ getPositionLeft() {
5928
+ const value = this.popupHelper.getPositionLeft(this.pickerbutton, this.pickercontainer, this.elementRef, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5929
+ this.posPopupLeft = value;
5930
+ switch (this.GetPickerPosition()) {
5931
+ case TooltipPosition.top:
5932
+ case TooltipPosition.bottom:
5933
+ this.posArrowLeft = this.getPickerWidth() / 2 - -this.getArrowWidth();
5934
+ break;
5935
+ case TooltipPosition.topend:
5936
+ case TooltipPosition.bottomend:
5937
+ this.posArrowLeft =
5938
+ this.getPickerWidth() -
5939
+ this.getArrowWidth() / 2 -
5940
+ this.popupHelper.getContainerWidth(this.pickerbutton, false) / 2;
5941
+ break;
5942
+ default:
5943
+ this.posArrowLeft = null;
5944
+ break;
5945
+ }
5946
+ return value;
5947
+ }
5948
+ /**
5949
+ * Calculates the position of the tooltip from the top
5950
+ */
5951
+ getPositionTop() {
5952
+ const value = this.popupHelper.getPositionTop(this.pickerbutton, this.pickercontainer, this.elementRef, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5953
+ this.posPopupTop = value;
5954
+ switch (this.GetPickerPosition()) {
5955
+ case TooltipPosition.left:
5956
+ case TooltipPosition.right:
5957
+ this.posArrowTop = this.getPickerHeight() / 2 - 6.5;
5958
+ break;
5959
+ default:
5960
+ this.posArrowTop = null;
5961
+ break;
5962
+ }
5963
+ return value;
5964
+ }
5965
+ setDateTimeFormat() {
5408
5966
  // HACK: Add addition property to FormControl. Can be fixed if solution for ticket: https://github.com/angular/angular/issues/19686
5409
5967
  if (this.ngControl) {
5410
- this.ngControl.datetimeformatstring =
5411
- this.GetDateTimeFormatString();
5968
+ this.ngControl.datetimeformatstring = this.GetDateTimeFormatString();
5412
5969
  }
5413
5970
  }
5414
5971
  }
@@ -5418,22 +5975,23 @@ SacBaseDateTimeControl.decorators = [
5418
5975
  SacBaseDateTimeControl.ctorParameters = () => [
5419
5976
  { type: SacFormLayoutCommon },
5420
5977
  { type: Injector },
5421
- { type: ElementRef }
5978
+ { type: ElementRef },
5979
+ { type: ChangeDetectorRef }
5422
5980
  ];
5423
5981
  SacBaseDateTimeControl.propDecorators = {
5424
5982
  isrequired: [{ type: Input }],
5983
+ pickerarrow: [{ type: ViewChild, args: ['pickerarrow', { static: false },] }],
5984
+ pickerbutton: [{ type: ViewChild, args: ['pickerbutton', { static: true },] }],
5425
5985
  placeholder: [{ type: Input }],
5986
+ position: [{ type: Input }],
5426
5987
  validationmessagedatetimeformat: [{ type: Input }],
5427
5988
  validationmessagedatetimeformatsummary: [{ type: Input }],
5428
5989
  validationmessagerequired: [{ type: Input }],
5429
5990
  validationmessagerequiredsummary: [{ type: Input }],
5991
+ picker: [{ type: ViewChild, args: ['picker', { static: false },] }],
5430
5992
  valuestring: [{ type: Input }]
5431
5993
  };
5432
5994
 
5433
- /**
5434
- * Moment
5435
- */
5436
- const moment$3 = moment_;
5437
5995
  /**
5438
5996
  * Komponente für SacDateCommon. Extends SacBaseDateTimeControl
5439
5997
  */
@@ -5445,9 +6003,10 @@ class SacDateCommon extends SacBaseDateTimeControl {
5445
6003
  * @param formlayout SacFormLayoutCommon to define scoped layout settings
5446
6004
  * @param injector Injector for injecting services
5447
6005
  * @param elementRef reference to html element
6006
+ * @param cdRef Change Dectection Servie
5448
6007
  */
5449
- constructor(formlayout, injector, elementRef) {
5450
- super(formlayout, injector, elementRef);
6008
+ constructor(formlayout, injector, elementRef, cdRef) {
6009
+ super(formlayout, injector, elementRef, cdRef);
5451
6010
  this.elementRef = elementRef;
5452
6011
  // #region Properties
5453
6012
  /**
@@ -5483,6 +6042,18 @@ class SacDateCommon extends SacBaseDateTimeControl {
5483
6042
  lazy: false,
5484
6043
  overwrite: true,
5485
6044
  };
6045
+ /**
6046
+ * Min Date
6047
+ */
6048
+ this._maxdate = null;
6049
+ /**
6050
+ * Min Date
6051
+ */
6052
+ this._mindate = null;
6053
+ /**
6054
+ * Moment JS module instance
6055
+ */
6056
+ this.moment = moment_;
5486
6057
  /**
5487
6058
  * Resource Key für Validation Message MaxDate bei Control
5488
6059
  */
@@ -5499,26 +6070,20 @@ class SacDateCommon extends SacBaseDateTimeControl {
5499
6070
  * Resource Key für Validation Message MinDate in Validation Summary
5500
6071
  */
5501
6072
  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
6073
  }
5515
6074
  // #endregion Constructors
5516
6075
  // #region Public Getters And Setters
6076
+ /**
6077
+ * icon for date selector button
6078
+ */
6079
+ get IconSelector() {
6080
+ return this.iconService.DateComponentSelectorIcon;
6081
+ }
5517
6082
  /**
5518
6083
  * Min Date
5519
6084
  */
5520
6085
  set maxdate(v) {
5521
- const date = moment$3(v, [this.DATEFORMAT], true);
6086
+ const date = this.moment(v, [this.DATEFORMAT], true);
5522
6087
  if (date.isValid()) {
5523
6088
  this._maxdate = super.getDate(date).toDate();
5524
6089
  }
@@ -5530,7 +6095,7 @@ class SacDateCommon extends SacBaseDateTimeControl {
5530
6095
  * Min Date
5531
6096
  */
5532
6097
  set mindate(v) {
5533
- const date = moment$3(v, [this.DATEFORMAT], true);
6098
+ const date = this.moment(v, [this.DATEFORMAT], true);
5534
6099
  if (date.isValid()) {
5535
6100
  this._mindate = super.getDate(date).toDate();
5536
6101
  }
@@ -5538,23 +6103,8 @@ class SacDateCommon extends SacBaseDateTimeControl {
5538
6103
  this._mindate = null;
5539
6104
  }
5540
6105
  }
5541
- /**
5542
- * icon for date selector button
5543
- */
5544
- get IconSelector() {
5545
- return this.iconService.DateComponentSelectorIcon;
5546
- }
5547
6106
  // #endregion Public Getters And Setters
5548
6107
  // #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
6108
  /**
5559
6109
  * Methode ergibt Datum-Format vom String
5560
6110
  */
@@ -5575,10 +6125,23 @@ class SacDateCommon extends SacBaseDateTimeControl {
5575
6125
  this.setValueString('');
5576
6126
  }
5577
6127
  else {
5578
- this.value = moment$3(v.date).utc().toDate();
6128
+ this.value = this.moment(v.date).utc().toDate();
5579
6129
  }
5580
6130
  this._showselector = false;
5581
6131
  }
6132
+ /**
6133
+ * HostListener
6134
+ */
6135
+ onClick(targetElement) {
6136
+ if (!this.pickercontainer) {
6137
+ return;
6138
+ }
6139
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
6140
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
6141
+ if (!clickedInsideContainer && !clickedInsideReference) {
6142
+ this._showselector = false;
6143
+ }
6144
+ }
5582
6145
  /**
5583
6146
  * Zeigt Date Selector an
5584
6147
  */
@@ -5623,7 +6186,8 @@ SacDateCommon.decorators = [
5623
6186
  SacDateCommon.ctorParameters = () => [
5624
6187
  { type: SacFormLayoutCommon },
5625
6188
  { type: Injector },
5626
- { type: ElementRef }
6189
+ { type: ElementRef },
6190
+ { type: ChangeDetectorRef }
5627
6191
  ];
5628
6192
  SacDateCommon.propDecorators = {
5629
6193
  validationmessagemaxdate: [{ type: Input }],
@@ -5751,11 +6315,11 @@ class SacDateSelectorCommon {
5751
6315
  this._initialValue = null;
5752
6316
  }
5753
6317
  else {
5754
- this._initialValue = moment$4(v);
6318
+ this._initialValue = moment$2(v);
5755
6319
  }
5756
6320
  this._selectedValue = null;
5757
6321
  if (this._initialValue === null) {
5758
- this.initCalendar(moment$4());
6322
+ this.initCalendar(moment$2());
5759
6323
  }
5760
6324
  else {
5761
6325
  this.initCalendar(this._initialValue);
@@ -5889,7 +6453,7 @@ class SacDateSelectorCommon {
5889
6453
  .forEach((itm) => (itm.isselected = false)));
5890
6454
  v.isnew = true;
5891
6455
  v.isselected = true;
5892
- const dateValue = moment$4(v.date);
6456
+ const dateValue = moment$2(v.date);
5893
6457
  // Übernehmen der Zeit aus dem bestehenden Wert
5894
6458
  if (this._selectedValue === null) {
5895
6459
  if (this._initialValue !== null) {
@@ -5944,7 +6508,7 @@ class SacDateSelectorCommon {
5944
6508
  * Auswahl auf aktuelle Zeit stellen
5945
6509
  */
5946
6510
  setToday() {
5947
- this._selectedValue = moment$4();
6511
+ this._selectedValue = moment$2();
5948
6512
  /**
5949
6513
  * Sekunden un Milisekunden Clean
5950
6514
  */
@@ -5980,20 +6544,20 @@ class SacDateSelectorCommon {
5980
6544
  * Initial Datum
5981
6545
  */
5982
6546
  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));
6547
+ const currentMonth = moment$2(new Date(this.year, this.month, 1));
6548
+ const lastMonth = moment$2(new Date(this.year, this.month, 1));
5985
6549
  lastMonth.add({ months: -1 });
5986
- const nextMonths = moment$4(new Date(this.year, this.month, 1));
6550
+ const nextMonths = moment$2(new Date(this.year, this.month, 1));
5987
6551
  nextMonths.add({ months: 1 });
5988
6552
  const weekdayBegin = currentMonth.weekday();
5989
- const weekdayEnd = moment$4(new Date(currentMonth.year(), currentMonth.month(), currentMonth.daysInMonth())).weekday();
6553
+ const weekdayEnd = moment$2(new Date(currentMonth.year(), currentMonth.month(), currentMonth.daysInMonth())).weekday();
5990
6554
  // Clear Array
5991
6555
  const daysInCalendar = [];
5992
6556
  this.dates = [];
5993
6557
  if (weekdayBegin !== this.beginOfCalendar) {
5994
6558
  const lastMonthDay = lastMonth.daysInMonth();
5995
6559
  const lastMonthDate = new Date(lastMonth.year(), lastMonth.month(), lastMonthDay);
5996
- const lastMonthWeekday = moment$4(lastMonthDate).weekday();
6560
+ const lastMonthWeekday = moment$2(lastMonthDate).weekday();
5997
6561
  let daysInLastMonth = 7 - ((7 + this.beginOfCalendar - lastMonthWeekday) % 7);
5998
6562
  if (daysInLastMonth === 7) {
5999
6563
  daysInLastMonth = 0;
@@ -6006,9 +6570,9 @@ class SacDateSelectorCommon {
6006
6570
  for (let dayinmonth = 1; dayinmonth <= currentMonth.daysInMonth(); dayinmonth++) {
6007
6571
  let isSelectedDate = false;
6008
6572
  let isNewDate = false;
6009
- const isCurrentDate = moment$4().month() === this.month &&
6010
- moment$4().year() === this.year &&
6011
- moment$4().date() === dayinmonth;
6573
+ const isCurrentDate = moment$2().month() === this.month &&
6574
+ moment$2().year() === this.year &&
6575
+ moment$2().date() === dayinmonth;
6012
6576
  // Initial Wert setzen, falls vorhanden
6013
6577
  if (this._initialValue !== null) {
6014
6578
  isSelectedDate =
@@ -6023,7 +6587,7 @@ class SacDateSelectorCommon {
6023
6587
  this._selectedValue.year() === this.year &&
6024
6588
  this._selectedValue.date() === dayinmonth;
6025
6589
  }
6026
- daysInCalendar.push(new DateSelectorItem(dayinmonth.toString(), moment$4([this.year, this.month, dayinmonth]).toDate(), true, isSelectedDate, isCurrentDate, isNewDate));
6590
+ daysInCalendar.push(new DateSelectorItem(dayinmonth.toString(), moment$2([this.year, this.month, dayinmonth]).toDate(), true, isSelectedDate, isCurrentDate, isNewDate));
6027
6591
  }
6028
6592
  let endOfCalender;
6029
6593
  if (this.beginOfCalendar === 0) {
@@ -6059,7 +6623,7 @@ class SacDateSelectorCommon {
6059
6623
  */
6060
6624
  if (this._selectedValue === null) {
6061
6625
  if (this._initialValue === null) {
6062
- this._selectedValue = moment$4();
6626
+ this._selectedValue = moment$2();
6063
6627
  }
6064
6628
  else {
6065
6629
  this._selectedValue = this._initialValue;
@@ -6087,13 +6651,9 @@ SacDateSelectorCommon.propDecorators = {
6087
6651
  /**
6088
6652
  * Moment
6089
6653
  */
6090
- const moment$4 = moment_;
6654
+ const moment$2 = moment_;
6091
6655
  // #endregion Variables
6092
6656
 
6093
- /**
6094
- * Moment
6095
- */
6096
- const moment$5 = moment_;
6097
6657
  /**
6098
6658
  * Komponente für SacDateTimeCommon. Extends SacBaseDateTimeControl
6099
6659
  */
@@ -6106,8 +6666,8 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6106
6666
  * @param injector Injector for injecting services
6107
6667
  * @param elementRef reference to html element
6108
6668
  */
6109
- constructor(formlayout, injector, elementRef) {
6110
- super(formlayout, injector, elementRef);
6669
+ constructor(formlayout, injector, elementRef, cdRef) {
6670
+ super(formlayout, injector, elementRef, cdRef);
6111
6671
  this.elementRef = elementRef;
6112
6672
  // #region Properties
6113
6673
  /**
@@ -6158,6 +6718,18 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6158
6718
  lazy: false,
6159
6719
  overwrite: true,
6160
6720
  };
6721
+ /**
6722
+ * Maximaler Wert des Datums
6723
+ */
6724
+ this._maxdate = null;
6725
+ /**
6726
+ * Minimaler Wert des Datums
6727
+ */
6728
+ this._mindate = null;
6729
+ /**
6730
+ * Moment JS module instance
6731
+ */
6732
+ this.moment = moment_;
6161
6733
  /**
6162
6734
  * Resource Key für Validation Message MaxDate bei Control
6163
6735
  */
@@ -6174,26 +6746,20 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6174
6746
  * Resource Key für Validation Message MinDate in Validation Summary
6175
6747
  */
6176
6748
  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
6749
  }
6190
6750
  // #endregion Constructors
6191
6751
  // #region Public Getters And Setters
6752
+ /**
6753
+ * icon for date selector button
6754
+ */
6755
+ get IconSelector() {
6756
+ return this.iconService.DateTimeComponentSelectorIcon;
6757
+ }
6192
6758
  /**
6193
6759
  * Max Date
6194
6760
  */
6195
6761
  set maxdate(v) {
6196
- const date = moment$5(v, [this.DATEFORMAT], true);
6762
+ const date = this.moment(v, [this.DATEFORMAT], true);
6197
6763
  if (date.isValid()) {
6198
6764
  this._maxdate = super.getDate(date).toDate();
6199
6765
  }
@@ -6205,7 +6771,7 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6205
6771
  * Min Date
6206
6772
  */
6207
6773
  set mindate(v) {
6208
- const date = moment$5(v, [this.DATEFORMAT], true);
6774
+ const date = this.moment(v, [this.DATEFORMAT], true);
6209
6775
  if (date.isValid()) {
6210
6776
  this._mindate = super.getDate(date).toDate();
6211
6777
  }
@@ -6213,23 +6779,8 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6213
6779
  this._mindate = null;
6214
6780
  }
6215
6781
  }
6216
- /**
6217
- * icon for date selector button
6218
- */
6219
- get IconSelector() {
6220
- return this.iconService.DateTimeComponentSelectorIcon;
6221
- }
6222
6782
  // #endregion Public Getters And Setters
6223
6783
  // #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
6784
  /**
6234
6785
  * Methode ergibt Datum-Format vom String
6235
6786
  */
@@ -6250,10 +6801,23 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6250
6801
  this.setValueString('');
6251
6802
  }
6252
6803
  else {
6253
- this.value = moment$5(v.date).utc().toDate();
6804
+ this.value = this.moment(v.date).utc().toDate();
6254
6805
  }
6255
6806
  this._showselector = false;
6256
6807
  }
6808
+ /**
6809
+ * HostListener
6810
+ */
6811
+ onClick(targetElement) {
6812
+ if (!this.pickercontainer) {
6813
+ return;
6814
+ }
6815
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
6816
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
6817
+ if (!clickedInsideContainer && !clickedInsideReference) {
6818
+ this._showselector = false;
6819
+ }
6820
+ }
6257
6821
  /**
6258
6822
  * DateSelector wird beim Click-Event angezeigt
6259
6823
  */
@@ -6300,7 +6864,8 @@ SacDateTimeCommon.decorators = [
6300
6864
  SacDateTimeCommon.ctorParameters = () => [
6301
6865
  { type: SacFormLayoutCommon },
6302
6866
  { type: Injector },
6303
- { type: ElementRef }
6867
+ { type: ElementRef },
6868
+ { type: ChangeDetectorRef }
6304
6869
  ];
6305
6870
  SacDateTimeCommon.propDecorators = {
6306
6871
  validationmessagemaxdate: [{ type: Input }],
@@ -6312,10 +6877,6 @@ SacDateTimeCommon.propDecorators = {
6312
6877
  onClick: [{ type: HostListener, args: ['document:click', ['$event.target'],] }]
6313
6878
  };
6314
6879
 
6315
- /**
6316
- * Moment
6317
- */
6318
- const moment$6 = moment_;
6319
6880
  /**
6320
6881
  * Komponente für SacTimeCommon. Extends SacBaseDateTimeControl
6321
6882
  */
@@ -6328,8 +6889,8 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6328
6889
  * @param injector Injector for injecting services
6329
6890
  * @param elementRef reference to html element
6330
6891
  */
6331
- constructor(formlayout, injector, elementRef) {
6332
- super(formlayout, injector, elementRef);
6892
+ constructor(formlayout, injector, elementRef, cdRef) {
6893
+ super(formlayout, injector, elementRef, cdRef);
6333
6894
  this.elementRef = elementRef;
6334
6895
  // #region Properties
6335
6896
  /**
@@ -6360,6 +6921,18 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6360
6921
  lazy: false,
6361
6922
  overwrite: true,
6362
6923
  };
6924
+ /**
6925
+ * Max Time
6926
+ */
6927
+ this._maxtime = null;
6928
+ /**
6929
+ * Min Time
6930
+ */
6931
+ this._mintime = null;
6932
+ /**
6933
+ * Moment JS module instance
6934
+ */
6935
+ this.moment = moment_;
6363
6936
  /**
6364
6937
  * Resource Key für Validation Message MinTime bei Control
6365
6938
  */
@@ -6376,26 +6949,20 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6376
6949
  * Resource Key für Validation Message MinTime in Validation Summary
6377
6950
  */
6378
6951
  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
6952
  }
6392
6953
  // #endregion Constructors
6393
6954
  // #region Public Getters And Setters
6955
+ /**
6956
+ * icon for date selector button
6957
+ */
6958
+ get IconSelector() {
6959
+ return this.iconService.TimeComponentSelectorIcon;
6960
+ }
6394
6961
  /**
6395
6962
  * Max Time
6396
6963
  */
6397
6964
  set maxtime(v) {
6398
- let time = moment$6(v, [this.TIMEFORMAT], true);
6965
+ let time = this.moment(v, [this.TIMEFORMAT], true);
6399
6966
  time = this.ModifyParsedDateTimeValue(time);
6400
6967
  if (time.isValid()) {
6401
6968
  this._maxtime = super.getDate(time).toDate();
@@ -6408,32 +6975,17 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6408
6975
  * Min Time
6409
6976
  */
6410
6977
  set mintime(v) {
6411
- let time = moment$6(v, [this.TIMEFORMAT], true);
6978
+ let time = this.moment(v, [this.TIMEFORMAT], true);
6412
6979
  time = this.ModifyParsedDateTimeValue(time);
6413
6980
  if (time.isValid()) {
6414
- this._mintime = super.getDate(time).toDate();
6415
- }
6416
- else {
6417
- this._mintime = null;
6418
- }
6419
- }
6420
- /**
6421
- * icon for date selector button
6422
- */
6423
- get IconSelector() {
6424
- return this.iconService.TimeComponentSelectorIcon;
6425
- }
6426
- // #endregion Public Getters And Setters
6427
- // #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;
6981
+ this._mintime = super.getDate(time).toDate();
6982
+ }
6983
+ else {
6984
+ this._mintime = null;
6435
6985
  }
6436
6986
  }
6987
+ // #endregion Public Getters And Setters
6988
+ // #region Public Methods
6437
6989
  /**
6438
6990
  * Methode ergibt Datum-Format vom String
6439
6991
  */
@@ -6449,6 +7001,19 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6449
7001
  v.year(1900);
6450
7002
  return v;
6451
7003
  }
7004
+ /**
7005
+ * HostListener
7006
+ */
7007
+ onClick(targetElement) {
7008
+ if (!this.pickercontainer) {
7009
+ return;
7010
+ }
7011
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
7012
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
7013
+ if (!clickedInsideContainer && !clickedInsideReference) {
7014
+ this._showselector = false;
7015
+ }
7016
+ }
6452
7017
  /**
6453
7018
  * Zeigt Date Selector an
6454
7019
  */
@@ -6470,7 +7035,7 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6470
7035
  this.setValueString('');
6471
7036
  }
6472
7037
  else {
6473
- this.value = moment$6(v.date).utc().toDate();
7038
+ this.value = this.moment(v.date).utc().toDate();
6474
7039
  }
6475
7040
  this._showselector = false;
6476
7041
  }
@@ -6505,7 +7070,8 @@ SacTimeCommon.decorators = [
6505
7070
  SacTimeCommon.ctorParameters = () => [
6506
7071
  { type: SacFormLayoutCommon },
6507
7072
  { type: Injector },
6508
- { type: ElementRef }
7073
+ { type: ElementRef },
7074
+ { type: ChangeDetectorRef }
6509
7075
  ];
6510
7076
  SacTimeCommon.propDecorators = {
6511
7077
  validationmessagemaxtime: [{ type: Input }],
@@ -6528,6 +7094,14 @@ class SacStaticFormContainerCommon extends SacBaseModelControl {
6528
7094
  * Definiert den Container als Required Form Item
6529
7095
  */
6530
7096
  this._isrequired = false;
7097
+ /**
7098
+ * Error message to be displayed
7099
+ */
7100
+ this.errormessage = '';
7101
+ /**
7102
+ * Activates the error message on the container control
7103
+ */
7104
+ this.isinvalid = false;
6531
7105
  // #endregion Public Methods
6532
7106
  }
6533
7107
  // #endregion Properties
@@ -6535,14 +7109,14 @@ class SacStaticFormContainerCommon extends SacBaseModelControl {
6535
7109
  /**
6536
7110
  * Definiert den Container als Required Form Item
6537
7111
  */
6538
- set isrequired(v) {
6539
- this._isrequired = convertToBoolean(v);
7112
+ get isrequired() {
7113
+ return this._isrequired;
6540
7114
  }
6541
7115
  /**
6542
7116
  * Definiert den Container als Required Form Item
6543
7117
  */
6544
- get isrequired() {
6545
- return this._isrequired;
7118
+ set isrequired(v) {
7119
+ this._isrequired = convertToBoolean(v);
6546
7120
  }
6547
7121
  // #endregion Public Getters And Setters
6548
7122
  // #region Public Methods
@@ -6562,6 +7136,8 @@ SacStaticFormContainerCommon.decorators = [
6562
7136
  { type: Directive }
6563
7137
  ];
6564
7138
  SacStaticFormContainerCommon.propDecorators = {
7139
+ errormessage: [{ type: Input }],
7140
+ isinvalid: [{ type: Input }],
6565
7141
  isrequired: [{ type: Input }]
6566
7142
  };
6567
7143
 
@@ -7398,22 +7974,6 @@ SacTreeViewChildCommon.decorators = [
7398
7974
  { type: Directive }
7399
7975
  ];
7400
7976
 
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
7977
  /**
7418
7978
  * Tooltip Component
7419
7979
  *
@@ -7435,29 +7995,15 @@ class SacTooltipCommon {
7435
7995
  constructor(cdRef, ref) {
7436
7996
  this.cdRef = cdRef;
7437
7997
  this.ref = ref;
7998
+ // #region Properties
7438
7999
  /**
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.
8000
+ * Helper class to display tooltip on correct position
7444
8001
  */
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
- };
8002
+ this.popupHelper = new PopUpHelper();
7455
8003
  /**
7456
- * Position of the tooltip. Values: left|top|right|bottom|auto
7457
- *
7458
- * Value 'auto' can be combined with another value.
8004
+ * Defines whether the tooltip is visible
7459
8005
  */
7460
- this.position = 'right|auto';
8006
+ this._isTooltipVisible = false;
7461
8007
  /**
7462
8008
  * Position of the tooltip on the left
7463
8009
  */
@@ -7474,9 +8020,42 @@ class SacTooltipCommon {
7474
8020
  * Position of the tooltip at the top
7475
8021
  */
7476
8022
  this.TopPos = 0;
8023
+ /**
8024
+ * Position of the picker arrow at the left
8025
+ */
8026
+ this.posArrowLeft = null;
8027
+ /**
8028
+ * Position of the picker arrow at the top
8029
+ */
8030
+ this.posArrowTop = null;
8031
+ /**
8032
+ * Position of the tooltip. Values: left|top|right|bottom|auto
8033
+ *
8034
+ * Value 'auto' can be combined with another value.
8035
+ */
8036
+ this.position = 'right|auto';
8037
+ /**
8038
+ * method if content has changed and proportions need to be reset in the UI.
8039
+ */
8040
+ this.onContentChange = () => {
8041
+ // Do nothing if is not visible
8042
+ if (!this._isTooltipVisible) {
8043
+ return;
8044
+ }
8045
+ setTimeout(() => {
8046
+ this.getLeftPosition();
8047
+ this.getTopPosition();
8048
+ });
8049
+ };
7477
8050
  }
7478
8051
  // #endregion Constructors
7479
8052
  // #region Public Getters And Setters
8053
+ /**
8054
+ * Property for inline mode for tooltip. Sets the display mode on the wrapper element to `inline`
8055
+ */
8056
+ get inlinemode() {
8057
+ return this._inlinemode;
8058
+ }
7480
8059
  /**
7481
8060
  * Setter for inline mode for tooltip
7482
8061
  */
@@ -7494,12 +8073,6 @@ class SacTooltipCommon {
7494
8073
  this.onContentChange();
7495
8074
  this.cdRef.detectChanges();
7496
8075
  }
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
8076
  get tooltop() {
7504
8077
  return this.tooltipcontainer;
7505
8078
  }
@@ -7509,50 +8082,7 @@ class SacTooltipCommon {
7509
8082
  * Returns the position of the tooltip
7510
8083
  */
7511
8084
  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
- }
8085
+ return this.popupHelper.getDisplayPosition(this.content, this.tooltipcontainer, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
7556
8086
  }
7557
8087
  /**
7558
8088
  * Hide tooltip
@@ -7583,24 +8113,13 @@ class SacTooltipCommon {
7583
8113
  * Calculates the height of the tooltip
7584
8114
  */
7585
8115
  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
- }
8116
+ return this.popupHelper.getPopupHeight(this.tooltipcontainer);
7593
8117
  }
7594
8118
  /**
7595
8119
  * Calculates the width of the tooltips
7596
8120
  */
7597
8121
  getToolTipWidth() {
7598
- if (this.tooltipcontainer) {
7599
- return this.tooltipcontainer.nativeElement.firstElementChild.clientWidth;
7600
- }
7601
- else {
7602
- return 0;
7603
- }
8122
+ return this.popupHelper.getPopupWidth(this.tooltipcontainer);
7604
8123
  }
7605
8124
  /**
7606
8125
  * Detect Changes after view checked. Prevent ExpressionChangedAfterItHasBeenCheckedError error
@@ -7645,187 +8164,37 @@ class SacTooltipCommon {
7645
8164
  document.body.appendChild(this.tooltipcontainer.nativeElement);
7646
8165
  }
7647
8166
  }
7648
- // #endregion Protected Abstract Methods
8167
+ // #endregion Protected Methods
7649
8168
  // #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
8169
  /**
7737
8170
  * Calculates the position of the tooltip from links
7738
8171
  */
7739
8172
  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
- }
8173
+ const value = this.popupHelper.getPositionLeft(this.content, this.tooltipcontainer, this.ref, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
8174
+ this.LeftPos = value;
8175
+ const requiredPosition = this.GetTooltipPosition();
8176
+ if (requiredPosition === TooltipPosition.left || requiredPosition === TooltipPosition.right) {
8177
+ this.posArrowTop = this.getToolTipHeight() / 2 - 6.5;
7764
8178
  }
7765
8179
  else {
7766
- return this.ref.nativeElement.offsetLeft;
8180
+ this.posArrowTop = null;
7767
8181
  }
8182
+ return value;
7768
8183
  }
7769
8184
  /**
7770
8185
  * Calculates the position of the tooltip from the top
7771
8186
  */
7772
8187
  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
- }
8188
+ const value = this.popupHelper.getPositionTop(this.content, this.tooltipcontainer, this.ref, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
8189
+ this.TopPos = value;
8190
+ const requiredPosition = this.GetTooltipPosition();
8191
+ if (requiredPosition === TooltipPosition.bottom || requiredPosition === TooltipPosition.top) {
8192
+ this.posArrowLeft = this.getToolTipWidth() / 2 - 6.5;
7799
8193
  }
7800
8194
  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;
8195
+ this.posArrowLeft = null;
7812
8196
  }
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;
7826
- }
7827
- const parentValue = this.getScrollTopParent(element.parentElement);
7828
- return parentValue + element.scrollTop;
8197
+ return value;
7829
8198
  }
7830
8199
  }
7831
8200
  SacTooltipCommon.decorators = [
@@ -7836,9 +8205,9 @@ SacTooltipCommon.ctorParameters = () => [
7836
8205
  { type: ElementRef }
7837
8206
  ];
7838
8207
  SacTooltipCommon.propDecorators = {
8208
+ content: [{ type: ViewChild, args: ['container', { static: true },] }],
7839
8209
  position: [{ type: Input }],
7840
8210
  tooltiptext: [{ type: Input }],
7841
- content: [{ type: ViewChild, args: ['container', { static: true },] }],
7842
8211
  inlinemode: [{ type: Input }],
7843
8212
  tooltip: [{ type: ViewChild, args: ['tooltip', { static: false },] }]
7844
8213
  };