presets

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 35 Imported by: 9

README

  • Preset
    • Model
      • Listing

        • Bulk Actions
          • UpdateForm
          • UpdateFunc
        • Filter Menu
        • Filter Tabs
      • Detailing

        • Actions
          • UpdateForm
          • UpdateFunc
      • Editing

        • Multiple Editing Form by Name
      • Creating

Documentation

Index

Constants

View Source
const (
	PermModule = "presets"
	PermList   = "presets:list"
	PermGet    = "presets:get"
	PermCreate = "presets:create"
	PermUpdate = "presets:update"
	PermDelete = "presets:delete"

	PermActions         = "actions"
	PermDoListingAction = "do_listing_action"
	PermBulkActions     = "bulk_actions"
)
View Source
const (
	ParamID                       = "id"
	ParamAction                   = "action"
	ParamOverlay                  = "overlay"
	ParamOverlayAfterUpdateScript = "overlay_after_update_script"
	ParamOverlayUpdateID          = "overlay_update_id"
	ParamBulkActionName           = "bulk_action"
	ParamListingActionName        = "listing_action"
	ParamSelectedIds              = "selected_ids"
	ParamInDialog                 = "presets_in_dialog"
	ParamListingQueries           = "presets_listing_queries"
	ParamAfterDeleteEvent         = "presets_after_delete_event"

	// list editor
	ParamAddRowFormKey      = "listEditor_AddRowFormKey"
	ParamRemoveRowFormKey   = "listEditor_RemoveRowFormKey"
	ParamIsStartSort        = "listEditor_IsStartSort"
	ParamSortSectionFormKey = "listEditor_SortSectionFormKey"
	ParamSortResultFormKey  = "listEditor_SortResultFormKey"
)

params

View Source
const (
	ColorPrimary   = "primary"
	ColorSecondary = "secondary"
)
View Source
const (
	CoreI18nModuleKey   i18n.ModuleKey = "CoreI18nModuleKey"
	ModelsI18nModuleKey i18n.ModuleKey = "ModelsI18nModuleKey"
)
View Source
const (
	ConfirmDialogConfirmEvent     = "presets_ConfirmDialog_ConfirmEvent"
	ConfirmDialogPromptText       = "presets_ConfirmDialog_PromptText"
	ConfirmDialogDialogPortalName = "presets_ConfirmDialog_DialogPortalName"
)
View Source
const ActiveFilterTabQueryKey = "active_filter_tab"
View Source
const CloseListingDialogVarScript = "vars.presetsListingDialog = false"
View Source
const DefaultConfirmDialogPortalName = "presets_confirmDialogPortalName"
View Source
const DeleteConfirmPortalName = "deleteConfirm"
View Source
const DialogPortalName = "presets_DialogPortalName"
View Source
const ListingDialogPortalName = "presets_listingDialogPortalName"
View Source
const NotificationCenterPortalName = "notification-center"
View Source
const (
	OpenConfirmDialog = "presets_ConfirmDialog"
)
View Source
const RightDrawerPortalName = "presets_RightDrawerPortalName"

Variables

View Source
var (
	ErrRecordNotFound = errors.New("record not found")
)
View Source
var Messages_en_US = &Messages{
	SuccessfullyUpdated:            "Successfully Updated",
	Search:                         "Search",
	New:                            "New",
	Update:                         "Update",
	Delete:                         "Delete",
	Edit:                           "Edit",
	FormTitle:                      "Form",
	OK:                             "OK",
	Cancel:                         "Cancel",
	Clear:                          "Clear",
	Create:                         "Create",
	DeleteConfirmationTextTemplate: "Are you sure you want to delete object with id: {id}?",
	CreatingObjectTitleTemplate:    "New {modelName}",
	EditingObjectTitleTemplate:     "Editing {modelName} {id}",
	ListingObjectTitleTemplate:     "Listing {modelName}",
	DetailingObjectTitleTemplate:   "{modelName} {id}",
	FiltersClear:                   "Clear Filters",
	FiltersAdd:                     "Add Filters",
	FilterApply:                    "Apply",
	FilterByTemplate:               "Filter by {filter}",
	FiltersDateInTheLast:           "is in the last",
	FiltersDateEquals:              "is equal to",
	FiltersDateBetween:             "is between",
	FiltersDateIsAfter:             "is after",
	FiltersDateIsAfterOrOn:         "is on or after",
	FiltersDateIsBefore:            "is before",
	FiltersDateIsBeforeOrOn:        "is before or on",
	FiltersDateDays:                "days",
	FiltersDateMonths:              "months",
	FiltersDateAnd:                 "and",
	FiltersDateTo:                  "to",
	FiltersNumberEquals:            "is equal to",
	FiltersNumberBetween:           "between",
	FiltersNumberGreaterThan:       "is greater than",
	FiltersNumberLessThan:          "is less than",
	FiltersNumberAnd:               "and",
	FiltersStringEquals:            "is equal to",
	FiltersStringContains:          "contains",
	FiltersMultipleSelectIn:        "in",
	FiltersMultipleSelectNotIn:     "not in",
	PaginationRowsPerPage:          "Rows per page: ",
	ListingNoRecordToShow:          "No records to show",
	ListingSelectedCountNotice:     "{count} records are selected. ",
	ListingClearSelection:          "clear selection",
	BulkActionNoAvailableRecords:   "None of the selected records can be executed with this action.",
	BulkActionSelectedIdsProcessNoticeTemplate: "Partially selected records cannot be executed with this action: {ids}.",
	ConfirmDialogPromptText:                    "Are you sure?",
	Language:                                   "Language",
	Colon:                                      ":",
	NotFoundPageNotice:                         "Sorry, the requested page cannot be found. Please check the URL.",
}
View Source
var Messages_ja_JP = &Messages{
	SuccessfullyUpdated:            "更新に成功しました",
	Search:                         "検索する",
	New:                            "新規",
	Update:                         "更新する",
	Delete:                         "削除する",
	Edit:                           "編集する",
	FormTitle:                      "フォーム",
	OK:                             "OK",
	Cancel:                         "キャンセル",
	Create:                         "新規作成",
	DeleteConfirmationTextTemplate: ": {id}を削除して本当によろしいですか?",
	CreatingObjectTitleTemplate:    "{modelName} を作る",
	EditingObjectTitleTemplate:     "{modelName} {id} を編集する",
	ListingObjectTitleTemplate:     "リスティング {modelName} ",
	DetailingObjectTitleTemplate:   "{modelName} {id} ",
	FiltersClear:                   "フィルターをクリアする",
	FiltersAdd:                     "フィルターを追加する",
	FilterApply:                    "適用する",
	FilterByTemplate:               "{filter} でフィルターする",
	FiltersDateInTheLast:           "がサイト",
	FiltersDateEquals:              "と同等",
	FiltersDateBetween:             "の間",
	FiltersDateIsAfter:             "が後",
	FiltersDateIsAfterOrOn:         "が同時または後",
	FiltersDateIsBefore:            "が前",
	FiltersDateIsBeforeOrOn:        "が前または同時",
	FiltersDateDays:                "日間",
	FiltersDateMonths:              "月数",
	FiltersDateAnd:                 "&",
	FiltersDateTo:                  "から",
	FiltersNumberEquals:            "と同等",
	FiltersNumberBetween:           "間",
	FiltersNumberGreaterThan:       "より大きい",
	FiltersNumberLessThan:          "より少ない",
	FiltersNumberAnd:               "&",
	FiltersStringEquals:            "と同等",
	FiltersStringContains:          "を含む",
	FiltersMultipleSelectIn:        "中",
	FiltersMultipleSelectNotIn:     "以外",
	PaginationRowsPerPage:          "行 / ページ",
	ListingNoRecordToShow:          "表示できるデータはありません",
	ListingSelectedCountNotice:     "{count} レコードが選択されています",
	ListingClearSelection:          "選択をクリア",
	BulkActionNoAvailableRecords:   "この機能はご利用いただけません",
	BulkActionSelectedIdsProcessNoticeTemplate: "この一部の機能はご利用いただけません: {ids}",
	ConfirmDialogPromptText:                    "よろしいですか?",
	Language:                                   "言語",
	Colon:                                      ":",
	NotFoundPageNotice:                         "申し訳ありませんが、リクエストされたページは見つかりませんでした。URLを確認してください。",
}
View Source
var Messages_zh_CN = &Messages{
	SuccessfullyUpdated:            "成功更新了",
	Search:                         "搜索",
	New:                            "新建",
	Update:                         "更新",
	Delete:                         "删除",
	Edit:                           "编辑",
	FormTitle:                      "表单",
	OK:                             "确定",
	Cancel:                         "取消",
	Clear:                          "清空",
	Create:                         "创建",
	DeleteConfirmationTextTemplate: "你确定你要删除这个对象吗,对象ID: {id}?",
	CreatingObjectTitleTemplate:    "新建{modelName}",
	EditingObjectTitleTemplate:     "编辑{modelName} {id}",
	ListingObjectTitleTemplate:     "{modelName}列表",
	DetailingObjectTitleTemplate:   "{modelName} {id}",
	FiltersClear:                   "清空筛选器",
	FiltersAdd:                     "添加筛选器",
	FilterApply:                    "应用",
	FilterByTemplate:               "按{filter}筛选",
	FiltersDateInTheLast:           "过去",
	FiltersDateEquals:              "等于",
	FiltersDateBetween:             "之间",
	FiltersDateIsAfter:             "之后",
	FiltersDateIsAfterOrOn:         "当天或之后",
	FiltersDateIsBefore:            "之前",
	FiltersDateIsBeforeOrOn:        "当天或之前",
	FiltersDateDays:                "天",
	FiltersDateMonths:              "月",
	FiltersDateAnd:                 "和",
	FiltersDateTo:                  "至",
	FiltersNumberEquals:            "等于",
	FiltersNumberBetween:           "之间",
	FiltersNumberGreaterThan:       "大于",
	FiltersNumberLessThan:          "小于",
	FiltersNumberAnd:               "和",
	FiltersStringEquals:            "等于",
	FiltersStringContains:          "包含",
	FiltersMultipleSelectIn:        "包含",
	FiltersMultipleSelectNotIn:     "不包含",
	PaginationRowsPerPage:          "每页: ",
	ListingNoRecordToShow:          "没有可显示的记录",
	ListingSelectedCountNotice:     "{count}条记录被选中。",
	ListingClearSelection:          "清除选择",
	BulkActionNoAvailableRecords:   "所有选中的记录均无法执行这个操作。",
	BulkActionSelectedIdsProcessNoticeTemplate: "部分选中的记录无法被执行这个操作: {ids}。",
	ConfirmDialogPromptText:                    "你确定吗?",
	Language:                                   "语言",
	Colon:                                      ":",
	NotFoundPageNotice:                         "很抱歉,所请求的页面不存在,请检查URL。",
}
View Source
var (
	PermRead = []string{PermList, PermGet}
)

Functions

func EditDeleteRowMenuItemFuncs

func EditDeleteRowMenuItemFuncs(mi *ModelInfo, url string, editExtraParams url.Values) []vx.RowMenuItemFunc

func InputWithDefaults

func InputWithDefaults[T inputElem](input T, obj any, field *FieldContext) T

InputWithDefaults fills input element with name, value and label. For now, input must be h.Input, v.VSelect or v.VTextField. This function will be implemented using the FieldContext method when golang supports generic method and the current function will be deprecated.

func IsInDialog

func IsInDialog(ctx context.Context) bool

func RecoverPrimaryColumnValuesBySlug

func RecoverPrimaryColumnValuesBySlug(dec SlugDecoder, slug string) (r map[string]string, err error)

func RedirectSlashes

func RedirectSlashes(next http.Handler) http.Handler

func ShowMessage

func ShowMessage(r *web.EventResponse, msg string, color string)

Types

type ActionBuilder

type ActionBuilder struct {
	NameLabel
	// contains filtered or unexported fields
}

func (*ActionBuilder) ButtonColor

func (b *ActionBuilder) ButtonColor(v string) (r *ActionBuilder)

ButtonColor defines the color of default button if buttonCompFunc is not defined.

func (*ActionBuilder) ButtonCompFunc

func (b *ActionBuilder) ButtonCompFunc(v ComponentFunc) (r *ActionBuilder)

ButtonCompFunc defines the components of the button area.

func (*ActionBuilder) ComponentFunc

func (b *ActionBuilder) ComponentFunc(v ActionComponentFunc) (r *ActionBuilder)

ComponentFunc defines the components in dialog of button click.

