@masterteam/components 0.0.201 → 0.0.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +70 -70
  2. package/assets/common.css +1 -1
  3. package/assets/i18n/ar.json +3 -1
  4. package/assets/i18n/en.json +3 -1
  5. package/fesm2022/masterteam-components-business-fields.mjs +6 -6
  6. package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
  7. package/fesm2022/masterteam-components-date-field.mjs +4 -3
  8. package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
  9. package/fesm2022/masterteam-components-drawer.mjs +2 -2
  10. package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
  11. package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
  12. package/fesm2022/masterteam-components-entities.mjs +16 -16
  13. package/fesm2022/masterteam-components-entities.mjs.map +1 -1
  14. package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
  15. package/fesm2022/masterteam-components-formula.mjs +17 -4
  16. package/fesm2022/masterteam-components-formula.mjs.map +1 -1
  17. package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
  18. package/fesm2022/masterteam-components-location-field.mjs +154 -17
  19. package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
  20. package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
  21. package/fesm2022/masterteam-components-number-field.mjs +2 -2
  22. package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
  23. package/fesm2022/masterteam-components-property-filter-builder.mjs +2 -2
  24. package/fesm2022/masterteam-components-property-filter-builder.mjs.map +1 -1
  25. package/fesm2022/masterteam-components-radio-cards-field.mjs +2 -2
  26. package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
  27. package/fesm2022/masterteam-components-runtime-action.mjs.map +1 -1
  28. package/fesm2022/masterteam-components-sidebar.mjs +118 -5
  29. package/fesm2022/masterteam-components-sidebar.mjs.map +1 -1
  30. package/fesm2022/masterteam-components-table.mjs +129 -10
  31. package/fesm2022/masterteam-components-table.mjs.map +1 -1
  32. package/fesm2022/masterteam-components-text-field.mjs +2 -2
  33. package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
  34. package/fesm2022/masterteam-components-textarea-field.mjs +2 -2
  35. package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
  36. package/fesm2022/masterteam-components-toggle-field.mjs +2 -2
  37. package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
  38. package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
  39. package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
  40. package/fesm2022/masterteam-components.mjs +3 -3
  41. package/fesm2022/masterteam-components.mjs.map +1 -1
  42. package/package.json +4 -4
  43. package/types/masterteam-components-date-field.d.ts +2 -1
  44. package/types/masterteam-components-entities.d.ts +1 -1
  45. package/types/masterteam-components-location-field.d.ts +31 -2
  46. package/types/masterteam-components-sidebar.d.ts +41 -0
  47. package/types/masterteam-components-table.d.ts +46 -3
  48. package/types/masterteam-components.d.ts +2 -2
