@masterteam/components 0.0.262 → 0.0.264
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.
- package/assets/common.css +1 -1
- package/assets/i18n/ar.json +10 -2
- package/assets/i18n/en.json +10 -2
- package/fesm2022/masterteam-components-business-fields.mjs +13 -8
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-button.mjs +34 -4
- package/fesm2022/masterteam-components-button.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +8 -4
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page-menu.mjs +4 -3
- package/fesm2022/masterteam-components-client-page-menu.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page.mjs +48 -6
- package/fesm2022/masterteam-components-client-page.mjs.map +1 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +8 -4
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +24 -5
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +8 -4
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-empty-state.mjs +53 -0
- package/fesm2022/masterteam-components-empty-state.mjs.map +1 -0
- package/fesm2022/masterteam-components-entities.mjs +187 -37
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +82 -3
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +9 -12
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +9 -5
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +8 -4
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +8 -4
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-page-header.mjs +2 -2
- package/fesm2022/masterteam-components-page-header.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +8 -4
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-cards-field.mjs +8 -3
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +7 -3
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +266 -65
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-tabs.mjs +1 -1
- package/fesm2022/masterteam-components-tabs.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +9 -5
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +8 -4
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-tree.mjs +1 -1
- package/fesm2022/masterteam-components-tree.mjs.map +1 -1
- package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +9 -4
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-uploader.mjs +28 -2
- package/fesm2022/masterteam-components-uploader.mjs.map +1 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +8 -4
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +277 -36
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/masterteam-components-business-fields.d.ts +4 -0
- package/types/masterteam-components-button.d.ts +27 -1
- package/types/masterteam-components-checkbox-field.d.ts +4 -0
- package/types/masterteam-components-client-page.d.ts +7 -1
- package/types/masterteam-components-color-picker-field.d.ts +4 -0
- package/types/masterteam-components-date-field.d.ts +7 -1
- package/types/masterteam-components-editor-field.d.ts +4 -0
- package/types/masterteam-components-empty-state.d.ts +47 -0
- package/types/masterteam-components-entities.d.ts +80 -8
- package/types/masterteam-components-field-validation.d.ts +38 -2
- package/types/masterteam-components-icon-field.d.ts +4 -0
- package/types/masterteam-components-location-field.d.ts +4 -0
- package/types/masterteam-components-multi-select-field.d.ts +4 -0
- package/types/masterteam-components-number-field.d.ts +4 -0
- package/types/masterteam-components-pick-list-field.d.ts +4 -0
- package/types/masterteam-components-radio-cards-field.d.ts +4 -0
- package/types/masterteam-components-select-field.d.ts +4 -0
- package/types/masterteam-components-table.d.ts +123 -6
- package/types/masterteam-components-text-field.d.ts +4 -0
- package/types/masterteam-components-textarea-field.d.ts +4 -0
- package/types/masterteam-components-upload-field.d.ts +4 -0
- package/types/masterteam-components-user-search-field.d.ts +4 -0
- package/types/masterteam-components.d.ts +107 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Pipe, input, booleanAttribute, Component } from '@angular/core';
|
|
2
|
+
import { inject, Pipe, ElementRef, input, booleanAttribute, computed, Component } from '@angular/core';
|
|
3
3
|
import { Message } from 'primeng/message';
|
|
4
4
|
import { TranslocoService } from '@jsverse/transloco';
|
|
5
5
|
import { isInvalid } from '@masterteam/components';
|
|
@@ -80,10 +80,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
80
80
|
}]
|
|
81
81
|
}] });
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* First focusable thing inside a field host — the element a screen reader is on
|
|
85
|
+
* when it needs to hear that the value was rejected. Covers the native controls
|
|
86
|
+
* and the inner input every PrimeNG wrapper renders.
|
|
87
|
+
*/
|
|
88
|
+
const CONTROL_SELECTOR = 'input, textarea, select, [contenteditable="true"], [role="combobox"], [role="listbox"], [role="spinbutton"]';
|
|
89
|
+
/**
|
|
90
|
+
* Process-unique suffix for the generated message id. Deliberately local rather
|
|
91
|
+
* than the shared `nextFieldId` helper: that lives behind the ROOT entry point,
|
|
92
|
+
* and reaching into it by relative path from a secondary entry point is what
|
|
93
|
+
* broke the `ng-packagr` build for this entry.
|
|
94
|
+
*/
|
|
95
|
+
let nextMessageId = 0;
|
|
83
96
|
class FieldValidation {
|
|
97
|
+
elementRef = inject(ElementRef);
|
|
84
98
|
control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
85
99
|
touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
100
|
+
/**
|
|
101
|
+
* Id the failing control points at with `aria-describedby`. Generated when
|
|
102
|
+
* not supplied, so no caller has to pass anything for the wiring below to
|
|
103
|
+
* work; override it only when a host needs a predictable id (a test, or a
|
|
104
|
+
* second `aria-describedby` target it is composing itself).
|
|
105
|
+
*/
|
|
106
|
+
messageId = input(null, ...(ngDevMode ? [{ debugName: "messageId" }] : /* istanbul ignore next */ []));
|
|
107
|
+
fallbackMessageId = `mt-field-error-${nextMessageId++}`;
|
|
108
|
+
resolvedMessageId = computed(() => this.messageId()?.trim() || this.fallbackMessageId, ...(ngDevMode ? [{ debugName: "resolvedMessageId" }] : /* istanbul ignore next */ []));
|
|
86
109
|
isInvalid = isInvalid;
|
|
110
|
+
/** Cached lookup — the control element never changes for a given field. */
|
|
111
|
+
controlElement;
|
|
112
|
+
describedApplied = false;
|
|
113
|
+
/**
|
|
114
|
+
* Keep `aria-invalid` / `aria-describedby` on the field's own control in step
|
|
115
|
+
* with the message below it.
|
|
116
|
+
*
|
|
117
|
+
* The message used to be loose text with no relationship to anything: a
|
|
118
|
+
* screen-reader user heard the field, then — separately, later, if they kept
|
|
119
|
+
* reading — an unattributed error (findings C-02, H-04). Wiring it here rather
|
|
120
|
+
* than in each of the 23 field templates means every field that already
|
|
121
|
+
* renders `mt-field-validation` gets it, including the ones whose control is
|
|
122
|
+
* an input PrimeNG renders and the template cannot reach.
|
|
123
|
+
*
|
|
124
|
+
* `ngDoCheck` rather than an `effect` because `AbstractControl` validity is
|
|
125
|
+
* not a signal — the template re-reads it every cycle, and so does this.
|
|
126
|
+
*/
|
|
127
|
+
ngDoCheck() {
|
|
128
|
+
const target = this.resolveControlElement();
|
|
129
|
+
if (!target) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const invalid = isInvalid(this.control());
|
|
133
|
+
if (invalid === this.describedApplied) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.describedApplied = invalid;
|
|
137
|
+
if (invalid) {
|
|
138
|
+
target.setAttribute('aria-invalid', 'true');
|
|
139
|
+
target.setAttribute('aria-describedby', this.resolvedMessageId());
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
target.removeAttribute('aria-invalid');
|
|
143
|
+
if (target.getAttribute('aria-describedby') === this.resolvedMessageId()) {
|
|
144
|
+
target.removeAttribute('aria-describedby');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
87
147
|
/**
|
|
88
148
|
* Reserve the error-message line whenever the control can surface an error —
|
|
89
149
|
* i.e. it has sync/async validators, or is already showing one. This keeps the
|
|
@@ -100,13 +160,30 @@ class FieldValidation {
|
|
|
100
160
|
control.asyncValidator !== null ||
|
|
101
161
|
isInvalid(control));
|
|
102
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The control this message belongs to: the first focusable element inside the
|
|
165
|
+
* field component that hosts us. `undefined` means "not looked up yet",
|
|
166
|
+
* `null` means "looked up and there is nothing to annotate" — a distinction
|
|
167
|
+
* that matters, because the second case must not re-query every cycle.
|
|
168
|
+
*/
|
|
169
|
+
resolveControlElement() {
|
|
170
|
+
if (this.controlElement !== undefined) {
|
|
171
|
+
return this.controlElement;
|
|
172
|
+
}
|
|
173
|
+
const host = this.elementRef.nativeElement.parentElement;
|
|
174
|
+
this.controlElement =
|
|
175
|
+
host?.querySelector(CONTROL_SELECTOR) ?? null;
|
|
176
|
+
return this.controlElement;
|
|
177
|
+
}
|
|
103
178
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: FieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
104
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", 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.mt-field-validation--reserved": "shouldReserveSpace()" }, classAttribute: "mt-field-validation" }, ngImport: i0, template: `
|
|
179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", 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 }, messageId: { classPropertyName: "messageId", publicName: "messageId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.mt-field-validation--reserved": "shouldReserveSpace()" }, classAttribute: "mt-field-validation" }, ngImport: i0, template: `
|
|
105
180
|
@if (isInvalid(control())) {
|
|
106
181
|
<p-message
|
|
107
182
|
severity="error"
|
|
108
183
|
variant="simple"
|
|
109
184
|
size="small"
|
|
185
|
+
role="alert"
|
|
186
|
+
[id]="resolvedMessageId()"
|
|
110
187
|
[text]="control().errors | errorMessage"
|
|
111
188
|
>
|
|
112
189
|
</p-message>
|
|
@@ -121,6 +198,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
121
198
|
severity="error"
|
|
122
199
|
variant="simple"
|
|
123
200
|
size="small"
|
|
201
|
+
role="alert"
|
|
202
|
+
[id]="resolvedMessageId()"
|
|
124
203
|
[text]="control().errors | errorMessage"
|
|
125
204
|
>
|
|
126
205
|
</p-message>
|
|
@@ -132,7 +211,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
132
211
|
// rest of the form). Fields with no validators stay compact.
|
|
133
212
|
'[class.mt-field-validation--reserved]': 'shouldReserveSpace()',
|
|
134
213
|
}, styles: [".mt-field-validation{display:none}.mt-field-validation--reserved{display:block;min-height:1.25rem}\n"] }]
|
|
135
|
-
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }] } });
|
|
214
|
+
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], messageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "messageId", required: false }] }] } });
|
|
136
215
|
|
|
137
216
|
const characterLimitValidator = (maxLength) => (control) => {
|
|
138
217
|
const value = control.value;
|
|
@@ -1 +1 @@
|
|
|
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/character-limit.validator.ts","../../../../packages/masterteam/components/field-validation/masterteam-components-field-validation.ts"],"sourcesContent":["import { inject, Pipe, PipeTransform } from '@angular/core';\r\nimport { ValidationErrors } from '@angular/forms';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\n\r\n@Pipe({\r\n name: 'errorMessage',\r\n standalone: true,\r\n pure: false,\r\n})\r\nexport class ErrorMessagePipe implements PipeTransform {\r\n private readonly translocoService = inject(TranslocoService);\r\n\r\n transform(errors: ValidationErrors | null): string {\r\n if (!errors) {\r\n return '';\r\n }\r\n\r\n const t = (key: string, params?: object) =>\r\n this.translocoService.translate(`components.validation.${key}`, params);\r\n\r\n // A `.message` on the error object means a caller deliberately configured\r\n // field-specific copy for this failure — ValidatorConfig with an explicit message\r\n // (buildValidators → wrapValidatorWithMessage), or ValidatorConfig.custom\r\n // (createCustomValidator). It must win over the generic translations below,\r\n // otherwise that copy is silently replaced by the generic string, e.g. every\r\n // pattern mismatch reading \"The format is invalid\" no matter what the field\r\n // configured.\r\n //\r\n // The inverse matters just as much: ValidatorConfig's type-specific factories\r\n // deliberately do NOT default `message` (see the note on ValidatorConfig in\r\n // dynamic-form.model.ts). With no message configured the raw Angular validator is\r\n // pushed unwrapped, so nothing reaches this loop and the translated — and, where\r\n // relevant, parameter-interpolated — generic branch below runs instead. Re-adding\r\n // a default there would shadow those translations in every locale but English.\r\n for (const key in errors) {\r\n const errorValue = errors[key];\r\n if (errorValue && typeof errorValue === 'object' && errorValue.message) {\r\n return errorValue.message;\r\n }\r\n }\r\n\r\n if (errors['required']) {\r\n return t('required');\r\n }\r\n if (errors['email']) {\r\n return t('email');\r\n }\r\n if (errors['minlength']) {\r\n const { requiredLength } = errors['minlength'];\r\n return t('minLength', { requiredLength });\r\n }\r\n if (errors['maxlength']) {\r\n const { requiredLength } = errors['maxlength'];\r\n return t('maxLength', { requiredLength });\r\n }\r\n if (errors['characterLimit']) {\r\n const { requiredLength } = errors['characterLimit'];\r\n return t('maxLength', { requiredLength });\r\n }\r\n if (errors['min']) {\r\n const { min } = errors['min'];\r\n return t('min', { min });\r\n }\r\n if (errors['max']) {\r\n const { max } = errors['max'];\r\n return t('max', { max });\r\n }\r\n if (errors['pattern']) {\r\n return t('pattern');\r\n }\r\n if (errors['fileSizeLimited']) {\r\n const { size } = errors['fileSizeLimited'] ?? {};\r\n return t('fileSizeLimited', { size });\r\n }\r\n\r\n // Fallback for any other error\r\n const firstErrorKey = Object.keys(errors)[0];\r\n return t('invalid', { key: firstErrorKey });\r\n }\r\n}\r\n","import { booleanAttribute, Component, input } from '@angular/core';\r\nimport { Message } from 'primeng/message';\r\nimport { AbstractControl } from '@angular/forms';\r\nimport { ErrorMessagePipe } from './error-message.pipe';\r\nimport { isInvalid } from '@masterteam/components';\r\n\r\n@Component({\r\n selector: 'mt-field-validation',\r\n standalone: true,\r\n imports: [Message, ErrorMessagePipe],\r\n template: `\r\n @if (isInvalid(control())) {\r\n <p-message\r\n severity=\"error\"\r\n variant=\"simple\"\r\n size=\"small\"\r\n [text]=\"control().errors | errorMessage\"\r\n >\r\n </p-message>\r\n }\r\n `,\r\n host: {\r\n class: 'mt-field-validation',\r\n // Reserve one line of space for fields that can produce an error so the\r\n // message appears/disappears without shifting the field height (and the\r\n // rest of the form). Fields with no validators stay compact.\r\n '[class.mt-field-validation--reserved]': 'shouldReserveSpace()',\r\n },\r\n styles: `\r\n .mt-field-validation {\r\n display: none;\r\n }\r\n .mt-field-validation--reserved {\r\n display: block;\r\n min-height: 1.25rem;\r\n }\r\n `,\r\n})\r\nexport class FieldValidation {\r\n readonly control = input<AbstractControl | null>(null);\r\n readonly touched = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n\r\n isInvalid = isInvalid;\r\n\r\n /**\r\n * Reserve the error-message line whenever the control can surface an error —\r\n * i.e. it has sync/async validators, or is already showing one. This keeps the\r\n * field's height constant so showing the error never pushes sibling fields or\r\n * the content below the row. Re-evaluated each change-detection cycle, so it\r\n * picks up validators that fields add asynchronously after init.\r\n */\r\n shouldReserveSpace(): boolean {\r\n const control = this.control();\r\n if (!control) {\r\n return false;\r\n }\r\n return (\r\n control.validator !== null ||\r\n control.asyncValidator !== null ||\r\n isInvalid(control)\r\n );\r\n }\r\n}\r\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\nexport const characterLimitValidator =\n (maxLength: number): ValidatorFn =>\n (control: AbstractControl): ValidationErrors | null => {\n const value = control.value;\n\n if (value === null || value === undefined) {\n return null;\n }\n\n const length = String(value).length;\n\n return length > maxLength\n ? {\n characterLimit: {\n requiredLength: maxLength,\n actualLength: length,\n },\n }\n : null;\n };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MASa,gBAAgB,CAAA;AACV,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE5D,IAAA,SAAS,CAAC,MAA+B,EAAA;QACvC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE;QACX;QAEA,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,MAAe,KACrC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA,sBAAA,EAAyB,GAAG,CAAA,CAAE,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;AAgBzE,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;AACxB,YAAA,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,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B;;;;AAI5B,wBAAA,uCAAuC,EAAE,sBAAsB;AAChE,qBAAA,EAAA,MAAA,EAAA,CAAA,sGAAA,CAAA,EAAA;;;ACzBI,MAAM,uBAAuB,GAClC,CAAC,SAAiB,KAClB,CAAC,OAAwB,KAA6B;AACpD,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;IAE3B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM;IAEnC,OAAO,MAAM,GAAG;AACd,UAAE;AACE,YAAA,cAAc,EAAE;AACd,gBAAA,cAAc,EAAE,SAAS;AACzB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA;AACF;UACD,IAAI;AACV;;ACrBF;;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/character-limit.validator.ts","../../../../packages/masterteam/components/field-validation/masterteam-components-field-validation.ts"],"sourcesContent":["import { inject, Pipe, PipeTransform } from '@angular/core';\r\nimport { ValidationErrors } from '@angular/forms';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\n\r\n@Pipe({\r\n name: 'errorMessage',\r\n standalone: true,\r\n pure: false,\r\n})\r\nexport class ErrorMessagePipe implements PipeTransform {\r\n private readonly translocoService = inject(TranslocoService);\r\n\r\n transform(errors: ValidationErrors | null): string {\r\n if (!errors) {\r\n return '';\r\n }\r\n\r\n const t = (key: string, params?: object) =>\r\n this.translocoService.translate(`components.validation.${key}`, params);\r\n\r\n // A `.message` on the error object means a caller deliberately configured\r\n // field-specific copy for this failure — ValidatorConfig with an explicit message\r\n // (buildValidators → wrapValidatorWithMessage), or ValidatorConfig.custom\r\n // (createCustomValidator). It must win over the generic translations below,\r\n // otherwise that copy is silently replaced by the generic string, e.g. every\r\n // pattern mismatch reading \"The format is invalid\" no matter what the field\r\n // configured.\r\n //\r\n // The inverse matters just as much: ValidatorConfig's type-specific factories\r\n // deliberately do NOT default `message` (see the note on ValidatorConfig in\r\n // dynamic-form.model.ts). With no message configured the raw Angular validator is\r\n // pushed unwrapped, so nothing reaches this loop and the translated — and, where\r\n // relevant, parameter-interpolated — generic branch below runs instead. Re-adding\r\n // a default there would shadow those translations in every locale but English.\r\n for (const key in errors) {\r\n const errorValue = errors[key];\r\n if (errorValue && typeof errorValue === 'object' && errorValue.message) {\r\n return errorValue.message;\r\n }\r\n }\r\n\r\n if (errors['required']) {\r\n return t('required');\r\n }\r\n if (errors['email']) {\r\n return t('email');\r\n }\r\n if (errors['minlength']) {\r\n const { requiredLength } = errors['minlength'];\r\n return t('minLength', { requiredLength });\r\n }\r\n if (errors['maxlength']) {\r\n const { requiredLength } = errors['maxlength'];\r\n return t('maxLength', { requiredLength });\r\n }\r\n if (errors['characterLimit']) {\r\n const { requiredLength } = errors['characterLimit'];\r\n return t('maxLength', { requiredLength });\r\n }\r\n if (errors['min']) {\r\n const { min } = errors['min'];\r\n return t('min', { min });\r\n }\r\n if (errors['max']) {\r\n const { max } = errors['max'];\r\n return t('max', { max });\r\n }\r\n if (errors['pattern']) {\r\n return t('pattern');\r\n }\r\n if (errors['fileSizeLimited']) {\r\n const { size } = errors['fileSizeLimited'] ?? {};\r\n return t('fileSizeLimited', { size });\r\n }\r\n\r\n // Fallback for any other error\r\n const firstErrorKey = Object.keys(errors)[0];\r\n return t('invalid', { key: firstErrorKey });\r\n }\r\n}\r\n","import {\r\n booleanAttribute,\r\n Component,\r\n computed,\r\n DoCheck,\r\n ElementRef,\r\n inject,\r\n input,\r\n} from '@angular/core';\r\nimport { Message } from 'primeng/message';\r\nimport { AbstractControl } from '@angular/forms';\r\nimport { ErrorMessagePipe } from './error-message.pipe';\r\nimport { isInvalid } from '@masterteam/components';\r\n\r\n/**\r\n * First focusable thing inside a field host — the element a screen reader is on\r\n * when it needs to hear that the value was rejected. Covers the native controls\r\n * and the inner input every PrimeNG wrapper renders.\r\n */\r\nconst CONTROL_SELECTOR =\r\n 'input, textarea, select, [contenteditable=\"true\"], [role=\"combobox\"], [role=\"listbox\"], [role=\"spinbutton\"]';\r\n\r\n/**\r\n * Process-unique suffix for the generated message id. Deliberately local rather\r\n * than the shared `nextFieldId` helper: that lives behind the ROOT entry point,\r\n * and reaching into it by relative path from a secondary entry point is what\r\n * broke the `ng-packagr` build for this entry.\r\n */\r\nlet nextMessageId = 0;\r\n\r\n@Component({\r\n selector: 'mt-field-validation',\r\n standalone: true,\r\n imports: [Message, ErrorMessagePipe],\r\n template: `\r\n @if (isInvalid(control())) {\r\n <p-message\r\n severity=\"error\"\r\n variant=\"simple\"\r\n size=\"small\"\r\n role=\"alert\"\r\n [id]=\"resolvedMessageId()\"\r\n [text]=\"control().errors | errorMessage\"\r\n >\r\n </p-message>\r\n }\r\n `,\r\n host: {\r\n class: 'mt-field-validation',\r\n // Reserve one line of space for fields that can produce an error so the\r\n // message appears/disappears without shifting the field height (and the\r\n // rest of the form). Fields with no validators stay compact.\r\n '[class.mt-field-validation--reserved]': 'shouldReserveSpace()',\r\n },\r\n styles: `\r\n .mt-field-validation {\r\n display: none;\r\n }\r\n .mt-field-validation--reserved {\r\n display: block;\r\n min-height: 1.25rem;\r\n }\r\n `,\r\n})\r\nexport class FieldValidation implements DoCheck {\r\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n readonly control = input<AbstractControl | null>(null);\r\n readonly touched = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n\r\n /**\r\n * Id the failing control points at with `aria-describedby`. Generated when\r\n * not supplied, so no caller has to pass anything for the wiring below to\r\n * work; override it only when a host needs a predictable id (a test, or a\r\n * second `aria-describedby` target it is composing itself).\r\n */\r\n readonly messageId = input<string | null>(null);\r\n\r\n private readonly fallbackMessageId = `mt-field-error-${nextMessageId++}`;\r\n\r\n readonly resolvedMessageId = computed(\r\n () => this.messageId()?.trim() || this.fallbackMessageId,\r\n );\r\n\r\n isInvalid = isInvalid;\r\n\r\n /** Cached lookup — the control element never changes for a given field. */\r\n private controlElement: HTMLElement | null | undefined;\r\n private describedApplied = false;\r\n\r\n /**\r\n * Keep `aria-invalid` / `aria-describedby` on the field's own control in step\r\n * with the message below it.\r\n *\r\n * The message used to be loose text with no relationship to anything: a\r\n * screen-reader user heard the field, then — separately, later, if they kept\r\n * reading — an unattributed error (findings C-02, H-04). Wiring it here rather\r\n * than in each of the 23 field templates means every field that already\r\n * renders `mt-field-validation` gets it, including the ones whose control is\r\n * an input PrimeNG renders and the template cannot reach.\r\n *\r\n * `ngDoCheck` rather than an `effect` because `AbstractControl` validity is\r\n * not a signal — the template re-reads it every cycle, and so does this.\r\n */\r\n ngDoCheck(): void {\r\n const target = this.resolveControlElement();\r\n if (!target) {\r\n return;\r\n }\r\n\r\n const invalid = isInvalid(this.control());\r\n if (invalid === this.describedApplied) {\r\n return;\r\n }\r\n\r\n this.describedApplied = invalid;\r\n\r\n if (invalid) {\r\n target.setAttribute('aria-invalid', 'true');\r\n target.setAttribute('aria-describedby', this.resolvedMessageId());\r\n return;\r\n }\r\n\r\n target.removeAttribute('aria-invalid');\r\n if (target.getAttribute('aria-describedby') === this.resolvedMessageId()) {\r\n target.removeAttribute('aria-describedby');\r\n }\r\n }\r\n\r\n /**\r\n * Reserve the error-message line whenever the control can surface an error —\r\n * i.e. it has sync/async validators, or is already showing one. This keeps the\r\n * field's height constant so showing the error never pushes sibling fields or\r\n * the content below the row. Re-evaluated each change-detection cycle, so it\r\n * picks up validators that fields add asynchronously after init.\r\n */\r\n shouldReserveSpace(): boolean {\r\n const control = this.control();\r\n if (!control) {\r\n return false;\r\n }\r\n return (\r\n control.validator !== null ||\r\n control.asyncValidator !== null ||\r\n isInvalid(control)\r\n );\r\n }\r\n\r\n /**\r\n * The control this message belongs to: the first focusable element inside the\r\n * field component that hosts us. `undefined` means \"not looked up yet\",\r\n * `null` means \"looked up and there is nothing to annotate\" — a distinction\r\n * that matters, because the second case must not re-query every cycle.\r\n */\r\n private resolveControlElement(): HTMLElement | null {\r\n if (this.controlElement !== undefined) {\r\n return this.controlElement;\r\n }\r\n\r\n const host = this.elementRef.nativeElement.parentElement;\r\n this.controlElement =\r\n host?.querySelector<HTMLElement>(CONTROL_SELECTOR) ?? null;\r\n\r\n return this.controlElement;\r\n }\r\n}\r\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\r\n\r\nexport const characterLimitValidator =\r\n (maxLength: number): ValidatorFn =>\r\n (control: AbstractControl): ValidationErrors | null => {\r\n const value = control.value;\r\n\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n\r\n const length = String(value).length;\r\n\r\n return length > maxLength\r\n ? {\r\n characterLimit: {\r\n requiredLength: maxLength,\r\n actualLength: length,\r\n },\r\n }\r\n : null;\r\n };\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MASa,gBAAgB,CAAA;AACV,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE5D,IAAA,SAAS,CAAC,MAA+B,EAAA;QACvC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE;QACX;QAEA,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,MAAe,KACrC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA,sBAAA,EAAyB,GAAG,CAAA,CAAE,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;AAgBzE,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;AACxB,YAAA,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC;YAC9B,IAAI,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,OAAO,EAAE;gBACtE,OAAO,UAAU,CAAC,OAAO;YAC3B;QACF;AA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AAA,EAAA,CAAA;;2FA+BxB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAlC3B,SAAS;+BACE,qBAAqB,EAAA,UAAA,EACnB,IAAI,EAAA,OAAA,EACP,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAA,QAAA,EAC1B,CAAA;;;;;;;;;;;;GAYT,EAAA,IAAA,EACK;AACJ,wBAAA,KAAK,EAAE,qBAAqB;;;;AAI5B,wBAAA,uCAAuC,EAAE,sBAAsB;AAChE,qBAAA,EAAA,MAAA,EAAA,CAAA,sGAAA,CAAA,EAAA;;;ACnDI,MAAM,uBAAuB,GAClC,CAAC,SAAiB,KAClB,CAAC,OAAwB,KAA6B;AACpD,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;IAE3B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM;IAEnC,OAAO,MAAM,GAAG;AACd,UAAE;AACE,YAAA,cAAc,EAAE;AACd,gBAAA,cAAc,EAAE,SAAS;AACzB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA;AACF;UACD,IAAI;AACV;;ACrBF;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, signal, inject, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { input, computed, signal, inject, effect, 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';
|
|
@@ -7,7 +7,7 @@ import { TranslocoPipe } from '@jsverse/transloco';
|
|
|
7
7
|
import * as mtIcons from '@masterteam/icons/assets/select-icons.json';
|
|
8
8
|
import { Icon } from '@masterteam/icons';
|
|
9
9
|
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
10
|
-
import { isInvalid } from '@masterteam/components';
|
|
10
|
+
import { nextFieldId, resolveFieldId, isInvalid } from '@masterteam/components';
|
|
11
11
|
import { Tooltip } from '@masterteam/components/tooltip';
|
|
12
12
|
|
|
13
13
|
const ICON_SEARCH_ALIASES = {
|
|
@@ -46,6 +46,10 @@ const ICON_DISPLAY_TOKEN_LABELS = {
|
|
|
46
46
|
};
|
|
47
47
|
class IconField {
|
|
48
48
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Fallback so a control-less, label-less field never renders id="undefined". */
|
|
50
|
+
defaultFieldId = nextFieldId('mt-icon-field');
|
|
51
|
+
/** Shared by the input and its <label for>. See src/lib/utils/field-id. */
|
|
52
|
+
fieldId = computed(() => resolveFieldId(this.ngControl?.name, this.label(), this.defaultFieldId), ...(ngDevMode ? [{ debugName: "fieldId" }] : /* istanbul ignore next */ []));
|
|
49
53
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
50
54
|
icons = (mtIcons?.regular ?? []).map((icon) => this.createIconOption(icon));
|
|
51
55
|
selectedIcon = signal(null, ...(ngDevMode ? [{ debugName: "selectedIcon" }] : /* istanbul ignore next */ []));
|
|
@@ -137,20 +141,13 @@ class IconField {
|
|
|
137
141
|
.filter(Boolean))).join(' ');
|
|
138
142
|
}
|
|
139
143
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: IconField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
140
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"
|
|
144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >{{ label() }}</label\r\n >\r\n}\r\n<p-select\r\n #dropdown\r\n [options]=\"icons\"\r\n [filter]=\"true\"\r\n filterBy=\"searchText\"\r\n optionLabel=\"name\"\r\n optionValue=\"key\"\r\n dataKey=\"key\"\r\n [inputId]=\"fieldId()\"\r\n appendTo=\"body\"\r\n (onBlur)=\"onTouched()\"\r\n (ngModelChange)=\"onChangeIcon($event)\"\r\n [ngModel]=\"selectedIcon()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.iconField.selectIcon' | transloco\"\r\n styleClass=\"w-full\"\r\n panelStyleClass=\"icon-select-panel\"\r\n>\r\n <ng-template let-icon #selectedItem>\r\n @let iconKey = getIconKey(icon);\r\n @if (iconKey) {\r\n <div\r\n class=\"flex items-center justify-center text-2xl\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"iconKey\" />\r\n </div>\r\n } @else {\r\n <div class=\"flex items-center justify-center\">\r\n {{ \"components.iconField.selectIcon\" | transloco }}\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template let-icon #item>\r\n <div\r\n class=\"w-full h-full flex items-center justify-center text-lg\"\r\n [attr.aria-label]=\"getIconTooltip(icon)\"\r\n [title]=\"getIconTooltip(icon)\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"icon.key\" />\r\n </div>\r\n </ng-template>\r\n</p-select>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n", styles: ["::ng-deep .icon-select-panel{width:min(22rem,100vw - 2rem)}::ng-deep .icon-select-panel .p-select-filter-container{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 2)}::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", "motionOptions"], 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", "messageId"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
141
145
|
}
|
|
142
146
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: IconField, decorators: [{
|
|
143
147
|
type: Component,
|
|
144
|
-
args: [{ selector: 'mt-icon-field', imports: [
|
|
145
|
-
FormsModule,
|
|
146
|
-
Select,
|
|
147
|
-
Icon,
|
|
148
|
-
FieldValidation,
|
|
149
|
-
TranslocoPipe,
|
|
150
|
-
Tooltip,
|
|
151
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
148
|
+
args: [{ selector: 'mt-icon-field', imports: [FormsModule, Select, Icon, FieldValidation, TranslocoPipe, Tooltip], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
152
149
|
class: 'grid gap-1',
|
|
153
|
-
}, template: "@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"
|
|
150
|
+
}, template: "@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >{{ label() }}</label\r\n >\r\n}\r\n<p-select\r\n #dropdown\r\n [options]=\"icons\"\r\n [filter]=\"true\"\r\n filterBy=\"searchText\"\r\n optionLabel=\"name\"\r\n optionValue=\"key\"\r\n dataKey=\"key\"\r\n [inputId]=\"fieldId()\"\r\n appendTo=\"body\"\r\n (onBlur)=\"onTouched()\"\r\n (ngModelChange)=\"onChangeIcon($event)\"\r\n [ngModel]=\"selectedIcon()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.iconField.selectIcon' | transloco\"\r\n styleClass=\"w-full\"\r\n panelStyleClass=\"icon-select-panel\"\r\n>\r\n <ng-template let-icon #selectedItem>\r\n @let iconKey = getIconKey(icon);\r\n @if (iconKey) {\r\n <div\r\n class=\"flex items-center justify-center text-2xl\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"iconKey\" />\r\n </div>\r\n } @else {\r\n <div class=\"flex items-center justify-center\">\r\n {{ \"components.iconField.selectIcon\" | transloco }}\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template let-icon #item>\r\n <div\r\n class=\"w-full h-full flex items-center justify-center text-lg\"\r\n [attr.aria-label]=\"getIconTooltip(icon)\"\r\n [title]=\"getIconTooltip(icon)\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"icon.key\" />\r\n </div>\r\n </ng-template>\r\n</p-select>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n", styles: ["::ng-deep .icon-select-panel{width:min(22rem,100vw - 2rem)}::ng-deep .icon-select-panel .p-select-filter-container{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 2)}::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"] }]
|
|
154
151
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
|
|
155
152
|
|
|
156
153
|
/**
|
|
@@ -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 {\r\n Component,\r\n signal,\r\n inject,\r\n input,\r\n ChangeDetectionStrategy,\r\n effect,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormControl,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { Select } from 'primeng/select';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\r\nimport { Icon, MTIcon } from '@masterteam/icons';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { isInvalid } from '@masterteam/components';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\n\r\nexport interface IconFieldOption {\r\n key: MTIcon;\r\n name: string;\r\n category: string;\r\n searchText: string;\r\n}\r\n\r\nconst ICON_SEARCH_ALIASES: Record<string, readonly string[]> = {\r\n add: ['plus', 'create', 'new'],\r\n alert: ['warning', 'notification'],\r\n approved: ['check', 'done', 'verified'],\r\n calendar: ['date', 'schedule'],\r\n chart: ['graph', 'analytics'],\r\n check: ['tick', 'done', 'approved'],\r\n clock: ['time'],\r\n cog: ['gear', 'settings', 'config'],\r\n config: ['settings', 'gear', 'cog'],\r\n dollar: ['money', 'finance', 'currency'],\r\n file: ['document'],\r\n folder: ['directory'],\r\n gear: ['settings', 'config', 'cog'],\r\n lg: ['large'],\r\n mail: ['email'],\r\n md: ['medium'],\r\n message: ['chat', 'comment'],\r\n minus: ['remove', 'subtract'],\r\n plus: ['add', 'create', 'new'],\r\n search: ['find', 'lookup'],\r\n settings: ['config', 'gear', 'cog'],\r\n sm: ['small'],\r\n sp: ['special'],\r\n trash: ['delete', 'remove'],\r\n user: ['person', 'profile'],\r\n users: ['team', 'group'],\r\n x: ['close', 'cancel', 'remove'],\r\n};\r\n\r\nconst ICON_DISPLAY_TOKEN_LABELS: Record<string, string> = {\r\n lg: 'large',\r\n md: 'medium',\r\n sm: 'small',\r\n};\r\n\r\n@Component({\r\n selector: 'mt-icon-field',\r\n imports: [\r\n FormsModule,\r\n Select,\r\n Icon,\r\n FieldValidation,\r\n TranslocoPipe,\r\n Tooltip,\r\n ],\r\n templateUrl: './icon-field.html',\r\n styleUrls: ['./icon-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class IconField implements ControlValueAccessor {\r\n readonly label = input<string>('');\r\n readonly required = input<boolean>(false);\r\n\r\n icons: IconFieldOption[] = ((mtIcons?.regular as MTIcon[]) ?? []).map(\r\n (icon) => this.createIconOption(icon),\r\n );\r\n selectedIcon = signal<MTIcon | null>(null);\r\n requiredValidator = Validators.required;\r\n\r\n public ngControl = inject(NgControl, { self: true, optional: true });\r\n\r\n isInvalid = isInvalid;\r\n\r\n constructor() {\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n effect(() => {\r\n const control = this.ngControl?.control;\r\n if (control && this.required()) {\r\n control.addValidators(Validators.required);\r\n control.updateValueAndValidity();\r\n }\r\n });\r\n }\r\n\r\n protected onTouched: () => void = () => {};\r\n private onChange: (icon: MTIcon | null) => void = () => {};\r\n\r\n writeValue(value: MTIcon | null) {\r\n this.selectedIcon.set(value ?? null);\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouched = fn;\r\n }\r\n\r\n onChangeIcon(icon: MTIcon | null) {\r\n this.selectedIcon.set(icon ?? null);\r\n this.onChange(icon ?? null);\r\n }\r\n\r\n public validate(c: FormControl) {\r\n return c.errors;\r\n }\r\n\r\n getIconKey(optionOrKey: IconFieldOption | MTIcon | null): MTIcon | null {\r\n if (!optionOrKey) return null;\r\n return typeof optionOrKey === 'string' ? optionOrKey : optionOrKey.key;\r\n }\r\n\r\n getIconTooltip(optionOrKey: IconFieldOption | MTIcon | null): string {\r\n if (!optionOrKey) return '';\r\n const icon =\r\n typeof optionOrKey === 'string'\r\n ? this.icons.find((item) => item.key === optionOrKey)\r\n : optionOrKey;\r\n\r\n return icon ? `${icon.name} (${icon.key})` : String(optionOrKey);\r\n }\r\n\r\n private createIconOption(icon: MTIcon): IconFieldOption {\r\n const [categoryKey = '', iconKey = icon] = icon.split('.', 2);\r\n const keyTokens = this.tokenize(iconKey);\r\n const category = this.toTitleCase(categoryKey);\r\n const name = keyTokens.map((token) => this.toTitleCase(token)).join(' ');\r\n const aliasTokens = keyTokens.flatMap(\r\n (token) => ICON_SEARCH_ALIASES[token] ?? [],\r\n );\r\n\r\n return {\r\n key: icon,\r\n name,\r\n category,\r\n searchText: this.normalizeSearchText([\r\n icon,\r\n categoryKey,\r\n category,\r\n iconKey,\r\n name,\r\n ...keyTokens,\r\n ...aliasTokens,\r\n ]),\r\n };\r\n }\r\n\r\n private tokenize(value: string): string[] {\r\n return value\r\n .split(/[^a-zA-Z0-9]+/)\r\n .map((token) => token.trim().toLowerCase())\r\n .filter(Boolean);\r\n }\r\n\r\n private toTitleCase(value: string): string {\r\n const normalized = ICON_DISPLAY_TOKEN_LABELS[value] ?? value;\r\n return normalized\r\n .split(/[^a-zA-Z0-9]+/)\r\n .filter(Boolean)\r\n .map(\r\n (part) =>\r\n `${part.charAt(0).toUpperCase()}${part.slice(1).toLowerCase()}`,\r\n )\r\n .join(' ');\r\n }\r\n\r\n private normalizeSearchText(values: readonly string[]): string {\r\n return Array.from(\r\n new Set(\r\n values\r\n .flatMap((value) => [value, ...this.tokenize(value)])\r\n .map((value) => value.trim().toLowerCase())\r\n .filter(Boolean),\r\n ),\r\n ).join(' ');\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\r\n}\r\n<p-select\r\n #dropdown\r\n [options]=\"icons\"\r\n [filter]=\"true\"\r\n filterBy=\"searchText\"\r\n optionLabel=\"name\"\r\n optionValue=\"key\"\r\n dataKey=\"key\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n appendTo=\"body\"\r\n (onBlur)=\"onTouched()\"\r\n (ngModelChange)=\"onChangeIcon($event)\"\r\n [ngModel]=\"selectedIcon()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.iconField.selectIcon' | transloco\"\r\n styleClass=\"w-full\"\r\n panelStyleClass=\"icon-select-panel\"\r\n>\r\n <ng-template let-icon #selectedItem>\r\n @let iconKey = getIconKey(icon);\r\n @if (iconKey) {\r\n <div\r\n class=\"flex items-center justify-center text-2xl\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"iconKey\" />\r\n </div>\r\n } @else {\r\n <div class=\"flex items-center justify-center\">\r\n {{ \"components.iconField.selectIcon\" | transloco }}\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template let-icon #item>\r\n <div\r\n class=\"w-full h-full flex items-center justify-center text-lg\"\r\n [attr.aria-label]=\"getIconTooltip(icon)\"\r\n [title]=\"getIconTooltip(icon)\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"icon.key\" />\r\n </div>\r\n </ng-template>\r\n</p-select>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","/**\n * Generated bundle index.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AAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAA,QAAA,EAAA,SAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACN,IAAI,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACJ,eAAe,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAEf,OAAO,mDADP,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAUJ,SAAS,EAAA,UAAA,EAAA,CAAA;kBAjBrB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,OAAA,EAChB;wBACP,WAAW;wBACX,MAAM;wBACN,IAAI;wBACJ,eAAe;wBACf,aAAa;wBACb,OAAO;qBACR,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,w1DAAA,EAAA,MAAA,EAAA,CAAA,iiBAAA,CAAA,EAAA;;;AEjFH;;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 {\r\n Component,\r\n signal,\r\n inject,\r\n input,\r\n ChangeDetectionStrategy,\r\n effect,\r\n computed,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormControl,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { Select } from 'primeng/select';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\r\nimport { Icon, MTIcon } from '@masterteam/icons';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { isInvalid, nextFieldId, resolveFieldId } from '@masterteam/components';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\n\r\nexport interface IconFieldOption {\r\n key: MTIcon;\r\n name: string;\r\n category: string;\r\n searchText: string;\r\n}\r\n\r\nconst ICON_SEARCH_ALIASES: Record<string, readonly string[]> = {\r\n add: ['plus', 'create', 'new'],\r\n alert: ['warning', 'notification'],\r\n approved: ['check', 'done', 'verified'],\r\n calendar: ['date', 'schedule'],\r\n chart: ['graph', 'analytics'],\r\n check: ['tick', 'done', 'approved'],\r\n clock: ['time'],\r\n cog: ['gear', 'settings', 'config'],\r\n config: ['settings', 'gear', 'cog'],\r\n dollar: ['money', 'finance', 'currency'],\r\n file: ['document'],\r\n folder: ['directory'],\r\n gear: ['settings', 'config', 'cog'],\r\n lg: ['large'],\r\n mail: ['email'],\r\n md: ['medium'],\r\n message: ['chat', 'comment'],\r\n minus: ['remove', 'subtract'],\r\n plus: ['add', 'create', 'new'],\r\n search: ['find', 'lookup'],\r\n settings: ['config', 'gear', 'cog'],\r\n sm: ['small'],\r\n sp: ['special'],\r\n trash: ['delete', 'remove'],\r\n user: ['person', 'profile'],\r\n users: ['team', 'group'],\r\n x: ['close', 'cancel', 'remove'],\r\n};\r\n\r\nconst ICON_DISPLAY_TOKEN_LABELS: Record<string, string> = {\r\n lg: 'large',\r\n md: 'medium',\r\n sm: 'small',\r\n};\r\n\r\n@Component({\r\n selector: 'mt-icon-field',\r\n imports: [FormsModule, Select, Icon, FieldValidation, TranslocoPipe, Tooltip],\r\n templateUrl: './icon-field.html',\r\n styleUrls: ['./icon-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class IconField implements ControlValueAccessor {\r\n readonly label = input<string>('');\r\n\r\n /** Fallback so a control-less, label-less field never renders id=\"undefined\". */\r\n private readonly defaultFieldId = nextFieldId('mt-icon-field');\r\n /** Shared by the input and its <label for>. See src/lib/utils/field-id. */\r\n readonly fieldId = computed(() =>\r\n resolveFieldId(this.ngControl?.name, this.label(), this.defaultFieldId),\r\n );\r\n readonly required = input<boolean>(false);\r\n\r\n icons: IconFieldOption[] = ((mtIcons?.regular as MTIcon[]) ?? []).map(\r\n (icon) => this.createIconOption(icon),\r\n );\r\n selectedIcon = signal<MTIcon | null>(null);\r\n requiredValidator = Validators.required;\r\n\r\n public ngControl = inject(NgControl, { self: true, optional: true });\r\n\r\n isInvalid = isInvalid;\r\n\r\n constructor() {\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n effect(() => {\r\n const control = this.ngControl?.control;\r\n if (control && this.required()) {\r\n control.addValidators(Validators.required);\r\n control.updateValueAndValidity();\r\n }\r\n });\r\n }\r\n\r\n protected onTouched: () => void = () => {};\r\n private onChange: (icon: MTIcon | null) => void = () => {};\r\n\r\n writeValue(value: MTIcon | null) {\r\n this.selectedIcon.set(value ?? null);\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouched = fn;\r\n }\r\n\r\n onChangeIcon(icon: MTIcon | null) {\r\n this.selectedIcon.set(icon ?? null);\r\n this.onChange(icon ?? null);\r\n }\r\n\r\n public validate(c: FormControl) {\r\n return c.errors;\r\n }\r\n\r\n getIconKey(optionOrKey: IconFieldOption | MTIcon | null): MTIcon | null {\r\n if (!optionOrKey) return null;\r\n return typeof optionOrKey === 'string' ? optionOrKey : optionOrKey.key;\r\n }\r\n\r\n getIconTooltip(optionOrKey: IconFieldOption | MTIcon | null): string {\r\n if (!optionOrKey) return '';\r\n const icon =\r\n typeof optionOrKey === 'string'\r\n ? this.icons.find((item) => item.key === optionOrKey)\r\n : optionOrKey;\r\n\r\n return icon ? `${icon.name} (${icon.key})` : String(optionOrKey);\r\n }\r\n\r\n private createIconOption(icon: MTIcon): IconFieldOption {\r\n const [categoryKey = '', iconKey = icon] = icon.split('.', 2);\r\n const keyTokens = this.tokenize(iconKey);\r\n const category = this.toTitleCase(categoryKey);\r\n const name = keyTokens.map((token) => this.toTitleCase(token)).join(' ');\r\n const aliasTokens = keyTokens.flatMap(\r\n (token) => ICON_SEARCH_ALIASES[token] ?? [],\r\n );\r\n\r\n return {\r\n key: icon,\r\n name,\r\n category,\r\n searchText: this.normalizeSearchText([\r\n icon,\r\n categoryKey,\r\n category,\r\n iconKey,\r\n name,\r\n ...keyTokens,\r\n ...aliasTokens,\r\n ]),\r\n };\r\n }\r\n\r\n private tokenize(value: string): string[] {\r\n return value\r\n .split(/[^a-zA-Z0-9]+/)\r\n .map((token) => token.trim().toLowerCase())\r\n .filter(Boolean);\r\n }\r\n\r\n private toTitleCase(value: string): string {\r\n const normalized = ICON_DISPLAY_TOKEN_LABELS[value] ?? value;\r\n return normalized\r\n .split(/[^a-zA-Z0-9]+/)\r\n .filter(Boolean)\r\n .map(\r\n (part) =>\r\n `${part.charAt(0).toUpperCase()}${part.slice(1).toLowerCase()}`,\r\n )\r\n .join(' ');\r\n }\r\n\r\n private normalizeSearchText(values: readonly string[]): string {\r\n return Array.from(\r\n new Set(\r\n values\r\n .flatMap((value) => [value, ...this.tokenize(value)])\r\n .map((value) => value.trim().toLowerCase())\r\n .filter(Boolean),\r\n ),\r\n ).join(' ');\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n (click)=\"dropdown.show(); dropdown.focus()\"\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >{{ label() }}</label\r\n >\r\n}\r\n<p-select\r\n #dropdown\r\n [options]=\"icons\"\r\n [filter]=\"true\"\r\n filterBy=\"searchText\"\r\n optionLabel=\"name\"\r\n optionValue=\"key\"\r\n dataKey=\"key\"\r\n [inputId]=\"fieldId()\"\r\n appendTo=\"body\"\r\n (onBlur)=\"onTouched()\"\r\n (ngModelChange)=\"onChangeIcon($event)\"\r\n [ngModel]=\"selectedIcon()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.iconField.selectIcon' | transloco\"\r\n styleClass=\"w-full\"\r\n panelStyleClass=\"icon-select-panel\"\r\n>\r\n <ng-template let-icon #selectedItem>\r\n @let iconKey = getIconKey(icon);\r\n @if (iconKey) {\r\n <div\r\n class=\"flex items-center justify-center text-2xl\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"iconKey\" />\r\n </div>\r\n } @else {\r\n <div class=\"flex items-center justify-center\">\r\n {{ \"components.iconField.selectIcon\" | transloco }}\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template let-icon #item>\r\n <div\r\n class=\"w-full h-full flex items-center justify-center text-lg\"\r\n [attr.aria-label]=\"getIconTooltip(icon)\"\r\n [title]=\"getIconTooltip(icon)\"\r\n [mtTooltip]=\"getIconTooltip(icon)\"\r\n tooltipPosition=\"top\"\r\n appendTo=\"body\"\r\n >\r\n <mt-icon [icon]=\"icon.key\" />\r\n </div>\r\n </ng-template>\r\n</p-select>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AA+BA,MAAM,mBAAmB,GAAsC;AAC7D,IAAA,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;AAC9B,IAAA,KAAK,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC;AAClC,IAAA,QAAQ,EAAE,CAAC,OAAO,EAAE,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SAAA,EAAA,UAAA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAA,QAAA,EAAA,SAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,IAAI,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,eAAe,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAiB,OAAO,mDAAtB,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQxD,SAAS,EAAA,UAAA,EAAA,CAAA;kBAVrB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,WAChB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,CAAC,mBAG5D,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,yxDAAA,EAAA,MAAA,EAAA,CAAA,iiBAAA,CAAA,EAAA;;;AE3EH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, inject, effect, ChangeDetectionStrategy, Component, signal, viewChild
|
|
2
|
+
import { input, inject, effect, ChangeDetectionStrategy, Component, computed, signal, viewChild } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import { HttpContext, HttpClient, HttpBackend, HttpParams } from '@angular/common/http';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
@@ -14,7 +14,7 @@ import * as i5 from 'primeng/inputgroupaddon';
|
|
|
14
14
|
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
15
15
|
import { Subject, debounceTime, tap, switchMap, take, of, finalize, catchError } from 'rxjs';
|
|
16
16
|
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
17
|
-
import { REQUEST_CONTEXT, isInvalid } from '@masterteam/components';
|
|
17
|
+
import { nextFieldId, resolveFieldId, REQUEST_CONTEXT, isInvalid } from '@masterteam/components';
|
|
18
18
|
import { Tooltip } from '@masterteam/components/tooltip';
|
|
19
19
|
import { ModalService } from '@masterteam/components/modal';
|
|
20
20
|
import { Icon } from '@masterteam/icons';
|
|
@@ -126,7 +126,7 @@ class LocationManualDialog {
|
|
|
126
126
|
}));
|
|
127
127
|
}
|
|
128
128
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationManualDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
129
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: LocationManualDialog, isStandalone: true, selector: "mt-location-manual-dialog", inputs: { initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<form\r\n [formGroup]=\"form\"\r\n [class]=\"modal.contentClass + ' flex flex-col gap-4 p-4'\"\r\n>\r\n <mt-text-field\r\n [label]=\"'components.locationField.displayName' | transloco\"\r\n [placeholder]=\"'components.locationField.displayName' | transloco\"\r\n formControlName=\"display_name\"\r\n [required]=\"true\"\r\n />\r\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\r\n <mt-number-field\r\n [label]=\"'components.locationField.longitude' | transloco\"\r\n [placeholder]=\"'components.locationField.longitude' | transloco\"\r\n [min]=\"-180\"\r\n [max]=\"180\"\r\n formControlName=\"longitude\"\r\n [required]=\"true\"\r\n />\r\n <mt-number-field\r\n [label]=\"'components.locationField.latitude' | transloco\"\r\n [placeholder]=\"'components.locationField.latitude' | transloco\"\r\n [min]=\"-90\"\r\n [max]=\"90\"\r\n formControlName=\"latitude\"\r\n [required]=\"true\"\r\n />\r\n </div>\r\n</form>\r\n\r\n<div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"'components.locationField.cancel' | transloco\"\r\n variant=\"outlined\"\r\n (onClick)=\"cancel()\"\r\n />\r\n <mt-button\r\n [label]=\"'components.locationField.save' | transloco\"\r\n severity=\"primary\"\r\n [disabled]=\"form.invalid\"\r\n (onClick)=\"save()\"\r\n />\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: LocationManualDialog, isStandalone: true, selector: "mt-location-manual-dialog", inputs: { initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<form\r\n [formGroup]=\"form\"\r\n [class]=\"modal.contentClass + ' flex flex-col gap-4 p-4'\"\r\n>\r\n <mt-text-field\r\n [label]=\"'components.locationField.displayName' | transloco\"\r\n [placeholder]=\"'components.locationField.displayName' | transloco\"\r\n formControlName=\"display_name\"\r\n [required]=\"true\"\r\n />\r\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\r\n <mt-number-field\r\n [label]=\"'components.locationField.longitude' | transloco\"\r\n [placeholder]=\"'components.locationField.longitude' | transloco\"\r\n [min]=\"-180\"\r\n [max]=\"180\"\r\n formControlName=\"longitude\"\r\n [required]=\"true\"\r\n />\r\n <mt-number-field\r\n [label]=\"'components.locationField.latitude' | transloco\"\r\n [placeholder]=\"'components.locationField.latitude' | transloco\"\r\n [min]=\"-90\"\r\n [max]=\"90\"\r\n formControlName=\"latitude\"\r\n [required]=\"true\"\r\n />\r\n </div>\r\n</form>\r\n\r\n<div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"'components.locationField.cancel' | transloco\"\r\n variant=\"outlined\"\r\n (onClick)=\"cancel()\"\r\n />\r\n <mt-button\r\n [label]=\"'components.locationField.save' | transloco\"\r\n severity=\"primary\"\r\n [disabled]=\"form.invalid\"\r\n (onClick)=\"save()\"\r\n />\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
130
130
|
}
|
|
131
131
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationManualDialog, decorators: [{
|
|
132
132
|
type: Component,
|
|
@@ -146,6 +146,10 @@ const DIRECT_NOMINATIM_HOST = 'nominatim.openstreetmap.org';
|
|
|
146
146
|
class LocationField {
|
|
147
147
|
hint = input(...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
148
148
|
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
149
|
+
/** Fallback so a control-less, label-less field never renders id="undefined". */
|
|
150
|
+
defaultFieldId = nextFieldId('mt-location-field');
|
|
151
|
+
/** Shared by the input and its <label for>. See src/lib/utils/field-id. */
|
|
152
|
+
fieldId = computed(() => resolveFieldId(this.ngControl?.name, this.label(), this.defaultFieldId), ...(ngDevMode ? [{ debugName: "fieldId" }] : /* istanbul ignore next */ []));
|
|
149
153
|
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
150
154
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
151
155
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
@@ -577,7 +581,7 @@ class LocationField {
|
|
|
577
581
|
return normalized === 'places/search';
|
|
578
582
|
}
|
|
579
583
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
580
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: LocationField, isStandalone: true, selector: "mt-location-field", inputs: { hint: { classPropertyName: "hint", publicName: "hint", 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 }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, searchUrl: { classPropertyName: "searchUrl", publicName: "searchUrl", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "autocomplete", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (label() || hint()) {\r\n <div class=\"mb-1 flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"
|
|
584
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: LocationField, isStandalone: true, selector: "mt-location-field", inputs: { hint: { classPropertyName: "hint", publicName: "hint", 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 }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, searchUrl: { classPropertyName: "searchUrl", publicName: "searchUrl", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "autocomplete", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (label() || hint()) {\r\n <div class=\"mb-1 flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n }\r\n @if (hint()) {\r\n <span\r\n class=\"inline-flex text-surface-400\"\r\n [mtTooltip]=\"hint()\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n}\r\n\r\n<div class=\"relative\">\r\n <p-inputgroup>\r\n <p-autoComplete\r\n #autocomplete=\"\"\r\n [suggestions]=\"suggestions()\"\r\n (completeMethod)=\"search($event)\"\r\n (onSelect)=\"onSelect($event)\"\r\n (onClear)=\"onClear()\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\"\r\n [ngModel]=\"value()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"fieldId()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.locationField.search' | transloco\"\r\n [optionLabel]=\"'display_name'\"\r\n [minLength]=\"minLength()\"\r\n [showEmptyMessage]=\"false\"\r\n class=\"w-full\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n >\r\n <ng-template let-location pTemplate=\"item\">\r\n <div\r\n class=\"flex min-w-0 items-start gap-2\"\r\n (pointerdown)=\"onSuggestionPointerDown()\"\r\n >\r\n <mt-icon icon=\"map.marker-pin-01\" class=\"mt-0.5 shrink-0 text-xl\" />\r\n <span class=\"min-w-0 text-wrap text-sm leading-5\">\r\n {{ location.display_name }}\r\n </span>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template let-location pTemplate=\"selecteditem\">\r\n <span class=\"min-w-0 truncate\">{{ location?.display_name }}</span>\r\n </ng-template>\r\n </p-autoComplete>\r\n\r\n @if (loading()) {\r\n <p-inputgroup-addon>\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"animate-spin text-surface-500\"\r\n />\r\n </p-inputgroup-addon>\r\n }\r\n\r\n <p-inputgroup-addon>\r\n <button\r\n type=\"button\"\r\n class=\"inline-flex h-full items-center justify-center text-surface-500 transition-colors hover:text-primary-500 disabled:cursor-not-allowed disabled:opacity-50\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [mtTooltip]=\"'components.locationField.enterManually' | transloco\"\r\n tooltipPosition=\"top\"\r\n (click)=\"openManualDialog()\"\r\n >\r\n <mt-icon icon=\"general.edit-03\" />\r\n </button>\r\n </p-inputgroup-addon>\r\n </p-inputgroup>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\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: AutoCompleteModule }, { kind: "component", type: i2.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i4.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["styleClass"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i5.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
581
585
|
}
|
|
582
586
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, decorators: [{
|
|
583
587
|
type: Component,
|
|
@@ -592,7 +596,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
592
596
|
TranslocoPipe,
|
|
593
597
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
594
598
|
class: 'grid gap-1',
|
|
595
|
-
}, template: "@if (label() || hint()) {\r\n <div class=\"mb-1 flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"
|
|
599
|
+
}, template: "@if (label() || hint()) {\r\n <div class=\"mb-1 flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n }\r\n @if (hint()) {\r\n <span\r\n class=\"inline-flex text-surface-400\"\r\n [mtTooltip]=\"hint()\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n}\r\n\r\n<div class=\"relative\">\r\n <p-inputgroup>\r\n <p-autoComplete\r\n #autocomplete=\"\"\r\n [suggestions]=\"suggestions()\"\r\n (completeMethod)=\"search($event)\"\r\n (onSelect)=\"onSelect($event)\"\r\n (onClear)=\"onClear()\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\"\r\n [ngModel]=\"value()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"fieldId()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.locationField.search' | transloco\"\r\n [optionLabel]=\"'display_name'\"\r\n [minLength]=\"minLength()\"\r\n [showEmptyMessage]=\"false\"\r\n class=\"w-full\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n >\r\n <ng-template let-location pTemplate=\"item\">\r\n <div\r\n class=\"flex min-w-0 items-start gap-2\"\r\n (pointerdown)=\"onSuggestionPointerDown()\"\r\n >\r\n <mt-icon icon=\"map.marker-pin-01\" class=\"mt-0.5 shrink-0 text-xl\" />\r\n <span class=\"min-w-0 text-wrap text-sm leading-5\">\r\n {{ location.display_name }}\r\n </span>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template let-location pTemplate=\"selecteditem\">\r\n <span class=\"min-w-0 truncate\">{{ location?.display_name }}</span>\r\n </ng-template>\r\n </p-autoComplete>\r\n\r\n @if (loading()) {\r\n <p-inputgroup-addon>\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"animate-spin text-surface-500\"\r\n />\r\n </p-inputgroup-addon>\r\n }\r\n\r\n <p-inputgroup-addon>\r\n <button\r\n type=\"button\"\r\n class=\"inline-flex h-full items-center justify-center text-surface-500 transition-colors hover:text-primary-500 disabled:cursor-not-allowed disabled:opacity-50\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [mtTooltip]=\"'components.locationField.enterManually' | transloco\"\r\n tooltipPosition=\"top\"\r\n (click)=\"openManualDialog()\"\r\n >\r\n <mt-icon icon=\"general.edit-03\" />\r\n </button>\r\n </p-inputgroup-addon>\r\n </p-inputgroup>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n" }]
|
|
596
600
|
}], ctorParameters: () => [], propDecorators: { hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], searchUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchUrl", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }], autocomplete: [{ type: i0.ViewChild, args: ['autocomplete', { isSignal: true }] }] } });
|
|
597
601
|
|
|
598
602
|
/**
|