navigate

package
v0.9.28 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: AGPL-3.0 Imports: 5 Imported by: 31

README

后台导航菜单

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeatureChecker = func(feature string) bool {
	return true
}

Functions

func GetGroupIndexes added in v0.9.5

func GetGroupIndexes(name string) map[string]int

func HasGroup added in v0.9.5

func HasGroup(name string, group string) bool

func RegisterGroup added in v0.9.5

func RegisterGroup(name string, groups ...Group)

func UnregisterGroup added in v0.9.5

func UnregisterGroup(name string, group string)

Types

type Checker

type Checker interface {
	Check(echo.Context, string) bool
}

type Filter

type Filter struct {
	Checker
}

func NewFilter

func NewFilter(checker Checker) *Filter

func (*Filter) FilterNavigate

func (r *Filter) FilterNavigate(ctx echo.Context, navList *List) List

FilterNavigate 过滤导航菜单,只显示有权限的菜单

func (*Filter) HasNavigate

func (r *Filter) HasNavigate(ctx echo.Context, navList *List) bool

type Group added in v0.9.5

type Group struct {
	Icon  string
	Label string
	Group string
}

func GetGroups added in v0.9.5

func GetGroups(name string) []Group

type Groups added in v0.9.5

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

func (*Groups) Slice added in v0.9.5

func (g *Groups) Slice() []Group

type Item

type Item struct {
	Display    bool        `json:",omitempty" xml:",omitempty"` //是否在菜单上显示
	Name       string      `json:",omitempty" xml:",omitempty"` //名称
	Action     string      `json:",omitempty" xml:",omitempty"` //操作(一般为网址)
	Icon       string      `json:",omitempty" xml:",omitempty"` //图标
	Badge      string      `json:",omitempty" xml:",omitempty"` // <sup class="badge badge-danger">123</sup>
	Target     string      `json:",omitempty" xml:",omitempty"` //打开方式
	Unlimited  bool        `json:",omitempty" xml:",omitempty"` //是否不限制权限
	Feature    string      `json:",omitempty" xml:",omitempty"` //功能
	Group      string      `json:",omitempty" xml:",omitempty"` //组标识(仅部分地方有用到)
	Attributes echo.KVList `json:",omitempty" xml:",omitempty"` //HTML标签a属性
	Children   *List       `json:",omitempty" xml:",omitempty"` //子菜单
}

Item 操作

func (*Item) FullPath

func (a *Item) FullPath(parentPath string) string

func (*Item) GetGroups added in v0.9.5

func (a *Item) GetGroups(name string) []Group

func (*Item) IsValid added in v0.7.1

func (a *Item) IsValid() bool

type List

type List []*Item

List 操作列表

func (*List) Add

func (a *List) Add(index int, list ...*Item) *List

Add 添加列表项

func (*List) AddChild

func (a *List) AddChild(action string, index int, list ...*Item) *List

func (*List) ChildItem

func (a *List) ChildItem(actions ...string) *Item

func (*List) ChildList

func (a *List) ChildList(actions ...string) *List

func (*List) ChildrenBy

func (a *List) ChildrenBy(index int) *List

ChildrenBy 添加列表项

func (*List) FullPath

func (a *List) FullPath(parentPath string) []string

func (*List) Get

func (a *List) Get(index int) *Item

Get 添加列表项

func (*List) Remove

func (a *List) Remove(index int) *List

Remove 删除元素

func (*List) ReplaceChild

func (a *List) ReplaceChild(action string, childAction string, newItem *Item) bool

func (*List) ReplaceOrAddChild

func (a *List) ReplaceOrAddChild(action string, childAction string, newItem *Item) *List

func (*List) Set

func (a *List) Set(index int, list ...*Item) *List

Set 设置元素

func (*List) Size

func (a *List) Size() int

Size 子项数量

type NavigateType string
const (
	Left   NavigateType = `left`
	Top    NavigateType = `top`
	Right  NavigateType = `right`
	Bottom NavigateType = `bottom`
)
type Navigates map[NavigateType]*List
func (n *Navigates) Add(typ NavigateType, nav *List)
func (n *Navigates) AddBottomItems(index int, items ...*Item)
func (n *Navigates) AddItems(typ NavigateType, index int, items ...*Item)
func (n *Navigates) AddLeftItems(index int, items ...*Item)
func (n *Navigates) AddRightItems(index int, items ...*Item)
func (n *Navigates) AddTopItems(index int, items ...*Item)
func (n *Navigates) Get(typ NavigateType) (nav *List)
func (n *Navigates) GetBottom() *List
func (n *Navigates) GetLeft() *List
func (n *Navigates) GetRight() *List
func (n *Navigates) GetTop() *List
func (n *Navigates) GroupedChildren(prefix string)
func (n *Navigates) Remove(typ NavigateType) bool

type ProjectItem

type ProjectItem struct {
	Name    string
	Ident   string
	URL     string
	NavList *List
}

func NewProject

func NewProject(name string, ident string, url string, navLists ...*List) *ProjectItem

func (*ProjectItem) GetIdent

func (a *ProjectItem) GetIdent() string

func (*ProjectItem) GetName

func (a *ProjectItem) GetName() string

func (*ProjectItem) GetURL

func (a *ProjectItem) GetURL() string

func (*ProjectItem) Is

func (a *ProjectItem) Is(ident string) bool

type ProjectList

type ProjectList []*ProjectItem

func (*ProjectList) Add

func (a *ProjectList) Add(index int, list ...*ProjectItem) *ProjectList

Add 添加列表项

func (*ProjectList) Remove

func (a *ProjectList) Remove(index int) *ProjectList

Remove 删除元素

func (*ProjectList) SearchIdent

func (a *ProjectList) SearchIdent(ident string) int

func (*ProjectList) Set

func (a *ProjectList) Set(index int, list ...*ProjectItem) *ProjectList

Set 设置元素

type ProjectNavigates

type ProjectNavigates struct {
	*Navigates

	Projects *Projects
	// contains filtered or unexported fields
}

func NewProjectNavigates

func NewProjectNavigates(kind, baseProject string) *ProjectNavigates

func (*ProjectNavigates) AddNavList

func (p *ProjectNavigates) AddNavList(name string, ident string, url string, navList *List)

func (*ProjectNavigates) AddProject

func (p *ProjectNavigates) AddProject(index int, list ...*ProjectItem)

func (*ProjectNavigates) Init added in v0.9.5

func (p *ProjectNavigates) Init()

func (*ProjectNavigates) Project

func (p *ProjectNavigates) Project(project string) *Navigates

func (*ProjectNavigates) RemoveProject

func (p *ProjectNavigates) RemoveProject(project string)

type Projects

type Projects struct {
	List *ProjectList
	Hash map[string]*ProjectItem //项目标识(Ident)=>项目信息
	// contains filtered or unexported fields
}

func NewProjects

func NewProjects() *Projects

func (*Projects) Add

func (p *Projects) Add(index int, list ...*ProjectItem) *Projects

func (*Projects) First

func (p *Projects) First(notEmptyOpts ...bool) *ProjectItem

func (*Projects) Get

func (p *Projects) Get(ident string) *ProjectItem

func (*Projects) GetIdent

func (p *Projects) GetIdent(urlPath string) string

func (*Projects) InitURLsIdent

func (p *Projects) InitURLsIdent() *Projects

func (*Projects) Remove

func (p *Projects) Remove(index int) *Projects

func (*Projects) RemoveByIdent

func (p *Projects) RemoveByIdent(ident string)

func (*Projects) Set

func (p *Projects) Set(index int, list ...*ProjectItem) *Projects

func (*Projects) URLsIdent

func (p *Projects) URLsIdent() map[string]string

Jump to

Keyboard shortcuts

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