@@ -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. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BA,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,MAAM,EAAE,UAAU,CAAC;AACvC,IAAA,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;AAC9B,IAAA,KAAK,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;AAC7B,IAAA,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;IACnC,KAAK,EAAE,CAAC,MAAM,CAAC;AACf,IAAA,GAAG,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC;AACnC,IAAA,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC;AACnC,IAAA,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC;IACxC,IAAI,EAAE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AM;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} 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[]> = {\n add: ['plus', 'create', 'new'],\n alert: ['warning', 'notification'],\n approved: ['check', 'done', 'verified'],\n calendar: ['date', 'schedule'],\n chart: ['graph', 'analytics'],\n check: ['tick', 'done', 'approved'],\n clock: ['time'],\n cog: ['gear', 'settings', 'config'],\n config: ['settings', 'gear', 'cog'],\n dollar: ['money', 'finance', 'currency'],\n file: ['document'],\n folder: ['directory'],\n gear: ['settings', 'config', 'cog'],\n lg: ['large'],\n mail: ['email'],\n md: ['medium'],\n message: ['chat', 'comment'],\n minus: ['remove', 'subtract'],\n plus: ['add', 'create', 'new'],\n search: ['find', 'lookup'],\n settings: ['config', 'gear', 'cog'],\n sm: ['small'],\n sp: ['special'],\n trash: ['delete', 'remove'],\n user: ['person', 'profile'],\n users: ['team', 'group'],\r\n x: ['close', 'cancel', 'remove'],\n};\n\nconst ICON_DISPLAY_TOKEN_LABELS: Record<string, string> = {\n lg: 'large',\n md: 'medium',\n sm: 'small',\n};\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 {\n const normalized = ICON_DISPLAY_TOKEN_LABELS[value] ?? value;\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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AAA,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,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,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 { HttpContext, HttpClient, HttpParams } from '@angular/common/http';
4
+ import { HttpContext, HttpClient, HttpBackend, 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';
@@ -126,11 +126,11 @@ 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\n [formGroup]=\"form\"\n [class]=\"modal.contentClass + ' flex flex-col gap-4 p-4'\"\n>\n <mt-text-field\n [label]=\"'components.locationField.displayName' | transloco\"\n [placeholder]=\"'components.locationField.displayName' | transloco\"\n formControlName=\"display_name\"\n [required]=\"true\"\n />\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <mt-number-field\n [label]=\"'components.locationField.longitude' | transloco\"\n [placeholder]=\"'components.locationField.longitude' | transloco\"\n [min]=\"-180\"\n [max]=\"180\"\n formControlName=\"longitude\"\n [required]=\"true\"\n />\n <mt-number-field\n [label]=\"'components.locationField.latitude' | transloco\"\n [placeholder]=\"'components.locationField.latitude' | transloco\"\n [min]=\"-90\"\n [max]=\"90\"\n formControlName=\"latitude\"\n [required]=\"true\"\n />\n </div>\n</form>\n\n<div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"'components.locationField.cancel' | transloco\"\n variant=\"outlined\"\n (onClick)=\"cancel()\"\n />\n <mt-button\n [label]=\"'components.locationField.save' | transloco\"\n severity=\"primary\"\n [disabled]=\"form.invalid\"\n (onClick)=\"save()\"\n />\n</div>\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 });
130
130
  }
131
131
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationManualDialog, decorators: [{
132
132
  type: Component,
133
- args: [{ selector: 'mt-location-manual-dialog', imports: [ReactiveFormsModule, TranslocoPipe, Button, TextField, NumberField], changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
133
+ args: [{ selector: 'mt-location-manual-dialog', imports: [ReactiveFormsModule, TranslocoPipe, Button, TextField, NumberField], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form\n [formGroup]=\"form\"\n [class]=\"modal.contentClass + ' flex flex-col gap-4 p-4'\"\n>\n <mt-text-field\n [label]=\"'components.locationField.displayName' | transloco\"\n [placeholder]=\"'components.locationField.displayName' | transloco\"\n formControlName=\"display_name\"\n [required]=\"true\"\n />\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <mt-number-field\n [label]=\"'components.locationField.longitude' | transloco\"\n [placeholder]=\"'components.locationField.longitude' | transloco\"\n [min]=\"-180\"\n [max]=\"180\"\n formControlName=\"longitude\"\n [required]=\"true\"\n />\n <mt-number-field\n [label]=\"'components.locationField.latitude' | transloco\"\n [placeholder]=\"'components.locationField.latitude' | transloco\"\n [min]=\"-90\"\n [max]=\"90\"\n formControlName=\"latitude\"\n [required]=\"true\"\n />\n </div>\n</form>\n\n<div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"'components.locationField.cancel' | transloco\"\n variant=\"outlined\"\n (onClick)=\"cancel()\"\n />\n <mt-button\n [label]=\"'components.locationField.save' | transloco\"\n severity=\"primary\"\n [disabled]=\"form.invalid\"\n (onClick)=\"save()\"\n />\n</div>\n" }]
134
134
  }], ctorParameters: () => [], propDecorators: { initialValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValue", required: false }] }] } });
135
135
  function coerceNumber(value) {
136
136
  if (value === null || value === undefined || value === '') {
@@ -142,6 +142,8 @@ function coerceNumber(value) {
142
142
 
143
143
  const BLUR_CLEANUP_DELAY_MS = 150;
144
144
  const SUGGESTION_POINTER_BLUR_CLEANUP_DELAY_MS = 750;
145
+ const POST_SELECT_SUGGESTION_CLEAR_DELAY_MS = 120;
146
+ const DIRECT_NOMINATIM_HOST = 'nominatim.openstreetmap.org';
145
147
  class LocationField {
146
148
  hint = input(...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
147
149
  label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
@@ -170,31 +172,45 @@ class LocationField {
170
172
  requiredValidator = Validators.required;
171
173
  autocomplete = viewChild('autocomplete', ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
172
174
  displayValue = computed(() => getLocationDisplayName(this.value()), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
175
+ normalizedConfiguration = computed(() => this.normalizeConfiguration(this.configuration()), ...(ngDevMode ? [{ debugName: "normalizedConfiguration" }] : /* istanbul ignore next */ []));
173
176
  resolvedSearchUrl = computed(() => {
174
- const config = this.configuration();
175
- const configuredUrl = config?.searchUrl ?? config?.nominatimBaseUrl;
176
- return typeof configuredUrl === 'string' && configuredUrl.trim()
177
- ? configuredUrl
178
- : (this.searchUrl() ?? 'places/search');
177
+ const config = this.normalizedConfiguration();
178
+ const configuredUrl = this.readConfiguredUrl(config?.searchUrl) ??
179
+ this.readConfiguredUrl(config?.geocodingUrl) ??
180
+ this.readConfiguredUrl(config?.endpoint) ??
181
+ this.readConfiguredUrl(config?.nominatimBaseUrl);
182
+ return configuredUrl ?? this.searchUrl()?.trim() ?? 'places/search';
179
183
  }, ...(ngDevMode ? [{ debugName: "resolvedSearchUrl" }] : /* istanbul ignore next */ []));
180
184
  countryName = computed(() => {
181
- const country = this.configuration()?.country;
185
+ const country = this.normalizedConfiguration()?.country;
182
186
  if (typeof country === 'string')
183
187
  return country.trim();
184
188
  return country?.name?.trim() ?? '';
185
189
  }, ...(ngDevMode ? [{ debugName: "countryName" }] : /* istanbul ignore next */ []));
186
190
  countryCode = computed(() => {
187
- const country = this.configuration()?.country;
191
+ const country = this.normalizedConfiguration()?.country;
188
192
  if (typeof country === 'object')
189
193
  return country?.code?.trim() ?? '';
190
194
  return '';
191
195
  }, ...(ngDevMode ? [{ debugName: "countryCode" }] : /* istanbul ignore next */ []));
196
+ viewBox = computed(() => {
197
+ const config = this.normalizedConfiguration();
198
+ const country = config?.country;
199
+ if (typeof config?.viewBox === 'string' && config.viewBox.trim()) {
200
+ return config.viewBox;
201
+ }
202
+ if (typeof country === 'object' && country?.viewBox?.trim()) {
203
+ return country.viewBox;
204
+ }
205
+ return '';
206
+ }, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
192
207
  ngControl = null;
193
208
  isInvalid = isInvalid;
194
209
  modal = inject(ModalService);
195
210
  transloco = inject(TranslocoService);
196
211
  document = inject(DOCUMENT);
197
212
  http = inject(HttpClient);
213
+ rawHttp = new HttpClient(inject(HttpBackend));
198
214
  searchTerms = new Subject();
199
215
  /**
200
216
  * Bumped every time a value is committed (select / manual entry / clear /
@@ -203,10 +219,12 @@ class LocationField {
203
219
  */
204
220
  committedValueVersion = 0;
205
221
  blurCleanupHandle = null;
222
+ suggestionClearHandle = null;
206
223
  inputFocused = false;
207
224
  suggestionPointerActive = false;
208
225
  hasUncommittedSearchText = false;
209
226
  ignoreSearchResultsUntilNextSearch = false;
227
+ clearSuggestionsAfterHide = false;
210
228
  handleDocumentPointerDown = (event) => {
211
229
  if (this.isOwnAutocompleteOption(event.target)) {
212
230
  this.onSuggestionPointerDown();
@@ -241,6 +259,7 @@ class LocationField {
241
259
  }
242
260
  ngOnDestroy() {
243
261
  this.cancelPendingBlurCleanup();
262
+ this.cancelPendingSuggestionClear();
244
263
  this.document.removeEventListener('pointerdown', this.handleDocumentPointerDown, true);
245
264
  }
246
265
  /**
@@ -250,6 +269,7 @@ class LocationField {
250
269
  * (`submitSearch` via the search button / Enter).
251
270
  */
252
271
  search(event) {
272
+ this.cancelPendingSuggestionClear();
253
273
  this.inputFocused = true;
254
274
  this.ignoreSearchResultsUntilNextSearch = false;
255
275
  const query = event.query ?? '';
@@ -316,13 +336,23 @@ class LocationField {
316
336
  this.inputFocused = false;
317
337
  this.ignoreSearchResultsUntilNextSearch = true;
318
338
  this.hasUncommittedSearchText = false;
319
- this.commitValue(normalizeLocationValue(event.value));
320
- this.suggestions.set([]);
339
+ const selected = normalizeLocationValue(event.value);
340
+ this.commitValue(selected);
341
+ if (selected) {
342
+ this.keepSelectedSuggestion(selected);
343
+ }
321
344
  this.loading.set(false);
322
345
  this.autocomplete()?.hide();
346
+ this.clearSuggestionsWhenAutocompleteHideSettles();
347
+ }
348
+ onAutocompleteHide() {
349
+ if (!this.clearSuggestionsAfterHide)
350
+ return;
351
+ this.schedulePendingSuggestionClear(0);
323
352
  }
324
353
  onClear() {
325
354
  this.cancelPendingBlurCleanup();
355
+ this.cancelPendingSuggestionClear();
326
356
  this.suggestionPointerActive = false;
327
357
  this.inputFocused = false;
328
358
  this.ignoreSearchResultsUntilNextSearch = true;
@@ -352,6 +382,7 @@ class LocationField {
352
382
  if (!next)
353
383
  return;
354
384
  this.cancelPendingBlurCleanup();
385
+ this.cancelPendingSuggestionClear();
355
386
  this.suggestionPointerActive = false;
356
387
  this.inputFocused = false;
357
388
  this.ignoreSearchResultsUntilNextSearch = true;
@@ -363,6 +394,7 @@ class LocationField {
363
394
  });
364
395
  }
365
396
  writeValue(value) {
397
+ this.cancelPendingSuggestionClear();
366
398
  this.value.set(normalizeLocationValue(value));
367
399
  this.committedValueVersion++;
368
400
  this.hasUncommittedSearchText = false;
@@ -403,6 +435,13 @@ class LocationField {
403
435
  clearTimeout(this.blurCleanupHandle);
404
436
  this.blurCleanupHandle = null;
405
437
  }
438
+ cancelPendingSuggestionClear() {
439
+ this.clearSuggestionsAfterHide = false;
440
+ if (this.suggestionClearHandle === null)
441
+ return;
442
+ clearTimeout(this.suggestionClearHandle);
443
+ this.suggestionClearHandle = null;
444
+ }
406
445
  /**
407
446
  * On blur, reconcile the free-typed input text with the committed value:
408
447
  * a selected location keeps showing its display name, exact-match text is
@@ -443,10 +482,46 @@ class LocationField {
443
482
  }
444
483
  }
445
484
  clearSearchState(autocomplete) {
485
+ this.cancelPendingSuggestionClear();
446
486
  this.suggestions.set([]);
447
487
  this.loading.set(false);
448
488
  autocomplete.hide();
449
489
  }
490
+ clearSuggestionsWhenAutocompleteHideSettles() {
491
+ this.clearSuggestionsAfterHide = true;
492
+ this.schedulePendingSuggestionClear(POST_SELECT_SUGGESTION_CLEAR_DELAY_MS);
493
+ }
494
+ schedulePendingSuggestionClear(delay) {
495
+ if (this.suggestionClearHandle !== null) {
496
+ clearTimeout(this.suggestionClearHandle);
497
+ }
498
+ this.suggestionClearHandle = setTimeout(() => {
499
+ this.suggestionClearHandle = null;
500
+ if (!this.clearSuggestionsAfterHide)
501
+ return;
502
+ this.clearSuggestionsAfterHide = false;
503
+ this.suggestions.set([]);
504
+ this.loading.set(false);
505
+ }, delay);
506
+ }
507
+ keepSelectedSuggestion(selected) {
508
+ const current = this.suggestions();
509
+ const hasSelected = current.some((item) => this.isSameLocation(item, selected));
510
+ if (!hasSelected) {
511
+ this.suggestions.set([selected, ...current]);
512
+ }
513
+ }
514
+ isSameLocation(a, b) {
515
+ if (!a || !b)
516
+ return false;
517
+ const aName = getLocationDisplayName(a);
518
+ const bName = getLocationDisplayName(b);
519
+ const aLat = a.lat == null ? '' : String(a.lat);
520
+ const bLat = b.lat == null ? '' : String(b.lat);
521
+ const aLon = (a.lon ?? a.lng) == null ? '' : String(a.lon ?? a.lng);
522
+ const bLon = (b.lon ?? b.lng) == null ? '' : String(b.lon ?? b.lng);
523
+ return aName === bName && aLat === bLat && aLon === bLon;
524
+ }
450
525
  searchLocations(term) {
451
526
  const trimmed = term?.trim();
452
527
  if (!trimmed || trimmed.length < this.minLength()) {
@@ -465,16 +540,27 @@ class LocationField {
465
540
  if (countryCode) {
466
541
  params = params.set('countryCodes', countryCode.toLowerCase());
467
542
  }
468
- return this.http
469
- .get(this.resolvedSearchUrl(), {
543
+ const url = this.resolvedSearchUrl();
544
+ const viewBox = this.viewBox();
545
+ if (viewBox) {
546
+ params = params.set('viewbox', viewBox);
547
+ }
548
+ return this.getHttpClientForUrl(url)
549
+ .get(url, {
470
550
  params,
471
- context: this.context() ?? this.gatewayRequestContext,
551
+ context: this.getHttpContextForUrl(url),
472
552
  })
473
553
  .pipe(finalize(() => this.loading.set(false)), catchError((error) => {
474
554
  console.error('Location search failed:', error);
475
555
  this.attribution.set('');
476
556
  return of({ data: { items: [] } });
477
557
  }), switchMap((response) => {
558
+ if (Array.isArray(response)) {
559
+ this.attribution.set('');
560
+ return of(response
561
+ .map((item) => normalizeLocationValue(item))
562
+ .filter((item) => item !== null));
563
+ }
478
564
  this.attribution.set(response?.data?.attribution?.trim() ?? '');
479
565
  const items = response?.data?.items ?? [];
480
566
  return of(items
@@ -491,8 +577,59 @@ class LocationField {
491
577
  lon: item.longitude,
492
578
  };
493
579
  }
580
+ normalizeConfiguration(value) {
581
+ if (!value)
582
+ return null;
583
+ if (typeof value === 'object')
584
+ return value;
585
+ const trimmed = value.trim();
586
+ if (!trimmed)
587
+ return null;
588
+ try {
589
+ const parsed = JSON.parse(trimmed);
590
+ return parsed && typeof parsed === 'object'
591
+ ? parsed
592
+ : null;
593
+ }
594
+ catch {
595
+ return { nominatimBaseUrl: trimmed };
596
+ }
597
+ }
598
+ readConfiguredUrl(value) {
599
+ return typeof value === 'string' && value.trim()
600
+ ? value.trim()
601
+ : undefined;
602
+ }
603
+ getHttpClientForUrl(url) {
604
+ return this.shouldBypassInterceptors(url) ? this.rawHttp : this.http;
605
+ }
606
+ getHttpContextForUrl(url) {
607
+ const explicitContext = this.context();
608
+ if (explicitContext)
609
+ return explicitContext;
610
+ return this.isDefaultGatewayPlacesUrl(url)
611
+ ? this.gatewayRequestContext
612
+ : undefined;
613
+ }
614
+ shouldBypassInterceptors(url) {
615
+ const config = this.normalizedConfiguration();
616
+ if (typeof config?.useInterceptors === 'boolean') {
617
+ return !config.useInterceptors;
618
+ }
619
+ try {
620
+ const parsed = new URL(url, this.document.baseURI);
621
+ return parsed.hostname === DIRECT_NOMINATIM_HOST;
622
+ }
623
+ catch {
624
+ return false;
625
+ }
626
+ }
627
+ isDefaultGatewayPlacesUrl(url) {
628
+ const normalized = url.trim().replace(/^\/+/, '').toLowerCase();
629
+ return normalized === 'places/search';
630
+ }
494
631
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, deps: [], target: i0.ɵɵFactoryTarget.Component });
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 });
632
+ 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 (onHide)=\"onAutocompleteHide()\"\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 });
496
633
  }
497
634
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LocationField, decorators: [{
498
635
  type: Component,
@@ -507,7 +644,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
507
644
  TranslocoPipe,
508
645
  ], changeDetection: ChangeDetectionStrategy.OnPush, host: {
509
646
  class: 'grid gap-1',
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" }]
647
+ }, 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 (onHide)=\"onAutocompleteHide()\"\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
648
  }], 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 }] }] } });
512
649
 
513
650
  /**