@masterteam/components 0.0.199 → 0.0.201
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/fesm2022/masterteam-components-business-fields.mjs +7 -5
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-card.mjs +2 -2
- package/fesm2022/masterteam-components-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +7 -4
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +76 -34
- package/fesm2022/masterteam-components-location-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-table.mjs +1 -1
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +6 -1
- package/types/masterteam-components-date-field.d.ts +3 -1
- package/types/masterteam-components-entities.d.ts +1 -1
- package/types/masterteam-components-location-field.d.ts +28 -4
|
@@ -11,12 +11,12 @@ class Card {
|
|
|
11
11
|
headless = contentChild('headless', ...(ngDevMode ? [{ debugName: "headless" }] : /* istanbul ignore next */ []));
|
|
12
12
|
cardEnd = contentChild('cardEnd', ...(ngDevMode ? [{ debugName: "cardEnd" }] : /* istanbul ignore next */ []));
|
|
13
13
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Card, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Card, isStandalone: true, selector: "mt-card", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, paddingless: { classPropertyName: "paddingless", publicName: "paddingless", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block bg-content rounded-lg border-1 border-surface
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Card, isStandalone: true, selector: "mt-card", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, paddingless: { classPropertyName: "paddingless", publicName: "paddingless", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block bg-content rounded-lg border-1 border-surface" }, queries: [{ propertyName: "headless", first: true, predicate: ["headless"], descendants: true, isSignal: true }, { propertyName: "cardEnd", first: true, predicate: ["cardEnd"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"size-full flex flex-col\">\r\n @if (headless()) {\r\n <!-- Custom headless template -->\r\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\r\n } @else {\r\n @if (title() || cardEnd()) {\r\n <!-- Default header with dynamic title -->\r\n <div\r\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\r\n >\r\n @if (title()) {\r\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\r\n }\r\n @if (cardEnd()) {\r\n <div class=\"flex\">\r\n <ng-container [ngTemplateOutlet]=\"cardEnd()\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"flex-1 min-h-0\" [class.p-4]=\"!paddingless()\">\r\n <ng-content></ng-content>\r\n </div>\r\n }\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
15
15
|
}
|
|
16
16
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Card, decorators: [{
|
|
17
17
|
type: Component,
|
|
18
18
|
args: [{ selector: 'mt-card', standalone: true, imports: [CommonModule], host: {
|
|
19
|
-
class: 'block bg-content rounded-lg border-1 border-surface
|
|
19
|
+
class: 'block bg-content rounded-lg border-1 border-surface',
|
|
20
20
|
}, template: "<div class=\"size-full flex flex-col\">\r\n @if (headless()) {\r\n <!-- Custom headless template -->\r\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\r\n } @else {\r\n @if (title() || cardEnd()) {\r\n <!-- Default header with dynamic title -->\r\n <div\r\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\r\n >\r\n @if (title()) {\r\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\r\n }\r\n @if (cardEnd()) {\r\n <div class=\"flex\">\r\n <ng-container [ngTemplateOutlet]=\"cardEnd()\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"flex-1 min-h-0\" [class.p-4]=\"!paddingless()\">\r\n <ng-content></ng-content>\r\n </div>\r\n }\r\n</div>\r\n" }]
|
|
21
21
|
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], paddingless: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingless", required: false }] }], headless: [{ type: i0.ContentChild, args: ['headless', { isSignal: true }] }], cardEnd: [{ type: i0.ContentChild, args: ['cardEnd', { isSignal: true }] }] } });
|
|
22
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-card.mjs","sources":["../../../../packages/masterteam/components/card/card.ts","../../../../packages/masterteam/components/card/card.html","../../../../packages/masterteam/components/card/masterteam-components-card.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n Component,\r\n input,\r\n contentChild,\r\n TemplateRef,\r\n booleanAttribute,\r\n} from '@angular/core';\r\n\r\n@Component({\r\n selector: 'mt-card',\r\n standalone: true,\r\n templateUrl: './card.html',\r\n styleUrl: './card.scss',\r\n imports: [CommonModule],\r\n host: {\r\n class
|
|
1
|
+
{"version":3,"file":"masterteam-components-card.mjs","sources":["../../../../packages/masterteam/components/card/card.ts","../../../../packages/masterteam/components/card/card.html","../../../../packages/masterteam/components/card/masterteam-components-card.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n Component,\r\n input,\r\n contentChild,\r\n TemplateRef,\r\n booleanAttribute,\r\n} from '@angular/core';\r\n\r\n@Component({\r\n selector: 'mt-card',\r\n standalone: true,\r\n templateUrl: './card.html',\r\n styleUrl: './card.scss',\r\n imports: [CommonModule],\r\n host: {\r\n class: 'block bg-content rounded-lg border-1 border-surface',\r\n },\r\n})\r\nexport class Card {\r\n readonly class = input<string>('');\r\n readonly title = input<string>('');\r\n readonly paddingless = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n // Content child to get the headless template\r\n headless = contentChild<TemplateRef<any>>('headless');\r\n cardEnd = contentChild<TemplateRef<any>>('cardEnd');\r\n}\r\n","<div class=\"size-full flex flex-col\">\r\n @if (headless()) {\r\n <!-- Custom headless template -->\r\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\r\n } @else {\r\n @if (title() || cardEnd()) {\r\n <!-- Default header with dynamic title -->\r\n <div\r\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\r\n >\r\n @if (title()) {\r\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\r\n }\r\n @if (cardEnd()) {\r\n <div class=\"flex\">\r\n <ng-container [ngTemplateOutlet]=\"cardEnd()\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"flex-1 min-h-0\" [class.p-4]=\"!paddingless()\">\r\n <ng-content></ng-content>\r\n </div>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,IAAI,CAAA;AACN,IAAA,KAAK,GAAG,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A,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,UAAU,oEACX,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3BpD;;AAEG;;;;"}
|
|
@@ -3,6 +3,7 @@ import { input, signal, inject, effect, HostBinding, ViewChild, ChangeDetectionS
|
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { Validators, NgControl, FormsModule } from '@angular/forms';
|
|
5
5
|
import { Tooltip } from '@masterteam/components/tooltip';
|
|
6
|
+
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
6
7
|
import * as i2 from 'primeng/datepicker';
|
|
7
8
|
import { DatePickerModule } from 'primeng/datepicker';
|
|
8
9
|
import { isInvalid } from '@masterteam/components';
|
|
@@ -19,6 +20,8 @@ class DateField {
|
|
|
19
20
|
showIcon = input(true, ...(ngDevMode ? [{ debugName: "showIcon" }] : /* istanbul ignore next */ []));
|
|
20
21
|
showClear = input(false, ...(ngDevMode ? [{ debugName: "showClear" }] : /* istanbul ignore next */ []));
|
|
21
22
|
showTime = input(false, ...(ngDevMode ? [{ debugName: "showTime" }] : /* istanbul ignore next */ []));
|
|
23
|
+
minDate = input(...(ngDevMode ? [undefined, { debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
24
|
+
maxDate = input(...(ngDevMode ? [undefined, { debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
22
25
|
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : /* istanbul ignore next */ []));
|
|
23
26
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
24
27
|
rtl = signal(document.documentElement.dir === 'rtl', ...(ngDevMode ? [{ debugName: "rtl" }] : /* istanbul ignore next */ []));
|
|
@@ -81,17 +84,17 @@ class DateField {
|
|
|
81
84
|
this.disabled.set(disabled);
|
|
82
85
|
}
|
|
83
86
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DateField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
84
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DateField, isStandalone: true, selector: "mt-date-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, 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 }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\r\n\r\n
|
|
87
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DateField, isStandalone: true, selector: "mt-date-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, 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 }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n [minDate]=\"minDate()\"\r\n [maxDate]=\"maxDate()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\r\n\r\n@if (ngControl) {\r\n <mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n}\r\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: DatePickerModule }, { kind: "component", type: i2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
85
88
|
}
|
|
86
89
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DateField, decorators: [{
|
|
87
90
|
type: Component,
|
|
88
|
-
args: [{ selector: 'mt-date-field', standalone: true, imports: [FormsModule, DatePickerModule, Tooltip, Icon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
91
|
+
args: [{ selector: 'mt-date-field', standalone: true, imports: [FormsModule, DatePickerModule, Tooltip, Icon, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
89
92
|
class: 'grid gap-1',
|
|
90
|
-
}, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\r\n\r\n
|
|
93
|
+
}, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n [minDate]=\"minDate()\"\r\n [maxDate]=\"maxDate()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\r\n\r\n@if (ngControl) {\r\n <mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n}\r\n" }]
|
|
91
94
|
}], ctorParameters: () => [], propDecorators: { calendar: [{
|
|
92
95
|
type: ViewChild,
|
|
93
96
|
args: ['calendar', { static: true }]
|
|
94
|
-
}], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], 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 }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], pInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pInputs", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], styleClass: [{
|
|
97
|
+
}], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], 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 }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], pInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pInputs", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], styleClass: [{
|
|
95
98
|
type: HostBinding,
|
|
96
99
|
args: ['class']
|
|
97
100
|
}] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-date-field.mjs","sources":["../../../../packages/masterteam/components/date-field/date-field.ts","../../../../packages/masterteam/components/date-field/date-field.html","../../../../packages/masterteam/components/date-field/masterteam-components-date-field.ts"],"sourcesContent":["import {\r\n Component,\r\n HostBinding,\r\n OnChanges,\r\n OnInit,\r\n SimpleChanges,\r\n ViewChild,\r\n signal,\r\n input,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { DatePickerModule, DatePicker } from 'primeng/datepicker';\r\nimport { isInvalid } from '@masterteam/components';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\n@Component({\r\n selector: 'mt-date-field',\r\n standalone: true,\r\n imports: [FormsModule, DatePickerModule, Tooltip, Icon],\r\n templateUrl: './date-field.html',\r\n styleUrls: ['./date-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class DateField implements ControlValueAccessor, OnInit, OnChanges {\r\n @ViewChild('calendar', { static: true })\r\n calendar: DatePicker;\r\n\r\n readonly field = input<boolean>(true);\r\n readonly hint = input<string>();\r\n readonly label = input<string>();\r\n readonly placeholder = input<string>();\r\n readonly class = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly showIcon = input<boolean>(true);\r\n readonly showClear = input<boolean>(false);\r\n readonly showTime = input<boolean>(false);\r\n readonly pInputs = input<Partial<DatePicker>>();\r\n readonly required = input<boolean>(false);\r\n\r\n rtl = signal<boolean>(document.documentElement.dir === 'rtl');\r\n\r\n @HostBinding('class') styleClass: string;\r\n\r\n requiredValidator = Validators.required;\r\n value = signal<Date | string | null>(null);\r\n disabled = signal<boolean>(false);\r\n\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: Date | string | null) => void = () => {};\r\n\r\n public ngControl = inject(NgControl, { self: 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 if (this.ngControl.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n }\r\n\r\n applyInputsToCalendar() {\r\n Object.assign(this.calendar, this.pInputs());\r\n }\r\n\r\n ngOnInit() {\r\n this.styleClass = this.class();\r\n if (this.pInputs()) {\r\n this.applyInputsToCalendar();\r\n }\r\n }\r\n onValueChange(value: Date | string | null) {\r\n this.onModelChange(value);\r\n this.value.set(value);\r\n }\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (changes['pInputs']) {\r\n this.applyInputsToCalendar();\r\n }\r\n }\r\n\r\n writeValue(value: Date | string | null) {\r\n if (value == null || value === '') {\r\n this.value.set(null);\r\n return;\r\n }\r\n if (typeof value === 'string') {\r\n const parsed = new Date(value);\r\n this.value.set(isNaN(parsed.getTime()) ? null : parsed);\r\n return;\r\n }\r\n this.value.set(value);\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean) {\r\n this.disabled.set(disabled);\r\n }\r\n}\r\n","@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\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":";;;;;;;;;;MAmCa,SAAS,CAAA;AAEpB,IAAA,QAAQ;AAEC,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,4EAAC;IAC5B,IAAI,GAAG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AA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,EAAA,QAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,SAAA,EAAA,cAAA,EAAA,cAAA,EAAA,eAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,OAAO,EAAA,QAAA,EAAA,aAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,IAAI,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQ3C,SAAS,EAAA,UAAA,EAAA,CAAA;kBAXrB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,cACb,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAA,eAAA,EAGtC,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,okDAAA,EAAA;;sBAGA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAiBtC,WAAW;uBAAC,OAAO;;;AErDtB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"masterteam-components-date-field.mjs","sources":["../../../../packages/masterteam/components/date-field/date-field.ts","../../../../packages/masterteam/components/date-field/date-field.html","../../../../packages/masterteam/components/date-field/masterteam-components-date-field.ts"],"sourcesContent":["import {\r\n Component,\r\n HostBinding,\r\n OnChanges,\r\n OnInit,\r\n SimpleChanges,\r\n ViewChild,\r\n signal,\r\n input,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { DatePickerModule, DatePicker } from 'primeng/datepicker';\r\nimport { isInvalid } from '@masterteam/components';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\n@Component({\r\n selector: 'mt-date-field',\r\n standalone: true,\r\n imports: [FormsModule, DatePickerModule, Tooltip, Icon, FieldValidation],\r\n templateUrl: './date-field.html',\r\n styleUrls: ['./date-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class DateField implements ControlValueAccessor, OnInit, OnChanges {\r\n @ViewChild('calendar', { static: true })\r\n calendar: DatePicker;\r\n\r\n readonly field = input<boolean>(true);\r\n readonly hint = input<string>();\r\n readonly label = input<string>();\r\n readonly placeholder = input<string>();\r\n readonly class = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly showIcon = input<boolean>(true);\r\n readonly showClear = input<boolean>(false);\r\n readonly showTime = input<boolean>(false);\r\n readonly minDate = input<Date | null | undefined>();\r\n readonly maxDate = input<Date | null | undefined>();\r\n readonly pInputs = input<Partial<DatePicker>>();\r\n readonly required = input<boolean>(false);\r\n\r\n rtl = signal<boolean>(document.documentElement.dir === 'rtl');\r\n\r\n @HostBinding('class') styleClass: string;\r\n\r\n requiredValidator = Validators.required;\r\n value = signal<Date | string | null>(null);\r\n disabled = signal<boolean>(false);\r\n\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: Date | string | null) => void = () => {};\r\n\r\n public ngControl = inject(NgControl, { self: 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 if (this.ngControl.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n }\r\n\r\n applyInputsToCalendar() {\r\n Object.assign(this.calendar, this.pInputs());\r\n }\r\n\r\n ngOnInit() {\r\n this.styleClass = this.class();\r\n if (this.pInputs()) {\r\n this.applyInputsToCalendar();\r\n }\r\n }\r\n onValueChange(value: Date | string | null) {\r\n this.onModelChange(value);\r\n this.value.set(value);\r\n }\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (changes['pInputs']) {\r\n this.applyInputsToCalendar();\r\n }\r\n }\r\n\r\n writeValue(value: Date | string | null) {\r\n if (value == null || value === '') {\r\n this.value.set(null);\r\n return;\r\n }\r\n if (typeof value === 'string') {\r\n const parsed = new Date(value);\r\n this.value.set(isNaN(parsed.getTime()) ? null : parsed);\r\n return;\r\n }\r\n this.value.set(value);\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean) {\r\n this.disabled.set(disabled);\r\n }\r\n}\r\n","@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\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<p-datepicker\r\n #calendar\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (onBlur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [baseZIndex]=\"1051\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n inputStyleClass=\"w-full\"\r\n [showIcon]=\"showIcon()\"\r\n [showClear]=\"showClear()\"\r\n [showTime]=\"showTime()\"\r\n [minDate]=\"minDate()\"\r\n [maxDate]=\"maxDate()\"\r\n dateFormat=\"dd/mm/yy\"\r\n appendTo=\"body\"\r\n>\r\n <ng-template #previousicon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-right' : 'arrow.chevron-left'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n <ng-template #nexticon>\r\n <mt-icon\r\n [icon]=\"rtl() ? 'arrow.chevron-left' : 'arrow.chevron-right'\"\r\n class=\"text-2xl\"\r\n />\r\n </ng-template>\r\n</p-datepicker>\r\n\r\n@if (ngControl) {\r\n <mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAoCa,SAAS,CAAA;AAEpB,IAAA,QAAQ;AAEC,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,4EAAC;IAC5B,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACtB,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACvB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAChC,IAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,+EAAC;AA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AGvD,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,ipDAAA,EAAA;;sBAGA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAmBtC,WAAW;uBAAC,OAAO;;;AExDtB;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, inject, effect, ChangeDetectionStrategy, Component, signal, viewChild, computed } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { HttpContext, HttpClient, HttpParams } from '@angular/common/http';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormControl, Validators, ReactiveFormsModule, NgControl, FormsModule } from '@angular/forms';
|
|
7
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -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 { isInvalid } from '@masterteam/components';
|
|
17
|
+
import { 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';
|
|
@@ -150,19 +150,32 @@ class LocationField {
|
|
|
150
150
|
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
151
151
|
minLength = input(2, ...(ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []));
|
|
152
152
|
configuration = input(null, ...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
153
|
-
|
|
153
|
+
/** Gateway places-search endpoint. Resolved through the app's HTTP
|
|
154
|
+
* interceptor, which attaches the gateway base URL and session token. */
|
|
155
|
+
searchUrl = input('places/search', ...(ngDevMode ? [{ debugName: "searchUrl" }] : /* istanbul ignore next */ []));
|
|
156
|
+
/** HTTP context the consuming app uses to route this call to gateway scope
|
|
157
|
+
* (so the GatewaySession bearer token is attached). */
|
|
158
|
+
context = input(undefined, ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
159
|
+
/** Default routing context when the consumer doesn't pass one: route the
|
|
160
|
+
* places search to the gateway API base (not the per-application base) so it
|
|
161
|
+
* resolves to `{gatewayApiBaseUrl}/places/search` with the GatewaySession
|
|
162
|
+
* bearer token. The app's gateway-auth interceptor reads
|
|
163
|
+
* `REQUEST_CONTEXT.useBaseUrl` to pick the gateway base + token. */
|
|
164
|
+
gatewayRequestContext = new HttpContext().set(REQUEST_CONTEXT, { useBaseUrl: true });
|
|
154
165
|
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
155
166
|
suggestions = signal([], ...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
|
|
167
|
+
attribution = signal('', ...(ngDevMode ? [{ debugName: "attribution" }] : /* istanbul ignore next */ []));
|
|
156
168
|
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
157
169
|
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
158
170
|
requiredValidator = Validators.required;
|
|
159
171
|
autocomplete = viewChild('autocomplete', ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
160
172
|
displayValue = computed(() => getLocationDisplayName(this.value()), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
161
173
|
resolvedSearchUrl = computed(() => {
|
|
162
|
-
const
|
|
174
|
+
const config = this.configuration();
|
|
175
|
+
const configuredUrl = config?.searchUrl ?? config?.nominatimBaseUrl;
|
|
163
176
|
return typeof configuredUrl === 'string' && configuredUrl.trim()
|
|
164
177
|
? configuredUrl
|
|
165
|
-
: (this.searchUrl() ?? '
|
|
178
|
+
: (this.searchUrl() ?? 'places/search');
|
|
166
179
|
}, ...(ngDevMode ? [{ debugName: "resolvedSearchUrl" }] : /* istanbul ignore next */ []));
|
|
167
180
|
countryName = computed(() => {
|
|
168
181
|
const country = this.configuration()?.country;
|
|
@@ -176,23 +189,12 @@ class LocationField {
|
|
|
176
189
|
return country?.code?.trim() ?? '';
|
|
177
190
|
return '';
|
|
178
191
|
}, ...(ngDevMode ? [{ debugName: "countryCode" }] : /* istanbul ignore next */ []));
|
|
179
|
-
viewBox = computed(() => {
|
|
180
|
-
const config = this.configuration();
|
|
181
|
-
const country = config?.country;
|
|
182
|
-
if (typeof config?.viewBox === 'string' && config.viewBox.trim()) {
|
|
183
|
-
return config.viewBox;
|
|
184
|
-
}
|
|
185
|
-
if (typeof country === 'object' && country?.viewBox?.trim()) {
|
|
186
|
-
return country.viewBox;
|
|
187
|
-
}
|
|
188
|
-
return '';
|
|
189
|
-
}, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
190
192
|
ngControl = null;
|
|
191
193
|
isInvalid = isInvalid;
|
|
192
194
|
modal = inject(ModalService);
|
|
193
195
|
transloco = inject(TranslocoService);
|
|
194
196
|
document = inject(DOCUMENT);
|
|
195
|
-
http =
|
|
197
|
+
http = inject(HttpClient);
|
|
196
198
|
searchTerms = new Subject();
|
|
197
199
|
/**
|
|
198
200
|
* Bumped every time a value is committed (select / manual entry / clear /
|
|
@@ -232,12 +234,21 @@ class LocationField {
|
|
|
232
234
|
return;
|
|
233
235
|
}
|
|
234
236
|
this.suggestions.set(items);
|
|
237
|
+
if (items.length) {
|
|
238
|
+
queueMicrotask(() => this.autocomplete()?.show());
|
|
239
|
+
}
|
|
235
240
|
});
|
|
236
241
|
}
|
|
237
242
|
ngOnDestroy() {
|
|
238
243
|
this.cancelPendingBlurCleanup();
|
|
239
244
|
this.document.removeEventListener('pointerdown', this.handleDocumentPointerDown, true);
|
|
240
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Fired by PrimeNG on every keystroke. The Gateway places provider forbids
|
|
248
|
+
* autocomplete/typeahead, so typing only tracks the pending text — it does
|
|
249
|
+
* NOT hit the network. The request is sent on explicit submit
|
|
250
|
+
* (`submitSearch` via the search button / Enter).
|
|
251
|
+
*/
|
|
241
252
|
search(event) {
|
|
242
253
|
this.inputFocused = true;
|
|
243
254
|
this.ignoreSearchResultsUntilNextSearch = false;
|
|
@@ -245,6 +256,23 @@ class LocationField {
|
|
|
245
256
|
const trimmed = query.trim();
|
|
246
257
|
const committedName = getLocationDisplayName(this.value()).trim();
|
|
247
258
|
this.hasUncommittedSearchText = !!trimmed && committedName !== trimmed;
|
|
259
|
+
}
|
|
260
|
+
/** Run the search on explicit user submit (search button or Enter). */
|
|
261
|
+
submitSearch() {
|
|
262
|
+
const autocomplete = this.autocomplete();
|
|
263
|
+
if (!autocomplete || this.disabled() || this.readonly())
|
|
264
|
+
return;
|
|
265
|
+
// Let PrimeNG handle Enter as "pick the highlighted suggestion" when a
|
|
266
|
+
// result list is already open; only submit a fresh search otherwise.
|
|
267
|
+
if (this.suggestions().length)
|
|
268
|
+
return;
|
|
269
|
+
const inputEl = this.getInputElement(autocomplete);
|
|
270
|
+
const query = (inputEl?.value ?? '').trim();
|
|
271
|
+
if (query.length < this.minLength())
|
|
272
|
+
return;
|
|
273
|
+
this.inputFocused = true;
|
|
274
|
+
this.ignoreSearchResultsUntilNextSearch = false;
|
|
275
|
+
this.hasUncommittedSearchText = true;
|
|
248
276
|
this.searchTerms.next(query);
|
|
249
277
|
}
|
|
250
278
|
onFocus() {
|
|
@@ -301,6 +329,7 @@ class LocationField {
|
|
|
301
329
|
this.hasUncommittedSearchText = false;
|
|
302
330
|
this.commitValue(null);
|
|
303
331
|
this.suggestions.set([]);
|
|
332
|
+
this.attribution.set('');
|
|
304
333
|
this.loading.set(false);
|
|
305
334
|
}
|
|
306
335
|
onSuggestionPointerDown() {
|
|
@@ -430,27 +459,40 @@ class LocationField {
|
|
|
430
459
|
: trimmed;
|
|
431
460
|
let params = new HttpParams()
|
|
432
461
|
.set('q', query)
|
|
433
|
-
.set('
|
|
434
|
-
.set('
|
|
435
|
-
.set('limit', '10')
|
|
436
|
-
.set('accept-language', this.transloco.getActiveLang() || 'en');
|
|
437
|
-
const viewBox = this.viewBox();
|
|
438
|
-
if (viewBox) {
|
|
439
|
-
params = params.set('bounded', '1').set('viewbox', viewBox);
|
|
440
|
-
}
|
|
462
|
+
.set('language', this.transloco.getActiveLang() || 'en')
|
|
463
|
+
.set('limit', '10');
|
|
441
464
|
const countryCode = this.countryCode();
|
|
442
465
|
if (countryCode) {
|
|
443
|
-
params = params.set('
|
|
466
|
+
params = params.set('countryCodes', countryCode.toLowerCase());
|
|
444
467
|
}
|
|
445
|
-
return this.http
|
|
468
|
+
return this.http
|
|
469
|
+
.get(this.resolvedSearchUrl(), {
|
|
470
|
+
params,
|
|
471
|
+
context: this.context() ?? this.gatewayRequestContext,
|
|
472
|
+
})
|
|
473
|
+
.pipe(finalize(() => this.loading.set(false)), catchError((error) => {
|
|
446
474
|
console.error('Location search failed:', error);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
.
|
|
475
|
+
this.attribution.set('');
|
|
476
|
+
return of({ data: { items: [] } });
|
|
477
|
+
}), switchMap((response) => {
|
|
478
|
+
this.attribution.set(response?.data?.attribution?.trim() ?? '');
|
|
479
|
+
const items = response?.data?.items ?? [];
|
|
480
|
+
return of(items
|
|
481
|
+
.map((item) => normalizeLocationValue(this.toLocationValue(item)))
|
|
482
|
+
.filter((item) => item !== null));
|
|
483
|
+
}));
|
|
484
|
+
}
|
|
485
|
+
/** Map a Gateway places item onto the shape `normalizeLocationValue` reads
|
|
486
|
+
* (it expects `lat`/`lon`, the gateway returns `latitude`/`longitude`). */
|
|
487
|
+
toLocationValue(item) {
|
|
488
|
+
return {
|
|
489
|
+
...item,
|
|
490
|
+
lat: item.latitude,
|
|
491
|
+
lon: item.longitude,
|
|
492
|
+
};
|
|
451
493
|
}
|
|
452
494
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
453
|
-
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 } }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "autocomplete", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (label() || hint()) {\n <div class=\"mb-1 flex items-center gap-1\">\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >\n {{ label() }}\n </label>\n }\n @if (hint()) {\n <span\n class=\"inline-flex text-surface-400\"\n [mtTooltip]=\"hint()\"\n tooltipPosition=\"top\"\n >\n <mt-icon icon=\"general.help-circle\" />\n </span>\n }\n </div>\n}\n\n<div class=\"relative\">\n <p-inputgroup>\n <p-autoComplete\n #autocomplete=\"\"\n [suggestions]=\"suggestions()\"\n (completeMethod)=\"search($event)\"\n (onSelect)=\"onSelect($event)\"\n (onClear)=\"onClear()\"\n (onFocus)=\"onFocus()\"\n (onBlur)=\"onBlur()\"\n [ngModel]=\"value()\"\n [disabled]=\"disabled() || readonly()\"\n [id]=\"ngControl?.name || label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n [placeholder]=\"'components.locationField.search' | transloco\"\n [optionLabel]=\"'display_name'\"\n [minLength]=\"minLength()\"\n class=\"w-full\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n >\n <ng-template let-location pTemplate=\"item\">\n <div\n class=\"flex min-w-0 items-start gap-2\"\n (pointerdown)=\"onSuggestionPointerDown()\"\n >\n <mt-icon icon=\"map.marker-pin-01\" class=\"mt-0.5 shrink-0 text-xl\" />\n <span class=\"min-w-0 text-wrap text-sm leading-5\">\n {{ location.display_name }}\n </span>\n </div>\n </ng-template>\n\n <ng-template let-location pTemplate=\"selecteditem\">\n <span class=\"min-w-0 truncate\">{{ location?.display_name }}</span>\n </ng-template>\n </p-autoComplete>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\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\"\n [disabled]=\"disabled() || readonly()\"\n [mtTooltip]=\"'components.locationField.enterManually' | transloco\"\n tooltipPosition=\"top\"\n (click)=\"openManualDialog()\"\n >\n <mt-icon icon=\"general.edit-03\" />\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n\n @if (loading()) {\n <mt-icon\n icon=\"general.loading-01\"\n class=\"absolute end-
|
|
495
|
+
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]=\"ngControl?.name || label()\"\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]=\"ngControl?.name || label()\"\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 (keydown.enter)=\"submitSearch()\"\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 <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.search' | transloco\"\r\n tooltipPosition=\"top\"\r\n (click)=\"submitSearch()\"\r\n >\r\n <mt-icon icon=\"general.search-md\" />\r\n </button>\r\n </p-inputgroup-addon>\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\r\n @if (loading()) {\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"absolute end-24 top-1/2 -translate-y-1/2 animate-spin bg-white\"\r\n />\r\n }\r\n</div>\r\n\r\n@if (attribution()) {\r\n <span class=\"text-xs text-surface-400\">{{ attribution() }}</span>\r\n}\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"] }, { 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 });
|
|
454
496
|
}
|
|
455
497
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, decorators: [{
|
|
456
498
|
type: Component,
|
|
@@ -465,8 +507,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
465
507
|
TranslocoPipe,
|
|
466
508
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
467
509
|
class: 'grid gap-1',
|
|
468
|
-
}, template: "@if (label() || hint()) {\n <div class=\"mb-1 flex items-center gap-1\">\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >\n {{ label() }}\n </label>\n }\n @if (hint()) {\n <span\n class=\"inline-flex text-surface-400\"\n [mtTooltip]=\"hint()\"\n tooltipPosition=\"top\"\n >\n <mt-icon icon=\"general.help-circle\" />\n </span>\n }\n </div>\n}\n\n<div class=\"relative\">\n <p-inputgroup>\n <p-autoComplete\n #autocomplete=\"\"\n [suggestions]=\"suggestions()\"\n (completeMethod)=\"search($event)\"\n (onSelect)=\"onSelect($event)\"\n (onClear)=\"onClear()\"\n (onFocus)=\"onFocus()\"\n (onBlur)=\"onBlur()\"\n [ngModel]=\"value()\"\n [disabled]=\"disabled() || readonly()\"\n [id]=\"ngControl?.name || label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n [placeholder]=\"'components.locationField.search' | transloco\"\n [optionLabel]=\"'display_name'\"\n [minLength]=\"minLength()\"\n class=\"w-full\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n >\n <ng-template let-location pTemplate=\"item\">\n <div\n class=\"flex min-w-0 items-start gap-2\"\n (pointerdown)=\"onSuggestionPointerDown()\"\n >\n <mt-icon icon=\"map.marker-pin-01\" class=\"mt-0.5 shrink-0 text-xl\" />\n <span class=\"min-w-0 text-wrap text-sm leading-5\">\n {{ location.display_name }}\n </span>\n </div>\n </ng-template>\n\n <ng-template let-location pTemplate=\"selecteditem\">\n <span class=\"min-w-0 truncate\">{{ location?.display_name }}</span>\n </ng-template>\n </p-autoComplete>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\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\"\n [disabled]=\"disabled() || readonly()\"\n [mtTooltip]=\"'components.locationField.enterManually' | transloco\"\n tooltipPosition=\"top\"\n (click)=\"openManualDialog()\"\n >\n <mt-icon icon=\"general.edit-03\" />\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n\n @if (loading()) {\n <mt-icon\n icon=\"general.loading-01\"\n class=\"absolute end-
|
|
469
|
-
}], 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 }] }], autocomplete: [{ type: i0.ViewChild, args: ['autocomplete', { isSignal: true }] }] } });
|
|
510
|
+
}, 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]=\"ngControl?.name || label()\"\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]=\"ngControl?.name || label()\"\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 (keydown.enter)=\"submitSearch()\"\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 <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.search' | transloco\"\r\n tooltipPosition=\"top\"\r\n (click)=\"submitSearch()\"\r\n >\r\n <mt-icon icon=\"general.search-md\" />\r\n </button>\r\n </p-inputgroup-addon>\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\r\n @if (loading()) {\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"absolute end-24 top-1/2 -translate-y-1/2 animate-spin bg-white\"\r\n />\r\n }\r\n</div>\r\n\r\n@if (attribution()) {\r\n <span class=\"text-xs text-surface-400\">{{ attribution() }}</span>\r\n}\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n" }]
|
|
511
|
+
}], 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 }] }] } });
|
|
470
512
|
|
|
471
513
|
/**
|
|
472
514
|
* Generated bundle index. Do not edit.
|