@lowdefy/plugin-aws 4.7.3 → 5.0.0
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/dist/blocks/S3Download/S3Download.js +6 -14
- package/dist/blocks/S3Download/gallery.yaml +234 -0
- package/dist/blocks/S3Download/meta.js +103 -0
- package/dist/blocks/S3Download/schema.js +107 -0
- package/dist/blocks/S3UploadButton/S3UploadButton.js +5 -14
- package/dist/blocks/S3UploadButton/gallery.yaml +349 -0
- package/dist/blocks/S3UploadButton/meta.js +156 -0
- package/dist/blocks/S3UploadButton/schema.js +121 -0
- package/dist/blocks/S3UploadDragger/S3UploadDragger.js +8 -16
- package/dist/blocks/S3UploadDragger/gallery.yaml +275 -0
- package/dist/blocks/S3UploadDragger/meta.js +102 -0
- package/dist/blocks/S3UploadDragger/schema.js +119 -0
- package/dist/blocks/S3UploadPhoto/S3UploadPhoto.js +20 -19
- package/dist/blocks/S3UploadPhoto/gallery.yaml +259 -0
- package/dist/blocks/S3UploadPhoto/meta.js +93 -0
- package/dist/blocks/S3UploadPhoto/schema.js +113 -0
- package/dist/blocks/utils/getS3Upload.js +35 -24
- package/dist/blocks/utils/useFileList.js +27 -4
- package/dist/blocks/withTheme.js +40 -0
- package/dist/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js +15 -11
- package/dist/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js +12 -11
- package/dist/{blocks/S3UploadButton/style.less → metas.js} +4 -4
- package/dist/types.js +11 -17
- package/package.json +20 -16
- package/dist/blocks/S3Download/schema.json +0 -85
- package/dist/blocks/S3Download/style.less +0 -17
- package/dist/blocks/S3UploadButton/schema.json +0 -103
- package/dist/blocks/S3UploadDragger/schema.json +0 -97
- package/dist/blocks/S3UploadDragger/style.less +0 -17
- package/dist/blocks/S3UploadPhoto/schema.json +0 -95
- package/dist/blocks/S3UploadPhoto/style.less +0 -17
- /package/dist/blocks/S3UploadButton/{examples.yaml → tests.yaml} +0 -0
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import React, { useEffect } from 'react';
|
|
16
16
|
import { Upload } from 'antd';
|
|
17
|
-
import {
|
|
17
|
+
import { withBlockDefaults } from '@lowdefy/block-utils';
|
|
18
|
+
import withTheme from '../withTheme.js';
|
|
18
19
|
const downloadFile = async ({ file, methods })=>{
|
|
19
20
|
const s3DownloadPolicy = await methods.triggerEvent({
|
|
20
21
|
name: '__getS3DownloadPolicy',
|
|
@@ -24,7 +25,7 @@ const downloadFile = async ({ file, methods })=>{
|
|
|
24
25
|
});
|
|
25
26
|
window.open(s3DownloadPolicy?.responses?.__getS3DownloadPolicy?.response?.[0]);
|
|
26
27
|
};
|
|
27
|
-
const S3Download = ({ blockId, methods, properties })=>{
|
|
28
|
+
const S3Download = ({ blockId, classNames = {}, methods, properties, styles = {} })=>{
|
|
28
29
|
useEffect(()=>{
|
|
29
30
|
methods.registerEvent({
|
|
30
31
|
name: '__getS3DownloadPolicy',
|
|
@@ -41,9 +42,8 @@ const S3Download = ({ blockId, methods, properties })=>{
|
|
|
41
42
|
}, []);
|
|
42
43
|
return /*#__PURE__*/ React.createElement(Upload, {
|
|
43
44
|
id: blockId,
|
|
44
|
-
className:
|
|
45
|
-
|
|
46
|
-
]),
|
|
45
|
+
className: classNames.element,
|
|
46
|
+
style: styles.element,
|
|
47
47
|
fileList: properties.fileList ?? [],
|
|
48
48
|
onPreview: async (file)=>await downloadFile({
|
|
49
49
|
file,
|
|
@@ -59,12 +59,4 @@ const S3Download = ({ blockId, methods, properties })=>{
|
|
|
59
59
|
})
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
S3Download.meta = {
|
|
64
|
-
category: 'display',
|
|
65
|
-
icons: [],
|
|
66
|
-
styles: [
|
|
67
|
-
'blocks/S3Download/style.less'
|
|
68
|
-
]
|
|
69
|
-
};
|
|
70
|
-
export default S3Download;
|
|
62
|
+
export default withBlockDefaults(withTheme('Upload', S3Download));
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
- title: Basic File List
|
|
16
|
+
blocks:
|
|
17
|
+
- id: basic_download
|
|
18
|
+
type: S3Download
|
|
19
|
+
properties:
|
|
20
|
+
s3GetPolicyRequestId: download_file
|
|
21
|
+
fileList:
|
|
22
|
+
- key: report.pdf
|
|
23
|
+
type: application/pdf
|
|
24
|
+
name: report.pdf
|
|
25
|
+
- key: photo.jpg
|
|
26
|
+
type: image/jpeg
|
|
27
|
+
name: photo.jpg
|
|
28
|
+
|
|
29
|
+
- title: Single File
|
|
30
|
+
blocks:
|
|
31
|
+
- id: single_file
|
|
32
|
+
type: S3Download
|
|
33
|
+
properties:
|
|
34
|
+
s3GetPolicyRequestId: download_file
|
|
35
|
+
fileList:
|
|
36
|
+
- key: invoice_2026_001.pdf
|
|
37
|
+
type: application/pdf
|
|
38
|
+
name: invoice_2026_001.pdf
|
|
39
|
+
|
|
40
|
+
- title: Multiple File Types
|
|
41
|
+
blocks:
|
|
42
|
+
- id: multi_type
|
|
43
|
+
type: S3Download
|
|
44
|
+
properties:
|
|
45
|
+
s3GetPolicyRequestId: download_file
|
|
46
|
+
fileList:
|
|
47
|
+
- key: documents/contract.pdf
|
|
48
|
+
type: application/pdf
|
|
49
|
+
name: contract.pdf
|
|
50
|
+
- key: images/logo.png
|
|
51
|
+
type: image/png
|
|
52
|
+
name: logo.png
|
|
53
|
+
- key: data/export.csv
|
|
54
|
+
type: text/csv
|
|
55
|
+
name: export.csv
|
|
56
|
+
- key: archives/backup.zip
|
|
57
|
+
type: application/zip
|
|
58
|
+
name: backup.zip
|
|
59
|
+
|
|
60
|
+
- title: Style and Class Overrides
|
|
61
|
+
blocks:
|
|
62
|
+
- id: styled_download
|
|
63
|
+
type: S3Download
|
|
64
|
+
style:
|
|
65
|
+
.element:
|
|
66
|
+
background: '#f6ffed'
|
|
67
|
+
border: 1px solid #b7eb8f
|
|
68
|
+
borderRadius: 8
|
|
69
|
+
padding: 12
|
|
70
|
+
properties:
|
|
71
|
+
s3GetPolicyRequestId: download_file
|
|
72
|
+
fileList:
|
|
73
|
+
- key: report.pdf
|
|
74
|
+
type: application/pdf
|
|
75
|
+
name: Quarterly Report.pdf
|
|
76
|
+
- key: summary.pdf
|
|
77
|
+
type: application/pdf
|
|
78
|
+
name: Executive Summary.pdf
|
|
79
|
+
|
|
80
|
+
- title: Theme Token Overrides
|
|
81
|
+
blocks:
|
|
82
|
+
- id: themed_download
|
|
83
|
+
type: S3Download
|
|
84
|
+
properties:
|
|
85
|
+
s3GetPolicyRequestId: download_file
|
|
86
|
+
theme:
|
|
87
|
+
actionsColor: '#f5222d'
|
|
88
|
+
controlItemBgHover: '#f9f0ff'
|
|
89
|
+
colorIcon: '#f5222d'
|
|
90
|
+
fontSize: 18
|
|
91
|
+
fileList:
|
|
92
|
+
- key: contracts/nda.pdf
|
|
93
|
+
type: application/pdf
|
|
94
|
+
name: Non-Disclosure Agreement.pdf
|
|
95
|
+
- key: contracts/sla.pdf
|
|
96
|
+
type: application/pdf
|
|
97
|
+
name: Service Level Agreement.pdf
|
|
98
|
+
- key: contracts/msa.pdf
|
|
99
|
+
type: application/pdf
|
|
100
|
+
name: Master Services Agreement.pdf
|
|
101
|
+
|
|
102
|
+
- title: S3Download in Document Portal
|
|
103
|
+
fullWidth: true
|
|
104
|
+
hideConfig: true
|
|
105
|
+
blocks:
|
|
106
|
+
- id: portal_example
|
|
107
|
+
type: MarkdownWithCode
|
|
108
|
+
properties:
|
|
109
|
+
content: |
|
|
110
|
+
Full page config with connection, request, and S3Download block:
|
|
111
|
+
```yaml
|
|
112
|
+
# lowdefy.yaml
|
|
113
|
+
connections:
|
|
114
|
+
- id: project_files
|
|
115
|
+
type: AwsS3Bucket
|
|
116
|
+
properties:
|
|
117
|
+
accessKeyId:
|
|
118
|
+
_secret: FILES_S3_ACCESS_KEY_ID
|
|
119
|
+
secretAccessKey:
|
|
120
|
+
_secret: FILES_S3_SECRET_ACCESS_KEY
|
|
121
|
+
region: us-east-1
|
|
122
|
+
bucket:
|
|
123
|
+
_secret: FILES_S3_BUCKET
|
|
124
|
+
|
|
125
|
+
# page config
|
|
126
|
+
id: document_portal
|
|
127
|
+
type: PageSiderMenu
|
|
128
|
+
blocks:
|
|
129
|
+
- id: documents_card
|
|
130
|
+
type: Card
|
|
131
|
+
properties:
|
|
132
|
+
title: Project Documents
|
|
133
|
+
blocks:
|
|
134
|
+
- id: download_files
|
|
135
|
+
type: S3Download
|
|
136
|
+
properties:
|
|
137
|
+
s3GetPolicyRequestId: download_file
|
|
138
|
+
fileList:
|
|
139
|
+
- key: projects/alpha/proposal.pdf
|
|
140
|
+
type: application/pdf
|
|
141
|
+
name: Project Alpha - Proposal.pdf
|
|
142
|
+
- key: projects/alpha/budget.xlsx
|
|
143
|
+
type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
|
144
|
+
name: Project Alpha - Budget.xlsx
|
|
145
|
+
requests:
|
|
146
|
+
- id: download_file
|
|
147
|
+
type: AwsS3PresignedGetObject
|
|
148
|
+
connectionId: project_files
|
|
149
|
+
payload:
|
|
150
|
+
key:
|
|
151
|
+
_event: file.key
|
|
152
|
+
type:
|
|
153
|
+
_event: file.type
|
|
154
|
+
properties:
|
|
155
|
+
key:
|
|
156
|
+
_payload: key
|
|
157
|
+
responseContentType:
|
|
158
|
+
_payload: type
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- title: S3Download with S3Upload
|
|
162
|
+
fullWidth: true
|
|
163
|
+
hideConfig: true
|
|
164
|
+
blocks:
|
|
165
|
+
- id: upload_download_example
|
|
166
|
+
type: MarkdownWithCode
|
|
167
|
+
properties:
|
|
168
|
+
content: |
|
|
169
|
+
Upload and download files on the same page by mapping the S3Upload fileList to S3Download:
|
|
170
|
+
```yaml
|
|
171
|
+
# lowdefy.yaml
|
|
172
|
+
connections:
|
|
173
|
+
- id: attachments
|
|
174
|
+
type: AwsS3Bucket
|
|
175
|
+
properties:
|
|
176
|
+
accessKeyId:
|
|
177
|
+
_secret: FILES_S3_ACCESS_KEY_ID
|
|
178
|
+
secretAccessKey:
|
|
179
|
+
_secret: FILES_S3_SECRET_ACCESS_KEY
|
|
180
|
+
region: us-east-1
|
|
181
|
+
bucket:
|
|
182
|
+
_secret: FILES_S3_BUCKET
|
|
183
|
+
write: true
|
|
184
|
+
|
|
185
|
+
# page config
|
|
186
|
+
id: file_management
|
|
187
|
+
type: PageSiderMenu
|
|
188
|
+
blocks:
|
|
189
|
+
- id: upload_card
|
|
190
|
+
type: Card
|
|
191
|
+
properties:
|
|
192
|
+
title: Upload Files
|
|
193
|
+
blocks:
|
|
194
|
+
- id: upload_files
|
|
195
|
+
type: S3Upload
|
|
196
|
+
properties:
|
|
197
|
+
s3PutPolicyRequestId: upload_policy
|
|
198
|
+
requests:
|
|
199
|
+
- id: upload_policy
|
|
200
|
+
type: AwsS3PresignedPutObject
|
|
201
|
+
connectionId: attachments
|
|
202
|
+
payload:
|
|
203
|
+
filename:
|
|
204
|
+
_event: filename
|
|
205
|
+
properties:
|
|
206
|
+
key:
|
|
207
|
+
_payload: filename
|
|
208
|
+
- id: download_card
|
|
209
|
+
type: Card
|
|
210
|
+
properties:
|
|
211
|
+
title: Download Uploaded Files
|
|
212
|
+
blocks:
|
|
213
|
+
- id: download_files
|
|
214
|
+
type: S3Download
|
|
215
|
+
properties:
|
|
216
|
+
s3GetPolicyRequestId: download_policy
|
|
217
|
+
# Map fileList directly from S3Upload state
|
|
218
|
+
fileList:
|
|
219
|
+
_state: upload_files
|
|
220
|
+
requests:
|
|
221
|
+
- id: download_policy
|
|
222
|
+
type: AwsS3PresignedGetObject
|
|
223
|
+
connectionId: attachments
|
|
224
|
+
payload:
|
|
225
|
+
key:
|
|
226
|
+
_event: file.key
|
|
227
|
+
type:
|
|
228
|
+
_event: file.type
|
|
229
|
+
properties:
|
|
230
|
+
key:
|
|
231
|
+
_payload: key
|
|
232
|
+
responseContentType:
|
|
233
|
+
_payload: type
|
|
234
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
category: 'display',
|
|
17
|
+
icons: [],
|
|
18
|
+
valueType: null,
|
|
19
|
+
cssKeys: {
|
|
20
|
+
element: 'The S3Download element.'
|
|
21
|
+
},
|
|
22
|
+
events: {
|
|
23
|
+
onChange: 'Triggered when the upload state is changing.'
|
|
24
|
+
},
|
|
25
|
+
properties: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
required: [
|
|
28
|
+
's3GetPolicyRequestId'
|
|
29
|
+
],
|
|
30
|
+
properties: {
|
|
31
|
+
fileList: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
description: 'List of files to be downloaded. If files were uploaded using an S3Upload block, the fileList value can just be mapped to this field.',
|
|
34
|
+
items: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
required: [
|
|
37
|
+
'key'
|
|
38
|
+
],
|
|
39
|
+
properties: {
|
|
40
|
+
key: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'S3 file key.'
|
|
43
|
+
},
|
|
44
|
+
lastModified: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'File last modified date.'
|
|
47
|
+
},
|
|
48
|
+
name: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'File name.'
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
type: 'number',
|
|
54
|
+
description: 'File size in bytes.'
|
|
55
|
+
},
|
|
56
|
+
type: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'File MIME type.'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
s3GetPolicyRequestId: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Id of a request of type AwsS3PresignedGetObject that defines which S3 bucket and file to download.'
|
|
66
|
+
},
|
|
67
|
+
theme: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
description: 'Antd design token overrides for this block. See <a href="https://ant.design/components/upload#design-token">antd design tokens</a>.',
|
|
70
|
+
docs: {
|
|
71
|
+
displayType: 'yaml',
|
|
72
|
+
link: 'https://ant.design/components/upload#design-token'
|
|
73
|
+
},
|
|
74
|
+
properties: {
|
|
75
|
+
actionsColor: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Color of action icons (download, preview).'
|
|
78
|
+
},
|
|
79
|
+
pictureCardSize: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
description: 'Size of list items in card type (affects both picture-card and picture-circle).'
|
|
82
|
+
},
|
|
83
|
+
controlItemBgHover: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'Background color of file item on hover.'
|
|
86
|
+
},
|
|
87
|
+
colorIcon: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Color of file icons.'
|
|
90
|
+
},
|
|
91
|
+
fontSize: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Font size of file name text.'
|
|
94
|
+
},
|
|
95
|
+
borderRadiusSM: {
|
|
96
|
+
type: 'number',
|
|
97
|
+
description: 'Border radius of file list items.'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
required: [
|
|
20
|
+
's3GetPolicyRequestId'
|
|
21
|
+
],
|
|
22
|
+
properties: {
|
|
23
|
+
fileList: {
|
|
24
|
+
type: 'array',
|
|
25
|
+
description: 'List of files to be downloaded. If files were uploaded using an S3Upload block, the fileList value can just be mapped to this field.',
|
|
26
|
+
items: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
required: [
|
|
29
|
+
'key'
|
|
30
|
+
],
|
|
31
|
+
properties: {
|
|
32
|
+
key: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'S3 file key.'
|
|
35
|
+
},
|
|
36
|
+
lastModified: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'File last modified date.'
|
|
39
|
+
},
|
|
40
|
+
name: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'File name.'
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
type: 'number',
|
|
46
|
+
description: 'File size in bytes.'
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'File MIME type.'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
s3GetPolicyRequestId: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Id of a request of type AwsS3PresignedGetObject that defines which S3 bucket and file to download.'
|
|
58
|
+
},
|
|
59
|
+
theme: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
description: 'Antd design token overrides for this block. See <a href="https://ant.design/components/upload#design-token">antd design tokens</a>.',
|
|
62
|
+
docs: {
|
|
63
|
+
displayType: 'yaml',
|
|
64
|
+
link: 'https://ant.design/components/upload#design-token'
|
|
65
|
+
},
|
|
66
|
+
properties: {
|
|
67
|
+
actionsColor: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Color of action icons (download, preview).'
|
|
70
|
+
},
|
|
71
|
+
pictureCardSize: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
description: 'Size of list items in card type (affects both picture-card and picture-circle).'
|
|
74
|
+
},
|
|
75
|
+
controlItemBgHover: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Background color of file item on hover.'
|
|
78
|
+
},
|
|
79
|
+
colorIcon: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Color of file icons.'
|
|
82
|
+
},
|
|
83
|
+
fontSize: {
|
|
84
|
+
type: 'number',
|
|
85
|
+
description: 'Font size of file name text.'
|
|
86
|
+
},
|
|
87
|
+
borderRadiusSM: {
|
|
88
|
+
type: 'number',
|
|
89
|
+
description: 'Border radius of file list items.'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
events: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
onChange: {
|
|
99
|
+
type: 'array',
|
|
100
|
+
description: 'Triggered when the upload state is changing.'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
cssKeys: [
|
|
105
|
+
'element'
|
|
106
|
+
]
|
|
107
|
+
};
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import React, { useEffect } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { withBlockDefaults } from '@lowdefy/block-utils';
|
|
17
17
|
import { Button } from '@lowdefy/blocks-antd/blocks';
|
|
18
18
|
import { Upload } from 'antd';
|
|
19
19
|
import useFileList from '../utils/useFileList.js';
|
|
20
20
|
import getS3Upload from '../utils/getS3Upload.js';
|
|
21
|
-
const S3UploadButtonBlock = ({ blockId, components, events, methods, properties, value })=>{
|
|
21
|
+
const S3UploadButtonBlock = ({ blockId, classNames = {}, components, events, methods, properties, styles = {}, value })=>{
|
|
22
22
|
const [state, loadFileList, setFileList, removeFile, setValue] = useFileList({
|
|
23
23
|
properties,
|
|
24
24
|
methods,
|
|
@@ -56,6 +56,8 @@ const S3UploadButtonBlock = ({ blockId, components, events, methods, properties,
|
|
|
56
56
|
return /*#__PURE__*/ React.createElement(Upload, {
|
|
57
57
|
accept: properties.accept ?? '*',
|
|
58
58
|
beforeUpload: loadFileList,
|
|
59
|
+
className: classNames.element,
|
|
60
|
+
style: styles.element,
|
|
59
61
|
customRequest: s3UploadRequest,
|
|
60
62
|
disabled: properties.disabled,
|
|
61
63
|
fileList: state.fileList,
|
|
@@ -83,15 +85,4 @@ const S3UploadButtonBlock = ({ blockId, components, events, methods, properties,
|
|
|
83
85
|
methods: methods
|
|
84
86
|
}));
|
|
85
87
|
};
|
|
86
|
-
|
|
87
|
-
S3UploadButtonBlock.meta = {
|
|
88
|
-
valueType: 'object',
|
|
89
|
-
category: 'input',
|
|
90
|
-
icons: [
|
|
91
|
-
'AiOutlineUpload'
|
|
92
|
-
],
|
|
93
|
-
styles: [
|
|
94
|
-
'blocks/S3UploadButton/style.less'
|
|
95
|
-
]
|
|
96
|
-
};
|
|
97
|
-
export default S3UploadButtonBlock;
|
|
88
|
+
export default withBlockDefaults(S3UploadButtonBlock);
|