@sprucelabs/spruce-people-utils 1.0.29 → 1.0.32
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractViewController, AutocompleteInputViewController, FormInputOptions, FormInputViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { AbstractViewController, AutocompleteInputViewController, FormInputHandlers, FormInputOptions, FormInputViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { SearchPerson } from '../types/people-module.types';
|
|
3
3
|
export default class PersonSelectInputViewController extends AbstractViewController<AutocompleteInput> implements FormInputViewController<AutocompleteInput> {
|
|
4
4
|
static id: string;
|
|
@@ -13,6 +13,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
13
13
|
private renderAnonSuggestion;
|
|
14
14
|
private handleOnChangeRenderedValue;
|
|
15
15
|
private populateSuggestions;
|
|
16
|
+
setHandlers(options: FormInputHandlers<AutocompleteInput>): void;
|
|
16
17
|
private handleClickInviteAnonymous;
|
|
17
18
|
private handleClickInvitePerson;
|
|
18
19
|
protected InvitePersonVc(): import("../index-module").InvitePersonCardViewController;
|
|
@@ -30,7 +31,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
30
31
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.AutocompleteInput;
|
|
31
32
|
}
|
|
32
33
|
declare type AutocompleteInput = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.AutocompleteInput;
|
|
33
|
-
export interface PersonSelectInputOptions extends
|
|
34
|
+
export interface PersonSelectInputOptions extends FormInputOptions {
|
|
34
35
|
organizationId?: string;
|
|
35
36
|
locationId?: string;
|
|
36
37
|
}
|
|
@@ -64,6 +64,9 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
+
setHandlers(options) {
|
|
68
|
+
this.autoCompleteVc.setHandlers(options);
|
|
69
|
+
}
|
|
67
70
|
handleClickInviteAnonymous() {
|
|
68
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
72
|
this.autoCompleteVc.hideSuggestions();
|
|
@@ -155,6 +158,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
155
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
159
|
const id = this.getValue();
|
|
157
160
|
if (id && this.lastLoadedPersonId !== id) {
|
|
161
|
+
this.shouldIgnoreNextChange = true;
|
|
158
162
|
this.lastLoadedPersonId = id;
|
|
159
163
|
yield this.setRenderedValue('Loading...');
|
|
160
164
|
try {
|
|
@@ -165,6 +169,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
165
169
|
searchPersonId: id,
|
|
166
170
|
},
|
|
167
171
|
});
|
|
172
|
+
this.shouldIgnoreNextChange = true;
|
|
168
173
|
yield this.setRenderedValue(renderLabel(person));
|
|
169
174
|
}
|
|
170
175
|
catch (err) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractViewController, AutocompleteInputViewController, FormInputOptions, FormInputViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { AbstractViewController, AutocompleteInputViewController, FormInputHandlers, FormInputOptions, FormInputViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { SearchPerson } from '../types/people-module.types';
|
|
3
3
|
export default class PersonSelectInputViewController extends AbstractViewController<AutocompleteInput> implements FormInputViewController<AutocompleteInput> {
|
|
4
4
|
static id: string;
|
|
@@ -13,6 +13,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
13
13
|
private renderAnonSuggestion;
|
|
14
14
|
private handleOnChangeRenderedValue;
|
|
15
15
|
private populateSuggestions;
|
|
16
|
+
setHandlers(options: FormInputHandlers<AutocompleteInput>): void;
|
|
16
17
|
private handleClickInviteAnonymous;
|
|
17
18
|
private handleClickInvitePerson;
|
|
18
19
|
protected InvitePersonVc(): import("../index-module").InvitePersonCardViewController;
|
|
@@ -30,7 +31,7 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
30
31
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.AutocompleteInput;
|
|
31
32
|
}
|
|
32
33
|
declare type AutocompleteInput = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.AutocompleteInput;
|
|
33
|
-
export interface PersonSelectInputOptions extends
|
|
34
|
+
export interface PersonSelectInputOptions extends FormInputOptions {
|
|
34
35
|
organizationId?: string;
|
|
35
36
|
locationId?: string;
|
|
36
37
|
}
|
|
@@ -74,6 +74,9 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
setHandlers(options) {
|
|
78
|
+
this.autoCompleteVc.setHandlers(options);
|
|
79
|
+
}
|
|
77
80
|
async handleClickInviteAnonymous() {
|
|
78
81
|
this.autoCompleteVc.hideSuggestions();
|
|
79
82
|
const confirm = await this.confirm({
|
|
@@ -152,6 +155,7 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
152
155
|
async _loadCurrentPerson() {
|
|
153
156
|
const id = this.getValue();
|
|
154
157
|
if (id && this.lastLoadedPersonId !== id) {
|
|
158
|
+
this.shouldIgnoreNextChange = true;
|
|
155
159
|
this.lastLoadedPersonId = id;
|
|
156
160
|
await this.setRenderedValue('Loading...');
|
|
157
161
|
try {
|
|
@@ -162,6 +166,7 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
162
166
|
searchPersonId: id,
|
|
163
167
|
},
|
|
164
168
|
});
|
|
169
|
+
this.shouldIgnoreNextChange = true;
|
|
165
170
|
await this.setRenderedValue((0, searchPeopleToSuggestions_1.renderLabel)(person));
|
|
166
171
|
}
|
|
167
172
|
catch (err) {
|