@onehat/ui 0.3.7 → 0.3.8
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.
package/package.json
CHANGED
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
CURRENT_MODE,
|
|
11
11
|
UI_MODE_WEB,
|
|
12
12
|
UI_MODE_REACT_NATIVE,
|
|
13
|
-
} from '
|
|
14
|
-
import UiGlobals from '
|
|
13
|
+
} from '../../Constants/UiModes.js';
|
|
14
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
15
15
|
import {
|
|
16
16
|
FILE_MODE_IMAGE,
|
|
17
17
|
FILE_MODE_FILE,
|
|
18
|
-
} from '
|
|
18
|
+
} from '../../Constants/File.js';
|
|
19
19
|
import { Avatar, Dropzone, FileMosaic, FileCard, FileInputButton, } from "@files-ui/react";
|
|
20
20
|
import withData from '../../Components/Hoc/withData.js';
|
|
21
21
|
import _ from 'lodash';
|
|
@@ -43,8 +43,32 @@ function AttachmentsElement(props) {
|
|
|
43
43
|
} = props,
|
|
44
44
|
styles = UiGlobals.styles,
|
|
45
45
|
WhichFile = isImageOnly ? Avatar : FileMosaic,
|
|
46
|
+
files = _.map(Repository.entities, () => {
|
|
47
|
+
// const ExtFile = {
|
|
48
|
+
// id string | number The identifier of the file
|
|
49
|
+
// file File The file object obtained from client drop or selection
|
|
50
|
+
// name string The name of the file
|
|
51
|
+
// type string The file mime type.
|
|
52
|
+
// size number The size of the file in bytes.
|
|
53
|
+
// valid boolean If present, it will show a valid or rejected message ("valid", "denied"). By default valid is undefined.
|
|
54
|
+
// errors string[] The list of errors according to the validation criteria or the result of the given custom validation function.
|
|
55
|
+
// uploadStatus UPLOADSTATUS The current upload status. (e.g. "uploading").
|
|
56
|
+
// uploadMessage string A message that shows the result of the upload process.
|
|
57
|
+
// imageUrl string A string representation or web url of the image that will be set to the "src" prop of an <img/> tag. If given, the component will use this image source instead of reading the image file.
|
|
58
|
+
// downloadUrl string The url to be used to perform a GET request in order to download the file. If defined, the download icon will be shown.
|
|
59
|
+
// progress number The current percentage of upload progress. This value will have a higher priority over the upload progress value calculated inside the component.
|
|
60
|
+
// extraUploadData Record<string, any> The additional data that will be sent to the server when files are uploaded individually
|
|
61
|
+
// extraData Object Any kind of extra data that could be needed.
|
|
62
|
+
// serverResponse ServerResponse The upload response from server.
|
|
63
|
+
// xhr XMLHttpRequest A reference to the XHR object that allows the upload, progress and abort events.
|
|
64
|
+
// };
|
|
65
|
+
|
|
66
|
+
debugger;
|
|
67
|
+
|
|
68
|
+
}),
|
|
46
69
|
onDelete = (a,b,c,d,e) => {
|
|
47
70
|
|
|
71
|
+
debugger;
|
|
48
72
|
};
|
|
49
73
|
|
|
50
74
|
if (canCrud) {
|
|
@@ -70,24 +94,6 @@ function AttachmentsElement(props) {
|
|
|
70
94
|
{..._dropZone}
|
|
71
95
|
>
|
|
72
96
|
{files.map((file) => {
|
|
73
|
-
// const ExtFile = {
|
|
74
|
-
// id string | number The identifier of the file
|
|
75
|
-
// file File The file object obtained from client drop or selection
|
|
76
|
-
// name string The name of the file
|
|
77
|
-
// type string The file mime type.
|
|
78
|
-
// size number The size of the file in bytes.
|
|
79
|
-
// valid boolean If present, it will show a valid or rejected message ("valid", "denied"). By default valid is undefined.
|
|
80
|
-
// errors string[] The list of errors according to the validation criteria or the result of the given custom validation function.
|
|
81
|
-
// uploadStatus UPLOADSTATUS The current upload status. (e.g. "uploading").
|
|
82
|
-
// uploadMessage string A message that shows the result of the upload process.
|
|
83
|
-
// imageUrl string A string representation or web url of the image that will be set to the "src" prop of an <img/> tag. If given, the component will use this image source instead of reading the image file.
|
|
84
|
-
// downloadUrl string The url to be used to perform a GET request in order to download the file. If defined, the download icon will be shown.
|
|
85
|
-
// progress number The current percentage of upload progress. This value will have a higher priority over the upload progress value calculated inside the component.
|
|
86
|
-
// extraUploadData Record<string, any> The additional data that will be sent to the server when files are uploaded individually
|
|
87
|
-
// extraData Object Any kind of extra data that could be needed.
|
|
88
|
-
// serverResponse ServerResponse The upload response from server.
|
|
89
|
-
// xhr XMLHttpRequest A reference to the XHR object that allows the upload, progress and abort events.
|
|
90
|
-
// };
|
|
91
97
|
return <WhichFile
|
|
92
98
|
key={file.id}
|
|
93
99
|
{...file}
|
|
@@ -119,4 +125,13 @@ function AttachmentsElement(props) {
|
|
|
119
125
|
</Row>;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
function withAdditionalProps(WrappedComponent) {
|
|
129
|
+
return (props) => {
|
|
130
|
+
return <WrappedComponent
|
|
131
|
+
model="Attachments"
|
|
132
|
+
{...props}
|
|
133
|
+
/>;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export default withAdditionalProps(withData(AttachmentsElement));
|