mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 19:56:10 +01:00
🎨 Add template type column to Attribute View https://github.com/siyuan-note/siyuan/issues/8766
This commit is contained in:
parent
e8359edebc
commit
c0424caf67
3 changed files with 95 additions and 21 deletions
|
|
@ -55,16 +55,17 @@ type KeyValues struct {
|
|||
type KeyType string
|
||||
|
||||
const (
|
||||
KeyTypeBlock KeyType = "block"
|
||||
KeyTypeText KeyType = "text"
|
||||
KeyTypeNumber KeyType = "number"
|
||||
KeyTypeDate KeyType = "date"
|
||||
KeyTypeSelect KeyType = "select"
|
||||
KeyTypeMSelect KeyType = "mSelect"
|
||||
KeyTypeURL KeyType = "url"
|
||||
KeyTypeEmail KeyType = "email"
|
||||
KeyTypePhone KeyType = "phone"
|
||||
KeyTypeMAsset KeyType = "mAsset"
|
||||
KeyTypeBlock KeyType = "block"
|
||||
KeyTypeText KeyType = "text"
|
||||
KeyTypeNumber KeyType = "number"
|
||||
KeyTypeDate KeyType = "date"
|
||||
KeyTypeSelect KeyType = "select"
|
||||
KeyTypeMSelect KeyType = "mSelect"
|
||||
KeyTypeURL KeyType = "url"
|
||||
KeyTypeEmail KeyType = "email"
|
||||
KeyTypePhone KeyType = "phone"
|
||||
KeyTypeMAsset KeyType = "mAsset"
|
||||
KeyTypeTemplate KeyType = "template"
|
||||
)
|
||||
|
||||
// Key 描述了属性视图属性列的基础结构。
|
||||
|
|
@ -100,15 +101,16 @@ type Value struct {
|
|||
Type KeyType `json:"type,omitempty"`
|
||||
IsDetached bool `json:"isDetached,omitempty"`
|
||||
|
||||
Block *ValueBlock `json:"block,omitempty"`
|
||||
Text *ValueText `json:"text,omitempty"`
|
||||
Number *ValueNumber `json:"number,omitempty"`
|
||||
Date *ValueDate `json:"date,omitempty"`
|
||||
MSelect []*ValueSelect `json:"mSelect,omitempty"`
|
||||
URL *ValueURL `json:"url,omitempty"`
|
||||
Email *ValueEmail `json:"email,omitempty"`
|
||||
Phone *ValuePhone `json:"phone,omitempty"`
|
||||
MAsset []*ValueAsset `json:"mAsset,omitempty"`
|
||||
Block *ValueBlock `json:"block,omitempty"`
|
||||
Text *ValueText `json:"text,omitempty"`
|
||||
Number *ValueNumber `json:"number,omitempty"`
|
||||
Date *ValueDate `json:"date,omitempty"`
|
||||
MSelect []*ValueSelect `json:"mSelect,omitempty"`
|
||||
URL *ValueURL `json:"url,omitempty"`
|
||||
Email *ValueEmail `json:"email,omitempty"`
|
||||
Phone *ValuePhone `json:"phone,omitempty"`
|
||||
MAsset []*ValueAsset `json:"mAsset,omitempty"`
|
||||
Template *ValueTemplate `json:"template,omitempty"`
|
||||
}
|
||||
|
||||
func (value *Value) String() string {
|
||||
|
|
@ -139,6 +141,8 @@ func (value *Value) String() string {
|
|||
ret = append(ret, v.Content)
|
||||
}
|
||||
return strings.Join(ret, " ")
|
||||
case KeyTypeTemplate:
|
||||
return value.Template.RenderedContent
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
|
@ -345,6 +349,11 @@ type ValueAsset struct {
|
|||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type ValueTemplate struct {
|
||||
Content string `json:"content"`
|
||||
RenderedContent string `json:"renderedContent"`
|
||||
}
|
||||
|
||||
// View 描述了视图的结构。
|
||||
type View struct {
|
||||
ID string `json:"id"` // 视图 ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue