Merge pull request #221 from trheyi/main

[fix] compute props bug
This commit is contained in:
Max 2022-10-22 11:03:02 +08:00 committed by GitHub
commit 9be7c25998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import (
"strings" "strings"
"github.com/yaoapp/gou" "github.com/yaoapp/gou"
"github.com/yaoapp/kun/any"
"github.com/yaoapp/kun/maps" "github.com/yaoapp/kun/maps"
) )
@ -147,8 +148,7 @@ func (dsl *DSL) computeViewRow(name string, process *gou.Process, res map[string
c := computes[0] c := computes[0]
field := dsl.Fields.Table[c.name] field := dsl.Fields.Table[c.name]
data.Set("value", res[key]) data.Set("value", res[key])
data.Set("type", field.View.Type) data.Merge(any.MapOf(field.View.Map()).MapStrAny.Dot())
data.Set("props", field.View.Props)
new, err := field.View.Compute.Value(data, process.Sid, process.Global) new, err := field.View.Compute.Value(data, process.Sid, process.Global)
if err != nil { if err != nil {
res[key] = nil res[key] = nil
@ -224,8 +224,7 @@ func (dsl *DSL) computeEditRow(name string, process *gou.Process, res map[string
c := computes[0] c := computes[0]
field := dsl.Fields.Table[c.name] field := dsl.Fields.Table[c.name]
data.Set("value", res[key]) data.Set("value", res[key])
data.Set("type", field.Edit.Type) data.Merge(any.MapOf(field.Edit.Map()).MapStrAny.Dot())
data.Set("props", field.Edit.Props)
new, err := field.Edit.Compute.Value(data, process.Sid, process.Global) new, err := field.Edit.Compute.Value(data, process.Sid, process.Global)
if err != nil { if err != nil {
messages = append(messages, fmt.Sprintf("fields.table.%s bind: %s, value: %v error: %s", c.name, key, res[key], err.Error())) messages = append(messages, fmt.Sprintf("fields.table.%s bind: %s, value: %v error: %s", c.name, key, res[key], err.Error()))