@masterteam/components 0.0.263 → 0.0.264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/common.css +1 -1
- package/assets/i18n/ar.json +10 -2
- package/assets/i18n/en.json +10 -2
- package/fesm2022/masterteam-components-business-fields.mjs +13 -8
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-button.mjs +34 -4
- package/fesm2022/masterteam-components-button.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +8 -4
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page-menu.mjs +4 -3
- package/fesm2022/masterteam-components-client-page-menu.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page.mjs +48 -6
- package/fesm2022/masterteam-components-client-page.mjs.map +1 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +8 -4
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +8 -4
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +8 -4
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-empty-state.mjs +53 -0
- package/fesm2022/masterteam-components-empty-state.mjs.map +1 -0
- package/fesm2022/masterteam-components-entities.mjs +184 -34
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +82 -3
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +9 -12
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +9 -5
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +8 -4
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +8 -4
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-page-header.mjs +2 -2
- package/fesm2022/masterteam-components-page-header.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +8 -4
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-cards-field.mjs +8 -3
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +7 -3
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +232 -57
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-tabs.mjs +1 -1
- package/fesm2022/masterteam-components-tabs.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +9 -5
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +8 -4
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-tree.mjs +1 -1
- package/fesm2022/masterteam-components-tree.mjs.map +1 -1
- package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +9 -4
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +8 -4
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +211 -33
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/masterteam-components-business-fields.d.ts +4 -0
- package/types/masterteam-components-button.d.ts +27 -1
- package/types/masterteam-components-checkbox-field.d.ts +4 -0
- package/types/masterteam-components-client-page.d.ts +7 -1
- package/types/masterteam-components-color-picker-field.d.ts +4 -0
- package/types/masterteam-components-date-field.d.ts +4 -0
- package/types/masterteam-components-editor-field.d.ts +4 -0
- package/types/masterteam-components-empty-state.d.ts +47 -0
- package/types/masterteam-components-entities.d.ts +77 -5
- package/types/masterteam-components-field-validation.d.ts +38 -2
- package/types/masterteam-components-icon-field.d.ts +4 -0
- package/types/masterteam-components-location-field.d.ts +4 -0
- package/types/masterteam-components-multi-select-field.d.ts +4 -0
- package/types/masterteam-components-number-field.d.ts +4 -0
- package/types/masterteam-components-pick-list-field.d.ts +4 -0
- package/types/masterteam-components-radio-cards-field.d.ts +4 -0
- package/types/masterteam-components-select-field.d.ts +4 -0
- package/types/masterteam-components-table.d.ts +114 -4
- package/types/masterteam-components-text-field.d.ts +4 -0
- package/types/masterteam-components-textarea-field.d.ts +4 -0
- package/types/masterteam-components-upload-field.d.ts +4 -0
- package/types/masterteam-components-user-search-field.d.ts +4 -0
- package/types/masterteam-components.d.ts +81 -1
|
@@ -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 } 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 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]=\"ngControl?.name || label()\"\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]=\"ngControl?.name || label()\"\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;IACvB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAChC,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAChC,IAAA,UAAU,GAAG,KAAK,CAAU,KAAK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cAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEtIhE;;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, 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,sBAAs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A,IAAA,EACJ,MAAM,sLACN,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,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,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;;;;"}
|
|
@@ -160,6 +160,156 @@ function generateTailwindPalette(baseColorHex, baseColorShade = '500') {
|
|
|
160
160
|
return palette;
|
|
161
161
|
}
|
|
162
162
|
|
|
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
|
+
|
|
163
313
|
/**
|
|
164
314
|
* Masterteam Design System — raw palettes and scales.
|
|
165
315
|
*
|
|
@@ -853,8 +1003,29 @@ function changeTextColor(color) {
|
|
|
853
1003
|
},
|
|
854
1004
|
});
|
|
855
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* The palette step a filled primary control should use so white text on it
|
|
1008
|
+
* clears WCAG AA (4.5:1).
|
|
1009
|
+
*
|
|
1010
|
+
* Kept as a named helper because it is the whole of finding H-03: the shipped
|
|
1011
|
+
* default `#2AAEC0` gives white text 2.65:1, so Add / New / Filter / Apply /
|
|
1012
|
+
* Submit — the controls that most need to be legible — were the least legible
|
|
1013
|
+
* in the product, and every tenant who configured a light brand colour hit the
|
|
1014
|
+
* same wall. Darkening the shipped hex would have fixed exactly one tenant and
|
|
1015
|
+
* changed the product's colour; this keeps the hue and moves one step down the
|
|
1016
|
+
* ramp their own colour already generated. A brand that passes at 500 stays at
|
|
1017
|
+
* 500 and looks identical.
|
|
1018
|
+
*/
|
|
1019
|
+
function accessiblePrimaryShade(palette) {
|
|
1020
|
+
return pickAccessibleShade(palette, '500', '#ffffff', WCAG_AA_NORMAL_TEXT);
|
|
1021
|
+
}
|
|
856
1022
|
const MTPreset = (themeOptions) => {
|
|
857
1023
|
const textPalette = generateTailwindPalette(themeOptions?.textColor ?? '#334155', '700');
|
|
1024
|
+
const primaryPalette = generateTailwindPalette(themeOptions?.primaryColor || '#2AAEC0');
|
|
1025
|
+
// Which shade filled controls use. See `accessiblePrimaryShade` — the tenant's
|
|
1026
|
+
// hue is untouched; only the step on their own ramp moves, and only when white
|
|
1027
|
+
// text would otherwise fail WCAG AA (finding H-03).
|
|
1028
|
+
const primaryActionShade = accessiblePrimaryShade(primaryPalette);
|
|
858
1029
|
const configs = {
|
|
859
1030
|
options: {
|
|
860
1031
|
prefix: 'mt',
|
|
@@ -866,6 +1037,16 @@ const MTPreset = (themeOptions) => {
|
|
|
866
1037
|
semantic: {
|
|
867
1038
|
colorScheme: {
|
|
868
1039
|
light: {
|
|
1040
|
+
// Filled primary surfaces resolve to the first shade whose contrast
|
|
1041
|
+
// with white text passes AA — usually 500, deeper only when the
|
|
1042
|
+
// tenant's brand is too light. Borders/icons keep reading `primary.500`
|
|
1043
|
+
// directly, so the brand accent itself is unchanged.
|
|
1044
|
+
primary: {
|
|
1045
|
+
color: `{primary.${primaryActionShade}}`,
|
|
1046
|
+
contrastColor: '#ffffff',
|
|
1047
|
+
hoverColor: `{primary.${primaryActionShade}}`,
|
|
1048
|
+
activeColor: `{primary.${primaryActionShade}}`,
|
|
1049
|
+
},
|
|
869
1050
|
text: {
|
|
870
1051
|
color: textPalette['700'],
|
|
871
1052
|
hoverColor: textPalette['800'],
|
|
@@ -882,7 +1063,7 @@ const MTPreset = (themeOptions) => {
|
|
|
882
1063
|
},
|
|
883
1064
|
},
|
|
884
1065
|
},
|
|
885
|
-
primary:
|
|
1066
|
+
primary: primaryPalette,
|
|
886
1067
|
content: {
|
|
887
1068
|
borderRadius: '{border.radius.lg}',
|
|
888
1069
|
},
|
|
@@ -2175,41 +2356,38 @@ function isInvalid(control) {
|
|
|
2175
2356
|
const REQUEST_CONTEXT = new HttpContextToken(() => ({ useBaseUrl: false }));
|
|
2176
2357
|
|
|
2177
2358
|
/**
|
|
2178
|
-
*
|
|
2359
|
+
* Stable DOM ids for form fields.
|
|
2360
|
+
*
|
|
2361
|
+
* Every field component used to bind `[id]="ngControl?.name || label()"`. Used
|
|
2362
|
+
* inside a reactive form that resolves, but a stand-alone field with no control
|
|
2363
|
+
* and no label produced `id="undefined"` — literally, because Angular
|
|
2364
|
+
* stringifies. The global search input was exactly that case, which is why it
|
|
2365
|
+
* also had no associated `<label>` and reported as unlabelled in the
|
|
2366
|
+
* accessibility tree (findings L-03 and H-04).
|
|
2367
|
+
*
|
|
2368
|
+
* `slider-field` already solved this locally; this is that solution extracted so
|
|
2369
|
+
* the six components that got it wrong share one implementation instead of six
|
|
2370
|
+
* near-copies.
|
|
2179
2371
|
*/
|
|
2372
|
+
let nextUniqueId = 0;
|
|
2373
|
+
/** A process-unique fallback id, e.g. `mt-text-field-3`. */
|
|
2374
|
+
function nextFieldId(prefix) {
|
|
2375
|
+
return `${prefix}-${nextUniqueId++}`;
|
|
2376
|
+
}
|
|
2180
2377
|
/**
|
|
2181
|
-
*
|
|
2182
|
-
*
|
|
2378
|
+
* The id a field should render, in preference order: the reactive form control
|
|
2379
|
+
* name, then a slug of the visible label, then the generated fallback.
|
|
2380
|
+
*
|
|
2381
|
+
* Never returns an empty string or `"undefined"` — a label/input pair is only
|
|
2382
|
+
* associated if the id is real, so the fallback matters more than it looks.
|
|
2183
2383
|
*/
|
|
2184
|
-
function
|
|
2185
|
-
const
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
const b = parseInt(hex.substring(4, 6), 16);
|
|
2189
|
-
const lightR = Math.round(r * 0.1 + 255 * 0.9);
|
|
2190
|
-
const lightG = Math.round(g * 0.1 + 255 * 0.9);
|
|
2191
|
-
const lightB = Math.round(b * 0.1 + 255 * 0.9);
|
|
2192
|
-
return `#${lightR.toString(16).padStart(2, '0')}${lightG
|
|
2193
|
-
.toString(16)
|
|
2194
|
-
.padStart(2, '0')}${lightB.toString(16).padStart(2, '0')}`;
|
|
2195
|
-
}
|
|
2196
|
-
function getContrastColor(bgColor) {
|
|
2197
|
-
let r = 0, g = 0, b = 0;
|
|
2198
|
-
if (bgColor.startsWith('#')) {
|
|
2199
|
-
const hex = bgColor.slice(1);
|
|
2200
|
-
if (hex.length === 3) {
|
|
2201
|
-
r = parseInt(hex[0] + hex[0], 16);
|
|
2202
|
-
g = parseInt(hex[1] + hex[1], 16);
|
|
2203
|
-
b = parseInt(hex[2] + hex[2], 16);
|
|
2204
|
-
}
|
|
2205
|
-
else if (hex.length === 6) {
|
|
2206
|
-
r = parseInt(hex.slice(0, 2), 16);
|
|
2207
|
-
g = parseInt(hex.slice(2, 4), 16);
|
|
2208
|
-
b = parseInt(hex.slice(4, 6), 16);
|
|
2209
|
-
}
|
|
2384
|
+
function resolveFieldId(controlName, label, fallbackId) {
|
|
2385
|
+
const name = controlName?.toString().trim();
|
|
2386
|
+
if (name) {
|
|
2387
|
+
return name;
|
|
2210
2388
|
}
|
|
2211
|
-
const
|
|
2212
|
-
return
|
|
2389
|
+
const slug = label?.trim().toLowerCase().replace(/\s+/g, '-');
|
|
2390
|
+
return slug || fallbackId;
|
|
2213
2391
|
}
|
|
2214
2392
|
|
|
2215
2393
|
/**
|
|
@@ -2330,5 +2508,5 @@ function parseDateOnlyValue(value) {
|
|
|
2330
2508
|
* Generated bundle index. Do not edit.
|
|
2331
2509
|
*/
|
|
2332
2510
|
|
|
2333
|
-
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, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
|
|
2511
|
+
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, nextFieldId, parseClockTime, pickAccessibleShade, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, resolveFieldId, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
|
|
2334
2512
|
//# sourceMappingURL=masterteam-components.mjs.map
|