Optimize upload component

This commit is contained in:
Max 2024-10-26 20:26:21 +08:00
parent c7b83a161c
commit 661c3e6a9f
3 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,7 @@ func (dsl DSL) Map() map[string]interface{} {
}
// Add Default Value for Upload api
if dsl.Type == "Upload" && dsl.Props != nil && !dsl.Props.Has("api") {
if (dsl.Type == "Upload" || dsl.Type == "Image") && dsl.Props != nil && !dsl.Props.Has("api") {
res["props"].(map[string]interface{})["$api"] = map[string]interface{}{"process": "fs.data.Upload"}
}

View file

@ -164,7 +164,7 @@ func processComponent(process *gouProcess.Process) interface{} {
// :query
query := map[string]interface{}{}
if process.NumOfArgsIs(4) {
query = process.ArgsMap(3)
query = process.ArgsMap(3, map[string]interface{}{})
}
// execute query

View file

@ -344,7 +344,7 @@ func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map
for _, cProp := range dsl.CProps {
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
if cProp.Type == "Upload" || cProp.Type == "WangEditor" {
if cProp.Type == "Upload" || cProp.Type == "WangEditor" || cProp.Type == "Image" {
return fmt.Sprintf("/api/__yao/table/%s%s", dsl.ID, cProp.UploadPath())
}