func (*ActionBuilder) DialogWidth

func (b *ActionBuilder) DialogWidth(v string) (r *ActionBuilder)

func (*ActionBuilder) Label

func (b *ActionBuilder) Label(v string) (r *ActionBuilder)

func (*ActionBuilder) UpdateFunc

func (b *ActionBuilder) UpdateFunc(v ActionUpdateFunc) (r *ActionBuilder)

UpdateFunc defines event when the button is clicked.

type ActionComponentFunc

type ActionComponentFunc func(id string, ctx *web.EventContext) h.HTMLComponent

type ActionUpdateFunc

type ActionUpdateFunc func(id string, ctx *web.EventContext) (err error)

type AddListItemRowEvent

type AddListItemRowEvent struct {
	Event string
}

type AssetFunc

type AssetFunc func(ctx *web.EventContext)

type AutocompleteDataResult

type AutocompleteDataResult struct {
	Items   []OptionItem `json:"items"`
	Total   int          `json:"total"`
	Current int          `json:"current"`
	Pages   int          `json:"pages"`
}

type AutocompleteDataSourceConfig

type AutocompleteDataSourceConfig struct {
	OptionValue string
	OptionText  interface{} //func(interface{}) string or string
	OptionIcon  func(interface{}) string

	IsPaging bool

	KeywordColumns []string
	SQLConditions  []*SQLCondition
	OrderBy        string
	PerPage        int64
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func New

func New() *Builder

func (*Builder) AddMenuTopItemFunc

func (b *Builder) AddMenuTopItemFunc(key string, v ComponentFunc) (r *Builder)

func (*Builder) AddWrapHandler

func (b *Builder) AddWrapHandler(key string, f func(in http.Handler) (out http.Handler))

func (*Builder) AssetFunc

func (b *Builder) AssetFunc(v AssetFunc) (r *Builder)

func (*Builder) BrandFunc

func (b *Builder) BrandFunc(v ComponentFunc) (r *Builder)

func (*Builder) BrandProfileSwitchLanguageDisplayFuncFunc

func (b *Builder) BrandProfileSwitchLanguageDisplayFuncFunc(f func(brand, profile, switchLanguage h.HTMLComponent) h.HTMLComponent) (r *Builder)

func (*Builder) BrandTitle

func (b *Builder) BrandTitle(v string) (r *Builder)

func (*Builder) Builder

func (b *Builder) Builder(v *web.Builder) (r *Builder)

func (*Builder) CreateMenus

func (b *Builder) CreateMenus(ctx *web.EventContext) (r h.HTMLComponent)

func (*Builder) DataOperator

func (b *Builder) DataOperator(v DataOperator) (r *Builder)

func (*Builder) DefaultNotFoundPageFunc

func (b *Builder) DefaultNotFoundPageFunc(ctx *web.EventContext) (r web.PageResponse, err error)

func (*Builder) DetailLayoutFunc

func (b *Builder) DetailLayoutFunc(v func(in web.PageFunc, cfg *LayoutConfig) (out web.PageFunc)) (r *Builder)

func (*Builder) ExtraAsset

func (b *Builder) ExtraAsset(path string, contentType string, body web.ComponentsPack, refTag ...string) (r *Builder)

func (*Builder) FieldDefaults

func (b *Builder) FieldDefaults(v FieldMode) (r *FieldDefaults)

func (*Builder) GetBrandTitle

func (b *Builder) GetBrandTitle() string

func (*Builder) GetDetailLayoutFunc

func (b *Builder) GetDetailLayoutFunc() func(in web.PageFunc, cfg *LayoutConfig) (out web.PageFunc)

func (*Builder) GetLayoutFunc

func (b *Builder) GetLayoutFunc() func(in web.PageFunc, cfg *LayoutConfig) (out web.PageFunc)

func (*Builder) GetPermission

func (b *Builder) GetPermission() (r *perm.Builder)

func (*Builder) GetProfileFunc

func (b *Builder) GetProfileFunc() ComponentFunc

func (*Builder) GetProgressBarColor

func (b *Builder) GetProgressBarColor() string

func (*Builder) GetURIPrefix

func (b *Builder) GetURIPrefix() string

func (*Builder) GetWebBuilder

func (b *Builder) GetWebBuilder() (r *web.Builder)

func (*Builder) HomePageFunc

func (b *Builder) HomePageFunc(v web.PageFunc) (r *Builder)

func (*Builder) HomePageLayoutConfig

func (b *Builder) HomePageLayoutConfig(v *LayoutConfig) (r *Builder)

func (*Builder) I18n

func (b *Builder) I18n() (r *i18n.Builder)

func (*Builder) InjectAssets

func (b *Builder) InjectAssets(ctx *web.EventContext)

func (*Builder) InjectExtraAssets

func (b *Builder) InjectExtraAssets(ctx *web.EventContext)

func (*Builder) LayoutFunc

func (b *Builder) LayoutFunc(v func(in web.PageFunc, cfg *LayoutConfig) (out web.PageFunc)) (r *Builder)

func (*Builder) Logger

func (b *Builder) Logger(v *zap.Logger) (r *Builder)

func (*Builder) MenuGroup

func (b *Builder) MenuGroup(name string) *MenuGroupBuilder

func (*Builder) MenuOrder

func (b *Builder) MenuOrder(items ...interface{})

item can be Slug name, model name, *MenuGroupBuilder the underlying logic is using Slug name, so if the Slug name is customized, item must be the Slug name example: b.MenuOrder(

b.MenuGroup("Product Management").SubItems(
	"products",
	"Variant",
),
"customized-uri",

)

func (*Builder) MessagesFunc

func (b *Builder) MessagesFunc(v MessagesFunc) (r *Builder)

func (*Builder) Model

func (b *Builder) Model(v interface{}) (r *ModelBuilder)

func (*Builder) NewFieldsBuilder

func (b *Builder) NewFieldsBuilder(v FieldMode) (r *FieldsBuilder)

func (*Builder) NotFoundFunc

func (b *Builder) NotFoundFunc(v web.PageFunc) (r *Builder)

func (*Builder) NotFoundPageLayoutConfig

func (b *Builder) NotFoundPageLayoutConfig(v *LayoutConfig) (r *Builder)

func (*Builder) NotificationFunc

func (b *Builder) NotificationFunc(contentFunc ComponentFunc, countFunc func(ctx *web.EventContext) int) (r *Builder)

func (*Builder) Permission

func (b *Builder) Permission(v *perm.Builder) (r *Builder)

func (*Builder) PlainLayout

func (b *Builder) PlainLayout(in web.PageFunc) (out web.PageFunc)

for pages outside the default presets layout

func (*Builder) ProfileFunc

func (b *Builder) ProfileFunc(v ComponentFunc) (r *Builder)

func (*Builder) ProgressBarColor

func (b *Builder) ProgressBarColor(v string) (r *Builder)

func (*Builder) RightDrawerWidth

func (b *Builder) RightDrawerWidth(v string) (r *Builder)

func (*Builder) RunBrandFunc

func (b *Builder) RunBrandFunc(ctx *web.EventContext) (r h.HTMLComponent)

func (*Builder) RunBrandProfileSwitchLanguageDisplayFunc

func (b *Builder) RunBrandProfileSwitchLanguageDisplayFunc(brand, profile, switchLanguage h.HTMLComponent, ctx *web.EventContext) (r h.HTMLComponent)

func (*Builder) RunSwitchLanguageFunc

func (b *Builder) RunSwitchLanguageFunc(ctx *web.EventContext) (r h.HTMLComponent)

func (*Builder) ServeHTTP

func (b *Builder) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Builder) SetI18n

