@colijnit/sharedcomponents 1.0.27 → 1.0.28

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 (133) hide show
  1. package/bundles/colijnit-sharedcomponents.umd.js +2713 -73
  2. package/bundles/colijnit-sharedcomponents.umd.js.map +1 -1
  3. package/colijnit-sharedcomponents.d.ts +24 -0
  4. package/colijnit-sharedcomponents.metadata.json +1 -1
  5. package/esm2015/colijnit-sharedcomponents.js +25 -1
  6. package/esm2015/lib/components/circular-gauge/co-circular-gauge.component.js +6 -5
  7. package/esm2015/lib/components/date-planning/component/agenda/agenda-base-view.component.js +61 -0
  8. package/esm2015/lib/components/date-planning/component/agenda/agenda-day-view.component.js +32 -0
  9. package/esm2015/lib/components/date-planning/component/agenda/agenda-event.component.js +54 -0
  10. package/esm2015/lib/components/date-planning/component/agenda/agenda-events.component.js +43 -0
  11. package/esm2015/lib/components/date-planning/component/agenda/agenda-half-hour-cell.component.js +68 -0
  12. package/esm2015/lib/components/date-planning/component/agenda/agenda-header.component.js +232 -0
  13. package/esm2015/lib/components/date-planning/component/agenda/agenda-hour-cell.component.js +36 -0
  14. package/esm2015/lib/components/date-planning/component/agenda/agenda-hour-view-labels.component.js +50 -0
  15. package/esm2015/lib/components/date-planning/component/agenda/agenda-hour-view.component.js +46 -0
  16. package/esm2015/lib/components/date-planning/component/agenda/agenda-month-view.component.js +61 -0
  17. package/esm2015/lib/components/date-planning/component/agenda/agenda-select-event.component.js +39 -0
  18. package/esm2015/lib/components/date-planning/component/agenda/agenda-view.component.js +35 -0
  19. package/esm2015/lib/components/date-planning/component/agenda/agenda-week-select-view.component.js +64 -0
  20. package/esm2015/lib/components/date-planning/component/agenda/agenda-week-view.component.js +48 -0
  21. package/esm2015/lib/components/date-planning/component/agenda/view-select.component.js +42 -0
  22. package/esm2015/lib/components/date-planning/component/calendar/calendar-all-months.component.js +34 -0
  23. package/esm2015/lib/components/date-planning/component/calendar/calendar-all-years.component.js +48 -0
  24. package/esm2015/lib/components/date-planning/component/calendar/calendar-header.component.js +107 -0
  25. package/esm2015/lib/components/date-planning/component/calendar/calendar-view.component.js +178 -0
  26. package/esm2015/lib/components/date-planning/component/calendar/calendar.component.js +34 -0
  27. package/esm2015/lib/components/date-planning/date-planning.component.js +106 -0
  28. package/esm2015/lib/components/date-planning/date-planning.module.js +63 -0
  29. package/esm2015/lib/components/send-method-dialog/send-method-dialog.component.js +83 -54
  30. package/esm2015/lib/components/send-method-dialog/send-method-dialog.module.js +6 -3
  31. package/esm2015/lib/components/send-method-dialog/send-method-params.interface.js +2 -0
  32. package/esm2015/lib/components/statusbar/statusbar.component.js +2 -2
  33. package/esm2015/lib/components/stock/stock-information-grid/stock-information-grid.component.js +7 -4
  34. package/esm2015/lib/enum/calendar-view.enum.js +8 -0
  35. package/esm2015/lib/enum/icon.enum.js +6 -1
  36. package/esm2015/lib/enum/month.enum.js +17 -0
  37. package/esm2015/lib/enum/thumb-three-way-state.js +19 -0
  38. package/esm2015/lib/enum/time-period.enum.js +11 -0
  39. package/esm2015/lib/model/agenda-event-per-day.model.js +6 -0
  40. package/esm2015/lib/model/agenda-event.model.js +8 -0
  41. package/esm2015/lib/model/agenda-null-objects.js +11 -0
  42. package/esm2015/lib/model/constant/all-months.js +17 -0
  43. package/esm2015/lib/model/date-range.js +5 -0
  44. package/esm2015/lib/model/day.model.js +7 -0
  45. package/esm2015/lib/model/icon-svg.js +6 -1
  46. package/esm2015/lib/model/month.model.js +11 -0
  47. package/esm2015/lib/model/time-window.bo.js +26 -0
  48. package/esm2015/lib/model/week.model.js +6 -0
  49. package/esm2015/lib/model/weekday.model.js +10 -0
  50. package/esm2015/lib/pipe/array-number.pipe.js +15 -0
  51. package/esm2015/lib/pipe/master-pipes.js +7 -0
  52. package/esm2015/lib/pipe/ucfirst.pipe.js +16 -0
  53. package/esm2015/lib/service/shared-connector.service.js +49 -1
  54. package/esm2015/lib/service/stock.service.js +16 -5
  55. package/esm2015/lib/utils/array-utils.js +24 -5
  56. package/esm2015/lib/utils/calendar.utils.js +69 -0
  57. package/esm2015/lib/utils/check-precision-and-scale-result.js +2 -0
  58. package/esm2015/lib/utils/check-within-stepped-bounds-result.js +2 -0
  59. package/esm2015/lib/utils/date-utils.js +264 -0
  60. package/esm2015/lib/utils/function/not-nill.function.js +5 -0
  61. package/esm2015/lib/utils/map-utils.js +41 -0
  62. package/esm2015/lib/utils/number-utils.js +390 -0
  63. package/esm2015/lib/utils/object-utils.js +278 -0
  64. package/esm2015/public-api.js +3 -1
  65. package/fesm2015/colijnit-sharedcomponents.js +2792 -99
  66. package/fesm2015/colijnit-sharedcomponents.js.map +1 -1
  67. package/lib/components/circular-gauge/style/_layout.scss +3 -6
  68. package/lib/components/date-planning/component/agenda/agenda-base-view.component.d.ts +21 -0
  69. package/lib/components/date-planning/component/agenda/agenda-day-view.component.d.ts +6 -0
  70. package/lib/components/date-planning/component/agenda/agenda-event.component.d.ts +17 -0
  71. package/lib/components/date-planning/component/agenda/agenda-events.component.d.ts +12 -0
  72. package/lib/components/date-planning/component/agenda/agenda-half-hour-cell.component.d.ts +18 -0
  73. package/lib/components/date-planning/component/agenda/agenda-header.component.d.ts +47 -0
  74. package/lib/components/date-planning/component/agenda/agenda-hour-cell.component.d.ts +9 -0
  75. package/lib/components/date-planning/component/agenda/agenda-hour-view-labels.component.d.ts +8 -0
  76. package/lib/components/date-planning/component/agenda/agenda-hour-view.component.d.ts +7 -0
  77. package/lib/components/date-planning/component/agenda/agenda-month-view.component.d.ts +10 -0
  78. package/lib/components/date-planning/component/agenda/agenda-select-event.component.d.ts +12 -0
  79. package/lib/components/date-planning/component/agenda/agenda-view.component.d.ts +11 -0
  80. package/lib/components/date-planning/component/agenda/agenda-week-select-view.component.d.ts +10 -0
  81. package/lib/components/date-planning/component/agenda/agenda-week-view.component.d.ts +8 -0
  82. package/lib/components/date-planning/component/agenda/view-select.component.d.ts +11 -0
  83. package/lib/components/date-planning/component/calendar/calendar-all-months.component.d.ts +9 -0
  84. package/lib/components/date-planning/component/calendar/calendar-all-years.component.d.ts +9 -0
  85. package/lib/components/date-planning/component/calendar/calendar-header.component.d.ts +23 -0
  86. package/lib/components/date-planning/component/calendar/calendar-view.component.d.ts +31 -0
  87. package/lib/components/date-planning/component/calendar/calendar.component.d.ts +10 -0
  88. package/lib/components/date-planning/date-planning.component.d.ts +25 -0
  89. package/lib/components/date-planning/date-planning.module.d.ts +2 -0
  90. package/lib/components/send-method-dialog/send-method-dialog.component.d.ts +24 -7
  91. package/lib/components/send-method-dialog/send-method-params.interface.d.ts +13 -0
  92. package/lib/components/send-method-dialog/style/_layout.scss +5 -0
  93. package/lib/components/statusbar/statusbar.component.d.ts +1 -0
  94. package/lib/components/tags/component/style/_layout.scss +67 -0
  95. package/lib/components/tags/component/style/_material-definition.scss +1 -0
  96. package/lib/components/tags/component/style/_theme.scss +8 -0
  97. package/lib/components/tags/component/style/material.scss +3 -0
  98. package/lib/components/tags/component/tag-join-label/style/_layout.scss +97 -0
  99. package/lib/components/tags/component/tag-join-label/style/_material-definition.scss +4 -0
  100. package/lib/components/tags/component/tag-join-label/style/_theme.scss +8 -0
  101. package/lib/components/tags/component/tag-join-label/style/material.scss +3 -0
  102. package/lib/enum/calendar-view.enum.d.ts +6 -0
  103. package/lib/enum/icon.enum.d.ts +5 -0
  104. package/lib/enum/month.enum.d.ts +14 -0
  105. package/lib/enum/thumb-three-way-state.d.ts +6 -0
  106. package/lib/enum/time-period.enum.d.ts +8 -0
  107. package/lib/model/agenda-event-per-day.model.d.ts +5 -0
  108. package/lib/model/agenda-event.model.d.ts +16 -0
  109. package/lib/model/agenda-null-objects.d.ts +10 -0
  110. package/lib/model/constant/all-months.d.ts +2 -0
  111. package/lib/model/date-range.d.ts +7 -0
  112. package/lib/model/day.model.d.ts +8 -0
  113. package/lib/model/month.model.d.ts +5 -0
  114. package/lib/model/time-window.bo.d.ts +13 -0
  115. package/lib/model/week.model.d.ts +4 -0
  116. package/lib/model/weekday.model.d.ts +16 -0
  117. package/lib/pipe/array-number.pipe.d.ts +4 -0
  118. package/lib/pipe/master-pipes.d.ts +1 -0
  119. package/lib/pipe/ucfirst.pipe.d.ts +4 -0
  120. package/lib/service/shared-connector.service.d.ts +4 -0
  121. package/lib/service/stock.service.d.ts +6 -2
  122. package/lib/style/_mixin.scss +5 -0
  123. package/lib/utils/array-utils.d.ts +6 -0
  124. package/lib/utils/calendar.utils.d.ts +10 -0
  125. package/lib/utils/check-precision-and-scale-result.d.ts +4 -0
  126. package/lib/utils/check-within-stepped-bounds-result.d.ts +8 -0
  127. package/lib/utils/date-utils.d.ts +44 -0
  128. package/lib/utils/function/not-nill.function.d.ts +1 -0
  129. package/lib/utils/map-utils.d.ts +16 -0
  130. package/lib/utils/number-utils.d.ts +125 -0
  131. package/lib/utils/object-utils.d.ts +40 -0
  132. package/package.json +1 -1
  133. package/public-api.d.ts +2 -0
@@ -1,30 +1,28 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Component, ViewEncapsulation, ViewChild, ElementRef, Input, Output, HostBinding, NgModule, Injectable, ChangeDetectorRef, HostListener } from '@angular/core';
3
+ import { EventEmitter, Component, ViewEncapsulation, ViewChild, ElementRef, Input, Output, HostBinding, NgModule, Injectable, ChangeDetectorRef, HostListener, Renderer2, Pipe, Inject, LOCALE_ID, NgZone, Directive } from '@angular/core';
4
4
  import { trigger, state, style, transition, animate } from '@angular/animations';
5
5
  import { PDFDocument } from 'pdf-lib';
6
6
  import * as PDFJS from 'pdfjs-dist/legacy/build/pdf';
7
7
  import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry';
8
- import { CommonModule } from '@angular/common';
8
+ import { CommonModule, DatePipe } from '@angular/common';
9
9
  import SignaturePad from 'signature_pad';
10
- import { PrintStockStickers } from '@colijnit/sharedapi/build/model/print-stock-stickers';
11
- import { PrintPriceStickers } from '@colijnit/sharedapi/build/model/print-price-stickers.bo';
12
10
  import { Articles } from '@colijnit/articleapi/build/articles';
13
11
  import { Sharedapi } from '@colijnit/sharedapi/build/sharedapi';
14
12
  import { Printer } from '@colijnit/sharedapi/build/model/report/printer.bo';
15
- import { notNill } from '@colijnit/articleapi/build/utils/function/not-nill.function';
16
- import { ObjectUtils } from '@colijnit/articleapi/build/utils/object-utils';
13
+ import { notNill as notNill$1 } from '@colijnit/articleapi/build/utils/function/not-nill.function';
14
+ import { ObjectUtils as ObjectUtils$1 } from '@colijnit/articleapi/build/utils/object-utils';
17
15
  import { GetYesNoDbBooleanValue } from '@colijnit/articleapi/build/enum/yes-no-db-type.enum';
18
16
  import { GetTrueFalseDbBooleanValue } from '@colijnit/articleapi/build/enum/true-false-db-type.enum';
19
17
  import { GetOneZeroDbBooleanValue } from '@colijnit/articleapi/build/enum/one-zero-bool-db-type.enum';
20
18
  import { GetLogicalBooleanValue } from '@colijnit/articleapi/build/enum/db-boolean-value-type.enum';
21
- import { DateUtils } from '@colijnit/articleapi/build/utils/date-utils';
22
- import { NumberUtils } from '@colijnit/articleapi/build/utils/number-utils';
23
- import { isNill as isNill$1 } from '@colijnit/articleapi/build/utils/function/is-nill.function';
19
+ import { DateUtils as DateUtils$1 } from '@colijnit/articleapi/build/utils/date-utils';
20
+ import { NumberUtils as NumberUtils$1 } from '@colijnit/articleapi/build/utils/number-utils';
24
21
  import { MapPropertyDecorator } from '@colijnit/articleapi/build/factory/decorators/map-property.decorator';
25
22
  import { BooleanTextDecorator as BooleanTextDecorator$1 } from '@colijnit/articleapi/build/factory/decorators/boolean.decorator';
26
23
  import { JsonFieldFieldDecorator } from '@colijnit/articleapi/build/factory/decorators/json.decorator';
27
24
  import { ComplexArrayDecorator as ComplexArrayDecorator$1 } from '@colijnit/articleapi/build/factory/decorators/complex-array.decorator';
25
+ import { PrintStockStickers } from '@colijnit/sharedapi/build/model/print-stock-stickers';
28
26
  import { ArticleStock } from '@colijnit/articleapi/build/model/article-stock.bo';
29
27
  import { StockHistoryBo } from '@colijnit/articleapi/build/model/stock-history.bo';
30
28
  import { StockStickersPrintLayouts } from '@colijnit/sharedapi/build/model/report/stock-stickers-print-layouts.bo';
@@ -34,14 +32,16 @@ import { StockManagementWarehouses } from '@colijnit/articleapi/build/model/stoc
34
32
  import { StockLocation } from '@colijnit/articleapi/build/model/stock-location.bo';
35
33
  import { ArticleTransaction } from '@colijnit/articleapi/build/model/article-transaction.bo';
36
34
  import { BehaviorSubject } from 'rxjs';
35
+ import { PrintPriceStickers } from '@colijnit/sharedapi/build/model/print-price-stickers.bo';
37
36
  import { GetStockHistoryRequest } from '@colijnit/articleapi/build/model/get-stock-history-request';
38
37
  import { ArticleStock as ArticleStock$1 } from '@colijnit/articleapi/build/model/article-stock';
39
- import { CoDialogPromptModule, InputCheckboxModule, InputComboBoxModule, IconModule, InputNumberPickerModule, CoDialogWizardModule, ButtonModule, CoGridModule, InputRadioButtonModule, DropDownModule, SimpleGridModule, ImageModule, InputTextModule, InputTextareaModule } from '@colijnit/corecomponents_v12';
38
+ import { CoDialogPromptModule, InputCheckboxModule, InputComboBoxModule, IconModule, InputNumberPickerModule, CoDialogWizardModule, ButtonModule, CoDialogModule, CoGridModule, InputRadioButtonModule, DropDownModule, SimpleGridModule, ImageModule, InputTextModule, InputTextareaModule, InputDatePickerModule } from '@colijnit/corecomponents_v12';
40
39
  import * as i1 from '@angular/platform-browser';
41
40
  import { DomSanitizer } from '@angular/platform-browser';
42
41
  import { ArticleStockManagement } from '@colijnit/articleapi/build/model/article-stock-management';
43
42
  import { ArticleTransaction as ArticleTransaction$1 } from '@colijnit/articleapi/build/model/article-transaction';
44
43
  import { CircularGaugeModule } from '@syncfusion/ej2-angular-circulargauge';
44
+ import * as moment from 'moment';
45
45
 
