@kato-lee/components 1.0.3

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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/assets/_fade-in.scss +40 -0
  4. package/assets/_fields.scss +76 -0
  5. package/assets/_grids.scss +317 -0
  6. package/assets/components/_buttons.scss +3 -0
  7. package/assets/components/_cards.scss +26 -0
  8. package/assets/components/_dialogs.scss +13 -0
  9. package/assets/components/_fields.scss +110 -0
  10. package/assets/components/_material.scss +15 -0
  11. package/assets/components/_pretty-box.scss +41 -0
  12. package/assets/components/_scroll-bar.scss +23 -0
  13. package/assets/components/_snack-bar.scss +18 -0
  14. package/assets/components/_tables.scss +235 -0
  15. package/assets/components/_tabs.scss +7 -0
  16. package/assets/components/main.scss +25 -0
  17. package/assets/fonts/body/Transpass-Bold.ttf +0 -0
  18. package/assets/fonts/body/Transpass-Light.ttf +0 -0
  19. package/assets/fonts/body/Transpass-Medium.ttf +0 -0
  20. package/assets/fonts/body/Transpass-Regular.ttf +0 -0
  21. package/assets/fonts/body/style-font.scss +40 -0
  22. package/assets/fonts/main.scss +2 -0
  23. package/assets/fonts/title/Poppins-Bold.ttf +0 -0
  24. package/assets/fonts/title/Poppins-Light.ttf +0 -0
  25. package/assets/fonts/title/Poppins-Medium.ttf +0 -0
  26. package/assets/fonts/title/Poppins-Regular.ttf +0 -0
  27. package/assets/fonts/title/Poppins-SemiBold.ttf +0 -0
  28. package/assets/fonts/title/style-font.scss +39 -0
  29. package/assets/layouts/_loader.scss +71 -0
  30. package/assets/layouts/origin.scss +775 -0
  31. package/assets/main.scss +4 -0
  32. package/assets/material/icons/icons.woff2 +0 -0
  33. package/assets/material/icons/local.css +1 -0
  34. package/assets/material/icons/remote.css +1 -0
  35. package/assets/material/themes/dark.scss +55 -0
  36. package/assets/material/themes/default.scss +106 -0
  37. package/assets/material/themes/main.scss +2907 -0
  38. package/assets/themes/_dark.scss +15 -0
  39. package/assets/themes/_default.scss +30 -0
  40. package/assets/themes/main.scss +2 -0
  41. package/assets/variables.scss +7 -0
  42. package/box-form/box-form.component.d.ts +34 -0
  43. package/box-form/box-form.module.d.ts +13 -0
  44. package/box-form/common.d.ts +5 -0
  45. package/box-form/index.d.ts +3 -0
  46. package/box-form/package.json +3 -0
  47. package/capsule/capsule.component.d.ts +14 -0
  48. package/capsule/capsule.module.d.ts +7 -0
  49. package/capsule/index.d.ts +2 -0
  50. package/capsule/package.json +3 -0
  51. package/cards/cards.module.d.ts +7 -0
  52. package/cards/index.d.ts +2 -0
  53. package/cards/package.json +3 -0
  54. package/cards/simple-card.component.d.ts +8 -0
  55. package/dialogs/dialogs.module.d.ts +11 -0
  56. package/dialogs/dismiss-dialog-button.component.d.ts +8 -0
  57. package/dialogs/index.d.ts +2 -0
  58. package/dialogs/package.json +3 -0
  59. package/esm2022/box-form/box-form.component.mjs +99 -0
  60. package/esm2022/box-form/box-form.module.mjs +40 -0
  61. package/esm2022/box-form/common.mjs +2 -0
  62. package/esm2022/box-form/index.mjs +7 -0
  63. package/esm2022/box-form/kato-lee-components-box-form.mjs +5 -0
  64. package/esm2022/capsule/capsule.component.mjs +78 -0
  65. package/esm2022/capsule/capsule.module.mjs +16 -0
  66. package/esm2022/capsule/index.mjs +6 -0
  67. package/esm2022/capsule/kato-lee-components-capsule.mjs +5 -0
  68. package/esm2022/cards/cards.module.mjs +17 -0
  69. package/esm2022/cards/index.mjs +6 -0
  70. package/esm2022/cards/kato-lee-components-cards.mjs +5 -0
  71. package/esm2022/cards/simple-card.component.mjs +47 -0
  72. package/esm2022/dialogs/dialogs.module.mjs +22 -0
  73. package/esm2022/dialogs/dismiss-dialog-button.component.mjs +44 -0
  74. package/esm2022/dialogs/index.mjs +6 -0
  75. package/esm2022/dialogs/kato-lee-components-dialogs.mjs +5 -0
  76. package/esm2022/fields/autocomplete-field/autocomplete-field.component.mjs +240 -0
  77. package/esm2022/fields/date-field/date-field.component.mjs +148 -0
  78. package/esm2022/fields/date-range-field/date-range-field.component.mjs +70 -0
  79. package/esm2022/fields/error/error-equals.pipe.mjs +19 -0
  80. package/esm2022/fields/error/error.component.mjs +55 -0
  81. package/esm2022/fields/error/error.module.mjs +21 -0
  82. package/esm2022/fields/error/error.msg.pipe.mjs +19 -0
  83. package/esm2022/fields/error/lang/_en.mjs +12 -0
  84. package/esm2022/fields/error/lang/_es.mjs +12 -0
  85. package/esm2022/fields/error/lang/index.mjs +3 -0
  86. package/esm2022/fields/fields.common.mjs +8 -0
  87. package/esm2022/fields/fields.module.mjs +118 -0
  88. package/esm2022/fields/general-field/general-field.component.mjs +188 -0
  89. package/esm2022/fields/index.mjs +17 -0
  90. package/esm2022/fields/kato-lee-components-fields.mjs +5 -0
  91. package/esm2022/fields/money-field/money-field.component.mjs +188 -0
  92. package/esm2022/fields/number-field/number-field.component.mjs +165 -0
  93. package/esm2022/fields/select-field/select-field.component.mjs +135 -0
  94. package/esm2022/fields/text-area/textarea.component.mjs +171 -0
  95. package/esm2022/index.mjs +2 -0
  96. package/esm2022/kato-lee-components.mjs +5 -0
  97. package/esm2022/layouts/origin/breadcrumb/breadcrumb.component.mjs +65 -0
  98. package/esm2022/layouts/origin/footer/footer.component.mjs +11 -0
  99. package/esm2022/layouts/origin/header/header.component.mjs +46 -0
  100. package/esm2022/layouts/origin/index.mjs +12 -0
  101. package/esm2022/layouts/origin/kato-lee-components-layouts-origin.mjs +5 -0
  102. package/esm2022/layouts/origin/layout.component.mjs +210 -0
  103. package/esm2022/layouts/origin/layout.module.mjs +52 -0
  104. package/esm2022/layouts/origin/layout.navigation.mjs +19 -0
  105. package/esm2022/layouts/origin/navigation-interfaces.mjs +2 -0
  106. package/esm2022/layouts/origin/services/index.mjs +4 -0
  107. package/esm2022/layouts/origin/services/route-parts.service.mjs +28 -0
  108. package/esm2022/layouts/origin/services/toggle-sidebar.mjs +48 -0
  109. package/esm2022/layouts/origin/services/validate-access.pipe.mjs +53 -0
  110. package/esm2022/layouts/origin/sidebar/sidebar.component.mjs +69 -0
  111. package/esm2022/layouts/origin/sidebar/sidenav/expansion/accordion.component.mjs +74 -0
  112. package/esm2022/layouts/origin/sidebar/sidenav/expansion/expansion-panel-header.component.mjs +51 -0
  113. package/esm2022/layouts/origin/sidebar/sidenav/expansion/expansion-panel.component.mjs +63 -0
  114. package/esm2022/layouts/origin/sidebar/sidenav/sidenav.component.mjs +130 -0
  115. package/esm2022/modal/config.mjs +2 -0
  116. package/esm2022/modal/index.mjs +8 -0
  117. package/esm2022/modal/kato-lee-components-modal.mjs +5 -0
  118. package/esm2022/modal/modal.component.mjs +63 -0
  119. package/esm2022/modal/modal.module.mjs +21 -0
  120. package/esm2022/modal/modal.service.mjs +33 -0
  121. package/esm2022/pretty-box/index.mjs +5 -0
  122. package/esm2022/pretty-box/kato-lee-components-pretty-box.mjs +5 -0
  123. package/esm2022/pretty-box/pretty-box.component.mjs +94 -0
  124. package/esm2022/tables/index.mjs +6 -0
  125. package/esm2022/tables/kato-lee-components-tables.mjs +5 -0
  126. package/esm2022/tables/mat-paginator.translation.mjs +22 -0
  127. package/esm2022/tables/tables.module.mjs +19 -0
  128. package/esm2022/toast/index.mjs +5 -0
  129. package/esm2022/toast/kato-lee-components-toast.mjs +5 -0
  130. package/esm2022/toast/toast.service.mjs +42 -0
  131. package/fesm2022/kato-lee-components-box-form.mjs +146 -0
  132. package/fesm2022/kato-lee-components-box-form.mjs.map +1 -0
  133. package/fesm2022/kato-lee-components-capsule.mjs +102 -0
  134. package/fesm2022/kato-lee-components-capsule.mjs.map +1 -0
  135. package/fesm2022/kato-lee-components-cards.mjs +72 -0
  136. package/fesm2022/kato-lee-components-cards.mjs.map +1 -0
  137. package/fesm2022/kato-lee-components-dialogs.mjs +74 -0
  138. package/fesm2022/kato-lee-components-dialogs.mjs.map +1 -0
  139. package/fesm2022/kato-lee-components-fields.mjs +1486 -0
  140. package/fesm2022/kato-lee-components-fields.mjs.map +1 -0
  141. package/fesm2022/kato-lee-components-layouts-origin.mjs +872 -0
  142. package/fesm2022/kato-lee-components-layouts-origin.mjs.map +1 -0
  143. package/fesm2022/kato-lee-components-modal.mjs +121 -0
  144. package/fesm2022/kato-lee-components-modal.mjs.map +1 -0
  145. package/fesm2022/kato-lee-components-pretty-box.mjs +105 -0
  146. package/fesm2022/kato-lee-components-pretty-box.mjs.map +1 -0
  147. package/fesm2022/kato-lee-components-tables.mjs +51 -0
  148. package/fesm2022/kato-lee-components-tables.mjs.map +1 -0
  149. package/fesm2022/kato-lee-components-toast.mjs +53 -0
  150. package/fesm2022/kato-lee-components-toast.mjs.map +1 -0
  151. package/fesm2022/kato-lee-components.mjs +4 -0
  152. package/fesm2022/kato-lee-components.mjs.map +1 -0
  153. package/fields/autocomplete-field/autocomplete-field.component.d.ts +65 -0
  154. package/fields/date-field/date-field.component.d.ts +46 -0
  155. package/fields/date-range-field/date-range-field.component.d.ts +23 -0
  156. package/fields/error/error-equals.pipe.d.ts +7 -0
  157. package/fields/error/error.component.d.ts +22 -0
  158. package/fields/error/error.module.d.ts +11 -0
  159. package/fields/error/error.msg.pipe.d.ts +7 -0
  160. package/fields/error/lang/_en.d.ts +1 -0
  161. package/fields/error/lang/_es.d.ts +1 -0
  162. package/fields/error/lang/index.d.ts +2 -0
  163. package/fields/fields.common.d.ts +5 -0
  164. package/fields/fields.module.d.ts +28 -0
  165. package/fields/general-field/general-field.component.d.ts +56 -0
  166. package/fields/index.d.ts +13 -0
  167. package/fields/money-field/money-field.component.d.ts +53 -0
  168. package/fields/number-field/number-field.component.d.ts +52 -0
  169. package/fields/package.json +3 -0
  170. package/fields/select-field/select-field.component.d.ts +44 -0
  171. package/fields/text-area/textarea.component.d.ts +55 -0
  172. package/index.d.ts +1 -0
  173. package/layouts/origin/breadcrumb/breadcrumb.component.d.ts +24 -0
  174. package/layouts/origin/footer/footer.component.d.ts +5 -0
  175. package/layouts/origin/header/header.component.d.ts +15 -0
  176. package/layouts/origin/index.d.ts +8 -0
  177. package/layouts/origin/layout.component.d.ts +58 -0
  178. package/layouts/origin/layout.module.d.ts +18 -0
  179. package/layouts/origin/layout.navigation.d.ts +10 -0
  180. package/layouts/origin/navigation-interfaces.d.ts +24 -0
  181. package/layouts/origin/package.json +3 -0
  182. package/layouts/origin/services/index.d.ts +3 -0
  183. package/layouts/origin/services/route-parts.service.d.ts +15 -0
  184. package/layouts/origin/services/toggle-sidebar.d.ts +10 -0
  185. package/layouts/origin/services/validate-access.pipe.d.ts +7 -0
  186. package/layouts/origin/sidebar/sidebar.component.d.ts +27 -0
  187. package/layouts/origin/sidebar/sidenav/expansion/accordion.component.d.ts +10 -0
  188. package/layouts/origin/sidebar/sidenav/expansion/expansion-panel-header.component.d.ts +11 -0
  189. package/layouts/origin/sidebar/sidenav/expansion/expansion-panel.component.d.ts +12 -0
  190. package/layouts/origin/sidebar/sidenav/sidenav.component.d.ts +23 -0
  191. package/modal/config.d.ts +9 -0
  192. package/modal/index.d.ts +4 -0
  193. package/modal/modal.component.d.ts +35 -0
  194. package/modal/modal.module.d.ts +11 -0
  195. package/modal/modal.service.d.ts +13 -0
  196. package/modal/package.json +3 -0
  197. package/package.json +82 -0
  198. package/pretty-box/index.d.ts +1 -0
  199. package/pretty-box/package.json +3 -0
  200. package/pretty-box/pretty-box.component.d.ts +24 -0
  201. package/tables/index.d.ts +2 -0
  202. package/tables/mat-paginator.translation.d.ts +2 -0
  203. package/tables/package.json +3 -0
  204. package/tables/tables.module.d.ts +9 -0
  205. package/toast/index.d.ts +1 -0
  206. package/toast/package.json +3 -0
  207. package/toast/toast.service.d.ts +21 -0
