jitz-sharepoint-utilities 2.0.22 → 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.
@@ -39,6 +39,8 @@ export interface IJitzPeoplePickerProps {
39
39
  errorMessage?: string;
40
40
  errorCss?: string;
41
41
  multiSelect: boolean;
42
+ placeholderText?: string;
43
+ shouldKeepItems?: boolean;
42
44
  }
43
45
 
44
46
  export class JitzPeoplePicker extends React.Component<
@@ -113,6 +115,7 @@ export class JitzPeoplePicker extends React.Component<
113
115
  <NormalPeoplePicker
114
116
  onChange={this._onChange.bind(this)}
115
117
  disabled={this.state.disabled}
118
+ inputProps={{ placeholder: this.props.placeholderText || "" }}
116
119
  onResolveSuggestions={this._onFilterChanged}
117
120
  getTextFromItem={(persona: IPersonaProps) =>
118
121
  persona.primaryText || ""
@@ -136,6 +139,7 @@ export class JitzPeoplePicker extends React.Component<
136
139
  onChange={this._onChange.bind(this)}
137
140
  onResolveSuggestions={this._onFilterChanged}
138
141
  disabled={this.state.disabled}
142
+ inputProps={{ placeholder: this.props.placeholderText || "" }}
139
143
  getTextFromItem={(persona: IPersonaProps) =>
140
144
  persona.primaryText || ""
141
145
  }
@@ -156,16 +160,20 @@ export class JitzPeoplePicker extends React.Component<
156
160
  }
157
161
 
158
162
  private _onChange(items?: any[]) {
159
- this.setState({
160
- selectedItems:
161
- (this.props.multiSelect
162
- ? items
163
- : items != undefined
164
- ? items.length > 0
165
- ? [items[0]]
166
- : items
167
- : []) || [],
168
- });
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
+ });
169
177
 
170
178
  if (items != undefined) {
171
179
  items.map((p, v) => {
@@ -17,6 +17,8 @@ export interface IJitzPeoplePickerProps {
17
17
  errorMessage?: string;
18
18
  errorCss?: string;
19
19
  multiSelect: boolean;
20
+ placeholderText?: string;
21
+ shouldKeepItems?: boolean;
20
22
  }
21
23
  export declare class JitzPeoplePicker extends React.Component<IJitzPeoplePickerProps, IJitzPeoplePickerState> {
22
24
  private _peopleList;
@@ -128,7 +128,7 @@ var JitzPeoplePicker = /** @class */ (function (_super) {
128
128
  };
129
129
  JitzPeoplePicker.prototype.render = function () {
130
130
  if (this.props.typePicker == "Normal") {
131
- return (React.createElement(react_1.NormalPeoplePicker, { onChange: this._onChange.bind(this), disabled: this.state.disabled, onResolveSuggestions: this._onFilterChanged, getTextFromItem: function (persona) {
131
+ return (React.createElement(react_1.NormalPeoplePicker, { onChange: this._onChange.bind(this), disabled: this.state.disabled, inputProps: { placeholder: this.props.placeholderText || "" }, onResolveSuggestions: this._onFilterChanged, getTextFromItem: function (persona) {
132
132
  return persona.primaryText || "";
133
133
  }, pickerSuggestionsProps: suggestionProps, selectedItems: this.state.selectedItems, className: "ms-PeoplePicker " +
134
134
  (this.props.errorMessage != null &&
@@ -138,7 +138,7 @@ var JitzPeoplePicker = /** @class */ (function (_super) {
138
138
  : ""), key: "normal" }));
139
139
  }
140
140
  else {
141
- return (React.createElement(react_1.CompactPeoplePicker, { onChange: this._onChange.bind(this), onResolveSuggestions: this._onFilterChanged, disabled: this.state.disabled, getTextFromItem: function (persona) {
141
+ return (React.createElement(react_1.CompactPeoplePicker, { onChange: this._onChange.bind(this), onResolveSuggestions: this._onFilterChanged, disabled: this.state.disabled, inputProps: { placeholder: this.props.placeholderText || "" }, getTextFromItem: function (persona) {
142
142
  return persona.primaryText || "";
143
143
  }, pickerSuggestionsProps: suggestionProps, selectedItems: this.state.selectedItems, className: "ms-PeoplePicker" +
144
144
  (this.props.errorMessage != null &&
@@ -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.22",
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",