gd-sprest-bs 8.7.4 → 8.7.8
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.
|
@@ -180,9 +180,8 @@ exports.PeoplePicker = function (props) {
|
|
|
180
180
|
elPeoplePicker.className = "people-picker";
|
|
181
181
|
// Create the menu
|
|
182
182
|
var elMenu = document.createElement("div");
|
|
183
|
-
elMenu.className = "dropdown-menu";
|
|
183
|
+
elMenu.className = "dropdown-menu border-0 mw-fit";
|
|
184
184
|
elMenu.innerHTML = '<h6 class="dropdown-header">Search requires 3+ characters</h6>';
|
|
185
|
-
elMenu.style.border = "0";
|
|
186
185
|
// Add the selected users
|
|
187
186
|
var elSelectedUsers = document.createElement("div");
|
|
188
187
|
elSelectedUsers.style.position = "relative";
|
|
@@ -191,6 +190,7 @@ exports.PeoplePicker = function (props) {
|
|
|
191
190
|
var elTextbox = core_1.Components.InputGroup({
|
|
192
191
|
placeholder: props.placeholder == null ? "Search" : props.placeholder,
|
|
193
192
|
onChange: function (searchText) {
|
|
193
|
+
var currentHTML = elMenu.innerHTML;
|
|
194
194
|
// See if a value exists
|
|
195
195
|
if (searchText) {
|
|
196
196
|
// Set the filter text
|
|
@@ -213,6 +213,12 @@ exports.PeoplePicker = function (props) {
|
|
|
213
213
|
// Set the header
|
|
214
214
|
elMenu.innerHTML = '<h6 class="dropdown-header">Search requires 3+ characters</h6>';
|
|
215
215
|
}
|
|
216
|
+
// See if a refresh is required
|
|
217
|
+
if (currentHTML != elMenu.innerHTML) {
|
|
218
|
+
// Refresh the popover
|
|
219
|
+
_menu.hide();
|
|
220
|
+
_menu.show();
|
|
221
|
+
}
|
|
216
222
|
}
|
|
217
223
|
}).el;
|
|
218
224
|
props.readOnly ? elTextbox.classList.add("d-none") : null;
|
|
@@ -224,6 +230,7 @@ exports.PeoplePicker = function (props) {
|
|
|
224
230
|
options: {
|
|
225
231
|
content: elMenu,
|
|
226
232
|
hideOnClick: false,
|
|
233
|
+
maxWidth: "none",
|
|
227
234
|
trigger: "focus"
|
|
228
235
|
}
|
|
229
236
|
});
|
|
@@ -709,7 +709,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
709
709
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
710
710
|
|
|
711
711
|
"use strict";
|
|
712
|
-
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.PeoplePickerControlType = exports.PeoplePicker = void 0;\n\nvar gd_sprest_1 = __webpack_require__(/*! gd-sprest */ \"./node_modules/.pnpm/gd-sprest@6.7.0/node_modules/gd-sprest/build/index.js\");\n\nvar core_1 = __webpack_require__(/*! ../core */ \"./build/components/core.js\");\n/**\r\n * People Picker\r\n */\n\n\nexports.PeoplePicker = function (props) {\n var _filterText = null;\n var _menu = null;\n var _users = []; // Method to add a user\n\n var addUser = function addUser(userInfo) {\n var user = typeof userInfo === \"string\" ? JSON.parse(userInfo) : userInfo; // Adds the button\n\n var addButton = function addButton(userInfo) {\n // See if the picker is read only\n if (props.readOnly) {\n // Render a button\n core_1.Components.Button({\n el: elSelectedUsers,\n className: \"mr-1 mb-1\",\n isSmall: true,\n text: userInfo.Title\n });\n } else {\n // Render a button\n var btn_1 = core_1.Components.Button({\n data: userInfo,\n el: elSelectedUsers,\n className: \"mr-1 mb-1\",\n isSmall: true,\n text: userInfo.Title,\n badge: {\n className: \"ml-2\",\n content: \"×\",\n isPill: true,\n type: core_1.Components.BadgeTypes.Light,\n onClick: function onClick() {\n // Remove the button\n elSelectedUsers.removeChild(btn_1.el); // Call the event\n\n props.onChange ? props.onChange(obj.getValue()) : null;\n }\n }\n }); // Set the data attribute\n\n btn_1.el.setAttribute(\"data-user\", JSON.stringify(userInfo.stringify()));\n } // Call the event\n\n\n props.onChange ? props.onChange(obj.getValue()) : null;\n }; // See if we are allowing multiple users\n\n\n var allowMultple = typeof props.multi == \"boolean\" ? props.multi : false;\n\n if (!allowMultple) {\n // Remove existing users\n while (elSelectedUsers.firstChild) {\n elSelectedUsers.removeChild(elSelectedUsers.firstChild);\n }\n } // Ensure this is a user object\n\n\n if (user.EntityData) {\n // Ensure the group or user id is set\n if (user.EntityData.SPGroupID) {\n // Find the user by id\n gd_sprest_1.Web().SiteGroups(parseInt(user.EntityData.SPGroupID)).execute(function (group) {\n // Add the button\n addButton(group);\n });\n } else if (user.EntityData.SPUserID) {\n // Find the user by id\n gd_sprest_1.Web().getUserById(parseInt(user.EntityData.SPUserID)).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n });\n } else {\n // Find the user\n gd_sprest_1.Web().ensureUser(user.Key).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n }, addButton);\n }\n } else {\n // Find the user by id\n gd_sprest_1.Web().getUserById(user).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n });\n }\n }; // Method to search for the users\n\n\n var searchUsers = function searchUsers(el, searchText, searchAll, spGroupId) {\n if (searchAll === void 0) {\n searchAll = true;\n } // Ensure 3 characters exist\n\n\n if (_filterText.length > 2) {\n // Search for the user\n gd_sprest_1.PeoplePicker().clientPeoplePickerSearchUser({\n MaximumEntitySuggestions: props.maxResults || 25,\n PrincipalSource: searchAll ? gd_sprest_1.SPTypes.PrincipalSources.All : gd_sprest_1.SPTypes.PrincipalSources.UserInfoList,\n PrincipalType: props.allowGroups ? gd_sprest_1.SPTypes.PrincipalTypes.All : gd_sprest_1.SPTypes.PrincipalTypes.User,\n QueryString: _filterText,\n SharePointGroupID: spGroupId\n }).execute(function (search) {\n // Ensure the search text matches\n if (_filterText != searchText) {\n return;\n } // Clear the users results\n\n\n _users = []; // Set the menu header\n\n el.innerHTML = '<h6 class=\"dropdown-header\">Search Results for \"' + searchText + '\"</h6>';\n el.innerHTML += '<div class=\"dropdown-divider\"></div>'; // See if no users were found\n\n if (search.ClientPeoplePickerSearchUser.length == 0) {\n // Add a message\n el.innerHTML += '<h6 class=\"dropdown-header\">No results were found...</h6>';\n } else {\n // Parse the users\n for (var i = 0; i < search.ClientPeoplePickerSearchUser.length; i++) {\n var exists = false;\n var user = search.ClientPeoplePickerSearchUser[i]; // Save the user\n\n _users.push(user); // Parse the selected users\n\n\n for (var j = 0; j < elSelectedUsers.children.length; j++) {\n var userInfo = JSON.parse(elSelectedUsers.children[j].getAttribute(\"data-user\")); // See if this user is already selected\n\n if (exists = user.Key == userInfo.Key) {\n break;\n }\n } // Ensure the user isn't already selected\n\n\n if (exists) {\n continue;\n } // Create the item\n\n\n var elItem = document.createElement(\"a\");\n elItem.className = \"dropdown-item\";\n elItem.href = \"#\";\n elItem.innerHTML = user.DisplayText;\n elItem.setAttribute(\"data-user\", JSON.stringify(user));\n el.appendChild(elItem); // Set the click event\n\n elItem.addEventListener(\"click\", function (ev) {\n var userInfo = ev.currentTarget.getAttribute(\"data-user\"); // Add the user\n\n addUser(userInfo); // Hide the menu\n\n _menu.hide(); // Clear the search text\n\n\n elTextbox.querySelector(\"input\").value = \"\";\n });\n }\n } // Refresh the popover\n\n\n _menu.hide();\n\n _menu.show();\n });\n }\n }; // Method to set the value\n\n\n var setValue = function setValue(selectedUsers) {\n if (selectedUsers === void 0) {\n selectedUsers = [];\n } // Clear the selected users\n\n\n elSelectedUsers.innerHTML = \"\"; // Parse the selected users\n\n for (var i = 0; i < selectedUsers.length; i++) {\n // Add the user\n addUser(selectedUsers[i]);\n }\n }; // Create the people picker\n\n\n var elPeoplePicker = document.createElement(\"div\");\n elPeoplePicker.className = \"people-picker\"; // Create the menu\n\n var elMenu = document.createElement(\"div\");\n elMenu.className = \"dropdown-menu\";\n elMenu.innerHTML = '<h6 class=\"dropdown-header\">Search requires 3+ characters</h6>';\n elMenu.style.border = \"0\"; // Add the selected users\n\n var elSelectedUsers = document.createElement(\"div\");\n elSelectedUsers.style.position = \"relative\";\n elPeoplePicker.appendChild(elSelectedUsers); // Create the textbox\n\n var elTextbox = core_1.Components.InputGroup({\n placeholder: props.placeholder == null ? \"Search\" : props.placeholder,\n onChange: function onChange(searchText) {\n // See if a value exists\n if (searchText) {\n // Set the filter text\n _filterText = searchText; // Set the header\n\n elMenu.innerHTML = ['<h6 class=\"dropdown-header\">', _filterText.length > 2 ? 'Searching for \"' + _filterText + '\"' : 'Search requires 3+ characters', '</h6>'].join('\\n'); // Wait 500ms before searching\n\n setTimeout(function () {\n // Ensure the filters match\n if (searchText == _filterText) {\n // Search for the users\n searchUsers(elMenu, searchText, props.searchLocal ? false : true, props.groupId);\n }\n }, 500);\n } else {\n // Set the header\n elMenu.innerHTML = '<h6 class=\"dropdown-header\">Search requires 3+ characters</h6>';\n }\n }\n }).el;\n props.readOnly ? elTextbox.classList.add(\"d-none\") : null;\n elPeoplePicker.appendChild(elTextbox); // Create the popover menu\n\n _menu = core_1.Components.Popover({\n target: elTextbox.querySelector(\"input\"),\n placement: core_1.Components.PopoverPlacements.BottomStart,\n options: {\n content: elMenu,\n hideOnClick: false,\n trigger: \"focus\"\n }\n }); // Set the value and ensure it's a \n\n var value = props.value || [];\n\n if (_typeof(props.value) != \"object\") {\n // Set the default selected users\n setValue([value]);\n } else {\n // See if this is a user object\n var userValue = value;\n\n if (userValue.EntityData) {\n // Set the value\n value = userValue.EntityData.SPGroupID || userValue.EntityData.SPUserID; // Set the default selected users\n\n setValue([value]);\n } // Else, see if the results exist\n else if (value.results) {\n var userIds = []; // Parse the results\n\n for (var i = 0; i < value.results.length; i++) {\n // Add the user id\n userIds.push(value.results[i].Id);\n } // Set the default selected users\n\n\n setValue(userIds);\n } else {\n // Set the default selected users\n setValue(value);\n }\n } // Create the element\n\n\n var el = document.createElement(\"div\");\n el.appendChild(elPeoplePicker); // See if we are rendering it to an element\n\n if (props.el) {\n // Ensure the parent element exists\n if (props.el.parentElement && props.el.parentElement.classList) {\n // Set the bootstrap class\n props.el.parentElement.classList.contains(\"bs\") ? null : props.el.parentElement.classList.add(\"bs\");\n } // Append the elements\n\n\n while (el.children.length > 0) {\n props.el.appendChild(el.children[0]);\n } // Update the element\n\n\n el = props.el;\n } else {\n // Set the bootstrap class\n el.classList.add(\"bs\");\n } // Create the object\n\n\n var obj = {\n el: elPeoplePicker,\n getValue: function getValue() {\n var selectedUsers = []; // Parse the selected users\n\n for (var i = 0; i < elSelectedUsers.children.length; i++) {\n var userInfo = JSON.parse(elSelectedUsers.children[i].getAttribute(\"data-user\"));\n var user = gd_sprest_1.Helper.parse(userInfo); // Add this user\n\n selectedUsers.push(user);\n } // Return the value\n\n\n return selectedUsers;\n },\n setValue: setValue\n }; // Execute the assign to event\n\n props.assignTo ? props.assignTo(obj) : null; // Return the people picker object\n\n return obj;\n}; // Extend the form controls\n\n\nexports.PeoplePickerControlType = 101;\ncore_1.Components.FormControlTypes[\"PeoplePicker\"] = exports.PeoplePickerControlType;\ncore_1.Components.CustomControls.registerType(exports.PeoplePickerControlType, function (props) {\n var picker = null; // Set the created method\n\n var onRendered = props.onControlRendered;\n\n props.onControlRendered = function (ctrl) {\n // Render a people picker\n picker = exports.PeoplePicker({\n allowGroups: props.allowGroups,\n className: props.className,\n el: ctrl.el,\n groupId: props.groupId,\n label: props.label,\n maxResults: props.maxResults,\n multi: props.multi,\n placeholder: props.placeholder,\n readOnly: props.isReadonly,\n searchLocal: props.searchLocal,\n value: props.value\n }); // See if the label exists\n\n var elLabel = ctrl[\"_elLabel\"];\n\n if (elLabel) {\n // Set the id and aria properties\n elLabel ? elLabel.id = (props.id || props.name) + \"_label\" : null;\n picker.el.querySelector(\"input\").setAttribute(\"aria-labelledby\", elLabel.id);\n } // Set the control\n\n\n ctrl.setControl(picker); // Call the custom render event\n\n onRendered ? onRendered(ctrl) : null;\n }; // Register a people picker\n\n\n props.onGetValue = function (ctrl) {\n // Return the value\n return picker ? picker.getValue() : ctrl.value;\n };\n});\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/peoplePicker/index.js?");
|
|
712
|
+
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.PeoplePickerControlType = exports.PeoplePicker = void 0;\n\nvar gd_sprest_1 = __webpack_require__(/*! gd-sprest */ \"./node_modules/.pnpm/gd-sprest@6.7.0/node_modules/gd-sprest/build/index.js\");\n\nvar core_1 = __webpack_require__(/*! ../core */ \"./build/components/core.js\");\n/**\r\n * People Picker\r\n */\n\n\nexports.PeoplePicker = function (props) {\n var _filterText = null;\n var _menu = null;\n var _users = []; // Method to add a user\n\n var addUser = function addUser(userInfo) {\n var user = typeof userInfo === \"string\" ? JSON.parse(userInfo) : userInfo; // Adds the button\n\n var addButton = function addButton(userInfo) {\n // See if the picker is read only\n if (props.readOnly) {\n // Render a button\n core_1.Components.Button({\n el: elSelectedUsers,\n className: \"mr-1 mb-1\",\n isSmall: true,\n text: userInfo.Title\n });\n } else {\n // Render a button\n var btn_1 = core_1.Components.Button({\n data: userInfo,\n el: elSelectedUsers,\n className: \"mr-1 mb-1\",\n isSmall: true,\n text: userInfo.Title,\n badge: {\n className: \"ml-2\",\n content: \"×\",\n isPill: true,\n type: core_1.Components.BadgeTypes.Light,\n onClick: function onClick() {\n // Remove the button\n elSelectedUsers.removeChild(btn_1.el); // Call the event\n\n props.onChange ? props.onChange(obj.getValue()) : null;\n }\n }\n }); // Set the data attribute\n\n btn_1.el.setAttribute(\"data-user\", JSON.stringify(userInfo.stringify()));\n } // Call the event\n\n\n props.onChange ? props.onChange(obj.getValue()) : null;\n }; // See if we are allowing multiple users\n\n\n var allowMultple = typeof props.multi == \"boolean\" ? props.multi : false;\n\n if (!allowMultple) {\n // Remove existing users\n while (elSelectedUsers.firstChild) {\n elSelectedUsers.removeChild(elSelectedUsers.firstChild);\n }\n } // Ensure this is a user object\n\n\n if (user.EntityData) {\n // Ensure the group or user id is set\n if (user.EntityData.SPGroupID) {\n // Find the user by id\n gd_sprest_1.Web().SiteGroups(parseInt(user.EntityData.SPGroupID)).execute(function (group) {\n // Add the button\n addButton(group);\n });\n } else if (user.EntityData.SPUserID) {\n // Find the user by id\n gd_sprest_1.Web().getUserById(parseInt(user.EntityData.SPUserID)).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n });\n } else {\n // Find the user\n gd_sprest_1.Web().ensureUser(user.Key).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n }, addButton);\n }\n } else {\n // Find the user by id\n gd_sprest_1.Web().getUserById(user).execute(function (userInfo) {\n // Add the button\n addButton(userInfo);\n });\n }\n }; // Method to search for the users\n\n\n var searchUsers = function searchUsers(el, searchText, searchAll, spGroupId) {\n if (searchAll === void 0) {\n searchAll = true;\n } // Ensure 3 characters exist\n\n\n if (_filterText.length > 2) {\n // Search for the user\n gd_sprest_1.PeoplePicker().clientPeoplePickerSearchUser({\n MaximumEntitySuggestions: props.maxResults || 25,\n PrincipalSource: searchAll ? gd_sprest_1.SPTypes.PrincipalSources.All : gd_sprest_1.SPTypes.PrincipalSources.UserInfoList,\n PrincipalType: props.allowGroups ? gd_sprest_1.SPTypes.PrincipalTypes.All : gd_sprest_1.SPTypes.PrincipalTypes.User,\n QueryString: _filterText,\n SharePointGroupID: spGroupId\n }).execute(function (search) {\n // Ensure the search text matches\n if (_filterText != searchText) {\n return;\n } // Clear the users results\n\n\n _users = []; // Set the menu header\n\n el.innerHTML = '<h6 class=\"dropdown-header\">Search Results for \"' + searchText + '\"</h6>';\n el.innerHTML += '<div class=\"dropdown-divider\"></div>'; // See if no users were found\n\n if (search.ClientPeoplePickerSearchUser.length == 0) {\n // Add a message\n el.innerHTML += '<h6 class=\"dropdown-header\">No results were found...</h6>';\n } else {\n // Parse the users\n for (var i = 0; i < search.ClientPeoplePickerSearchUser.length; i++) {\n var exists = false;\n var user = search.ClientPeoplePickerSearchUser[i]; // Save the user\n\n _users.push(user); // Parse the selected users\n\n\n for (var j = 0; j < elSelectedUsers.children.length; j++) {\n var userInfo = JSON.parse(elSelectedUsers.children[j].getAttribute(\"data-user\")); // See if this user is already selected\n\n if (exists = user.Key == userInfo.Key) {\n break;\n }\n } // Ensure the user isn't already selected\n\n\n if (exists) {\n continue;\n } // Create the item\n\n\n var elItem = document.createElement(\"a\");\n elItem.className = \"dropdown-item\";\n elItem.href = \"#\";\n elItem.innerHTML = user.DisplayText;\n elItem.setAttribute(\"data-user\", JSON.stringify(user));\n el.appendChild(elItem); // Set the click event\n\n elItem.addEventListener(\"click\", function (ev) {\n var userInfo = ev.currentTarget.getAttribute(\"data-user\"); // Add the user\n\n addUser(userInfo); // Hide the menu\n\n _menu.hide(); // Clear the search text\n\n\n elTextbox.querySelector(\"input\").value = \"\";\n });\n }\n } // Refresh the popover\n\n\n _menu.hide();\n\n _menu.show();\n });\n }\n }; // Method to set the value\n\n\n var setValue = function setValue(selectedUsers) {\n if (selectedUsers === void 0) {\n selectedUsers = [];\n } // Clear the selected users\n\n\n elSelectedUsers.innerHTML = \"\"; // Parse the selected users\n\n for (var i = 0; i < selectedUsers.length; i++) {\n // Add the user\n addUser(selectedUsers[i]);\n }\n }; // Create the people picker\n\n\n var elPeoplePicker = document.createElement(\"div\");\n elPeoplePicker.className = \"people-picker\"; // Create the menu\n\n var elMenu = document.createElement(\"div\");\n elMenu.className = \"dropdown-menu border-0 mw-fit\";\n elMenu.innerHTML = '<h6 class=\"dropdown-header\">Search requires 3+ characters</h6>'; // Add the selected users\n\n var elSelectedUsers = document.createElement(\"div\");\n elSelectedUsers.style.position = \"relative\";\n elPeoplePicker.appendChild(elSelectedUsers); // Create the textbox\n\n var elTextbox = core_1.Components.InputGroup({\n placeholder: props.placeholder == null ? \"Search\" : props.placeholder,\n onChange: function onChange(searchText) {\n var currentHTML = elMenu.innerHTML; // See if a value exists\n\n if (searchText) {\n // Set the filter text\n _filterText = searchText; // Set the header\n\n elMenu.innerHTML = ['<h6 class=\"dropdown-header\">', _filterText.length > 2 ? 'Searching for \"' + _filterText + '\"' : 'Search requires 3+ characters', '</h6>'].join('\\n'); // Wait 500ms before searching\n\n setTimeout(function () {\n // Ensure the filters match\n if (searchText == _filterText) {\n // Search for the users\n searchUsers(elMenu, searchText, props.searchLocal ? false : true, props.groupId);\n }\n }, 500);\n } else {\n // Set the header\n elMenu.innerHTML = '<h6 class=\"dropdown-header\">Search requires 3+ characters</h6>';\n } // See if a refresh is required\n\n\n if (currentHTML != elMenu.innerHTML) {\n // Refresh the popover\n _menu.hide();\n\n _menu.show();\n }\n }\n }).el;\n props.readOnly ? elTextbox.classList.add(\"d-none\") : null;\n elPeoplePicker.appendChild(elTextbox); // Create the popover menu\n\n _menu = core_1.Components.Popover({\n target: elTextbox.querySelector(\"input\"),\n placement: core_1.Components.PopoverPlacements.BottomStart,\n options: {\n content: elMenu,\n hideOnClick: false,\n maxWidth: \"none\",\n trigger: \"focus\"\n }\n }); // Set the value and ensure it's a \n\n var value = props.value || [];\n\n if (_typeof(props.value) != \"object\") {\n // Set the default selected users\n setValue([value]);\n } else {\n // See if this is a user object\n var userValue = value;\n\n if (userValue.EntityData) {\n // Set the value\n value = userValue.EntityData.SPGroupID || userValue.EntityData.SPUserID; // Set the default selected users\n\n setValue([value]);\n } // Else, see if the results exist\n else if (value.results) {\n var userIds = []; // Parse the results\n\n for (var i = 0; i < value.results.length; i++) {\n // Add the user id\n userIds.push(value.results[i].Id);\n } // Set the default selected users\n\n\n setValue(userIds);\n } else {\n // Set the default selected users\n setValue(value);\n }\n } // Create the element\n\n\n var el = document.createElement(\"div\");\n el.appendChild(elPeoplePicker); // See if we are rendering it to an element\n\n if (props.el) {\n // Ensure the parent element exists\n if (props.el.parentElement && props.el.parentElement.classList) {\n // Set the bootstrap class\n props.el.parentElement.classList.contains(\"bs\") ? null : props.el.parentElement.classList.add(\"bs\");\n } // Append the elements\n\n\n while (el.children.length > 0) {\n props.el.appendChild(el.children[0]);\n } // Update the element\n\n\n el = props.el;\n } else {\n // Set the bootstrap class\n el.classList.add(\"bs\");\n } // Create the object\n\n\n var obj = {\n el: elPeoplePicker,\n getValue: function getValue() {\n var selectedUsers = []; // Parse the selected users\n\n for (var i = 0; i < elSelectedUsers.children.length; i++) {\n var userInfo = JSON.parse(elSelectedUsers.children[i].getAttribute(\"data-user\"));\n var user = gd_sprest_1.Helper.parse(userInfo); // Add this user\n\n selectedUsers.push(user);\n } // Return the value\n\n\n return selectedUsers;\n },\n setValue: setValue\n }; // Execute the assign to event\n\n props.assignTo ? props.assignTo(obj) : null; // Return the people picker object\n\n return obj;\n}; // Extend the form controls\n\n\nexports.PeoplePickerControlType = 101;\ncore_1.Components.FormControlTypes[\"PeoplePicker\"] = exports.PeoplePickerControlType;\ncore_1.Components.CustomControls.registerType(exports.PeoplePickerControlType, function (props) {\n var picker = null; // Set the created method\n\n var onRendered = props.onControlRendered;\n\n props.onControlRendered = function (ctrl) {\n // Render a people picker\n picker = exports.PeoplePicker({\n allowGroups: props.allowGroups,\n className: props.className,\n el: ctrl.el,\n groupId: props.groupId,\n label: props.label,\n maxResults: props.maxResults,\n multi: props.multi,\n placeholder: props.placeholder,\n readOnly: props.isReadonly,\n searchLocal: props.searchLocal,\n value: props.value\n }); // See if the label exists\n\n var elLabel = ctrl[\"_elLabel\"];\n\n if (elLabel) {\n // Set the id and aria properties\n elLabel ? elLabel.id = (props.id || props.name) + \"_label\" : null;\n picker.el.querySelector(\"input\").setAttribute(\"aria-labelledby\", elLabel.id);\n } // Set the control\n\n\n ctrl.setControl(picker); // Call the custom render event\n\n onRendered ? onRendered(ctrl) : null;\n }; // Register a people picker\n\n\n props.onGetValue = function (ctrl) {\n // Return the value\n return picker ? picker.getValue() : ctrl.value;\n };\n});\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/peoplePicker/index.js?");
|
|
713
713
|
|
|
714
714
|
/***/ }),
|
|
715
715
|
|