func (b *Builder) SetI18n(v *i18n.Builder) (r *Builder)

func (*Builder) SwitchLanguageFunc

func (b *Builder) SwitchLanguageFunc(v ComponentFunc) (r *Builder)

func (*Builder) URIPrefix

func (b *Builder) URIPrefix(v string) (r *Builder)

func (*Builder) VuetifyOptions

func (b *Builder) VuetifyOptions(v string) (r *Builder)

type BulkActionBuilder

type BulkActionBuilder struct {
	NameLabel
	// contains filtered or unexported fields
}

func (*BulkActionBuilder) ButtonColor

func (b *BulkActionBuilder) ButtonColor(v string) (r *BulkActionBuilder)

func (*BulkActionBuilder) ButtonCompFunc

func (b *BulkActionBuilder) ButtonCompFunc(v ComponentFunc) (r *BulkActionBuilder)

func (*BulkActionBuilder) ComponentFunc

func (*BulkActionBuilder) DialogWidth

func (b *BulkActionBuilder) DialogWidth(v string) (r *BulkActionBuilder)

func (*BulkActionBuilder) Label

func (b *BulkActionBuilder) Label(v string) (r *BulkActionBuilder)

func (*BulkActionBuilder) SelectedIdsProcessorFunc

func (b *BulkActionBuilder) SelectedIdsProcessorFunc(v BulkActionSelectedIdsProcessorFunc) (r *BulkActionBuilder)

func (*BulkActionBuilder) SelectedIdsProcessorNoticeFunc

func (b *BulkActionBuilder) SelectedIdsProcessorNoticeFunc(v BulkActionSelectedIdsProcessorNoticeFunc) (r *BulkActionBuilder)

func (*BulkActionBuilder) UpdateFunc

type BulkActionComponentFunc

type BulkActionComponentFunc func(selectedIds []string, ctx *web.EventContext) h.HTMLComponent

type BulkActionSelectedIdsProcessorFunc

type BulkActionSelectedIdsProcessorFunc func(selectedIds []string, ctx *web.EventContext) (processedSelectedIds []string, err error)

type BulkActionSelectedIdsProcessorNoticeFunc

type BulkActionSelectedIdsProcessorNoticeFunc func(selectedIds []string, processedSelectedIds []string, unactionableIds []string) string

type BulkActionUpdateFunc

type BulkActionUpdateFunc func(selectedIds []string, ctx *web.EventContext) (err error)

type ColOrderBy

type ColOrderBy struct {
	FieldName string
	// ASC, DESC
	OrderBy string
}

func GetOrderBysFromQuery

func GetOrderBysFromQuery(query url.Values) []*ColOrderBy

GetOrderBysFromQuery gets order bys from query string.

type ComponentFunc

type ComponentFunc func(ctx *web.EventContext) h.HTMLComponent

type DataOperator

type DataOperator interface {
	Search(obj interface{}, params *SearchParams, ctx *web.EventContext) (r interface{}, totalCount int, err error)
	// return ErrRecordNotFound if record not found
	Fetch(obj interface{}, id string, ctx *web.EventContext) (r interface{}, err error)
	Save(obj interface{}, id string, ctx *web.EventContext) (err error)
	Delete(obj interface{}, id string, ctx *web.EventContext) (err error)
}

Data Layer

type DeleteFunc

type DeleteFunc func(obj interface{}, id string, ctx *web.EventContext) (err error)

type DetailingBuilder

type DetailingBuilder struct {
	FieldsBuilder
	// contains filtered or unexported fields
}

func (*DetailingBuilder) Action

func (b *DetailingBuilder) Action(name string) (r *ActionBuilder)

func (*DetailingBuilder) AppendTabsPanelFunc

func (b *DetailingBuilder) AppendTabsPanelFunc(v ObjectComponentFunc) (r *DetailingBuilder)

func (*DetailingBuilder) CleanTabsPanels

func (b *DetailingBuilder) CleanTabsPanels() (r *DetailingBuilder)

func (*DetailingBuilder) Drawer

func (b *DetailingBuilder) Drawer(v bool) (r *DetailingBuilder)

func (*DetailingBuilder) Except

func (b *DetailingBuilder) Except(vs ...string) (r *DetailingBuilder)

func (*DetailingBuilder) FetchFunc

func (b *DetailingBuilder) FetchFunc(v FetchFunc) (r *DetailingBuilder)

func (*DetailingBuilder) GetFetchFunc

func (b *DetailingBuilder) GetFetchFunc() FetchFunc

func (*DetailingBuilder) GetPageFunc

func (b *DetailingBuilder) GetPageFunc() web.PageFunc

func (*DetailingBuilder) Only

func (b *DetailingBuilder) Only(vs ...interface{}) (r *DetailingBuilder)

string / []string / *FieldsSection

func (*DetailingBuilder) PageFunc

func (b *DetailingBuilder) PageFunc(pf web.PageFunc) (r *DetailingBuilder)

func (*DetailingBuilder) TabsPanelFunc

