monkey-style-guide 2.0.82 → 2.0.86

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 (197) hide show
  1. package/README.md +1 -1
  2. package/assets/scss/partials/components/_buttons.scss +5 -5
  3. package/assets/scss/partials/components/_date-range-picker.scss +204 -0
  4. package/assets/scss/partials/components/_index.scss +1 -0
  5. package/bundles/monkey-style-guide.umd.js +249 -7
  6. package/bundles/monkey-style-guide.umd.js.map +1 -1
  7. package/esm2015/lib/components/badge/badge.component.ngfactory.js +17 -0
  8. package/esm2015/lib/components/badge/badge.component.ngsummary.json +1 -0
  9. package/esm2015/lib/components/badge/badge.module.ngfactory.js +12 -0
  10. package/esm2015/lib/components/badge/badge.module.ngsummary.json +1 -0
  11. package/esm2015/lib/components/badge/index.ngsummary.json +1 -0
  12. package/esm2015/lib/components/button/button-avatar.component.ngfactory.js +19 -0
  13. package/esm2015/lib/components/button/button-avatar.component.ngsummary.json +1 -0
  14. package/esm2015/lib/components/button/button-dropdown.component.ngfactory.js +39 -0
  15. package/esm2015/lib/components/button/button-dropdown.component.ngsummary.json +1 -0
  16. package/esm2015/lib/components/button/button.component.ngfactory.js +31 -0
  17. package/esm2015/lib/components/button/button.component.ngsummary.json +1 -0
  18. package/esm2015/lib/components/button/button.module.ngfactory.js +14 -0
  19. package/esm2015/lib/components/button/button.module.ngsummary.json +1 -0
  20. package/esm2015/lib/components/button/index.ngsummary.json +1 -0
  21. package/esm2015/lib/components/checkbox/checkbox.component.ngfactory.js +38 -0
  22. package/esm2015/lib/components/checkbox/checkbox.component.ngsummary.json +1 -0
  23. package/esm2015/lib/components/checkbox/checkbox.module.ngfactory.js +13 -0
  24. package/esm2015/lib/components/checkbox/checkbox.module.ngsummary.json +1 -0
  25. package/esm2015/lib/components/checkbox/index.ngsummary.json +1 -0
  26. package/esm2015/lib/components/date-range-picker/date-range-picker.component.js +323 -0
  27. package/esm2015/lib/components/date-range-picker/date-range-picker.component.ngfactory.js +75 -0
  28. package/esm2015/lib/components/date-range-picker/date-range-picker.component.ngsummary.json +1 -0
  29. package/esm2015/lib/components/date-range-picker/date-range-picker.module.js +17 -0
  30. package/esm2015/lib/components/date-range-picker/date-range-picker.module.ngfactory.js +15 -0
  31. package/esm2015/lib/components/date-range-picker/date-range-picker.module.ngsummary.json +1 -0
  32. package/esm2015/lib/components/date-range-picker/index.js +3 -0
  33. package/esm2015/lib/components/date-range-picker/index.ngsummary.json +1 -0
  34. package/esm2015/lib/components/expansion/expansion.component.ngfactory.js +35 -0
  35. package/esm2015/lib/components/expansion/expansion.component.ngsummary.json +1 -0
  36. package/esm2015/lib/components/expansion/expansion.module.ngfactory.js +13 -0
  37. package/esm2015/lib/components/expansion/expansion.module.ngsummary.json +1 -0
  38. package/esm2015/lib/components/expansion/index.ngsummary.json +1 -0
  39. package/esm2015/lib/components/file-upload/file-upload.component.ngfactory.js +39 -0
  40. package/esm2015/lib/components/file-upload/file-upload.component.ngsummary.json +1 -0
  41. package/esm2015/lib/components/file-upload/file-upload.module.ngfactory.js +15 -0
  42. package/esm2015/lib/components/file-upload/file-upload.module.ngsummary.json +1 -0
  43. package/esm2015/lib/components/file-upload/index.ngsummary.json +1 -0
  44. package/esm2015/lib/components/icon/icon.component.ngfactory.js +88 -0
  45. package/esm2015/lib/components/icon/icon.component.ngsummary.json +1 -0
  46. package/esm2015/lib/components/icon/icon.module.ngfactory.js +12 -0
  47. package/esm2015/lib/components/icon/icon.module.ngsummary.json +1 -0
  48. package/esm2015/lib/components/icon/icons.component.ngfactory.js +465 -0
  49. package/esm2015/lib/components/icon/icons.component.ngsummary.json +1 -0
  50. package/esm2015/lib/components/icon/index.ngsummary.json +1 -0
  51. package/esm2015/lib/components/image-crop/image-crop.component.ngfactory.js +108 -0
  52. package/esm2015/lib/components/image-crop/image-crop.component.ngsummary.json +1 -0
  53. package/esm2015/lib/components/image-crop/image-crop.module.ngfactory.js +17 -0
  54. package/esm2015/lib/components/image-crop/image-crop.module.ngsummary.json +1 -0
  55. package/esm2015/lib/components/image-crop/index.ngsummary.json +1 -0
  56. package/esm2015/lib/components/index.js +2 -1
  57. package/esm2015/lib/components/index.ngsummary.json +1 -0
  58. package/esm2015/lib/components/input/index.ngsummary.json +1 -0
  59. package/esm2015/lib/components/input/input-filter.component.ngfactory.js +129 -0
  60. package/esm2015/lib/components/input/input-filter.component.ngsummary.json +1 -0
  61. package/esm2015/lib/components/input/input.component.js +12 -3
  62. package/esm2015/lib/components/input/input.component.ngfactory.js +139 -0
  63. package/esm2015/lib/components/input/input.component.ngsummary.json +1 -0
  64. package/esm2015/lib/components/input/input.module.ngfactory.js +15 -0
  65. package/esm2015/lib/components/input/input.module.ngsummary.json +1 -0
  66. package/esm2015/lib/components/modal/index.ngsummary.json +1 -0
  67. package/esm2015/lib/components/modal/modal.component.ngfactory.js +61 -0
  68. package/esm2015/lib/components/modal/modal.component.ngsummary.json +1 -0
  69. package/esm2015/lib/components/modal/modal.module.ngfactory.js +15 -0
  70. package/esm2015/lib/components/modal/modal.module.ngsummary.json +1 -0
  71. package/esm2015/lib/components/option/index.ngsummary.json +1 -0
  72. package/esm2015/lib/components/option/option.component.ngfactory.js +24 -0
  73. package/esm2015/lib/components/option/option.component.ngsummary.json +1 -0
  74. package/esm2015/lib/components/option/option.module.ngfactory.js +12 -0
  75. package/esm2015/lib/components/option/option.module.ngsummary.json +1 -0
  76. package/esm2015/lib/components/radiobutton/index.ngsummary.json +1 -0
  77. package/esm2015/lib/components/radiobutton/radiobutton.component.ngfactory.js +18 -0
  78. package/esm2015/lib/components/radiobutton/radiobutton.component.ngsummary.json +1 -0
  79. package/esm2015/lib/components/radiobutton/radiobutton.module.ngfactory.js +13 -0
  80. package/esm2015/lib/components/radiobutton/radiobutton.module.ngsummary.json +1 -0
  81. package/esm2015/lib/components/select/index.ngsummary.json +1 -0
  82. package/esm2015/lib/components/select/select-filter.component.ngfactory.js +30 -0
  83. package/esm2015/lib/components/select/select-filter.component.ngsummary.json +1 -0
  84. package/esm2015/lib/components/select/select-multiple.component.ngfactory.js +33 -0
  85. package/esm2015/lib/components/select/select-multiple.component.ngsummary.json +1 -0
  86. package/esm2015/lib/components/select/select-search.component.ngfactory.js +48 -0
  87. package/esm2015/lib/components/select/select-search.component.ngsummary.json +1 -0
  88. package/esm2015/lib/components/select/select.component.ngfactory.js +33 -0
  89. package/esm2015/lib/components/select/select.component.ngsummary.json +1 -0
  90. package/esm2015/lib/components/select/select.module.ngfactory.js +17 -0
  91. package/esm2015/lib/components/select/select.module.ngsummary.json +1 -0
  92. package/esm2015/lib/components/stepper/index.ngsummary.json +1 -0
  93. package/esm2015/lib/components/stepper/stepper.component.ngfactory.js +18 -0
  94. package/esm2015/lib/components/stepper/stepper.component.ngsummary.json +1 -0
  95. package/esm2015/lib/components/stepper/stepper.module.ngfactory.js +13 -0
  96. package/esm2015/lib/components/stepper/stepper.module.ngsummary.json +1 -0
  97. package/esm2015/lib/components/tab/index.ngsummary.json +1 -0
  98. package/esm2015/lib/components/tab/tab.component.ngfactory.js +18 -0
  99. package/esm2015/lib/components/tab/tab.component.ngsummary.json +1 -0
  100. package/esm2015/lib/components/tab/tab.module.ngfactory.js +14 -0
  101. package/esm2015/lib/components/tab/tab.module.ngsummary.json +1 -0
  102. package/esm2015/lib/components/table/index.ngsummary.json +1 -0
  103. package/esm2015/lib/components/table/table-column.component.ngfactory.js +17 -0
  104. package/esm2015/lib/components/table/table-column.component.ngsummary.json +1 -0
  105. package/esm2015/lib/components/table/table.component.ngfactory.js +33 -0
  106. package/esm2015/lib/components/table/table.component.ngsummary.json +1 -0
  107. package/esm2015/lib/components/table/table.module.ngfactory.js +15 -0
  108. package/esm2015/lib/components/table/table.module.ngsummary.json +1 -0
  109. package/esm2015/lib/components/toggle/index.ngsummary.json +1 -0
  110. package/esm2015/lib/components/toggle/toggle.component.ngfactory.js +20 -0
  111. package/esm2015/lib/components/toggle/toggle.component.ngsummary.json +1 -0
  112. package/esm2015/lib/components/toggle/toggle.module.ngfactory.js +12 -0
  113. package/esm2015/lib/components/toggle/toggle.module.ngsummary.json +1 -0
  114. package/esm2015/lib/components/wizard/index.ngsummary.json +1 -0
  115. package/esm2015/lib/components/wizard/wizard.component.ngfactory.js +18 -0
  116. package/esm2015/lib/components/wizard/wizard.component.ngsummary.json +1 -0
  117. package/esm2015/lib/components/wizard/wizard.module.ngfactory.js +13 -0
  118. package/esm2015/lib/components/wizard/wizard.module.ngsummary.json +1 -0
  119. package/esm2015/lib/core/index.ngsummary.json +1 -0
  120. package/esm2015/lib/core/interfaces/index.ngsummary.json +1 -0
  121. package/esm2015/lib/core/interfaces/monkey-modal-settings.ngsummary.json +1 -0
  122. package/esm2015/lib/core/interfaces/monkey-style-settings.ngsummary.json +1 -0
  123. package/esm2015/lib/core/services/index.ngsummary.json +1 -0
  124. package/esm2015/lib/core/services/modal/index.ngsummary.json +1 -0
  125. package/esm2015/lib/core/services/modal/monkey-style-guide-modal-fixed.service.ngsummary.json +1 -0
  126. package/esm2015/lib/core/services/modal/monkey-style-guide-modal.service.ngsummary.json +1 -0
  127. package/esm2015/lib/core/services/monkey-style-guide.service.js +3 -3
  128. package/esm2015/lib/core/services/monkey-style-guide.service.ngsummary.json +1 -0
  129. package/esm2015/lib/core/services/settings/index.ngsummary.json +1 -0
  130. package/esm2015/lib/core/services/settings/monkey-style-guide-settings.service.js +2 -2
  131. package/esm2015/lib/core/services/settings/monkey-style-guide-settings.service.ngsummary.json +1 -0
  132. package/esm2015/lib/core/services/settings/monkey-style-guide-theme-settings.service.ngsummary.json +1 -0
  133. package/esm2015/lib/core/services/snackbar/index.ngsummary.json +1 -0
  134. package/esm2015/lib/core/services/snackbar/mokey-style-guide-snackbar.service.ngsummary.json +1 -0
  135. package/esm2015/lib/core/utils/index.ngsummary.json +1 -0
  136. package/esm2015/lib/core/utils/utils.ngsummary.json +1 -0
  137. package/esm2015/lib/monkey-style-guide.module.ngfactory.js +17 -0
  138. package/esm2015/lib/monkey-style-guide.module.ngsummary.json +1 -0
  139. package/esm2015/monkey-style-guide.ngsummary.json +1 -0
  140. package/esm2015/public-api.ngsummary.json +1 -0
  141. package/fesm2015/monkey-style-guide.js +343 -5
  142. package/fesm2015/monkey-style-guide.js.map +1 -1
  143. package/lib/components/badge/badge.component.ngfactory.d.ts +1 -0
  144. package/lib/components/badge/badge.module.ngfactory.d.ts +3 -0
  145. package/lib/components/button/button-avatar.component.ngfactory.d.ts +1 -0
  146. package/lib/components/button/button-dropdown.component.ngfactory.d.ts +1 -0
  147. package/lib/components/button/button.component.ngfactory.d.ts +1 -0
  148. package/lib/components/button/button.module.ngfactory.d.ts +3 -0
  149. package/lib/components/checkbox/checkbox.component.ngfactory.d.ts +1 -0
  150. package/lib/components/checkbox/checkbox.module.ngfactory.d.ts +3 -0
  151. package/lib/components/date-range-picker/date-range-picker.component.d.ts +50 -0
  152. package/lib/components/date-range-picker/date-range-picker.component.ngfactory.d.ts +1 -0
  153. package/lib/components/date-range-picker/date-range-picker.module.d.ts +2 -0
  154. package/lib/components/date-range-picker/date-range-picker.module.ngfactory.d.ts +3 -0
  155. package/lib/components/date-range-picker/index.d.ts +2 -0
  156. package/lib/components/expansion/expansion.component.ngfactory.d.ts +1 -0
  157. package/lib/components/expansion/expansion.module.ngfactory.d.ts +3 -0
  158. package/lib/components/file-upload/file-upload.component.ngfactory.d.ts +1 -0
  159. package/lib/components/file-upload/file-upload.module.ngfactory.d.ts +3 -0
  160. package/lib/components/icon/icon.component.ngfactory.d.ts +1 -0
  161. package/lib/components/icon/icon.module.ngfactory.d.ts +3 -0
  162. package/lib/components/icon/icons.component.ngfactory.d.ts +1 -0
  163. package/lib/components/image-crop/image-crop.component.ngfactory.d.ts +1 -0
  164. package/lib/components/image-crop/image-crop.module.ngfactory.d.ts +3 -0
  165. package/lib/components/index.d.ts +1 -0
  166. package/lib/components/input/input-filter.component.ngfactory.d.ts +1 -0
  167. package/lib/components/input/input.component.d.ts +1 -0
  168. package/lib/components/input/input.component.ngfactory.d.ts +1 -0
  169. package/lib/components/input/input.module.ngfactory.d.ts +3 -0
  170. package/lib/components/modal/modal.component.ngfactory.d.ts +1 -0
  171. package/lib/components/modal/modal.module.ngfactory.d.ts +3 -0
  172. package/lib/components/option/option.component.ngfactory.d.ts +1 -0
  173. package/lib/components/option/option.module.ngfactory.d.ts +3 -0
  174. package/lib/components/radiobutton/radiobutton.component.ngfactory.d.ts +1 -0
  175. package/lib/components/radiobutton/radiobutton.module.ngfactory.d.ts +3 -0
  176. package/lib/components/select/select-filter.component.ngfactory.d.ts +1 -0
  177. package/lib/components/select/select-multiple.component.ngfactory.d.ts +1 -0
  178. package/lib/components/select/select-search.component.ngfactory.d.ts +1 -0
  179. package/lib/components/select/select.component.ngfactory.d.ts +1 -0
  180. package/lib/components/select/select.module.ngfactory.d.ts +3 -0
  181. package/lib/components/stepper/stepper.component.ngfactory.d.ts +1 -0
  182. package/lib/components/stepper/stepper.module.ngfactory.d.ts +3 -0
  183. package/lib/components/tab/tab.component.ngfactory.d.ts +1 -0
  184. package/lib/components/tab/tab.module.ngfactory.d.ts +3 -0
  185. package/lib/components/table/table-column.component.ngfactory.d.ts +1 -0
  186. package/lib/components/table/table.component.ngfactory.d.ts +1 -0
  187. package/lib/components/table/table.module.ngfactory.d.ts +3 -0
  188. package/lib/components/toggle/toggle.component.ngfactory.d.ts +1 -0
  189. package/lib/components/toggle/toggle.module.ngfactory.d.ts +3 -0
  190. package/lib/components/wizard/wizard.component.ngfactory.d.ts +1 -0
  191. package/lib/components/wizard/wizard.module.ngfactory.d.ts +3 -0
  192. package/lib/core/services/monkey-style-guide.service.d.ts +2 -2
  193. package/lib/monkey-style-guide.module.ngfactory.d.ts +3 -0
  194. package/monkey-style-guide-2.0.86.tgz +0 -0
  195. package/monkey-style-guide.metadata.json +1 -1
  196. package/package.json +2 -1
  197. package/monkey-style-guide-2.0.82.tgz +0 -0
