@koalarx/ui 21.1.16 → 21.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/koalarx-ui-core-base.mjs +4 -4
- package/fesm2022/koalarx-ui-core-base.mjs.map +1 -1
- package/fesm2022/koalarx-ui-core-components-loader-page.mjs +2 -2
- package/fesm2022/koalarx-ui-core-components-loader-page.mjs.map +1 -1
- package/fesm2022/koalarx-ui-shared-components-dropdown.mjs +25 -4
- package/fesm2022/koalarx-ui-shared-components-dropdown.mjs.map +1 -1
- package/package.json +1 -1
- package/types/koalarx-ui-core-base.d.ts +5 -5
- package/types/koalarx-ui-shared-components-dropdown.d.ts +9 -4
|
@@ -93,7 +93,7 @@ class ListBase {
|
|
|
93
93
|
limitPage = signal(30, ...(ngDevMode ? [{ debugName: "limitPage" }] : []));
|
|
94
94
|
page = signal(1, ...(ngDevMode ? [{ debugName: "page" }] : []));
|
|
95
95
|
filter = signal({}, ...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
96
|
-
|
|
96
|
+
service;
|
|
97
97
|
totalItemsOnPage = signal(0, ...(ngDevMode ? [{ debugName: "totalItemsOnPage" }] : []));
|
|
98
98
|
totalItems = signal(0, ...(ngDevMode ? [{ debugName: "totalItems" }] : []));
|
|
99
99
|
list = signal([], ...(ngDevMode ? [{ debugName: "list" }] : []));
|
|
@@ -120,12 +120,12 @@ class ListBase {
|
|
|
120
120
|
reload = input(false, ...(ngDevMode ? [{ debugName: "reload" }] : []));
|
|
121
121
|
constructor(
|
|
122
122
|
// eslint-disable-next-line @angular-eslint/prefer-inject
|
|
123
|
-
|
|
123
|
+
service,
|
|
124
124
|
// eslint-disable-next-line @angular-eslint/prefer-inject
|
|
125
125
|
componentFilter) {
|
|
126
126
|
this.componentFilter = componentFilter;
|
|
127
|
-
this.
|
|
128
|
-
this.resourceRef = this.
|
|
127
|
+
this.service = inject(service);
|
|
128
|
+
this.resourceRef = this.service.getManyWithResource(this.queryParams);
|
|
129
129
|
effect(() => {
|
|
130
130
|
this.filter();
|
|
131
131
|
this.page.set(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koalarx-ui-core-base.mjs","sources":["../../projects/koala-ui/core/base/http-base.ts","../../projects/koala-ui/core/base/list-base.ts","../../projects/koala-ui/core/base/page-base.ts","../../projects/koala-ui/core/base/koalarx-ui-core-base.ts"],"sourcesContent":["import { HttpClient, httpResource } from '@angular/common/http';\nimport { inject, Injector, Signal } from '@angular/core';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { GetManyResult } from '@koalarx/ui/core/models';\nimport { SelectOption } from '@koalarx/ui/shared/components/input-field/select';\nimport { first } from 'rxjs/internal/operators/first';\nimport { map } from 'rxjs/internal/operators/map';\n\nexport interface HttpResourceRequestOptions<EntityType> {\n debounceTime?: number;\n endpoint?: string;\n mapOption?: (\n item: any\n ) => Omit<SelectOption<EntityType> | GetManyResult<EntityType>, 'data'>;\n}\n\nexport abstract class HttpBase<\n EntityType = any,\n PayloadType = any,\n QueryType = any\n> {\n private readonly appConfig = inject(AppConfig);\n protected readonly injector = inject(Injector);\n protected readonly http = inject(HttpClient);\n protected readonly url: string;\n protected readonly hostApi: string;\n\n constructor(protected readonly resource: string, hostApi?: string) {\n this.hostApi = hostApi || this.appConfig.hostApi || '';\n this.url = `${this.hostApi}/${this.resource}`;\n }\n\n post<T>(data: PayloadType, endpoint = '') {\n return this.http.post<T>(`${this.url}${endpoint}`, data).pipe(first());\n }\n\n put<T>(id: string, data: PayloadType) {\n return this.http.put<T>(`${this.url}/${id}`, data).pipe(first());\n }\n\n patch<T>(id: string, data: any) {\n return this.http.patch<T>(`${this.url}/${id}`, data).pipe(first());\n }\n\n delete<T>(id: string) {\n return this.http.delete<T>(`${this.url}/${id}`).pipe(first());\n }\n\n getMany<TResponse = EntityType>(query: QueryType, endpoint = '') {\n return this.http.get<GetManyResult<TResponse>>(`${this.url}${endpoint}`, {\n params: query as any,\n });\n }\n\n getById<TResponse = EntityType>(id: string | null) {\n return this.http.get<TResponse>(`${this.url}/${id}`);\n }\n\n getManyWithResource<TResponse = EntityType>(\n query: Signal<QueryType>,\n {\n endpoint = '',\n mapOption,\n }: Omit<HttpResourceRequestOptions<TResponse>, 'debounceTime'> = {}\n ) {\n return httpResource<GetManyResult<TResponse>>(\n () => {\n return {\n url: `${this.url}${endpoint}`,\n params: query() as any,\n };\n },\n {\n parse: mapOption as (data: any) => any,\n }\n );\n }\n\n getByIdWithResource<TResponse = EntityType>(\n id: Signal<string | null>,\n endpoint = ':id',\n mapResponse?: (response: TResponse) => TResponse\n ) {\n return httpResource<TResponse>(\n () => {\n const resourceId = id();\n\n if (!resourceId) {\n return undefined;\n }\n\n return `${this.url}/${endpoint.replace(':id', resourceId)}`;\n },\n {\n parse: mapResponse as (resume: any) => TResponse,\n }\n );\n }\n\n getByOneWithResource<TResponse = EntityType>(\n endpoint: Signal<string | null>,\n params?: Signal<any>,\n mapResponse?: (response: TResponse) => TResponse\n ) {\n return httpResource<TResponse>(\n () => {\n const resourceUrl = endpoint();\n\n if (!resourceUrl) {\n return undefined;\n }\n\n return {\n url: `${this.url}/${resourceUrl}`,\n params: params ? params() : undefined,\n };\n },\n {\n parse: mapResponse as (resume: any) => TResponse,\n }\n );\n }\n\n getManyForSelector<TResponse = EntityType>(\n query: QueryType | Signal<QueryType>,\n mapOption: (item: TResponse) => Omit<SelectOption<TResponse>, 'data'>\n ) {\n return rxResource({\n defaultValue: [],\n params: () => (query instanceof Function ? query() : query),\n stream: (data) =>\n this.getMany<TResponse>(data.params).pipe(\n map((response) =>\n response.items.map((item) => ({\n ...mapOption(item),\n data: item,\n }))\n )\n ),\n });\n }\n}\n","import { HttpResourceRef } from '@angular/common/http';\nimport {\n computed,\n Directive,\n effect,\n inject,\n input,\n linkedSignal,\n model,\n signal,\n Type,\n} from '@angular/core';\nimport {\n GetManyResult,\n QueryPagination,\n SortFilterType,\n} from '@koalarx/ui/core/models';\nimport { DatatableConfig } from '@koalarx/ui/shared/components/datatable';\nimport { HttpBase } from './http-base';\n\ntype PaginationType = 'paginator' | 'loadMore';\n\n@Directive()\nexport abstract class ListBase<\n QueryType extends QueryPagination,\n TEntity = any\n> {\n private reloading = false;\n private currentPaginationType: PaginationType = 'paginator';\n protected readonly resourceRef: HttpResourceRef<\n GetManyResult<TEntity> | undefined\n >;\n protected readonly limitPage = signal(30);\n protected readonly page = signal(1);\n protected readonly filter = signal<QueryType>({} as any);\n protected readonly resource: HttpBase<TEntity, any, QueryType>;\n protected readonly totalItemsOnPage = signal(0);\n protected readonly totalItems = signal(0);\n protected readonly list = signal<TEntity[]>([]);\n protected readonly sortFilter = signal<SortFilterType | null>(null);\n protected readonly paginationType = model<PaginationType>('paginator');\n protected readonly withPagination = computed<boolean>(() => {\n this.currentPaginationType = this.paginationType();\n return this.currentPaginationType === 'paginator';\n });\n protected readonly datatableConfig = linkedSignal(\n () =>\n ({\n currentPage: this.page(),\n totalItems: this.totalItems(),\n totalItemsOnPage: this.totalItemsOnPage(),\n currentPageSize: this.limitPage(),\n isLoading: this.resourceRef.isLoading(),\n hasError: !!this.resourceRef.error(),\n } as DatatableConfig)\n );\n\n queryParams = computed<QueryType>(\n () =>\n ({\n page: this.page(),\n limit: this.limitPage(),\n ...(this.sortFilter() ?? {}),\n ...this.filter(),\n } as QueryType)\n );\n reload = input<boolean>(false);\n\n constructor(\n // eslint-disable-next-line @angular-eslint/prefer-inject\n resource: Type<HttpBase<TEntity, any, QueryType>>,\n // eslint-disable-next-line @angular-eslint/prefer-inject\n protected readonly componentFilter?: Type<any>\n ) {\n this.resource = inject(resource);\n this.resourceRef = this.resource.getManyWithResource(this.queryParams);\n\n effect(() => {\n this.filter();\n this.page.set(1);\n });\n\n effect(() => {\n const queryParams = this.queryParams();\n\n if (queryParams.page === 1 && !this.reloading) {\n this.reloading = true;\n return;\n }\n });\n\n effect(() => {\n const withPagination = this.currentPaginationType === 'paginator';\n const result = this.resourceRef.value();\n\n if (!withPagination && !this.reloading) {\n if (result) {\n this.list.update((current) => [...current, ...result.items]);\n this.totalItemsOnPage.update(\n (current) => current + result.items.length\n );\n this.totalItems.set(result.count);\n }\n this.reloading = false;\n return;\n }\n\n if (!result) {\n this.list.set([]);\n this.totalItemsOnPage.set(0);\n this.totalItems.set(0);\n this.reloading = false;\n return;\n }\n\n this.list.set(result.items);\n this.totalItemsOnPage.set(result.items.length);\n this.totalItems.set(result.count);\n this.reloading = false;\n });\n\n effect(() => {\n if (this.reload()) {\n this.reloadList();\n }\n });\n }\n\n protected sort(sortFilter: SortFilterType) {\n this.sortFilter.set(sortFilter);\n }\n\n protected reloadList() {\n this.reloading = true;\n this.list.set([]);\n this.totalItemsOnPage.set(0);\n this.totalItems.set(0);\n this.page.set(1);\n this.resourceRef.reload();\n }\n\n protected loadMore() {\n this.page.update((current) => current + 1);\n }\n}\n","import { signal } from '@angular/core';\n\nexport abstract class PageBase {\n protected reload = signal(false);\n\n protected reloadList() {\n this.reload.set(true);\n setTimeout(() => this.reload.set(false));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAiBsB,QAAQ,CAAA;AAWG,IAAA,QAAA;AANd,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC3B,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,GAAG;AACH,IAAA,OAAO;IAE1B,WAAA,CAA+B,QAAgB,EAAE,OAAgB,EAAA;QAAlC,IAAA,CAAA,QAAQ,GAAR,QAAQ;AACrC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE;AACtD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,CAAA,CAAA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AA,EAAA,EAAA,CAAA;;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAD7B;;;MCpBqB,QAAQ,CAAA;AAClB,IAAA,MAAM,GAAG,MAAM,CAAC,KAAK,kDAAC;IAEtB,UAAU,GAAA;AAClB,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AACrB,QAAA,UAAU,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;;AAE3C;;ACTD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"koalarx-ui-core-base.mjs","sources":["../../projects/koala-ui/core/base/http-base.ts","../../projects/koala-ui/core/base/list-base.ts","../../projects/koala-ui/core/base/page-base.ts","../../projects/koala-ui/core/base/koalarx-ui-core-base.ts"],"sourcesContent":["import { HttpClient, httpResource } from '@angular/common/http';\nimport { inject, Injector, Signal } from '@angular/core';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { GetManyResult } from '@koalarx/ui/core/models';\nimport { SelectOption } from '@koalarx/ui/shared/components/input-field/select';\nimport { first } from 'rxjs/internal/operators/first';\nimport { map } from 'rxjs/internal/operators/map';\n\nexport interface HttpResourceRequestOptions<EntityType> {\n debounceTime?: number;\n endpoint?: string;\n mapOption?: (\n item: any\n ) => Omit<SelectOption<EntityType> | GetManyResult<EntityType>, 'data'>;\n}\n\nexport abstract class HttpBase<\n EntityType = any,\n PayloadType = any,\n QueryType = any\n> {\n private readonly appConfig = inject(AppConfig);\n protected readonly injector = inject(Injector);\n protected readonly http = inject(HttpClient);\n protected readonly url: string;\n protected readonly hostApi: string;\n\n constructor(protected readonly resource: string, hostApi?: string) {\n this.hostApi = hostApi || this.appConfig.hostApi || '';\n this.url = `${this.hostApi}/${this.resource}`;\n }\n\n post<T>(data: PayloadType, endpoint = '') {\n return this.http.post<T>(`${this.url}${endpoint}`, data).pipe(first());\n }\n\n put<T>(id: string, data: PayloadType) {\n return this.http.put<T>(`${this.url}/${id}`, data).pipe(first());\n }\n\n patch<T>(id: string, data: any) {\n return this.http.patch<T>(`${this.url}/${id}`, data).pipe(first());\n }\n\n delete<T>(id: string) {\n return this.http.delete<T>(`${this.url}/${id}`).pipe(first());\n }\n\n getMany<TResponse = EntityType>(query: QueryType, endpoint = '') {\n return this.http.get<GetManyResult<TResponse>>(`${this.url}${endpoint}`, {\n params: query as any,\n });\n }\n\n getById<TResponse = EntityType>(id: string | null) {\n return this.http.get<TResponse>(`${this.url}/${id}`);\n }\n\n getManyWithResource<TResponse = EntityType>(\n query: Signal<QueryType>,\n {\n endpoint = '',\n mapOption,\n }: Omit<HttpResourceRequestOptions<TResponse>, 'debounceTime'> = {}\n ) {\n return httpResource<GetManyResult<TResponse>>(\n () => {\n return {\n url: `${this.url}${endpoint}`,\n params: query() as any,\n };\n },\n {\n parse: mapOption as (data: any) => any,\n }\n );\n }\n\n getByIdWithResource<TResponse = EntityType>(\n id: Signal<string | null>,\n endpoint = ':id',\n mapResponse?: (response: TResponse) => TResponse\n ) {\n return httpResource<TResponse>(\n () => {\n const resourceId = id();\n\n if (!resourceId) {\n return undefined;\n }\n\n return `${this.url}/${endpoint.replace(':id', resourceId)}`;\n },\n {\n parse: mapResponse as (resume: any) => TResponse,\n }\n );\n }\n\n getByOneWithResource<TResponse = EntityType>(\n endpoint: Signal<string | null>,\n params?: Signal<any>,\n mapResponse?: (response: TResponse) => TResponse\n ) {\n return httpResource<TResponse>(\n () => {\n const resourceUrl = endpoint();\n\n if (!resourceUrl) {\n return undefined;\n }\n\n return {\n url: `${this.url}/${resourceUrl}`,\n params: params ? params() : undefined,\n };\n },\n {\n parse: mapResponse as (resume: any) => TResponse,\n }\n );\n }\n\n getManyForSelector<TResponse = EntityType>(\n query: QueryType | Signal<QueryType>,\n mapOption: (item: TResponse) => Omit<SelectOption<TResponse>, 'data'>\n ) {\n return rxResource({\n defaultValue: [],\n params: () => (query instanceof Function ? query() : query),\n stream: (data) =>\n this.getMany<TResponse>(data.params).pipe(\n map((response) =>\n response.items.map((item) => ({\n ...mapOption(item),\n data: item,\n }))\n )\n ),\n });\n }\n}\n","import { HttpResourceRef } from '@angular/common/http';\nimport {\n computed,\n Directive,\n effect,\n inject,\n input,\n linkedSignal,\n model,\n signal,\n Type,\n} from '@angular/core';\nimport {\n GetManyResult,\n QueryPagination,\n SortFilterType,\n} from '@koalarx/ui/core/models';\nimport { DatatableConfig } from '@koalarx/ui/shared/components/datatable';\nimport { HttpBase } from './http-base';\n\ntype PaginationType = 'paginator' | 'loadMore';\n\n@Directive()\nexport abstract class ListBase<\n QueryType extends QueryPagination,\n TEntity = any,\n TService extends HttpBase<TEntity, any, QueryType> = HttpBase<\n TEntity,\n any,\n QueryType\n >,\n> {\n private reloading = false;\n private currentPaginationType: PaginationType = 'paginator';\n protected readonly resourceRef: HttpResourceRef<\n GetManyResult<TEntity> | undefined\n >;\n protected readonly limitPage = signal(30);\n protected readonly page = signal(1);\n protected readonly filter = signal<QueryType>({} as any);\n protected readonly service: TService;\n protected readonly totalItemsOnPage = signal(0);\n protected readonly totalItems = signal(0);\n protected readonly list = signal<TEntity[]>([]);\n protected readonly sortFilter = signal<SortFilterType | null>(null);\n protected readonly paginationType = model<PaginationType>('paginator');\n protected readonly withPagination = computed<boolean>(() => {\n this.currentPaginationType = this.paginationType();\n return this.currentPaginationType === 'paginator';\n });\n protected readonly datatableConfig = linkedSignal(\n () =>\n ({\n currentPage: this.page(),\n totalItems: this.totalItems(),\n totalItemsOnPage: this.totalItemsOnPage(),\n currentPageSize: this.limitPage(),\n isLoading: this.resourceRef.isLoading(),\n hasError: !!this.resourceRef.error(),\n }) as DatatableConfig,\n );\n\n queryParams = computed<QueryType>(\n () =>\n ({\n page: this.page(),\n limit: this.limitPage(),\n ...(this.sortFilter() ?? {}),\n ...this.filter(),\n }) as QueryType,\n );\n reload = input<boolean>(false);\n\n constructor(\n // eslint-disable-next-line @angular-eslint/prefer-inject\n service: Type<TService>,\n // eslint-disable-next-line @angular-eslint/prefer-inject\n protected readonly componentFilter?: Type<any>,\n ) {\n this.service = inject(service);\n this.resourceRef = this.service.getManyWithResource(this.queryParams);\n\n effect(() => {\n this.filter();\n this.page.set(1);\n });\n\n effect(() => {\n const queryParams = this.queryParams();\n\n if (queryParams.page === 1 && !this.reloading) {\n this.reloading = true;\n return;\n }\n });\n\n effect(() => {\n const withPagination = this.currentPaginationType === 'paginator';\n const result = this.resourceRef.value();\n\n if (!withPagination && !this.reloading) {\n if (result) {\n this.list.update((current) => [...current, ...result.items]);\n this.totalItemsOnPage.update(\n (current) => current + result.items.length,\n );\n this.totalItems.set(result.count);\n }\n this.reloading = false;\n return;\n }\n\n if (!result) {\n this.list.set([]);\n this.totalItemsOnPage.set(0);\n this.totalItems.set(0);\n this.reloading = false;\n return;\n }\n\n this.list.set(result.items);\n this.totalItemsOnPage.set(result.items.length);\n this.totalItems.set(result.count);\n this.reloading = false;\n });\n\n effect(() => {\n if (this.reload()) {\n this.reloadList();\n }\n });\n }\n\n protected sort(sortFilter: SortFilterType) {\n this.sortFilter.set(sortFilter);\n }\n\n protected reloadList() {\n this.reloading = true;\n this.list.set([]);\n this.totalItemsOnPage.set(0);\n this.totalItems.set(0);\n this.page.set(1);\n this.resourceRef.reload();\n }\n\n protected loadMore() {\n this.page.update((current) => current + 1);\n }\n}\n","import { signal } from '@angular/core';\n\nexport abstract class PageBase {\n protected reload = signal(false);\n\n protected reloadList() {\n this.reload.set(true);\n setTimeout(() => this.reload.set(false));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAiBsB,QAAQ,CAAA;AAWG,IAAA,QAAA;AANd,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC3B,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,GAAG;AACH,I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A,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,cAAA,EAAA,sBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAD7B;;;MCpBqB,QAAQ,CAAA;AAClB,IAAA,MAAM,GAAG,MAAM,CAAC,KAAK,kDAAC;IAEtB,UAAU,GAAA;AAClB,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AACrB,QAAA,UAAU,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;;AAE3C;;ACTD;;AAEG;;;;"}
|
|
@@ -24,11 +24,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
24
24
|
class LoaderPageContent {
|
|
25
25
|
loaderPage = inject(LoaderPage);
|
|
26
26
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoaderPageContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
27
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: LoaderPageContent, isStandalone: true, selector: "kl-loader-page-content", ngImport: i0, template: "<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-
|
|
27
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: LoaderPageContent, isStandalone: true, selector: "kl-loader-page-content", ngImport: i0, template: "<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-10000\"\n [class]=\"{ 'hidden': !loaderPage.isLoading() }\">\n <kl-loader size=\"extraLarge\" />\n</div>\n", dependencies: [{ kind: "component", type: Loader, selector: "kl-loader", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28
28
|
}
|
|
29
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoaderPageContent, decorators: [{
|
|
30
30
|
type: Component,
|
|
31
|
-
args: [{ selector: 'kl-loader-page-content', changeDetection: ChangeDetectionStrategy.OnPush, imports: [Loader], template: "<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-
|
|
31
|
+
args: [{ selector: 'kl-loader-page-content', changeDetection: ChangeDetectionStrategy.OnPush, imports: [Loader], template: "<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-10000\"\n [class]=\"{ 'hidden': !loaderPage.isLoading() }\">\n <kl-loader size=\"extraLarge\" />\n</div>\n" }]
|
|
32
32
|
}] });
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koalarx-ui-core-components-loader-page.mjs","sources":["../../projects/koala-ui/core/components/loader-page/loader-page.ts","../../projects/koala-ui/core/components/loader-page/loader-page-content.ts","../../projects/koala-ui/core/components/loader-page/loader-page-content.html","../../projects/koala-ui/core/components/loader-page/koalarx-ui-core-components-loader-page.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class LoaderPage {\n private _loading = signal(false);\n\n get isLoading() {\n return this._loading.asReadonly();\n }\n\n show() {\n this._loading.set(true);\n }\n\n dismiss() {\n this._loading.set(false);\n }\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { Loader } from '@koalarx/ui/core/components/loader';\nimport { LoaderPage } from './loader-page';\n\n@Component({\n selector: 'kl-loader-page-content',\n templateUrl: './loader-page-content.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [Loader],\n})\nexport class LoaderPageContent {\n loaderPage = inject(LoaderPage);\n}\n","<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-
|
|
1
|
+
{"version":3,"file":"koalarx-ui-core-components-loader-page.mjs","sources":["../../projects/koala-ui/core/components/loader-page/loader-page.ts","../../projects/koala-ui/core/components/loader-page/loader-page-content.ts","../../projects/koala-ui/core/components/loader-page/loader-page-content.html","../../projects/koala-ui/core/components/loader-page/koalarx-ui-core-components-loader-page.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class LoaderPage {\n private _loading = signal(false);\n\n get isLoading() {\n return this._loading.asReadonly();\n }\n\n show() {\n this._loading.set(true);\n }\n\n dismiss() {\n this._loading.set(false);\n }\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { Loader } from '@koalarx/ui/core/components/loader';\nimport { LoaderPage } from './loader-page';\n\n@Component({\n selector: 'kl-loader-page-content',\n templateUrl: './loader-page-content.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [Loader],\n})\nexport class LoaderPageContent {\n loaderPage = inject(LoaderPage);\n}\n","<div class=\"fixed bg-base-100/40 flex w-full h-full items-center justify-center z-10000\"\n [class]=\"{ 'hidden': !loaderPage.isLoading() }\">\n <kl-loader size=\"extraLarge\" />\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,UAAU,CAAA;AACb,IAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,oDAAC;AAEhC,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;;IAGnC,IAAI,GAAA;AACF,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;;IAGzB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;;uGAZf,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAV,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cADG,MAAM,EAAA,CAAA;;2FACnB,UAAU,EAAA,UAAA,EAAA,CAAA;kBADtB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCQrB,iBAAiB,CAAA;AAC5B,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;uGADpB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAjB,iBAAiB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECV9B,iMAIA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDIY,MAAM,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAEL,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAN7B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,wBAAwB,mBAEjB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,MAAM,CAAC,EAAA,QAAA,EAAA,iMAAA,EAAA;;;AERnB;;AAEG;;;;"}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { viewChild, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { viewChild, input, booleanAttribute, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { randomString, KlString } from '@koalarx/utils/KlString';
|
|
4
4
|
|
|
5
5
|
class Dropdown {
|
|
6
6
|
dropdownTriggerElement = viewChild('dropdownTrigger', ...(ngDevMode ? [{ debugName: "dropdownTriggerElement" }] : []));
|
|
7
7
|
dropdownContentElement = viewChild('dropdownContent', ...(ngDevMode ? [{ debugName: "dropdownContentElement" }] : []));
|
|
8
|
-
|
|
8
|
+
closeInsideClick = (event) => {
|
|
9
|
+
if (this.insideClick()) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const contentElement = this.dropdownContentElement()?.nativeElement;
|
|
13
|
+
const clickElement = event.target;
|
|
14
|
+
if (contentElement && contentElement.contains(clickElement)) {
|
|
15
|
+
contentElement.hidePopover();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
id = randomString(10, {
|
|
19
|
+
numbers: true,
|
|
20
|
+
uppercase: false,
|
|
21
|
+
lowercase: false,
|
|
22
|
+
});
|
|
23
|
+
insideClick = input(false, { ...(ngDevMode ? { debugName: "insideClick" } : {}), transform: booleanAttribute });
|
|
9
24
|
anchorName = new KlString('--anchor-').concat(this.id);
|
|
10
25
|
constructor() {
|
|
11
26
|
effect(() => {
|
|
@@ -17,6 +32,12 @@ class Dropdown {
|
|
|
17
32
|
}
|
|
18
33
|
});
|
|
19
34
|
}
|
|
35
|
+
ngOnDestroy() {
|
|
36
|
+
document.removeEventListener('click', this.closeInsideClick);
|
|
37
|
+
}
|
|
38
|
+
ngOnInit() {
|
|
39
|
+
document.addEventListener('click', this.closeInsideClick);
|
|
40
|
+
}
|
|
20
41
|
ajustPosition() {
|
|
21
42
|
const triggerElement = this.dropdownTriggerElement()?.nativeElement;
|
|
22
43
|
const contentElement = this.dropdownContentElement()?.nativeElement;
|
|
@@ -36,12 +57,12 @@ class Dropdown {
|
|
|
36
57
|
}
|
|
37
58
|
}
|
|
38
59
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Dropdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
39
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: Dropdown, isStandalone: true, selector: "kl-dropdown", viewQueries: [{ propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, isSignal: true }, { propertyName: "dropdownContentElement", first: true, predicate: ["dropdownContent"], descendants: true, isSignal: true }], ngImport: i0, template: "<button #dropdownTrigger\n type=\"button\"\n class=\"p-0!\"\n tabindex=\"0\"\n role=\"button\"\n [attr.popovertarget]=\"id\"\n (click)=\"ajustPosition()\">\n <ng-content select=\"[trigger]\" />\n</button>\n\n<div #dropdownContent\n tabindex=\"0\"\n popover\n [id]=\"id\"\n class=\"dropdown bg-base-200 rounded-box mt-3 min-w-52 w-auto max-w-[30vw] max-h-[40vh] shadow-sm border-2 border-neutral-200 dark:border-neutral-800 rounded-md overflow-y-auto\">\n <ng-content select=\"[options]\" />\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
60
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: Dropdown, isStandalone: true, selector: "kl-dropdown", inputs: { insideClick: { classPropertyName: "insideClick", publicName: "insideClick", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, isSignal: true }, { propertyName: "dropdownContentElement", first: true, predicate: ["dropdownContent"], descendants: true, isSignal: true }], ngImport: i0, template: "<button #dropdownTrigger\n type=\"button\"\n class=\"p-0!\"\n tabindex=\"0\"\n role=\"button\"\n [attr.popovertarget]=\"id\"\n (click)=\"ajustPosition()\">\n <ng-content select=\"[trigger]\" />\n</button>\n\n<div #dropdownContent\n tabindex=\"0\"\n popover\n [id]=\"id\"\n class=\"dropdown bg-base-200 rounded-box mt-3 min-w-52 w-auto max-w-[30vw] max-h-[40vh] shadow-sm border-2 border-neutral-200 dark:border-neutral-800 rounded-md overflow-y-auto\">\n <ng-content select=\"[options]\" />\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
40
61
|
}
|
|
41
62
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Dropdown, decorators: [{
|
|
42
63
|
type: Component,
|
|
43
64
|
args: [{ selector: 'kl-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #dropdownTrigger\n type=\"button\"\n class=\"p-0!\"\n tabindex=\"0\"\n role=\"button\"\n [attr.popovertarget]=\"id\"\n (click)=\"ajustPosition()\">\n <ng-content select=\"[trigger]\" />\n</button>\n\n<div #dropdownContent\n tabindex=\"0\"\n popover\n [id]=\"id\"\n class=\"dropdown bg-base-200 rounded-box mt-3 min-w-52 w-auto max-w-[30vw] max-h-[40vh] shadow-sm border-2 border-neutral-200 dark:border-neutral-800 rounded-md overflow-y-auto\">\n <ng-content select=\"[options]\" />\n</div>\n" }]
|
|
44
|
-
}], ctorParameters: () => [], propDecorators: { dropdownTriggerElement: [{ type: i0.ViewChild, args: ['dropdownTrigger', { isSignal: true }] }], dropdownContentElement: [{ type: i0.ViewChild, args: ['dropdownContent', { isSignal: true }] }] } });
|
|
65
|
+
}], ctorParameters: () => [], propDecorators: { dropdownTriggerElement: [{ type: i0.ViewChild, args: ['dropdownTrigger', { isSignal: true }] }], dropdownContentElement: [{ type: i0.ViewChild, args: ['dropdownContent', { isSignal: true }] }], insideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "insideClick", required: false }] }] } });
|
|
45
66
|
|
|
46
67
|
/**
|
|
47
68
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koalarx-ui-shared-components-dropdown.mjs","sources":["../../projects/koala-ui/shared/components/dropdown/dropdown.ts","../../projects/koala-ui/shared/components/dropdown/dropdown.html","../../projects/koala-ui/shared/components/dropdown/koalarx-ui-shared-components-dropdown.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n viewChild,\n} from '@angular/core';\nimport { KlString, randomString } from '@koalarx/utils/KlString';\n\n@Component({\n selector: 'kl-dropdown',\n templateUrl: './dropdown.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Dropdown {\n private readonly dropdownTriggerElement =\n viewChild<ElementRef<HTMLButtonElement>>('dropdownTrigger');\n private readonly dropdownContentElement =\n viewChild<ElementRef<HTMLDivElement>>('dropdownContent');\n\n id = randomString(10, {
|
|
1
|
+
{"version":3,"file":"koalarx-ui-shared-components-dropdown.mjs","sources":["../../projects/koala-ui/shared/components/dropdown/dropdown.ts","../../projects/koala-ui/shared/components/dropdown/dropdown.html","../../projects/koala-ui/shared/components/dropdown/koalarx-ui-shared-components-dropdown.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n input,\n OnDestroy,\n OnInit,\n viewChild,\n} from '@angular/core';\nimport { KlString, randomString } from '@koalarx/utils/KlString';\n\n@Component({\n selector: 'kl-dropdown',\n templateUrl: './dropdown.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Dropdown implements OnInit, OnDestroy {\n private readonly dropdownTriggerElement =\n viewChild<ElementRef<HTMLButtonElement>>('dropdownTrigger');\n private readonly dropdownContentElement =\n viewChild<ElementRef<HTMLDivElement>>('dropdownContent');\n private readonly closeInsideClick = (event: PointerEvent) => {\n if (this.insideClick()) {\n return;\n }\n\n const contentElement = this.dropdownContentElement()?.nativeElement;\n const clickElement = event.target as HTMLElement;\n\n if (contentElement && contentElement.contains(clickElement)) {\n contentElement.hidePopover();\n }\n };\n\n readonly id = randomString(10, {\n numbers: true,\n uppercase: false,\n lowercase: false,\n });\n readonly insideClick = input(false, { transform: booleanAttribute });\n readonly anchorName = new KlString('--anchor-').concat(this.id);\n\n constructor() {\n effect(() => {\n const triggerElement = this.dropdownTriggerElement()?.nativeElement;\n const contentElement = this.dropdownContentElement()?.nativeElement;\n\n if (triggerElement && contentElement) {\n triggerElement.style = `anchor-name: ${this.anchorName};`;\n contentElement.style = `position-anchor: ${this.anchorName};`;\n }\n });\n }\n\n ngOnDestroy() {\n document.removeEventListener('click', this.closeInsideClick);\n }\n\n ngOnInit() {\n document.addEventListener('click', this.closeInsideClick);\n }\n\n ajustPosition() {\n const triggerElement = this.dropdownTriggerElement()?.nativeElement;\n const contentElement = this.dropdownContentElement()?.nativeElement;\n\n if (triggerElement && contentElement) {\n setTimeout(() => {\n const position = contentElement.getBoundingClientRect();\n const screenWidth = document.body.clientWidth;\n const screenHeight = document.body.clientHeight;\n\n if (position.right > screenWidth) {\n contentElement.classList.add('dropdown-left');\n contentElement.classList.add('dropdown-start');\n }\n\n if (position.bottom > screenHeight) {\n contentElement.classList.add('dropdown-top');\n }\n });\n }\n }\n}\n","<button #dropdownTrigger\n type=\"button\"\n class=\"p-0!\"\n tabindex=\"0\"\n role=\"button\"\n [attr.popovertarget]=\"id\"\n (click)=\"ajustPosition()\">\n <ng-content select=\"[trigger]\" />\n</button>\n\n<div #dropdownContent\n tabindex=\"0\"\n popover\n [id]=\"id\"\n class=\"dropdown bg-base-200 rounded-box mt-3 min-w-52 w-auto max-w-[30vw] max-h-[40vh] shadow-sm border-2 border-neutral-200 dark:border-neutral-800 rounded-md overflow-y-auto\">\n <ng-content select=\"[options]\" />\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAkBa,QAAQ,CAAA;AACF,IAAA,sBAAsB,GACrC,SAAS,CAAgC,iBAAiB,kEAAC;AAC5C,IAAA,sBAAsB,GACrC,SAAS,CAA6B,iBAAiB,kEAAC;AACzC,IAAA,gBAAgB,GAAG,CAAC,KAAmB,KAAI;AAC1D,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB;;QAGF,MAAM,cAAc,GAAG,IAAI,CAAC,sBAAsB,EAAE,E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AAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEtB3D;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ declare abstract class HttpBase<EntityType = any, PayloadType = any, QueryType =
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
type PaginationType = 'paginator' | 'loadMore';
|
|
42
|
-
declare abstract class ListBase<QueryType extends QueryPagination, TEntity = any> {
|
|
42
|
+
declare abstract class ListBase<QueryType extends QueryPagination, TEntity = any, TService extends HttpBase<TEntity, any, QueryType> = HttpBase<TEntity, any, QueryType>> {
|
|
43
43
|
protected readonly componentFilter?: Type<any> | undefined;
|
|
44
44
|
private reloading;
|
|
45
45
|
private currentPaginationType;
|
|
@@ -47,7 +47,7 @@ declare abstract class ListBase<QueryType extends QueryPagination, TEntity = any
|
|
|
47
47
|
protected readonly limitPage: _angular_core.WritableSignal<number>;
|
|
48
48
|
protected readonly page: _angular_core.WritableSignal<number>;
|
|
49
49
|
protected readonly filter: _angular_core.WritableSignal<QueryType>;
|
|
50
|
-
protected readonly
|
|
50
|
+
protected readonly service: TService;
|
|
51
51
|
protected readonly totalItemsOnPage: _angular_core.WritableSignal<number>;
|
|
52
52
|
protected readonly totalItems: _angular_core.WritableSignal<number>;
|
|
53
53
|
protected readonly list: _angular_core.WritableSignal<TEntity[]>;
|
|
@@ -57,12 +57,12 @@ declare abstract class ListBase<QueryType extends QueryPagination, TEntity = any
|
|
|
57
57
|
protected readonly datatableConfig: _angular_core.WritableSignal<DatatableConfig>;
|
|
58
58
|
queryParams: _angular_core.Signal<QueryType>;
|
|
59
59
|
reload: _angular_core.InputSignal<boolean>;
|
|
60
|
-
constructor(
|
|
60
|
+
constructor(service: Type<TService>, componentFilter?: Type<any> | undefined);
|
|
61
61
|
protected sort(sortFilter: SortFilterType): void;
|
|
62
62
|
protected reloadList(): void;
|
|
63
63
|
protected loadMore(): void;
|
|
64
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListBase<any, any>, never>;
|
|
65
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ListBase<any, any>, never, never, { "paginationType": { "alias": "paginationType"; "required": false; "isSignal": true; }; "reload": { "alias": "reload"; "required": false; "isSignal": true; }; }, { "paginationType": "paginationTypeChange"; }, never, never, true, never>;
|
|
64
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListBase<any, any, any>, never>;
|
|
65
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ListBase<any, any, any>, never, never, { "paginationType": { "alias": "paginationType"; "required": false; "isSignal": true; }; "reload": { "alias": "reload"; "required": false; "isSignal": true; }; }, { "paginationType": "paginationTypeChange"; }, never, never, true, never>;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
declare abstract class PageBase {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
3
|
|
|
3
|
-
declare class Dropdown {
|
|
4
|
+
declare class Dropdown implements OnInit, OnDestroy {
|
|
4
5
|
private readonly dropdownTriggerElement;
|
|
5
6
|
private readonly dropdownContentElement;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
private readonly closeInsideClick;
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly insideClick: i0.InputSignalWithTransform<boolean, unknown>;
|
|
10
|
+
readonly anchorName: string;
|
|
8
11
|
constructor();
|
|
12
|
+
ngOnDestroy(): void;
|
|
13
|
+
ngOnInit(): void;
|
|
9
14
|
ajustPosition(): void;
|
|
10
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<Dropdown, never>;
|
|
11
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Dropdown, "kl-dropdown", never, {}, {}, never, ["[trigger]", "[options]"], true, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Dropdown, "kl-dropdown", never, { "insideClick": { "alias": "insideClick"; "required": false; "isSignal": true; }; }, {}, never, ["[trigger]", "[options]"], true, never>;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export { Dropdown };
|