diginet-core-ui 1.3.79-beta.1 → 1.3.79-beta.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.
|
@@ -646,16 +646,21 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
646
646
|
}
|
|
647
647
|
return false;
|
|
648
648
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
649
|
+
|
|
650
|
+
// const checkExistingFileInData = newFile => {
|
|
651
|
+
// const files = data;
|
|
652
|
+
|
|
653
|
+
// if (files && files.length) {
|
|
654
|
+
// const length = files.length;
|
|
655
|
+
|
|
656
|
+
// for (let i = 0; i < length; i++) {
|
|
657
|
+
// if (parseStringify2(newFile) === parseStringify2(files[i], true)) return true;
|
|
658
|
+
// }
|
|
659
|
+
// }
|
|
660
|
+
|
|
661
|
+
// return false;
|
|
662
|
+
// };
|
|
663
|
+
|
|
659
664
|
const checkAcceptFileType = newFile => {
|
|
660
665
|
if (!accept || !accept.length) return true;
|
|
661
666
|
const type = typeof accept === 'string' ? accept : accept.join('-');
|
|
@@ -859,10 +864,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
859
864
|
type: fileInfo.type,
|
|
860
865
|
webkitRelativePath: fileInfo.webkitRelativePath
|
|
861
866
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
867
|
+
|
|
868
|
+
// const parseStringify2 = (fileInfo, inData) =>
|
|
869
|
+
// JSON.stringify({
|
|
870
|
+
// name: fileInfo?.[inData ? 'FileName' : 'name'],
|
|
871
|
+
// size: fileInfo?.[inData ? 'FileSize' : 'size'],
|
|
872
|
+
// });
|
|
873
|
+
|
|
866
874
|
const mountDomain = item => {
|
|
867
875
|
if (!item) return item;
|
|
868
876
|
const cloneItem = JSON.parse(JSON.stringify(item));
|
|
@@ -983,36 +991,38 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
983
991
|
// Load files data was uploaded
|
|
984
992
|
const length = data.length;
|
|
985
993
|
for (let i = 0; i < length; i++) {
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
994
|
+
const newAttach = getItemHTMLFromData(data[i], i);
|
|
995
|
+
if (Object.prototype.toString.call(data[i]) === '[object File]') {
|
|
996
|
+
allNewAttached.append('files', data[i]);
|
|
997
|
+
newAttachedRef.current.push(data[i]);
|
|
998
|
+
attached.push(data[i]);
|
|
991
999
|
} else {
|
|
1000
|
+
const item = mountDomain(data[i]);
|
|
992
1001
|
oldAttached.push(item);
|
|
1002
|
+
attached.push(item);
|
|
993
1003
|
}
|
|
994
|
-
attached.push(item);
|
|
995
1004
|
const newElement = document.createElement('div');
|
|
996
1005
|
newElement.className = 'attachment-row';
|
|
997
1006
|
ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
998
1007
|
}
|
|
999
1008
|
}
|
|
1000
|
-
if (newAttachedRef.current) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1009
|
+
// if (newAttachedRef.current) {
|
|
1010
|
+
// const length = newAttachedRef.current.length;
|
|
1011
|
+
|
|
1012
|
+
// for (let i = length - 1; i >= 0; i--) {
|
|
1013
|
+
// const item = newAttachedRef.current[i];
|
|
1014
|
+
// if (checkExistingFileInData(item)) {
|
|
1015
|
+
// newAttachedRef.current.splice(i, 1);
|
|
1016
|
+
// } else {
|
|
1017
|
+
// const newAttach = getItemHTMLFromData(item, i);
|
|
1018
|
+
// allNewAttached.append('files', item);
|
|
1019
|
+
// attached.push(item);
|
|
1020
|
+
// const newElement = document.createElement('div');
|
|
1021
|
+
// newElement.className = 'attachment-row';
|
|
1022
|
+
// ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
1023
|
+
// }
|
|
1024
|
+
// }
|
|
1025
|
+
// }
|
|
1016
1026
|
return () => {
|
|
1017
1027
|
if (attachedRef.current) {
|
|
1018
1028
|
attachedRef.current.innerHTML = null;
|
|
@@ -1124,7 +1134,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1124
1134
|
viewType: 'ghost',
|
|
1125
1135
|
name: viewTypeState === 'detail' ? 'IconView' : 'ListView',
|
|
1126
1136
|
onClick: () => setViewTypeState(viewTypeState === 'icon' ? 'detail' : 'icon')
|
|
1127
|
-
}))), [allowSort, disabled, readOnly, label, required, hintText, viewTypeState]);
|
|
1137
|
+
}))), [allowSort, disabled, readOnly, label, required, hintText, domain, viewTypeState]);
|
|
1128
1138
|
const AttachmentInputView = useMemo(() => jsx("div", {
|
|
1129
1139
|
css: AttachmentInputCSS,
|
|
1130
1140
|
className: 'DGN-UI-Attachment-Input'
|