control

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ButtonStylePrimary   ButtonStyle = "btn-primary"
	ButtonStyleSecondary             = "btn-secondary"
	ButtonStyleSuccess               = "btn-success"
	ButtonStyleInfo                  = "btn-info"
	ButtonStyleWarning               = "btn-warning"
	ButtonStyleDanger                = "btn-danger"
	ButtonStyleLight                 = "btn-light"
	ButtonStyleDark                  = "btn-dark"
	ButtonStyleLink                  = "btn-link"

	ButtonStyleOutlinePrimary   = "btn-outline-primary"
	ButtonStyleOutlineSecondary = "btn-outline-secondary"
	ButtonStyleOutlineSuccess   = "btn-outline-success"
	ButtonStyleOutlineInfo      = "btn-outline-info"
	ButtonStyleOutlineWarning   = "btn-outline-warning"
	ButtonStyleOutlineDanger    = "btn-outline-danger"
	ButtonStyleOutlineLight     = "btn-outline-light"
	ButtonStyleOutlineDark      = "btn-outline-dark"
)
View Source
const (
	ButtonSizeLarge  ButtonSize = "btn-lg"
	ButtonSizeMedium            = ""
	ButtonSizeSmall             = "btn-sm"
)
View Source
const (
	Container       ContainerClass = "container"
	ContainerFluid                 = "container-fluid"
	ContainerSmall                 = "container-sm"
	ContainerMedium                = "container-md"
	ContainerLarge                 = "container-lg"
	ContainerXL                    = "container-xl"
	ContainerXXL                   = "container-xxl"
)
View Source
const (
	TextColorPrimary   TextColorClass = "text-primary"
	TextColorSecondary                = "text-secondary"
	TextColorDanger                   = "text-danger"
	TextColorWarning                  = "text-warning"
	TextColorInfo                     = "text-info"
	TextColorLight                    = "text-light"
	TextColorDark                     = "text-dark"
	TextColorBody                     = "text-body"
	TextColorMuted                    = "text-muted"
	TextColorWhite                    = "text-white"
	TextColorWhite50                  = "text-white-50"
	TextColorBlack50                  = "text-black-50"
)
View Source
const (
	BackgroundColorPrimary     BackgroundColorClass = "bg-primary"
	BackgroundColorSecondary                        = "bg-secondary"
	BackgroundColorSuccess                          = "bg-danger"
	BackgroundColorDanger                           = "bg-danger"
	BackgroundColorWarning                          = "bg-warning"
	BackgroundColorInfo                             = "bg-info"
	BackgroundColorLight                            = "bg-light"
	BackgroundColorDark                             = "bg-dark"
	BackgroundColorWhite                            = "bg-white"
	BackgroundColorTransparent                      = "bg-transparent"
	BackgroundColorNone                             = "" // utility to allow custom background colors for components
)
View Source
const (
	NavTabs      = "nav-tabs"
	NavPills     = "nav-pills"
	NavJustified = "nav-justified"

	NavbarHeader   = "navbar-header"
	NavbarCollapse = "navbar-collapse"
	NavbarBrand    = "navbar-brand"
	NavbarToggle   = "navbar-toggle"
	NavbarNav      = "navbar-nav"
	NavbarLeft     = "navbar-left"
	NavbarRight    = "navbar-right"
	NavbarForm     = "navbar-form"
)
View Source
const (
	NavbarExpandExtraLarge NavbarExpandClass = "navbar-expand-xl"
	NavbarExpandLarge                        = "navbar-expand-lg"
	NavbarExpandMedium                       = "navbar-expand-md"
	NavbarExpandSmall                        = "navbar-expand-sm"
	// NavbarExpandNone will always show the navbar as collapsed at any size
	NavbarExpandNone = ""
)
View Source
const ButtonBlock = "btn-block"

ButtonBlock is a class you can add to a button to make it span a full block

View Source
const ButtonClass = "btn"
View Source
const (
	DialogClosed = iota + 10000
)

event codes

View Source
const DropdownSelect = "gr-bs-dropdownselect"
View Source
const NavbarSelect = "gr-bs-navbarselect"

Variables

This section is empty.

Functions

func DropdownSelectEvent() *event.Event
func NavbarSelectEvent() *event.Event

Types

type BackgroundColorClass

type BackgroundColorClass string

type Button

type Button struct {
	grctl.Button
	// contains filtered or unexported fields
}

func GetButton added in v0.2.4

func GetButton(c page.ControlI, id string) *Button

GetButton is a convenience method to return the button with the given id from the page.

func NewButton

func NewButton(parent page.ControlI, id string) *Button

NewButton creates a new bootstrap html button

func (*Button) Deserialize

func (b *Button) Deserialize(d page.Decoder)

Deserialize reconstructs the control from the page state.

func (*Button) DrawingAttributes

func (b *Button) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes returns the attributes to add to the tag just before the button is drawn.

func (*Button) Init

func (b *Button) Init(parent page.ControlI, id string)

Init initializes the button

func (*Button) Serialize

func (b *Button) Serialize(e page.Encoder)

Serialize serializes the state of the control for the pagestate

func (*Button) SetButtonSize

func (b *Button) SetButtonSize(size ButtonSize) ButtonI

SetButtonSize sets the size class of the button.

func (*Button) SetButtonStyle

func (b *Button) SetButtonStyle(style ButtonStyle) ButtonI

SetButtonStyle will set the button's style to one of the predefined bootstrap styles.

func (*Button) SetIsPrimary

func (b *Button) SetIsPrimary(isPrimary bool) grctl.ButtonI

SetIsPrimary determines whether the button is styled as a primary or secondary button.

type ButtonCreator added in v0.2.0

type ButtonCreator struct {
	// ID is the control id
	ID string
	// Text is the text displayed in the button
	Text string
	// OnSubmit is the action to take when the button is submitted. Use this specifically
	// for buttons that move to other pages or processes transactions, as it debounces the button
	// and waits until all other actions complete
	OnSubmit action.ActionI
	// OnClick is an action to take when the button is pressed. Do not specify both
	// a OnSubmit and OnClick.
	OnClick        action.ActionI
	Style          ButtonStyle
	Size           ButtonSize
	IsPrimary      bool
	ValidationType event.ValidationType
	page.ControlOptions
}

ButtonCreator is the initialization structure for the declarative creation of the control.

func (ButtonCreator) Create added in v0.2.0

