dattatable 1.5.1 → 1.5.5

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.
@@ -21,6 +21,7 @@ export interface IDocumentsProps {
21
21
  enableSearch?: boolean;
22
22
  listName: string;
23
23
  query?: Types.IODataQuery;
24
+ onActionsRendered?: (el: HTMLElement, col: Components.ITableColumn, file: Types.SP.Attachment | Types.SP.File) => void;
24
25
  onFilterRendered?: (el: HTMLElement) => void;
25
26
  onItemFormEditing?: {
26
27
  onCreateEditForm?: (props: Components.IListFormEditProps) => Components.IListFormEditProps;
@@ -44,8 +45,8 @@ export interface IDocumentsProps {
44
45
  onNavigationRendering?: (props: Components.INavbarProps) => void;
45
46
  onNavigationRendered?: (nav: Components.INavbar) => void;
46
47
  onRefresh?: () => void;
47
- onRendered?: () => void;
48
- onSearchRendered?: (el: HTMLElement) => void;
48
+ onRendered?: (el?: HTMLElement) => void;
49
+ onSearchRendered?: (el?: HTMLElement) => void;
49
50
  onShowFilter?: Function;
50
51
  table?: {
51
52
  columns?: Components.ITableColumn[];
@@ -206,7 +206,7 @@ var Documents = /** @class */ (function () {
206
206
  // Get the file contents
207
207
  (0, gd_sprest_bs_1.Web)().getFileByServerRelativeUrl(file.ServerRelativeUrl).content().execute(function (data) {
208
208
  // Copy the file
209
- (0, gd_sprest_bs_1.List)(_this._props.listName).RootFolder().Files().add(file.Name, true, data).execute(resolve, resolve);
209
+ (0, gd_sprest_bs_1.Web)().getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file.Name, true, data).execute(resolve, resolve);
210
210
  });
211
211
  });
212
212
  }).then(function () {
@@ -221,7 +221,7 @@ var Documents = /** @class */ (function () {
221
221
  var file_1 = item.data;
222
222
  file_1.content().execute(function (data) {
223
223
  // Copy the file
224
- (0, gd_sprest_bs_1.List)(_this._props.listName).RootFolder().Files().add(file_1.Name, true, data).execute(function () {
224
+ (0, gd_sprest_bs_1.Web)().getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(file_1.Name, true, data).execute(function () {
225
225
  // Close the dialog
226
226
  loadingDialog_1.LoadingDialog.hide();
227
227
  // Refresh the page
@@ -327,7 +327,15 @@ var Documents = /** @class */ (function () {
327
327
  });
328
328
  }
329
329
  // Return the dropdown items
330
- return items;
330
+ return items.sort(function (a, b) {
331
+ if (a.text < b.text) {
332
+ return -1;
333
+ }
334
+ if (a.text > b.text) {
335
+ return 1;
336
+ }
337
+ return 0;
338
+ });
331
339
  };
332
340
  // Generates the table properties
333
341
  Documents.prototype.generateTableProps = function () {
@@ -393,8 +401,8 @@ var Documents = /** @class */ (function () {
393
401
  // Render the file
394
402
  _this.renderFileIcon(el, _this.getFileName(file));
395
403
  // Set the filter/sort value
396
- el.setAttribute("data-filter", _this.getFileName(file));
397
- el.setAttribute("data-sort", _this.getFileName(file));
404
+ el.setAttribute("data-filter", (0, methods_1.getFileExt)(_this.getFileName(file)));
405
+ el.setAttribute("data-sort", (0, methods_1.getFileExt)(_this.getFileName(file)));
398
406
  // Call the custom event
399
407
  customEvent ? customEvent(el, col, file) : null;
400
408
  };
@@ -443,6 +451,7 @@ var Documents = /** @class */ (function () {
443
451
  _this.renderActionButtons(el, file);
444
452
  // Call the custom event
445
453
  customEvent ? customEvent(el, col, file) : null;
454
+ _this._props.onActionsRendered ? _this._props.onActionsRendered(el, col, file) : null;
446
455
  };
447
456
  }
448
457
  else {
@@ -559,7 +568,7 @@ var Documents = /** @class */ (function () {
559
568
  // Render the table
560
569
  _this.renderTable();
561
570
  // Call the render event
562
- _this._props.onRendered ? _this._props.onRendered() : null;
571
+ _this._props.onRendered ? _this._props.onRendered(_this._el) : null;
563
572
  // Resolve the promise
564
573
  resolve();
565
574
  }, reject);
@@ -598,7 +607,7 @@ var Documents = /** @class */ (function () {
598
607
  content: "Delete",
599
608
  btnProps: {
600
609
  // Render the icon button
601
- className: "p-1",
610
+ className: "p-1 btn-actions-delete",
602
611
  iconType: x_1.x,
603
612
  iconSize: 24,
604
613
  isDisabled: !this.CanDelete,
@@ -634,7 +643,7 @@ var Documents = /** @class */ (function () {
634
643
  content: "Download",
635
644
  btnProps: {
636
645
  // Render the icon button
637
- className: "p-1",
646
+ className: "p-1 btn-actions-download",
638
647
  iconType: fileEarmarkArrowDown_1.fileEarmarkArrowDown,
639
648
  iconSize: 24,
640
649
  isDisabled: !this.CanView,
@@ -651,7 +660,7 @@ var Documents = /** @class */ (function () {
651
660
  content: "Edit",
652
661
  btnProps: {
653
662
  // Render the icon button
654
- className: "p-1",
663
+ className: "p-1 btn-actions-edit",
655
664
  iconType: inputCursorText_1.inputCursorText,
656
665
  iconSize: 24,
657
666
  isDisabled: (!isWopi || !this.CanEdit),
@@ -669,7 +678,7 @@ var Documents = /** @class */ (function () {
669
678
  content: "Properties",
670
679
  btnProps: {
671
680
  // Render the icon button
672
- className: "p-1",
681
+ className: "p-1 btn-actions-properties",
673
682
  iconType: layoutTextSidebar_1.layoutTextSidebar,
674
683
  iconSize: 24,
675
684
  isDisabled: !this.CanEdit && !this.CanView,
@@ -762,7 +771,7 @@ var Documents = /** @class */ (function () {
762
771
  content: "View",
763
772
  btnProps: {
764
773
  // Render the icon button
765
- className: "img-flip-x p-1",
774
+ className: "img-flip-x p-1 btn-actions-view",
766
775
  iconType: front_1.front,
767
776
  iconSize: 24,
768
777
  isDisabled: !this.CanView,
@@ -803,6 +812,7 @@ var Documents = /** @class */ (function () {
803
812
  span.title = "Binary File";
804
813
  break;
805
814
  // Code
815
+ case "app":
806
816
  case "asp":
807
817
  case "aspx":
808
818
  case "css":
@@ -814,6 +824,8 @@ var Documents = /** @class */ (function () {
814
824
  case "mht":
815
825
  case "mhtml":
816
826
  case "scss":
827
+ case "sppkg":
828
+ case "wsp":
817
829
  case "xml":
818
830
  case "yaml":
819
831
  span.appendChild((0, fileEarmarkCode_1.fileEarmarkCode)(size));
@@ -1090,7 +1102,7 @@ var Documents = /** @class */ (function () {
1090
1102
  }
1091
1103
  else {
1092
1104
  // Upload the file to the objective folder
1093
- list.RootFolder().Files().add(fileInfo.name, true, fileInfo.data).execute(resolve, reject);
1105
+ (0, gd_sprest_bs_1.Web)().getFolderByServerRelativeUrl(_this._rootFolder.ServerRelativeUrl).Files().add(fileInfo.name, true, fileInfo.data).execute(resolve, reject);
1094
1106
  }
1095
1107
  });
1096
1108
  };