@ieeesa-npm/groups 0.15.8 → 0.15.9

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.
@@ -45,6 +45,25 @@ export declare class AddUserRosterComponent implements OnInit, OnDestroy {
45
45
  isUserExist: boolean;
46
46
  selectedOrganizations: AutoCompleteOption[];
47
47
  timeOutId: ReturnType<typeof setTimeout>;
48
+ /**
49
+ * True when the selected group's roster type is INDIVIDUAL (the only roster
50
+ * type that shows the Representing Organization field).
51
+ * @readonly
52
+ * @memberof AddUserRosterComponent
53
+ */
54
+ get isIndividualRoster(): boolean;
55
+ /**
56
+ * True when the org field holds an uncommitted, invalid free-text token. Used
57
+ * to keep Save disabled even when a valid chip already exists.
58
+ */
59
+ hasInvalidOrgFreeText: boolean;
60
+ /**
61
+ * Handles the org field's invalid-free-text state and recomputes Save-button
62
+ * state so the form cannot be submitted while an invalid token remains.
63
+ * @param {boolean} isInvalid -whether an uncommitted invalid token is present.
64
+ * @memberof AddUserRosterComponent
65
+ */
66
+ onOrgInvalidFreeText(isInvalid: boolean): void;
48
67
  dynamicFormComponent: DynamicFormComponent;
49
68
  submitFormResponse: EventEmitter<any>;
50
69
  formCancel: EventEmitter<any>;
@@ -132,6 +151,17 @@ export declare class AddUserRosterComponent implements OnInit, OnDestroy {
132
151
  * @memberof AddUserRosterComponent
133
152
  */
134
153
  getAddUserFormGroupRef(form: FormGroup[]): void;
154
+ /**
155
+ * Registers the `representingOrg` reactive control on the dynamic form's
156
+ * FormGroup for INDIVIDUAL rosters. The field itself is rendered by the custom
157
+ * OrgMultiSelectComponent (not the dynamic form), but keeping this control on
158
+ * the same FormGroup — with the original validators — means all existing
159
+ * submit/Save-button logic that reads `form.get('representingOrg')` keeps
160
+ * working unchanged. Its value is the selected-organizations array, kept in
161
+ * sync by getSelectedOrganizations().
162
+ * @memberof AddUserRosterComponent
163
+ */
164
+ registerRepresentingOrgControl(): void;
135
165
  /**
136
166
  * Handles user role selection in add user form.
137
167
  * @param {CheckboxOption} event
@@ -40,6 +40,18 @@ export declare class EditUserRolesComponent implements OnInit, OnDestroy {
40
40
  groupRosterType: GroupRosterType;
41
41
  representingOrganizations: SelectOption[];
42
42
  orgSearchValue: string;
43
+ /**
44
+ * True when the selected group's roster type is INDIVIDUAL (the only roster
45
+ * type that shows the Representing Organization field).
46
+ * @readonly
47
+ * @memberof EditUserRolesComponent
48
+ */
49
+ get isIndividualRoster(): boolean;
50
+ /**
51
+ * True when the org field holds an uncommitted, invalid free-text token. Used
52
+ * to keep Save disabled even when a valid chip already exists.
53
+ */
54
+ hasInvalidOrgFreeText: boolean;
43
55
  dynamicFormComponent: DynamicFormComponent;
44
56
  submitFormResponse: EventEmitter<any>;
45
57
  formCancel: EventEmitter<any>;
@@ -66,6 +78,13 @@ export declare class EditUserRolesComponent implements OnInit, OnDestroy {
66
78
  * @memberof EditUserRolesComponent
67
79
  */
68
80
  getSelectedOrganizations(selectedOrg: AutoCompleteOption[]): void;
81
+ /**
82
+ * Handles the org field's invalid-free-text state. Disables Save while an
83
+ * uncommitted invalid token remains; re-evaluates when it clears.
84
+ * @param {boolean} isInvalid -whether an uncommitted invalid token is present.
85
+ * @memberof EditUserRolesComponent
86
+ */
87
+ onOrgInvalidFreeText(isInvalid: boolean): void;
69
88
  /**
70
89
  * Updates the edit user form group controls by adding fieldConfig at required index.
71
90
  * @param {number} indexPosition
@@ -103,6 +122,18 @@ export declare class EditUserRolesComponent implements OnInit, OnDestroy {
103
122
  * @memberof EditUserRolesComponent
104
123
  */
105
124
  getFormGroupReference(form: FormGroup[]): void;
125
+ /**
126
+ * Registers the `representingOrg` reactive control on the dynamic form's
127
+ * FormGroup for INDIVIDUAL rosters. The field itself is rendered by the custom
128
+ * OrgMultiSelectComponent (not the dynamic form), but keeping this control on
129
+ * the same FormGroup — with the original validators — means all existing
130
+ * submit/Save-button logic that reads `form.get('representingOrg')` keeps
131
+ * working unchanged. Its value is the selected-organizations array, kept in
132
+ * sync by getSelectedOrganizations(). Prefilled with the user's existing
133
+ * organizations on edit.
134
+ * @memberof EditUserRolesComponent
135
+ */
136
+ registerRepresentingOrgControl(): void;
106
137
  /**
107
138
  * Handles edit user role form change event.
108
139
  * @param {FormGroup[]} form
@@ -0,0 +1,212 @@
1
+ import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { SelectOption } from '@ieeesa-npm/presentation';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * A self-contained multi-select organization field used inside the Add/Edit
6
+ * roster popups.
7
+ *
8
+ * It intentionally does NOT reuse the shared MultiSelectAutocompleteComponent
9
+ * (which is built on mat-autocomplete). Material's autocomplete closes its panel
10
+ * and overwrites the input on every option pick, which made multi-selection
11
+ * feel single-select and cleared the user's typed text. This component uses a
12
+ * fully-owned custom dropdown (<div> + checkboxes) so:
13
+ * - the panel stays open while the user ticks several results,
14
+ * - the typed search text is never overwritten by a pick,
15
+ * - pressing Enter adds the typed value as a free-text chip,
16
+ * - clicking outside clears any leftover typed text (old behavior),
17
+ * - selected values render as removable chips (old behavior).
18
+ *
19
+ * The parent supplies search results via {@link options} and reacts to
20
+ * {@link search} (debounced typed term) and {@link selectionChange}.
21
+ * @export
22
+ * @class OrgMultiSelectComponent
23
+ */
24
+ export declare class OrgMultiSelectComponent implements OnInit, OnDestroy {
25
+ /** Field label (e.g. "Representing Organization *"). */
26
+ label: string;
27
+ /** Placeholder for the input. */
28
+ placeholder: string;
29
+ /** Support/help text shown below the field. */
30
+ supportMessage: string;
31
+ /** aria-label for the input. */
32
+ ariaLabel: string;
33
+ /** Search results supplied by the parent (repopulated on each search). */
34
+ set options(value: SelectOption[]);
35
+ get options(): SelectOption[];
36
+ private _options;
37
+ /** Pre-selected options (edit prefill). Rendered as chips. */
38
+ set selectedOptions(value: SelectOption[]);
39
+ get selectedOptions(): SelectOption[];
40
+ private _selectedOptions;
41
+ /** Marks the field required (drives the required message + error border). */
42
+ required: boolean;
43
+ /**
44
+ * Icon URLs (same sprite refs the shared multi-select field used). Defaulted
45
+ * so the popups don't need to pass them; overridable via input if needed.
46
+ */
47
+ removeIconURL: string;
48
+ clearAllIconURL: string;
49
+ /** Emits the trimmed typed term (debounced) so the parent can call the API. */
50
+ search: EventEmitter<string>;
51
+ /** Emits the current selection array whenever it changes. */
52
+ selectionChange: EventEmitter<SelectOption[]>;
53
+ /** Emitted when the field is blurred (parent can re-evaluate validation). */
54
+ fieldBlur: EventEmitter<void>;
55
+ /**
56
+ * Emits true when the input holds an uncommitted free-text token that fails
57
+ * validation (too short / too long / invalid pattern), and false when the
58
+ * input is empty or the token is valid. The parent uses this to keep the Save
59
+ * button disabled while an invalid token remains — otherwise a previously
60
+ * added valid chip would keep the parent control valid and let the form submit
61
+ * with an invalid token still in the input.
62
+ */
63
+ invalidFreeText: EventEmitter<boolean>;
64
+ /** Tracks the last emitted invalid-token state to avoid duplicate emits. */
65
+ private hasInvalidFreeText;
66
+ searchInput: ElementRef<HTMLInputElement>;
67
+ constants: any;
68
+ addUserRosterTexts: any;
69
+ /** Whether the results dropdown is open. */
70
+ isDropdownOpen: boolean;
71
+ /** The current typed search text. */
72
+ searchText: string;
73
+ /** Inline validation message for the free-text (Enter) path. */
74
+ errorMessage: string;
75
+ /** Whether the field has been touched (to show required error after blur). */
76
+ isTouched: boolean;
77
+ /**
78
+ * Index of the keyboard-highlighted result row (-1 = none). Enables arrow-key
79
+ * navigation and Enter-to-toggle for keyboard users, mirroring the mat-option
80
+ * behavior this custom dropdown replaces.
81
+ */
82
+ activeOptionIndex: number;
83
+ /** Stable id prefix for option rows (used for aria-activedescendant). */
84
+ readonly optionIdPrefix = "ieeesa-org-option-";
85
+ private destroy$;
86
+ private searchDebounce?;
87
+ private blurTimer?;
88
+ private readonly debounceMs;
89
+ private readonly minCharToSearch;
90
+ private separatorKeys;
91
+ ngOnInit(): void;
92
+ /**
93
+ * Handles typing in the search input: tracks the text, opens/closes the
94
+ * dropdown and debounces the search emit to the parent.
95
+ * @param {Event} event -input event.
96
+ * @memberof OrgMultiSelectComponent
97
+ */
98
+ onInput(event: Event): void;
99
+ /**
100
+ * Emits the invalid-free-text state to the parent (deduped). True means an
101
+ * uncommitted token is present and Save should stay disabled.
102
+ * @param {boolean} isInvalid -whether an uncommitted token is present.
103
+ * @memberof OrgMultiSelectComponent
104
+ */
105
+ private emitInvalidState;
106
+ /**
107
+ * Opens the dropdown on focus only when there are results AND the input still
108
+ * holds a valid search term (at or above minCharToSearch). This prevents
109
+ * re-opening stale results — e.g. a late API response that populated options
110
+ * after the input was cleared — when the user simply refocuses the field.
111
+ * @memberof OrgMultiSelectComponent
112
+ */
113
+ onFocus(): void;
114
+ /**
115
+ * Called by the parent (via a setter re-assign) or internally after new
116
+ * options arrive so the dropdown opens to show them.
117
+ * @memberof OrgMultiSelectComponent
118
+ */
119
+ showResults(): void;
120
+ /**
121
+ * Handles keydown for the Enter/comma "add typed value" path.
122
+ * @param {KeyboardEvent} event -keyboard event.
123
+ * @memberof OrgMultiSelectComponent
124
+ */
125
+ onKeydown(event: KeyboardEvent): void;
126
+ /**
127
+ * Moves the keyboard highlight up/down the results list, wrapping at the ends.
128
+ * @param {number} delta -+1 to move down, -1 to move up.
129
+ * @memberof OrgMultiSelectComponent
130
+ */
131
+ private moveActiveOption;
132
+ /**
133
+ * Whether the given result index is the keyboard-highlighted row.
134
+ * @param {number} index -the option's index.
135
+ * @return {boolean}
136
+ * @memberof OrgMultiSelectComponent
137
+ */
138
+ isActiveOption(index: number): boolean;
139
+ /**
140
+ * Adds the typed free-text value as a selection (chip) after validating its
141
+ * length and pattern (parity with the previous chip-input behavior).
142
+ * @memberof OrgMultiSelectComponent
143
+ */
144
+ addTypedValue(): void;
145
+ /**
146
+ * Validates a free-text organization value against the shared min/max/pattern
147
+ * rules. Returns an error message when invalid, otherwise an empty string.
148
+ * @param {string} value -the typed value.
149
+ * @return {string}
150
+ * @memberof OrgMultiSelectComponent
151
+ */
152
+ validateFreeText(value: string): string;
153
+ /**
154
+ * Toggles selection of a result option. Keeps the dropdown open and the typed
155
+ * text intact so the user can keep selecting.
156
+ * @param {SelectOption} option -the clicked result option.
157
+ * @memberof OrgMultiSelectComponent
158
+ */
159
+ toggleOption(option: SelectOption): void;
160
+ /**
161
+ * Whether an option is currently selected (drives the checkbox checked state).
162
+ * @param {SelectOption} option -option to test.
163
+ * @return {boolean}
164
+ * @memberof OrgMultiSelectComponent
165
+ */
166
+ isSelected(option: SelectOption): boolean;
167
+ /**
168
+ * Removes a selected chip.
169
+ * @param {SelectOption} option -the option to remove.
170
+ * @memberof OrgMultiSelectComponent
171
+ */
172
+ removeOption(option: SelectOption): void;
173
+ /**
174
+ * Clears all selected chips.
175
+ * @memberof OrgMultiSelectComponent
176
+ */
177
+ clearAll(): void;
178
+ /**
179
+ * Clears the leftover typed text on blur (old behavior) and closes the
180
+ * dropdown. Deferred so a click on a dropdown option (which also blurs the
181
+ * input) is handled first.
182
+ * @memberof OrgMultiSelectComponent
183
+ */
184
+ onBlur(): void;
185
+ /**
186
+ * Whether the required error should show (touched, no selection).
187
+ * @return {boolean}
188
+ * @memberof OrgMultiSelectComponent
189
+ */
190
+ get showRequiredError(): boolean;
191
+ /**
192
+ * Clears the typed search text and hides the results.
193
+ * @memberof OrgMultiSelectComponent
194
+ */
195
+ private clearSearchText;
196
+ /**
197
+ * Emits the current selection to the parent.
198
+ * @memberof OrgMultiSelectComponent
199
+ */
200
+ private emitSelection;
201
+ /**
202
+ * TrackBy for both result and chip lists.
203
+ * @param {number} index -list index.
204
+ * @param {SelectOption} option -the option.
205
+ * @return {(string | number)}
206
+ * @memberof OrgMultiSelectComponent
207
+ */
208
+ trackByFn(index: number, option: SelectOption): string | number;
209
+ ngOnDestroy(): void;
210
+ static ɵfac: i0.ɵɵFactoryDeclaration<OrgMultiSelectComponent, never>;
211
+ static ɵcmp: i0.ɵɵComponentDeclaration<OrgMultiSelectComponent, "ieeesa-org-multi-select", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "supportMessage": { "alias": "supportMessage"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "options": { "alias": "options"; "required": false; }; "selectedOptions": { "alias": "selectedOptions"; "required": false; }; "required": { "alias": "required"; "required": false; }; "removeIconURL": { "alias": "removeIconURL"; "required": false; }; "clearAllIconURL": { "alias": "clearAllIconURL"; "required": false; }; }, { "search": "search"; "selectionChange": "selectionChange"; "fieldBlur": "fieldBlur"; "invalidFreeText": "invalidFreeText"; }, never, never, true, never>;
212
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/groups",
3
- "version": "0.15.8",
3
+ "version": "0.15.9",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"