@servicemind.tis/tis-image-and-file-upload-and-view 1.2.15 → 1.2.16
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.
|
@@ -660,167 +660,7 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
660
660
|
openImageSelector(selectorId = this.config?.selectorId) {
|
|
661
661
|
document.getElementById(selectorId)?.click();
|
|
662
662
|
}
|
|
663
|
-
openCameraCapture() {
|
|
664
|
-
// Show the selection menu dialog first
|
|
665
|
-
this.showSelectionDialog();
|
|
666
|
-
}
|
|
667
|
-
showSelectionDialog() {
|
|
668
|
-
// Create modal overlay
|
|
669
|
-
const modal = document.createElement('div');
|
|
670
|
-
modal.style.cssText = `
|
|
671
|
-
position: fixed;
|
|
672
|
-
top: 0;
|
|
673
|
-
left: 0;
|
|
674
|
-
width: 100%;
|
|
675
|
-
height: 100%;
|
|
676
|
-
background: rgba(0, 0, 0, 0.6);
|
|
677
|
-
backdrop-filter: blur(8px);
|
|
678
|
-
-webkit-backdrop-filter: blur(8px);
|
|
679
|
-
display: flex;
|
|
680
|
-
align-items: center;
|
|
681
|
-
justify-content: center;
|
|
682
|
-
z-index: 9999;
|
|
683
|
-
padding: 20px;
|
|
684
|
-
box-sizing: border-box;
|
|
685
|
-
animation: fadeIn 0.3s ease;
|
|
686
|
-
`;
|
|
687
|
-
// Add animation styles
|
|
688
|
-
const style = document.createElement('style');
|
|
689
|
-
style.textContent = `
|
|
690
|
-
@keyframes fadeIn {
|
|
691
|
-
from { opacity: 0; }
|
|
692
|
-
to { opacity: 1; }
|
|
693
|
-
}
|
|
694
|
-
@keyframes slideUp {
|
|
695
|
-
from { opacity: 0; transform: translateY(20px); }
|
|
696
|
-
to { opacity: 1; transform: translateY(0); }
|
|
697
|
-
}
|
|
698
|
-
.menu-option:hover {
|
|
699
|
-
background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
|
|
700
|
-
transform: translateY(-2px);
|
|
701
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
702
|
-
border-color: #d0d0d0;
|
|
703
|
-
}
|
|
704
|
-
.menu-option:active {
|
|
705
|
-
transform: translateY(0px);
|
|
706
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
707
|
-
}
|
|
708
|
-
`;
|
|
709
|
-
document.head.appendChild(style);
|
|
710
|
-
// Create menu container
|
|
711
|
-
const menuContainer = document.createElement('div');
|
|
712
|
-
menuContainer.style.cssText = `
|
|
713
|
-
background: white;
|
|
714
|
-
border-radius: 20px;
|
|
715
|
-
padding: 20px;
|
|
716
|
-
min-width: 280px;
|
|
717
|
-
max-width: 400px;
|
|
718
|
-
width: 100%;
|
|
719
|
-
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
|
|
720
|
-
animation: slideUp 0.4s ease;
|
|
721
|
-
`;
|
|
722
|
-
// Create title
|
|
723
|
-
const title = document.createElement('h3');
|
|
724
|
-
title.textContent = 'Select Option';
|
|
725
|
-
title.style.cssText = `
|
|
726
|
-
margin: 0 0 20px 0;
|
|
727
|
-
font-size: 18px;
|
|
728
|
-
font-weight: 600;
|
|
729
|
-
text-align: center;
|
|
730
|
-
color: #333;
|
|
731
|
-
`;
|
|
732
|
-
// Create options container
|
|
733
|
-
const optionsContainer = document.createElement('div');
|
|
734
|
-
optionsContainer.style.cssText = `
|
|
735
|
-
display: flex;
|
|
736
|
-
flex-direction: column;
|
|
737
|
-
gap: 12px;
|
|
738
|
-
`;
|
|
739
|
-
// Photo Library Option
|
|
740
|
-
// const photoLibraryOption = this.createMenuOption(
|
|
741
|
-
// `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#007AFF">
|
|
742
|
-
// <path d="M0 0h24v24H0V0z" fill="none"/>
|
|
743
|
-
// <path d="M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"/>
|
|
744
|
-
// </svg>`,
|
|
745
|
-
// 'Photo Library',
|
|
746
|
-
// () => {
|
|
747
|
-
// this.closeSelectionDialog(modal);
|
|
748
|
-
// this.openImageSelector();
|
|
749
|
-
// }
|
|
750
|
-
// );
|
|
751
|
-
// Take Photo Option
|
|
752
|
-
const captureOption = this.createMenuOption(`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#34C759">
|
|
753
|
-
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
754
|
-
<path d="M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h4.05l1.83-2h4.24l1.83 2H20v12zM12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 8c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"/>
|
|
755
|
-
</svg>`, 'Take Photo', () => {
|
|
756
|
-
this.closeSelectionDialog(modal);
|
|
757
|
-
this.openAdvancedCamera();
|
|
758
|
-
});
|
|
759
|
-
// Choose Files Option
|
|
760
|
-
const filesOption = this.createMenuOption(`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FF9500">
|
|
761
|
-
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
762
|
-
<path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
|
763
|
-
</svg>`, 'Choose Files', () => {
|
|
764
|
-
this.closeSelectionDialog(modal);
|
|
765
|
-
this.openImageSelector();
|
|
766
|
-
});
|
|
767
|
-
// Add elements to container
|
|
768
|
-
menuContainer.appendChild(title);
|
|
769
|
-
// optionsContainer.appendChild(photoLibraryOption);
|
|
770
|
-
optionsContainer.appendChild(captureOption);
|
|
771
|
-
optionsContainer.appendChild(filesOption);
|
|
772
|
-
menuContainer.appendChild(optionsContainer);
|
|
773
|
-
modal.appendChild(menuContainer);
|
|
774
|
-
document.body.appendChild(modal);
|
|
775
|
-
// Handle click outside to close
|
|
776
|
-
modal.addEventListener('click', (e) => {
|
|
777
|
-
if (e.target === modal) {
|
|
778
|
-
this.closeSelectionDialog(modal);
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
// Handle ESC key
|
|
782
|
-
const handleKeyPress = (e) => {
|
|
783
|
-
if (e.key === 'Escape') {
|
|
784
|
-
this.closeSelectionDialog(modal);
|
|
785
|
-
document.removeEventListener('keydown', handleKeyPress);
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
document.addEventListener('keydown', handleKeyPress);
|
|
789
|
-
}
|
|
790
|
-
createMenuOption(iconSvg, text, onClick) {
|
|
791
|
-
const option = document.createElement('div');
|
|
792
|
-
option.className = 'menu-option';
|
|
793
|
-
option.style.cssText = `
|
|
794
|
-
display: flex;
|
|
795
|
-
align-items: center;
|
|
796
|
-
gap: 16px;
|
|
797
|
-
padding: 18px;
|
|
798
|
-
border-radius: 16px;
|
|
799
|
-
cursor: pointer;
|
|
800
|
-
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
801
|
-
border: 1px solid #e8e8e8;
|
|
802
|
-
background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
|
|
803
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
|
|
804
|
-
`;
|
|
805
|
-
option.innerHTML = `
|
|
806
|
-
<div style="flex-shrink: 0;">${iconSvg}</div>
|
|
807
|
-
<div style="flex: 1; font-size: 16px; font-weight: 500; color: #333;">${text}</div>
|
|
808
|
-
<div style="flex-shrink: 0;">
|
|
809
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="#999">
|
|
810
|
-
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
811
|
-
<path d="M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"/>
|
|
812
|
-
</svg>
|
|
813
|
-
</div>
|
|
814
|
-
`;
|
|
815
|
-
option.addEventListener('click', onClick);
|
|
816
|
-
return option;
|
|
817
|
-
}
|
|
818
|
-
closeSelectionDialog(modal) {
|
|
819
|
-
if (modal.parentNode) {
|
|
820
|
-
modal.parentNode.removeChild(modal);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
async openAdvancedCamera() {
|
|
663
|
+
async openCameraCapture() {
|
|
824
664
|
// Check configuration preference and browser support
|
|
825
665
|
if (this.config.useAdvancedCamera && typeof navigator !== 'undefined' && navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia === 'function') {
|
|
826
666
|
try {
|
|
@@ -880,7 +720,7 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
880
720
|
left: 0;
|
|
881
721
|
width: 100%;
|
|
882
722
|
height: 100%;
|
|
883
|
-
background: linear-gradient(135deg, rgba(0, 0, 0, 0.
|
|
723
|
+
background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(20, 20, 30, 0.95) 100%);
|
|
884
724
|
backdrop-filter: blur(8px);
|
|
885
725
|
-webkit-backdrop-filter: blur(8px);
|
|
886
726
|
display: flex;
|
|
@@ -888,7 +728,7 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
888
728
|
align-items: center;
|
|
889
729
|
justify-content: center;
|
|
890
730
|
z-index: 9999;
|
|
891
|
-
padding:
|
|
731
|
+
padding: 20px;
|
|
892
732
|
box-sizing: border-box;
|
|
893
733
|
animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
894
734
|
`;
|
|
@@ -1038,33 +878,35 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
1038
878
|
const buttonsDiv = document.createElement('div');
|
|
1039
879
|
buttonsDiv.style.cssText = `
|
|
1040
880
|
display: flex;
|
|
1041
|
-
gap:
|
|
881
|
+
gap: 12px;
|
|
1042
882
|
justify-content: center;
|
|
1043
883
|
align-items: center;
|
|
1044
884
|
padding: ${this.isMobile ? '10px' : '20px'};
|
|
1045
885
|
padding-bottom: 0px;
|
|
1046
886
|
background: transparent;
|
|
887
|
+
flex-wrap: wrap;
|
|
1047
888
|
`;
|
|
1048
889
|
// Create capture button with clean design
|
|
1049
890
|
const captureBtn = document.createElement('button');
|
|
1050
891
|
captureBtn.innerHTML = `
|
|
1051
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="
|
|
892
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="#e3e3e3">
|
|
1052
893
|
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
1053
894
|
<path d="M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h4.05l1.83-2h4.24l1.83 2H20v12zM12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 8c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"/>
|
|
1054
895
|
</svg>
|
|
896
|
+
${this.isMobile ? '' : ' Capture'}
|
|
1055
897
|
`;
|
|
1056
898
|
captureBtn.style.cssText = `
|
|
1057
899
|
background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
|
|
1058
900
|
color: white;
|
|
1059
901
|
border: none;
|
|
1060
|
-
padding: ${this.isMobile ? '
|
|
1061
|
-
border-radius:
|
|
1062
|
-
font-size:
|
|
902
|
+
padding: ${this.isMobile ? '12px' : '14px 20px'};
|
|
903
|
+
border-radius: 25px;
|
|
904
|
+
font-size: 13px;
|
|
1063
905
|
font-weight: 600;
|
|
1064
906
|
cursor: pointer;
|
|
1065
907
|
width: auto;
|
|
1066
908
|
height: auto;
|
|
1067
|
-
min-width: ${this.isMobile ? '
|
|
909
|
+
min-width: ${this.isMobile ? '50px' : '100px'};
|
|
1068
910
|
transition: all 0.3s ease;
|
|
1069
911
|
display: flex;
|
|
1070
912
|
align-items: center;
|
|
@@ -1081,26 +923,64 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
1081
923
|
captureBtn.style.transform = 'scale(1)';
|
|
1082
924
|
captureBtn.style.boxShadow = '0 4px 20px rgba(0, 122, 255, 0.4)';
|
|
1083
925
|
});
|
|
926
|
+
// Create library button with clean design
|
|
927
|
+
const libraryBtn = document.createElement('button');
|
|
928
|
+
libraryBtn.innerHTML = `
|
|
929
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="#e3e3e3">
|
|
930
|
+
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
931
|
+
<path d="M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"/>
|
|
932
|
+
</svg>
|
|
933
|
+
${this.isMobile ? '' : ' Upload'}
|
|
934
|
+
`;
|
|
935
|
+
libraryBtn.style.cssText = `
|
|
936
|
+
background: linear-gradient(135deg, #34C759 0%, #248A3D 100%);
|
|
937
|
+
color: white;
|
|
938
|
+
border: none;
|
|
939
|
+
padding: ${this.isMobile ? '12px' : '14px 20px'};
|
|
940
|
+
border-radius: 25px;
|
|
941
|
+
font-size: 13px;
|
|
942
|
+
font-weight: 600;
|
|
943
|
+
cursor: pointer;
|
|
944
|
+
width: auto;
|
|
945
|
+
height: auto;
|
|
946
|
+
min-width: ${this.isMobile ? '50px' : '100px'};
|
|
947
|
+
transition: all 0.3s ease;
|
|
948
|
+
display: flex;
|
|
949
|
+
align-items: center;
|
|
950
|
+
justify-content: center;
|
|
951
|
+
text-transform: uppercase;
|
|
952
|
+
letter-spacing: 0.5px;
|
|
953
|
+
box-shadow: 0 4px 20px rgba(52, 199, 89, 0.4);
|
|
954
|
+
`;
|
|
955
|
+
libraryBtn.addEventListener('mouseenter', () => {
|
|
956
|
+
libraryBtn.style.transform = 'scale(1.05)';
|
|
957
|
+
libraryBtn.style.boxShadow = '0 8px 25px rgba(52, 199, 89, 0.6)';
|
|
958
|
+
});
|
|
959
|
+
libraryBtn.addEventListener('mouseleave', () => {
|
|
960
|
+
libraryBtn.style.transform = 'scale(1)';
|
|
961
|
+
libraryBtn.style.boxShadow = '0 4px 20px rgba(52, 199, 89, 0.4)';
|
|
962
|
+
});
|
|
1084
963
|
// Create cancel button with clean design
|
|
1085
964
|
const cancelBtn = document.createElement('button');
|
|
1086
965
|
cancelBtn.innerHTML = `
|
|
1087
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="
|
|
966
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="#e3e3e3">
|
|
1088
967
|
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
1089
968
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
|
|
1090
969
|
</svg>
|
|
970
|
+
${this.isMobile ? '' : ' Cancel'}
|
|
1091
971
|
`;
|
|
1092
972
|
cancelBtn.style.cssText = `
|
|
1093
973
|
background: rgba(255, 255, 255, 0.1);
|
|
1094
974
|
color: white;
|
|
1095
975
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
1096
|
-
padding: ${this.isMobile ? '
|
|
1097
|
-
border-radius:
|
|
1098
|
-
font-size:
|
|
976
|
+
padding: ${this.isMobile ? '12px' : '14px 20px'};
|
|
977
|
+
border-radius: 25px;
|
|
978
|
+
font-size: 13px;
|
|
1099
979
|
font-weight: 600;
|
|
1100
980
|
cursor: pointer;
|
|
1101
981
|
width: auto;
|
|
1102
982
|
height: auto;
|
|
1103
|
-
min-width: ${this.isMobile ? '
|
|
983
|
+
min-width: ${this.isMobile ? '50px' : '100px'};
|
|
1104
984
|
transition: all 0.3s ease;
|
|
1105
985
|
display: flex;
|
|
1106
986
|
align-items: center;
|
|
@@ -1121,6 +1001,7 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
1121
1001
|
// Add elements to modal with proper structure
|
|
1122
1002
|
videoContainer.appendChild(video);
|
|
1123
1003
|
buttonsDiv.appendChild(captureBtn);
|
|
1004
|
+
buttonsDiv.appendChild(libraryBtn);
|
|
1124
1005
|
buttonsDiv.appendChild(cancelBtn);
|
|
1125
1006
|
mainContainer.appendChild(videoContainer);
|
|
1126
1007
|
mainContainer.appendChild(buttonsDiv);
|
|
@@ -1186,6 +1067,11 @@ class TisImageAndFileUploadAndViewComponent {
|
|
|
1186
1067
|
}
|
|
1187
1068
|
});
|
|
1188
1069
|
}
|
|
1070
|
+
// Handle library button click
|
|
1071
|
+
libraryBtn.addEventListener('click', () => {
|
|
1072
|
+
this.cleanupCameraModal(currentStream, modal);
|
|
1073
|
+
this.openImageSelector();
|
|
1074
|
+
});
|
|
1189
1075
|
// Handle capture with modern effects
|
|
1190
1076
|
captureBtn.addEventListener('click', () => {
|
|
1191
1077
|
// Create capture flash effect
|