func (b *DetailingBuilder) TabsPanelFunc() (r []ObjectComponentFunc)

type DisplayFieldInSorter

type DisplayFieldInSorter struct {
	Field string
}

type EditingBuilder

type EditingBuilder struct {
	Fetcher   FetchFunc
	Setter    SetterFunc
	Saver     SaveFunc
	Deleter   DeleteFunc
	Validator ValidateFunc

	FieldsBuilder
	// contains filtered or unexported fields
}

func (*EditingBuilder) ActionsFunc

func (b *EditingBuilder) ActionsFunc(v ObjectComponentFunc) (r *EditingBuilder)

func (*EditingBuilder) AppendHiddenFunc

func (b *EditingBuilder) AppendHiddenFunc(v ObjectComponentFunc) (r *EditingBuilder)

func (*EditingBuilder) AppendTabsPanelFunc

func (b *EditingBuilder) AppendTabsPanelFunc(v ObjectComponentFunc) (r *EditingBuilder)

func (*EditingBuilder) CleanTabsPanels

func (b *EditingBuilder) CleanTabsPanels() (r *EditingBuilder)

func (*EditingBuilder) Creating

func (b *EditingBuilder) Creating(vs ...interface{}) (r *EditingBuilder)

func (*EditingBuilder) DeleteFunc

func (b *EditingBuilder) DeleteFunc(v DeleteFunc) (r *EditingBuilder)

func (*EditingBuilder) EditingTitleFunc

func (b *EditingBuilder) EditingTitleFunc(v EditingTitleComponentFunc) (r *EditingBuilder)

func (*EditingBuilder) Except

func (b *EditingBuilder) Except(vs ...string) (r *EditingBuilder)

func (*EditingBuilder) FetchAndUnmarshal

func (b *EditingBuilder) FetchAndUnmarshal(id string, removeDeletedAndSort bool, ctx *web.EventContext) (obj interface{}, vErr web.ValidationErrors)

func (*EditingBuilder) FetchFunc

func (b *EditingBuilder) FetchFunc(v FetchFunc) (r *EditingBuilder)

func (*EditingBuilder) Only

func (b *EditingBuilder) Only(vs ...interface{}) (r *EditingBuilder)

string / []string / *FieldsSection

func (*EditingBuilder) RunSetterFunc

func (b *EditingBuilder) RunSetterFunc(ctx *web.EventContext, removeDeletedAndSort bool, toObj interface{}) (vErr web.ValidationErrors)

func (*EditingBuilder) SaveFunc

func (b *EditingBuilder) SaveFunc(v SaveFunc) (r *EditingBuilder)

func (*EditingBuilder) SaveOverlayContent

func (b *EditingBuilder) SaveOverlayContent(
	ctx *web.EventContext,
	r *web.EventResponse,
) (err error)

func (*EditingBuilder) SetterFunc

func (b *EditingBuilder) SetterFunc(v SetterFunc) (r *EditingBuilder)

func (*EditingBuilder) SidePanelFunc

func (b *EditingBuilder) SidePanelFunc(v ComponentFunc) (r *EditingBuilder)

func (*EditingBuilder) UpdateOverlayContent

func (b *EditingBuilder) UpdateOverlayContent(
	ctx *web.EventContext,
	r *web.EventResponse,
	obj interface{},
	successMessage string,
	err error,
)

func (*EditingBuilder) ValidateFunc

func (b *EditingBuilder) ValidateFunc(v ValidateFunc) (r *EditingBuilder)

type EditingTitleComponentFunc

type EditingTitleComponentFunc func(obj interface{}, defaultTitle string, ctx *web.EventContext) h.HTMLComponent

type FetchFunc

type FetchFunc func(obj interface{}, id string, ctx *web.EventContext) (r interface{}, err error)

type FieldBuilder

type FieldBuilder struct {
	NameLabel
	// contains filtered or unexported fields
}

func (*FieldBuilder) Clone

func (b *FieldBuilder) Clone() (r *FieldBuilder)

func (*FieldBuilder) ComponentFunc

func (b *FieldBuilder) ComponentFunc(v FieldComponentFunc) (r *FieldBuilder)

func (*FieldBuilder) Label

func (b *FieldBuilder) Label(v string) (r *FieldBuilder)

func (*FieldBuilder) Nested

func (b *FieldBuilder) Nested(fb *FieldsBuilder, cfgs ...NestedConfig) (r *FieldBuilder)

func (*FieldBuilder) SetterFunc

func (b *FieldBuilder) SetterFunc(v FieldSetterFunc) (r *FieldBuilder)

func (*FieldBuilder) WithContextValue

func (b *FieldBuilder) WithContextValue(key interface{}, val interface{}) (r *FieldBuilder)

type FieldComponentFunc

type FieldComponentFunc func(obj interface{}, field *FieldContext, ctx *web.EventContext) h.HTMLComponent

type FieldContext

type FieldContext struct {
	Name                string
	FormKey             string
	Label               string
	Errors              []string
	ModelInfo           *ModelInfo
	NestedFieldsBuilder *FieldsBuilder
	Context             context.Context
	Disabled            bool
}

func (*FieldContext) ContextValue

func (fc *FieldContext) ContextValue(key interface{}) (r interface{})

func (*FieldContext) StringValue

func (fc *FieldContext) StringValue(obj interface{}) (r string)

func (*FieldContext) Value

func (fc *FieldContext) Value(obj interface{}) (r interface{})

type FieldDefaultBuilder

type FieldDefaultBuilder struct {
	// contains filtered or unexported fields
}

func NewFieldDefault

func NewFieldDefault(t reflect.Type) (r *FieldDefaultBuilder)

func (*FieldDefaultBuilder) ComponentFunc

func (*FieldDefaultBuilder) SetterFunc

type FieldDefaults

type FieldDefaults struct {
	// contains filtered or unexported fields
}

func NewFieldDefaults

func NewFieldDefaults(t FieldMode) (r *FieldDefaults)

func (*FieldDefaults) Exclude

func (b *FieldDefaults) Exclude(patterns ...string) (r *FieldDefaults)

func (*FieldDefaults) FieldType

func (b *FieldDefaults) FieldType(v interface{}) (r *FieldDefaultBuilder)

func (*FieldDefaults) InspectFields

func (b *FieldDefaults) InspectFields(val interface{}) (r *FieldsBuilder)

