@lucca-front/ng 17.3.6 → 17.3.8
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/core-select/input/select-input.component.d.ts +6 -6
- package/core-select/option/group.pipe.d.ts +13 -0
- package/core-select/option/index.d.ts +1 -0
- package/core-select/option/option.component.d.ts +3 -1
- package/core-select/panel/index.d.ts +1 -1
- package/core-select/panel/panel.utils.d.ts +5 -3
- package/dialog/model/dialog-config.d.ts +4 -3
- package/esm2022/core-select/api/api.directive.mjs +4 -2
- package/esm2022/core-select/establishment/establishments.directive.mjs +7 -3
- package/esm2022/core-select/input/select-input.component.mjs +16 -14
- package/esm2022/core-select/job-qualification/job-qualifications.directive.mjs +2 -2
- package/esm2022/core-select/option/group.pipe.mjs +43 -0
- package/esm2022/core-select/option/index.mjs +2 -1
- package/esm2022/core-select/option/option.component.mjs +10 -6
- package/esm2022/core-select/panel/index.mjs +2 -2
- package/esm2022/core-select/panel/panel.utils.mjs +8 -24
- package/esm2022/dialog/dialog/dialog.component.mjs +2 -2
- package/esm2022/dialog/dialog-footer/dialog-footer.component.mjs +2 -2
- package/esm2022/dialog/dialog-header/dialog-header.component.mjs +3 -3
- package/esm2022/dialog/dialog.service.mjs +2 -2
- package/esm2022/dialog/model/dialog-config.mjs +1 -1
- package/esm2022/empty-state/empty-state-page/empty-state-page.component.mjs +3 -3
- package/esm2022/empty-state/empty-state-section/empty-state-section.component.mjs +3 -3
- package/esm2022/form-field/form-field.component.mjs +3 -3
- package/esm2022/forms/text-input/text-input.component.mjs +13 -4
- package/esm2022/icon/icon.component.mjs +3 -3
- package/esm2022/modal/dialog-adapter/dialog-content-adapter/dialog-content-adapter.component.mjs +4 -1
- package/esm2022/multi-select/displayer/default-displayer.component.mjs +7 -10
- package/esm2022/multi-select/displayer/displayer-input.directive.mjs +14 -8
- package/esm2022/multi-select/input/select-input.component.mjs +4 -4
- package/esm2022/multi-select/panel/panel.component.mjs +9 -7
- package/esm2022/option/item/option-item.component.mjs +3 -3
- package/esm2022/option/item/tree-option-item.component.mjs +3 -3
- package/esm2022/simple-select/input/select-input.component.mjs +3 -3
- package/esm2022/simple-select/panel/panel.component.mjs +8 -7
- package/esm2022/user/display/user-display.pipe.mjs +2 -2
- package/esm2022/user/picture/index.mjs +1 -1
- package/esm2022/user/picture/user-picture.component.mjs +1 -1
- package/esm2022/user/tile/user-tile.component.mjs +4 -4
- package/fesm2022/lucca-front-ng-core-select-api.mjs +3 -1
- package/fesm2022/lucca-front-ng-core-select-api.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-core-select-establishment.mjs +6 -2
- package/fesm2022/lucca-front-ng-core-select-establishment.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-core-select-job-qualification.mjs +1 -1
- package/fesm2022/lucca-front-ng-core-select-job-qualification.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-core-select.mjs +70 -41
- package/fesm2022/lucca-front-ng-core-select.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-dialog.mjs +7 -7
- package/fesm2022/lucca-front-ng-dialog.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-empty-state.mjs +4 -4
- package/fesm2022/lucca-front-ng-empty-state.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-form-field.mjs +2 -2
- package/fesm2022/lucca-front-ng-form-field.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-forms.mjs +12 -3
- package/fesm2022/lucca-front-ng-forms.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-icon.mjs +2 -2
- package/fesm2022/lucca-front-ng-icon.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-modal.mjs +3 -0
- package/fesm2022/lucca-front-ng-modal.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-multi-select.mjs +27 -23
- package/fesm2022/lucca-front-ng-multi-select.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-option.mjs +4 -4
- package/fesm2022/lucca-front-ng-option.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-simple-select.mjs +9 -8
- package/fesm2022/lucca-front-ng-simple-select.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-user.mjs +3 -3
- package/fesm2022/lucca-front-ng-user.mjs.map +1 -1
- package/forms/text-input/text-input.component.d.ts +5 -1
- package/modal/dialog-adapter/dialog-content-adapter/dialog-content-adapter.component.d.ts +1 -0
- package/multi-select/displayer/default-displayer.component.d.ts +0 -1
- package/multi-select/displayer/displayer-input.directive.d.ts +1 -1
- package/multi-select/panel/panel.component.d.ts +2 -1
- package/package.json +37 -37
- package/simple-select/panel/panel.component.d.ts +2 -1
- package/src/components/_picker.scss +11 -1
- package/src/definitions/option/_option-item.scss +6 -0
- package/user/display/user-display.pipe.d.ts +6 -3
- package/user/picture/index.d.ts +1 -1
- package/user/picture/user-picture.component.d.ts +11 -4
- package/user/tile/user-tile.component.d.ts +14 -6
|
@@ -4,11 +4,11 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
import * as i1 from "../picture/user-picture.component";
|
|
5
5
|
import * as i2 from "../display/user-display.pipe";
|
|
6
6
|
/**
|
|
7
|
-
* Displays user picture and name.
|
|
7
|
+
* Displays user picture and name. LuUserTileUserInput's role can be specified, and the footer is customizable.
|
|
8
8
|
*/
|
|
9
9
|
export class LuUserTileComponent {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* LuUserTileUserInput to display.
|
|
12
12
|
*/
|
|
13
13
|
set user(user) {
|
|
14
14
|
this._user = user;
|
|
@@ -18,7 +18,7 @@ export class LuUserTileComponent {
|
|
|
18
18
|
return this._user;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* LuUserTileUserInput role to display
|
|
22
22
|
*/
|
|
23
23
|
set role(role) {
|
|
24
24
|
this._role = role;
|
|
@@ -64,4 +64,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
|
|
|
64
64
|
}], role: [{
|
|
65
65
|
type: Input
|
|
66
66
|
}] } });
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci10aWxlLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL25nL3VzZXIvdGlsZS91c2VyLXRpbGUuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvbmcvdXNlci90aWxlL3VzZXItdGlsZS5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsdUJBQXVCLEVBQXFCLFNBQVMsRUFBRSxLQUFLLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDN0YsT0FBTyxFQUFtQixpQkFBaUIsRUFBRSxlQUFlLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQzs7OztBQVUxRzs7R0FFRztBQU9ILE1BQU0sT0FBTyxtQkFBbUI7SUFFL0I7O09BRUc7SUFDSCxJQUNJLElBQUksQ0FBQyxJQUF5QjtRQUNqQyxJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQztRQUNsQixJQUFJLENBQUMsZUFBZSxDQUFDLFlBQVksRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFFRCxJQUFJLElBQUk7UUFDUCxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDbkIsQ0FBQztJQVVEOztPQUVHO0lBQ0gsSUFDSSxJQUFJLENBQUMsSUFBWTtRQUNwQixJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQztRQUNsQixJQUFJLENBQUMsZUFBZSxDQUFDLFlBQVksRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFFRCxJQUFJLElBQUk7UUFDUCxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDbkI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wiPlxuXHQ8ZGl2IGNsYXNzPVwidXNlci10aWxlLWxhYmVsXCI+e3sgcm9sZSA/IHJvbGUgOiB1c2VyPy5qb2JUaXRsZSB9fTwvZGl2PlxuXHQ8ZGl2IGNsYXNzPVwidXNlci10aWxlLXRpdGxlXCI+e3sgdXNlciB8IGx1VXNlckRpc3BsYXk6IGRpc3BsYXlGb3JtYXQgfX08L2Rpdj5cblx0PGRpdiBjbGFzcz1cInVzZXItdGlsZS1mb290bm90ZVwiPjxuZy1jb250ZW50PjwvbmctY29udGVudD48L2Rpdj5cbjwvZGl2PlxuIl19
|
|
@@ -17,7 +17,9 @@ class ALuCoreSelectApiDirective {
|
|
|
17
17
|
}
|
|
18
18
|
ngOnInit() {
|
|
19
19
|
this.select.optionComparer = this.optionComparer;
|
|
20
|
-
this.buildOptions()
|
|
20
|
+
this.buildOptions()
|
|
21
|
+
.pipe(takeUntil(this.destroy$))
|
|
22
|
+
.subscribe((options) => (this.select.options = options));
|
|
21
23
|
}
|
|
22
24
|
buildOptions() {
|
|
23
25
|
// Prevent a double call to getOptions when the clue is changed while the panel is closed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucca-front-ng-core-select-api.mjs","sources":["../../../packages/ng/core-select/api/api.directive.ts","../../../packages/ng/core-select/api/api-v3.directive.ts","../../../packages/ng/core-select/api/api-v4.directive.ts","../../../packages/ng/core-select/api/lucca-front-ng-core-select-api.ts"],"sourcesContent":["import { Directive, inject, OnDestroy, OnInit } from '@angular/core';\nimport { ALuSelectInputComponent } from '@lucca-front/ng/core-select';\nimport { catchError, combineLatest, concatMap, debounceTime, distinctUntilChanged, map, merge, Observable, of, pairwise, scan, startWith, Subject, switchMap, takeUntil, takeWhile, tap } from 'rxjs';\n\nexport const MAGIC_PAGE_SIZE = 20;\nexport const MAGIC_DEBOUNCE_DURATION = 250;\n\n@Directive()\nexport abstract class ALuCoreSelectApiDirective<TOption, TParams = Record<string, string | number | boolean>> implements OnDestroy, OnInit {\n\tprotected destroy$ = new Subject<void>();\n\tprotected pageSize = MAGIC_PAGE_SIZE;\n\tprotected debounceDuration = MAGIC_DEBOUNCE_DURATION;\n\n\tpublic select = inject<ALuSelectInputComponent<TOption, unknown>>(ALuSelectInputComponent);\n\n\tprotected page$ = this.select.nextPage.pipe(\n\t\tscan((page) => page + 1, 0),\n\t\tstartWith(0),\n\t);\n\n\tprotected clue$ = this.select.clueChange.pipe(debounceTime(this.debounceDuration), startWith(''));\n\n\t/**\n\t * Create an object that will be used as params for the api call\n\t */\n\tprotected abstract params$: Observable<TParams>;\n\n\t/**\n\t * Compare two options to know if they are the same. For example, compare by id or by JSON\n\t */\n\tprotected abstract optionComparer: (a: TOption, b: TOption) => boolean;\n\n\t/**\n\t * Return the options for the given params and page\n\t */\n\tprotected abstract getOptions(params: TParams, page: number): Observable<TOption[]>;\n\n\tpublic ngOnInit(): void {\n\t\tthis.select.optionComparer = this.optionComparer;\n\t\tthis.buildOptions().pipe(takeUntil(this.destroy$)).subscribe(this.select.options$);\n\t}\n\n\tprotected buildOptions(): Observable<TOption[]> {\n\t\t// Prevent a double call to getOptions when the clue is changed while the panel is closed\n\t\tconst clueIsPendingDebounce$ = merge(this.select.clueChange.pipe(map(() => true)), this.clue$.pipe(map(() => false))).pipe(distinctUntilChanged());\n\t\tconst isOpen$ = combineLatest([this.select.isPanelOpen$, clueIsPendingDebounce$]).pipe(\n\t\t\tdebounceTime(0),\n\t\t\tstartWith([false, false]),\n\t\t\tpairwise(),\n\t\t\ttap(([[wasOpen], [isOpen, clueIsPendingDebounce]]) => {\n\t\t\t\t// Start the loader as soon as the panel is opened to avoid a short display of the \"no result\" message\n\t\t\t\tif (!wasOpen && isOpen && clueIsPendingDebounce) {\n\t\t\t\t\tthis.select.loading = true;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tmap(([[wasOpen], [isOpen, clueIsPendingDebounce]]) => (isOpen && !wasOpen ? !clueIsPendingDebounce : isOpen)),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\n\t\treturn combineLatest([this.params$, isOpen$]).pipe(\n\t\t\tswitchMap(([params, isOpened]) =>\n\t\t\t\tisOpened\n\t\t\t\t\t? this.page$.pipe(\n\t\t\t\t\t\t\tconcatMap((page) => {\n\t\t\t\t\t\t\t\tthis.select.loading = true;\n\t\t\t\t\t\t\t\treturn this.getOptions(params, page).pipe(\n\t\t\t\t\t\t\t\t\tcatchError(() => of([] as TOption[])),\n\t\t\t\t\t\t\t\t\ttap(() => (this.select.loading = false)),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeWhile((items) => items.length === this.pageSize, true),\n\t\t\t\t\t\t\tscan((acc, items) => [...acc, ...items], [] as TOption[]),\n\t\t\t\t\t )\n\t\t\t\t\t: of([] as TOption[]),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.destroy$.next();\n\t\tthis.destroy$.complete();\n\t}\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, inject, Input } from '@angular/core';\nimport { ILuApiCollectionResponse, ILuApiItem } from '@lucca-front/ng/api';\nimport { BehaviorSubject, combineLatest, map, Observable, ReplaySubject, switchMap, take } from 'rxjs';\nimport { ALuCoreSelectApiDirective } from './api.directive';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[apiV3],lu-multi-select[apiV3]',\n\tstandalone: true,\n})\nexport class LuCoreSelectApiV3Directive<T extends ILuApiItem> extends ALuCoreSelectApiDirective<T> {\n\t@Input()\n\tpublic set apiV3(value: string) {\n\t\tthis.url$.next(value);\n\t}\n\n\t@Input()\n\tpublic set fields(value: string) {\n\t\tthis.fields$.next(value);\n\t}\n\n\t@Input()\n\tpublic set orderBy(value: string | null) {\n\t\tthis.orderBy$.next(value);\n\t}\n\n\t@Input()\n\tpublic set filters(value: Record<string, string | number | boolean>) {\n\t\tthis.filters$.next(value);\n\t}\n\n\tprotected url$ = new ReplaySubject<string>(1);\n\tprotected fields$ = new BehaviorSubject<string>('id,name');\n\tprotected orderBy$ = new BehaviorSubject<string | null>('name,asc');\n\tprotected filters$ = new BehaviorSubject<Record<string, string | number | boolean>>({});\n\n\tprotected httpClient = inject(HttpClient);\n\n\tprotected override params$ = combineLatest([this.fields$, this.filters$, this.orderBy$, this.clue$]).pipe(\n\t\tmap(([fields, filters, orderBy, clue]) => ({\n\t\t\t...filters,\n\t\t\tfields,\n\t\t\t...(orderBy ? { orderBy } : {}),\n\t\t\t...(clue ? { name: `like,${clue}` } : {}),\n\t\t})),\n\t);\n\n\tprotected override getOptions(params: Record<string, string | number | boolean>, page: number): Observable<T[]> {\n\t\treturn this.url$.pipe(\n\t\t\ttake(1),\n\t\t\tswitchMap((url) =>\n\t\t\t\tthis.httpClient.get<ILuApiCollectionResponse<T>>(url, {\n\t\t\t\t\tparams: {\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tpaging: `${page * this.pageSize},${this.pageSize}`,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\tmap((res) => res.data.items),\n\t\t);\n\t}\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, inject, Input } from '@angular/core';\nimport { ILuApiItem } from '@lucca-front/ng/api';\nimport { BehaviorSubject, combineLatest, map, Observable, ReplaySubject, switchMap, take } from 'rxjs';\nimport { ALuCoreSelectApiDirective } from './api.directive';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[apiV4],lu-multi-select[apiV4]',\n\tstandalone: true,\n})\nexport class LuCoreSelectApiV4Directive<T extends ILuApiItem> extends ALuCoreSelectApiDirective<T> {\n\t@Input()\n\tpublic set apiV4(value: string) {\n\t\tthis.url$.next(value);\n\t}\n\n\t@Input()\n\tpublic set sort(value: string | null) {\n\t\tthis.sort$.next(value);\n\t}\n\n\t@Input()\n\tpublic set filters(value: Record<string, string | number | boolean>) {\n\t\tthis.filters$.next(value);\n\t}\n\n\tprotected url$ = new ReplaySubject<string>(1);\n\tprotected sort$ = new BehaviorSubject<string | null>('+name');\n\tprotected filters$ = new BehaviorSubject<Record<string, string | number | boolean>>({});\n\n\tprotected httpClient = inject(HttpClient);\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([this.filters$, this.sort$, this.clue$]).pipe(\n\t\tmap(([filters, sort, clue]) => ({\n\t\t\t...filters,\n\t\t\t...(sort ? { sort } : {}),\n\t\t\t...(clue ? { search: clue } : {}),\n\t\t})),\n\t);\n\n\tprotected override getOptions(params: Record<string, string | number | boolean>, page: number): Observable<T[]> {\n\t\treturn this.url$.pipe(\n\t\t\ttake(1),\n\t\t\tswitchMap((url) =>\n\t\t\t\tthis.httpClient.get<T[] | { items: T[] }>(url, {\n\t\t\t\t\tparams: {\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tpage: page + 1,\n\t\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\tmap((res) => (Array.isArray(res) ? res : res?.items) ?? []),\n\t\t);\n\t}\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,uBAAuB,GAAG,GAAG,CAAC;MAGrB,yBAAyB,CAAA;AAD/C,IAAA,WAAA,GAAA;AAEW,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;QAC/B,IAAQ,CAAA,QAAA,GAAG,eAAe,CAAC;QAC3B,IAAgB,CAAA,gBAAA,GAAG,uBAAuB,CAAC;AAE9C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAA4C,uBAA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EAAA,SAAA,EAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBANtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;;AAGV,oBAAA,QAAQ,EAAE,gDAAgD;AAC1D,oBAAA,UAAU,EAAE,IAAI;AAChB,iBAAA,CAAA;8BAGW,KAAK,EAAA,CAAA;sBADf,KAAK;gBAMK,IAAI,EAAA,CAAA;sBADd,KAAK;gBAMK,OAAO,EAAA,CAAA;sBADjB,KAAK;;;ACvBP;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"lucca-front-ng-core-select-api.mjs","sources":["../../../packages/ng/core-select/api/api.directive.ts","../../../packages/ng/core-select/api/api-v3.directive.ts","../../../packages/ng/core-select/api/api-v4.directive.ts","../../../packages/ng/core-select/api/lucca-front-ng-core-select-api.ts"],"sourcesContent":["import { Directive, inject, OnDestroy, OnInit } from '@angular/core';\nimport { ALuSelectInputComponent } from '@lucca-front/ng/core-select';\nimport { catchError, combineLatest, concatMap, debounceTime, distinctUntilChanged, map, merge, Observable, of, pairwise, scan, startWith, Subject, switchMap, takeUntil, takeWhile, tap } from 'rxjs';\n\nexport const MAGIC_PAGE_SIZE = 20;\nexport const MAGIC_DEBOUNCE_DURATION = 250;\n\n@Directive()\nexport abstract class ALuCoreSelectApiDirective<TOption, TParams = Record<string, string | number | boolean>> implements OnDestroy, OnInit {\n\tprotected destroy$ = new Subject<void>();\n\tprotected pageSize = MAGIC_PAGE_SIZE;\n\tprotected debounceDuration = MAGIC_DEBOUNCE_DURATION;\n\n\tpublic select = inject<ALuSelectInputComponent<TOption, unknown>>(ALuSelectInputComponent);\n\n\tprotected page$ = this.select.nextPage.pipe(\n\t\tscan((page) => page + 1, 0),\n\t\tstartWith(0),\n\t);\n\n\tprotected clue$ = this.select.clueChange.pipe(debounceTime(this.debounceDuration), startWith(''));\n\n\t/**\n\t * Create an object that will be used as params for the api call\n\t */\n\tprotected abstract params$: Observable<TParams>;\n\n\t/**\n\t * Compare two options to know if they are the same. For example, compare by id or by JSON\n\t */\n\tprotected abstract optionComparer: (a: TOption, b: TOption) => boolean;\n\n\t/**\n\t * Return the options for the given params and page\n\t */\n\tprotected abstract getOptions(params: TParams, page: number): Observable<TOption[]>;\n\n\tpublic ngOnInit(): void {\n\t\tthis.select.optionComparer = this.optionComparer;\n\t\tthis.buildOptions()\n\t\t\t.pipe(takeUntil(this.destroy$))\n\t\t\t.subscribe((options) => (this.select.options = options));\n\t}\n\n\tprotected buildOptions(): Observable<TOption[]> {\n\t\t// Prevent a double call to getOptions when the clue is changed while the panel is closed\n\t\tconst clueIsPendingDebounce$ = merge(this.select.clueChange.pipe(map(() => true)), this.clue$.pipe(map(() => false))).pipe(distinctUntilChanged());\n\t\tconst isOpen$ = combineLatest([this.select.isPanelOpen$, clueIsPendingDebounce$]).pipe(\n\t\t\tdebounceTime(0),\n\t\t\tstartWith([false, false]),\n\t\t\tpairwise(),\n\t\t\ttap(([[wasOpen], [isOpen, clueIsPendingDebounce]]) => {\n\t\t\t\t// Start the loader as soon as the panel is opened to avoid a short display of the \"no result\" message\n\t\t\t\tif (!wasOpen && isOpen && clueIsPendingDebounce) {\n\t\t\t\t\tthis.select.loading = true;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tmap(([[wasOpen], [isOpen, clueIsPendingDebounce]]) => (isOpen && !wasOpen ? !clueIsPendingDebounce : isOpen)),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\n\t\treturn combineLatest([this.params$, isOpen$]).pipe(\n\t\t\tswitchMap(([params, isOpened]) =>\n\t\t\t\tisOpened\n\t\t\t\t\t? this.page$.pipe(\n\t\t\t\t\t\t\tconcatMap((page) => {\n\t\t\t\t\t\t\t\tthis.select.loading = true;\n\t\t\t\t\t\t\t\treturn this.getOptions(params, page).pipe(\n\t\t\t\t\t\t\t\t\tcatchError(() => of([] as TOption[])),\n\t\t\t\t\t\t\t\t\ttap(() => (this.select.loading = false)),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeWhile((items) => items.length === this.pageSize, true),\n\t\t\t\t\t\t\tscan((acc, items) => [...acc, ...items], [] as TOption[]),\n\t\t\t\t\t )\n\t\t\t\t\t: of([] as TOption[]),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.destroy$.next();\n\t\tthis.destroy$.complete();\n\t}\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, inject, Input } from '@angular/core';\nimport { ILuApiCollectionResponse, ILuApiItem } from '@lucca-front/ng/api';\nimport { BehaviorSubject, combineLatest, map, Observable, ReplaySubject, switchMap, take } from 'rxjs';\nimport { ALuCoreSelectApiDirective } from './api.directive';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[apiV3],lu-multi-select[apiV3]',\n\tstandalone: true,\n})\nexport class LuCoreSelectApiV3Directive<T extends ILuApiItem> extends ALuCoreSelectApiDirective<T> {\n\t@Input()\n\tpublic set apiV3(value: string) {\n\t\tthis.url$.next(value);\n\t}\n\n\t@Input()\n\tpublic set fields(value: string) {\n\t\tthis.fields$.next(value);\n\t}\n\n\t@Input()\n\tpublic set orderBy(value: string | null) {\n\t\tthis.orderBy$.next(value);\n\t}\n\n\t@Input()\n\tpublic set filters(value: Record<string, string | number | boolean>) {\n\t\tthis.filters$.next(value);\n\t}\n\n\tprotected url$ = new ReplaySubject<string>(1);\n\tprotected fields$ = new BehaviorSubject<string>('id,name');\n\tprotected orderBy$ = new BehaviorSubject<string | null>('name,asc');\n\tprotected filters$ = new BehaviorSubject<Record<string, string | number | boolean>>({});\n\n\tprotected httpClient = inject(HttpClient);\n\n\tprotected override params$ = combineLatest([this.fields$, this.filters$, this.orderBy$, this.clue$]).pipe(\n\t\tmap(([fields, filters, orderBy, clue]) => ({\n\t\t\t...filters,\n\t\t\tfields,\n\t\t\t...(orderBy ? { orderBy } : {}),\n\t\t\t...(clue ? { name: `like,${clue}` } : {}),\n\t\t})),\n\t);\n\n\tprotected override getOptions(params: Record<string, string | number | boolean>, page: number): Observable<T[]> {\n\t\treturn this.url$.pipe(\n\t\t\ttake(1),\n\t\t\tswitchMap((url) =>\n\t\t\t\tthis.httpClient.get<ILuApiCollectionResponse<T>>(url, {\n\t\t\t\t\tparams: {\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tpaging: `${page * this.pageSize},${this.pageSize}`,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\tmap((res) => res.data.items),\n\t\t);\n\t}\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, inject, Input } from '@angular/core';\nimport { ILuApiItem } from '@lucca-front/ng/api';\nimport { BehaviorSubject, combineLatest, map, Observable, ReplaySubject, switchMap, take } from 'rxjs';\nimport { ALuCoreSelectApiDirective } from './api.directive';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[apiV4],lu-multi-select[apiV4]',\n\tstandalone: true,\n})\nexport class LuCoreSelectApiV4Directive<T extends ILuApiItem> extends ALuCoreSelectApiDirective<T> {\n\t@Input()\n\tpublic set apiV4(value: string) {\n\t\tthis.url$.next(value);\n\t}\n\n\t@Input()\n\tpublic set sort(value: string | null) {\n\t\tthis.sort$.next(value);\n\t}\n\n\t@Input()\n\tpublic set filters(value: Record<string, string | number | boolean>) {\n\t\tthis.filters$.next(value);\n\t}\n\n\tprotected url$ = new ReplaySubject<string>(1);\n\tprotected sort$ = new BehaviorSubject<string | null>('+name');\n\tprotected filters$ = new BehaviorSubject<Record<string, string | number | boolean>>({});\n\n\tprotected httpClient = inject(HttpClient);\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([this.filters$, this.sort$, this.clue$]).pipe(\n\t\tmap(([filters, sort, clue]) => ({\n\t\t\t...filters,\n\t\t\t...(sort ? { sort } : {}),\n\t\t\t...(clue ? { search: clue } : {}),\n\t\t})),\n\t);\n\n\tprotected override getOptions(params: Record<string, string | number | boolean>, page: number): Observable<T[]> {\n\t\treturn this.url$.pipe(\n\t\t\ttake(1),\n\t\t\tswitchMap((url) =>\n\t\t\t\tthis.httpClient.get<T[] | { items: T[] }>(url, {\n\t\t\t\t\tparams: {\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tpage: page + 1,\n\t\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\tmap((res) => (Array.isArray(res) ? res : res?.items) ?? []),\n\t\t);\n\t}\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,uBAAuB,GAAG,GAAG,CAAC;MAGrB,yBAAyB,CAAA;AAD/C,IAAA,WAAA,GAAA;AAEW,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;QAC/B,IAAQ,CAAA,QAAA,GAAG,eAAe,CAAC;QAC3B,IAAgB,CAAA,gBAAA,GAAG,uBAAuB,CAAC;AAE9C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAA4C,uBAAuB,CAAC,CAAC;AAEjF,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAC1C,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAC3B,SAAS,CAAC,CAAC,CAAC,CACZ,CAAC;QAEQ,IAAK,CAAA,KAAA,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC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U,EAAE,IAAI;AAChB,iBAAA,CAAA;8BAGW,KAAK,EAAA,CAAA;sBADf,KAAK;gBAMK,IAAI,EAAA,CAAA;sBADd,KAAK;gBAMK,OAAO,EAAA,CAAA;sBADjB,KAAK;;;ACvBP;;AAEG;;;;"}
|
|
@@ -59,8 +59,12 @@ class LuCoreSelectEstablishmentsDirective extends ALuCoreSelectApiDirective {
|
|
|
59
59
|
toObservable(this._appInstanceId),
|
|
60
60
|
]).pipe(map(([filters, clue, operationIds, appInstanceId]) => ({
|
|
61
61
|
...filters,
|
|
62
|
-
...(clue
|
|
63
|
-
|
|
62
|
+
...(clue
|
|
63
|
+
? // When the clue is not empty, sort establishments by name
|
|
64
|
+
{ search: sanitizeClueFilter(clue), sort: 'name' }
|
|
65
|
+
: // When the clue is empty, establishments are grouped by legal unit, so sort them by legal unit name and then by name
|
|
66
|
+
{ sort: 'legalunit.name,name' }),
|
|
67
|
+
...(operationIds ? { operations: operationIds.join(',') } : {}),
|
|
64
68
|
...(appInstanceId ? { appInstanceId } : {}),
|
|
65
69
|
})));
|
|
66
70
|
this.optionComparer = (a, b) => a.id === b.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucca-front-ng-core-select-establishment.mjs","sources":["../../../packages/ng/core-select/establishment/establishment-grouping.service.ts","../../../packages/ng/core-select/establishment/establishment-grouping.component.ts","../../../packages/ng/core-select/establishment/establishments.directive.ts","../../../packages/ng/core-select/establishment/lucca-front-ng-core-select-establishment.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { combineLatest, map, shareReplay } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class EstablishmentGroupingService {\n\tprotected http = inject(HttpClient);\n\tprotected establishmentsUrl = '/organization/structure/api/establishments';\n\tprotected legalUnitsUrl = '/organization/structure/api/legal-units';\n\n\tprotected countParams: HttpParams = new HttpParams().set('fields.root', 'count').set('limit', 0);\n\tprotected establishmentsCount$ = this.http.get<{ count: number }>(this.establishmentsUrl, { params: this.countParams }).pipe(map((res) => res.count));\n\tprotected legalUnitsCount$ = this.http.get<{ count: number }>(this.legalUnitsUrl, { params: this.countParams }).pipe(map((res) => res.count));\n\n\tpublic useGrouping$ = combineLatest([this.legalUnitsCount$, this.establishmentsCount$]).pipe(\n\t\tmap(([luCount, establishmentCount]) => luCount > 1 && establishmentCount > 1 && luCount !== establishmentCount),\n\t\tshareReplay(),\n\t);\n}\n","import { AsyncPipe } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { PORTAL_CONTEXT } from '@lucca-front/ng/core';\nimport { LuOptionGroupByContext } from '@lucca-front/ng/core-select';\nimport { LuCoreSelectEstablishment } from './models';\n\n@Component({\n\tselector: 'lu-establishment-grouping',\n\tstandalone: true,\n\timports: [AsyncPipe],\n\ttemplate: `{{ group.options[0].legalUnit.name }}`,\n})\nexport class LuEstablishmentGroupingComponent {\n\tgroup = inject<LuOptionGroupByContext<LuCoreSelectEstablishment, number>>(PORTAL_CONTEXT).$implicit;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { DestroyRef, Directive, Input, OnInit, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { ALuCoreSelectApiDirective } from '@lucca-front/ng/core-select/api';\nimport { Observable, combineLatest, filter, map } from 'rxjs';\nimport { LuEstablishmentGroupingComponent } from './establishment-grouping.component';\nimport { EstablishmentGroupingService } from './establishment-grouping.service';\nimport { LuCoreSelectEstablishment } from './models';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\" / \"lu-multi-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[establishments],lu-multi-select[establishments]',\n\tstandalone: true,\n\texportAs: 'luEstablishments',\n})\nexport class LuCoreSelectEstablishmentsDirective<T extends LuCoreSelectEstablishment = LuCoreSelectEstablishment> extends ALuCoreSelectApiDirective<T> implements OnInit {\n\t#groupingService = inject(EstablishmentGroupingService);\n\t#destroyRef = inject(DestroyRef);\n\n\tprotected httpClient = inject(HttpClient);\n\n\t@Input()\n\tpublic set url(url: string | null) {\n\t\tthis._url.set(url);\n\t}\n\n\t@Input()\n\tpublic set filters(filters: Record<string, string | number | boolean> | null) {\n\t\tthis._filters.set(filters);\n\t}\n\n\t@Input()\n\tpublic set operationIds(ids: number[] | null) {\n\t\tthis._operationIds.set(ids);\n\t}\n\n\t@Input()\n\tpublic set appInstanceId(id: number | null) {\n\t\tthis._appInstanceId.set(id);\n\t}\n\n\tprotected _url = signal<string>('/organization/structure/api/establishments');\n\tprotected _filters = signal<Record<string, string | number | boolean> | null>(null);\n\tprotected _operationIds = signal<number[] | null>(null);\n\tprotected _appInstanceId = signal<number | null>(null);\n\n\tpublic override ngOnInit(): void {\n\t\tsuper.ngOnInit();\n\t\tthis.initGrouping();\n\t}\n\n\tprotected initGrouping() {\n\t\tthis.#groupingService.useGrouping$.pipe(filter(Boolean), takeUntilDestroyed(this.#destroyRef)).subscribe(() => {\n\t\t\tthis.select.grouping = {\n\t\t\t\tselector: (option) => option.legalUnitId,\n\t\t\t\tcontent: LuEstablishmentGroupingComponent,\n\t\t\t};\n\t\t});\n\t}\n\n\tprotected override getOptions(params: Record<string, string | number | boolean> | null, page: number): Observable<T[]> {\n\t\treturn this.httpClient\n\t\t\t.get<T[] | { items: T[] }>(this._url(), {\n\t\t\t\tparams: {\n\t\t\t\t\t...params,\n\t\t\t\t\tpage: page + 1,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t},\n\t\t\t})\n\t\t\t.pipe(map((res) => (Array.isArray(res) ? res : res?.items) ?? []));\n\t}\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([\n\t\ttoObservable(this._filters),\n\t\tthis.clue$,\n\t\ttoObservable(this._operationIds),\n\t\ttoObservable(this._appInstanceId),\n\t]).pipe(\n\t\tmap(([filters, clue, operationIds, appInstanceId]) => ({\n\t\t\t...filters,\n\t\t\t...(clue ? { search: sanitizeClueFilter(clue) } : {}),\n\t\t\t...(operationIds ? { operationIds: operationIds.join(',') } : {}),\n\t\t\t...(appInstanceId ? { appInstanceId } : {}),\n\t\t})),\n\t);\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n\nfunction sanitizeClueFilter(clue: string) {\n\treturn clue\n\t\t.split(' ')\n\t\t.map((c: string) => encodeURIComponent(c))\n\t\t.join(',');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAKa,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;AAEW,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAC1B,IAAiB,CAAA,iBAAA,GAAG,4CAA4C,CAAC;QACjE,IAAa,CAAA,aAAA,GAAG,yCAAyC,CAAC;AAE1D,QAAA,IAAA,CAAA,WAAW,GAAe,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AACvF,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAoB,IAAI,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5I,QAAA,IAAA,CAAA,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAoB,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAEvI,QAAA,IAAA,CAAA,YAAY,GAAG,aAAa,CAAC,CAAC,IAAI,CA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;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAS,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC;SACzC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb;;AC/FA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"lucca-front-ng-core-select-establishment.mjs","sources":["../../../packages/ng/core-select/establishment/establishment-grouping.service.ts","../../../packages/ng/core-select/establishment/establishment-grouping.component.ts","../../../packages/ng/core-select/establishment/establishments.directive.ts","../../../packages/ng/core-select/establishment/lucca-front-ng-core-select-establishment.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { combineLatest, map, shareReplay } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class EstablishmentGroupingService {\n\tprotected http = inject(HttpClient);\n\tprotected establishmentsUrl = '/organization/structure/api/establishments';\n\tprotected legalUnitsUrl = '/organization/structure/api/legal-units';\n\n\tprotected countParams: HttpParams = new HttpParams().set('fields.root', 'count').set('limit', 0);\n\tprotected establishmentsCount$ = this.http.get<{ count: number }>(this.establishmentsUrl, { params: this.countParams }).pipe(map((res) => res.count));\n\tprotected legalUnitsCount$ = this.http.get<{ count: number }>(this.legalUnitsUrl, { params: this.countParams }).pipe(map((res) => res.count));\n\n\tpublic useGrouping$ = combineLatest([this.legalUnitsCount$, this.establishmentsCount$]).pipe(\n\t\tmap(([luCount, establishmentCount]) => luCount > 1 && establishmentCount > 1 && luCount !== establishmentCount),\n\t\tshareReplay(),\n\t);\n}\n","import { AsyncPipe } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { PORTAL_CONTEXT } from '@lucca-front/ng/core';\nimport { LuOptionGroupByContext } from '@lucca-front/ng/core-select';\nimport { LuCoreSelectEstablishment } from './models';\n\n@Component({\n\tselector: 'lu-establishment-grouping',\n\tstandalone: true,\n\timports: [AsyncPipe],\n\ttemplate: `{{ group.options[0].legalUnit.name }}`,\n})\nexport class LuEstablishmentGroupingComponent {\n\tgroup = inject<LuOptionGroupByContext<LuCoreSelectEstablishment, number>>(PORTAL_CONTEXT).$implicit;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { DestroyRef, Directive, Input, OnInit, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { ALuCoreSelectApiDirective } from '@lucca-front/ng/core-select/api';\nimport { Observable, combineLatest, filter, map } from 'rxjs';\nimport { LuEstablishmentGroupingComponent } from './establishment-grouping.component';\nimport { EstablishmentGroupingService } from './establishment-grouping.service';\nimport { LuCoreSelectEstablishment } from './models';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\" / \"lu-multi-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[establishments],lu-multi-select[establishments]',\n\tstandalone: true,\n\texportAs: 'luEstablishments',\n})\nexport class LuCoreSelectEstablishmentsDirective<T extends LuCoreSelectEstablishment = LuCoreSelectEstablishment> extends ALuCoreSelectApiDirective<T> implements OnInit {\n\t#groupingService = inject(EstablishmentGroupingService);\n\t#destroyRef = inject(DestroyRef);\n\n\tprotected httpClient = inject(HttpClient);\n\n\t@Input()\n\tpublic set url(url: string | null) {\n\t\tthis._url.set(url);\n\t}\n\n\t@Input()\n\tpublic set filters(filters: Record<string, string | number | boolean> | null) {\n\t\tthis._filters.set(filters);\n\t}\n\n\t@Input()\n\tpublic set operationIds(ids: number[] | null) {\n\t\tthis._operationIds.set(ids);\n\t}\n\n\t@Input()\n\tpublic set appInstanceId(id: number | null) {\n\t\tthis._appInstanceId.set(id);\n\t}\n\n\tprotected _url = signal<string>('/organization/structure/api/establishments');\n\tprotected _filters = signal<Record<string, string | number | boolean> | null>(null);\n\tprotected _operationIds = signal<number[] | null>(null);\n\tprotected _appInstanceId = signal<number | null>(null);\n\n\tpublic override ngOnInit(): void {\n\t\tsuper.ngOnInit();\n\t\tthis.initGrouping();\n\t}\n\n\tprotected initGrouping() {\n\t\tthis.#groupingService.useGrouping$.pipe(filter(Boolean), takeUntilDestroyed(this.#destroyRef)).subscribe(() => {\n\t\t\tthis.select.grouping = {\n\t\t\t\tselector: (option) => option.legalUnitId,\n\t\t\t\tcontent: LuEstablishmentGroupingComponent,\n\t\t\t};\n\t\t});\n\t}\n\n\tprotected override getOptions(params: Record<string, string | number | boolean> | null, page: number): Observable<T[]> {\n\t\treturn this.httpClient\n\t\t\t.get<T[] | { items: T[] }>(this._url(), {\n\t\t\t\tparams: {\n\t\t\t\t\t...params,\n\t\t\t\t\tpage: page + 1,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t},\n\t\t\t})\n\t\t\t.pipe(map((res) => (Array.isArray(res) ? res : res?.items) ?? []));\n\t}\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([\n\t\ttoObservable(this._filters),\n\t\tthis.clue$,\n\t\ttoObservable(this._operationIds),\n\t\ttoObservable(this._appInstanceId),\n\t]).pipe(\n\t\tmap(([filters, clue, operationIds, appInstanceId]) => ({\n\t\t\t...filters,\n\t\t\t...(clue\n\t\t\t\t? // When the clue is not empty, sort establishments by name\n\t\t\t\t { search: sanitizeClueFilter(clue), sort: 'name' }\n\t\t\t\t: // When the clue is empty, establishments are grouped by legal unit, so sort them by legal unit name and then by name\n\t\t\t\t { sort: 'legalunit.name,name' }),\n\t\t\t...(operationIds ? { operations: operationIds.join(',') } : {}),\n\t\t\t...(appInstanceId ? { appInstanceId } : {}),\n\t\t})),\n\t);\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n\nfunction sanitizeClueFilter(clue: string) {\n\treturn clue\n\t\t.split(' ')\n\t\t.map((c: string) => encodeURIComponent(c))\n\t\t.join(',');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAKa,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;AAEW,QAAA,IAAA,CAAA,IAAI,G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KAAK,EAAE,CAAC,CAAC,CAAC;KACpE;8GAvDW,mCAAmC,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAnC,mCAAmC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kEAAA,EAAA,MAAA,EAAA,EAAA,GAAA,EAAA,KAAA,EAAA,OAAA,EAAA,SAAA,EAAA,YAAA,EAAA,cAAA,EAAA,aAAA,EAAA,eAAA,EAAA,EAAA,QAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAnC,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAP/C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;;AAGV,oBAAA,QAAQ,EAAE,kEAAkE;AAC5E,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,iBAAA,CAAA;8BAQW,GAAG,EAAA,CAAA;sBADb,KAAK;gBAMK,OAAO,EAAA,CAAA;sBADjB,KAAK;gBAMK,YAAY,EAAA,CAAA;sBADtB,KAAK;gBAMK,aAAa,EAAA,CAAA;sBADvB,KAAK;;AAyDP,SAAS,kBAAkB,CAAC,IAAY,EAAA;AACvC,IAAA,OAAO,IAAI;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAS,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC;SACzC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb;;ACnGA;;AAEG;;;;"}
|
|
@@ -38,7 +38,7 @@ class LuCoreSelectJobQualificationsDirective extends ALuCoreSelectApiDirective {
|
|
|
38
38
|
this._filters = signal(null);
|
|
39
39
|
this.params$ = combineLatest([toObservable(this._filters), this.clue$]).pipe(map(([filters, clue]) => ({
|
|
40
40
|
...filters,
|
|
41
|
-
...(clue ? { search: sanitizeClueFilter(clue) } : {}),
|
|
41
|
+
...(clue ? { search: sanitizeClueFilter(clue), sort: 'name' } : { sort: 'job.name,level.position' }),
|
|
42
42
|
})));
|
|
43
43
|
this.optionComparer = (a, b) => a.id === b.id;
|
|
44
44
|
this.select.grouping = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucca-front-ng-core-select-job-qualification.mjs","sources":["../../../packages/ng/core-select/job-qualification/job-qualification-grouping.component.ts","../../../packages/ng/core-select/job-qualification/job-qualifications.directive.ts","../../../packages/ng/core-select/job-qualification/lucca-front-ng-core-select-job-qualification.ts"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { PORTAL_CONTEXT } from '@lucca-front/ng/core';\nimport { LuOptionGroupByContext } from '@lucca-front/ng/core-select';\nimport { LuCoreSelectJobQualification } from './models';\n\n@Component({\n\tselector: 'lu-job-qualification-grouping',\n\tstandalone: true,\n\timports: [AsyncPipe],\n\ttemplate: `{{ group.options[0].job.name }}`,\n})\nexport class LuJobQualificationGroupingComponent {\n\tgroup = inject<LuOptionGroupByContext<LuCoreSelectJobQualification, number>>(PORTAL_CONTEXT).$implicit;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, Input, OnInit, inject, signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { ALuCoreSelectApiDirective } from '@lucca-front/ng/core-select/api';\nimport { Observable, combineLatest, map } from 'rxjs';\nimport { LuJobQualificationGroupingComponent } from './job-qualification-grouping.component';\nimport { LuCoreSelectJobQualification } from './models';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\" / \"lu-multi-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[jobQualifications],lu-multi-select[jobQualifications]',\n\tstandalone: true,\n\texportAs: 'jobQualifications',\n})\nexport class LuCoreSelectJobQualificationsDirective<T extends LuCoreSelectJobQualification = LuCoreSelectJobQualification> extends ALuCoreSelectApiDirective<T> implements OnInit {\n\tprotected httpClient = inject(HttpClient);\n\n\t@Input()\n\tpublic set url(url: string | null) {\n\t\tthis._url.set(url);\n\t}\n\n\t@Input()\n\tpublic set filters(filters: Record<string, string | number | boolean> | null) {\n\t\tthis._filters.set(filters);\n\t}\n\n\tprotected _url = signal<string>('/organization/structure/api/job-qualifications');\n\tprotected _filters = signal<Record<string, string | number | boolean> | null>(null);\n\n\tpublic constructor() {\n\t\tsuper();\n\n\t\tthis.select.grouping = {\n\t\t\tselector: (option) => option.job.id,\n\t\t\tcontent: LuJobQualificationGroupingComponent,\n\t\t};\n\t}\n\n\tprotected override getOptions(params: Record<string, string | number | boolean> | null, page: number): Observable<T[]> {\n\t\treturn this.httpClient\n\t\t\t.get<T[] | { items: T[] }>(this._url(), {\n\t\t\t\tparams: {\n\t\t\t\t\t...params,\n\t\t\t\t\tpage: page + 1,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t},\n\t\t\t})\n\t\t\t.pipe(map((res) => (Array.isArray(res) ? res : res?.items) ?? []));\n\t}\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([toObservable(this._filters), this.clue$]).pipe(\n\t\tmap(([filters, clue]) => ({\n\t\t\t...filters,\n\t\t\t...(clue ? { search: sanitizeClueFilter(clue) } : {}),\n\t\t})),\n\t);\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n\nfunction sanitizeClueFilter(clue: string) {\n\treturn clue\n\t\t.split(' ')\n\t\t.map((c: string) => encodeURIComponent(c))\n\t\t.join(',');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAYa,mCAAmC,CAAA;AANhD,IAAA,WAAA,GAAA;AAOC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAA+D,cAAc,CAAC,CAAC,SAAS,CAAC;AACvG,KAAA;8GAFY,mCAAmC,EAAA,IAAA,EAAA,EA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CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM;AACzB,YAAA,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"lucca-front-ng-core-select-job-qualification.mjs","sources":["../../../packages/ng/core-select/job-qualification/job-qualification-grouping.component.ts","../../../packages/ng/core-select/job-qualification/job-qualifications.directive.ts","../../../packages/ng/core-select/job-qualification/lucca-front-ng-core-select-job-qualification.ts"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { PORTAL_CONTEXT } from '@lucca-front/ng/core';\nimport { LuOptionGroupByContext } from '@lucca-front/ng/core-select';\nimport { LuCoreSelectJobQualification } from './models';\n\n@Component({\n\tselector: 'lu-job-qualification-grouping',\n\tstandalone: true,\n\timports: [AsyncPipe],\n\ttemplate: `{{ group.options[0].job.name }}`,\n})\nexport class LuJobQualificationGroupingComponent {\n\tgroup = inject<LuOptionGroupByContext<LuCoreSelectJobQualification, number>>(PORTAL_CONTEXT).$implicit;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Directive, Input, OnInit, inject, signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { ALuCoreSelectApiDirective } from '@lucca-front/ng/core-select/api';\nimport { Observable, combineLatest, map } from 'rxjs';\nimport { LuJobQualificationGroupingComponent } from './job-qualification-grouping.component';\nimport { LuCoreSelectJobQualification } from './models';\n\n@Directive({\n\t// The attribute is already prefixed with \"lu-simple-select\" / \"lu-multi-select\"\n\t// eslint-disable-next-line @angular-eslint/directive-selector\n\tselector: 'lu-simple-select[jobQualifications],lu-multi-select[jobQualifications]',\n\tstandalone: true,\n\texportAs: 'jobQualifications',\n})\nexport class LuCoreSelectJobQualificationsDirective<T extends LuCoreSelectJobQualification = LuCoreSelectJobQualification> extends ALuCoreSelectApiDirective<T> implements OnInit {\n\tprotected httpClient = inject(HttpClient);\n\n\t@Input()\n\tpublic set url(url: string | null) {\n\t\tthis._url.set(url);\n\t}\n\n\t@Input()\n\tpublic set filters(filters: Record<string, string | number | boolean> | null) {\n\t\tthis._filters.set(filters);\n\t}\n\n\tprotected _url = signal<string>('/organization/structure/api/job-qualifications');\n\tprotected _filters = signal<Record<string, string | number | boolean> | null>(null);\n\n\tpublic constructor() {\n\t\tsuper();\n\n\t\tthis.select.grouping = {\n\t\t\tselector: (option) => option.job.id,\n\t\t\tcontent: LuJobQualificationGroupingComponent,\n\t\t};\n\t}\n\n\tprotected override getOptions(params: Record<string, string | number | boolean> | null, page: number): Observable<T[]> {\n\t\treturn this.httpClient\n\t\t\t.get<T[] | { items: T[] }>(this._url(), {\n\t\t\t\tparams: {\n\t\t\t\t\t...params,\n\t\t\t\t\tpage: page + 1,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t},\n\t\t\t})\n\t\t\t.pipe(map((res) => (Array.isArray(res) ? res : res?.items) ?? []));\n\t}\n\n\tprotected override params$: Observable<Record<string, string | number | boolean>> = combineLatest([toObservable(this._filters), this.clue$]).pipe(\n\t\tmap(([filters, clue]) => ({\n\t\t\t...filters,\n\t\t\t...(clue ? { search: sanitizeClueFilter(clue), sort: 'name' } : { sort: 'job.name,level.position' }),\n\t\t})),\n\t);\n\n\tprotected override optionComparer = (a: T, b: T) => a.id === b.id;\n}\n\nfunction sanitizeClueFilter(clue: string) {\n\treturn clue\n\t\t.split(' ')\n\t\t.map((c: string) => encodeURIComponent(c))\n\t\t.join(',');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAYa,mCAAmC,CAAA;AANhD,IAAA,WAAA,GAAA;AAOC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAA+D,cAAc,CAAC,CAAC,SAAS,CAAC;AACvG,KAAA;8GAFY,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,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sC,EAAA,UAAA,EAAA,CAAA;kBAPlD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;;AAGV,oBAAA,QAAQ,EAAE,wEAAwE;AAClF,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,iBAAA,CAAA;wDAKW,GAAG,EAAA,CAAA;sBADb,KAAK;gBAMK,OAAO,EAAA,CAAA;sBADjB,KAAK;;AAuCP,SAAS,kBAAkB,CAAC,IAAY,EAAA;AACvC,IAAA,OAAO,IAAI;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAS,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC;SACzC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb;;ACnEA;;AAEG;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, InjectionToken, inject, Component, TemplateRef, ViewContainerRef, Injector, ChangeDetectorRef, ElementRef, ChangeDetectionStrategy, HostBinding, ViewChild, EventEmitter, booleanAttribute, Output, HostListener, Injectable } from '@angular/core';
|
|
2
|
+
import { Directive, Input, InjectionToken, inject, Component, TemplateRef, Pipe, ViewContainerRef, Injector, ChangeDetectorRef, ElementRef, ChangeDetectionStrategy, HostBinding, ViewChild, EventEmitter, booleanAttribute, Output, HostListener, Injectable } from '@angular/core';
|
|
3
3
|
import { OverlayContainer, Overlay } from '@angular/cdk/overlay';
|
|
4
|
-
import { BehaviorSubject, asyncScheduler, observeOn, ReplaySubject, Subject } from 'rxjs';
|
|
4
|
+
import { BehaviorSubject, asyncScheduler, observeOn, ReplaySubject, Subject, map, distinctUntilChanged, skip, take, switchMap, startWith, of } from 'rxjs';
|
|
5
5
|
import { AsyncPipe, NgIf, DOCUMENT } from '@angular/common';
|
|
6
|
+
import { PortalDirective } from '@lucca-front/ng/core';
|
|
6
7
|
import { Platform } from '@angular/cdk/platform';
|
|
7
8
|
|
|
8
9
|
class LuDisplayerDirective {
|
|
@@ -116,6 +117,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
|
|
|
116
117
|
args: ['luOptionGroupBy']
|
|
117
118
|
}] } });
|
|
118
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Generate groups with a O(n) complexity. Note that the options must be sorted by group.
|
|
122
|
+
*/
|
|
123
|
+
function generateGroups(options, selector) {
|
|
124
|
+
if (!options?.length) {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
const groups = [];
|
|
128
|
+
let group;
|
|
129
|
+
for (const option of options) {
|
|
130
|
+
const groupKey = selector(option);
|
|
131
|
+
if (!group || group.key !== groupKey) {
|
|
132
|
+
if (group) {
|
|
133
|
+
groups.push(group);
|
|
134
|
+
}
|
|
135
|
+
group = { key: groupKey, options: [option] };
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
group.options.push(option);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (group) {
|
|
142
|
+
groups.push(group);
|
|
143
|
+
}
|
|
144
|
+
return groups;
|
|
145
|
+
}
|
|
146
|
+
class LuOptionGroupPipe {
|
|
147
|
+
transform(options, selector) {
|
|
148
|
+
return Array.isArray(options) ? generateGroups(options, selector) : generateGroups([options], selector)[0];
|
|
149
|
+
}
|
|
150
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LuOptionGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
151
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.2", ngImport: i0, type: LuOptionGroupPipe, isStandalone: true, name: "luOptionGroup" }); }
|
|
152
|
+
}
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LuOptionGroupPipe, decorators: [{
|
|
154
|
+
type: Pipe,
|
|
155
|
+
args: [{
|
|
156
|
+
name: 'luOptionGroup',
|
|
157
|
+
standalone: true,
|
|
158
|
+
}]
|
|
159
|
+
}] });
|
|
160
|
+
|
|
119
161
|
class LuOptionOutletDirective {
|
|
120
162
|
constructor() {
|
|
121
163
|
this.luOptionShowNull = false;
|
|
@@ -236,11 +278,11 @@ class LuOptionComponent {
|
|
|
236
278
|
}
|
|
237
279
|
}
|
|
238
280
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LuOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
239
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.2", type: LuOptionComponent, isStandalone: true, selector: "lu-select-option", inputs: { optionTpl: "optionTpl", isSelected: "isSelected", option: "option", optionIndex: "optionIndex", scrollIntoViewOptions: "scrollIntoViewOptions" }, host: { properties: { "class.optionItem": "this.hasOptionItemClass", "attr.aria-selected": "this.isSelected", "attr.role": "this.role", "attr.id": "this.id" } }, viewQueries: [{ propertyName: "optionContext", first: true, predicate: LuOptionOutletDirective, descendants: true, read: LU_OPTION_CONTEXT, static: true }], ngImport: i0, template: "<div\n\tclass=\"optionItem-value\"\n\t[class.is-selected]=\"isSelected\"\n\t[class.is-highlighted]=\"isHighlighted$ | async\"\n\t[class.is-disabled]=\"disabled\"\n\t(click)=\"selectOption($event)\"\n>\n\t<ng-container *luOptionOutlet=\"optionTpl; value: option\"
|
|
281
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.2", type: LuOptionComponent, isStandalone: true, selector: "lu-select-option", inputs: { optionTpl: "optionTpl", isSelected: "isSelected", option: "option", grouping: "grouping", optionIndex: "optionIndex", scrollIntoViewOptions: "scrollIntoViewOptions" }, host: { properties: { "class.optionItem": "this.hasOptionItemClass", "attr.aria-selected": "this.isSelected", "attr.role": "this.role", "attr.id": "this.id" } }, viewQueries: [{ propertyName: "optionContext", first: true, predicate: LuOptionOutletDirective, descendants: true, read: LU_OPTION_CONTEXT, static: true }], ngImport: i0, template: "<div\n\tclass=\"optionItem-value\"\n\t[class.is-selected]=\"isSelected\"\n\t[class.is-highlighted]=\"isHighlighted$ | async\"\n\t[class.is-disabled]=\"disabled\"\n\t(click)=\"selectOption($event)\"\n>\n\t<ng-container *luOptionOutlet=\"optionTpl; value: option\" />\n\n\t<div *ngIf=\"grouping\" class=\"optionItem-value-group\">\n\t\t<ng-container *luPortal=\"grouping.content; context: { $implicit: option | luOptionGroup:grouping.selector }\" />\n\t</div>\n</div>\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XXS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-neutral-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-product-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-neutral-700);--components-options-establishment-multiple-padding: 2rem}:host{display:block;scroll-margin:var(--spacings-XXS)}.optionItem{position:relative}.optionItem-value{position:relative;border-radius:var(--commons-borderRadius-M);display:block;padding:var(--components-options-item-padding-vertical) var(--components-options-item-padding-horizontal);transition:background-color 50ms;cursor:pointer}.optionItem-value.is-selected{background-color:var(--palettes-product-50)}.optionItem-value.is-selected:before{content:\"\";position:absolute;top:0;bottom:0;left:calc(var(--spacings-XXS) * -1);width:2px;background-color:var(--palettes-product-700);border-top-right-radius:var(--commons-borderRadius-M);border-bottom-right-radius:var(--commons-borderRadius-M)}.optionItem-value.is-selected:hover{background-color:var(--palettes-product-100)}.optionItem-value.is-selected:active{background-color:var(--palettes-product-200)}.optionItem-value.is-selected.is-highlighted{background-color:var(--palettes-product-100)}.optionItem-value.is-selected.is-highlighted:hover{background-color:var(--palettes-product-200)}.optionItem-value:hover,.optionItem-value.is-highlighted,.optionItem-value.is-focus,.optionItem-value.is-highlighted:hover,.optionItem-value.is-focus:hover{background-color:var(--palettes-neutral-50)}.optionItem-value.is-highlighted:active,.optionItem-value.is-focus:active,.optionItem-value:active{background-color:var(--palettes-neutral-100)}.optionItem-value-group{color:var(--palettes-neutral-600);font-size:var(--sizes-S-fontSize);line-height:var(--sizes-S-lineHeight)}:host-context(.lu-select-value) .optionItem-value{padding:0;overflow:hidden;text-overflow:ellipsis}:host-context(.lu-select-value) .optionItem-value:hover,:host-context(.lu-select-value) .optionItem-value.is-focus,:host-context(.lu-select-value) .optionItem-value.is-highlighted{background-color:inherit}:host-context(.mod-multiple) .optionItem-value{position:relative;padding-left:var(--components-options-item-multiple-padding)}:host-context(.mod-multiple) .optionItem-value:after,:host-context(.mod-multiple) .optionItem-value:before{display:block;position:absolute;left:var(--components-options-checkbox-left);top:50%;transform:translateY(-50%)}:host-context(.mod-multiple) .optionItem-value:before{content:\"\";border-radius:var(--components-options-checkbox-border-radius);box-shadow:inset 0 0 0 2px var(--components-options-checkbox-border-color);display:block;height:var(--components-options-checkbox-size);transition-property:background-color,box-shadow;transition-duration:var(--commons-animations-durations-fast);width:var(--components-options-checkbox-size)}:host-context(.mod-multiple) .optionItem-value:after{display:inline-block;vertical-align:text-bottom;font-style:normal;font-family:Lucca icons;color:transparent;font-size:var(--sizes-S-lineHeight);line-height:var(--components-options-checkbox-size);position:absolute;text-align:center;transform:translateY(-50%) scale(0);transition:all .1s;width:var(--components-options-checkbox-size)}@supports (content: \"*\"/\"\"){:host-context(.mod-multiple) .optionItem-value:after{content:\"\\e97d\"/\"\"}}@supports not (content: \"*\"/\"\"){:host-context(.mod-multiple) .optionItem-value:after{content:\"\\e97d\"}}:host-context(.mod-multiple) .optionItem-value.is-selected:before{background-color:var(--components-options-checkbox-color);box-shadow:inset 0 0 0 2px var(--components-options-checkbox-color)}:host-context(.mod-multiple) .optionItem-value.is-selected:after{color:var(--colors-white-color);transform:translateY(-50%) scale(1)}:host-context(.mod-multiple) .optionItem-value.is-disabled{--components-options-checkbox-border-color: var(--palettes-neutral-500)}:host-context(.mod-multiple) .optionItem-value:not(.is-disabled):hover:before{box-shadow:inset 0 0 0 2px var(--components-options-checkbox-color)}:host-context(.mod-multiple).establishmentOption .optionItem-value{position:relative;padding-left:calc(var(--components-options-checkbox-size) + var(--spacings-XS) * 2)}:host-context(.mod-multiple).establishmentOption .optionItem-value:before,:host-context(.mod-multiple).establishmentOption .optionItem-value:after{left:var(--spacings-XS)}.is-disabled{color:var(--palettes-neutral-500);-webkit-user-select:none;user-select:none;cursor:default}.is-disabled.is-selected{background-color:var(--palettes-neutral-100)}.is-disabled:hover{background-color:inherit}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: LuOptionOutletDirective, selector: "[luOptionOutlet]", inputs: ["luOptionOutlet", "luOptionOutletValue", "luOptionShowNull"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PortalDirective, selector: "[luPortal]", inputs: ["luPortal", "luPortalContext"] }, { kind: "pipe", type: LuOptionGroupPipe, name: "luOptionGroup" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
240
282
|
}
|
|
241
283
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: LuOptionComponent, decorators: [{
|
|
242
284
|
type: Component,
|
|
243
|
-
args: [{ selector: 'lu-select-option', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [AsyncPipe, LuOptionOutletDirective], template: "<div\n\tclass=\"optionItem-value\"\n\t[class.is-selected]=\"isSelected\"\n\t[class.is-highlighted]=\"isHighlighted$ | async\"\n\t[class.is-disabled]=\"disabled\"\n\t(click)=\"selectOption($event)\"\n>\n\t<ng-container *luOptionOutlet=\"optionTpl; value: option\"
|
|
285
|
+
args: [{ selector: 'lu-select-option', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [AsyncPipe, LuOptionOutletDirective, NgIf, PortalDirective, LuOptionGroupPipe], template: "<div\n\tclass=\"optionItem-value\"\n\t[class.is-selected]=\"isSelected\"\n\t[class.is-highlighted]=\"isHighlighted$ | async\"\n\t[class.is-disabled]=\"disabled\"\n\t(click)=\"selectOption($event)\"\n>\n\t<ng-container *luOptionOutlet=\"optionTpl; value: option\" />\n\n\t<div *ngIf=\"grouping\" class=\"optionItem-value-group\">\n\t\t<ng-container *luPortal=\"grouping.content; context: { $implicit: option | luOptionGroup:grouping.selector }\" />\n\t</div>\n</div>\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XXS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-neutral-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-product-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-neutral-700);--components-options-establishment-multiple-padding: 2rem}:host{display:block;scroll-margin:var(--spacings-XXS)}.optionItem{position:relative}.optionItem-value{position:relative;border-radius:var(--commons-borderRadius-M);display:block;padding:var(--components-options-item-padding-vertical) var(--components-options-item-padding-horizontal);transition:background-color 50ms;cursor:pointer}.optionItem-value.is-selected{background-color:var(--palettes-product-50)}.optionItem-value.is-selected:before{content:\"\";position:absolute;top:0;bottom:0;left:calc(var(--spacings-XXS) * -1);width:2px;background-color:var(--palettes-product-700);border-top-right-radius:var(--commons-borderRadius-M);border-bottom-right-radius:var(--commons-borderRadius-M)}.optionItem-value.is-selected:hover{background-color:var(--palettes-product-100)}.optionItem-value.is-selected:active{background-color:var(--palettes-product-200)}.optionItem-value.is-selected.is-highlighted{background-color:var(--palettes-product-100)}.optionItem-value.is-selected.is-highlighted:hover{background-color:var(--palettes-product-200)}.optionItem-value:hover,.optionItem-value.is-highlighted,.optionItem-value.is-focus,.optionItem-value.is-highlighted:hover,.optionItem-value.is-focus:hover{background-color:var(--palettes-neutral-50)}.optionItem-value.is-highlighted:active,.optionItem-value.is-focus:active,.optionItem-value:active{background-color:var(--palettes-neutral-100)}.optionItem-value-group{color:var(--palettes-neutral-600);font-size:var(--sizes-S-fontSize);line-height:var(--sizes-S-lineHeight)}:host-context(.lu-select-value) .optionItem-value{padding:0;overflow:hidden;text-overflow:ellipsis}:host-context(.lu-select-value) .optionItem-value:hover,:host-context(.lu-select-value) .optionItem-value.is-focus,:host-context(.lu-select-value) .optionItem-value.is-highlighted{background-color:inherit}:host-context(.mod-multiple) .optionItem-value{position:relative;padding-left:var(--components-options-item-multiple-padding)}:host-context(.mod-multiple) .optionItem-value:after,:host-context(.mod-multiple) .optionItem-value:before{display:block;position:absolute;left:var(--components-options-checkbox-left);top:50%;transform:translateY(-50%)}:host-context(.mod-multiple) .optionItem-value:before{content:\"\";border-radius:var(--components-options-checkbox-border-radius);box-shadow:inset 0 0 0 2px var(--components-options-checkbox-border-color);display:block;height:var(--components-options-checkbox-size);transition-property:background-color,box-shadow;transition-duration:var(--commons-animations-durations-fast);width:var(--components-options-checkbox-size)}:host-context(.mod-multiple) .optionItem-value:after{display:inline-block;vertical-align:text-bottom;font-style:normal;font-family:Lucca icons;color:transparent;font-size:var(--sizes-S-lineHeight);line-height:var(--components-options-checkbox-size);position:absolute;text-align:center;transform:translateY(-50%) scale(0);transition:all .1s;width:var(--components-options-checkbox-size)}@supports (content: \"*\"/\"\"){:host-context(.mod-multiple) .optionItem-value:after{content:\"\\e97d\"/\"\"}}@supports not (content: \"*\"/\"\"){:host-context(.mod-multiple) .optionItem-value:after{content:\"\\e97d\"}}:host-context(.mod-multiple) .optionItem-value.is-selected:before{background-color:var(--components-options-checkbox-color);box-shadow:inset 0 0 0 2px var(--components-options-checkbox-color)}:host-context(.mod-multiple) .optionItem-value.is-selected:after{color:var(--colors-white-color);transform:translateY(-50%) scale(1)}:host-context(.mod-multiple) .optionItem-value.is-disabled{--components-options-checkbox-border-color: var(--palettes-neutral-500)}:host-context(.mod-multiple) .optionItem-value:not(.is-disabled):hover:before{box-shadow:inset 0 0 0 2px var(--components-options-checkbox-color)}:host-context(.mod-multiple).establishmentOption .optionItem-value{position:relative;padding-left:calc(var(--components-options-checkbox-size) + var(--spacings-XS) * 2)}:host-context(.mod-multiple).establishmentOption .optionItem-value:before,:host-context(.mod-multiple).establishmentOption .optionItem-value:after{left:var(--spacings-XS)}.is-disabled{color:var(--palettes-neutral-500);-webkit-user-select:none;user-select:none;cursor:default}.is-disabled.is-selected{background-color:var(--palettes-neutral-100)}.is-disabled:hover{background-color:inherit}\n"] }]
|
|
244
286
|
}], propDecorators: { hasOptionItemClass: [{
|
|
245
287
|
type: HostBinding,
|
|
246
288
|
args: ['class.optionItem']
|
|
@@ -253,6 +295,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
|
|
|
253
295
|
args: ['attr.aria-selected']
|
|
254
296
|
}], option: [{
|
|
255
297
|
type: Input
|
|
298
|
+
}], grouping: [{
|
|
299
|
+
type: Input
|
|
256
300
|
}], optionIndex: [{
|
|
257
301
|
type: Input
|
|
258
302
|
}], scrollIntoViewOptions: [{
|
|
@@ -296,8 +340,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
|
|
|
296
340
|
class ALuSelectInputComponent {
|
|
297
341
|
constructor() {
|
|
298
342
|
this.placeholder$ = new BehaviorSubject('');
|
|
343
|
+
this.disabled$ = new BehaviorSubject(false);
|
|
299
344
|
this.clearable = false;
|
|
300
|
-
this.disabled = false;
|
|
301
345
|
this.isPanelOpen$ = new BehaviorSubject(false);
|
|
302
346
|
this.activeDescendant$ = new BehaviorSubject('');
|
|
303
347
|
this.overlayConfig = {
|
|
@@ -363,8 +407,9 @@ class ALuSelectInputComponent {
|
|
|
363
407
|
get inputPlaceholder() {
|
|
364
408
|
return this.value ? null : this.placeholder$.value;
|
|
365
409
|
}
|
|
366
|
-
clueChanged(clue) {
|
|
367
|
-
|
|
410
|
+
clueChanged(clue, skipPanelOpen = false) {
|
|
411
|
+
this.clue = clue;
|
|
412
|
+
if (!skipPanelOpen && !this.isPanelOpen) {
|
|
368
413
|
this.openPanel(clue);
|
|
369
414
|
}
|
|
370
415
|
else if (this.lastEmittedClue !== clue) {
|
|
@@ -396,9 +441,13 @@ class ALuSelectInputComponent {
|
|
|
396
441
|
this.panelRef?.handleKeyManagerEvent($event);
|
|
397
442
|
}
|
|
398
443
|
break;
|
|
399
|
-
case '
|
|
444
|
+
case ' ':
|
|
400
445
|
case 'ArrowDown':
|
|
401
446
|
case 'ArrowUp':
|
|
447
|
+
// Initial space should just open the panel, not trigger a clue change
|
|
448
|
+
if (!this.clue && $event.key === ' ') {
|
|
449
|
+
$event.preventDefault();
|
|
450
|
+
}
|
|
402
451
|
if (this.isPanelOpen) {
|
|
403
452
|
this.panelRef?.handleKeyManagerEvent($event);
|
|
404
453
|
}
|
|
@@ -418,7 +467,7 @@ class ALuSelectInputComponent {
|
|
|
418
467
|
this.onTouched = onTouched;
|
|
419
468
|
}
|
|
420
469
|
setDisabledState(isDisabled) {
|
|
421
|
-
this.disabled
|
|
470
|
+
this.disabled$.next(isDisabled);
|
|
422
471
|
this.changeDetectorRef.markForCheck();
|
|
423
472
|
}
|
|
424
473
|
ngOnDestroy() {
|
|
@@ -433,11 +482,11 @@ class ALuSelectInputComponent {
|
|
|
433
482
|
}
|
|
434
483
|
clearValue(event) {
|
|
435
484
|
event.stopPropagation();
|
|
436
|
-
this.updateValue(null);
|
|
485
|
+
this.updateValue(null, true);
|
|
437
486
|
this.inputElementRef.nativeElement.focus();
|
|
438
487
|
}
|
|
439
488
|
openPanel(clue = '') {
|
|
440
|
-
if (this.isPanelOpen || this.disabled) {
|
|
489
|
+
if (this.isPanelOpen || this.disabled$.value) {
|
|
441
490
|
return;
|
|
442
491
|
}
|
|
443
492
|
this.isPanelOpen$.next(true);
|
|
@@ -485,15 +534,15 @@ class ALuSelectInputComponent {
|
|
|
485
534
|
writeValue(value) {
|
|
486
535
|
this.value = value;
|
|
487
536
|
}
|
|
488
|
-
updateValue(value) {
|
|
537
|
+
updateValue(value, skipPanelOpen = false) {
|
|
489
538
|
this.value = value;
|
|
490
539
|
this.emptyClue();
|
|
491
|
-
this.clueChanged('');
|
|
540
|
+
this.clueChanged('', skipPanelOpen);
|
|
492
541
|
this.onChange?.(value);
|
|
493
542
|
this.onTouched?.();
|
|
494
543
|
}
|
|
495
544
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: ALuSelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
496
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.0.2", type: ALuSelectInputComponent, inputs: { placeholder: "placeholder", clearable: ["clearable", "clearable", booleanAttribute],
|
|
545
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.0.2", type: ALuSelectInputComponent, inputs: { placeholder: "placeholder", clearable: ["clearable", "clearable", booleanAttribute], overlayConfig: "overlayConfig", loading: "loading", options: "options", optionComparer: "optionComparer", optionTpl: "optionTpl", valueTpl: "valueTpl" }, outputs: { clueChange: "clueChange", nextPage: "nextPage", previousPage: "previousPage" }, host: { listeners: { "click": "onClickOpenPanel($event)", "keydown": "onKeyDownNavigation($event)" }, properties: { "class.is-clearable": "this.clearable", "class.is-selected": "this.isSelectedClass", "class.is-searchFilled": "this.isSearchFilledClass" } }, viewQueries: [{ propertyName: "inputElementRef", first: true, predicate: ["inputElement"], descendants: true }], ngImport: i0 }); }
|
|
497
546
|
}
|
|
498
547
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: ALuSelectInputComponent, decorators: [{
|
|
499
548
|
type: Directive
|
|
@@ -508,9 +557,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
|
|
|
508
557
|
}, {
|
|
509
558
|
type: HostBinding,
|
|
510
559
|
args: ['class.is-clearable']
|
|
511
|
-
}], disabled: [{
|
|
512
|
-
type: Input,
|
|
513
|
-
args: [{ transform: booleanAttribute }]
|
|
514
560
|
}], isSelectedClass: [{
|
|
515
561
|
type: HostBinding,
|
|
516
562
|
args: ['class.is-selected']
|
|
@@ -619,35 +665,18 @@ class LuSelectPanelRef {
|
|
|
619
665
|
}
|
|
620
666
|
|
|
621
667
|
/**
|
|
622
|
-
*
|
|
668
|
+
* In order to avoid a blinking when we go from empty clue to a clue
|
|
669
|
+
* We need to delay the change of group displayer location by waiting for the options to be updated.
|
|
623
670
|
*/
|
|
624
|
-
function
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
const groups = [];
|
|
629
|
-
let group;
|
|
630
|
-
for (const option of options) {
|
|
631
|
-
const groupKey = selector(option);
|
|
632
|
-
if (!group || group.key !== groupKey) {
|
|
633
|
-
if (group) {
|
|
634
|
-
groups.push(group);
|
|
635
|
-
}
|
|
636
|
-
group = { key: groupKey, options: [option] };
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
group.options.push(option);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (group) {
|
|
643
|
-
groups.push(group);
|
|
644
|
-
}
|
|
645
|
-
return groups;
|
|
671
|
+
function getGroupTemplateLocation(hasGrouping, clueChange$, options$) {
|
|
672
|
+
return hasGrouping
|
|
673
|
+
? clueChange$.pipe(map((clue) => !!clue), distinctUntilChanged(), switchMap((hasClue) => options$.pipe(skip(1), take(1), map(() => (hasClue ? 'option' : 'group-header')))), startWith('group-header'))
|
|
674
|
+
: of('none');
|
|
646
675
|
}
|
|
647
676
|
|
|
648
677
|
/**
|
|
649
678
|
* Generated bundle index. Do not edit.
|
|
650
679
|
*/
|
|
651
680
|
|
|
652
|
-
export { ALuSelectInputComponent, LU_OPTION_CONTEXT, LuDisabledOptionDirective, LuDisplayerDirective, LuOptionDirective, LuOptionGroupDirective, LuSelectPanelRef, LuSimpleSelectDefaultOptionComponent, SELECT_ID, SELECT_LABEL, SELECT_LABEL_ID, provideLuSelectLabelsAndIds, provideLuSelectOverlayContainer, provideOptionContext, LuOptionComponent as ɵLuOptionComponent, LuOptionOutletDirective as ɵLuOptionOutletDirective, generateGroups as ɵgenerateGroups };
|
|
681
|
+
export { ALuSelectInputComponent, LU_OPTION_CONTEXT, LuDisabledOptionDirective, LuDisplayerDirective, LuOptionDirective, LuOptionGroupDirective, LuSelectPanelRef, LuSimpleSelectDefaultOptionComponent, SELECT_ID, SELECT_LABEL, SELECT_LABEL_ID, provideLuSelectLabelsAndIds, provideLuSelectOverlayContainer, provideOptionContext, LuOptionComponent as ɵLuOptionComponent, LuOptionGroupPipe as ɵLuOptionGroupPipe, LuOptionOutletDirective as ɵLuOptionOutletDirective, generateGroups as ɵgenerateGroups, getGroupTemplateLocation as ɵgetGroupTemplateLocation };
|
|
653
682
|
//# sourceMappingURL=lucca-front-ng-core-select.mjs.map
|