Documentation
¶
Index ¶
- Variables
- func AssignActionSet(lw Widgeter, as ActionSet) error
- func NewActionSet() map[ActionCode]Action
- func SetLinkPrefix(s string)
- func ToSnakeCase(str string) string
- func WitTitlePrefix(prefix string) func(*Option)
- func WithDownloadOption(b bool) func(*Option)
- func WithI18n() func(*Option)
- type Action
- type ActionCode
- type ActionSet
- type AttrValueWidget
- type Column
- type ContentBodyType
- type ContentWidget
- type Date
- type DirectCall
- type DownloadResponse
- type EmptyWidget
- type Float
- type Formatter
- type Grid
- func (g *Grid) ApplySliceOfStruct(src interface{}) *Grid
- func (g *Grid) AssignActionSet(as ActionSet) error
- func (g *Grid) DeleteColumns(col []string)
- func (r *Grid) Excelize(fname string) (*DownloadResponse, error)
- func (g *Grid) JSON() ([]byte, error)
- func (g *Grid) ReplaceCellWithFullLinks() error
- type GridWidget
- type Header
- type Icon
- type Int
- type LazyWidget
- type Line
- type LineType
- type Media
- type MediaWidget
- type NullTime
- type Option
- type Page
- type PaginationType
- type RefBookType
- type String
- type SuggestionType
- type Tab
- type Time
- type Widget
- type WidgetType
- type Widgeter
Constants ¶
This section is empty.
Variables ¶
var FieldTagLabel = "grid"
FieldTagLabel holds struct field tag key.
Functions ¶
func AssignActionSet ¶ added in v0.0.10
func NewActionSet ¶ added in v0.0.3
func NewActionSet() map[ActionCode]Action
NewActionSet builds instance of ActionSet.
func SetLinkPrefix ¶
func SetLinkPrefix(s string)
func ToSnakeCase ¶
ToSnakeCase converts string like RobertEgorov to robert_egorov.
func WitTitlePrefix ¶
func WithDownloadOption ¶
Types ¶
type Action ¶ added in v0.0.2
type Action struct {
Code ActionCode `json:"code,omitempty"`
Perm string `json:"perm,omitempty"`
Title string `json:"title,omitempty"`
Icon *Icon `json:"icon,omitempty"`
DirectCall *DirectCall `json:"directCall,omitempty"`
}
Action describes an operation on UI user can invocate. An action could relate to the specific row or not.
type ActionCode ¶ added in v0.0.3
type ActionCode string
type ActionSet ¶ added in v0.0.3
type ActionSet map[ActionCode]Action
ActionSet holds Actions identified by code. The type is useful for describe all supported application actions.
func (ActionSet) Add ¶ added in v0.0.6
func (as ActionSet) Add(arr []ActionCode)
func (ActionSet) AssignActionValues ¶ added in v0.0.6
type AttrValueWidget ¶ added in v0.0.3
func (AttrValueWidget) WidgetType ¶ added in v0.0.3
func (AttrValueWidget) WidgetType() WidgetType
type Column ¶ added in v0.0.3
type Column struct {
Name string `json:"name"`
Hidden bool `json:"hidden,omitempty"` // default false
Sortable bool `json:"sortable,omitempty"` // default false
Filterable bool `json:"filterable,omitempty"` // default false
Title string `json:"title,omitempty"` // default ""
Perm string `json:"perm,omitempty"` // default not permission
Type string `json:"type,omitempty"` // default "" (regular text)
Href string `json:"href,omitempty"` // default "" (no link)
Align string `json:"align,omitempty"` // default "" ("left") cell align
Caption string `json:"caption,omitempty"` // default ""
Method string `json:"method,omitempty"` // ?
Icons string `json:"icons,omitempty"` // comma separated fa-* icon names
IconsAlign string `json:"ialign,omitempty"` // default "" ("left") "right" - after text
Target string `json:"target,omitempty"` // default "" browser window target for opening link
BgColor string `json:"bgColor,omitempty"` // default "" background color
FgColor string `json:"fgColor,omitempty"` // default "" foreground color
Width string `json:"width,omitempty"` // default "" column width
}
Column describes grid column's properties.
type ContentBodyType ¶ added in v0.0.13
type ContentBodyType int
const ( Text ContentBodyType = 1 Html ContentBodyType = 2 Markdown ContentBodyType = 3 )
func (ContentBodyType) MarshalJSON ¶ added in v0.0.13
func (wt ContentBodyType) MarshalJSON() ([]byte, error)
func (ContentBodyType) String ¶ added in v0.0.13
func (wt ContentBodyType) String() string
type ContentWidget ¶ added in v0.0.13
type ContentWidget struct {
*Widget
Type ContentBodyType `json:"type"`
Body string `json:"body"`
}
func (ContentWidget) WidgetType ¶ added in v0.0.13
func (ContentWidget) WidgetType() WidgetType
type Date ¶
func (Date) ConvertToString ¶
type DirectCall ¶ added in v0.0.3
type DirectCall struct {
IsConfirmationRequired bool `json:"isConfirmationRequired,omitempty"`
ConfirmationMessage string `json:"confirmationMessage,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Body json.RawMessage `json:"body,omitempty"`
}
DirectCall is action's extended attributes describing a simple action what does not have user interaction. As instance an action what directly calls server REST handler.
type DownloadResponse ¶
type EmptyWidget ¶ added in v0.0.19
type EmptyWidget struct {
*Widget
}
func (EmptyWidget) WidgetType ¶ added in v0.0.19
func (EmptyWidget) WidgetType() WidgetType
type Float ¶
func (Float) ConvertToString ¶
type Grid ¶
type Grid struct {
Columns []Column `json:"columns"`
Rows [][]string `json:"rows"`
RowObjects []interface{} `json:"rowObjects,omitempty"`
RowIDs []int `json:"rowIds,omitempty"`
RowActions [][]ActionCode `json:"rowActions,omitempty"`
GridActions []ActionCode `json:"gridActions,omitempty"`
Action ActionSet `json:"action,omitempty"`
IsDownloadable bool `json:"isDownloadable"`
IsFilterable bool `json:"isFilterable"`
NoPagination bool `json:"noPagination,omitempty"`
PaginationType PaginationType `json:"paginationType"`
TotalCount int `json:"totalCount,omitempty"` // total count of rows in accordance with applied filters
// contains filtered or unexported fields
}
Grid describes data and metadata for presenting grid.
func (*Grid) ApplySliceOfStruct ¶
ApplySliceOfStruct converts slice of any struct to Grid, slice of column and rows.
func (*Grid) AssignActionSet ¶ added in v0.0.6
func (*Grid) DeleteColumns ¶
DeleteColumns deletes columns with exact names in cols.
func (*Grid) ReplaceCellWithFullLinks ¶
type GridWidget ¶ added in v0.0.7
func (GridWidget) WidgetType ¶ added in v0.0.7
func (GridWidget) WidgetType() WidgetType
type Header ¶ added in v0.0.3
type Header struct {
ID int `json:"id,omitempty"`
// Icon параметры иконки отображемой в заголовке.
LeftIcons []Icon `json:"leftIcons,omitempty"`
// Title может содержать код из ресурсов %слово%
Title string `json:"title,omitempty"`
// SubTitle может содержать код из ресурсов %слово%
SubTitle string `json:"subTitle,omitempty"`
RightIcons []Icon `json:"rightIcons,omitempty"`
// URL для перехода на страницу объекта, если значение заполнено.
URL string `json:"url,omitempty"`
// BgColor содержит цвета фона заголовка в формате HTML: red, #fff или #fefefe.
BgColor string `json:"bgColor,omitempty"`
}
Header describes header of the Page or Tab.
type Icon ¶ added in v0.0.3
type Icon struct {
// Name is name of font-awesome icon.
Name string `json:"name"`
// Color in HTML format.
Color string `json:"color,omitempty"`
}
Icon describes fa-icon properties.
type Int ¶
func (Int) ConvertToString ¶
type LazyWidget ¶ added in v0.0.9
func (LazyWidget) WidgetType ¶ added in v0.0.9
func (LazyWidget) WidgetType() WidgetType
type Line ¶ added in v0.0.3
type Line struct {
ID int `json:"id,omitempty"`
Icon *Icon `json:"icon,omitempty"`
Label string `json:"label,omitempty"`
Value string `json:"value,omitempty"`
Type LineType `json:"type,omitempty"`
// RefBook заполняется только если Type = "refbook"
RefBook *RefBookType `json:"refBook,omitempty"`
Suggestion *SuggestionType `json:"suggestion,omitempty"`
// URL заполняется при Type = href или exthref
URL string `json:"url,omitempty"`
Actions []ActionCode `json:"actions,omitempty"`
}
Line описывает одну информационную строчку
type LineType ¶ added in v0.0.3
type LineType string
LineType описывает поддерживаемые типы линий.
const ( // LineTypeDefault обычная строка. Показывать как текст LineTypeDefault LineType = "" // LineTypeHref показывать Value как ссылку LineTypeHref LineType = "href" // LineTypeExtHref показывать Value как ссылку на внешний ресурс. LineTypeExtHref LineType = "exthref" // LineTypeRefbook отображать Value как ссылку активирующую режим редактирования // параметры отображения комбобокса в структуре RefBookType. LineTypeRefbook LineType = "refbook" // LineTypeSuggestion отображать Value как ссылку активирующую режим редактирования // параметры отображения комбобокса в структуре RefBookType. LineTypeSuggestion LineType = "suggestion" )
type Media ¶ added in v0.0.3
type Media struct {
// ThumbnailURL содержит URL который необходимо использовать для отображения
// миниатюр.
ThumbnailURL string `json:"thumbnailUrl"`
// URL содержит адрес полной фотографии/видео.
URL string `json:"url"`
// IsVideo = true, если это видео. В миниатюре будет фото.
IsVideo bool `json:"isVideo,omitempty"`
}
Media описывает фото или видео для отображения в окне.
type MediaWidget ¶ added in v0.0.3
func (MediaWidget) WidgetType ¶ added in v0.0.3
func (MediaWidget) WidgetType() WidgetType
type NullTime ¶
func (NullTime) ConvertToString ¶
type Page ¶ added in v0.0.3
type Page struct {
ID int `json:"id,omitempty"`
Header *Header `json:"header,omitempty"`
Widgets []Widgeter `json:"widgets,omitempty"`
// Tabs содержит описание подчиненных объектов.
Tabs []Tab `json:"tabs,omitempty"`
Action ActionSet `json:"action,omitempty"`
// PageActions holds actions available in the drop down list on the page level.
PageActions []ActionCode `json:"pageActions,omitempty"`
}
Page describes a single object page.
func (*Page) AssignActionSet ¶ added in v0.0.6
Footer описывает содержимое нижней части окна.
type Footer struct {
Media []Media `json:"media,omitempty"`
}
type PaginationType ¶ added in v0.0.12
type PaginationType int
const ( PaginationServer PaginationType = 0 PaginationClient PaginationType = 1 PaginationWithout PaginationType = 2 )
func (PaginationType) MarshalJSON ¶ added in v0.0.12
func (pt PaginationType) MarshalJSON() ([]byte, error)
func (PaginationType) String ¶ added in v0.0.12
func (pt PaginationType) String() string
type RefBookType ¶ added in v0.0.3
type RefBookType struct {
// Name содержит название справочника из /dictionary
Name string `json:"name"`
// SelectedID текущий ID элемента справочника.
SelectedID int `json:"selectedId"`
// SubmitURL адрес куда надо направить POST запрос содержащий новый выбранный id из справочника Name.
// Структура запроса {"id" : 2}
SubmitURL string `json:"sumbitUrl"`
}
RefBookType описывает параметры строчки которая является изменяемым элементом справочника.
type String ¶
func (String) ConvertToString ¶
type SuggestionType ¶ added in v0.0.3
type SuggestionType struct {
// Name содержит название справочника из /dictionary
Name string `json:"name"`
// SelectedID текущий ID элемента справочника.
SelectedID *int64 `json:"selectedId,omitempty"`
UID string `json:"uid,omitempty"`
// SubmitURL адрес куда надо направить POST запрос содержащий новый выбранный id из справочника Name.
// Структура запроса {"id" : 2}
SubmitURL string `json:"submitUrl"`
}
type Tab ¶ added in v0.0.3
type Tab struct {
Header *Header `json:"header,omitempty"`
TabActions []ActionCode `json:"tabActions,omitempty"`
Widgets []Widgeter `json:"widgets,omitempty"`
IsActive bool `json:"isActive,omitempty"`
IsInitRequired bool `json:"isInitRequired,omitempty"`
IsDisabled bool `json:"isDisabled,omitempty"`
}
Tab описывает содержимое одного связанного объекта.
type Time ¶
func (Time) ConvertToString ¶
type Widget ¶ added in v0.0.4
type Widget struct {
ID int `json:"id,omitempty"`
Type WidgetType `json:"type"`
Header *Header `json:"header,omitempty"`
// Row int `json:"row"`
// Col int `json:"col"`
Width int `json:"width"`
Actions []ActionCode `json:"widgetActions,omitempty"`
// Action must be only filled if widget generated independent as
// result of request from lazy widget.
Action ActionSet `json:"action,omitempty"`
// Object is an object in JSON. The object can be consumed
// by customized UI logic. As instance: take data to init modal window.
Object interface{} `json:"object,omitempty"`
}
type WidgetType ¶ added in v0.0.3
type WidgetType int
const ( AttrValueType WidgetType = 1 MediaType WidgetType = 2 GridType WidgetType = 3 MapType WidgetType = 4 ChartType WidgetType = 5 CustomType WidgetType = 6 LazyType WidgetType = 7 ContentType WidgetType = 8 EmptyType WidgetType = 9 )
func (WidgetType) MarshalJSON ¶ added in v0.0.4
func (wt WidgetType) MarshalJSON() ([]byte, error)
func (WidgetType) String ¶ added in v0.0.4
func (wt WidgetType) String() string
type Widgeter ¶ added in v0.0.3
type Widgeter interface {
WidgetType() WidgetType
}