yao/widgets/component/types.go
2022-12-03 23:33:05 +08:00

82 lines
2.2 KiB
Go

package component
// DSL the component DSL
type DSL struct {
Bind string `json:"bind,omitempty"`
Type string `json:"type,omitempty"`
Compute *Compute `json:"compute,omitempty"`
Props PropsDSL `json:"props,omitempty"`
}
// Actions the actions
type Actions []ActionDSL
// Instances the Instances
type Instances []InstanceDSL
// InstanceDSL the component instance DSL
type InstanceDSL struct {
Name string `json:"name,omitempty"`
Width interface{} `json:"width,omitempty"`
Height interface{} `json:"height,omitempty"`
}
// ActionsExport the export actions
type ActionsExport struct {
Type string `json:"type,omitempty"`
Xpath string `json:"xpath"`
Actions Actions `json:"actions,omitempty"`
}
// ActionDSL the component action DSL
type ActionDSL struct {
Title string `json:"title,omitempty"`
Width int `json:"width,omitempty"`
Icon string `json:"icon,omitempty"`
Style string `json:"style,omitempty"`
ID string `json:"id,omitempty"`
Xpath string `json:"xpath,omitempty"`
Props PropsDSL `json:"props,omitempty"`
Confirm *ConfirmActionDSL `json:"confirm,omitempty"`
Action map[string]ParamsDSL `json:"action,omitempty"`
}
// ConfirmActionDSL action.confirm
type ConfirmActionDSL struct {
Title string `json:"title,omitempty"`
Desc string `json:"desc,omitempty"`
}
// PropsDSL component props
type PropsDSL map[string]interface{}
// ParamsDSL action params
type ParamsDSL map[string]interface{}
// Compute process
type Compute struct {
Process string `json:"process"`
Args []CArg `json:"args,omitempty"`
}
// computeAlias for JSON UnmarshalJSON
type computeAlias Compute
// CArg compute interface{}
type CArg struct {
IsExp bool
key string
value interface{}
}
// ComputeHanlder computeHanlder
type ComputeHanlder func(args ...interface{}) (interface{}, error)
// CloudPropsDSL the cloud props
type CloudPropsDSL struct {
Xpath string `json:"xpath,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Process string `json:"process,omitempty"`
Query map[string]interface{} `json:"query,omitempty"`
}