func (*FieldDefaults) String

func (b *FieldDefaults) String() string

type FieldMode

type FieldMode int
const (
	WRITE FieldMode = iota
	LIST
	DETAIL
)

type FieldSetterFunc

type FieldSetterFunc func(obj interface{}, field *FieldContext, ctx *web.EventContext) (err error)

type FieldsBuilder

type FieldsBuilder struct {
	// contains filtered or unexported fields
}

func NewFieldsBuilder

func NewFieldsBuilder() *FieldsBuilder

func (*FieldsBuilder) Clone

func (b *FieldsBuilder) Clone() (r *FieldsBuilder)

func (*FieldsBuilder) Defaults

func (b *FieldsBuilder) Defaults(v *FieldDefaults) (r *FieldsBuilder)

func (*FieldsBuilder) Except

func (b *FieldsBuilder) Except(patterns ...string) (r *FieldsBuilder)

func (*FieldsBuilder) Field

func (b *FieldsBuilder) Field(name string) (r *FieldBuilder)

func (*FieldsBuilder) GetField

func (b *FieldsBuilder) GetField(name string) (r *FieldBuilder)

func (*FieldsBuilder) Labels

func (b *FieldsBuilder) Labels(vs ...string) (r *FieldsBuilder)

func (*FieldsBuilder) Model

func (b *FieldsBuilder) Model(v interface{}) (r *FieldsBuilder)

func (*FieldsBuilder) Only

func (b *FieldsBuilder) Only(vs ...interface{}) (r *FieldsBuilder)

func (*FieldsBuilder) SetObjectFields

func (b *FieldsBuilder) SetObjectFields(fromObj interface{}, toObj interface{}, parent *FieldContext, removeDeletedAndSort bool, modifiedIndexes *ModifiedIndexesBuilder, ctx *web.EventContext) (vErr web.ValidationErrors)

func (*FieldsBuilder) String

func (b *FieldsBuilder) String() (r string)

func (*FieldsBuilder) ToComponent

func (b *FieldsBuilder) ToComponent(info *ModelInfo, obj interface{}, ctx *web.EventContext) h.HTMLComponent

func (*FieldsBuilder) ToComponentForEach

func (b *FieldsBuilder) ToComponentForEach(field *FieldContext, slice interface{}, ctx *web.EventContext, rowFunc RowFunc) h.HTMLComponent

func (*FieldsBuilder) Unmarshal

func (b *FieldsBuilder) Unmarshal(toObj interface{}, info *ModelInfo, removeDeletedAndSort bool, ctx *web.EventContext) (vErr web.ValidationErrors)

type FieldsSection

type FieldsSection struct {
	Title string
	Rows  [][]string
}

type FilterDataFunc

type FilterDataFunc func(ctx *web.EventContext) vuetifyx.FilterData

type FilterTab

type FilterTab struct {
	ID    string
	Label string
	// render AdvancedLabel if it is not nil
	AdvancedLabel h.HTMLComponent
	Query         url.Values
}

type FilterTabsFunc

type FilterTabsFunc func(ctx *web.EventContext) []*FilterTab

type LayoutConfig

type LayoutConfig struct {
	SearchBoxInvisible          bool
	NotificationCenterInvisible bool
}

type ListEditorBuilder

type ListEditorBuilder struct {
	// contains filtered or unexported fields
}

func NewListEditor

func NewListEditor(v *FieldContext) *ListEditorBuilder

func (*ListEditorBuilder) AddListItemRowEvnet

func (b *ListEditorBuilder) AddListItemRowEvnet(v string) (r *ListEditorBuilder)

func (*ListEditorBuilder) DisplayFieldInSorter

func (b *ListEditorBuilder) DisplayFieldInSorter(v string) (r *ListEditorBuilder)

func (*ListEditorBuilder) MarshalHTML

func (b *ListEditorBuilder) MarshalHTML(c context.Context) (r []byte, err error)

func (*ListEditorBuilder) RemoveListItemRowEvent

func (b *ListEditorBuilder) RemoveListItemRowEvent(v string) (r *ListEditorBuilder)

func (*ListEditorBuilder) SortListItemsEvent

func (b *ListEditorBuilder) SortListItemsEvent(v string) (r *ListEditorBuilder)

func (*ListEditorBuilder) Value

func (b *ListEditorBuilder) Value(v interface{}) (r *ListEditorBuilder)

type ListSorter

type ListSorter struct {
	Items []ListSorterItem `json:"items"`
}

type ListSorterItem

type ListSorterItem struct {
	Index int    `json:"index"`
	Label string `json:"label"`
}

type ListingBuilder

type ListingBuilder struct {
	Searcher SearchFunc

	FieldsBuilder
	// contains filtered or unexported fields
}

func (*ListingBuilder) Action

func (b *ListingBuilder) Action(name string) (r *ActionBuilder)

func (*ListingBuilder) ActionsAsMenu

func (b *ListingBuilder) ActionsAsMenu(v bool) (r *ListingBuilder)

func (*ListingBuilder) BulkAction

func (b *ListingBuilder) BulkAction(name string) (r *BulkActionBuilder)

func (*ListingBuilder) CellWrapperFunc

func (b *ListingBuilder) CellWrapperFunc(cwf vx.CellWrapperFunc) (r *ListingBuilder)

func (*ListingBuilder) Conditions

func (b *ListingBuilder) Conditions(v []*SQLCondition) (r *ListingBuilder)

func (*ListingBuilder) ConfigureAutocompleteDataSource

func (b *ListingBuilder) ConfigureAutocompleteDataSource(config *AutocompleteDataSourceConfig, name ...string) *vuetifyx.AutocompleteDataSource

func (*ListingBuilder) DialogHeight

func (b *ListingBuilder) DialogHeight(v string) (r *ListingBuilder)

func (*ListingBuilder) DialogWidth

func (b *ListingBuilder) DialogWidth(v string) (r *ListingBuilder)

func (*ListingBuilder) DisablePagination

func (b *ListingBuilder) DisablePagination(v bool) (r *ListingBuilder)

func (*ListingBuilder) Except

func (b *ListingBuilder) Except(vs ...string) (r *ListingBuilder)

func (*ListingBuilder) FilterDataFunc

func (b *ListingBuilder) FilterDataFunc(v FilterDataFunc)

func (*ListingBuilder) FilterTabsFunc

