dattatable 2.9.78 → 2.9.80

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 (62) hide show
  1. package/build/common/documents.d.ts +1 -0
  2. package/build/common/documents.js +1 -1
  3. package/build/dashboard/index.js +3 -3
  4. package/dist/dattatable.js +2 -2
  5. package/dist/dattatable.min.js +1 -1
  6. package/docs/assets/search.js +1 -1
  7. package/docs/classes/Accordion.html +2 -2
  8. package/docs/classes/AuditLog.html +2 -2
  9. package/docs/classes/CanvasForm.html +2 -2
  10. package/docs/classes/Comments.html +2 -2
  11. package/docs/classes/Dashboard.html +4 -4
  12. package/docs/classes/DataTable.html +3 -3
  13. package/docs/classes/Documents.html +6 -6
  14. package/docs/classes/FilterSlideout.html +2 -2
  15. package/docs/classes/Footer.html +2 -2
  16. package/docs/classes/Header.html +2 -2
  17. package/docs/classes/InstallationRequired.html +2 -2
  18. package/docs/classes/ItemForm.html +4 -4
  19. package/docs/classes/List.html +4 -4
  20. package/docs/classes/ListSecurity.html +2 -2
  21. package/docs/classes/LoadingDialog.html +2 -2
  22. package/docs/classes/Modal.html +2 -2
  23. package/docs/classes/Navigation.html +3 -3
  24. package/docs/classes/Tiles.html +2 -2
  25. package/docs/classes/Timeout.html +2 -2
  26. package/docs/enums/ActionButtonTypes.html +2 -2
  27. package/docs/functions/formatBytes.html +1 -1
  28. package/docs/functions/formatDateValue.html +1 -1
  29. package/docs/functions/formatTimeValue.html +1 -1
  30. package/docs/functions/getContextInfo.html +1 -1
  31. package/docs/functions/getFileExt.html +1 -1
  32. package/docs/functions/waitForTheme.html +1 -1
  33. package/docs/interfaces/IAccordion.html +2 -2
  34. package/docs/interfaces/IAccordionProps.html +2 -2
  35. package/docs/interfaces/IAuditLogItem.html +2 -2
  36. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  37. package/docs/interfaces/IAuditLogProps.html +2 -2
  38. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  39. package/docs/interfaces/ICommentsItem.html +2 -2
  40. package/docs/interfaces/IDashboardProps.html +2 -2
  41. package/docs/interfaces/IDataTable.html +2 -2
  42. package/docs/interfaces/IDataTableProps.html +2 -2
  43. package/docs/interfaces/IDocumentsProps.html +3 -2
  44. package/docs/interfaces/IFilterItem.html +2 -2
  45. package/docs/interfaces/IFilterProps.html +2 -2
  46. package/docs/interfaces/IFooterProps.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/IItemFormTab.html +2 -2
  52. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  53. package/docs/interfaces/IItemFormViewProps.html +2 -2
  54. package/docs/interfaces/IListProps.html +2 -2
  55. package/docs/interfaces/IListSecurity.html +2 -2
  56. package/docs/interfaces/IListSecurityItem.html +2 -2
  57. package/docs/interfaces/IShowDialogProps.html +2 -2
  58. package/docs/interfaces/ITiles.html +2 -2
  59. package/docs/interfaces/ITilesProps.html +2 -2
  60. package/docs/variables/DattaTable.html +1 -1
  61. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  62. package/package.json +1 -1
