@lowdefy/plugin-aws 4.7.3 → 5.1.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,349 @@
|
|
|
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: S3UploadButton
|
|
19
|
+
properties:
|
|
20
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
21
|
+
- id: basic_custom_title
|
|
22
|
+
type: S3UploadButton
|
|
23
|
+
properties:
|
|
24
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
25
|
+
button:
|
|
26
|
+
icon: UploadOutlined
|
|
27
|
+
title: Choose File
|
|
28
|
+
type: default
|
|
29
|
+
- id: basic_custom_icon
|
|
30
|
+
type: S3UploadButton
|
|
31
|
+
properties:
|
|
32
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
33
|
+
button:
|
|
34
|
+
icon: AiOutlineCloudUpload
|
|
35
|
+
title: Upload to Cloud
|
|
36
|
+
type: default
|
|
37
|
+
|
|
38
|
+
- title: File Type Restrictions
|
|
39
|
+
blocks:
|
|
40
|
+
- id: accept_images
|
|
41
|
+
type: S3UploadButton
|
|
42
|
+
properties:
|
|
43
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
44
|
+
accept: 'image/*'
|
|
45
|
+
button:
|
|
46
|
+
icon: AiOutlinePicture
|
|
47
|
+
title: Upload Image
|
|
48
|
+
type: default
|
|
49
|
+
- id: accept_pdf
|
|
50
|
+
type: S3UploadButton
|
|
51
|
+
properties:
|
|
52
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
53
|
+
accept: '.pdf'
|
|
54
|
+
button:
|
|
55
|
+
icon: AiOutlineFilePdf
|
|
56
|
+
title: Upload PDF
|
|
57
|
+
type: default
|
|
58
|
+
- id: accept_specific
|
|
59
|
+
type: S3UploadButton
|
|
60
|
+
properties:
|
|
61
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
62
|
+
accept: '.jpg,.png,.gif'
|
|
63
|
+
button:
|
|
64
|
+
icon: AiOutlinePicture
|
|
65
|
+
title: Upload JPG, PNG, or GIF
|
|
66
|
+
type: default
|
|
67
|
+
|
|
68
|
+
- title: Upload Limits
|
|
69
|
+
blocks:
|
|
70
|
+
- id: limit_single
|
|
71
|
+
type: S3UploadButton
|
|
72
|
+
properties:
|
|
73
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
74
|
+
singleFile: true
|
|
75
|
+
button:
|
|
76
|
+
icon: UploadOutlined
|
|
77
|
+
title: Upload Single File
|
|
78
|
+
type: default
|
|
79
|
+
- id: limit_max_three
|
|
80
|
+
type: S3UploadButton
|
|
81
|
+
properties:
|
|
82
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
83
|
+
maxCount: 3
|
|
84
|
+
button:
|
|
85
|
+
icon: UploadOutlined
|
|
86
|
+
title: Upload (Max 3)
|
|
87
|
+
type: default
|
|
88
|
+
- id: limit_single_images
|
|
89
|
+
type: S3UploadButton
|
|
90
|
+
properties:
|
|
91
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
92
|
+
singleFile: true
|
|
93
|
+
accept: 'image/*'
|
|
94
|
+
button:
|
|
95
|
+
icon: AiOutlinePicture
|
|
96
|
+
title: Upload One Image
|
|
97
|
+
type: default
|
|
98
|
+
|
|
99
|
+
- title: Button Customization
|
|
100
|
+
blocks:
|
|
101
|
+
- id: button_primary
|
|
102
|
+
type: S3UploadButton
|
|
103
|
+
properties:
|
|
104
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
105
|
+
button:
|
|
106
|
+
icon: UploadOutlined
|
|
107
|
+
title: Upload
|
|
108
|
+
type: primary
|
|
109
|
+
- id: button_large
|
|
110
|
+
type: S3UploadButton
|
|
111
|
+
properties:
|
|
112
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
113
|
+
button:
|
|
114
|
+
icon: UploadOutlined
|
|
115
|
+
title: Upload Files
|
|
116
|
+
type: default
|
|
117
|
+
size: large
|
|
118
|
+
- id: button_different_icon
|
|
119
|
+
type: S3UploadButton
|
|
120
|
+
properties:
|
|
121
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
122
|
+
button:
|
|
123
|
+
icon: AiOutlinePaperClip
|
|
124
|
+
title: Attach Files
|
|
125
|
+
type: default
|
|
126
|
+
|
|
127
|
+
- title: Disabled State
|
|
128
|
+
blocks:
|
|
129
|
+
- id: disabled_default
|
|
130
|
+
type: S3UploadButton
|
|
131
|
+
properties:
|
|
132
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
133
|
+
disabled: true
|
|
134
|
+
- id: disabled_primary
|
|
135
|
+
type: S3UploadButton
|
|
136
|
+
properties:
|
|
137
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
138
|
+
disabled: true
|
|
139
|
+
button:
|
|
140
|
+
icon: UploadOutlined
|
|
141
|
+
title: Upload
|
|
142
|
+
type: primary
|
|
143
|
+
- id: disabled_hidden_list
|
|
144
|
+
type: S3UploadButton
|
|
145
|
+
properties:
|
|
146
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
147
|
+
disabled: true
|
|
148
|
+
showUploadList: false
|
|
149
|
+
|
|
150
|
+
- title: Upload List Visibility
|
|
151
|
+
blocks:
|
|
152
|
+
- id: list_visible
|
|
153
|
+
type: S3UploadButton
|
|
154
|
+
properties:
|
|
155
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
156
|
+
showUploadList: true
|
|
157
|
+
button:
|
|
158
|
+
icon: UploadOutlined
|
|
159
|
+
title: Upload (List Visible)
|
|
160
|
+
type: default
|
|
161
|
+
- id: list_hidden
|
|
162
|
+
type: S3UploadButton
|
|
163
|
+
properties:
|
|
164
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
165
|
+
showUploadList: false
|
|
166
|
+
button:
|
|
167
|
+
icon: UploadOutlined
|
|
168
|
+
title: Upload (No List)
|
|
169
|
+
type: default
|
|
170
|
+
- id: list_single_hidden
|
|
171
|
+
type: S3UploadButton
|
|
172
|
+
properties:
|
|
173
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
174
|
+
singleFile: true
|
|
175
|
+
showUploadList: false
|
|
176
|
+
button:
|
|
177
|
+
icon: UploadOutlined
|
|
178
|
+
title: Upload Single (No List)
|
|
179
|
+
type: default
|
|
180
|
+
|
|
181
|
+
- title: Label Options
|
|
182
|
+
blocks:
|
|
183
|
+
- id: label_default
|
|
184
|
+
type: S3UploadButton
|
|
185
|
+
properties:
|
|
186
|
+
title: Upload Attachment
|
|
187
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
188
|
+
- id: label_inline
|
|
189
|
+
type: S3UploadButton
|
|
190
|
+
properties:
|
|
191
|
+
title: Attachment
|
|
192
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
193
|
+
label:
|
|
194
|
+
inline: true
|
|
195
|
+
span: 8
|
|
196
|
+
- id: label_extra
|
|
197
|
+
type: S3UploadButton
|
|
198
|
+
properties:
|
|
199
|
+
title: Upload Document
|
|
200
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
201
|
+
label:
|
|
202
|
+
extra: Accepted formats are PDF, DOCX, and PNG. Max size 10MB.
|
|
203
|
+
|
|
204
|
+
- title: Style Overrides
|
|
205
|
+
blocks:
|
|
206
|
+
- id: style_element_bg
|
|
207
|
+
type: S3UploadButton
|
|
208
|
+
style:
|
|
209
|
+
.element:
|
|
210
|
+
background: '#f6ffed'
|
|
211
|
+
border: 1px solid #b7eb8f
|
|
212
|
+
borderRadius: 8
|
|
213
|
+
padding: 12
|
|
214
|
+
properties:
|
|
215
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
216
|
+
button:
|
|
217
|
+
icon: UploadOutlined
|
|
218
|
+
title: Upload
|
|
219
|
+
type: default
|
|
220
|
+
- id: style_label
|
|
221
|
+
type: S3UploadButton
|
|
222
|
+
style:
|
|
223
|
+
.label:
|
|
224
|
+
color: '#722ed1'
|
|
225
|
+
fontWeight: bold
|
|
226
|
+
properties:
|
|
227
|
+
title: Upload Files
|
|
228
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
229
|
+
- id: style_tailwind
|
|
230
|
+
type: S3UploadButton
|
|
231
|
+
class: shadow-md rounded-lg
|
|
232
|
+
properties:
|
|
233
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
234
|
+
button:
|
|
235
|
+
icon: UploadOutlined
|
|
236
|
+
title: Upload
|
|
237
|
+
type: default
|
|
238
|
+
|
|
239
|
+
- title: S3UploadButton in Document Management
|
|
240
|
+
blocks:
|
|
241
|
+
- id: doc_mgmt_card
|
|
242
|
+
type: Card
|
|
243
|
+
properties:
|
|
244
|
+
title: Upload Document
|
|
245
|
+
blocks:
|
|
246
|
+
- id: doc_name
|
|
247
|
+
type: TextInput
|
|
248
|
+
required: true
|
|
249
|
+
properties:
|
|
250
|
+
title: Document Name
|
|
251
|
+
placeholder: Enter document name
|
|
252
|
+
label:
|
|
253
|
+
colon: false
|
|
254
|
+
- id: doc_category
|
|
255
|
+
type: Selector
|
|
256
|
+
properties:
|
|
257
|
+
title: Category
|
|
258
|
+
placeholder: Select category
|
|
259
|
+
label:
|
|
260
|
+
colon: false
|
|
261
|
+
options:
|
|
262
|
+
- label: Contracts
|
|
263
|
+
value: contracts
|
|
264
|
+
- label: Invoices
|
|
265
|
+
value: invoices
|
|
266
|
+
- label: Reports
|
|
267
|
+
value: reports
|
|
268
|
+
- label: Other
|
|
269
|
+
value: other
|
|
270
|
+
- id: doc_upload
|
|
271
|
+
type: S3UploadButton
|
|
272
|
+
properties:
|
|
273
|
+
title: Attachment
|
|
274
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
275
|
+
accept: '.pdf,.docx,.xlsx'
|
|
276
|
+
button:
|
|
277
|
+
icon: AiOutlineFilePdf
|
|
278
|
+
title: Choose Document
|
|
279
|
+
type: default
|
|
280
|
+
label:
|
|
281
|
+
colon: false
|
|
282
|
+
extra: Accepted formats are PDF, DOCX, and XLSX.
|
|
283
|
+
- id: doc_save
|
|
284
|
+
type: Button
|
|
285
|
+
layout:
|
|
286
|
+
flex: 0 0 auto
|
|
287
|
+
properties:
|
|
288
|
+
title: Save Document
|
|
289
|
+
color: primary
|
|
290
|
+
variant: solid
|
|
291
|
+
icon: AiOutlineSave
|
|
292
|
+
events:
|
|
293
|
+
onClick:
|
|
294
|
+
- id: save_validate
|
|
295
|
+
type: Validate
|
|
296
|
+
- id: save_msg
|
|
297
|
+
type: DisplayMessage
|
|
298
|
+
params:
|
|
299
|
+
content: Document saved successfully!
|
|
300
|
+
status: success
|
|
301
|
+
|
|
302
|
+
- title: S3UploadButton in Profile Picture Upload
|
|
303
|
+
blocks:
|
|
304
|
+
- id: profile_card
|
|
305
|
+
type: Card
|
|
306
|
+
properties:
|
|
307
|
+
title: Update Profile
|
|
308
|
+
blocks:
|
|
309
|
+
- id: profile_avatar
|
|
310
|
+
type: S3UploadButton
|
|
311
|
+
properties:
|
|
312
|
+
title: Profile Picture
|
|
313
|
+
s3PostPolicyRequestId: s3_upload_policy_request
|
|
314
|
+
singleFile: true
|
|
315
|
+
accept: 'image/*'
|
|
316
|
+
button:
|
|
317
|
+
icon: AiOutlineCamera
|
|
318
|
+
title: Choose Photo
|
|
319
|
+
type: default
|
|
320
|
+
label:
|
|
321
|
+
colon: false
|
|
322
|
+
extra: Upload a JPG, PNG, or GIF image.
|
|
323
|
+
- id: profile_display_name
|
|
324
|
+
type: TextInput
|
|
325
|
+
required: true
|
|
326
|
+
properties:
|
|
327
|
+
title: Display Name
|
|
328
|
+
prefixIcon: AiOutlineUser
|
|
329
|
+
placeholder: Enter your display name
|
|
330
|
+
label:
|
|
331
|
+
colon: false
|
|
332
|
+
- id: profile_update
|
|
333
|
+
type: Button
|
|
334
|
+
layout:
|
|
335
|
+
flex: 0 0 auto
|
|
336
|
+
properties:
|
|
337
|
+
title: Update Profile
|
|
338
|
+
color: primary
|
|
339
|
+
variant: solid
|
|
340
|
+
icon: AiOutlineCheck
|
|
341
|
+
events:
|
|
342
|
+
onClick:
|
|
343
|
+
- id: update_validate
|
|
344
|
+
type: Validate
|
|
345
|
+
- id: update_msg
|
|
346
|
+
type: DisplayMessage
|
|
347
|
+
params:
|
|
348
|
+
content: Profile updated successfully!
|
|
349
|
+
status: success
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
'AiOutlineUpload'
|
|
19
|
+
],
|
|
20
|
+
valueType: 'object',
|
|
21
|
+
cssKeys: {
|
|
22
|
+
element: 'The upload wrapper element.'
|
|
23
|
+
},
|
|
24
|
+
events: {
|
|
25
|
+
onBeforeUpload: {
|
|
26
|
+
description: 'Triggered before a file is uploaded. If an action throws, the upload is cancelled.',
|
|
27
|
+
event: {
|
|
28
|
+
file: 'The file metadata (name, type, size, lastModified, uid, url).'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onChange: 'Triggered when the upload state is changing.',
|
|
32
|
+
onProgress: {
|
|
33
|
+
description: 'Triggered when the upload state is in progress.',
|
|
34
|
+
event: {
|
|
35
|
+
file: 'The file being uploaded.',
|
|
36
|
+
fileList: 'The full list of files.'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
onSuccess: {
|
|
40
|
+
description: 'Triggered when the upload state is done uploading.',
|
|
41
|
+
event: {
|
|
42
|
+
file: 'The uploaded file.',
|
|
43
|
+
fileList: 'The full list of files.'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
onRemove: {
|
|
47
|
+
description: 'Triggered when the upload has been removed.',
|
|
48
|
+
event: {
|
|
49
|
+
file: 'The removed file.',
|
|
50
|
+
fileList: 'The full list of files.'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
onError: {
|
|
54
|
+
description: 'Triggered when the upload has failed.',
|
|
55
|
+
event: {
|
|
56
|
+
file: 'The file that failed.',
|
|
57
|
+
fileList: 'The full list of files.'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
onClick: 'Triggered when the upload button is clicked.'
|
|
61
|
+
},
|
|
62
|
+
properties: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
required: [
|
|
65
|
+
's3PostPolicyRequestId'
|
|
66
|
+
],
|
|
67
|
+
properties: {
|
|
68
|
+
accept: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
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.'
|
|
71
|
+
},
|
|
72
|
+
button: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
description: 'Button block properties. See <a href="/Button">Button</a> for all properties.',
|
|
75
|
+
default: {
|
|
76
|
+
icon: 'UploadOutlined',
|
|
77
|
+
title: 'Upload',
|
|
78
|
+
type: 'default'
|
|
79
|
+
},
|
|
80
|
+
docs: {
|
|
81
|
+
displayType: 'button'
|
|
82
|
+
},
|
|
83
|
+
properties: {
|
|
84
|
+
title: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Button title text.'
|
|
87
|
+
},
|
|
88
|
+
icon: {
|
|
89
|
+
type: [
|
|
90
|
+
'string',
|
|
91
|
+
'object'
|
|
92
|
+
],
|
|
93
|
+
description: 'Button icon name or Icon block properties.',
|
|
94
|
+
docs: {
|
|
95
|
+
displayType: 'icon'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
type: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
enum: [
|
|
101
|
+
'default',
|
|
102
|
+
'primary',
|
|
103
|
+
'dashed',
|
|
104
|
+
'text',
|
|
105
|
+
'link'
|
|
106
|
+
],
|
|
107
|
+
default: 'default',
|
|
108
|
+
description: 'Button type.'
|
|
109
|
+
},
|
|
110
|
+
danger: {
|
|
111
|
+
type: 'boolean',
|
|
112
|
+
default: false,
|
|
113
|
+
description: 'Set button style to danger.'
|
|
114
|
+
},
|
|
115
|
+
disabled: {
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
default: false,
|
|
118
|
+
description: 'Disable the button.'
|
|
119
|
+
},
|
|
120
|
+
size: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
enum: [
|
|
123
|
+
'small',
|
|
124
|
+
'default',
|
|
125
|
+
'large'
|
|
126
|
+
],
|
|
127
|
+
default: 'default',
|
|
128
|
+
description: 'Button size.'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
disabled: {
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
description: 'Disable the file input.'
|
|
135
|
+
},
|
|
136
|
+
maxCount: {
|
|
137
|
+
type: 'number',
|
|
138
|
+
description: 'Maximum number of files that can be uploaded.'
|
|
139
|
+
},
|
|
140
|
+
s3PostPolicyRequestId: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.'
|
|
143
|
+
},
|
|
144
|
+
showUploadList: {
|
|
145
|
+
type: 'boolean',
|
|
146
|
+
default: true,
|
|
147
|
+
description: 'Whether to show default upload list.'
|
|
148
|
+
},
|
|
149
|
+
singleFile: {
|
|
150
|
+
type: 'boolean',
|
|
151
|
+
default: false,
|
|
152
|
+
description: 'Only allow a single file to be uploaded. Only one file can be selected in the prompt.'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
accept: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
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.'
|
|
26
|
+
},
|
|
27
|
+
button: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
description: 'Button block properties.',
|
|
30
|
+
default: {
|
|
31
|
+
icon: 'UploadOutlined',
|
|
32
|
+
title: 'Upload',
|
|
33
|
+
type: 'default'
|
|
34
|
+
},
|
|
35
|
+
docs: {
|
|
36
|
+
displayType: 'button'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
description: 'Disable the file input.'
|
|
42
|
+
},
|
|
43
|
+
maxCount: {
|
|
44
|
+
type: 'number',
|
|
45
|
+
description: 'Maximum number of files that can be uploaded.'
|
|
46
|
+
},
|
|
47
|
+
s3PostPolicyRequestId: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.',
|
|
50
|
+
docs: {
|
|
51
|
+
displayType: 'manual',
|
|
52
|
+
block: {
|
|
53
|
+
id: 'block_properties_s3PostPolicyRequestId',
|
|
54
|
+
layout: {
|
|
55
|
+
_global: 'settings_input_layout'
|
|
56
|
+
},
|
|
57
|
+
type: 'Label',
|
|
58
|
+
required: true,
|
|
59
|
+
properties: {
|
|
60
|
+
title: 's3PostPolicyRequestId',
|
|
61
|
+
span: 8,
|
|
62
|
+
align: 'right'
|
|
63
|
+
},
|
|
64
|
+
blocks: [
|
|
65
|
+
{
|
|
66
|
+
id: 'block_properties_s3PostPolicyRequestId_text',
|
|
67
|
+
type: 'Markdown',
|
|
68
|
+
style: {
|
|
69
|
+
color: '#8c8c8c'
|
|
70
|
+
},
|
|
71
|
+
properties: {
|
|
72
|
+
content: 'Id of a request of type AwsS3PresignedPostPolicy that defines to which S3 bucket and how the file should be uploaded.'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
getter: {}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
showUploadList: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
default: true,
|
|
83
|
+
description: 'Whether to show default upload list.'
|
|
84
|
+
},
|
|
85
|
+
singleFile: {
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
default: false,
|
|
88
|
+
description: 'Only allow a single file to be uploaded. Only one file can be selected in the prompt.'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
events: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
onChange: {
|
|
96
|
+
type: 'array',
|
|
97
|
+
description: 'Triggered when the upload state is changing.'
|
|
98
|
+
},
|
|
99
|
+
onProgress: {
|
|
100
|
+
type: 'array',
|
|
101
|
+
description: 'Triggered when the upload state is in progress.'
|
|
102
|
+
},
|
|
103
|
+
onSuccess: {
|
|
104
|
+
type: 'array',
|
|
105
|
+
description: 'Triggered when the upload state is done uploading.'
|
|
106
|
+
},
|
|
107
|
+
onRemove: {
|
|
108
|
+
type: 'array',
|
|
109
|
+
description: 'Triggered when the upload has been removed.'
|
|
110
|
+
},
|
|
111
|
+
onError: {
|
|
112
|
+
type: 'array',
|
|
113
|
+
description: 'Triggered when the upload has failed.'
|
|
114
|
+
},
|
|
115
|
+
onClick: {
|
|
116
|
+
type: 'array',
|
|
117
|
+
description: 'Triggered when the upload button is clicked.'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import React, { useEffect } from 'react';
|
|
16
16
|
import { Upload } from 'antd';
|
|
17
|
-
import {
|
|
17
|
+
import { withBlockDefaults, renderHtml } from '@lowdefy/block-utils';
|
|
18
18
|
import useFileList from '../utils/useFileList.js';
|
|
19
19
|
import getS3Upload from '../utils/getS3Upload.js';
|
|
20
20
|
import getOnPaste from '../utils/getOnPaste.js';
|
|
21
21
|
const { Dragger } = Upload;
|
|
22
|
-
const S3UploadDragger = ({ blockId, methods, properties, value })=>{
|
|
22
|
+
const S3UploadDragger = ({ blockId, classNames = {}, methods, properties, styles = {}, value })=>{
|
|
23
23
|
const [state, loadFileList, setFileList, removeFile, setValue] = useFileList({
|
|
24
24
|
properties,
|
|
25
25
|
methods,
|
|
@@ -67,9 +67,9 @@ const S3UploadDragger = ({ blockId, methods, properties, value })=>{
|
|
|
67
67
|
}, /*#__PURE__*/ React.createElement(Dragger, {
|
|
68
68
|
accept: properties.accept ?? '*',
|
|
69
69
|
beforeUpload: loadFileList,
|
|
70
|
-
className:
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
className: classNames.element,
|
|
71
|
+
style: styles.element,
|
|
72
|
+
height: properties.height,
|
|
73
73
|
customRequest: s3UploadRequest,
|
|
74
74
|
disabled: properties.disabled,
|
|
75
75
|
fileList: state.fileList,
|
|
@@ -83,19 +83,11 @@ const S3UploadDragger = ({ blockId, methods, properties, value })=>{
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
86
|
-
className:
|
|
86
|
+
className: classNames.hint,
|
|
87
|
+
style: styles.hint
|
|
87
88
|
}, renderHtml({
|
|
88
89
|
html: properties.title ?? 'Click or drag to add a file.',
|
|
89
90
|
methods
|
|
90
91
|
}))));
|
|
91
92
|
};
|
|
92
|
-
|
|
93
|
-
S3UploadDragger.meta = {
|
|
94
|
-
valueType: 'object',
|
|
95
|
-
category: 'input',
|
|
96
|
-
icons: [],
|
|
97
|
-
styles: [
|
|
98
|
-
'blocks/S3UploadDragger/style.less'
|
|
99
|
-
]
|
|
100
|
-
};
|
|
101
|
-
export default S3UploadDragger;
|
|
93
|
+
export default withBlockDefaults(S3UploadDragger);
|