@masterteam/components 0.0.9 → 0.0.11

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 (53) hide show
  1. package/button-group/index.d.ts +8 -0
  2. package/checkbox-field/index.d.ts +5 -2
  3. package/color-picker-field/index.d.ts +30 -0
  4. package/date-field/index.d.ts +2 -0
  5. package/editor-field/index.d.ts +2 -0
  6. package/fesm2022/masterteam-components-avatar-text.mjs +3 -3
  7. package/fesm2022/masterteam-components-avatar.mjs +3 -3
  8. package/fesm2022/masterteam-components-button-group.mjs +20 -0
  9. package/fesm2022/masterteam-components-button-group.mjs.map +1 -0
  10. package/fesm2022/masterteam-components-button.mjs +3 -3
  11. package/fesm2022/masterteam-components-card.mjs +6 -4
  12. package/fesm2022/masterteam-components-card.mjs.map +1 -1
  13. package/fesm2022/masterteam-components-checkbox-field.mjs +12 -8
  14. package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
  15. package/fesm2022/masterteam-components-chip.mjs +3 -3
  16. package/fesm2022/masterteam-components-color-picker-field.mjs +76 -0
  17. package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -0
  18. package/fesm2022/masterteam-components-date-field.mjs +9 -6
  19. package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
  20. package/fesm2022/masterteam-components-editor-field.mjs +8 -6
  21. package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
  22. package/fesm2022/masterteam-components-field-validation.mjs +78 -113
  23. package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
  24. package/fesm2022/masterteam-components-icon-field.mjs +9 -6
  25. package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
  26. package/fesm2022/masterteam-components-list.mjs +3 -3
  27. package/fesm2022/masterteam-components-multi-select-field.mjs +9 -6
  28. package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
  29. package/fesm2022/masterteam-components-number-field.mjs +9 -6
  30. package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
  31. package/fesm2022/masterteam-components-select-field.mjs +9 -7
  32. package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
  33. package/fesm2022/masterteam-components-slider-field.mjs +9 -6
  34. package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
  35. package/fesm2022/masterteam-components-text-field.mjs +8 -6
  36. package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
  37. package/fesm2022/masterteam-components-textarea-field.mjs +9 -6
  38. package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
  39. package/fesm2022/masterteam-components-toggle-field.mjs +80 -0
  40. package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -0
  41. package/fesm2022/masterteam-components.mjs +23 -1
  42. package/fesm2022/masterteam-components.mjs.map +1 -1
  43. package/field-validation/index.d.ts +3 -3
  44. package/icon-field/index.d.ts +3 -1
  45. package/index.d.ts +19 -4
  46. package/multi-select-field/index.d.ts +2 -0
  47. package/number-field/index.d.ts +2 -0
  48. package/package.json +42 -30
  49. package/select-field/index.d.ts +2 -0
  50. package/slider-field/index.d.ts +2 -0
  51. package/text-field/index.d.ts +2 -0
  52. package/textarea-field/index.d.ts +2 -0
  53. package/toggle-field/index.d.ts +33 -0
@@ -1,132 +1,97 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, Component } from '@angular/core';
2
+ import { Pipe, input, booleanAttribute, Component } from '@angular/core';
3
3
  import { Message } from 'primeng/message';
4
+ import { isInvalid } from '@masterteam/components';
4
5
 