@@ -2,8 +2,9 @@ import { Injectable, Inject, ComponentFactoryResolver, ApplicationRef, Injector,
2
2
  import { HttpClient, HttpClientModule } from '@angular/common/http';
3
3
  import { BehaviorSubject, throwError, Subject } from 'rxjs';
4
4
  import { DOCUMENT, Location, CommonModule, CurrencyPipe } from '@angular/common';
5
- import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { FormsModule, ReactiveFormsModule, Validators, NG_VALUE_ACCESSOR, FormBuilder } from '@angular/forms';
6
6
  import { takeUntil } from 'rxjs/operators';
7
+ import * as moment_ from 'moment';
7
8
  import { NgxMaskModule } from 'ngx-mask';
8
9
  import { DomSanitizer } from '@angular/platform-browser';
9
10
 
@@ -91,7 +92,7 @@ MonkeyStyleGuideThemeSettingsService.ctorParameters = () => [
91
92
  * Copyright Monkey Exchange. All Rights Reserved
92
93
  * This style guide was developed by Monkey Exchange Team
93
94
  * MIT Licence
94
- **************************/
95
+ **************************/
95
96
  class MonkeyStyleGuideSettingsService {
96
97
  constructor(monkeySGService, monkeySGThemeConfigService) {
97
98
  this.monkeySGService = monkeySGService;
@@ -2039,6 +2040,334 @@ MonkeyButtonModule.decorators = [
2039
2040
  },] }
2040
2041
  ];
2041
2042
 
2043
+ /**************************
2044
+ * Copyright Monkey Exchange. All Rights Reserved
2045
+ * This style guide was developed by Monkey Exchange Team
2046
+ * MIT Licence
2047
+ **************************/
2048
+ const moment = moment_;
2049
+ const ɵ0 = () => {
2050
+ const isMobileWidth = window.screen.width <= 640 ||
2051
+ (window.matchMedia && window.matchMedia('only screen and (max-width: 640px)').matches);
2052
+ return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(navigator.userAgent) || isMobileWidth);
2053
+ };
2054
+ const isMobile = (ɵ0)();
2055
+ class MonkeyDateRangePickerComponent {
2056
+ constructor(fb, cdr) {
2057
+ this.fb = fb;
2058
+ this.cdr = cdr;
2059
+ this.onChange = new EventEmitter();
2060
+ this.today = moment().format('YYYY-MM-DD');
2061
+ this.onModelChange = (value) => { };
2062
+ this.onModelTouched = (value) => { };
2063
+ this._dateFirst = moment();
2064
+ this._dateSecond = moment().add(1, 'M');
2065
+ this._id = `mecx-date-range-picker-${MonkeyUtils.getRandomString(10)}`;
2066
+ this._daysArrFirst = [];
2067
+ this._daysArrSecond = [];
2068
+ this.initDateRange();
2069
+ }
2070
+ initDateRange() {
2071
+ return (this._dateForm = this.fb.group({
2072
+ startDate: [null, Validators.required],
2073
+ endDate: [null, Validators.required],
2074
+ }));
2075
+ }
2076
+ createCalendar(month) {
2077
+ let firstDay = moment(month).startOf('M');
2078
+ let lastDay = moment(month).endOf('M');
2079
+ let days = Array.apply(null, { length: month.daysInMonth() })
2080
+ .map(Number.call, Number)
2081
+ .map((n) => {
2082
+ return moment(firstDay).add(n, 'd');
2083
+ });
2084
+ let n = 0;
2085
+ while (n < firstDay.weekday()) {
2086
+ days.unshift(null);
2087
+ n++;
2088
+ }
2089
+ n = 0;
2090
+ while (n < 7 - lastDay.weekday()) {
2091
+ days.push(null);
2092
+ n++;
2093
+ }
2094
+ let index = 1;
2095
+ let group = [];
2096
+ let grouped = [];
2097
+ Object.entries(days).map(([key, value]) => {
2098
+ if (index > 7) {
2099
+ index = 1;
2100
+ grouped.push(group);
2101
+ group = [];
2102
+ }
2103
+ group.push(value);
2104
+ index++;
2105
+ });
2106
+ grouped.push(group);
2107
+ return grouped;
2108
+ }
2109
+ build() {
2110
+ this._daysArrFirst = this.createCalendar(this._dateFirst);
2111
+ if (!isMobile) {
2112
+ this._daysArrSecond = this.createCalendar(this._dateSecond);
2113
+ }
2114
+ }
2115
+ navigateToToday() {
2116
+ this._dateFirst = moment();
2117
+ this._dateSecond = moment().add(1, 'M');
2118
+ this.build();
2119
+ }
2120
+ ngOnInit() {
2121
+ this.build();
2122
+ }
2123
+ registerOnChange(fn) {
2124
+ this.onModelChange = fn;
2125
+ }
2126
+ registerOnTouched(fn) {
2127
+ this.onModelTouched = fn;
2128
+ }
2129
+ set value(value) {
2130
+ this._dateForm.setValue(value);
2131
+ this.cdr.detectChanges();
2132
+ this.onModelChange(this._dateForm.value);
2133
+ this.onModelTouched(this._dateForm.value);
2134
+ }
2135
+ get value() {
2136
+ return this._dateForm.value;
2137
+ }
2138
+ writeValue(value) {
2139
+ this.value = value;
2140
+ this.onChange.next(value);
2141
+ }
2142
+ nextMonth() {
2143
+ this._dateFirst.add(1, 'M');
2144
+ this._dateSecond.add(1, 'M');
2145
+ this._daysArrFirst = this.createCalendar(this._dateFirst);
2146
+ this._daysArrSecond = this.createCalendar(this._dateSecond);
2147
+ }
2148
+ previousMonth() {
2149
+ this._dateFirst.subtract(1, 'M');
2150
+ this._dateSecond.subtract(1, 'M');
2151
+ this._daysArrFirst = this.createCalendar(this._dateFirst);
2152
+ this._daysArrSecond = this.createCalendar(this._dateSecond);
2153
+ }
2154
+ todayCheck(day) {
2155
+ if (!day) {
2156
+ return false;
2157
+ }
2158
+ return moment().format('L') === day.format('L');
2159
+ }
2160
+ isSelected(day) {
2161
+ if (!day) {
2162
+ return false;
2163
+ }
2164
+ let startDateMoment = moment(this._dateForm.value.startDate, 'YYYY-MM-DD');
2165
+ let endDateMoment = moment(this._dateForm.value.endDate, 'YYYY-MM-DD');
2166
+ if (this._dateForm.valid) {
2167
+ return startDateMoment.isSameOrBefore(day) && endDateMoment.isSameOrAfter(day);
2168
+ }
2169
+ if (this._dateForm.get('startDate').valid) {
2170
+ return startDateMoment.isSame(day);
2171
+ }
2172
+ }
2173
+ isFirstSelected(day) {
2174
+ const { _dateForm } = this;
2175
+ const { startDate } = _dateForm.value;
2176
+ return day === null || day === void 0 ? void 0 : day.isSame(startDate);
2177
+ }
2178
+ isLastSelected(day) {
2179
+ const { _dateForm } = this;
2180
+ const { endDate } = _dateForm.value;
2181
+ return day === null || day === void 0 ? void 0 : day.isSame(endDate);
2182
+ }
2183
+ selectedDate(day) {
2184
+ const { _dateForm } = this;
2185
+ let dayFormatted = day.format('YYYY-MM-DD');
2186
+ if (_dateForm.valid) {
2187
+ _dateForm.setValue({ startDate: null, endDate: null });
2188
+ this.writeValue(null);
2189
+ return;
2190
+ }
2191
+ if (!_dateForm.get('startDate').value) {
2192
+ _dateForm.get('startDate').patchValue(dayFormatted);
2193
+ }
2194
+ else {
2195
+ _dateForm.get('endDate').patchValue(dayFormatted);
2196
+ this.writeValue(_dateForm.value);
2197
+ }
2198
+ }
2199
+ selectRangeOfDays(days) {
2200
+ const { _dateForm, today } = this;
2201
+ const { startDate } = _dateForm.value;
2202
+ const firstDay = startDate || today;
2203
+ const lastDay = moment(firstDay).add(days, 'day').format('YYYY-MM-DD');
2204
+ _dateForm.get('startDate').patchValue(firstDay);
2205
+ _dateForm.get('endDate').patchValue(lastDay);
2206
+ this.writeValue(_dateForm.value);
2207
+ }
2208
+ }
2209
+ MonkeyDateRangePickerComponent.decorators = [
2210
+ { type: Component, args: [{
2211
+ selector: 'monkey-date-range-picker',
2212
+ template: `
2213
+ <mecx-date-range-picker-group [class.error]="errorMessage?.trim()">
2214
+ <mecx-date-range-picker-group-body>
2215
+ <mecx-date-range-picker class="first-date-range">
2216
+ <mecx-date-range-picker-header>
2217
+ <div class="calendar-title">
2218
+ <monkey-button
2219
+ class="calendar-previous"
2220
+ color="theme"
2221
+ icon="arrow-left-16"
2222
+ type="tertiary"
2223
+ (click)="previousMonth()"
2224
+ size="sm"
2225
+ >
2226
+ </monkey-button>
2227
+ <div class="month-year-title">
2228
+ {{ i18n?.months?.[_dateFirst.format('M')] }}
2229
+ {{ _dateFirst.format('YYYY') }}
2230
+ </div>
2231
+ <monkey-button
2232
+ class="calendar-next"
2233
+ color="theme"
2234
+ icon="arrow-right-16"
2235
+ type="tertiary"
2236
+ (click)="nextMonth()"
2237
+ size="sm"
2238
+ >
2239
+ </monkey-button>
2240
+ </div>
2241
+ <div class="week">
2242
+ <span class="week-day" *ngFor="let day of [1, 2, 3, 4, 5, 6, 7]">
2243
+ {{ i18n?.days?.[day]}}
2244
+ </span>
2245
+ </div>
2246
+ </mecx-date-range-picker-header>
2247
+ <mecx-date-range-picker-body>
2248
+ <div class="month-week" *ngFor="let week of _daysArrFirst">
2249
+ <div
2250
+ class="month-day"
2251
+ (click)="selectedDate(day)"
2252
+ [ngClass]="{
2253
+ inactive: !day,
2254
+ selected: isSelected(day),
2255
+ today: todayCheck(day),
2256
+ 'first-selected': isFirstSelected(day),
2257
+ 'last-selected': isLastSelected(day)
2258
+ }"
2259
+ *ngFor="let day of week"
2260
+ #divOne
2261
+ >
2262
+ {{ day?.date() }}
2263
+ </div>
2264
+ </div>
2265
+ </mecx-date-range-picker-body>
2266
+ </mecx-date-range-picker>
2267
+
2268
+ <mecx-date-range-picker class="second-date-range" *ngIf="_daysArrSecond?.length">
2269
+ <mecx-date-range-picker-header>
2270
+ <div class="calendar-title">
2271
+ <div class="month-year-title">
2272
+ {{ i18n?.months?.[_dateSecond.format('M')] }}
2273
+ {{ _dateSecond.format('YYYY') }}
2274
+ </div>
2275
+ <monkey-button
2276
+ class="calendar-previous"
2277
+ color="theme"
2278
+ icon="arrow-right-16"
2279
+ type="tertiary"
2280
+ (click)="nextMonth()"
2281
+ size="sm"
2282
+ >
2283
+ </monkey-button>
2284
+ </div>
2285
+ <div class="week">
2286
+ <span class="week-day" *ngFor="let day of [1, 2, 3, 4, 5, 6, 7]">
2287
+ {{ i18n?.days?.[day]}}
2288
+ </span>
2289
+ </div>
2290
+ </mecx-date-range-picker-header>
2291
+ <mecx-date-range-picker-body>
2292
+ <div class="month-week" *ngFor="let week of _daysArrSecond">
2293
+ <div
2294
+ class="month-day"
2295
+ (click)="selectedDate(day)"
2296
+ [ngClass]="{
2297
+ inactive: !day,
2298
+ selected: isSelected(day),
2299
+ today: todayCheck(day),
2300
+ 'first-selected': isFirstSelected(day),
2301
+ 'last-selected': isLastSelected(day)
2302
+ }"
2303
+ *ngFor="let day of week"
2304
+ >
2305
+ {{ day?.date() }}
2306
+ </div>
2307
+ </div>
2308
+ </mecx-date-range-picker-body>
2309
+ </mecx-date-range-picker>
2310
+ </mecx-date-range-picker-group-body>
2311
+ <mecx-date-range-picker-group-info>
2312
+ <info>
2313
+ {{ infoMessage }}
2314
+ </info>
2315
+ <error>
2316
+ {{ errorMessage }}
2317
+ </error>
2318
+ </mecx-date-range-picker-group-info>
2319
+ <mecx-date-range-picker-group-action>
2320
+ <div class="action-days">
2321
+ <monkey-button color="theme" type="secondary" (click)="selectRangeOfDays(30)">
2322
+ {{ i18n?.actions?.['30'] }}
2323
+ </monkey-button>
2324
+ <monkey-button color="theme" type="secondary" (click)="selectRangeOfDays(60)">
2325
+ {{ i18n?.actions?.['60'] }}
2326
+ </monkey-button>
2327
+ <monkey-button color="theme" type="secondary" (click)="selectRangeOfDays(90)">
2328
+ {{ i18n?.actions?.['90'] }}
2329
+ </monkey-button>
2330
+ </div>
2331
+ <monkey-button color="theme" type="primary" (click)="navigateToToday()">
2332
+ {{ i18n?.today }}
2333
+ </monkey-button>
2334
+ </mecx-date-range-picker-group-action>
2335
+ </mecx-date-range-picker-group>
2336
+ `,
2337
+ encapsulation: ViewEncapsulation.None,
2338
+ providers: [
2339
+ {
2340
+ provide: NG_VALUE_ACCESSOR,
2341
+ useExisting: forwardRef(() => MonkeyDateRangePickerComponent),
2342
+ multi: true,
2343
+ },
2344
+ CurrencyPipe,
2345
+ ]
2346
+ },] }
2347
+ ];
2348
+ MonkeyDateRangePickerComponent.ctorParameters = () => [
2349
+ { type: FormBuilder },
2350
+ { type: ChangeDetectorRef }
2351
+ ];
2352
+ MonkeyDateRangePickerComponent.propDecorators = {
2353
+ i18n: [{ type: Input }],
2354
+ infoMessage: [{ type: Input }],
2355
+ errorMessage: [{ type: Input }],
2356
+ onChange: [{ type: Output }],
2357
+ value: [{ type: Input }]
2358
+ };
2359
+
2360
+ class MonkeyDateRangePickerModule {
2361
+ }
2362
+ MonkeyDateRangePickerModule.decorators = [
2363
+ { type: NgModule, args: [{
2364
+ declarations: [MonkeyDateRangePickerComponent],
2365
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, MonkeyButtonModule, MonkeyIconModule],
2366
+ exports: [MonkeyDateRangePickerComponent],
2367
+ schemas: [NO_ERRORS_SCHEMA],
2368
+ },] }
2369
+ ];
2370
+
2042
2371
  /**************************
2043
2372
  * Copyright Monkey Exchange. All Rights Reserved
2044
2373
  * This style guide was developed by Monkey Exchange Team
@@ -2079,12 +2408,15 @@ class MonkeyInputComponent {
2079
2408
  }
2080
2409
  return value;
2081
2410
  }
2411
+ replaceZero(value) {
2412
+ return `${value}`.replace(new RegExp(/0/, 'g'), '');
2413
+ }
2082
2414
  formatValue(value) {
2083
2415
  var _a, _b;
2084
2416
  const { settings } = this;
2085
2417
  if (this.currency) {
2086
- if (!value)
2087
- value = 0;
2418
+ if (!value || !this.replaceZero(value))
2419
+ return '';
2088
2420
  return this.currencyPipe.transform(value, ((_a = settings === null || settings === void 0 ? void 0 : settings.currency) === null || _a === void 0 ? void 0 : _a.code) || 'BRL', '', '1.2-2', ((_b = settings === null || settings === void 0 ? void 0 : settings.currency) === null || _b === void 0 ? void 0 : _b.locale) || 'pt-BR');
2089
2421
  }
2090
2422
  else if (this.percent) {
@@ -2151,10 +2483,16 @@ class MonkeyInputComponent {
2151
2483
  (_c = (_b = (_a = document === null || document === void 0 ? void 0 : document.getElementById(this._id)) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('input')) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.focus();
2152
2484
  }
2153
2485
  onKeyPress(event) {
2486
+ var _a;
2154
2487
  let pattern = null;
2488
+ const cmp = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value;
2155
2489
  const inputChar = String.fromCharCode(event.charCode);
2156
2490
  if (this.currency || this.onlyNumber || this.percent) {
2157
2491
  pattern = /[0-9]/;
2492
+ if (inputChar === '0' && !this.replaceZero(cmp)) {
2493
+ event.preventDefault();
2494
+ return;
2495
+ }
2158
2496
  }
2159
2497
  else if (this.onlyAlphaNumeric) {
2160
2498
  pattern = /[^0-9A-Za-z]/;
@@ -5051,5 +5389,5 @@ MonkeyStyleGuideModule.decorators = [
5051
5389
  * Generated bundle index. Do not edit.
5052
5390
  */
