@lowdefy/plugin-aws 4.7.2 → 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
|
@@ -0,0 +1,275 @@
|
|
|
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
|
|
16
|
+
blocks:
|
|
17
|
+
- id: basic_default
|
|
18
|
+
type: S3UploadDragger
|
|
19
|
+
properties:
|
|
20
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
21
|
+
- id: basic_custom_title
|
|
22
|
+
type: S3UploadDragger
|
|
23
|
+
properties:
|
|
24
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
25
|
+
title: Drop your files here
|
|
26
|
+
- id: basic_html_title
|
|
27
|
+
type: S3UploadDragger
|
|
28
|
+
properties:
|
|
29
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
30
|
+
title: '<b>Upload</b> your <i>documents</i> here'
|
|
31
|
+
|
|
32
|
+
- title: File Type Restrictions
|
|
33
|
+
blocks:
|
|
34
|
+
- id: accept_images
|
|
35
|
+
type: S3UploadDragger
|
|
36
|
+
properties:
|
|
37
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
38
|
+
title: Drag images here
|
|
39
|
+
accept: 'image/*'
|
|
40
|
+
- id: accept_pdfs
|
|
41
|
+
type: S3UploadDragger
|
|
42
|
+
properties:
|
|
43
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
44
|
+
title: Drag PDF files here
|
|
45
|
+
accept: '.pdf'
|
|
46
|
+
- id: accept_specific
|
|
47
|
+
type: S3UploadDragger
|
|
48
|
+
properties:
|
|
49
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
50
|
+
title: Drag image files here (.jpg, .png, .gif)
|
|
51
|
+
accept: '.jpg,.png,.gif'
|
|
52
|
+
|
|
53
|
+
- title: Upload Limits
|
|
54
|
+
blocks:
|
|
55
|
+
- id: limit_single
|
|
56
|
+
type: S3UploadDragger
|
|
57
|
+
properties:
|
|
58
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
59
|
+
title: Upload a single file
|
|
60
|
+
singleFile: true
|
|
61
|
+
- id: limit_max_three
|
|
62
|
+
type: S3UploadDragger
|
|
63
|
+
properties:
|
|
64
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
65
|
+
title: Upload up to 3 files
|
|
66
|
+
maxCount: 3
|
|
67
|
+
- id: limit_single_images
|
|
68
|
+
type: S3UploadDragger
|
|
69
|
+
properties:
|
|
70
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
71
|
+
title: Upload a single image
|
|
72
|
+
singleFile: true
|
|
73
|
+
accept: 'image/*'
|
|
74
|
+
|
|
75
|
+
- title: Drag Area Styling
|
|
76
|
+
blocks:
|
|
77
|
+
- id: style_light_blue
|
|
78
|
+
type: S3UploadDragger
|
|
79
|
+
properties:
|
|
80
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
81
|
+
title: Light blue background
|
|
82
|
+
style:
|
|
83
|
+
background: '#e6f7ff'
|
|
84
|
+
- id: style_dashed_border
|
|
85
|
+
type: S3UploadDragger
|
|
86
|
+
properties:
|
|
87
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
88
|
+
title: Dashed border style
|
|
89
|
+
style:
|
|
90
|
+
border: 2px dashed #1890ff
|
|
91
|
+
borderRadius: 12
|
|
92
|
+
- id: style_large_padding
|
|
93
|
+
type: S3UploadDragger
|
|
94
|
+
properties:
|
|
95
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
96
|
+
title: Larger drop area with custom font
|
|
97
|
+
style:
|
|
98
|
+
padding: 40
|
|
99
|
+
fontSize: 18
|
|
100
|
+
|
|
101
|
+
- title: Disabled State
|
|
102
|
+
blocks:
|
|
103
|
+
- id: disabled_default
|
|
104
|
+
type: S3UploadDragger
|
|
105
|
+
properties:
|
|
106
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
107
|
+
disabled: true
|
|
108
|
+
- id: disabled_custom_title
|
|
109
|
+
type: S3UploadDragger
|
|
110
|
+
properties:
|
|
111
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
112
|
+
disabled: true
|
|
113
|
+
title: Uploads are currently disabled
|
|
114
|
+
- id: disabled_hidden_list
|
|
115
|
+
type: S3UploadDragger
|
|
116
|
+
properties:
|
|
117
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
118
|
+
disabled: true
|
|
119
|
+
title: Disabled with hidden list
|
|
120
|
+
showUploadList: false
|
|
121
|
+
|
|
122
|
+
- title: Upload List Visibility
|
|
123
|
+
blocks:
|
|
124
|
+
- id: list_visible
|
|
125
|
+
type: S3UploadDragger
|
|
126
|
+
properties:
|
|
127
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
128
|
+
title: Upload list visible (default)
|
|
129
|
+
showUploadList: true
|
|
130
|
+
- id: list_hidden
|
|
131
|
+
type: S3UploadDragger
|
|
132
|
+
properties:
|
|
133
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
134
|
+
title: Upload list hidden
|
|
135
|
+
showUploadList: false
|
|
136
|
+
- id: list_single_hidden
|
|
137
|
+
type: S3UploadDragger
|
|
138
|
+
properties:
|
|
139
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
140
|
+
title: Single file, list hidden
|
|
141
|
+
singleFile: true
|
|
142
|
+
showUploadList: false
|
|
143
|
+
|
|
144
|
+
- title: Style Overrides
|
|
145
|
+
blocks:
|
|
146
|
+
- id: style_element_bg
|
|
147
|
+
type: S3UploadDragger
|
|
148
|
+
style:
|
|
149
|
+
.element:
|
|
150
|
+
background: '#f6ffed'
|
|
151
|
+
borderRadius: 12
|
|
152
|
+
padding: 8
|
|
153
|
+
properties:
|
|
154
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
155
|
+
title: Custom element background
|
|
156
|
+
- id: style_element_border
|
|
157
|
+
type: S3UploadDragger
|
|
158
|
+
style:
|
|
159
|
+
.element:
|
|
160
|
+
border: 2px solid #d9d9d9
|
|
161
|
+
boxShadow: 0 2px 8px rgba(0,0,0,0.1)
|
|
162
|
+
properties:
|
|
163
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
164
|
+
title: Styled with border and shadow
|
|
165
|
+
- id: style_class_tailwind
|
|
166
|
+
type: S3UploadDragger
|
|
167
|
+
class: rounded-xl shadow-md
|
|
168
|
+
properties:
|
|
169
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
170
|
+
title: Tailwind rounded with shadow
|
|
171
|
+
|
|
172
|
+
- title: S3UploadDragger in File Submission Form
|
|
173
|
+
blocks:
|
|
174
|
+
- id: submission_card
|
|
175
|
+
type: Card
|
|
176
|
+
properties:
|
|
177
|
+
title: Submit Files
|
|
178
|
+
size: small
|
|
179
|
+
blocks:
|
|
180
|
+
- id: submission_description
|
|
181
|
+
type: TextInput
|
|
182
|
+
required: true
|
|
183
|
+
properties:
|
|
184
|
+
label:
|
|
185
|
+
title: File Description
|
|
186
|
+
placeholder: Describe the file you are uploading
|
|
187
|
+
- id: submission_category
|
|
188
|
+
type: Selector
|
|
189
|
+
required: true
|
|
190
|
+
properties:
|
|
191
|
+
label:
|
|
192
|
+
title: File Category
|
|
193
|
+
placeholder: Select a category
|
|
194
|
+
options:
|
|
195
|
+
- label: Documents
|
|
196
|
+
value: documents
|
|
197
|
+
- label: Images
|
|
198
|
+
value: images
|
|
199
|
+
- label: Spreadsheets
|
|
200
|
+
value: spreadsheets
|
|
201
|
+
- label: Other
|
|
202
|
+
value: other
|
|
203
|
+
- id: submission_upload
|
|
204
|
+
type: S3UploadDragger
|
|
205
|
+
properties:
|
|
206
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
207
|
+
title: Drag files here or click to browse
|
|
208
|
+
accept: '.pdf,.docx,.xlsx,.png,.jpg'
|
|
209
|
+
- id: submission_actions
|
|
210
|
+
type: Box
|
|
211
|
+
layout:
|
|
212
|
+
justify: flex-end
|
|
213
|
+
blocks:
|
|
214
|
+
- id: submission_submit
|
|
215
|
+
type: Button
|
|
216
|
+
layout:
|
|
217
|
+
flex: 0 0 auto
|
|
218
|
+
properties:
|
|
219
|
+
title: Submit
|
|
220
|
+
color: primary
|
|
221
|
+
variant: solid
|
|
222
|
+
icon: AiOutlineUpload
|
|
223
|
+
events:
|
|
224
|
+
onClick:
|
|
225
|
+
- id: submit_validate
|
|
226
|
+
type: Validate
|
|
227
|
+
- id: submit_msg
|
|
228
|
+
type: DisplayMessage
|
|
229
|
+
params:
|
|
230
|
+
content: Files submitted successfully!
|
|
231
|
+
status: success
|
|
232
|
+
|
|
233
|
+
- title: S3UploadDragger in Photo Gallery Upload
|
|
234
|
+
blocks:
|
|
235
|
+
- id: gallery_card
|
|
236
|
+
type: Card
|
|
237
|
+
properties:
|
|
238
|
+
title: Upload Photos
|
|
239
|
+
size: small
|
|
240
|
+
blocks:
|
|
241
|
+
- id: gallery_album_name
|
|
242
|
+
type: TextInput
|
|
243
|
+
required: true
|
|
244
|
+
properties:
|
|
245
|
+
label:
|
|
246
|
+
title: Album Name
|
|
247
|
+
placeholder: Enter album name
|
|
248
|
+
- id: gallery_upload
|
|
249
|
+
type: S3UploadDragger
|
|
250
|
+
properties:
|
|
251
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
252
|
+
title: Drag photos here or click to browse
|
|
253
|
+
accept: 'image/*'
|
|
254
|
+
maxCount: 10
|
|
255
|
+
- id: gallery_actions
|
|
256
|
+
type: Box
|
|
257
|
+
layout:
|
|
258
|
+
justify: flex-end
|
|
259
|
+
blocks:
|
|
260
|
+
- id: gallery_submit
|
|
261
|
+
type: Button
|
|
262
|
+
layout:
|
|
263
|
+
flex: 0 0 auto
|
|
264
|
+
properties:
|
|
265
|
+
title: Upload Photos
|
|
266
|
+
color: primary
|
|
267
|
+
variant: solid
|
|
268
|
+
icon: AiOutlineCloudUpload
|
|
269
|
+
events:
|
|
270
|
+
onClick:
|
|
271
|
+
- id: gallery_msg
|
|
272
|
+
type: DisplayMessage
|
|
273
|
+
params:
|
|
274
|
+
content: Photos uploaded to album!
|
|
275
|
+
status: success
|
|
@@ -0,0 +1,102 @@
|
|
|
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: 'input',
|
|
17
|
+
icons: [],
|
|
18
|
+
valueType: 'object',
|
|
19
|
+
cssKeys: {
|
|
20
|
+
element: 'The upload dragger area.',
|
|
21
|
+
hint: 'The hint text inside the dragger.'
|
|
22
|
+
},
|
|
23
|
+
events: {
|
|
24
|
+
onBeforeUpload: {
|
|
25
|
+
description: 'Triggered before a file is uploaded. If an action throws, the upload is cancelled.',
|
|
26
|
+
event: {
|
|
27
|
+
file: 'The file metadata (name, type, size, lastModified, uid, url).'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onChange: 'Triggered when the upload state is changing.',
|
|
31
|
+
onProgress: {
|
|
32
|
+
description: 'Triggered when the upload state is in progress.',
|
|
33
|
+
event: {
|
|
34
|
+
file: 'The file being uploaded.',
|
|
35
|
+
fileList: 'The full list of files.'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onSuccess: {
|
|
39
|
+
description: 'Triggered when the upload state is done uploading.',
|
|
40
|
+
event: {
|
|
41
|
+
file: 'The uploaded file.',
|
|
42
|
+
fileList: 'The full list of files.'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
onRemove: {
|
|
46
|
+
description: 'Triggered when the upload has been removed.',
|
|
47
|
+
event: {
|
|
48
|
+
file: 'The removed file.',
|
|
49
|
+
fileList: 'The full list of files.'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
onError: {
|
|
53
|
+
description: 'Triggered when the upload has failed.',
|
|
54
|
+
event: {
|
|
55
|
+
file: 'The file that failed.',
|
|
56
|
+
fileList: 'The full list of files.'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
properties: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
required: [
|
|
63
|
+
's3PostPolicyRequestId'
|
|
64
|
+
],
|
|
65
|
+
properties: {
|
|
66
|
+
height: {
|
|
67
|
+
type: 'number',
|
|
68
|
+
description: 'Height of the dragger area in pixels. Defaults to the antd control height. Overridden by style .element height if set.'
|
|
69
|
+
},
|
|
70
|
+
title: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Title of the file input to be displayed on the draggable area.'
|
|
73
|
+
},
|
|
74
|
+
accept: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: 'File types accepted by the input. See html file type input accept property at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept.'
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
description: 'Disable the file input.'
|
|
81
|
+
},
|
|
82
|
+
maxCount: {
|
|
83
|
+
type: 'number',
|
|
84
|
+
description: 'Maximum number of files that can be uploaded.'
|
|
85
|
+
},
|
|
86
|
+
s3PostPolicyRequestId: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.'
|
|
89
|
+
},
|
|
90
|
+
showUploadList: {
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
default: true,
|
|
93
|
+
description: 'Whether to show default upload list.'
|
|
94
|
+
},
|
|
95
|
+
singleFile: {
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
default: false,
|
|
98
|
+
description: 'Only allow a single file to be uploaded. Only one file can be selected in the prompt.'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
's3PostPolicyRequestId'
|
|
21
|
+
],
|
|
22
|
+
properties: {
|
|
23
|
+
height: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
description: 'Height of the dragger area in pixels. Defaults to the antd control height. Overridden by style .element height if set.'
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Title of the file input to be displayed on the draggable area.'
|
|
30
|
+
},
|
|
31
|
+
accept: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'File types accepted by the input. See html file type input accept property at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept.'
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
description: 'Disable the file input.'
|
|
38
|
+
},
|
|
39
|
+
maxCount: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: 'Maximum number of files that can be uploaded.'
|
|
42
|
+
},
|
|
43
|
+
s3PostPolicyRequestId: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.',
|
|
46
|
+
docs: {
|
|
47
|
+
displayType: 'manual',
|
|
48
|
+
block: {
|
|
49
|
+
id: 'block_properties_s3PostPolicyRequestId',
|
|
50
|
+
layout: {
|
|
51
|
+
_global: 'settings_input_layout'
|
|
52
|
+
},
|
|
53
|
+
type: 'Label',
|
|
54
|
+
required: true,
|
|
55
|
+
properties: {
|
|
56
|
+
title: 's3PostPolicyRequestId',
|
|
57
|
+
span: 8,
|
|
58
|
+
align: 'right'
|
|
59
|
+
},
|
|
60
|
+
blocks: [
|
|
61
|
+
{
|
|
62
|
+
id: 'block_properties_s3PostPolicyRequestId_text',
|
|
63
|
+
type: 'Markdown',
|
|
64
|
+
style: {
|
|
65
|
+
color: '#8c8c8c'
|
|
66
|
+
},
|
|
67
|
+
properties: {
|
|
68
|
+
content: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
showUploadList: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
default: true,
|
|
78
|
+
description: 'Whether to show default upload list.'
|
|
79
|
+
},
|
|
80
|
+
singleFile: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
default: false,
|
|
83
|
+
description: 'Only allow a single file to be uploaded. Only one file can be selected in the prompt.'
|
|
84
|
+
},
|
|
85
|
+
style: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
description: 'Css style object to applied to draggable area.',
|
|
88
|
+
docs: {
|
|
89
|
+
displayType: 'yaml'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
events: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
onChange: {
|
|
98
|
+
type: 'array',
|
|
99
|
+
description: 'Triggered when the upload state is changing.'
|
|
100
|
+
},
|
|
101
|
+
onProgress: {
|
|
102
|
+
type: 'array',
|
|
103
|
+
description: 'Triggered when the upload state is in progress.'
|
|
104
|
+
},
|
|
105
|
+
onSuccess: {
|
|
106
|
+
type: 'array',
|
|
107
|
+
description: 'Triggered when the upload state is done uploading.'
|
|
108
|
+
},
|
|
109
|
+
onRemove: {
|
|
110
|
+
type: 'array',
|
|
111
|
+
description: 'Triggered when the upload has been removed.'
|
|
112
|
+
},
|
|
113
|
+
onError: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
description: 'Triggered when the upload has failed.'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import React, { useEffect, useState } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { withBlockDefaults, renderHtml } from '@lowdefy/block-utils';
|
|
17
17
|
import { Upload } from 'antd';
|
|
18
18
|
import useFileList from '../utils/useFileList.js';
|
|
19
19
|
import getS3Upload from '../utils/getS3Upload.js';
|
|
20
|
-
const S3UploadPhoto = ({ blockId, components: { Icon }, events, methods, properties, value })=>{
|
|
20
|
+
const S3UploadPhoto = ({ blockId, classNames = {}, components: { Icon }, events, methods, properties, styles = {}, value })=>{
|
|
21
21
|
const [state, loadFileList, setFileList, removeFile, setValue] = useFileList({
|
|
22
22
|
properties,
|
|
23
23
|
methods,
|
|
@@ -73,42 +73,43 @@ const S3UploadPhoto = ({ blockId, components: { Icon }, events, methods, propert
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
76
|
-
className:
|
|
77
|
-
|
|
78
|
-
])
|
|
76
|
+
className: classNames.element,
|
|
77
|
+
style: styles.element
|
|
79
78
|
}, loading ? /*#__PURE__*/ React.createElement(Icon, {
|
|
80
79
|
blockId: `${blockId}_icon`,
|
|
80
|
+
classNames: {
|
|
81
|
+
element: classNames.icon
|
|
82
|
+
},
|
|
81
83
|
events: events,
|
|
82
84
|
properties: {
|
|
83
85
|
name: 'AiOutlineLoading',
|
|
84
86
|
size: 24
|
|
87
|
+
},
|
|
88
|
+
styles: {
|
|
89
|
+
element: styles.icon
|
|
85
90
|
}
|
|
86
91
|
}) : /*#__PURE__*/ React.createElement(Icon, {
|
|
87
92
|
blockId: `${blockId}_icon`,
|
|
93
|
+
classNames: {
|
|
94
|
+
element: classNames.icon
|
|
95
|
+
},
|
|
88
96
|
events: events,
|
|
89
97
|
properties: {
|
|
90
98
|
name: 'AiOutlineCamera',
|
|
91
99
|
size: 24
|
|
100
|
+
},
|
|
101
|
+
styles: {
|
|
102
|
+
element: styles.icon
|
|
92
103
|
}
|
|
93
104
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
105
|
+
className: classNames.title,
|
|
94
106
|
style: {
|
|
95
|
-
marginTop: 8
|
|
107
|
+
marginTop: 8,
|
|
108
|
+
...styles.title
|
|
96
109
|
}
|
|
97
110
|
}, renderHtml({
|
|
98
111
|
html: properties.title ?? 'Upload image',
|
|
99
112
|
methods
|
|
100
113
|
}))));
|
|
101
114
|
};
|
|
102
|
-
|
|
103
|
-
S3UploadPhoto.meta = {
|
|
104
|
-
valueType: 'object',
|
|
105
|
-
category: 'input',
|
|
106
|
-
icons: [
|
|
107
|
-
'AiOutlineLoading',
|
|
108
|
-
'AiOutlineCamera'
|
|
109
|
-
],
|
|
110
|
-
styles: [
|
|
111
|
-
'blocks/S3UploadPhoto/style.less'
|
|
112
|
-
]
|
|
113
|
-
};
|
|
114
|
-
export default S3UploadPhoto;
|
|
115
|
+
export default withBlockDefaults(S3UploadPhoto);
|