form

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 29 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 LoadFile added in v0.10.3

func LoadFile(root string, file string) error

LoadFile load form dsl by file

func LoadFileSync added in v0.10.3

func LoadFileSync(root string, file string) error

LoadFileSync load form dsl by file

func LoadID

func LoadID(id string, root string) error

LoadID load via id

Types

type ActionDSL

type ActionDSL struct {
	Guard        string          `json:"guard,omitempty"` // the default guard
	Bind         *BindActionDSL  `json:"bind,omitempty"`
	Setting      *action.Process `json:"setting,omitempty"`
	Component    *action.Process `json:"component,omitempty"`
	Upload       *action.Process `json:"upload,omitempty"`
	Download     *action.Process `json:"download,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 *model.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
	*mapping.Mapping
}

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) Actions added in v0.10.3

func (dsl *DSL) Actions() []component.ActionsExport

Actions get the form actions

func (*DSL) Bind

func (dsl *DSL) Bind() error

Bind model / store / table / ...

func (*DSL) Validate

func (dsl *DSL) Validate() error

Validate table

func (*DSL) Xgen

func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (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 *model.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"`
	Actions component.Actions      `json:"actions,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 *model.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) Clone added in v0.10.3

func (layout *LayoutDSL) Clone() (*LayoutDSL, error)

Clone layout for output

func (*LayoutDSL) Xgen

func (layout *LayoutDSL) Xgen(data map[string]interface{}, excludes map[string]bool, mapping *mapping.Mapping) (*LayoutDSL, error)

Xgen trans to Xgen setting

type SectionDSL

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

SectionDSL layout.form.sections[*]

func (SectionDSL) Filter added in v0.10.3

func (section SectionDSL) Filter(excludes map[string]bool, mapping *mapping.Mapping) (SectionDSL, error)

Filter exclude filter

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