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 ¶
func NewActionSet ¶
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 ¶
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 ¶
type ActionCode string
type ActionSet ¶
type ActionSet map[ActionCode]Action
ActionSet holds Actions identified by code. The type is useful for describe all supported application actions.
func (ActionSet) Add ¶
func (as ActionSet) Add(arr []ActionCode)
func (ActionSet) AssignActionValues ¶
type AttrValueWidget ¶
func (AttrValueWidget) WidgetType ¶
func (AttrValueWidget) WidgetType() WidgetType
type Column ¶
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
}
Column describes grid column's properties.
type ContentBodyType ¶
type ContentBodyType int
const ( Text ContentBodyType = 1 Html ContentBodyType = 2 Markdown ContentBodyType = 3 )
func (ContentBodyType) MarshalJSON ¶
func (wt ContentBodyType) MarshalJSON() ([]byte, error)
func (ContentBodyType) String ¶
func (wt ContentBodyType) String() string
type ContentWidget ¶
type ContentWidget struct {
*Widget
Type ContentBodyType `json:"type"`
Body string `json:"body"`
}
func (ContentWidget) WidgetType ¶
func (ContentWidget) WidgetType() WidgetType
type Date ¶
func (Date) ConvertToString ¶
type DirectCall ¶
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 ¶
type EmptyWidget struct {
*Widget
}
func (EmptyWidget) WidgetType ¶
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"`
RowUIDs []uuid.UUID `json:"rowUids,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"`
// 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 ¶
func (*Grid) DeleteColumns ¶
DeleteColumns deletes columns with exact names in cols.
func (*Grid) ReplaceCellWithFullLinks ¶
type GridWidget ¶
func (GridWidget) WidgetType ¶
func (GridWidget) WidgetType() WidgetType
type Header ¶
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 ¶
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 ¶
func (LazyWidget) WidgetType ¶
func (LazyWidget) WidgetType() WidgetType
type Line ¶
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 ¶
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 ¶
type Media struct {
// ThumbnailURL содержит URL который необходимо использовать для отображения
// миниатюр.
ThumbnailURL string `json:"thumbnailUrl"`
// URL содержит адрес полной фотографии/видео.
URL string `json:"url"`
// IsVideo = true, если это видео. В миниатюре будет фото.
IsVideo bool `json:"isVideo,omitempty"`
}
Media описывает фото или видео для отображения в окне.
type MediaWidget ¶
func (MediaWidget) WidgetType ¶
func (MediaWidget) WidgetType() WidgetType
type NullTime ¶
func (NullTime) ConvertToString ¶
type Page ¶
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 ¶
Footer описывает содержимое нижней части окна.
type Footer struct {
Media []Media `json:"media,omitempty"`
}
type PaginationType ¶
type PaginationType int
const ( PaginationServer PaginationType = 0 PaginationClient PaginationType = 1 PaginationWithout PaginationType = 2 )
func (PaginationType) MarshalJSON ¶
func (pt PaginationType) MarshalJSON() ([]byte, error)
func (PaginationType) String ¶
func (pt PaginationType) String() string
type RefBookType ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (wt WidgetType) MarshalJSON() ([]byte, error)
func (WidgetType) String ¶
func (wt WidgetType) String() string
type Widgeter ¶
type Widgeter interface {
WidgetType() WidgetType
}