func (b *ListingBuilder) FilterTabsFunc(v FilterTabsFunc)

func (*ListingBuilder) GetPageFunc

func (b *ListingBuilder) GetPageFunc() web.PageFunc

func (*ListingBuilder) NewButtonFunc

func (b *ListingBuilder) NewButtonFunc(v ComponentFunc) (r *ListingBuilder)

func (*ListingBuilder) Only

func (b *ListingBuilder) Only(vs ...string) (r *ListingBuilder)

func (*ListingBuilder) OrderBy

func (b *ListingBuilder) OrderBy(v string) (r *ListingBuilder)

func (*ListingBuilder) OrderableFields

func (b *ListingBuilder) OrderableFields(v []*OrderableField) (r *ListingBuilder)

func (*ListingBuilder) PageFunc

func (b *ListingBuilder) PageFunc(pf web.PageFunc) (r *ListingBuilder)

func (*ListingBuilder) PerPage

func (b *ListingBuilder) PerPage(v int64) (r *ListingBuilder)

func (*ListingBuilder) RowMenu

func (b *ListingBuilder) RowMenu(listings ...string) *RowMenuBuilder

func (*ListingBuilder) SearchColumns

func (b *ListingBuilder) SearchColumns(vs ...string) (r *ListingBuilder)

func (*ListingBuilder) SearchFunc

func (b *ListingBuilder) SearchFunc(v SearchFunc) (r *ListingBuilder)

func (*ListingBuilder) SelectableColumns

func (b *ListingBuilder) SelectableColumns(v bool) (r *ListingBuilder)

func (*ListingBuilder) Title

func (b *ListingBuilder) Title(title string) (r *ListingBuilder)
type MenuGroupBuilder struct {
	// contains filtered or unexported fields
}
func (b *MenuGroupBuilder) Icon(v string) (r *MenuGroupBuilder)
func (b *MenuGroupBuilder) SubItems(ss ...string) (r *MenuGroupBuilder)
type MenuGroups struct {
	// contains filtered or unexported fields
}
func (g *MenuGroups) MenuGroup(name string) (r *MenuGroupBuilder)

type Messages

type Messages struct {
	SuccessfullyUpdated                        string
	Search                                     string
	New                                        string
	Update                                     string
	Delete                                     string
	Edit                                       string
	FormTitle                                  string
	OK                                         string
	Cancel                                     string
	Clear                                      string
	Create                                     string
	DeleteConfirmationTextTemplate             string
	CreatingObjectTitleTemplate                string
	EditingObjectTitleTemplate                 string
	ListingObjectTitleTemplate                 string
	DetailingObjectTitleTemplate               string
	FiltersClear                               string
	FiltersAdd                                 string
	FilterApply                                string
	FilterByTemplate                           string
	FiltersDateInTheLast                       string
	FiltersDateEquals                          string
	FiltersDateBetween                         string
	FiltersDateIsAfter                         string
	FiltersDateIsAfterOrOn                     string
	FiltersDateIsBefore                        string
	FiltersDateIsBeforeOrOn                    string
	FiltersDateDays                            string
	FiltersDateMonths                          string
	FiltersDateAnd                             string
	FiltersDateTo                              string
	FiltersNumberEquals                        string
	FiltersNumberBetween                       string
	FiltersNumberGreaterThan                   string
	FiltersNumberLessThan                      string
	FiltersNumberAnd                           string
	FiltersStringEquals                        string
	FiltersStringContains                      string
	FiltersMultipleSelectIn                    string
	FiltersMultipleSelectNotIn                 string
	PaginationRowsPerPage                      string
	ListingNoRecordToShow                      string
	ListingSelectedCountNotice                 string
	ListingClearSelection                      string
	BulkActionNoAvailableRecords               string
	BulkActionSelectedIdsProcessNoticeTemplate string
	ConfirmDialogPromptText                    string
	Language                                   string
	Colon                                      string
	NotFoundPageNotice                         string
}

func MustGetMessages

func MustGetMessages(r *http.Request) *Messages

func (*Messages) BulkActionSelectedIdsProcessNotice

func (msgr *Messages) BulkActionSelectedIdsProcessNotice(ids string) string

func (*Messages) CreatingObjectTitle

func (msgr *Messages) CreatingObjectTitle(modelName string) string

func (*Messages) DeleteConfirmationText

func (msgr *Messages) DeleteConfirmationText(id string) string

func (*Messages) DetailingObjectTitle

func (msgr *Messages) DetailingObjectTitle(label string, name string) string

func (*Messages) EditingObjectTitle

func (msgr *Messages) EditingObjectTitle(label string, name string) string

func (*Messages) FilterBy

func (msgr *Messages) FilterBy(filter string) string

func (*Messages) ListingObjectTitle

func (msgr *Messages) ListingObjectTitle(label string) string

type MessagesFunc

type MessagesFunc func(r *http.Request) *Messages

type ModelBuilder

type ModelBuilder struct {
	web.EventsHub
	// contains filtered or unexported fields
}

func NewModelBuilder

func NewModelBuilder(p *Builder, model interface{}) (mb *ModelBuilder)

func (*ModelBuilder) DefaultURLQueryFunc

func (mb *ModelBuilder) DefaultURLQueryFunc(v func(*http.Request) url.Values) (r *ModelBuilder)

func (*ModelBuilder) Detailing

func (mb *ModelBuilder) Detailing(vs ...interface{}) (r *DetailingBuilder)

string / []string / *FieldsSection

func (*ModelBuilder) Editing

func (mb *ModelBuilder) Editing(vs ...interface{}) (r *EditingBuilder)

string / []string / *FieldsSection

func (*ModelBuilder) InMenu

func (mb *ModelBuilder) InMenu(v bool) (r *ModelBuilder)

func (*ModelBuilder) Info

func (mb *ModelBuilder) Info() (r *ModelInfo)

func (*ModelBuilder) Label

func (mb *ModelBuilder) Label(v string) (r *ModelBuilder)

func (*ModelBuilder) Labels

func (mb *ModelBuilder) Labels(vs ...string) (r *ModelBuilder)

func (*ModelBuilder) LayoutConfig

func (mb *ModelBuilder) LayoutConfig(v *LayoutConfig) (r *ModelBuilder)
func (mb *ModelBuilder) Link(v string) *ModelBuilder

func (*ModelBuilder) Listing

func (mb *ModelBuilder) Listing(vs ...string) (r *ListingBuilder)

func (*ModelBuilder) MenuIcon

func (mb *ModelBuilder) MenuIcon(v string) (r *ModelBuilder)

func (*ModelBuilder) NewModel

func (mb *ModelBuilder) NewModel() (r interface{})

func (*ModelBuilder) NewModelSlice

func (mb *ModelBuilder) NewModelSlice() (r interface{})

func (*ModelBuilder) Placeholders

func (mb *ModelBuilder) Placeholders(vs ...string) (r *ModelBuilder)

func (*ModelBuilder) PrimaryField

func (mb *ModelBuilder) PrimaryField(v string) (r *ModelBuilder)

func (*ModelBuilder) RightDrawerWidth

func (mb *ModelBuilder) RightDrawerWidth(v string) *ModelBuilder

func (*ModelBuilder) Singleton

func (mb *ModelBuilder) Singleton(v bool) (r *ModelBuilder)

func (*ModelBuilder) URIName

func (mb *ModelBuilder) URIName(v string) (r *ModelBuilder)

type ModelInfo

type ModelInfo struct {
	// contains filtered or unexported fields
}

func (ModelInfo) DetailingHref

func (b ModelInfo) DetailingHref(id string) string

func (ModelInfo) DetailingInDrawer

func (b ModelInfo) DetailingInDrawer() bool

func (ModelInfo) EditingHref

func (b ModelInfo) EditingHref(id string) string

func (ModelInfo) HasDetailing

func (b ModelInfo) HasDetailing() bool

func (ModelInfo) Label

func (b ModelInfo) Label() string

func (ModelInfo) ListingHref

func (b ModelInfo) ListingHref() string

func (ModelInfo) PresetsPrefix

func (b ModelInfo) PresetsPrefix() string

func (ModelInfo) URIName

func (b ModelInfo) URIName() string

func (ModelInfo) Verifier

func (b ModelInfo) Verifier() *perm.Verifier

type ModifiedIndexesBuilder

type ModifiedIndexesBuilder struct {
	// contains filtered or unexported fields
}

func ContextModifiedIndexesBuilder

func ContextModifiedIndexesBuilder(ctx *web.EventContext) (r *ModifiedIndexesBuilder)

func (*ModifiedIndexesBuilder) AppendDeleted

func (b *ModifiedIndexesBuilder) AppendDeleted(sliceFormKey string, index int) (r *ModifiedIndexesBuilder)

func (*ModifiedIndexesBuilder) DeletedContains

func (b *ModifiedIndexesBuilder) DeletedContains(sliceFormKey string, index int) (r bool)

func (*ModifiedIndexesBuilder) FromHidden

func (b *ModifiedIndexesBuilder) FromHidden(req *http.Request) (r *ModifiedIndexesBuilder)

func (*ModifiedIndexesBuilder) ReversedmodifiedIndexes

func (b *ModifiedIndexesBuilder) ReversedmodifiedIndexes(sliceFormKey string) (r []int)

func (*ModifiedIndexesBuilder) SetSorted

func (b *ModifiedIndexesBuilder) SetSorted(sliceFormKey string, indexes []string) (r *ModifiedIndexesBuilder)

func (*ModifiedIndexesBuilder) SortedForEach

func (b *ModifiedIndexesBuilder) SortedForEach(slice interface{}, sliceFormKey string, f func(obj interface{}, i int))

func (*ModifiedIndexesBuilder) ToFormHidden

func (b *ModifiedIndexesBuilder) ToFormHidden() h.HTMLComponent

type NameLabel

type NameLabel struct {
	// contains filtered or unexported fields
}

type NestedConfig

type NestedConfig interface {
	// contains filtered or unexported methods
}

type ObjectComponentFunc

type ObjectComponentFunc func(obj interface{}, ctx *web.EventContext) h.HTMLComponent

type OptionItem

type OptionItem struct {
	Text  string `json:"text,omitempty"`
	Value string `json:"value,omitempty"`
	Icon  string `json:"icon,omitempty"`
}

type OrderableField

type OrderableField struct {
	FieldName string
	DBColumn  string
}

type RemoveListItemRowEvent

type RemoveListItemRowEvent struct {
	Event string
}

type RowFunc

type RowFunc func(obj interface{}, formKey string, content h.HTMLComponent, ctx *web.EventContext) h.HTMLComponent

type RowMenuBuilder

type RowMenuBuilder struct {
	// contains filtered or unexported fields
}

func (*RowMenuBuilder) Empty

func (b *RowMenuBuilder) Empty()

func (*RowMenuBuilder) RowMenuItem

func (b *RowMenuBuilder) RowMenuItem(name string) *RowMenuItemBuilder

type RowMenuItemBuilder

type RowMenuItemBuilder struct {
	// contains filtered or unexported fields
}

func (*RowMenuItemBuilder) ComponentFunc

func (*RowMenuItemBuilder) Icon

func (*RowMenuItemBuilder) OnClick

func (*RowMenuItemBuilder) PermAction

func (b *RowMenuItemBuilder) PermAction(v string) *RowMenuItemBuilder

type RowMenuItemClickFunc

type RowMenuItemClickFunc func(ctx *web.EventContext, id string) (r web.EventResponse, err error)

type SQLCondition

type SQLCondition struct {
	Query string
	Args  []interface{}
}

type SaveFunc

type SaveFunc func(obj interface{}, id string, ctx *web.EventContext) (err error)

type SearchFunc

type SearchFunc func(model interface{}, params *SearchParams, ctx *web.EventContext) (r interface{}, totalCount int, err error)

type SearchParams

type SearchParams struct {
	KeywordColumns []string
	Keyword        string
	SQLConditions  []*SQLCondition
	PerPage        int64
	Page           int64
	OrderBy        string
	PageURL        *url.URL
}

type SetterFunc

type SetterFunc func(obj interface{}, ctx *web.EventContext)

type SlugDecoder

type SlugDecoder interface {
	PrimaryColumnValuesBySlug(slug string) map[string]string
}

type SlugEncoder

type SlugEncoder interface {
	PrimarySlug() string
}

type SortListItemsEvent

type SortListItemsEvent struct {
	Event string
}

type ValidateFunc

type ValidateFunc func(obj interface{}, ctx *web.EventContext) (err web.ValidationErrors)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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