5
- class FieldValidation {
6
- control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : []));
7
- touched = input(false, ...(ngDevMode ? [{ debugName: "touched", transform: booleanAttribute }] : [{
8
- transform: booleanAttribute,
9
- }]));
10
- customErrorClass = input('', ...(ngDevMode ? [{ debugName: "customErrorClass" }] : []));
11
- getErrorMessage() {
12
- const ctrl = this.control();
13
- if (!ctrl || !ctrl.errors)
6
+ class ErrorMessagePipe {
7
+ transform(errors) {
8
+ if (!errors) {
14
9
  return '';
15
- const errors = ctrl.errors;
16
- // Handle errors with embedded messages (from ValidatorConfig)
17
- for (const errorKey in errors) {
18
- const errorValue = errors[errorKey];
19
- // If error has a message property, use it
10
+ }
11
+ // Handle standard Angular validator errors first
12
+ if (errors['required']) {
13
+ return 'This field is required';
14
+ }
15
+ if (errors['email']) {
16
+ return 'Please enter a valid email address';
17
+ }
18
+ if (errors['minlength']) {
19
+ const { requiredLength, actualLength } = errors['minlength'];
20
+ return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;
21
+ }
22
+ if (errors['maxlength']) {
23
+ const { requiredLength, actualLength } = errors['maxlength'];
24
+ return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;
25
+ }
26
+ if (errors['min']) {
27
+ const { min, actual } = errors['min'];
28
+ return `Minimum value is ${min} (current: ${actual})`;
29
+ }
30
+ if (errors['max']) {
31
+ const { max, actual } = errors['max'];
32
+ return `Maximum value is ${max} (current: ${actual})`;
33
+ }
34
+ if (errors['pattern']) {
35
+ return 'The format is invalid';
36
+ }
37
+ // Handle custom errors that provide their own message
38
+ // This looks for an error structured like: { myCustomError: { message: '...' } }
39
+ for (const key in errors) {
40
+ const errorValue = errors[key];
20
41
  if (errorValue && typeof errorValue === 'object' && errorValue.message) {
21
42
  return errorValue.message;
22
43
  }
23
44
  }
24
- // // Default error messages based on error type
25
- // if (errors['required']) {
26
- // return 'This field is required';
27
- // }
28
- // if (errors['email']) {
29
- // return 'Please enter a valid email address';
30
- // }
31
- // if (errors['minlength']) {
32
- // const requiredLength = errors['minlength'].requiredLength;
33
- // const actualLength = errors['minlength'].actualLength;
34
- // return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;
35
- // }
36
- // if (errors['maxlength']) {
37
- // const requiredLength = errors['maxlength'].requiredLength;
38
- // const actualLength = errors['maxlength'].actualLength;
39
- // return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;
40
- // }
41
- // if (errors['min']) {
42
- // const min = errors['min'].min;
43
- // const actual = errors['min'].actual;
44
- // return `Minimum value is ${min} (current: ${actual})`;
45
- // }
46
- // if (errors['max']) {
47
- // const max = errors['max'].max;
48
- // const actual = errors['max'].actual;
49
- // return `Maximum value is ${max} (current: ${actual})`;
50
- // }
51
- // if (errors['pattern']) {
52
- // const pattern = errors['pattern'].requiredPattern;
53
- // return `Invalid format. Expected pattern: ${pattern}`;
54
- // }
55
- // if (errors['custom']) {
56
- // return errors['custom'].message || 'Invalid value';
57
- // }
58
- // For any other errors, try to extract meaningful information
45
+ // Fallback for any other error
59
46
  const firstErrorKey = Object.keys(errors)[0];
60
- const firstError = errors[firstErrorKey];
61
- // If it's an object with a message, use it
62
- if (firstError && typeof firstError === 'object' && firstError.message) {
63
- return firstError.message;
64
- }
65
- // If it's a string, use it
66
- if (typeof firstError === 'string') {
67
- return firstError;
68
- }
69
- // Fallback to error key
70
- return `Invalid ${firstErrorKey}`;
47
+ return `Invalid field: ${firstErrorKey}`;
71
48
  }
72
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: FieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Component });
73
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: FieldValidation, isStandalone: true, selector: "mt-field-validation", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, customErrorClass: { classPropertyName: "customErrorClass", publicName: "customErrorClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
74
- @if (control() && control()!.invalid && (control()!.touched || touched())) {
75
- <p-message severity="error" variant="simple" size="small">
76
- {{ getErrorMessage() }}</p-message
49
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ErrorMessagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
50
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: ErrorMessagePipe, isStandalone: true, name: "errorMessage" });
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ErrorMessagePipe, decorators: [{
53
+ type: Pipe,
54
+ args: [{
55
+ name: 'errorMessage',
56
+ standalone: true,
57
+ pure: true,
58
+ }]
59
+ }] });
60
+
61
+ class FieldValidation {
62
+ control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : []));
63
+ touched = input(false, ...(ngDevMode ? [{ debugName: "touched", transform: booleanAttribute }] : [{
64
+ transform: booleanAttribute,
65
+ }]));
66
+ isInvalid = isInvalid;
67
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Component });
68
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: FieldValidation, isStandalone: true, selector: "mt-field-validation", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.hidden": "!isInvalid(control())" } }, ngImport: i0, template: `
69
+ @if (isInvalid(control())) {
70
+ <p-message
71
+ severity="error"
72
+ variant="simple"
73
+ size="small"
74
+ [text]="control().errors | errorMessage"
77
75
  >
78
- <!-- <div -->
79
- <!-- class="text-red-500 text-sm mt-1 flex items-start gap-1" -->
80
- <!-- [class]=" -->
81
- <!-- customErrorClass() || -->
82
- <!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->
83
- <!-- " -->
84
- <!-- > -->
85
- <!-- <span -->
86
- <!-- class="inline-block w-4 h-4 flex-shrink-0 mt-0.5" -->
87
- <!-- aria-hidden="true" -->
88
- <!-- > -->
89
- <!-- <svg viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"> -->
90
- <!-- <path -->
91
- <!-- fill-rule="evenodd" -->
92
- <!-- d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" -->
93
- <!-- /> -->
94
- <!-- </svg> -->
95
- <!-- </span> -->
96
- <!-- <span class="flex-1">{{ getErrorMessage() }}</span> -->
97
- <!-- </div> -->
76
+ </p-message>
98
77
  }
