form

package
v0.10.2-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Forms map[string]*DSL = map[string]*DSL{}

Forms the loaded form widgets

Functions

func Export

func Export() error

Export process & api

func Guard

func Guard(c *gin.Context)

Guard form widget guard

func Load

func Load(cfg config.Config) error

Load load task

func LoadAndExport

func LoadAndExport(cfg config.Config) error

LoadAndExport load table

func LoadData

func LoadData(data []byte, id string, root string) error

LoadData load via data

func LoadFrom

func LoadFrom(dir string, prefix string) error

LoadFrom load from dir

func LoadID

func LoadID(id string, root string) error

LoadID load via id

Types

type ActionDSL

type ActionDSL struct {
	Bind         *BindActionDSL  `json:"bind,omitempty"`
	Setting      *action.Process `json:"setting,omitempty"`
	Component    *action.Process `json:"component,omitempty"`
	Find         *action.Process `json:"find,omitempty"`
	Save         *action.Process `json:"save,omitempty"`
	Update       *action.Process `json:"update,omitempty"`
	Create       *action.Process `json:"create,omitempty"`
	Delete       *action.Process `json:"delete,omitempty"`
	BeforeFind   *hook.Before    `json:"before:find,omitempty"`
	AfterFind    *hook.After     `json:"after:find,omitempty"`
	BeforeSave   *hook.Before    `json:"before:save,omitempty"`
	AfterSave    *hook.After     `json:"after:save,omitempty"`
	BeforeCreate *hook.Before    `json:"before:create,omitempty"`
	AfterCreate  *hook.After     `json:"after:create,omitempty"`
	BeforeDelete *hook.Before    `json:"before:delete,omitempty"`
	AfterDelete  *hook.After     `json:"after:delete,omitempty"`
	BeforeUpdate *hook.Before    `json:"before:update,omitempty"`
	AfterUpdate  *hook.After     `json:"after:update,omitempty"`
}

ActionDSL the form action DSL

func (*ActionDSL) BindForm

func (act *ActionDSL) BindForm(form *DSL) error

BindForm bind form

func (*ActionDSL) BindModel

func (act *ActionDSL) BindModel(m *gou.Model)

BindModel bind model

func (*ActionDSL) BindTable

func (act *ActionDSL) BindTable(tab *table.DSL) error

BindTable bind table

func (*ActionDSL) SetDefaultProcess

func (act *ActionDSL) SetDefaultProcess()

SetDefaultProcess set the default value of action

type BindActionDSL

type BindActionDSL struct {
	Model  string                 `json:"model,omitempty"`  // bind model
	Store  string                 `json:"store,omitempty"`  // bind store
	Table  string                 `json:"table,omitempty"`  // bind table
	Form   string                 `json:"form,omitempty"`   // bind form
	Option map[string]interface{} `json:"option,omitempty"` // bind option
}

BindActionDSL action.bind

type Column

type Column struct {
	Tabs []SectionDSL `json:"tabs,omitempty"`
	component.InstanceDSL
}

Column table columns

type DSL

type DSL struct {
	ID     string                 `json:"id,omitempty"`
	Root   string                 `json:"-"`
	Name   string                 `json:"name,omitempty"`
	Action *ActionDSL             `json:"action"`
	Layout *LayoutDSL             `json:"layout"`
	Fields *FieldsDSL             `json:"fields"`
	Config map[string]interface{} `json:"config,omitempty"`
	CProps field.CloudProps       `json:"-"`
	compute.Computable
}

DSL the form DSL

func Get

func Get(form interface{}) (*DSL, error)

Get form via process or id

func MustGet

func MustGet(form interface{}) *DSL

MustGet Get form via process or id thow error

func New

func New(id string) *DSL

New create a new DSL

func (*DSL) Bind

func (dsl *DSL) Bind() error

Bind model / store / table / ...

func (*DSL) Parse

func (dsl *DSL) Parse() error

Parse Layout

func (*DSL) Validate

func (dsl *DSL) Validate() error

Validate table

func (*DSL) Xgen

func (dsl *DSL) Xgen() (map[string]interface{}, error)

Xgen trans to xgen setting

type FieldsDSL

type FieldsDSL struct {
	Form field.Columns `json:"form,omitempty"`
	// contains filtered or unexported fields
}

FieldsDSL the form fields DSL

func (*FieldsDSL) BindForm

func (fields *FieldsDSL) BindForm(form *DSL) error

BindForm bind form

func (*FieldsDSL) BindModel

func (fields *FieldsDSL) BindModel(m *gou.Model) error

BindModel bind model

func (*FieldsDSL) BindTable

func (fields *FieldsDSL) BindTable(tab *table.DSL) error

BindTable bind table

func (*FieldsDSL) Xgen

func (fields *FieldsDSL) Xgen(layout *LayoutDSL) (map[string]interface{}, error)

Xgen trans to xgen setting

type LayoutDSL

type LayoutDSL struct {
	Primary   string                 `json:"primary,omitempty"`
	Operation *OperationLayoutDSL    `json:"operation,omitempty"`
	Form      *ViewLayoutDSL         `json:"form,omitempty"`
	Config    map[string]interface{} `json:"config,omitempty"`
}

LayoutDSL the form layout DSL

func (*LayoutDSL) BindForm

func (layout *LayoutDSL) BindForm(form *DSL, fields *FieldsDSL) error

BindForm bind form

func (*LayoutDSL) BindModel

func (layout *LayoutDSL) BindModel(m *gou.Model, formID string, fields *FieldsDSL, option map[string]interface{})

BindModel bind model

func (*LayoutDSL) BindTable

func (layout *LayoutDSL) BindTable(tab *table.DSL, formID string, fields *FieldsDSL) error

BindTable bind table

func (*LayoutDSL) Xgen

func (layout *LayoutDSL) Xgen() (map[string]interface{}, error)

Xgen trans to Xgen setting

type OperationLayoutDSL

type OperationLayoutDSL struct {
	Preset  map[string]map[string]interface{} `json:"preset,omitempty"`
	Actions []component.ActionDSL             `json:"actions,omitempty"`
}

OperationLayoutDSL layout.operation

type SectionDSL

type SectionDSL struct {
	Title   string   `json:"title,omitempty"`
	Desc    string   `json:"desc,omitempty"`
	Columns []Column `json:"columns,omitempty"`
}

SectionDSL layout.form.sections[*]

type ViewLayoutDSL

type ViewLayoutDSL struct {
	Props    component.PropsDSL `json:"props,omitempty"`
	Sections []SectionDSL       `json:"sections,omitempty"`
}

ViewLayoutDSL layout.form

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL