dattatable 2.10.18 → 2.10.20

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 +2 -1
  2. package/build/common/documents.js +45 -29
  3. package/build/common/list.js +8 -7
  4. package/dist/dattatable.js +580 -580
  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 +7 -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 +2 -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 +2 -2
@@ -104,7 +104,6 @@ export declare class Documents {
104
104
  private generateItems;
105
105
  private generateTableProps;
106
106
  private getFileName;
107
- static isWopi(filename: string): boolean;
108
107
  private load;
109
108
  private render;
110
109
  private renderActionButtons;
@@ -115,6 +114,8 @@ export declare class Documents {
115
114
  private uploadFile;
116
115
  /** Public Methods */
117
116
  generateActionButton(btnType: number, file: Types.SP.File): HTMLElement;
117
+ static isWopi(filename: string): boolean;
118
+ static open(fileUrl: string, edit?: boolean): void;
118
119
  refresh(): void;
119
120
  search(value: string): void;
120
121
  }
@@ -473,32 +473,6 @@ var Documents = /** @class */ (function () {
473
473
  // Return the file name
474
474
  return file.Name || file.FileName;
475
475
  };
476
- // Determines if the document can be viewed in office online servers
477
- Documents.isWopi = function (filename) {
478
- switch ((0, methods_1.getFileExt)(filename)) {
479
- // Excel
480
- case "csv":
481
- case "doc":
482
- case "docx":
483
- case "dot":
484
- case "dotx":
485
- case "pot":
486
- case "potx":
487
- case "pps":
488
- case "ppsx":
489
- case "ppt":
490
- case "pptx":
491
- case "xls":
492
- case "xlsx":
493
- case "xlt":
494
- case "xltx":
495
- return true;
496
- // Default
497
- default: {
498
- return false;
499
- }
500
- }
501
- };
502
476
  // Loads the data
503
477
  Documents.prototype.load = function () {
504
478
  var _this = this;
@@ -659,6 +633,7 @@ var Documents = /** @class */ (function () {
659
633
  type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
660
634
  onClick: function () {
661
635
  if (_this.CanView) {
636
+ // Open the document
662
637
  window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/download.aspx?SourceUrl=" + file.ServerRelativeUrl, "_blank");
663
638
  }
664
639
  }
@@ -677,7 +652,7 @@ var Documents = /** @class */ (function () {
677
652
  onClick: function () {
678
653
  if (isWopi && _this.CanEdit) {
679
654
  // Open the file in a new tab
680
- window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + file.ServerRelativeUrl + "&action=edit");
655
+ Documents.open(file.ServerRelativeUrl, true);
681
656
  }
682
657
  }
683
658
  },
@@ -808,8 +783,8 @@ var Documents = /** @class */ (function () {
808
783
  type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
809
784
  onClick: function () {
810
785
  if (_this.CanView) {
811
- // Open the file in a new tab
812
- window.open(isWopi ? gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + file.ServerRelativeUrl + "&action=view" : file.ServerRelativeUrl, "_blank");
786
+ // Open the file
787
+ Documents.open(file.ServerRelativeUrl);
813
788
  }
814
789
  }
815
790
  },
@@ -1166,6 +1141,47 @@ var Documents = /** @class */ (function () {
1166
1141
  // Return the button
1167
1142
  return this.generateButton(btnType, file);
1168
1143
  };
1144
+ // Determines if the document can be viewed in office online servers
1145
+ Documents.isWopi = function (filename) {
1146
+ switch ((0, methods_1.getFileExt)(filename)) {
1147
+ // Excel
1148
+ case "csv":
1149
+ case "doc":
1150
+ case "docx":
1151
+ case "dot":
1152
+ case "dotx":
1153
+ case "pot":
1154
+ case "potx":
1155
+ case "pps":
1156
+ case "ppsx":
1157
+ case "ppt":
1158
+ case "pptx":
1159
+ case "xls":
1160
+ case "xlsx":
1161
+ case "xlt":
1162
+ case "xltx":
1163
+ return true;
1164
+ // Default
1165
+ default: {
1166
+ return false;
1167
+ }
1168
+ }
1169
+ };
1170
+ // Opens the document
1171
+ Documents.open = function (fileUrl, edit) {
1172
+ if (edit === void 0) { edit = false; }
1173
+ var fileData = fileUrl.split('/');
1174
+ var fileName = fileData[fileData.length - 1];
1175
+ // See if this is an office doc
1176
+ if (this.isWopi(fileName)) {
1177
+ // Open the document
1178
+ window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + fileUrl + "&action=" + (edit ? "edit" : "view"), "_blank");
1179
+ }
1180
+ else {
1181
+ // Open the document
1182
+ window.open(fileUrl, "_blank");
1183
+ }
1184
+ };
1169
1185
  // Refreshes the documents
1170
1186
  Documents.prototype.refresh = function () {
1171
1187
  var _this = this;
@@ -192,11 +192,12 @@ var List = /** @class */ (function () {
192
192
  configurable: true
193
193
  });
194
194
  // Clears the modal or canvas
195
- List.prototype.clear = function (el) {
196
- // Ensure we rendering to a modal/canvas
197
- if (el == null) {
195
+ List.prototype.clear = function (props) {
196
+ // Ensure we are not rendering to a specified element
197
+ if (props.elForm == null) {
198
198
  // Clear the modal/form
199
- _1.ItemForm.UseModal ? _1.Modal.clear() : _1.CanvasForm.clear();
199
+ var useModal = typeof (props.useModal) === "boolean" ? props.useModal : _1.ItemForm.UseModal;
200
+ useModal ? _1.Modal.clear() : _1.CanvasForm.clear();
200
201
  }
201
202
  // Set the list name
202
203
  _1.ItemForm.ListName = this.ListName;
@@ -215,7 +216,7 @@ var List = /** @class */ (function () {
215
216
  // Displays the edit form
216
217
  List.prototype.editForm = function (props) {
217
218
  // Clear the modal/canvas
218
- this.clear(props.elForm);
219
+ this.clear(props);
219
220
  // Display the form
220
221
  _1.ItemForm.edit(props).then(null, this._onLoadFormError);
221
222
  };
@@ -473,7 +474,7 @@ var List = /** @class */ (function () {
473
474
  // Displays the new form
474
475
  List.prototype.newForm = function (props) {
475
476
  // Clear the modal/canvas
476
- this.clear(props.elForm);
477
+ this.clear(props);
477
478
  // Display the form
478
479
  _1.ItemForm.create(props).then(null, this._onLoadFormError);
479
480
  };
@@ -541,7 +542,7 @@ var List = /** @class */ (function () {
541
542
  // Displays the view form
542
543
  List.prototype.viewForm = function (props) {
543
544
  // Clear the modal/canvas
544
- this.clear(props.elForm);
545
+ this.clear(props);
545
546
  // Display the form
546
547
  _1.ItemForm.view(props).then(null, this._onLoadFormError);
547
548
  };