@agorapulse/ui-components 22.5.7-beta.1 → 22.6.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/agorapulse-ui-components-22.6.0.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +16 -27
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-i18n.mjs +5 -2
- package/fesm2022/agorapulse-ui-components-i18n.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-input-search.mjs +2 -2
- package/fesm2022/agorapulse-ui-components-input-search.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-labels-selector.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-labels-selector.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-select.mjs +189 -4
- package/fesm2022/agorapulse-ui-components-select.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs +48 -4
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs.map +1 -1
- package/package.json +1 -1
- package/types/agorapulse-ui-components-filter-dropdown.d.ts +7 -5
- package/types/agorapulse-ui-components-i18n.d.ts +38 -6
- package/types/agorapulse-ui-components-select.d.ts +38 -2
- package/types/agorapulse-ui-components-selection-dropdown.d.ts +14 -2
- package/agorapulse-ui-components-22.5.7-beta.1.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agorapulse-ui-components-i18n.mjs","sources":["../../../libs/ui-components/i18n/src/default-texts.ts","../../../libs/ui-components/i18n/src/key-guard.ts","../../../libs/ui-components/i18n/src/raw.pipe.ts","../../../libs/ui-components/i18n/src/translation.model.ts","../../../libs/ui-components/i18n/src/translation.provider.ts","../../../libs/ui-components/i18n/src/resolve-texts.ts","../../../libs/ui-components/i18n/src/agorapulse-ui-components-i18n.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DEFAULT_TEXTS: Readonly<Record<string, string>> = Object.freeze({\n 'ui-components.filters.trigger': 'Filters',\n 'ui-components.filters.aria-label': 'Filters',\n 'ui-components.filters.apply': 'Apply filters',\n 'ui-components.filters.clear': 'Clear filters',\n 'ui-components.filters.reset': 'Reset filters',\n 'ui-components.filters.save-preset': 'Save preset',\n 'ui-components.filters.save-new-presets': 'Save new presets',\n 'ui-components.filters.save-as-new-preset': 'Save as new preset',\n 'ui-components.filters.update-existing-preset': 'Update existing preset',\n 'ui-components.filters.date-range-placeholder': 'Select date range',\n 'ui-components.search.placeholder': 'Search',\n 'ui-components.select.only': 'Only',\n 'ui-components.select.placeholder': 'Select an option',\n});\n\n/**\n * Holds the fallback table read by `injectTranslate`; provide another table to override it, for instance in a test.\n *\n * @example\n * TestBed.configureTestingModule({ providers: [{ provide: UI_COMPONENTS_DEFAULT_TEXTS, useValue: { 'ui-components.ok': 'OK' } }] });\n */\nexport const UI_COMPONENTS_DEFAULT_TEXTS = new InjectionToken<Readonly<Record<string, string>>>('UI_COMPONENTS_DEFAULT_TEXTS', {\n providedIn: 'root',\n factory: () => DEFAULT_TEXTS,\n});\n\nexport function fallbackText(\n key: string,\n params?: Record<string, unknown>,\n table: Readonly<Record<string, string>> = DEFAULT_TEXTS\n): string | undefined {\n if (!Object.prototype.hasOwnProperty.call(table, key)) return undefined;\n\n return table[key].replace(/\\{\\{\\s*([^{}\\s]+)\\s*\\}\\}/g, (placeholder, name: string) =>\n params?.[name] !== undefined && params[name] !== null && Object.prototype.hasOwnProperty.call(params, name)\n ? String(params[name])\n : placeholder\n );\n}\n","import { isDevMode } from '@angular/core';\n\n/**\n * The default `isKey`: dotted segments, so dotted data such as `example.com` passes too.\n *\n * @example\n * DEFAULT_IS_KEY('report.filter.apply'); // true\n * DEFAULT_IS_KEY('Black Friday 2026'); // false\n */\nexport const DEFAULT_IS_KEY = (text: string): boolean => /^[\\w-]+(\\.[\\w-]+)+$/.test(text);\n\nconst warnedValues = new Set<string>();\n\nexport function warnIfNotKey(text: string, isKey: (text: string) => boolean, devMode: boolean = isDevMode()): void {\n if (!devMode || isKey(text) || warnedValues.has(text)) return;\n\n warnedValues.add(text);\n console.warn(`[ui-components/i18n] \"${text}\" is not a translation key. Wrap displayed data with raw() (or | apRaw).`);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { RawText } from './translation.model';\n\n/**\n * Turns a text into a {@link RawText} so a component displays it as is. `null` and `undefined` give an empty text.\n *\n * @example\n * <ap-button [i18n]=\"{ label: user.name | apRaw }\" />\n */\n@Pipe({ name: 'apRaw' })\nexport class RawPipe implements PipeTransform {\n transform(text: string | null | undefined): RawText {\n return { raw: text ?? '' };\n }\n}\n","/**\n * A translation key with optional interpolation parameters.\n *\n * @example\n * const request: TranslationKeyRequest = { key: 'inbox.unread', params: { count: 3 } };\n */\nexport type TranslationKeyRequest = { key: string; params?: Record<string, unknown> };\n\n/**\n * A text displayed as is, never looked up in a catalogue (user content, names, handles).\n *\n * @example\n * const text: RawText = { raw: 'jordan.amar' };\n */\nexport type RawText = { raw: string };\n\n/**\n * What a component accepts for a displayed text: a string is a translation key,\n * `{ key, params }` a key with parameters, `{ raw }` a text displayed as is.\n *\n * @example\n * const label: TranslationRequest = 'common.save';\n */\nexport type TranslationRequest = string | TranslationKeyRequest | RawText;\n\n/**\n * Declares the translatable inputs of a component: `Req` are required, `Opt` optional.\n *\n * @example\n * type ButtonI18n = I18nOf<'label', 'caption'>;\n * const i18n: ButtonI18n = { label: 'common.save' };\n */\nexport type I18nOf<Req extends string, Opt extends string = never> = Record<Req, TranslationRequest> &\n Partial<Record<Opt, TranslationRequest>>;\n\n/**\n * Marks a text to display as is: it never reaches the app's `translate`.\n *\n * @example\n * raw('jordan.amar'); // { raw: 'jordan.amar' }\n */\nexport function raw(text: string): RawText {\n return { raw: text };\n}\n\n/**\n * Checks the shape only: an object with a string `raw`, whatever other keys it carries.\n *\n * @example\n * isRawText({ raw: 'x' }); // true\n * isRawText('a.b'); // false\n */\nexport function isRawText(value: unknown): value is RawText {\n return typeof value === 'object' && value !== null && 'raw' in value && typeof value.raw === 'string';\n}\n\n/**\n * Checks the shape only: an object with a string `key`; `params` is not validated.\n *\n * @example\n * isKeyRequest({ key: 'a.b' }); // true\n * isKeyRequest({ label: 'x' }); // false\n */\nexport function isKeyRequest(value: unknown): value is TranslationKeyRequest {\n return typeof value === 'object' && value !== null && 'key' in value && typeof value.key === 'string';\n}\n","import { computed, inject, InjectionToken, isDevMode, Provider, Signal } from '@angular/core';\nimport { fallbackText, UI_COMPONENTS_DEFAULT_TEXTS } from './default-texts';\nimport { DEFAULT_IS_KEY, warnIfNotKey } from './key-guard';\nimport { isKeyRequest, isRawText, TranslationRequest } from './translation.model';\n\n/**\n * How the DS translates the texts it renders, provided by the consuming app.\n *\n * @example\n * const config: UiComponentsTranslation = { translate: (key, params) => catalogue.instant(key, params), language: currentLanguage };\n */\nexport interface UiComponentsTranslation {\n /** Turns a key and its simple params into the text to render. */\n translate: (key: string, params?: Record<string, unknown>) => string;\n /** The app's current language, such as `fr`; texts are recomputed when it changes. */\n language?: Signal<string>;\n /** Used by the dev guard only, never for rendering; defaults to `DEFAULT_IS_KEY`. */\n isKey?: (text: string) => boolean;\n}\n\n/**\n * Holds the app's translation; absent when the app provides none.\n *\n * @example\n * const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n */\nexport const UI_COMPONENTS_TRANSLATION = new InjectionToken<UiComponentsTranslation>('UI_COMPONENTS_TRANSLATION');\n\n/**\n * Plugs the app's translation into the DS components.\n *\n * @param config the translation, or a factory run in an injection context when it needs `inject()`.\n *\n * @example\n * provideUiComponentsTranslation(() => {\n * const translateService = inject(TranslateService);\n * return { translate: (key, params) => translateService.instant(key, params) };\n * });\n */\nexport function provideUiComponentsTranslation(config: UiComponentsTranslation | (() => UiComponentsTranslation)): Provider {\n return typeof config === 'function'\n ? { provide: UI_COMPONENTS_TRANSLATION, useFactory: config }\n : { provide: UI_COMPONENTS_TRANSLATION, useValue: config };\n}\n\n/**\n * Call in an injection context; the returned function renders a {@link TranslationRequest} and, read inside a\n * `computed`, follows language changes. Resolution rules: `design-specs/patterns/translation.md`.\n *\n * @example\n * const t = injectTranslate();\n * const title = computed(() => t(this.i18n().title, { count: this.count() }));\n */\nexport function injectTranslate(): (request: TranslationRequest | null | undefined, params?: Record<string, unknown>) => string {\n const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n const defaultTexts = inject(UI_COMPONENTS_DEFAULT_TEXTS);\n const isKey = translation?.isKey ?? DEFAULT_IS_KEY;\n\n function resolve(request: unknown, dsParams?: Record<string, unknown>): string {\n translation?.language?.();\n\n if (request === null || request === undefined || request === '') return '';\n if (typeof request === 'string') {\n warnIfNotKey(request, isKey);\n return translateKey(request, dsParams);\n }\n if (isRawText(request)) return request.raw;\n if (isKeyRequest(request)) {\n if (request.key === '') return '';\n return translateKey(request.key, request.params || dsParams ? { ...request.params, ...definedEntries(dsParams) } : undefined);\n }\n\n if (isDevMode()) {\n console.warn(\n '[ui-components/i18n] Unsupported translation request, expected a key string, { key, params } or { raw }:',\n request\n );\n }\n return '';\n }\n\n function translateKey(key: string, params: Record<string, unknown> | undefined): string {\n const resolvedParams = resolveParams(params);\n if (!translation) return fallbackText(key, resolvedParams, defaultTexts) ?? key;\n\n const translated = translation.translate(key, resolvedParams);\n return translated === key ? (fallbackText(key, resolvedParams, defaultTexts) ?? translated) : translated;\n }\n\n function definedEntries(params: Record<string, unknown> | undefined): Record<string, unknown> {\n return Object.fromEntries(Object.entries(params ?? {}).filter(([, value]) => value !== undefined));\n }\n\n function resolveParams(params: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n if (!params) return undefined;\n return Object.fromEntries(\n Object.entries(params).map(([name, value]) => [name, isRawText(value) || isKeyRequest(value) ? resolve(value) : value])\n );\n }\n\n return resolve;\n}\n\n/**\n * The app's current language, `undefined` when the app gives none.\n *\n * @example\n * const language = injectLanguage();\n * const locale = computed(() => language() ?? 'en');\n */\nexport function injectLanguage(): Signal<string | undefined> {\n const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n\n return computed(() => translation?.language?.());\n}\n","import { TranslationRequest } from './translation.model';\nimport { injectTranslate } from './translation.provider';\n\n/**\n * The text roles a component renders: per role, the DS default key, or `null` when the role has no default.\n *\n * @example\n * const ROLES = { title: null, placeholder: 'ui-components.select.placeholder' } as const satisfies TextRoles;\n */\nexport type TextRoles = Readonly<Record<string, string | null>>;\n\n/**\n * Resolves every role of `roles` from `i18n` in one call: an absent role (`null` or `undefined`) takes its default key,\n * an explicit request wins even when it renders empty. A model `i18n` carrying more roles than `roles` lists is accepted.\n */\nexport type ResolveTexts = <R extends TextRoles>(\n i18n: Readonly<Partial<Record<keyof NoInfer<R> & string, TranslationRequest | null | undefined>>> | null | undefined,\n roles: R\n) => { [K in keyof R]: string };\n\n/**\n * Call in an injection context; built on {@link injectTranslate}, so read inside a `computed` the texts follow language changes.\n * Resolution rules: `design-specs/patterns/translation.md`.\n *\n * @example\n * const ROLES = { title: null, placeholder: 'ui-components.select.placeholder' } as const satisfies TextRoles;\n * const resolveTexts = injectResolveTexts();\n * const texts = computed(() => resolveTexts(this.i18n(), ROLES));\n */\nexport function injectResolveTexts(): ResolveTexts {\n const t = injectTranslate();\n\n return <R extends TextRoles>(\n i18n: Readonly<Partial<Record<keyof R & string, TranslationRequest | null | undefined>>> | null | undefined,\n roles: R\n ) => {\n const requests: Readonly<Partial<Record<string, TranslationRequest | null | undefined>>> = i18n ?? {};\n // A mapped type over a generic R cannot be built key by key; the keys are exactly those of `roles`.\n return Object.fromEntries(Object.entries(roles).map(([role, defaultKey]) => [role, t(requests[role] ?? defaultKey)])) as {\n [K in keyof R]: string;\n };\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAEO,MAAM,aAAa,GAAqC,MAAM,CAAC,MAAM,CAAC;AACzE,IAAA,+BAA+B,EAAE,SAAS;AAC1C,IAAA,kCAAkC,EAAE,SAA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,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEzE,OAAO,QAAQ,CAAC,MAAM,WAAW,EAAE,QAAQ,IAAI,CAAC;AACpD;;AC9FA;;;;;;;;AAQG;SACa,kBAAkB,GAAA;AAC9B,IAAA,MAAM,CAAC,GAAG,eAAe,EAAE;AAE3B,IAAA,OAAO,CACH,IAA2G,EAC3G,KAAQ,KACR;AACA,QAAA,MAAM,QAAQ,GAA6E,IAAI,IAAI,EAAE;;AAErG,QAAA,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAEnH;AACL,IAAA,CAAC;AACL;;AC1CA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"agorapulse-ui-components-i18n.mjs","sources":["../../../libs/ui-components/i18n/src/default-texts.ts","../../../libs/ui-components/i18n/src/key-guard.ts","../../../libs/ui-components/i18n/src/raw.pipe.ts","../../../libs/ui-components/i18n/src/translation.model.ts","../../../libs/ui-components/i18n/src/translation.provider.ts","../../../libs/ui-components/i18n/src/resolve-texts.ts","../../../libs/ui-components/i18n/src/agorapulse-ui-components-i18n.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DEFAULT_TEXTS = Object.freeze({\n 'ui-components.filters.trigger': 'Filters',\n 'ui-components.filters.aria-label': 'Filters',\n 'ui-components.filters.apply': 'Apply filters',\n 'ui-components.filters.clear': 'Clear filters',\n 'ui-components.filters.reset': 'Reset filters',\n 'ui-components.filters.save-preset': 'Save preset',\n 'ui-components.filters.save-new-presets': 'Save new presets',\n 'ui-components.filters.save-as-new-preset': 'Save as new preset',\n 'ui-components.filters.update-existing-preset': 'Update existing preset',\n 'ui-components.filters.date-range-placeholder': 'Select date range',\n 'ui-components.search.placeholder': 'Search',\n 'ui-components.select.only': 'Only',\n 'ui-components.select.placeholder': 'Select an option',\n} as const);\n\n/**\n * A key of the DS default texts, the only keys a component may fall back to.\n *\n * @example\n * const key: DefaultTextKey = 'ui-components.search.placeholder';\n */\nexport type DefaultTextKey = keyof typeof DEFAULT_TEXTS;\n\n/**\n * Holds the fallback table read by `injectTranslate`; provide another table to override it, for instance in a test.\n *\n * @example\n * TestBed.configureTestingModule({ providers: [{ provide: UI_COMPONENTS_DEFAULT_TEXTS, useValue: { 'ui-components.ok': 'OK' } }] });\n */\nexport const UI_COMPONENTS_DEFAULT_TEXTS = new InjectionToken<Readonly<Record<string, string>>>('UI_COMPONENTS_DEFAULT_TEXTS', {\n providedIn: 'root',\n factory: () => DEFAULT_TEXTS,\n});\n\nexport function fallbackText(\n key: string,\n params?: Record<string, unknown>,\n table: Readonly<Record<string, string>> = DEFAULT_TEXTS\n): string | undefined {\n if (!Object.prototype.hasOwnProperty.call(table, key)) return undefined;\n\n return table[key].replace(/\\{\\{\\s*([^{}\\s]+)\\s*\\}\\}/g, (placeholder, name: string) =>\n params?.[name] !== undefined && params[name] !== null && Object.prototype.hasOwnProperty.call(params, name)\n ? String(params[name])\n : placeholder\n );\n}\n","import { isDevMode } from '@angular/core';\n\n/**\n * The default `isKey`: dotted segments, so dotted data such as `example.com` passes too.\n *\n * @example\n * DEFAULT_IS_KEY('report.filter.apply'); // true\n * DEFAULT_IS_KEY('Black Friday 2026'); // false\n */\nexport const DEFAULT_IS_KEY = (text: string): boolean => /^[\\w-]+(\\.[\\w-]+)+$/.test(text);\n\nconst warnedValues = new Set<string>();\n\nexport function warnIfNotKey(text: string, isKey: (text: string) => boolean, devMode: boolean = isDevMode()): void {\n if (!devMode || isKey(text) || warnedValues.has(text)) return;\n\n warnedValues.add(text);\n console.warn(`[ui-components/i18n] \"${text}\" is not a translation key. Wrap displayed data with raw() (or | apRaw).`);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { RawText } from './translation.model';\n\n/**\n * Turns a text into a {@link RawText} so a component displays it as is. `null` and `undefined` give an empty text.\n *\n * @example\n * <ap-button [i18n]=\"{ label: user.name | apRaw }\" />\n */\n@Pipe({ name: 'apRaw' })\nexport class RawPipe implements PipeTransform {\n transform(text: string | null | undefined): RawText {\n return { raw: text ?? '' };\n }\n}\n","/**\n * A translation key with optional interpolation parameters.\n *\n * @example\n * const request: TranslationKeyRequest = { key: 'inbox.unread', params: { count: 3 } };\n */\nexport type TranslationKeyRequest = { key: string; params?: Record<string, unknown> };\n\n/**\n * A text displayed as is, never looked up in a catalogue (user content, names, handles).\n *\n * @example\n * const text: RawText = { raw: 'jordan.amar' };\n */\nexport type RawText = { raw: string };\n\n/**\n * What a component accepts for a displayed text: a string is a translation key,\n * `{ key, params }` a key with parameters, `{ raw }` a text displayed as is.\n *\n * @example\n * const label: TranslationRequest = 'common.save';\n */\nexport type TranslationRequest = string | TranslationKeyRequest | RawText;\n\n/**\n * Declares the translatable inputs of a component: `Req` are required, `Opt` optional.\n *\n * @example\n * type ButtonI18n = I18nOf<'label', 'caption'>;\n * const i18n: ButtonI18n = { label: 'common.save' };\n */\nexport type I18nOf<Req extends string, Opt extends string = never> = Record<Req, TranslationRequest> &\n Partial<Record<Opt, TranslationRequest>>;\n\n/**\n * Marks a text to display as is: it never reaches the app's `translate`.\n *\n * @example\n * raw('jordan.amar'); // { raw: 'jordan.amar' }\n */\nexport function raw(text: string): RawText {\n return { raw: text };\n}\n\n/**\n * Checks the shape only: an object with a string `raw`, whatever other keys it carries.\n *\n * @example\n * isRawText({ raw: 'x' }); // true\n * isRawText('a.b'); // false\n */\nexport function isRawText(value: unknown): value is RawText {\n return typeof value === 'object' && value !== null && 'raw' in value && typeof value.raw === 'string';\n}\n\n/**\n * Checks the shape only: an object with a string `key`; `params` is not validated.\n *\n * @example\n * isKeyRequest({ key: 'a.b' }); // true\n * isKeyRequest({ label: 'x' }); // false\n */\nexport function isKeyRequest(value: unknown): value is TranslationKeyRequest {\n return typeof value === 'object' && value !== null && 'key' in value && typeof value.key === 'string';\n}\n","import { computed, inject, InjectionToken, isDevMode, Provider, Signal } from '@angular/core';\nimport { fallbackText, UI_COMPONENTS_DEFAULT_TEXTS } from './default-texts';\nimport { DEFAULT_IS_KEY, warnIfNotKey } from './key-guard';\nimport { isKeyRequest, isRawText, TranslationRequest } from './translation.model';\n\n/**\n * How the DS translates the texts it renders, provided by the consuming app.\n *\n * @example\n * const config: UiComponentsTranslation = { translate: (key, params) => catalogue.instant(key, params), language: currentLanguage };\n */\nexport interface UiComponentsTranslation {\n /** Turns a key and its simple params into the text to render. */\n translate: (key: string, params?: Record<string, unknown>) => string;\n /** The app's current language, such as `fr`; texts are recomputed when it changes. */\n language?: Signal<string>;\n /** Used by the dev guard only, never for rendering; defaults to `DEFAULT_IS_KEY`. */\n isKey?: (text: string) => boolean;\n}\n\n/**\n * Holds the app's translation; absent when the app provides none.\n *\n * @example\n * const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n */\nexport const UI_COMPONENTS_TRANSLATION = new InjectionToken<UiComponentsTranslation>('UI_COMPONENTS_TRANSLATION');\n\n/**\n * Plugs the app's translation into the DS components.\n *\n * @param config the translation, or a factory run in an injection context when it needs `inject()`.\n *\n * @example\n * provideUiComponentsTranslation(() => {\n * const translateService = inject(TranslateService);\n * return { translate: (key, params) => translateService.instant(key, params) };\n * });\n */\nexport function provideUiComponentsTranslation(config: UiComponentsTranslation | (() => UiComponentsTranslation)): Provider {\n return typeof config === 'function'\n ? { provide: UI_COMPONENTS_TRANSLATION, useFactory: config }\n : { provide: UI_COMPONENTS_TRANSLATION, useValue: config };\n}\n\n/**\n * Call in an injection context; the returned function renders a {@link TranslationRequest} and, read inside a\n * `computed`, follows language changes. Resolution rules: `design-specs/patterns/translation.md`.\n *\n * @example\n * const t = injectTranslate();\n * const title = computed(() => t(this.i18n().title, { count: this.count() }));\n */\nexport function injectTranslate(): (request: TranslationRequest | null | undefined, params?: Record<string, unknown>) => string {\n const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n const defaultTexts = inject(UI_COMPONENTS_DEFAULT_TEXTS);\n const isKey = translation?.isKey ?? DEFAULT_IS_KEY;\n\n function resolve(request: unknown, dsParams?: Record<string, unknown>): string {\n translation?.language?.();\n\n if (request === null || request === undefined || request === '') return '';\n if (typeof request === 'string') {\n warnIfNotKey(request, isKey);\n return translateKey(request, dsParams);\n }\n if (isRawText(request)) return request.raw;\n if (isKeyRequest(request)) {\n if (request.key === '') return '';\n return translateKey(request.key, request.params || dsParams ? { ...request.params, ...definedEntries(dsParams) } : undefined);\n }\n\n if (isDevMode()) {\n console.warn(\n '[ui-components/i18n] Unsupported translation request, expected a key string, { key, params } or { raw }:',\n request\n );\n }\n return '';\n }\n\n function translateKey(key: string, params: Record<string, unknown> | undefined): string {\n const resolvedParams = resolveParams(params);\n if (!translation) return fallbackText(key, resolvedParams, defaultTexts) ?? key;\n\n const translated = translation.translate(key, resolvedParams);\n return translated === key ? (fallbackText(key, resolvedParams, defaultTexts) ?? translated) : translated;\n }\n\n function definedEntries(params: Record<string, unknown> | undefined): Record<string, unknown> {\n return Object.fromEntries(Object.entries(params ?? {}).filter(([, value]) => value !== undefined));\n }\n\n function resolveParams(params: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n if (!params) return undefined;\n return Object.fromEntries(\n Object.entries(params).map(([name, value]) => [name, isRawText(value) || isKeyRequest(value) ? resolve(value) : value])\n );\n }\n\n return resolve;\n}\n\n/**\n * The app's current language, `undefined` when the app gives none.\n *\n * @example\n * const language = injectLanguage();\n * const locale = computed(() => language() ?? 'en');\n */\nexport function injectLanguage(): Signal<string | undefined> {\n const translation = inject(UI_COMPONENTS_TRANSLATION, { optional: true });\n\n return computed(() => translation?.language?.());\n}\n","import { DefaultTextKey } from './default-texts';\nimport { TranslationRequest } from './translation.model';\nimport { injectTranslate } from './translation.provider';\n\n/**\n * The text roles a component renders: per role, the DS default key, or `null` when the role has no default.\n *\n * @example\n * const ROLES = { title: null, placeholder: 'ui-components.select.placeholder' } as const satisfies TextRoles;\n */\nexport type TextRoles = Readonly<Record<string, DefaultTextKey | null>>;\n\n/**\n * The text roles a component renders from a model `i18n` type: any subset of its keys, each with a DS default key or `null`.\n * Checked with `satisfies`, a role the model does not declare fails compilation.\n *\n * @example\n * const ROLES = { caption: null, placeholder: 'ui-components.select.placeholder' } as const satisfies TextRolesOf<Group['i18n']>;\n */\nexport type TextRolesOf<I18n> = Readonly<Partial<Record<keyof I18n & string, DefaultTextKey | null>>>;\n\n/**\n * Resolves every role of `roles` from `i18n` in one call: an absent role (`null` or `undefined`) takes its default key,\n * or stays `undefined` without one; an explicit request wins even when it renders empty.\n * A model `i18n` carrying more roles than `roles` lists is accepted.\n */\nexport type ResolveTexts = <R extends TextRoles>(\n i18n: Readonly<Partial<Record<keyof NoInfer<R> & string, TranslationRequest | null | undefined>>> | null | undefined,\n roles: R\n) => ResolvedTexts<R>;\n\ntype ResolvedTexts<R extends TextRoles> = { [K in keyof R]: R[K] extends string ? string : string | undefined };\n\n/**\n * Call in an injection context; built on {@link injectTranslate}, so read inside a `computed` the texts follow language changes.\n * Resolution rules: `design-specs/patterns/translation.md`.\n *\n * @example\n * const ROLES = { title: null, placeholder: 'ui-components.select.placeholder' } as const satisfies TextRolesOf<Group['i18n']>;\n * const resolveTexts = injectResolveTexts();\n * const texts = computed(() => resolveTexts(this.i18n(), ROLES));\n */\nexport function injectResolveTexts(): ResolveTexts {\n const t = injectTranslate();\n\n return <R extends TextRoles>(\n i18n: Readonly<Partial<Record<keyof R & string, TranslationRequest | null | undefined>>> | null | undefined,\n roles: R\n ) => {\n const requests: Readonly<Partial<Record<string, TranslationRequest | null | undefined>>> = i18n ?? {};\n // A mapped type over a generic R cannot be built key by key; the keys are exactly those of `roles`.\n return Object.fromEntries(\n Object.entries(roles).map(([role, defaultKey]) => {\n const request = requests[role] ?? defaultKey;\n return [role, request === null ? undefined : t(request)];\n })\n ) as ResolvedTexts<R>;\n };\n}\n","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AAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAC1H;IACL;AAEA,IAAA,OAAO,OAAO;AAClB;AAEA;;;;;;AAMG;SACa,cAAc,GAAA;AAC1B,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEzE,OAAO,QAAQ,CAAC,MAAM,WAAW,EAAE,QAAQ,IAAI,CAAC;AACpD;;ACjFA;;;;;;;;AAQG;SACa,kBAAkB,GAAA;AAC9B,IAAA,MAAM,CAAC,GAAG,eAAe,EAAE;AAE3B,IAAA,OAAO,CACH,IAA2G,EAC3G,KAAQ,KACR;AACA,QAAA,MAAM,QAAQ,GAA6E,IAAI,IAAI,EAAE;;QAErG,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,KAAI;YAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU;AAC5C,YAAA,OAAO,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC,CAAC,CACe;AACzB,IAAA,CAAC;AACL;;AC1DA;;AAEG;;;;"}
|
|
@@ -80,7 +80,7 @@ class InputSearchComponent {
|
|
|
80
80
|
useExisting: forwardRef(() => InputSearchComponent),
|
|
81
81
|
multi: true,
|
|
82
82
|
},
|
|
83
|
-
], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n", styles: ["ap-input-search ap-input-group .ap-input-group .close{height:20px;width:20px;display:flex;justify-content:center;align-items:center;border-radius:50%}ap-input-search ap-input-group .ap-input-group .close ap-symbol{color:var(--ref-color-grey-100);align-self:center}ap-input-search ap-input-group .ap-input-group .close:hover{background:#3445631a;border-radius:50%;cursor:pointer}ap-input-search ap-input-group .ap-input-group input{width:100
|
|
83
|
+
], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n", styles: ["ap-input-search ap-input-group .ap-input-group .close{height:20px;width:20px;display:flex;justify-content:center;align-items:center;border-radius:50%}ap-input-search ap-input-group .ap-input-group .close ap-symbol{color:var(--ref-color-grey-100);align-self:center}ap-input-search ap-input-group .ap-input-group .close:hover{background:#3445631a;border-radius:50%;cursor:pointer}ap-input-search ap-input-group .ap-input-group input{width:100%;line-height:var(--comp-input-text-line-height)}\n"], dependencies: [{ kind: "component", type: InputGroupComponent, selector: "ap-input-group", inputs: ["symbolPosition", "disabled"] }, { kind: "directive", type: InputDirective, selector: "[apInput]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "directive", type: ClickDirective, selector: "[apClick]", inputs: ["apClickDisabled", "apClickRole"], outputs: ["apClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
84
84
|
}
|
|
85
85
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputSearchComponent, decorators: [{
|
|
86
86
|
type: Component,
|
|
@@ -90,7 +90,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
90
90
|
useExisting: forwardRef(() => InputSearchComponent),
|
|
91
91
|
multi: true,
|
|
92
92
|
},
|
|
93
|
-
], template: "<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n", styles: ["ap-input-search ap-input-group .ap-input-group .close{height:20px;width:20px;display:flex;justify-content:center;align-items:center;border-radius:50%}ap-input-search ap-input-group .ap-input-group .close ap-symbol{color:var(--ref-color-grey-100);align-self:center}ap-input-search ap-input-group .ap-input-group .close:hover{background:#3445631a;border-radius:50%;cursor:pointer}ap-input-search ap-input-group .ap-input-group input{width:100
|
|
93
|
+
], template: "<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n", styles: ["ap-input-search ap-input-group .ap-input-group .close{height:20px;width:20px;display:flex;justify-content:center;align-items:center;border-radius:50%}ap-input-search ap-input-group .ap-input-group .close ap-symbol{color:var(--ref-color-grey-100);align-self:center}ap-input-search ap-input-group .ap-input-group .close:hover{background:#3445631a;border-radius:50%;cursor:pointer}ap-input-search ap-input-group .ap-input-group input{width:100%;line-height:var(--comp-input-text-line-height)}\n"] }]
|
|
94
94
|
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], ariaControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaControls", required: false }] }], ariaActiveDescendant: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaActiveDescendant", required: false }] }], focus: [{ type: i0.Output, args: ["focus"] }], blur: [{ type: i0.Output, args: ["blur"] }], keyup: [{ type: i0.Output, args: ["keyup"] }], inputElement: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }] } });
|
|
95
95
|
|
|
96
96
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agorapulse-ui-components-input-search.mjs","sources":["../../../libs/ui-components/input-search/src/input-search.component.ts","../../../libs/ui-components/input-search/src/input-search.component.html","../../../libs/ui-components/input-search/src/agorapulse-ui-components-input-search.ts"],"sourcesContent":["import { ClickDirective } from '@agorapulse/ui-components/directives';\nimport { InputDirective } from '@agorapulse/ui-components/input';\nimport { InputGroupComponent } from '@agorapulse/ui-components/input-group';\nimport { SymbolComponent, SymbolRegistry, apClose, apSearch } from '@agorapulse/ui-symbol';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nlet inputSearchId = 0;\n\n@Component({\n selector: 'ap-input-search',\n templateUrl: './input-search.component.html',\n styleUrls: ['./input-search.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [InputGroupComponent, InputDirective, FormsModule, SymbolComponent, ClickDirective],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => InputSearchComponent),\n multi: true,\n },\n ],\n})\nexport class InputSearchComponent implements ControlValueAccessor {\n id = input<string>('');\n placeholder = input<string>('');\n clearable = input(true);\n\n /** Id of the list this field drives, when it drives one. */\n ariaControls = input<string | null>(null);\n\n /** Id of the option this field marks in that list, so focus can stay in the field. */\n ariaActiveDescendant = input<string | null>(null);\n\n // eslint-disable-next-line @angular-eslint/no-output-native\n focus = output<FocusEvent>();\n // eslint-disable-next-line @angular-eslint/no-output-native\n blur = output<FocusEvent>();\n // eslint-disable-next-line @angular-eslint/no-output-native\n keyup = output<KeyboardEvent>();\n\n inputElement = viewChild.required<ElementRef>('input');\n\n value = signal<string | null>('');\n defaultInputId = `ap-input-search-${inputSearchId++}`;\n\n inputId = computed(() => this.id() ?? this.defaultInputId);\n\n disabled = signal(false);\n\n onTouched: () => void = () => {};\n\n onChanged: (value: any) => void = () => {};\n\n private symbolRegistry = inject(SymbolRegistry);\n\n constructor() {\n this.symbolRegistry.registerSymbols([apSearch, apClose]);\n }\n\n registerOnChange(fn: (value: string | null) => void): void {\n this.onChanged = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n onValueChange(value: string | null) {\n this.writeValue(value);\n this.onChanged(value);\n }\n\n focusInput(): void {\n this.inputElement().nativeElement.focus();\n }\n\n writeValue(value: string | null): void {\n this.value.set(value);\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n\n onClear($event: Event): void {\n $event.stopImmediatePropagation();\n this.onValueChange(null);\n }\n\n onFocusHandle($event: FocusEvent): void {\n this.focus.emit($event);\n }\n\n onBlurHandle($event: FocusEvent): void {\n this.blur.emit($event);\n }\n\n onKeyup($event: KeyboardEvent): void {\n this.keyup.emit($event);\n }\n}\n","<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAmBA,IAAI,aAAa,GAAG,CAAC;MAiBR,oBAAoB,CAAA;IAC7B,EAAE,GAAG,KAAK,CAAS,EAAE;2EAAC;IACtB,WAAW,GAAG,KAAK,CAAS,EAAE;oFAAC;IAC/B,SAAS,GAAG,KAAK,CAAC,IAAI;kFAAC;;IAGvB,YAAY,GAAG,KAAK,CAAgB,IAAI;qFAAC;;IAGzC,oBAAoB,GAAG,KAAK,CAAgB,IAAI;6FAAC;;IAGjD,KAAK,GAAG,MAAM,EAAc;;IAE5B,IAAI,GAAG,MAAM,EAAc;;IAE3B,KAAK,GAAG,MAAM,EAAiB;AAE/B,IAAA,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAa,OAAO,CAAC;IAEtD,KAAK,GAAG,MAAM,CAAgB,EAAE;8EAAC;AACjC,IAAA,cAAc,GAAG,CAAA,gBAAA,EAAmB,aAAa,EAAE,EAAE;AAErD,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,cAAc;gFAAC;IAE1D,QAAQ,GAAG,MAAM,CAAC,KAAK;iFAAC;AAExB,IAAA,SAAS,GAAe,MAAK,EAAE,CAAC;AAEhC,IAAA,SAAS,GAAyB,MAAK,EAAE,CAAC;AAElC,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAE/C,IAAA,WAAA,GAAA;QACI,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5D;AAEA,IAAA,gBAAgB,CAA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AAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EClCL,0zBA0BA,EAAA,MAAA,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"agorapulse-ui-components-input-search.mjs","sources":["../../../libs/ui-components/input-search/src/input-search.component.ts","../../../libs/ui-components/input-search/src/input-search.component.html","../../../libs/ui-components/input-search/src/agorapulse-ui-components-input-search.ts"],"sourcesContent":["import { ClickDirective } from '@agorapulse/ui-components/directives';\nimport { InputDirective } from '@agorapulse/ui-components/input';\nimport { InputGroupComponent } from '@agorapulse/ui-components/input-group';\nimport { SymbolComponent, SymbolRegistry, apClose, apSearch } from '@agorapulse/ui-symbol';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nlet inputSearchId = 0;\n\n@Component({\n selector: 'ap-input-search',\n templateUrl: './input-search.component.html',\n styleUrls: ['./input-search.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [InputGroupComponent, InputDirective, FormsModule, SymbolComponent, ClickDirective],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => InputSearchComponent),\n multi: true,\n },\n ],\n})\nexport class InputSearchComponent implements ControlValueAccessor {\n id = input<string>('');\n placeholder = input<string>('');\n clearable = input(true);\n\n /** Id of the list this field drives, when it drives one. */\n ariaControls = input<string | null>(null);\n\n /** Id of the option this field marks in that list, so focus can stay in the field. */\n ariaActiveDescendant = input<string | null>(null);\n\n // eslint-disable-next-line @angular-eslint/no-output-native\n focus = output<FocusEvent>();\n // eslint-disable-next-line @angular-eslint/no-output-native\n blur = output<FocusEvent>();\n // eslint-disable-next-line @angular-eslint/no-output-native\n keyup = output<KeyboardEvent>();\n\n inputElement = viewChild.required<ElementRef>('input');\n\n value = signal<string | null>('');\n defaultInputId = `ap-input-search-${inputSearchId++}`;\n\n inputId = computed(() => this.id() ?? this.defaultInputId);\n\n disabled = signal(false);\n\n onTouched: () => void = () => {};\n\n onChanged: (value: any) => void = () => {};\n\n private symbolRegistry = inject(SymbolRegistry);\n\n constructor() {\n this.symbolRegistry.registerSymbols([apSearch, apClose]);\n }\n\n registerOnChange(fn: (value: string | null) => void): void {\n this.onChanged = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n onValueChange(value: string | null) {\n this.writeValue(value);\n this.onChanged(value);\n }\n\n focusInput(): void {\n this.inputElement().nativeElement.focus();\n }\n\n writeValue(value: string | null): void {\n this.value.set(value);\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n\n onClear($event: Event): void {\n $event.stopImmediatePropagation();\n this.onValueChange(null);\n }\n\n onFocusHandle($event: FocusEvent): void {\n this.focus.emit($event);\n }\n\n onBlurHandle($event: FocusEvent): void {\n this.blur.emit($event);\n }\n\n onKeyup($event: KeyboardEvent): void {\n this.keyup.emit($event);\n }\n}\n","<ap-input-group>\n <ap-symbol symbolId=\"search\" />\n <input\n #input\n apInput\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.aria-activedescendant]=\"ariaActiveDescendant()\"\n [ngModel]=\"value()\"\n (blur)=\"onBlurHandle($event)\"\n (focus)=\"onFocusHandle($event)\"\n (keyup)=\"onKeyup($event)\"\n (ngModelChange)=\"onValueChange($event)\" />\n @if (clearable() && value()) {\n <div\n class=\"close\"\n aria-label=\"Clear search\"\n (apClick)=\"onClear($event)\">\n <ap-symbol\n symbolId=\"close\"\n size=\"xs\" />\n </div>\n }\n</ap-input-group>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAmBA,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AACP,wBAAA;AACI,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,0BAA0B,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACd,yBAAA;AACJ,qBAAA,EAAA,QAAA,EAAA,0zBAAA,EAAA,MAAA,EAAA,CAAA,6eAAA,CAAA,EAAA;2uBAoB6C,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEtDzD;;AAEG;;;;"}
|
|
@@ -82,7 +82,7 @@ class LabelsSelectorComponent {
|
|
|
82
82
|
}))));
|
|
83
83
|
}
|
|
84
84
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: LabelsSelectorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: LabelsSelectorComponent, isStandalone: true, selector: "ap-labels-selector", inputs: { addLabelEnabled: "addLabelEnabled", disabled: "disabled", initialLabels: "initialLabels", translation: "translation", loadingOnSearch: "loadingOnSearch", multipleEnabled: "multipleEnabled", searchLabelsFunction: "searchLabelsFunction" }, outputs: { createLabel: "createLabel", addLabel: "addLabel", deleteLabel: "deleteLabel", selectLabels: "selectLabels", searchErrorMessage: "searchErrorMessage" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- @JRA [multiple]=\"false\" break the component display and behavior, we use [maxSelectedItems]=\"1\" as efficient workaround -->\n<ng-select\n #select\n class=\"labels-select ap-select\"\n apSelectMultiple\n appendTo=\"body\"\n [clearable]=\"false\"\n [disabled]=\"disabled\"\n [items]=\"(labels$ | async) ?? []\"\n [loading]=\"labelsLoading\"\n [minTermLength]=\"0\"\n [multiple]=\"true\"\n [placeholder]=\"translation.placeholder\"\n [typeahead]=\"labelsInput$\"\n [(ngModel)]=\"labels\"\n (change)=\"onLabelsChange()\"\n (add)=\"onAddLabel($event)\"\n (remove)=\"onDeleteLabel($event)\"\n (open)=\"onOpen()\">\n <ng-template\n let-items=\"items\"\n let-clear=\"clear\"\n ng-multi-label-tmp>\n <ap-select-label-multiple\n displayType=\"label\"\n [selectedItems]=\"items\"\n (removeItem)=\"clear($event)\" />\n </ng-template>\n <ng-template\n let-item=\"item\"\n let-item$=\"item$\"\n ng-option-tmp>\n <ap-dropdown-item-multiple-one-line\n [text]=\"item\"\n [htmlId]=\"item$.htmlId\"\n [selected]=\"item$.selected\" />\n </ng-template>\n <ng-template ng-header-tmp>\n <ap-dropdown-search-form\n [searchPlaceholder]=\"translation.searchPlaceholder ?? translation.placeholder\"\n [select]=\"select\" />\n </ng-template>\n @if (addLabelEnabled) {\n <ng-template\n let-searchTerm=\"searchTerm\"\n ng-footer-tmp>\n <ap-dropdown-create-new\n [text]=\"translation.createLabel\"\n [searchTerm]=\"searchTerm\"\n (createNew)=\"onCreateLabel($event)\" />\n </ng-template>\n }\n <ng-template ng-notfound-tmp>\n <div class=\"option not-found\">\n <span>{{ select.notFoundText() || 'Not found text' }}</span>\n </div>\n </ng-template>\n <ng-template ng-loadingtext-tmp>\n <div class=\"loading-state\">\n <ap-loader diameter=\"30\" />\n <span>{{ select.loadingText() || 'Loading Items' }}</span>\n </div>\n </ng-template>\n</ng-select>\n", styles: ["[color=facebook]{color:#0866ff}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#0866ff}[border=facebook]{border:1px solid #0866ff}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=reddit]{color:#ff4500}[bgcolor=reddit],[hcolor=reddit]:hover{background-color:#ff4500}[border=reddit]{border:1px solid #ff4500}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #a566a5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #c7ab82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #f2713c}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #ffd006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94c5aa}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2a9d8f}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78acd8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525a9e}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6a2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729e}:host{max-width:260px;display:flex}.labels-select{width:260px}.labels-select .labels-wrapper{margin-bottom:5px;max-width:221px}::ng-deep .labels-select.ng-select .ng-select-container .ng-value-container{overflow-y:auto;overflow-x:hidden;max-height:171px;padding-left:6px!important;gap:4px}::ng-deep .ng-option{color:#344563!important}::ng-deep .ng-option.ng-option-marked{color:#178dfe!important}.add-label{display:flex;align-items:center;color:#178dfe}.add-label .add-label-icon{padding-right:8px}.add-label-preview{text-overflow:ellipsis;display:block;white-space:nowrap;overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: ApSelectModule }, { kind: "directive", type: i1.SelectMultipleDirective, selector: "ng-select[apSelectMultiple]", inputs: ["maxItemsTooltip", "pinnedItemsEnabled"] }, { kind: "component", type: i1.DropdownItemMultipleOneLineComponent, selector: "ap-dropdown-item-multiple-one-line", inputs: ["text", "selected", "indeterminate", "htmlId", "disabled", "avatarUrl", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "presentational", "onlyEnabled", "onlyText", "isFeatureLocked", "roundedAvatar", "network", "symbolColor", "symbolTooltipText"], outputs: ["selectOnly", "lockedFeatureClicked"] }, { kind: "component", type: i1.SelectLabelMultipleComponent, selector: "ap-select-label-multiple", inputs: ["displayType", "tagColor", "selectedItems", "bindLabel", "bindValue", "bindAvatarUrl", "bindSymbolId", "roundedAvatar", "bindNetwork", "bindTagColor", "disabled"], outputs: ["removeItem"] }, { kind: "component", type: i1.DropdownSearchFormComponent, selector: "ap-dropdown-search-form", inputs: ["searchPlaceholder", "createNewEnabled", "createText", "select"], outputs: ["createNew"] }, { kind: "component", type: i1.DropdownCreateNewComponent, selector: "ap-dropdown-create-new", inputs: ["text", "searchTerm"], outputs: ["createNew"] }, { kind: "component", type: i2.NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "dropdownPosition", "appendTo", "outsideClickEvent", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "tabFocusOnClearButton", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "clearKeepsDisabledOptions", "deselectOnClick", "clearSearchOnAdd", "compareWith", "keyDownFn", "popover", "bindLabel", "bindValue", "appearance", "isOpen", "items"], outputs: ["bindLabelChange", "bindValueChange", "appearanceChange", "isOpenChange", "itemsChange", "blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"], exportAs: ["ngSelect"] }, { kind: "directive", type: i2.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i2.NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]" }, { kind: "directive", type: i2.NgHeaderTemplateDirective, selector: "[ng-header-tmp]" }, { kind: "directive", type: i2.NgFooterTemplateDirective, selector: "[ng-footer-tmp]" }, { kind: "directive", type: i2.NgNotFoundTemplateDirective, selector: "[ng-notfound-tmp]" }, { kind: "directive", type: i2.NgLoadingTextTemplateDirective, selector: "[ng-loadingtext-tmp]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: LoaderComponent, selector: "ap-loader", inputs: ["color", "diameter"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
85
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: LabelsSelectorComponent, isStandalone: true, selector: "ap-labels-selector", inputs: { addLabelEnabled: "addLabelEnabled", disabled: "disabled", initialLabels: "initialLabels", translation: "translation", loadingOnSearch: "loadingOnSearch", multipleEnabled: "multipleEnabled", searchLabelsFunction: "searchLabelsFunction" }, outputs: { createLabel: "createLabel", addLabel: "addLabel", deleteLabel: "deleteLabel", selectLabels: "selectLabels", searchErrorMessage: "searchErrorMessage" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- @JRA [multiple]=\"false\" break the component display and behavior, we use [maxSelectedItems]=\"1\" as efficient workaround -->\n<ng-select\n #select\n class=\"labels-select ap-select\"\n apSelectMultiple\n appendTo=\"body\"\n [clearable]=\"false\"\n [disabled]=\"disabled\"\n [items]=\"(labels$ | async) ?? []\"\n [loading]=\"labelsLoading\"\n [minTermLength]=\"0\"\n [multiple]=\"true\"\n [placeholder]=\"translation.placeholder\"\n [typeahead]=\"labelsInput$\"\n [(ngModel)]=\"labels\"\n (change)=\"onLabelsChange()\"\n (add)=\"onAddLabel($event)\"\n (remove)=\"onDeleteLabel($event)\"\n (open)=\"onOpen()\">\n <ng-template\n let-items=\"items\"\n let-clear=\"clear\"\n ng-multi-label-tmp>\n <ap-select-label-multiple\n displayType=\"label\"\n [selectedItems]=\"items\"\n (removeItem)=\"clear($event)\" />\n </ng-template>\n <ng-template\n let-item=\"item\"\n let-item$=\"item$\"\n ng-option-tmp>\n <ap-dropdown-item-multiple-one-line\n [text]=\"item\"\n [htmlId]=\"item$.htmlId\"\n [selected]=\"item$.selected\" />\n </ng-template>\n <ng-template ng-header-tmp>\n <ap-dropdown-search-form\n [searchPlaceholder]=\"translation.searchPlaceholder ?? translation.placeholder\"\n [select]=\"select\" />\n </ng-template>\n @if (addLabelEnabled) {\n <ng-template\n let-searchTerm=\"searchTerm\"\n ng-footer-tmp>\n <ap-dropdown-create-new\n [text]=\"translation.createLabel\"\n [searchTerm]=\"searchTerm\"\n (createNew)=\"onCreateLabel($event)\" />\n </ng-template>\n }\n <ng-template ng-notfound-tmp>\n <div class=\"option not-found\">\n <span>{{ select.notFoundText() || 'Not found text' }}</span>\n </div>\n </ng-template>\n <ng-template ng-loadingtext-tmp>\n <div class=\"loading-state\">\n <ap-loader diameter=\"30\" />\n <span>{{ select.loadingText() || 'Loading Items' }}</span>\n </div>\n </ng-template>\n</ng-select>\n", styles: ["[color=facebook]{color:#0866ff}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#0866ff}[border=facebook]{border:1px solid #0866ff}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=reddit]{color:#ff4500}[bgcolor=reddit],[hcolor=reddit]:hover{background-color:#ff4500}[border=reddit]{border:1px solid #ff4500}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #a566a5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #c7ab82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #f2713c}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #ffd006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94c5aa}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2a9d8f}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78acd8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525a9e}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6a2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729e}:host{max-width:260px;display:flex}.labels-select{width:260px}.labels-select .labels-wrapper{margin-bottom:5px;max-width:221px}::ng-deep .labels-select.ng-select .ng-select-container .ng-value-container{overflow-y:auto;overflow-x:hidden;max-height:171px;padding-left:6px!important;gap:4px}::ng-deep .ng-option{color:#344563!important}::ng-deep .ng-option.ng-option-marked{color:#178dfe!important}.add-label{display:flex;align-items:center;color:#178dfe}.add-label .add-label-icon{padding-right:8px}.add-label-preview{text-overflow:ellipsis;display:block;white-space:nowrap;overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: ApSelectModule }, { kind: "directive", type: i1.SelectMultipleDirective, selector: "ng-select[apSelectMultiple]", inputs: ["maxItemsTooltip", "pinnedItemsEnabled", "selectAllEnabled", "selectAllText", "selectAllCountText"] }, { kind: "component", type: i1.DropdownItemMultipleOneLineComponent, selector: "ap-dropdown-item-multiple-one-line", inputs: ["text", "selected", "indeterminate", "htmlId", "disabled", "avatarUrl", "symbolId", "disabledTooltip", "badgeText", "dividerEnabled", "presentational", "onlyEnabled", "onlyText", "isFeatureLocked", "roundedAvatar", "network", "symbolColor", "symbolTooltipText"], outputs: ["selectOnly", "lockedFeatureClicked"] }, { kind: "component", type: i1.SelectLabelMultipleComponent, selector: "ap-select-label-multiple", inputs: ["displayType", "tagColor", "selectedItems", "bindLabel", "bindValue", "bindAvatarUrl", "bindSymbolId", "roundedAvatar", "bindNetwork", "bindTagColor", "disabled"], outputs: ["removeItem"] }, { kind: "component", type: i1.DropdownSearchFormComponent, selector: "ap-dropdown-search-form", inputs: ["searchPlaceholder", "createNewEnabled", "createText", "select"], outputs: ["createNew"] }, { kind: "component", type: i1.DropdownCreateNewComponent, selector: "ap-dropdown-create-new", inputs: ["text", "searchTerm"], outputs: ["createNew"] }, { kind: "component", type: i2.NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "dropdownPosition", "appendTo", "outsideClickEvent", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "tabFocusOnClearButton", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "clearKeepsDisabledOptions", "deselectOnClick", "clearSearchOnAdd", "compareWith", "keyDownFn", "popover", "bindLabel", "bindValue", "appearance", "isOpen", "items"], outputs: ["bindLabelChange", "bindValueChange", "appearanceChange", "isOpenChange", "itemsChange", "blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"], exportAs: ["ngSelect"] }, { kind: "directive", type: i2.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i2.NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]" }, { kind: "directive", type: i2.NgHeaderTemplateDirective, selector: "[ng-header-tmp]" }, { kind: "directive", type: i2.NgFooterTemplateDirective, selector: "[ng-footer-tmp]" }, { kind: "directive", type: i2.NgNotFoundTemplateDirective, selector: "[ng-notfound-tmp]" }, { kind: "directive", type: i2.NgLoadingTextTemplateDirective, selector: "[ng-loadingtext-tmp]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: LoaderComponent, selector: "ap-loader", inputs: ["color", "diameter"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
86
86
|
}
|
|
87
87
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: LabelsSelectorComponent, decorators: [{
|
|
88
88
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agorapulse-ui-components-labels-selector.mjs","sources":["../../../libs/ui-components/labels-selector/src/labels-selector.component.ts","../../../libs/ui-components/labels-selector/src/labels-selector.component.html","../../../libs/ui-components/labels-selector/src/agorapulse-ui-components-labels-selector.ts"],"sourcesContent":["import { LoaderComponent } from '@agorapulse/ui-animations';\nimport { LabelComponent } from '@agorapulse/ui-components/labels';\nimport { ApSelectModule } from '@agorapulse/ui-components/select';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnChanges,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { NgSelectComponent } from '@ng-select/ng-select';\nimport { Observable, Subject } from 'rxjs';\nimport { catchError, debounceTime, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';\n\nexport interface LabelsSelectorTranslation {\n placeholder: string;\n createLabel: string;\n searchPlaceholder?: string;\n}\n\n@Component({\n selector: 'ap-labels-selector',\n templateUrl: './labels-selector.component.html',\n styleUrls: ['./labels-selector.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [ApSelectModule, LabelComponent, FormsModule, AsyncPipe, LoaderComponent],\n})\nexport class LabelsSelectorComponent implements OnInit, OnChanges {\n @Input() addLabelEnabled: boolean = true;\n @Input() disabled: boolean = false;\n @Input() initialLabels: string[] = [];\n @Input() translation!: LabelsSelectorTranslation;\n @Input() loadingOnSearch: boolean = true;\n @Input() multipleEnabled: boolean = true;\n @Input({\n required: true,\n })\n searchLabelsFunction!: (val: string) => Observable<string[]>;\n\n @Output() createLabel = new EventEmitter<string>();\n @Output() addLabel = new EventEmitter<string>();\n @Output() deleteLabel = new EventEmitter<string>();\n @Output() selectLabels = new EventEmitter<string[]>();\n @Output() searchErrorMessage = new EventEmitter<string>();\n\n @ViewChild('select') select!: NgSelectComponent;\n\n labels: string[] = [];\n labelsInput$: Subject<string> = new Subject<string>();\n labels$!: Observable<string[]>;\n labelsLoading = false;\n\n constructor(private changeDetectorRef: ChangeDetectorRef) {}\n\n ngOnInit(): void {\n this.labels = this.initialLabels;\n this.setSearchFunction();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.initialLabels?.currentValue) {\n this.labels = this.initialLabels;\n }\n }\n\n onCreateLabel(label: string): void {\n if (label && this.initialLabels.indexOf(label) === -1) {\n const handleTag = (item: string) => this.select.itemsList.addItem(item);\n this.select.select(handleTag(label));\n }\n this.createLabel.emit(label);\n }\n\n onDeleteLabel(label: string) {\n this.deleteLabel.emit(label);\n }\n\n onAddLabel(label: string) {\n this.addLabel.emit(label);\n }\n\n onOpen(): void {\n this.labelsInput$.next('');\n }\n\n onLabelsChange(): void {\n if (!this.multipleEnabled && this.labels.length > 1) {\n this.labels = [this.labels[this.labels.length - 1]];\n }\n this.selectLabels.emit(this.labels);\n this.changeDetectorRef.markForCheck();\n }\n\n setSearchFunction(): void {\n this.labels$ = this.labelsInput$.pipe(\n debounceTime(this.loadingOnSearch ? 400 : 0),\n distinctUntilChanged(),\n tap(() => {\n this.labelsLoading = true;\n this.changeDetectorRef.markForCheck();\n }),\n switchMap((term: string) =>\n this.searchLabelsFunction(term).pipe(\n catchError(response => {\n this.searchErrorMessage.emit(response.error ? response.error.message : 'Error');\n return [];\n }),\n map(response => {\n this.labelsLoading = false;\n this.changeDetectorRef.markForCheck();\n if (!response || Object.keys(response).length == 0) {\n return [];\n }\n return response;\n })\n )\n )\n );\n }\n}\n","<!-- @JRA [multiple]=\"false\" break the component display and behavior, we use [maxSelectedItems]=\"1\" as efficient workaround -->\n<ng-select\n #select\n class=\"labels-select ap-select\"\n apSelectMultiple\n appendTo=\"body\"\n [clearable]=\"false\"\n [disabled]=\"disabled\"\n [items]=\"(labels$ | async) ?? []\"\n [loading]=\"labelsLoading\"\n [minTermLength]=\"0\"\n [multiple]=\"true\"\n [placeholder]=\"translation.placeholder\"\n [typeahead]=\"labelsInput$\"\n [(ngModel)]=\"labels\"\n (change)=\"onLabelsChange()\"\n (add)=\"onAddLabel($event)\"\n (remove)=\"onDeleteLabel($event)\"\n (open)=\"onOpen()\">\n <ng-template\n let-items=\"items\"\n let-clear=\"clear\"\n ng-multi-label-tmp>\n <ap-select-label-multiple\n displayType=\"label\"\n [selectedItems]=\"items\"\n (removeItem)=\"clear($event)\" />\n </ng-template>\n <ng-template\n let-item=\"item\"\n let-item$=\"item$\"\n ng-option-tmp>\n <ap-dropdown-item-multiple-one-line\n [text]=\"item\"\n [htmlId]=\"item$.htmlId\"\n [selected]=\"item$.selected\" />\n </ng-template>\n <ng-template ng-header-tmp>\n <ap-dropdown-search-form\n [searchPlaceholder]=\"translation.searchPlaceholder ?? translation.placeholder\"\n [select]=\"select\" />\n </ng-template>\n @if (addLabelEnabled) {\n <ng-template\n let-searchTerm=\"searchTerm\"\n ng-footer-tmp>\n <ap-dropdown-create-new\n [text]=\"translation.createLabel\"\n [searchTerm]=\"searchTerm\"\n (createNew)=\"onCreateLabel($event)\" />\n </ng-template>\n }\n <ng-template ng-notfound-tmp>\n <div class=\"option not-found\">\n <span>{{ select.notFoundText() || 'Not found text' }}</span>\n </div>\n </ng-template>\n <ng-template ng-loadingtext-tmp>\n <div class=\"loading-state\">\n <ap-loader diameter=\"30\" />\n <span>{{ select.loadingText() || 'Loading Items' }}</span>\n </div>\n </ng-template>\n</ng-select>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAkCa,uBAAuB,CAAA;AAyBZ,IAAA,iBAAA;IAxBX,eAAe,GAAY,IAAI;IAC/B,QAAQ,GAAY,KAAK;IACzB,aAAa,GAAa,EAAE;AAC5B,IAAA,WAAW;IACX,eAAe,GAAY,IAAI;IAC/B,eAAe,GAAY,IAAI;AAIxC,IAAA,oBAAoB;AAEV,IAAA,WAAW,GAAG,IAAI,YAAY,EAAU;AACxC,IAAA,QAAQ,GAAG,IAAI,YAAY,EAAU;AACrC,IAAA,WAAW,GAAG,IAAI,YAAY,EAAU;AACxC,IAAA,YAAY,GAAG,IAAI,YAAY,EAAY;AAC3C,IAAA,kBAAkB,GAAG,IAAI,YAAY,EAAU;AAEpC,IAAA,MAAM;IAE3B,MAAM,GAAa,EAAE;AACrB,IAAA,YAAY,GAAoB,IAAI,OAAO,EAAU;AACrD,IAAA,OAAO;IACP,aAAa,GAAG,KAAK;AAErB,IAAA,WA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,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAA1B,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAEvD,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAPnC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,EAAA,eAAA,EAGb,uBAAuB,CAAC,MAAM,WACtC,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,CAAC,EAAA,QAAA,EAAA,4qEAAA,EAAA,MAAA,EAAA,CAAA,+nMAAA,CAAA,EAAA;;sBAGjF;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,QAAQ,EAAE,IAAI;AACjB,qBAAA;;sBAGA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA,SAAS;uBAAC,QAAQ;;;AEpDvB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"agorapulse-ui-components-labels-selector.mjs","sources":["../../../libs/ui-components/labels-selector/src/labels-selector.component.ts","../../../libs/ui-components/labels-selector/src/labels-selector.component.html","../../../libs/ui-components/labels-selector/src/agorapulse-ui-components-labels-selector.ts"],"sourcesContent":["import { LoaderComponent } from '@agorapulse/ui-animations';\nimport { LabelComponent } from '@agorapulse/ui-components/labels';\nimport { ApSelectModule } from '@agorapulse/ui-components/select';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnChanges,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { NgSelectComponent } from '@ng-select/ng-select';\nimport { Observable, Subject } from 'rxjs';\nimport { catchError, debounceTime, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';\n\nexport interface LabelsSelectorTranslation {\n placeholder: string;\n createLabel: string;\n searchPlaceholder?: string;\n}\n\n@Component({\n selector: 'ap-labels-selector',\n templateUrl: './labels-selector.component.html',\n styleUrls: ['./labels-selector.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [ApSelectModule, LabelComponent, FormsModule, AsyncPipe, LoaderComponent],\n})\nexport class LabelsSelectorComponent implements OnInit, OnChanges {\n @Input() addLabelEnabled: boolean = true;\n @Input() disabled: boolean = false;\n @Input() initialLabels: string[] = [];\n @Input() translation!: LabelsSelectorTranslation;\n @Input() loadingOnSearch: boolean = true;\n @Input() multipleEnabled: boolean = true;\n @Input({\n required: true,\n })\n searchLabelsFunction!: (val: string) => Observable<string[]>;\n\n @Output() createLabel = new EventEmitter<string>();\n @Output() addLabel = new EventEmitter<string>();\n @Output() deleteLabel = new EventEmitter<string>();\n @Output() selectLabels = new EventEmitter<string[]>();\n @Output() searchErrorMessage = new EventEmitter<string>();\n\n @ViewChild('select') select!: NgSelectComponent;\n\n labels: string[] = [];\n labelsInput$: Subject<string> = new Subject<string>();\n labels$!: Observable<string[]>;\n labelsLoading = false;\n\n constructor(private changeDetectorRef: ChangeDetectorRef) {}\n\n ngOnInit(): void {\n this.labels = this.initialLabels;\n this.setSearchFunction();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.initialLabels?.currentValue) {\n this.labels = this.initialLabels;\n }\n }\n\n onCreateLabel(label: string): void {\n if (label && this.initialLabels.indexOf(label) === -1) {\n const handleTag = (item: string) => this.select.itemsList.addItem(item);\n this.select.select(handleTag(label));\n }\n this.createLabel.emit(label);\n }\n\n onDeleteLabel(label: string) {\n this.deleteLabel.emit(label);\n }\n\n onAddLabel(label: string) {\n this.addLabel.emit(label);\n }\n\n onOpen(): void {\n this.labelsInput$.next('');\n }\n\n onLabelsChange(): void {\n if (!this.multipleEnabled && this.labels.length > 1) {\n this.labels = [this.labels[this.labels.length - 1]];\n }\n this.selectLabels.emit(this.labels);\n this.changeDetectorRef.markForCheck();\n }\n\n setSearchFunction(): void {\n this.labels$ = this.labelsInput$.pipe(\n debounceTime(this.loadingOnSearch ? 400 : 0),\n distinctUntilChanged(),\n tap(() => {\n this.labelsLoading = true;\n this.changeDetectorRef.markForCheck();\n }),\n switchMap((term: string) =>\n this.searchLabelsFunction(term).pipe(\n catchError(response => {\n this.searchErrorMessage.emit(response.error ? response.error.message : 'Error');\n return [];\n }),\n map(response => {\n this.labelsLoading = false;\n this.changeDetectorRef.markForCheck();\n if (!response || Object.keys(response).length == 0) {\n return [];\n }\n return response;\n })\n )\n )\n );\n }\n}\n","<!-- @JRA [multiple]=\"false\" break the component display and behavior, we use [maxSelectedItems]=\"1\" as efficient workaround -->\n<ng-select\n #select\n class=\"labels-select ap-select\"\n apSelectMultiple\n appendTo=\"body\"\n [clearable]=\"false\"\n [disabled]=\"disabled\"\n [items]=\"(labels$ | async) ?? []\"\n [loading]=\"labelsLoading\"\n [minTermLength]=\"0\"\n [multiple]=\"true\"\n [placeholder]=\"translation.placeholder\"\n [typeahead]=\"labelsInput$\"\n [(ngModel)]=\"labels\"\n (change)=\"onLabelsChange()\"\n (add)=\"onAddLabel($event)\"\n (remove)=\"onDeleteLabel($event)\"\n (open)=\"onOpen()\">\n <ng-template\n let-items=\"items\"\n let-clear=\"clear\"\n ng-multi-label-tmp>\n <ap-select-label-multiple\n displayType=\"label\"\n [selectedItems]=\"items\"\n (removeItem)=\"clear($event)\" />\n </ng-template>\n <ng-template\n let-item=\"item\"\n let-item$=\"item$\"\n ng-option-tmp>\n <ap-dropdown-item-multiple-one-line\n [text]=\"item\"\n [htmlId]=\"item$.htmlId\"\n [selected]=\"item$.selected\" />\n </ng-template>\n <ng-template ng-header-tmp>\n <ap-dropdown-search-form\n [searchPlaceholder]=\"translation.searchPlaceholder ?? translation.placeholder\"\n [select]=\"select\" />\n </ng-template>\n @if (addLabelEnabled) {\n <ng-template\n let-searchTerm=\"searchTerm\"\n ng-footer-tmp>\n <ap-dropdown-create-new\n [text]=\"translation.createLabel\"\n [searchTerm]=\"searchTerm\"\n (createNew)=\"onCreateLabel($event)\" />\n </ng-template>\n }\n <ng-template ng-notfound-tmp>\n <div class=\"option not-found\">\n <span>{{ select.notFoundText() || 'Not found text' }}</span>\n </div>\n </ng-template>\n <ng-template ng-loadingtext-tmp>\n <div class=\"loading-state\">\n <ap-loader diameter=\"30\" />\n <span>{{ select.loadingText() || 'Loading Items' }}</span>\n </div>\n </ng-template>\n</ng-select>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAkCa,uBAAuB,CAAA;AAyBZ,IAAA,iBAAA;IAxBX,eAAe,GAAY,IAAI;IAC/B,QAAQ,GAAY,KAAK;IACzB,aAAa,GAAa,EAAE;AAC5B,IAAA,WAAW;IACX,eAAe,GAAY,IAAI;IAC/B,eAAe,GAAY,IAAI;AAIxC,IAAA,oBAAoB;AAEV,IAAA,WAAW,GAAG,IAAI,YAAY,EAAU;AACxC,IAAA,QAAQ,GAAG,IAAI,YAAY,EAAU;AACrC,IAAA,WAAW,GAAG,IAAI,YAAY,EAAU;AACxC,IAAA,YAAY,GAAG,IAAI,YAAY,EAAY;AAC3C,IAAA,kBAAkB,GAAG,IAAI,YAAY,EAAU;AAEpC,IAAA,MAAM;IAE3B,MAAM,GAAa,EAAE;AACrB,IAAA,YAAY,GAAoB,IAAI,OAAO,EAAU;AACrD,IAAA,OAAO;IACP,aAAa,GAAG,KAAK;AAErB,IAAA,WAAA,CAAoB,iBAAoC,EAAA;QAApC,IAAA,CAAA,iBAAiB,GAAjB,iBAAiB;IAAsB;IAE3D,QAAQ,GAAA;AACJ,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa;QAChC,IAAI,CAAC,iBAAiB,EAAE;IAC5B;AAEA,IAAA,WAAW,CAAC,OAAsB,EAAA;AAC9B,QAAA,IAAI,OAAO,CAAC,aAAa,E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,EAAA,eAAA,EAGb,uBAAuB,CAAC,MAAM,WACtC,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,CAAC,EAAA,QAAA,EAAA,4qEAAA,EAAA,MAAA,EAAA,CAAA,+nMAAA,CAAA,EAAA;;sBAGjF;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,QAAQ,EAAE,IAAI;AACjB,qBAAA;;sBAGA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA,SAAS;uBAAC,QAAQ;;;AEpDvB;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Input, ElementRef, Renderer2, ViewContainerRef, DestroyRef, effect, Directive, booleanAttribute, HostListener, ViewChild, EventEmitter, Output,
|
|
2
|
+
import { inject, input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Input, signal, computed, ElementRef, Renderer2, ViewContainerRef, DestroyRef, effect, Directive, Injector, untracked, booleanAttribute, HostListener, ViewChild, EventEmitter, Output, afterNextRender, NgModule } from '@angular/core';
|
|
3
3
|
import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select';
|
|
4
4
|
import { SymbolRegistry, apPlus, SymbolComponent, apCheck } from '@agorapulse/ui-symbol';
|
|
5
5
|
import { BadgeComponent } from '@agorapulse/ui-components/badge';
|
|
@@ -107,6 +107,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
107
107
|
type: Input
|
|
108
108
|
}] } });
|
|
109
109
|
|
|
110
|
+
/** "Select all" row added above the options by `SelectMultipleDirective` when `selectAllEnabled` is set. */
|
|
111
|
+
class DropdownSelectAllComponent {
|
|
112
|
+
select = input.required(/* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "select" }] : /* istanbul ignore next */ []));
|
|
114
|
+
text = input('Select all', /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
116
|
+
/** Appended to `text`. `{selected}` and `{total}` are replaced by the counts of the options it acts on. */
|
|
117
|
+
countText = input('({selected} of {total})', /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "countText" }] : /* istanbul ignore next */ []));
|
|
119
|
+
marked = signal(false, /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "marked" }] : /* istanbul ignore next */ []));
|
|
121
|
+
/** Bumped by the owner on every selection or filter change, as `itemsList` is not reactive. */
|
|
122
|
+
version = signal(0, /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "version" }] : /* istanbul ignore next */ []));
|
|
124
|
+
targets = computed(() => {
|
|
125
|
+
this.version();
|
|
126
|
+
return this.select().itemsList.filteredItems.filter(item => !item.children && !item.disabled);
|
|
127
|
+
}, /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "targets" }] : /* istanbul ignore next */ []));
|
|
129
|
+
visible = computed(() => this.targets().length > 0, /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
131
|
+
checked = computed(() => this.visible() && this.targets().every(item => item.selected), /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
133
|
+
indeterminate = computed(() => !this.checked() && this.targets().some(item => item.selected), /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
135
|
+
label = computed(() => {
|
|
136
|
+
const targets = this.targets();
|
|
137
|
+
const count = this.countText()
|
|
138
|
+
.replace('{selected}', String(targets.filter(item => item.selected).length))
|
|
139
|
+
.replace('{total}', String(targets.length));
|
|
140
|
+
return count ? `${this.text()} ${count}` : this.text();
|
|
141
|
+
}, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
143
|
+
ariaChecked = computed(() => (this.checked() ? 'true' : this.indeterminate() ? 'mixed' : 'false'), /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "ariaChecked" }] : /* istanbul ignore next */ []));
|
|
145
|
+
get rowId() {
|
|
146
|
+
return `${this.select().dropdownId}-select-all`;
|
|
147
|
+
}
|
|
148
|
+
refresh() {
|
|
149
|
+
this.version.update(version => version + 1);
|
|
150
|
+
}
|
|
151
|
+
/** Handles a key before ng-select does, and returns whether it did. */
|
|
152
|
+
handleKey(event) {
|
|
153
|
+
const select = this.select();
|
|
154
|
+
if (!this.visible() || !select.isOpen()) {
|
|
155
|
+
this.marked.set(false);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (this.marked()) {
|
|
159
|
+
switch (event.key) {
|
|
160
|
+
case 'ArrowUp':
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
return true;
|
|
163
|
+
case 'Enter':
|
|
164
|
+
case ' ':
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
this.toggle();
|
|
167
|
+
return true;
|
|
168
|
+
default:
|
|
169
|
+
this.marked.set(false);
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (event.key === 'ArrowUp' && this.isAtFirstOption()) {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
select.itemsList.unmarkItem();
|
|
176
|
+
this.marked.set(true);
|
|
177
|
+
select.detectChanges();
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
isAtFirstOption() {
|
|
183
|
+
const { markedIndex, filteredItems } = this.select().itemsList;
|
|
184
|
+
return markedIndex < 0 || filteredItems.slice(0, markedIndex).every(item => item.disabled);
|
|
185
|
+
}
|
|
186
|
+
toggle() {
|
|
187
|
+
const select = this.select();
|
|
188
|
+
// Snapshot first: selecting may clear the search (`clearSearchOnAdd`), which refilters the list.
|
|
189
|
+
const targets = this.targets();
|
|
190
|
+
const hasSelection = targets.some(item => item.selected);
|
|
191
|
+
const selectAll = select.maxSelectedItems() ? !hasSelection : !this.checked();
|
|
192
|
+
if (selectAll) {
|
|
193
|
+
for (const item of targets) {
|
|
194
|
+
select.select(item);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
for (const item of targets.filter(target => target.selected)) {
|
|
199
|
+
select.unselect(item);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
this.refresh();
|
|
203
|
+
select.detectChanges();
|
|
204
|
+
}
|
|
205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DropdownSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: DropdownSelectAllComponent, isStandalone: true, selector: "ap-dropdown-select-all", inputs: { select: { classPropertyName: "select", publicName: "select", isSignal: true, isRequired: true, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, countText: { classPropertyName: "countText", publicName: "countText", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.hidden": "visible() ? null : \"\"" } }, ngImport: i0, template: "<button\n type=\"button\"\n role=\"checkbox\"\n class=\"select-all-row\"\n tabindex=\"-1\"\n [id]=\"rowId\"\n [class.marked]=\"marked()\"\n [attr.aria-checked]=\"ariaChecked()\"\n (click)=\"toggle()\">\n <ap-checkbox\n class=\"centered\"\n fullyControlled\n presentational\n [name]=\"'option-select-all-' + select().dropdownId\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\">\n <span class=\"select-all-text\">\n {{ label() }}\n </span>\n </ap-checkbox>\n</button>\n", styles: ["ap-dropdown-select-all{display:block;padding:0 var(--comp-select-search-bar-padding-horizontal);margin-bottom:var(--ref-spacing-xxs);border-bottom:1px solid var(--comp-select-search-bar-border-bottom-color)}ap-dropdown-select-all[hidden]{display:none}.ng-dropdown-header ap-dropdown-select-all{padding:0;margin:0;border:none}ap-dropdown-select-all .select-all-row{display:flex;align-items:center;width:100%;height:var(--comp-select-one-line-height);box-sizing:border-box;margin:0;padding:0 var(--comp-select-search-bar-padding-horizontal);border:none;background-color:var(--comp-select-one-line-background-color);cursor:pointer;text-align:left}ap-dropdown-select-all .select-all-row.marked{background-color:var(--ref-color-electric-blue-10)}ap-dropdown-select-all .select-all-row ap-checkbox{width:100%;pointer-events:none}ap-dropdown-select-all .select-all-row ap-checkbox .checkbox{width:100%}ap-dropdown-select-all .select-all-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-family:var(--comp-select-one-line-selected-text-font-family);font-size:var(--comp-select-one-line-selected-text-size);font-weight:var(--comp-select-one-line-selected-text-font-weight);line-height:var(--comp-select-one-line-selected-text-line-height);color:var(--comp-select-one-line-text-color)}.ng-dropdown-panel.ap-select .ng-dropdown-header:has(>ap-dropdown-select-all:not([hidden])){padding-bottom:0}\n"], dependencies: [{ kind: "component", type: CheckboxComponent, selector: "ap-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "disabled", "indeterminate", "checked", "fullyControlled", "presentational", "required", "name"], outputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
207
|
+
}
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DropdownSelectAllComponent, decorators: [{
|
|
209
|
+
type: Component,
|
|
210
|
+
args: [{ selector: 'ap-dropdown-select-all', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CheckboxComponent], host: {
|
|
211
|
+
'[attr.hidden]': 'visible() ? null : ""',
|
|
212
|
+
}, template: "<button\n type=\"button\"\n role=\"checkbox\"\n class=\"select-all-row\"\n tabindex=\"-1\"\n [id]=\"rowId\"\n [class.marked]=\"marked()\"\n [attr.aria-checked]=\"ariaChecked()\"\n (click)=\"toggle()\">\n <ap-checkbox\n class=\"centered\"\n fullyControlled\n presentational\n [name]=\"'option-select-all-' + select().dropdownId\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\">\n <span class=\"select-all-text\">\n {{ label() }}\n </span>\n </ap-checkbox>\n</button>\n", styles: ["ap-dropdown-select-all{display:block;padding:0 var(--comp-select-search-bar-padding-horizontal);margin-bottom:var(--ref-spacing-xxs);border-bottom:1px solid var(--comp-select-search-bar-border-bottom-color)}ap-dropdown-select-all[hidden]{display:none}.ng-dropdown-header ap-dropdown-select-all{padding:0;margin:0;border:none}ap-dropdown-select-all .select-all-row{display:flex;align-items:center;width:100%;height:var(--comp-select-one-line-height);box-sizing:border-box;margin:0;padding:0 var(--comp-select-search-bar-padding-horizontal);border:none;background-color:var(--comp-select-one-line-background-color);cursor:pointer;text-align:left}ap-dropdown-select-all .select-all-row.marked{background-color:var(--ref-color-electric-blue-10)}ap-dropdown-select-all .select-all-row ap-checkbox{width:100%;pointer-events:none}ap-dropdown-select-all .select-all-row ap-checkbox .checkbox{width:100%}ap-dropdown-select-all .select-all-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-family:var(--comp-select-one-line-selected-text-font-family);font-size:var(--comp-select-one-line-selected-text-size);font-weight:var(--comp-select-one-line-selected-text-font-weight);line-height:var(--comp-select-one-line-selected-text-line-height);color:var(--comp-select-one-line-text-color)}.ng-dropdown-panel.ap-select .ng-dropdown-header:has(>ap-dropdown-select-all:not([hidden])){padding-bottom:0}\n"] }]
|
|
213
|
+
}], propDecorators: { select: [{ type: i0.Input, args: [{ isSignal: true, alias: "select", required: true }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], countText: [{ type: i0.Input, args: [{ isSignal: true, alias: "countText", required: false }] }] } });
|
|
214
|
+
|
|
110
215
|
class SelectBaseDirective {
|
|
111
216
|
inlineLabel = input(/* @ts-ignore */
|
|
112
217
|
...(ngDevMode ? [undefined, { debugName: "inlineLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -268,14 +373,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
268
373
|
class SelectMultipleDirective {
|
|
269
374
|
selectComponent = inject(NgSelectComponent);
|
|
270
375
|
elementRef = inject(ElementRef);
|
|
376
|
+
injector = inject(Injector);
|
|
271
377
|
originalDisabledState = new WeakMap();
|
|
272
378
|
maxItemsTooltip = input(/* @ts-ignore */
|
|
273
379
|
...(ngDevMode ? [undefined, { debugName: "maxItemsTooltip" }] : /* istanbul ignore next */ []));
|
|
274
380
|
/** Pins items selected at open time to the top of the dropdown. Ignored when `groupBy` is set. */
|
|
275
381
|
pinnedItemsEnabled = input(false, /* @ts-ignore */
|
|
276
382
|
...(ngDevMode ? [{ debugName: "pinnedItemsEnabled" }] : /* istanbul ignore next */ []));
|
|
383
|
+
/** Adds a "Select all" row above the options, acting on every visible option across groups. */
|
|
384
|
+
selectAllEnabled = input(false, /* @ts-ignore */
|
|
385
|
+
...(ngDevMode ? [{ debugName: "selectAllEnabled" }] : /* istanbul ignore next */ []));
|
|
386
|
+
/** Label of the "Select all" row. */
|
|
387
|
+
selectAllText = input('Select all', /* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [{ debugName: "selectAllText" }] : /* istanbul ignore next */ []));
|
|
389
|
+
/** Count after the "Select all" label. `{selected}` and `{total}` are replaced; empty hides it. */
|
|
390
|
+
selectAllCountText = input('({selected} of {total})', /* @ts-ignore */
|
|
391
|
+
...(ngDevMode ? [{ debugName: "selectAllCountText" }] : /* istanbul ignore next */ []));
|
|
277
392
|
valueContainer = null;
|
|
278
393
|
subs = new Subscription();
|
|
394
|
+
selectAllRow = null;
|
|
279
395
|
constructor() {
|
|
280
396
|
this.selectComponent.multiple.set(true);
|
|
281
397
|
this.selectComponent.closeOnSelect.set(false);
|
|
@@ -286,7 +402,9 @@ class SelectMultipleDirective {
|
|
|
286
402
|
this.subs.add(this.selectComponent.openEvent.subscribe(() => {
|
|
287
403
|
this.pinSelectedAtTop();
|
|
288
404
|
this.openAtTop();
|
|
405
|
+
this.mountSelectAll();
|
|
289
406
|
}));
|
|
407
|
+
this.subs.add(this.selectComponent.closeEvent.subscribe(() => this.unmountSelectAll()));
|
|
290
408
|
}
|
|
291
409
|
ngAfterViewInit() {
|
|
292
410
|
if (!this.selectComponent.multiLabelTemplate()) {
|
|
@@ -303,6 +421,7 @@ class SelectMultipleDirective {
|
|
|
303
421
|
if (this.valueContainer) {
|
|
304
422
|
this.valueContainer.removeEventListener('mousedown', this.onMousedown, true);
|
|
305
423
|
}
|
|
424
|
+
this.unmountSelectAll();
|
|
306
425
|
this.subs.unsubscribe();
|
|
307
426
|
}
|
|
308
427
|
onMousedown = (event) => {
|
|
@@ -343,6 +462,72 @@ class SelectMultipleDirective {
|
|
|
343
462
|
}
|
|
344
463
|
});
|
|
345
464
|
}
|
|
465
|
+
// `openEvent` fires before ng-select renders the panel, hence the microtask (cf. `pinSelectedAtTop`).
|
|
466
|
+
mountSelectAll() {
|
|
467
|
+
if (!this.selectAllEnabled())
|
|
468
|
+
return;
|
|
469
|
+
queueMicrotask(() => {
|
|
470
|
+
const panel = document.getElementById(this.selectComponent.dropdownId);
|
|
471
|
+
const items = panel?.querySelector('.ng-dropdown-panel-items');
|
|
472
|
+
if (!panel || !items || !this.selectComponent.isOpen())
|
|
473
|
+
return;
|
|
474
|
+
this.unmountSelectAll();
|
|
475
|
+
const ref = this.injector.get(ViewContainerRef).createComponent(DropdownSelectAllComponent);
|
|
476
|
+
ref.setInput('select', this.selectComponent);
|
|
477
|
+
ref.setInput('text', this.selectAllText());
|
|
478
|
+
ref.setInput('countText', this.selectAllCountText());
|
|
479
|
+
const host = ref.location.nativeElement;
|
|
480
|
+
// ng-select closes or blurs on a press it receives; the row handles its own clicks.
|
|
481
|
+
host.addEventListener('mousedown', event => event.preventDefault());
|
|
482
|
+
const header = panel.querySelector('.ng-dropdown-header');
|
|
483
|
+
if (header) {
|
|
484
|
+
header.append(host);
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
items.before(host);
|
|
488
|
+
}
|
|
489
|
+
// Also reached by the keys the header search field forwards.
|
|
490
|
+
const originalHandleKeyCodeInput = this.selectComponent.handleKeyCodeInput.bind(this.selectComponent);
|
|
491
|
+
this.selectComponent.handleKeyCodeInput = (event) => {
|
|
492
|
+
const handled = ref.instance.handleKey(event);
|
|
493
|
+
if (!handled) {
|
|
494
|
+
originalHandleKeyCodeInput(event);
|
|
495
|
+
}
|
|
496
|
+
this.syncActiveDescendant(ref.instance);
|
|
497
|
+
};
|
|
498
|
+
const unmarkOnHover = () => ref.instance.marked.set(false);
|
|
499
|
+
items.addEventListener('mouseover', unmarkOnHover);
|
|
500
|
+
const refresh = () => ref.instance.refresh();
|
|
501
|
+
const subs = new Subscription(() => {
|
|
502
|
+
this.selectComponent.handleKeyCodeInput = originalHandleKeyCodeInput;
|
|
503
|
+
items.removeEventListener('mouseover', unmarkOnHover);
|
|
504
|
+
});
|
|
505
|
+
subs.add(this.selectComponent.addEvent.subscribe(refresh));
|
|
506
|
+
subs.add(this.selectComponent.removeEvent.subscribe(refresh));
|
|
507
|
+
subs.add(this.selectComponent.clearEvent.subscribe(refresh));
|
|
508
|
+
subs.add(this.selectComponent.searchEvent.subscribe(refresh));
|
|
509
|
+
// ng-select rebuilds its list after this effect runs.
|
|
510
|
+
const itemsEffect = effect(() => {
|
|
511
|
+
this.selectComponent.items();
|
|
512
|
+
untracked(() => queueMicrotask(refresh));
|
|
513
|
+
}, { ...(ngDevMode ? { debugName: "itemsEffect" } : /* istanbul ignore next */ {}), injector: this.injector });
|
|
514
|
+
this.selectAllRow = { ref, subs, itemsEffect };
|
|
515
|
+
ref.changeDetectorRef.detectChanges();
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
syncActiveDescendant(selectAll) {
|
|
519
|
+
if (!selectAll.marked())
|
|
520
|
+
return;
|
|
521
|
+
this.elementRef.nativeElement.querySelector('input[role="combobox"]')?.setAttribute('aria-activedescendant', selectAll.rowId);
|
|
522
|
+
}
|
|
523
|
+
unmountSelectAll() {
|
|
524
|
+
if (!this.selectAllRow)
|
|
525
|
+
return;
|
|
526
|
+
this.selectAllRow.subs.unsubscribe();
|
|
527
|
+
this.selectAllRow.itemsEffect.destroy();
|
|
528
|
+
this.selectAllRow.ref.destroy();
|
|
529
|
+
this.selectAllRow = null;
|
|
530
|
+
}
|
|
346
531
|
// On open, ng-select natively marks the last selected option, which ends up scrolling the panel to it.
|
|
347
532
|
// This method removes the mark so that the panel stays scrolled to the top.
|
|
348
533
|
openAtTop() {
|
|
@@ -371,7 +556,7 @@ class SelectMultipleDirective {
|
|
|
371
556
|
}
|
|
372
557
|
}
|
|
373
558
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SelectMultipleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
374
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: SelectMultipleDirective, isStandalone: true, selector: "ng-select[apSelectMultiple]", inputs: { maxItemsTooltip: { classPropertyName: "maxItemsTooltip", publicName: "maxItemsTooltip", isSignal: true, isRequired: false, transformFunction: null }, pinnedItemsEnabled: { classPropertyName: "pinnedItemsEnabled", publicName: "pinnedItemsEnabled", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: SelectBaseDirective, inputs: ["inlineLabel", "inlineLabel", "symbolId", "symbolId", "clearable", "clearable"] }], ngImport: i0 });
|
|
559
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: SelectMultipleDirective, isStandalone: true, selector: "ng-select[apSelectMultiple]", inputs: { maxItemsTooltip: { classPropertyName: "maxItemsTooltip", publicName: "maxItemsTooltip", isSignal: true, isRequired: false, transformFunction: null }, pinnedItemsEnabled: { classPropertyName: "pinnedItemsEnabled", publicName: "pinnedItemsEnabled", isSignal: true, isRequired: false, transformFunction: null }, selectAllEnabled: { classPropertyName: "selectAllEnabled", publicName: "selectAllEnabled", isSignal: true, isRequired: false, transformFunction: null }, selectAllText: { classPropertyName: "selectAllText", publicName: "selectAllText", isSignal: true, isRequired: false, transformFunction: null }, selectAllCountText: { classPropertyName: "selectAllCountText", publicName: "selectAllCountText", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: SelectBaseDirective, inputs: ["inlineLabel", "inlineLabel", "symbolId", "symbolId", "clearable", "clearable"] }], ngImport: i0 });
|
|
375
560
|
}
|
|
376
561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SelectMultipleDirective, decorators: [{
|
|
377
562
|
type: Directive,
|
|
@@ -385,7 +570,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
385
570
|
},
|
|
386
571
|
],
|
|
387
572
|
}]
|
|
388
|
-
}], ctorParameters: () => [], propDecorators: { maxItemsTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxItemsTooltip", required: false }] }], pinnedItemsEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinnedItemsEnabled", required: false }] }] } });
|
|
573
|
+
}], ctorParameters: () => [], propDecorators: { maxItemsTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxItemsTooltip", required: false }] }], pinnedItemsEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinnedItemsEnabled", required: false }] }], selectAllEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAllEnabled", required: false }] }], selectAllText: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAllText", required: false }] }], selectAllCountText: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAllCountText", required: false }] }] } });
|
|
389
574
|
|
|
390
575
|
class DropdownItemMultipleOneLineComponent {
|
|
391
576
|
symbolRegistry = inject(SymbolRegistry);
|
|
@@ -934,5 +1119,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
934
1119
|
* Generated bundle index. Do not edit.
|
|
935
1120
|
*/
|
|
936
1121
|
|
|
937
|
-
export { ApSelectModule, DropdownCreateNewComponent, DropdownGroupItemComponent, DropdownItemMultipleOneLineComponent, DropdownItemMultipleTwoLinesComponent, DropdownItemSingleOneLineComponent, DropdownItemSingleTwoLinesComponent, DropdownSearchFormComponent, SelectBaseDirective, SelectLabelMultipleComponent, SelectLabelSingleComponent, SelectMultipleDirective, SelectSingleDirective };
|
|
1122
|
+
export { ApSelectModule, DropdownCreateNewComponent, DropdownGroupItemComponent, DropdownItemMultipleOneLineComponent, DropdownItemMultipleTwoLinesComponent, DropdownItemSingleOneLineComponent, DropdownItemSingleTwoLinesComponent, DropdownSearchFormComponent, DropdownSelectAllComponent, SelectBaseDirective, SelectLabelMultipleComponent, SelectLabelSingleComponent, SelectMultipleDirective, SelectSingleDirective };
|
|
938
1123
|
//# sourceMappingURL=agorapulse-ui-components-select.mjs.map
|