@cleavelandprice/ngx-lib 4.7.14 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-kendo.mjs +619 -0
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-kendo.mjs.map +1 -0
- package/fesm2022/cleavelandprice-ngx-lib-authentication-sso.mjs +18 -6
- package/fesm2022/cleavelandprice-ngx-lib-authentication-sso.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-table.mjs +9 -11
- package/fesm2022/cleavelandprice-ngx-lib-table.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cleavelandprice-ngx-lib-active-directory-kendo.d.ts +188 -0
- package/types/cleavelandprice-ngx-lib-table.d.ts +1 -1
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import { ActiveDirectoryService, ActiveDirectoryServiceOptionsToken } from '@cleavelandprice/ngx-lib/active-directory';
|
|
2
|
+
export * from '@cleavelandprice/ngx-lib/active-directory';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, viewChild, input, model, debounced, signal, computed, ChangeDetectorRef, effect, afterNextRender, ViewEncapsulation, Component, output, Optional, SkipSelf, NgModule } from '@angular/core';
|
|
5
|
+
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { switchMap, of } from 'rxjs';
|
|
7
|
+
import { SharePointService } from '@cleavelandprice/ngx-lib/sharepoint';
|
|
8
|
+
import * as i2 from '@progress/kendo-angular-buttons';
|
|
9
|
+
import { KENDO_BUTTONS, ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
10
|
+
import * as i1$1 from '@progress/kendo-angular-dialog';
|
|
11
|
+
import { KENDO_DIALOGS, DialogsModule } from '@progress/kendo-angular-dialog';
|
|
12
|
+
import * as i3 from '@progress/kendo-angular-inputs';
|
|
13
|
+
import { KENDO_INPUTS, InputsModule } from '@progress/kendo-angular-inputs';
|
|
14
|
+
import * as i4 from '@progress/kendo-angular-label';
|
|
15
|
+
import { KENDO_LABELS, LabelModule } from '@progress/kendo-angular-label';
|
|
16
|
+
import * as i5 from '@progress/kendo-angular-layout';
|
|
17
|
+
import { KENDO_TABSTRIP, TabStripModule } from '@progress/kendo-angular-layout';
|
|
18
|
+
import * as i6 from '@progress/kendo-angular-icons';
|
|
19
|
+
import { KENDO_ICONS, IconsModule, SVGIconModule } from '@progress/kendo-angular-icons';
|
|
20
|
+
import { filterClearIcon, questionCircleIcon, usersIcon, userIcon } from '@progress/kendo-svg-icons';
|
|
21
|
+
import { NgClass, CommonModule } from '@angular/common';
|
|
22
|
+
import * as i1 from '@progress/kendo-angular-grid';
|
|
23
|
+
import { GridComponent, KENDO_GRID, GridModule } from '@progress/kendo-angular-grid';
|
|
24
|
+
import { process } from '@progress/kendo-data-query';
|
|
25
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
26
|
+
|
|
27
|
+
const USER_CHOOSER_DEFAULT_SETTINGS = {
|
|
28
|
+
usersTitle: 'Select User(s)',
|
|
29
|
+
groupsTitle: 'Select Group(s)',
|
|
30
|
+
displayMultiSelectInstructions: true,
|
|
31
|
+
displayHideUnselectedToggle: true,
|
|
32
|
+
displaySelectedCount: true,
|
|
33
|
+
filterMode: 'Global',
|
|
34
|
+
groupable: true,
|
|
35
|
+
sortable: true,
|
|
36
|
+
pageable: false,
|
|
37
|
+
pageSize: 150,
|
|
38
|
+
height: 600,
|
|
39
|
+
additionalWidth: 500,
|
|
40
|
+
displayPhotos: true,
|
|
41
|
+
photoColumnWidth: 40,
|
|
42
|
+
returnType: 'AccountName',
|
|
43
|
+
cancelReturnValue: 'cancel',
|
|
44
|
+
okButtonText: 'Ok',
|
|
45
|
+
cancelButtonText: 'Cancel',
|
|
46
|
+
unselectButtonText: 'Unselect All',
|
|
47
|
+
emptyDataPullMode: 'Users',
|
|
48
|
+
selectionSettings: {
|
|
49
|
+
checkboxOnly: false,
|
|
50
|
+
mode: 'multiple',
|
|
51
|
+
enabled: true,
|
|
52
|
+
drag: true,
|
|
53
|
+
cell: false,
|
|
54
|
+
metaKeyMultiSelect: false
|
|
55
|
+
},
|
|
56
|
+
userColumns: [
|
|
57
|
+
{ field: 'employeeNumber', title: 'Emp #', width: 120, columnFilterable: true, globalFilterable: true, sortable: true, groupable: true, hidden: true },
|
|
58
|
+
{ field: 'displayName', title: 'Display Name', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: false },
|
|
59
|
+
{ field: 'department', title: 'Department', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: true },
|
|
60
|
+
{ field: 'title', title: 'Title', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: true },
|
|
61
|
+
{ field: 'telephoneNumber', title: 'Phone', width: 120, columnFilterable: true, globalFilterable: false, sortable: true, groupable: false },
|
|
62
|
+
{ field: 'sAMAccountName', title: 'Username', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: false, hidden: true }
|
|
63
|
+
],
|
|
64
|
+
groupColumns: [
|
|
65
|
+
{ field: 'name', title: 'Name', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: false },
|
|
66
|
+
{ field: 'sAMAccountName', title: 'Username', width: 200, columnFilterable: true, globalFilterable: true, sortable: true, groupable: false, hidden: false }
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
class UserChooserList {
|
|
71
|
+
#sp;
|
|
72
|
+
#debouncedFilter;
|
|
73
|
+
#filteredData;
|
|
74
|
+
#photosFromService$;
|
|
75
|
+
#resolvedPhotos;
|
|
76
|
+
#cdr;
|
|
77
|
+
constructor() {
|
|
78
|
+
this.#sp = inject(SharePointService);
|
|
79
|
+
this.grid = viewChild(GridComponent, /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []));
|
|
81
|
+
this.settings = input({
|
|
82
|
+
...USER_CHOOSER_DEFAULT_SETTINGS
|
|
83
|
+
}, /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
85
|
+
this.data = input([], /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
87
|
+
this.photoClass = input('user-chooser-photo', /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "photoClass" }] : /* istanbul ignore next */ []));
|
|
89
|
+
this.selectedAccountNames = model([], /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "selectedAccountNames" }] : /* istanbul ignore next */ []));
|
|
91
|
+
this.filter = input('', /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
93
|
+
this.#debouncedFilter = debounced(() => this.filter(), 300);
|
|
94
|
+
this.#filteredData = signal([], /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "#filteredData" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.hideUnselected = input(false, /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "hideUnselected" }] : /* istanbul ignore next */ []));
|
|
98
|
+
this.mode = computed(() => this.data().at(0)?.hasOwnProperty('givenName') ? 'users' : 'groups', /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
100
|
+
//#region Either passed in or pulled from the service
|
|
101
|
+
this.photos = input(/* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [undefined, { debugName: "photos" }] : /* istanbul ignore next */ []));
|
|
103
|
+
this.#photosFromService$ = toObservable(this.photos)
|
|
104
|
+
.pipe(switchMap(photos => {
|
|
105
|
+
if (photos) {
|
|
106
|
+
return of(photos);
|
|
107
|
+
}
|
|
108
|
+
return (this.data().at(0)?.hasOwnProperty('givenName'))
|
|
109
|
+
? this.#sp.getPhotos()
|
|
110
|
+
: of([]);
|
|
111
|
+
}));
|
|
112
|
+
this.#resolvedPhotos = toSignal(this.#photosFromService$, { initialValue: [] });
|
|
113
|
+
//#endregion Either passed in or pulled from the service
|
|
114
|
+
this.selectedCount = signal(0, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "selectedCount" }] : /* istanbul ignore next */ []));
|
|
116
|
+
this.gridData = computed(() => this.#debouncedFilter.value() ?
|
|
117
|
+
this.#filteredData() :
|
|
118
|
+
this.data()
|
|
119
|
+
.filter(data => !this.hideUnselected() ||
|
|
120
|
+
this.selectedAccountNames()
|
|
121
|
+
.some(item => item.toLowerCase() === data.sAMAccountName.toLowerCase())), /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "gridData" }] : /* istanbul ignore next */ []));
|
|
123
|
+
this.#cdr = inject(ChangeDetectorRef);
|
|
124
|
+
// Function to generate a case-insensitive key
|
|
125
|
+
this.caseInsensitiveSelectBy = (context) => {
|
|
126
|
+
// Convert to string and then to lowercase to ensure consistency.
|
|
127
|
+
return String(context.dataItem.sAMAccountName).toLowerCase();
|
|
128
|
+
};
|
|
129
|
+
effect(() => {
|
|
130
|
+
const filterableFields = this.settings().userColumns
|
|
131
|
+
.filter(c => c.globalFilterable ?? true)
|
|
132
|
+
.map(c => c.field)
|
|
133
|
+
?? [];
|
|
134
|
+
const filters = filterableFields.map(field => ({
|
|
135
|
+
field: field,
|
|
136
|
+
operator: 'contains',
|
|
137
|
+
value: this.#debouncedFilter.value()
|
|
138
|
+
}));
|
|
139
|
+
this.#filteredData.set(process(
|
|
140
|
+
//this.users(),
|
|
141
|
+
this.data(), {
|
|
142
|
+
filter: filters.length > 0 ? { logic: 'or', filters: filters } : undefined
|
|
143
|
+
})
|
|
144
|
+
.data
|
|
145
|
+
.filter(data => !this.hideUnselected() || this.selectedAccountNames().some(s => s.toLowerCase() === data.sAMAccountName.toLowerCase())));
|
|
146
|
+
});
|
|
147
|
+
afterNextRender(() => {
|
|
148
|
+
this.selectedCount.set(this.grid()?.selectionService.selected?.length ?? 0);
|
|
149
|
+
this.selectionChangeSubscription = this.grid()?.selectionService.changes.subscribe((event) => {
|
|
150
|
+
this.selectedCount.set(this.grid()?.selectionService.selected?.length ?? 0);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
ngOnDestroy() {
|
|
155
|
+
this.selectionChangeSubscription?.unsubscribe();
|
|
156
|
+
}
|
|
157
|
+
photo(user) {
|
|
158
|
+
return this.#resolvedPhotos()
|
|
159
|
+
.find(p => p.accountName?.toLowerCase() === user.sAMAccountName.toLowerCase())
|
|
160
|
+
?? null;
|
|
161
|
+
}
|
|
162
|
+
unselectAll() {
|
|
163
|
+
this.selectedAccountNames.set([]);
|
|
164
|
+
this.#cdr.detectChanges();
|
|
165
|
+
this.grid()?.selectionService.changes.emit({ selectedRows: [], deselectedRows: [], shiftKey: false, ctrlKey: false });
|
|
166
|
+
}
|
|
167
|
+
rowClassCallback(context) {
|
|
168
|
+
if (this.mode() === 'groups') {
|
|
169
|
+
return {
|
|
170
|
+
'disabled': false
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
// Return an object with the class name as key and a condition as value
|
|
174
|
+
return {
|
|
175
|
+
'disabled': !context.dataItem.enabled
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserChooserList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
179
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: UserChooserList, isStandalone: true, selector: "user-chooser-list", inputs: { settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, photoClass: { classPropertyName: "photoClass", publicName: "photoClass", isSignal: true, isRequired: false, transformFunction: null }, selectedAccountNames: { classPropertyName: "selectedAccountNames", publicName: "selectedAccountNames", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, hideUnselected: { classPropertyName: "hideUnselected", publicName: "hideUnselected", isSignal: true, isRequired: false, transformFunction: null }, photos: { classPropertyName: "photos", publicName: "photos", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedAccountNames: "selectedAccountNamesChange" }, viewQueries: [{ propertyName: "grid", first: true, predicate: GridComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<kendo-grid #grid [kendoGridBinding]=\"gridData()\"\r\n [rowClass]=\"rowClassCallback.bind(this)\"\r\n [filterable]=\"settings().filterMode === 'Column' || settings().filterMode === 'Both'\"\r\n [groupable]=\"settings().groupable!\"\r\n [sortable]=\"settings().sortable!\"\r\n [pageSize]=\"settings().pageable! ? settings().pageSize! : 0\"\r\n [pageable]=\"settings().pageable!\"\r\n [height]=\"settings().height!\"\r\n [selectable]=\"settings().selectionSettings!\"\r\n [kendoGridSelectBy]=\"caseInsensitiveSelectBy\"\r\n [(selectedKeys)]=\"selectedAccountNames\">\r\n \r\n <!-- Checkbox is we are in checkbox selection mode -->\r\n @if (settings().selectionSettings?.checkboxOnly ?? false) {\r\n <kendo-grid-column [width]=\"30\">\r\n <ng-template kendoGridCellTemplate let-rowIndex=\"rowIndex\">\r\n <kendo-checkbox [kendoGridSelectionCheckbox]=\"rowIndex\"></kendo-checkbox>\r\n </ng-template>\r\n </kendo-grid-column>\r\n }\r\n\r\n @if (mode() === 'users') {\r\n <!-- Optional user photo -->\r\n @if (settings().displayPhotos ?? false) {\r\n <kendo-grid-column [width]=\"settings().photoColumnWidth ?? 40\">\r\n <ng-template kendoGridCellTemplate let-dataItem>\r\n @if (photo(dataItem)) {\r\n <img [src]=\"photo(dataItem)!.encodedAbsUrl\" [ngClass]=\"photoClass()\" />\r\n }\r\n </ng-template>\r\n </kendo-grid-column>\r\n }\r\n \r\n <!-- Columns -->\r\n @for (column of settings().userColumns!; track column.field) {\r\n <kendo-grid-column [field]=\"column.field\" [title]=\"column.title\"\r\n [width]=\"column.width ?? 0\"\r\n [hidden]=\"column.hidden ?? false\"\r\n [filterable]=\"column.columnFilterable ?? true\"\r\n [sortable]=\"column.sortable ?? true\"\r\n [groupable]=\"column.groupable ?? true\" />\r\n }\r\n } @else if (mode() === 'groups') {\r\n <!-- Columns -->\r\n @for (column of settings().groupColumns!; track column.field) {\r\n <kendo-grid-column [field]=\"column.field\" [title]=\"column.title\"\r\n [width]=\"column.width ?? 0\"\r\n [hidden]=\"column.hidden ?? false\"\r\n [filterable]=\"column.columnFilterable ?? true\"\r\n [sortable]=\"column.sortable ?? true\"\r\n [groupable]=\"column.groupable ?? true\" />\r\n }\r\n }\r\n</kendo-grid>", styles: [".user-chooser-photo{width:2rem;height:2rem;border-radius:100%}.disabled{opacity:.5}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i1.GridComponent, selector: "kendo-grid", inputs: ["data", "pageSize", "height", "rowHeight", "adaptiveMode", "detailRowHeight", "skip", "scrollable", "selectable", "sort", "size", "trackBy", "filter", "group", "virtualColumns", "filterable", "sortable", "pageable", "groupable", "gridResizable", "rowReorderable", "navigable", "autoSize", "rowClass", "rowSticky", "rowSelected", "isRowSelectable", "cellSelected", "resizable", "reorderable", "loading", "columnMenu", "hideHeader", "showInactiveTools", "isDetailExpanded", "isGroupExpanded", "dataLayoutMode", "pinnable", "pinnedTopRows", "pinnedBottomRows", "isRowPinnable"], outputs: ["filterChange", "pageChange", "groupChange", "sortChange", "selectionChange", "rowReorder", "rowPinChange", "dataStateChange", "gridStateChange", "groupExpand", "groupCollapse", "detailExpand", "detailCollapse", "edit", "cancel", "save", "remove", "add", "cellClose", "cellClick", "pdfExport", "excelExport", "csvExport", "columnResize", "columnReorder", "columnVisibilityChange", "columnLockedChange", "columnStickyChange", "scrollBottom", "contentScroll"], exportAs: ["kendoGrid"] }, { kind: "directive", type: i1.DataBindingDirective, selector: "[kendoGridBinding]", inputs: ["skip", "sort", "filter", "pageSize", "group", "kendoGridBinding"], exportAs: ["kendoGridBinding"] }, { kind: "directive", type: i1.SelectionDirective, selector: "[kendoGridSelectBy]" }, { kind: "component", type: i1.ColumnComponent, selector: "kendo-grid-column", inputs: ["field", "format", "sortable", "groupable", "editor", "filter", "filterVariant", "filterable", "editable"] }, { kind: "directive", type: i1.FocusableDirective, selector: "[kendoGridFocusable], [kendoGridEditCommand], [kendoGridRemoveCommand], [kendoGridSaveCommand], [kendoGridCancelCommand], [kendoGridSelectionCheckbox] ", inputs: ["kendoGridFocusable"] }, { kind: "directive", type: i1.SelectionCheckboxDirective, selector: "[kendoGridSelectionCheckbox]", inputs: ["kendoGridSelectionCheckbox"] }, { kind: "directive", type: i1.CellTemplateDirective, selector: "[kendoGridCellTemplate]" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
180
|
+
}
|
|
181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserChooserList, decorators: [{
|
|
182
|
+
type: Component,
|
|
183
|
+
args: [{ selector: 'user-chooser-list', imports: [
|
|
184
|
+
NgClass,
|
|
185
|
+
KENDO_GRID
|
|
186
|
+
], encapsulation: ViewEncapsulation.None // Required for rowClassCallback
|
|
187
|
+
, template: "<kendo-grid #grid [kendoGridBinding]=\"gridData()\"\r\n [rowClass]=\"rowClassCallback.bind(this)\"\r\n [filterable]=\"settings().filterMode === 'Column' || settings().filterMode === 'Both'\"\r\n [groupable]=\"settings().groupable!\"\r\n [sortable]=\"settings().sortable!\"\r\n [pageSize]=\"settings().pageable! ? settings().pageSize! : 0\"\r\n [pageable]=\"settings().pageable!\"\r\n [height]=\"settings().height!\"\r\n [selectable]=\"settings().selectionSettings!\"\r\n [kendoGridSelectBy]=\"caseInsensitiveSelectBy\"\r\n [(selectedKeys)]=\"selectedAccountNames\">\r\n \r\n <!-- Checkbox is we are in checkbox selection mode -->\r\n @if (settings().selectionSettings?.checkboxOnly ?? false) {\r\n <kendo-grid-column [width]=\"30\">\r\n <ng-template kendoGridCellTemplate let-rowIndex=\"rowIndex\">\r\n <kendo-checkbox [kendoGridSelectionCheckbox]=\"rowIndex\"></kendo-checkbox>\r\n </ng-template>\r\n </kendo-grid-column>\r\n }\r\n\r\n @if (mode() === 'users') {\r\n <!-- Optional user photo -->\r\n @if (settings().displayPhotos ?? false) {\r\n <kendo-grid-column [width]=\"settings().photoColumnWidth ?? 40\">\r\n <ng-template kendoGridCellTemplate let-dataItem>\r\n @if (photo(dataItem)) {\r\n <img [src]=\"photo(dataItem)!.encodedAbsUrl\" [ngClass]=\"photoClass()\" />\r\n }\r\n </ng-template>\r\n </kendo-grid-column>\r\n }\r\n \r\n <!-- Columns -->\r\n @for (column of settings().userColumns!; track column.field) {\r\n <kendo-grid-column [field]=\"column.field\" [title]=\"column.title\"\r\n [width]=\"column.width ?? 0\"\r\n [hidden]=\"column.hidden ?? false\"\r\n [filterable]=\"column.columnFilterable ?? true\"\r\n [sortable]=\"column.sortable ?? true\"\r\n [groupable]=\"column.groupable ?? true\" />\r\n }\r\n } @else if (mode() === 'groups') {\r\n <!-- Columns -->\r\n @for (column of settings().groupColumns!; track column.field) {\r\n <kendo-grid-column [field]=\"column.field\" [title]=\"column.title\"\r\n [width]=\"column.width ?? 0\"\r\n [hidden]=\"column.hidden ?? false\"\r\n [filterable]=\"column.columnFilterable ?? true\"\r\n [sortable]=\"column.sortable ?? true\"\r\n [groupable]=\"column.groupable ?? true\" />\r\n }\r\n }\r\n</kendo-grid>", styles: [".user-chooser-photo{width:2rem;height:2rem;border-radius:100%}.disabled{opacity:.5}\n"] }]
|
|
188
|
+
}], ctorParameters: () => [], propDecorators: { grid: [{ type: i0.ViewChild, args: [i0.forwardRef(() => GridComponent), { isSignal: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], photoClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "photoClass", required: false }] }], selectedAccountNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedAccountNames", required: false }] }, { type: i0.Output, args: ["selectedAccountNamesChange"] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], hideUnselected: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideUnselected", required: false }] }], photos: [{ type: i0.Input, args: [{ isSignal: true, alias: "photos", required: false }] }] } });
|
|
189
|
+
|
|
190
|
+
class UserChooserDialogComponent {
|
|
191
|
+
constructor() {
|
|
192
|
+
this.#services = {
|
|
193
|
+
ad: inject(ActiveDirectoryService),
|
|
194
|
+
sp: inject(SharePointService)
|
|
195
|
+
};
|
|
196
|
+
this.userChooserList = viewChild('userChooserList', /* @ts-ignore */
|
|
197
|
+
...(ngDevMode ? [{ debugName: "userChooserList" }] : /* istanbul ignore next */ []));
|
|
198
|
+
this.groupChooserList = viewChild('groupChooserList', /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "groupChooserList" }] : /* istanbul ignore next */ []));
|
|
200
|
+
this.settings = input({
|
|
201
|
+
...USER_CHOOSER_DEFAULT_SETTINGS
|
|
202
|
+
}, /* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
204
|
+
//#region Either passed in or pulled from the service
|
|
205
|
+
this.users = input(/* @ts-ignore */
|
|
206
|
+
...(ngDevMode ? [undefined, { debugName: "users" }] : /* istanbul ignore next */ []));
|
|
207
|
+
this.#usersFromService$ = toObservable(this.users)
|
|
208
|
+
.pipe(switchMap(users => {
|
|
209
|
+
if (users) {
|
|
210
|
+
return of(users);
|
|
211
|
+
}
|
|
212
|
+
return (this.settings().emptyDataPullMode === 'All' || this.settings().emptyDataPullMode === 'Users')
|
|
213
|
+
? this.#services.ad.getUsers('NgxLibUserChooser')
|
|
214
|
+
: of([]);
|
|
215
|
+
}));
|
|
216
|
+
this.resolvedUsers = toSignal(this.#usersFromService$, { initialValue: [] });
|
|
217
|
+
this.groups = input(/* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [undefined, { debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
219
|
+
this.#groupsFromService$ = toObservable(this.groups)
|
|
220
|
+
.pipe(switchMap(groups => {
|
|
221
|
+
if (groups) {
|
|
222
|
+
return of(groups);
|
|
223
|
+
}
|
|
224
|
+
return (this.settings().emptyDataPullMode === 'All' || this.settings().emptyDataPullMode === 'Groups')
|
|
225
|
+
? this.#services.ad.getGroups('NgxLibUserChooser')
|
|
226
|
+
: of([]);
|
|
227
|
+
}));
|
|
228
|
+
this.resolvedGroups = toSignal(this.#groupsFromService$, { initialValue: [] });
|
|
229
|
+
this.photos = input(/* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [undefined, { debugName: "photos" }] : /* istanbul ignore next */ []));
|
|
231
|
+
this.#photosFromService$ = toObservable(this.photos)
|
|
232
|
+
.pipe(switchMap(photos => {
|
|
233
|
+
if (photos) {
|
|
234
|
+
return of(photos);
|
|
235
|
+
}
|
|
236
|
+
return (this.settings().emptyDataPullMode === 'All' || this.settings().emptyDataPullMode === 'Users')
|
|
237
|
+
? this.#services.sp.getPhotos()
|
|
238
|
+
: of([]);
|
|
239
|
+
}));
|
|
240
|
+
this.resolvedPhotos = toSignal(this.#photosFromService$, { initialValue: [] });
|
|
241
|
+
//#endregion Either passed in or pulled from the service
|
|
242
|
+
this.photoClass = input('user-chooser-photo', /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "photoClass" }] : /* istanbul ignore next */ []));
|
|
244
|
+
this.selectedUsers = model([], /* @ts-ignore */
|
|
245
|
+
...(ngDevMode ? [{ debugName: "selectedUsers" }] : /* istanbul ignore next */ []));
|
|
246
|
+
this.selectedGroups = model([], /* @ts-ignore */
|
|
247
|
+
...(ngDevMode ? [{ debugName: "selectedGroups" }] : /* istanbul ignore next */ []));
|
|
248
|
+
this.hideUnselected = signal(false, /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "hideUnselected" }] : /* istanbul ignore next */ []));
|
|
250
|
+
this.returnValue = computed(() => {
|
|
251
|
+
const users = this.settings().returnType === 'Object' ?
|
|
252
|
+
// User objects
|
|
253
|
+
this.resolvedUsers().filter(u => this.selectedUsers().some(s => s.toLowerCase() === u.sAMAccountName.toLowerCase())) :
|
|
254
|
+
// Account names - reject any invalid account names that may have been passed in
|
|
255
|
+
this.resolvedUsers().filter(u => this.selectedUsers().some(s => s.toLowerCase() === u.sAMAccountName.toLowerCase())).map(u => u.sAMAccountName.toLowerCase());
|
|
256
|
+
const groups = this.settings().returnType === 'Object' ?
|
|
257
|
+
// Group objects
|
|
258
|
+
this.resolvedGroups().filter(u => this.selectedGroups().some(s => s.toLowerCase() === u.sAMAccountName.toLowerCase())) :
|
|
259
|
+
// Account names - reject any invalid account names that may have been passed in
|
|
260
|
+
this.resolvedGroups().filter(u => this.selectedGroups().some(s => s.toLowerCase() === u.sAMAccountName.toLowerCase())).map(u => u.sAMAccountName.toLowerCase());
|
|
261
|
+
const validUsers = [
|
|
262
|
+
...(this.settings().returnType === 'Object' ?
|
|
263
|
+
users.map(u => u.sAMAccountName.toLowerCase()) :
|
|
264
|
+
users)
|
|
265
|
+
];
|
|
266
|
+
const invalidUsers = this.selectedUsers().filter(s => !validUsers.some(u => u.toLowerCase() === s.toLowerCase()));
|
|
267
|
+
const validGroups = [
|
|
268
|
+
...(this.settings().returnType === 'Object' ?
|
|
269
|
+
groups.map(u => u.sAMAccountName.toLowerCase()) :
|
|
270
|
+
groups)
|
|
271
|
+
];
|
|
272
|
+
const invalidGroups = this.selectedGroups().filter(s => !validGroups.some(u => u.toLowerCase() === s.toLowerCase()));
|
|
273
|
+
return { users, groups, invalidUsers, invalidGroups };
|
|
274
|
+
}, /* @ts-ignore */
|
|
275
|
+
...(ngDevMode ? [{ debugName: "returnValue" }] : /* istanbul ignore next */ []));
|
|
276
|
+
this.multiSelectInstructions = computed(() => {
|
|
277
|
+
if (!this.settings().displayMultiSelectInstructions) {
|
|
278
|
+
return '';
|
|
279
|
+
}
|
|
280
|
+
const instructions = [];
|
|
281
|
+
if (this.settings().selectionSettings?.mode === 'multiple' && this.settings().selectionSettings?.metaKeyMultiSelect) {
|
|
282
|
+
instructions.push('<span class="bold">[CTRL/SHIFT + Click]</span>');
|
|
283
|
+
}
|
|
284
|
+
if (this.settings().selectionSettings?.drag) {
|
|
285
|
+
instructions.push('<span class="bold">[Click and drag]</span>');
|
|
286
|
+
}
|
|
287
|
+
if (instructions.length === 0) {
|
|
288
|
+
return '';
|
|
289
|
+
}
|
|
290
|
+
return `${instructions.join(' or ')} to select multiple`;
|
|
291
|
+
}, /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "multiSelectInstructions" }] : /* istanbul ignore next */ []));
|
|
293
|
+
this.close = output();
|
|
294
|
+
this.filter = signal('', /* @ts-ignore */
|
|
295
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
296
|
+
this.filterClearIcon = filterClearIcon;
|
|
297
|
+
this.dialogWidth = computed(() => this.settings().userColumns
|
|
298
|
+
.filter(c => !c.hidden)
|
|
299
|
+
.reduce((total, column) => total + (column.width ?? 0), 0)
|
|
300
|
+
+ (this.settings().additionalWidth ?? 0), /* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "dialogWidth" }] : /* istanbul ignore next */ []));
|
|
302
|
+
this.selectedTabIndex = signal(0, /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "selectedTabIndex" }] : /* istanbul ignore next */ []));
|
|
304
|
+
this.mode = computed(() => this.resolvedUsers().length > 0 && this.resolvedGroups().length > 0 ? 'tabs' : 'standalone', /* @ts-ignore */
|
|
305
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
306
|
+
this.title = computed(() => {
|
|
307
|
+
return ((this.mode() === 'tabs' && this.selectedTabIndex() === 0) ||
|
|
308
|
+
(this.mode() === 'standalone' && this.resolvedUsers().length > 0)) ?
|
|
309
|
+
this.settings().usersTitle ?? 'Select User(s)' :
|
|
310
|
+
this.settings().groupsTitle ?? 'Select Group(s)';
|
|
311
|
+
}, /* @ts-ignore */
|
|
312
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
313
|
+
}
|
|
314
|
+
#services;
|
|
315
|
+
#usersFromService$;
|
|
316
|
+
#groupsFromService$;
|
|
317
|
+
#photosFromService$;
|
|
318
|
+
unselectAll() {
|
|
319
|
+
const list = this.selectedTabIndex() === 0 ?
|
|
320
|
+
this.userChooserList :
|
|
321
|
+
this.groupChooserList;
|
|
322
|
+
list()?.unselectAll();
|
|
323
|
+
}
|
|
324
|
+
onTabSelect(e) {
|
|
325
|
+
this.selectedTabIndex.set(e.index);
|
|
326
|
+
}
|
|
327
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserChooserDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
328
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: UserChooserDialogComponent, isStandalone: true, selector: "user-chooser-dialog", inputs: { settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null }, users: { classPropertyName: "users", publicName: "users", isSignal: true, isRequired: false, transformFunction: null }, groups: { classPropertyName: "groups", publicName: "groups", isSignal: true, isRequired: false, transformFunction: null }, photos: { classPropertyName: "photos", publicName: "photos", isSignal: true, isRequired: false, transformFunction: null }, photoClass: { classPropertyName: "photoClass", publicName: "photoClass", isSignal: true, isRequired: false, transformFunction: null }, selectedUsers: { classPropertyName: "selectedUsers", publicName: "selectedUsers", isSignal: true, isRequired: false, transformFunction: null }, selectedGroups: { classPropertyName: "selectedGroups", publicName: "selectedGroups", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedUsers: "selectedUsersChange", selectedGroups: "selectedGroupsChange", close: "close" }, viewQueries: [{ propertyName: "userChooserList", first: true, predicate: ["userChooserList"], descendants: true, isSignal: true }, { propertyName: "groupChooserList", first: true, predicate: ["groupChooserList"], descendants: true, isSignal: true }], ngImport: i0, template: "<kendo-dialog [width]=\"dialogWidth()\" (close)=\"close.emit('cancel')\">\r\n <!-- Title -->\r\n <kendo-dialog-titlebar>\r\n <div id=\"title\" class=\"bold\">\r\n {{ title() }}\r\n </div>\r\n @if (multiSelectInstructions()) {\r\n <div id=\"multi-select-instructions\" [innerHTML]=\"multiSelectInstructions()\">\r\n </div>\r\n }\r\n </kendo-dialog-titlebar>\r\n\r\n <!-- Global filter -->\r\n @if (settings().filterMode === 'Global' || settings().filterMode === 'Both') {\r\n <kendo-textbox id=\"filter\" [(value)]=\"filter\" placeholder=\"Type here to filter employee list...\">\r\n @if (filter()) {\r\n <ng-template kendoTextBoxSuffixTemplate>\r\n <kendo-svgicon [icon]=\"filterClearIcon\" class=\"clear-filter\" (click)=\"filter.set('')\" />\r\n </ng-template>\r\n }\r\n </kendo-textbox>\r\n }\r\n\r\n @if (resolvedUsers().length > 0 && resolvedGroups().length > 0) {\r\n <!-- Groups AND Users, so we need tabs -->\r\n <kendo-tabstrip [keepTabContent]=\"true\" (tabSelect)=\"onTabSelect($event)\">\r\n <!-- Users tab -->\r\n <kendo-tabstrip-tab title=\"Users\" [selected]=\"true\" #usersTab>\r\n <ng-template kendoTabContent>\r\n <user-chooser-list #userChooserList [data]=\"resolvedUsers()\" [photos]=\"resolvedPhotos()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedUsers\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\" />\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <!-- Groups tab -->\r\n <kendo-tabstrip-tab title=\"Groups\" #groupsTab>\r\n <ng-template kendoTabContent>\r\n <user-chooser-list #groupChooserList [data]=\"resolvedGroups()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedGroups\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\" />\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n }\r\n @else if (resolvedUsers().length > 0) {\r\n <!-- Users only -->\r\n <user-chooser-list #userChooserList [data]=\"resolvedUsers()\" [photos]=\"resolvedPhotos()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedUsers\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\"\r\n /> <!-- (selectedCountChange)=\"selectedUsersCount.set($event)\" -->\r\n }\r\n @else if (resolvedGroups().length > 0) {\r\n <!-- Groups only -->\r\n <user-chooser-list #groupChooserList [data]=\"resolvedGroups()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedGroups\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\"\r\n /> <!-- (selectedCountChange)=\"selectedGroupsCount.set($event)\" -->\r\n }\r\n\r\n <kendo-dialog-actions>\r\n <!-- Hide unselected toggle -->\r\n <div id=\"hide-toggle\">\r\n @if (\r\n settings().displayHideUnselectedToggle &&\r\n (selectedUsers().length > 0 || selectedGroups().length > 0))\r\n {\r\n <kendo-label [for]=\"hideunselected\">Hide Unselected </kendo-label>\r\n <kendo-switch #hideunselected (valueChange)=\"hideUnselected.set($event)\" onLabel=\"'Yes'\" offLabel=\"'No'\" />\r\n }\r\n </div>\r\n\r\n <!-- Selected user count -->\r\n <div id=\"selected-count\">\r\n @if (settings().displaySelectedCount) {\r\n @if (resolvedUsers().length > 0 && resolvedGroups().length > 0) {\r\n {{ userChooserList()?.selectedCount() }} user(s), {{ groupChooserList()?.selectedCount() }} group(s) selected\r\n\r\n }\r\n @else if (resolvedUsers().length > 0) {\r\n {{ userChooserList()?.selectedCount() }} user(s) selected\r\n }\r\n @else if (resolvedGroups().length > 0) {\r\n {{ groupChooserList()?.selectedCount() }} group(s) selected\r\n }\r\n }\r\n </div>\r\n\r\n <div id=\"buttons\">\r\n <!-- Unselect All button -->\r\n @if (\r\n (selectedTabIndex() === 0 && selectedUsers().length > 0) ||\r\n (selectedTabIndex() === 1 && selectedGroups().length > 0))\r\n {\r\n <button kendoButton (click)=\"unselectAll()\">\r\n {{ settings().unselectButtonText ?? 'Unselect All' }}\r\n </button>\r\n }\r\n \r\n <!-- Cancel button -->\r\n <button kendoButton\r\n (click)=\"close.emit(settings().cancelReturnValue)\">\r\n\r\n {{ settings().cancelButtonText ?? 'Cancel' }}\r\n </button>\r\n\r\n <!-- Ok button -->\r\n <button kendoButton themeColor=\"primary\"\r\n [disabled]=\"selectedUsers().length === 0 && selectedGroups().length === 0\"\r\n (click)=\"close.emit(returnValue())\">\r\n\r\n {{ settings().okButtonText ?? 'Ok' }}\r\n </button>\r\n </div>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>", styles: ["::ng-deep .k-dialog-title,.k-window-title{display:flex;justify-content:space-between}::ng-deep .k-dialog-title .bold,.k-window-title .bold{font-weight:700}::ng-deep .k-dialog-title #multi-select-instructions,.k-window-title #multi-select-instructions{opacity:.5}#filter{margin-bottom:1rem}#filter .clear-filter{cursor:pointer}.k-dialog-actions,.k-window-actions,.k-actions{display:flex;justify-content:space-between}.k-dialog-actions>#selected-count,.k-window-actions>#selected-count,.k-actions>#selected-count{text-align:center}.k-dialog-actions>#buttons,.k-window-actions>#buttons,.k-actions>#buttons{display:grid;grid-auto-flow:column;justify-content:end;gap:1rem}.k-dialog-actions>#buttons button,.k-window-actions>#buttons button,.k-actions>#buttons button{min-width:5rem}\n"], dependencies: [{ kind: "component", type: i1$1.DialogComponent, selector: "kendo-dialog", inputs: ["actions", "actionsLayout", "autoFocusedElement", "closable", "title", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "animation"], outputs: ["action", "close"], exportAs: ["kendoDialog"] }, { kind: "component", type: i1$1.DialogTitleBarComponent, selector: "kendo-dialog-titlebar", inputs: ["id", "closeTitle", "closable"], outputs: ["close"] }, { kind: "component", type: i1$1.DialogActionsComponent, selector: "kendo-dialog-actions", inputs: ["actions", "layout"], outputs: ["action"] }, { kind: "component", type: i2.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconPosition", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: i3.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: i3.TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: i3.SwitchComponent, selector: "kendo-switch", inputs: ["focusableId", "onLabel", "offLabel", "checked", "disabled", "readonly", "tabindex", "size", "thumbRounded", "trackRounded", "tabIndex"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoSwitch"] }, { kind: "component", type: i4.LabelComponent, selector: "kendo-label", inputs: ["text", "for", "optional", "labelCssStyle", "labelCssClass"], exportAs: ["kendoLabel"] }, { kind: "component", type: i5.TabStripComponent, selector: "kendo-tabstrip", inputs: ["height", "animate", "tabAlignment", "tabPosition", "keepTabContent", "closable", "scrollable", "size", "closeIcon", "closeIconClass", "closeSVGIcon", "showContentArea"], outputs: ["tabSelect", "tabClose", "tabScroll"], exportAs: ["kendoTabStrip"] }, { kind: "component", type: i5.TabStripTabComponent, selector: "kendo-tabstrip-tab", inputs: ["title", "disabled", "cssClass", "cssStyle", "selected", "closable", "closeIcon", "closeIconClass", "closeSVGIcon"], exportAs: ["kendoTabStripTab"] }, { kind: "directive", type: i5.TabContentDirective, selector: "[kendoTabContent]" }, { kind: "component", type: i6.SVGIconComponent, selector: "kendo-svg-icon, kendo-svgicon", inputs: ["icon", "variant"], exportAs: ["kendoSVGIcon"] }, { kind: "component", type: UserChooserList, selector: "user-chooser-list", inputs: ["settings", "data", "photoClass", "selectedAccountNames", "filter", "hideUnselected", "photos"], outputs: ["selectedAccountNamesChange"] }] }); }
|
|
329
|
+
}
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserChooserDialogComponent, decorators: [{
|
|
331
|
+
type: Component,
|
|
332
|
+
args: [{ selector: 'user-chooser-dialog', imports: [
|
|
333
|
+
KENDO_DIALOGS,
|
|
334
|
+
KENDO_BUTTONS,
|
|
335
|
+
KENDO_INPUTS,
|
|
336
|
+
KENDO_LABELS,
|
|
337
|
+
KENDO_TABSTRIP,
|
|
338
|
+
KENDO_ICONS,
|
|
339
|
+
UserChooserList
|
|
340
|
+
], template: "<kendo-dialog [width]=\"dialogWidth()\" (close)=\"close.emit('cancel')\">\r\n <!-- Title -->\r\n <kendo-dialog-titlebar>\r\n <div id=\"title\" class=\"bold\">\r\n {{ title() }}\r\n </div>\r\n @if (multiSelectInstructions()) {\r\n <div id=\"multi-select-instructions\" [innerHTML]=\"multiSelectInstructions()\">\r\n </div>\r\n }\r\n </kendo-dialog-titlebar>\r\n\r\n <!-- Global filter -->\r\n @if (settings().filterMode === 'Global' || settings().filterMode === 'Both') {\r\n <kendo-textbox id=\"filter\" [(value)]=\"filter\" placeholder=\"Type here to filter employee list...\">\r\n @if (filter()) {\r\n <ng-template kendoTextBoxSuffixTemplate>\r\n <kendo-svgicon [icon]=\"filterClearIcon\" class=\"clear-filter\" (click)=\"filter.set('')\" />\r\n </ng-template>\r\n }\r\n </kendo-textbox>\r\n }\r\n\r\n @if (resolvedUsers().length > 0 && resolvedGroups().length > 0) {\r\n <!-- Groups AND Users, so we need tabs -->\r\n <kendo-tabstrip [keepTabContent]=\"true\" (tabSelect)=\"onTabSelect($event)\">\r\n <!-- Users tab -->\r\n <kendo-tabstrip-tab title=\"Users\" [selected]=\"true\" #usersTab>\r\n <ng-template kendoTabContent>\r\n <user-chooser-list #userChooserList [data]=\"resolvedUsers()\" [photos]=\"resolvedPhotos()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedUsers\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\" />\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <!-- Groups tab -->\r\n <kendo-tabstrip-tab title=\"Groups\" #groupsTab>\r\n <ng-template kendoTabContent>\r\n <user-chooser-list #groupChooserList [data]=\"resolvedGroups()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedGroups\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\" />\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n }\r\n @else if (resolvedUsers().length > 0) {\r\n <!-- Users only -->\r\n <user-chooser-list #userChooserList [data]=\"resolvedUsers()\" [photos]=\"resolvedPhotos()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedUsers\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\"\r\n /> <!-- (selectedCountChange)=\"selectedUsersCount.set($event)\" -->\r\n }\r\n @else if (resolvedGroups().length > 0) {\r\n <!-- Groups only -->\r\n <user-chooser-list #groupChooserList [data]=\"resolvedGroups()\" [settings]=\"settings()\"\r\n [photoClass]=\"photoClass()\"\r\n [(selectedAccountNames)]=\"selectedGroups\"\r\n [hideUnselected]=\"hideUnselected()\"\r\n [filter]=\"filter()\"\r\n /> <!-- (selectedCountChange)=\"selectedGroupsCount.set($event)\" -->\r\n }\r\n\r\n <kendo-dialog-actions>\r\n <!-- Hide unselected toggle -->\r\n <div id=\"hide-toggle\">\r\n @if (\r\n settings().displayHideUnselectedToggle &&\r\n (selectedUsers().length > 0 || selectedGroups().length > 0))\r\n {\r\n <kendo-label [for]=\"hideunselected\">Hide Unselected </kendo-label>\r\n <kendo-switch #hideunselected (valueChange)=\"hideUnselected.set($event)\" onLabel=\"'Yes'\" offLabel=\"'No'\" />\r\n }\r\n </div>\r\n\r\n <!-- Selected user count -->\r\n <div id=\"selected-count\">\r\n @if (settings().displaySelectedCount) {\r\n @if (resolvedUsers().length > 0 && resolvedGroups().length > 0) {\r\n {{ userChooserList()?.selectedCount() }} user(s), {{ groupChooserList()?.selectedCount() }} group(s) selected\r\n\r\n }\r\n @else if (resolvedUsers().length > 0) {\r\n {{ userChooserList()?.selectedCount() }} user(s) selected\r\n }\r\n @else if (resolvedGroups().length > 0) {\r\n {{ groupChooserList()?.selectedCount() }} group(s) selected\r\n }\r\n }\r\n </div>\r\n\r\n <div id=\"buttons\">\r\n <!-- Unselect All button -->\r\n @if (\r\n (selectedTabIndex() === 0 && selectedUsers().length > 0) ||\r\n (selectedTabIndex() === 1 && selectedGroups().length > 0))\r\n {\r\n <button kendoButton (click)=\"unselectAll()\">\r\n {{ settings().unselectButtonText ?? 'Unselect All' }}\r\n </button>\r\n }\r\n \r\n <!-- Cancel button -->\r\n <button kendoButton\r\n (click)=\"close.emit(settings().cancelReturnValue)\">\r\n\r\n {{ settings().cancelButtonText ?? 'Cancel' }}\r\n </button>\r\n\r\n <!-- Ok button -->\r\n <button kendoButton themeColor=\"primary\"\r\n [disabled]=\"selectedUsers().length === 0 && selectedGroups().length === 0\"\r\n (click)=\"close.emit(returnValue())\">\r\n\r\n {{ settings().okButtonText ?? 'Ok' }}\r\n </button>\r\n </div>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>", styles: ["::ng-deep .k-dialog-title,.k-window-title{display:flex;justify-content:space-between}::ng-deep .k-dialog-title .bold,.k-window-title .bold{font-weight:700}::ng-deep .k-dialog-title #multi-select-instructions,.k-window-title #multi-select-instructions{opacity:.5}#filter{margin-bottom:1rem}#filter .clear-filter{cursor:pointer}.k-dialog-actions,.k-window-actions,.k-actions{display:flex;justify-content:space-between}.k-dialog-actions>#selected-count,.k-window-actions>#selected-count,.k-actions>#selected-count{text-align:center}.k-dialog-actions>#buttons,.k-window-actions>#buttons,.k-actions>#buttons{display:grid;grid-auto-flow:column;justify-content:end;gap:1rem}.k-dialog-actions>#buttons button,.k-window-actions>#buttons button,.k-actions>#buttons button{min-width:5rem}\n"] }]
|
|
341
|
+
}], propDecorators: { userChooserList: [{ type: i0.ViewChild, args: ['userChooserList', { isSignal: true }] }], groupChooserList: [{ type: i0.ViewChild, args: ['groupChooserList', { isSignal: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: false }] }], users: [{ type: i0.Input, args: [{ isSignal: true, alias: "users", required: false }] }], groups: [{ type: i0.Input, args: [{ isSignal: true, alias: "groups", required: false }] }], photos: [{ type: i0.Input, args: [{ isSignal: true, alias: "photos", required: false }] }], photoClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "photoClass", required: false }] }], selectedUsers: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedUsers", required: false }] }, { type: i0.Output, args: ["selectedUsersChange"] }], selectedGroups: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedGroups", required: false }] }, { type: i0.Output, args: ["selectedGroupsChange"] }], close: [{ type: i0.Output, args: ["close"] }] } });
|
|
342
|
+
|
|
343
|
+
class UserFieldComponent {
|
|
344
|
+
constructor() {
|
|
345
|
+
this.#services = {
|
|
346
|
+
ad: inject(ActiveDirectoryService),
|
|
347
|
+
sp: inject(SharePointService)
|
|
348
|
+
};
|
|
349
|
+
this.icons = {
|
|
350
|
+
user: userIcon,
|
|
351
|
+
group: usersIcon,
|
|
352
|
+
unknown: questionCircleIcon
|
|
353
|
+
};
|
|
354
|
+
this.rejectedInvalidAccountNames = output();
|
|
355
|
+
this.showUserChooser = signal(false, /* @ts-ignore */
|
|
356
|
+
...(ngDevMode ? [{ debugName: "showUserChooser" }] : /* istanbul ignore next */ [])); // Controls the visibility of the user chooser dialog
|
|
357
|
+
//#region Inputs
|
|
358
|
+
this.userAccountNames = model([], /* @ts-ignore */
|
|
359
|
+
...(ngDevMode ? [{ debugName: "userAccountNames" }] : /* istanbul ignore next */ []));
|
|
360
|
+
this.groupAccountNames = model([], /* @ts-ignore */
|
|
361
|
+
...(ngDevMode ? [{ debugName: "groupAccountNames" }] : /* istanbul ignore next */ []));
|
|
362
|
+
//#region Either passed in or pulled from the service
|
|
363
|
+
this.users = input(/* @ts-ignore */
|
|
364
|
+
...(ngDevMode ? [undefined, { debugName: "users" }] : /* istanbul ignore next */ []));
|
|
365
|
+
this.#usersFromService$ = toObservable(this.users)
|
|
366
|
+
.pipe(switchMap(users => {
|
|
367
|
+
if (users) {
|
|
368
|
+
return of(users);
|
|
369
|
+
}
|
|
370
|
+
return (this.userChooserSettings().emptyDataPullMode === 'All' || this.userChooserSettings().emptyDataPullMode === 'Users')
|
|
371
|
+
? this.#services.ad.getUsers('NgxLibUserChooser')
|
|
372
|
+
: of([]);
|
|
373
|
+
}));
|
|
374
|
+
this.resolvedUsers = toSignal(this.#usersFromService$, { initialValue: [] });
|
|
375
|
+
this.groups = input(/* @ts-ignore */
|
|
376
|
+
...(ngDevMode ? [undefined, { debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
377
|
+
this.#groupsFromService$ = toObservable(this.groups)
|
|
378
|
+
.pipe(switchMap(groups => {
|
|
379
|
+
if (groups) {
|
|
380
|
+
return of(groups);
|
|
381
|
+
}
|
|
382
|
+
return (this.userChooserSettings().emptyDataPullMode === 'All' || this.userChooserSettings().emptyDataPullMode === 'Groups')
|
|
383
|
+
? this.#services.ad.getGroups('NgxLibUserChooser')
|
|
384
|
+
: of([]);
|
|
385
|
+
}));
|
|
386
|
+
this.resolvedGroups = toSignal(this.#groupsFromService$, { initialValue: [] });
|
|
387
|
+
this.photos = input(/* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [undefined, { debugName: "photos" }] : /* istanbul ignore next */ []));
|
|
389
|
+
this.#photosFromService$ = toObservable(this.photos)
|
|
390
|
+
.pipe(switchMap(photos => {
|
|
391
|
+
if (photos) {
|
|
392
|
+
return of(photos);
|
|
393
|
+
}
|
|
394
|
+
return (this.displayPhoto())
|
|
395
|
+
? this.#services.sp.getPhotos()
|
|
396
|
+
: of([]);
|
|
397
|
+
}));
|
|
398
|
+
this.resolvedPhotos = toSignal(this.#photosFromService$, { initialValue: [] });
|
|
399
|
+
//#endregion Either passed in or pulled from the service
|
|
400
|
+
this.maxItemsToDisplay = input(5, /* @ts-ignore */
|
|
401
|
+
...(ngDevMode ? [{ debugName: "maxItemsToDisplay" }] : /* istanbul ignore next */ []));
|
|
402
|
+
this.groupItemsOverMax = input(false, /* @ts-ignore */
|
|
403
|
+
...(ngDevMode ? [{ debugName: "groupItemsOverMax" }] : /* istanbul ignore next */ []));
|
|
404
|
+
this.groupItemsOverMaxText = input('users/groups', /* @ts-ignore */
|
|
405
|
+
...(ngDevMode ? [{ debugName: "groupItemsOverMaxText" }] : /* istanbul ignore next */ []));
|
|
406
|
+
this.ignoreInvalidAccountNames = input(false, /* @ts-ignore */
|
|
407
|
+
...(ngDevMode ? [{ debugName: "ignoreInvalidAccountNames" }] : /* istanbul ignore next */ []));
|
|
408
|
+
this.displayType = input('PhotoAndDisplayName', /* @ts-ignore */
|
|
409
|
+
...(ngDevMode ? [{ debugName: "displayType" }] : /* istanbul ignore next */ []));
|
|
410
|
+
this.emptyUserNameText = input('Select user...', /* @ts-ignore */
|
|
411
|
+
...(ngDevMode ? [{ debugName: "emptyUserNameText" }] : /* istanbul ignore next */ []));
|
|
412
|
+
this.enableUserChooser = input(true, /* @ts-ignore */
|
|
413
|
+
...(ngDevMode ? [{ debugName: "enableUserChooser" }] : /* istanbul ignore next */ []));
|
|
414
|
+
//userChooserUsers = input<CleavelandPriceUser[]>([]);
|
|
415
|
+
//userChooserGroups = input<Group[]>([]);
|
|
416
|
+
this.userChooserSettings = input({
|
|
417
|
+
...USER_CHOOSER_DEFAULT_SETTINGS
|
|
418
|
+
}, /* @ts-ignore */
|
|
419
|
+
...(ngDevMode ? [{ debugName: "userChooserSettings" }] : /* istanbul ignore next */ []));
|
|
420
|
+
//#region CSS Classes
|
|
421
|
+
this.wrapperClass = input('wrapper', /* @ts-ignore */
|
|
422
|
+
...(ngDevMode ? [{ debugName: "wrapperClass" }] : /* istanbul ignore next */ []));
|
|
423
|
+
this.emptyUserNameClass = input('empty-user', /* @ts-ignore */
|
|
424
|
+
...(ngDevMode ? [{ debugName: "emptyUserNameClass" }] : /* istanbul ignore next */ []));
|
|
425
|
+
this.validUserTextClass = input('valid-user', /* @ts-ignore */
|
|
426
|
+
...(ngDevMode ? [{ debugName: "validUserTextClass" }] : /* istanbul ignore next */ []));
|
|
427
|
+
this.manySelectedClass = input('many-selected', /* @ts-ignore */
|
|
428
|
+
...(ngDevMode ? [{ debugName: "manySelectedClass" }] : /* istanbul ignore next */ []));
|
|
429
|
+
this.invalidUserTextClass = input('invalid-user', /* @ts-ignore */
|
|
430
|
+
...(ngDevMode ? [{ debugName: "invalidUserTextClass" }] : /* istanbul ignore next */ []));
|
|
431
|
+
this.photoClass = input('user-photo', /* @ts-ignore */
|
|
432
|
+
...(ngDevMode ? [{ debugName: "photoClass" }] : /* istanbul ignore next */ []));
|
|
433
|
+
this.userChooserPhotoClass = input('user-chooser-photo', /* @ts-ignore */
|
|
434
|
+
...(ngDevMode ? [{ debugName: "userChooserPhotoClass" }] : /* istanbul ignore next */ []));
|
|
435
|
+
this.userChooserEnabledClass = input('user-chooser-enabled', /* @ts-ignore */
|
|
436
|
+
...(ngDevMode ? [{ debugName: "userChooserEnabledClass" }] : /* istanbul ignore next */ []));
|
|
437
|
+
this.userChooserDisabledClass = input('user-chooser-disabled', /* @ts-ignore */
|
|
438
|
+
...(ngDevMode ? [{ debugName: "userChooserDisabledClass" }] : /* istanbul ignore next */ []));
|
|
439
|
+
//#endregion CSS Classes
|
|
440
|
+
//#endregion Inputs
|
|
441
|
+
//#region Computed Properties
|
|
442
|
+
this.totalItemCount = computed(() => this.userObjects().length + this.groupObjects().length, /* @ts-ignore */
|
|
443
|
+
...(ngDevMode ? [{ debugName: "totalItemCount" }] : /* istanbul ignore next */ []));
|
|
444
|
+
this.userObjects = computed(() => {
|
|
445
|
+
const data = this.userAccountNames()
|
|
446
|
+
.map(accountName => ({
|
|
447
|
+
accountName,
|
|
448
|
+
label: accountName,
|
|
449
|
+
user: this.resolvedUsers().find(u => u.sAMAccountName.toLowerCase() === accountName.toLowerCase())
|
|
450
|
+
}));
|
|
451
|
+
data.forEach(dataItem => {
|
|
452
|
+
if (dataItem.user) {
|
|
453
|
+
// Photo
|
|
454
|
+
dataItem.photo = this.resolvedPhotos().find(photo =>
|
|
455
|
+
// Try to match the photo to the user by employee number, account name, or display name
|
|
456
|
+
(photo.employeeNumber ?? 0) === +(dataItem.user.employeeNumber ?? -1) ||
|
|
457
|
+
(photo.accountName ?? 'photoaccountname').toLowerCase() === dataItem.user.sAMAccountName.toLowerCase() ||
|
|
458
|
+
(photo.displayName ?? 'photodisplayname').toLowerCase() === dataItem.user.displayName?.toLowerCase());
|
|
459
|
+
// Label
|
|
460
|
+
switch (this.displayType()) {
|
|
461
|
+
case 'PhotoAndDisplayName':
|
|
462
|
+
case 'DisplayName':
|
|
463
|
+
dataItem.label = dataItem.user.displayName || dataItem.accountName;
|
|
464
|
+
break;
|
|
465
|
+
case 'Username':
|
|
466
|
+
case 'PhotoAndUsername':
|
|
467
|
+
dataItem.label = dataItem.accountName;
|
|
468
|
+
break;
|
|
469
|
+
case 'DisplayNameAndUsername':
|
|
470
|
+
case 'PhotoDisplayNameAndUsername':
|
|
471
|
+
dataItem.label = `${dataItem.user.displayName} (${dataItem.accountName})`;
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
return data.filter(dataItem => this.ignoreInvalidAccountNames() ? !!dataItem.user : true);
|
|
478
|
+
}, /* @ts-ignore */
|
|
479
|
+
...(ngDevMode ? [{ debugName: "userObjects" }] : /* istanbul ignore next */ []));
|
|
480
|
+
this.groupObjects = computed(() => {
|
|
481
|
+
const data = this.groupAccountNames()
|
|
482
|
+
.map(accountName => ({
|
|
483
|
+
accountName,
|
|
484
|
+
label: accountName,
|
|
485
|
+
group: this.resolvedGroups().find(g => g.sAMAccountName.toLowerCase() === accountName.toLowerCase())
|
|
486
|
+
}));
|
|
487
|
+
data.forEach(dataItem => {
|
|
488
|
+
if (dataItem.group) {
|
|
489
|
+
// Label
|
|
490
|
+
dataItem.label = dataItem.group.displayName ?? dataItem.group.name ?? dataItem.accountName;
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
return data.filter(dataItem => this.ignoreInvalidAccountNames() ? !!dataItem.group : true);
|
|
494
|
+
}, /* @ts-ignore */
|
|
495
|
+
...(ngDevMode ? [{ debugName: "groupObjects" }] : /* istanbul ignore next */ []));
|
|
496
|
+
this.displayPhoto = computed(() => ['Photo', 'PhotoAndDisplayName', 'PhotoAndUsername', 'PhotoDisplayNameAndUsername']
|
|
497
|
+
.includes(this.displayType()), /* @ts-ignore */
|
|
498
|
+
...(ngDevMode ? [{ debugName: "displayPhoto" }] : /* istanbul ignore next */ []));
|
|
499
|
+
this.displayName = computed(() => this.displayType() !== 'Photo', /* @ts-ignore */
|
|
500
|
+
...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
501
|
+
}
|
|
502
|
+
#services;
|
|
503
|
+
#usersFromService$;
|
|
504
|
+
#groupsFromService$;
|
|
505
|
+
#photosFromService$;
|
|
506
|
+
//#endregion Computed Properties
|
|
507
|
+
userChooserClosed(event) {
|
|
508
|
+
if (event === this.userChooserSettings().cancelReturnValue) {
|
|
509
|
+
// console.log('User chooser canceled'); // debug
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
this.userAccountNames.set(this.userChooserSettings().returnType === 'Object' ?
|
|
513
|
+
event.users.map(u => u.sAMAccountName) :
|
|
514
|
+
event.users);
|
|
515
|
+
this.groupAccountNames.set(this.userChooserSettings().returnType === 'Object' ?
|
|
516
|
+
event.groups.map(g => g.sAMAccountName) :
|
|
517
|
+
event.groups);
|
|
518
|
+
if (event.invalidUsers.length > 0 || event.invalidGroups.length > 0) {
|
|
519
|
+
this.rejectedInvalidAccountNames.emit({
|
|
520
|
+
users: event.invalidUsers,
|
|
521
|
+
groups: event.invalidGroups
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
this.showUserChooser.set(false);
|
|
526
|
+
}
|
|
527
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
528
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: UserFieldComponent, isStandalone: true, selector: "user-field", inputs: { userAccountNames: { classPropertyName: "userAccountNames", publicName: "userAccountNames", isSignal: true, isRequired: false, transformFunction: null }, groupAccountNames: { classPropertyName: "groupAccountNames", publicName: "groupAccountNames", isSignal: true, isRequired: false, transformFunction: null }, users: { classPropertyName: "users", publicName: "users", isSignal: true, isRequired: false, transformFunction: null }, groups: { classPropertyName: "groups", publicName: "groups", isSignal: true, isRequired: false, transformFunction: null }, photos: { classPropertyName: "photos", publicName: "photos", isSignal: true, isRequired: false, transformFunction: null }, maxItemsToDisplay: { classPropertyName: "maxItemsToDisplay", publicName: "maxItemsToDisplay", isSignal: true, isRequired: false, transformFunction: null }, groupItemsOverMax: { classPropertyName: "groupItemsOverMax", publicName: "groupItemsOverMax", isSignal: true, isRequired: false, transformFunction: null }, groupItemsOverMaxText: { classPropertyName: "groupItemsOverMaxText", publicName: "groupItemsOverMaxText", isSignal: true, isRequired: false, transformFunction: null }, ignoreInvalidAccountNames: { classPropertyName: "ignoreInvalidAccountNames", publicName: "ignoreInvalidAccountNames", isSignal: true, isRequired: false, transformFunction: null }, displayType: { classPropertyName: "displayType", publicName: "displayType", isSignal: true, isRequired: false, transformFunction: null }, emptyUserNameText: { classPropertyName: "emptyUserNameText", publicName: "emptyUserNameText", isSignal: true, isRequired: false, transformFunction: null }, enableUserChooser: { classPropertyName: "enableUserChooser", publicName: "enableUserChooser", isSignal: true, isRequired: false, transformFunction: null }, userChooserSettings: { classPropertyName: "userChooserSettings", publicName: "userChooserSettings", isSignal: true, isRequired: false, transformFunction: null }, wrapperClass: { classPropertyName: "wrapperClass", publicName: "wrapperClass", isSignal: true, isRequired: false, transformFunction: null }, emptyUserNameClass: { classPropertyName: "emptyUserNameClass", publicName: "emptyUserNameClass", isSignal: true, isRequired: false, transformFunction: null }, validUserTextClass: { classPropertyName: "validUserTextClass", publicName: "validUserTextClass", isSignal: true, isRequired: false, transformFunction: null }, manySelectedClass: { classPropertyName: "manySelectedClass", publicName: "manySelectedClass", isSignal: true, isRequired: false, transformFunction: null }, invalidUserTextClass: { classPropertyName: "invalidUserTextClass", publicName: "invalidUserTextClass", isSignal: true, isRequired: false, transformFunction: null }, photoClass: { classPropertyName: "photoClass", publicName: "photoClass", isSignal: true, isRequired: false, transformFunction: null }, userChooserPhotoClass: { classPropertyName: "userChooserPhotoClass", publicName: "userChooserPhotoClass", isSignal: true, isRequired: false, transformFunction: null }, userChooserEnabledClass: { classPropertyName: "userChooserEnabledClass", publicName: "userChooserEnabledClass", isSignal: true, isRequired: false, transformFunction: null }, userChooserDisabledClass: { classPropertyName: "userChooserDisabledClass", publicName: "userChooserDisabledClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rejectedInvalidAccountNames: "rejectedInvalidAccountNames", userAccountNames: "userAccountNamesChange", groupAccountNames: "groupAccountNamesChange" }, ngImport: i0, template: " <div (click)=\"enableUserChooser() && showUserChooser.set(true)\"\r\n [ngClass]=\"[wrapperClass(), enableUserChooser() ? userChooserEnabledClass() : userChooserDisabledClass()]\">\r\n\r\n @if (userObjects().length === 0 && groupObjects().length === 0) {\r\n <!-- No data provided, just present an empty user/group chooser -->\r\n <div [ngClass]=\"emptyUserNameClass()\">\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ emptyUserNameText() }}\r\n </div>\r\n }\r\n @else if (totalItemCount() > maxItemsToDisplay()) {\r\n <!-- Too many items to display, just show a count -->\r\n <div [ngClass]=\"manySelectedClass()\">\r\n @if (groupObjects().length === 0) {\r\n <!-- We only have Users -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} users\r\n } @else if (groupObjects().length === 0) {\r\n <!-- We only have Groups -->\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} groups\r\n } @else {\r\n <!-- We have both Users and Groups -->\r\n @if (groupItemsOverMax()) {\r\n <!-- Lump users/groups together -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} {{ groupItemsOverMaxText() }}\r\n } @else {\r\n <!-- List how many users/groups separately -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ userObjects().length }} users\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ groupObjects().length }} groups\r\n }\r\n }\r\n </div>\r\n\r\n }\r\n @else {\r\n <!-- Display the users/groups that were passed in -->\r\n\r\n <!-- Users -->\r\n @for (userObject of userObjects(); track userObject.accountName) {\r\n <div class=\"user-identity\" [class.with-photo]=\"displayPhoto()\">\r\n \r\n @if (displayPhoto()) {\r\n @if (userObject.photo) {\r\n <img [src]=\"userObject.photo!.encodedAbsUrl\" [ngClass]=\"photoClass()\" />\r\n } @else {\r\n @if (userObject.user) {\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n } @else {\r\n <kendo-svg-icon [icon]=\"icons.unknown\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n }\r\n }\r\n }\r\n \r\n @if (displayName()) {\r\n <div id=\"name\"\r\n [ngClass]=\"userObject.user ? validUserTextClass() : invalidUserTextClass()\"\r\n [innerText]=\"userObject.label\">\r\n </div>\r\n }\r\n </div>\r\n }\r\n \r\n <!-- Groups -->\r\n @for (groupObject of groupObjects(); track groupObject.accountName) {\r\n <div class=\"user-identity\" [class.with-photo]=\"displayPhoto()\">\r\n \r\n @if (displayPhoto()) {\r\n @if (groupObject.group) {\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n } @else {\r\n <kendo-svg-icon [icon]=\"icons.unknown \" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n }\r\n }\r\n \r\n @if (displayName()) {\r\n <div id=\"name\"\r\n [ngClass]=\"groupObject.group ? validUserTextClass() : invalidUserTextClass()\"\r\n [innerText]=\"groupObject.label\">\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n\r\n</div>\r\n\r\n<!-- Display User Chooser when the user clicks the component -->\r\n@if (showUserChooser()) {\r\n <!--\r\n TODO\r\n If we want to ensure that only valid users/groups are passed in...\r\n [selectedUsers]=\"data().filter(i => i.userOrGroup).map(i => i.accountName!)\"\r\n -->\r\n\r\n <user-chooser-dialog [users]=\"resolvedUsers()\" [groups]=\"resolvedGroups()\" [photos]=\"resolvedPhotos()\"\r\n [settings]=\"userChooserSettings()\"\r\n [photoClass]=\"userChooserPhotoClass()\"\r\n [selectedUsers]=\"userAccountNames()\" [selectedGroups]=\"groupAccountNames()\"\r\n (close)=\"userChooserClosed($event)\" />\r\n}", styles: [".wrapper{display:flex;gap:.5rem}.wrapper.user-chooser-enabled{cursor:pointer}.empty-user{font-style:italic;opacity:.75;display:grid;align-items:center;grid-template-columns:auto 1fr;gap:.5rem}.many-selected{display:grid;align-items:center;grid-auto-flow:column;gap:.5rem}.user-identity{display:grid;align-items:center}.user-identity.with-photo{grid-template-columns:auto 1fr;gap:.5rem}.user-identity .empty-user{font-style:italic;opacity:.75}.user-identity .invalid-user{color:#9b0202;font-style:italic}.user-identity .user-photo{width:2rem;height:2rem;border-radius:100%}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i6.SVGIconComponent, selector: "kendo-svg-icon, kendo-svgicon", inputs: ["icon", "variant"], exportAs: ["kendoSVGIcon"] }, { kind: "component", type: UserChooserDialogComponent, selector: "user-chooser-dialog", inputs: ["settings", "users", "groups", "photos", "photoClass", "selectedUsers", "selectedGroups"], outputs: ["selectedUsersChange", "selectedGroupsChange", "close"] }] }); }
|
|
529
|
+
}
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: UserFieldComponent, decorators: [{
|
|
531
|
+
type: Component,
|
|
532
|
+
args: [{ selector: 'user-field', imports: [
|
|
533
|
+
NgClass,
|
|
534
|
+
KENDO_ICONS,
|
|
535
|
+
UserChooserDialogComponent
|
|
536
|
+
], template: " <div (click)=\"enableUserChooser() && showUserChooser.set(true)\"\r\n [ngClass]=\"[wrapperClass(), enableUserChooser() ? userChooserEnabledClass() : userChooserDisabledClass()]\">\r\n\r\n @if (userObjects().length === 0 && groupObjects().length === 0) {\r\n <!-- No data provided, just present an empty user/group chooser -->\r\n <div [ngClass]=\"emptyUserNameClass()\">\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ emptyUserNameText() }}\r\n </div>\r\n }\r\n @else if (totalItemCount() > maxItemsToDisplay()) {\r\n <!-- Too many items to display, just show a count -->\r\n <div [ngClass]=\"manySelectedClass()\">\r\n @if (groupObjects().length === 0) {\r\n <!-- We only have Users -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} users\r\n } @else if (groupObjects().length === 0) {\r\n <!-- We only have Groups -->\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} groups\r\n } @else {\r\n <!-- We have both Users and Groups -->\r\n @if (groupItemsOverMax()) {\r\n <!-- Lump users/groups together -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ totalItemCount() }} {{ groupItemsOverMaxText() }}\r\n } @else {\r\n <!-- List how many users/groups separately -->\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ userObjects().length }} users\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n {{ groupObjects().length }} groups\r\n }\r\n }\r\n </div>\r\n\r\n }\r\n @else {\r\n <!-- Display the users/groups that were passed in -->\r\n\r\n <!-- Users -->\r\n @for (userObject of userObjects(); track userObject.accountName) {\r\n <div class=\"user-identity\" [class.with-photo]=\"displayPhoto()\">\r\n \r\n @if (displayPhoto()) {\r\n @if (userObject.photo) {\r\n <img [src]=\"userObject.photo!.encodedAbsUrl\" [ngClass]=\"photoClass()\" />\r\n } @else {\r\n @if (userObject.user) {\r\n <kendo-svg-icon [icon]=\"icons.user\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n } @else {\r\n <kendo-svg-icon [icon]=\"icons.unknown\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n }\r\n }\r\n }\r\n \r\n @if (displayName()) {\r\n <div id=\"name\"\r\n [ngClass]=\"userObject.user ? validUserTextClass() : invalidUserTextClass()\"\r\n [innerText]=\"userObject.label\">\r\n </div>\r\n }\r\n </div>\r\n }\r\n \r\n <!-- Groups -->\r\n @for (groupObject of groupObjects(); track groupObject.accountName) {\r\n <div class=\"user-identity\" [class.with-photo]=\"displayPhoto()\">\r\n \r\n @if (displayPhoto()) {\r\n @if (groupObject.group) {\r\n <kendo-svg-icon [icon]=\"icons.group\" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n } @else {\r\n <kendo-svg-icon [icon]=\"icons.unknown \" size=\"small\" [ngClass]=\"photoClass()\"/>\r\n }\r\n }\r\n \r\n @if (displayName()) {\r\n <div id=\"name\"\r\n [ngClass]=\"groupObject.group ? validUserTextClass() : invalidUserTextClass()\"\r\n [innerText]=\"groupObject.label\">\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n\r\n</div>\r\n\r\n<!-- Display User Chooser when the user clicks the component -->\r\n@if (showUserChooser()) {\r\n <!--\r\n TODO\r\n If we want to ensure that only valid users/groups are passed in...\r\n [selectedUsers]=\"data().filter(i => i.userOrGroup).map(i => i.accountName!)\"\r\n -->\r\n\r\n <user-chooser-dialog [users]=\"resolvedUsers()\" [groups]=\"resolvedGroups()\" [photos]=\"resolvedPhotos()\"\r\n [settings]=\"userChooserSettings()\"\r\n [photoClass]=\"userChooserPhotoClass()\"\r\n [selectedUsers]=\"userAccountNames()\" [selectedGroups]=\"groupAccountNames()\"\r\n (close)=\"userChooserClosed($event)\" />\r\n}", styles: [".wrapper{display:flex;gap:.5rem}.wrapper.user-chooser-enabled{cursor:pointer}.empty-user{font-style:italic;opacity:.75;display:grid;align-items:center;grid-template-columns:auto 1fr;gap:.5rem}.many-selected{display:grid;align-items:center;grid-auto-flow:column;gap:.5rem}.user-identity{display:grid;align-items:center}.user-identity.with-photo{grid-template-columns:auto 1fr;gap:.5rem}.user-identity .empty-user{font-style:italic;opacity:.75}.user-identity .invalid-user{color:#9b0202;font-style:italic}.user-identity .user-photo{width:2rem;height:2rem;border-radius:100%}\n"] }]
|
|
537
|
+
}], propDecorators: { rejectedInvalidAccountNames: [{ type: i0.Output, args: ["rejectedInvalidAccountNames"] }], userAccountNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "userAccountNames", required: false }] }, { type: i0.Output, args: ["userAccountNamesChange"] }], groupAccountNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupAccountNames", required: false }] }, { type: i0.Output, args: ["groupAccountNamesChange"] }], users: [{ type: i0.Input, args: [{ isSignal: true, alias: "users", required: false }] }], groups: [{ type: i0.Input, args: [{ isSignal: true, alias: "groups", required: false }] }], photos: [{ type: i0.Input, args: [{ isSignal: true, alias: "photos", required: false }] }], maxItemsToDisplay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxItemsToDisplay", required: false }] }], groupItemsOverMax: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupItemsOverMax", required: false }] }], groupItemsOverMaxText: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupItemsOverMaxText", required: false }] }], ignoreInvalidAccountNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "ignoreInvalidAccountNames", required: false }] }], displayType: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayType", required: false }] }], emptyUserNameText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyUserNameText", required: false }] }], enableUserChooser: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableUserChooser", required: false }] }], userChooserSettings: [{ type: i0.Input, args: [{ isSignal: true, alias: "userChooserSettings", required: false }] }], wrapperClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapperClass", required: false }] }], emptyUserNameClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyUserNameClass", required: false }] }], validUserTextClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "validUserTextClass", required: false }] }], manySelectedClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "manySelectedClass", required: false }] }], invalidUserTextClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidUserTextClass", required: false }] }], photoClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "photoClass", required: false }] }], userChooserPhotoClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "userChooserPhotoClass", required: false }] }], userChooserEnabledClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "userChooserEnabledClass", required: false }] }], userChooserDisabledClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "userChooserDisabledClass", required: false }] }] } });
|
|
538
|
+
|
|
539
|
+
class KendoActiveDirectoryModule {
|
|
540
|
+
static forRoot(config) {
|
|
541
|
+
return {
|
|
542
|
+
ngModule: KendoActiveDirectoryModule,
|
|
543
|
+
providers: [
|
|
544
|
+
{
|
|
545
|
+
provide: ActiveDirectoryServiceOptionsToken,
|
|
546
|
+
useValue: config
|
|
547
|
+
}
|
|
548
|
+
]
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
constructor(parentModule) {
|
|
552
|
+
if (parentModule) {
|
|
553
|
+
throw new Error('KendoActiveDirectoryModule is already loaded. Import it in the AppModule only');
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: KendoActiveDirectoryModule, deps: [{ token: KendoActiveDirectoryModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
557
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: KendoActiveDirectoryModule, imports: [CommonModule,
|
|
558
|
+
ReactiveFormsModule,
|
|
559
|
+
IconsModule, SVGIconModule,
|
|
560
|
+
GridModule,
|
|
561
|
+
ButtonsModule,
|
|
562
|
+
DialogsModule,
|
|
563
|
+
InputsModule,
|
|
564
|
+
LabelModule,
|
|
565
|
+
TabStripModule,
|
|
566
|
+
UserChooserDialogComponent,
|
|
567
|
+
UserChooserList,
|
|
568
|
+
UserFieldComponent], exports: [UserChooserDialogComponent,
|
|
569
|
+
UserChooserList,
|
|
570
|
+
UserFieldComponent] }); }
|
|
571
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: KendoActiveDirectoryModule, imports: [CommonModule,
|
|
572
|
+
ReactiveFormsModule,
|
|
573
|
+
IconsModule, SVGIconModule,
|
|
574
|
+
GridModule,
|
|
575
|
+
ButtonsModule,
|
|
576
|
+
DialogsModule,
|
|
577
|
+
InputsModule,
|
|
578
|
+
LabelModule,
|
|
579
|
+
TabStripModule,
|
|
580
|
+
UserChooserDialogComponent,
|
|
581
|
+
UserChooserList,
|
|
582
|
+
UserFieldComponent] }); }
|
|
583
|
+
}
|
|
584
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: KendoActiveDirectoryModule, decorators: [{
|
|
585
|
+
type: NgModule,
|
|
586
|
+
args: [{
|
|
587
|
+
declarations: [],
|
|
588
|
+
imports: [
|
|
589
|
+
CommonModule,
|
|
590
|
+
ReactiveFormsModule,
|
|
591
|
+
IconsModule, SVGIconModule,
|
|
592
|
+
GridModule,
|
|
593
|
+
ButtonsModule,
|
|
594
|
+
DialogsModule,
|
|
595
|
+
InputsModule,
|
|
596
|
+
LabelModule,
|
|
597
|
+
TabStripModule,
|
|
598
|
+
UserChooserDialogComponent,
|
|
599
|
+
UserChooserList,
|
|
600
|
+
UserFieldComponent
|
|
601
|
+
],
|
|
602
|
+
exports: [
|
|
603
|
+
UserChooserDialogComponent,
|
|
604
|
+
UserChooserList,
|
|
605
|
+
UserFieldComponent
|
|
606
|
+
]
|
|
607
|
+
}]
|
|
608
|
+
}], ctorParameters: () => [{ type: KendoActiveDirectoryModule, decorators: [{
|
|
609
|
+
type: Optional
|
|
610
|
+
}, {
|
|
611
|
+
type: SkipSelf
|
|
612
|
+
}] }] });
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Generated bundle index. Do not edit.
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
export { KendoActiveDirectoryModule, USER_CHOOSER_DEFAULT_SETTINGS, UserChooserDialogComponent, UserChooserList, UserFieldComponent };
|
|
619
|
+
//# sourceMappingURL=cleavelandprice-ngx-lib-active-directory-kendo.mjs.map
|