dattatable 2.10.10 → 2.10.11

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 (59) hide show
  1. package/build/common/comments.js +7 -0
  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 +4 -4
  16. package/docs/classes/List.html +4 -4
  17. package/docs/classes/ListSecurity.html +2 -2
  18. package/docs/classes/LoadingDialog.html +2 -2
  19. package/docs/classes/Modal.html +2 -2
  20. package/docs/classes/Navigation.html +3 -3
  21. package/docs/classes/Tiles.html +2 -2
  22. package/docs/classes/Timeout.html +2 -2
  23. package/docs/enums/ActionButtonTypes.html +2 -2
  24. package/docs/functions/formatBytes.html +1 -1
  25. package/docs/functions/formatDateValue.html +1 -1
  26. package/docs/functions/formatTimeValue.html +1 -1
  27. package/docs/functions/getContextInfo.html +1 -1
  28. package/docs/functions/getFileExt.html +1 -1
  29. package/docs/functions/waitForTheme.html +1 -1
  30. package/docs/interfaces/IAccordion.html +2 -2
  31. package/docs/interfaces/IAccordionProps.html +2 -2
  32. package/docs/interfaces/IAuditLogItem.html +2 -2
  33. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  34. package/docs/interfaces/IAuditLogProps.html +2 -2
  35. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  36. package/docs/interfaces/ICommentsItem.html +2 -2
  37. package/docs/interfaces/IDashboardProps.html +2 -2
  38. package/docs/interfaces/IDataTable.html +2 -2
  39. package/docs/interfaces/IDataTableProps.html +2 -2
  40. package/docs/interfaces/IDocumentsProps.html +2 -2
  41. package/docs/interfaces/IFilterItem.html +2 -2
  42. package/docs/interfaces/IFilterProps.html +2 -2
  43. package/docs/interfaces/IFooterProps.html +2 -2
  44. package/docs/interfaces/IHeaderProps.html +2 -2
  45. package/docs/interfaces/IInstallProps.html +2 -2
  46. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  47. package/docs/interfaces/IItemFormEditProps.html +2 -2
  48. package/docs/interfaces/IItemFormTab.html +2 -2
  49. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  50. package/docs/interfaces/IItemFormViewProps.html +2 -2
  51. package/docs/interfaces/IListProps.html +2 -2
  52. package/docs/interfaces/IListSecurity.html +2 -2
  53. package/docs/interfaces/IListSecurityItem.html +2 -2
  54. package/docs/interfaces/IShowDialogProps.html +2 -2
  55. package/docs/interfaces/ITiles.html +2 -2
  56. package/docs/interfaces/ITilesProps.html +2 -2
  57. package/docs/variables/DattaTable.html +1 -1
  58. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  59. package/package.json +1 -1
