dattatable 2.11.65 → 2.11.66

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.
Files changed (68) hide show
  1. package/build/common/list.js +2 -2
  2. package/dist/dattatable.js +1 -1
  3. package/dist/dattatable.min.js +1 -1
  4. package/docs/classes/Accordion.html +2 -2
  5. package/docs/classes/AuditLog.html +2 -2
  6. package/docs/classes/CanvasForm.html +2 -2
  7. package/docs/classes/Comments.html +2 -2
  8. package/docs/classes/Dashboard.html +4 -4
  9. package/docs/classes/DataTable.html +3 -3
  10. package/docs/classes/Documents.html +6 -6
  11. package/docs/classes/FilterSlideout.html +2 -2
  12. package/docs/classes/Footer.html +2 -2
  13. package/docs/classes/Header.html +2 -2
  14. package/docs/classes/InstallationRequired.html +2 -2
  15. package/docs/classes/ItemForm.html +5 -5
  16. package/docs/classes/List.html +4 -4
  17. package/docs/classes/ListConfig.html +2 -2
  18. package/docs/classes/ListSecurity.html +2 -2
  19. package/docs/classes/LoadingDialog.html +2 -2
  20. package/docs/classes/Modal.html +2 -2
  21. package/docs/classes/Navigation.html +3 -3
  22. package/docs/classes/Tiles.html +2 -2
  23. package/docs/classes/Timeout.html +2 -2
  24. package/docs/enums/ActionButtonTypes.html +2 -2
  25. package/docs/functions/formatBytes.html +1 -1
  26. package/docs/functions/formatDateValue.html +1 -1
  27. package/docs/functions/formatTimeValue.html +1 -1
  28. package/docs/functions/getContextInfo.html +1 -1
  29. package/docs/functions/getFileExt.html +1 -1
  30. package/docs/functions/waitForTheme.html +1 -1
  31. package/docs/interfaces/IAccordion.html +2 -2
  32. package/docs/interfaces/IAccordionProps.html +2 -2
  33. package/docs/interfaces/IAuditLogItem.html +2 -2
  34. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  35. package/docs/interfaces/IAuditLogProps.html +2 -2
  36. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  37. package/docs/interfaces/ICommentsItem.html +2 -2
  38. package/docs/interfaces/ICreateLookupData.html +2 -2
  39. package/docs/interfaces/IDashboardProps.html +2 -2
  40. package/docs/interfaces/IDataTable.html +2 -2
  41. package/docs/interfaces/IDataTableProps.html +2 -2
  42. package/docs/interfaces/IDocumentsProps.html +2 -2
  43. package/docs/interfaces/IFilterItem.html +2 -2
  44. package/docs/interfaces/IFilterProps.html +2 -2
  45. package/docs/interfaces/IFooterProps.html +2 -2
  46. package/docs/interfaces/IGenerateLookupDataProps.html +2 -2
  47. package/docs/interfaces/IHeaderProps.html +2 -2
  48. package/docs/interfaces/IInstallProps.html +2 -2
  49. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  50. package/docs/interfaces/IItemFormEditProps.html +2 -2
  51. package/docs/interfaces/IItemFormSaveProps.html +2 -2
  52. package/docs/interfaces/IItemFormTab.html +2 -2
  53. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  54. package/docs/interfaces/IItemFormViewProps.html +2 -2
  55. package/docs/interfaces/IListConfig.html +2 -2
  56. package/docs/interfaces/IListConfigProps.html +2 -2
  57. package/docs/interfaces/IListProps.html +2 -2
  58. package/docs/interfaces/IListSecurity.html +2 -2
  59. package/docs/interfaces/IListSecurityItem.html +2 -2
  60. package/docs/interfaces/ILookupData.html +2 -2
  61. package/docs/interfaces/IShowDialogProps.html +2 -2
  62. package/docs/interfaces/ITiles.html +2 -2
  63. package/docs/interfaces/ITilesProps.html +2 -2
  64. package/docs/interfaces/IValidateLookupsProps.html +2 -2
  65. package/docs/variables/DattaTable.html +1 -1
  66. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  67. package/package.json +1 -1
  68. package/tsconfig.json +5 -1