@@ -19,6 +19,7 @@ export interface IDocumentsProps {
19
19
  itemId?: number;
20
20
  el: HTMLElement;
21
21
  enableSearch?: boolean;
22
+ fileExtensions?: string[];
22
23
  listName: string;
23
24
  query?: Types.IODataQuery;
24
25
  onActionsRendered?: (el: HTMLElement, col: Components.ITableColumn, file: Types.SP.Attachment | Types.SP.File) => void;
@@ -1029,7 +1029,7 @@ var Documents = /** @class */ (function () {
1029
1029
  type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
1030
1030
  onClick: function () {
1031
1031
  // Show the file upload dialog
1032
- gd_sprest_bs_1.Helper.ListForm.showFileDialog().then(function (fileInfo) {
1032
+ gd_sprest_bs_1.Helper.ListForm.showFileDialog(_this._props.fileExtensions).then(function (fileInfo) {
1033
1033
  // Code to run after the event
1034
1034
  var onCompleted = function (fileInfo) {
1035
1035
  // Show a loading dialog
@@ -137,9 +137,9 @@ var Dashboard = /** @class */ (function () {
137
137
  elTemplate.innerHTML = "\n <div class=\"row\">\n <div id=\"navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"header\" class=\"col mx-75\"></div>\n </div>\n <div class=\"row\">\n <div id=\"sub-navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"".concat(this.IsAccordion ? "accordion" : (this.IsTiles ? "tiles" : "datatable"), "\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"footer\" class=\"col\"></div>\n </div>").trim();
138
138
  this._props.el.appendChild(elTemplate);
139
139
  // Set/Default the visibility flags
140
- var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;
141
- var navIsVisible = this._props.hideNavigation ? false : true;
142
- var subNavIsVisible = (this._props.hideSubNavigation == null || this._props.hideSubNavigation == true) && this._props.subNavigation == null ? false : true;
140
+ var headerIsVisible = typeof (this._props.hideHeader) === "boolean" ? !this._props.hideHeader : (this._props.header == null ? false : true);
141
+ var navIsVisible = typeof (this._props.hideNavigation) === "boolean" ? !this._props.hideNavigation : true;
142
+ var subNavIsVisible = typeof (this._props.hideSubNavigation) === "boolean" ? !this._props.hideSubNavigation : (this._props.subNavigation == null ? false : true);
143
143
  // See if we are hiding the navigation
144
144
  if (!navIsVisible) {
145
145
  // Hide the element
@@ -60,7 +60,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
60
60
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
61
61
 
62
62
  "use strict";
63
- eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Documents = exports.ActionButtonTypes = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar jQuery = __webpack_require__(/*! jquery */ \"./node_modules/.pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.min.js\");\r\nvar moment = __webpack_require__(/*! moment */ \"./node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js\");\r\nvar loadingDialog_1 = __webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\");\r\nvar methods_1 = __webpack_require__(/*! ./methods */ \"./build/common/methods.js\");\r\nvar table_1 = __webpack_require__(/*! ../dashboard/table */ \"./build/dashboard/table.js\");\r\nvar itemForm_1 = __webpack_require__(/*! ./itemForm */ \"./build/common/itemForm.js\");\r\n/** Icons */\r\nvar fileEarmark_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmark */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmark.js\");\r\nvar fileEarmarkArrowDown_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkArrowDown */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkArrowDown.js\");\r\nvar fileEarmarkArrowUp_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkArrowUp */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkArrowUp.js\");\r\nvar fileEarmarkBarGraph_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkBarGraph */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkBarGraph.js\");\r\nvar fileEarmarkBinary_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkBinary */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkBinary.js\");\r\nvar fileEarmarkCode_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkCode */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkCode.js\");\r\nvar fileEarmarkExcel_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkExcel */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkExcel.js\");\r\nvar fileEarmarkImage_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkImage */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkImage.js\");\r\nvar fileEarmarkMusic_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkMusic */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkMusic.js\");\r\nvar fileEarmarkPdf_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPdf */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPdf.js\");\r\nvar fileEarmarkPlus_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPlus */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPlus.js\");\r\nvar fileEarmarkPpt_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPpt */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPpt.js\");\r\nvar fileEarmarkPlay_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPlay */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPlay.js\");\r\nvar fileEarmarkRichtext_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkRichtext */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkRichtext.js\");\r\nvar fileEarmarkSpreadsheet_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkSpreadsheet */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkSpreadsheet.js\");\r\nvar fileEarmarkText_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkText */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkText.js\");\r\nvar fileEarmarkWord_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkWord */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkWord.js\");\r\nvar fileEarmarkZip_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkZip */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkZip.js\");\r\nvar filterSquare_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/filterSquare */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/filterSquare.js\");\r\nvar front_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/front */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/front.js\");\r\nvar inputCursorText_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/inputCursorText */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/inputCursorText.js\");\r\nvar layoutTextSidebar_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/layoutTextSidebar */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/layoutTextSidebar.js\");\r\nvar x_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/x */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/x.js\");\r\n/** Action Button Types */\r\nvar ActionButtonTypes;\r\n(function (ActionButtonTypes) {\r\n ActionButtonTypes[ActionButtonTypes[\"Delete\"] = 1] = \"Delete\";\r\n ActionButtonTypes[ActionButtonTypes[\"Download\"] = 2] = \"Download\";\r\n ActionButtonTypes[ActionButtonTypes[\"Edit\"] = 3] = \"Edit\";\r\n ActionButtonTypes[ActionButtonTypes[\"Properties\"] = 4] = \"Properties\";\r\n ActionButtonTypes[ActionButtonTypes[\"View\"] = 5] = \"View\";\r\n})(ActionButtonTypes = exports.ActionButtonTypes || (exports.ActionButtonTypes = {}));\r\n/**\r\n * Documents\r\n * Renders a data table containing the contents of a document library.\r\n */\r\nvar Documents = /** @class */ (function () {\r\n // Constructor\r\n function Documents(props) {\r\n this._el = null;\r\n this._props = null;\r\n this._tblProps = null;\r\n /** The list item attachments */\r\n this._attachments = null;\r\n /** The data table */\r\n this._dt = null;\r\n // Can delete documents\r\n this._canDelete = true;\r\n // Can edit documents\r\n this._canEdit = true;\r\n // Can view documents\r\n this._canView = true;\r\n // The navigation component\r\n this._navbar = null;\r\n // The root folder of the library\r\n this._rootFolder = null;\r\n // The template files\r\n this._templatesFiles = null;\r\n // The template folders\r\n this._templateFolders = null;\r\n // Save the properties\r\n this._props = props;\r\n // Default the permissions\r\n this._canDelete = typeof (this._props.canDelete) === \"boolean\" ? this._props.canDelete : true;\r\n this._canEdit = typeof (this._props.canEdit) === \"boolean\" ? this._props.canEdit : true;\r\n this._canView = typeof (this._props.canView) === \"boolean\" ? this._props.canView : true;\r\n // Create the element\r\n this._el = document.createElement(\"div\");\r\n this._props.el ? this._props.el.appendChild(this._el) : null;\r\n // Generate the table properties\r\n this.generateTableProps();\r\n // Render the component\r\n this.render();\r\n }\r\n Object.defineProperty(Documents.prototype, \"Attachments\", {\r\n get: function () { return this._attachments; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"DataTable\", {\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanDelete\", {\r\n get: function () { return this._canDelete; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanEdit\", {\r\n get: function () { return this._canEdit; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanView\", {\r\n get: function () { return this._canView; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"Files\", {\r\n // The files\r\n get: function () {\r\n // Default the files to the root folder\r\n var files = this.RootFolder.Files.results;\r\n // Parse the folders\r\n var formsFl = false;\r\n for (var i = 0; i < this.RootFolder.Folders.results.length; i++) {\r\n var folder = this.RootFolder.Folders.results[i];\r\n // Skip the internal forms folder\r\n if (!formsFl && folder.Name == \"Forms\") {\r\n // Set the flag and skip this folder\r\n formsFl = true;\r\n continue;\r\n }\r\n // Append files\r\n files = files.concat(folder.Files.results);\r\n }\r\n // Return the files\r\n return files;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"IsAttachment\", {\r\n // Type of object we are dealing with\r\n get: function () { return this._props.itemId > 0; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"IsDocSet\", {\r\n get: function () { return this._props.docSetId > 0; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"Navigation\", {\r\n get: function () { return this._navbar; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"NavigationElement\", {\r\n // The navigation element\r\n get: function () { return this.Navigation.el; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"RootFolder\", {\r\n get: function () { return this._rootFolder; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TableElement\", {\r\n // The table element\r\n get: function () { return this.DataTable.el; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TemplateFiles\", {\r\n get: function () { return this._templatesFiles; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TemplateFolders\", {\r\n get: function () { return this._templateFolders; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Copies a file to a folder to the library\r\n * @param item The dropdown item containing the file/folder to copy.\r\n */\r\n Documents.prototype.copyFile = function (item) {\r\n var _this = this;\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Initializing the Transfer\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Copying the file(s) to the workspace...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // See if this is a folder\r\n if (item.data.Files) {\r\n // Parse the files\r\n var folder = item.data;\r\n gd_sprest_bs_1.Helper.Executor(folder.Files.results, function (file) {\r\n // Return a promise\r\n return new Promise(function (resolve) {\r\n // Get the file contents\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFileByServerRelativeUrl(file.ServerRelativeUrl).content().execute(function (data) {\r\n // Copy the file\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file.Name, true, data).execute(resolve, resolve);\r\n });\r\n });\r\n }).then(function () {\r\n // Close the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n });\r\n }\r\n else {\r\n // Copy the file\r\n var file_1 = item.data;\r\n file_1.content().execute(function (data) {\r\n // Copy the file\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file_1.Name, true, data).execute(function () {\r\n // Close the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n });\r\n });\r\n }\r\n };\r\n // Generates the table columns\r\n Documents.prototype.generateColumns = function () {\r\n // See if the columns were provided\r\n if (this._props.table && this._props.table.columns) {\r\n return this._props.table.columns;\r\n }\r\n // See if we are dealing w/ attachments\r\n if (this.IsAttachment) {\r\n // Return the default columns\r\n return [\r\n {\r\n name: \"Type\",\r\n title: \"Type\"\r\n },\r\n {\r\n name: \"FileName\",\r\n title: \"Name\"\r\n },\r\n {\r\n className: \"text-end text-nowrap\",\r\n name: \"Actions\",\r\n title: \"\"\r\n }\r\n ];\r\n }\r\n // Return the default columns\r\n return [\r\n {\r\n name: \"Type\",\r\n title: \"Type\",\r\n },\r\n {\r\n name: \"Name\",\r\n title: \"Name\"\r\n },\r\n {\r\n name: \"Title\",\r\n title: \"Description\"\r\n },\r\n {\r\n name: \"FileSize\",\r\n title: \"File Size\"\r\n },\r\n {\r\n name: \"Created\",\r\n title: \"Created\"\r\n },\r\n {\r\n name: \"Author\",\r\n title: \"Created By\"\r\n },\r\n {\r\n name: \"Modified\",\r\n title: \"Modified\"\r\n },\r\n {\r\n name: \"ModifiedBy\",\r\n title: \"Modified By\"\r\n },\r\n {\r\n className: \"text-end text-nowrap\",\r\n name: \"Actions\",\r\n title: \"\"\r\n }\r\n ];\r\n };\r\n // Generates the template files/folders dropdown items\r\n Documents.prototype.generateItems = function () {\r\n var _this = this;\r\n var items = [];\r\n // Parse the template folders\r\n for (var i = 0; i < this.TemplateFolders.length; i++) {\r\n var folder = this.TemplateFolders[i];\r\n // Skip the internal forms folder\r\n if (folder.Name == \"Forms\") {\r\n continue;\r\n }\r\n // Add a dropdown item\r\n items.push({\r\n text: folder.Name,\r\n data: folder,\r\n value: folder.ServerRelativeUrl,\r\n onClick: function (item) { _this.copyFile(item); }\r\n });\r\n }\r\n // Parse the template files\r\n for (var i = 0; i < this.TemplateFiles.length; i++) {\r\n var file = this.TemplateFiles[i];\r\n // Add a dropdown item\r\n items.push({\r\n text: file.Name,\r\n data: file,\r\n value: file.ServerRelativeUrl,\r\n onClick: function (item) { _this.copyFile(item); }\r\n });\r\n }\r\n // Return the dropdown items\r\n return items.sort(function (a, b) {\r\n if (a.text < b.text) {\r\n return -1;\r\n }\r\n if (a.text > b.text) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n };\r\n // Generates the table properties\r\n Documents.prototype.generateTableProps = function () {\r\n var _this = this;\r\n // Default the indexes for the type and action buttons\r\n var idxActions = this.IsAttachment ? 2 : 8;\r\n // See if custom columns are defined\r\n if (this._props.table && this._props.table.columns) {\r\n // Clear the indexes\r\n idxActions = -1;\r\n // Parse the columns\r\n for (var i = 0; i < this._props.table.columns.length; i++) {\r\n // Update the index based on the value\r\n switch (this._props.table.columns[i].name) {\r\n // Actions\r\n case \"Actions\":\r\n idxActions = i;\r\n break;\r\n }\r\n }\r\n }\r\n // See if the column definitions are not defined\r\n var columnDefs = this._props.table ? this._props.table.dtProps : null;\r\n if (columnDefs == null) {\r\n columnDefs = [];\r\n // Add the default options for the Actions and Type\r\n idxActions >= 0 ? columnDefs.push({ targets: idxActions, orderable: false, searchable: false }) : null;\r\n }\r\n // Create the table properties\r\n this._tblProps = {\r\n el: null,\r\n dtProps: this._props.table && this._props.table.dtProps ? this._props.table.dtProps : {\r\n dom: 'rt<\"row\"<\"col-sm-4\"l><\"col-sm-4\"i><\"col-sm-4\"p>>',\r\n columnDefs: columnDefs,\r\n createdRow: function (row, data, index) {\r\n jQuery('td', row).addClass('align-middle');\r\n },\r\n // Add some classes to the dataTable elements\r\n drawCallback: function (settings) {\r\n var api = new jQuery.fn.dataTable.Api(settings);\r\n var div = api.table().container();\r\n var table = api.table().node();\r\n div.querySelector(\".dataTables_info\").classList.add(\"text-center\");\r\n div.querySelector(\".dataTables_length\").classList.add(\"pt-2\");\r\n div.querySelector(\".dataTables_paginate\").classList.add(\"pt-03\");\r\n table.classList.remove(\"no-footer\");\r\n table.classList.add(\"tbl-footer\");\r\n table.classList.add(\"table-striped\");\r\n },\r\n headerCallback: function (thead, data, start, end, display) {\r\n jQuery('th', thead).addClass('align-middle');\r\n },\r\n // Order by the 1st column by default; ascending\r\n order: [[1, \"asc\"]]\r\n },\r\n columns: this.generateColumns()\r\n };\r\n // Parse the columns\r\n gd_sprest_bs_1.Helper.Executor(this._tblProps.columns, function (col) {\r\n var customEvent = col.onRenderCell;\r\n // See if this is the type column\r\n if (col.name == \"Type\") {\r\n // Set the event to render an icon\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the file\r\n _this.renderFileIcon(el, _this.getFileName(file));\r\n // Set the filter/sort value\r\n el.setAttribute(\"data-filter\", (0, methods_1.getFileExt)(_this.getFileName(file)));\r\n el.setAttribute(\"data-sort\", (0, methods_1.getFileExt)(_this.getFileName(file)));\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is the file size\r\n else if (col.name == \"FileSize\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the file size value\r\n el.innerHTML = (0, methods_1.formatBytes)(file.Length);\r\n // Set the sort value\r\n el.setAttribute(\"data-sort\", file.Length.toString());\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is a date/time field\r\n else if (col.name == \"Created\" || col.name == \"Modified\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the date/time value\r\n var value = col.name == \"Created\" ? file.TimeCreated : file.TimeLastModified;\r\n el.innerHTML = (0, methods_1.formatTimeValue)(value);\r\n // Set the date/time filter/sort values\r\n el.setAttribute(\"data-filter\", moment(value).format(\"dddd MMMM DD YYYY\"));\r\n el.setAttribute(\"data-sort\", value);\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is a user field\r\n else if (col.name == \"Author\" || col.name == \"ModifiedBy\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the Person field Title\r\n el.innerHTML = (file[col.name] ? file[col.name][\"Title\"] : null) || \"\";\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is the \"actions\" buttons\r\n else if (col.name == \"Actions\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the action buttons\r\n _this.renderActionButtons(el, file);\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n _this._props.onActionsRendered ? _this._props.onActionsRendered(el, col, file) : null;\r\n };\r\n }\r\n else {\r\n // Set the default render event\r\n col.onRenderCell = function (el, col, file) {\r\n // Set the value\r\n el.innerHTML = file[col.name] ||\r\n (file.ListItemAllFields && file.ListItemAllFields.FieldValuesAsText[col.name]) || \"\";\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n });\r\n };\r\n // Gets the file name\r\n Documents.prototype.getFileName = function (file) {\r\n // Return the file name\r\n return file.Name || file.FileName;\r\n };\r\n // Determines if the document can be viewed in office online servers\r\n Documents.isWopi = function (filename) {\r\n switch ((0, methods_1.getFileExt)(filename)) {\r\n // Excel\r\n case \"csv\":\r\n case \"doc\":\r\n case \"docx\":\r\n case \"dot\":\r\n case \"dotx\":\r\n case \"pot\":\r\n case \"potx\":\r\n case \"pps\":\r\n case \"ppsx\":\r\n case \"ppt\":\r\n case \"pptx\":\r\n case \"xls\":\r\n case \"xlsx\":\r\n case \"xlt\":\r\n case \"xltx\":\r\n return true;\r\n // Default\r\n default: {\r\n return false;\r\n }\r\n }\r\n };\r\n // Loads the data\r\n Documents.prototype.load = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var web = (0, gd_sprest_bs_1.Web)(_this._props.webUrl);\r\n // Clear the properties\r\n _this._rootFolder = null;\r\n _this._templateFolders = null;\r\n _this._templatesFiles = null;\r\n // See if the templates library was set\r\n if (_this._props.templatesUrl) {\r\n // Load the files and folders\r\n web.getFolderByServerRelativeUrl(_this._props.templatesUrl).query({\r\n Expand: [\"Folders/Files\", \"Files\"]\r\n }).execute(\r\n // Templates folder exists\r\n function (folder) {\r\n // Set the template files\r\n _this._templatesFiles = folder.Files.results;\r\n // Set the template folders\r\n _this._templateFolders = folder.Folders.results;\r\n }, \r\n // Error loading the templates folder\r\n function () {\r\n // Log\r\n console.error(\"[Dattatable] Document's template folder failed to be loaded.\", _this._props.templatesUrl);\r\n });\r\n }\r\n // Set the query\r\n var query = _this._props.query || {};\r\n query.Expand = (query.Expand ? query.Expand : []).concat([\r\n \"Folders/Files\", \"Folders/Files/Author\",\r\n \"Folders/Files/ListItemAllFields\", \"Folders/Files/ListItemAllFields/FieldValuesAsText\",\r\n \"Folders/Files/ModifiedBy\", \"Files\", \"Files/Author\", \"Files/ListItemAllFields\",\r\n \"Files/ListItemAllFields/FieldValuesAsText\", \"Files/ModifiedBy\"\r\n ]);\r\n // See if we are targeting a document set folder\r\n if (_this.IsDocSet) {\r\n web.Lists(_this._props.listName).Items(_this._props.docSetId).Folder().query(query).execute(function (folder) {\r\n // Set the root folder\r\n _this._rootFolder = folder;\r\n }, reject);\r\n }\r\n // Else, see if we are targeting list item attachments\r\n else if (_this.IsAttachment) {\r\n web.Lists(_this._props.listName).Items(_this._props.itemId).AttachmentFiles().execute(function (attachments) {\r\n // Set the attachments\r\n _this._attachments = attachments.results;\r\n }, reject);\r\n }\r\n // Else, it's a library\r\n else {\r\n // Load library information\r\n web.Lists(_this._props.listName).RootFolder().query(query).execute(function (folder) {\r\n // Set the root folder\r\n _this._rootFolder = folder;\r\n }, reject);\r\n }\r\n // Wait for the requests to complete\r\n web.done(function () {\r\n // Resolve the request\r\n resolve();\r\n });\r\n });\r\n };\r\n // Renders the component\r\n Documents.prototype.render = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Load the data\r\n _this.load().then(function () {\r\n // Render the navigation\r\n _this.renderNavigation();\r\n // Render the table\r\n _this.renderTable();\r\n // Call the render event\r\n _this._props.onRendered ? _this._props.onRendered(_this._el) : null;\r\n // Resolve the promise\r\n resolve();\r\n }, reject);\r\n });\r\n };\r\n // Renders the file actions\r\n Documents.prototype.renderActionButtons = function (el, file) {\r\n // Create a span to wrap the icons in\r\n var span = document.createElement(\"span\");\r\n span.className = \"bg-white d-inline-flex ms-2 rounded\";\r\n var spanEdit = span.cloneNode();\r\n var spanProps = span.cloneNode();\r\n var spanDownload = span.cloneNode();\r\n var spanDel = span.cloneNode();\r\n spanDel.classList.add(\"me-1\");\r\n // Add the icons\r\n el.appendChild(span);\r\n el.appendChild(spanEdit);\r\n this.IsAttachment ? null : el.appendChild(spanProps);\r\n el.appendChild(spanDownload);\r\n el.appendChild(spanDel);\r\n // Render the buttons\r\n span.appendChild(this.generateButton(ActionButtonTypes.View, file));\r\n spanEdit.appendChild(this.generateButton(ActionButtonTypes.Edit, file));\r\n this.IsAttachment ? null : spanProps.appendChild(this.generateButton(ActionButtonTypes.Properties, file));\r\n spanDownload.appendChild(this.generateButton(ActionButtonTypes.Download, file));\r\n spanDel.appendChild(this.generateButton(ActionButtonTypes.Delete, file));\r\n };\r\n Documents.prototype.generateButton = function (btnType, file) {\r\n var _this = this;\r\n var isWopi = Documents.isWopi(this.getFileName(file));\r\n // Render the button based on the type\r\n switch (btnType) {\r\n case ActionButtonTypes.Delete:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Delete\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-delete\",\r\n iconType: x_1.x,\r\n iconSize: 24,\r\n isDisabled: !this.CanDelete,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanDelete) {\r\n // Confirm we want to delete the item\r\n if (confirm(\"Are you sure you want to delete this document?\")) {\r\n // Display a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Deleting Document\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Deleting Document: \" + _this.getFileName(file) + \". This will close afterwards.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Delete the document\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFileByServerRelativeUrl(file.ServerRelativeUrl).delete().execute(\r\n // Success\r\n function () {\r\n // close dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page \r\n _this.refresh();\r\n }, \r\n // Error\r\n function (err) {\r\n // TODO\r\n });\r\n }\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Download:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Download\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-download\",\r\n iconType: fileEarmarkArrowDown_1.fileEarmarkArrowDown,\r\n iconSize: 24,\r\n isDisabled: !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanView) {\r\n window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/download.aspx?SourceUrl=\" + file.ServerRelativeUrl, \"_blank\");\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Edit:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Edit\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-edit\",\r\n iconType: inputCursorText_1.inputCursorText,\r\n iconSize: 24,\r\n isDisabled: (!isWopi || !this.CanEdit),\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (isWopi && _this.CanEdit) {\r\n // Open the file in a new tab\r\n window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/WopiFrame.aspx?sourcedoc=\" + file.ServerRelativeUrl + \"&action=edit\");\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Properties:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Properties\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-properties\",\r\n iconType: layoutTextSidebar_1.layoutTextSidebar,\r\n iconSize: 24,\r\n isDisabled: !this.CanEdit && !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n // Set the item form properties\r\n itemForm_1.ItemForm.ListName = _this._props.listName;\r\n itemForm_1.ItemForm.UseModal = false;\r\n // Ensure the user can edit the item\r\n if (_this.CanEdit) {\r\n // Define the properties\r\n var editProps = __assign(__assign({}, (_this._props.onItemFormEditing || {})), {\r\n // Set the item id\r\n itemId: file.ListItemAllFields[\"Id\"],\r\n // Set the edit form properties\r\n onCreateEditForm: function (props) {\r\n // Set the rendering event\r\n props.onControlRendering = function (ctrl, field) {\r\n if (field.InternalName == \"FileLeafRef\") {\r\n // Validate the name of the file\r\n ctrl.onValidate = function (ctrl, results) {\r\n var _a;\r\n // Ensure the value is less than 128 characters\r\n if (((_a = results.value) === null || _a === void 0 ? void 0 : _a.length) > 128) {\r\n // Return an error message\r\n results.invalidMessage = \"The file name must be less than 128 characters.\";\r\n results.isValid = false;\r\n }\r\n // Return the results\r\n return results;\r\n };\r\n }\r\n else if (field.InternalName == \"Title\") {\r\n // Update the label of the Title field\r\n ctrl.label = \"Description\";\r\n }\r\n };\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onCreateEditForm) {\r\n // Return the properties\r\n return _this._props.onItemFormEditing.onCreateEditForm(props);\r\n }\r\n // Return the properties\r\n return props;\r\n },\r\n // Update the footer\r\n onSetFooter: function (el) {\r\n var updateBtn = el.querySelector('[role=\"group\"]').firstChild;\r\n updateBtn.classList.remove(\"btn-outline-primary\");\r\n updateBtn.classList.add(\"btn-primary\");\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onSetFooter) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onSetFooter(el);\r\n }\r\n },\r\n // Update the header\r\n onSetHeader: function (el) {\r\n // Update the header\r\n el.querySelector(\"h5\").innerHTML = \"Properties\";\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onSetHeader) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onSetHeader(el);\r\n }\r\n },\r\n // Refresh the view when updates occur\r\n onUpdate: function (item) {\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onUpdate) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onUpdate(item);\r\n }\r\n else {\r\n // Refresh the data table\r\n _this.refresh();\r\n }\r\n }\r\n });\r\n // Show the edit form\r\n itemForm_1.ItemForm.edit(editProps);\r\n }\r\n else {\r\n // View the form\r\n itemForm_1.ItemForm.view(__assign(__assign({}, (_this._props.onItemFormViewing || {})), {\r\n itemId: file.ListItemAllFields[\"Id\"],\r\n // Set the view form properties\r\n onCreateViewForm: function (props) {\r\n // Set the rendering event\r\n props.onControlRendering = function (ctrl, field) {\r\n if (field.InternalName == \"Title\") {\r\n // Update the label of the Title field\r\n ctrl.label = \"Description\";\r\n }\r\n };\r\n // See if a custom event exists\r\n if (_this._props.onItemFormViewing && _this._props.onItemFormViewing.onCreateViewForm) {\r\n // Return the properties\r\n return _this._props.onItemFormViewing.onCreateViewForm(props);\r\n }\r\n // Return the properties\r\n return props;\r\n }\r\n }));\r\n }\r\n }\r\n }\r\n }).el;\r\n case ActionButtonTypes.View:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"View\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"img-flip-x p-1 btn-actions-view\",\r\n iconType: front_1.front,\r\n iconSize: 24,\r\n isDisabled: !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanView) {\r\n // Open the file in a new tab\r\n window.open(isWopi ? gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/WopiFrame.aspx?sourcedoc=\" + file.ServerRelativeUrl + \"&action=view\" : file.ServerRelativeUrl, \"_blank\");\r\n }\r\n }\r\n },\r\n }).el;\r\n }\r\n };\r\n // Renders the file icon\r\n Documents.prototype.renderFileIcon = function (el, fileName) {\r\n // Render the icon wrapper\r\n var span = document.createElement(\"span\");\r\n span.className = \"text-body\";\r\n el.appendChild(span);\r\n // Render the icon\r\n var size = 28;\r\n switch ((0, methods_1.getFileExt)(fileName)) {\r\n // Power BI\r\n case \"pbix\":\r\n span.appendChild((0, fileEarmarkBarGraph_1.fileEarmarkBarGraph)(size));\r\n span.title = \"Power BI Report\";\r\n break;\r\n // Binary\r\n case \"bin\":\r\n case \"blg\":\r\n case \"dat\":\r\n case \"dmg\":\r\n case \"dmp\":\r\n case \"log\":\r\n case \"pbi\":\r\n span.appendChild((0, fileEarmarkBinary_1.fileEarmarkBinary)(size));\r\n span.title = \"Binary File\";\r\n break;\r\n // Code\r\n case \"app\":\r\n case \"asp\":\r\n case \"aspx\":\r\n case \"css\":\r\n case \"hta\":\r\n case \"htm\":\r\n case \"html\":\r\n case \"js\":\r\n case \"json\":\r\n case \"mht\":\r\n case \"mhtml\":\r\n case \"scss\":\r\n case \"sppkg\":\r\n case \"wsp\":\r\n case \"xml\":\r\n case \"yaml\":\r\n span.appendChild((0, fileEarmarkCode_1.fileEarmarkCode)(size));\r\n span.title = \"Code\";\r\n break;\r\n // Excel\r\n case \"csv\":\r\n case \"ods\":\r\n case \"xls\":\r\n case \"xlsx\":\r\n case \"xlt\":\r\n case \"xltx\":\r\n span.appendChild((0, fileEarmarkExcel_1.fileEarmarkExcel)(size));\r\n span.title = \"Excel Spreadsheet\";\r\n break;\r\n // Image\r\n case \"ai\":\r\n case \"bmp\":\r\n case \"eps\":\r\n case \"gif\":\r\n case \"heic\":\r\n case \"heif\":\r\n case \"jpe\":\r\n case \"jpeg\":\r\n case \"jpg\":\r\n case \"png\":\r\n case \"psd\":\r\n case \"svg\":\r\n case \"tif\":\r\n case \"tiff\":\r\n case \"webp\":\r\n span.appendChild((0, fileEarmarkImage_1.fileEarmarkImage)(size));\r\n span.title = \"Image\";\r\n break;\r\n // Audio\r\n case \"aac\":\r\n case \"aiff\":\r\n case \"alac\":\r\n case \"flac\":\r\n case \"m4a\":\r\n case \"m4p\":\r\n case \"mka\":\r\n case \"mp3\":\r\n case \"mp4a\":\r\n case \"wav\":\r\n case \"wma\":\r\n span.appendChild((0, fileEarmarkMusic_1.fileEarmarkMusic)(size));\r\n span.title = \"Audio File\";\r\n break;\r\n // PDF\r\n case \"pdf\":\r\n span.appendChild((0, fileEarmarkPdf_1.fileEarmarkPdf)(size));\r\n span.title = \"Adobe PDF\";\r\n break;\r\n // PowerPoint\r\n case \"odp\":\r\n case \"pot\":\r\n case \"potx\":\r\n case \"pps\":\r\n case \"ppsx\":\r\n case \"ppt\":\r\n case \"pptx\":\r\n span.appendChild((0, fileEarmarkPpt_1.fileEarmarkPpt)(size));\r\n span.title = \"PowerPoint Presentation\";\r\n break;\r\n // Media\r\n case \"avi\":\r\n case \"flv\":\r\n case \"m2ts\":\r\n case \"mkv\":\r\n case \"mov\":\r\n case \"m4p\":\r\n case \"m4v\":\r\n case \"mp4\":\r\n case \"mpe\":\r\n case \"mpeg\":\r\n case \"mpg\":\r\n case \"mpv\":\r\n case \"qt\":\r\n case \"ts\":\r\n case \"vob\":\r\n case \"webm\":\r\n case \"wmv\":\r\n span.appendChild((0, fileEarmarkPlay_1.fileEarmarkPlay)(size));\r\n span.title = \"Media File\";\r\n break;\r\n // Rich Text\r\n case \"rtf\":\r\n span.appendChild((0, fileEarmarkRichtext_1.fileEarmarkRichtext)(size));\r\n span.title = \"Rich Text\";\r\n break;\r\n // Database\r\n case \"ldf\":\r\n case \"mdb\":\r\n case \"mdf\":\r\n span.appendChild((0, fileEarmarkSpreadsheet_1.fileEarmarkSpreadsheet)(size));\r\n span.title = \"Database\";\r\n break;\r\n // Text\r\n case \"md\":\r\n case \"text\":\r\n case \"txt\":\r\n span.appendChild((0, fileEarmarkText_1.fileEarmarkText)(size));\r\n span.title = \"Text\";\r\n break;\r\n // Word\r\n case \"doc\":\r\n case \"docx\":\r\n case \"dot\":\r\n case \"dotx\":\r\n case \"odt\":\r\n case \"wpd\":\r\n span.appendChild((0, fileEarmarkWord_1.fileEarmarkWord)(size));\r\n span.title = \"Word Document\";\r\n break;\r\n // Compressed\r\n case \"7z\":\r\n case \"cab\":\r\n case \"gz\":\r\n case \"iso\":\r\n case \"rar\":\r\n case \"tgz\":\r\n case \"zip\":\r\n span.appendChild((0, fileEarmarkZip_1.fileEarmarkZip)(size));\r\n span.title = \"Compressed Folder\";\r\n break;\r\n // Default\r\n default: {\r\n span.appendChild((0, fileEarmark_1.fileEarmark)(size));\r\n span.title = \"File\";\r\n }\r\n }\r\n };\r\n // Renders the navigation\r\n Documents.prototype.renderNavigation = function () {\r\n var _this = this;\r\n var itemsEnd = [];\r\n // See if templates exist\r\n if (this.TemplateFiles && this.TemplateFolders) {\r\n // Add the item\r\n itemsEnd.push({\r\n text: \"Templates\",\r\n className: \"btn btn-sm btn-outline-secondary\",\r\n classNameItem: \"bg-white\",\r\n iconClassName: \"btn-icon-sm\",\r\n iconSize: 20,\r\n iconType: fileEarmarkPlus_1.fileEarmarkPlus,\r\n isButton: true,\r\n items: this.generateItems()\r\n });\r\n }\r\n // Add the upload button\r\n itemsEnd.push({\r\n text: \"Upload\",\r\n onRender: function (el, item) {\r\n // Clear the existing button\r\n el.innerHTML = \"\";\r\n // Create a span to wrap the icon in\r\n var span = document.createElement(\"span\");\r\n span.className = \"bg-white d-inline-flex ms-2 rounded\";\r\n el.appendChild(span);\r\n // Render a tooltip\r\n gd_sprest_bs_1.Components.Tooltip({\r\n el: span,\r\n content: item.text,\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1\",\r\n iconType: fileEarmarkArrowUp_1.fileEarmarkArrowUp,\r\n iconSize: 24,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n // Show the file upload dialog\r\n gd_sprest_bs_1.Helper.ListForm.showFileDialog().then(function (fileInfo) {\r\n // Code to run after the event\r\n var onCompleted = function (fileInfo) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Uploading File\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Saving the file you selected. Please wait...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Upload the file\r\n _this.uploadFile(fileInfo).then(\r\n // Success\r\n function (file) {\r\n // Call the event\r\n _this._props.onFileAdded ? _this._props.onFileAdded(file) : null;\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n }, \r\n // Error\r\n function () {\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n });\r\n };\r\n // Call the file adding event\r\n var returnVal = _this._props.onFileAdding ? _this._props.onFileAdding(fileInfo) : null;\r\n if (typeof (returnVal) === \"boolean\") {\r\n // Add the file\r\n returnVal ? onCompleted(fileInfo) : null;\r\n }\r\n // Else, see if it doesn't exist\r\n else if (returnVal == null) {\r\n // Add the file\r\n onCompleted(fileInfo);\r\n }\r\n else if (returnVal.then) {\r\n // Wait for the event to complete\r\n returnVal.then(function (addFile) {\r\n // Add the file\r\n addFile ? onCompleted(fileInfo) : null;\r\n });\r\n }\r\n });\r\n }\r\n },\r\n });\r\n }\r\n });\r\n // Set the default properties\r\n var navProps = {\r\n el: this._el,\r\n brand: \"Documents\",\r\n itemsEnd: itemsEnd,\r\n searchBox: this._props.enableSearch ? {\r\n hideButton: true,\r\n onChange: function (value) {\r\n // Search the data table\r\n _this._dt.search(value);\r\n },\r\n onSearch: function (value) {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n } : null\r\n };\r\n // Call the rendering event\r\n this._props.onNavigationRendering ? this._props.onNavigationRendering(navProps) : null;\r\n // Create the navbar\r\n this._navbar = gd_sprest_bs_1.Components.Navbar(navProps);\r\n /* Fix the padding on the left & right of the nav */\r\n this._navbar.el.querySelector(\"div.container-fluid\").classList.add(\"ps-75\");\r\n this._navbar.el.querySelector(\"div.container-fluid\").classList.add(\"pe-2\");\r\n // See if we are showing the filter\r\n if (this._props.onShowFilter) {\r\n // Render the filter icon\r\n var icon = document.createElement(\"div\");\r\n icon.classList.add(\"filter-icon\");\r\n icon.classList.add(\"nav-link\");\r\n icon.classList.add(\"text-dark\");\r\n icon.style.cursor = \"pointer\";\r\n icon.appendChild((0, filterSquare_1.filterSquare)());\r\n this._props.onShowFilter ? icon.addEventListener(\"click\", this._props.onShowFilter) : null;\r\n this._navbar.el.firstElementChild.appendChild(icon);\r\n // Call the render event\r\n this._props.onFilterRendered ? this._props.onFilterRendered(icon) : null;\r\n }\r\n // Call the render events\r\n this._props.onSearchRendered ? this._props.onSearchRendered(this._navbar.el.querySelector(\"input[type='search']\")) : null;\r\n this._props.onNavigationRendered ? this._props.onNavigationRendered(this.Navigation) : null;\r\n };\r\n // Renders the datatable with the file information\r\n Documents.prototype.renderTable = function () {\r\n // Create the element\r\n var el = document.createElement(\"div\");\r\n this._el.appendChild(el);\r\n this._tblProps.el = el;\r\n // Set the data\r\n this._tblProps.rows = this.Attachments || this.Files;\r\n // Call the rendering event\r\n this._props.table && this._props.table.onRendering ? this._props.table.onRendering(this._tblProps) : null;\r\n // Render the table\r\n this._dt = new table_1.DataTable(this._tblProps);\r\n // Call the rendered event\r\n this._tblProps.onRendered ? this._tblProps.onRendered(el, this._dt.datatable) : null;\r\n };\r\n // Uploads a file\r\n Documents.prototype.uploadFile = function (fileInfo) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var list = (0, gd_sprest_bs_1.List)(_this._props.listName);\r\n // See if this is an attachment\r\n if (_this.IsAttachment) {\r\n // Upload the attachment\r\n list.Items(_this._props.itemId).AttachmentFiles().add(fileInfo.name, fileInfo.data).execute(resolve, reject);\r\n }\r\n else {\r\n // Upload the file to the objective folder\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(fileInfo.name, true, fileInfo.data).execute(resolve, reject);\r\n }\r\n });\r\n };\r\n /** Public Methods */\r\n // Generates an action button\r\n Documents.prototype.generateActionButton = function (btnType, file) {\r\n // Return the button\r\n return this.generateButton(btnType, file);\r\n };\r\n // Refreshes the documents\r\n Documents.prototype.refresh = function () {\r\n var _this = this;\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Reloading Workspace\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Reloading the workspace data. This will close afterwards.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Clear the element\r\n while (this._el.firstChild) {\r\n this._el.removeChild(this._el.firstChild);\r\n }\r\n // Render the component\r\n this.render().then(function () {\r\n // Call the event\r\n _this._props.onRefresh ? _this._props.onRefresh() : null;\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n });\r\n };\r\n // Searches the data table\r\n Documents.prototype.search = function (value) {\r\n // Search the table data\r\n this._dt.search(value);\r\n };\r\n return Documents;\r\n}());\r\nexports.Documents = Documents;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/documents.js?");
63
+ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Documents = exports.ActionButtonTypes = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar jQuery = __webpack_require__(/*! jquery */ \"./node_modules/.pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.min.js\");\r\nvar moment = __webpack_require__(/*! moment */ \"./node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js\");\r\nvar loadingDialog_1 = __webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\");\r\nvar methods_1 = __webpack_require__(/*! ./methods */ \"./build/common/methods.js\");\r\nvar table_1 = __webpack_require__(/*! ../dashboard/table */ \"./build/dashboard/table.js\");\r\nvar itemForm_1 = __webpack_require__(/*! ./itemForm */ \"./build/common/itemForm.js\");\r\n/** Icons */\r\nvar fileEarmark_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmark */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmark.js\");\r\nvar fileEarmarkArrowDown_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkArrowDown */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkArrowDown.js\");\r\nvar fileEarmarkArrowUp_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkArrowUp */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkArrowUp.js\");\r\nvar fileEarmarkBarGraph_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkBarGraph */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkBarGraph.js\");\r\nvar fileEarmarkBinary_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkBinary */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkBinary.js\");\r\nvar fileEarmarkCode_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkCode */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkCode.js\");\r\nvar fileEarmarkExcel_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkExcel */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkExcel.js\");\r\nvar fileEarmarkImage_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkImage */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkImage.js\");\r\nvar fileEarmarkMusic_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkMusic */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkMusic.js\");\r\nvar fileEarmarkPdf_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPdf */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPdf.js\");\r\nvar fileEarmarkPlus_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPlus */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPlus.js\");\r\nvar fileEarmarkPpt_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPpt */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPpt.js\");\r\nvar fileEarmarkPlay_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkPlay */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkPlay.js\");\r\nvar fileEarmarkRichtext_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkRichtext */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkRichtext.js\");\r\nvar fileEarmarkSpreadsheet_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkSpreadsheet */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkSpreadsheet.js\");\r\nvar fileEarmarkText_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkText */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkText.js\");\r\nvar fileEarmarkWord_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkWord */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkWord.js\");\r\nvar fileEarmarkZip_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/fileEarmarkZip */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/fileEarmarkZip.js\");\r\nvar filterSquare_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/filterSquare */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/filterSquare.js\");\r\nvar front_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/front */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/front.js\");\r\nvar inputCursorText_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/inputCursorText */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/inputCursorText.js\");\r\nvar layoutTextSidebar_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/layoutTextSidebar */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/layoutTextSidebar.js\");\r\nvar x_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/x */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/icons/svgs/x.js\");\r\n/** Action Button Types */\r\nvar ActionButtonTypes;\r\n(function (ActionButtonTypes) {\r\n ActionButtonTypes[ActionButtonTypes[\"Delete\"] = 1] = \"Delete\";\r\n ActionButtonTypes[ActionButtonTypes[\"Download\"] = 2] = \"Download\";\r\n ActionButtonTypes[ActionButtonTypes[\"Edit\"] = 3] = \"Edit\";\r\n ActionButtonTypes[ActionButtonTypes[\"Properties\"] = 4] = \"Properties\";\r\n ActionButtonTypes[ActionButtonTypes[\"View\"] = 5] = \"View\";\r\n})(ActionButtonTypes = exports.ActionButtonTypes || (exports.ActionButtonTypes = {}));\r\n/**\r\n * Documents\r\n * Renders a data table containing the contents of a document library.\r\n */\r\nvar Documents = /** @class */ (function () {\r\n // Constructor\r\n function Documents(props) {\r\n this._el = null;\r\n this._props = null;\r\n this._tblProps = null;\r\n /** The list item attachments */\r\n this._attachments = null;\r\n /** The data table */\r\n this._dt = null;\r\n // Can delete documents\r\n this._canDelete = true;\r\n // Can edit documents\r\n this._canEdit = true;\r\n // Can view documents\r\n this._canView = true;\r\n // The navigation component\r\n this._navbar = null;\r\n // The root folder of the library\r\n this._rootFolder = null;\r\n // The template files\r\n this._templatesFiles = null;\r\n // The template folders\r\n this._templateFolders = null;\r\n // Save the properties\r\n this._props = props;\r\n // Default the permissions\r\n this._canDelete = typeof (this._props.canDelete) === \"boolean\" ? this._props.canDelete : true;\r\n this._canEdit = typeof (this._props.canEdit) === \"boolean\" ? this._props.canEdit : true;\r\n this._canView = typeof (this._props.canView) === \"boolean\" ? this._props.canView : true;\r\n // Create the element\r\n this._el = document.createElement(\"div\");\r\n this._props.el ? this._props.el.appendChild(this._el) : null;\r\n // Generate the table properties\r\n this.generateTableProps();\r\n // Render the component\r\n this.render();\r\n }\r\n Object.defineProperty(Documents.prototype, \"Attachments\", {\r\n get: function () { return this._attachments; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"DataTable\", {\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanDelete\", {\r\n get: function () { return this._canDelete; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanEdit\", {\r\n get: function () { return this._canEdit; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"CanView\", {\r\n get: function () { return this._canView; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"Files\", {\r\n // The files\r\n get: function () {\r\n // Default the files to the root folder\r\n var files = this.RootFolder.Files.results;\r\n // Parse the folders\r\n var formsFl = false;\r\n for (var i = 0; i < this.RootFolder.Folders.results.length; i++) {\r\n var folder = this.RootFolder.Folders.results[i];\r\n // Skip the internal forms folder\r\n if (!formsFl && folder.Name == \"Forms\") {\r\n // Set the flag and skip this folder\r\n formsFl = true;\r\n continue;\r\n }\r\n // Append files\r\n files = files.concat(folder.Files.results);\r\n }\r\n // Return the files\r\n return files;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"IsAttachment\", {\r\n // Type of object we are dealing with\r\n get: function () { return this._props.itemId > 0; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"IsDocSet\", {\r\n get: function () { return this._props.docSetId > 0; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"Navigation\", {\r\n get: function () { return this._navbar; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"NavigationElement\", {\r\n // The navigation element\r\n get: function () { return this.Navigation.el; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"RootFolder\", {\r\n get: function () { return this._rootFolder; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TableElement\", {\r\n // The table element\r\n get: function () { return this.DataTable.el; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TemplateFiles\", {\r\n get: function () { return this._templatesFiles; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Documents.prototype, \"TemplateFolders\", {\r\n get: function () { return this._templateFolders; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Copies a file to a folder to the library\r\n * @param item The dropdown item containing the file/folder to copy.\r\n */\r\n Documents.prototype.copyFile = function (item) {\r\n var _this = this;\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Initializing the Transfer\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Copying the file(s) to the workspace...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // See if this is a folder\r\n if (item.data.Files) {\r\n // Parse the files\r\n var folder = item.data;\r\n gd_sprest_bs_1.Helper.Executor(folder.Files.results, function (file) {\r\n // Return a promise\r\n return new Promise(function (resolve) {\r\n // Get the file contents\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFileByServerRelativeUrl(file.ServerRelativeUrl).content().execute(function (data) {\r\n // Copy the file\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file.Name, true, data).execute(resolve, resolve);\r\n });\r\n });\r\n }).then(function () {\r\n // Close the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n });\r\n }\r\n else {\r\n // Copy the file\r\n var file_1 = item.data;\r\n file_1.content().execute(function (data) {\r\n // Copy the file\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file_1.Name, true, data).execute(function () {\r\n // Close the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n });\r\n });\r\n }\r\n };\r\n // Generates the table columns\r\n Documents.prototype.generateColumns = function () {\r\n // See if the columns were provided\r\n if (this._props.table && this._props.table.columns) {\r\n return this._props.table.columns;\r\n }\r\n // See if we are dealing w/ attachments\r\n if (this.IsAttachment) {\r\n // Return the default columns\r\n return [\r\n {\r\n name: \"Type\",\r\n title: \"Type\"\r\n },\r\n {\r\n name: \"FileName\",\r\n title: \"Name\"\r\n },\r\n {\r\n className: \"text-end text-nowrap\",\r\n name: \"Actions\",\r\n title: \"\"\r\n }\r\n ];\r\n }\r\n // Return the default columns\r\n return [\r\n {\r\n name: \"Type\",\r\n title: \"Type\",\r\n },\r\n {\r\n name: \"Name\",\r\n title: \"Name\"\r\n },\r\n {\r\n name: \"Title\",\r\n title: \"Description\"\r\n },\r\n {\r\n name: \"FileSize\",\r\n title: \"File Size\"\r\n },\r\n {\r\n name: \"Created\",\r\n title: \"Created\"\r\n },\r\n {\r\n name: \"Author\",\r\n title: \"Created By\"\r\n },\r\n {\r\n name: \"Modified\",\r\n title: \"Modified\"\r\n },\r\n {\r\n name: \"ModifiedBy\",\r\n title: \"Modified By\"\r\n },\r\n {\r\n className: \"text-end text-nowrap\",\r\n name: \"Actions\",\r\n title: \"\"\r\n }\r\n ];\r\n };\r\n // Generates the template files/folders dropdown items\r\n Documents.prototype.generateItems = function () {\r\n var _this = this;\r\n var items = [];\r\n // Parse the template folders\r\n for (var i = 0; i < this.TemplateFolders.length; i++) {\r\n var folder = this.TemplateFolders[i];\r\n // Skip the internal forms folder\r\n if (folder.Name == \"Forms\") {\r\n continue;\r\n }\r\n // Add a dropdown item\r\n items.push({\r\n text: folder.Name,\r\n data: folder,\r\n value: folder.ServerRelativeUrl,\r\n onClick: function (item) { _this.copyFile(item); }\r\n });\r\n }\r\n // Parse the template files\r\n for (var i = 0; i < this.TemplateFiles.length; i++) {\r\n var file = this.TemplateFiles[i];\r\n // Add a dropdown item\r\n items.push({\r\n text: file.Name,\r\n data: file,\r\n value: file.ServerRelativeUrl,\r\n onClick: function (item) { _this.copyFile(item); }\r\n });\r\n }\r\n // Return the dropdown items\r\n return items.sort(function (a, b) {\r\n if (a.text < b.text) {\r\n return -1;\r\n }\r\n if (a.text > b.text) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n };\r\n // Generates the table properties\r\n Documents.prototype.generateTableProps = function () {\r\n var _this = this;\r\n // Default the indexes for the type and action buttons\r\n var idxActions = this.IsAttachment ? 2 : 8;\r\n // See if custom columns are defined\r\n if (this._props.table && this._props.table.columns) {\r\n // Clear the indexes\r\n idxActions = -1;\r\n // Parse the columns\r\n for (var i = 0; i < this._props.table.columns.length; i++) {\r\n // Update the index based on the value\r\n switch (this._props.table.columns[i].name) {\r\n // Actions\r\n case \"Actions\":\r\n idxActions = i;\r\n break;\r\n }\r\n }\r\n }\r\n // See if the column definitions are not defined\r\n var columnDefs = this._props.table ? this._props.table.dtProps : null;\r\n if (columnDefs == null) {\r\n columnDefs = [];\r\n // Add the default options for the Actions and Type\r\n idxActions >= 0 ? columnDefs.push({ targets: idxActions, orderable: false, searchable: false }) : null;\r\n }\r\n // Create the table properties\r\n this._tblProps = {\r\n el: null,\r\n dtProps: this._props.table && this._props.table.dtProps ? this._props.table.dtProps : {\r\n dom: 'rt<\"row\"<\"col-sm-4\"l><\"col-sm-4\"i><\"col-sm-4\"p>>',\r\n columnDefs: columnDefs,\r\n createdRow: function (row, data, index) {\r\n jQuery('td', row).addClass('align-middle');\r\n },\r\n // Add some classes to the dataTable elements\r\n drawCallback: function (settings) {\r\n var api = new jQuery.fn.dataTable.Api(settings);\r\n var div = api.table().container();\r\n var table = api.table().node();\r\n div.querySelector(\".dataTables_info\").classList.add(\"text-center\");\r\n div.querySelector(\".dataTables_length\").classList.add(\"pt-2\");\r\n div.querySelector(\".dataTables_paginate\").classList.add(\"pt-03\");\r\n table.classList.remove(\"no-footer\");\r\n table.classList.add(\"tbl-footer\");\r\n table.classList.add(\"table-striped\");\r\n },\r\n headerCallback: function (thead, data, start, end, display) {\r\n jQuery('th', thead).addClass('align-middle');\r\n },\r\n // Order by the 1st column by default; ascending\r\n order: [[1, \"asc\"]]\r\n },\r\n columns: this.generateColumns()\r\n };\r\n // Parse the columns\r\n gd_sprest_bs_1.Helper.Executor(this._tblProps.columns, function (col) {\r\n var customEvent = col.onRenderCell;\r\n // See if this is the type column\r\n if (col.name == \"Type\") {\r\n // Set the event to render an icon\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the file\r\n _this.renderFileIcon(el, _this.getFileName(file));\r\n // Set the filter/sort value\r\n el.setAttribute(\"data-filter\", (0, methods_1.getFileExt)(_this.getFileName(file)));\r\n el.setAttribute(\"data-sort\", (0, methods_1.getFileExt)(_this.getFileName(file)));\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is the file size\r\n else if (col.name == \"FileSize\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the file size value\r\n el.innerHTML = (0, methods_1.formatBytes)(file.Length);\r\n // Set the sort value\r\n el.setAttribute(\"data-sort\", file.Length.toString());\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is a date/time field\r\n else if (col.name == \"Created\" || col.name == \"Modified\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the date/time value\r\n var value = col.name == \"Created\" ? file.TimeCreated : file.TimeLastModified;\r\n el.innerHTML = (0, methods_1.formatTimeValue)(value);\r\n // Set the date/time filter/sort values\r\n el.setAttribute(\"data-filter\", moment(value).format(\"dddd MMMM DD YYYY\"));\r\n el.setAttribute(\"data-sort\", value);\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is a user field\r\n else if (col.name == \"Author\" || col.name == \"ModifiedBy\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the Person field Title\r\n el.innerHTML = (file[col.name] ? file[col.name][\"Title\"] : null) || \"\";\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n // Else, see if this is the \"actions\" buttons\r\n else if (col.name == \"Actions\") {\r\n // Set the event to render the size\r\n col.onRenderCell = function (el, col, file) {\r\n // Render the action buttons\r\n _this.renderActionButtons(el, file);\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n _this._props.onActionsRendered ? _this._props.onActionsRendered(el, col, file) : null;\r\n };\r\n }\r\n else {\r\n // Set the default render event\r\n col.onRenderCell = function (el, col, file) {\r\n // Set the value\r\n el.innerHTML = file[col.name] ||\r\n (file.ListItemAllFields && file.ListItemAllFields.FieldValuesAsText[col.name]) || \"\";\r\n // Call the custom event\r\n customEvent ? customEvent(el, col, file) : null;\r\n };\r\n }\r\n });\r\n };\r\n // Gets the file name\r\n Documents.prototype.getFileName = function (file) {\r\n // Return the file name\r\n return file.Name || file.FileName;\r\n };\r\n // Determines if the document can be viewed in office online servers\r\n Documents.isWopi = function (filename) {\r\n switch ((0, methods_1.getFileExt)(filename)) {\r\n // Excel\r\n case \"csv\":\r\n case \"doc\":\r\n case \"docx\":\r\n case \"dot\":\r\n case \"dotx\":\r\n case \"pot\":\r\n case \"potx\":\r\n case \"pps\":\r\n case \"ppsx\":\r\n case \"ppt\":\r\n case \"pptx\":\r\n case \"xls\":\r\n case \"xlsx\":\r\n case \"xlt\":\r\n case \"xltx\":\r\n return true;\r\n // Default\r\n default: {\r\n return false;\r\n }\r\n }\r\n };\r\n // Loads the data\r\n Documents.prototype.load = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var web = (0, gd_sprest_bs_1.Web)(_this._props.webUrl);\r\n // Clear the properties\r\n _this._rootFolder = null;\r\n _this._templateFolders = null;\r\n _this._templatesFiles = null;\r\n // See if the templates library was set\r\n if (_this._props.templatesUrl) {\r\n // Load the files and folders\r\n web.getFolderByServerRelativeUrl(_this._props.templatesUrl).query({\r\n Expand: [\"Folders/Files\", \"Files\"]\r\n }).execute(\r\n // Templates folder exists\r\n function (folder) {\r\n // Set the template files\r\n _this._templatesFiles = folder.Files.results;\r\n // Set the template folders\r\n _this._templateFolders = folder.Folders.results;\r\n }, \r\n // Error loading the templates folder\r\n function () {\r\n // Log\r\n console.error(\"[Dattatable] Document's template folder failed to be loaded.\", _this._props.templatesUrl);\r\n });\r\n }\r\n // Set the query\r\n var query = _this._props.query || {};\r\n query.Expand = (query.Expand ? query.Expand : []).concat([\r\n \"Folders/Files\", \"Folders/Files/Author\",\r\n \"Folders/Files/ListItemAllFields\", \"Folders/Files/ListItemAllFields/FieldValuesAsText\",\r\n \"Folders/Files/ModifiedBy\", \"Files\", \"Files/Author\", \"Files/ListItemAllFields\",\r\n \"Files/ListItemAllFields/FieldValuesAsText\", \"Files/ModifiedBy\"\r\n ]);\r\n // See if we are targeting a document set folder\r\n if (_this.IsDocSet) {\r\n web.Lists(_this._props.listName).Items(_this._props.docSetId).Folder().query(query).execute(function (folder) {\r\n // Set the root folder\r\n _this._rootFolder = folder;\r\n }, reject);\r\n }\r\n // Else, see if we are targeting list item attachments\r\n else if (_this.IsAttachment) {\r\n web.Lists(_this._props.listName).Items(_this._props.itemId).AttachmentFiles().execute(function (attachments) {\r\n // Set the attachments\r\n _this._attachments = attachments.results;\r\n }, reject);\r\n }\r\n // Else, it's a library\r\n else {\r\n // Load library information\r\n web.Lists(_this._props.listName).RootFolder().query(query).execute(function (folder) {\r\n // Set the root folder\r\n _this._rootFolder = folder;\r\n }, reject);\r\n }\r\n // Wait for the requests to complete\r\n web.done(function () {\r\n // Resolve the request\r\n resolve();\r\n });\r\n });\r\n };\r\n // Renders the component\r\n Documents.prototype.render = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Load the data\r\n _this.load().then(function () {\r\n // Render the navigation\r\n _this.renderNavigation();\r\n // Render the table\r\n _this.renderTable();\r\n // Call the render event\r\n _this._props.onRendered ? _this._props.onRendered(_this._el) : null;\r\n // Resolve the promise\r\n resolve();\r\n }, reject);\r\n });\r\n };\r\n // Renders the file actions\r\n Documents.prototype.renderActionButtons = function (el, file) {\r\n // Create a span to wrap the icons in\r\n var span = document.createElement(\"span\");\r\n span.className = \"bg-white d-inline-flex ms-2 rounded\";\r\n var spanEdit = span.cloneNode();\r\n var spanProps = span.cloneNode();\r\n var spanDownload = span.cloneNode();\r\n var spanDel = span.cloneNode();\r\n spanDel.classList.add(\"me-1\");\r\n // Add the icons\r\n el.appendChild(span);\r\n el.appendChild(spanEdit);\r\n this.IsAttachment ? null : el.appendChild(spanProps);\r\n el.appendChild(spanDownload);\r\n el.appendChild(spanDel);\r\n // Render the buttons\r\n span.appendChild(this.generateButton(ActionButtonTypes.View, file));\r\n spanEdit.appendChild(this.generateButton(ActionButtonTypes.Edit, file));\r\n this.IsAttachment ? null : spanProps.appendChild(this.generateButton(ActionButtonTypes.Properties, file));\r\n spanDownload.appendChild(this.generateButton(ActionButtonTypes.Download, file));\r\n spanDel.appendChild(this.generateButton(ActionButtonTypes.Delete, file));\r\n };\r\n Documents.prototype.generateButton = function (btnType, file) {\r\n var _this = this;\r\n var isWopi = Documents.isWopi(this.getFileName(file));\r\n // Render the button based on the type\r\n switch (btnType) {\r\n case ActionButtonTypes.Delete:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Delete\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-delete\",\r\n iconType: x_1.x,\r\n iconSize: 24,\r\n isDisabled: !this.CanDelete,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanDelete) {\r\n // Confirm we want to delete the item\r\n if (confirm(\"Are you sure you want to delete this document?\")) {\r\n // Display a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Deleting Document\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Deleting Document: \" + _this.getFileName(file) + \". This will close afterwards.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Delete the document\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFileByServerRelativeUrl(file.ServerRelativeUrl).delete().execute(\r\n // Success\r\n function () {\r\n // close dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page \r\n _this.refresh();\r\n }, \r\n // Error\r\n function (err) {\r\n // TODO\r\n });\r\n }\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Download:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Download\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-download\",\r\n iconType: fileEarmarkArrowDown_1.fileEarmarkArrowDown,\r\n iconSize: 24,\r\n isDisabled: !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanView) {\r\n window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/download.aspx?SourceUrl=\" + file.ServerRelativeUrl, \"_blank\");\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Edit:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Edit\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-edit\",\r\n iconType: inputCursorText_1.inputCursorText,\r\n iconSize: 24,\r\n isDisabled: (!isWopi || !this.CanEdit),\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (isWopi && _this.CanEdit) {\r\n // Open the file in a new tab\r\n window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/WopiFrame.aspx?sourcedoc=\" + file.ServerRelativeUrl + \"&action=edit\");\r\n }\r\n }\r\n },\r\n }).el;\r\n case ActionButtonTypes.Properties:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"Properties\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1 btn-actions-properties\",\r\n iconType: layoutTextSidebar_1.layoutTextSidebar,\r\n iconSize: 24,\r\n isDisabled: !this.CanEdit && !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n // Set the item form properties\r\n itemForm_1.ItemForm.ListName = _this._props.listName;\r\n itemForm_1.ItemForm.UseModal = false;\r\n // Ensure the user can edit the item\r\n if (_this.CanEdit) {\r\n // Define the properties\r\n var editProps = __assign(__assign({}, (_this._props.onItemFormEditing || {})), {\r\n // Set the item id\r\n itemId: file.ListItemAllFields[\"Id\"],\r\n // Set the edit form properties\r\n onCreateEditForm: function (props) {\r\n // Set the rendering event\r\n props.onControlRendering = function (ctrl, field) {\r\n if (field.InternalName == \"FileLeafRef\") {\r\n // Validate the name of the file\r\n ctrl.onValidate = function (ctrl, results) {\r\n var _a;\r\n // Ensure the value is less than 128 characters\r\n if (((_a = results.value) === null || _a === void 0 ? void 0 : _a.length) > 128) {\r\n // Return an error message\r\n results.invalidMessage = \"The file name must be less than 128 characters.\";\r\n results.isValid = false;\r\n }\r\n // Return the results\r\n return results;\r\n };\r\n }\r\n else if (field.InternalName == \"Title\") {\r\n // Update the label of the Title field\r\n ctrl.label = \"Description\";\r\n }\r\n };\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onCreateEditForm) {\r\n // Return the properties\r\n return _this._props.onItemFormEditing.onCreateEditForm(props);\r\n }\r\n // Return the properties\r\n return props;\r\n },\r\n // Update the footer\r\n onSetFooter: function (el) {\r\n var updateBtn = el.querySelector('[role=\"group\"]').firstChild;\r\n updateBtn.classList.remove(\"btn-outline-primary\");\r\n updateBtn.classList.add(\"btn-primary\");\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onSetFooter) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onSetFooter(el);\r\n }\r\n },\r\n // Update the header\r\n onSetHeader: function (el) {\r\n // Update the header\r\n el.querySelector(\"h5\").innerHTML = \"Properties\";\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onSetHeader) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onSetHeader(el);\r\n }\r\n },\r\n // Refresh the view when updates occur\r\n onUpdate: function (item) {\r\n // See if a custom event exists\r\n if (_this._props.onItemFormEditing && _this._props.onItemFormEditing.onUpdate) {\r\n // Execute the event\r\n _this._props.onItemFormEditing.onUpdate(item);\r\n }\r\n else {\r\n // Refresh the data table\r\n _this.refresh();\r\n }\r\n }\r\n });\r\n // Show the edit form\r\n itemForm_1.ItemForm.edit(editProps);\r\n }\r\n else {\r\n // View the form\r\n itemForm_1.ItemForm.view(__assign(__assign({}, (_this._props.onItemFormViewing || {})), {\r\n itemId: file.ListItemAllFields[\"Id\"],\r\n // Set the view form properties\r\n onCreateViewForm: function (props) {\r\n // Set the rendering event\r\n props.onControlRendering = function (ctrl, field) {\r\n if (field.InternalName == \"Title\") {\r\n // Update the label of the Title field\r\n ctrl.label = \"Description\";\r\n }\r\n };\r\n // See if a custom event exists\r\n if (_this._props.onItemFormViewing && _this._props.onItemFormViewing.onCreateViewForm) {\r\n // Return the properties\r\n return _this._props.onItemFormViewing.onCreateViewForm(props);\r\n }\r\n // Return the properties\r\n return props;\r\n }\r\n }));\r\n }\r\n }\r\n }\r\n }).el;\r\n case ActionButtonTypes.View:\r\n return gd_sprest_bs_1.Components.Tooltip({\r\n content: \"View\",\r\n btnProps: {\r\n // Render the icon button\r\n className: \"img-flip-x p-1 btn-actions-view\",\r\n iconType: front_1.front,\r\n iconSize: 24,\r\n isDisabled: !this.CanView,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n if (_this.CanView) {\r\n // Open the file in a new tab\r\n window.open(isWopi ? gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + \"/_layouts/15/WopiFrame.aspx?sourcedoc=\" + file.ServerRelativeUrl + \"&action=view\" : file.ServerRelativeUrl, \"_blank\");\r\n }\r\n }\r\n },\r\n }).el;\r\n }\r\n };\r\n // Renders the file icon\r\n Documents.prototype.renderFileIcon = function (el, fileName) {\r\n // Render the icon wrapper\r\n var span = document.createElement(\"span\");\r\n span.className = \"text-body\";\r\n el.appendChild(span);\r\n // Render the icon\r\n var size = 28;\r\n switch ((0, methods_1.getFileExt)(fileName)) {\r\n // Power BI\r\n case \"pbix\":\r\n span.appendChild((0, fileEarmarkBarGraph_1.fileEarmarkBarGraph)(size));\r\n span.title = \"Power BI Report\";\r\n break;\r\n // Binary\r\n case \"bin\":\r\n case \"blg\":\r\n case \"dat\":\r\n case \"dmg\":\r\n case \"dmp\":\r\n case \"log\":\r\n case \"pbi\":\r\n span.appendChild((0, fileEarmarkBinary_1.fileEarmarkBinary)(size));\r\n span.title = \"Binary File\";\r\n break;\r\n // Code\r\n case \"app\":\r\n case \"asp\":\r\n case \"aspx\":\r\n case \"css\":\r\n case \"hta\":\r\n case \"htm\":\r\n case \"html\":\r\n case \"js\":\r\n case \"json\":\r\n case \"mht\":\r\n case \"mhtml\":\r\n case \"scss\":\r\n case \"sppkg\":\r\n case \"wsp\":\r\n case \"xml\":\r\n case \"yaml\":\r\n span.appendChild((0, fileEarmarkCode_1.fileEarmarkCode)(size));\r\n span.title = \"Code\";\r\n break;\r\n // Excel\r\n case \"csv\":\r\n case \"ods\":\r\n case \"xls\":\r\n case \"xlsx\":\r\n case \"xlt\":\r\n case \"xltx\":\r\n span.appendChild((0, fileEarmarkExcel_1.fileEarmarkExcel)(size));\r\n span.title = \"Excel Spreadsheet\";\r\n break;\r\n // Image\r\n case \"ai\":\r\n case \"bmp\":\r\n case \"eps\":\r\n case \"gif\":\r\n case \"heic\":\r\n case \"heif\":\r\n case \"jpe\":\r\n case \"jpeg\":\r\n case \"jpg\":\r\n case \"png\":\r\n case \"psd\":\r\n case \"svg\":\r\n case \"tif\":\r\n case \"tiff\":\r\n case \"webp\":\r\n span.appendChild((0, fileEarmarkImage_1.fileEarmarkImage)(size));\r\n span.title = \"Image\";\r\n break;\r\n // Audio\r\n case \"aac\":\r\n case \"aiff\":\r\n case \"alac\":\r\n case \"flac\":\r\n case \"m4a\":\r\n case \"m4p\":\r\n case \"mka\":\r\n case \"mp3\":\r\n case \"mp4a\":\r\n case \"wav\":\r\n case \"wma\":\r\n span.appendChild((0, fileEarmarkMusic_1.fileEarmarkMusic)(size));\r\n span.title = \"Audio File\";\r\n break;\r\n // PDF\r\n case \"pdf\":\r\n span.appendChild((0, fileEarmarkPdf_1.fileEarmarkPdf)(size));\r\n span.title = \"Adobe PDF\";\r\n break;\r\n // PowerPoint\r\n case \"odp\":\r\n case \"pot\":\r\n case \"potx\":\r\n case \"pps\":\r\n case \"ppsx\":\r\n case \"ppt\":\r\n case \"pptx\":\r\n span.appendChild((0, fileEarmarkPpt_1.fileEarmarkPpt)(size));\r\n span.title = \"PowerPoint Presentation\";\r\n break;\r\n // Media\r\n case \"avi\":\r\n case \"flv\":\r\n case \"m2ts\":\r\n case \"mkv\":\r\n case \"mov\":\r\n case \"m4p\":\r\n case \"m4v\":\r\n case \"mp4\":\r\n case \"mpe\":\r\n case \"mpeg\":\r\n case \"mpg\":\r\n case \"mpv\":\r\n case \"qt\":\r\n case \"ts\":\r\n case \"vob\":\r\n case \"webm\":\r\n case \"wmv\":\r\n span.appendChild((0, fileEarmarkPlay_1.fileEarmarkPlay)(size));\r\n span.title = \"Media File\";\r\n break;\r\n // Rich Text\r\n case \"rtf\":\r\n span.appendChild((0, fileEarmarkRichtext_1.fileEarmarkRichtext)(size));\r\n span.title = \"Rich Text\";\r\n break;\r\n // Database\r\n case \"ldf\":\r\n case \"mdb\":\r\n case \"mdf\":\r\n span.appendChild((0, fileEarmarkSpreadsheet_1.fileEarmarkSpreadsheet)(size));\r\n span.title = \"Database\";\r\n break;\r\n // Text\r\n case \"md\":\r\n case \"text\":\r\n case \"txt\":\r\n span.appendChild((0, fileEarmarkText_1.fileEarmarkText)(size));\r\n span.title = \"Text\";\r\n break;\r\n // Word\r\n case \"doc\":\r\n case \"docx\":\r\n case \"dot\":\r\n case \"dotx\":\r\n case \"odt\":\r\n case \"wpd\":\r\n span.appendChild((0, fileEarmarkWord_1.fileEarmarkWord)(size));\r\n span.title = \"Word Document\";\r\n break;\r\n // Compressed\r\n case \"7z\":\r\n case \"cab\":\r\n case \"gz\":\r\n case \"iso\":\r\n case \"rar\":\r\n case \"tgz\":\r\n case \"zip\":\r\n span.appendChild((0, fileEarmarkZip_1.fileEarmarkZip)(size));\r\n span.title = \"Compressed Folder\";\r\n break;\r\n // Default\r\n default: {\r\n span.appendChild((0, fileEarmark_1.fileEarmark)(size));\r\n span.title = \"File\";\r\n }\r\n }\r\n };\r\n // Renders the navigation\r\n Documents.prototype.renderNavigation = function () {\r\n var _this = this;\r\n var itemsEnd = [];\r\n // See if templates exist\r\n if (this.TemplateFiles && this.TemplateFolders) {\r\n // Add the item\r\n itemsEnd.push({\r\n text: \"Templates\",\r\n className: \"btn btn-sm btn-outline-secondary\",\r\n classNameItem: \"bg-white\",\r\n iconClassName: \"btn-icon-sm\",\r\n iconSize: 20,\r\n iconType: fileEarmarkPlus_1.fileEarmarkPlus,\r\n isButton: true,\r\n items: this.generateItems()\r\n });\r\n }\r\n // Add the upload button\r\n itemsEnd.push({\r\n text: \"Upload\",\r\n onRender: function (el, item) {\r\n // Clear the existing button\r\n el.innerHTML = \"\";\r\n // Create a span to wrap the icon in\r\n var span = document.createElement(\"span\");\r\n span.className = \"bg-white d-inline-flex ms-2 rounded\";\r\n el.appendChild(span);\r\n // Render a tooltip\r\n gd_sprest_bs_1.Components.Tooltip({\r\n el: span,\r\n content: item.text,\r\n btnProps: {\r\n // Render the icon button\r\n className: \"p-1\",\r\n iconType: fileEarmarkArrowUp_1.fileEarmarkArrowUp,\r\n iconSize: 24,\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,\r\n onClick: function () {\r\n // Show the file upload dialog\r\n gd_sprest_bs_1.Helper.ListForm.showFileDialog(_this._props.fileExtensions).then(function (fileInfo) {\r\n // Code to run after the event\r\n var onCompleted = function (fileInfo) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Uploading File\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Saving the file you selected. Please wait...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Upload the file\r\n _this.uploadFile(fileInfo).then(\r\n // Success\r\n function (file) {\r\n // Call the event\r\n _this._props.onFileAdded ? _this._props.onFileAdded(file) : null;\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n // Refresh the page\r\n _this.refresh();\r\n }, \r\n // Error\r\n function () {\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n });\r\n };\r\n // Call the file adding event\r\n var returnVal = _this._props.onFileAdding ? _this._props.onFileAdding(fileInfo) : null;\r\n if (typeof (returnVal) === \"boolean\") {\r\n // Add the file\r\n returnVal ? onCompleted(fileInfo) : null;\r\n }\r\n // Else, see if it doesn't exist\r\n else if (returnVal == null) {\r\n // Add the file\r\n onCompleted(fileInfo);\r\n }\r\n else if (returnVal.then) {\r\n // Wait for the event to complete\r\n returnVal.then(function (addFile) {\r\n // Add the file\r\n addFile ? onCompleted(fileInfo) : null;\r\n });\r\n }\r\n });\r\n }\r\n },\r\n });\r\n }\r\n });\r\n // Set the default properties\r\n var navProps = {\r\n el: this._el,\r\n brand: \"Documents\",\r\n itemsEnd: itemsEnd,\r\n searchBox: this._props.enableSearch ? {\r\n hideButton: true,\r\n onChange: function (value) {\r\n // Search the data table\r\n _this._dt.search(value);\r\n },\r\n onSearch: function (value) {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n } : null\r\n };\r\n // Call the rendering event\r\n this._props.onNavigationRendering ? this._props.onNavigationRendering(navProps) : null;\r\n // Create the navbar\r\n this._navbar = gd_sprest_bs_1.Components.Navbar(navProps);\r\n /* Fix the padding on the left & right of the nav */\r\n this._navbar.el.querySelector(\"div.container-fluid\").classList.add(\"ps-75\");\r\n this._navbar.el.querySelector(\"div.container-fluid\").classList.add(\"pe-2\");\r\n // See if we are showing the filter\r\n if (this._props.onShowFilter) {\r\n // Render the filter icon\r\n var icon = document.createElement(\"div\");\r\n icon.classList.add(\"filter-icon\");\r\n icon.classList.add(\"nav-link\");\r\n icon.classList.add(\"text-dark\");\r\n icon.style.cursor = \"pointer\";\r\n icon.appendChild((0, filterSquare_1.filterSquare)());\r\n this._props.onShowFilter ? icon.addEventListener(\"click\", this._props.onShowFilter) : null;\r\n this._navbar.el.firstElementChild.appendChild(icon);\r\n // Call the render event\r\n this._props.onFilterRendered ? this._props.onFilterRendered(icon) : null;\r\n }\r\n // Call the render events\r\n this._props.onSearchRendered ? this._props.onSearchRendered(this._navbar.el.querySelector(\"input[type='search']\")) : null;\r\n this._props.onNavigationRendered ? this._props.onNavigationRendered(this.Navigation) : null;\r\n };\r\n // Renders the datatable with the file information\r\n Documents.prototype.renderTable = function () {\r\n // Create the element\r\n var el = document.createElement(\"div\");\r\n this._el.appendChild(el);\r\n this._tblProps.el = el;\r\n // Set the data\r\n this._tblProps.rows = this.Attachments || this.Files;\r\n // Call the rendering event\r\n this._props.table && this._props.table.onRendering ? this._props.table.onRendering(this._tblProps) : null;\r\n // Render the table\r\n this._dt = new table_1.DataTable(this._tblProps);\r\n // Call the rendered event\r\n this._tblProps.onRendered ? this._tblProps.onRendered(el, this._dt.datatable) : null;\r\n };\r\n // Uploads a file\r\n Documents.prototype.uploadFile = function (fileInfo) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var list = (0, gd_sprest_bs_1.List)(_this._props.listName);\r\n // See if this is an attachment\r\n if (_this.IsAttachment) {\r\n // Upload the attachment\r\n list.Items(_this._props.itemId).AttachmentFiles().add(fileInfo.name, fileInfo.data).execute(resolve, reject);\r\n }\r\n else {\r\n // Upload the file to the objective folder\r\n (0, gd_sprest_bs_1.Web)(_this._props.webUrl).getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(fileInfo.name, true, fileInfo.data).execute(resolve, reject);\r\n }\r\n });\r\n };\r\n /** Public Methods */\r\n // Generates an action button\r\n Documents.prototype.generateActionButton = function (btnType, file) {\r\n // Return the button\r\n return this.generateButton(btnType, file);\r\n };\r\n // Refreshes the documents\r\n Documents.prototype.refresh = function () {\r\n var _this = this;\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Reloading Workspace\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Reloading the workspace data. This will close afterwards.\");\r\n loadingDialog_1.LoadingDialog.show();\r\n // Clear the element\r\n while (this._el.firstChild) {\r\n this._el.removeChild(this._el.firstChild);\r\n }\r\n // Render the component\r\n this.render().then(function () {\r\n // Call the event\r\n _this._props.onRefresh ? _this._props.onRefresh() : null;\r\n // Hide the dialog\r\n loadingDialog_1.LoadingDialog.hide();\r\n });\r\n };\r\n // Searches the data table\r\n Documents.prototype.search = function (value) {\r\n // Search the table data\r\n this._dt.search(value);\r\n };\r\n return Documents;\r\n}());\r\nexports.Documents = Documents;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/documents.js?");
64
64
 
65
65
  /***/ }),
66
66
 
@@ -214,7 +214,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
214
214
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
215
215
 
216
216
  "use strict";
217
- eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Dashboard = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\nvar accordion_1 = __webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\");\r\nvar filter_1 = __webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\");\r\nvar footer_1 = __webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\");\r\nvar header_1 = __webpack_require__(/*! ./header */ \"./build/dashboard/header.js\");\r\nvar navigation_1 = __webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\");\r\nvar table_1 = __webpack_require__(/*! ./table */ \"./build/dashboard/table.js\");\r\nvar tiles_1 = __webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\");\r\n// Export the components\r\n__exportStar(__webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./header */ \"./build/dashboard/header.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./table */ \"./build/dashboard/table.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\"), exports);\r\n/**\r\n * Dashboard\r\n */\r\nvar Dashboard = /** @class */ (function () {\r\n // Constructor\r\n function Dashboard(props) {\r\n var _this = this;\r\n this._accordion = null;\r\n this._dt = null;\r\n this._filters = null;\r\n this._navigation = null;\r\n this._props = null;\r\n this._tiles = null;\r\n // Set the properties\r\n this._props = props;\r\n // Set the flag\r\n typeof (props.useModal) === \"boolean\" ? common_1.ItemForm.UseModal = props.useModal : null;\r\n // Render the dashboard\r\n this.render();\r\n // Let the object get instaniated before calling the event\r\n setTimeout(function () {\r\n // Apply the filters\r\n _this.applyFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(_this._props.el) : null;\r\n }, 10);\r\n }\r\n Object.defineProperty(Dashboard.prototype, \"IsAccordion\", {\r\n // Determines if we are rendering an accordion\r\n get: function () { return this._props.accordion ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"IsTiles\", {\r\n // Determines if we are rendering tiles\r\n get: function () { return this._props.tiles ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Applies the default active filters\r\n Dashboard.prototype.applyFilters = function () {\r\n var _a;\r\n // See if filters exist\r\n if ((_a = this._props.filters) === null || _a === void 0 ? void 0 : _a.items) {\r\n // Parse the filters\r\n for (var i = 0; i < this._props.filters.items.length; i++) {\r\n var applyFilter = false;\r\n var filter = this._props.filters.items[i];\r\n var value = filter.multi ? [] : \"\";\r\n // Parse the items\r\n for (var j = 0; j < (filter === null || filter === void 0 ? void 0 : filter.items.length); j++) {\r\n var item = filter.items[j];\r\n // See if this one is active\r\n if (item.isSelected) {\r\n // Set the flag\r\n applyFilter = true;\r\n // Set the value\r\n filter.multi ? value.push(item.label) : value = item.label;\r\n }\r\n }\r\n // See if we are applying the filter\r\n if (applyFilter) {\r\n // Apply the filter\r\n filter.onFilter(value);\r\n }\r\n }\r\n }\r\n };\r\n // Renders the component\r\n Dashboard.prototype.render = function () {\r\n var _this = this;\r\n // Create the filters\r\n this._filters = new filter_1.FilterSlideout({\r\n filters: this._props.filters ? this._props.filters.items : [],\r\n onClear: this._props.filters ? this._props.filters.onClear : null,\r\n onRendered: this._props.filters ? this._props.filters.onRendered : null,\r\n onFilter: this.IsAccordion || this.IsTiles ? function (value, item) {\r\n // See if this is an accordion\r\n if (_this.IsAccordion) {\r\n // Filter the accordion\r\n _this._accordion.filter(value, item);\r\n }\r\n else {\r\n // Filter the tiles\r\n _this._tiles.filter(value, item);\r\n }\r\n } : null\r\n });\r\n // Render the template\r\n var elTemplate = document.createElement(\"div\");\r\n elTemplate.classList.add(\"dashboard\");\r\n elTemplate.innerHTML = \"\\n <div class=\\\"row\\\">\\n <div id=\\\"navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"header\\\" class=\\\"col mx-75\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"sub-navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"\".concat(this.IsAccordion ? \"accordion\" : (this.IsTiles ? \"tiles\" : \"datatable\"), \"\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"footer\\\" class=\\\"col\\\"></div>\\n </div>\").trim();\r\n this._props.el.appendChild(elTemplate);\r\n // Set/Default the visibility flags\r\n var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;\r\n var navIsVisible = this._props.hideNavigation ? false : true;\r\n var subNavIsVisible = (this._props.hideSubNavigation == null || this._props.hideSubNavigation == true) && this._props.subNavigation == null ? false : true;\r\n // See if we are hiding the navigation\r\n if (!navIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_1 = this._props.navigation || {};\r\n this._navigation = new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#navigation\"),\r\n hideFilter: navProps_1.showFilter != null ? !navProps_1.showFilter : false,\r\n hideSearch: navProps_1.showSearch != null ? !navProps_1.showSearch : false,\r\n items: navProps_1.items,\r\n itemsEnd: navProps_1.itemsEnd,\r\n title: navProps_1.title,\r\n onFilterRendered: navProps_1.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"bg-sharepoint rounded\" + (headerIsVisible || subNavIsVisible ? \"-top\" : \"\"));\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Dark;\r\n // Call the rendering event if it exists\r\n navProps_1.onRendering ? navProps_1.onRendering(props) : null;\r\n },\r\n onRendered: navProps_1.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onSearchRendered: navProps_1.onSearchRendered,\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n // Call the event\r\n navProps_1.onShowFilter ? navProps_1.onShowFilter() : null;\r\n },\r\n searchPlaceholder: navProps_1.searchPlaceholder\r\n });\r\n }\r\n // See if we are hiding the header\r\n if (!headerIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#header\").classList.add(\"d-none\");\r\n }\r\n else {\r\n var elHeader = this._props.el.querySelector(\"#header\");\r\n // Render the header\r\n var header = this._props.header || {};\r\n new header_1.Header({\r\n el: elHeader,\r\n onRendering: this._props.header ? this._props.header.onRendering : null,\r\n onRendered: this._props.header ? this._props.header.onRendered : null,\r\n title: header.title\r\n });\r\n // See if the sub-nav is not visible\r\n if (!navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded\");\r\n }\r\n else if (navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-bottom\");\r\n }\r\n else if (!navIsVisible && subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-top\");\r\n }\r\n }\r\n // See if we are hiding the sub-navigation\r\n if (!subNavIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#sub-navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_2 = this._props.subNavigation || {};\r\n new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#sub-navigation\"),\r\n hideFilter: navProps_2.showFilter != null ? !navProps_2.showFilter : true,\r\n hideSearch: navProps_2.showSearch != null ? !navProps_2.showSearch : true,\r\n items: navProps_2.items,\r\n itemsEnd: navProps_2.itemsEnd,\r\n title: navProps_2.title,\r\n onFilterRendered: navProps_2.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"rounded\" + (!headerIsVisible && !navIsVisible ? \"\" : \"-bottom\"));\r\n props.className = \"sub-nav \" + props.className;\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Light;\r\n // Call the rendering event if it exists\r\n navProps_2.onRendering ? navProps_2.onRendering(props) : null;\r\n },\r\n onRendered: navProps_2.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n },\r\n });\r\n }\r\n // See if we are rendering an accordion\r\n if (this.IsAccordion) {\r\n // Render the accordion\r\n this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector(\"#accordion\") }, this._props.accordion));\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Render the tiles\r\n this._tiles = new tiles_1.Tiles(__assign({ el: this._props.el.querySelector(\"#tiles\") }, this._props.tiles));\r\n }\r\n else {\r\n // Render the data table\r\n this._dt = new table_1.DataTable(__assign({ el: this._props.el.querySelector(\"#datatable\") }, this._props.table));\r\n }\r\n // See if we are hiding the footer\r\n if (this._props.hideFooter) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#footer\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the footer\r\n var footer = this._props.footer || {};\r\n new footer_1.Footer({\r\n el: this._props.el.querySelector(\"#footer\"),\r\n items: footer.items,\r\n itemsEnd: footer.itemsEnd,\r\n onRendering: footer.onRendering,\r\n onRendered: footer.onRendered\r\n });\r\n }\r\n };\r\n Object.defineProperty(Dashboard.prototype, \"Datatable\", {\r\n /**\r\n * Component References\r\n */\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Filters\", {\r\n get: function () { return this._filters; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Navigation\", {\r\n get: function () { return this._navigation; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Public Interface\r\n */\r\n // Clears the filters\r\n Dashboard.prototype.clearFilter = function () {\r\n // Clear the filters\r\n this._filters.clear();\r\n };\r\n // Filter the table\r\n Dashboard.prototype.filter = function (idx, value, exactMatchFl) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(value);\r\n }\r\n else {\r\n // If no value is specified, then we don't want to filter by exact value\r\n exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordion = function (values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(typeof (values) === \"string\" ? [values] : values);\r\n }\r\n };\r\n // Filter the table by multiple values\r\n Dashboard.prototype.filterMulti = function (idx, values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(values);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(values);\r\n }\r\n else {\r\n // Filter the table\r\n this._dt.filterMulti(idx, values);\r\n }\r\n };\r\n // Filter the tiles\r\n Dashboard.prototype.filterTiles = function (values) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(typeof (values) === \"string\" ? [values] : values);\r\n }\r\n };\r\n // Returns a filter checkbox group by its key\r\n Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };\r\n // Returns the current search value\r\n Dashboard.prototype.getSearchValue = function () { return this._navigation ? this._navigation.getSearchValue() : \"\"; };\r\n // Hides the filter\r\n Dashboard.prototype.hideFilter = function () { this._filters.hide(); };\r\n // Refresh the table\r\n Dashboard.prototype.refresh = function (rows) {\r\n // Refresh the table\r\n this._dt.refresh(rows);\r\n // See if a search value exists\r\n var searchValue = this._navigation ? this._navigation.getSearchValue() : \"\";\r\n if (searchValue) {\r\n // Apply the search value\r\n this.search(searchValue);\r\n }\r\n };\r\n // Search the table\r\n Dashboard.prototype.search = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Search the accordion\r\n this._accordion.search(value);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Search the tiles\r\n this._tiles.search(value);\r\n }\r\n else {\r\n // Search the table\r\n this._dt.search(value);\r\n }\r\n };\r\n // Sets a filter checkbox group value\r\n Dashboard.prototype.setFilterValue = function (key, value) { return this._filters.setFilterValue(key, value); };\r\n // Shows the filter\r\n Dashboard.prototype.showFilter = function () { this._filters.show(); };\r\n return Dashboard;\r\n}());\r\nexports.Dashboard = Dashboard;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/index.js?");
217
+ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Dashboard = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\nvar accordion_1 = __webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\");\r\nvar filter_1 = __webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\");\r\nvar footer_1 = __webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\");\r\nvar header_1 = __webpack_require__(/*! ./header */ \"./build/dashboard/header.js\");\r\nvar navigation_1 = __webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\");\r\nvar table_1 = __webpack_require__(/*! ./table */ \"./build/dashboard/table.js\");\r\nvar tiles_1 = __webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\");\r\n// Export the components\r\n__exportStar(__webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./header */ \"./build/dashboard/header.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./table */ \"./build/dashboard/table.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\"), exports);\r\n/**\r\n * Dashboard\r\n */\r\nvar Dashboard = /** @class */ (function () {\r\n // Constructor\r\n function Dashboard(props) {\r\n var _this = this;\r\n this._accordion = null;\r\n this._dt = null;\r\n this._filters = null;\r\n this._navigation = null;\r\n this._props = null;\r\n this._tiles = null;\r\n // Set the properties\r\n this._props = props;\r\n // Set the flag\r\n typeof (props.useModal) === \"boolean\" ? common_1.ItemForm.UseModal = props.useModal : null;\r\n // Render the dashboard\r\n this.render();\r\n // Let the object get instaniated before calling the event\r\n setTimeout(function () {\r\n // Apply the filters\r\n _this.applyFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(_this._props.el) : null;\r\n }, 10);\r\n }\r\n Object.defineProperty(Dashboard.prototype, \"IsAccordion\", {\r\n // Determines if we are rendering an accordion\r\n get: function () { return this._props.accordion ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"IsTiles\", {\r\n // Determines if we are rendering tiles\r\n get: function () { return this._props.tiles ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Applies the default active filters\r\n Dashboard.prototype.applyFilters = function () {\r\n var _a;\r\n // See if filters exist\r\n if ((_a = this._props.filters) === null || _a === void 0 ? void 0 : _a.items) {\r\n // Parse the filters\r\n for (var i = 0; i < this._props.filters.items.length; i++) {\r\n var applyFilter = false;\r\n var filter = this._props.filters.items[i];\r\n var value = filter.multi ? [] : \"\";\r\n // Parse the items\r\n for (var j = 0; j < (filter === null || filter === void 0 ? void 0 : filter.items.length); j++) {\r\n var item = filter.items[j];\r\n // See if this one is active\r\n if (item.isSelected) {\r\n // Set the flag\r\n applyFilter = true;\r\n // Set the value\r\n filter.multi ? value.push(item.label) : value = item.label;\r\n }\r\n }\r\n // See if we are applying the filter\r\n if (applyFilter) {\r\n // Apply the filter\r\n filter.onFilter(value);\r\n }\r\n }\r\n }\r\n };\r\n // Renders the component\r\n Dashboard.prototype.render = function () {\r\n var _this = this;\r\n // Create the filters\r\n this._filters = new filter_1.FilterSlideout({\r\n filters: this._props.filters ? this._props.filters.items : [],\r\n onClear: this._props.filters ? this._props.filters.onClear : null,\r\n onRendered: this._props.filters ? this._props.filters.onRendered : null,\r\n onFilter: this.IsAccordion || this.IsTiles ? function (value, item) {\r\n // See if this is an accordion\r\n if (_this.IsAccordion) {\r\n // Filter the accordion\r\n _this._accordion.filter(value, item);\r\n }\r\n else {\r\n // Filter the tiles\r\n _this._tiles.filter(value, item);\r\n }\r\n } : null\r\n });\r\n // Render the template\r\n var elTemplate = document.createElement(\"div\");\r\n elTemplate.classList.add(\"dashboard\");\r\n elTemplate.innerHTML = \"\\n <div class=\\\"row\\\">\\n <div id=\\\"navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"header\\\" class=\\\"col mx-75\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"sub-navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"\".concat(this.IsAccordion ? \"accordion\" : (this.IsTiles ? \"tiles\" : \"datatable\"), \"\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"footer\\\" class=\\\"col\\\"></div>\\n </div>\").trim();\r\n this._props.el.appendChild(elTemplate);\r\n // Set/Default the visibility flags\r\n var headerIsVisible = typeof (this._props.hideHeader) === \"boolean\" ? !this._props.hideHeader : (this._props.header == null ? false : true);\r\n var navIsVisible = typeof (this._props.hideNavigation) === \"boolean\" ? !this._props.hideNavigation : true;\r\n var subNavIsVisible = typeof (this._props.hideSubNavigation) === \"boolean\" ? !this._props.hideSubNavigation : (this._props.subNavigation == null ? false : true);\r\n // See if we are hiding the navigation\r\n if (!navIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_1 = this._props.navigation || {};\r\n this._navigation = new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#navigation\"),\r\n hideFilter: navProps_1.showFilter != null ? !navProps_1.showFilter : false,\r\n hideSearch: navProps_1.showSearch != null ? !navProps_1.showSearch : false,\r\n items: navProps_1.items,\r\n itemsEnd: navProps_1.itemsEnd,\r\n title: navProps_1.title,\r\n onFilterRendered: navProps_1.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"bg-sharepoint rounded\" + (headerIsVisible || subNavIsVisible ? \"-top\" : \"\"));\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Dark;\r\n // Call the rendering event if it exists\r\n navProps_1.onRendering ? navProps_1.onRendering(props) : null;\r\n },\r\n onRendered: navProps_1.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onSearchRendered: navProps_1.onSearchRendered,\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n // Call the event\r\n navProps_1.onShowFilter ? navProps_1.onShowFilter() : null;\r\n },\r\n searchPlaceholder: navProps_1.searchPlaceholder\r\n });\r\n }\r\n // See if we are hiding the header\r\n if (!headerIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#header\").classList.add(\"d-none\");\r\n }\r\n else {\r\n var elHeader = this._props.el.querySelector(\"#header\");\r\n // Render the header\r\n var header = this._props.header || {};\r\n new header_1.Header({\r\n el: elHeader,\r\n onRendering: this._props.header ? this._props.header.onRendering : null,\r\n onRendered: this._props.header ? this._props.header.onRendered : null,\r\n title: header.title\r\n });\r\n // See if the sub-nav is not visible\r\n if (!navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded\");\r\n }\r\n else if (navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-bottom\");\r\n }\r\n else if (!navIsVisible && subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-top\");\r\n }\r\n }\r\n // See if we are hiding the sub-navigation\r\n if (!subNavIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#sub-navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_2 = this._props.subNavigation || {};\r\n new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#sub-navigation\"),\r\n hideFilter: navProps_2.showFilter != null ? !navProps_2.showFilter : true,\r\n hideSearch: navProps_2.showSearch != null ? !navProps_2.showSearch : true,\r\n items: navProps_2.items,\r\n itemsEnd: navProps_2.itemsEnd,\r\n title: navProps_2.title,\r\n onFilterRendered: navProps_2.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"rounded\" + (!headerIsVisible && !navIsVisible ? \"\" : \"-bottom\"));\r\n props.className = \"sub-nav \" + props.className;\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Light;\r\n // Call the rendering event if it exists\r\n navProps_2.onRendering ? navProps_2.onRendering(props) : null;\r\n },\r\n onRendered: navProps_2.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n },\r\n });\r\n }\r\n // See if we are rendering an accordion\r\n if (this.IsAccordion) {\r\n // Render the accordion\r\n this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector(\"#accordion\") }, this._props.accordion));\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Render the tiles\r\n this._tiles = new tiles_1.Tiles(__assign({ el: this._props.el.querySelector(\"#tiles\") }, this._props.tiles));\r\n }\r\n else {\r\n // Render the data table\r\n this._dt = new table_1.DataTable(__assign({ el: this._props.el.querySelector(\"#datatable\") }, this._props.table));\r\n }\r\n // See if we are hiding the footer\r\n if (this._props.hideFooter) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#footer\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the footer\r\n var footer = this._props.footer || {};\r\n new footer_1.Footer({\r\n el: this._props.el.querySelector(\"#footer\"),\r\n items: footer.items,\r\n itemsEnd: footer.itemsEnd,\r\n onRendering: footer.onRendering,\r\n onRendered: footer.onRendered\r\n });\r\n }\r\n };\r\n Object.defineProperty(Dashboard.prototype, \"Datatable\", {\r\n /**\r\n * Component References\r\n */\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Filters\", {\r\n get: function () { return this._filters; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Navigation\", {\r\n get: function () { return this._navigation; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Public Interface\r\n */\r\n // Clears the filters\r\n Dashboard.prototype.clearFilter = function () {\r\n // Clear the filters\r\n this._filters.clear();\r\n };\r\n // Filter the table\r\n Dashboard.prototype.filter = function (idx, value, exactMatchFl) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(value);\r\n }\r\n else {\r\n // If no value is specified, then we don't want to filter by exact value\r\n exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordion = function (values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(typeof (values) === \"string\" ? [values] : values);\r\n }\r\n };\r\n // Filter the table by multiple values\r\n Dashboard.prototype.filterMulti = function (idx, values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(values);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(values);\r\n }\r\n else {\r\n // Filter the table\r\n this._dt.filterMulti(idx, values);\r\n }\r\n };\r\n // Filter the tiles\r\n Dashboard.prototype.filterTiles = function (values) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(typeof (values) === \"string\" ? [values] : values);\r\n }\r\n };\r\n // Returns a filter checkbox group by its key\r\n Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };\r\n // Returns the current search value\r\n Dashboard.prototype.getSearchValue = function () { return this._navigation ? this._navigation.getSearchValue() : \"\"; };\r\n // Hides the filter\r\n Dashboard.prototype.hideFilter = function () { this._filters.hide(); };\r\n // Refresh the table\r\n Dashboard.prototype.refresh = function (rows) {\r\n // Refresh the table\r\n this._dt.refresh(rows);\r\n // See if a search value exists\r\n var searchValue = this._navigation ? this._navigation.getSearchValue() : \"\";\r\n if (searchValue) {\r\n // Apply the search value\r\n this.search(searchValue);\r\n }\r\n };\r\n // Search the table\r\n Dashboard.prototype.search = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Search the accordion\r\n this._accordion.search(value);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Search the tiles\r\n this._tiles.search(value);\r\n }\r\n else {\r\n // Search the table\r\n this._dt.search(value);\r\n }\r\n };\r\n // Sets a filter checkbox group value\r\n Dashboard.prototype.setFilterValue = function (key, value) { return this._filters.setFilterValue(key, value); };\r\n // Shows the filter\r\n Dashboard.prototype.showFilter = function () { this._filters.show(); };\r\n return Dashboard;\r\n}());\r\nexports.Dashboard = Dashboard;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/index.js?");
218
218
 
219
219
  /***/ }),
220
220