@sevtech/kit 21.6.2 → 21.8.0
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/http.mjs +19 -4
- package/fesm2022/http.mjs.map +1 -1
- package/fesm2022/ng-misc.mjs +79 -4
- package/fesm2022/ng-misc.mjs.map +1 -1
- package/fesm2022/ui-yoda.mjs +4 -4
- package/fesm2022/ui-yoda.mjs.map +1 -1
- package/http/index.d.ts +13 -2
- package/ng-misc/index.d.ts +27 -2
- package/package.json +1 -1
package/fesm2022/ng-misc.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable, linkedSignal, effect, booleanAttribute, ViewContainerRef, TemplateRef, ComponentRef } from '@angular/core';
|
|
3
3
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
5
|
-
import { map, distinctUntilChanged, Observable, of, isObservable, from, catchError, EMPTY } from 'rxjs';
|
|
6
|
-
import { isNil, isString, isNumber, isPlainObject, toArray, isPromise } from '@sevtech/kit/misc';
|
|
4
|
+
import { Router, ActivatedRoute, DefaultUrlSerializer, UrlTree, PRIMARY_OUTLET } from '@angular/router';
|
|
5
|
+
import { map, distinctUntilChanged, Observable, of, isObservable, from, catchError, EMPTY, filter, share } from 'rxjs';
|
|
6
|
+
import { isNil, isString, isNumber, isPlainObject, toArray, isPromise, isNonEmptyString } from '@sevtech/kit/misc';
|
|
7
7
|
export { toCssDimension as cssDimensionAttribute } from '@sevtech/kit/misc';
|
|
8
8
|
import { NgComponentOutlet } from '@angular/common';
|
|
9
9
|
import { FormControl, FormGroup, FormArray, FormRecord, Validators, AbstractControl } from '@angular/forms';
|
|
@@ -286,9 +286,84 @@ function safeCatchError(...fallback) {
|
|
|
286
286
|
return catchError(() => (fallback.length ? of(fallback[0]) : EMPTY));
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
const RELATIVE_URL_BASE = new URL('https://relative.invalid/');
|
|
290
|
+
const ABSOLUTE_URL_PREFIX = /^[\u0000-\u0020]*(?:[a-z][a-z0-9+.-]*:|[/\\]{2})/i;
|
|
291
|
+
const PLAIN_BLOCKED_PATH = /^\/?[\w-]+(?:\/[\w-]+)*$/;
|
|
292
|
+
const serializer = new DefaultUrlSerializer();
|
|
293
|
+
/**
|
|
294
|
+
* Оставляет ровно один `/` в начале пути.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* withLeadingSlash('//login'); // '/login'
|
|
298
|
+
*/
|
|
299
|
+
function withLeadingSlash(path) {
|
|
300
|
+
return `/${path.replace(/^\/+/, '')}`;
|
|
301
|
+
}
|
|
302
|
+
/** Проверяет, что значение — `UrlTree` или непустая строка. */
|
|
303
|
+
function isRouterUrlInput(url) {
|
|
304
|
+
return url instanceof UrlTree || isNonEmptyString(url);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Возвращает локальный URL для Angular Router или null.
|
|
308
|
+
* Принимает относительные ссылки и пути от корня приложения.
|
|
309
|
+
* Сравнивает запрещённые маршруты по основному outlet через {@link DefaultUrlSerializer}.
|
|
310
|
+
* При сравнении игнорирует matrix-параметры, query и фрагмент.
|
|
311
|
+
* Параметры, фрагмент и дополнительные outlets разрешённого URL сохраняются.
|
|
312
|
+
*/
|
|
313
|
+
function toSafeRelativeUrl(url, blocked = []) {
|
|
314
|
+
if (!isNonEmptyString(url))
|
|
315
|
+
return null;
|
|
316
|
+
const input = url.replace(/[\t\n\r]/g, '');
|
|
317
|
+
if (ABSOLUTE_URL_PREFIX.test(input))
|
|
318
|
+
return null;
|
|
319
|
+
try {
|
|
320
|
+
const parsed = new URL(input, RELATIVE_URL_BASE);
|
|
321
|
+
if (parsed.origin !== RELATIVE_URL_BASE.origin)
|
|
322
|
+
return null;
|
|
323
|
+
const relative = toRouterUrl(parsed);
|
|
324
|
+
const tree = serializer.parse(relative);
|
|
325
|
+
const blockedPaths = typeof blocked === 'string' ? [blocked] : blocked;
|
|
326
|
+
if (blockedPaths.length === 0)
|
|
327
|
+
return relative;
|
|
328
|
+
const primaryPath = getPrimaryPath(tree);
|
|
329
|
+
const isBlocked = blockedPaths.some((path) => getBlockedPrimaryPath(path) === primaryPath);
|
|
330
|
+
return isBlocked ? null : relative;
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function toRouterUrl(url) {
|
|
337
|
+
return withLeadingSlash(url.pathname) + url.search + url.hash;
|
|
338
|
+
}
|
|
339
|
+
function getBlockedPrimaryPath(path) {
|
|
340
|
+
if (PLAIN_BLOCKED_PATH.test(path)) {
|
|
341
|
+
return path.startsWith('/') ? path.slice(1) : path;
|
|
342
|
+
}
|
|
343
|
+
const url = new URL(RELATIVE_URL_BASE.origin + withLeadingSlash(path));
|
|
344
|
+
return getPrimaryPath(serializer.parse(toRouterUrl(url)));
|
|
345
|
+
}
|
|
346
|
+
function getPrimaryPath({ root }) {
|
|
347
|
+
const segments = [];
|
|
348
|
+
for (let group = root.children[PRIMARY_OUTLET]; group; group = group.children[PRIMARY_OUTLET]) {
|
|
349
|
+
for (const { path } of group.segments) {
|
|
350
|
+
segments.push(encodeURIComponent(path));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return segments.join('/').replace(/\/+$/, '');
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Возвращает поток указанных событий Router с общей фильтрацией для его подписчиков.
|
|
358
|
+
* Вызывать в контексте инъекции.
|
|
359
|
+
*/
|
|
360
|
+
function injectRouterEvents(...eventClasses) {
|
|
361
|
+
return inject(Router).events.pipe(filter((event) => eventClasses.some((eventClass) => event instanceof eventClass)), share());
|
|
362
|
+
}
|
|
363
|
+
|
|
289
364
|
/**
|
|
290
365
|
* Generated bundle index. Do not edit.
|
|
291
366
|
*/
|
|
292
367
|
|
|
293
|
-
export { collectFeatureProviders, dateAttribute, defineKitFeature, fromMaybeAsync, htmlBooleanAttribute, ifAsyncValidator, ifValidator, isComponentOutlet, isComponentRef, isFormArray, isFormControl, isFormGroup, isFormRecord, isTemplateRef, isViewContainer, linkedQueryParam, resizeObservable, resolveConfigProviders, revalidateOn, safeCatchError };
|
|
368
|
+
export { collectFeatureProviders, dateAttribute, defineKitFeature, fromMaybeAsync, htmlBooleanAttribute, ifAsyncValidator, ifValidator, injectRouterEvents, isComponentOutlet, isComponentRef, isFormArray, isFormControl, isFormGroup, isFormRecord, isRouterUrlInput, isTemplateRef, isViewContainer, linkedQueryParam, resizeObservable, resolveConfigProviders, revalidateOn, safeCatchError, toSafeRelativeUrl, withLeadingSlash };
|
|
294
369
|
//# sourceMappingURL=ng-misc.mjs.map
|
package/fesm2022/ng-misc.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-misc.mjs","sources":["../../../projects/kit/ng-misc/lib/linked-query-param.ts","../../../projects/kit/ng-misc/lib/resize-observable.ts","../../../projects/kit/ng-misc/lib/transform-inputs.ts","../../../projects/kit/ng-misc/lib/type-guards.ts","../../../projects/kit/ng-misc/lib/feature-providers.ts","../../../projects/kit/ng-misc/lib/validators.ts","../../../projects/kit/ng-misc/lib/rxjs-utils.ts","../../../projects/kit/ng-misc/ng-misc.ts"],"sourcesContent":["import { effect, inject, Injectable, linkedSignal, WritableSignal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\nimport { distinctUntilChanged, map } from 'rxjs';\nimport { isNil } from '@sevtech/kit/misc';\n\nexport interface LinkedQueryParamOptions<T = string | undefined> {\n /** Сырое значение параметра в значение сигнала; `null` — параметра нет в URL. */\n transform: (raw: string | null) => T;\n /** Значение сигнала в строку; `null` удаляет параметр из URL. */\n serialize?: (value: T) => string | null;\n /** Задержка перед записью в URL после изменения сигнала. По умолчанию — без задержки. */\n debounce?: number;\n /**\n * Обновлять URL через `replaceState` (без записи в history) или через\n * `pushState`. По умолчанию `true` (`replaceState`).\n */\n replaceUrl?: boolean;\n}\n\nconst defaultSerialize = (value: unknown): string | null => (isNil(value) ? null : String(value));\nconst defaultTransform = (raw: string | null): string | undefined => raw ?? undefined;\n\n@Injectable({\n providedIn: 'root',\n})\nclass QueryParamsQueue {\n private readonly router = inject(Router);\n private pending = new Map<string, string | null>();\n private replaceUrl = true;\n private waiters: Array<(ok: boolean) => void> = [];\n private flushing: Promise<void> | null = null;\n\n schedule(key: string, value: string | null, replaceUrl: boolean): Promise<boolean> {\n this.pending.set(key, value);\n this.replaceUrl &&= replaceUrl;\n\n const result = new Promise<boolean>((resolve) => this.waiters.push(resolve));\n\n this.flushing ??= this.run();\n return result;\n }\n\n private async run(): Promise<void> {\n await Promise.resolve();\n\n while (this.pending.size > 0) {\n const queryParams = Object.fromEntries(this.pending);\n const replaceUrl = this.replaceUrl;\n const waiters = this.waiters;\n\n this.pending = new Map();\n this.replaceUrl = true;\n this.waiters = [];\n\n const ok = await this.navigate(queryParams, replaceUrl);\n\n waiters.forEach((resolve) => resolve(ok));\n }\n\n this.flushing = null;\n }\n\n private async navigate(queryParams: Params, replaceUrl: boolean): Promise<boolean> {\n try {\n return await this.router.navigate([], {\n replaceUrl,\n queryParams,\n preserveFragment: true,\n queryParamsHandling: 'merge',\n });\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Двусторонний сигнал, связанный с query-параметром текущего роута:\n * чтение отражает URL, запись обновляет URL через `router.navigate`\n * без гонки с другими `linkedQueryParam` на той же странице.\n *\n * @example\n * class MyComponent {\n * search = linkedQueryParam('q', { debounce: 300 });\n * page = linkedQueryParam('page', {\n * transform: (raw) => Number(raw) || 1,\n * serialize: (value) => (value > 1 ? String(value) : null),\n * });\n * }\n */\nexport function linkedQueryParam<T>(\n key: string,\n options: LinkedQueryParamOptions<T>,\n): WritableSignal<T>;\nexport function linkedQueryParam(\n key: string,\n options?: Omit<LinkedQueryParamOptions, 'transform' | 'serialize'>,\n): WritableSignal<string | undefined>;\nexport function linkedQueryParam<T = string | undefined>(\n key: string,\n options?: Partial<LinkedQueryParamOptions<T>>,\n): WritableSignal<T> {\n const route = inject(ActivatedRoute);\n const queue = inject(QueryParamsQueue);\n\n const transform = (options?.transform ?? defaultTransform) as (raw: string | null) => T;\n const serialize = (options?.serialize ?? defaultSerialize) as (value: T) => string | null;\n\n const source$$ = toSignal(\n route.queryParamMap.pipe(\n map((params) => params.get(key)),\n distinctUntilChanged(),\n map(transform),\n ),\n { initialValue: transform(route.snapshot.queryParamMap.get(key)) },\n );\n\n const state$$ = linkedSignal(() => source$$());\n\n effect((onCleanup) => {\n const raw = serialize(state$$());\n if (raw === serialize(source$$())) return;\n\n const write = () => {\n queue.schedule(key, raw, options?.replaceUrl ?? true).then((ok) => {\n if (!ok) state$$.set(source$$());\n });\n };\n\n if (!options?.debounce) return write();\n\n const timer = setTimeout(write, options.debounce);\n onCleanup(() => clearTimeout(timer));\n });\n\n return state$$;\n}\n","import { Observable } from 'rxjs';\n\n/**\n * Эмитит при изменении размеров элемента; отписка снимает наблюдение.\n * @example\n * resizeObservable(host).subscribe((entries) => entries[0].contentRect.width);\n */\nexport function resizeObservable(element: HTMLElement): Observable<ResizeObserverEntry[]> {\n return new Observable((subscriber) => {\n const resizeObserver = new ResizeObserver((entries) => {\n subscriber.next(entries);\n });\n\n resizeObserver.observe(element);\n\n return () => {\n resizeObserver.unobserve(element);\n };\n });\n}\n","import { booleanAttribute } from '@angular/core';\nimport { isNumber, isString } from '@sevtech/kit/misc';\n\n/**\n * Transform-функция для инпутов CSS-размера: число и числовая строка получают `px`,\n * готовый размер и `Nil` проходят как есть.\n *\n * Псевдоним `toCssDimension` — имя единообразно с остальными transform-функциями.\n * Для другой единицы вызывайте его напрямую: `(value) => toCssDimension(value, 'rem')`.\n */\nexport { toCssDimension as cssDimensionAttribute } from '@sevtech/kit/misc';\n\n/**\n * Transform-функция для булевых HTML-атрибутов. В отличие от `booleanAttribute`, отдаёт\n * `true | undefined` вместо `boolean` — атрибут либо присутствует в шаблоне, либо нет.\n *\n * @example\n * disabled = input(undefined, { transform: htmlBooleanAttribute });\n * // <my-component disabled /> → true\n * // <my-component /> → undefined\n */\nexport function htmlBooleanAttribute(value: unknown): true | undefined {\n return booleanAttribute(value) || undefined;\n}\n\n/**\n * Transform-функция для инпутов даты: `Date`, строка и timestamp приводятся к `Date`,\n * невалидное значение и `Nil` — к `fallbackValue`.\n *\n * @example\n * startDate = input<Date | null, unknown>(null, { transform: dateAttribute });\n * // свой дефолт: transform: (value) => dateAttribute(value, new Date())\n */\nexport function dateAttribute(value: unknown, fallbackValue: Date | null = null): Date | null {\n if (value == null || value === '') return fallbackValue;\n\n const date =\n value instanceof Date ? value : isString(value) || isNumber(value) ? new Date(value) : null;\n\n return date === null || isNaN(date.getTime()) ? fallbackValue : date;\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport { ComponentRef, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { FormArray, FormControl, FormGroup, FormRecord } from '@angular/forms';\n\n/** Проверяет, что значение — `FormControl`. */\nexport function isFormControl<T = unknown>(data: unknown): data is FormControl<T> {\n return data instanceof FormControl;\n}\n\n/** Проверяет, что значение — `FormGroup`. */\nexport function isFormGroup(data: unknown): data is FormGroup {\n return data instanceof FormGroup;\n}\n\n/** Проверяет, что значение — `FormArray`. */\nexport function isFormArray(data: unknown): data is FormArray {\n return data instanceof FormArray;\n}\n\n/** Проверяет, что значение — `FormRecord`. */\nexport function isFormRecord(data: unknown): data is FormRecord {\n return data instanceof FormRecord;\n}\n\n/** Проверяет, что значение — `ViewContainerRef`. */\nexport function isViewContainer(data: unknown): data is ViewContainerRef {\n return data instanceof ViewContainerRef;\n}\n\n/** Проверяет, что значение — `TemplateRef`. Полезно для инпутов вида `TemplateRef | string`. */\nexport function isTemplateRef<Context = unknown>(data: unknown): data is TemplateRef<Context> {\n return data instanceof TemplateRef;\n}\n\n/** Проверяет, что значение — `ComponentRef`. */\nexport function isComponentRef<Instance>(data: unknown): data is ComponentRef<Instance> {\n return data instanceof ComponentRef;\n}\n\n/** Проверяет, что значение — `NgComponentOutlet`. */\nexport function isComponentOutlet(data: unknown): data is NgComponentOutlet {\n return data instanceof NgComponentOutlet;\n}\n","import { Provider } from '@angular/core';\nimport { isPlainObject, MaybeArray, toArray } from '@sevtech/kit/misc';\n\n/** Публичный маркер: объект-«фича», возвращаемый withXxx()-функциями. */\nexport interface KitFeature<TKind extends number = number> {\n readonly ɵkind: TKind;\n readonly ɵproviders: Provider[];\n}\n\nfunction isKitFeature(value: unknown): value is KitFeature {\n return isPlainObject(value) && 'ɵkind' in value;\n}\n\n/**\n * Создаёт withXxx()-функцию: связывает вид фичи с фабрикой её провайдеров.\n * Вид задаётся локальным `const enum`, поэтому фича одного модуля не пройдёт\n * в `provide*` другого.\n *\n * @example\n * const enum FeatureKind { Prefix }\n *\n * export const withPrefix = defineKitFeature(\n * FeatureKind.Prefix,\n * (prefix: string) => ({ provide: API_PREFIX, useValue: prefix }),\n * );\n */\nexport function defineKitFeature<Kind extends number, Args extends unknown[]>(\n kind: Kind,\n build: (...args: Args) => MaybeArray<Provider>,\n): (...args: Args) => KitFeature<Kind> {\n return (...args) => ({\n ɵkind: kind,\n ɵproviders: toArray(build(...args)),\n });\n}\n\n/** Собирает Provider[] со всех переданных KitFeature-объектов. */\nexport function collectFeatureProviders(...items: unknown[]): Provider[] {\n const providers: Provider[] = [];\n\n for (const item of items) {\n if (!isKitFeature(item)) continue;\n providers.push(...item.ɵproviders);\n }\n\n return providers;\n}\n\n/**\n * Резолвит Provider[] для параметра, который может быть\n * либо «сырым» конфигом, либо уже готовой KitFeature (тогда пропускается —\n * её обработает collectFeatureProviders).\n */\nexport function resolveConfigProviders<TConfig>(\n config: TConfig,\n handler: (config: Exclude<TConfig, KitFeature>) => MaybeArray<Provider>,\n): Provider[] {\n if (isKitFeature(config)) return [];\n\n return toArray(handler(config as Exclude<TConfig, KitFeature>));\n}\n","import { Observable, of } from 'rxjs';\nimport { DestroyRef } from '@angular/core';\nimport { MaybeArray, toArray } from '@sevtech/kit/misc';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { AbstractControl, AsyncValidatorFn, ValidatorFn, Validators } from '@angular/forms';\n\nconst compose = (validators?: ValidatorFn | ValidatorFn[]): ValidatorFn | null =>\n Array.isArray(validators) ? Validators.compose(validators) : (validators ?? null);\n\nconst composeAsync = (\n validators?: AsyncValidatorFn | AsyncValidatorFn[],\n): AsyncValidatorFn | null =>\n Array.isArray(validators) ? Validators.composeAsync(validators) : (validators ?? null);\n\n/**\n * Применяет `validators`, когда `condition` вернул `true`, и `otherwise` — когда `false`.\n * Ветка без валидаторов считается валидной.\n *\n * Если `condition` зависит не от значения своего контрола — нужен {@link revalidateOn}.\n *\n * @example\n * new FormControl('', ifValidator(isCourier, [Validators.required, Validators.maxLength(200)]));\n * new FormControl('', ifValidator(isCourier, Validators.required, mustBeEmpty));\n */\nexport function ifValidator(\n condition: (control: AbstractControl) => boolean,\n validators: ValidatorFn | ValidatorFn[],\n otherwise?: ValidatorFn | ValidatorFn[],\n): ValidatorFn {\n const onTrue = compose(validators);\n const onFalse = compose(otherwise);\n\n return (control) => {\n const validator = condition(control) ? onTrue : onFalse;\n\n return validator ? validator(control) : null;\n };\n}\n\n/** Асинхронный вариант {@link ifValidator} — в невыбранной ветке запрос не уходит вовсе. */\nexport function ifAsyncValidator(\n condition: (control: AbstractControl) => boolean,\n validators: AsyncValidatorFn | AsyncValidatorFn[],\n otherwise?: AsyncValidatorFn | AsyncValidatorFn[],\n): AsyncValidatorFn {\n const onTrue = composeAsync(validators);\n const onFalse = composeAsync(otherwise);\n\n return (control) => {\n const validator = condition(control) ? onTrue : onFalse;\n\n return validator ? validator(control) : of(null);\n };\n}\n\nexport interface RevalidateOnOptions {\n /**\n * Эмитить ли `valueChanges`/`statusChanges` целей. По умолчанию `true`.\n * `false` спасает от ложного автосохранения, но глушит `statusChanges` и рвёт\n * цепочки перевалидации. Статусы пересчитываются в обоих случаях.\n */\n emitEvent?: boolean;\n /** Для вызова вне injection context — как в `takeUntilDestroyed`. */\n destroyRef?: DestroyRef;\n}\n\n/**\n * Перевалидирует `targets` при изменении `source` — и один раз сразу, чтобы закрыть\n * первый проход, на котором `control.parent` ещё не проставлен.\n *\n * Нужен валидаторам, зависящим не от значения своего контрола: reactive forms\n * перезапускают их только на изменение собственного значения.\n *\n * @example\n * constructor() {\n * const { delivery, address, entrance } = this.form.controls;\n *\n * revalidateOn(delivery, [address, entrance]);\n * }\n */\nexport function revalidateOn(\n source: AbstractControl | Observable<unknown>,\n targets: MaybeArray<AbstractControl>,\n options?: RevalidateOnOptions,\n): void {\n const changes$ = source instanceof AbstractControl ? source.valueChanges : source;\n const controls = toArray(targets);\n const emitEvent = options?.emitEvent;\n let running = false;\n\n const revalidate = () => {\n // `updateValueAndValidity()` эмитит `valueChanges` цели → встречные связки уходят\n // в рекурсию, причём молча: RxJS глотает исключение из next-обработчика\n if (running) return;\n running = true;\n\n try {\n for (const control of controls) {\n control.updateValueAndValidity({ emitEvent });\n }\n } finally {\n running = false;\n }\n };\n\n revalidate();\n changes$.pipe(takeUntilDestroyed(options?.destroyRef)).subscribe(revalidate);\n}\n","import type { MaybeAsync } from './types';\nimport {\n catchError,\n EMPTY,\n from,\n isObservable,\n MonoTypeOperatorFunction,\n Observable,\n of,\n OperatorFunction,\n} from 'rxjs';\nimport { isPromise } from '@sevtech/kit/misc';\n\n/**\n * Приводит значение, промис или `Observable` к `Observable`.\n * Значение эмитится синхронно, промис — после разрешения, `Observable` возвращается как есть.\n */\nexport function fromMaybeAsync<T>(value: MaybeAsync<T>): Observable<T> {\n if (isObservable(value)) return value;\n\n return isPromise(value) ? from(value) : of(value);\n}\n\n/** Обрабатывает ошибку потока, заменяя его на `EMPTY` или `fallback`. */\nexport function safeCatchError<T>(): MonoTypeOperatorFunction<T>;\nexport function safeCatchError<T, R>(fallback: R): OperatorFunction<T, T | R>;\nexport function safeCatchError<T, R>(...fallback: [] | [R]): OperatorFunction<T, T | R> {\n return catchError(() => (fallback.length ? of(fallback[0]) : EMPTY));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,gBAAgB,GAAG,CAAC,KAAc,MAAqB,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACjG,MAAM,gBAAgB,GAAG,CAAC,GAAkB,KAAyB,GAAG,IAAI,SAAS;AAErF,MAGM,gBAAgB,CAAA;AAHtB,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAChC,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,GAAG,EAAyB;QAC1C,IAAA,CAAA,UAAU,GAAG,IAAI;QACjB,IAAA,CAAA,OAAO,GAAiC,EAAE;QAC1C,IAAA,CAAA,QAAQ,GAAyB,IAAI;AA4C9C,IAAA;AA1CC,IAAA,QAAQ,CAAC,GAAW,EAAE,KAAoB,EAAE,UAAmB,EAAA;QAC7D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;AAC5B,QAAA,IAAI,CAAC,UAAU,KAAK,UAAU;AAE9B,QAAA,MAAM,MAAM,GAAG,IAAI,OAAO,CAAU,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE5E,QAAA,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,GAAG,EAAE;AAC5B,QAAA,OAAO,MAAM;IACf;AAEQ,IAAA,MAAM,GAAG,GAAA;AACf,QAAA,MAAM,OAAO,CAAC,OAAO,EAAE;QAEvB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE;YAC5B,MAAM,WAAW,GAAG,M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3,"file":"ng-misc.mjs","sources":["../../../projects/kit/ng-misc/lib/linked-query-param.ts","../../../projects/kit/ng-misc/lib/resize-observable.ts","../../../projects/kit/ng-misc/lib/transform-inputs.ts","../../../projects/kit/ng-misc/lib/type-guards.ts","../../../projects/kit/ng-misc/lib/feature-providers.ts","../../../projects/kit/ng-misc/lib/validators.ts","../../../projects/kit/ng-misc/lib/rxjs-utils.ts","../../../projects/kit/ng-misc/lib/router-utils.ts","../../../projects/kit/ng-misc/lib/router-events.ts","../../../projects/kit/ng-misc/ng-misc.ts"],"sourcesContent":["import { effect, inject, Injectable, linkedSignal, WritableSignal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\nimport { distinctUntilChanged, map } from 'rxjs';\nimport { isNil } from '@sevtech/kit/misc';\n\nexport interface LinkedQueryParamOptions<T = string | undefined> {\n /** Сырое значение параметра в значение сигнала; `null` — параметра нет в URL. */\n transform: (raw: string | null) => T;\n /** Значение сигнала в строку; `null` удаляет параметр из URL. */\n serialize?: (value: T) => string | null;\n /** Задержка перед записью в URL после изменения сигнала. По умолчанию — без задержки. */\n debounce?: number;\n /**\n * Обновлять URL через `replaceState` (без записи в history) или через\n * `pushState`. По умолчанию `true` (`replaceState`).\n */\n replaceUrl?: boolean;\n}\n\nconst defaultSerialize = (value: unknown): string | null => (isNil(value) ? null : String(value));\nconst defaultTransform = (raw: string | null): string | undefined => raw ?? undefined;\n\n@Injectable({\n providedIn: 'root',\n})\nclass QueryParamsQueue {\n private readonly router = inject(Router);\n private pending = new Map<string, string | null>();\n private replaceUrl = true;\n private waiters: Array<(ok: boolean) => void> = [];\n private flushing: Promise<void> | null = null;\n\n schedule(key: string, value: string | null, replaceUrl: boolean): Promise<boolean> {\n this.pending.set(key, value);\n this.replaceUrl &&= replaceUrl;\n\n const result = new Promise<boolean>((resolve) => this.waiters.push(resolve));\n\n this.flushing ??= this.run();\n return result;\n }\n\n private async run(): Promise<void> {\n await Promise.resolve();\n\n while (this.pending.size > 0) {\n const queryParams = Object.fromEntries(this.pending);\n const replaceUrl = this.replaceUrl;\n const waiters = this.waiters;\n\n this.pending = new Map();\n this.replaceUrl = true;\n this.waiters = [];\n\n const ok = await this.navigate(queryParams, replaceUrl);\n\n waiters.forEach((resolve) => resolve(ok));\n }\n\n this.flushing = null;\n }\n\n private async navigate(queryParams: Params, replaceUrl: boolean): Promise<boolean> {\n try {\n return await this.router.navigate([], {\n replaceUrl,\n queryParams,\n preserveFragment: true,\n queryParamsHandling: 'merge',\n });\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Двусторонний сигнал, связанный с query-параметром текущего роута:\n * чтение отражает URL, запись обновляет URL через `router.navigate`\n * без гонки с другими `linkedQueryParam` на той же странице.\n *\n * @example\n * class MyComponent {\n * search = linkedQueryParam('q', { debounce: 300 });\n * page = linkedQueryParam('page', {\n * transform: (raw) => Number(raw) || 1,\n * serialize: (value) => (value > 1 ? String(value) : null),\n * });\n * }\n */\nexport function linkedQueryParam<T>(\n key: string,\n options: LinkedQueryParamOptions<T>,\n): WritableSignal<T>;\nexport function linkedQueryParam(\n key: string,\n options?: Omit<LinkedQueryParamOptions, 'transform' | 'serialize'>,\n): WritableSignal<string | undefined>;\nexport function linkedQueryParam<T = string | undefined>(\n key: string,\n options?: Partial<LinkedQueryParamOptions<T>>,\n): WritableSignal<T> {\n const route = inject(ActivatedRoute);\n const queue = inject(QueryParamsQueue);\n\n const transform = (options?.transform ?? defaultTransform) as (raw: string | null) => T;\n const serialize = (options?.serialize ?? defaultSerialize) as (value: T) => string | null;\n\n const source$$ = toSignal(\n route.queryParamMap.pipe(\n map((params) => params.get(key)),\n distinctUntilChanged(),\n map(transform),\n ),\n { initialValue: transform(route.snapshot.queryParamMap.get(key)) },\n );\n\n const state$$ = linkedSignal(() => source$$());\n\n effect((onCleanup) => {\n const raw = serialize(state$$());\n if (raw === serialize(source$$())) return;\n\n const write = () => {\n queue.schedule(key, raw, options?.replaceUrl ?? true).then((ok) => {\n if (!ok) state$$.set(source$$());\n });\n };\n\n if (!options?.debounce) return write();\n\n const timer = setTimeout(write, options.debounce);\n onCleanup(() => clearTimeout(timer));\n });\n\n return state$$;\n}\n","import { Observable } from 'rxjs';\n\n/**\n * Эмитит при изменении размеров элемента; отписка снимает наблюдение.\n * @example\n * resizeObservable(host).subscribe((entries) => entries[0].contentRect.width);\n */\nexport function resizeObservable(element: HTMLElement): Observable<ResizeObserverEntry[]> {\n return new Observable((subscriber) => {\n const resizeObserver = new ResizeObserver((entries) => {\n subscriber.next(entries);\n });\n\n resizeObserver.observe(element);\n\n return () => {\n resizeObserver.unobserve(element);\n };\n });\n}\n","import { booleanAttribute } from '@angular/core';\nimport { isNumber, isString } from '@sevtech/kit/misc';\n\n/**\n * Transform-функция для инпутов CSS-размера: число и числовая строка получают `px`,\n * готовый размер и `Nil` проходят как есть.\n *\n * Псевдоним `toCssDimension` — имя единообразно с остальными transform-функциями.\n * Для другой единицы вызывайте его напрямую: `(value) => toCssDimension(value, 'rem')`.\n */\nexport { toCssDimension as cssDimensionAttribute } from '@sevtech/kit/misc';\n\n/**\n * Transform-функция для булевых HTML-атрибутов. В отличие от `booleanAttribute`, отдаёт\n * `true | undefined` вместо `boolean` — атрибут либо присутствует в шаблоне, либо нет.\n *\n * @example\n * disabled = input(undefined, { transform: htmlBooleanAttribute });\n * // <my-component disabled /> → true\n * // <my-component /> → undefined\n */\nexport function htmlBooleanAttribute(value: unknown): true | undefined {\n return booleanAttribute(value) || undefined;\n}\n\n/**\n * Transform-функция для инпутов даты: `Date`, строка и timestamp приводятся к `Date`,\n * невалидное значение и `Nil` — к `fallbackValue`.\n *\n * @example\n * startDate = input<Date | null, unknown>(null, { transform: dateAttribute });\n * // свой дефолт: transform: (value) => dateAttribute(value, new Date())\n */\nexport function dateAttribute(value: unknown, fallbackValue: Date | null = null): Date | null {\n if (value == null || value === '') return fallbackValue;\n\n const date =\n value instanceof Date ? value : isString(value) || isNumber(value) ? new Date(value) : null;\n\n return date === null || isNaN(date.getTime()) ? fallbackValue : date;\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport { ComponentRef, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { FormArray, FormControl, FormGroup, FormRecord } from '@angular/forms';\n\n/** Проверяет, что значение — `FormControl`. */\nexport function isFormControl<T = unknown>(data: unknown): data is FormControl<T> {\n return data instanceof FormControl;\n}\n\n/** Проверяет, что значение — `FormGroup`. */\nexport function isFormGroup(data: unknown): data is FormGroup {\n return data instanceof FormGroup;\n}\n\n/** Проверяет, что значение — `FormArray`. */\nexport function isFormArray(data: unknown): data is FormArray {\n return data instanceof FormArray;\n}\n\n/** Проверяет, что значение — `FormRecord`. */\nexport function isFormRecord(data: unknown): data is FormRecord {\n return data instanceof FormRecord;\n}\n\n/** Проверяет, что значение — `ViewContainerRef`. */\nexport function isViewContainer(data: unknown): data is ViewContainerRef {\n return data instanceof ViewContainerRef;\n}\n\n/** Проверяет, что значение — `TemplateRef`. Полезно для инпутов вида `TemplateRef | string`. */\nexport function isTemplateRef<Context = unknown>(data: unknown): data is TemplateRef<Context> {\n return data instanceof TemplateRef;\n}\n\n/** Проверяет, что значение — `ComponentRef`. */\nexport function isComponentRef<Instance>(data: unknown): data is ComponentRef<Instance> {\n return data instanceof ComponentRef;\n}\n\n/** Проверяет, что значение — `NgComponentOutlet`. */\nexport function isComponentOutlet(data: unknown): data is NgComponentOutlet {\n return data instanceof NgComponentOutlet;\n}\n","import { Provider } from '@angular/core';\nimport { isPlainObject, MaybeArray, toArray } from '@sevtech/kit/misc';\n\n/** Публичный маркер: объект-«фича», возвращаемый withXxx()-функциями. */\nexport interface KitFeature<TKind extends number = number> {\n readonly ɵkind: TKind;\n readonly ɵproviders: Provider[];\n}\n\nfunction isKitFeature(value: unknown): value is KitFeature {\n return isPlainObject(value) && 'ɵkind' in value;\n}\n\n/**\n * Создаёт withXxx()-функцию: связывает вид фичи с фабрикой её провайдеров.\n * Вид задаётся локальным `const enum`, поэтому фича одного модуля не пройдёт\n * в `provide*` другого.\n *\n * @example\n * const enum FeatureKind { Prefix }\n *\n * export const withPrefix = defineKitFeature(\n * FeatureKind.Prefix,\n * (prefix: string) => ({ provide: API_PREFIX, useValue: prefix }),\n * );\n */\nexport function defineKitFeature<Kind extends number, Args extends unknown[]>(\n kind: Kind,\n build: (...args: Args) => MaybeArray<Provider>,\n): (...args: Args) => KitFeature<Kind> {\n return (...args) => ({\n ɵkind: kind,\n ɵproviders: toArray(build(...args)),\n });\n}\n\n/** Собирает Provider[] со всех переданных KitFeature-объектов. */\nexport function collectFeatureProviders(...items: unknown[]): Provider[] {\n const providers: Provider[] = [];\n\n for (const item of items) {\n if (!isKitFeature(item)) continue;\n providers.push(...item.ɵproviders);\n }\n\n return providers;\n}\n\n/**\n * Резолвит Provider[] для параметра, который может быть\n * либо «сырым» конфигом, либо уже готовой KitFeature (тогда пропускается —\n * её обработает collectFeatureProviders).\n */\nexport function resolveConfigProviders<TConfig>(\n config: TConfig,\n handler: (config: Exclude<TConfig, KitFeature>) => MaybeArray<Provider>,\n): Provider[] {\n if (isKitFeature(config)) return [];\n\n return toArray(handler(config as Exclude<TConfig, KitFeature>));\n}\n","import { Observable, of } from 'rxjs';\nimport { DestroyRef } from '@angular/core';\nimport { MaybeArray, toArray } from '@sevtech/kit/misc';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { AbstractControl, AsyncValidatorFn, ValidatorFn, Validators } from '@angular/forms';\n\nconst compose = (validators?: ValidatorFn | ValidatorFn[]): ValidatorFn | null =>\n Array.isArray(validators) ? Validators.compose(validators) : (validators ?? null);\n\nconst composeAsync = (\n validators?: AsyncValidatorFn | AsyncValidatorFn[],\n): AsyncValidatorFn | null =>\n Array.isArray(validators) ? Validators.composeAsync(validators) : (validators ?? null);\n\n/**\n * Применяет `validators`, когда `condition` вернул `true`, и `otherwise` — когда `false`.\n * Ветка без валидаторов считается валидной.\n *\n * Если `condition` зависит не от значения своего контрола — нужен {@link revalidateOn}.\n *\n * @example\n * new FormControl('', ifValidator(isCourier, [Validators.required, Validators.maxLength(200)]));\n * new FormControl('', ifValidator(isCourier, Validators.required, mustBeEmpty));\n */\nexport function ifValidator(\n condition: (control: AbstractControl) => boolean,\n validators: ValidatorFn | ValidatorFn[],\n otherwise?: ValidatorFn | ValidatorFn[],\n): ValidatorFn {\n const onTrue = compose(validators);\n const onFalse = compose(otherwise);\n\n return (control) => {\n const validator = condition(control) ? onTrue : onFalse;\n\n return validator ? validator(control) : null;\n };\n}\n\n/** Асинхронный вариант {@link ifValidator} — в невыбранной ветке запрос не уходит вовсе. */\nexport function ifAsyncValidator(\n condition: (control: AbstractControl) => boolean,\n validators: AsyncValidatorFn | AsyncValidatorFn[],\n otherwise?: AsyncValidatorFn | AsyncValidatorFn[],\n): AsyncValidatorFn {\n const onTrue = composeAsync(validators);\n const onFalse = composeAsync(otherwise);\n\n return (control) => {\n const validator = condition(control) ? onTrue : onFalse;\n\n return validator ? validator(control) : of(null);\n };\n}\n\nexport interface RevalidateOnOptions {\n /**\n * Эмитить ли `valueChanges`/`statusChanges` целей. По умолчанию `true`.\n * `false` спасает от ложного автосохранения, но глушит `statusChanges` и рвёт\n * цепочки перевалидации. Статусы пересчитываются в обоих случаях.\n */\n emitEvent?: boolean;\n /** Для вызова вне injection context — как в `takeUntilDestroyed`. */\n destroyRef?: DestroyRef;\n}\n\n/**\n * Перевалидирует `targets` при изменении `source` — и один раз сразу, чтобы закрыть\n * первый проход, на котором `control.parent` ещё не проставлен.\n *\n * Нужен валидаторам, зависящим не от значения своего контрола: reactive forms\n * перезапускают их только на изменение собственного значения.\n *\n * @example\n * constructor() {\n * const { delivery, address, entrance } = this.form.controls;\n *\n * revalidateOn(delivery, [address, entrance]);\n * }\n */\nexport function revalidateOn(\n source: AbstractControl | Observable<unknown>,\n targets: MaybeArray<AbstractControl>,\n options?: RevalidateOnOptions,\n): void {\n const changes$ = source instanceof AbstractControl ? source.valueChanges : source;\n const controls = toArray(targets);\n const emitEvent = options?.emitEvent;\n let running = false;\n\n const revalidate = () => {\n // `updateValueAndValidity()` эмитит `valueChanges` цели → встречные связки уходят\n // в рекурсию, причём молча: RxJS глотает исключение из next-обработчика\n if (running) return;\n running = true;\n\n try {\n for (const control of controls) {\n control.updateValueAndValidity({ emitEvent });\n }\n } finally {\n running = false;\n }\n };\n\n revalidate();\n changes$.pipe(takeUntilDestroyed(options?.destroyRef)).subscribe(revalidate);\n}\n","import type { MaybeAsync } from './types';\nimport {\n catchError,\n EMPTY,\n from,\n isObservable,\n MonoTypeOperatorFunction,\n Observable,\n of,\n OperatorFunction,\n} from 'rxjs';\nimport { isPromise } from '@sevtech/kit/misc';\n\n/**\n * Приводит значение, промис или `Observable` к `Observable`.\n * Значение эмитится синхронно, промис — после разрешения, `Observable` возвращается как есть.\n */\nexport function fromMaybeAsync<T>(value: MaybeAsync<T>): Observable<T> {\n if (isObservable(value)) return value;\n\n return isPromise(value) ? from(value) : of(value);\n}\n\n/** Обрабатывает ошибку потока, заменяя его на `EMPTY` или `fallback`. */\nexport function safeCatchError<T>(): MonoTypeOperatorFunction<T>;\nexport function safeCatchError<T, R>(fallback: R): OperatorFunction<T, T | R>;\nexport function safeCatchError<T, R>(...fallback: [] | [R]): OperatorFunction<T, T | R> {\n return catchError(() => (fallback.length ? of(fallback[0]) : EMPTY));\n}\n","import { DefaultUrlSerializer, PRIMARY_OUTLET, UrlTree } from '@angular/router';\nimport { isNonEmptyString } from '@sevtech/kit/misc';\n\nconst RELATIVE_URL_BASE = new URL('https://relative.invalid/');\nconst ABSOLUTE_URL_PREFIX = /^[\\u0000-\\u0020]*(?:[a-z][a-z0-9+.-]*:|[/\\\\]{2})/i;\nconst PLAIN_BLOCKED_PATH = /^\\/?[\\w-]+(?:\\/[\\w-]+)*$/;\nconst serializer = new DefaultUrlSerializer();\n\n/**\n * Оставляет ровно один `/` в начале пути.\n *\n * @example\n * withLeadingSlash('//login'); // '/login'\n */\nexport function withLeadingSlash(path: string): string {\n return `/${path.replace(/^\\/+/, '')}`;\n}\n\n/** Проверяет, что значение — `UrlTree` или непустая строка. */\nexport function isRouterUrlInput(url: unknown): url is UrlTree | string {\n return url instanceof UrlTree || isNonEmptyString(url);\n}\n\n/**\n * Возвращает локальный URL для Angular Router или null.\n * Принимает относительные ссылки и пути от корня приложения.\n * Сравнивает запрещённые маршруты по основному outlet через {@link DefaultUrlSerializer}.\n * При сравнении игнорирует matrix-параметры, query и фрагмент.\n * Параметры, фрагмент и дополнительные outlets разрешённого URL сохраняются.\n */\nexport function toSafeRelativeUrl(\n url: unknown,\n blocked: string | readonly string[] = [],\n): string | null {\n if (!isNonEmptyString(url)) return null;\n\n const input = url.replace(/[\\t\\n\\r]/g, '');\n if (ABSOLUTE_URL_PREFIX.test(input)) return null;\n\n try {\n const parsed = new URL(input, RELATIVE_URL_BASE);\n if (parsed.origin !== RELATIVE_URL_BASE.origin) return null;\n\n const relative = toRouterUrl(parsed);\n const tree = serializer.parse(relative);\n const blockedPaths = typeof blocked === 'string' ? [blocked] : blocked;\n if (blockedPaths.length === 0) return relative;\n\n const primaryPath = getPrimaryPath(tree);\n const isBlocked = blockedPaths.some((path) => getBlockedPrimaryPath(path) === primaryPath);\n\n return isBlocked ? null : relative;\n } catch {\n return null;\n }\n}\n\nfunction toRouterUrl(url: URL): string {\n return withLeadingSlash(url.pathname) + url.search + url.hash;\n}\n\nfunction getBlockedPrimaryPath(path: string): string {\n if (PLAIN_BLOCKED_PATH.test(path)) {\n return path.startsWith('/') ? path.slice(1) : path;\n }\n\n const url = new URL(RELATIVE_URL_BASE.origin + withLeadingSlash(path));\n return getPrimaryPath(serializer.parse(toRouterUrl(url)));\n}\n\nfunction getPrimaryPath({ root }: UrlTree): string {\n const segments: string[] = [];\n\n for (let group = root.children[PRIMARY_OUTLET]; group; group = group.children[PRIMARY_OUTLET]) {\n for (const { path } of group.segments) {\n segments.push(encodeURIComponent(path));\n }\n }\n\n return segments.join('/').replace(/\\/+$/, '');\n}\n","import { inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport type { Event as RouterEvent } from '@angular/router';\nimport { filter, share } from 'rxjs';\nimport type { Observable } from 'rxjs';\n\ntype RouterEventClass = abstract new (...args: never[]) => RouterEvent;\n\n/**\n * Возвращает поток указанных событий Router с общей фильтрацией для его подписчиков.\n * Вызывать в контексте инъекции.\n */\nexport function injectRouterEvents<T extends [RouterEventClass, ...RouterEventClass[]]>(\n ...eventClasses: T\n): Observable<InstanceType<T[number]>> {\n return inject(Router).events.pipe(\n filter((event): event is InstanceType<T[number]> =>\n eventClasses.some((eventClass) => event instanceof eventClass),\n ),\n share(),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,gBAAgB,GAAG,CAAC,KAAc,MAAqB,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACjG,MAAM,gBAAgB,GAAG,CAAC,GAAkB,KAAyB,GAAG,IAAI,SAAS;AAErF,MAGM,gBAAgB,CAAA;AAHtB,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAChC,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,GAAG,EAAyB;QAC1C,IAAA,CAAA,UAAU,GAAG,IAAI;QACjB,IAAA,CAAA,OAAO,GAAiC,EAAE;QAC1C,IAAA,CAAA,QAAQ,GAAyB,IAAI;AA4C9C,IAAA;AA1CC,IAAA,QAAQ,CAAC,GAAW,EAAE,KAAoB,EAAE,UAAmB,EAAA;QAC7D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;AAC5B,QAAA,IAAI,CAAC,UAAU,KAAK,UAAU;AAE9B,QAAA,MAAM,MAAM,GAAG,IAAI,OAAO,CAAU,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI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K,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC7F,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE;YACrC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzC;IACF;AAEA,IAAA,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AAC/C;;ACxEA;;;AAGG;AACG,SAAU,kBAAkB,CAChC,GAAG,YAAe,EAAA;AAElB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAC/B,MAAM,CAAC,CAAC,KAAK,KACX,YAAY,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,KAAK,YAAY,UAAU,CAAC,CAC/D,EACD,KAAK,EAAE,CACR;AACH;;ACrBA;;AAEG;;;;"}
|
package/fesm2022/ui-yoda.mjs
CHANGED
|
@@ -980,11 +980,11 @@ class NativeComponent {
|
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
983
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: NativeComponent, isStandalone: true, selector: "ss-yoda-native", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledOption: { classPropertyName: "disabledOption", publicName: "disabledOption", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "selectRef", first: true, predicate: ["nativeRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<select\n #nativeRef\n [disabled]=\"disabled()\"\n (change)=\"select(nativeRef.value, state.options$$() ?? [])\"\n>\n <option\n disabled\n value=\"\"\n >\n {{ placeholder() }}\n </option>\n\n @for (group of groups$$(); track $index) {\n @if (group.label; as label) {\n <optgroup [label]=\"label\">\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n </optgroup>\n } @else {\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n }\n }\n</select>\n", styles: [":host{position:absolute;
|
|
983
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: NativeComponent, isStandalone: true, selector: "ss-yoda-native", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledOption: { classPropertyName: "disabledOption", publicName: "disabledOption", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "selectRef", first: true, predicate: ["nativeRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<select\n #nativeRef\n [disabled]=\"disabled()\"\n (change)=\"select(nativeRef.value, state.options$$() ?? [])\"\n>\n <option\n disabled\n value=\"\"\n >\n {{ placeholder() }}\n </option>\n\n @for (group of groups$$(); track $index) {\n @if (group.label; as label) {\n <optgroup [label]=\"label\">\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n </optgroup>\n } @else {\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n }\n }\n</select>\n", styles: [":host{position:absolute;inset:0}select{inline-size:100%;block-size:100%;appearance:none;border:0;opacity:0;cursor:pointer}select:disabled{cursor:not-allowed}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
984
984
|
}
|
|
985
985
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeComponent, decorators: [{
|
|
986
986
|
type: Component,
|
|
987
|
-
args: [{ selector: 'ss-yoda-native', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select\n #nativeRef\n [disabled]=\"disabled()\"\n (change)=\"select(nativeRef.value, state.options$$() ?? [])\"\n>\n <option\n disabled\n value=\"\"\n >\n {{ placeholder() }}\n </option>\n\n @for (group of groups$$(); track $index) {\n @if (group.label; as label) {\n <optgroup [label]=\"label\">\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n </optgroup>\n } @else {\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n }\n }\n</select>\n", styles: [":host{position:absolute;
|
|
987
|
+
args: [{ selector: 'ss-yoda-native', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select\n #nativeRef\n [disabled]=\"disabled()\"\n (change)=\"select(nativeRef.value, state.options$$() ?? [])\"\n>\n <option\n disabled\n value=\"\"\n >\n {{ placeholder() }}\n </option>\n\n @for (group of groups$$(); track $index) {\n @if (group.label; as label) {\n <optgroup [label]=\"label\">\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n </optgroup>\n } @else {\n @for (item of group.items; track item.value) {\n <option\n [value]=\"item.value\"\n [disabled]=\"isDisabled(item)\"\n >\n {{ item.optionLabel ?? item.label }}\n </option>\n }\n }\n }\n</select>\n", styles: [":host{position:absolute;inset:0}select{inline-size:100%;block-size:100%;appearance:none;border:0;opacity:0;cursor:pointer}select:disabled{cursor:not-allowed}\n"] }]
|
|
988
988
|
}], ctorParameters: () => [], propDecorators: { selectRef: [{ type: i0.ViewChild, args: ['nativeRef', { isSignal: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledOption", required: false }] }] } });
|
|
989
989
|
|
|
990
990
|
class PanelComponent {
|
|
@@ -1056,11 +1056,11 @@ class PanelComponent {
|
|
|
1056
1056
|
return this.showEmpty() && isEmptyArray(this.state.options$$()) && hasContent;
|
|
1057
1057
|
}
|
|
1058
1058
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1059
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: PanelComponent, isStandalone: true, selector: "ss-yoda-panel", inputs: { origin: { classPropertyName: "origin", publicName: "origin", isSignal: true, isRequired: true, transformFunction: null }, listRender: { classPropertyName: "listRender", publicName: "listRender", isSignal: true, isRequired: false, transformFunction: null }, scrollStrategy: { classPropertyName: "scrollStrategy", publicName: "scrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, showHint: { classPropertyName: "showHint", publicName: "showHint", isSignal: true, isRequired: false, transformFunction: null }, showEmpty: { classPropertyName: "showEmpty", publicName: "showEmpty", isSignal: true, isRequired: false, transformFunction: null }, minQueryLength: { classPropertyName: "minQueryLength", publicName: "minQueryLength", isSignal: true, isRequired: false, transformFunction: null }, hintMessage: { classPropertyName: "hintMessage", publicName: "hintMessage", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let status = status$$();\n\n@if (listRender() === 'overlay') {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOpen]=\"isOpen$$()\"\n [cdkConnectedOverlayWidth]=\"width$$()\"\n [cdkConnectedOverlayOrigin]=\"origin()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPanelClass]=\"panelClass()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy$$()\"\n (detach)=\"close()\"\n (overlayOutsideClick)=\"close($event)\"\n (positionChange)=\"onPositionChange($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"layout\" />\n </ng-template>\n} @else if (isOpen$$()) {\n <ng-container [ngTemplateOutlet]=\"layout\" />\n}\n\n<ng-template #layout>\n <!-- \u041E\u0432\u0435\u0440\u043B\u0435\u0439 \u043B\u0435\u0436\u0438\u0442 \u0432 body: \u0431\u0435\u0437 \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043F\u0430\u043F-\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C \u0437\u0430\u043A\u0440\u043E\u0435\u0442\u0441\u044F \u043F\u043E mousedown \u0440\u0430\u043D\u044C\u0448\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 -->\n <section\n class=\"yoda-panel\"\n [class.yoda-panel--above]=\"above$$()\"\n [class.yoda-panel--overlay]=\"listRender() === 'overlay'\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @if (status === 'list' && headerSlot$$(); as header) {\n <header class=\"yoda-panel__header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n </header>\n }\n\n <div\n class=\"yoda-panel__content\"\n tabindex=\"-1\"\n [style.max-block-size]=\"scrollHeight()\"\n >\n @switch (status) {\n @case ('hint') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"hintSlot$$() ?? hintMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('empty') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"emptySlot$$() ?? emptyMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('list') {\n <ng-content select=\"ss-yoda-list\" />\n }\n }\n </div>\n\n @if (status === 'list' && footerSlot$$(); as footer) {\n <footer class=\"yoda-panel__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </footer>\n }\n </section>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}.yoda-panel{display:flex;outline:none;overflow:hidden;flex-wrap:nowrap;flex-direction:column;color:var(--ss-yoda-panel-color, inherit);background:var(--ss-yoda-panel-background, #fff);margin-block-start:var(--ss-yoda-panel-offset, .25rem);border-radius:var(--ss-yoda-panel-radius, var(--ss-yoda-radius, 6px));border:1px solid var(--ss-yoda-panel-border-color, var(--ss-yoda-border-color, #d4d4d8))}.yoda-panel--overlay{min-inline-size:100%;box-shadow:var(--ss-yoda-panel-shadow, 0 4px 12px rgba(0, 0, 0, .12))}.yoda-panel--above{margin-block-start:0;margin-block-end:var(--ss-yoda-panel-offset, .25rem)}.yoda-panel__content{overflow:auto;outline:none}.yoda-panel__header,.yoda-panel__footer{display:flex;flex-direction:column;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);font-size:var(--ss-yoda-small-font-size, .875em);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}.yoda-panel__header{border-block-end:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__footer{border-block-start:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__message{display:flex;align-items:center;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}::ng-deep .cdk-overlay-container,::ng-deep .cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}::ng-deep .cdk-overlay-container{position:fixed;z-index:1000}::ng-deep .cdk-overlay-container:empty{display:none}::ng-deep .cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}::ng-deep .cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}::ng-deep .cdk-overlay-backdrop{position:absolute;
|
|
1059
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: PanelComponent, isStandalone: true, selector: "ss-yoda-panel", inputs: { origin: { classPropertyName: "origin", publicName: "origin", isSignal: true, isRequired: true, transformFunction: null }, listRender: { classPropertyName: "listRender", publicName: "listRender", isSignal: true, isRequired: false, transformFunction: null }, scrollStrategy: { classPropertyName: "scrollStrategy", publicName: "scrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, showHint: { classPropertyName: "showHint", publicName: "showHint", isSignal: true, isRequired: false, transformFunction: null }, showEmpty: { classPropertyName: "showEmpty", publicName: "showEmpty", isSignal: true, isRequired: false, transformFunction: null }, minQueryLength: { classPropertyName: "minQueryLength", publicName: "minQueryLength", isSignal: true, isRequired: false, transformFunction: null }, hintMessage: { classPropertyName: "hintMessage", publicName: "hintMessage", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let status = status$$();\n\n@if (listRender() === 'overlay') {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOpen]=\"isOpen$$()\"\n [cdkConnectedOverlayWidth]=\"width$$()\"\n [cdkConnectedOverlayOrigin]=\"origin()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPanelClass]=\"panelClass()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy$$()\"\n (detach)=\"close()\"\n (overlayOutsideClick)=\"close($event)\"\n (positionChange)=\"onPositionChange($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"layout\" />\n </ng-template>\n} @else if (isOpen$$()) {\n <ng-container [ngTemplateOutlet]=\"layout\" />\n}\n\n<ng-template #layout>\n <!-- \u041E\u0432\u0435\u0440\u043B\u0435\u0439 \u043B\u0435\u0436\u0438\u0442 \u0432 body: \u0431\u0435\u0437 \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043F\u0430\u043F-\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C \u0437\u0430\u043A\u0440\u043E\u0435\u0442\u0441\u044F \u043F\u043E mousedown \u0440\u0430\u043D\u044C\u0448\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 -->\n <section\n class=\"yoda-panel\"\n [class.yoda-panel--above]=\"above$$()\"\n [class.yoda-panel--overlay]=\"listRender() === 'overlay'\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @if (status === 'list' && headerSlot$$(); as header) {\n <header class=\"yoda-panel__header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n </header>\n }\n\n <div\n class=\"yoda-panel__content\"\n tabindex=\"-1\"\n [style.max-block-size]=\"scrollHeight()\"\n >\n @switch (status) {\n @case ('hint') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"hintSlot$$() ?? hintMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('empty') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"emptySlot$$() ?? emptyMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('list') {\n <ng-content select=\"ss-yoda-list\" />\n }\n }\n </div>\n\n @if (status === 'list' && footerSlot$$(); as footer) {\n <footer class=\"yoda-panel__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </footer>\n }\n </section>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}.yoda-panel{display:flex;outline:none;overflow:hidden;flex-wrap:nowrap;flex-direction:column;color:var(--ss-yoda-panel-color, inherit);background:var(--ss-yoda-panel-background, #fff);margin-block-start:var(--ss-yoda-panel-offset, .25rem);border-radius:var(--ss-yoda-panel-radius, var(--ss-yoda-radius, 6px));border:1px solid var(--ss-yoda-panel-border-color, var(--ss-yoda-border-color, #d4d4d8))}.yoda-panel--overlay{min-inline-size:100%;box-shadow:var(--ss-yoda-panel-shadow, 0 4px 12px rgba(0, 0, 0, .12))}.yoda-panel--above{margin-block-start:0;margin-block-end:var(--ss-yoda-panel-offset, .25rem)}.yoda-panel__content{overflow:auto;outline:none}.yoda-panel__header,.yoda-panel__footer{display:flex;flex-direction:column;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);font-size:var(--ss-yoda-small-font-size, .875em);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}.yoda-panel__header{border-block-end:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__footer{border-block-start:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__message{display:flex;align-items:center;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}::ng-deep .cdk-overlay-container,::ng-deep .cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}::ng-deep .cdk-overlay-container{position:fixed;z-index:1000}::ng-deep .cdk-overlay-container:empty{display:none}::ng-deep .cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}::ng-deep .cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}::ng-deep .cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:transparent;opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){::ng-deep .cdk-overlay-backdrop{transition-duration:1ms}}::ng-deep .cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){::ng-deep .cdk-overlay-backdrop-showing{opacity:.6}}::ng-deep .cdk-overlay-dark-backdrop{background:#00000052}::ng-deep .cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}::ng-deep .cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active ::ng-deep .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}::ng-deep .cdk-overlay-backdrop-noop-animation{transition:none}::ng-deep .cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}::ng-deep .cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: SlotOutletDirective, selector: "[slotOutlet]", inputs: ["slotOutlet", "slotOutletContext"], exportAs: ["slotOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1060
1060
|
}
|
|
1061
1061
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PanelComponent, decorators: [{
|
|
1062
1062
|
type: Component,
|
|
1063
|
-
args: [{ selector: 'ss-yoda-panel', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, OverlayModule, SlotOutletDirective], template: "@let status = status$$();\n\n@if (listRender() === 'overlay') {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOpen]=\"isOpen$$()\"\n [cdkConnectedOverlayWidth]=\"width$$()\"\n [cdkConnectedOverlayOrigin]=\"origin()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPanelClass]=\"panelClass()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy$$()\"\n (detach)=\"close()\"\n (overlayOutsideClick)=\"close($event)\"\n (positionChange)=\"onPositionChange($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"layout\" />\n </ng-template>\n} @else if (isOpen$$()) {\n <ng-container [ngTemplateOutlet]=\"layout\" />\n}\n\n<ng-template #layout>\n <!-- \u041E\u0432\u0435\u0440\u043B\u0435\u0439 \u043B\u0435\u0436\u0438\u0442 \u0432 body: \u0431\u0435\u0437 \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043F\u0430\u043F-\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C \u0437\u0430\u043A\u0440\u043E\u0435\u0442\u0441\u044F \u043F\u043E mousedown \u0440\u0430\u043D\u044C\u0448\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 -->\n <section\n class=\"yoda-panel\"\n [class.yoda-panel--above]=\"above$$()\"\n [class.yoda-panel--overlay]=\"listRender() === 'overlay'\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @if (status === 'list' && headerSlot$$(); as header) {\n <header class=\"yoda-panel__header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n </header>\n }\n\n <div\n class=\"yoda-panel__content\"\n tabindex=\"-1\"\n [style.max-block-size]=\"scrollHeight()\"\n >\n @switch (status) {\n @case ('hint') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"hintSlot$$() ?? hintMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('empty') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"emptySlot$$() ?? emptyMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('list') {\n <ng-content select=\"ss-yoda-list\" />\n }\n }\n </div>\n\n @if (status === 'list' && footerSlot$$(); as footer) {\n <footer class=\"yoda-panel__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </footer>\n }\n </section>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}.yoda-panel{display:flex;outline:none;overflow:hidden;flex-wrap:nowrap;flex-direction:column;color:var(--ss-yoda-panel-color, inherit);background:var(--ss-yoda-panel-background, #fff);margin-block-start:var(--ss-yoda-panel-offset, .25rem);border-radius:var(--ss-yoda-panel-radius, var(--ss-yoda-radius, 6px));border:1px solid var(--ss-yoda-panel-border-color, var(--ss-yoda-border-color, #d4d4d8))}.yoda-panel--overlay{min-inline-size:100%;box-shadow:var(--ss-yoda-panel-shadow, 0 4px 12px rgba(0, 0, 0, .12))}.yoda-panel--above{margin-block-start:0;margin-block-end:var(--ss-yoda-panel-offset, .25rem)}.yoda-panel__content{overflow:auto;outline:none}.yoda-panel__header,.yoda-panel__footer{display:flex;flex-direction:column;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);font-size:var(--ss-yoda-small-font-size, .875em);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}.yoda-panel__header{border-block-end:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__footer{border-block-start:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__message{display:flex;align-items:center;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}::ng-deep .cdk-overlay-container,::ng-deep .cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}::ng-deep .cdk-overlay-container{position:fixed;z-index:1000}::ng-deep .cdk-overlay-container:empty{display:none}::ng-deep .cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}::ng-deep .cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}::ng-deep .cdk-overlay-backdrop{position:absolute;
|
|
1063
|
+
args: [{ selector: 'ss-yoda-panel', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, OverlayModule, SlotOutletDirective], template: "@let status = status$$();\n\n@if (listRender() === 'overlay') {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOpen]=\"isOpen$$()\"\n [cdkConnectedOverlayWidth]=\"width$$()\"\n [cdkConnectedOverlayOrigin]=\"origin()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPanelClass]=\"panelClass()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy$$()\"\n (detach)=\"close()\"\n (overlayOutsideClick)=\"close($event)\"\n (positionChange)=\"onPositionChange($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"layout\" />\n </ng-template>\n} @else if (isOpen$$()) {\n <ng-container [ngTemplateOutlet]=\"layout\" />\n}\n\n<ng-template #layout>\n <!-- \u041E\u0432\u0435\u0440\u043B\u0435\u0439 \u043B\u0435\u0436\u0438\u0442 \u0432 body: \u0431\u0435\u0437 \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043F\u0430\u043F-\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C \u0437\u0430\u043A\u0440\u043E\u0435\u0442\u0441\u044F \u043F\u043E mousedown \u0440\u0430\u043D\u044C\u0448\u0435 \u0432\u044B\u0431\u043E\u0440\u0430 -->\n <section\n class=\"yoda-panel\"\n [class.yoda-panel--above]=\"above$$()\"\n [class.yoda-panel--overlay]=\"listRender() === 'overlay'\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @if (status === 'list' && headerSlot$$(); as header) {\n <header class=\"yoda-panel__header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n </header>\n }\n\n <div\n class=\"yoda-panel__content\"\n tabindex=\"-1\"\n [style.max-block-size]=\"scrollHeight()\"\n >\n @switch (status) {\n @case ('hint') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"hintSlot$$() ?? hintMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('empty') {\n <div class=\"yoda-panel__message\">\n <ng-container *slotOutlet=\"emptySlot$$() ?? emptyMessage(); let text\">\n <span>{{ text }}</span>\n </ng-container>\n </div>\n }\n\n @case ('list') {\n <ng-content select=\"ss-yoda-list\" />\n }\n }\n </div>\n\n @if (status === 'list' && footerSlot$$(); as footer) {\n <footer class=\"yoda-panel__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </footer>\n }\n </section>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}.yoda-panel{display:flex;outline:none;overflow:hidden;flex-wrap:nowrap;flex-direction:column;color:var(--ss-yoda-panel-color, inherit);background:var(--ss-yoda-panel-background, #fff);margin-block-start:var(--ss-yoda-panel-offset, .25rem);border-radius:var(--ss-yoda-panel-radius, var(--ss-yoda-radius, 6px));border:1px solid var(--ss-yoda-panel-border-color, var(--ss-yoda-border-color, #d4d4d8))}.yoda-panel--overlay{min-inline-size:100%;box-shadow:var(--ss-yoda-panel-shadow, 0 4px 12px rgba(0, 0, 0, .12))}.yoda-panel--above{margin-block-start:0;margin-block-end:var(--ss-yoda-panel-offset, .25rem)}.yoda-panel__content{overflow:auto;outline:none}.yoda-panel__header,.yoda-panel__footer{display:flex;flex-direction:column;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);font-size:var(--ss-yoda-small-font-size, .875em);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}.yoda-panel__header{border-block-end:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__footer{border-block-start:1px solid var(--ss-yoda-separator-color, #e4e4e7)}.yoda-panel__message{display:flex;align-items:center;gap:var(--ss-yoda-gap, .5rem);color:var(--ss-yoda-muted-color, #71717a);padding:var(--ss-yoda-padding-y, .5rem) var(--ss-yoda-padding-x, .75rem)}::ng-deep .cdk-overlay-container,::ng-deep .cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}::ng-deep .cdk-overlay-container{position:fixed;z-index:1000}::ng-deep .cdk-overlay-container:empty{display:none}::ng-deep .cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}::ng-deep .cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}::ng-deep .cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:transparent;opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){::ng-deep .cdk-overlay-backdrop{transition-duration:1ms}}::ng-deep .cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){::ng-deep .cdk-overlay-backdrop-showing{opacity:.6}}::ng-deep .cdk-overlay-dark-backdrop{background:#00000052}::ng-deep .cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}::ng-deep .cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active ::ng-deep .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}::ng-deep .cdk-overlay-backdrop-noop-animation{transition:none}::ng-deep .cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}::ng-deep .cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}\n"] }]
|
|
1064
1064
|
}], ctorParameters: () => [], propDecorators: { origin: [{ type: i0.Input, args: [{ isSignal: true, alias: "origin", required: true }] }], listRender: [{ type: i0.Input, args: [{ isSignal: true, alias: "listRender", required: false }] }], scrollStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollStrategy", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], scrollHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollHeight", required: false }] }], showHint: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHint", required: false }] }], showEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEmpty", required: false }] }], minQueryLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minQueryLength", required: false }] }], hintMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintMessage", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }] } });
|
|
1065
1065
|
|
|
1066
1066
|
/** Ключ ошибки в `control.errors` */
|