func (c ButtonCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (ButtonCreator) Init added in v0.2.0

func (c ButtonCreator) Init(ctx context.Context, ctrl ButtonI)

Init is called by implementations of Buttons to initialize a control with the creator. You do not normally need to call this.

type ButtonI

type ButtonI interface {
	grctl.ButtonI
	SetButtonStyle(style ButtonStyle) ButtonI
	SetButtonSize(size ButtonSize) ButtonI
}

type ButtonSize

type ButtonSize string

type ButtonStyle

type ButtonStyle string

type Checkbox

type Checkbox struct {
	control.Checkbox
	// contains filtered or unexported fields
}

func GetCheckbox added in v0.2.0

func GetCheckbox(c page.ControlI, id string) *Checkbox

GetCheckbox is a convenience method to return the checkbox with the given id from the page.

func NewCheckbox

func NewCheckbox(parent page.ControlI, id string) *Checkbox

func (*Checkbox) Deserialize

func (c *Checkbox) Deserialize(d page.Decoder)

func (*Checkbox) DrawTag

func (c *Checkbox) DrawTag(ctx context.Context, w io.Writer)

func (*Checkbox) DrawingAttributes

func (c *Checkbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*Checkbox) GetDrawingLabelAttributes added in v0.4.0

func (c *Checkbox) GetDrawingLabelAttributes() html5tag.Attributes

func (*Checkbox) Serialize

func (c *Checkbox) Serialize(e page.Encoder)

func (*Checkbox) SetInline added in v0.0.4

func (c *Checkbox) SetInline(v bool) *Checkbox

type CheckboxCreator added in v0.2.0

type CheckboxCreator struct {
	// ID is the id of the control
	ID string
	// Text is the text of the label displayed right next to the checkbox.
	Text string
	// Checked will initialize the checkbox in its checked state.
	Checked bool
	// LabelMode specifies how the label is drawn with the checkbox.
	LabelMode html5tag.LabelDrawingMode
	// LabelAttributes are additional attributes placed on the label tag.
	LabelAttributes html5tag.Attributes
	// SaveState will save the value of the checkbox and restore it when the page is reentered.
	SaveState bool
	// Set inline when drawing this checkbox inline or wrapped by an inline FormGroup
	Inline bool
	page.ControlOptions
}

func (CheckboxCreator) Create added in v0.2.0

func (c CheckboxCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

type CheckboxList

type CheckboxList struct {
	control.CheckboxList
	// contains filtered or unexported fields
}

CheckboxList is a multi-select control that presents its choices as a list of checkboxes. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-table table, or a single-table scrolling list much like a standard html select list.

func GetCheckboxList added in v0.2.0

func GetCheckboxList(c page.ControlI, id string) *CheckboxList

GetCheckboxList is a convenience method to return the control with the given id from the page.

func NewCheckboxList

func NewCheckboxList(parent page.ControlI, id string) *CheckboxList

func (*CheckboxList) Deserialize added in v0.9.3

func (l *CheckboxList) Deserialize(d page.Decoder)

func (*CheckboxList) DrawingAttributes

func (l *CheckboxList) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.

func (*CheckboxList) Init

func (l *CheckboxList) Init(parent page.ControlI, id string)

func (*CheckboxList) RenderItem added in v0.4.0

func (l *CheckboxList) RenderItem(item *control.ListItem) (h string)

RenderItem is called by the framework to render a single item in the list.

func (*CheckboxList) Serialize added in v0.9.3

func (l *CheckboxList) Serialize(e page.Encoder)

func (*CheckboxList) SetCellClass added in v0.2.0

func (l *CheckboxList) SetCellClass(c string)

SetCellClass sets a string that is applied to every cell. This is useful for setting responsive breakpoints

func (*CheckboxList) SetIsInline

func (l *CheckboxList) SetIsInline(i bool)

type CheckboxListCreator added in v0.2.0

type CheckboxListCreator struct {
	ID string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	// ColumnCount specifies how many columns to show
	ColumnCount int
	// LayoutDirection determines how the items are arranged in the columns
	LayoutDirection control.LayoutDirection
	// LabelDrawingMode specifies how the labels on the radio buttons will be associated with the buttons
	LabelDrawingMode html5tag.LabelDrawingMode
	// IsScrolling will give the inner div a vertical scroll style. You will need to style the height of the outer control to have a fixed style as well.
	IsScrolling bool
	// RowClass is the class assigned to each row
	RowClass string
	// Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Value string
	// SaveState saves the selected value so that it is restored if the form is returned to.
	SaveState bool
	page.ControlOptions
}

func (CheckboxListCreator) Create added in v0.2.0

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (CheckboxListCreator) Init added in v0.2.0

type CheckboxListI

type CheckboxListI interface {
	control.CheckboxListI
}

type ContainerClass

type ContainerClass string

type DataPager

type DataPager struct {
	control.DataPager
	ButtonStyle    ButtonStyle
	HighlightStyle ButtonStyle
}

DataPager is a toolbar designed to aid scrolling through a large set of data. It is implemented using Aria design best practices. It is designed to be paired with a Table or DataRepeater to aid in navigating through the data. It is similar to a Paginator, but a paginator is for navigating through a whole series of pages and not just for data on one override.

func NewDataPager

func NewDataPager(parent page.ControlI, id string, pagedControl control.PagedControlI) *DataPager

func (*DataPager) Deserialize

func (d *DataPager) Deserialize(dec page.Decoder)

func (*DataPager) DrawingAttributes

func (d *DataPager) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*DataPager) Init

func (d *DataPager) Init(parent page.ControlI, id string, pagedControl control.PagedControlI)

func (*DataPager) NextButtonsHtml

func (d *DataPager) NextButtonsHtml() string

func (*DataPager) PageButtonsHtml

func (d *DataPager) PageButtonsHtml(i int) string

func (*DataPager) PreviousButtonsHtml

func (d *DataPager) PreviousButtonsHtml() string

func (*DataPager) Serialize

func (d *DataPager) Serialize(e page.Encoder)

type DataPagerCreator added in v0.2.0

type DataPagerCreator struct {
	// ID is the control id
	ID string
	// MaxPageButtons is the maximum number of page buttons to display in the pager
	MaxPageButtons int
	// ObjectName is the name of the object being displayed in the table
	ObjectName string
	// ObjectPluralName is the plural name of the object being displayed
	ObjectPluralName string
	// LabelForNext is the text to use in the Next button
	LabelForNext string
	// LabelForPrevious is the text to use in the Previous button
	LabelForPrevious string
	// PagedControl is the id of the control that will be paged by the pager
	PagedControl string
	page.ControlOptions
	// ButtonStyle is the style that will be used to draw the standard buttons
	ButtonStyle ButtonStyle
	// HighlightStyle is the style that will be used to draw the highlighted buttons
	HighlightStyle ButtonStyle
}

DataPagerCreator is the initialization structure for declarative creation of data pagers

func (DataPagerCreator) Create added in v0.2.0

func (c DataPagerCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (DataPagerCreator) Init added in v0.2.0

func (c DataPagerCreator) Init(ctx context.Context, ctrl DataPagerI)

Init is called by implementations of Buttons to initialize a control with the creator. You do not normally need to call this.

type DataPagerI

type DataPagerI interface {
	control.DataPagerI
}

type DateTextbox

type DateTextbox struct {
	control.DateTextbox
}

func GetDateTextbox added in v0.2.0

func GetDateTextbox(c page.ControlI, id string) *DateTextbox

GetDateTextbox is a convenience method to return the control with the given id from the page.

func NewDateTextbox

func NewDateTextbox(parent page.ControlI, id string) *DateTextbox

func (*DateTextbox) DrawingAttributes

func (t *DateTextbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type DateTextboxCreator added in v0.2.0

type DateTextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// Text is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Text string
	// Formats is the time.format strings to use to decode the text into a date.
	Formats []string

	page.ControlOptions
}

DateTextboxCreator creates an email textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.

func (DateTextboxCreator) Create added in v0.2.0

func (DateTextboxCreator) Init added in v0.2.0

func (c DateTextboxCreator) Init(ctx context.Context, ctrl DateTextboxI)

type DateTextboxI added in v0.2.0

type DateTextboxI interface {
	control.DateTextboxI
}
type Dropdown struct {
	control.UnorderedList
	// contains filtered or unexported fields
}

A Dropdown implements the Bootstrap Dropdown control. The Dropdown is a button combined with a list. The button shows the list, allowing the user to select an item from the list.

func GetDropdown added in v0.21.0

func GetDropdown(c page.ControlI, id string) *Dropdown

GetDropdown is a convenience method to return the control with the given id from the page.

func NewDropdown added in v0.21.0

func NewDropdown(parent page.ControlI, id string) *Dropdown
func (l *Dropdown) ButtonAttributes() html5tag.Attributes

ButtonAttributes returns the attributes for the internal button of the dropdown. If you change them, be sure to call Refresh().

func (l *Dropdown) Deserialize(d page.Decoder)

Deserialize reconstructs the control from the page state.

func (l *Dropdown) DrawInnerHtml(_ context.Context, w io.Writer)
func (l *Dropdown) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.

func (l *Dropdown) GetItemsHtml(items []*control.ListItem) string
func (l *Dropdown) Init(parent page.ControlI, id string)
func (l *Dropdown) MenuAttributes() html5tag.Attributes

MenuAttributes returns the attributes for the internal button of the dropdown. If you change them, be sure to call Refresh().

func (l *Dropdown) OnClick(a action.ActionI) DropdownI

OnClick sets the action to take when a link in the Dropdown is selected. It will only respond to links whose href is "#", which indicates its an empty link. The ActionValue will be the id of the link clicked.

func (l *Dropdown) Serialize(e page.Encoder)

Serialize serializes the state of the control for the pagestate

func (l *Dropdown) SetAsNavItem(asNavItem bool) DropdownI
type DropdownCreator struct {
	// ID is the id attribute for the html object and the id for the page control
	ID string
	// Text is the label that will appear in the dropdown button
	Text string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	// AsNavItem determines whether to draw as an item in a navbar, or just a regular button.
	AsNavItem bool
	// ButtonAttributes are additional attributes that will be assigned to the button.
	ButtonAttributes html5tag.Attributes
	// MenuAttributes are additional attributes that will be assigned to the menu.
	MenuAttributes html5tag.Attributes
	// OnClick is the action to take when a link is clicked or selected. It will only respond
	// to anchor tags whose href is set to "#". The EventValue will be the value of the item clicked.
	OnClick action.ActionI
	// ControlOptions are additional settings for the control.
	// If this is part of a Navbar, you should add the "nav-item" class.
	page.ControlOptions
}
func (c DropdownCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (c DropdownCreator) Init(ctx context.Context, ctrl DropdownI)
type DropdownI interface {
	control.UnorderedListI
	SetAsNavItem(bool) DropdownI
	ButtonAttributes() html5tag.Attributes
	MenuAttributes() html5tag.Attributes
	OnClick(action action.ActionI) DropdownI
}

type EmailTextbox

type EmailTextbox struct {
	control.EmailTextbox
}

func GetEmailTextbox added in v0.2.0

func GetEmailTextbox(c page.ControlI, id string) *EmailTextbox

GetEmailTextbox is a convenience method to return the control with the given id from the page.

func NewEmailTextbox

func NewEmailTextbox(parent page.ControlI, id string) *EmailTextbox

func (*EmailTextbox) DrawingAttributes

func (t *EmailTextbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type EmailTextboxCreator added in v0.2.0

type EmailTextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// Text is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Text string
	// MaxItemCount is the maximum number of email addresses allowed to be entered, separated by commas
	// By default it allows only 1.
	MaxItemCount int

	page.ControlOptions
}

EmailTextboxCreator creates an email textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.

func (EmailTextboxCreator) Create added in v0.2.0

func (EmailTextboxCreator) Init added in v0.2.0

type EmailTextboxI added in v0.2.0

type EmailTextboxI interface {
	control.EmailTextboxI
}

type FloatTextbox

type FloatTextbox struct {
	control.FloatTextbox
}

func GetFloatTextbox added in v0.2.0

func GetFloatTextbox(c page.ControlI, id string) *FloatTextbox

GetFloatTextbox is a convenience method to return the control with the given id from the page.

func NewFloatTextbox

func NewFloatTextbox(parent page.ControlI, id string) *FloatTextbox

func (*FloatTextbox) DrawingAttributes

func (t *FloatTextbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type FloatTextboxCreator added in v0.2.0

type FloatTextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// RowCount creates a multi-line textarea with the given number of rows. By default the
	// textbox will expand vertically by this number of lines. Use a height style property for
	// better control of the height of a textbox.
	RowCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// MinValue is the minimum value the user can enter. If the user does not
	// enter at least this amount, or enters something that is not an integer, it will fail validation
	// and the FormFieldWrapper will show an error.
	MinValue *control.FloatLimit
	// MaxValue is the maximum value the user can enter. If the user enter more
	// than this amount, or enters something that is not an integer, it will fail validation
	// and the FormFieldWrapper will show an error.
	MaxValue *control.FloatLimit
	// Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Value interface{}

	page.ControlOptions
}

FloatTextboxCreator creates a textbox that only accepts numbers. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.

func (FloatTextboxCreator) Create added in v0.2.0

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (FloatTextboxCreator) Init added in v0.2.0

Init is called by implementations of Textboxes to initialize a control with the creator. You do not normally need to call this.

type FloatTextboxI added in v0.2.0

type FloatTextboxI interface {
	control.FloatTextboxI
}

type FormFieldset added in v0.2.0

type FormFieldset struct {
	control.Panel
	// contains filtered or unexported fields
}

FormFieldset is a FormGroup kind of wrapper that is specific to using a fieldset as a wrapper. See https://getbootstrap.com/docs/4.3/components/forms/#horizontal-form. You will need to coordinate with whatever you are drawing internally to get the formatting right.

func GetFormFieldset added in v0.2.0

func GetFormFieldset(c page.ControlI, id string) *FormFieldset

GetFormFieldset is a convenience method to return the fieldset with the given id from the page.

func NewFormFieldset added in v0.2.0

func NewFormFieldset(parent page.ControlI, id string) *FormFieldset

func (*FormFieldset) Deserialize added in v0.9.3

func (c *FormFieldset) Deserialize(d page.Decoder)

func (*FormFieldset) DrawInnerHtml added in v0.4.0

func (c *FormFieldset) DrawInnerHtml(ctx context.Context, w io.Writer)

func (*FormFieldset) DrawingAttributes added in v0.4.0

func (c *FormFieldset) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*FormFieldset) Init added in v0.2.0

func (c *FormFieldset) Init(parent page.ControlI, id string)

func (*FormFieldset) InstructionAttributes added in v0.2.0

func (c *FormFieldset) InstructionAttributes() html5tag.Attributes

func (*FormFieldset) LegendAttributes added in v0.2.0

func (c *FormFieldset) LegendAttributes() html5tag.Attributes

func (*FormFieldset) Serialize added in v0.9.3

func (c *FormFieldset) Serialize(e page.Encoder)

func (*FormFieldset) SetAsRow added in v0.2.0

func (c *FormFieldset) SetAsRow(r bool) FormFieldsetI

func (*FormFieldset) SetInstructions added in v0.2.0

func (c *FormFieldset) SetInstructions(instructions string) FormFieldsetI

type FormFieldsetCreator added in v0.2.0

type FormFieldsetCreator struct {
	// ID is the control id on the html form.
	ID string
	// Legend is the text that will be in the html label tag associated with the Child control.
	Legend string
	// Child should be a panel, or a control that draws a group of controls,
	// like a RadioList or CheckboxList
	Child page.Creator
	// LegendAttributes are additional attributes to add to the label tag.
	LegendAttributes html5tag.Attributes
	// Instructions contains help text that accompanies the control
	Instructions string
	// Set AsRow to true to put the legend on the same row as the content
	AsRow bool
	// ControlOptions are additional options for the wrapper tag
	ControlOptions page.ControlOptions
}

FormFieldsetCreator creates a bootstrap fieldset, which wraps a control group with a fieldset. The Child item should be a panel or a control that groups other controls, like a RadioList or CheckboxList

func (FormFieldsetCreator) Create added in v0.2.0

func (FormFieldsetCreator) Init added in v0.2.0

type FormFieldsetI added in v0.2.0

type FormFieldsetI interface {
	control.PanelI
	LegendAttributes() html5tag.Attributes
	SetAsRow(r bool) FormFieldsetI
	SetInstructions(instructions string) FormFieldsetI
}

type FormGroup

type FormGroup struct {
	control.FormFieldWrapper
	// contains filtered or unexported fields
}

FormGroup is a Goradd control that wraps other controls, and provides common companion functionality like a form label, validation state display, and help text.

func GetFormGroup added in v0.2.0

func GetFormGroup(c page.ControlI, id string) *FormGroup

GetFormGroup is a convenience method to return the form group with the given id from the page.

func NewFormGroup added in v0.2.0

func NewFormGroup(parent page.ControlI, id string) *FormGroup

func (*FormGroup) ChildValidationChanged added in v0.2.5

func (c *FormGroup) ChildValidationChanged()

func (*FormGroup) Deserialize added in v0.9.3

func (c *FormGroup) Deserialize(dec page.Decoder)

func (*FormGroup) DrawTag added in v0.4.0

func (c *FormGroup) DrawTag(ctx context.Context, w io.Writer)

func (*FormGroup) DrawingAttributes added in v0.4.0

func (c *FormGroup) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*FormGroup) Init added in v0.2.0

func (c *FormGroup) Init(parent page.ControlI, id string)

func (*FormGroup) InnerDivAttributes added in v0.2.0

func (c *FormGroup) InnerDivAttributes() html5tag.Attributes

func (*FormGroup) Serialize added in v0.9.3

func (c *FormGroup) Serialize(e page.Encoder)

func (*FormGroup) SetUseTooltips added in v0.2.0

func (c *FormGroup) SetUseTooltips(use bool) FormGroupI

SetUseTooltips sets whether to use tooltips to display validation messages.

func (*FormGroup) UseTooltips added in v0.2.0

func (c *FormGroup) UseTooltips() bool

func (*FormGroup) Validate added in v0.2.0

func (c *FormGroup) Validate(ctx context.Context) bool

type FormGroupCreator added in v0.2.0

type FormGroupCreator struct {
	// ID is the optional control id on the html form. If you do not specify this, it
	// will create on for you that is the ID of the child control + "-fg"
	ID string
	// Label is the text that will be in the html label tag associated with the Child control.
	Label string
	// Child is the creator of the child control you want to wrap
	Child page.Creator
	// Instructions contains help text that will follow the control and that further describes its purpose or use.
	Instructions string
	// For specifies the id of the control that the label is for, and that is the control that we are wrapping.
	// You normally do not need to specify this, as it will default to the first child control, but if for some reason
	// that control is wrapped, you should explicitly specify the For control id here.
	For string
	// LabelAttributes are additional attributes to add to the label tag.
	LabelAttributes html5tag.Attributes
	// ErrorAttributes are additional attributes to add to the tag that displays the error.
	ErrorAttributes html5tag.Attributes
	// InstructionAttributes are additional attributes to add to the tag that displays the instructions.
	InstructionAttributes html5tag.Attributes
	// Set IsInline to true to use a "span" instead of a "div" in the wrapping tag.
	IsInline bool
	// ControlOptions are additional options for the wrapper tag
	ControlOptions page.ControlOptions
	// InnerDivAttributes are the attributes for the additional div wrapper of the control
	// To achieve certain effects, Bootstrap needs this addition div. To display the div, you
	// must specify its attributes here. Otherwise, no inner div will be displayed.
	InnerDivAttributes html5tag.Attributes
	// UseTooltips will cause validation errors to be displayed with tooltips, a specific
	// feature of Bootstrap
	UseTooltips bool
}

FormGroupCreator creates a FormGroup, which wraps a control with a div or span that also has a label, validation error text and optional instructions. Pass the creator of the control you are wrapping as the Child item.

func (FormGroupCreator) Create added in v0.2.0

func (f FormGroupCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create the control. You do not normally need to call it.

func (FormGroupCreator) Init added in v0.2.0

func (f FormGroupCreator) Init(ctx context.Context, c FormGroupI)

Init is called by implementations of a FormFieldWrapper to initialize the creator. You do not normally need to call this.

type FormGroupI added in v0.2.0

type FormGroupI interface {
	control.FormFieldWrapperI
	SetUseTooltips(use bool) FormGroupI
	UseTooltips() bool
	InnerDivAttributes() html5tag.Attributes
}

type InputGroup added in v0.12.1

type InputGroup struct {
	grctl.Panel
}

func NewInputGroup added in v0.12.1

func NewInputGroup(parent page.ControlI, id string) *InputGroup

NewInputGroup creates a new input group

func (*InputGroup) Init added in v0.12.1

func (g *InputGroup) Init(parent page.ControlI, id string)

type InputGroupCreator added in v0.12.1

type InputGroupCreator struct {
	// ID is the control id
	ID      string
	Prepend []page.Creator
	Child   page.Creator
	Append  []page.Creator
	page.ControlOptions
}

func (InputGroupCreator) Create added in v0.12.1

func (c InputGroupCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

type InputGroupI added in v0.12.1

type InputGroupI interface {
	grctl.PanelI
}

type IntegerTextbox

type IntegerTextbox struct {
	control.IntegerTextbox
}

func GetIntegerTextbox added in v0.2.0

func GetIntegerTextbox(c page.ControlI, id string) *IntegerTextbox

GetIntegerTextbox is a convenience method to return the control with the given id from the page.

func NewIntegerTextbox

func NewIntegerTextbox(parent page.ControlI, id string) *IntegerTextbox

func (*IntegerTextbox) DrawingAttributes

func (t *IntegerTextbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type IntegerTextboxCreator added in v0.2.0

type IntegerTextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// RowCount creates a multi-line textarea with the given number of rows. By default the
	// textbox will expand vertically by this number of lines. Use a height style property for
	// better control of the height of a textbox.
	RowCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// MinValue is the minimum value the user can enter. If the user does not
	// enter at least this amount, or enters something that is not an integer, it will fail validation
	// and the FormFieldWrapper will show an error.
	MinValue *control.IntegerLimit
	// MaxValue is the maximum value the user can enter. If the user enter more
	// than this amount, or enters something that is not an integer, it will fail validation
	// and the FormFieldWrapper will show an error.
	MaxValue *control.IntegerLimit
	// Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Value interface{}

	page.ControlOptions
}

IntegerTextboxCreator creates an integer textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.

func (IntegerTextboxCreator) Create added in v0.2.0

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (IntegerTextboxCreator) Init added in v0.2.0

Init is called by implementations of Textboxes to initialize a control with the creator. You do not normally need to call this.

type IntegerTextboxI added in v0.2.0

type IntegerTextboxI interface {
	control.IntegerTextboxI
}

type ItemDirection

type ItemDirection int
const (
	HorizontalItemDirection ItemDirection = 0
	VerticalItemDirection                 = 1
)

type ListGroup

type ListGroup struct {
	control.UnorderedList
}

A ListGroup implements the Bootstrap ListGroup control. Since just a static list isn't all that interesting, this is a dynamic list whose individual items are considered clickable. To conform with the html standard and accessibility rules, items should appear as anchors if they link to another page, but as buttons if they cause a different action, like popping up a dialog.

Use the data provider to AddItems to the list, assigning attributes as needed to produce the items you want. You can also use a proxy control to create the attributes.

func GetListGroup added in v0.2.0

func GetListGroup(c page.ControlI, id string) *ListGroup

GetListGroup is a convenience method to return the control with the given id from the page.

func NewListGroup

func NewListGroup(parent page.ControlI, id string) *ListGroup

func (*ListGroup) GetItemsHtml

func (l *ListGroup) GetItemsHtml(items []*control.ListItem) string

func (*ListGroup) Init

func (l *ListGroup) Init(parent page.ControlI, id string)

type ListGroupCreator added in v0.2.0

type ListGroupCreator struct {
	ID string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	page.ControlOptions
	// ItemTag is the tag of the items. It defaults to "a".
	ItemTag string
	// OnClick is the action to take when an item is clicked.
	// The id of the item will appear as the action's ControlValue.
	OnClick action.ActionI
}

func (ListGroupCreator) Create added in v0.2.0

func (c ListGroupCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (ListGroupCreator) Init added in v0.2.0

func (c ListGroupCreator) Init(ctx context.Context, ctrl ListGroupI)

type ListGroupI added in v0.2.0

type ListGroupI interface {
	control.UnorderedListI
}
type Modal struct {
	control.Panel
	// contains filtered or unexported fields
}

Modal is a bootstrap modal dialog. To use a custom template in a bootstrap modal, add a Panel child element or subclass of a panel child element. To use the grid system, add the container-fluid class to that embedded panel.

func GetModal added in v0.2.3

func GetModal(c page.ControlI, id string) *Modal

GetListGroup is a convenience method to return the control with the given id from the page.

func NewModal

func NewModal(parent page.ControlI, id string) *Modal

func (*Modal) AddButton

func (m *Modal) AddButton(
	label string,
	id string,
	options *control.DialogButtonOptions,
)

AddButton adds a button to the modal. Buttons should be added in the order to appear. Styling options you can include in options.Options:

style - ButtonStyle value
size - ButtonSize value

func (*Modal) AddCloseButton

func (m *Modal) AddCloseButton(label string, id string)

AddCloseButton adds a button to the list of buttons with the given label, but this button will trigger the DialogCloseEvent instead of the DialogButtonEvent. The button will also close the dialog (by hiding it).

func (*Modal) AddTitlebarClass

func (m *Modal) AddTitlebarClass(class string)

func (*Modal) Deserialize added in v0.9.3

func (m *Modal) Deserialize(d page.Decoder)

func (*Modal) DrawTemplate

func (d *Modal) DrawTemplate(ctx context.Context, _w io.Writer) (err error)

func (*Modal) DrawingAttributes

func (m *Modal) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*Modal) Hide added in v0.5.0

func (m *Modal) Hide()

func (*Modal) Init

func (m *Modal) Init(parent page.ControlI, id string)

func (*Modal) PrivateAction

func (m *Modal) PrivateAction(_ context.Context, a action.Params)

func (*Modal) PutCustomScript

func (m *Modal) PutCustomScript(_ context.Context, response *page.Response)

func (*Modal) RemoveAllButtons

func (m *Modal) RemoveAllButtons()

func (*Modal) RemoveButton

func (m *Modal) RemoveButton(id string)

func (*Modal) Serialize added in v0.9.3

func (m *Modal) Serialize(e page.Encoder)

func (*Modal) SetBackdrop

func (m *Modal) SetBackdrop(b ModalBackdropType)

func (*Modal) SetButtonStyle

func (m *Modal) SetButtonStyle(id string, a html5tag.Style)

SetButtonStyle sets css styles on a button that is already in the dialog

func (*Modal) SetButtonText added in v0.13.4

func (m *Modal) SetButtonText(id string, text string)

SetButtonText sets the text of a button that is already on the dialog

func (*Modal) SetButtonVisible

func (m *Modal) SetButtonVisible(id string, visible bool)

func (*Modal) SetDialogStyle added in v0.0.3

func (m *Modal) SetDialogStyle(style control.DialogStyle)

func (*Modal) SetHasCloseBox

func (m *Modal) SetHasCloseBox(h bool)

func (*Modal) SetTitle

func (m *Modal) SetTitle(t string)

func (*Modal) Show added in v0.5.0

func (m *Modal) Show()

func (*Modal) Title

func (m *Modal) Title() string

type ModalBackdropType

type ModalBackdropType int
const (
	ModalBackdrop       ModalBackdropType = iota // Standard bootstrap backdrop. Clicking the backdrop closes the modal.
	ModalStaticBackdrop                          // Clicking the backdrop will not close the modal.
)

type ModalButtonCreator added in v0.2.3

type ModalButtonCreator struct {
	Label               string
	ID                  string
	Validates           bool
	ConfirmationMessage string
	PushLeft            bool
	IsClose             bool
	Options             map[string]interface{}
}

func ModalButtons added in v0.2.3

func ModalButtons(buttons ...ModalButtonCreator) []ModalButtonCreator

type ModalCreator added in v0.2.3

type ModalCreator struct {
	ID            string
	Title         string
	TitlebarClass string
	HasCloseBox   bool
	Style         control.DialogStyle
	Backdrop      ModalBackdropType
	Buttons       []ModalButtonCreator
	OnButton      action.ActionI
	page.ControlOptions
	Children []page.Creator
}

func (ModalCreator) Create added in v0.2.3

func (c ModalCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

type ModalI

type ModalI interface {
	control.DialogI
}
type NavLink struct {
	grctl.ActiveLink
}

NavLink creates an anchor tag with a nav-link class. It is used to create a link in a NavBar, and generally should be a child item of a NavGroup.

func GetNavLink(c page.ControlI, id string) *NavLink

GetNavLink is a convenience method to return the button with the given id from the page.

func NewNavLink(parent page.ControlI, id string) *NavLink

NewNavLink creates a new NavLink.

func (l *NavLink) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes returns the attributes to add to the tag just before the button is drawn.

func (l *NavLink) Init(parent page.ControlI, id string)

Init initializes the button

type NavLinkCreator struct {
	// ID is the control id. This is also the eventValue sent by the enclosing Navbar.
	ID string
	// Text is the text displayed in the link
	Text string
	// Location is the content of the href, which is the url where the link will go.
	// Alternatively, add an On handler to the ControlOptions
	Location string
	// ActiveAttributes are additional attributes to add to the active link. By default, the ActiveAttributes
	// will add the "active" class and aria-current=page.
	ActiveAttributes html5tag.Attributes
	page.ControlOptions
}

NavLinkCreator is the initialization structure for the declarative creation of the control.

func (c NavLinkCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (c NavLinkCreator) Init(ctx context.Context, ctrl NavLinkI)

Init is called by implementations of NavLinks to initialize a control with the creator. You do not normally need to call this.

type NavLinkI interface {
	grctl.ActiveLinkI
}
type Navbar struct {
	page.ControlBase
	// contains filtered or unexported fields
}

Navbar is a bootstrap navbar object. Use SetText() to set the logo text of the navbar, and SetTextIsHtml() to true to turn off encoding if needed. Add child controls to populate it. When adding NavLink objects, they should be grouped together using the NavGroup object.

func GetNavbar added in v0.2.0

func GetNavbar(c page.ControlI, id string) *Navbar

GetNavbar is a convenience method to return the control with the given id from the page.

func NewNavbar

func NewNavbar(parent page.ControlI, id string) *Navbar

NewNavbar returns a newly created Bootstrap Navbar object

func (b *Navbar) Deserialize(d page.Decoder)
func (b *Navbar) DrawTemplate(ctx context.Context, _w io.Writer) (err error)
func (b *Navbar) DrawingAttributes(ctx context.Context) html5tag.Attributes
func (b *Navbar) Init(parent page.ControlI, id string)
func (b *Navbar) OnClick(a action.ActionI) NavbarI

OnClick sets the action to take when a link in the Navbar is selected. It will only respond to links whose href is "#", which indicates its an empty link. The ActionValue will be the id of the link clicked.

func (b *Navbar) Serialize(e page.Encoder)
func (b *Navbar) SetBackgroundClass(c BackgroundColorClass) NavbarI
func (b *Navbar) SetBrand(label string, anchor string, p NavbarCollapsedBrandPlacement) NavbarI
func (b *Navbar) SetContainerClass(class ContainerClass) NavbarI
func (b *Navbar) SetExpand(e NavbarExpandClass) NavbarI
func (b *Navbar) SetNavbarStyle(style NavbarStyle) NavbarI
type NavbarCollapsedBrandPlacement int

NavbarCollapsedBrandPlacement controls the location of the brand when the navbar is collapsed

const (
	// NavbarCollapsedBrandLeft will place the brand on the left and the toggle button on the right when collapsed
	NavbarCollapsedBrandLeft NavbarCollapsedBrandPlacement = iota
	// NavbarCollapsedBrandRight will place the brand on the right and the toggle button on the left when collapsed
	NavbarCollapsedBrandRight
	// NavbarCollapsedBrandHidden means the brand will be hidden when collapsed, and shown when expanded
	NavbarCollapsedBrandHidden
)
type NavbarCreator struct {
	ID    string
	Brand string
	// BrandAnchor is the url to go to when the main logo in the navbar is clicked
	BrandAnchor string
	// Style is either NavbarDark or NavbarLight
	Style NavbarStyle
	// BackgroundColorClass is one of the background colors that you can assign the navbar
	BackgroundColorClass BackgroundColorClass
	// Expand determines at what screen width the navbar will be expanded.
	Expand NavbarExpandClass
	// BrandLocation controls the placement of the brand item
	BrandLocation NavbarCollapsedBrandPlacement
	// ContainerClass is the class of the container that will wrap the contents of the navbar
	ContainerClass ContainerClass

	// OnClick is the action to take when a link is clicked. It will only respond
	// to nav-link items that have an href of "#". The EventValue will be the id of the item clicked.
	OnClick action.ActionI

	page.ControlOptions
	Children []page.Creator
}
func (c NavbarCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (c NavbarCreator) Init(ctx context.Context, ctrl NavbarI)
type NavbarExpandClass string
type NavbarI interface {
	page.ControlI
	SetNavbarStyle(style NavbarStyle) NavbarI
	SetBrand(label string, anchor string, p NavbarCollapsedBrandPlacement) NavbarI
	SetBackgroundClass(c BackgroundColorClass) NavbarI
	SetExpand(e NavbarExpandClass) NavbarI
	SetContainerClass(class ContainerClass) NavbarI
	OnClick(action action.ActionI) NavbarI
}
type NavbarStyle string
const (
	NavbarDark  NavbarStyle = "navbar-dark" // black on white
	NavbarLight             = "navbar-light"
)

type PhoneTextbox added in v0.7.1

type PhoneTextbox struct {
	control.PhoneTextbox
}

func GetPhoneTextbox added in v0.7.1

func GetPhoneTextbox(c page.ControlI, id string) *PhoneTextbox

GetPhoneTextbox is a convenience method to return the control with the given id from the page.

func NewPhoneTextbox added in v0.7.1

func NewPhoneTextbox(parent page.ControlI, id string) *PhoneTextbox

func (*PhoneTextbox) DrawingAttributes added in v0.7.1

func (t *PhoneTextbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type PhoneTextboxCreator added in v0.7.1

type PhoneTextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// Text is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Text string

	page.ControlOptions
}

PhoneTextboxCreator creates an phone textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.

func (PhoneTextboxCreator) Create added in v0.7.1

func (PhoneTextboxCreator) Init added in v0.7.1

type PhoneTextboxI added in v0.7.1

type PhoneTextboxI interface {
	control.PhoneTextboxI
}

type RadioButton

type RadioButton struct {
	control.RadioButton
	// contains filtered or unexported fields
}

func GetRadioButton added in v0.2.0

func GetRadioButton(c page.ControlI, id string) *RadioButton

GetRadioButton is a convenience method to return the radio button with the given id from the page.

func NewRadioButton

func NewRadioButton(parent page.ControlI, id string) *RadioButton

func (*RadioButton) Deserialize

func (c *RadioButton) Deserialize(d page.Decoder)

func (*RadioButton) DrawTag

func (c *RadioButton) DrawTag(ctx context.Context, w io.Writer)

func (*RadioButton) DrawingAttributes

func (c *RadioButton) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*RadioButton) GetDrawingLabelAttributes added in v0.4.0

func (c *RadioButton) GetDrawingLabelAttributes() html5tag.Attributes

func (*RadioButton) Serialize

func (c *RadioButton) Serialize(e page.Encoder)

func (*RadioButton) SetInline added in v0.0.4

func (c *RadioButton) SetInline(v bool) *RadioButton

type RadioButtonCreator added in v0.2.0

type RadioButtonCreator struct {
	// ID is the id of the control
	ID string
	// Text is the text of the label displayed right next to the checkbox.
	Text string
	// Checked will initialize the checkbox in its checked state.
	Checked bool
	// LabelMode specifies how the label is drawn with the checkbox.
	LabelMode html5tag.LabelDrawingMode
	// LabelAttributes are additional attributes placed on the label tag.
	LabelAttributes html5tag.Attributes
	// SaveState will save the value of the checkbox and restore it when the page is reentered.
	SaveState bool
	// Group is the name of the group that the button belongs to
	Group string
	// Inline draws the radio group inline. Specify this when drawing the
	// radio button inline or in an inline FormGroup.
	Inline bool
	page.ControlOptions
}

func (RadioButtonCreator) Create added in v0.2.0

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

type RadioButtonI

type RadioButtonI interface {
	control.RadioButtonI
}

type RadioList

type RadioList struct {
	control.RadioList
	// contains filtered or unexported fields
}

RadioList is a multi-select control that presents its choices as a list of radio buttons. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-table table, or a single-table scrolling list much like a standard html select list.

func GetRadioList added in v0.2.0

func GetRadioList(c page.ControlI, id string) *RadioList

GetRadioList is a convenience method to return the control with the given id from the page.

func NewRadioList

func NewRadioList(parent page.ControlI, id string) *RadioList

func (*RadioList) Deserialize added in v0.9.3

func (l *RadioList) Deserialize(d page.Decoder)

func (*RadioList) DrawingAttributes added in v0.4.0

func (l *RadioList) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.

func (*RadioList) Init

func (l *RadioList) Init(parent page.ControlI, id string)

func (*RadioList) RenderItem added in v0.4.0

func (l *RadioList) RenderItem(item *control.ListItem) (h string)

RenderItem is called by the framework to render a single item in the list.

func (*RadioList) Serialize added in v0.9.3

func (l *RadioList) Serialize(e page.Encoder)

func (*RadioList) SetCellClass added in v0.2.0

func (l *RadioList) SetCellClass(c string)

SetCellClass sets a string that is applied to every cell. This is useful for setting responsive breakpoints

func (*RadioList) SetIsInline added in v0.2.0

func (l *RadioList) SetIsInline(i bool)

type RadioListCreator added in v0.2.0

type RadioListCreator struct {
	ID string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	// ColumnCount specifies how many columns to show
	ColumnCount int
	// LayoutDirection determines how the items are arranged in the columns
	LayoutDirection control.LayoutDirection
	// LabelDrawingMode specifies how the labels on the radio buttons will be associated with the buttons
	LabelDrawingMode html5tag.LabelDrawingMode
	// IsScrolling will give the inner div a vertical scroll style. You will need to style the height of the outer control to have a fixed style as well.
	IsScrolling bool
	// RowClass is the class assigned to each row
	RowClass string
	// Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Value string
	// OnChange is the action to take when any of the radio buttons in the list change
	OnChange action.ActionI
	// SaveState saves the selected value so that it is restored if the form is returned to.
	SaveState bool
	page.ControlOptions
}

func (RadioListCreator) Create added in v0.2.0

func (c RadioListCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (RadioListCreator) Init added in v0.2.0

func (c RadioListCreator) Init(ctx context.Context, ctrl RadioListI)

type RadioListGroup added in v0.12.0

type RadioListGroup struct {
	RadioList
	// contains filtered or unexported fields
}

RadioListGroup is a RadioList styled as a group.

See https://getbootstrap.com/docs/4.4/components/buttons/#checkbox-and-radio-buttons

func GetRadioListGroup added in v0.12.0

func GetRadioListGroup(c page.ControlI, id string) *RadioListGroup

GetRadioListGroup is a convenience method to return the control with the given id from the page.

func NewRadioListGroup added in v0.12.0

func NewRadioListGroup(parent page.ControlI, id string) *RadioListGroup

func (*RadioListGroup) Deserialize added in v0.12.0

func (l *RadioListGroup) Deserialize(d page.Decoder)

func (*RadioListGroup) DrawingAttributes added in v0.12.0

func (l *RadioListGroup) DrawingAttributes(ctx context.Context) html5tag.Attributes

DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.

func (*RadioListGroup) Init added in v0.12.0

func (l *RadioListGroup) Init(parent page.ControlI, id string)

func (*RadioListGroup) RenderItem added in v0.12.0

func (l *RadioListGroup) RenderItem(item *control.ListItem) (h string)

RenderItem is called by the framework to render a single item in the list.

func (*RadioListGroup) Serialize added in v0.12.0

func (l *RadioListGroup) Serialize(e page.Encoder)

func (*RadioListGroup) SetButtonStyle added in v0.12.0

func (l *RadioListGroup) SetButtonStyle(buttonStyle string) RadioListGroupI

type RadioListGroupCreator added in v0.12.0

type RadioListGroupCreator struct {
	ID string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	// Value is the initial value of the radio list. Often its best to load the value in a separate Load step after creating the control.
	Value string
	// SaveState saves the selected value so that it is restored if the form is returned to.
	ButtonStyle string
	// OnChange is the action to take when any of the radio buttons in the list change
	OnChange  action.ActionI
	SaveState bool
	page.ControlOptions
}

func (RadioListGroupCreator) Create added in v0.12.0

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (RadioListGroupCreator) Init added in v0.12.0

type RadioListGroupI added in v0.12.0

type RadioListGroupI interface {
	RadioListI
	SetButtonStyle(string) RadioListGroupI
}

type RadioListI

type RadioListI interface {
	control.RadioListI
}

type SelectList

type SelectList struct {
	control.SelectList
}

func GetSelectList added in v0.2.0

func GetSelectList(c page.ControlI, id string) *SelectList

GetSelectList is a convenience method to return the control with the given id from the page.

func NewSelectList

func NewSelectList(parent page.ControlI, id string) *SelectList

func (*SelectList) DrawingAttributes

func (l *SelectList) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*SelectList) Init added in v0.3.0

func (l *SelectList) Init(parent page.ControlI, id string)

type SelectListCreator added in v0.2.0

type SelectListCreator struct {
	ID string
	// Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items.
	Items []control.ListValue
	// NilItem is a helper to add an item at the top of the list with a nil value. This is often
	// used to specify no selection, or a message that a selection is required.
	NilItem string
	// DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProvider control.DataBinder
	// DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface.
	DataProviderID string
	// Size specifies how many items to show, and turns the list into a scrolling list
	Size int
	// Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control.
	Value string
	// SaveState saves the selected value so that it is restored if the form is returned to.
	SaveState bool
	page.ControlOptions
}

func (SelectListCreator) Create added in v0.2.0

func (c SelectListCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

func (SelectListCreator) Init added in v0.2.0

func (c SelectListCreator) Init(ctx context.Context, ctrl SelectListI)

type SelectListI added in v0.2.0

type SelectListI interface {
	control.SelectListI
}

type Tabs

type Tabs struct {
	control.Panel
	// contains filtered or unexported fields
}

Tabs draws its child controls as a set of tabs. The labels of the children serve as the tab labels. This currently draws everything at once, with the current panel visible, but everything else has hidden html.

func GetTabs added in v0.2.0

func GetTabs(c page.ControlI, id string) *Tabs

GetTabs is a convenience method to return the control with the given id from the page.

func NewTabs

func NewTabs(parent page.ControlI, id string) *Tabs

func (*Tabs) Deserialize added in v0.9.3

func (t *Tabs) Deserialize(d page.Decoder)

func (*Tabs) DrawTemplate

func (t *Tabs) DrawTemplate(ctx context.Context, _w io.Writer) (err error)

func (*Tabs) DrawingAttributes

func (t *Tabs) DrawingAttributes(ctx context.Context) html5tag.Attributes

func (*Tabs) Init

func (t *Tabs) Init(parent page.ControlI, id string)

func (*Tabs) Serialize added in v0.9.3

func (t *Tabs) Serialize(e page.Encoder)

type TabsCreator added in v0.2.0

type TabsCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	page.ControlOptions
	Children []page.Creator
}

func (TabsCreator) Create added in v0.2.0

func (c TabsCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

type TabsI added in v0.2.0

type TabsI interface {
	control.PanelI
}

type TextColorClass

type TextColorClass string

type Textbox

type Textbox struct {
	control.Textbox
}

func GetTextbox added in v0.2.3

func GetTextbox(c page.ControlI, id string) *Textbox

GetTextbox is a convenience method to return the control with the given id from the page.

func NewTextbox

func NewTextbox(parent page.ControlI, id string) *Textbox

func (*Textbox) DrawingAttributes

func (t *Textbox) DrawingAttributes(ctx context.Context) html5tag.Attributes

type TextboxCreator added in v0.2.0

type TextboxCreator struct {
	// ID is the control id of the html widget and must be unique to the page
	ID string
	// Placeholder is the placeholder attribute of the textbox and shows as help text inside the field
	Placeholder string
	// Type is the type attribute of the textbox
	Type string
	// MinLength is the minimum number of characters that the user is required to enter. If the
	// length is less than this number, a validation error will be shown.
	MinLength int
	// MaxLength is the maximum number of characters that the user is required to enter. If the
	// length is more than this number, a validation error will be shown.
	MaxLength int
	// ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag.
	// The actual width is browser dependent. For better control, use a width style property.
	ColumnCount int
	// RowCount creates a multi-line textarea with the given number of rows. By default, the
	// textbox will expand vertically by this number of lines. Use a height style property for
	// better control of the height of a textbox.
	RowCount int
	// ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user.
	ReadOnly bool
	// SaveState will save the text in the textbox, to be restored if the user comes back to the page.
	// It is particularly helpful when the textbox is being used to filter the results of a query, so that
	// when the user comes back to the page, he does not have to type the filter text again.
	SaveState bool
	// Text is the initial value of the textbox. Generally you would not use this, but rather load the value in a separate Load step after creating the control.
	Text string

	page.ControlOptions
}

TextboxCreator creates a textbox. Pass it to AddControls of a control, or as a Child of a FormGroup.

func (TextboxCreator) Create added in v0.2.0

func (c TextboxCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI

Create is called by the framework to create a new control from the Creator. You do not normally need to call this.

func (TextboxCreator) Init added in v0.2.0

func (c TextboxCreator) Init(ctx context.Context, ctrl TextboxI)

type TextboxI added in v0.2.0

type TextboxI interface {
	control.TextboxI
}

type TitleBar

type TitleBar struct {
	control.Panel
	HasCloseBox bool
	Title       string
}

func NewTitleBar

func NewTitleBar(parent page.ControlI, id string) *TitleBar

func (*TitleBar) DrawTemplate

func (d *TitleBar) DrawTemplate(ctx context.Context, _w io.Writer) (err error)

Jump to

Keyboard shortcuts

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