component

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopyWithoutPrimitivePointer

func DeepCopyWithoutPrimitivePointer[T Component](src T, dst T)

DeepCopyWithoutPrimitivePointer is a deep copy function for component But limitations of gob package, it can't copy primitive pointer Example: copy to {min *int = &0} will be {min *int = nil} Cause golang assume {*int=&0} >= 0 means default value => pointer's default value is nil => nil Thus we need to use DeepCopyWithoutPrimitivePointer carefully

Types

type Array

type Array struct {
	BaseComponent `json:",inline"`
	Min           *int `json:"min,omitempty"`
	Max           *int `json:"max,omitempty"`
	Form          Form `json:"form"`
}

func NewArray

func NewArray(base BaseComponentOptions) *Array

func (*Array) DeepCopy

func (c *Array) DeepCopy() Component

type BaseComponent

type BaseComponent struct {
	Component string `json:"component"`

	PropertyName string `json:"propertyName"`

	Label string `json:"label"`

	Placeholder string `json:"placeholder"`

	Required bool `json:"required"`

	State string `json:"state,omitempty"`

	DefaultValue any `json:"defaultValue,omitempty"`

	Messages []Message `json:"messages,omitempty"`

	// Width of component conflict with grid
	Width string `json:"width,omitempty"`
	// Grid of component conflict with width
	Grid *Grid `json:"grid,omitempty"`

	/**
	 * Not useful options
	 */
	// No Message? IDK
	NoMsg *bool `json:"no-msg,omitempty"`
	// Disable component
	Disabled *bool `json:"disabled,omitempty"`
	// Component is visible or not
	Visible *bool `json:"visible,omitempty"`
	// Cannot modify input form
	Readonly *bool `json:"readonly,omitempty"`
	// No Label? IDK, It doesn't work to my expected
	NoLabel *bool `json:"no-label,omitempty"`
	// No Clear? IDK
	NoClear *bool `json:"no-clear,omitempty"`
}

func NewBaseComponent

func NewBaseComponent(component string, option BaseComponentOptions) BaseComponent

func (*BaseComponent) DeepCopy

func (c *BaseComponent) DeepCopy() Component

func (*BaseComponent) SetPropertyName

func (c *BaseComponent) SetPropertyName(propertyName string)

type BaseComponentOptions

type BaseComponentOptions struct {
	Label        string
	Placeholder  string
	Required     bool
	State        string
	DefaultValue any
	Messages     []Message
	Width        string
	Grid         *Grid
}

type Checkbox

type Checkbox struct {
	BaseComponent `json:",inline"`
}

func NewCheckbox

func NewCheckbox(base BaseComponentOptions) *Checkbox

func (*Checkbox) DeepCopy

func (c *Checkbox) DeepCopy() Component

type CheckboxSet

type CheckboxSet struct {
	BaseComponent `json:",inline"`
	*VenusOptions `json:",inline"`
	Column        bool `json:"column"`
}

func NewCheckboxSet

func NewCheckboxSet(base BaseComponentOptions, options *VenusOptions) *CheckboxSet

func (*CheckboxSet) DeepCopy

func (c *CheckboxSet) DeepCopy() Component

type Component

type Component interface {
	SetPropertyName(propertyName string)
	DeepCopy() Component
	// contains filtered or unexported methods
}

type DateRangePicker

type DateRangePicker struct {
	BaseComponent `json:",inline"`
}

func NewDateRangePicker

func NewDateRangePicker(base BaseComponentOptions) *DateRangePicker

func (*DateRangePicker) DeepCopy

func (c *DateRangePicker) DeepCopy() Component

type DateTimePicker

type DateTimePicker struct {
	BaseComponent `json:",inline"`
}

func NewDateTimePicker

func NewDateTimePicker(base BaseComponentOptions) *DateTimePicker

func (*DateTimePicker) DeepCopy

func (c *DateTimePicker) DeepCopy() Component

type Form

type Form [][]Component

func (Form) DeepCopy

func (f Form) DeepCopy() Form

type Grid

type Grid struct {
	Sm       *int `json:"sm,omitempty"`
	Md       *int `json:"md,omitempty"`
	Lg       *int `json:"lg,omitempty"`
	SmOffset *int `json:"smOffset,omitempty"`
	MdOffset *int `json:"mdOffset,omitempty"`
	LgOffset *int `json:"lgOffset,omitempty"`
	Order    *int `json:"order,omitempty"`
}

func (*Grid) DeepCopy

func (g *Grid) DeepCopy() *Grid

type Input

type Input struct {
	BaseComponent `json:",inline"`
	// text or number
	Type string `json:"type,omitempty"`
	// When type is text, min length of input text
	// When type is number, min value of input number
	Min *int `json:"min,omitempty"`
	// When type is text, max length of input text
	// When type is number, max value of input number
	Max *int `json:"max,omitempty"`

	Regex string `json:"regex,omitempty"`
}

func NewInput

func NewInput(base BaseComponentOptions) *Input

func (*Input) DeepCopy

func (c *Input) DeepCopy() Component

type JsonEditor

type JsonEditor struct {
	BaseComponent `json:",inline"`

	// Example: 400px
	Height string `json:"height,omitempty"`
}

func NewJsonEditor

func NewJsonEditor(base BaseComponentOptions) *JsonEditor

func (*JsonEditor) DeepCopy

func (c *JsonEditor) DeepCopy() Component

type LabeledOption

type LabeledOption struct {
	Value any    `json:"value"`
	Label string `json:"label"`
}

LabeledOption Start

type LabeledOptions

type LabeledOptions []LabeledOption

func (LabeledOptions) DeepCopy

func (o LabeledOptions) DeepCopy() VenusOptionsOptions

type Map

type Map struct {
	BaseComponent `json:",inline"`

	Key    Component `json:"key"`
	Values Form      `json:"values"`
}

func NewMap

func NewMap(base BaseComponentOptions) *Map

func (*Map) DeepCopy

func (c *Map) DeepCopy() Component

type Message

type Message struct {
	State string `json:"state"`
	Text  string `json:"text"`
}

func (Message) DeepCopy

func (m Message) DeepCopy() Message

type MultiString

type MultiString struct {
	BaseComponent `json:",inline"`
	// Delimeter
	Delimeter string `json:"delimeter"`
	// Value max length
	Max *int `json:"max"`
	// Hide chips
	NoChips bool `json:"no-chips"`
	// Show copy button
	Copy bool `json:"copy"`
}

func NewMultiString

func NewMultiString(base BaseComponentOptions) *MultiString

func (*MultiString) DeepCopy

func (c *MultiString) DeepCopy() Component

type OneOf

type OneOf struct {
	BaseComponent `json:",inline"`
	Forms         OneOfForms `json:"form"`
}

func NewOneOf

func NewOneOf(base BaseComponentOptions, forms OneOfForms) *OneOf

func (*OneOf) DeepCopy

func (c *OneOf) DeepCopy() Component

type OneOfForm

type OneOfForm struct {
	Label string `json:"label"`
	Key   string `json:"key"`
	Form  Form   `json:"settings"`
}

type OneOfForms

type OneOfForms []OneOfForm

type Radio

type Radio struct {
	BaseComponent `json:",inline"`
	RadioLabel    string `json:"radio-label"`
	Name          string `json:"name"`
	Option        any    `json:"option"`
}

func NewRadio

func NewRadio(base BaseComponentOptions, name string) *Radio

func (*Radio) DeepCopy

func (c *Radio) DeepCopy() Component

type RadioSet

type RadioSet struct {
	BaseComponent `json:",inline"`
	*VenusOptions `json:",inline"`
	Column        bool `json:"column"`
}

func NewRadioSet

func NewRadioSet(base BaseComponentOptions, options *VenusOptions) *RadioSet

func (*RadioSet) DeepCopy

func (c *RadioSet) DeepCopy() Component

type Select

type Select struct {
	BaseComponent `json:",inline"`
	*VenusOptions `json:",inline"`
	// Apply autocomplete
	Autocomplete bool `json:"autocomplete"`
	// Can choose multiple options
	Multiple bool `json:"multiple"`
	// Can choose multiple options
	SelectAll bool `json:"select-all"`
	// Express chips briefly
	CollapseChips bool `json:"collapse-chips"`
	// Can erase chip(s)
	ClosableChips bool `json:"closable-chips"`
	// Change infinite load count
	InfiniteLoad *int `json:"infinite-load,omitempty"`
}

func NewSelect

func NewSelect(base BaseComponentOptions, options *VenusOptions) *Select

func (*Select) DeepCopy

func (c *Select) DeepCopy() Component

type SimpleOptions

type SimpleOptions []string

SimpleOptions Start

func (SimpleOptions) DeepCopy

func (o SimpleOptions) DeepCopy() VenusOptionsOptions

type Switch

type Switch struct {
	BaseComponent `json:",inline"`
}

func NewSwitch

func NewSwitch(base BaseComponentOptions) *Switch

func (*Switch) DeepCopy

func (c *Switch) DeepCopy() Component

type Table

type Table struct {
	BaseComponent `json:",inline"`

	Key    Component   `json:"key"`
	Values []Component `json:"values"`
}

func NewTable

func NewTable(base BaseComponentOptions) *Table

func (*Table) DeepCopy

func (c *Table) DeepCopy() Component

type TextArea

type TextArea struct {
	BaseComponent `json:",inline"`
	Min           *int   `json:"min,omitempty"`
	Max           *int   `json:"max,omitempty"`
	Regex         string `json:"regex,omitempty"`
}

func NewTextArea

func NewTextArea(base BaseComponentOptions) *TextArea

func (*TextArea) DeepCopy

func (c *TextArea) DeepCopy() Component

type VenusOptions

type VenusOptions struct {
	Options     VenusOptionsOptions `json:"options,omitempty"`
	OptionLabel string              `json:"option-label,omitempty"`
	OptionValue string              `json:"option-value,omitempty"`
}

func NewVenusOptions

func NewVenusOptions() *VenusOptions

func (*VenusOptions) DeepCopy

func (o *VenusOptions) DeepCopy() *VenusOptions

func (*VenusOptions) SetLabeledOptions

func (o *VenusOptions) SetLabeledOptions(options LabeledOptions)

func (*VenusOptions) SetSimpleOptions

func (o *VenusOptions) SetSimpleOptions(options SimpleOptions)

type VenusOptionsOptions

type VenusOptionsOptions interface {
	DeepCopy() VenusOptionsOptions
	// contains filtered or unexported methods
}

VenusOptionsOptions Start

Jump to

Keyboard shortcuts

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