99
- `, isInline: true, dependencies: [{ kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }] });
78
+ `, isInline: true, dependencies: [{ kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }] });
100
79
  }
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: FieldValidation, decorators: [{
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FieldValidation, decorators: [{
102
81
  type: Component,
103
- args: [{ selector: 'mt-field-validation', standalone: true, imports: [Message], template: `
104
- @if (control() && control()!.invalid && (control()!.touched || touched())) {
105
- <p-message severity="error" variant="simple" size="small">
106
- {{ getErrorMessage() }}</p-message
82
+ args: [{ selector: 'mt-field-validation', standalone: true, imports: [Message, ErrorMessagePipe], template: `
83
+ @if (isInvalid(control())) {
84
+ <p-message
85
+ severity="error"
86
+ variant="simple"
87
+ size="small"
88
+ [text]="control().errors | errorMessage"
107
89
  >
108
- <!-- <div -->
109
- <!-- class="text-red-500 text-sm mt-1 flex items-start gap-1" -->
110
- <!-- [class]=" -->
111
- <!-- customErrorClass() || -->
112
- <!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->
113
- <!-- " -->
114
- <!-- > -->
115
- <!-- <span -->
116
- <!-- class="inline-block w-4 h-4 flex-shrink-0 mt-0.5" -->
117
- <!-- aria-hidden="true" -->
118
- <!-- > -->
119
- <!-- <svg viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"> -->
120
- <!-- <path -->
121
- <!-- fill-rule="evenodd" -->
122
- <!-- d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" -->
123
- <!-- /> -->
124
- <!-- </svg> -->
125
- <!-- </span> -->
126
- <!-- <span class="flex-1">{{ getErrorMessage() }}</span> -->
127
- <!-- </div> -->
90
+ </p-message>
128
91
  }
129
- ` }]
92
+ `, host: {
93
+ '[class.hidden]': '!isInvalid(control())',
94
+ } }]
130
95
  }] });
131
96
 
