Skip to content

Commit

Permalink
Add List tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Oct 31, 2024
1 parent 85ad308 commit 90a2d9c
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 5 deletions.
22 changes: 17 additions & 5 deletions forms/hero.form.yao
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@
{ "name": "Select Option with Icon", "width": 24 }
]
},
{
"title": "List Upgraded",
"icon": { "name": "icon-list", "size": 14 },
"weight": "medium",
"color": "danger",
"columns": [{ "name": "Upload Group", "width": 24 }]
},
{
"title": "Upload Upgraded",
"icon": { "name": "icon-upload", "size": 14 },
Expand Down Expand Up @@ -735,7 +742,7 @@
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",
"previewSize": { "width": 210, "height": 90, "objectFit": "cover" },
"previewSize": { "width": 210, "height": 90 },
"placeholder": "Upload Cover"
}
}
Expand All @@ -749,7 +756,7 @@
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",
"previewSize": { "width": 210, "height": 90, "objectFit": "cover" },
"previewSize": { "width": 210, "height": 90 },
"placeholder": "Upload Cover",
"maxCount": 20
}
Expand All @@ -764,7 +771,7 @@
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",
"previewSize": { "ratio": 1.33, "objectFit": "cover" },
"previewSize": { "ratio": 1.33 },
"placeholder": "Upload Cover"
}
}
Expand All @@ -778,7 +785,7 @@
"filetype": "video",
"accept": ".mp4,.avi,.mov,.wmv",
"maxSize": "5M",
"previewSize": { "width": 420, "height": 180, "objectFit": "cover" }
"previewSize": { "width": 420, "height": 180 }
}
}
},
Expand Down Expand Up @@ -809,7 +816,7 @@
"filetype": "video",
"accept": ".mp4,.avi,.mov,.wmv",
"maxSize": "5M",
"previewSize": { "ratio": 2.33, "objectFit": "cover" }
"previewSize": { "ratio": 2.33 }
}
}
},
Expand Down Expand Up @@ -979,6 +986,11 @@
"$api": { "process": "scripts.upload.ErrorChunkResponse" }
}
}
},

"Upload Group": {
"bind": "upload_group",
"edit": { "type": "List", "props": { "name": "upload" } }
}
}
}
Expand Down
154 changes: 154 additions & 0 deletions lists/upload.list.yao
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"name": "Upload Group",
"action": {},
"layout": {
"list": {
"columns": [
{ "name": "Image", "width": 24 },
{ "name": "Image Multiple", "width": 24 },
{ "name": "Audio", "width": 24 },
{ "name": "Audio Multiple", "width": 24 },
{ "name": "Video", "width": 24 },
{ "name": "Video Multiple", "width": 24 },
{ "name": "File", "width": 24 },
{ "name": "File Multiple", "width": 24 },
{ "name": "Preview URL", "width": 24 }
],
"props": { "placeholder": "Add Upload Group" }
}
},
"fields": {
"list": {
"Image": {
"bind": "image",
"edit": {
"type": "Upload",
"props": {
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",
"placeholder": "Upload Image"
}
}
},
"Image Multiple": {
"bind": "image_multiple",
"edit": {
"type": "Upload",
"props": {
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",
"previewSize": { "width": 210, "height": 90 },
"maxCount": 3,
"placeholder": "Upload Multiple"
}
}
},

"Audio": {
"bind": "audio",
"edit": {
"type": "Upload",
"props": {
"filetype": "audio",
"accept": ".mp3,.wav,.ogg",
"maxSize": "5M",
"previewSize": { "width": 300 },
"placeholder": "Upload Audio"
}
}
},

"Audio Multiple": {
"bind": "audio_multiple",
"edit": {
"type": "Upload",
"props": {
"filetype": "audio",
"accept": ".mp3,.wav,.ogg",
"maxSize": "5M",
"maxCount": 3,
"placeholder": "Upload Multiple"
}
}
},

"Video": {
"bind": "video",
"edit": {
"type": "Upload",
"props": {
"filetype": "video",
"accept": ".mp4,.avi,.mov,.wmv",
"maxSize": "5M",
"placeholder": "Upload Video"
}
}
},
"Video Multiple": {
"bind": "video_multiple",
"edit": {
"type": "Upload",
"props": {
"filetype": "video",
"accept": ".mp4,.avi,.mov,.wmv",
"maxSize": "5M",
"maxCount": 3,
"previewSize": { "ratio": 2.33 },
"placeholder": "Upload Multiple"
}
}
},

"File": {
"bind": "file",
"edit": {
"type": "Upload",
"props": {
"filetype": "file",
"accept": ".doc,.docx,.pdf,.xls,.xlsx,.ppt,.pptx",
"maxSize": "5M",
"placeholder": "Upload File"
}
}
},

"File Multiple": {
"bind": "file_multiple",
"edit": {
"type": "Upload",
"props": {
"filetype": "file",
"accept": ".doc,.docx,.pdf,.xls,.xlsx,.ppt,.pptx",
"maxSize": "5M",
"maxCount": 3,
"placeholder": "Upload Multiple"
}
}
},

"Preview URL": {
"bind": "preview_url",
"edit": {
"type": "Upload",
"props": {
"filetype": "image",
"accept": ".jpg,.jpeg,.png,.gif,.webp",
"maxSize": "5M",

// [[ $PATH ]] is the file path,
// [[ $TOKEN ]] is the admin panel user token
// [[ $EXT ]] is the file extension
// [[ $NAME ]] is the file name
// [[ $BASE ]] is the file base name
// [[ $<key> ]] the rest of the key returned by the upload API
"previewURL": "/assets/upload/images[[ $PATH ]]?additional=[[ $additional ]]",
"$api": { "process": "scripts.upload.ImageToPublic" },
"placeholder": "Upload Preview"
}
}
}
}
}
}

0 comments on commit 90a2d9c

Please sign in to comment.