46
46
  class DocsignComponent {
47
47
  constructor() {
@@ -422,7 +422,7 @@ function ComplexField(type) {
422
422
  // to be immediately processed when a class is first imported
423
423
  if (!type) {
424
424
  // eslint-disable-next-line no-console
425
- console.warn(`@ComplexField(type): type was UNDEFINED. Called on prop (${ObjectUtils.GetClassName(target)}, ${propertyKey}). ` +
425
+ console.warn(`@ComplexField(type): type was UNDEFINED. Called on prop (${ObjectUtils$1.GetClassName(target)}, ${propertyKey}). ` +
426
426
  `Class will not properly serialize and deserialize now. We've always been able to fix this by CHANGING IMPORT ORDERS ` +
427
427
  `where both classes and their dependencies are used, e.g. factory, repository or models..`);
428
428
  return;
@@ -440,7 +440,7 @@ class ComplexFieldDecorator {
440
440
  if (!target || !propertyKey || typeof target !== "object") {
441
441
  return false;
442
442
  }
443
- return (notNill(Reflect.getMetadata(PROP_META_KEY$3, target, propertyKey)));
443
+ return (notNill$1(Reflect.getMetadata(PROP_META_KEY$3, target, propertyKey)));
444
444
  }
445
445
  // Returns the VALUE of the @ComplexField(VALUE) property decorator on the given propertyKey on the given modelObject.
446
446
  static GetComplexFieldType(target, propertyKey) {
@@ -473,7 +473,7 @@ function ComplexArray(type) {
473
473
  // warn the programmer if given type was undefined; it's probably an import order glitch that caused this, because decorators seem
474
474
  // to be immediately processed when a class is first imported
475
475
  if (!type) {
476
- console.warn(`@ComplexArray(type): type was UNDEFINED. Called on prop (${ObjectUtils.GetClassName(target)}, ${propertyKey}). ` +
476
+ console.warn(`@ComplexArray(type): type was UNDEFINED. Called on prop (${ObjectUtils$1.GetClassName(target)}, ${propertyKey}). ` +
477
477
  `Class will not properly serialize and deserialize now. We've always been able to fix this by CHANGING IMPORT ORDERS ` +
478
478
  `where both classes and their dependencies are used, e.g. factory, repository or models..`);
479
479
  return;
@@ -491,7 +491,7 @@ class ComplexArrayDecorator {
491
491
  if (!target || !propertyKey || typeof target !== "object") {
492
492
  return false;
493
493
  }
494
- return (notNill(Reflect.getMetadata(PROP_META_KEY$2, target, propertyKey)));
494
+ return (notNill$1(Reflect.getMetadata(PROP_META_KEY$2, target, propertyKey)));
495
495
  }
496
496
  /**
497
497
  * Returns the VALUE of the @ComplexArray(VALUE) property decorator on the given propertyKey on the given modelobject.
@@ -633,7 +633,7 @@ class DateFieldFieldDecorator {
633
633
  return Reflect.hasMetadata(PROP_META_KEY$1, target, propertyKey);
634
634
  }
635
635
  static StringAsDate(str) {
636
- return DateUtils.StringAsDate(str);
636
+ return DateUtils$1.StringAsDate(str);
637
637
  }
638
638
  }
639
639
 
@@ -672,7 +672,7 @@ class StringNumberDecorator {
672
672
  return Reflect.hasMetadata(PROP_META_KEY, target, propertyKey);
673
673
  }
674
674
  static StringAsNumber(str) {
675
- return NumberUtils.ParseFloatKeepPrecision(str);
675
+ return NumberUtils$1.ParseFloatKeepPrecision(str);
676
676
  }
677
677
  static NumberAsString(nr) {
678
678
  return "" + nr;
@@ -684,6 +684,673 @@ function isNill(value) {
684
684
  return value === null || value === undefined;
685
685
  }
686
686
 
687
+ // @returns true iff given value does not equals null and does not equal undefined
688
+ function notNill(value) {
689
+ return value !== null && value !== undefined;
690
+ }
691
+
692
+ // Static utility function holder related to objects.
693
+ class ObjectUtils {
694
+ /**
695
+ * Returns whether all given values exist: for all values it holds that they are not null nor undefined. Short-circuit check.
696
+ * @param {any} values Rest parameters with all objects to check existence for.
697
+ * @returns {boolean} True if ALL given values are not null nor undefined, otherwise false (if at least one value was null or undefined)
698
+ */
699
+ static AllExist(...values) {
700
+ let allExist = true;
701
+ for (let i = 0, len = values.length; i < len; i++) {
702
+ if (isNill(values[i])) {
703
+ allExist = false;
704
+ break;
705
+ }
706
+ }
707
+ return allExist;
708
+ }
709
+ /**
710
+ * Copies all properties from object 'from' to object 'to'. Overwrites properties on object 'to' if property already exists.
711
+ * Does not copy functions, only properties.
712
+ * @param {Object} from The source object from which to copy all properties of to the 'to' object.
713
+ * @param {Object} to The object to which the properties of the 'from' object will be copied.
714
+ * @param {boolean} [allowUndefined = true] wether the 'to' object may be assigned null or undefined values to any of its properties.
715
+ */
716
+ static CopyPropertiesFrom(from, to, allowUndefined = true) {
717
+ if (!to) {
718
+ to = {};
719
+ }
720
+ if (!from) {
721
+ return to;
722
+ }
723
+ ObjectUtils.ForOwnProperty(from, (value, key) => {
724
+ if (allowUndefined || notNill(value)) {
725
+ to[key] = value;
726
+ }
727
+ });
728
+ return to;
729
+ }
730
+ static DeepEquals(actual, expected) {
731
+ if (actual === expected) {
732
+ return true;
733
+ }
734
+ else if (actual instanceof Date && expected instanceof Date) {
735
+ return actual.getTime() === expected.getTime();
736
+ }
737
+ else if (!actual || !expected || typeof actual !== "object" && typeof expected !== "object") {
738
+ return actual === expected;
739
+ }
740
+ else {
741
+ return this._objEquiv(actual, expected);
742
+ }
743
+ }
744
+ // Performs given callback function for each own property of given plain object. Also works on string enums.
745
+ static ForOwnProperty(plainObject, callback) {
746
+ if (ObjectUtils.IsPlainObject(plainObject)) {
747
+ for (const key in plainObject) {
748
+ if (plainObject.hasOwnProperty(key) && typeof plainObject[key] !== "function") {
749
+ const response = callback(plainObject[key], key);
750
+ if (response === false) {
751
+ break;
752
+ }
753
+ }
754
+ }
755
+ }
756
+ }
757
+ // Returns the class name of given argument. The argument can be an object or a class.
758
+ static GetClassName(objectOrClass) {
759
+ if (!objectOrClass) {
760
+ return undefined;
761
+ // arg was a class (or a function..)
762
+ }
763
+ else if (objectOrClass.constructor === Function) {
764
+ return objectOrClass.name; // .. which has its readable name stores like this
765
+ // else arg was an object
766
+ }
767
+ else {
768
+ const constructorString = objectOrClass.constructor.toString();
769
+ return constructorString.match(/\w+/g)[1];
770
+ }
771
+ }
772
+ // Returns a shallow clone of the given original object. The clone is a SIMPLE OBJECT with the same properties as the original.
773
+ static GetShallowClone(originalObject, objectClass) {
774
+ let clonedObject = undefined;
775
+ if (objectClass) {
776
+ clonedObject = new objectClass();
777
+ }
778
+ else {
779
+ clonedObject = {};
780
+ }
781
+ ObjectUtils.ForOwnProperty(originalObject, (value, key) => {
782
+ clonedObject[key] = value;
783
+ });
784
+ return clonedObject;
785
+ }
786
+ static GetDeepClone(originalObject, circular = true) {
787
+ // First create an empty object with
788
+ // same prototype of our original source
789
+ let propertyIndex;
790
+ let descriptor;
791
+ let keys;
792
+ let current;
793
+ let nextSource;
794
+ let indexOf;
795
+ const copies = [{
796
+ source: originalObject,
797
+ target: Object.create(Object.getPrototypeOf(originalObject))
798
+ }];
799
+ const cloneObject = copies[0].target;
800
+ const sourceReferences = [originalObject];
801
+ const targetReferences = [cloneObject];
802
+ // First in, first out
803
+ while (current = copies.shift()) { //NOSONAR
804
+ keys = Object.getOwnPropertyNames(current.source);
805
+ for (propertyIndex = 0; propertyIndex < keys.length; propertyIndex++) {
806
+ // Save the source's descriptor
807
+ descriptor = Object.getOwnPropertyDescriptor(current.source, keys[propertyIndex]);
808
+ if (!descriptor.value || typeof descriptor.value !== "object") {
809
+ Object.defineProperty(current.target, keys[propertyIndex], descriptor);
810
+ continue;
811
+ }
812
+ nextSource = descriptor.value;
813
+ descriptor.value = Array.isArray(nextSource) ?
814
+ [] :
815
+ Object.create(Object.getPrototypeOf(nextSource));
816
+ if (circular) {
817
+ indexOf = sourceReferences.indexOf(nextSource);
818
+ if (indexOf !== -1) {
819
+ // The source is already referenced, just assign reference
820
+ descriptor.value = targetReferences[indexOf];
821
+ Object.defineProperty(current.target, keys[propertyIndex], descriptor);
822
+ continue;
823
+ }
824
+ sourceReferences.push(nextSource);
825
+ targetReferences.push(descriptor.value);
826
+ }
827
+ Object.defineProperty(current.target, keys[propertyIndex], descriptor);
828
+ copies.push({ source: nextSource, target: descriptor.value });
829
+ }
830
+ }
831
+ return cloneObject;
832
+ }
833
+ static IsEmpty(obj) {
834
+ return isNill(obj) || Object.getOwnPropertyNames(obj).length === 0;
835
+ }
836
+ // Returns whether given object is an existing, plain object. That is, it defined, its type if 'object' and it is NOT an array or func.
837
+ static IsPlainObject(object) {
838
+ return object !== null && !Array.isArray(object) && typeof object !== "function" && typeof object === "object";
839
+ }
840
+ /**
841
+ * Returns an instance of given class with data of given dataObject. Only works if that class has a default constructor without args.
842
+ * Does not actually create a new object if it alread is an instance of that class.
843
+ * @param {any} clazz A class that has a default constructor
844
+ * @param {any} [dataObject] The object with data to copy to the new instance of the class
845
+ * @returns {any} An object that is an instance of given class, with given data applied to it.
846
+ */
847
+ static MakeInstanceOf(clazz, dataObject) {
848
+ // dont make a clone if given dataObject already instance of clazz
849
+ if (dataObject instanceof clazz) {
850
+ return dataObject;
851
+ }
852
+ else {
853
+ const asClazz = new clazz();
854
+ ObjectUtils.CopyPropertiesFrom(dataObject, asClazz);
855
+ return asClazz;
856
+ }
857
+ }
858
+ // Returns the value of a random own property of given object.
859
+ static PickRandomPropertyValue(object) {
860
+ if (!object) {
861
+ return;
862
+ }
863
+ let result;
864
+ let count = 0;
865
+ for (const prop in object) {
866
+ if (object.hasOwnProperty(prop)) {
867
+ count++;
868
+ if (Math.random() < 1 / count) {
869
+ result = object[prop];
870
+ }
871
+ }
872
+ }
873
+ return result;
874
+ }
875
+ // Returns a default if given value doesn't exist, otherwise just value.
876
+ static ValueOrDefault(value, defaultReturnVal = "") {
877
+ return notNill(value) ? value : defaultReturnVal;
878
+ }
879
+ static _isArguments(x) {
880
+ const supportsArgsClass = this._supportsArgumentsClass();
881
+ return supportsArgsClass ? this._isArgumentsWhenArgsClassSupported(x) : this._isArgumentsWhenArgsClassNotSupported(x);
882
+ }
883
+ static _isArgumentsWhenArgsClassNotSupported(object) {
884
+ return object &&
885
+ typeof object === "object" &&
886
+ typeof object.length === "number" &&
887
+ Object.prototype.hasOwnProperty.call(object, "callee") &&
888
+ !Object.prototype.propertyIsEnumerable.call(object, "callee") ||
889
+ false;
890
+ }
891
+ static _isArgumentsWhenArgsClassSupported(object) {
892
+ return Object.prototype.toString.call(object) === "[object Arguments]";
893
+ }
894
+ static _isBuffer(x) {
895
+ if (!x || typeof x !== "object" || typeof x.length !== "number") {
896
+ return false;
897
+ }
898
+ if (typeof x.copy !== "function" || typeof x.slice !== "function") {
899
+ return false;
900
+ }
901
+ return !(x.length > 0 && typeof x[0] !== "number");
902
+ }
903
+ static _isUndefinedOrNull(value) {
904
+ return value === null || value === undefined;
905
+ }
906
+ static _objEquiv(a, b) {
907
+ let i, key;
908
+ if (this._isUndefinedOrNull(a) || this._isUndefinedOrNull(b)) {
909
+ return false;
910
+ }
911
+ if (a.prototype !== b.prototype) {
912
+ return false;
913
+ }
914
+ if (this._isArguments(a)) {
915
+ if (!this._isArguments(b)) {
916
+ return false;
917
+ }
918
+ a = Array.prototype.slice.call(a);
919
+ b = Array.prototype.slice.call(b);
920
+ return this.DeepEquals(a, b);
921
+ }
922
+ if (this._isBuffer(a)) {
923
+ if (!this._isBuffer(b)) {
924
+ return false;
925
+ }
926
+ if (a.length !== b.length) {
927
+ return false;
928
+ }
929
+ for (i = 0; i < a.length; i++) {
930
+ if (a[i] !== b[i]) {
931
+ return false;
932
+ }
933
+ }
934
+ return true;
935
+ }
936
+ let ka;
937
+ let kb;
938
+ try {
939
+ ka = Object.keys(a);
940
+ kb = Object.keys(b);
941
+ }
942
+ catch (e) {
943
+ return false;
944
+ }
945
+ if (ka.length !== kb.length) {
946
+ return false;
947
+ }
948
+ ka.sort();
949
+ kb.sort();
950
+ for (i = ka.length - 1; i >= 0; i--) {
951
+ if (ka[i] !== kb[i]) {
952
+ return false;
953
+ }
954
+ }
955
+ for (i = ka.length - 1; i >= 0; i--) {
956
+ key = ka[i];
957
+ if (!this.DeepEquals(a[key], b[key])) {
958
+ return false;
959
+ }
960
+ }
961
+ return typeof a === typeof b;
962
+ }
963
+ static _supportsArgumentsClass() {
964
+ return Object.prototype.toString.call(arguments) === "[object Arguments]";
965
+ }
966
+ }
967
+
968
+ // Static utility function holder related to numeric variable evaluations and operations.
969
+ class NumberUtils {
970
+ // For user-typed number input; supports comma's as decimal delimiter.
971
+ static ParseIntNumberInput(arg) {
972
+ return NumberUtils.ParseInt(NumberUtils._NumberInputToNumberStr(arg));
973
+ }
974
+ // Parses given argument to an integer, using a native parseInt() function with a radix of 10. Returns NaN if parsing was not possible.
975
+ static ParseInt(arg) {
976
+ if (isNill(arg) || Array.isArray(arg)) {
977
+ return undefined;
978
+ }
979
+ return parseInt(arg, 10);
980
+ }
981
+ // For user-typed number input; supports comma's as decimal delimiter.
982
+ static ParseFloatNumberInput(arg, decimalPrecision = 2) {
983
+ return NumberUtils.ParseFloat(NumberUtils._NumberInputToNumberStr(arg), decimalPrecision);
984
+ }
985
+ static ParseFloatNumberInputKeepPrecision(arg) {
986
+ const correctedInputStr = NumberUtils._NumberInputToNumberStr(arg);
987
+ const decimalPrecision = this.GetDecimalPlaces(correctedInputStr);
988
+ return NumberUtils.ParseFloat(correctedInputStr, decimalPrecision);
989
+ }
990
+ /**
991
+ * Returns given arg as a float number with given decimal precision, if possible. Returns NaN if parse conversion failed.
992
+ *
993
+ * @param {any} arg The argument to parse to a float
994
+ * @param {number} decimalPrecision The number of decimals, or the precision, the parsed return float should have
995
+ * @returns {number} NaN if not possible, else the parsed float value
996
+ */
997
+ static ParseFloat(arg, decimalPrecision = 2) {
998
+ if (!ObjectUtils.AllExist(arg, decimalPrecision) || Array.isArray(arg)) {
999
+ return NaN;
1000
+ }
1001
+ if (!NumberUtils.IsInteger(decimalPrecision) || decimalPrecision < 0) {
1002
+ decimalPrecision = 2;
1003
+ // toFixed() can only handle up until 20
1004
+ }
1005
+ else if (decimalPrecision > 20) {
1006
+ decimalPrecision = 20;
1007
+ }
1008
+ return parseFloat(parseFloat(arg).toFixed(decimalPrecision));
1009
+ }
1010
+ /**
1011
+ * Returns given arg as a float number with given decimal precision, if possible. Returns NaN if parse conversion failed.
1012
+ *
1013
+ * @param arg The argument to parse to a float
1014
+ * @returns {number} The argument as a float with its original decimal precision intact
1015
+ */
1016
+ static ParseFloatKeepPrecision(arg) {
1017
+ const decimalPrecision = this.GetDecimalPlaces(arg);
1018
+ return this.ParseFloat(arg, decimalPrecision);
1019
+ }
1020
+ /**
1021
+ * Returns the given argument as a number. Returns given defaultValue if conversion of argument was impossible.
1022
+ * @param arg
1023
+ * @param {number} [defaultValue = 0]
1024
+ * @returns {number}
1025
+ */
1026
+ static ParseNumberOrDefault(arg, defaultValue = 0) {
1027
+ if (Array.isArray(arg)) {
1028
+ return defaultValue;
1029
+ }
1030
+ if (!NumberUtils.IsNumber(arg)) {
1031
+ arg = parseFloat(arg);
1032
+ arg = isNaN(arg) ? defaultValue : arg;
1033
+ }
1034
+ return arg;
1035
+ }
1036
+ // Returns true iff given argument is an integer number. Returns false on non-numbers or numbers with significant decimals.
1037
+ static IsInteger(arg) {
1038
+ if (isNaN(arg) || Array.isArray(arg)) {
1039
+ return false;
1040
+ }
1041
+ const argAsFloat = parseFloat(arg);
1042
+ return ((argAsFloat | 0) === argAsFloat); // returns whether 'arg converted to an integer equals arg'
1043
+ }
1044
+ // Returns the number of decimal places of the given number. Returns 0 if no decimals whatsoever could be found on given arg.
1045
+ static GetDecimalPlaces(arg, maxAnswer = 1000) {
1046
+ const match = ("" + arg).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
1047
+ if (!match) {
1048
+ return 0;
1049
+ }
1050
+ let answer = Math.max(0,
1051
+ // number of digits right of decimal point.
1052
+ (match[1] ? match[1].length : 0)
1053
+ // adjust for scientific notation
1054
+ - (match[2] ? +match[2] : 0));
1055
+ if (answer > maxAnswer) {
1056
+ answer = maxAnswer;
1057
+ }
1058
+ return answer;
1059
+ }
1060
+ // Parses given numberInput to a number, or returns given defaultValue if parse not possible. Allows ',' char as decimal delimiter.
1061
+ static ParseNumberInputOrDefault(numberInput, defaultValue = 0) {
1062
+ return NumberUtils.ParseNumberOrDefault(NumberUtils._NumberInputToNumberStr(numberInput), defaultValue);
1063
+ }
1064
+ // Returns whether the type of given argument is 'number'.
1065
+ static IsNumber(arg) {
1066
+ return typeof arg === "number" && !isNaN(arg);
1067
+ }
1068
+ /**
1069
+ * Returns whether given arg is indeed not a number (it's NaN or it has another type than 'number')
1070
+ * Our exact copy of AS Flex'es isNaN(arg) function. Always use this method for copying Flex isNaN(..) occurences into TypeScript.
1071
+ * @param arg
1072
+ * @returns {boolean}
1073
+ * @constructor
1074
+ */
1075
+ static IsNaN(arg) {
1076
+ return isNaN(arg) || !NumberUtils.IsNumber(arg);
1077
+ }
1078
+ // Our copy of CoMath.NaN. Returns number, or substitute if NumberUtils.IsNaN(number) holds true.
1079
+ static NaN(number, substitute = 0) {
1080
+ return NumberUtils.IsNaN(number) ? substitute : number;
1081
+ }
1082
+ // Returns whether the value is parasable as a number.
1083
+ static IsParsableNumber(arg) {
1084
+ if (Array.isArray(arg)) {
1085
+ return false;
1086
+ }
1087
+ return !isNaN(parseFloat(arg));
1088
+ }
1089
+ static IsParsableNumberInput(numberInput) {
1090
+ return NumberUtils.IsParsableNumber(NumberUtils._NumberInputToNumberStr(numberInput));
1091
+ }
1092
+ /**
1093
+ * Returns whether given arg is parseable as a number, and whether the lengts of its number parse result is equal to its original length.
1094
+ * I.e. this function returns FALSE with given number-parsable strings, but that have non-numeric appendices, eg '2233ff'. That arg
1095
+ * IS number-parseable, but not a strict 'string number', the latter being what this method actually checks for.
1096
+ */
1097
+ static IsStringNumber(arg) {
1098
+ if (!NumberUtils.IsParsableNumber(arg)) {
1099
+ return false;
1100
+ }
1101
+ else {
1102
+ return arg.toString().length === parseFloat(arg).toString().length;
1103
+ }
1104
+ }
1105
+ static IsListOfNumbers(arg, separator = ",") {
1106
+ const nrs = arg.split(separator);
1107
+ if (nrs.length === 0) {
1108
+ return false;
1109
+ }
1110
+ return nrs.filter(s => NumberUtils.IsStringNumber(s)).length === nrs.length;
1111
+ }
1112
+ // Returns given argument as a string representation of a number parse, e.g. "1" for a number parse result of arg to 1.
1113
+ static ParseStringNumber(arg) {
1114
+ if (!this.IsStringNumber(arg)) {
1115
+ return NaN;
1116
+ }
1117
+ return NumberUtils.ParseFloatKeepPrecision(arg);
1118
+ }
1119
+ static ParseStringNumberDefault(arg, defaultValue = 0) {
1120
+ return NumberUtils.NaN(NumberUtils.ParseStringNumber(arg), defaultValue);
1121
+ }
1122
+ /**
1123
+ * Returns a random integer in range [lowerBound .. upperBound], an inclusive range. Returns NaN if not possible.
1124
+ * Given bounds are truncated first, before serving as the true lower- and upper bounds for the random int.
1125
+ */
1126
+ static RandomInt(lowerBoundInt, upperBoundInt) {
1127
+ if (!NumberUtils.IsNumber(lowerBoundInt) || !NumberUtils.IsNumber(upperBoundInt) || lowerBoundInt > upperBoundInt) {
1128
+ return NaN;
1129
+ }
1130
+ lowerBoundInt = Math.trunc(lowerBoundInt);
1131
+ upperBoundInt = Math.trunc(upperBoundInt);
1132
+ if (lowerBoundInt === upperBoundInt) {
1133
+ return lowerBoundInt;
1134
+ }
1135
+ const delta = upperBoundInt - lowerBoundInt;
1136
+ return (Math.round(Math.random() * delta) + lowerBoundInt);
1137
+ }
1138
+ // Adds thousands comma's to given value, E.g. '1000' to '1,000'. Returns empty string if value was undefined.
1139
+ static AddThousandsCommasTo(value) {
1140
+ if (isNill(value)) {
1141
+ return "";
1142
+ }
1143
+ return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1144
+ }
1145
+ /**
1146
+ * Function used to check wether a given number is composed of another number, power-of-two wise.
1147
+ * Example usage: NumberUtils.NumIsComposedOf(articleListObject.publication, ArticlePublication.Selector).
1148
+ * This would return whether or not that articleListObject was publicated for selector or not, where articleListObject.publication
1149
+ * was possibly a 'COMPOSITE that was made out of (including)' ArticlePublication.Selector.
1150
+ */
1151
+ static NumIsComposedOfOtherPowTwoNum(bigNrToCheck, powTwoNumItShouldBeComposedOf) {
1152
+ if (!bigNrToCheck) {
1153
+ return false;
1154
+ }
1155
+ else if (!powTwoNumItShouldBeComposedOf) {
1156
+ return true;
1157
+ }
1158
+ else {
1159
+ return ((bigNrToCheck & powTwoNumItShouldBeComposedOf) === powTwoNumItShouldBeComposedOf);
1160
+ }
1161
+ }
1162
+ /**
1163
+ * Returns given nr, or the given default number (default 0) if the nr number was undefined or otherwise not a number.
1164
+ * Same as CoMath.NaN from AS code (used as its substitute in transaction logic)
1165
+ * @param nr
1166
+ * @param defaultNr
1167
+ * @returns {number}
1168
+ */
1169
+ static NrOrDefault(nr, defaultNr = 0) {
1170
+ if (notNill(nr) && NumberUtils.IsNumber(nr)) {
1171
+ return nr;
1172
+ }
1173
+ else {
1174
+ return defaultNr;
1175
+ }
1176
+ }
1177
+ /**
1178
+ * Returns whether given nrToCheck is within the given precision and scale limits. Precision and scale, here, are Oracle DB terms.
1179
+ * This function can thus be used to check whether the given number is safe to send to the 'database' beforehand, if we know the
1180
+ * precision and scale of the number in the db declaration.
1181
+ *
1182
+ * I.e. A number declared in the Oracle DB as number(5, 2) has a precision of 5 and a scale of 2.
1183
+ *
1184
+ * @param {number} nrToCheck
1185
+ * @param {number} precision The number of significant digits, including possibly negative scale. E.g. 3 in '123' and 5 in '51.123'
1186
+ * @param {number} [scale = 0] The number of significant digits AFTER the decimal point. E.g. 1 in 5432.1 and 3 in 54000.003
1187
+ * @returns {CheckPrecisionAndScaleResult} Whether given nrToCheck is ok for given precision and scale, and if not, the
1188
+ * nearest number that IS ok for those constraints.
1189
+ */
1190
+ static CheckPrecisionAndScale(nrToCheck, precision, scale = 0) {
1191
+ // let's say any undefined number is checked OK, and all numbers are checked OK for an undefined precision
1192
+ if (!ObjectUtils.AllExist(nrToCheck, precision, scale)) {
1193
+ return { isOk: true, nearestOkNr: NaN };
1194
+ }
1195
+ // no number can have 0 or less than 0 significant digits, in our universe
1196
+ if (precision < 1 || precision - scale < 1) {
1197
+ return { isOk: false, nearestOkNr: NaN };
1198
+ }
1199
+ // begin check
1200
+ const isNegative = (nrToCheck < 0);
1201
+ const nrParts = nrToCheck.toString().split(".");
1202
+ // remove minus sign if negative
1203
+ if (isNegative) {
1204
+ nrParts[0] = nrParts[0].slice(1);
1205
+ }
1206
+ const numCountBeforeDot = nrParts[0].length;
1207
+ const allowedNumCountBeforeDot = precision - scale;
1208
+ if (numCountBeforeDot <= allowedNumCountBeforeDot) {
1209
+ return { isOk: true, nearestOkNr: nrToCheck };
1210
+ }
1211
+ else {
1212
+ // cut a part from the "before decimal number" so that the number is not too big anymore
1213
+ const numCountToRemove = numCountBeforeDot - allowedNumCountBeforeDot;
1214
+ // remove the right-most numbers before the decimal dot
1215
+ nrParts[0] = nrParts[0].slice(0, -1 * numCountToRemove);
1216
+ // add minus sign again if it was negative
1217
+ if (isNegative) {
1218
+ nrParts[0] = "-" + nrParts[0];
1219
+ }
1220
+ // build and return composite number again
1221
+ let nearestOkNr;
1222
+ if (nrParts[1]) {
1223
+ nearestOkNr = Number(nrParts[0] + "." + nrParts[1]);
1224
+ }
1225
+ else {
1226
+ nearestOkNr = Number(nrParts[0]);
1227
+ }
1228
+ return { isOk: false, nearestOkNr: nearestOkNr };
1229
+ }
1230
+ }
1231
+ /**
1232
+ * Returns whether given x is OK within the given min, max and step boundaries, where it should hold that nrToCheck = min + N * step,
1233
+ * with N integer or 0.
1234
+ * @param {number} nrToCheck Number to check whether it's within the given bounds
1235
+ * @param min Inclusive
1236
+ * @param max Inclusive
1237
+ * @param stepSize
1238
+ * @returns {CheckWithinSteppedBounds} Returns remainder of undefined when nrToCheck was OUTSIDE [min, max], else full result object.
1239
+ */
1240
+ static CheckWithinSteppedBounds(nrToCheck, min, max, stepSize = 1) {
1241
+ if (nrToCheck < min || nrToCheck > max) {
1242
+ return { isOk: false, remainder: undefined };
1243
+ }
1244
+ // we're in [min, max], but still check if nrToCheck = min + N * step holds (for N integer or 0)
1245
+ let remainder = (nrToCheck - min) % stepSize;
1246
+ // correct float for largest precision amongst input numbers
1247
+ remainder = NumberUtils.ParseFloat(remainder, NumberUtils._GetLargestDecimalPrecisionOf(nrToCheck, min, stepSize));
1248
+ return { isOk: (remainder === 0), remainder: remainder };
1249
+ }
1250
+ /**
1251
+ * Finds the number closest to the originalNumber, that adheres to the given bounds. That is, for which it holds that
1252
+ * nr = min + N * step with N integer or 0.
1253
+ * @param {number} originalNr Find closest answer to this number
1254
+ * @param min Inclusive
1255
+ * @param max Inclusive
1256
+ * @param stepSize
1257
+ * @returns {boolean} The closest OK number for bounds.
1258
+ */
1259
+ static GetNearestNumberWithinSteppedBounds(originalNr, min, max, stepSize = 1) {
1260
+ if (originalNr < min) {
1261
+ return min;
1262
+ }
1263
+ else if (originalNr > max) {
1264
+ return NumberUtils.GetTrueSteppedBoundsMax(min, max, stepSize);
1265
+ }
1266
+ const boundsCheck = NumberUtils.CheckWithinSteppedBounds(originalNr, min, max, stepSize);
1267
+ if (boundsCheck.isOk) {
1268
+ return originalNr;
1269
+ }
1270
+ let answer;
1271
+ const remainder = boundsCheck.remainder;
1272
+ if (remainder) {
1273
+ // round up or down?
1274
+ if ((remainder / stepSize) < 0.5) {
1275
+ // round down, but not below min
1276
+ answer = (originalNr - remainder >= min ? originalNr - remainder : min);
1277
+ }
1278
+ else {
1279
+ // round up, but not above max
1280
+ answer = (originalNr + stepSize - remainder <= max ? originalNr + stepSize - remainder :
1281
+ NumberUtils.GetTrueSteppedBoundsMax(min, max, stepSize));
1282
+ }
1283
+ }
1284
+ else {
1285
+ // is this real life, why wasn't our stepped bounds check OK?
1286
+ answer = originalNr;
1287
+ }
1288
+ // 'correct' float errors
1289
+ answer = NumberUtils.ParseFloat(answer, NumberUtils._GetLargestDecimalPrecisionOf(originalNr, min, max, stepSize));
1290
+ return answer;
1291
+ }
1292
+ /**
1293
+ * Returns the true maximum allowed value for the given "stepped bounds": min, stepSize and max, for which it holds that each allowed
1294
+ * value Y = min + stepSize * N, for any INTEGER or 0 N where it also holds, of course, that Y <= max.
1295
+ * @param min
1296
+ * @param max
1297
+ * @param stepSize
1298
+ */
1299
+ static GetTrueSteppedBoundsMax(min, max, stepSize = 1) {
1300
+ // solve max integer X in formula min + X * step <= max, and return min + X * stepSize for that X
1301
+ const maxSteps = Math.floor((max - min) / stepSize);
1302
+ // 'correct' float errors
1303
+ return NumberUtils.ParseFloat(min + maxSteps * stepSize, NumberUtils._GetLargestDecimalPrecisionOf(min, min, max));
1304
+ }
1305
+ // Returns the nearest number, relative to the given originalNr, that is within the given [min, max] inclusive bounds.
1306
+ static GetNearestNumberWithinBounds(originalNr, min, max) {
1307
+ let answer = originalNr;
1308
+ if (originalNr < min) {
1309
+ answer = min;
1310
+ }
1311
+ else if (originalNr > max) {
1312
+ answer = max;
1313
+ }
1314
+ return answer;
1315
+ }
1316
+ // Returns the string representation of given number. If it's not a number, returns the empty string.
1317
+ static ToString(nr) {
1318
+ if (!NumberUtils.IsNaN(nr)) {
1319
+ return "" + nr;
1320
+ }
1321
+ else {
1322
+ return "";
1323
+ }
1324
+ }
1325
+ static DecimalsToStepIncrement(numberOfDecimals) {
1326
+ return Math.pow(10, -1 * numberOfDecimals);
1327
+ }
1328
+ static Round(value, decimals) {
1329
+ const factor = Math.pow(10, decimals);
1330
+ return Math.round(value * factor) / factor;
1331
+ }
1332
+ // @returns The inclusive max value
1333
+ static PrecisionScaleToMaxValue(precision, scale) {
1334
+ const oneStep = this.DecimalsToStepIncrement(scale);
1335
+ const maxExclusive = Math.pow(10, precision - scale);
1336
+ return maxExclusive - oneStep;
1337
+ }
1338
+ // @returns the difference between given 2 numbers
1339
+ static DifferenceBetweenNumbers(numberA, numberB) {
1340
+ return Math.abs(numberA - numberB);
1341
+ }
1342
+ static _GetLargestDecimalPrecisionOf(...args) {
1343
+ const result = ArrayUtils.GetMaxCalculatedValue(args, (arg) => {
1344
+ return NumberUtils.GetDecimalPlaces(arg);
1345
+ });
1346
+ return result;
1347
+ }
1348
+ // Returns given number input as a number that's useable by Javascript. Allows for incoming ',' decimal delimiter.
1349
+ static _NumberInputToNumberStr(numberInput) {
1350
+ return (numberInput + "").replace(",", ".");
1351
+ }
1352
+ }
1353
+
687
1354
  class ArrayUtils {
688
1355
  /**
689
1356
  * Returns whether at least one element in given array could be found by given finder function.
@@ -807,7 +1474,7 @@ class ArrayUtils {
807
1474
  }
808
1475
  // Checks if given array is defined, and is an array, and has length > 0, and, optionally checks that the first element is of type given clazz.
809
1476
  static IsArrayWithElements(arrayToCheck, classItemsMustBeInstanceOf) {
810
- if (isNill$1(arrayToCheck)) {
1477
+ if (isNill(arrayToCheck)) {
811
1478
  return false;
812
1479
  }
813
1480
  if (Array.isArray(arrayToCheck) && arrayToCheck.length > 0) {
@@ -839,7 +1506,7 @@ class ArrayUtils {
839
1506
  return atLeastOneRemoved;
840
1507
  }
841
1508
  static MoveElement(element, toIndex, array) {
842
- if (!Array.isArray(array) || isNill$1(toIndex)) {
1509
+ if (!Array.isArray(array) || isNill(toIndex)) {
843
1510
  return false;
844
1511
  }
845
1512
  const fromIndex = array.indexOf(element);
@@ -861,6 +1528,25 @@ class ArrayUtils {
861
1528
  }
862
1529
  }
863
1530
  }
1531
+ /**
1532
+ * Returns max value from all resulting values from applying given itemValueFunction to all items of given array.
1533
+ * @param array
1534
+ * @param itemValueFunction The function applied to each array item that gives it a numerical value. The max num val found is returned.
1535
+ */
1536
+ static GetMaxCalculatedValue(array, itemValueFunction) {
1537
+ if (!array || !itemValueFunction) {
1538
+ return NaN;
1539
+ }
1540
+ let max = undefined;
1541
+ const len = array.length;
1542
+ for (let i = 0; i < len; i++) {
1543
+ const valueCur = itemValueFunction.call(this);
1544
+ if (valueCur > max) {
1545
+ max = valueCur;
1546
+ }
1547
+ }
1548
+ return max;
1549
+ }
864
1550
  }
865
1551
 
866
1552
  /**
@@ -1421,13 +2107,13 @@ class SharedConnectorService {
1421
2107
  });
1422
2108
  });
1423
2109
  }
1424
- getArticleDetails(data) {
2110
+ getOrderConfirmationDefaultSendMethod(relationId) {
1425
2111
  return __awaiter(this, void 0, void 0, function* () {
1426
2112
  return new Promise((resolve, reject) => {
1427
- return this.articleConnector.getArticleDetails(data).then((result) => {
2113
+ return this.sharedConnector.getOrderConfirmationDefaultSendMethod(relationId).then((result) => {
1428
2114
  if (result.validationResult && result.validationResult.success) {
1429
- if (result.resultObjects) {
1430
- resolve(this._boFactory.makeBOArrayFromRawBackendDataArray(ArticleDetailsBo, result.resultObjects));
2115
+ if (result.resultObject) {
2116
+ resolve(result.resultObject);
1431
2117
  }
1432
2118
  }
1433
2119
  else {
@@ -1437,43 +2123,91 @@ class SharedConnectorService {
1437
2123
  });
1438
2124
  });
1439
2125
  }
1440
- updateArticleDetails(data) {
2126
+ getDefaultEmailAddressListForOrderConfirmation(transactionUUID) {
1441
2127
  return __awaiter(this, void 0, void 0, function* () {
1442
2128
  return new Promise((resolve, reject) => {
1443
- return this.articleConnector.updateArticleDetails(data).then((result) => __awaiter(this, void 0, void 0, function* () {
2129
+ return this.sharedConnector.getDefaultEmailAddressListForOrderConfirmation(transactionUUID).then((result) => {
1444
2130
  if (result.validationResult && result.validationResult.success) {
1445
- yield this.commit();
1446
- resolve(true);
2131
+ if (result.resultObject) {
2132
+ resolve(result.resultObject);
2133
+ }
1447
2134
  }
1448
2135
  else {
1449
2136
  reject(result.validationMessagesAsString);
1450
2137
  }
1451
- }));
2138
+ });
1452
2139
  });
1453
2140
  });
1454
2141
  }
1455
- lockArticleDetails(data) {
2142
+ getPurchaseOrderEmailLayouts(transactionUUID) {
1456
2143
  return __awaiter(this, void 0, void 0, function* () {
1457
2144
  return new Promise((resolve, reject) => {
1458
- return this.articleConnector.lockArticleDetails(data).then((result) => __awaiter(this, void 0, void 0, function* () {
2145
+ return this.sharedConnector.getPurchaseOrderEmailLayouts(transactionUUID).then((result) => {
1459
2146
  if (result.validationResult && result.validationResult.success) {
1460
- yield this.commit();
1461
- resolve(true);
2147
+ if (result.resultObject) {
2148
+ resolve(result.resultObject);
2149
+ }
1462
2150
  }
1463
2151
  else {
1464
2152
  reject(result.validationMessagesAsString);
1465
2153
  }
1466
- }));
2154
+ });
1467
2155
  });
1468
2156
  });
1469
2157
  }
1470
- getStockStatus() {
2158
+ getArticleDetails(data) {
1471
2159
  return __awaiter(this, void 0, void 0, function* () {
1472
2160
  return new Promise((resolve, reject) => {
1473
- return this.articleConnector.getStockState().then((result) => {
2161
+ return this.articleConnector.getArticleDetails(data).then((result) => {
1474
2162
  if (result.validationResult && result.validationResult.success) {
1475
2163
  if (result.resultObjects) {
1476
- resolve(this._boFactory.makeBOArrayFromRawBackendDataArray(StockStatus, result.resultObjects));
2164
+ resolve(this._boFactory.makeBOArrayFromRawBackendDataArray(ArticleDetailsBo, result.resultObjects));
2165
+ }
2166
+ }
2167
+ else {
2168
+ reject(result.validationMessagesAsString);
2169
+ }
2170
+ });
2171
+ });
2172
+ });
2173
+ }
2174
+ updateArticleDetails(data) {
2175
+ return __awaiter(this, void 0, void 0, function* () {
2176
+ return new Promise((resolve, reject) => {
2177
+ return this.articleConnector.updateArticleDetails(data).then((result) => __awaiter(this, void 0, void 0, function* () {
2178
+ if (result.validationResult && result.validationResult.success) {
2179
+ yield this.commit();
2180
+ resolve(true);
2181
+ }
2182
+ else {
2183
+ reject(result.validationMessagesAsString);
2184
+ }
2185
+ }));
2186
+ });
2187
+ });
2188
+ }
2189
+ lockArticleDetails(data) {
2190
+ return __awaiter(this, void 0, void 0, function* () {
2191
+ return new Promise((resolve, reject) => {
2192
+ return this.articleConnector.lockArticleDetails(data).then((result) => __awaiter(this, void 0, void 0, function* () {
2193
+ if (result.validationResult && result.validationResult.success) {
2194
+ yield this.commit();
2195
+ resolve(true);
2196
+ }
2197
+ else {
2198
+ reject(result.validationMessagesAsString);
2199
+ }
2200
+ }));
2201
+ });
2202
+ });
2203
+ }
2204
+ getStockStatus() {
2205
+ return __awaiter(this, void 0, void 0, function* () {
2206
+ return new Promise((resolve, reject) => {
2207
+ return this.articleConnector.getStockState().then((result) => {
2208
+ if (result.validationResult && result.validationResult.success) {
2209
+ if (result.resultObjects) {
2210
+ resolve(this._boFactory.makeBOArrayFromRawBackendDataArray(StockStatus, result.resultObjects));
1477
2211
  }
1478
2212
  }
1479
2213
  else {
@@ -1532,8 +2266,6 @@ SharedConnectorService.ctorParameters = () => [
1532
2266
  class StockService {
1533
2267
  constructor(_sharedService) {
1534
2268
  this._sharedService = _sharedService;
1535
- this.printSticker = new PrintStockStickers();
1536
- this.printPriceSticker = new PrintPriceStickers();
1537
2269
  }
1538
2270
  getPrintStockStickers(data) {
1539
2271
  return __awaiter(this, void 0, void 0, function* () {
@@ -1593,6 +2325,21 @@ class StockService {
1593
2325
  return yield this._sharedService.getStockManagementLocations(warehouseNo);
1594
2326
  });
1595
2327
  }
2328
+ getOrderConfirmationDefaultSendMethod(relationId) {
2329
+ return __awaiter(this, void 0, void 0, function* () {
2330
+ return yield this._sharedService.getOrderConfirmationDefaultSendMethod(relationId);
2331
+ });
2332
+ }
2333
+ getDefaultEmailAddressListForOrderConfirmation(transactionUUID) {
2334
+ return __awaiter(this, void 0, void 0, function* () {
2335
+ return yield this._sharedService.getDefaultEmailAddressListForOrderConfirmation(transactionUUID);
2336
+ });
2337
+ }
2338
+ getPurchaseOrderEmailLayouts(transactionUUID) {
2339
+ return __awaiter(this, void 0, void 0, function* () {
2340
+ return yield this._sharedService.getPurchaseOrderEmailLayouts(transactionUUID);
2341
+ });
2342
+ }
1596
2343
  getArticleTransaction(data) {
1597
2344
  return __awaiter(this, void 0, void 0, function* () {
1598
2345
  return yield this._sharedService.getArticleTransaction(data);
@@ -1814,8 +2561,13 @@ const IconSvg = {
1814
2561
  "delete_left_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><path d=\"M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z\"/></svg>",
1815
2562
  "delivery_truck": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><rect x=\"15.35\" y=\"16.56\" width=\"15.14\" height=\"10.94\" transform=\"translate(-1.83 2.08) rotate(-5)\" fill=\"#484f60\"/><path d=\"M38.5,18.1l-6.9.61L32.41,28l-7.63.67a3.76,3.76,0,0,1,1.43,2.25l7.25-.63A3.83,3.83,0,0,1,41,29.6l1-.1-.52-6Zm.29,5.84-3.91.34a.51.51,0,0,1-.55-.46L34,20.1a.49.49,0,0,1,.45-.54l2.27-.2a.5.5,0,0,1,.48.25l2,3.59A.5.5,0,0,1,38.79,23.94Z\" fill=\"#484f60\"/><path d=\"M19.66,29.09a3.8,3.8,0,0,0-1,2.46l-.74.07-1.82-.94L16,29.41Z\" fill=\"#484f60\"/><path d=\"M34.56,30.62a2.74,2.74,0,1,0,2.49-3A2.73,2.73,0,0,0,34.56,30.62Z\" fill=\"#484f60\"/><path d=\"M19.74,31.91a2.74,2.74,0,1,0,2.49-3A2.74,2.74,0,0,0,19.74,31.91Z\" fill=\"#484f60\"/><rect x=\"7.96\" y=\"17.63\" width=\"5\" height=\"1\" transform=\"translate(-1.54 0.98) rotate(-5)\" fill=\"#484f60\"/><rect x=\"11.02\" y=\"29.71\" width=\"3\" height=\"1\" transform=\"translate(-2.59 1.21) rotate(-5)\" fill=\"#484f60\"/><rect x=\"9.48\" y=\"23.53\" width=\"4\" height=\"1\" transform=\"matrix(1, -0.09, 0.09, 1, -2.05, 1.09)\" fill=\"#484f60\"/></svg>",
1816
2563
  "email": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.79,38.45A17.82,17.82,0,0,1,23.86,40,13.09,13.09,0,0,1,10.41,26.42C10.41,17.63,16.83,10,26.53,10c7.63,0,13.06,5.21,13.06,12.46,0,6.33-3.53,10.3-8.19,10.3a3.42,3.42,0,0,1-3.71-3.32h-.08A6.5,6.5,0,0,1,22,32.76c-2.75,0-4.82-2.11-4.82-5.65a9.85,9.85,0,0,1,10.13-10,12.89,12.89,0,0,1,5.13,1l-1.3,8c-.43,2.54-.13,3.71,1.08,3.75,1.85.09,4.18-2.28,4.18-7.28,0-5.65-3.62-10-10.3-10S13.73,17.76,13.73,26c0,7.25,4.57,11.3,11,11.3A14.81,14.81,0,0,0,31,36ZM28,20.65a5.34,5.34,0,0,0-1.33-.18c-2.85,0-5.09,2.81-5.09,6.12,0,1.64.73,2.68,2.16,2.68,1.59,0,3.27-2,3.66-4.53Z\" fill=\"#484f60\"/></svg>",
2564
+ "envelope_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M64 112c-8.8 0-16 7.2-16 16v22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1V128c0-8.8-7.2-16-16-16H64zM48 212.2V384c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V212.2L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64H448c35.3 0 64 28.7 64 64V384c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V128z\"/></svg>",
2565
+ "file_pdf_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><path d=\"M320 464C328.8 464 336 456.8 336 448V416H384V448C384 483.3 355.3 512 320 512H64C28.65 512 0 483.3 0 448V416H48V448C48 456.8 55.16 464 64 464H320zM256 160C238.3 160 224 145.7 224 128V48H64C55.16 48 48 55.16 48 64V192H0V64C0 28.65 28.65 0 64 0H229.5C246.5 0 262.7 6.743 274.7 18.75L365.3 109.3C377.3 121.3 384 137.5 384 154.5V192H336V160H256zM88 224C118.9 224 144 249.1 144 280C144 310.9 118.9 336 88 336H80V368C80 376.8 72.84 384 64 384C55.16 384 48 376.8 48 368V240C48 231.2 55.16 224 64 224H88zM112 280C112 266.7 101.3 256 88 256H80V304H88C101.3 304 112 293.3 112 280zM160 240C160 231.2 167.2 224 176 224H200C226.5 224 248 245.5 248 272V336C248 362.5 226.5 384 200 384H176C167.2 384 160 376.8 160 368V240zM192 352H200C208.8 352 216 344.8 216 336V272C216 263.2 208.8 256 200 256H192V352zM336 224C344.8 224 352 231.2 352 240C352 248.8 344.8 256 336 256H304V288H336C344.8 288 352 295.2 352 304C352 312.8 344.8 320 336 320H304V368C304 376.8 296.8 384 288 384C279.2 384 272 376.8 272 368V240C272 231.2 279.2 224 288 224H336z\"/></svg>",
2566
+ "file_pdf_solid": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><path d=\"M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM64 224H88c30.9 0 56 25.1 56 56s-25.1 56-56 56H80v32c0 8.8-7.2 16-16 16s-16-7.2-16-16V320 240c0-8.8 7.2-16 16-16zm24 80c13.3 0 24-10.7 24-24s-10.7-24-24-24H80v48h8zm72-64c0-8.8 7.2-16 16-16h24c26.5 0 48 21.5 48 48v64c0 26.5-21.5 48-48 48H176c-8.8 0-16-7.2-16-16V240zm32 112h8c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16h-8v96zm96-128h48c8.8 0 16 7.2 16 16s-7.2 16-16 16H304v32h32c8.8 0 16 7.2 16 16s-7.2 16-16 16H304v48c0 8.8-7.2 16-16 16s-16-7.2-16-16V304 240c0-8.8 7.2-16 16-16z\"/></svg>",
1817
2567
  "pdf": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.42,40.17H13.88c-2.16,0-2.72-.56-2.72-2.72V12.88c0-2.15.56-2.71,2.72-2.71h11.6l8.66,8.88v3.43H32.8V19.6l-7.88-8.09h-11c-1.38,0-1.38,0-1.38,1.37V37.45c0,1.37,0,1.37,1.38,1.37H31.42c1.38,0,1.38,0,1.38-1.37V35h1.34v2.43C34.14,39.61,33.58,40.17,31.42,40.17Z\" fill=\"#484f60\"/><path d=\"M27.83,26.63v4.24h1a3.57,3.57,0,0,0,.78-.06,1.22,1.22,0,0,0,.52-.26,1.44,1.44,0,0,0,.34-.62,4.13,4.13,0,0,0,.13-1.18,3.79,3.79,0,0,0-.13-1.14,1.51,1.51,0,0,0-.37-.62,1.14,1.14,0,0,0-.6-.3,5.93,5.93,0,0,0-1.06-.06Z\" fill=\"#484f60\"/><path d=\"M21.86,26.63v1.82h.71a3.57,3.57,0,0,0,1-.1A.88.88,0,0,0,24,28a.84.84,0,0,0,.14-.5.8.8,0,0,0-.2-.57.88.88,0,0,0-.52-.29,6.36,6.36,0,0,0-.93,0Z\" fill=\"#484f60\"/><path d=\"M19.14,24.27v9h19.7v-9Zm6.12,4.24a1.68,1.68,0,0,1-.54.63,1.9,1.9,0,0,1-.67.3,6.57,6.57,0,0,1-1.34.1h-.85V32H20.57V25.54h2.07a7.75,7.75,0,0,1,1.54.1,1.73,1.73,0,0,1,.93.63,2,2,0,0,1,.37,1.25A2,2,0,0,1,25.26,28.51Zm6.45,1.66A2.91,2.91,0,0,1,31,31.31a2.28,2.28,0,0,1-.91.51A4,4,0,0,1,29,32H26.54V25.54H28.9a4.21,4.21,0,0,1,1.22.13,2.08,2.08,0,0,1,1,.59,2.79,2.79,0,0,1,.61,1,4.76,4.76,0,0,1,.21,1.52A4.19,4.19,0,0,1,31.71,30.17Zm5.7-3.54h-3.1v1.52H37v1.08H34.31V32H33V25.54h4.39Z\" fill=\"#484f60\"/><path d=\"M25.2,10.84v6.44c0,1.78.27,2,2,2h6.23Z\" fill=\"#484f60\"/></svg>",
1818
2568
  "print": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M38,16.5H12a2,2,0,0,0-2,2v9a2,2,0,0,0,2,2h2v-5H36v5h2a2,2,0,0,0,2-2v-9A2,2,0,0,0,38,16.5ZM37,21a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,37,21Z\" fill=\"#484f60\"/><path d=\"M35,11.5v5H15v-5H35m1-1H14v7H36v-7Z\" fill=\"#484f60\"/><path d=\"M35,25.5v13H15v-13H35m1-1H14v15H36v-15Z\" fill=\"#484f60\"/><rect x=\"17\" y=\"28.3\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/><rect x=\"17\" y=\"31.5\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/><rect x=\"17\" y=\"34.7\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/></svg>",
2569
+ "print_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M111.1 48h254.1L400 81.94V160H448V81.94c0-12.73-5.057-24.94-14.06-33.94l-33.94-33.94C391 5.057 378.8 0 366.1 0H111.1C85.49 0 64.01 21.48 64 47.98l.002 82.28c-.002 0 .002 0 0 0L64 160h48.01L111.1 48zM440 192H72C32.3 192 0 224.3 0 264v112c0 13.25 10.75 24 24 24H80V480c0 17.67 14.33 32 32 32h288c17.67 0 32-14.33 32-32v-80h56c13.25 0 24-10.75 24-24v-112C512 224.3 479.7 192 440 192zM384 464H128v-96h256V464zM464 352h-32c0-17.67-14.33-32-32-32h-288c-17.67 0-32 14.33-32 32h-32V264c0-13.23 10.77-24 24-24h368c13.23 0 24 10.77 24 24V352z\"/></svg>",
2570
+ "print_solid": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M448 192H64C28.65 192 0 220.7 0 256v96c0 17.67 14.33 32 32 32h32v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h32c17.67 0 32-14.33 32-32V256C512 220.7 483.3 192 448 192zM384 448H128v-96h256V448zM432 296c-13.25 0-24-10.75-24-24c0-13.27 10.75-24 24-24s24 10.73 24 24C456 285.3 445.3 296 432 296zM128 64h229.5L384 90.51V160h64V77.25c0-8.484-3.375-16.62-9.375-22.62l-45.25-45.25C387.4 3.375 379.2 0 370.8 0H96C78.34 0 64 14.33 64 32v128h64V64z\"/></svg>",
1819
2571
  "signature_field": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M20.1,25.42a1.1,1.1,0,1,1,1.27,1.45l-3.3,9.07A63.13,63.13,0,0,1,28,28.3l1.26-12-8.26-3-6.77,10A62.4,62.4,0,0,1,17,35.54l3.3-9.07A1.12,1.12,0,0,1,20.1,25.42Z\" fill=\"#484f60\"/><rect x=\"21.62\" y=\"11.43\" width=\"8.79\" height=\"2.34\" transform=\"translate(5.88 -8.14) rotate(20)\" fill=\"#484f60\"/><path d=\"M18.11,37.48c1.44,2.65,4.58,2.94,7.23,2.1,1.41-.44,2.2-1.49,3.44-2.06,2.42-1.1,3.13,1.2,5.36,1.37.42,0,2-.65,1.54-.68-2.55-.19-2.93-3.13-5.51-2.65a4.9,4.9,0,0,0-1.64.71c-.77.49-1.31,1.62-2.07,2l-4.61.56A3.38,3.38,0,0,1,20,37c-.22-.41-2,.28-1.85.5Z\" fill=\"#484f60\"/></svg>",
1820
2572
  "xml": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.42,40.17H13.87c-2.15,0-2.71-.56-2.71-2.72V12.88c0-2.15.56-2.71,2.71-2.71H25.48l8.66,8.88v3.43H32.8V19.6l-7.88-8.09H13.87c-1.37,0-1.37,0-1.37,1.37V37.45c0,1.37,0,1.37,1.37,1.37H31.42c1.38,0,1.38,0,1.38-1.37V35h1.34v2.43C34.14,39.61,33.58,40.17,31.42,40.17Z\" fill=\"#484f60\"/><path d=\"M25.2,10.84v6.44c0,1.78.27,2,2,2h6.23Z\" fill=\"#484f60\"/><path d=\"M19.14,24.27v9h19.7v-9Zm5.36,7.41-1.3-2-1.3,2H20.48l2-3.06-1.81-2.8h1.38l1.18,1.88,1.15-1.88h1.37l-1.83,2.85,2,3Zm7.67,0h-1.1V27.07l-1.16,4.61H28.77l-1.16-4.61v4.61H26.52V25.82h1.76l1.07,4,1-4h1.77Zm5.33,0H33.38V25.87h1.18v4.82H37.5Z\" fill=\"#484f60\"/></svg>"
1821
2573
  };
@@ -1879,8 +2631,13 @@ var Icon;
1879
2631
  Icon["DeleteLeftRegular"] = "delete_left_regular";
1880
2632
  Icon["DeliveryTruck"] = "delivery_truck";
1881
2633
  Icon["Email"] = "email";
2634
+ Icon["EnvelopeRegular"] = "envelope_regular";
2635
+ Icon["FilePdfRegular"] = "file_pdf_regular";
2636
+ Icon["FilePdfSolid"] = "file_pdf_solid";
1882
2637
  Icon["Pdf"] = "pdf";
1883
2638
  Icon["Print"] = "print";
2639
+ Icon["PrintRegular"] = "print_regular";
2640
+ Icon["PrintSolid"] = "print_solid";
1884
2641
  Icon["SignatureField"] = "signature_field";
1885
2642
  Icon["Xml"] = "xml";
1886
2643
  })(Icon || (Icon = {}));
@@ -1965,12 +2722,14 @@ class StockInformationGridComponent {
1965
2722
  });
1966
2723
  }
1967
2724
  openSendMethodDialog(data) {
1968
- this._stockService.printSticker.goodId = data.goodId;
1969
- this._stockService.printSticker.warehouse = data.warehouseNo;
2725
+ if (!(this._stockService.printLayoutParams instanceof PrintPriceStickers)) {
2726
+ this._stockService.printLayoutParams.goodId = data.goodId;
2727
+ this._stockService.printLayoutParams.warehouse = data.warehouseNo;
2728
+ }
1970
2729
  this.showSendMethodDialog = !this.showSendMethodDialog;
1971
2730
  }
1972
2731
  printStockStickers() {
1973
- this._stockService.getPrintStockStickers(this._stockService.printSticker);
2732
+ this._stockService.getPrintStockStickers(this._stockService.printLayoutParams);
1974
2733
  }
1975
2734
  onOkClick() {
1976
2735
  }
@@ -2435,46 +3194,62 @@ class SendMethodDialogComponent {
2435
3194
  this.showPrintOption = true;
2436
3195
  this.showPdfOption = true;
2437
3196
  this.showXmlOption = true;
2438
- this.showPrintPriceStickers = false;
2439
- this.showPrintStockStickers = true;
3197
+ this.showPrintPriceStickers = true;
2440
3198
  this.sendOptions = [
2441
3199
  { option: SendOption.Email,
2442
- iconName: this.icons.Email,
3200
+ iconName: this.icons.EnvelopeRegular,
2443
3201
  },
2444
3202
  { option: SendOption.Print,
2445
- iconName: this.icons.Print,
3203
+ iconName: this.icons.PrintRegular,
2446
3204
  },
2447
3205
  { option: SendOption.Pdf,
2448
- iconName: this.icons.Pdf,
3206
+ iconName: this.icons.FilePdfRegular,
2449
3207
  },
2450
3208
  { option: SendOption.Xml,
2451
- iconName: this.icons.Xml,
3209
+ iconName: this.icons.FilePdfRegular,
2452
3210
  }
2453
3211
  ];
2454
3212
  this.activeSendOption = SendOption.Email;
2455
3213
  this.showStandardPrinterOptions = false;
2456
3214
  this.showPrinterSelections = false;
2457
3215
  this.showExitButton = true;
3216
+ this.printTemplates = [];
2458
3217
  this.printTemplatesField = { text: "name", value: "reportId" };
3218
+ this.emailLayoutField = { text: "name", value: "reportId" };
2459
3219
  this.priceListDataField = { text: "name", value: "priceListCode" };
2460
3220
  this.upAndLoaded = false;
2461
- this.emails = ['lars.vdv@colijn-it.nl', 'david@colijn-it.nl', 'ruben@colijn-it.nl'];
2462
3221
  this.models = [false, false, true];
2463
- this.layouts = ['Layout 1', 'Layout 2', 'Layout 3'];
2464
3222
  this.showDialog = false;
3223
+ this.emailAdresses = [];
3224
+ this.printLayouts = [];
3225
+ this.isDocSignEnabled = false;
3226
+ this.docSign = false;
2465
3227
  this.startSignatureClicked = new EventEmitter();
3228
+ this.sendEmailClicked = new EventEmitter();
2466
3229
  this.printButtonClicked = new EventEmitter();
3230
+ this.emailLayoutClicked = new EventEmitter();
3231
+ this.printTemplatesClicked = new EventEmitter();
3232
+ this.defaultSendMethodClicked = new EventEmitter();
3233
+ this.printLayoutParams = new EventEmitter();
3234
+ this.sendMethodParams = new class {
3235
+ };
2467
3236
  this._subscriptions = [];
2468
3237
  this._subscriptions.push(this._optionsService.optionsLoaded.subscribe(loaded => this._handleSettingsLoaded(loaded)));
2469
3238
  }
2470
3239
  set articleData(data) {
2471
- this.stockService.printSticker.goodId = data.goodId;
2472
- this.stockService.printSticker.warehouse = data.warehouseNo;
3240
+ if (!(this.printLayoutParams instanceof PrintPriceStickers)) {
3241
+ this.sendMethodParams.goodId = data.goodId;
3242
+ this.sendMethodParams.warehouse = data.warehouseNo;
3243
+ }
2473
3244
  }
2474
3245
  ;
2475
3246
  showClass() {
2476
3247
  return true;
2477
3248
  }
3249
+ ngOnInit() {
3250
+ this.getDefaultSendMethod();
3251
+ this.getDefaultEmailLayouts();
3252
+ }
2478
3253
  ngOnDestroy() {
2479
3254
  this._subscriptions.forEach(subscription => subscription.unsubscribe());
2480
3255
  }
@@ -2489,12 +3264,16 @@ class SendMethodDialogComponent {
2489
3264
  this.showDialog = false;
2490
3265
  }
2491
3266
  handleSignatureStart() {
3267
+ this.docSign = !this.docSign;
2492
3268
  this.startSignatureClicked.emit();
2493
3269
  }
3270
+ sendEmail() {
3271
+ this.sendEmailClicked.emit();
3272
+ this.printLayoutParams.emit(this.sendMethodParams);
3273
+ }
2494
3274
  handlePrintClicked() {
2495
- // this.printButtonClicked.emit();
2496
- if (this.stockService.printSticker.printerName) {
2497
- this.stockService.getPrintStockStickers(this.stockService.printSticker);
3275
+ if (this.sendMethodParams.printerName) {
3276
+ this.printButtonClicked.emit();
2498
3277
  }
2499
3278
  }
2500
3279
  togglePrinterSelection() {
@@ -2510,16 +3289,19 @@ class SendMethodDialogComponent {
2510
3289
  }
2511
3290
  onPrinterClicked(printer) {
2512
3291
  this.defaultPrinter = printer.name;
2513
- this.stockService.printSticker.printerName = printer.name;
3292
+ this.sendMethodParams.printerName = printer.name;
2514
3293
  this.showPrinterSelections = !this.showPrinterSelections;
2515
3294
  }
2516
3295
  getPrintTemplates() {
2517
- if (!this.printTemplates) {
2518
- const data = new StockStickersPrintLayouts();
2519
- this.stockService.getStockStickerTemplates(data).then((templates) => {
2520
- this.printTemplates = templates;
2521
- });
2522
- }
3296
+ this.printTemplatesClicked.emit();
3297
+ }
3298
+ getDefaultSendMethod() {
3299
+ this.defaultSendMethodClicked.emit();
3300
+ }
3301
+ getDefaultEmailLayouts() {
3302
+ return __awaiter(this, void 0, void 0, function* () {
3303
+ this.emailLayoutClicked.emit();
3304
+ });
2523
3305
  }
2524
3306
  _handleSettingsLoaded(loaded) {
2525
3307
  return __awaiter(this, void 0, void 0, function* () {
@@ -2547,10 +3329,10 @@ SendMethodDialogComponent.decorators = [
2547
3329
  selector: "ione-send-method-dialog",
2548
3330
  template: `
2549
3331
  <div class="send-method-dialog-wrapper">
2550
- <co-dialog-wizard id="sendOptionsDialog" *ngIf="showDialog" [showCloseIcon]="showExitButton" (closeClick)="closeDialogClick()">
2551
- <ng-container header>
2552
- <span [textContent]="headerTitle"></span>
2553
- </ng-container>
3332
+ <co-dialog id="sendOptionsDialog" [headerTemplate]="headerTemplate" *ngIf="showDialog" [showCloseIcon]="showExitButton" (closeClick)="closeDialogClick()">
3333
+ <ng-template #headerTemplate>
3334
+ <h2 [textContent]="headerTitle"></h2>
3335
+ </ng-template>
2554
3336
  <div class="dialog-content-wrapper">
2555
3337
  <div class="main-content-container" *ngIf="!showPrinterSelections">
2556
3338
  <div class="send-options-wrapper">
@@ -2565,43 +3347,47 @@ SendMethodDialogComponent.decorators = [
2565
3347
  <div class="email-option-content" *ngIf="activeSendOption === sendOption.Email || activeSendOption === sendOption.Pdf">
2566
3348
  <div class="emails-container" *ngIf="activeSendOption === sendOption.Email">
2567
3349
  <co-input-checkbox
2568
- *ngFor="let email, let index of emails"
2569
- [name]="email"
2570
- [(model)]="models[index]"
3350
+ *ngFor="let email of emailAdresses"
3351
+ [(model)]="email.name"
2571
3352
  [label]="email"
2572
3353
  [cssClass]="'input-checkbox-wrapper'"
2573
3354
  ></co-input-checkbox>
2574
3355
  </div>
2575
3356
 
2576
- <div class="lov-wrapper">
3357
+ <div class="lov-wrapper" (click)="getDefaultEmailLayouts()">
2577
3358
  <co-input-combo-box
2578
- [(model)]="selectedLayout"
2579
- [collection]="layouts"
2580
- [forceReadonly]="true"
3359
+ [(model)]="sendMethodParams.reportId"
3360
+ [collection]="emailLayouts"
3361
+ [fields]="emailLayoutField"
2581
3362
  placeholder="Layout"
2582
3363
  ></co-input-combo-box>
2583
3364
  </div>
2584
3365
 
2585
- <div class="signature-button-wrapper">
3366
+ <div *ngIf="isDocSignEnabled" class="signature-button-wrapper">
2586
3367
  <div class="custom-button-wrapper signature-button" (click)="handleSignatureStart()">
2587
3368
  <co-icon [iconData]="iconCacheService.getIcon(icons.SignatureField)"></co-icon>
2588
3369
  </div>
3370
+ <div class="custom-button-wrapper send-button" (click)="sendEmail()">
3371
+ <co-icon [iconData]="iconCacheService.getIcon(icons.Email)"></co-icon>
3372
+ </div>
2589
3373
  </div>
3374
+
3375
+ <ione-docsign *ngIf="docSign"></ione-docsign>
2590
3376
  </div>
2591
3377
 
2592
3378
  <div class="email-option-content" *ngIf="activeSendOption === sendOption.Print" (click)="getPrintTemplates()">
2593
3379
  <div *ngIf="showPrintPriceStickers">
2594
3380
  <div class="lov-wrapper">
2595
3381
  <co-input-combo-box
2596
- [(model)]="stockService.printPriceSticker.reportId"
2597
- [collection]="printTemplates"
3382
+ [(model)]="sendMethodParams.reportId"
3383
+ [collection]="printLayouts"
2598
3384
  [fields]="printTemplatesField"
2599
3385
  placeholder="Layout"
2600
3386
  ></co-input-combo-box>
2601
3387
  </div>
2602
3388
  <div class="lov-wrapper" *ngIf="priceListCodeData">
2603
3389
  <co-input-combo-box
2604
- [(model)]="stockService.printPriceSticker.priceListCode"
3390
+ [(model)]="sendMethodParams.priceListCode"
2605
3391
  [collection]="priceListCodeData"
2606
3392
  [fields]="priceListDataField"
2607
3393
  placeholder="Layout"
@@ -2609,21 +3395,10 @@ SendMethodDialogComponent.decorators = [
2609
3395
  </div>
2610
3396
  </div>
2611
3397
 
2612
- <div *ngIf="showPrintStockStickers">
2613
- <div class="lov-wrapper">
2614
- <co-input-combo-box
2615
- [(model)]="stockService.printSticker.reportId"
2616
- [collection]="printTemplates"
2617
- [fields]="printTemplatesField"
2618
- placeholder="Layout"
2619
- ></co-input-combo-box>
2620
- </div>
2621
- </div>
2622
-
2623
3398
  <div class="lov-wrapper clickable" (click)="togglePrinterSelection()">
2624
3399
  <div class="selected-printer-wrapper">
2625
3400
  <div class="printer-option-list-item">
2626
- <co-icon class="printer-icon" [iconData]="iconCacheService.getIcon(icons.Print)"></co-icon>
3401
+ <co-icon class="printer-icon" [iconData]="iconCacheService.getIcon(icons.PrintRegular)"></co-icon>
2627
3402
  <div class="printer-details" *ngIf="printerList">
2628
3403
  <span class="printer-name" [textContent]="defaultPrinter"></span>
2629
3404
  <span class="printer-status" [textContent]="defaultPrinter.acceptingJobs"></span>
@@ -2656,7 +3431,7 @@ SendMethodDialogComponent.decorators = [
2656
3431
  <div class="print-footer-wrapper">
2657
3432
  <div class="input-number-wrapper">
2658
3433
  <co-input-number-picker class="number-picker"
2659
- [step]="1" [(model)]="stockService.printSticker.amount" [min]="1"
3434
+ [step]="1" [(model)]="sendMethodParams.amount" [min]="1"
2660
3435
  [ngModelOptions]="{debounce: 1}">
2661
3436
  </co-input-number-picker>
2662
3437
  </div>
@@ -2673,7 +3448,7 @@ SendMethodDialogComponent.decorators = [
2673
3448
  <div class="printer-content-container" @slideInOut *ngIf="showPrinterSelections">
2674
3449
  <div class="selected-printer-wrapper selection clickable" *ngFor="let printers of printerList" (click)="onPrinterClicked(printers)">
2675
3450
  <div class="printer-option-list-item">
2676
- <co-icon class="printer-icon" [iconData]="iconCacheService.getIcon(icons.Print)"></co-icon>
3451
+ <co-icon class="printer-icon" [iconData]="iconCacheService.getIcon(icons.PrintRegular)"></co-icon>
2677
3452
  <div class="printer-details">
2678
3453
  <span class="printer-name" [textContent]="printers.name"></span>
2679
3454
  <span class="printer-status" [textContent]="printers.acceptingJobs"></span>
@@ -2684,7 +3459,7 @@ SendMethodDialogComponent.decorators = [
2684
3459
  </div>
2685
3460
  </div>
2686
3461
  </div>
2687
- </co-dialog-wizard>
3462
+ </co-dialog>
2688
3463
  </div>
2689
3464
  `,
2690
3465
  encapsulation: ViewEncapsulation.None,
@@ -2710,15 +3485,28 @@ SendMethodDialogComponent.propDecorators = {
2710
3485
  showPdfOption: [{ type: Input }],
2711
3486
  showXmlOption: [{ type: Input }],
2712
3487
  showPrintPriceStickers: [{ type: Input }],
2713
- showPrintStockStickers: [{ type: Input }],
2714
3488
  priceListCodeData: [{ type: Input }],
3489
+ transactionUUID: [{ type: Input }],
2715
3490
  showDialog: [{ type: Input }],
2716
3491
  headerTitle: [{ type: Input }],
2717
3492
  printerList: [{ type: Input }],
3493
+ relationId: [{ type: Input }],
3494
+ emailAdresses: [{ type: Input }],
3495
+ emailLayouts: [{ type: Input }],
3496
+ printLayouts: [{ type: Input }],
3497
+ defaultSendMethod: [{ type: Input }],
3498
+ defaultEmailAdresses: [{ type: Input }],
3499
+ isDocSignEnabled: [{ type: Input }],
3500
+ docSign: [{ type: Input }],
2718
3501
  articleData: [{ type: Input }],
2719
3502
  startSignatureClicked: [{ type: Output }],
3503
+ sendEmailClicked: [{ type: Output }],
2720
3504
  printButtonClicked: [{ type: Output }],
2721
- showClass: [{ type: HostBinding, args: ["class.ione-send-method-dialog",] }]
3505
+ emailLayoutClicked: [{ type: Output }],
3506
+ showClass: [{ type: HostBinding, args: ["class.ione-send-method-dialog",] }],
3507
+ printTemplatesClicked: [{ type: Output }],
3508
+ defaultSendMethodClicked: [{ type: Output }],
3509
+ printLayoutParams: [{ type: Output }]
2722
3510
  };
2723
3511
 
2724
3512
  class SendMethodDialogModule {
@@ -2736,7 +3524,9 @@ SendMethodDialogModule.decorators = [
2736
3524
  IconModule,
2737
3525
  InputNumberPickerModule,
2738
3526
  CoDialogWizardModule,
2739
- ButtonModule
3527
+ ButtonModule,
3528
+ DocsignModule,
3529
+ CoDialogModule
2740
3530
  ],
2741
3531
  exports: [
2742
3532
  SendMethodDialogComponent
@@ -3253,11 +4043,12 @@ class CoCircularGaugeComponent {
3253
4043
  }
3254
4044
  ;
3255
4045
  getAnnotations() {
3256
- if (this.value !== undefined) {
3257
- const label = this.value ? this.value + "%" : "0%";
4046
+ if (this.value) {
3258
4047
  return [{
3259
- content: '<div class="annotation" style="width:20px;height:20px;">' +
3260
- '<div class="annotation-label">' + label + '</div></div>',
4048
+ content: '<div class="annotation">' +
4049
+ this.value + '%</div>',
4050
+ angle: 90,
4051
+ radius: '50%',
3261
4052
  zIndex: '10',
3262
4053
  }];
3263
4054
  }
@@ -3431,7 +4222,7 @@ StatusbarComponent.decorators = [
3431
4222
  (click)="onStatusbarClick()">
3432
4223
  <div class="statuses">
3433
4224
  <div *ngFor="let data of statusbarData; let index = index" class="status">
3434
- <co-linear-gauge [value]="data.percentage" [count]="!!data.count ? data.count : undefined"></co-linear-gauge>
4225
+ <co-linear-gauge [value]="data.percentage" [count]="data.count ? data.count : undefined"></co-linear-gauge>
3435
4226
  </div>
3436
4227
  </div>
3437
4228
  <div class=status-description-popup *ngIf="showPopup" @showHidePopup [ngClass]="popupClass">
@@ -3479,6 +4270,1908 @@ StatusbarModule.decorators = [
3479
4270
  },] }
3480
4271
  ];
3481
4272
 
4273
+ class DatePlanningComponent {
4274
+ constructor(_changeDetector, renderer) {
4275
+ this._changeDetector = _changeDetector;
4276
+ this.renderer = renderer;
4277
+ this.calendarNavigation = false;
4278
+ this.showButton = false;
4279
+ this.buttonLabel = "";
4280
+ this.eventsPerDay = [];
4281
+ this.eventChecked = new EventEmitter();
4282
+ this.selectedDateChange = new EventEmitter();
4283
+ this.rangeChange = new EventEmitter();
4284
+ this.viewChange = new EventEmitter();
4285
+ this.buttonClick = new EventEmitter();
4286
+ this.days = [];
4287
+ this._selectedDate = new Date();
4288
+ }
4289
+ doChangeSelectedDate(date, rangeChanged = false) {
4290
+ this.selectedDate = new Date(date);
4291
+ if (rangeChanged) {
4292
+ this.rangeChange.next(this.selectedDate);
4293
+ }
4294
+ else {
4295
+ this.selectedDateChange.next(this.selectedDate);
4296
+ }
4297
+ this._changeDetector.detectChanges();
4298
+ }
4299
+ doChangeView(view) {
4300
+ this.view = view;
4301
+ this.viewChange.next(this.view);
4302
+ }
4303
+ scrollToDayStart() {
4304
+ if (this.dayStart !== undefined) {
4305
+ const dayStart = this.renderer.selectRootElement("#dayStart");
4306
+ if (dayStart) {
4307
+ setTimeout(() => {
4308
+ dayStart.scrollIntoView({ behavior: "instant", block: "center" });
4309
+ });
4310
+ }
4311
+ }
4312
+ }
4313
+ }
4314
+ DatePlanningComponent.decorators = [
4315
+ { type: Component, args: [{
4316
+ selector: "sc-date-planning",
4317
+ template: `
4318
+ <div class="sc-agenda">
4319
+ <div class="content-wrapper">
4320
+ <calendar *ngIf="calendarNavigation"
4321
+ [view]="view"
4322
+ [(days)]="days"
4323
+ [selectedDate]="selectedDate" (selectedDateChange)="doChangeSelectedDate($event)"></calendar>
4324
+ <div class="agenda-content-wrapper mini-scrollbar">
4325
+ <div class="agenda-content">
4326
+ <agenda-header [view]="view" (viewChange)="doChangeView($event)"
4327
+ [firstAvailableDate]="firstAvailableDate"
4328
+ [eventsPerDay]="eventsPerDay"
4329
+ [selectedDate]="selectedDate"
4330
+ (selectedDateChange)="doChangeSelectedDate($event)"
4331
+ (rangeChange)="doChangeSelectedDate($event, true)"></agenda-header>
4332
+ <agenda-view [view]="view"
4333
+ [selectedDate]="selectedDate"
4334
+ [eventsPerDay]="eventsPerDay"
4335
+ (eventChecked)="eventChecked.emit($event)"></agenda-view>
4336
+ </div>
4337
+ </div>
4338
+ </div>
4339
+ </div>
4340
+ <co-button *ngIf="showButton && eventsPerDay.length > 0" class="text-only select-agenda-button"
4341
+ [label]="buttonLabel"
4342
+ (click)="buttonClick.emit($event)">
4343
+ </co-button>
4344
+ `,
4345
+ animations: [
4346
+ trigger("showHideWindow", [
4347
+ state("void", style({ transform: "scaleY(0)" })),
4348
+ state("*", style({ transform: "scaleY(1)" })),
4349
+ transition(":enter, :leave", [
4350
+ animate("200ms ease-in-out")
4351
+ ])
4352
+ ])
4353
+ ],
4354
+ encapsulation: ViewEncapsulation.None
4355
+ },] }
4356
+ ];
4357
+ DatePlanningComponent.ctorParameters = () => [
4358
+ { type: ChangeDetectorRef },
4359
+ { type: Renderer2 }
4360
+ ];
4361
+ DatePlanningComponent.propDecorators = {
4362
+ calendarNavigation: [{ type: Input }],
4363
+ showButton: [{ type: Input }],
4364
+ selectedDate: [{ type: Input }],
4365
+ firstAvailableDate: [{ type: Input }],
4366
+ buttonLabel: [{ type: Input }],
4367
+ eventsPerDay: [{ type: Input }],
4368
+ view: [{ type: Input }],
4369
+ eventChecked: [{ type: Output }],
4370
+ selectedDateChange: [{ type: Output }],
4371
+ rangeChange: [{ type: Output }],
4372
+ viewChange: [{ type: Output }],
4373
+ buttonClick: [{ type: Output }],
4374
+ dayStart: [{ type: ViewChild, args: ["dayStart", { static: true },] }]
4375
+ };
4376
+
4377
+ class CalendarAllYearsComponent {
4378
+ constructor() {
4379
+ this.yearChange = new EventEmitter();
4380
+ this.years = [];
4381
+ }
4382
+ ngOnInit() {
4383
+ this.years.length = 0;
4384
+ let start = this._determineStart();
4385
+ const end = start + 11;
4386
+ while (start < end) {
4387
+ this.years.push(start);
4388
+ start++;
4389
+ }
4390
+ }
4391
+ _determineStart() {
4392
+ if (this.year > 0) {
4393
+ let thisYear = this.year;
4394
+ let thisYearLastDigit = parseInt(thisYear.toString().split("").pop());
4395
+ while (thisYearLastDigit > 0) {
4396
+ thisYear--;
4397
+ thisYearLastDigit = parseInt(thisYear.toString().split("").pop());
4398
+ }
4399
+ return thisYear;
4400
+ }
4401
+ return 0;
4402
+ }
4403
+ }
4404
+ CalendarAllYearsComponent.decorators = [
4405
+ { type: Component, args: [{
4406
+ selector: "calendar-all-years",
4407
+ template: `
4408
+ <div *ngFor="let currentYear of years"
4409
+ [textContent]="currentYear"
4410
+ [class.selected-year]="currentYear === year"
4411
+ class="pointer-hover"
4412
+ (click)="year = currentYear; yearChange.emit(year)"
4413
+ ></div>
4414
+ `,
4415
+ encapsulation: ViewEncapsulation.None
4416
+ },] }
4417
+ ];
4418
+ CalendarAllYearsComponent.ctorParameters = () => [];
4419
+ CalendarAllYearsComponent.propDecorators = {
4420
+ year: [{ type: Input }],
4421
+ yearChange: [{ type: Output }]
4422
+ };
4423
+
4424
+ // All the months. Values are corresponding dictionary keys in text_nl.
4425
+ var Month$1;
4426
+ (function (Month) {
4427
+ Month["January"] = "JANUARY";
4428
+ Month["Februrary"] = "FEBRUARY";
4429
+ Month["March"] = "MARCH";
4430
+ Month["April"] = "APRIL";
4431
+ Month["May"] = "MAY";
4432
+ Month["June"] = "JUNE";
4433
+ Month["July"] = "JULY";
4434
+ Month["August"] = "AUGUST";
4435
+ Month["September"] = "SEPTEMBER";
4436
+ Month["October"] = "OCTOBER";
4437
+ Month["November"] = "NOVEMBER";
4438
+ Month["December"] = "DECEMBER";
4439
+ })(Month$1 || (Month$1 = {}));
4440
+
4441
+ // All the months in a year. The order is important, and should remain January - to December!
4442
+ const ALL_MONTHS = [
4443
+ Month$1.January,
4444
+ Month$1.Februrary,
4445
+ Month$1.March,
4446
+ Month$1.April,
4447
+ Month$1.May,
4448
+ Month$1.June,
4449
+ Month$1.July,
4450
+ Month$1.August,
4451
+ Month$1.September,
4452
+ Month$1.October,
4453
+ Month$1.November,
4454
+ Month$1.December
4455
+ ];
4456
+
4457
+ class CalendarAllMonthsComponent {
4458
+ constructor() {
4459
+ this.shortDescriptions = false;
4460
+ this.monthChange = new EventEmitter();
4461
+ this.months = [];
4462
+ }
4463
+ ngOnInit() {
4464
+ this.months.length = 0;
4465
+ this.months = ALL_MONTHS;
4466
+ }
4467
+ }
4468
+ CalendarAllMonthsComponent.decorators = [
4469
+ { type: Component, args: [{
4470
+ selector: "calendar-all-months",
4471
+ template: `
4472
+ <div *ngFor="let currentMonth of months; let index = index"
4473
+ [class.selected-month]="month === index"
4474
+ [textContent]="currentMonth"
4475
+ class="pointer-hover"
4476
+ (click)="month = index; monthChange.emit(month)"
4477
+ ></div>
4478
+ `,
4479
+ encapsulation: ViewEncapsulation.None
4480
+ },] }
4481
+ ];
4482
+ CalendarAllMonthsComponent.ctorParameters = () => [];
4483
+ CalendarAllMonthsComponent.propDecorators = {
4484
+ month: [{ type: Input }],
4485
+ shortDescriptions: [{ type: Input }],
4486
+ monthChange: [{ type: Output }]
4487
+ };
4488
+
4489
+ class CalendarHeaderComponent {
4490
+ constructor(iconCacheService) {
4491
+ this.iconCacheService = iconCacheService;
4492
+ this.selectedDate = new Date();
4493
+ this.selectedDateChange = new EventEmitter();
4494
+ this.icons = Icon;
4495
+ this.showMonthYearSelect = false;
4496
+ this.expanded = false;
4497
+ }
4498
+ ngDoCheck() {
4499
+ if (this.selectedDate) {
4500
+ this.currentMonth = ALL_MONTHS[this.selectedDate.getMonth()];
4501
+ this.currentYear = this.selectedDate.getFullYear();
4502
+ }
4503
+ }
4504
+ subMonth() {
4505
+ const newDate = new Date(this.selectedDate);
4506
+ newDate.setMonth(newDate.getMonth() - 1);
4507
+ this.selectedDate = newDate;
4508
+ this.selectedDateChange.emit(this.selectedDate);
4509
+ }
4510
+ addMonth() {
4511
+ const newDate = new Date(this.selectedDate);
4512
+ newDate.setMonth(newDate.getMonth() + 1);
4513
+ this.selectedDate = newDate;
4514
+ this.selectedDateChange.emit(this.selectedDate);
4515
+ }
4516
+ hideMonthYearSelection() {
4517
+ this.expanded = false;
4518
+ this.showMonthYearSelect = false;
4519
+ }
4520
+ setNewMonth(month) {
4521
+ this.selectedMonth = month;
4522
+ }
4523
+ setNewYear(year) {
4524
+ this.selectedYear = year;
4525
+ }
4526
+ changeMonthYear() {
4527
+ this.hideMonthYearSelection();
4528
+ const newDate = new Date(this.selectedDate);
4529
+ newDate.setMonth(this.selectedMonth);
4530
+ newDate.setFullYear(this.selectedYear);
4531
+ this.selectedDate = newDate;
4532
+ this.selectedDateChange.emit(this.selectedDate);
4533
+ }
4534
+ }
4535
+ CalendarHeaderComponent.decorators = [
4536
+ { type: Component, args: [{
4537
+ selector: "calendar-header",
4538
+ template: `
4539
+ <div #monthYearSelect class="calendar-header-row">
4540
+ <co-icon class="pointer-hover" [iconData]="iconCacheService.getIcon(icons.ArrowPointLeft)" (click)="subMonth()"></co-icon>
4541
+ <div (click)="showMonthYearSelect = true">
4542
+ <div class="month" [textContent]="currentMonth"></div>
4543
+ <div class="year" [textContent]="currentYear"></div>
4544
+ </div>
4545
+ <co-icon class="pointer-hover" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" (click)="addMonth()"></co-icon>
4546
+ </div>
4547
+ <ng-template #template>
4548
+ <div *ngIf="showMonthYearSelect"
4549
+ (clickOutside)="hideMonthYearSelection()"
4550
+ class="select-month-year-window" [class.expanded]="expanded" @showMonthYearSelect
4551
+ >
4552
+ <div>
4553
+ <calendar-all-months [month]="currentMonth" (monthChange)="setNewMonth($event)" shortDescriptions></calendar-all-months>
4554
+ <div class="vertical-divider"></div>
4555
+ <calendar-all-years [year]="currentYear" (yearChange)="setNewYear($event)"></calendar-all-years>
4556
+ </div>
4557
+ <!-- <default-ok-cancel-buttons-->
4558
+ <!-- (okClick)="changeMonthYear()"-->
4559
+ <!-- (cancelClick)="showMonthYearSelect = false"-->
4560
+ <!-- >-->
4561
+ <!-- </default-ok-cancel-buttons>-->
4562
+ </div>
4563
+ </ng-template>
4564
+ `,
4565
+ encapsulation: ViewEncapsulation.None,
4566
+ animations: [
4567
+ trigger("showMonthYearSelect", [
4568
+ state("void", style({
4569
+ "transform-origin": "top center",
4570
+ transform: "scaleY(0)"
4571
+ })),
4572
+ state("*", style({
4573
+ "transform-origin": "top center",
4574
+ transform: "scaleY(1)"
4575
+ })),
4576
+ transition(":enter, :leave", [
4577
+ animate("200ms ease-in-out")
4578
+ ])
4579
+ ])
4580
+ ]
4581
+ },] }
4582
+ ];
4583
+ CalendarHeaderComponent.ctorParameters = () => [
4584
+ { type: IconCacheService }
4585
+ ];
4586
+ CalendarHeaderComponent.propDecorators = {
4587
+ selectedDate: [{ type: Input }],
4588
+ selectedDateChange: [{ type: Output }]
4589
+ };
4590
+
4591
+ var CalendarView;
4592
+ (function (CalendarView) {
4593
+ CalendarView["DayView"] = "DAY";
4594
+ CalendarView["WeekView"] = "WEEK";
4595
+ CalendarView["WeekSelectView"] = "WEEK_SELECT";
4596
+ CalendarView["MonthView"] = "MONTH";
4597
+ })(CalendarView || (CalendarView = {}));
4598
+
4599
+ class CalendarComponent {
4600
+ constructor() {
4601
+ this.view = CalendarView.WeekView;
4602
+ this.selectedDate = new Date();
4603
+ this.days = [];
4604
+ this.selectedDateChange = new EventEmitter();
4605
+ }
4606
+ changeSelectedDate(date) {
4607
+ this.selectedDate = date;
4608
+ this.selectedDateChange.emit(this.selectedDate);
4609
+ }
4610
+ }
4611
+ CalendarComponent.decorators = [
4612
+ { type: Component, args: [{
4613
+ selector: "calendar",
4614
+ template: `
4615
+ <div class="sc-calendar">
4616
+ <calendar-header [selectedDate]="selectedDate" (selectedDateChange)="changeSelectedDate($event)"></calendar-header>
4617
+ <calendar-view [view]="view" [selectedDate]="selectedDate" (selectedDateChange)="changeSelectedDate($event)"></calendar-view>
4618
+ </div>
4619
+ `,
4620
+ encapsulation: ViewEncapsulation.None
4621
+ },] }
4622
+ ];
4623
+ CalendarComponent.ctorParameters = () => [];
4624
+ CalendarComponent.propDecorators = {
4625
+ view: [{ type: Input }],
4626
+ selectedDate: [{ type: Input }],
4627
+ days: [{ type: Input }],
4628
+ selectedDateChange: [{ type: Output }]
4629
+ };
4630
+
4631
+ class ArrayNumberPipe {
4632
+ transform(length, offset = 0) {
4633
+ if (!length || length < 0) {
4634
+ return [];
4635
+ }
4636
+ return Array.from({ length: Math.round(length) }, (x, i) => i + offset);
4637
+ }
4638
+ }
4639
+ ArrayNumberPipe.decorators = [
4640
+ { type: Pipe, args: [{
4641
+ name: "arrayNumber"
4642
+ },] }
4643
+ ];
4644
+
4645
+ class DateRange {
4646
+ constructor() {
4647
+ }
4648
+ }
4649
+
4650
+ Date.prototype.toJSON = function () {
4651
+ return moment(this).format('YYYY-MM-DD[T]HH:mm:ss');
4652
+ };
4653
+ // static utility function holder related to dates
4654
+ class DateUtils {
4655
+ static NowAsString() {
4656
+ return DateUtils.ParseDate(new Date(), DateUtils.BACKEND_DATE_FORMAT);
4657
+ }
4658
+ static ParseDate(date, format = "d-m-y") {
4659
+ if (!date) {
4660
+ return "";
4661
+ }
4662
+ const day = ("0" + date.getDate()).slice(-2);
4663
+ const month = ("0" + (date.getMonth() + 1)).slice(-2);
4664
+ const year = date.getFullYear() + "";
4665
+ const formatParts = format.split("-");
4666
+ const dateParts = [];
4667
+ for (let i = 0, l = formatParts.length; i < l; i++) {
4668
+ switch (formatParts[i]) {
4669
+ case "d":
4670
+ case "DD":
4671
+ dateParts.push(day);
4672
+ break;
4673
+ case "m":
4674
+ case "MM":
4675
+ dateParts.push(month);
4676
+ break;
4677
+ case "y":
4678
+ case "YYYY":
4679
+ dateParts.push(year);
4680
+ break;
4681
+ default:
4682
+ break;
4683
+ }
4684
+ }
4685
+ return dateParts.join("-");
4686
+ }
4687
+ static GetWeekNumber(date) {
4688
+ date = new Date(date.getTime());
4689
+ date.setHours(0, 0, 0, 0);
4690
+ date.setDate(date.getDate() + 4 - (date.getDay() || 7));
4691
+ return Math.ceil((((date.getTime() - new Date(date.getFullYear(), 0, 1).getTime()) / 8.64e7) + 1) / 7);
4692
+ }
4693
+ // Returns the number of days from now, for the given date in the future. Returns negative days if given date is in the past from now.
4694
+ static GetDaysFromNow(date) {
4695
+ return DateUtils.GetDayDifference(new Date(Date.now()), date);
4696
+ }
4697
+ static StringAsDate(str, format = DateUtils.BACKEND_DATE_FORMAT) {
4698
+ if (notNill(str)) {
4699
+ if (!isNaN(Number(str))) {
4700
+ return new Date(str);
4701
+ }
4702
+ else {
4703
+ const time = moment(str, format, true);
4704
+ return time.isValid() ? new Date(time) : undefined;
4705
+ }
4706
+ }
4707
+ else {
4708
+ return undefined;
4709
+ }
4710
+ }
4711
+ static MomentToDate(time) {
4712
+ if (!time || !time.isValid()) {
4713
+ return undefined;
4714
+ }
4715
+ const d = new Date(time.format(DateUtils.BACKEND_DATE_FORMAT));
4716
+ d.setHours(time.hours());
4717
+ d.setMinutes(time.minutes());
4718
+ d.setSeconds(time.seconds());
4719
+ return d;
4720
+ }
4721
+ static GetCurrentMonth() {
4722
+ return ALL_MONTHS[new Date().getMonth()];
4723
+ }
4724
+ // @returns e.g. ["FEBRUARI", "MARCH", ..] if it's Februari today, otherwise e.g. ["APRIL", "MAY", ...] if it's April today
4725
+ static Get12MonthsArrayWithFirstMonthIsCurrentMonth() {
4726
+ const answer = [];
4727
+ let monthNrToAdd = new Date().getMonth();
4728
+ for (let i = 0; i < 12; i++) {
4729
+ answer.push(ALL_MONTHS[monthNrToAdd]);
4730
+ monthNrToAdd = (monthNrToAdd + 1) % ALL_MONTHS.length;
4731
+ }
4732
+ return answer;
4733
+ }
4734
+ static GetFirstDayOfWeek(date) {
4735
+ if (!DateUtils._ValidDate(date)) {
4736
+ return null;
4737
+ }
4738
+ let firstDay;
4739
+ const dayOfWeek = date.getDay() || 7;
4740
+ if (dayOfWeek === 1) {
4741
+ firstDay = new Date(date);
4742
+ }
4743
+ else {
4744
+ firstDay = new Date(date);
4745
+ firstDay.setHours(-24 * (dayOfWeek - 1));
4746
+ }
4747
+ return firstDay;
4748
+ }
4749
+ static GetLastDayOfWeek(date) {
4750
+ const firstDayOfWeek = DateUtils.GetFirstDayOfWeek(date);
4751
+ const lastDayOfWeek = new Date(firstDayOfWeek);
4752
+ lastDayOfWeek.setDate(firstDayOfWeek.getDate() + 6);
4753
+ return lastDayOfWeek;
4754
+ }
4755
+ static GetFirstDayOfMonth(date) {
4756
+ if (!DateUtils._ValidDate(date)) {
4757
+ return null;
4758
+ }
4759
+ const year = date.getFullYear();
4760
+ const month = date.getMonth();
4761
+ return new Date(year, month, 1);
4762
+ }
4763
+ static GetLastDayOfMonth(date) {
4764
+ if (!DateUtils._ValidDate(date)) {
4765
+ return null;
4766
+ }
4767
+ const year = date.getFullYear();
4768
+ const month = date.getMonth();
4769
+ return new Date(year, month + 1, 0);
4770
+ }
4771
+ static DatesEqual(date1, date2) {
4772
+ let result = false;
4773
+ if (DateUtils._ValidDate(date1) && DateUtils._ValidDate(date2)) {
4774
+ result =
4775
+ date1.getDate() === date2.getDate() &&
4776
+ date1.getMonth() === date2.getMonth() &&
4777
+ date1.getFullYear() === date2.getFullYear();
4778
+ }
4779
+ return result;
4780
+ }
4781
+ static DateRangeEqual(dates1, dates2) {
4782
+ return (this.DatesEqual(dates1.startDate, dates2.startDate) &&
4783
+ this.DatesEqual(dates1.endDate, dates2.endDate));
4784
+ }
4785
+ static AddMinutes(date, minutes) {
4786
+ return new Date(date.getTime() + (minutes * 60000));
4787
+ }
4788
+ static AddDays(date, days) {
4789
+ const result = new Date(date);
4790
+ result.setDate(result.getDate() + days);
4791
+ return result;
4792
+ }
4793
+ static AddMonths(date, months) {
4794
+ const result = new Date(date);
4795
+ result.setMonth(result.getMonth() + months);
4796
+ return result;
4797
+ }
4798
+ static DetermineDSTBreakpoints() {
4799
+ const endOfYear = new Date(new Date().getFullYear(), 11, 1);
4800
+ let checkDate = new Date(new Date().getFullYear(), 0, 1);
4801
+ let offset = checkDate.getTimezoneOffset();
4802
+ const periodStart = new Date();
4803
+ let periodStartSet = false;
4804
+ const periodEnd = new Date();
4805
+ let periodEndSet = false;
4806
+ while (checkDate.getTime() < endOfYear.getTime()) {
4807
+ checkDate = this.AddMinutes(checkDate, 60);
4808
+ if (offset < checkDate.getTimezoneOffset()) {
4809
+ periodEnd.setTime(checkDate.getTime());
4810
+ periodEndSet = true;
4811
+ }
4812
+ else if (offset > checkDate.getTimezoneOffset()) {
4813
+ periodStart.setTime(checkDate.getTime());
4814
+ periodStartSet = true;
4815
+ }
4816
+ offset = checkDate.getTimezoneOffset();
4817
+ if (periodStartSet && periodEndSet) {
4818
+ break;
4819
+ }
4820
+ }
4821
+ if (periodStartSet && periodEndSet) {
4822
+ return {
4823
+ start: this._DateToTimeStringWithDateFormat(periodStart),
4824
+ end: this._DateToTimeStringWithDateFormat(periodEnd)
4825
+ };
4826
+ }
4827
+ else {
4828
+ return { start: undefined, end: undefined }; // important otherwise we return new Date() for both
4829
+ }
4830
+ }
4831
+ static _ValidDate(date) {
4832
+ return date !== null && date !== undefined;
4833
+ }
4834
+ /**
4835
+ * Returns the difference between the two given days as the number of days, in float precision (date to - date from).
4836
+ * Returns negative values of the 'from' date is later than in time than the 'to' date.
4837
+ */
4838
+ static GetDayDifference(from, to) {
4839
+ if (!from || !to) {
4840
+ return NaN;
4841
+ }
4842
+ return ((to.getTime() - from.getTime()) / 1000 / 60 / 60 / 24);
4843
+ }
4844
+ static IsSameDay(dateOne, dateTwo) {
4845
+ return (dateOne && dateTwo &&
4846
+ dateOne.getDate() === dateTwo.getDate()
4847
+ && dateOne.getMonth() === dateTwo.getMonth()
4848
+ && dateOne.getFullYear() === dateTwo.getFullYear());
4849
+ }
4850
+ static IsInBetween(date, startDate, endDate, withTime = true) {
4851
+ if (startDate && endDate) {
4852
+ if (withTime) {
4853
+ return (date > startDate && date < endDate);
4854
+ }
4855
+ else {
4856
+ const dateWithoutTime = new Date(date).setHours(0, 0, 0, 0), dateFromWithoutTime = new Date(startDate).setHours(0, 0, 0, 0), dateToWithoutTime = new Date(endDate).setHours(0, 0, 0, 0);
4857
+ return dateWithoutTime >= dateFromWithoutTime && dateWithoutTime <= dateToWithoutTime;
4858
+ }
4859
+ }
4860
+ }
4861
+ static IsMonday(date) {
4862
+ return date.getDay() === 1;
4863
+ }
4864
+ static IsSunday(date) {
4865
+ return date.getDay() === 0;
4866
+ }
4867
+ static IsToday(date) {
4868
+ const today = new Date();
4869
+ return DateUtils.IsSameDay(today, date);
4870
+ }
4871
+ // Returns date format like it would when using a pipe in the templete, ie: "1 okt. 2020"
4872
+ static ParseDateInShortDateFormat(date, locale) {
4873
+ this.datePipe = new DatePipe(locale);
4874
+ const parsedDate = this.datePipe.transform(date);
4875
+ return parsedDate;
4876
+ }
4877
+ // Transforms a string that is formatted like "'17-08-2014'<=?<='17-08-2021'" into "'17-08-2014' Untill '17-08-2021'"
4878
+ static getFormattedDateRangeString(dateRangeString, separator = " - ") {
4879
+ let newString = dateRangeString;
4880
+ newString = newString.replace("<=?<=", ` ${separator} `);
4881
+ newString = newString.replace(/'/g, "");
4882
+ return newString;
4883
+ }
4884
+ static SetDateOrDateRangeObjectHoursZero(date) {
4885
+ if (date instanceof DateRange) {
4886
+ if (date.startDate) {
4887
+ date.startDate.setHours(0, 0, 0);
4888
+ }
4889
+ if (date.endDate) {
4890
+ date.endDate.setHours(0, 0, 0);
4891
+ }
4892
+ }
4893
+ else if (!!date && (date instanceof Date)) {
4894
+ date.setHours(0, 0, 0, 0);
4895
+ }
4896
+ }
4897
+ static _DateToTimeStringWithDateFormat(value, dateFormat = "d-m-y") {
4898
+ if (!value) {
4899
+ return "";
4900
+ }
4901
+ const hours = value.getHours() < 10 ? "0" + value.getHours() : "" + value.getHours();
4902
+ const minutes = value.getMinutes() < 10 ? "0" + value.getMinutes() : "" + value.getMinutes();
4903
+ return this.ParseDate(value, dateFormat) + " " + [hours, minutes].join(":");
4904
+ }
4905
+ }
4906
+ DateUtils.BACKEND_DATE_FORMAT = 'YYYY-MM-DD[T]HH:mm:ss';
4907
+ DateUtils.datePipe = new DatePipe('shortDate');
4908
+
4909
+ //fixme we don't have a todayDayStamp field but our template references it
4910
+ class CalendarViewComponent {
4911
+ constructor(_locale) {
4912
+ this._locale = _locale;
4913
+ this.selectedDateChange = new EventEmitter();
4914
+ this.trackByStamp = (index, stamp) => {
4915
+ return stamp && stamp.timestamp || index;
4916
+ };
4917
+ this.trackByWeek = (index, week) => {
4918
+ return week && week[0].week || index;
4919
+ };
4920
+ this.weekDayLabel = [];
4921
+ this.weeks = [];
4922
+ this._selectedDate = new Date();
4923
+ this._view = CalendarView.WeekView;
4924
+ this.selectedDate.setHours(0, 0, 0, 0);
4925
+ this._setLabels();
4926
+ }
4927
+ set view(value) {
4928
+ this._view = value;
4929
+ this._selectDays();
4930
+ }
4931
+ get view() {
4932
+ return this._view;
4933
+ }
4934
+ set selectedDate(value) {
4935
+ this._selectedDate = value;
4936
+ this._selectedDate.setHours(0, 0, 0, 0);
4937
+ this._prepareWeeks();
4938
+ }
4939
+ get selectedDate() {
4940
+ return this._selectedDate;
4941
+ }
4942
+ onDateClick(date) {
4943
+ this.selectedDate = new Date(date.timestamp);
4944
+ this.selectedDateChange.emit(this.selectedDate);
4945
+ this._selectDays();
4946
+ }
4947
+ _setLabels() {
4948
+ const datePipe = new DatePipe(this._locale);
4949
+ const currentDay = this.selectedDate.getDay();
4950
+ const startWeekDate = new Date(this.selectedDate.getTime());
4951
+ startWeekDate.setDate(startWeekDate.getDate() - currentDay - 1);
4952
+ this.weekDayLabel = new ArrayNumberPipe().transform(7).map(() => {
4953
+ startWeekDate.setDate(startWeekDate.getDate() + 1);
4954
+ return datePipe.transform(startWeekDate, "E");
4955
+ });
4956
+ this.weekDayLabel.push(this.weekDayLabel.shift());
4957
+ }
4958
+ _prepareWeeks() {
4959
+ this.weeks.length = 0;
4960
+ const date = new Date(this.selectedDate.getTime());
4961
+ date.setHours(0, 0, 0, 0);
4962
+ // go to last day of month
4963
+ date.setMonth(date.getMonth() + 1);
4964
+ date.setDate(0);
4965
+ const monthEndDay = date.getDay();
4966
+ const monthEndDate = date.getDate();
4967
+ // days after end of month
4968
+ const daysAfter = !monthEndDay ? 0 : 7 - monthEndDay;
4969
+ // go to first day of month
4970
+ date.setDate(1);
4971
+ const monthBeginDay = date.getDay();
4972
+ // days before start of month
4973
+ const daysBefore = !monthBeginDay ? 6 : monthBeginDay - 1;
4974
+ // go to start of calendar view
4975
+ date.setDate(-daysBefore + 1);
4976
+ // amount of weeks to display
4977
+ const weekCount = Math.ceil((daysBefore + daysAfter + monthEndDate) / 7);
4978
+ const weekStart = DateUtils.GetWeekNumber(date);
4979
+ const weekEnd = weekStart + weekCount - 1;
4980
+ // iterate over week count
4981
+ for (let i = weekStart; i <= weekEnd; i++) {
4982
+ let week = i;
4983
+ // only recalculate week when it's necessary
4984
+ if (weekStart > 50) {
4985
+ week = DateUtils.GetWeekNumber(date);
4986
+ }
4987
+ const days = [];
4988
+ // iterate over 7 days
4989
+ for (let ii = 1; ii <= 7; ii++) {
4990
+ // check if we are in the current month
4991
+ let inMonth = true;
4992
+ if (i === weekStart) {
4993
+ inMonth = ii > daysBefore;
4994
+ }
4995
+ else if (i === weekEnd) {
4996
+ inMonth = ii <= 7 - daysAfter;
4997
+ }
4998
+ const timestamp = date.getTime();
4999
+ // add dateStamp to date array
5000
+ days.push({
5001
+ week: week,
5002
+ inMonth: inMonth,
5003
+ day: date.getDate(),
5004
+ timestamp: timestamp,
5005
+ selected: this.selectedDate.getTime() === timestamp
5006
+ });
5007
+ // go one day further
5008
+ date.setDate(date.getDate() + 1);
5009
+ }
5010
+ this.weeks.push(days);
5011
+ }
5012
+ this._selectDays();
5013
+ }
5014
+ _selectDays() {
5015
+ this._resetSelection();
5016
+ if (!this.selectedDate) {
5017
+ return;
5018
+ }
5019
+ const weekNumber = DateUtils.GetWeekNumber(this.selectedDate);
5020
+ const len = this.weeks.length;
5021
+ for (let i = 0; i < len; i++) {
5022
+ const leni = this.weeks[i].length;
5023
+ for (let ii = 0; ii < leni; ii++) {
5024
+ if (this.weeks[i][ii].inMonth && this.view === CalendarView.MonthView) {
5025
+ this.weeks[i][ii].selected = true;
5026
+ }
5027
+ else if (this.weeks[i][ii].week === weekNumber && this.view === CalendarView.WeekView) {
5028
+ this.weeks[i][ii].selected = true;
5029
+ }
5030
+ else if (this.weeks[i][ii].timestamp === this.selectedDate.getTime() && this.view === CalendarView.WeekSelectView) {
5031
+ this.weeks[i][ii].selected = true;
5032
+ }
5033
+ else if (this.weeks[i][ii].timestamp === this.selectedDate.getTime() && this.view === CalendarView.DayView) {
5034
+ this.weeks[i][ii].selected = true;
5035
+ }
5036
+ }
5037
+ }
5038
+ }
5039
+ _resetSelection() {
5040
+ const len = this.weeks.length;
5041
+ for (let i = 0; i < len; i++) {
5042
+ const leni = this.weeks[i].length;
5043
+ for (let ii = 0; ii < leni; ii++) {
5044
+ this.weeks[i][ii].selected = false;
5045
+ }
5046
+ }
5047
+ }
5048
+ }
5049
+ CalendarViewComponent.decorators = [
5050
+ { type: Component, args: [{
5051
+ selector: "calendar-view",
5052
+ template: `
5053
+ <div class="calendar-content">
5054
+ <div>
5055
+ <div class="week-day-header week-row">
5056
+ <div class="week-acronym"></div>
5057
+ <div *ngFor="let weekDay of weekDayLabel" [textContent]="weekDay | ucfirst"
5058
+ class="week-day-label"></div>
5059
+ </div>
5060
+ <div class="week-row" *ngFor="let week of weeks;trackBy:trackByWeek">
5061
+ <div [textContent]="week[0].week" class="week-number"></div>
5062
+ <div *ngFor="let date of week;trackBy:trackByStamp" class="week-day"
5063
+ (click)="onDateClick(date)" [textContent]="date.day">
5064
+ </div>
5065
+ </div>
5066
+ </div>
5067
+ </div>
5068
+ `,
5069
+ encapsulation: ViewEncapsulation.None
5070
+ },] }
5071
+ ];
5072
+ CalendarViewComponent.ctorParameters = () => [
5073
+ { type: LanguageCode, decorators: [{ type: Inject, args: [LOCALE_ID,] }] }
5074
+ ];
5075
+ CalendarViewComponent.propDecorators = {
5076
+ view: [{ type: Input }],
5077
+ selectedDate: [{ type: Input }],
5078
+ selectedDateChange: [{ type: Output }]
5079
+ };
5080
+
5081
+ class Weekday {
5082
+ constructor() {
5083
+ this.inView = true;
5084
+ this.newMonth = false;
5085
+ this.weekdaySelected = false;
5086
+ this.datesByTheHour = [];
5087
+ this.events = [];
5088
+ }
5089
+ }
5090
+
5091
+ class Week {
5092
+ constructor() {
5093
+ this.weekDays = [];
5094
+ }
5095
+ }
5096
+
5097
+ class CalendarUtils {
5098
+ constructor(_locale) {
5099
+ this._locale = _locale;
5100
+ CalendarUtils.Locale = _locale;
5101
+ }
5102
+ // public static GetCurrentYear(): number {
5103
+ // return this.Now.getFullYear();
5104
+ // }
5105
+ //
5106
+ // public static GetCurrentMonth(): number {
5107
+ // return this.Now.getUTCMonth() + 1;
5108
+ // }
5109
+ static GetDayHours(day) {
5110
+ const datesByTheHour = [];
5111
+ if (day) {
5112
+ let newDate = new Date(day);
5113
+ newDate.setHours(0, 0, 0, 0);
5114
+ datesByTheHour.push(newDate);
5115
+ for (let i = 0; i < 23; i++) {
5116
+ newDate = new Date(newDate);
5117
+ newDate.setHours(newDate.getHours() + 1);
5118
+ datesByTheHour.push(newDate);
5119
+ }
5120
+ }
5121
+ return datesByTheHour;
5122
+ }
5123
+ static GetDaysOfWeek(date) {
5124
+ let day = DateUtils.GetFirstDayOfWeek(date);
5125
+ const daysOfWeek = [];
5126
+ let options;
5127
+ let month;
5128
+ for (let i = 0; i < 7; i++) {
5129
+ const dayPerWeek = new Weekday();
5130
+ const dayHours = CalendarUtils.GetDayHours(day);
5131
+ dayPerWeek.newMonth = day.getMonth() !== month;
5132
+ dayPerWeek.weekdaySelected = day.getDay() === date.getDay();
5133
+ dayPerWeek.weekdayDay = day.getDate();
5134
+ options = { weekday: "short" };
5135
+ dayPerWeek.weekdayShort = day.toLocaleDateString(CalendarUtils.Locale, options);
5136
+ options = { weekday: "long" };
5137
+ dayPerWeek.weekdayLong = day.toLocaleDateString(CalendarUtils.Locale, options);
5138
+ options = { month: "short" };
5139
+ dayPerWeek.weekdayMonthShort = day.toLocaleDateString(CalendarUtils.Locale, options);
5140
+ options = { month: "long" };
5141
+ dayPerWeek.weekdayMonthLong = day.toLocaleDateString(CalendarUtils.Locale, options);
5142
+ dayPerWeek.weekdayYear = day.getFullYear();
5143
+ dayPerWeek.date = new Date(day);
5144
+ dayPerWeek.datesByTheHour = dayHours;
5145
+ daysOfWeek.push(dayPerWeek);
5146
+ month = day.getMonth();
5147
+ day = new Date(day);
5148
+ day.setDate(day.getDate() + 1);
5149
+ }
5150
+ const week = new Week();
5151
+ week.weekDays = daysOfWeek;
5152
+ return week;
5153
+ }
5154
+ }
5155
+ CalendarUtils.Locale = undefined;
5156
+ CalendarUtils.Now = new Date();
5157
+ CalendarUtils.ctorParameters = () => [
5158
+ { type: LanguageCode, decorators: [{ type: Inject, args: [LOCALE_ID,] }] }
5159
+ ];
5160
+
5161
+ class AgendaEvent {
5162
+ constructor() {
5163
+ this.checked = false;
5164
+ this.showCheckbox = false;
5165
+ this.draggable = false;
5166
+ }
5167
+ }
5168
+
5169
+ class AgendaEventPerDay {
5170
+ constructor() {
5171
+ this.events = [];
5172
+ }
5173
+ }
5174
+
5175
+ class Month {
5176
+ constructor() {
5177
+ this.weeks = [];
5178
+ }
5179
+ get firstWeek() {
5180
+ if (this.weeks && this.weeks.length > 0) {
5181
+ return this.weeks[0];
5182
+ }
5183
+ }
5184
+ }
5185
+
5186
+ class Day {
5187
+ constructor() {
5188
+ this.datesByTheHour = [];
5189
+ this.events = [];
5190
+ }
5191
+ }
5192
+
5193
+ const NULL_AGENDA_EVENT = new AgendaEvent();
5194
+ const NULL_AGENDA_EVENT_PER_DAY = new AgendaEventPerDay();
5195
+ const NULL_MONTH = new Month();
5196
+ const NULL_WEEK = new Week();
5197
+ const NULL_DAY = new Day();
5198
+
5199
+ class AgendaHeaderComponent {
5200
+ constructor(_locale, _elementRef, _renderer, _ngZone, iconCacheService) {
5201
+ this._locale = _locale;
5202
+ this._elementRef = _elementRef;
5203
+ this._renderer = _renderer;
5204
+ this._ngZone = _ngZone;
5205
+ this.iconCacheService = iconCacheService;
5206
+ this.icons = Icon;
5207
+ this.viewTypes = CalendarView;
5208
+ this.scrollbarWidth = 15;
5209
+ this.view = CalendarView.WeekSelectView;
5210
+ this.viewChange = new EventEmitter();
5211
+ this.selectedDateChange = new EventEmitter();
5212
+ this.rangeChange = new EventEmitter();
5213
+ this.weekDays = [];
5214
+ this.day = NULL_DAY;
5215
+ this.showBackButton = true;
5216
+ this._eventsPerDay = [];
5217
+ this._onResize = () => __awaiter(this, void 0, void 0, function* () {
5218
+ this._resizeHost();
5219
+ });
5220
+ }
5221
+ set selectedDate(value) {
5222
+ this._selectedDate = new Date(value);
5223
+ this._prepareHeaderData();
5224
+ }
5225
+ get selectedDate() {
5226
+ return this._selectedDate;
5227
+ }
5228
+ set firstAvailableDate(value) {
5229
+ if (value) {
5230
+ this._firstAvailableDate = new Date(value);
5231
+ this._prepareHeaderData();
5232
+ }
5233
+ }
5234
+ get firstAvailableDate() {
5235
+ return this._firstAvailableDate;
5236
+ }
5237
+ set eventsPerDay(value) {
5238
+ this._eventsPerDay = value;
5239
+ this._prepareHeaderData();
5240
+ }
5241
+ ngOnDestroy() {
5242
+ window.removeEventListener("resize", this._onResize);
5243
+ this._elementRef = undefined;
5244
+ }
5245
+ ngOnInit() {
5246
+ this._ngZone.runOutsideAngular(() => {
5247
+ window.addEventListener("resize", this._onResize);
5248
+ });
5249
+ }
5250
+ ngAfterContentChecked() {
5251
+ this._resizeHost();
5252
+ }
5253
+ subUnit() {
5254
+ if (this.selectedDate) {
5255
+ const newDate = new Date(this.selectedDate);
5256
+ switch (this.view) {
5257
+ case CalendarView.DayView:
5258
+ newDate.setDate(this.selectedDate.getDate() - 1);
5259
+ break;
5260
+ case CalendarView.WeekView:
5261
+ newDate.setDate(this.selectedDate.getDate() - 7);
5262
+ break;
5263
+ case CalendarView.WeekSelectView:
5264
+ newDate.setDate(this.selectedDate.getDate() - 7);
5265
+ break;
5266
+ case CalendarView.MonthView:
5267
+ newDate.setMonth(this.selectedDate.getMonth() - 1);
5268
+ break;
5269
+ }
5270
+ this.selectedDate = newDate;
5271
+ this.rangeChange.emit(this.selectedDate);
5272
+ }
5273
+ }
5274
+ addUnit() {
5275
+ if (this.selectedDate) {
5276
+ const newDate = new Date(this.selectedDate);
5277
+ switch (this.view) {
5278
+ case CalendarView.DayView:
5279
+ newDate.setDate(this.selectedDate.getDate() + 1);
5280
+ break;
5281
+ case CalendarView.WeekView:
5282
+ newDate.setDate(this.selectedDate.getDate() + 7);
5283
+ break;
5284
+ case CalendarView.WeekSelectView:
5285
+ newDate.setDate(this.selectedDate.getDate() + 7);
5286
+ break;
5287
+ case CalendarView.MonthView:
5288
+ newDate.setMonth(this.selectedDate.getMonth() + 1);
5289
+ break;
5290
+ }
5291
+ this.selectedDate = newDate;
5292
+ this.rangeChange.emit(this.selectedDate);
5293
+ }
5294
+ }
5295
+ setUnit(weekDay) {
5296
+ this.selectedDate = weekDay.date;
5297
+ this.selectedDateChange.emit(this.selectedDate);
5298
+ }
5299
+ changeTheView(view) {
5300
+ this.view = view;
5301
+ this.viewChange.emit(view);
5302
+ this._prepareHeaderData();
5303
+ }
5304
+ /**
5305
+ * Need to resize the host component to size it's fixed positioned child through css
5306
+ */
5307
+ _resizeHost() {
5308
+ if (this._elementRef) {
5309
+ this._renderer.setStyle(this._elementRef.nativeElement, "width", this._elementRef.nativeElement.parentElement.clientWidth - this.scrollbarWidth + "px");
5310
+ }
5311
+ }
5312
+ _prepareHeaderData() {
5313
+ if (this.selectedDate) {
5314
+ switch (this.view) {
5315
+ case CalendarView.DayView:
5316
+ const day = new Day();
5317
+ day.date = new Date(this.selectedDate);
5318
+ const options = { year: "numeric", month: "long", day: "numeric" };
5319
+ day.description = this.selectedDate.toLocaleDateString(this._locale, options);
5320
+ this.day = day;
5321
+ break;
5322
+ case CalendarView.WeekView:
5323
+ const weekView = CalendarUtils.GetDaysOfWeek(this.selectedDate);
5324
+ this.weekDays = weekView.weekDays;
5325
+ if (this.firstAvailableDate) {
5326
+ this.showBackButton = this.weekDays.find(wd => DateUtils.DatesEqual(this.firstAvailableDate, wd.date)) === undefined;
5327
+ }
5328
+ break;
5329
+ case CalendarView.WeekSelectView:
5330
+ const weekSelectView = CalendarUtils.GetDaysOfWeek(this.selectedDate);
5331
+ this.weekDays = weekSelectView.weekDays;
5332
+ this.weekDays.forEach((wd) => {
5333
+ const evPerDay = this._eventsPerDay && this._eventsPerDay.length > 0 ? this._eventsPerDay.find(e => DateUtils.DatesEqual(e.date, wd.date)) : null;
5334
+ if (evPerDay) {
5335
+ wd.events = evPerDay.events;
5336
+ }
5337
+ else {
5338
+ wd.weekdaySelected = false;
5339
+ }
5340
+ });
5341
+ if (this.firstAvailableDate) {
5342
+ this.showBackButton = this.weekDays.find(wd => DateUtils.DatesEqual(this.firstAvailableDate, wd.date)) === undefined;
5343
+ }
5344
+ break;
5345
+ case CalendarView.MonthView:
5346
+ const weekOfMonth = CalendarUtils.GetDaysOfWeek(this.selectedDate);
5347
+ this.weekDays = weekOfMonth.weekDays;
5348
+ if (this.firstAvailableDate) {
5349
+ this.showBackButton = this.weekDays.find(wd => DateUtils.DatesEqual(this.firstAvailableDate, wd.date)) === undefined;
5350
+ }
5351
+ break;
5352
+ }
5353
+ }
5354
+ }
5355
+ }
5356
+ AgendaHeaderComponent.decorators = [
5357
+ { type: Component, args: [{
5358
+ selector: "agenda-header",
5359
+ template: `
5360
+ <div class="agenda-header-wrapper" *ngIf="view === viewTypes.DayView">
5361
+ <div class="hour-label-placeholder">
5362
+ <view-select [selectedView]="view" (selectedViewChange)="changeTheView($event)"></view-select>
5363
+ </div>
5364
+ <div class="week-day-label">
5365
+ <co-icon class="pointer-hover no-user-select sub-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointLeft)" (click)="subUnit()"></co-icon>
5366
+ <div class="day-description" [textContent]="day.description"></div>
5367
+ <co-icon class="pointer-hover no-user-select add-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" (click)="addUnit()"></co-icon>
5368
+ </div>
5369
+ </div>
5370
+ <div class="agenda-header-wrapper" *ngIf="view === viewTypes.WeekView">
5371
+ <div class="hour-label-placeholder">
5372
+ <view-select [selectedView]="view" (selectedViewChange)="changeTheView($event)"></view-select>
5373
+ </div>
5374
+ <div class="week-day-label" *ngFor="let weekDay of weekDays; let index = index" [class.selected]="weekDay.weekdaySelected" (click)="setUnit(weekDay)">
5375
+ <co-icon *ngIf="index === 0 && showBackButton" class="pointer-hover no-user-select sub-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointLeft)" (click)="subUnit()"></co-icon>
5376
+ <div *ngIf="weekDay.newMonth" [textContent]="weekDay.weekdayMonthLong + ' ' + weekDay.weekdayYear" class="month-description"></div>
5377
+ <div class="weekday-value" [textContent]="weekDay.weekdayDay"></div>
5378
+ <div class="weekday-description" [textContent]="weekDay.weekdayShort"></div>
5379
+ <co-icon *ngIf="index === 6" class="pointer-hover no-user-select add-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" (click)="addUnit()"></co-icon>
5380
+ </div>
5381
+ </div>
5382
+ <div class="agenda-header-wrapper" *ngIf="view === viewTypes.WeekSelectView">
5383
+ <div class="week-day-label" *ngFor="let weekDay of weekDays; let index = index"
5384
+ [class.selected]="weekDay.weekdaySelected"
5385
+ [class.selectable]="weekDay.events && weekDay.events.length > 0"
5386
+ (click)="setUnit(weekDay)">
5387
+ <co-icon *ngIf="index === 0 && showBackButton" class="pointer-hover no-user-select sub-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointLeft)" (click)="subUnit()"></co-icon>
5388
+ <div class="weekday-description" [textContent]="weekDay.weekdayShort"></div>
5389
+ <div class="weekday-value" [textContent]="weekDay.weekdayDay + ' ' + weekDay.weekdayMonthShort"></div>
5390
+ <co-icon *ngIf="index === 6" class="pointer-hover no-user-select add-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" (click)="addUnit()"></co-icon>
5391
+ </div>
5392
+ </div>
5393
+ <div class="agenda-header-wrapper" *ngIf="view === viewTypes.MonthView">
5394
+ <div class="week-day-label" *ngFor="let weekDay of weekDays; let index = index">
5395
+ <co-icon *ngIf="index === 0 && showBackButton" class="pointer-hover no-user-select sub-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointLeft)" (click)="subUnit()"></co-icon>
5396
+ <div class="weekday-description" [textContent]="weekDay.weekdayShort"></div>
5397
+ <co-icon *ngIf="index === 6" class="pointer-hover no-user-select add-unit-icon dark" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" (click)="addUnit()"></co-icon>
5398
+ </div>
5399
+ </div>
5400
+ `,
5401
+ encapsulation: ViewEncapsulation.None
5402
+ },] }
5403
+ ];
5404
+ AgendaHeaderComponent.ctorParameters = () => [
5405
+ { type: LanguageCode, decorators: [{ type: Inject, args: [LOCALE_ID,] }] },
5406
+ { type: ElementRef },
5407
+ { type: Renderer2 },
5408
+ { type: NgZone },
5409
+ { type: IconCacheService }
5410
+ ];
5411
+ AgendaHeaderComponent.propDecorators = {
5412
+ selectedDate: [{ type: Input }],
5413
+ view: [{ type: Input }],
5414
+ firstAvailableDate: [{ type: Input }],
5415
+ eventsPerDay: [{ type: Input }],
5416
+ viewChange: [{ type: Output }],
5417
+ selectedDateChange: [{ type: Output }],
5418
+ rangeChange: [{ type: Output }]
5419
+ };
5420
+
5421
+ class AgendaViewComponent {
5422
+ constructor() {
5423
+ this.view = CalendarView.WeekView;
5424
+ this.eventsPerDay = [];
5425
+ this.eventChecked = new EventEmitter();
5426
+ this.viewTypes = CalendarView;
5427
+ }
5428
+ }
5429
+ AgendaViewComponent.decorators = [
5430
+ { type: Component, args: [{
5431
+ selector: "agenda-view",
5432
+ template: `
5433
+ <div class="view-wrapper mini-scrollbar" [ngSwitch]="view">
5434
+ <agenda-day-view *ngSwitchCase="viewTypes.DayView"
5435
+ [selectedDate]="selectedDate" [eventsPerDay]="eventsPerDay" (eventChecked)="eventChecked.emit($event)"></agenda-day-view>
5436
+ <agenda-week-view *ngSwitchCase="viewTypes.WeekView"
5437
+ [view]="view" [selectedDate]="selectedDate" [eventsPerDay]="eventsPerDay" (eventChecked)="eventChecked.emit($event)"></agenda-week-view>
5438
+ <agenda-week-select-view *ngSwitchCase="viewTypes.WeekSelectView"
5439
+ [view]="view" [selectedDate]="selectedDate" [eventsPerDay]="eventsPerDay" (eventChecked)="eventChecked.emit($event)"></agenda-week-select-view>
5440
+ <agenda-month-view *ngSwitchCase="viewTypes.MonthView"
5441
+ [selectedDate]="selectedDate" [eventsPerDay]="eventsPerDay" (eventChecked)="eventChecked.emit($event)"></agenda-month-view>
5442
+ </div>
5443
+ `,
5444
+ encapsulation: ViewEncapsulation.None
5445
+ },] }
5446
+ ];
5447
+ AgendaViewComponent.propDecorators = {
5448
+ view: [{ type: Input }],
5449
+ selectedDate: [{ type: Input }],
5450
+ eventsPerDay: [{ type: Input }],
5451
+ eventChecked: [{ type: Output }]
5452
+ };
5453
+
5454
+ class AgendaBaseViewComponent {
5455
+ constructor(locale, iconCacheService) {
5456
+ this.locale = locale;
5457
+ this.iconCacheService = iconCacheService;
5458
+ this.eventChecked = new EventEmitter();
5459
+ this._eventsPerDay = [];
5460
+ }
5461
+ set selectedDate(value) {
5462
+ this._selectedDate = value;
5463
+ this._dateIsSet();
5464
+ }
5465
+ set eventsPerDay(value) {
5466
+ this._eventsPerDay = value;
5467
+ this._eventsAreSet();
5468
+ }
5469
+ get selectedDate() {
5470
+ return this._selectedDate;
5471
+ }
5472
+ get eventsPerDate() {
5473
+ return this._eventsPerDay;
5474
+ }
5475
+ //overridable by descendents
5476
+ prepareViewData() {
5477
+ }
5478
+ getEventsFromDate(date) {
5479
+ let events = [];
5480
+ if (this.eventsPerDate) {
5481
+ const len = this.eventsPerDate.length;
5482
+ for (let i = 0; i < len; i++) {
5483
+ if (DateUtils.DatesEqual(date, this.eventsPerDate[i].date)) {
5484
+ events = this.eventsPerDate[i].events;
5485
+ break;
5486
+ }
5487
+ }
5488
+ }
5489
+ return events;
5490
+ }
5491
+ _dateIsSet() {
5492
+ this.prepareViewData();
5493
+ }
5494
+ _eventsAreSet() {
5495
+ this.prepareViewData();
5496
+ }
5497
+ }
5498
+ AgendaBaseViewComponent.decorators = [
5499
+ { type: Directive }
5500
+ ];
5501
+ AgendaBaseViewComponent.ctorParameters = () => [
5502
+ { type: LanguageCode, decorators: [{ type: Inject, args: [LOCALE_ID,] }] },
5503
+ { type: IconCacheService }
5504
+ ];
5505
+ AgendaBaseViewComponent.propDecorators = {
5506
+ selectedDate: [{ type: Input }],
5507
+ eventsPerDay: [{ type: Input }],
5508
+ eventChecked: [{ type: Output }]
5509
+ };
5510
+
5511
+ class AgendaMonthViewComponent extends AgendaBaseViewComponent {
5512
+ constructor() {
5513
+ super(...arguments);
5514
+ this.month = NULL_MONTH;
5515
+ this.firstWeekDays = [];
5516
+ this.weeks = [];
5517
+ }
5518
+ prepareViewData() {
5519
+ const month = new Month();
5520
+ if (this.selectedDate) {
5521
+ const day = DateUtils.GetFirstDayOfMonth(this.selectedDate);
5522
+ const endOfMonth = DateUtils.GetLastDayOfMonth(this.selectedDate);
5523
+ let oneMoreIteration = false;
5524
+ let continueLoop = true;
5525
+ while (continueLoop) {
5526
+ if (oneMoreIteration) {
5527
+ continueLoop = false;
5528
+ }
5529
+ const week = CalendarUtils.GetDaysOfWeek(day);
5530
+ const len = week.weekDays.length;
5531
+ for (let i = 0; i < len; i++) {
5532
+ week.weekDays[i].events = this.getEventsFromDate(week.weekDays[i].date);
5533
+ week.weekDays[i].inView = week.weekDays[i].date.getMonth() === this.selectedDate.getMonth();
5534
+ }
5535
+ month.weeks.push(week);
5536
+ day.setDate(day.getDate() + 7);
5537
+ if (day.getTime() >= endOfMonth.getTime()) {
5538
+ oneMoreIteration = true;
5539
+ }
5540
+ }
5541
+ this.month = month;
5542
+ this.firstWeekDays = this.month.firstWeek.weekDays;
5543
+ this.weeks = month.weeks;
5544
+ }
5545
+ }
5546
+ }
5547
+ AgendaMonthViewComponent.decorators = [
5548
+ { type: Component, args: [{
5549
+ selector: "agenda-month-view",
5550
+ template: `
5551
+ <div class="view-wrapper">
5552
+ <div class="hour-view-labels-wrapper"></div>
5553
+ <div class="weeks">
5554
+ <div class="week" *ngFor="let week of weeks" fxLayout="row">
5555
+ <div class="week-day" *ngFor="let weekDay of week.weekDays" [class.not-in-month]="!weekDay.inView">
5556
+ <div class="day" [textContent]="weekDay.weekdayDay"></div>
5557
+ </div>
5558
+ </div>
5559
+ </div>
5560
+ </div>
5561
+ `,
5562
+ encapsulation: ViewEncapsulation.None
5563
+ },] }
5564
+ ];
5565
+
5566
+ class AgendaDayViewComponent extends AgendaBaseViewComponent {
5567
+ constructor() {
5568
+ super(...arguments);
5569
+ this.events = [];
5570
+ }
5571
+ prepareViewData() {
5572
+ if (this.eventsPerDate && this.eventsPerDate.length > 0) {
5573
+ this.events = this.eventsPerDate[0].events;
5574
+ }
5575
+ }
5576
+ }
5577
+ AgendaDayViewComponent.decorators = [
5578
+ { type: Component, args: [{
5579
+ selector: "agenda-day-view",
5580
+ template: `
5581
+ <div class="view-wrapper">
5582
+ <agenda-hour-view-labels [date]="selectedDate"></agenda-hour-view-labels>
5583
+ <agenda-hour-view [date]="selectedDate">
5584
+ <agenda-events
5585
+ [halfHourHeight]="40"
5586
+ [events]="events"
5587
+ (eventChecked)="eventChecked.emit($event)"
5588
+ ></agenda-events>
5589
+ </agenda-hour-view>
5590
+ </div>
5591
+ `,
5592
+ encapsulation: ViewEncapsulation.None
5593
+ },] }
5594
+ ];
5595
+
5596
+ class AgendaWeekViewComponent extends AgendaBaseViewComponent /*implements OnInit, OnDestroy*/ {
5597
+ constructor() {
5598
+ super(...arguments);
5599
+ this.view = CalendarView.WeekView;
5600
+ this.week = NULL_WEEK;
5601
+ }
5602
+ prepareViewData() {
5603
+ if (this.selectedDate) {
5604
+ // get the events
5605
+ const week = CalendarUtils.GetDaysOfWeek(this.selectedDate);
5606
+ const len = week.weekDays.length;
5607
+ for (let i = 0; i < len; i++) {
5608
+ week.weekDays[i].events = this.getEventsFromDate(week.weekDays[i].date);
5609
+ }
5610
+ this.week = week;
5611
+ }
5612
+ }
5613
+ }
5614
+ AgendaWeekViewComponent.decorators = [
5615
+ { type: Component, args: [{
5616
+ selector: "agenda-week-view",
5617
+ template: `
5618
+ <div class="view-wrapper">
5619
+ <agenda-hour-view-labels [date]="selectedDate"></agenda-hour-view-labels>
5620
+ <div class="week-day" *ngFor="let weekDay of week.weekDays">
5621
+ <agenda-hour-view [date]="weekDay.date">
5622
+ <agenda-events
5623
+ [halfHourHeight]="40"
5624
+ [events]="weekDay.events"
5625
+ (eventChecked)="eventChecked.emit($event)"
5626
+ [view]="view"
5627
+ ></agenda-events>
5628
+ </agenda-hour-view>
5629
+ </div>
5630
+ </div>
5631
+ `,
5632
+ encapsulation: ViewEncapsulation.None
5633
+ },] }
5634
+ ];
5635
+ AgendaWeekViewComponent.propDecorators = {
5636
+ view: [{ type: Input }]
5637
+ };
5638
+
5639
+ class AgendaWeekSelectViewComponent extends AgendaBaseViewComponent {
5640
+ constructor() {
5641
+ super(...arguments);
5642
+ this.view = CalendarView.WeekSelectView;
5643
+ this.week = NULL_WEEK;
5644
+ this.icons = Icon;
5645
+ }
5646
+ prepareViewData() {
5647
+ if (this.selectedDate) {
5648
+ // get the events
5649
+ const week = CalendarUtils.GetDaysOfWeek(this.selectedDate);
5650
+ const len = week.weekDays.length;
5651
+ for (let i = 0; i < len; i++) {
5652
+ week.weekDays[i].events = this.getEventsFromDate(week.weekDays[i].date);
5653
+ }
5654
+ this.week = week;
5655
+ }
5656
+ }
5657
+ }
5658
+ AgendaWeekSelectViewComponent.decorators = [
5659
+ { type: Component, args: [{
5660
+ selector: "agenda-week-select-view",
5661
+ template: `
5662
+ <div class="view-wrapper week-select-view">
5663
+ <div class="week-day" *ngFor="let weekDay of week.weekDays">
5664
+ <div class="week-select-container" *ngIf="weekDay.weekdaySelected">
5665
+ <div class="week-select-left">
5666
+ <h3 [textContent]="'AGENDA_CHOOSE_DELIVERY_PERIOD'"></h3>
5667
+ <div class="week-select-list mini-scrollbar">
5668
+ <agenda-events
5669
+ [halfHourHeight]="40"
5670
+ [events]="weekDay.events"
5671
+ (eventChecked)="eventChecked.emit($event)"
5672
+ [view]="view"
5673
+ ></agenda-events>
5674
+ <div class="no-events-banner" *ngIf="weekDay.events.length === 0">
5675
+ <p [textContent]="'AGENDA_NO_PERIODS_AVAILABLE'"></p>
5676
+ </div>
5677
+ </div>
5678
+ </div>
5679
+ <div class="week-select-right">
5680
+ <h3 [textContent]="'AGENDA_FOR_EVERY_PERIOD'"></h3>
5681
+ <ul>
5682
+ <li><co-icon [iconData]="iconCacheService.getIcon(icons.CheckRound)" class="small action-color moment-icon"></co-icon><span [textContent]="'AGENDA_FOR_EVERY_PERIOD_REASON1'"></span></li>
5683
+ <li><co-icon [iconData]="iconCacheService.getIcon(icons.CheckRound)" class="small action-color moment-icon"></co-icon><span [textContent]="'AGENDA_FOR_EVERY_PERIOD_REASON2'"></span></li>
5684
+ </ul>
5685
+ </div>
5686
+ </div>
5687
+ </div>
5688
+ </div>
5689
+ `,
5690
+ encapsulation: ViewEncapsulation.None
5691
+ },] }
5692
+ ];
5693
+ AgendaWeekSelectViewComponent.propDecorators = {
5694
+ view: [{ type: Input }]
5695
+ };
5696
+
5697
+ class AgendaHourViewComponent {
5698
+ constructor() {
5699
+ this.datesByTheHour = [];
5700
+ this._date = new Date();
5701
+ }
5702
+ set date(value) {
5703
+ this._date = new Date(value);
5704
+ this._prepareViewData();
5705
+ }
5706
+ get date() {
5707
+ return this._date;
5708
+ }
5709
+ // fixme remove ctrl + c, ctrl + v code duplication with AgendaHourViewLabelsComponent._prepareViewData()
5710
+ _prepareViewData() {
5711
+ this.datesByTheHour.length = 0;
5712
+ if (this.date) {
5713
+ let newDate = new Date(this.date);
5714
+ newDate.setHours(0, 0, 0, 0);
5715
+ this.datesByTheHour.push(newDate);
5716
+ for (let i = 0; i < 23; i++) {
5717
+ newDate = new Date(newDate);
5718
+ newDate.setHours(newDate.getHours() + 1);
5719
+ this.datesByTheHour.push(newDate);
5720
+ }
5721
+ }
5722
+ }
5723
+ }
5724
+ AgendaHourViewComponent.decorators = [
5725
+ { type: Component, args: [{
5726
+ selector: "agenda-hour-view",
5727
+ template: `
5728
+ <div class="row-per-hour" *ngFor="let dateByTheHour of datesByTheHour">
5729
+ <div fxLayout="row">
5730
+ <agenda-hour-cell [date]="dateByTheHour"></agenda-hour-cell>
5731
+ </div>
5732
+ </div>
5733
+ <ng-content></ng-content>
5734
+ `,
5735
+ encapsulation: ViewEncapsulation.None
5736
+ },] }
5737
+ ];
5738
+ AgendaHourViewComponent.propDecorators = {
5739
+ date: [{ type: Input }]
5740
+ };
5741
+
5742
+ class AgendaHourCellComponent {
5743
+ constructor() {
5744
+ this.onlyLabels = false;
5745
+ this.noLabels = false;
5746
+ }
5747
+ set date(value) {
5748
+ this._date = value;
5749
+ this._setNextHalfHour();
5750
+ }
5751
+ get date() {
5752
+ return this._date;
5753
+ }
5754
+ _setNextHalfHour() {
5755
+ this.datePlushalfHour = new Date(this._date);
5756
+ this.datePlushalfHour.setMinutes(this.datePlushalfHour.getMinutes() + 30);
5757
+ }
5758
+ }
5759
+ AgendaHourCellComponent.decorators = [
5760
+ { type: Component, args: [{
5761
+ selector: "agenda-hour-cell",
5762
+ template: `
5763
+ <div class="row-per-half-hour">
5764
+ <agenda-half-hour-cell [date]="date" [showLabel]="onlyLabels && !noLabels"></agenda-half-hour-cell>
5765
+ <agenda-half-hour-cell [date]="datePlushalfHour"></agenda-half-hour-cell>
5766
+ </div>
5767
+ `,
5768
+ encapsulation: ViewEncapsulation.None
5769
+ },] }
5770
+ ];
5771
+ AgendaHourCellComponent.propDecorators = {
5772
+ onlyLabels: [{ type: Input }],
5773
+ noLabels: [{ type: Input }],
5774
+ date: [{ type: Input }]
5775
+ };
5776
+
5777
+ class AgendaHourViewLabelsComponent {
5778
+ constructor() {
5779
+ this.noLabels = false;
5780
+ this.datesByTheHour = [];
5781
+ this._date = new Date();
5782
+ }
5783
+ set date(value) {
5784
+ this._date = new Date(value);
5785
+ this._date.setDate(1);
5786
+ this._date.setMonth(1);
5787
+ this._date.setFullYear(1);
5788
+ this._prepareViewData();
5789
+ }
5790
+ get date() {
5791
+ return this._date;
5792
+ }
5793
+ // fixme remove ctrl + c, ctrl + v code duplication with AgendaHourViewComponent._prepareViewData()
5794
+ _prepareViewData() {
5795
+ this.datesByTheHour.length = 0;
5796
+ if (this.date) {
5797
+ let newDate = new Date(this.date);
5798
+ newDate.setHours(0, 0, 0, 0);
5799
+ this.datesByTheHour.push(newDate);
5800
+ for (let i = 0; i < 23; i++) {
5801
+ newDate = new Date(newDate);
5802
+ newDate.setHours(newDate.getHours() + 1);
5803
+ this.datesByTheHour.push(newDate);
5804
+ }
5805
+ }
5806
+ }
5807
+ }
5808
+ AgendaHourViewLabelsComponent.decorators = [
5809
+ { type: Component, args: [{
5810
+ selector: "agenda-hour-view-labels",
5811
+ template: `
5812
+ <div class="row-per-hour" *ngFor="let dateByTheHour of datesByTheHour">
5813
+ <div>
5814
+ <agenda-hour-cell [date]="dateByTheHour" onlyLabels [noLabels]="noLabels"></agenda-hour-cell>
5815
+ </div>
5816
+ </div>
5817
+ `,
5818
+ encapsulation: ViewEncapsulation.None
5819
+ },] }
5820
+ ];
5821
+ AgendaHourViewLabelsComponent.propDecorators = {
5822
+ date: [{ type: Input }],
5823
+ noLabels: [{ type: Input }]
5824
+ };
5825
+
5826
+ class AgendaHalfHourCellComponent {
5827
+ constructor(_renderer) {
5828
+ this._renderer = _renderer;
5829
+ this.showLabel = false;
5830
+ this.showCurrentTime = false;
5831
+ this.currentTimeTop = 0;
5832
+ }
5833
+ set date(value) {
5834
+ this._date = value;
5835
+ this._checkDate();
5836
+ this._checkWorkingDayStart();
5837
+ }
5838
+ get date() {
5839
+ return this._date;
5840
+ }
5841
+ ngOnDestroy() {
5842
+ this.currentTimeElement = undefined;
5843
+ }
5844
+ _checkDate() {
5845
+ const checkDate = new Date();
5846
+ const minutesFrom = this.date.getMinutes();
5847
+ const minutesTo = minutesFrom + 30;
5848
+ if (DateUtils.DatesEqual(this.date, checkDate)) {
5849
+ if (checkDate.getHours() === this.date.getHours() && (checkDate.getMinutes() > minutesFrom && checkDate.getMinutes() < minutesTo)) {
5850
+ this.currentTimeTop = (Math.max(checkDate.getMinutes(), .01) / 60) * 100;
5851
+ this._positionCurrentTime();
5852
+ this.showCurrentTime = true;
5853
+ }
5854
+ }
5855
+ }
5856
+ _checkWorkingDayStart() {
5857
+ this.id = (this._date.getHours() === 8 && this._date.getMinutes() === 30) ? "dayStart" : "";
5858
+ }
5859
+ _positionCurrentTime() {
5860
+ if (this.currentTimeElement) {
5861
+ this._renderer.setStyle(this.currentTimeElement.nativeElement, "top", this.currentTimeTop + "%");
5862
+ this.currentTimeElement.nativeElement.scrollIntoView();
5863
+ }
5864
+ }
5865
+ }
5866
+ AgendaHalfHourCellComponent.decorators = [
5867
+ { type: Component, args: [{
5868
+ selector: "agenda-half-hour-cell",
5869
+ template: `
5870
+ <div id="{{id}}" class="cell-wrapper">
5871
+ <div *ngIf="showLabel" [class.show]="showLabel" class="half-hour-label">
5872
+ <div [textContent]="date | date:'HH:mm'"></div>
5873
+ </div>
5874
+ <div *ngIf="showCurrentTime" id="currentTime" class="current-time" #currentTime></div>
5875
+ <div class="content-wrapper">
5876
+ <ng-content></ng-content>
5877
+ </div>
5878
+ </div>
5879
+ `,
5880
+ encapsulation: ViewEncapsulation.None
5881
+ },] }
5882
+ ];
5883
+ AgendaHalfHourCellComponent.ctorParameters = () => [
5884
+ { type: Renderer2 }
5885
+ ];
5886
+ AgendaHalfHourCellComponent.propDecorators = {
5887
+ currentTimeElement: [{ type: ViewChild, args: ["currentTime",] }],
5888
+ date: [{ type: Input }],
5889
+ showLabel: [{ type: Input }]
5890
+ };
5891
+
5892
+ class AgendaEventsComponent {
5893
+ constructor() {
5894
+ this.viewTypes = CalendarView;
5895
+ this.view = CalendarView.WeekView;
5896
+ this.type = "";
5897
+ this.events = [];
5898
+ this.eventChecked = new EventEmitter();
5899
+ }
5900
+ }
5901
+ AgendaEventsComponent.decorators = [
5902
+ { type: Component, args: [{
5903
+ selector: "agenda-events",
5904
+ template: `
5905
+ <ng-container *ngIf="view !== viewTypes.WeekSelectView">
5906
+ <agenda-event
5907
+ *ngFor="let event of events"
5908
+ [halfHourHeight]="halfHourHeight"
5909
+ [event]="event"
5910
+ (eventChecked)="eventChecked.emit($event)"
5911
+ ></agenda-event>
5912
+ </ng-container>
5913
+ <ng-container *ngIf="view === viewTypes.WeekSelectView">
5914
+ <agenda-select-event
5915
+ *ngFor="let event of events"
5916
+ [event]="event"
5917
+ (eventChecked)="eventChecked.emit($event)"
5918
+ ></agenda-select-event>
5919
+ </ng-container>
5920
+ `,
5921
+ encapsulation: ViewEncapsulation.None
5922
+ },] }
5923
+ ];
5924
+ AgendaEventsComponent.ctorParameters = () => [];
5925
+ AgendaEventsComponent.propDecorators = {
5926
+ view: [{ type: Input }],
5927
+ type: [{ type: Input }],
5928
+ events: [{ type: Input }],
5929
+ halfHourHeight: [{ type: Input }],
5930
+ eventChecked: [{ type: Output }]
5931
+ };
5932
+
5933
+ class AgendaEventComponent {
5934
+ constructor(_elementRef, _renderer, iconCacheService) {
5935
+ this._elementRef = _elementRef;
5936
+ this._renderer = _renderer;
5937
+ this.iconCacheService = iconCacheService;
5938
+ this.icons = Icon;
5939
+ this.event = NULL_AGENDA_EVENT;
5940
+ this.eventChecked = new EventEmitter();
5941
+ }
5942
+ ngOnDestroy() {
5943
+ this._elementRef = undefined;
5944
+ }
5945
+ ngOnInit() {
5946
+ const hourTo = this.event.from.getHours();
5947
+ const minutesTo = this.event.from.getMinutes();
5948
+ const multiply = hourTo + (minutesTo / 60);
5949
+ const top = multiply * (this.halfHourHeight * 2);
5950
+ this._renderer.setStyle(this._elementRef.nativeElement, "top", top + "px");
5951
+ const hours = Math.abs(this.event.to.getTime() - this.event.from.getTime()) / 3600000;
5952
+ const height = hours * (this.halfHourHeight * 2) - 1;
5953
+ this._renderer.setStyle(this._elementRef.nativeElement, "height", height + "px");
5954
+ }
5955
+ checkEvent(event) {
5956
+ this.event.checked = !this.event.checked;
5957
+ this.eventChecked.emit(this.event);
5958
+ }
5959
+ }
5960
+ AgendaEventComponent.decorators = [
5961
+ { type: Component, args: [{
5962
+ selector: "agenda-event",
5963
+ template: `
5964
+ <div class="agenda-event-wrapper" [class.checkable]="event.showCheckbox" [class.selected]="event.checked" (click)="checkEvent($event)">
5965
+ <div [textContent]="event.fromToRepresentation" class="event-description"></div>
5966
+ <co-icon *ngIf="event.showCheckbox" [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" [class.checked]="event.checked"></co-icon>
5967
+ </div>
5968
+ `,
5969
+ encapsulation: ViewEncapsulation.None
5970
+ },] }
5971
+ ];
5972
+ AgendaEventComponent.ctorParameters = () => [
5973
+ { type: ElementRef },
5974
+ { type: Renderer2 },
5975
+ { type: IconCacheService }
5976
+ ];
5977
+ AgendaEventComponent.propDecorators = {
5978
+ event: [{ type: Input }],
5979
+ halfHourHeight: [{ type: Input }],
5980
+ eventChecked: [{ type: Output }]
5981
+ };
5982
+
5983
+ // Pipe capable of transforming the first character of a string-value to upper case.
5984
+ class UCfirstPipe {
5985
+ transform(value) {
5986
+ if (typeof value === "string") {
5987
+ return value.charAt(0).toUpperCase() + value.slice(1);
5988
+ }
5989
+ return value;
5990
+ }
5991
+ }
5992
+ UCfirstPipe.decorators = [
5993
+ { type: Pipe, args: [{
5994
+ name: "ucfirst"
5995
+ },] }
5996
+ ];
5997
+
5998
+ const MASTER_PIPES = [
5999
+ ArrayNumberPipe,
6000
+ UCfirstPipe
6001
+ ];
6002
+
6003
+ // <b>Enum</b> Represents the different states of the three way thumb.
6004
+ var ThumbThreeWayState;
6005
+ (function (ThumbThreeWayState) {
6006
+ ThumbThreeWayState[ThumbThreeWayState["Left"] = 0] = "Left";
6007
+ ThumbThreeWayState[ThumbThreeWayState["Middle"] = 1] = "Middle";
6008
+ ThumbThreeWayState[ThumbThreeWayState["Right"] = 2] = "Right";
6009
+ })(ThumbThreeWayState || (ThumbThreeWayState = {}));
6010
+ function NextStateOfThumbThreeWay(state) {
6011
+ switch (state) {
6012
+ case ThumbThreeWayState.Left:
6013
+ return ThumbThreeWayState.Middle;
6014
+ case ThumbThreeWayState.Middle:
6015
+ return ThumbThreeWayState.Right;
6016
+ case ThumbThreeWayState.Right:
6017
+ default:
6018
+ return ThumbThreeWayState.Left;
6019
+ }
6020
+ }
6021
+
6022
+ // Static utility functions holder related to Maps.
6023
+ class MapUtils {
6024
+ /**
6025
+ * Returns the first key from given map, for which the value filter holds true. Basically a reverse Map.get(key) function.
6026
+ * @param map
6027
+ * @param valueFilter For the first value that returns true for this filter functions, its key will be returned.
6028
+ */
6029
+ static FindKeyByValue(map, valueFilter) {
6030
+ if (!map || !valueFilter) {
6031
+ return undefined;
6032
+ }
6033
+ let foundKey = undefined;
6034
+ let keyWasFound = false;
6035
+ map.forEach((value, key) => {
6036
+ if (!keyWasFound && valueFilter.call(this, value)) {
6037
+ foundKey = key;
6038
+ keyWasFound = true;
6039
+ }
6040
+ });
6041
+ return foundKey;
6042
+ }
6043
+ /**
6044
+ * Inserts given arrayEntry into given map, under given mapKey. What's special here, is that a NEW map entry is created with an array
6045
+ * containing the single [arrayEntry] item, if no entry yet existed.
6046
+ * @param map
6047
+ * @param mapKey
6048
+ * @param arrayEntry
6049
+ */
6050
+ static InsertArrayItemIntoMap(map, mapKey, arrayEntry) {
6051
+ if (!map) {
6052
+ return;
6053
+ }
6054
+ if (!map.has(mapKey)) {
6055
+ map.set(mapKey, [arrayEntry]);
6056
+ }
6057
+ else {
6058
+ map.get(mapKey).push(arrayEntry);
6059
+ }
6060
+ }
6061
+ }
6062
+
6063
+ class ViewSelectComponent {
6064
+ constructor() {
6065
+ this._viewsToThumb = new Map([
6066
+ [CalendarView.DayView, ThumbThreeWayState.Left],
6067
+ [CalendarView.WeekView, ThumbThreeWayState.Middle],
6068
+ [CalendarView.MonthView, ThumbThreeWayState.Right]
6069
+ ]);
6070
+ this.selectedView = CalendarView.WeekView;
6071
+ this.selectedViewChange = new EventEmitter();
6072
+ }
6073
+ get modelAsThumbState() {
6074
+ return this._viewsToThumb.get(this.selectedView);
6075
+ }
6076
+ onThumbStateChange(thumbState) {
6077
+ this.selectedView = MapUtils.FindKeyByValue(this._viewsToThumb, (value) => {
6078
+ return (value === thumbState);
6079
+ });
6080
+ this.selectedViewChange.emit(this.selectedView);
6081
+ }
6082
+ }
6083
+ ViewSelectComponent.decorators = [
6084
+ { type: Component, args: [{
6085
+ selector: "view-select",
6086
+ template: `
6087
+ <div class="select-wrapper">
6088
+ <div [textContent]="'DAY'" class="label"></div>
6089
+ <div [textContent]="'MONTH'" class="label"></div>
6090
+ </div>
6091
+ `,
6092
+ encapsulation: ViewEncapsulation.None
6093
+ },] }
6094
+ ];
6095
+ ViewSelectComponent.ctorParameters = () => [];
6096
+ ViewSelectComponent.propDecorators = {
6097
+ selectedView: [{ type: Input }],
6098
+ selectedViewChange: [{ type: Output }]
6099
+ };
6100
+
6101
+ class AgendaSelectEventComponent {
6102
+ constructor(iconCacheService) {
6103
+ this.iconCacheService = iconCacheService;
6104
+ this.icons = Icon;
6105
+ this.event = NULL_AGENDA_EVENT;
6106
+ this.eventChecked = new EventEmitter();
6107
+ }
6108
+ checkEvent(event) {
6109
+ this.event.checked = !this.event.checked;
6110
+ this.eventChecked.emit(this.event);
6111
+ }
6112
+ }
6113
+ AgendaSelectEventComponent.decorators = [
6114
+ { type: Component, args: [{
6115
+ selector: "agenda-select-event",
6116
+ template: `
6117
+ <div class="week-select-item" (click)="checkEvent($event)">
6118
+ <co-icon [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" class="select-icon action-color" *ngIf="!event.checked"></co-icon>
6119
+ <co-icon [iconData]="iconCacheService.getIcon(icons.ArrowPointRight)" class="select-icon action-color" *ngIf="event.checked"></co-icon>
6120
+ <div class="moment-name">
6121
+ <small>{{ event.date | date: 'EEEE d MMMM' | uppercase }}</small>
6122
+ <h2>{{ event.description }}</h2>
6123
+ </div>
6124
+ </div>
6125
+ `
6126
+ },] }
6127
+ ];
6128
+ AgendaSelectEventComponent.ctorParameters = () => [
6129
+ { type: IconCacheService }
6130
+ ];
6131
+ AgendaSelectEventComponent.propDecorators = {
6132
+ event: [{ type: Input }],
6133
+ eventChecked: [{ type: Output }]
6134
+ };
6135
+
6136
+ class DatePlanningModule {
6137
+ }
6138
+ DatePlanningModule.decorators = [
6139
+ { type: NgModule, args: [{
6140
+ imports: [
6141
+ CommonModule,
6142
+ InputDatePickerModule,
6143
+ IconModule,
6144
+ ButtonModule,
6145
+ ],
6146
+ declarations: [
6147
+ DatePlanningComponent,
6148
+ CalendarAllYearsComponent,
6149
+ CalendarAllMonthsComponent,
6150
+ CalendarHeaderComponent,
6151
+ CalendarComponent,
6152
+ CalendarViewComponent,
6153
+ AgendaHeaderComponent,
6154
+ AgendaViewComponent,
6155
+ AgendaMonthViewComponent,
6156
+ AgendaDayViewComponent,
6157
+ AgendaWeekViewComponent,
6158
+ AgendaWeekSelectViewComponent,
6159
+ AgendaHourViewComponent,
6160
+ AgendaHourCellComponent,
6161
+ AgendaHourViewLabelsComponent,
6162
+ AgendaHalfHourCellComponent,
6163
+ AgendaEventsComponent,
6164
+ AgendaEventComponent,
6165
+ ViewSelectComponent,
6166
+ AgendaSelectEventComponent,
6167
+ MASTER_PIPES
6168
+ ],
6169
+ exports: [
6170
+ DatePlanningComponent
6171
+ ]
6172
+ },] }
6173
+ ];
6174
+
3482
6175
  class SharedService {
3483
6176
  constructor(options, connector) {
3484
6177
  this.options = options;
@@ -3510,5 +6203,5 @@ SharedService.ctorParameters = () => [
3510
6203
  * Generated bundle index. Do not edit.
3511
6204
  */
3512
6205
 
3513
- export { CoCircularGaugeComponent, CoCircularGaugeModule, CoLinearGaugeComponent, CoLinearGaugeModule, DocsignComponent, DocsignModule, KeyPadComponent, KeyPadModule, LayoutSwitcherComponent, LayoutSwitcherModule, SendMethodDialogComponent, SendMethodDialogModule, SharedService, StatusbarComponent, StatusbarModule, StockComponent, StockModule, SignatureComponent as ɵa, SignaturesComponent as ɵb, StockService as ɵc, SharedConnectorService as ɵd, OptionsService as ɵe, DictionaryService as ɵf, IconCacheService as ɵg, StockInformationComponent as ɵh, StockInformationGridComponent as ɵi, StockLocationComponent as ɵj, StockTransferComponent as ɵk, StockChangeAmountComponent as ɵl };
6206
+ export { CoCircularGaugeComponent, CoCircularGaugeModule, CoLinearGaugeComponent, CoLinearGaugeModule, DatePlanningComponent, DatePlanningModule, DocsignComponent, DocsignModule, KeyPadComponent, KeyPadModule, LayoutSwitcherComponent, LayoutSwitcherModule, SendMethodDialogComponent, SendMethodDialogModule, SharedService, StatusbarComponent, StatusbarModule, StockComponent, StockModule, SignatureComponent as ɵa, SignaturesComponent as ɵb, AgendaHourCellComponent as ɵba, AgendaHourViewLabelsComponent as ɵbb, AgendaHalfHourCellComponent as ɵbc, AgendaEventsComponent as ɵbd, AgendaEventComponent as ɵbe, ViewSelectComponent as ɵbf, AgendaSelectEventComponent as ɵbg, MASTER_PIPES as ɵbh, ArrayNumberPipe as ɵbi, UCfirstPipe as ɵbj, StockService as ɵc, SharedConnectorService as ɵd, OptionsService as ɵe, DictionaryService as ɵf, IconCacheService as ɵg, StockInformationComponent as ɵh, StockInformationGridComponent as ɵi, StockLocationComponent as ɵj, StockTransferComponent as ɵk, StockChangeAmountComponent as ɵl, CalendarAllYearsComponent as ɵm, CalendarAllMonthsComponent as ɵn, CalendarHeaderComponent as ɵo, CalendarComponent as ɵp, CalendarViewComponent as ɵq, LanguageCode as ɵr, AgendaHeaderComponent as ɵs, AgendaViewComponent as ɵt, AgendaMonthViewComponent as ɵu, AgendaBaseViewComponent as ɵv, AgendaDayViewComponent as ɵw, AgendaWeekViewComponent as ɵx, AgendaWeekSelectViewComponent as ɵy, AgendaHourViewComponent as ɵz };
3514
6207
  //# sourceMappingURL=colijnit-sharedcomponents.js.map