yao/widgets/component/types.go
2022-12-10 16:43:30 +08:00

89 lines
2.3 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"`
}
type aliasActionDSL ActionDSL
// ActionDSL the component action DSL
type ActionDSL struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Width int `json:"width,omitempty"`
Icon string `json:"icon,omitempty"`
Style string `json:"style,omitempty"`
Xpath string `json:"xpath,omitempty"`
Props PropsDSL `json:"props,omitempty"`
Confirm *ConfirmActionDSL `json:"confirm,omitempty"`
Action ActionNodes `json:"action,omitempty"`
}
type aliasActionNodes []ActionNode
// ActionNodes the action nodes
type ActionNodes []ActionNode
// ActionNode the action node
type ActionNode map[string]interface{}
// ConfirmActionDSL action.confirm
type ConfirmActionDSL struct {
Title string `json:"title,omitempty"`
Desc string `json:"desc,omitempty"`
}
// PropsDSL component props
type PropsDSL 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"`
}