gd-sprest-bs 10.12.1 → 10.12.2

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.
@@ -668,50 +668,34 @@ exports.ListForm.renderEditForm = function (props) {
668
668
  text: fileInfo.name
669
669
  },
670
670
  options: {
671
- content: core_1.Components.ButtonGroup({
672
- buttons: [
673
- {
674
- data: fileInfo,
675
- isSmall: true,
676
- text: "Remove",
677
- type: core_1.Components.ButtonTypes.Danger,
678
- onClick: function (btn, ev) {
679
- var fileName = btn.data.name;
680
- // Parse the array
681
- for (var i = 0; i < attachments.new.length; i++) {
682
- // See if this is the target attachment
683
- if (attachments.new[i].name == fileName) {
684
- // Remove this attachment
685
- attachments.new.splice(i, 1);
686
- break;
687
- }
688
- }
689
- // Get the files
690
- var files = btnGroup.querySelectorAll(".btn.file-attachment");
691
- for (var i = 0; i < files.length; i++) {
692
- var file = files[i];
693
- // See if this is the target button
694
- if (file.innerText == fileName) {
695
- // Remove this popover
696
- file.parentElement.removeChild(file);
697
- break;
698
- }
699
- }
671
+ content: core_1.Components.Button({
672
+ data: fileInfo,
673
+ isSmall: true,
674
+ text: "Remove",
675
+ type: core_1.Components.ButtonTypes.Danger,
676
+ onClick: function (btn, ev) {
677
+ var fileName = btn.data.name;
678
+ // Parse the array
679
+ for (var i = 0; i < attachments.new.length; i++) {
680
+ // See if this is the target attachment
681
+ if (attachments.new[i].name == fileName) {
682
+ // Remove this attachment
683
+ attachments.new.splice(i, 1);
684
+ break;
700
685
  }
701
- },
702
- {
703
- data: fileInfo,
704
- isDisabled: fileInfo.src ? false : true,
705
- isSmall: true,
706
- text: "View",
707
- type: core_1.Components.ButtonTypes.Primary,
708
- onClick: function (btn, ev) {
709
- var fileUrl = btn.data.src;
710
- // Show the file in a new tab
711
- window.open(fileUrl, "_blank");
686
+ }
687
+ // Get the files
688
+ var files = btnGroup.querySelectorAll(".btn.file-attachment");
689
+ for (var i = 0; i < files.length; i++) {
690
+ var file = files[i];
691
+ // See if this is the target button
692
+ if (file.innerText == fileName) {
693
+ // Remove this popover
694
+ file.parentElement.removeChild(file);
695
+ break;
712
696
  }
713
697
  }
714
- ]
698
+ }
715
699
  }).el
716
700
  }
717
701
  }).el);
@@ -737,27 +721,43 @@ exports.ListForm.renderEditForm = function (props) {
737
721
  text: attachment.FileName,
738
722
  },
739
723
  options: {
740
- content: core_1.Components.Button({
741
- data: attachment,
742
- isSmall: true,
743
- text: "Remove",
744
- type: core_1.Components.ButtonTypes.Danger,
745
- onClick: function (btn, ev) {
746
- var attachment = btn.data;
747
- // Add this file for deletion
748
- attachments.delete.push(attachment);
749
- // Get the files
750
- var files = btnGroup.querySelectorAll(".btn.file-attachment");
751
- for (var i_1 = 0; i_1 < files.length; i_1++) {
752
- var file = files[i_1];
753
- // See if this is the target button
754
- if (file.innerText == attachment.FileName) {
755
- // Remove this popover
756
- file.parentElement.removeChild(file);
757
- break;
724
+ content: core_1.Components.ButtonGroup({
725
+ buttons: [
726
+ {
727
+ data: attachment,
728
+ isSmall: true,
729
+ text: "Remove",
730
+ type: core_1.Components.ButtonTypes.Danger,
731
+ onClick: function (btn, ev) {
732
+ var attachment = btn.data;
733
+ // Add this file for deletion
734
+ attachments.delete.push(attachment);
735
+ // Get the files
736
+ var files = btnGroup.querySelectorAll(".btn.file-attachment");
737
+ for (var i_1 = 0; i_1 < files.length; i_1++) {
738
+ var file = files[i_1];
739
+ // See if this is the target button
740
+ if (file.innerText == attachment.FileName) {
741
+ // Remove this popover
742
+ file.parentElement.removeChild(file);
743
+ break;
744
+ }
745
+ }
746
+ }
747
+ },
748
+ {
749
+ data: attachment,
750
+ isDisabled: attachment.ServerRelativeUrl ? false : true,
751
+ isSmall: true,
752
+ text: "View",
753
+ type: core_1.Components.ButtonTypes.Primary,
754
+ onClick: function (btn, ev) {
755
+ var fileUrl = btn.data.ServerRelativeUrl;
756
+ // Show the file in a new tab
757
+ window.open(fileUrl, "_blank");
758
758
  }
759
759
  }
760
- }
760
+ ]
761
761
  }).el
762
762
  }
763
763
  }).el);