132
97
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-components-field-validation.mjs","sources":["../../../../packages/masterteam/components/field-validation/field-validation.ts","../../../../packages/masterteam/components/field-validation/masterteam-components-field-validation.ts"],"sourcesContent":["import { booleanAttribute, Component, input } from '@angular/core';\nimport { Message } from 'primeng/message';\nimport { AbstractControl } from '@angular/forms';\n\n@Component({\n selector: 'mt-field-validation',\n standalone: true,\n imports: [Message],\n template: `\n @if (control() && control()!.invalid && (control()!.touched || touched())) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">\n {{ getErrorMessage() }}</p-message\n >\n <!-- <div -->\n <!-- class=\"text-red-500 text-sm mt-1 flex items-start gap-1\" -->\n <!-- [class]=\" -->\n <!-- customErrorClass() || -->\n <!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->\n <!-- \" -->\n <!-- > -->\n <!-- <span -->\n <!-- class=\"inline-block w-4 h-4 flex-shrink-0 mt-0.5\" -->\n <!-- aria-hidden=\"true\" -->\n <!-- > -->\n <!-- <svg viewBox=\"0 0 16 16\" fill=\"currentColor\" class=\"w-4 h-4\"> -->\n <!-- <path -->\n <!-- fill-rule=\"evenodd\" -->\n <!-- d=\"M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z\" -->\n <!-- /> -->\n <!-- </svg> -->\n <!-- </span> -->\n <!-- <span class=\"flex-1\">{{ getErrorMessage() }}</span> -->\n <!-- </div> -->\n }\n `,\n styles: [],\n})\nexport class FieldValidation {\n readonly control = input<AbstractControl | null>(null);\n readonly touched = input<boolean, unknown>(false, {\n transform: booleanAttribute,\n });\n readonly customErrorClass = input<string>('');\n\n getErrorMessage(): string {\n const ctrl = this.control();\n if (!ctrl || !ctrl.errors) return '';\n\n const errors = ctrl.errors;\n\n // Handle errors with embedded messages (from ValidatorConfig)\n for (const errorKey in errors) {\n const errorValue = errors[errorKey];\n\n // If error has a message property, use it\n if (errorValue && typeof errorValue === 'object' && errorValue.message) {\n return errorValue.message;\n }\n }\n\n // // Default error messages based on error type\n // if (errors['required']) {\n // return 'This field is required';\n // }\n // if (errors['email']) {\n // return 'Please enter a valid email address';\n // }\n // if (errors['minlength']) {\n // const requiredLength = errors['minlength'].requiredLength;\n // const actualLength = errors['minlength'].actualLength;\n // return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;\n // }\n // if (errors['maxlength']) {\n // const requiredLength = errors['maxlength'].requiredLength;\n // const actualLength = errors['maxlength'].actualLength;\n // return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;\n // }\n // if (errors['min']) {\n // const min = errors['min'].min;\n // const actual = errors['min'].actual;\n // return `Minimum value is ${min} (current: ${actual})`;\n // }\n // if (errors['max']) {\n // const max = errors['max'].max;\n // const actual = errors['max'].actual;\n // return `Maximum value is ${max} (current: ${actual})`;\n // }\n // if (errors['pattern']) {\n // const pattern = errors['pattern'].requiredPattern;\n // return `Invalid format. Expected pattern: ${pattern}`;\n // }\n // if (errors['custom']) {\n // return errors['custom'].message || 'Invalid value';\n // }\n\n // For any other errors, try to extract meaningful information\n const firstErrorKey = Object.keys(errors)[0];\n const firstError = errors[firstErrorKey];\n\n // If it's an object with a message, use it\n if (firstError && typeof firstError === 'object' && firstError.message) {\n return firstError.message;\n }\n\n // If it's a string, use it\n if (typeof firstError === 'string') {\n return firstError;\n }\n\n // Fallback to error key\n return `Invalid ${firstErrorKey}`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAqCa,eAAe,CAAA;AACjB,IAAA,OAAO,GAAG,KAAK,CAAyB,IAAI,mDAAC;IAC7C,OAAO,GAAG,KAAK,CAAmB,KAAK,2CAC9C,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CADqB;AAChD,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAA,CAAA,CAAC;AACO,IAAA,gBAAgB,GAAG,KAAK,CAAS,EAAE,4DAAC;IAE7C,eAAe,GAAA;AACb,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE;AAC3B,QAAA,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,EAAE;AAEpC,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM;;AAG1B,QAAA,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE;AAC7B,YAAA,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC;;YAGnC,IAAI,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,OAAO,EAAE;gBACtE,OAAO,UAAU,CAAC,OAAO;YAC3B;QACF;;;;;;;;;;;;;;;;;;;;;;;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AAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EA3BS,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,OAAA,EAAA,YAAA,EAAA,UAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FA8BN,eAAe,EAAA,UAAA,EAAA,CAAA;kBAjC3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,qBAAqB,cACnB,IAAI,EAAA,OAAA,EACP,CAAC,OAAO,CAAC,EAAA,QAAA,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BT,EAAA,CAAA,EAAA;;;AClCH;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-components-field-validation.mjs","sources":["../../../../packages/masterteam/components/field-validation/error-message.pipe.ts","../../../../packages/masterteam/components/field-validation/field-validation.ts","../../../../packages/masterteam/components/field-validation/masterteam-components-field-validation.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { ValidationErrors } from '@angular/forms';\n\n@Pipe({\n name: 'errorMessage',\n standalone: true,\n pure: true,\n})\nexport class ErrorMessagePipe implements PipeTransform {\n transform(errors: ValidationErrors | null): string {\n if (!errors) {\n return '';\n }\n\n // Handle standard Angular validator errors first\n if (errors['required']) {\n return 'This field is required';\n }\n if (errors['email']) {\n return 'Please enter a valid email address';\n }\n if (errors['minlength']) {\n const { requiredLength, actualLength } = errors['minlength'];\n return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;\n }\n if (errors['maxlength']) {\n const { requiredLength, actualLength } = errors['maxlength'];\n return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;\n }\n if (errors['min']) {\n const { min, actual } = errors['min'];\n return `Minimum value is ${min} (current: ${actual})`;\n }\n if (errors['max']) {\n const { max, actual } = errors['max'];\n return `Maximum value is ${max} (current: ${actual})`;\n }\n if (errors['pattern']) {\n return 'The format is invalid';\n }\n\n // Handle custom errors that provide their own message\n // This looks for an error structured like: { myCustomError: { message: '...' } }\n for (const key in errors) {\n const errorValue = errors[key];\n if (errorValue && typeof errorValue === 'object' && errorValue.message) {\n return errorValue.message;\n }\n }\n\n // Fallback for any other error\n const firstErrorKey = Object.keys(errors)[0];\n return `Invalid field: ${firstErrorKey}`;\n }\n}\n","import { booleanAttribute, Component, input } from '@angular/core';\nimport { Message } from 'primeng/message';\nimport { AbstractControl } from '@angular/forms';\nimport { ErrorMessagePipe } from './error-message.pipe';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-field-validation',\n standalone: true,\n imports: [Message, ErrorMessagePipe],\n template: `\n @if (isInvalid(control())) {\n <p-message\n severity=\"error\"\n variant=\"simple\"\n size=\"small\"\n [text]=\"control().errors | errorMessage\"\n >\n </p-message>\n }\n `,\n host: {\n '[class.hidden]': '!isInvalid(control())',\n },\n styles: [],\n})\nexport class FieldValidation {\n readonly control = input<AbstractControl | null>(null);\n readonly touched = input<boolean, unknown>(false, {\n transform: booleanAttribute,\n });\n\n isInvalid = isInvalid;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAQa,gBAAgB,CAAA;AAC3B,IAAA,SAAS,CAAC,MAA+B,EAAA;QACvC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE;QACX;;AAGA,QAAA,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE;AACtB,YAAA,OAAO,wBAAwB;QACjC;AACA,QAAA,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;AACnB,YAAA,OAAO,oCAAoC;QAC7C;AACA,QAAA,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;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,EAAA,uBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAhBhB;;;;;;;;;;GAUT,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAXS,OAAO,oPAAE,gBAAgB,EAAA,IAAA,EAAA,cAAA,EAAA,CAAA,EAAA,CAAA;;2FAiBxB,eAAe,EAAA,UAAA,EAAA,CAAA;kBApB3B,SAAS;+BACE,qBAAqB,EAAA,UAAA,EACnB,IAAI,EAAA,OAAA,EACP,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAA,QAAA,EAC1B;;;;;;;;;;GAUT,EAAA,IAAA,EACK;AACJ,wBAAA,gBAAgB,EAAE,uBAAuB;AAC1C,qBAAA,EAAA;;;ACvBH;;AAEG;;;;"}
@@ -1,10 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, signal, inject, Component } from '@angular/core';
2
+ import { input, signal, inject, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { Validators, NgControl, FormsModule } from '@angular/forms';
5
5
  import { Select } from 'primeng/select';
6
6
  import * as mtIcons from '@masterteam/icons/assets/select-icons.json';
7
7
  import { Icon } from '@masterteam/icons';
8
+ import { FieldValidation } from '@masterteam/components/field-validation';
9
+ import { isInvalid } from '@masterteam/components';
8
10
 
9
11
  class IconField {
10
12
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
@@ -12,6 +14,7 @@ class IconField {
12
14
  selectedIcon = signal(null, ...(ngDevMode ? [{ debugName: "selectedIcon" }] : []));
13
15
  requiredValidator = Validators.required;
14
16
  ngControl = inject(NgControl, { self: true });
17
+ isInvalid = isInvalid;
15
18
  constructor() {
16
19
  if (this.ngControl) {
17
20
  this.ngControl.valueAccessor = this;
@@ -35,14 +38,14 @@ class IconField {
35
38
  validate(c) {
36
39
  return c.errors;
37
40
  }
38
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: IconField, deps: [], target: i0.ɵɵFactoryTarget.Component });
39
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }] });
41
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: IconField, deps: [], target: i0.ɵɵFactoryTarget.Component });
42
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n appendTo=\"body\"\n (onBlur)=\"onTouched()\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
40
43
  }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: IconField, decorators: [{
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: IconField, decorators: [{
42
45
  type: Component,
43
- args: [{ selector: 'mt-icon-field', imports: [FormsModule, Select, Icon], host: {
46
+ args: [{ selector: 'mt-icon-field', imports: [FormsModule, Select, Icon, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
44
47
  class: 'grid gap-1',
45
- }, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\n"] }]
48
+ }, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n appendTo=\"body\"\n (onBlur)=\"onTouched()\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\n"] }]
46
49
  }], ctorParameters: () => [] });
47
50
 
48
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-components-icon-field.mjs","sources":["../../../../packages/masterteam/components/icon-field/icon-field.ts","../../../../packages/masterteam/components/icon-field/icon-field.html","../../../../packages/masterteam/components/icon-field/masterteam-components-icon-field.ts"],"sourcesContent":["import { Component, signal, inject, input } from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { Select } from 'primeng/select';\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\nimport { Icon, MTIcon } from '@masterteam/icons';\n\n@Component({\n selector: 'mt-icon-field',\n imports: [FormsModule, Select, Icon],\n templateUrl: './icon-field.html',\n styleUrls: ['./icon-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class IconField implements ControlValueAccessor {\n readonly label = input<string>('');\n\n icons: MTIcon[] = (mtIcons?.regular as MTIcon[]) ?? [];\n selectedIcon = signal<string | null>(null);\n requiredValidator = Validators.required;\n\n public ngControl = inject(NgControl, { self: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n private onTouched: () => void = () => {};\n private onChange: (icon: string) => void = () => {};\n\n writeValue(value: string) {\n this.selectedIcon.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n onChangeIcon(icon: string) {\n this.selectedIcon.set(icon);\n this.onChange(icon);\n }\n\n public validate(c: FormControl) {\n return c.errors;\n }\n}\n","@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAqBa,SAAS,CAAA;AACX,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,iDAAC;AAElC,IAAA,KAAK,GAAc,OAAO,EAAE,OAAoB,IAAI,EAAE;AACtD,IAAA,YAAY,GAAG,MAAM,CAAgB,IAAI,wDAAC;AAC1C,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;IAEhC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEpD,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI;QACrC;IACF;AAEQ,IAAA,SAAS,GAAe,MAAK,EAAE,CAAC;AAChC,IAAA,QAAQ,GAA2B,MAAK,EAAE,CAAC;AAEnD,IAAA,UAAU,CAAC,KAAa,EAAA;AACtB,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;IAC9B;AAEA,IAAA,gBAAgB,CAAC,EAAO,EAAA;AACtB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE;IACpB;AAEA,IAAA,iBAAiB,CAAC,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AAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAA,IAAA,EAG9B;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,kmCAAA,EAAA,MAAA,EAAA,CAAA,+VAAA,CAAA,EAAA;;;AEnBH;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-components-icon-field.mjs","sources":["../../../../packages/masterteam/components/icon-field/icon-field.ts","../../../../packages/masterteam/components/icon-field/icon-field.html","../../../../packages/masterteam/components/icon-field/masterteam-components-icon-field.ts"],"sourcesContent":["import {\n Component,\n signal,\n inject,\n input,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { Select } from 'primeng/select';\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\nimport { Icon, MTIcon } from '@masterteam/icons';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-icon-field',\n imports: [FormsModule, Select, Icon, FieldValidation],\n templateUrl: './icon-field.html',\n styleUrls: ['./icon-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class IconField implements ControlValueAccessor {\n readonly label = input<string>('');\n\n icons: MTIcon[] = (mtIcons?.regular as MTIcon[]) ?? [];\n selectedIcon = signal<string | null>(null);\n requiredValidator = Validators.required;\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n protected onTouched: () => void = () => {};\n private onChange: (icon: string) => void = () => {};\n\n writeValue(value: string) {\n this.selectedIcon.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n onChangeIcon(icon: string) {\n this.selectedIcon.set(icon);\n this.onChange(icon);\n }\n\n public validate(c: FormControl) {\n return c.errors;\n }\n}\n","@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n appendTo=\"body\"\n (onBlur)=\"onTouched()\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;MA8Ba,SAAS,CAAA;AACX,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,iDAAC;AAElC,IAAA,KAAK,GAAc,OAAO,EAAE,OAAoB,IAAI,EAAE;AACtD,IAAA,YAAY,GAAG,MAAM,CAAgB,IAAI,wDAAC;AAC1C,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;IAEhC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEpD,SAAS,GAAG,SAAS;AAErB,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI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,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,EAAA,eAAA,EAGpC,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,usCAAA,EAAA,MAAA,EAAA,CAAA,+VAAA,CAAA,EAAA;;;AE5BH;;AAEG;;;;"}
@@ -15,10 +15,10 @@ class List {
15
15
  effectiveTemplate = computed(() => {
16
16
  return this.template() || this.itemTemplate() || null;
17
17
  }, ...(ngDevMode ? [{ debugName: "effectiveTemplate" }] : []));
18
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: List, deps: [], target: i0.ɵɵFactoryTarget.Component });
19
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: List, isStandalone: true, selector: "mt-list", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, separated: { classPropertyName: "separated", publicName: "separated", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"template-list\">\n @if (effectiveTemplate()) {\n @for (item of data(); track $index) {\n <div class=\"border-surface-300\" [class.border-b]=\"!$last && separated()\">\n <ng-container\n [ngTemplateOutlet]=\"effectiveTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: item,\n index: $index,\n first: $first,\n last: $last,\n count: $count,\n }\"\n >\n </ng-container>\n </div>\n }\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
18
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: List, deps: [], target: i0.ɵɵFactoryTarget.Component });
19
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: List, isStandalone: true, selector: "mt-list", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, separated: { classPropertyName: "separated", publicName: "separated", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"template-list\">\n @if (effectiveTemplate()) {\n @for (item of data(); track $index) {\n <div class=\"border-surface-300\" [class.border-b]=\"!$last && separated()\">\n <ng-container\n [ngTemplateOutlet]=\"effectiveTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: item,\n index: $index,\n first: $first,\n last: $last,\n count: $count,\n }\"\n >\n </ng-container>\n </div>\n }\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
20
20
  }
21
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: List, decorators: [{
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: List, decorators: [{
22
22
  type: Component,
23
23
  args: [{ selector: 'mt-list', standalone: true, imports: [CommonModule], template: "<div class=\"template-list\">\n @if (effectiveTemplate()) {\n @for (item of data(); track $index) {\n <div class=\"border-surface-300\" [class.border-b]=\"!$last && separated()\">\n <ng-container\n [ngTemplateOutlet]=\"effectiveTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: item,\n index: $index,\n first: $first,\n last: $last,\n count: $count,\n }\"\n >\n </ng-container>\n </div>\n }\n }\n</div>\n" }]
24
24
  }] });
@@ -1,9 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, EventEmitter, signal, inject, HostBinding, Output, ViewChild, Component } from '@angular/core';
2
+ import { input, EventEmitter, signal, inject, HostBinding, Output, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { Validators, NgControl, FormsModule } from '@angular/forms';
5
5
  import * as i2 from 'primeng/multiselect';
6
6
  import { MultiSelectModule } from 'primeng/multiselect';
7
+ import { FieldValidation } from '@masterteam/components/field-validation';
8
+ import { isInvalid } from '@masterteam/components';
7
9
 
8
10
  class MultiSelectField {
9
11
  multiSelect;
@@ -29,6 +31,7 @@ class MultiSelectField {
29
31
  onTouched = () => { };
30
32
  onModelChange = () => { };
31
33
  ngControl = inject(NgControl, { self: true });
34
+ isInvalid = isInvalid;
32
35
  constructor() {
33
36
  if (this.ngControl) {
34
37
  this.ngControl.valueAccessor = this;
@@ -66,14 +69,14 @@ class MultiSelectField {
66
69
  setDisabledState(disabled) {
67
70
  this.disabled.set(disabled);
68
71
  }
69
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: MultiSelectField, deps: [], target: i0.ɵɵFactoryTarget.Component });
70
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: MultiSelectField, isStandalone: true, selector: "mt-multi-select-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterBy: { classPropertyName: "filterBy", publicName: "filterBy", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "multiSelect", first: true, predicate: ["multiSelect"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i2.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "styleClass", "panelStyle", "panelStyleClass", "inputId", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "dataKey", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "placeholder", "options", "filterValue", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect", "size", "variant", "fluid", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }] });
72
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MultiSelectField, deps: [], target: i0.ɵɵFactoryTarget.Component });
73
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: MultiSelectField, isStandalone: true, selector: "mt-multi-select-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterBy: { classPropertyName: "filterBy", publicName: "filterBy", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "multiSelect", first: true, predicate: ["multiSelect"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i2.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "styleClass", "panelStyle", "panelStyleClass", "inputId", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "dataKey", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "placeholder", "options", "filterValue", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect", "size", "variant", "fluid", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
71
74
  }
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: MultiSelectField, decorators: [{
75
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MultiSelectField, decorators: [{
73
76
  type: Component,
74
- args: [{ selector: 'mt-multi-select-field', standalone: true, imports: [FormsModule, MultiSelectModule], host: {
77
+ args: [{ selector: 'mt-multi-select-field', standalone: true, imports: [FormsModule, MultiSelectModule, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
75
78
  class: 'grid gap-1',
76
- }, template: "@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n" }]
79
+ }, template: "@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n" }]
77
80
  }], ctorParameters: () => [], propDecorators: { multiSelect: [{
78
81
  type: ViewChild,
79
82
  args: ['multiSelect', { static: true }]
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-components-multi-select-field.mjs","sources":["../../../../packages/masterteam/components/multi-select-field/multi-select-field.ts","../../../../packages/masterteam/components/multi-select-field/multi-select-field.html","../../../../packages/masterteam/components/multi-select-field/masterteam-components-multi-select-field.ts"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n OnChanges,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n inject,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { MultiSelect } from 'primeng/multiselect';\nimport { MultiSelectModule } from 'primeng/multiselect';\n\n@Component({\n selector: 'mt-multi-select-field',\n templateUrl: './multi-select-field.html',\n styleUrls: ['./multi-select-field.scss'],\n standalone: true,\n imports: [FormsModule, MultiSelectModule],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class MultiSelectField\n implements ControlValueAccessor, OnInit, OnChanges\n{\n @ViewChild('multiSelect', { static: true })\n multiSelect: MultiSelect;\n\n readonly field = input<boolean>(true);\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly readonly = input<boolean>(false);\n readonly pInputs = input<Partial<MultiSelect>>();\n readonly options = input<any[]>();\n readonly optionValue = input<string>();\n readonly optionLabel = input<string>();\n readonly filter = input<boolean>(false);\n readonly filterBy = input<string>();\n readonly dataKey = input<string>();\n readonly showClear = input<boolean>(false);\n readonly display = input<string>('chip');\n @Output() onChange: EventEmitter<any> = new EventEmitter();\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<any>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: any) => void = () => {};\n\n public ngControl = inject(NgControl, { self: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n applyInputsToMultiSelect() {\n Object.assign(this.multiSelect, this.pInputs());\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n if (this.pInputs()) {\n this.applyInputsToMultiSelect();\n }\n }\n onValueChange(value: any) {\n this.onModelChange(value);\n this.value.set(value);\n this.onChange.emit(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToMultiSelect();\n }\n }\n\n writeValue(value: any) {\n this.value.set(value);\n this.multiSelect.writeValue(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAgCa,gBAAgB,CAAA;AAI3B,IAAA,WAAW;AAEF,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,iDAAC;IAC5B,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;IACvB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,iDAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,oDAAC;IAChC,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAwB;IACvC,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAS;IACxB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;IAC7B,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,MAAM,GAAG,KAAK,CAAU,KAAK,kDAAC;IAC9B,QAAQ,GAAG,KAAK,CAAA,IAAA,SAA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IAAA,EAAA,CAAA,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAiBhC,QAAQ,EAAA,CAAA;sBAAjB;gBAEqB,UAAU,EAAA,CAAA;sBAA/B,WAAW;uBAAC,OAAO;;;AEtDtB;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-components-multi-select-field.mjs","sources":["../../../../packages/masterteam/components/multi-select-field/multi-select-field.ts","../../../../packages/masterteam/components/multi-select-field/multi-select-field.html","../../../../packages/masterteam/components/multi-select-field/masterteam-components-multi-select-field.ts"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n OnChanges,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n inject,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { MultiSelect } from 'primeng/multiselect';\nimport { MultiSelectModule } from 'primeng/multiselect';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-multi-select-field',\n templateUrl: './multi-select-field.html',\n styleUrls: ['./multi-select-field.scss'],\n standalone: true,\n imports: [FormsModule, MultiSelectModule, FieldValidation],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class MultiSelectField\n implements ControlValueAccessor, OnInit, OnChanges\n{\n @ViewChild('multiSelect', { static: true })\n multiSelect: MultiSelect;\n\n readonly field = input<boolean>(true);\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly readonly = input<boolean>(false);\n readonly pInputs = input<Partial<MultiSelect>>();\n readonly options = input<any[]>();\n readonly optionValue = input<string>();\n readonly optionLabel = input<string>();\n readonly filter = input<boolean>(false);\n readonly filterBy = input<string>();\n readonly dataKey = input<string>();\n readonly showClear = input<boolean>(false);\n readonly display = input<string>('chip');\n @Output() onChange: EventEmitter<any> = new EventEmitter();\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<any>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: any) => void = () => {};\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n applyInputsToMultiSelect() {\n Object.assign(this.multiSelect, this.pInputs());\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n if (this.pInputs()) {\n this.applyInputsToMultiSelect();\n }\n }\n onValueChange(value: any) {\n this.onModelChange(value);\n this.value.set(value);\n this.onChange.emit(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToMultiSelect();\n }\n }\n\n writeValue(value: any) {\n this.value.set(value);\n this.multiSelect.writeValue(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","@if (label()) {\n <label\n (click)=\"multiSelect?.show()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-multiSelect\n #multiSelect\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [options]=\"options()\"\n [display]=\"display()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name?.toString() || label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n [filter]=\"filter()\"\n [filterBy]=\"filterBy()\"\n [dataKey]=\"dataKey()\"\n styleClass=\"w-full\"\n appendTo=\"body\"\n [showClear]=\"showClear()\"\n></p-multiSelect>\n\n<mt-field-validation [control]=\"ngControl?.control\"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AA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,iBAAiB,+xCAAE,eAAe,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAM9C,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAX5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,EAAA,UAAA,EAGrB,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,iBAAiB,EAAE,eAAe,CAAC,EAAA,eAAA,EACzC,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,s6BAAA,EAAA;wDAMD,WAAW,EAAA,CAAA;sBADV,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAiBhC,QAAQ,EAAA,CAAA;sBAAjB;gBAEqB,UAAU,EAAA,CAAA;sBAA/B,WAAW;uBAAC,OAAO;;;AE1DtB;;AAEG;;;;"}
@@ -1,9 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, inject, signal, HostBinding, ViewChild, Component } from '@angular/core';
2
+ import { input, inject, signal, HostBinding, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { NgControl, Validators, FormsModule } from '@angular/forms';
5
5
  import * as i2 from 'primeng/inputnumber';
6
6
  import { InputNumberModule } from 'primeng/inputnumber';
7
+ import { FieldValidation } from '@masterteam/components/field-validation';
8
+ import { isInvalid } from '@masterteam/components';
7
9
 
8
10
  class NumberField {
9
11
  inputNumber;
@@ -20,6 +22,7 @@ class NumberField {
20
22
  max = input(999999999999999, ...(ngDevMode ? [{ debugName: "max" }] : []));
21
23
  styleClass;
22
24
  ngControl = inject(NgControl, { self: true });
25
+ isInvalid = isInvalid;
23
26
  requiredValidator = Validators.required;
24
27
  value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
25
28
  disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
@@ -60,14 +63,14 @@ class NumberField {
60
63
  setDisabledState(disabled) {
61
64
  this.disabled.set(disabled);
62
65
  }
63
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NumberField, deps: [], target: i0.ɵɵFactoryTarget.Component });
64
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: NumberField, isStandalone: true, selector: "mt-number-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, maxFractionDigits: { classPropertyName: "maxFractionDigits", publicName: "maxFractionDigits", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "inputNumber", first: true, predicate: ["inputNumber"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-inputnumber\n #inputNumber\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [format]=\"format()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [maxFractionDigits]=\"maxFractionDigits()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n></p-inputnumber>\n", styles: [":host p-inputNumber{display:block;width:100%}:host p-inputNumber input{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i2.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }] });
66
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NumberField, deps: [], target: i0.ɵɵFactoryTarget.Component });
67
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: NumberField, isStandalone: true, selector: "mt-number-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, maxFractionDigits: { classPropertyName: "maxFractionDigits", publicName: "maxFractionDigits", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "inputNumber", first: true, predicate: ["inputNumber"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-inputnumber\n #inputNumber\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [format]=\"format()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [maxFractionDigits]=\"maxFractionDigits()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n></p-inputnumber>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: [":host p-inputNumber{display:block;width:100%}:host p-inputNumber input{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i2.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
65
68
  }
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NumberField, decorators: [{
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NumberField, decorators: [{
67
70
  type: Component,
68
- args: [{ selector: 'mt-number-field', standalone: true, imports: [FormsModule, InputNumberModule], host: {
71
+ args: [{ selector: 'mt-number-field', standalone: true, imports: [FormsModule, InputNumberModule, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
69
72
  class: 'grid gap-1',
70
- }, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-inputnumber\n #inputNumber\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [format]=\"format()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [maxFractionDigits]=\"maxFractionDigits()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n></p-inputnumber>\n", styles: [":host p-inputNumber{display:block;width:100%}:host p-inputNumber input{width:100%}\n"] }]
73
+ }, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-inputnumber\n #inputNumber\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [format]=\"format()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [maxFractionDigits]=\"maxFractionDigits()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n></p-inputnumber>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: [":host p-inputNumber{display:block;width:100%}:host p-inputNumber input{width:100%}\n"] }]
71
74
  }], ctorParameters: () => [], propDecorators: { inputNumber: [{
72
75
  type: ViewChild,
73
76
  args: ['inputNumber', { static: true }]