@@ -0,0 +1,1486 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Component, ViewChild, Input, EventEmitter, Self, Optional, Output, NgModule } from '@angular/core';
3
+ import { ESCAPE } from '@kato-lee/cdk/keycodes';
4
+ import * as i10 from '@angular/common';
5
+ import { CommonModule } from '@angular/common';
6
+ import * as i1 from '@angular/forms';
7
+ import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
8
+ import * as i2 from '@kato-lee/material/form-field';
9
+ import { MatFormFieldModule } from '@kato-lee/material/form-field';
10
+ import * as i7 from '@kato-lee/material/select';
11
+ import { MatSelectModule } from '@kato-lee/material/select';
12
+ import * as i3 from '@kato-lee/material/button';
13
+ import { MatButtonModule } from '@kato-lee/material/button';
14
+ import * as i4 from '@kato-lee/material/core';
15
+ import { MatOptionModule, MatNativeDateModule } from '@kato-lee/material/core';
16
+ import * as i6 from '@kato-lee/material/input';
17
+ import { MatInputModule } from '@kato-lee/material/input';
18
+ import * as i5 from '@kato-lee/material/icon';
19
+ import { MatIconModule } from '@kato-lee/material/icon';
20
+ import * as i3$1 from '@kato-lee/material/datepicker';
21
+ import { MatDatepickerModule } from '@kato-lee/material/datepicker';
22
+ import * as i8 from '@kato-lee/material/tooltip';
23
+ import { MatTooltipModule } from '@kato-lee/material/tooltip';
24
+ import { takeUntil } from 'rxjs/operators';
25
+ import { Subject, takeUntil as takeUntil$1, map, debounceTime } from 'rxjs';
26
+ import * as i9 from '@kato-lee/material/menu';
27
+ import { MatMenuModule } from '@kato-lee/material/menu';
28
+ import * as i2$1 from '@kato-lee/material/progress-spinner';
29
+ import { MatProgressSpinnerModule } from '@kato-lee/material/progress-spinner';
30
+ import * as i5$1 from '@kato-lee/material/autocomplete';
31
+ import { MatAutocompleteModule } from '@kato-lee/material/autocomplete';
32
+
33
+ class TakErrorEqualsPipe {
34
+ transform(errors, error, args) {
35
+ if (!errors)
36
+ return false;
37
+ const array = Object.keys(errors);
38
+ if (array && array.length > 0)
39
+ return errors[array[0]] === error;
40
+ return false;
41
+ }
42
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorEqualsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
43
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: TakErrorEqualsPipe, name: "errorEquals" }); }
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorEqualsPipe, decorators: [{
46
+ type: Pipe,
47
+ args: [{ name: 'errorEquals' }]
48
+ }] });
49
+
50
+ const en = {
51
+ minLengthMsg: (length) => `The field contains fewer than ${length} characters`,
52
+ maxLengthMsg: (length) => `The field contains more than ${length} characters`,
53
+ minMsg: (min) => `The number must be bigger than ${min}`,
54
+ maxMsg: (max) => `The number must be lower than ${max}`,
55
+ patternMsg: 'One or more characters not allowed',
56
+ requiredMsg: 'This field is required',
57
+ EmailMsg: 'This field must be an email',
58
+ badDateMsg: 'Insert a valid date',
59
+ DateRangeMsg: 'The range is not valid',
60
+ };
61
+
62
+ const es = {
63
+ minLengthMsg: (length) => `El campo contiene menos de ${length} caracteres`,
64
+ maxLengthMsg: (length) => `El campo contiene mas de ${length} caracteres`,
65
+ minMsg: (min) => `El numero debe ser mayor a ${min}`,
66
+ maxMsg: (max) => `El numero debe ser menor a ${max}`,
67
+ patternMsg: 'Uno o mas caracteres no permitidos',
68
+ requiredMsg: 'Este campo es requerido',
69
+ EmailMsg: 'Este campo debe ser un email',
70
+ badDateMsg: 'Inserte una fecha valida',
71
+ DateRangeMsg: 'El rango no es valido',
72
+ };
73
+
74
+ class TakErrorMsgPipe {
75
+ transform(parameter, aditionalValue) {
76
+ let resources = es;
77
+ if (aditionalValue)
78
+ return resources[parameter](aditionalValue);
79
+ else
80
+ return resources[parameter];
81
+ }
82
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorMsgPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
83
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: TakErrorMsgPipe, name: "errorMsg" }); }
84
+ }
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorMsgPipe, decorators: [{
86
+ type: Pipe,
87
+ args: [{ name: 'errorMsg' }]
88
+ }] });
89
+
90
+ class TakErrorComponent {
91
+ constructor() {
92
+ this.isDateField = false;
93
+ this.isNumberField = false;
94
+ this.marginTop = -20;
95
+ this.hasPatternError = false;
96
+ }
97
+ get required() {
98
+ return this.control?.errors?.['required'];
99
+ }
100
+ get pattern() {
101
+ return this.control?.errors?.['pattern'];
102
+ }
103
+ get max() {
104
+ return this.control?.errors?.['max'];
105
+ }
106
+ get min() {
107
+ return this.control?.errors?.['min'];
108
+ }
109
+ get maxlength() {
110
+ return this.control?.errors?.['maxlength'];
111
+ }
112
+ get minlength() {
113
+ return this.control?.errors?.['minlength'];
114
+ }
115
+ get email() {
116
+ return this.control?.errors?.['email'];
117
+ }
118
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
119
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakErrorComponent, selector: "tak-error", inputs: { control: "control", start: "start", end: "end", isDateField: "isDateField", isNumberField: "isNumberField", marginTop: "marginTop" }, viewQueries: [{ propertyName: "error", first: true, predicate: ["error"], descendants: true }], ngImport: i0, template: "<div class=\"tak-custom-error tak-fade-in--800ms\" #error [style.marginTop.px]=\"marginTop\">\r\n @if (control !== undefined && isDateField && control.valid) {\r\n <div>\r\n {{ 'badDateMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: required) {\r\n <div>\r\n {{ 'requiredMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: pattern) {\r\n <div>\r\n {{\r\n isNumberField\r\n ? 'El campo solo debe contener caracteres numericos'\r\n : ('patternMsg' | errorMsg)\r\n }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: max) {\r\n <div>\r\n {{ 'maxMsg' | errorMsg: max.max }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: min) {\r\n <div>\r\n {{ 'minMsg' | errorMsg: min.min }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: maxlength) {\r\n <div>\r\n {{ 'maxLengthMsg' | errorMsg: maxlength.requiredLength }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: minlength) {\r\n <div>\r\n {{ 'minLengthMsg' | errorMsg: minlength.requiredLength }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: email) {\r\n <div>\r\n {{ 'EmailMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control === undefined) {\r\n <div>\r\n {{\r\n start.hasError('required') && end.hasError('required')\r\n ? ('requiredMsg' | errorMsg)\r\n : ('DateRangeMsg' | errorMsg)\r\n }}\r\n </div>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "pipe", type: TakErrorEqualsPipe, name: "errorEquals" }, { kind: "pipe", type: TakErrorMsgPipe, name: "errorMsg" }] }); }
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorComponent, decorators: [{
122
+ type: Component,
123
+ args: [{ selector: 'tak-error', template: "<div class=\"tak-custom-error tak-fade-in--800ms\" #error [style.marginTop.px]=\"marginTop\">\r\n @if (control !== undefined && isDateField && control.valid) {\r\n <div>\r\n {{ 'badDateMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: required) {\r\n <div>\r\n {{ 'requiredMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: pattern) {\r\n <div>\r\n {{\r\n isNumberField\r\n ? 'El campo solo debe contener caracteres numericos'\r\n : ('patternMsg' | errorMsg)\r\n }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: max) {\r\n <div>\r\n {{ 'maxMsg' | errorMsg: max.max }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: min) {\r\n <div>\r\n {{ 'minMsg' | errorMsg: min.min }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: maxlength) {\r\n <div>\r\n {{ 'maxLengthMsg' | errorMsg: maxlength.requiredLength }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: minlength) {\r\n <div>\r\n {{ 'minLengthMsg' | errorMsg: minlength.requiredLength }}\r\n </div>\r\n }\r\n @if (control !== undefined && control.errors | errorEquals: email) {\r\n <div>\r\n {{ 'EmailMsg' | errorMsg }}\r\n </div>\r\n }\r\n @if (control === undefined) {\r\n <div>\r\n {{\r\n start.hasError('required') && end.hasError('required')\r\n ? ('requiredMsg' | errorMsg)\r\n : ('DateRangeMsg' | errorMsg)\r\n }}\r\n </div>\r\n }\r\n</div>\r\n" }]
124
+ }], propDecorators: { error: [{
125
+ type: ViewChild,
126
+ args: ['error']
127
+ }], control: [{
128
+ type: Input
129
+ }], start: [{
130
+ type: Input
131
+ }], end: [{
132
+ type: Input
133
+ }], isDateField: [{
134
+ type: Input
135
+ }], isNumberField: [{
136
+ type: Input
137
+ }], marginTop: [{
138
+ type: Input
139
+ }] } });
140
+
141
+ const TAK_DEFAULT_APPEARANCE_FORM = 'standard';
142
+ const TAK_PRESS_ESC_KEY = new KeyboardEvent('keydown', {
143
+ bubbles: true,
144
+ cancelable: true,
145
+ keyCode: ESCAPE,
146
+ });
147
+
148
+ class TakSelectFieldComponent {
149
+ constructor(_ngControl, _formGroupDirective, _cd) {
150
+ this._ngControl = _ngControl;
151
+ this._formGroupDirective = _formGroupDirective;
152
+ this._cd = _cd;
153
+ this.autocomplete = 'off';
154
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
155
+ this.color = 'primary';
156
+ this.suggestions = [];
157
+ this.disabled = false;
158
+ this.type = 'select';
159
+ this.tooltip = '';
160
+ this.icon = 'filter_list';
161
+ this.option = 'option';
162
+ this.extraInfo = '';
163
+ this.hasDefaultValue = false;
164
+ this.onSelect = new EventEmitter();
165
+ this.onChangeFn = (_) => { };
166
+ this.onTouchFn = (_) => { };
167
+ this.isInvalid = false;
168
+ this.isSubmitted = false;
169
+ this._unsubscribe$ = new Subject();
170
+ if (_ngControl)
171
+ this._ngControl.valueAccessor = this;
172
+ if (_formGroupDirective) {
173
+ _formGroupDirective.ngSubmit.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
174
+ this.isSubmitted = true;
175
+ _cd.markForCheck();
176
+ });
177
+ }
178
+ }
179
+ ngOnInit() {
180
+ if (this.suggestions.length && this.hasDefaultValue) {
181
+ this._ngControl.control?.setValue(this.suggestions[0]);
182
+ }
183
+ if (this.disabled)
184
+ this.control.disable();
185
+ }
186
+ writeValue(value) { }
187
+ registerOnChange(fn) {
188
+ this.onChangeFn = fn;
189
+ }
190
+ registerOnTouched(fn) {
191
+ this.onTouchFn = fn;
192
+ }
193
+ onChange(event) {
194
+ this.onChangeFn(event.target.value);
195
+ if (this.control.touched)
196
+ this._onValidate();
197
+ }
198
+ emit(el) {
199
+ if (el.isUserInput) {
200
+ this.onSelect.emit(el.source.value);
201
+ this.isInvalid = false;
202
+ }
203
+ }
204
+ justEmit(el) {
205
+ this.control.setValue(el);
206
+ this.onSelect.emit(el);
207
+ this.isInvalid = false;
208
+ }
209
+ onFocusOut() {
210
+ this._onValidate();
211
+ }
212
+ _onValidate() {
213
+ if (this.control.invalid)
214
+ this.isInvalid = true;
215
+ else
216
+ this.isInvalid = false;
217
+ }
218
+ ngOnDestroy() {
219
+ this._unsubscribe$.next();
220
+ this._unsubscribe$.complete();
221
+ }
222
+ get control() {
223
+ return this._ngControl?.control;
224
+ }
225
+ get directive() {
226
+ return this._formGroupDirective;
227
+ }
228
+ get isDisabled() {
229
+ return this._ngControl.disabled;
230
+ }
231
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakSelectFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
232
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakSelectFieldComponent, selector: "tak-select-field", inputs: { autocomplete: "autocomplete", appearance: "appearance", color: "color", suggestions: "suggestions", disabled: "disabled", type: "type", tooltip: "tooltip", icon: "icon", option: "option", extraInfo: "extraInfo", hasDefaultValue: "hasDefaultValue" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "@if (type === 'select') {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\">\r\n <mat-label><ng-content></ng-content></mat-label>\r\n <mat-select [formControl]=\"control\" (focusout)=\"onFocusOut()\">\r\n @for (suggestion of suggestions; track suggestion) {\r\n <mat-option\r\n [value]=\"suggestion\"\r\n (onSelectionChange)=\"emit($event)\"\r\n title=\"{{ suggestion[option] }} {{\r\n extraInfo ? '(' + suggestion[extraInfo] + ')' : ''\r\n }}\"\r\n >\r\n {{ suggestion[option] }}\r\n @if (extraInfo) {\r\n <span class=\"tak-option-span-extra\">{{ suggestion[extraInfo] }}</span>\r\n }\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n} @else {\r\n <div [matTooltip]=\"tooltip\">\r\n @if (type === 'menu') {\r\n <span>\r\n <button mat-icon-button type=\"button\" [matMenuTriggerFor]=\"menu\" [disabled]=\"isDisabled\">\r\n <mat-icon>{{ icon }}</mat-icon>\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n @for (item of suggestions; track item) {\r\n <a tak-menu-item (click)=\"justEmit(item)\">\r\n {{ item[option] }}\r\n </a>\r\n }\r\n </mat-menu>\r\n </span>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "directive", type: i9.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }] }); }
233
+ }
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakSelectFieldComponent, decorators: [{
235
+ type: Component,
236
+ args: [{ selector: 'tak-select-field', template: "@if (type === 'select') {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\">\r\n <mat-label><ng-content></ng-content></mat-label>\r\n <mat-select [formControl]=\"control\" (focusout)=\"onFocusOut()\">\r\n @for (suggestion of suggestions; track suggestion) {\r\n <mat-option\r\n [value]=\"suggestion\"\r\n (onSelectionChange)=\"emit($event)\"\r\n title=\"{{ suggestion[option] }} {{\r\n extraInfo ? '(' + suggestion[extraInfo] + ')' : ''\r\n }}\"\r\n >\r\n {{ suggestion[option] }}\r\n @if (extraInfo) {\r\n <span class=\"tak-option-span-extra\">{{ suggestion[extraInfo] }}</span>\r\n }\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n} @else {\r\n <div [matTooltip]=\"tooltip\">\r\n @if (type === 'menu') {\r\n <span>\r\n <button mat-icon-button type=\"button\" [matMenuTriggerFor]=\"menu\" [disabled]=\"isDisabled\">\r\n <mat-icon>{{ icon }}</mat-icon>\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n @for (item of suggestions; track item) {\r\n <a tak-menu-item (click)=\"justEmit(item)\">\r\n {{ item[option] }}\r\n </a>\r\n }\r\n </mat-menu>\r\n </span>\r\n }\r\n </div>\r\n}\r\n" }]
237
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
238
+ type: Self
239
+ }, {
240
+ type: Optional
241
+ }] }, { type: i1.FormGroupDirective, decorators: [{
242
+ type: Optional
243
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { autocomplete: [{
244
+ type: Input
245
+ }], appearance: [{
246
+ type: Input
247
+ }], color: [{
248
+ type: Input
249
+ }], suggestions: [{
250
+ type: Input
251
+ }], disabled: [{
252
+ type: Input
253
+ }], type: [{
254
+ type: Input
255
+ }], tooltip: [{
256
+ type: Input
257
+ }], icon: [{
258
+ type: Input
259
+ }], option: [{
260
+ type: Input
261
+ }], extraInfo: [{
262
+ type: Input
263
+ }], hasDefaultValue: [{
264
+ type: Input
265
+ }], onSelect: [{
266
+ type: Output
267
+ }] } });
268
+
269
+ class TakDateFieldComponent {
270
+ constructor(_ngControl, _formGroupDirective, _cd) {
271
+ this._ngControl = _ngControl;
272
+ this._formGroupDirective = _formGroupDirective;
273
+ this._cd = _cd;
274
+ this._unsubscribe$ = new Subject();
275
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
276
+ this.autocomplete = 'off';
277
+ this.color = 'primary';
278
+ this.placeholder = '';
279
+ this.notInput = false;
280
+ this.disabled = false;
281
+ this.onChangeFn = (_) => { };
282
+ this.onTouchFn = (_) => { };
283
+ this._isSubmitted = false;
284
+ this._isInvalid = false;
285
+ this._required = false;
286
+ this._value = '';
287
+ if (_ngControl)
288
+ this._ngControl.valueAccessor = this;
289
+ if (_formGroupDirective) {
290
+ _formGroupDirective.ngSubmit.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
291
+ this._isSubmitted = true;
292
+ _cd.markForCheck();
293
+ });
294
+ }
295
+ }
296
+ ngOnInit() {
297
+ const form = this.control;
298
+ if (form?._rawValidators) {
299
+ form._rawValidators.map((r) => {
300
+ if (r.name.includes('required')) {
301
+ this._required = true;
302
+ }
303
+ });
304
+ }
305
+ if (this.disabled)
306
+ this.control.disable();
307
+ }
308
+ ngAfterViewInit() {
309
+ const isValidDate = Date.parse(this.control.value);
310
+ if (isNaN(isValidDate))
311
+ this.control.setValue(null);
312
+ else
313
+ this.control.setValue(new Date(this.control.value));
314
+ }
315
+ writeValue(value) {
316
+ if (value === null)
317
+ this._isInvalid = false;
318
+ this._value = value;
319
+ }
320
+ registerOnChange(fn) {
321
+ this.onChangeFn = fn;
322
+ }
323
+ registerOnTouched(fn) {
324
+ this.onTouchFn = fn;
325
+ }
326
+ onChange(event) {
327
+ this._value = event.target.value;
328
+ this.onChangeFn(event.target.value);
329
+ if (this.control.touched)
330
+ this._onValidate();
331
+ }
332
+ onFocusout() {
333
+ this.onTouchFn(true);
334
+ this._onValidate();
335
+ }
336
+ onCloseDatePicker() {
337
+ this.onTouchFn(true);
338
+ this._onValidate();
339
+ }
340
+ _onValidate() {
341
+ const isValidDate = Date.parse(this.control.value);
342
+ if (this.control.invalid ||
343
+ ([undefined, null, ''].indexOf(this.control.value) < 0 &&
344
+ this.control.valid &&
345
+ isNaN(isValidDate))) {
346
+ this._isInvalid = true;
347
+ }
348
+ else {
349
+ this._isInvalid = false;
350
+ }
351
+ }
352
+ ngOnDestroy() {
353
+ this._unsubscribe$.next();
354
+ this._unsubscribe$.complete();
355
+ }
356
+ get control() {
357
+ return this._ngControl?.control;
358
+ }
359
+ get directive() {
360
+ return this._formGroupDirective;
361
+ }
362
+ get isDisabled() {
363
+ return this._ngControl.disabled;
364
+ }
365
+ get isSubmitted() {
366
+ return this._isSubmitted;
367
+ }
368
+ get isInvalid() {
369
+ return this._isInvalid;
370
+ }
371
+ get required() {
372
+ return this._required;
373
+ }
374
+ get value() {
375
+ return this._value;
376
+ }
377
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakDateFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
378
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakDateFieldComponent, selector: "tak-date-field", inputs: { appearance: "appearance", autocomplete: "autocomplete", color: "color", placeholder: "placeholder", notInput: "notInput", minDate: "minDate", maxDate: "maxDate", disabled: "disabled" }, ngImport: i0, template: "@if (!notInput) {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n matInput\r\n [min]=\"minDate\"\r\n [max]=\"maxDate\"\r\n [autocomplete]=\"autocomplete\"\r\n [matDatepicker]=\"picker\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n [disabled]=\"isDisabled\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker (closed)=\"onCloseDatePicker()\" #picker></mat-datepicker>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\" [isDateField]=\"true\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n@if (notInput) {\r\n <div>\r\n <div\r\n class=\"tak__date-not-input__picker-container\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n >\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker (closed)=\"onCloseDatePicker()\" #picker></mat-datepicker>\r\n </div>\r\n <div class=\"tak__date-not-input__field-container\">\r\n <mat-form-field [color]=\"color\">\r\n <input\r\n matInput\r\n [min]=\"minDate\"\r\n [max]=\"maxDate\"\r\n autocomplete=\"off\"\r\n [matDatepicker]=\"picker\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\" [isDateField]=\"true\" [marginTop]=\"-60\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] }); }
379
+ }
380
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakDateFieldComponent, decorators: [{
381
+ type: Component,
382
+ args: [{ selector: 'tak-date-field', template: "@if (!notInput) {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n matInput\r\n [min]=\"minDate\"\r\n [max]=\"maxDate\"\r\n [autocomplete]=\"autocomplete\"\r\n [matDatepicker]=\"picker\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n [disabled]=\"isDisabled\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker (closed)=\"onCloseDatePicker()\" #picker></mat-datepicker>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\" [isDateField]=\"true\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n@if (notInput) {\r\n <div>\r\n <div\r\n class=\"tak__date-not-input__picker-container\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n >\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker (closed)=\"onCloseDatePicker()\" #picker></mat-datepicker>\r\n </div>\r\n <div class=\"tak__date-not-input__field-container\">\r\n <mat-form-field [color]=\"color\">\r\n <input\r\n matInput\r\n [min]=\"minDate\"\r\n [max]=\"maxDate\"\r\n autocomplete=\"off\"\r\n [matDatepicker]=\"picker\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\" [isDateField]=\"true\" [marginTop]=\"-60\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n" }]
383
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
384
+ type: Self
385
+ }, {
386
+ type: Optional
387
+ }] }, { type: i1.FormGroupDirective, decorators: [{
388
+ type: Optional
389
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { appearance: [{
390
+ type: Input
391
+ }], autocomplete: [{
392
+ type: Input
393
+ }], color: [{
394
+ type: Input
395
+ }], placeholder: [{
396
+ type: Input
397
+ }], notInput: [{
398
+ type: Input
399
+ }], minDate: [{
400
+ type: Input
401
+ }], maxDate: [{
402
+ type: Input
403
+ }], disabled: [{
404
+ type: Input
405
+ }] } });
406
+
407
+ class TakAutocompleteFieldComponent {
408
+ constructor(_ngControl, _formGroupDirective, _cd) {
409
+ this._ngControl = _ngControl;
410
+ this._formGroupDirective = _formGroupDirective;
411
+ this._cd = _cd;
412
+ this._unsubscribe$ = new Subject();
413
+ this.option = 'option';
414
+ this.extraInfo = '';
415
+ this.autocomplete = 'off';
416
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
417
+ this.color = 'primary';
418
+ this.hasClearButton = true;
419
+ this.suggestions = [];
420
+ this.disabled = false;
421
+ this.hasTitle = false;
422
+ this.isLoading = false;
423
+ this.isRemoteSearch = false;
424
+ this.debounceTimeForRemoteSearch = 500;
425
+ this.onSelect = new EventEmitter();
426
+ this.onSearch = new EventEmitter();
427
+ this.onChangeFn = (_) => { };
428
+ this.onTouchFn = (_) => { };
429
+ this._isSubmitted = false;
430
+ this._isInvalid = false;
431
+ this._required = false;
432
+ this._value = '';
433
+ this._notSuggestions = false;
434
+ this._lastValue = '';
435
+ if (_ngControl)
436
+ this._ngControl.valueAccessor = this;
437
+ if (_formGroupDirective) {
438
+ _formGroupDirective.ngSubmit.pipe(takeUntil$1(this._unsubscribe$)).subscribe(() => {
439
+ this._isSubmitted = true;
440
+ _cd.markForCheck();
441
+ });
442
+ }
443
+ }
444
+ ngOnInit() {
445
+ const form = this.control;
446
+ if (form?._rawValidators) {
447
+ form._rawValidators.map((r) => {
448
+ if (r.name.includes('required'))
449
+ this._required = true;
450
+ });
451
+ }
452
+ this._filteredOptions = this.control.valueChanges.pipe(takeUntil$1(this._unsubscribe$), map(() => this._filter()));
453
+ if (this.isRemoteSearch) {
454
+ this.control.valueChanges
455
+ .pipe(takeUntil$1(this._unsubscribe$), debounceTime(this.debounceTimeForRemoteSearch))
456
+ .subscribe(() => {
457
+ if (this._lastValue !== `${this._value}` && `${this._value}` && !this.control.value) {
458
+ this.onSearch.emit(`${this._value}`);
459
+ this._setValue(`${this._value}`);
460
+ }
461
+ this._lastValue = `${this._value}`;
462
+ });
463
+ }
464
+ if (this.disabled)
465
+ this.control.disable();
466
+ }
467
+ _filter() {
468
+ const value = typeof `${this._value}` === 'string'
469
+ ? `${this._value}`.toLowerCase()
470
+ : `${this.control.value[this.option]}`.toLowerCase();
471
+ const option = this.suggestions.filter(res => `${res[this.option]}`.toLowerCase().includes(value));
472
+ if (!option.length)
473
+ this._notSuggestions = true;
474
+ else
475
+ this._notSuggestions = false;
476
+ return option;
477
+ }
478
+ writeValue(value) {
479
+ if (value === null)
480
+ this._isInvalid = false;
481
+ this._value = value || '';
482
+ this._isSubmitted = false;
483
+ this._cd.markForCheck();
484
+ }
485
+ registerOnChange(fn) {
486
+ this.onChangeFn = fn;
487
+ }
488
+ registerOnTouched(fn) {
489
+ this.onTouchFn = fn;
490
+ }
491
+ onChange(event) {
492
+ if (event.target.value !== `${this._value}`) {
493
+ this._value = event.target.value;
494
+ if (!this.isRemoteSearch)
495
+ this._setValue(`${this._value}`);
496
+ this.onChangeFn(this.suggestions.filter(sug => `${sug[this.option]}`.toLowerCase() === `${`${this._value}`}`.toLowerCase())[0] || null);
497
+ if (this.control.touched) {
498
+ this._onValidate();
499
+ }
500
+ }
501
+ }
502
+ _setValue(value) {
503
+ if (!this.isRemoteSearch) {
504
+ const suggestionsFiltered = value
505
+ ? this.suggestions.filter(el => `${el[this.option]}`.toLowerCase().trim() === value.toLowerCase().trim())
506
+ : [];
507
+ if (suggestionsFiltered.length) {
508
+ document.body.dispatchEvent(TAK_PRESS_ESC_KEY);
509
+ }
510
+ try {
511
+ this.control.setValue(suggestionsFiltered[0][this.option], {
512
+ emitEvent: false,
513
+ });
514
+ this.onSelect.emit(suggestionsFiltered[0]);
515
+ }
516
+ catch (error) { }
517
+ }
518
+ }
519
+ emit(el) {
520
+ if (el && el.isUserInput)
521
+ this._isInvalid = false;
522
+ }
523
+ emitWithClick(suggestionOption) {
524
+ this.control.setValue(suggestionOption);
525
+ this._value = `${suggestionOption[this.option]}`;
526
+ this._isInvalid = false;
527
+ }
528
+ onFocusout() {
529
+ this.onTouchFn(true);
530
+ this._onValidate();
531
+ }
532
+ setValue(value) {
533
+ this.control.setValue(value);
534
+ this._value = `${value[this.option]}`;
535
+ }
536
+ onUpdateSuggestions(suggestions) {
537
+ this.suggestions = suggestions;
538
+ this._cd.markForCheck();
539
+ this.onChangeFn(this.suggestions.filter(sug => `${sug[this.option]}`.toLowerCase() === `${this._value}`.toLowerCase())[0] || null);
540
+ }
541
+ _onValidate() {
542
+ if (this.control.invalid)
543
+ this._isInvalid = true;
544
+ else
545
+ this._isInvalid = false;
546
+ }
547
+ onFocus() {
548
+ if (!`${this._value}`) {
549
+ this.control.setValue('');
550
+ this._value = '';
551
+ }
552
+ }
553
+ onClearControl() {
554
+ this.control.setValue('', { emitEvent: false });
555
+ this._value = '';
556
+ }
557
+ ngOnDestroy() {
558
+ this._unsubscribe$.next();
559
+ this._unsubscribe$.complete();
560
+ }
561
+ get control() {
562
+ return this._ngControl?.control;
563
+ }
564
+ get directive() {
565
+ return this._formGroupDirective;
566
+ }
567
+ get isDisabled() {
568
+ return this._ngControl.disabled;
569
+ }
570
+ get isSubmitted() {
571
+ return this._isSubmitted;
572
+ }
573
+ get isInvalid() {
574
+ return this._isInvalid;
575
+ }
576
+ get required() {
577
+ return this._required;
578
+ }
579
+ get value() {
580
+ return `${this._value}`;
581
+ }
582
+ get filteredOptions() {
583
+ return this._filteredOptions;
584
+ }
585
+ get notSuggestions() {
586
+ return this._notSuggestions;
587
+ }
588
+ get lastValue() {
589
+ return this._lastValue;
590
+ }
591
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakAutocompleteFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
592
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakAutocompleteFieldComponent, selector: "tak-autocomplete-field", inputs: { option: "option", extraInfo: "extraInfo", autocomplete: "autocomplete", appearance: "appearance", color: "color", hasClearButton: "hasClearButton", suggestions: "suggestions", disabled: "disabled", hasTitle: "hasTitle", isLoading: "isLoading", isRemoteSearch: "isRemoteSearch", debounceTimeForRemoteSearch: "debounceTimeForRemoteSearch" }, outputs: { onSelect: "onSelect", onSearch: "onSearch" }, ngImport: i0, template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [matAutocomplete]=\"auto\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n (focus)=\"onFocus()\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n @if (isRemoteSearch && isLoading) {\r\n <button matSuffix mat-icon-button type=\"button\">\r\n <mat-spinner [diameter]=\"15\" mode=\"indeterminate\"></mat-spinner>\r\n </button>\r\n }\r\n @if ((control.value || value) && hasClearButton && !disabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n }\r\n <mat-autocomplete #auto=\"matAutocomplete\">\r\n @for (suggestion of filteredOptions | async; track suggestion) {\r\n <mat-option\r\n [value]=\"suggestion[option]\"\r\n [class.tak-option-extra]=\"extraInfo\"\r\n (onSelectionChange)=\"emit($event)\"\r\n (click)=\"emitWithClick(suggestion)\"\r\n title=\"{{ suggestion[option] }} {{ extraInfo ? '(' + suggestion[extraInfo] + ')' : '' }}\"\r\n >\r\n <span>{{ suggestion[option] }}</span>\r\n @if (extraInfo) {\r\n <span class=\"tak-option-span-extra\">{{ suggestion[extraInfo] }}</span>\r\n }\r\n </mat-option>\r\n }\r\n @if (notSuggestions && control.invalid) {\r\n <mat-option>\r\n <span class=\"tak-autocomplete-not-records\"> No se encuentran resultados </span>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: i2$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i5$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i10.AsyncPipe, name: "async" }] }); }
593
+ }
594
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakAutocompleteFieldComponent, decorators: [{
595
+ type: Component,
596
+ args: [{ selector: 'tak-autocomplete-field', template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [matAutocomplete]=\"auto\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n (focus)=\"onFocus()\"\r\n (focusout)=\"onFocusout()\"\r\n />\r\n @if (isRemoteSearch && isLoading) {\r\n <button matSuffix mat-icon-button type=\"button\">\r\n <mat-spinner [diameter]=\"15\" mode=\"indeterminate\"></mat-spinner>\r\n </button>\r\n }\r\n @if ((control.value || value) && hasClearButton && !disabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n }\r\n <mat-autocomplete #auto=\"matAutocomplete\">\r\n @for (suggestion of filteredOptions | async; track suggestion) {\r\n <mat-option\r\n [value]=\"suggestion[option]\"\r\n [class.tak-option-extra]=\"extraInfo\"\r\n (onSelectionChange)=\"emit($event)\"\r\n (click)=\"emitWithClick(suggestion)\"\r\n title=\"{{ suggestion[option] }} {{ extraInfo ? '(' + suggestion[extraInfo] + ')' : '' }}\"\r\n >\r\n <span>{{ suggestion[option] }}</span>\r\n @if (extraInfo) {\r\n <span class=\"tak-option-span-extra\">{{ suggestion[extraInfo] }}</span>\r\n }\r\n </mat-option>\r\n }\r\n @if (notSuggestions && control.invalid) {\r\n <mat-option>\r\n <span class=\"tak-autocomplete-not-records\"> No se encuentran resultados </span>\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n</div>\r\n" }]
597
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
598
+ type: Self
599
+ }, {
600
+ type: Optional
601
+ }] }, { type: i1.FormGroupDirective, decorators: [{
602
+ type: Optional
603
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { option: [{
604
+ type: Input
605
+ }], extraInfo: [{
606
+ type: Input
607
+ }], autocomplete: [{
608
+ type: Input
609
+ }], appearance: [{
610
+ type: Input
611
+ }], color: [{
612
+ type: Input
613
+ }], hasClearButton: [{
614
+ type: Input
615
+ }], suggestions: [{
616
+ type: Input
617
+ }], disabled: [{
618
+ type: Input
619
+ }], hasTitle: [{
620
+ type: Input
621
+ }], isLoading: [{
622
+ type: Input
623
+ }], isRemoteSearch: [{
624
+ type: Input
625
+ }], debounceTimeForRemoteSearch: [{
626
+ type: Input
627
+ }], onSelect: [{
628
+ type: Output
629
+ }], onSearch: [{
630
+ type: Output
631
+ }] } });
632
+
633
+ class TakErrorModule {
634
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
635
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: TakErrorModule, declarations: [TakErrorEqualsPipe, TakErrorMsgPipe, TakErrorComponent], imports: [FormsModule, CommonModule, ReactiveFormsModule], exports: [TakErrorComponent] }); }
636
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorModule, imports: [FormsModule, CommonModule, ReactiveFormsModule] }); }
637
+ }
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakErrorModule, decorators: [{
639
+ type: NgModule,
640
+ args: [{
641
+ declarations: [TakErrorEqualsPipe, TakErrorMsgPipe, TakErrorComponent],
642
+ imports: [FormsModule, CommonModule, ReactiveFormsModule],
643
+ exports: [TakErrorComponent],
644
+ }]
645
+ }] });
646
+
647
+ class TakDateRangeFieldComponent {
648
+ constructor() {
649
+ this.autocomplete = 'off';
650
+ this.startPlaceholder = 'Inicio';
651
+ this.endPlaceholder = 'Fin';
652
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
653
+ this.color = 'primary';
654
+ this.notInput = false;
655
+ this.disabled = false;
656
+ this._required = false;
657
+ }
658
+ ngOnInit() {
659
+ const start = this.start;
660
+ const end = this.end;
661
+ if (start?._rawValidators) {
662
+ start._rawValidators.map((r) => {
663
+ if (r.name.includes('required'))
664
+ this._required = true;
665
+ });
666
+ }
667
+ if (end?._rawValidators) {
668
+ end._rawValidators.map((r) => {
669
+ if (r.name.includes('required'))
670
+ this._required = true;
671
+ });
672
+ }
673
+ if (this.disabled) {
674
+ this.start.disable();
675
+ this.end.disable();
676
+ }
677
+ }
678
+ get required() {
679
+ return this._required;
680
+ }
681
+ get isDisabled() {
682
+ return this.start.disabled || this.end.disabled;
683
+ }
684
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakDateRangeFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
685
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakDateRangeFieldComponent, selector: "tak-date-range-field", inputs: { autocomplete: "autocomplete", startPlaceholder: "startPlaceholder", endPlaceholder: "endPlaceholder", appearance: "appearance", color: "color", start: "start", end: "end", notInput: "notInput", disabled: "disabled" }, ngImport: i0, template: "@if (!notInput) {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\">\r\n <mat-label>\r\n <ng-content></ng-content>\r\n </mat-label>\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input\r\n matStartDate\r\n [placeholder]=\"startPlaceholder\"\r\n [formControl]=\"start\"\r\n [autocomplete]=\"autocomplete\"\r\n />\r\n <input matEndDate [placeholder]=\"endPlaceholder\" [formControl]=\"end\" />\r\n </mat-date-range-input>\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker></mat-date-range-picker>\r\n </mat-form-field>\r\n @if ((start.invalid || end.invalid) && (start.touched || end.touched)) {\r\n <tak-error [start]=\"start\" [end]=\"end\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n@if (notInput) {\r\n <div>\r\n <div\r\n class=\"tak__date-not-input__picker-container\"\r\n [class.mat-form-field-invalid]=\"\r\n (start.invalid || end.invalid) && (start.touched || end.touched)\r\n \"\r\n >\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker [disabled]=\"isDisabled\"></mat-date-range-picker>\r\n </div>\r\n <div class=\"tak__date-not-input__field-container\">\r\n <mat-form-field [color]=\"color\">\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input matStartDate [formControl]=\"start\" />\r\n <input matEndDate [formControl]=\"end\" />\r\n </mat-date-range-input>\r\n </mat-form-field>\r\n </div>\r\n @if ((start.invalid || end.invalid) && (start.touched || end.touched)) {\r\n <tak-error [start]=\"start\" [end]=\"end\" [marginTop]=\"-60\"></tak-error>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i3$1.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i3$1.MatStartDate, selector: "input[matStartDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i3$1.MatEndDate, selector: "input[matEndDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i3$1.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }] }); }
686
+ }
687
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakDateRangeFieldComponent, decorators: [{
688
+ type: Component,
689
+ args: [{ selector: 'tak-date-range-field', template: "@if (!notInput) {\r\n <div class=\"tak-form-container\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\">\r\n <mat-label>\r\n <ng-content></ng-content>\r\n </mat-label>\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input\r\n matStartDate\r\n [placeholder]=\"startPlaceholder\"\r\n [formControl]=\"start\"\r\n [autocomplete]=\"autocomplete\"\r\n />\r\n <input matEndDate [placeholder]=\"endPlaceholder\" [formControl]=\"end\" />\r\n </mat-date-range-input>\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker></mat-date-range-picker>\r\n </mat-form-field>\r\n @if ((start.invalid || end.invalid) && (start.touched || end.touched)) {\r\n <tak-error [start]=\"start\" [end]=\"end\"> </tak-error>\r\n }\r\n </div>\r\n}\r\n@if (notInput) {\r\n <div>\r\n <div\r\n class=\"tak__date-not-input__picker-container\"\r\n [class.mat-form-field-invalid]=\"\r\n (start.invalid || end.invalid) && (start.touched || end.touched)\r\n \"\r\n >\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker [disabled]=\"isDisabled\"></mat-date-range-picker>\r\n </div>\r\n <div class=\"tak__date-not-input__field-container\">\r\n <mat-form-field [color]=\"color\">\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input matStartDate [formControl]=\"start\" />\r\n <input matEndDate [formControl]=\"end\" />\r\n </mat-date-range-input>\r\n </mat-form-field>\r\n </div>\r\n @if ((start.invalid || end.invalid) && (start.touched || end.touched)) {\r\n <tak-error [start]=\"start\" [end]=\"end\" [marginTop]=\"-60\"></tak-error>\r\n }\r\n </div>\r\n}\r\n" }]
690
+ }], propDecorators: { autocomplete: [{
691
+ type: Input
692
+ }], startPlaceholder: [{
693
+ type: Input
694
+ }], endPlaceholder: [{
695
+ type: Input
696
+ }], appearance: [{
697
+ type: Input
698
+ }], color: [{
699
+ type: Input
700
+ }], start: [{
701
+ type: Input
702
+ }], end: [{
703
+ type: Input
704
+ }], notInput: [{
705
+ type: Input
706
+ }], disabled: [{
707
+ type: Input
708
+ }] } });
709
+
710
+ class TakMoneyFieldComponent {
711
+ constructor(_ngControl, _formGroupDirective, _cd) {
712
+ this._ngControl = _ngControl;
713
+ this._formGroupDirective = _formGroupDirective;
714
+ this._cd = _cd;
715
+ this.autocomplete = 'off';
716
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
717
+ this.floatLabel = 'auto';
718
+ this.color = 'primary';
719
+ this.actionIcon = 'search';
720
+ this.defaultFilterStyle = true;
721
+ this.hasActionButton = false;
722
+ this.hasClearButton = true;
723
+ this.countCaracters = false;
724
+ this.placeholder = '';
725
+ this.disabled = false;
726
+ this.onExecuteAction = new EventEmitter();
727
+ this.onKeyUp = new EventEmitter();
728
+ this.onChangeFn = (_) => { };
729
+ this.onTouchFn = (_) => { };
730
+ this._isSubmitted = false;
731
+ this._isInvalid = false;
732
+ this._required = false;
733
+ this._value = '';
734
+ if (_ngControl)
735
+ this._ngControl.valueAccessor = this;
736
+ if (_formGroupDirective) {
737
+ this._subscription = _formGroupDirective.ngSubmit.subscribe(() => {
738
+ this._isSubmitted = true;
739
+ _cd.markForCheck();
740
+ });
741
+ }
742
+ }
743
+ ngOnInit() {
744
+ const form = this.control;
745
+ if (form?._rawValidators) {
746
+ form._rawValidators.forEach((r) => {
747
+ if (r.name.includes('required'))
748
+ this._required = true;
749
+ });
750
+ }
751
+ this.control.addValidators(Validators.pattern(/^[0-9.,-]+$/));
752
+ if (['', null, undefined, '-'].indexOf(this.control.value) < 0)
753
+ this._addCurrencyMask();
754
+ if (this.disabled)
755
+ this.control.disable();
756
+ }
757
+ writeValue(value) {
758
+ if (value === null) {
759
+ this._isInvalid = false;
760
+ }
761
+ this._value = value;
762
+ this._isSubmitted = false;
763
+ this._cd.markForCheck();
764
+ }
765
+ registerOnChange(fn) {
766
+ this.onChangeFn = fn;
767
+ }
768
+ registerOnTouched(fn) {
769
+ this.onTouchFn = fn;
770
+ }
771
+ onChange(event) {
772
+ this._value = event.target.value;
773
+ this.onChangeFn(event.target.value);
774
+ this._addCurrencyMask();
775
+ if (this.control.touched)
776
+ this._onValidate();
777
+ }
778
+ _addCurrencyMask() {
779
+ const valueFormatted = this.control.value
780
+ .toString()
781
+ .replace(/,/g, '')
782
+ .replace(/ /g, '')
783
+ .replace('$', '');
784
+ if (['', null, undefined, '-'].indexOf(valueFormatted) < 0 && !isNaN(Number(valueFormatted))) {
785
+ const value = '$ ' + Intl.NumberFormat('en-US').format(Number(valueFormatted));
786
+ this.control.setValue(+valueFormatted);
787
+ this._value = value;
788
+ }
789
+ else if (['-'].indexOf(valueFormatted) >= 0)
790
+ this.control.setValue('-');
791
+ else
792
+ this.control.setValue(null);
793
+ }
794
+ onFocusOut() {
795
+ this.onTouchFn(true);
796
+ //this._executeIfIsMoneyField();
797
+ this._onValidate();
798
+ }
799
+ _onValidate() {
800
+ if (this.control.invalid)
801
+ this._isInvalid = true;
802
+ else
803
+ this._isInvalid = false;
804
+ }
805
+ onKeyDown(event) {
806
+ const pattern = /[0-9.-]/i.test(event.key);
807
+ const validKeyCodes = [8, 46, 37, 39, 9, 17, 16, 67, 86, 109, 189];
808
+ return pattern || validKeyCodes.indexOf(event.keyCode) >= 0;
809
+ }
810
+ onClearControl() {
811
+ if (['', null, undefined].indexOf(this.control.value) >= 0) {
812
+ this.control.setValue('', { emitEvent: false });
813
+ }
814
+ else {
815
+ this.control.setValue('');
816
+ }
817
+ this._value = '';
818
+ }
819
+ ngOnDestroy() {
820
+ if (this._subscription)
821
+ this._subscription.unsubscribe();
822
+ }
823
+ get control() {
824
+ return this._ngControl.control;
825
+ }
826
+ get directive() {
827
+ return this._formGroupDirective;
828
+ }
829
+ get isDisabled() {
830
+ return this._ngControl.disabled;
831
+ }
832
+ get isSubmitted() {
833
+ return this._isSubmitted;
834
+ }
835
+ get isInvalid() {
836
+ return this._isInvalid;
837
+ }
838
+ get required() {
839
+ return this._required;
840
+ }
841
+ get value() {
842
+ return this._value;
843
+ }
844
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakMoneyFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
845
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakMoneyFieldComponent, selector: "tak-money-field", inputs: { autocomplete: "autocomplete", appearance: "appearance", floatLabel: "floatLabel", color: "color", actionIcon: "actionIcon", defaultFilterStyle: "defaultFilterStyle", hasActionButton: "hasActionButton", hasClearButton: "hasClearButton", countCaracters: "countCaracters", placeholder: "placeholder", maxLength: "maxLength", minLength: "minLength", disabled: "disabled" }, outputs: { onExecuteAction: "onExecuteAction", onKeyUp: "onKeyUp" }, ngImport: i0, template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n class=\"money-input\"\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [placeholder]=\"placeholder\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] }); }
846
+ }
847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakMoneyFieldComponent, decorators: [{
848
+ type: Component,
849
+ args: [{ selector: 'tak-money-field', template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n class=\"money-input\"\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [placeholder]=\"placeholder\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n" }]
850
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
851
+ type: Self
852
+ }, {
853
+ type: Optional
854
+ }] }, { type: i1.FormGroupDirective, decorators: [{
855
+ type: Optional
856
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { autocomplete: [{
857
+ type: Input
858
+ }], appearance: [{
859
+ type: Input
860
+ }], floatLabel: [{
861
+ type: Input
862
+ }], color: [{
863
+ type: Input
864
+ }], actionIcon: [{
865
+ type: Input
866
+ }], defaultFilterStyle: [{
867
+ type: Input
868
+ }], hasActionButton: [{
869
+ type: Input
870
+ }], hasClearButton: [{
871
+ type: Input
872
+ }], countCaracters: [{
873
+ type: Input
874
+ }], placeholder: [{
875
+ type: Input
876
+ }], maxLength: [{
877
+ type: Input
878
+ }], minLength: [{
879
+ type: Input
880
+ }], disabled: [{
881
+ type: Input
882
+ }], onExecuteAction: [{
883
+ type: Output
884
+ }], onKeyUp: [{
885
+ type: Output
886
+ }] } });
887
+
888
+ class TakGeneralFieldComponent {
889
+ constructor(_ngControl, _formGroupDirective, _cd) {
890
+ this._ngControl = _ngControl;
891
+ this._formGroupDirective = _formGroupDirective;
892
+ this._cd = _cd;
893
+ this.autocomplete = 'off';
894
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
895
+ this.type = 'text';
896
+ this.floatLabel = 'never';
897
+ this.color = 'primary';
898
+ this.actionIcon = 'search';
899
+ this.defaultFilterStyle = true;
900
+ this.hasActionButton = false;
901
+ this.hasClearButton = false;
902
+ this.countCaracters = false;
903
+ this.placeholder = '';
904
+ this.disabled = false;
905
+ this.onExecuteAction = new EventEmitter();
906
+ this.onKeyUp = new EventEmitter();
907
+ this.onChangeFn = (_) => { };
908
+ this.onTouchFn = (_) => { };
909
+ this._isSubmitted = false;
910
+ this._isInvalid = false;
911
+ this._required = false;
912
+ this._value = '';
913
+ this._decrypted = false;
914
+ if (_ngControl)
915
+ this._ngControl.valueAccessor = this;
916
+ if (_formGroupDirective) {
917
+ this._subscription = _formGroupDirective.ngSubmit.subscribe(() => {
918
+ this._isSubmitted = true;
919
+ _cd.markForCheck();
920
+ });
921
+ }
922
+ }
923
+ ngOnInit() {
924
+ const form = this.control;
925
+ if (this.type === 'filter' && this.defaultFilterStyle) {
926
+ this.control.removeValidators(Validators.required);
927
+ this.appearance = 'legacy';
928
+ this.floatLabel = 'never';
929
+ if (!this.placeholder)
930
+ this.placeholder = 'Buscar';
931
+ this.hasClearButton = true;
932
+ this._cd.markForCheck();
933
+ }
934
+ if (form?._rawValidators) {
935
+ form._rawValidators.forEach((r) => {
936
+ if (r.name.includes('required'))
937
+ this._required = true;
938
+ });
939
+ }
940
+ if (this.disabled)
941
+ this.control.disable();
942
+ }
943
+ writeValue(value) {
944
+ if (value === null)
945
+ this._isInvalid = false;
946
+ this._value = value;
947
+ this._isSubmitted = false;
948
+ this._cd.markForCheck();
949
+ }
950
+ registerOnChange(fn) {
951
+ this.onChangeFn = fn;
952
+ }
953
+ registerOnTouched(fn) {
954
+ this.onTouchFn = fn;
955
+ }
956
+ onChange(event) {
957
+ this._value = event.target.value;
958
+ this.onChangeFn(event.target.value);
959
+ if (!this.control.value && this.type === 'password')
960
+ this._decrypted = false;
961
+ if (this.control.touched)
962
+ this._onValidate();
963
+ if (this.type === 'filter')
964
+ this.onKeyUp.emit(this.control.value);
965
+ }
966
+ showPassword() {
967
+ if (this.type === 'password') {
968
+ if (this._decrypted)
969
+ this._decrypted = false;
970
+ else
971
+ this._decrypted = true;
972
+ }
973
+ }
974
+ onFocusOut() {
975
+ this.onTouchFn(true);
976
+ this._onValidate();
977
+ }
978
+ _onValidate() {
979
+ if (this.control.invalid)
980
+ this._isInvalid = true;
981
+ else
982
+ this._isInvalid = false;
983
+ }
984
+ onClearControl() {
985
+ if (['', null, undefined].indexOf(this.control.value) >= 0) {
986
+ this.control.setValue('', { emitEvent: false });
987
+ }
988
+ else
989
+ this.control.setValue('');
990
+ this._value = '';
991
+ }
992
+ ngOnDestroy() {
993
+ if (this._subscription)
994
+ this._subscription.unsubscribe();
995
+ }
996
+ get control() {
997
+ return this._ngControl.control;
998
+ }
999
+ get directive() {
1000
+ return this._formGroupDirective;
1001
+ }
1002
+ get decrypted() {
1003
+ return this._decrypted;
1004
+ }
1005
+ get isDisabled() {
1006
+ return this._ngControl.disabled;
1007
+ }
1008
+ get isSubmitted() {
1009
+ return this._isSubmitted;
1010
+ }
1011
+ get isInvalid() {
1012
+ return this._isInvalid;
1013
+ }
1014
+ get required() {
1015
+ return this._required;
1016
+ }
1017
+ get value() {
1018
+ return this._value;
1019
+ }
1020
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakGeneralFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1021
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakGeneralFieldComponent, selector: "tak-general-field", inputs: { autocomplete: "autocomplete", appearance: "appearance", type: "type", floatLabel: "floatLabel", color: "color", actionIcon: "actionIcon", defaultFilterStyle: "defaultFilterStyle", hasActionButton: "hasActionButton", hasClearButton: "hasClearButton", countCaracters: "countCaracters", placeholder: "placeholder", maxLength: "maxLength", minLength: "minLength", disabled: "disabled" }, outputs: { onExecuteAction: "onExecuteAction", onKeyUp: "onKeyUp" }, ngImport: i0, template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n [type]=\"type === 'password' && !decrypted ? 'password' : 'text'\"\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && type === 'password' && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"showPassword()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{\r\n decrypted ? 'visibility_off' : 'visibility'\r\n }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] }); }
1022
+ }
1023
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakGeneralFieldComponent, decorators: [{
1024
+ type: Component,
1025
+ args: [{ selector: 'tak-general-field', template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n [type]=\"type === 'password' && !decrypted ? 'password' : 'text'\"\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && type === 'password' && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"showPassword()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{\r\n decrypted ? 'visibility_off' : 'visibility'\r\n }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n" }]
1026
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
1027
+ type: Self
1028
+ }, {
1029
+ type: Optional
1030
+ }] }, { type: i1.FormGroupDirective, decorators: [{
1031
+ type: Optional
1032
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { autocomplete: [{
1033
+ type: Input
1034
+ }], appearance: [{
1035
+ type: Input
1036
+ }], type: [{
1037
+ type: Input
1038
+ }], floatLabel: [{
1039
+ type: Input
1040
+ }], color: [{
1041
+ type: Input
1042
+ }], actionIcon: [{
1043
+ type: Input
1044
+ }], defaultFilterStyle: [{
1045
+ type: Input
1046
+ }], hasActionButton: [{
1047
+ type: Input
1048
+ }], hasClearButton: [{
1049
+ type: Input
1050
+ }], countCaracters: [{
1051
+ type: Input
1052
+ }], placeholder: [{
1053
+ type: Input
1054
+ }], maxLength: [{
1055
+ type: Input
1056
+ }], minLength: [{
1057
+ type: Input
1058
+ }], disabled: [{
1059
+ type: Input
1060
+ }], onExecuteAction: [{
1061
+ type: Output
1062
+ }], onKeyUp: [{
1063
+ type: Output
1064
+ }] } });
1065
+
1066
+ class TakNumberFieldComponent {
1067
+ constructor(_ngControl, _formGroupDirective, _cd) {
1068
+ this._ngControl = _ngControl;
1069
+ this._formGroupDirective = _formGroupDirective;
1070
+ this._cd = _cd;
1071
+ this.autocomplete = 'off';
1072
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
1073
+ this.floatLabel = 'auto';
1074
+ this.color = 'primary';
1075
+ this.actionIcon = 'search';
1076
+ this.hasActionButton = false;
1077
+ this.hasClearButton = false;
1078
+ this.countCaracters = false;
1079
+ this.placeholder = '';
1080
+ this.disabled = false;
1081
+ this.onExecuteAction = new EventEmitter();
1082
+ this.onKeyUp = new EventEmitter();
1083
+ this.onChangeFn = (_) => { };
1084
+ this.onTouchFn = (_) => { };
1085
+ this._isSubmitted = false;
1086
+ this._isInvalid = false;
1087
+ this._required = false;
1088
+ this._value = '';
1089
+ if (_ngControl)
1090
+ this._ngControl.valueAccessor = this;
1091
+ if (_formGroupDirective) {
1092
+ this._subscription = _formGroupDirective.ngSubmit.subscribe(() => {
1093
+ this._isSubmitted = true;
1094
+ _cd.markForCheck();
1095
+ });
1096
+ }
1097
+ }
1098
+ ngOnInit() {
1099
+ const form = this.control;
1100
+ if (form?._rawValidators) {
1101
+ form._rawValidators.forEach((r) => {
1102
+ if (r.name.includes('required'))
1103
+ this._required = true;
1104
+ });
1105
+ }
1106
+ if (this.min)
1107
+ this.control.addValidators(Validators.min(this.min));
1108
+ if (this.max)
1109
+ this.control.addValidators(Validators.max(this.max));
1110
+ if (this.disabled)
1111
+ this.control.disable();
1112
+ }
1113
+ writeValue(value) {
1114
+ if (value === null)
1115
+ this._isInvalid = false;
1116
+ this._value = value;
1117
+ this._isSubmitted = false;
1118
+ this._cd.markForCheck();
1119
+ }
1120
+ registerOnChange(fn) {
1121
+ this.onChangeFn = fn;
1122
+ }
1123
+ registerOnTouched(fn) {
1124
+ this.onTouchFn = fn;
1125
+ }
1126
+ onChange(event) {
1127
+ this._value = event.target.value;
1128
+ this.onChangeFn(['', null, undefined].indexOf(event.target.value) < 0 ? +event.target.value : null);
1129
+ if (this.control.touched)
1130
+ this._onValidate();
1131
+ }
1132
+ onFocusOut() {
1133
+ this.onTouchFn(true);
1134
+ this._onValidate();
1135
+ }
1136
+ _onValidate() {
1137
+ if (this.control.invalid)
1138
+ this._isInvalid = true;
1139
+ else
1140
+ this._isInvalid = false;
1141
+ }
1142
+ onClearControl() {
1143
+ if (['', null, undefined].indexOf(this.control.value) >= 0) {
1144
+ this.control.setValue('', { emitEvent: false });
1145
+ }
1146
+ else
1147
+ this.control.setValue('');
1148
+ this._value = '';
1149
+ }
1150
+ ngOnDestroy() {
1151
+ if (this._subscription)
1152
+ this._subscription.unsubscribe();
1153
+ }
1154
+ get control() {
1155
+ return this._ngControl.control;
1156
+ }
1157
+ get directive() {
1158
+ return this._formGroupDirective;
1159
+ }
1160
+ get isDisabled() {
1161
+ return this._ngControl.disabled;
1162
+ }
1163
+ get isSubmitted() {
1164
+ return this._isSubmitted;
1165
+ }
1166
+ get isInvalid() {
1167
+ return this._isInvalid;
1168
+ }
1169
+ get required() {
1170
+ return this._required;
1171
+ }
1172
+ get value() {
1173
+ return this._value;
1174
+ }
1175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakNumberFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1176
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakNumberFieldComponent, selector: "tak-number-field", inputs: { autocomplete: "autocomplete", appearance: "appearance", floatLabel: "floatLabel", color: "color", actionIcon: "actionIcon", hasActionButton: "hasActionButton", hasClearButton: "hasClearButton", countCaracters: "countCaracters", placeholder: "placeholder", min: "min", max: "max", minLength: "minLength", maxLength: "maxLength", disabled: "disabled" }, outputs: { onExecuteAction: "onExecuteAction", onKeyUp: "onKeyUp" }, ngImport: i0, template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n type=\"number\"\r\n matInput\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] }); }
1177
+ }
1178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakNumberFieldComponent, decorators: [{
1179
+ type: Component,
1180
+ args: [{ selector: 'tak-number-field', template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <input\r\n type=\"number\"\r\n matInput\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n (keyup)=\"onChange($event)\"\r\n [placeholder]=\"placeholder\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n />\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton && !isDisabled) {\r\n <button matSuffix mat-icon-button type=\"button\" (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n" }]
1181
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
1182
+ type: Self
1183
+ }, {
1184
+ type: Optional
1185
+ }] }, { type: i1.FormGroupDirective, decorators: [{
1186
+ type: Optional
1187
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { autocomplete: [{
1188
+ type: Input
1189
+ }], appearance: [{
1190
+ type: Input
1191
+ }], floatLabel: [{
1192
+ type: Input
1193
+ }], color: [{
1194
+ type: Input
1195
+ }], actionIcon: [{
1196
+ type: Input
1197
+ }], hasActionButton: [{
1198
+ type: Input
1199
+ }], hasClearButton: [{
1200
+ type: Input
1201
+ }], countCaracters: [{
1202
+ type: Input
1203
+ }], placeholder: [{
1204
+ type: Input
1205
+ }], min: [{
1206
+ type: Input
1207
+ }], max: [{
1208
+ type: Input
1209
+ }], minLength: [{
1210
+ type: Input
1211
+ }], maxLength: [{
1212
+ type: Input
1213
+ }], disabled: [{
1214
+ type: Input
1215
+ }], onExecuteAction: [{
1216
+ type: Output
1217
+ }], onKeyUp: [{
1218
+ type: Output
1219
+ }] } });
1220
+
1221
+ class TakTextareaComponent {
1222
+ constructor(_ngControl, _formGroupDirective, _cd) {
1223
+ this._ngControl = _ngControl;
1224
+ this._formGroupDirective = _formGroupDirective;
1225
+ this._cd = _cd;
1226
+ this.autocomplete = 'off';
1227
+ this.appearance = TAK_DEFAULT_APPEARANCE_FORM;
1228
+ this.floatLabel = 'auto';
1229
+ this.color = 'primary';
1230
+ this.actionIcon = 'search';
1231
+ this.defaultFilterStyle = true;
1232
+ this.hasActionButton = false;
1233
+ this.hasClearButton = false;
1234
+ this.countCaracters = false;
1235
+ this.isTextArea = false;
1236
+ this.placeholder = '';
1237
+ this.heightInPx = 60;
1238
+ this.disabled = false;
1239
+ this.onExecuteAction = new EventEmitter();
1240
+ this.onKeyUp = new EventEmitter();
1241
+ this.onChangeFn = (_) => { };
1242
+ this.onTouchFn = (_) => { };
1243
+ this._isSubmitted = false;
1244
+ this._isInvalid = false;
1245
+ this._required = false;
1246
+ this._value = '';
1247
+ this._decrypted = false;
1248
+ if (_ngControl)
1249
+ this._ngControl.valueAccessor = this;
1250
+ if (_formGroupDirective) {
1251
+ this._subscription = _formGroupDirective.ngSubmit.subscribe(() => {
1252
+ this._isSubmitted = true;
1253
+ _cd.markForCheck();
1254
+ });
1255
+ }
1256
+ }
1257
+ ngOnInit() {
1258
+ const form = this.control;
1259
+ if (form?._rawValidators) {
1260
+ form._rawValidators.forEach((r) => {
1261
+ if (r.name.includes('required'))
1262
+ this._required = true;
1263
+ });
1264
+ }
1265
+ if (this.disabled)
1266
+ this.control.disable();
1267
+ }
1268
+ writeValue(value) {
1269
+ if (value === null) {
1270
+ this._isInvalid = false;
1271
+ }
1272
+ this._value = value;
1273
+ this._isSubmitted = false;
1274
+ this._cd.markForCheck();
1275
+ }
1276
+ registerOnChange(fn) {
1277
+ this.onChangeFn = fn;
1278
+ }
1279
+ registerOnTouched(fn) {
1280
+ this.onTouchFn = fn;
1281
+ }
1282
+ onChange(event) {
1283
+ this._value = event.target.value;
1284
+ this.onChangeFn(event.target.value);
1285
+ if (this.control.touched)
1286
+ this._onValidate();
1287
+ }
1288
+ onFocusOut() {
1289
+ this.onTouchFn(true);
1290
+ this._onValidate();
1291
+ }
1292
+ _onValidate() {
1293
+ if (this.control.invalid)
1294
+ this._isInvalid = true;
1295
+ else
1296
+ this._isInvalid = false;
1297
+ }
1298
+ onClearControl() {
1299
+ if (['', null, undefined].indexOf(this.control.value) >= 0) {
1300
+ this.control.setValue('', { emitEvent: false });
1301
+ }
1302
+ else {
1303
+ this.control.setValue('');
1304
+ }
1305
+ this._value = '';
1306
+ }
1307
+ ngOnDestroy() {
1308
+ if (this._subscription)
1309
+ this._subscription.unsubscribe();
1310
+ }
1311
+ get control() {
1312
+ return this._ngControl.control;
1313
+ }
1314
+ get directive() {
1315
+ return this._formGroupDirective;
1316
+ }
1317
+ get decrypted() {
1318
+ return this._decrypted;
1319
+ }
1320
+ get isDisabled() {
1321
+ return this._ngControl.disabled;
1322
+ }
1323
+ get isSubmitted() {
1324
+ return this._isSubmitted;
1325
+ }
1326
+ get isInvalid() {
1327
+ return this._isInvalid;
1328
+ }
1329
+ get required() {
1330
+ return this._required;
1331
+ }
1332
+ get value() {
1333
+ return this._value;
1334
+ }
1335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakTextareaComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i1.FormGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1336
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", type: TakTextareaComponent, selector: "tak-textarea", inputs: { autocomplete: "autocomplete", appearance: "appearance", floatLabel: "floatLabel", color: "color", actionIcon: "actionIcon", defaultFilterStyle: "defaultFilterStyle", hasActionButton: "hasActionButton", hasClearButton: "hasClearButton", countCaracters: "countCaracters", isTextArea: "isTextArea", placeholder: "placeholder", heightInPx: "heightInPx", minLength: "minLength", maxLength: "maxLength", disabled: "disabled" }, outputs: { onExecuteAction: "onExecuteAction", onKeyUp: "onKeyUp" }, ngImport: i0, template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <textarea\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n [style.height.px]=\"heightInPx\"\r\n [placeholder]=\"placeholder\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n ></textarea>\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button mat-icon-button type=\"button\" matSuffix (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton) {\r\n <button mat-icon-button type=\"button\" matSuffix (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TakErrorComponent, selector: "tak-error", inputs: ["control", "start", "end", "isDateField", "isNumberField", "marginTop"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] }); }
1337
+ }
1338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakTextareaComponent, decorators: [{
1339
+ type: Component,
1340
+ args: [{ selector: 'tak-textarea', template: "<div class=\"tak-form-container\">\r\n <mat-form-field\r\n [floatLabel]=\"floatLabel\"\r\n [class.mat-form-field-invalid]=\"isInvalid || (isSubmitted && control.invalid)\"\r\n [appearance]=\"appearance\"\r\n [color]=\"color\"\r\n >\r\n <mat-label>\r\n <ng-content></ng-content>{{ ' ' }}\r\n @if (required) {\r\n <span class=\"tak-field__danger-x\">*</span>\r\n }\r\n </mat-label>\r\n <textarea\r\n matInput\r\n [autocomplete]=\"autocomplete\"\r\n [value]=\"value\"\r\n [style.height.px]=\"heightInPx\"\r\n [placeholder]=\"placeholder\"\r\n (keyup)=\"onChange($event)\"\r\n (change)=\"onChange($event)\"\r\n [disabled]=\"isDisabled\"\r\n [attr.minLength]=\"minLength\"\r\n [attr.maxLength]=\"maxLength\"\r\n (focusout)=\"onFocusOut()\"\r\n ></textarea>\r\n @if (control.value && hasClearButton && !isDisabled) {\r\n <button mat-icon-button type=\"button\" matSuffix (click)=\"onClearControl()\">\r\n <mat-icon class=\"tak-suffix-icon-button\">close</mat-icon>\r\n </button>\r\n }\r\n @if (control.value && hasActionButton) {\r\n <button mat-icon-button type=\"button\" matSuffix (click)=\"onExecuteAction.emit(control.value)\">\r\n <mat-icon class=\"tak-suffix-icon-button\">{{ actionIcon }}</mat-icon>\r\n </button>\r\n }\r\n @if (countCaracters) {\r\n <mat-hint align=\"end\" class=\"tak-hint\">\r\n {{ control.value?.length || 0 }}/{{ maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n <div [style.maxWidth]=\"countCaracters ? '80%' : '100%'\">\r\n @if (isInvalid || (isSubmitted && control.invalid)) {\r\n <tak-error [control]=\"control\"></tak-error>\r\n }\r\n </div>\r\n</div>\r\n" }]
1341
+ }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
1342
+ type: Self
1343
+ }, {
1344
+ type: Optional
1345
+ }] }, { type: i1.FormGroupDirective, decorators: [{
1346
+ type: Optional
1347
+ }] }, { type: i0.ChangeDetectorRef }], propDecorators: { autocomplete: [{
1348
+ type: Input
1349
+ }], appearance: [{
1350
+ type: Input
1351
+ }], floatLabel: [{
1352
+ type: Input
1353
+ }], color: [{
1354
+ type: Input
1355
+ }], actionIcon: [{
1356
+ type: Input
1357
+ }], defaultFilterStyle: [{
1358
+ type: Input
1359
+ }], hasActionButton: [{
1360
+ type: Input
1361
+ }], hasClearButton: [{
1362
+ type: Input
1363
+ }], countCaracters: [{
1364
+ type: Input
1365
+ }], isTextArea: [{
1366
+ type: Input
1367
+ }], placeholder: [{
1368
+ type: Input
1369
+ }], heightInPx: [{
1370
+ type: Input
1371
+ }], minLength: [{
1372
+ type: Input
1373
+ }], maxLength: [{
1374
+ type: Input
1375
+ }], disabled: [{
1376
+ type: Input
1377
+ }], onExecuteAction: [{
1378
+ type: Output
1379
+ }], onKeyUp: [{
1380
+ type: Output
1381
+ }] } });
1382
+
1383
+ const components = [
1384
+ TakSelectFieldComponent,
1385
+ TakDateFieldComponent,
1386
+ TakAutocompleteFieldComponent,
1387
+ TakDateRangeFieldComponent,
1388
+ TakGeneralFieldComponent,
1389
+ TakMoneyFieldComponent,
1390
+ TakTextareaComponent,
1391
+ TakNumberFieldComponent,
1392
+ ];
1393
+ class TakFieldsModule {
1394
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakFieldsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1395
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: TakFieldsModule, declarations: [TakSelectFieldComponent,
1396
+ TakDateFieldComponent,
1397
+ TakAutocompleteFieldComponent,
1398
+ TakDateRangeFieldComponent,
1399
+ TakGeneralFieldComponent,
1400
+ TakMoneyFieldComponent,
1401
+ TakTextareaComponent,
1402
+ TakNumberFieldComponent], imports: [FormsModule,
1403
+ CommonModule,
1404
+ ReactiveFormsModule,
1405
+ MatProgressSpinnerModule,
1406
+ MatFormFieldModule,
1407
+ MatButtonModule,
1408
+ MatDatepickerModule,
1409
+ MatAutocompleteModule,
1410
+ TakErrorModule,
1411
+ MatIconModule,
1412
+ MatInputModule,
1413
+ MatOptionModule,
1414
+ MatSelectModule,
1415
+ MatTooltipModule,
1416
+ MatMenuModule], exports: [ReactiveFormsModule,
1417
+ MatAutocompleteModule,
1418
+ FormsModule,
1419
+ MatNativeDateModule, TakSelectFieldComponent,
1420
+ TakDateFieldComponent,
1421
+ TakAutocompleteFieldComponent,
1422
+ TakDateRangeFieldComponent,
1423
+ TakGeneralFieldComponent,
1424
+ TakMoneyFieldComponent,
1425
+ TakTextareaComponent,
1426
+ TakNumberFieldComponent] }); }
1427
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakFieldsModule, imports: [FormsModule,
1428
+ CommonModule,
1429
+ ReactiveFormsModule,
1430
+ MatProgressSpinnerModule,
1431
+ MatFormFieldModule,
1432
+ MatButtonModule,
1433
+ MatDatepickerModule,
1434
+ MatAutocompleteModule,
1435
+ TakErrorModule,
1436
+ MatIconModule,
1437
+ MatInputModule,
1438
+ MatOptionModule,
1439
+ MatSelectModule,
1440
+ MatTooltipModule,
1441
+ MatMenuModule, ReactiveFormsModule,
1442
+ MatAutocompleteModule,
1443
+ FormsModule,
1444
+ MatNativeDateModule] }); }
1445
+ }
1446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: TakFieldsModule, decorators: [{
1447
+ type: NgModule,
1448
+ args: [{
1449
+ declarations: components,
1450
+ imports: [
1451
+ FormsModule,
1452
+ CommonModule,
1453
+ ReactiveFormsModule,
1454
+ MatProgressSpinnerModule,
1455
+ MatFormFieldModule,
1456
+ MatButtonModule,
1457
+ MatDatepickerModule,
1458
+ MatAutocompleteModule,
1459
+ TakErrorModule,
1460
+ MatIconModule,
1461
+ MatInputModule,
1462
+ MatOptionModule,
1463
+ MatSelectModule,
1464
+ MatTooltipModule,
1465
+ MatMenuModule,
1466
+ ],
1467
+ exports: [
1468
+ ReactiveFormsModule,
1469
+ MatAutocompleteModule,
1470
+ FormsModule,
1471
+ MatNativeDateModule,
1472
+ ...components,
1473
+ ],
1474
+ }]
1475
+ }] });
1476
+
1477
+ /*
1478
+ * Public API Surface of @kato-lee/components/fields
1479
+ */
1480
+
1481
+ /**
1482
+ * Generated bundle index. Do not edit.
1483
+ */
1484
+
1485
+ export { TAK_DEFAULT_APPEARANCE_FORM, TAK_PRESS_ESC_KEY, TakAutocompleteFieldComponent, TakDateFieldComponent, TakDateRangeFieldComponent, TakErrorComponent, TakErrorEqualsPipe, TakErrorMsgPipe, TakFieldsModule, TakGeneralFieldComponent, TakMoneyFieldComponent, TakNumberFieldComponent, TakSelectFieldComponent, TakTextareaComponent };
1486
+ //# sourceMappingURL=kato-lee-components-fields.mjs.map