jitz-sharepoint-utilities 2.0.23 → 2.0.24

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.
@@ -40,6 +40,7 @@ export interface IJitzPeoplePickerProps {
40
40
  errorCss?: string;
41
41
  multiSelect: boolean;
42
42
  placeholderText?: string;
43
+ shouldKeepItems?: boolean;
43
44
  }
44
45
 
45
46
  export class JitzPeoplePicker extends React.Component<
@@ -159,16 +160,20 @@ export class JitzPeoplePicker extends React.Component<
159
160
  }
160
161
 
161
162
  private _onChange(items?: any[]) {
162
- this.setState({
163
- selectedItems:
164
- (this.props.multiSelect
165
- ? items
166
- : items != undefined
167
- ? items.length > 0
168
- ? [items[0]]
169
- : items
170
- : []) || [],
171
- });
163
+ if (
164
+ this.props.shouldKeepItems == undefined ||
165
+ this.props.shouldKeepItems == true
166
+ )
167
+ this.setState({
168
+ selectedItems:
169
+ (this.props.multiSelect
170
+ ? items
171
+ : items != undefined
172
+ ? items.length > 0
173
+ ? [items[0]]
174
+ : items
175
+ : []) || [],
176
+ });
172
177
 
173
178
  if (items != undefined) {
174
179
  items.map((p, v) => {
@@ -18,6 +18,7 @@ export interface IJitzPeoplePickerProps {
18
18
  errorCss?: string;
19
19
  multiSelect: boolean;
20
20
  placeholderText?: string;
21
+ shouldKeepItems?: boolean;
21
22
  }
22
23
  export declare class JitzPeoplePicker extends React.Component<IJitzPeoplePickerProps, IJitzPeoplePickerState> {
23
24
  private _peopleList;
@@ -150,15 +150,17 @@ var JitzPeoplePicker = /** @class */ (function (_super) {
150
150
  };
151
151
  JitzPeoplePicker.prototype._onChange = function (items) {
152
152
  var _this = this;
153
- this.setState({
154
- selectedItems: (this.props.multiSelect
155
- ? items
156
- : items != undefined
157
- ? items.length > 0
158
- ? [items[0]]
159
- : items
160
- : []) || [],
161
- });
153
+ if (this.props.shouldKeepItems == undefined ||
154
+ this.props.shouldKeepItems == true)
155
+ this.setState({
156
+ selectedItems: (this.props.multiSelect
157
+ ? items
158
+ : items != undefined
159
+ ? items.length > 0
160
+ ? [items[0]]
161
+ : items
162
+ : []) || [],
163
+ });
162
164
  if (items != undefined) {
163
165
  items.map(function (p, v) {
164
166
  // console.log(p);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitz-sharepoint-utilities",
3
- "version": "2.0.23",
3
+ "version": "2.0.24",
4
4
  "description": "Essential SharePoint utilities for SharePoint Add-in and SPFx development",
5
5
  "author": "Jithendra Mani",
6
6
  "license": "ISC",