@masterteam/components 0.0.267 → 0.0.269
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/fesm2022/masterteam-components-business-fields.mjs +5 -7
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +6 -8
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +6 -8
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +6 -8
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +6 -8
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +3 -62
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +2 -8
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +6 -8
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +6 -8
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +6 -8
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +6 -8
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +6 -8
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-cards-field.mjs +6 -8
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +5 -7
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +5 -9
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +6 -8
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +6 -8
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +5 -7
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +6 -8
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +149 -235
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +2 -4
- package/types/masterteam-components-checkbox-field.d.ts +2 -4
- package/types/masterteam-components-color-picker-field.d.ts +2 -4
- package/types/masterteam-components-date-field.d.ts +2 -4
- package/types/masterteam-components-editor-field.d.ts +2 -4
- package/types/masterteam-components-entities.d.ts +0 -14
- package/types/masterteam-components-icon-field.d.ts +2 -4
- package/types/masterteam-components-location-field.d.ts +2 -4
- package/types/masterteam-components-multi-select-field.d.ts +2 -4
- package/types/masterteam-components-number-field.d.ts +2 -4
- package/types/masterteam-components-pick-list-field.d.ts +2 -4
- package/types/masterteam-components-radio-cards-field.d.ts +2 -4
- package/types/masterteam-components-select-field.d.ts +2 -4
- package/types/masterteam-components-slider-field.d.ts +2 -2
- package/types/masterteam-components-text-field.d.ts +2 -4
- package/types/masterteam-components-textarea-field.d.ts +2 -4
- package/types/masterteam-components-upload-field.d.ts +2 -4
- package/types/masterteam-components-user-search-field.d.ts +2 -4
- package/types/masterteam-components.d.ts +33 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-user-search-field.mjs","sources":["../../../../packages/masterteam/components/user-search-field/user-search-field.ts","../../../../packages/masterteam/components/user-search-field/user-search-field.html","../../../../packages/masterteam/components/user-search-field/masterteam-components-user-search-field.ts"],"sourcesContent":["import {\r\n Component,\r\n HostBinding,\r\n signal,\r\n computed,\r\n input,\r\n OnInit,\r\n OnDestroy,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';\r\nimport { InputGroupModule } from 'primeng/inputgroup';\r\nimport { InputGroupAddonModule } from 'primeng/inputgroupaddon';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { isInvalid, nextFieldId, resolveFieldId } from '@masterteam/components';\r\nimport { Icon } from '@masterteam/icons';\r\nimport {\r\n Subject,\r\n debounceTime,\r\n switchMap,\r\n tap,\r\n of,\r\n finalize,\r\n catchError,\r\n} from 'rxjs';\r\nimport { HttpClient, HttpContext, HttpParams } from '@angular/common/http';\r\nimport { Avatar } from '@masterteam/components/avatar';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { TranslocoService, TranslocoPipe } from '@jsverse/transloco';\r\n\r\nexport interface User {\r\n isExternal: boolean;\r\n id: string;\r\n userId?: string;\r\n displayName: string;\r\n userName: string;\r\n email?: string | null;\r\n photo: string;\r\n /**\r\n * `false` when the user is no longer linked to the current application\r\n * (e.g. removed/deleted) but is still referenced by historical records.\r\n */\r\n isLinkedToCurrentApplication?: boolean;\r\n}\r\n\r\nconst BLUR_CLEANUP_DELAY_MS = 150;\r\nconst SUGGESTION_POINTER_BLUR_CLEANUP_DELAY_MS = 750;\r\n\r\n@Component({\r\n selector: 'mt-user-search-field',\r\n standalone: true,\r\n imports: [\r\n FormsModule,\r\n AutoCompleteModule,\r\n Tooltip,\r\n InputGroupModule,\r\n InputGroupAddonModule,\r\n FieldValidation,\r\n Icon,\r\n Avatar,\r\n TranslocoPipe,\r\n ],\r\n templateUrl: './user-search-field.html',\r\n styleUrls: ['./user-search-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class UserSearchField\r\n implements ControlValueAccessor, OnInit, OnDestroy\r\n{\r\n readonly hint = input<string>();\r\n /**\r\n * Hides the \"not linked to current application\" indicator (the amber\r\n * info badge in single-select mode and the per-chip badge in multiple\r\n * mode). The control still functions; only the visual hint is suppressed.\r\n */\r\n readonly hideUnlinkedHint = input<boolean>(false);\r\n readonly label = input<string>();\r\n\r\n /** Fallback so a control-less, label-less field never renders id=\"undefined\". */\r\n private readonly defaultFieldId = nextFieldId('mt-user-search-field');\r\n /** Shared by the input and its <label for>. See src/lib/utils/field-id. */\r\n readonly fieldId = computed(() =>\r\n resolveFieldId(this.ngControl?.name, this.label(), this.defaultFieldId),\r\n );\r\n readonly placeholder = input<string>();\r\n readonly class = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly isMultiple = input<boolean>(false);\r\n readonly apiUrl = input.required<string>();\r\n readonly dataKey = input<string>('data');\r\n readonly paramName = input<string>('query');\r\n readonly minLength = input<number>(1);\r\n readonly context = input<HttpContext | undefined>(undefined);\r\n\r\n @HostBinding('class') styleClass: string;\r\n\r\n requiredValidator = Validators.required;\r\n value = signal<User | User[] | null>(null);\r\n disabled = signal<boolean>(false);\r\n loading = signal<boolean>(false);\r\n\r\n readonly size = input<'small' | 'large' | undefined>();\r\n\r\n filteredUsers = signal<User[]>([]);\r\n private searchTerms = new Subject<string>();\r\n private readonly document = inject(DOCUMENT);\r\n private committedValueVersion = 0;\r\n private blurCleanupHandle: ReturnType<typeof setTimeout> | null = null;\r\n private inputFocused = false;\r\n private suggestionPointerActive = false;\r\n private hasUncommittedSearchText = false;\r\n private ignoreSearchResultsUntilNextSearch = false;\r\n\r\n /**\r\n * In single-select mode, `true` when the currently selected user is no\r\n * longer linked to the application. Drives the inline info badge/tooltip.\r\n * Multiple-select mode handles this per-chip via the `selecteditem` template.\r\n */\r\n readonly unlinkedSingleUser = computed<boolean>(() => {\r\n if (this.isMultiple()) return false;\r\n const current = this.value() as User | null;\r\n return !!current && current.isLinkedToCurrentApplication === false;\r\n });\r\n\r\n private readonly translocoService = inject(TranslocoService);\r\n\r\n readonly autocomplete = viewChild<AutoComplete>('autocomplete');\r\n\r\n private readonly handleDocumentPointerDown = (event: PointerEvent): void => {\r\n if (this.isOwnAutocompleteOption(event.target)) {\r\n this.onSuggestionPointerDown();\r\n }\r\n };\r\n\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: any) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n private http = inject(HttpClient);\r\n\r\n isInvalid = isInvalid;\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\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 this.document.addEventListener(\r\n 'pointerdown',\r\n this.handleDocumentPointerDown,\r\n true,\r\n );\r\n this.getUsers();\r\n }\r\n\r\n ngOnInit() {\r\n this.styleClass = this.class();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.cancelPendingBlurCleanup();\r\n this.document.removeEventListener(\r\n 'pointerdown',\r\n this.handleDocumentPointerDown,\r\n true,\r\n );\r\n }\r\n\r\n search(event: { query: string }) {\r\n this.inputFocused = true;\r\n this.ignoreSearchResultsUntilNextSearch = false;\r\n\r\n const query = event.query ?? '';\r\n const trimmed = query.trim();\r\n const current = this.isMultiple() ? null : (this.value() as User | null);\r\n this.hasUncommittedSearchText =\r\n !!trimmed && (!current || current.displayName?.trim() !== trimmed);\r\n\r\n this.searchTerms.next(query);\r\n }\r\n\r\n onFocus() {\r\n this.inputFocused = true;\r\n const autocomplete = this.autocomplete();\r\n if (!autocomplete) return;\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = (inputEl?.value ?? '').trim();\r\n if (!typed) {\r\n this.filteredUsers.set([]);\r\n return;\r\n }\r\n if (this.filteredUsers().length > 0) {\r\n autocomplete.show();\r\n }\r\n }\r\n\r\n onBlur() {\r\n this.onTouched();\r\n this.inputFocused = false;\r\n\r\n const autocomplete = this.autocomplete();\r\n if (!autocomplete) return;\r\n\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = (inputEl?.value ?? '').trim();\r\n const committedValueVersion = this.committedValueVersion;\r\n\r\n this.cancelPendingBlurCleanup();\r\n\r\n const cleanupDelay = this.suggestionPointerActive\r\n ? SUGGESTION_POINTER_BLUR_CLEANUP_DELAY_MS\r\n : BLUR_CLEANUP_DELAY_MS;\r\n\r\n this.blurCleanupHandle = setTimeout(() => {\r\n this.blurCleanupHandle = null;\r\n this.resetUncommittedSearch(autocomplete, typed, committedValueVersion);\r\n }, cleanupDelay);\r\n }\r\n\r\n onSelect(event: { originalEvent: Event; value: User }) {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n const selectedUser = event.value;\r\n if (this.isMultiple()) {\r\n const current = (this.value() as User[]) || [];\r\n const updated = [...current, selectedUser];\r\n this.value.set(updated);\r\n this.committedValueVersion++;\r\n this.onModelChange(updated);\r\n const remaining = this.filteredUsers().filter(\r\n (u) => u.id !== selectedUser.id,\r\n );\r\n this.filteredUsers.set(remaining);\r\n if (remaining.length > 0) {\r\n queueMicrotask(() => this.autocomplete()?.show());\r\n }\r\n } else {\r\n this.inputFocused = false;\r\n this.ignoreSearchResultsUntilNextSearch = true;\r\n this.value.set(selectedUser);\r\n this.committedValueVersion++;\r\n this.onModelChange(selectedUser);\r\n this.filteredUsers.set([]);\r\n this.autocomplete()?.hide();\r\n }\r\n this.hasUncommittedSearchText = false;\r\n this.onTouched();\r\n this.loading.set(false);\r\n }\r\n\r\n onUnselect(event: { originalEvent: Event; value: User }) {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n const removedUser = event.value;\r\n const current = (this.value() as User[]) || [];\r\n const updated = current.filter((u) => u.id !== removedUser.id);\r\n this.value.set(updated);\r\n this.committedValueVersion++;\r\n this.onModelChange(updated);\r\n this.hasUncommittedSearchText = false;\r\n this.onTouched();\r\n }\r\n\r\n onClear() {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n this.value.set(this.isMultiple() ? [] : null);\r\n this.committedValueVersion++;\r\n this.onModelChange(this.isMultiple() ? [] : null);\r\n this.inputFocused = false;\r\n this.ignoreSearchResultsUntilNextSearch = true;\r\n this.hasUncommittedSearchText = false;\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n }\r\n\r\n writeValue(value: User | User[] | null): void {\r\n if (this.isMultiple()) {\r\n this.value.set(Array.isArray(value) ? value : value ? [value] : []);\r\n } else {\r\n this.value.set(Array.isArray(value) ? (value[0] ?? null) : value);\r\n }\r\n this.committedValueVersion++;\r\n this.hasUncommittedSearchText = false;\r\n this.ignoreSearchResultsUntilNextSearch = false;\r\n }\r\n\r\n registerOnChange(fn: (value: User | null) => void) {\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 onSuggestionPointerDown() {\r\n this.suggestionPointerActive = true;\r\n this.cancelPendingBlurCleanup();\r\n }\r\n\r\n private isOwnAutocompleteOption(target: EventTarget | null): boolean {\r\n const defaultView = this.document.defaultView;\r\n if (!defaultView || !(target instanceof defaultView.Element)) return false;\r\n\r\n const autocompleteId = this.autocomplete()?.id;\r\n if (!autocompleteId) return false;\r\n\r\n const option = target.closest('[role=\"option\"]');\r\n const listbox = option?.closest('[role=\"listbox\"]');\r\n\r\n return listbox?.id === `${autocompleteId}_list`;\r\n }\r\n\r\n getUsers() {\r\n this.searchTerms\r\n .pipe(\r\n takeUntilDestroyed(),\r\n debounceTime(250),\r\n tap(() => this.loading.set(true)),\r\n switchMap((term: string) => {\r\n const trimmed = term?.trim();\r\n if (!trimmed || trimmed.length < this.minLength()) {\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n return of({ [this.dataKey()]: [] } as Record<string, User[]>);\r\n }\r\n const params = new HttpParams().set(this.paramName(), trimmed);\r\n return this.http\r\n .get<Record<string, User[]>>(this.apiUrl(), {\r\n params,\r\n context: this.context(),\r\n })\r\n .pipe(\r\n finalize(() => this.loading.set(false)),\r\n catchError((err) => {\r\n console.error('API search failed:', err);\r\n return of({ [this.dataKey()]: [] } as Record<string, User[]>);\r\n }),\r\n );\r\n }),\r\n )\r\n .subscribe({\r\n next: (response) => {\r\n if (!this.inputFocused || this.ignoreSearchResultsUntilNextSearch) {\r\n this.filteredUsers.set([]);\r\n return;\r\n }\r\n\r\n const users = this.readUsers(response).map((user) => ({\r\n ...user,\r\n id: user.id ?? user.userId ?? '',\r\n userId: user.userId ?? user.id,\r\n userName: user.userName ?? user.email ?? user.displayName,\r\n photo: user.photo ?? '',\r\n isExternal: user.isExternal ?? false,\r\n }));\r\n if (this.isMultiple()) {\r\n const selectedIds = new Set(\r\n ((this.value() as User[]) ?? []).map((u) => u.id),\r\n );\r\n this.filteredUsers.set(users.filter((u) => !selectedIds.has(u.id)));\r\n } else {\r\n this.filteredUsers.set(users);\r\n }\r\n },\r\n });\r\n }\r\n\r\n private readUsers(response: Record<string, unknown>): User[] {\r\n const value = this.dataKey()\r\n .split('.')\r\n .reduce<unknown>(\r\n (current, key) =>\r\n current && typeof current === 'object'\r\n ? (current as Record<string, unknown>)[key]\r\n : undefined,\r\n response,\r\n );\r\n return Array.isArray(value) ? (value as User[]) : [];\r\n }\r\n\r\n private getInputElement(autocomplete: AutoComplete): HTMLInputElement | null {\r\n return (\r\n autocomplete.multiInputEl?.nativeElement ??\r\n autocomplete.inputEL?.nativeElement ??\r\n null\r\n );\r\n }\r\n\r\n private cancelPendingBlurCleanup() {\r\n if (this.blurCleanupHandle === null) return;\r\n\r\n clearTimeout(this.blurCleanupHandle);\r\n this.blurCleanupHandle = null;\r\n }\r\n\r\n private resetUncommittedSearch(\r\n autocomplete: AutoComplete,\r\n typedOnBlur: string,\r\n committedValueVersionOnBlur: number,\r\n ) {\r\n this.suggestionPointerActive = false;\r\n\r\n if (committedValueVersionOnBlur !== this.committedValueVersion) return;\r\n\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = typedOnBlur.trim();\r\n\r\n if (this.isMultiple()) {\r\n this.clearInput(inputEl);\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n return;\r\n }\r\n\r\n const current = this.value() as User | null;\r\n if (current && !this.hasUncommittedSearchText) {\r\n this.writeInput(inputEl, current.displayName ?? '');\r\n this.clearSearchState(autocomplete);\r\n return;\r\n }\r\n\r\n if (typed && current?.displayName?.trim() === typed) {\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n return;\r\n }\r\n\r\n if (current || typed) {\r\n this.value.set(null);\r\n this.committedValueVersion++;\r\n this.onModelChange(null);\r\n }\r\n\r\n this.clearInput(inputEl);\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n }\r\n\r\n private clearInput(inputEl: HTMLInputElement | null) {\r\n this.writeInput(inputEl, '');\r\n }\r\n\r\n private writeInput(inputEl: HTMLInputElement | null, value: string) {\r\n if (inputEl) {\r\n inputEl.value = value;\r\n }\r\n }\r\n\r\n private clearSearchState(autocomplete: AutoComplete) {\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n autocomplete.hide();\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n<div class=\"relative\">\r\n <p-inputgroup>\r\n @if (unlinkedSingleUser() && !hideUnlinkedHint()) {\r\n <p-inputgroup-addon\r\n [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.info-circle\" class=\"text-amber-500\" />\r\n </p-inputgroup-addon>\r\n }\r\n <p-autoComplete\r\n #autocomplete=\"\"\r\n [suggestions]=\"filteredUsers()\"\r\n (completeMethod)=\"search($event)\"\r\n (onSelect)=\"onSelect($event)\"\r\n (onUnselect)=\"onUnselect($event)\"\r\n (onClear)=\"onClear()\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\"\r\n [ngModel]=\"value()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"fieldId()\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.userSearchField.search' | transloco\"\r\n [multiple]=\"isMultiple()\"\r\n [optionLabel]=\"'displayName'\"\r\n class=\"w-full\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n [dropdown]=\"false\"\r\n [size]=\"size()\"\r\n >\r\n <ng-template let-user pTemplate=\"item\">\r\n <div\r\n class=\"flex w-full min-w-0 items-center gap-2\"\r\n (pointerdown)=\"onSuggestionPointerDown()\"\r\n >\r\n <mt-avatar size=\"small\" icon=\"user.user-01\" />\r\n <div class=\"flex align-items-center gap-3\">\r\n <span class=\"font-medium\">{{ user.displayName }}</span>\r\n <medium class=\"text-gray-500\">{{ \"@\" + user.userName }}</medium>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template let-user pTemplate=\"selecteditem\">\r\n <span class=\"inline-flex items-center gap-1\">\r\n <span>{{ user.displayName }}</span>\r\n @if (\r\n user.isLinkedToCurrentApplication === false && !hideUnlinkedHint()\r\n ) {\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"text-amber-500 text-sm shrink-0\"\r\n [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n tooltipPosition=\"top\"\r\n />\r\n }\r\n </span>\r\n </ng-template>\r\n </p-autoComplete>\r\n @if (hint()) {\r\n <p-inputgroup-addon [mtTooltip]=\"hint()\" tooltipPosition=\"top\">\r\n <mt-icon icon=\"general.help-circle\" />\r\n </p-inputgroup-addon>\r\n } @else {\r\n <p-inputgroup-addon tooltipPosition=\"top\">\r\n <mt-icon icon=\"user.user-03\" />\r\n </p-inputgroup-addon>\r\n }\r\n </p-inputgroup>\r\n\r\n @if (loading()) {\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"animate-spin absolute right-3 bg-white top-1/2 -translate-y-1/2\"\r\n />\r\n }\r\n</div>\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":";;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAM,qBAAqB,GAAG,GAAG;AACjC,MAAM,wCAAwC,GAAG,GAAG;MAuBvC,eAAe,CAAA;IAGjB,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC/B;;;;AAIG;AACM,IAAA,gBAAgB,GAAG,KAAK,CAAU,KAAK,uFAAC;IACxC,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;;AAGf,IAAA,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;IAE5D,OAAO,GAAG,QAAQ,CAAC,MAC1B,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CACxE;IACQ,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,E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ACrB,eAAe;wBACf,IAAI;wBACJ,MAAM;wBACN,aAAa;qBACd,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,wlGAAA,EAAA,MAAA,EAAA,CAAA,qGAAA,CAAA,EAAA;;sBA+BA,WAAW;uBAAC,OAAO;oJAgC4B,cAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE7IhE;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"masterteam-components-user-search-field.mjs","sources":["../../../../packages/masterteam/components/user-search-field/user-search-field.ts","../../../../packages/masterteam/components/user-search-field/user-search-field.html","../../../../packages/masterteam/components/user-search-field/masterteam-components-user-search-field.ts"],"sourcesContent":["import {\r\n Component,\r\n HostBinding,\r\n signal,\r\n computed,\r\n input,\r\n OnInit,\r\n OnDestroy,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';\r\nimport { InputGroupModule } from 'primeng/inputgroup';\r\nimport { InputGroupAddonModule } from 'primeng/inputgroupaddon';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { isInvalid, newFieldId } from '@masterteam/components';\r\nimport { Icon } from '@masterteam/icons';\r\nimport {\r\n Subject,\r\n debounceTime,\r\n switchMap,\r\n tap,\r\n of,\r\n finalize,\r\n catchError,\r\n} from 'rxjs';\r\nimport { HttpClient, HttpContext, HttpParams } from '@angular/common/http';\r\nimport { Avatar } from '@masterteam/components/avatar';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { TranslocoService, TranslocoPipe } from '@jsverse/transloco';\r\n\r\nexport interface User {\r\n isExternal: boolean;\r\n id: string;\r\n userId?: string;\r\n displayName: string;\r\n userName: string;\r\n email?: string | null;\r\n photo: string;\r\n /**\r\n * `false` when the user is no longer linked to the current application\r\n * (e.g. removed/deleted) but is still referenced by historical records.\r\n */\r\n isLinkedToCurrentApplication?: boolean;\r\n}\r\n\r\nconst BLUR_CLEANUP_DELAY_MS = 150;\r\nconst SUGGESTION_POINTER_BLUR_CLEANUP_DELAY_MS = 750;\r\n\r\n@Component({\r\n selector: 'mt-user-search-field',\r\n standalone: true,\r\n imports: [\r\n FormsModule,\r\n AutoCompleteModule,\r\n Tooltip,\r\n InputGroupModule,\r\n InputGroupAddonModule,\r\n FieldValidation,\r\n Icon,\r\n Avatar,\r\n TranslocoPipe,\r\n ],\r\n templateUrl: './user-search-field.html',\r\n styleUrls: ['./user-search-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class UserSearchField\r\n implements ControlValueAccessor, OnInit, OnDestroy\r\n{\r\n readonly hint = input<string>();\r\n /**\r\n * Hides the \"not linked to current application\" indicator (the amber\r\n * info badge in single-select mode and the per-chip badge in multiple\r\n * mode). The control still functions; only the visual hint is suppressed.\r\n */\r\n readonly hideUnlinkedHint = input<boolean>(false);\r\n readonly label = input<string>();\r\n\r\n /** Unique; shared by the control and its <label for>. See src/lib/utils/field-id. */\r\n readonly fieldId = newFieldId('mt-user-search-field');\r\n readonly placeholder = input<string>();\r\n readonly class = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly isMultiple = input<boolean>(false);\r\n readonly apiUrl = input.required<string>();\r\n readonly dataKey = input<string>('data');\r\n readonly paramName = input<string>('query');\r\n readonly minLength = input<number>(1);\r\n readonly context = input<HttpContext | undefined>(undefined);\r\n\r\n @HostBinding('class') styleClass: string;\r\n\r\n requiredValidator = Validators.required;\r\n value = signal<User | User[] | null>(null);\r\n disabled = signal<boolean>(false);\r\n loading = signal<boolean>(false);\r\n\r\n readonly size = input<'small' | 'large' | undefined>();\r\n\r\n filteredUsers = signal<User[]>([]);\r\n private searchTerms = new Subject<string>();\r\n private readonly document = inject(DOCUMENT);\r\n private committedValueVersion = 0;\r\n private blurCleanupHandle: ReturnType<typeof setTimeout> | null = null;\r\n private inputFocused = false;\r\n private suggestionPointerActive = false;\r\n private hasUncommittedSearchText = false;\r\n private ignoreSearchResultsUntilNextSearch = false;\r\n\r\n /**\r\n * In single-select mode, `true` when the currently selected user is no\r\n * longer linked to the application. Drives the inline info badge/tooltip.\r\n * Multiple-select mode handles this per-chip via the `selecteditem` template.\r\n */\r\n readonly unlinkedSingleUser = computed<boolean>(() => {\r\n if (this.isMultiple()) return false;\r\n const current = this.value() as User | null;\r\n return !!current && current.isLinkedToCurrentApplication === false;\r\n });\r\n\r\n private readonly translocoService = inject(TranslocoService);\r\n\r\n readonly autocomplete = viewChild<AutoComplete>('autocomplete');\r\n\r\n private readonly handleDocumentPointerDown = (event: PointerEvent): void => {\r\n if (this.isOwnAutocompleteOption(event.target)) {\r\n this.onSuggestionPointerDown();\r\n }\r\n };\r\n\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: any) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n private http = inject(HttpClient);\r\n\r\n isInvalid = isInvalid;\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\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 this.document.addEventListener(\r\n 'pointerdown',\r\n this.handleDocumentPointerDown,\r\n true,\r\n );\r\n this.getUsers();\r\n }\r\n\r\n ngOnInit() {\r\n this.styleClass = this.class();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.cancelPendingBlurCleanup();\r\n this.document.removeEventListener(\r\n 'pointerdown',\r\n this.handleDocumentPointerDown,\r\n true,\r\n );\r\n }\r\n\r\n search(event: { query: string }) {\r\n this.inputFocused = true;\r\n this.ignoreSearchResultsUntilNextSearch = false;\r\n\r\n const query = event.query ?? '';\r\n const trimmed = query.trim();\r\n const current = this.isMultiple() ? null : (this.value() as User | null);\r\n this.hasUncommittedSearchText =\r\n !!trimmed && (!current || current.displayName?.trim() !== trimmed);\r\n\r\n this.searchTerms.next(query);\r\n }\r\n\r\n onFocus() {\r\n this.inputFocused = true;\r\n const autocomplete = this.autocomplete();\r\n if (!autocomplete) return;\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = (inputEl?.value ?? '').trim();\r\n if (!typed) {\r\n this.filteredUsers.set([]);\r\n return;\r\n }\r\n if (this.filteredUsers().length > 0) {\r\n autocomplete.show();\r\n }\r\n }\r\n\r\n onBlur() {\r\n this.onTouched();\r\n this.inputFocused = false;\r\n\r\n const autocomplete = this.autocomplete();\r\n if (!autocomplete) return;\r\n\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = (inputEl?.value ?? '').trim();\r\n const committedValueVersion = this.committedValueVersion;\r\n\r\n this.cancelPendingBlurCleanup();\r\n\r\n const cleanupDelay = this.suggestionPointerActive\r\n ? SUGGESTION_POINTER_BLUR_CLEANUP_DELAY_MS\r\n : BLUR_CLEANUP_DELAY_MS;\r\n\r\n this.blurCleanupHandle = setTimeout(() => {\r\n this.blurCleanupHandle = null;\r\n this.resetUncommittedSearch(autocomplete, typed, committedValueVersion);\r\n }, cleanupDelay);\r\n }\r\n\r\n onSelect(event: { originalEvent: Event; value: User }) {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n const selectedUser = event.value;\r\n if (this.isMultiple()) {\r\n const current = (this.value() as User[]) || [];\r\n const updated = [...current, selectedUser];\r\n this.value.set(updated);\r\n this.committedValueVersion++;\r\n this.onModelChange(updated);\r\n const remaining = this.filteredUsers().filter(\r\n (u) => u.id !== selectedUser.id,\r\n );\r\n this.filteredUsers.set(remaining);\r\n if (remaining.length > 0) {\r\n queueMicrotask(() => this.autocomplete()?.show());\r\n }\r\n } else {\r\n this.inputFocused = false;\r\n this.ignoreSearchResultsUntilNextSearch = true;\r\n this.value.set(selectedUser);\r\n this.committedValueVersion++;\r\n this.onModelChange(selectedUser);\r\n this.filteredUsers.set([]);\r\n this.autocomplete()?.hide();\r\n }\r\n this.hasUncommittedSearchText = false;\r\n this.onTouched();\r\n this.loading.set(false);\r\n }\r\n\r\n onUnselect(event: { originalEvent: Event; value: User }) {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n const removedUser = event.value;\r\n const current = (this.value() as User[]) || [];\r\n const updated = current.filter((u) => u.id !== removedUser.id);\r\n this.value.set(updated);\r\n this.committedValueVersion++;\r\n this.onModelChange(updated);\r\n this.hasUncommittedSearchText = false;\r\n this.onTouched();\r\n }\r\n\r\n onClear() {\r\n this.cancelPendingBlurCleanup();\r\n this.suggestionPointerActive = false;\r\n\r\n this.value.set(this.isMultiple() ? [] : null);\r\n this.committedValueVersion++;\r\n this.onModelChange(this.isMultiple() ? [] : null);\r\n this.inputFocused = false;\r\n this.ignoreSearchResultsUntilNextSearch = true;\r\n this.hasUncommittedSearchText = false;\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n }\r\n\r\n writeValue(value: User | User[] | null): void {\r\n if (this.isMultiple()) {\r\n this.value.set(Array.isArray(value) ? value : value ? [value] : []);\r\n } else {\r\n this.value.set(Array.isArray(value) ? (value[0] ?? null) : value);\r\n }\r\n this.committedValueVersion++;\r\n this.hasUncommittedSearchText = false;\r\n this.ignoreSearchResultsUntilNextSearch = false;\r\n }\r\n\r\n registerOnChange(fn: (value: User | null) => void) {\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 onSuggestionPointerDown() {\r\n this.suggestionPointerActive = true;\r\n this.cancelPendingBlurCleanup();\r\n }\r\n\r\n private isOwnAutocompleteOption(target: EventTarget | null): boolean {\r\n const defaultView = this.document.defaultView;\r\n if (!defaultView || !(target instanceof defaultView.Element)) return false;\r\n\r\n const autocompleteId = this.autocomplete()?.id;\r\n if (!autocompleteId) return false;\r\n\r\n const option = target.closest('[role=\"option\"]');\r\n const listbox = option?.closest('[role=\"listbox\"]');\r\n\r\n return listbox?.id === `${autocompleteId}_list`;\r\n }\r\n\r\n getUsers() {\r\n this.searchTerms\r\n .pipe(\r\n takeUntilDestroyed(),\r\n debounceTime(250),\r\n tap(() => this.loading.set(true)),\r\n switchMap((term: string) => {\r\n const trimmed = term?.trim();\r\n if (!trimmed || trimmed.length < this.minLength()) {\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n return of({ [this.dataKey()]: [] } as Record<string, User[]>);\r\n }\r\n const params = new HttpParams().set(this.paramName(), trimmed);\r\n return this.http\r\n .get<Record<string, User[]>>(this.apiUrl(), {\r\n params,\r\n context: this.context(),\r\n })\r\n .pipe(\r\n finalize(() => this.loading.set(false)),\r\n catchError((err) => {\r\n console.error('API search failed:', err);\r\n return of({ [this.dataKey()]: [] } as Record<string, User[]>);\r\n }),\r\n );\r\n }),\r\n )\r\n .subscribe({\r\n next: (response) => {\r\n if (!this.inputFocused || this.ignoreSearchResultsUntilNextSearch) {\r\n this.filteredUsers.set([]);\r\n return;\r\n }\r\n\r\n const users = this.readUsers(response).map((user) => ({\r\n ...user,\r\n id: user.id ?? user.userId ?? '',\r\n userId: user.userId ?? user.id,\r\n userName: user.userName ?? user.email ?? user.displayName,\r\n photo: user.photo ?? '',\r\n isExternal: user.isExternal ?? false,\r\n }));\r\n if (this.isMultiple()) {\r\n const selectedIds = new Set(\r\n ((this.value() as User[]) ?? []).map((u) => u.id),\r\n );\r\n this.filteredUsers.set(users.filter((u) => !selectedIds.has(u.id)));\r\n } else {\r\n this.filteredUsers.set(users);\r\n }\r\n },\r\n });\r\n }\r\n\r\n private readUsers(response: Record<string, unknown>): User[] {\r\n const value = this.dataKey()\r\n .split('.')\r\n .reduce<unknown>(\r\n (current, key) =>\r\n current && typeof current === 'object'\r\n ? (current as Record<string, unknown>)[key]\r\n : undefined,\r\n response,\r\n );\r\n return Array.isArray(value) ? (value as User[]) : [];\r\n }\r\n\r\n private getInputElement(autocomplete: AutoComplete): HTMLInputElement | null {\r\n return (\r\n autocomplete.multiInputEl?.nativeElement ??\r\n autocomplete.inputEL?.nativeElement ??\r\n null\r\n );\r\n }\r\n\r\n private cancelPendingBlurCleanup() {\r\n if (this.blurCleanupHandle === null) return;\r\n\r\n clearTimeout(this.blurCleanupHandle);\r\n this.blurCleanupHandle = null;\r\n }\r\n\r\n private resetUncommittedSearch(\r\n autocomplete: AutoComplete,\r\n typedOnBlur: string,\r\n committedValueVersionOnBlur: number,\r\n ) {\r\n this.suggestionPointerActive = false;\r\n\r\n if (committedValueVersionOnBlur !== this.committedValueVersion) return;\r\n\r\n const inputEl = this.getInputElement(autocomplete);\r\n const typed = typedOnBlur.trim();\r\n\r\n if (this.isMultiple()) {\r\n this.clearInput(inputEl);\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n return;\r\n }\r\n\r\n const current = this.value() as User | null;\r\n if (current && !this.hasUncommittedSearchText) {\r\n this.writeInput(inputEl, current.displayName ?? '');\r\n this.clearSearchState(autocomplete);\r\n return;\r\n }\r\n\r\n if (typed && current?.displayName?.trim() === typed) {\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n return;\r\n }\r\n\r\n if (current || typed) {\r\n this.value.set(null);\r\n this.committedValueVersion++;\r\n this.onModelChange(null);\r\n }\r\n\r\n this.clearInput(inputEl);\r\n this.clearSearchState(autocomplete);\r\n this.hasUncommittedSearchText = false;\r\n }\r\n\r\n private clearInput(inputEl: HTMLInputElement | null) {\r\n this.writeInput(inputEl, '');\r\n }\r\n\r\n private writeInput(inputEl: HTMLInputElement | null, value: string) {\r\n if (inputEl) {\r\n inputEl.value = value;\r\n }\r\n }\r\n\r\n private clearSearchState(autocomplete: AutoComplete) {\r\n this.filteredUsers.set([]);\r\n this.loading.set(false);\r\n autocomplete.hide();\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"fieldId\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n<div class=\"relative\">\r\n <p-inputgroup>\r\n @if (unlinkedSingleUser() && !hideUnlinkedHint()) {\r\n <p-inputgroup-addon\r\n [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.info-circle\" class=\"text-amber-500\" />\r\n </p-inputgroup-addon>\r\n }\r\n <p-autoComplete\r\n #autocomplete=\"\"\r\n [suggestions]=\"filteredUsers()\"\r\n (completeMethod)=\"search($event)\"\r\n (onSelect)=\"onSelect($event)\"\r\n (onUnselect)=\"onUnselect($event)\"\r\n (onClear)=\"onClear()\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\"\r\n [ngModel]=\"value()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [inputId]=\"fieldId\"\r\n [invalid]=\"isInvalid(ngControl?.control)\"\r\n [placeholder]=\"'components.userSearchField.search' | transloco\"\r\n [multiple]=\"isMultiple()\"\r\n [optionLabel]=\"'displayName'\"\r\n class=\"w-full\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n [dropdown]=\"false\"\r\n [size]=\"size()\"\r\n >\r\n <ng-template let-user pTemplate=\"item\">\r\n <div\r\n class=\"flex w-full min-w-0 items-center gap-2\"\r\n (pointerdown)=\"onSuggestionPointerDown()\"\r\n >\r\n <mt-avatar size=\"small\" icon=\"user.user-01\" />\r\n <div class=\"flex align-items-center gap-3\">\r\n <span class=\"font-medium\">{{ user.displayName }}</span>\r\n <medium class=\"text-gray-500\">{{ \"@\" + user.userName }}</medium>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template let-user pTemplate=\"selecteditem\">\r\n <span class=\"inline-flex items-center gap-1\">\r\n <span>{{ user.displayName }}</span>\r\n @if (\r\n user.isLinkedToCurrentApplication === false && !hideUnlinkedHint()\r\n ) {\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"text-amber-500 text-sm shrink-0\"\r\n [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n tooltipPosition=\"top\"\r\n />\r\n }\r\n </span>\r\n </ng-template>\r\n </p-autoComplete>\r\n @if (hint()) {\r\n <p-inputgroup-addon [mtTooltip]=\"hint()\" tooltipPosition=\"top\">\r\n <mt-icon icon=\"general.help-circle\" />\r\n </p-inputgroup-addon>\r\n } @else {\r\n <p-inputgroup-addon tooltipPosition=\"top\">\r\n <mt-icon icon=\"user.user-03\" />\r\n </p-inputgroup-addon>\r\n }\r\n </p-inputgroup>\r\n\r\n @if (loading()) {\r\n <mt-icon\r\n icon=\"general.loading-01\"\r\n class=\"animate-spin absolute right-3 bg-white top-1/2 -translate-y-1/2\"\r\n />\r\n }\r\n</div>\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":";;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAM,qBAAqB,GAAG,GAAG;AACjC,MAAM,wCAAwC,GAAG,GAAG;MAuBvC,eAAe,CAAA;IAGjB,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC/B;;;;AAIG;AACM,IAAA,gBAAgB,GAAG,KAAK,CAAU,KAAK,uFAAC;IACxC,KAAK,GAAG,KAAK,CAAA,I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CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FASJ,eAAe,EAAA,UAAA,EAAA,CAAA;kBArB3B,SAAS;+BACE,sBAAsB,EAAA,UAAA,EACpB,IAAI,EAAA,OAAA,EACP;wBACP,WAAW;wBACX,kBAAkB;wBAClB,OAAO;wBACP,gBAAgB;wBAChB,qBAAqB;wBACrB,eAAe;wBACf,IAAI;wBACJ,MAAM;wBACN,aAAa;qBACd,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,ylGAAA,EAAA,MAAA,EAAA,CAAA,qGAAA,CAAA,EAAA;;sBA2BA,WAAW;uBAAC,OAAO;oJAgC4B,cAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEzIhE;;AAEG;;;;"}
|
|
@@ -6,6 +6,7 @@ import * as i0 from '@angular/core';
|
|
|
6
6
|
import { InjectionToken, makeEnvironmentProviders, computed, inject, LOCALE_ID, Pipe } from '@angular/core';
|
|
7
7
|
import { tap, catchError, finalize } from 'rxjs/operators';
|
|
8
8
|
import { HttpContextToken } from '@angular/common/http';
|
|
9
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
9
10
|
import { formatDate } from '@angular/common';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -160,156 +161,6 @@ function generateTailwindPalette(baseColorHex, baseColorShade = '500') {
|
|
|
160
161
|
return palette;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
/**
|
|
164
|
-
* Color utility functions for brand display.
|
|
165
|
-
*/
|
|
166
|
-
/**
|
|
167
|
-
* Converts a hex color to a light shade (equivalent to primary-100 in Tailwind).
|
|
168
|
-
* This creates a color with ~10% opacity or a very light tint by mixing with white.
|
|
169
|
-
*/
|
|
170
|
-
function getLightColor(hexColor) {
|
|
171
|
-
const hex = hexColor.replace('#', '');
|
|
172
|
-
const r = parseInt(hex.substring(0, 2), 16);
|
|
173
|
-
const g = parseInt(hex.substring(2, 4), 16);
|
|
174
|
-
const b = parseInt(hex.substring(4, 6), 16);
|
|
175
|
-
const lightR = Math.round(r * 0.1 + 255 * 0.9);
|
|
176
|
-
const lightG = Math.round(g * 0.1 + 255 * 0.9);
|
|
177
|
-
const lightB = Math.round(b * 0.1 + 255 * 0.9);
|
|
178
|
-
return `#${lightR.toString(16).padStart(2, '0')}${lightG
|
|
179
|
-
.toString(16)
|
|
180
|
-
.padStart(2, '0')}${lightB.toString(16).padStart(2, '0')}`;
|
|
181
|
-
}
|
|
182
|
-
function getContrastColor(bgColor) {
|
|
183
|
-
let r = 0, g = 0, b = 0;
|
|
184
|
-
if (bgColor.startsWith('#')) {
|
|
185
|
-
const hex = bgColor.slice(1);
|
|
186
|
-
if (hex.length === 3) {
|
|
187
|
-
r = parseInt(hex[0] + hex[0], 16);
|
|
188
|
-
g = parseInt(hex[1] + hex[1], 16);
|
|
189
|
-
b = parseInt(hex[2] + hex[2], 16);
|
|
190
|
-
}
|
|
191
|
-
else if (hex.length === 6) {
|
|
192
|
-
r = parseInt(hex.slice(0, 2), 16);
|
|
193
|
-
g = parseInt(hex.slice(2, 4), 16);
|
|
194
|
-
b = parseInt(hex.slice(4, 6), 16);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
198
|
-
return luminance > 0.5 ? '' : '#ffffff';
|
|
199
|
-
}
|
|
200
|
-
/** Parses `#rgb` / `#rrggbb` into 0-255 channels. Null when unparseable. */
|
|
201
|
-
function toRgb(hex) {
|
|
202
|
-
const value = hex.trim().replace('#', '');
|
|
203
|
-
const full = value.length === 3
|
|
204
|
-
? value
|
|
205
|
-
.split('')
|
|
206
|
-
.map((c) => c + c)
|
|
207
|
-
.join('')
|
|
208
|
-
: value;
|
|
209
|
-
if (full.length !== 6 || !/^[0-9a-f]{6}$/i.test(full)) {
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
return [
|
|
213
|
-
parseInt(full.slice(0, 2), 16),
|
|
214
|
-
parseInt(full.slice(2, 4), 16),
|
|
215
|
-
parseInt(full.slice(4, 6), 16),
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* WCAG 2.x relative luminance.
|
|
220
|
-
*
|
|
221
|
-
* Note this is NOT the 0.299/0.587/0.114 perceived-brightness formula used by
|
|
222
|
-
* `getContrastColor` above — that one is fine for "is this light or dark?" but
|
|
223
|
-
* it is not the definition a conformance ratio is measured against, so it
|
|
224
|
-
* cannot be used to decide whether text passes AA.
|
|
225
|
-
*/
|
|
226
|
-
function relativeLuminance(hex) {
|
|
227
|
-
const rgb = toRgb(hex);
|
|
228
|
-
if (!rgb) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
const [r, g, b] = rgb.map((channel) => {
|
|
232
|
-
const c = channel / 255;
|
|
233
|
-
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
234
|
-
});
|
|
235
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
236
|
-
}
|
|
237
|
-
/** WCAG contrast ratio between two hex colours, 1–21. Null if either is bad. */
|
|
238
|
-
function contrastRatio(foreground, background) {
|
|
239
|
-
const l1 = relativeLuminance(foreground);
|
|
240
|
-
const l2 = relativeLuminance(background);
|
|
241
|
-
if (l1 === null || l2 === null) {
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
245
|
-
}
|
|
246
|
-
/** WCAG 1.4.3 Contrast Minimum, normal-size text. */
|
|
247
|
-
const WCAG_AA_NORMAL_TEXT = 4.5;
|
|
248
|
-
/**
|
|
249
|
-
* The first shade at or below `preferred` on a generated ramp whose contrast
|
|
250
|
-
* against `foreground` clears `minRatio`.
|
|
251
|
-
*
|
|
252
|
-
* This is how the brand colour stays fully tenant-configurable while the
|
|
253
|
-
* primary button still passes AA (finding H-03). The shipped default
|
|
254
|
-
* `#2AAEC0` gives white text 2.65:1 — the single most important control in the
|
|
255
|
-
* product was the least legible one, and any tenant picking a light brand hit
|
|
256
|
-
* the same wall. Rather than hardcode a darker teal, which fixes exactly one
|
|
257
|
-
* tenant, we keep their hue and step down the ramp their own colour generated
|
|
258
|
-
* until the text is readable.
|
|
259
|
-
*
|
|
260
|
-
* Returns `preferred` unchanged when it already passes, so a tenant whose brand
|
|
261
|
-
* is dark enough sees no change at all. Returns the darkest available shade if
|
|
262
|
-
* none passes — better to be as close as the palette allows than to give up.
|
|
263
|
-
*/
|
|
264
|
-
function pickAccessibleShade(palette, preferred, foreground = '#ffffff', minRatio = WCAG_AA_NORMAL_TEXT) {
|
|
265
|
-
const ladder = ['500', '600', '700', '800', '900'];
|
|
266
|
-
const startIndex = ladder.indexOf(preferred);
|
|
267
|
-
const candidates = startIndex >= 0 ? ladder.slice(startIndex) : ladder;
|
|
268
|
-
let darkestAvailable = null;
|
|
269
|
-
for (const step of candidates) {
|
|
270
|
-
const shade = palette[step];
|
|
271
|
-
if (!shade) {
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
darkestAvailable = step;
|
|
275
|
-
const ratio = contrastRatio(foreground, shade);
|
|
276
|
-
if (ratio !== null && ratio >= minRatio) {
|
|
277
|
-
return step;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
// Nothing on the ramp clears the threshold — return the darkest step the
|
|
281
|
-
// palette actually has rather than one we already know fails. Falls back to
|
|
282
|
-
// `preferred` only when the palette carried none of the ladder steps at all.
|
|
283
|
-
return darkestAvailable ?? preferred;
|
|
284
|
-
}
|
|
285
|
-
/** Dark ink used when white text would not be legible on a status colour. */
|
|
286
|
-
const READABLE_DARK_INK = '#1f2937';
|
|
287
|
-
/**
|
|
288
|
-
* Picks the more legible of white and a dark ink for text sitting on `bgColor`.
|
|
289
|
-
*
|
|
290
|
-
* Status and lookup colours come from a tenant's own catalog, so they can be
|
|
291
|
-
* any hex at all — and the count badges on the Explore cards were painting
|
|
292
|
-
* white on every one of them, which measured 2.59:1 at the low end (finding
|
|
293
|
-
* H-03 / M-04). Rather than restrict what colours a tenant may choose, pick the
|
|
294
|
-
* foreground that actually reads on the colour they chose.
|
|
295
|
-
*
|
|
296
|
-
* Measured with the WCAG relative-luminance ratio, not the perceived-brightness
|
|
297
|
-
* shortcut in `getContrastColor`, because that shortcut is not the definition
|
|
298
|
-
* conformance is judged against. Unparseable input falls back to white, which
|
|
299
|
-
* is the behaviour every caller had before.
|
|
300
|
-
*/
|
|
301
|
-
function readableTextOn(bgColor, dark = READABLE_DARK_INK, light = '#ffffff') {
|
|
302
|
-
if (!bgColor) {
|
|
303
|
-
return light;
|
|
304
|
-
}
|
|
305
|
-
const onLight = contrastRatio(light, bgColor);
|
|
306
|
-
const onDark = contrastRatio(dark, bgColor);
|
|
307
|
-
if (onLight === null || onDark === null) {
|
|
308
|
-
return light;
|
|
309
|
-
}
|
|
310
|
-
return onDark > onLight ? dark : light;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
164
|
/**
|
|
314
165
|
* Masterteam Design System — raw palettes and scales.
|
|
315
166
|
*
|
|
@@ -963,35 +814,11 @@ function getMTDesignIdentity() {
|
|
|
963
814
|
function changePrimaryColor(color) {
|
|
964
815
|
const isDS = activeDesignIdentity === 'experimental';
|
|
965
816
|
const base = color || (isDS ? DS_DEFAULT_PRIMARY_COLOR : '#2AAEC0');
|
|
966
|
-
const anchor = isDS ? '800' : '500';
|
|
967
|
-
const palette = isDS
|
|
968
|
-
? generateTailwindPalette(base, '800')
|
|
969
|
-
: generateTailwindPalette(base);
|
|
970
|
-
const shade = accessiblePrimaryShade(palette, anchor);
|
|
971
817
|
updatePreset({
|
|
972
818
|
semantic: {
|
|
973
|
-
primary:
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
// Re-resolve which step filled controls use, for THIS colour.
|
|
977
|
-
//
|
|
978
|
-
// The bootstrap preset picks the step from whatever colour the app
|
|
979
|
-
// starts with, and a tenant's real brand arrives later — Brand
|
|
980
|
-
// Settings pushes it through here. Without recomputing, the step
|
|
981
|
-
// stayed the one chosen for the startup colour: the tenant's hue was
|
|
982
|
-
// still honoured (the token is a `{primary.N}` reference, so it
|
|
983
|
-
// follows the new ramp) but N was decided for a different colour, so
|
|
984
|
-
// a light brand could still fail AA and a dark one could render
|
|
985
|
-
// needlessly deep. Finding H-03 is only actually closed if this runs
|
|
986
|
-
// on the colour the tenant configured.
|
|
987
|
-
primary: {
|
|
988
|
-
color: `{primary.${shade}}`,
|
|
989
|
-
contrastColor: '#ffffff',
|
|
990
|
-
hoverColor: `{primary.${shade}}`,
|
|
991
|
-
activeColor: `{primary.${shade}}`,
|
|
992
|
-
},
|
|
993
|
-
},
|
|
994
|
-
},
|
|
819
|
+
primary: isDS
|
|
820
|
+
? generateTailwindPalette(base, '800')
|
|
821
|
+
: generateTailwindPalette(base),
|
|
995
822
|
},
|
|
996
823
|
});
|
|
997
824
|
}
|
|
@@ -1027,29 +854,8 @@ function changeTextColor(color) {
|
|
|
1027
854
|
},
|
|
1028
855
|
});
|
|
1029
856
|
}
|
|
1030
|
-
/**
|
|
1031
|
-
* The palette step a filled primary control should use so white text on it
|
|
1032
|
-
* clears WCAG AA (4.5:1).
|
|
1033
|
-
*
|
|
1034
|
-
* Kept as a named helper because it is the whole of finding H-03: the shipped
|
|
1035
|
-
* default `#2AAEC0` gives white text 2.65:1, so Add / New / Filter / Apply /
|
|
1036
|
-
* Submit — the controls that most need to be legible — were the least legible
|
|
1037
|
-
* in the product, and every tenant who configured a light brand colour hit the
|
|
1038
|
-
* same wall. Darkening the shipped hex would have fixed exactly one tenant and
|
|
1039
|
-
* changed the product's colour; this keeps the hue and moves one step down the
|
|
1040
|
-
* ramp their own colour already generated. A brand that passes at 500 stays at
|
|
1041
|
-
* 500 and looks identical.
|
|
1042
|
-
*/
|
|
1043
|
-
function accessiblePrimaryShade(palette, anchor = '500') {
|
|
1044
|
-
return pickAccessibleShade(palette, anchor, '#ffffff', WCAG_AA_NORMAL_TEXT);
|
|
1045
|
-
}
|
|
1046
857
|
const MTPreset = (themeOptions) => {
|
|
1047
858
|
const textPalette = generateTailwindPalette(themeOptions?.textColor ?? '#334155', '700');
|
|
1048
|
-
const primaryPalette = generateTailwindPalette(themeOptions?.primaryColor || '#2AAEC0');
|
|
1049
|
-
// Which shade filled controls use. See `accessiblePrimaryShade` — the tenant's
|
|
1050
|
-
// hue is untouched; only the step on their own ramp moves, and only when white
|
|
1051
|
-
// text would otherwise fail WCAG AA (finding H-03).
|
|
1052
|
-
const primaryActionShade = accessiblePrimaryShade(primaryPalette);
|
|
1053
859
|
const configs = {
|
|
1054
860
|
options: {
|
|
1055
861
|
prefix: 'mt',
|
|
@@ -1061,16 +867,6 @@ const MTPreset = (themeOptions) => {
|
|
|
1061
867
|
semantic: {
|
|
1062
868
|
colorScheme: {
|
|
1063
869
|
light: {
|
|
1064
|
-
// Filled primary surfaces resolve to the first shade whose contrast
|
|
1065
|
-
// with white text passes AA — usually 500, deeper only when the
|
|
1066
|
-
// tenant's brand is too light. Borders/icons keep reading `primary.500`
|
|
1067
|
-
// directly, so the brand accent itself is unchanged.
|
|
1068
|
-
primary: {
|
|
1069
|
-
color: `{primary.${primaryActionShade}}`,
|
|
1070
|
-
contrastColor: '#ffffff',
|
|
1071
|
-
hoverColor: `{primary.${primaryActionShade}}`,
|
|
1072
|
-
activeColor: `{primary.${primaryActionShade}}`,
|
|
1073
|
-
},
|
|
1074
870
|
text: {
|
|
1075
871
|
color: textPalette['700'],
|
|
1076
872
|
hoverColor: textPalette['800'],
|
|
@@ -1087,7 +883,7 @@ const MTPreset = (themeOptions) => {
|
|
|
1087
883
|
},
|
|
1088
884
|
},
|
|
1089
885
|
},
|
|
1090
|
-
primary:
|
|
886
|
+
primary: generateTailwindPalette(themeOptions?.primaryColor || '#2AAEC0'),
|
|
1091
887
|
content: {
|
|
1092
888
|
borderRadius: '{border.radius.lg}',
|
|
1093
889
|
},
|
|
@@ -2380,38 +2176,156 @@ function isInvalid(control) {
|
|
|
2380
2176
|
const REQUEST_CONTEXT = new HttpContextToken(() => ({ useBaseUrl: false }));
|
|
2381
2177
|
|
|
2382
2178
|
/**
|
|
2383
|
-
*
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
*
|
|
2387
|
-
*
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2179
|
+
* Color utility functions for brand display.
|
|
2180
|
+
*/
|
|
2181
|
+
/**
|
|
2182
|
+
* Converts a hex color to a light shade (equivalent to primary-100 in Tailwind).
|
|
2183
|
+
* This creates a color with ~10% opacity or a very light tint by mixing with white.
|
|
2184
|
+
*/
|
|
2185
|
+
function getLightColor(hexColor) {
|
|
2186
|
+
const hex = hexColor.replace('#', '');
|
|
2187
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
2188
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
2189
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
2190
|
+
const lightR = Math.round(r * 0.1 + 255 * 0.9);
|
|
2191
|
+
const lightG = Math.round(g * 0.1 + 255 * 0.9);
|
|
2192
|
+
const lightB = Math.round(b * 0.1 + 255 * 0.9);
|
|
2193
|
+
return `#${lightR.toString(16).padStart(2, '0')}${lightG
|
|
2194
|
+
.toString(16)
|
|
2195
|
+
.padStart(2, '0')}${lightB.toString(16).padStart(2, '0')}`;
|
|
2196
|
+
}
|
|
2197
|
+
function getContrastColor(bgColor) {
|
|
2198
|
+
let r = 0, g = 0, b = 0;
|
|
2199
|
+
if (bgColor.startsWith('#')) {
|
|
2200
|
+
const hex = bgColor.slice(1);
|
|
2201
|
+
if (hex.length === 3) {
|
|
2202
|
+
r = parseInt(hex[0] + hex[0], 16);
|
|
2203
|
+
g = parseInt(hex[1] + hex[1], 16);
|
|
2204
|
+
b = parseInt(hex[2] + hex[2], 16);
|
|
2205
|
+
}
|
|
2206
|
+
else if (hex.length === 6) {
|
|
2207
|
+
r = parseInt(hex.slice(0, 2), 16);
|
|
2208
|
+
g = parseInt(hex.slice(2, 4), 16);
|
|
2209
|
+
b = parseInt(hex.slice(4, 6), 16);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
2213
|
+
return luminance > 0.5 ? '' : '#ffffff';
|
|
2214
|
+
}
|
|
2215
|
+
/** Parses `#rgb` / `#rrggbb` into 0-255 channels. Null when unparseable. */
|
|
2216
|
+
function toRgb(hex) {
|
|
2217
|
+
const value = hex.trim().replace('#', '');
|
|
2218
|
+
const full = value.length === 3
|
|
2219
|
+
? value
|
|
2220
|
+
.split('')
|
|
2221
|
+
.map((c) => c + c)
|
|
2222
|
+
.join('')
|
|
2223
|
+
: value;
|
|
2224
|
+
if (full.length !== 6 || !/^[0-9a-f]{6}$/i.test(full)) {
|
|
2225
|
+
return null;
|
|
2226
|
+
}
|
|
2227
|
+
return [
|
|
2228
|
+
parseInt(full.slice(0, 2), 16),
|
|
2229
|
+
parseInt(full.slice(2, 4), 16),
|
|
2230
|
+
parseInt(full.slice(4, 6), 16),
|
|
2231
|
+
];
|
|
2232
|
+
}
|
|
2233
|
+
/**
|
|
2234
|
+
* WCAG 2.x relative luminance.
|
|
2391
2235
|
*
|
|
2392
|
-
*
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2236
|
+
* Note this is NOT the 0.299/0.587/0.114 perceived-brightness formula used by
|
|
2237
|
+
* `getContrastColor` above — that one is fine for "is this light or dark?" but
|
|
2238
|
+
* it is not the definition a conformance ratio is measured against, so it
|
|
2239
|
+
* cannot be used to decide whether text passes AA.
|
|
2395
2240
|
*/
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2241
|
+
function relativeLuminance(hex) {
|
|
2242
|
+
const rgb = toRgb(hex);
|
|
2243
|
+
if (!rgb) {
|
|
2244
|
+
return null;
|
|
2245
|
+
}
|
|
2246
|
+
const [r, g, b] = rgb.map((channel) => {
|
|
2247
|
+
const c = channel / 255;
|
|
2248
|
+
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
2249
|
+
});
|
|
2250
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
2400
2251
|
}
|
|
2252
|
+
/** WCAG contrast ratio between two hex colours, 1–21. Null if either is bad. */
|
|
2253
|
+
function contrastRatio(foreground, background) {
|
|
2254
|
+
const l1 = relativeLuminance(foreground);
|
|
2255
|
+
const l2 = relativeLuminance(background);
|
|
2256
|
+
if (l1 === null || l2 === null) {
|
|
2257
|
+
return null;
|
|
2258
|
+
}
|
|
2259
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2260
|
+
}
|
|
2261
|
+
/** WCAG 1.4.3 Contrast Minimum, normal-size text. */
|
|
2262
|
+
const WCAG_AA_NORMAL_TEXT = 4.5;
|
|
2263
|
+
/** Dark ink used when white text would not be legible on a status colour. */
|
|
2264
|
+
const READABLE_DARK_INK = '#1f2937';
|
|
2401
2265
|
/**
|
|
2402
|
-
*
|
|
2403
|
-
*
|
|
2266
|
+
* Picks the more legible of white and a dark ink for text sitting on `bgColor`.
|
|
2267
|
+
*
|
|
2268
|
+
* Status and lookup colours come from a tenant's own catalog, so they can be
|
|
2269
|
+
* any hex at all — and the count badges on the Explore cards were painting
|
|
2270
|
+
* white on every one of them, which measured 2.59:1 at the low end (finding
|
|
2271
|
+
* H-03 / M-04). Rather than restrict what colours a tenant may choose, pick the
|
|
2272
|
+
* foreground that actually reads on the colour they chose.
|
|
2404
2273
|
*
|
|
2405
|
-
*
|
|
2406
|
-
*
|
|
2274
|
+
* Measured with the WCAG relative-luminance ratio, not the perceived-brightness
|
|
2275
|
+
* shortcut in `getContrastColor`, because that shortcut is not the definition
|
|
2276
|
+
* conformance is judged against. Unparseable input falls back to white, which
|
|
2277
|
+
* is the behaviour every caller had before.
|
|
2407
2278
|
*/
|
|
2408
|
-
function
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
return name;
|
|
2279
|
+
function readableTextOn(bgColor, dark = READABLE_DARK_INK, light = '#ffffff') {
|
|
2280
|
+
if (!bgColor) {
|
|
2281
|
+
return light;
|
|
2412
2282
|
}
|
|
2413
|
-
const
|
|
2414
|
-
|
|
2283
|
+
const onLight = contrastRatio(light, bgColor);
|
|
2284
|
+
const onDark = contrastRatio(dark, bgColor);
|
|
2285
|
+
if (onLight === null || onDark === null) {
|
|
2286
|
+
return light;
|
|
2287
|
+
}
|
|
2288
|
+
return onDark > onLight ? dark : light;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* A unique DOM id for a form field, shared by its control and its `<label for>`.
|
|
2293
|
+
*
|
|
2294
|
+
* Call it in a property initialiser, where an injection context exists:
|
|
2295
|
+
*
|
|
2296
|
+
* ```ts
|
|
2297
|
+
* readonly fieldId = newFieldId('mt-text-field');
|
|
2298
|
+
* ```
|
|
2299
|
+
*
|
|
2300
|
+
* ---
|
|
2301
|
+
*
|
|
2302
|
+
* Fields used to bind `[id]="ngControl?.name || label()"`, which failed twice
|
|
2303
|
+
* over:
|
|
2304
|
+
*
|
|
2305
|
+
* 1. A field with no control and no label rendered `id="undefined"` —
|
|
2306
|
+
* literally, because Angular stringifies. The global search input was
|
|
2307
|
+
* exactly that, which is why it reported as unlabelled in the accessibility
|
|
2308
|
+
* tree (findings L-03, H-04).
|
|
2309
|
+
*
|
|
2310
|
+
* 2. **A control name is not unique on a page.** Measured on the forms
|
|
2311
|
+
* showcase: `country` on four elements, and 15 of 63 `<label for>` pointing
|
|
2312
|
+
* at an id shared by more than one. A label activates the FIRST element with
|
|
2313
|
+
* that id, so the third "Country" label focused the first Country field —
|
|
2314
|
+
* a wrong-field click for a sighted mouse user, not just a conformance note.
|
|
2315
|
+
*
|
|
2316
|
+
* The first attempt at this fix addressed only (1): it preferred the control
|
|
2317
|
+
* name and fell back to a generated id, which is precisely what produced the
|
|
2318
|
+
* duplicates in (2). Uniqueness has to be the default, not the fallback, so the
|
|
2319
|
+
* id is always generated and never derived from user-facing content.
|
|
2320
|
+
*
|
|
2321
|
+
* `_IdGenerator` is the CDK service Angular Material uses for exactly this, and
|
|
2322
|
+
* CDK is already a dependency here. It salts with the application id, so an app
|
|
2323
|
+
* embedded alongside another Angular app cannot collide either. The underscore
|
|
2324
|
+
* marks it Angular-internal: if a future CDK moves it, the replacement is a
|
|
2325
|
+
* module-scoped counter and this file is the only thing that changes.
|
|
2326
|
+
*/
|
|
2327
|
+
function newFieldId(prefix) {
|
|
2328
|
+
return inject(_IdGenerator).getId(`${prefix}-`);
|
|
2415
2329
|
}
|
|
2416
2330
|
|
|
2417
2331
|
/**
|
|
@@ -2532,5 +2446,5 @@ function parseDateOnlyValue(value) {
|
|
|
2532
2446
|
* Generated bundle index. Do not edit.
|
|
2533
2447
|
*/
|
|
2534
2448
|
|
|
2535
|
-
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid,
|
|
2449
|
+
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
|
|
2536
2450
|
//# sourceMappingURL=masterteam-components.mjs.map
|