@@ -166,6 +166,13 @@ var Comments = /** @class */ (function () {
166
166
  var _this = this;
167
167
  // Set the header
168
168
  this._elModalHeader.innerHTML = "Add Comment";
169
+ // Clear the body and footer
170
+ while (this._elModalBody.firstChild) {
171
+ this._elModalBody.removeChild(this._elModalBody.firstChild);
172
+ }
173
+ while (this._elModalFooter.firstChild) {
174
+ this._elModalFooter.removeChild(this._elModalFooter.firstChild);
175
+ }
169
176
  // Create the form
170
177
  var form = gd_sprest_bs_1.Components.Form({
171
178
  el: this._elModalBody,
@@ -49,7 +49,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
49
49
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
50
50
 
51
51
  "use strict";
52
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Comments = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.56/node_modules/gd-sprest-bs/build/index.js\");\r\nvar moment = __webpack_require__(/*! moment */ \"./node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js\");\r\nvar canvas_1 = __webpack_require__(/*! ./canvas */ \"./build/common/canvas.js\");\r\nvar loadingDialog_1 = __webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\");\r\n// List Name\r\nvar LIST_NAME = \"Comments\";\r\n/**\r\n * Comments\r\n */\r\nvar Comments = /** @class */ (function () {\r\n function Comments() {\r\n }\r\n Object.defineProperty(Comments, \"CommentsListId\", {\r\n get: function () { return this._commentsListId; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Adds a comment to an item\r\n Comments.add = function (item, comment) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Ensure a comment exists\r\n if (comment) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Adding Comment\");\r\n loadingDialog_1.LoadingDialog.setBody(\"This dialog will close after the comment is added.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Add the item\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).Items().add({\r\n Comment: comment,\r\n Title: _this._listId + \"|\" + item.Id\r\n }).execute(function () {\r\n // Hide the loading dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Resolve the request\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 // Configuration\r\n Comments.configuration = function (cfg) {\r\n var commentsCfg = gd_sprest_bs_1.Helper.SPConfig({\r\n ListCfg: [\r\n {\r\n ListInformation: {\r\n Title: LIST_NAME,\r\n BaseTemplate: gd_sprest_bs_1.SPTypes.ListTemplateType.GenericList,\r\n Hidden: true,\r\n NoCrawl: true\r\n },\r\n TitleFieldDisplayName: \"Comment ID\",\r\n TitleFieldIndexed: true,\r\n CustomFields: [\r\n {\r\n name: \"Comment\",\r\n title: \"Comment\",\r\n type: gd_sprest_bs_1.Helper.SPCfgFieldType.Note,\r\n noteType: gd_sprest_bs_1.SPTypes.FieldNoteType.TextOnly\r\n }\r\n ],\r\n ViewInformation: [\r\n {\r\n ViewName: \"All Items\",\r\n ViewQuery: \"Author eq [Me]\",\r\n ViewFields: [\"LinkTitle\", \"Comment\", \"Author\", \"Created\"]\r\n }\r\n ]\r\n }\r\n ]\r\n });\r\n // Append the comments to the configuration if it exists\r\n if (cfg && cfg._configuration.ListCfg && cfg._configuration.ListCfg.length > 0) {\r\n // Append the list configuration\r\n cfg._configuration.ListCfg = cfg._configuration.ListCfg.concat(commentsCfg._configuration.ListCfg);\r\n }\r\n // Return the configuration\r\n return cfg || commentsCfg;\r\n };\r\n // Initialization of the component\r\n Comments.init = function (listName, webUrl) {\r\n var _this = this;\r\n // Create the modal element\r\n var el = document.createElement(\"div\");\r\n el.id = \"comments-modal\";\r\n // Ensure the body exists\r\n if (document.body) {\r\n // Append the element\r\n document.body.appendChild(el);\r\n }\r\n else {\r\n // Create an event\r\n window.addEventListener(\"load\", function () {\r\n // Append the element\r\n document.body.appendChild(el);\r\n });\r\n }\r\n // Render the canvas\r\n this._modal = gd_sprest_bs_1.Components.Modal({\r\n el: el,\r\n type: gd_sprest_bs_1.Components.ModalTypes.Medium,\r\n options: {\r\n autoClose: false,\r\n backdrop: true,\r\n centered: true,\r\n keyboard: true\r\n },\r\n onRenderBody: function (el) { _this._elModalBody = el; },\r\n onRenderFooter: function (el) { _this._elModalFooter = el; },\r\n onRenderHeader: function (el) { _this._elModalHeader = el.querySelector(\".modal-title\"); ; }\r\n });\r\n // Save the web url\r\n this._webUrl = webUrl;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Load the list id\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).query({\r\n Select: [\"Id\"]\r\n }).execute(function (list) {\r\n // Set the list id\r\n _this._commentsListId = list.Id;\r\n }, reject);\r\n // Load the List Information\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(listName).execute(function (list) {\r\n // Set the list id\r\n _this._listId = list.Id;\r\n // Resolve the request\r\n resolve();\r\n }, reject);\r\n });\r\n };\r\n // Loads the comments for the item\r\n Comments.load = function (item) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Ensure a list id exists\r\n if (_this._listId) {\r\n // Load the comments for this item\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).Items().query({\r\n Expand: [\"Author\"],\r\n Filter: \"Title eq '\" + _this._listId + \"|\" + item.Id + \"'\",\r\n OrderBy: [\"Created desc\"],\r\n Select: [\"Id\", \"Comment\", \"Created\", \"Title\", \"Author/Id\", \"Author/EMail\", \"Author/Title\"]\r\n }).execute(function (items) {\r\n // Resolve the request\r\n resolve(items.results);\r\n }, reject);\r\n }\r\n else {\r\n // Reject the request\r\n reject(\"The target list doesn't exist. Please initialize the component before using it.\");\r\n }\r\n });\r\n };\r\n // Displays the new comment form\r\n Comments.new = function (item, el) {\r\n var _this = this;\r\n // Set the header\r\n this._elModalHeader.innerHTML = \"Add Comment\";\r\n // Create the form\r\n var form = gd_sprest_bs_1.Components.Form({\r\n el: this._elModalBody,\r\n controls: [{\r\n name: \"comment\",\r\n label: \"Comment\",\r\n type: gd_sprest_bs_1.Components.FormControlTypes.TextArea,\r\n rows: 10,\r\n required: true,\r\n errorMessage: \"A value is required\"\r\n }]\r\n });\r\n // Set the footer\r\n gd_sprest_bs_1.Components.TooltipGroup({\r\n el: this._elModalFooter,\r\n tooltips: [\r\n {\r\n content: \"Click to add a comment to the request.\",\r\n btnProps: {\r\n text: \"Add\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSuccess,\r\n onClick: function () {\r\n // Ensure the form is valid\r\n if (form.isValid()) {\r\n // Hide the modal\r\n _this._modal.hide();\r\n // Add the comment\r\n _this.add(item, form.getValues()[\"comment\"]).then(function () {\r\n // View the comments\r\n _this.view(item, el);\r\n });\r\n }\r\n }\r\n }\r\n },\r\n {\r\n content: \"Closes this dialog and views the comments\",\r\n btnProps: {\r\n text: \"Close\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineDanger,\r\n onClick: function () {\r\n // Hide the modal\r\n _this._modal.hide();\r\n // Show the canvas form\r\n el ? null : canvas_1.CanvasForm.show();\r\n }\r\n }\r\n }\r\n ]\r\n });\r\n // Show the form\r\n this._modal.show();\r\n };\r\n // Security configuration\r\n Comments.security = function (cfg, webUrl) {\r\n // Resets the list permissions\r\n var resetPermissions = function () {\r\n return new Promise(function (resolve) {\r\n var list = (0, gd_sprest_bs_1.Web)(webUrl).Lists(LIST_NAME);\r\n // Reset the inheritance\r\n list.resetRoleInheritance().execute();\r\n // Clear the permissions\r\n list.breakRoleInheritance(false, true).execute(resolve, true);\r\n });\r\n };\r\n // Return a promise\r\n return new Promise(function (resolve) {\r\n var list = (0, gd_sprest_bs_1.Web)(webUrl).Lists(LIST_NAME);\r\n // Ensure a configuration exists\r\n if (cfg && cfg.length > 0) {\r\n // Reset the list permissions\r\n resetPermissions().then(function () {\r\n var _loop_1 = function (i) {\r\n var principalId = cfg[i].principalId;\r\n var roleDefId = cfg[i].roleDefId;\r\n // Update the list settings\r\n list.RoleAssignments().addRoleAssignment(principalId, roleDefId).execute(function () {\r\n // Log\r\n console.log(\"[Comments List] The user/group (\" + principalId + \") was added successfully.\");\r\n });\r\n };\r\n // Parse the configuration\r\n for (var i = 0; i < cfg.length; i++) {\r\n _loop_1(i);\r\n }\r\n // Wait for the requests to complete\r\n list.done(resolve);\r\n });\r\n }\r\n else {\r\n // Resolve the request\r\n resolve();\r\n }\r\n });\r\n };\r\n // Displays the comments in a canvas form\r\n Comments.view = function (item, el) {\r\n var _this = this;\r\n // Display a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Loading Comments\");\r\n loadingDialog_1.LoadingDialog.setBody(\"This dialog will close after the comments are loaded.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Clear the element\r\n while (el.firstChild) {\r\n el.removeChild(el.firstChild);\r\n }\r\n // Load the items\r\n this.load(item).then(function (comments) {\r\n // See if we are not rendering to an element\r\n if (el == null) {\r\n // Clear the form\r\n canvas_1.CanvasForm.clear();\r\n // Set the header\r\n canvas_1.CanvasForm.setHeader(\"<h5>Comments</h5>\");\r\n }\r\n // Render a nav\r\n gd_sprest_bs_1.Components.Navbar({\r\n el: el || canvas_1.CanvasForm.BodyElement,\r\n itemsEnd: [{\r\n text: \"+ Add Comment\",\r\n onClick: function () {\r\n // Hide the form\r\n el ? null : canvas_1.CanvasForm.hide();\r\n // Display a modal to add the comment\r\n _this.new(item, el);\r\n }\r\n }]\r\n });\r\n // Parse the comments\r\n for (var i = 0; i < comments.length; i++) {\r\n var comment = comments[i];\r\n // Render a toast\r\n gd_sprest_bs_1.Components.Toast({\r\n el: el || canvas_1.CanvasForm.BodyElement,\r\n headerText: comment.Author.Title,\r\n mutedText: moment(new Date(comment.Created)).toString(),\r\n body: (comment.Comment || \"\").replace(/\\r?\\n/g, '<br />'),\r\n options: {\r\n animation: true,\r\n autohide: false\r\n }\r\n });\r\n }\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Show the canvas form\r\n el ? null : canvas_1.CanvasForm.show();\r\n });\r\n };\r\n Comments._elModalBody = null;\r\n Comments._elModalFooter = null;\r\n Comments._elModalHeader = null;\r\n Comments._listId = null;\r\n Comments._modal = null;\r\n Comments._webUrl = null;\r\n // Comment's List Id\r\n Comments._commentsListId = null;\r\n return Comments;\r\n}());\r\nexports.Comments = Comments;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/comments.js?");
52
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Comments = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.56/node_modules/gd-sprest-bs/build/index.js\");\r\nvar moment = __webpack_require__(/*! moment */ \"./node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js\");\r\nvar canvas_1 = __webpack_require__(/*! ./canvas */ \"./build/common/canvas.js\");\r\nvar loadingDialog_1 = __webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\");\r\n// List Name\r\nvar LIST_NAME = \"Comments\";\r\n/**\r\n * Comments\r\n */\r\nvar Comments = /** @class */ (function () {\r\n function Comments() {\r\n }\r\n Object.defineProperty(Comments, \"CommentsListId\", {\r\n get: function () { return this._commentsListId; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Adds a comment to an item\r\n Comments.add = function (item, comment) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Ensure a comment exists\r\n if (comment) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Adding Comment\");\r\n loadingDialog_1.LoadingDialog.setBody(\"This dialog will close after the comment is added.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Add the item\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).Items().add({\r\n Comment: comment,\r\n Title: _this._listId + \"|\" + item.Id\r\n }).execute(function () {\r\n // Hide the loading dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Resolve the request\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 // Configuration\r\n Comments.configuration = function (cfg) {\r\n var commentsCfg = gd_sprest_bs_1.Helper.SPConfig({\r\n ListCfg: [\r\n {\r\n ListInformation: {\r\n Title: LIST_NAME,\r\n BaseTemplate: gd_sprest_bs_1.SPTypes.ListTemplateType.GenericList,\r\n Hidden: true,\r\n NoCrawl: true\r\n },\r\n TitleFieldDisplayName: \"Comment ID\",\r\n TitleFieldIndexed: true,\r\n CustomFields: [\r\n {\r\n name: \"Comment\",\r\n title: \"Comment\",\r\n type: gd_sprest_bs_1.Helper.SPCfgFieldType.Note,\r\n noteType: gd_sprest_bs_1.SPTypes.FieldNoteType.TextOnly\r\n }\r\n ],\r\n ViewInformation: [\r\n {\r\n ViewName: \"All Items\",\r\n ViewQuery: \"Author eq [Me]\",\r\n ViewFields: [\"LinkTitle\", \"Comment\", \"Author\", \"Created\"]\r\n }\r\n ]\r\n }\r\n ]\r\n });\r\n // Append the comments to the configuration if it exists\r\n if (cfg && cfg._configuration.ListCfg && cfg._configuration.ListCfg.length > 0) {\r\n // Append the list configuration\r\n cfg._configuration.ListCfg = cfg._configuration.ListCfg.concat(commentsCfg._configuration.ListCfg);\r\n }\r\n // Return the configuration\r\n return cfg || commentsCfg;\r\n };\r\n // Initialization of the component\r\n Comments.init = function (listName, webUrl) {\r\n var _this = this;\r\n // Create the modal element\r\n var el = document.createElement(\"div\");\r\n el.id = \"comments-modal\";\r\n // Ensure the body exists\r\n if (document.body) {\r\n // Append the element\r\n document.body.appendChild(el);\r\n }\r\n else {\r\n // Create an event\r\n window.addEventListener(\"load\", function () {\r\n // Append the element\r\n document.body.appendChild(el);\r\n });\r\n }\r\n // Render the canvas\r\n this._modal = gd_sprest_bs_1.Components.Modal({\r\n el: el,\r\n type: gd_sprest_bs_1.Components.ModalTypes.Medium,\r\n options: {\r\n autoClose: false,\r\n backdrop: true,\r\n centered: true,\r\n keyboard: true\r\n },\r\n onRenderBody: function (el) { _this._elModalBody = el; },\r\n onRenderFooter: function (el) { _this._elModalFooter = el; },\r\n onRenderHeader: function (el) { _this._elModalHeader = el.querySelector(\".modal-title\"); ; }\r\n });\r\n // Save the web url\r\n this._webUrl = webUrl;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Load the list id\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).query({\r\n Select: [\"Id\"]\r\n }).execute(function (list) {\r\n // Set the list id\r\n _this._commentsListId = list.Id;\r\n }, reject);\r\n // Load the List Information\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(listName).execute(function (list) {\r\n // Set the list id\r\n _this._listId = list.Id;\r\n // Resolve the request\r\n resolve();\r\n }, reject);\r\n });\r\n };\r\n // Loads the comments for the item\r\n Comments.load = function (item) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Ensure a list id exists\r\n if (_this._listId) {\r\n // Load the comments for this item\r\n (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(LIST_NAME).Items().query({\r\n Expand: [\"Author\"],\r\n Filter: \"Title eq '\" + _this._listId + \"|\" + item.Id + \"'\",\r\n OrderBy: [\"Created desc\"],\r\n Select: [\"Id\", \"Comment\", \"Created\", \"Title\", \"Author/Id\", \"Author/EMail\", \"Author/Title\"]\r\n }).execute(function (items) {\r\n // Resolve the request\r\n resolve(items.results);\r\n }, reject);\r\n }\r\n else {\r\n // Reject the request\r\n reject(\"The target list doesn't exist. Please initialize the component before using it.\");\r\n }\r\n });\r\n };\r\n // Displays the new comment form\r\n Comments.new = function (item, el) {\r\n var _this = this;\r\n // Set the header\r\n this._elModalHeader.innerHTML = \"Add Comment\";\r\n // Clear the body and footer\r\n while (this._elModalBody.firstChild) {\r\n this._elModalBody.removeChild(this._elModalBody.firstChild);\r\n }\r\n while (this._elModalFooter.firstChild) {\r\n this._elModalFooter.removeChild(this._elModalFooter.firstChild);\r\n }\r\n // Create the form\r\n var form = gd_sprest_bs_1.Components.Form({\r\n el: this._elModalBody,\r\n controls: [{\r\n name: \"comment\",\r\n label: \"Comment\",\r\n type: gd_sprest_bs_1.Components.FormControlTypes.TextArea,\r\n rows: 10,\r\n required: true,\r\n errorMessage: \"A value is required\"\r\n }]\r\n });\r\n // Set the footer\r\n gd_sprest_bs_1.Components.TooltipGroup({\r\n el: this._elModalFooter,\r\n tooltips: [\r\n {\r\n content: \"Click to add a comment to the request.\",\r\n btnProps: {\r\n text: \"Add\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSuccess,\r\n onClick: function () {\r\n // Ensure the form is valid\r\n if (form.isValid()) {\r\n // Hide the modal\r\n _this._modal.hide();\r\n // Add the comment\r\n _this.add(item, form.getValues()[\"comment\"]).then(function () {\r\n // View the comments\r\n _this.view(item, el);\r\n });\r\n }\r\n }\r\n }\r\n },\r\n {\r\n content: \"Closes this dialog and views the comments\",\r\n btnProps: {\r\n text: \"Close\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineDanger,\r\n onClick: function () {\r\n // Hide the modal\r\n _this._modal.hide();\r\n // Show the canvas form\r\n el ? null : canvas_1.CanvasForm.show();\r\n }\r\n }\r\n }\r\n ]\r\n });\r\n // Show the form\r\n this._modal.show();\r\n };\r\n // Security configuration\r\n Comments.security = function (cfg, webUrl) {\r\n // Resets the list permissions\r\n var resetPermissions = function () {\r\n return new Promise(function (resolve) {\r\n var list = (0, gd_sprest_bs_1.Web)(webUrl).Lists(LIST_NAME);\r\n // Reset the inheritance\r\n list.resetRoleInheritance().execute();\r\n // Clear the permissions\r\n list.breakRoleInheritance(false, true).execute(resolve, true);\r\n });\r\n };\r\n // Return a promise\r\n return new Promise(function (resolve) {\r\n var list = (0, gd_sprest_bs_1.Web)(webUrl).Lists(LIST_NAME);\r\n // Ensure a configuration exists\r\n if (cfg && cfg.length > 0) {\r\n // Reset the list permissions\r\n resetPermissions().then(function () {\r\n var _loop_1 = function (i) {\r\n var principalId = cfg[i].principalId;\r\n var roleDefId = cfg[i].roleDefId;\r\n // Update the list settings\r\n list.RoleAssignments().addRoleAssignment(principalId, roleDefId).execute(function () {\r\n // Log\r\n console.log(\"[Comments List] The user/group (\" + principalId + \") was added successfully.\");\r\n });\r\n };\r\n // Parse the configuration\r\n for (var i = 0; i < cfg.length; i++) {\r\n _loop_1(i);\r\n }\r\n // Wait for the requests to complete\r\n list.done(resolve);\r\n });\r\n }\r\n else {\r\n // Resolve the request\r\n resolve();\r\n }\r\n });\r\n };\r\n // Displays the comments in a canvas form\r\n Comments.view = function (item, el) {\r\n var _this = this;\r\n // Display a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Loading Comments\");\r\n loadingDialog_1.LoadingDialog.setBody(\"This dialog will close after the comments are loaded.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Clear the element\r\n while (el.firstChild) {\r\n el.removeChild(el.firstChild);\r\n }\r\n // Load the items\r\n this.load(item).then(function (comments) {\r\n // See if we are not rendering to an element\r\n if (el == null) {\r\n // Clear the form\r\n canvas_1.CanvasForm.clear();\r\n // Set the header\r\n canvas_1.CanvasForm.setHeader(\"<h5>Comments</h5>\");\r\n }\r\n // Render a nav\r\n gd_sprest_bs_1.Components.Navbar({\r\n el: el || canvas_1.CanvasForm.BodyElement,\r\n itemsEnd: [{\r\n text: \"+ Add Comment\",\r\n onClick: function () {\r\n // Hide the form\r\n el ? null : canvas_1.CanvasForm.hide();\r\n // Display a modal to add the comment\r\n _this.new(item, el);\r\n }\r\n }]\r\n });\r\n // Parse the comments\r\n for (var i = 0; i < comments.length; i++) {\r\n var comment = comments[i];\r\n // Render a toast\r\n gd_sprest_bs_1.Components.Toast({\r\n el: el || canvas_1.CanvasForm.BodyElement,\r\n headerText: comment.Author.Title,\r\n mutedText: moment(new Date(comment.Created)).toString(),\r\n body: (comment.Comment || \"\").replace(/\\r?\\n/g, '<br />'),\r\n options: {\r\n animation: true,\r\n autohide: false\r\n }\r\n });\r\n }\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Show the canvas form\r\n el ? null : canvas_1.CanvasForm.show();\r\n });\r\n };\r\n Comments._elModalBody = null;\r\n Comments._elModalFooter = null;\r\n Comments._elModalHeader = null;\r\n Comments._listId = null;\r\n Comments._modal = null;\r\n Comments._webUrl = null;\r\n // Comment's List Id\r\n Comments._commentsListId = null;\r\n return Comments;\r\n}());\r\nexports.Comments = Comments;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/comments.js?");
53
53
 
54
54
  /***/ }),
55
55