5053
5391
 
5054
- export { MonkeyBadgeComponent, MonkeyBadgeModule, MonkeyButtonAvatarComponent, MonkeyButtonComponent, MonkeyButtonDropdownComponent, MonkeyButtonModule, MonkeyCheckboxComponent, MonkeyCheckboxModule, MonkeyExpansionComponent, MonkeyExpansionModule, MonkeyFileUploadComponent, MonkeyFileUploadModule, MonkeyIconArrowDownComponent, MonkeyIconArrowLeftComponent, MonkeyIconArrowRightComponent, MonkeyIconArrowUpComponent, MonkeyIconBankComponent, MonkeyIconBellComponent, MonkeyIconBookComponent, MonkeyIconBoxComponent, MonkeyIconCNPJComponent, MonkeyIconCalendarComponent, MonkeyIconCameraComponent, MonkeyIconChatComponent, MonkeyIconCheckCircleComponent, MonkeyIconCheckCircleOutComponent, MonkeyIconCheckComponent, MonkeyIconCheckGreyComponent, MonkeyIconCheckWhiteComponent, MonkeyIconClipboardComponent, MonkeyIconClockComponent, MonkeyIconCloseComponent, MonkeyIconCodepenComponent, MonkeyIconCompanyNameComponent, MonkeyIconComponent, MonkeyIconContractComponent, MonkeyIconDeleteComponent, MonkeyIconDocumentComponent, MonkeyIconDollarSignComponent, MonkeyIconDomainComponent, MonkeyIconDownloadComponent, MonkeyIconEditComponent, MonkeyIconEmailComponent, MonkeyIconEmptyDocComponent, MonkeyIconErrorComponent, MonkeyIconEyeClosedComponent, MonkeyIconEyeOpenComponent, MonkeyIconFilterComponent, MonkeyIconGridComponent, MonkeyIconHelpComponent, MonkeyIconHexagonComponent, MonkeyIconHomeComponent, MonkeyIconImageComponent, MonkeyIconListComponent, MonkeyIconLocationPinComponent, MonkeyIconLoginComponent, MonkeyIconLogoutComponent, MonkeyIconMenuComponent, MonkeyIconModule, MonkeyIconMoneySignComponent, MonkeyIconMoreComponent, MonkeyIconOfferedComponent, MonkeyIconPasswordComponent, MonkeyIconPeopleComponent, MonkeyIconPercentComponent, MonkeyIconPersonDocumentComponent, MonkeyIconPersonSadComponent, MonkeyIconPhoneComponent, MonkeyIconPorkComponent, MonkeyIconRefreshComponent, MonkeyIconRepeatComponent, MonkeyIconSearchComponent, MonkeyIconSecondWarningComponent, MonkeyIconSettingsComponent, MonkeyIconTrashComponent, MonkeyIconUploadComponent, MonkeyIconUserComponent, MonkeyIconWalletComponent, MonkeyIconWarningComponent, MonkeyImageCropComponent, MonkeyImageCropModule, MonkeyInputComponent, MonkeyInputFilterComponent, MonkeyInputModule, MonkeyModalComponent, MonkeyModalModule, MonkeyOptionComponent, MonkeyOptionModule, MonkeyRadioButtonComponent, MonkeyRadioButtonModule, MonkeySelectComponent, MonkeySelectFilterComponent, MonkeySelectModule, MonkeySelectMultipleComponent, MonkeySelectSearchComponent, MonkeyStepperComponent, MonkeyStepperModule, MonkeyStyleGuideModalFixedService, MonkeyStyleGuideModalService, MonkeyStyleGuideModule, MonkeyStyleGuideSettingsService, MonkeyStyleGuideSnackbarService, MonkeyTabComponent, MonkeyTabModule, MonkeyTableColumnComponent, MonkeyTableComponent, MonkeyTableModule, MonkeyToggleComponent, MonkeyToggleModule, MonkeyUtils, MonkeyWizardComponent, MonkeyWizardModule, MonkeyStyleGuideService as ɵa, MonkeyStyleGuideSettingsService as ɵb, MonkeyStyleGuideThemeSettingsService as ɵc, MonkeyStyleGuideSnackbarService as ɵd };
5392
+ export { MonkeyBadgeComponent, MonkeyBadgeModule, MonkeyButtonAvatarComponent, MonkeyButtonComponent, MonkeyButtonDropdownComponent, MonkeyButtonModule, MonkeyCheckboxComponent, MonkeyCheckboxModule, MonkeyDateRangePickerComponent, MonkeyDateRangePickerModule, MonkeyExpansionComponent, MonkeyExpansionModule, MonkeyFileUploadComponent, MonkeyFileUploadModule, MonkeyIconArrowDownComponent, MonkeyIconArrowLeftComponent, MonkeyIconArrowRightComponent, MonkeyIconArrowUpComponent, MonkeyIconBankComponent, MonkeyIconBellComponent, MonkeyIconBookComponent, MonkeyIconBoxComponent, MonkeyIconCNPJComponent, MonkeyIconCalendarComponent, MonkeyIconCameraComponent, MonkeyIconChatComponent, MonkeyIconCheckCircleComponent, MonkeyIconCheckCircleOutComponent, MonkeyIconCheckComponent, MonkeyIconCheckGreyComponent, MonkeyIconCheckWhiteComponent, MonkeyIconClipboardComponent, MonkeyIconClockComponent, MonkeyIconCloseComponent, MonkeyIconCodepenComponent, MonkeyIconCompanyNameComponent, MonkeyIconComponent, MonkeyIconContractComponent, MonkeyIconDeleteComponent, MonkeyIconDocumentComponent, MonkeyIconDollarSignComponent, MonkeyIconDomainComponent, MonkeyIconDownloadComponent, MonkeyIconEditComponent, MonkeyIconEmailComponent, MonkeyIconEmptyDocComponent, MonkeyIconErrorComponent, MonkeyIconEyeClosedComponent, MonkeyIconEyeOpenComponent, MonkeyIconFilterComponent, MonkeyIconGridComponent, MonkeyIconHelpComponent, MonkeyIconHexagonComponent, MonkeyIconHomeComponent, MonkeyIconImageComponent, MonkeyIconListComponent, MonkeyIconLocationPinComponent, MonkeyIconLoginComponent, MonkeyIconLogoutComponent, MonkeyIconMenuComponent, MonkeyIconModule, MonkeyIconMoneySignComponent, MonkeyIconMoreComponent, MonkeyIconOfferedComponent, MonkeyIconPasswordComponent, MonkeyIconPeopleComponent, MonkeyIconPercentComponent, MonkeyIconPersonDocumentComponent, MonkeyIconPersonSadComponent, MonkeyIconPhoneComponent, MonkeyIconPorkComponent, MonkeyIconRefreshComponent, MonkeyIconRepeatComponent, MonkeyIconSearchComponent, MonkeyIconSecondWarningComponent, MonkeyIconSettingsComponent, MonkeyIconTrashComponent, MonkeyIconUploadComponent, MonkeyIconUserComponent, MonkeyIconWalletComponent, MonkeyIconWarningComponent, MonkeyImageCropComponent, MonkeyImageCropModule, MonkeyInputComponent, MonkeyInputFilterComponent, MonkeyInputModule, MonkeyModalComponent, MonkeyModalModule, MonkeyOptionComponent, MonkeyOptionModule, MonkeyRadioButtonComponent, MonkeyRadioButtonModule, MonkeySelectComponent, MonkeySelectFilterComponent, MonkeySelectModule, MonkeySelectMultipleComponent, MonkeySelectSearchComponent, MonkeyStepperComponent, MonkeyStepperModule, MonkeyStyleGuideModalFixedService, MonkeyStyleGuideModalService, MonkeyStyleGuideModule, MonkeyStyleGuideSettingsService, MonkeyStyleGuideSnackbarService, MonkeyTabComponent, MonkeyTabModule, MonkeyTableColumnComponent, MonkeyTableComponent, MonkeyTableModule, MonkeyToggleComponent, MonkeyToggleModule, MonkeyUtils, MonkeyWizardComponent, MonkeyWizardModule, ɵ0, MonkeyStyleGuideService as ɵa, MonkeyStyleGuideSettingsService as ɵb, MonkeyStyleGuideThemeSettingsService as ɵc, MonkeyStyleGuideSnackbarService as ɵd };
5055
5393
  //# sourceMappingURL=monkey-style-guide.js.map