@@ -644,7 +644,7 @@ var List = /** @class */ (function () {
644
644
  // Clear the modal/canvas
645
645
  this.clear(props);
646
646
  // Display the form
647
- _1.ItemForm.create(props).then(null, this._onLoadFormError);
647
+ this.ItemForm.create(props).then(null, this._onLoadFormError);
648
648
  };
649
649
  // Refresh the data
650
650
  List.prototype.refresh = function (query) {
@@ -717,7 +717,7 @@ var List = /** @class */ (function () {
717
717
  // Clear the modal/canvas
718
718
  this.clear(props);
719
719
  // Display the form
720
- _1.ItemForm.view(props).then(null, this._onLoadFormError);
720
+ this.ItemForm.view(props).then(null, this._onLoadFormError);
721
721
  };
722
722
  return List;
723
723
  }());
@@ -104,7 +104,7 @@ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assig
104
104
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
105
105
 
106
106
  "use strict";
107
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.List = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.15.65_@popperjs+core@2.11.8/node_modules/gd-sprest-bs/build/index.js\");\r\nvar _1 = __webpack_require__(/*! . */ \"./build/common/index.js\");\r\n/**\r\n * List\r\n */\r\nvar List = /** @class */ (function () {\r\n // Constructor\r\n function List(props) {\r\n var _this = this;\r\n /** Public Properties */\r\n // CAML query\r\n this._camlQuery = null;\r\n // Item Form\r\n this._itemForm = null;\r\n // Items\r\n this._items = null;\r\n // List Content Types Information\r\n this._listContentTypes = null;\r\n // List Fields Information\r\n this._listFields = null;\r\n // List Information\r\n this._listInfo = null;\r\n // List Url\r\n this._listUrl = null;\r\n // List Views Information\r\n this._listViews = null;\r\n // List Id\r\n this._listId = null;\r\n // List Name\r\n this._listName = null;\r\n // OData query\r\n this._odata = null;\r\n // View name\r\n this._viewName = null;\r\n // View Xml\r\n this._viewXml = null;\r\n // Web Url\r\n this._webUrl = null;\r\n /** Private Properties */\r\n // Base Permissions\r\n this._basePermissions = null;\r\n // Error event when loading the items fail\r\n this._onInitError = null;\r\n // Event triggered when the component is initialized\r\n this._onInitialized = null;\r\n // Items loading event\r\n this._onItemLoading = null;\r\n // Items loaded event\r\n this._onItemsLoaded = null;\r\n // Error event when loading a form\r\n this._onLoadFormError = null;\r\n // Refresh event when refreshing the items\r\n this._onRefreshItems = null;\r\n // Event triggered when the form is reset\r\n this._onResetForm = null;\r\n // The request digest value of the target site\r\n this._requestDigest = null;\r\n // Save the properties\r\n this._camlQuery = props.camlQuery;\r\n this._listId = props.listId;\r\n this._listName = props.listName;\r\n this._odata = props.itemQuery;\r\n this._onInitError = props.onInitError;\r\n this._onInitialized = props.onInitialized;\r\n this._onItemLoading = props.onItemLoading;\r\n this._onItemsLoaded = props.onItemsLoaded;\r\n this._onLoadFormError = props.onLoadFormError;\r\n this._onRefreshItems = props.onRefreshItems;\r\n this._onResetForm = props.onResetForm;\r\n this._viewName = props.viewName;\r\n this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;\r\n // Set the context information\r\n (0, _1.getContextInfo)(props.webUrl).then(function (requestDigest) {\r\n _this._requestDigest = requestDigest;\r\n // Load the list information\r\n _this.init().then(function () {\r\n // Load the items\r\n _this.loadItems().then(function () {\r\n // Call the event\r\n _this._onInitialized ? _this._onInitialized() : null;\r\n // Call the items loaded event\r\n _this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }\r\n Object.defineProperty(List.prototype, \"CAMLQuery\", {\r\n get: function () { return this._camlQuery; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanAddEditItems\", {\r\n // Flag to determine if the user can add/edit items to the list\r\n get: function () {\r\n return this.hasPermissions([\r\n gd_sprest_bs_1.SPTypes.BasePermissionTypes.AddListItems,\r\n gd_sprest_bs_1.SPTypes.BasePermissionTypes.EditListItems\r\n ]);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanDeleteItems\", {\r\n // Flag to determine if the user can delete items to the list\r\n get: function () {\r\n return this.hasPermissions(gd_sprest_bs_1.SPTypes.BasePermissionTypes.DeleteListItems);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanViewItems\", {\r\n // Flag to determine if the user can view items to the list \r\n get: function () {\r\n return this.hasPermissions(gd_sprest_bs_1.SPTypes.BasePermissionTypes.ViewListItems);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForm\", {\r\n // Reference to the edit form\r\n get: function () { return this.ItemForm.EditForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForms\", {\r\n // Reference to the edit forms, if tabs are used\r\n get: function () { return this.ItemForm.EditForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ItemForm\", {\r\n get: function () { return this._itemForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"Items\", {\r\n get: function () { return this._items; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListContentTypes\", {\r\n get: function () { return this._listContentTypes; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListFields\", {\r\n get: function () { return this._listFields; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListInfo\", {\r\n get: function () { return this._listInfo; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListSettingsUrl\", {\r\n // List Settings Url\r\n get: function () { return \"\".concat(this.WebUrl, \"/\").concat(gd_sprest_bs_1.ContextInfo.layoutsUrl, \"/listedit.aspx?List=\").concat(this.ListInfo.Id); },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListUrl\", {\r\n get: function () { return this._listUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListViews\", {\r\n get: function () { return this._listViews; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListId\", {\r\n get: function () { return this._listId; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListName\", {\r\n get: function () { return this._listName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"OData\", {\r\n get: function () { return this._odata; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForm\", {\r\n // Reference to the display form\r\n get: function () { return this.ItemForm.DisplayForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForms\", {\r\n // Reference to the display forms, if tabs are used\r\n get: function () { return this.ItemForm.DisplayForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewName\", {\r\n get: function () { return this._viewName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewXml\", {\r\n get: function () { return this._viewXml; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"WebUrl\", {\r\n get: function () { return this._webUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Clears the modal or canvas\r\n List.prototype.clear = function (props) {\r\n // Set the item form\r\n this._itemForm = new _1.ItemForm(props);\r\n this._itemForm.ListName = this.ListName;\r\n // Ensure we are not rendering to a specified element\r\n if (props.elForm == null) {\r\n // Clear the modal/form\r\n var useModal = typeof (props.useModal) === \"boolean\" ? props.useModal : this.ItemForm.UseModal;\r\n useModal ? _1.Modal.clear() : _1.CanvasForm.clear();\r\n }\r\n // Call the event\r\n this._onResetForm ? this._onResetForm() : null;\r\n };\r\n // Reference to the create item method\r\n List.prototype.createItem = function (values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items().add(values).execute(resolve, reject);\r\n });\r\n };\r\n // Deletes the item and removes it from the internal items array\r\n List.prototype.deleteItem = function (itemId) {\r\n var _this = this;\r\n // Parse the items\r\n for (var i = 0; i < this.Items.length; i++) {\r\n var item = this.Items[i];\r\n // See if this is the target item\r\n if (item[\"Id\"] == itemId || item[\"ID\"] == itemId) {\r\n // Remove the item\r\n this.Items.splice(i, 1);\r\n break;\r\n }\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Delete the item\r\n _this.ListInfo.Items(itemId).delete().execute(resolve, reject);\r\n });\r\n };\r\n // Displays the edit form\r\n List.prototype.editForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n this.ItemForm.edit(props).then(null, this._onLoadFormError);\r\n };\r\n // Gets the changes for a list item's version history\r\n List.prototype.getChanges = function (id, defaultFields) {\r\n var _this = this;\r\n if (defaultFields === void 0) { defaultFields = []; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var changes = {};\r\n // Get the item\r\n var item = _this.getItem(id);\r\n if (item) {\r\n // Get the versions for this item\r\n item[\"Versions\"]().execute(function (versions) {\r\n // Parse the versions\r\n for (var i = 0; i < versions.results.length; i++) {\r\n var version = versions.results[i];\r\n var prevVersion = versions.results[i + 1];\r\n var versionId = version.VersionLabel;\r\n // Set the change object\r\n changes[versionId] = {};\r\n // Set the default properties\r\n for (var i_1 = 0; i_1 < defaultFields.length; i_1++) {\r\n var defaultField = defaultFields[i_1];\r\n // Set the default value\r\n changes[versionId][defaultField] = version[defaultField];\r\n }\r\n // Parse the list fields\r\n for (var j = 0; j < _this.ListFields.length; j++) {\r\n var field = _this.ListFields[j];\r\n var value = version[field.InternalName] || version[field.InternalName + \"Id\"];\r\n var prevValue = prevVersion ? prevVersion[field.InternalName] || prevVersion[field.InternalName + \"Id\"] : null;\r\n // Skip the default properties\r\n if (defaultFields.indexOf(field.InternalName) >= 0) {\r\n continue;\r\n }\r\n // Skip functions\r\n if (typeof (value) === \"function\") {\r\n continue;\r\n }\r\n // Try to convert the values to a string\r\n try {\r\n if (JSON.stringify(value) != JSON.stringify(prevValue)) {\r\n // Append the change\r\n changes[versionId][field.InternalName] = value;\r\n }\r\n }\r\n // Skip this property on error\r\n catch (_a) { }\r\n }\r\n }\r\n // Resolve the request\r\n resolve(changes);\r\n }, reject);\r\n }\r\n });\r\n };\r\n // Gets a list field by internal or title\r\n List.prototype.getField = function (name) {\r\n var titleField = null;\r\n // Parse the fields\r\n for (var i = 0; i < this.ListFields.length; i++) {\r\n var field = this.ListFields[i];\r\n // Try to find the field by internal name first\r\n if (field.InternalName == name) {\r\n // Return the field if we match by internal\r\n return field;\r\n }\r\n // Else, see if the title field matches and save a reference\r\n else if (field.Title == name) {\r\n // Save the field reference\r\n titleField = field;\r\n }\r\n }\r\n // Return the title field if it was found\r\n return titleField;\r\n };\r\n // Gets a list field by internal or title\r\n List.prototype.getFieldById = function (id) {\r\n if (id === void 0) { id = \"\"; }\r\n var fieldId = id.replace(/{|}/g, '');\r\n // Parse the fields\r\n for (var i = 0; i < this.ListFields.length; i++) {\r\n var field = this.ListFields[i];\r\n // See if this is the target field\r\n if (field.Id == fieldId) {\r\n // Return the field if we match by internal\r\n return field;\r\n }\r\n }\r\n // Not found\r\n return null;\r\n };\r\n // Gets a list item by id\r\n List.prototype.getItem = function (id) {\r\n // Parse the items\r\n for (var i = 0; i < this.Items.length; i++) {\r\n var item = this.Items[i];\r\n // See if this is the target item\r\n if (item[\"Id\"] == id || item[\"ID\"] == id) {\r\n // Return the item\r\n return item;\r\n }\r\n }\r\n // Not found\r\n return null;\r\n };\r\n // Determines if the user has permissions to the list\r\n List.prototype.hasPermissions = function (permissions) {\r\n // See if the user has permissions\r\n return gd_sprest_bs_1.Helper.hasPermissions(this._basePermissions, permissions);\r\n };\r\n // Initializes the list component\r\n List.prototype.init = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Set the web\r\n var web = (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n });\r\n // Get the list\r\n var list = _this.ListId ? web.Lists().getById(_this.ListId) : web.Lists(_this.ListName);\r\n // Query the list content types\r\n list.execute(function (list) {\r\n // Set the list id/name\r\n _this._listId = list.Id;\r\n _this._listName = list.Title;\r\n // Save the list information\r\n _this._listInfo = list;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n });\r\n // Get the user permissions for this list\r\n list.query({ Expand: [\"EffectiveBasePermissions\"] }).execute(function (list) {\r\n _this._basePermissions = list.EffectiveBasePermissions;\r\n });\r\n // Get the root folder\r\n list.RootFolder().execute(function (folder) {\r\n // Set the url\r\n _this._listUrl = folder.ServerRelativeUrl;\r\n }, true);\r\n // Query the content types\r\n list.ContentTypes().query({\r\n Expand: [\"FieldLinks\", \"Fields\", \"Parent\"]\r\n }).execute(function (cts) {\r\n // Save the content types\r\n _this._listContentTypes = cts.results;\r\n }, true);\r\n // Query the list fields\r\n list.Fields().execute(function (fields) {\r\n // Save the fields\r\n _this._listFields = fields.results;\r\n }, true);\r\n // Query the list views\r\n list.Views().query({\r\n Expand: [\"ViewFields\"]\r\n }).execute(function (views) {\r\n // Save the views\r\n _this._listViews = views.results;\r\n }, true);\r\n // Wait for the requests to complete\r\n list.done(function () {\r\n // See if the view name is specified\r\n if (_this.ViewName) {\r\n // Parse the views\r\n for (var i = 0; i < _this.ListViews.length; i++) {\r\n var view = _this.ListViews[i];\r\n if (view.Title.toLowerCase() == _this.ViewName.toLowerCase()) {\r\n // Set the view xml\r\n _this._viewXml = view.ListViewXml;\r\n }\r\n }\r\n }\r\n // Resolve the request\r\n resolve();\r\n });\r\n });\r\n };\r\n // Loads the items\r\n List.prototype.loadItem = function (itemId, query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).Items(itemId).query({\r\n Custom: query ? query.Custom : null,\r\n Expand: query ? query.Expand : null,\r\n Select: query ? query.Select : null\r\n }).execute(function (newItem) {\r\n var itemFound = false;\r\n // Parse the items\r\n for (var i = 0; i < _this._items.length; i++) {\r\n var item = _this._items[i];\r\n // See if this is the item\r\n if (itemId == item.Id) {\r\n // Call the event\r\n _this._onItemLoading ? _this._onItemLoading(newItem) : null;\r\n // Replace the item\r\n _this._items[i] = newItem;\r\n // Set the flag and break from the loop\r\n itemFound = true;\r\n break;\r\n }\r\n }\r\n // See if the item wasn't found\r\n if (!itemFound) {\r\n // Append the item\r\n _this._items.push(newItem);\r\n }\r\n // Resolve the request\r\n resolve(newItem);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items\r\n List.prototype.loadItems = function (query) {\r\n // See if the caml query exists\r\n if (this.CAMLQuery) {\r\n return this.loadItemsByCAMLQuery();\r\n }\r\n // Else, see if the view xml exists\r\n else if (this.ViewXml) {\r\n // Get the items by the view name\r\n return this.loadItemsByView();\r\n }\r\n else {\r\n // Get the items by odata\r\n return this.loadItemsByQuery(query);\r\n }\r\n };\r\n // Loads the items by CAML query\r\n List.prototype.loadItemsByCAMLQuery = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items already exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).getItemsByQuery(_this.CAMLQuery).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items by odata query\r\n List.prototype.loadItemsByQuery = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName).Items().query(query).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items by view name\r\n List.prototype.loadItemsByView = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items already exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).getItems(_this.ViewXml).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Displays the new form\r\n List.prototype.newForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n _1.ItemForm.create(props).then(null, this._onLoadFormError);\r\n };\r\n // Refresh the data\r\n List.prototype.refresh = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Clear the items\r\n this._items = null;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Refresh the context information\r\n _this.refreshContextInfo().then(function () {\r\n // Load the data\r\n _this.loadItems(query).then(function (items) {\r\n // Call the event\r\n var callback = _this._onRefreshItems ? _this._onRefreshItems(items) : null;\r\n if (callback && typeof (callback.then) === \"function\") {\r\n // Wait for the request to complete\r\n callback.then(resolve, reject);\r\n }\r\n else {\r\n // Resolve the request\r\n resolve(items);\r\n }\r\n }, reject);\r\n }, reject);\r\n });\r\n };\r\n // Refreshes the context information\r\n List.prototype.refreshContextInfo = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the request digest is set\r\n if (_this._requestDigest) {\r\n // Get the context information\r\n (0, _1.getContextInfo)(_this.WebUrl).then(function (requestDigest) {\r\n // Save the value and resolve the request\r\n _this._requestDigest = requestDigest;\r\n resolve();\r\n }, reject);\r\n }\r\n else {\r\n // Resolve the request\r\n resolve();\r\n }\r\n });\r\n };\r\n // Refresh the data\r\n List.prototype.refreshItem = function (itemId, query) {\r\n if (query === void 0) { query = this.OData; }\r\n // Load the item\r\n return this.loadItem(itemId, query);\r\n };\r\n // Saves the item with an option to bypass validation\r\n List.prototype.save = function (bypassValidation) {\r\n // Save the item\r\n return this.ItemForm.save({ bypassValidation: bypassValidation });\r\n };\r\n // Updates an item\r\n List.prototype.updateItem = function (itemId, values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items(itemId).update(values).execute(resolve, reject);\r\n });\r\n };\r\n // Displays the view form\r\n List.prototype.viewForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n _1.ItemForm.view(props).then(null, this._onLoadFormError);\r\n };\r\n return List;\r\n}());\r\nexports.List = List;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/list.js?");
107
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.List = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.15.65_@popperjs+core@2.11.8/node_modules/gd-sprest-bs/build/index.js\");\r\nvar _1 = __webpack_require__(/*! . */ \"./build/common/index.js\");\r\n/**\r\n * List\r\n */\r\nvar List = /** @class */ (function () {\r\n // Constructor\r\n function List(props) {\r\n var _this = this;\r\n /** Public Properties */\r\n // CAML query\r\n this._camlQuery = null;\r\n // Item Form\r\n this._itemForm = null;\r\n // Items\r\n this._items = null;\r\n // List Content Types Information\r\n this._listContentTypes = null;\r\n // List Fields Information\r\n this._listFields = null;\r\n // List Information\r\n this._listInfo = null;\r\n // List Url\r\n this._listUrl = null;\r\n // List Views Information\r\n this._listViews = null;\r\n // List Id\r\n this._listId = null;\r\n // List Name\r\n this._listName = null;\r\n // OData query\r\n this._odata = null;\r\n // View name\r\n this._viewName = null;\r\n // View Xml\r\n this._viewXml = null;\r\n // Web Url\r\n this._webUrl = null;\r\n /** Private Properties */\r\n // Base Permissions\r\n this._basePermissions = null;\r\n // Error event when loading the items fail\r\n this._onInitError = null;\r\n // Event triggered when the component is initialized\r\n this._onInitialized = null;\r\n // Items loading event\r\n this._onItemLoading = null;\r\n // Items loaded event\r\n this._onItemsLoaded = null;\r\n // Error event when loading a form\r\n this._onLoadFormError = null;\r\n // Refresh event when refreshing the items\r\n this._onRefreshItems = null;\r\n // Event triggered when the form is reset\r\n this._onResetForm = null;\r\n // The request digest value of the target site\r\n this._requestDigest = null;\r\n // Save the properties\r\n this._camlQuery = props.camlQuery;\r\n this._listId = props.listId;\r\n this._listName = props.listName;\r\n this._odata = props.itemQuery;\r\n this._onInitError = props.onInitError;\r\n this._onInitialized = props.onInitialized;\r\n this._onItemLoading = props.onItemLoading;\r\n this._onItemsLoaded = props.onItemsLoaded;\r\n this._onLoadFormError = props.onLoadFormError;\r\n this._onRefreshItems = props.onRefreshItems;\r\n this._onResetForm = props.onResetForm;\r\n this._viewName = props.viewName;\r\n this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;\r\n // Set the context information\r\n (0, _1.getContextInfo)(props.webUrl).then(function (requestDigest) {\r\n _this._requestDigest = requestDigest;\r\n // Load the list information\r\n _this.init().then(function () {\r\n // Load the items\r\n _this.loadItems().then(function () {\r\n // Call the event\r\n _this._onInitialized ? _this._onInitialized() : null;\r\n // Call the items loaded event\r\n _this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }\r\n Object.defineProperty(List.prototype, \"CAMLQuery\", {\r\n get: function () { return this._camlQuery; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanAddEditItems\", {\r\n // Flag to determine if the user can add/edit items to the list\r\n get: function () {\r\n return this.hasPermissions([\r\n gd_sprest_bs_1.SPTypes.BasePermissionTypes.AddListItems,\r\n gd_sprest_bs_1.SPTypes.BasePermissionTypes.EditListItems\r\n ]);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanDeleteItems\", {\r\n // Flag to determine if the user can delete items to the list\r\n get: function () {\r\n return this.hasPermissions(gd_sprest_bs_1.SPTypes.BasePermissionTypes.DeleteListItems);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"CanViewItems\", {\r\n // Flag to determine if the user can view items to the list \r\n get: function () {\r\n return this.hasPermissions(gd_sprest_bs_1.SPTypes.BasePermissionTypes.ViewListItems);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForm\", {\r\n // Reference to the edit form\r\n get: function () { return this.ItemForm.EditForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForms\", {\r\n // Reference to the edit forms, if tabs are used\r\n get: function () { return this.ItemForm.EditForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ItemForm\", {\r\n get: function () { return this._itemForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"Items\", {\r\n get: function () { return this._items; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListContentTypes\", {\r\n get: function () { return this._listContentTypes; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListFields\", {\r\n get: function () { return this._listFields; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListInfo\", {\r\n get: function () { return this._listInfo; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListSettingsUrl\", {\r\n // List Settings Url\r\n get: function () { return \"\".concat(this.WebUrl, \"/\").concat(gd_sprest_bs_1.ContextInfo.layoutsUrl, \"/listedit.aspx?List=\").concat(this.ListInfo.Id); },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListUrl\", {\r\n get: function () { return this._listUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListViews\", {\r\n get: function () { return this._listViews; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListId\", {\r\n get: function () { return this._listId; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListName\", {\r\n get: function () { return this._listName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"OData\", {\r\n get: function () { return this._odata; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForm\", {\r\n // Reference to the display form\r\n get: function () { return this.ItemForm.DisplayForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForms\", {\r\n // Reference to the display forms, if tabs are used\r\n get: function () { return this.ItemForm.DisplayForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewName\", {\r\n get: function () { return this._viewName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewXml\", {\r\n get: function () { return this._viewXml; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"WebUrl\", {\r\n get: function () { return this._webUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Clears the modal or canvas\r\n List.prototype.clear = function (props) {\r\n // Set the item form\r\n this._itemForm = new _1.ItemForm(props);\r\n this._itemForm.ListName = this.ListName;\r\n // Ensure we are not rendering to a specified element\r\n if (props.elForm == null) {\r\n // Clear the modal/form\r\n var useModal = typeof (props.useModal) === \"boolean\" ? props.useModal : this.ItemForm.UseModal;\r\n useModal ? _1.Modal.clear() : _1.CanvasForm.clear();\r\n }\r\n // Call the event\r\n this._onResetForm ? this._onResetForm() : null;\r\n };\r\n // Reference to the create item method\r\n List.prototype.createItem = function (values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items().add(values).execute(resolve, reject);\r\n });\r\n };\r\n // Deletes the item and removes it from the internal items array\r\n List.prototype.deleteItem = function (itemId) {\r\n var _this = this;\r\n // Parse the items\r\n for (var i = 0; i < this.Items.length; i++) {\r\n var item = this.Items[i];\r\n // See if this is the target item\r\n if (item[\"Id\"] == itemId || item[\"ID\"] == itemId) {\r\n // Remove the item\r\n this.Items.splice(i, 1);\r\n break;\r\n }\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Delete the item\r\n _this.ListInfo.Items(itemId).delete().execute(resolve, reject);\r\n });\r\n };\r\n // Displays the edit form\r\n List.prototype.editForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n this.ItemForm.edit(props).then(null, this._onLoadFormError);\r\n };\r\n // Gets the changes for a list item's version history\r\n List.prototype.getChanges = function (id, defaultFields) {\r\n var _this = this;\r\n if (defaultFields === void 0) { defaultFields = []; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var changes = {};\r\n // Get the item\r\n var item = _this.getItem(id);\r\n if (item) {\r\n // Get the versions for this item\r\n item[\"Versions\"]().execute(function (versions) {\r\n // Parse the versions\r\n for (var i = 0; i < versions.results.length; i++) {\r\n var version = versions.results[i];\r\n var prevVersion = versions.results[i + 1];\r\n var versionId = version.VersionLabel;\r\n // Set the change object\r\n changes[versionId] = {};\r\n // Set the default properties\r\n for (var i_1 = 0; i_1 < defaultFields.length; i_1++) {\r\n var defaultField = defaultFields[i_1];\r\n // Set the default value\r\n changes[versionId][defaultField] = version[defaultField];\r\n }\r\n // Parse the list fields\r\n for (var j = 0; j < _this.ListFields.length; j++) {\r\n var field = _this.ListFields[j];\r\n var value = version[field.InternalName] || version[field.InternalName + \"Id\"];\r\n var prevValue = prevVersion ? prevVersion[field.InternalName] || prevVersion[field.InternalName + \"Id\"] : null;\r\n // Skip the default properties\r\n if (defaultFields.indexOf(field.InternalName) >= 0) {\r\n continue;\r\n }\r\n // Skip functions\r\n if (typeof (value) === \"function\") {\r\n continue;\r\n }\r\n // Try to convert the values to a string\r\n try {\r\n if (JSON.stringify(value) != JSON.stringify(prevValue)) {\r\n // Append the change\r\n changes[versionId][field.InternalName] = value;\r\n }\r\n }\r\n // Skip this property on error\r\n catch (_a) { }\r\n }\r\n }\r\n // Resolve the request\r\n resolve(changes);\r\n }, reject);\r\n }\r\n });\r\n };\r\n // Gets a list field by internal or title\r\n List.prototype.getField = function (name) {\r\n var titleField = null;\r\n // Parse the fields\r\n for (var i = 0; i < this.ListFields.length; i++) {\r\n var field = this.ListFields[i];\r\n // Try to find the field by internal name first\r\n if (field.InternalName == name) {\r\n // Return the field if we match by internal\r\n return field;\r\n }\r\n // Else, see if the title field matches and save a reference\r\n else if (field.Title == name) {\r\n // Save the field reference\r\n titleField = field;\r\n }\r\n }\r\n // Return the title field if it was found\r\n return titleField;\r\n };\r\n // Gets a list field by internal or title\r\n List.prototype.getFieldById = function (id) {\r\n if (id === void 0) { id = \"\"; }\r\n var fieldId = id.replace(/{|}/g, '');\r\n // Parse the fields\r\n for (var i = 0; i < this.ListFields.length; i++) {\r\n var field = this.ListFields[i];\r\n // See if this is the target field\r\n if (field.Id == fieldId) {\r\n // Return the field if we match by internal\r\n return field;\r\n }\r\n }\r\n // Not found\r\n return null;\r\n };\r\n // Gets a list item by id\r\n List.prototype.getItem = function (id) {\r\n // Parse the items\r\n for (var i = 0; i < this.Items.length; i++) {\r\n var item = this.Items[i];\r\n // See if this is the target item\r\n if (item[\"Id\"] == id || item[\"ID\"] == id) {\r\n // Return the item\r\n return item;\r\n }\r\n }\r\n // Not found\r\n return null;\r\n };\r\n // Determines if the user has permissions to the list\r\n List.prototype.hasPermissions = function (permissions) {\r\n // See if the user has permissions\r\n return gd_sprest_bs_1.Helper.hasPermissions(this._basePermissions, permissions);\r\n };\r\n // Initializes the list component\r\n List.prototype.init = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Set the web\r\n var web = (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n });\r\n // Get the list\r\n var list = _this.ListId ? web.Lists().getById(_this.ListId) : web.Lists(_this.ListName);\r\n // Query the list content types\r\n list.execute(function (list) {\r\n // Set the list id/name\r\n _this._listId = list.Id;\r\n _this._listName = list.Title;\r\n // Save the list information\r\n _this._listInfo = list;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n });\r\n // Get the user permissions for this list\r\n list.query({ Expand: [\"EffectiveBasePermissions\"] }).execute(function (list) {\r\n _this._basePermissions = list.EffectiveBasePermissions;\r\n });\r\n // Get the root folder\r\n list.RootFolder().execute(function (folder) {\r\n // Set the url\r\n _this._listUrl = folder.ServerRelativeUrl;\r\n }, true);\r\n // Query the content types\r\n list.ContentTypes().query({\r\n Expand: [\"FieldLinks\", \"Fields\", \"Parent\"]\r\n }).execute(function (cts) {\r\n // Save the content types\r\n _this._listContentTypes = cts.results;\r\n }, true);\r\n // Query the list fields\r\n list.Fields().execute(function (fields) {\r\n // Save the fields\r\n _this._listFields = fields.results;\r\n }, true);\r\n // Query the list views\r\n list.Views().query({\r\n Expand: [\"ViewFields\"]\r\n }).execute(function (views) {\r\n // Save the views\r\n _this._listViews = views.results;\r\n }, true);\r\n // Wait for the requests to complete\r\n list.done(function () {\r\n // See if the view name is specified\r\n if (_this.ViewName) {\r\n // Parse the views\r\n for (var i = 0; i < _this.ListViews.length; i++) {\r\n var view = _this.ListViews[i];\r\n if (view.Title.toLowerCase() == _this.ViewName.toLowerCase()) {\r\n // Set the view xml\r\n _this._viewXml = view.ListViewXml;\r\n }\r\n }\r\n }\r\n // Resolve the request\r\n resolve();\r\n });\r\n });\r\n };\r\n // Loads the items\r\n List.prototype.loadItem = function (itemId, query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).Items(itemId).query({\r\n Custom: query ? query.Custom : null,\r\n Expand: query ? query.Expand : null,\r\n Select: query ? query.Select : null\r\n }).execute(function (newItem) {\r\n var itemFound = false;\r\n // Parse the items\r\n for (var i = 0; i < _this._items.length; i++) {\r\n var item = _this._items[i];\r\n // See if this is the item\r\n if (itemId == item.Id) {\r\n // Call the event\r\n _this._onItemLoading ? _this._onItemLoading(newItem) : null;\r\n // Replace the item\r\n _this._items[i] = newItem;\r\n // Set the flag and break from the loop\r\n itemFound = true;\r\n break;\r\n }\r\n }\r\n // See if the item wasn't found\r\n if (!itemFound) {\r\n // Append the item\r\n _this._items.push(newItem);\r\n }\r\n // Resolve the request\r\n resolve(newItem);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items\r\n List.prototype.loadItems = function (query) {\r\n // See if the caml query exists\r\n if (this.CAMLQuery) {\r\n return this.loadItemsByCAMLQuery();\r\n }\r\n // Else, see if the view xml exists\r\n else if (this.ViewXml) {\r\n // Get the items by the view name\r\n return this.loadItemsByView();\r\n }\r\n else {\r\n // Get the items by odata\r\n return this.loadItemsByQuery(query);\r\n }\r\n };\r\n // Loads the items by CAML query\r\n List.prototype.loadItemsByCAMLQuery = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items already exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).getItemsByQuery(_this.CAMLQuery).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items by odata query\r\n List.prototype.loadItemsByQuery = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName).Items().query(query).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Loads the items by view name\r\n List.prototype.loadItemsByView = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items already exist\r\n if (_this._items) {\r\n resolve(_this._items);\r\n return;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl, {\r\n disableCache: true,\r\n requestDigest: _this._requestDigest\r\n }).Lists(_this.ListName).getItems(_this.ViewXml).execute(function (items) {\r\n // See if the event exists\r\n if (_this._onItemLoading) {\r\n // Parse the items\r\n for (var i = 0; i < items.results.length; i++) {\r\n // Call the event\r\n _this._onItemLoading(items.results[i]);\r\n }\r\n }\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Displays the new form\r\n List.prototype.newForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n this.ItemForm.create(props).then(null, this._onLoadFormError);\r\n };\r\n // Refresh the data\r\n List.prototype.refresh = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Clear the items\r\n this._items = null;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Refresh the context information\r\n _this.refreshContextInfo().then(function () {\r\n // Load the data\r\n _this.loadItems(query).then(function (items) {\r\n // Call the event\r\n var callback = _this._onRefreshItems ? _this._onRefreshItems(items) : null;\r\n if (callback && typeof (callback.then) === \"function\") {\r\n // Wait for the request to complete\r\n callback.then(resolve, reject);\r\n }\r\n else {\r\n // Resolve the request\r\n resolve(items);\r\n }\r\n }, reject);\r\n }, reject);\r\n });\r\n };\r\n // Refreshes the context information\r\n List.prototype.refreshContextInfo = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the request digest is set\r\n if (_this._requestDigest) {\r\n // Get the context information\r\n (0, _1.getContextInfo)(_this.WebUrl).then(function (requestDigest) {\r\n // Save the value and resolve the request\r\n _this._requestDigest = requestDigest;\r\n resolve();\r\n }, reject);\r\n }\r\n else {\r\n // Resolve the request\r\n resolve();\r\n }\r\n });\r\n };\r\n // Refresh the data\r\n List.prototype.refreshItem = function (itemId, query) {\r\n if (query === void 0) { query = this.OData; }\r\n // Load the item\r\n return this.loadItem(itemId, query);\r\n };\r\n // Saves the item with an option to bypass validation\r\n List.prototype.save = function (bypassValidation) {\r\n // Save the item\r\n return this.ItemForm.save({ bypassValidation: bypassValidation });\r\n };\r\n // Updates an item\r\n List.prototype.updateItem = function (itemId, values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items(itemId).update(values).execute(resolve, reject);\r\n });\r\n };\r\n // Displays the view form\r\n List.prototype.viewForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear(props);\r\n // Display the form\r\n this.ItemForm.view(props).then(null, this._onLoadFormError);\r\n };\r\n return List;\r\n}());\r\nexports.List = List;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/list.js?");
108
108
 
109
109
  /***/ }),
110
110