🎨 Support hiding database table view title https://github.com/siyuan-note/siyuan/issues/10478

This commit is contained in:
Daniel 2024-03-01 22:40:56 +08:00
parent 950a148336
commit bbf41e4769
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 40 additions and 33 deletions

View file

@ -306,10 +306,11 @@ func renderSnapshotAttributeView(c *gin.Context) {
var views []map[string]interface{}
for _, v := range attrView.Views {
view := map[string]interface{}{
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"type": v.LayoutType,
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"hideAttrViewName": v.HideAttrViewName,
"type": v.LayoutType,
}
views = append(views, view)
@ -347,10 +348,11 @@ func renderHistoryAttributeView(c *gin.Context) {
var views []map[string]interface{}
for _, v := range attrView.Views {
view := map[string]interface{}{
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"type": v.LayoutType,
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"hideAttrViewName": v.HideAttrViewName,
"type": v.LayoutType,
}
views = append(views, view)
@ -404,10 +406,11 @@ func renderAttributeView(c *gin.Context) {
var views []map[string]interface{}
for _, v := range attrView.Views {
view := map[string]interface{}{
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"type": v.LayoutType,
"id": v.ID,
"icon": v.Icon,
"name": v.Name,
"hideAttrViewName": v.HideAttrViewName,
"type": v.LayoutType,
}
views = append(views, view)

View file

@ -815,15 +815,16 @@ func (value *Value) compareOperator(filter *ViewFilter) bool {
// Table 描述了表格实例的结构。
type Table struct {
ID string `json:"id"` // 表格布局 ID
Icon string `json:"icon"` // 表格图标
Name string `json:"name"` // 表格名称
Filters []*ViewFilter `json:"filters"` // 过滤规则
Sorts []*ViewSort `json:"sorts"` // 排序规则
Columns []*TableColumn `json:"columns"` // 表格列
Rows []*TableRow `json:"rows"` // 表格行
RowCount int `json:"rowCount"` // 表格总行数
PageSize int `json:"pageSize"` // 每页行数
ID string `json:"id"` // 表格布局 ID
Icon string `json:"icon"` // 表格图标
Name string `json:"name"` // 表格名称
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称
Filters []*ViewFilter `json:"filters"` // 过滤规则
Sorts []*ViewSort `json:"sorts"` // 排序规则
Columns []*TableColumn `json:"columns"` // 表格列
Rows []*TableRow `json:"rows"` // 表格行
RowCount int `json:"rowCount"` // 表格总行数
PageSize int `json:"pageSize"` // 每页行数
}
type TableColumn struct {

View file

@ -729,13 +729,14 @@ func renderTemplateCol(ial map[string]string, tplContent string, rowValues []*av
func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *av.Table, err error) {
ret = &av.Table{
ID: view.ID,
Icon: view.Icon,
Name: view.Name,
Columns: []*av.TableColumn{},
Rows: []*av.TableRow{},
Filters: view.Table.Filters,
Sorts: view.Table.Sorts,
ID: view.ID,
Icon: view.Icon,
Name: view.Name,
HideAttrViewName: view.HideAttrViewName,
Columns: []*av.TableColumn{},
Rows: []*av.TableRow{},
Filters: view.Table.Filters,
Sorts: view.Table.Sorts,
}
// 组装列
@ -1332,6 +1333,7 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr
view.Icon = masterView.Icon
view.Name = attrView.GetDuplicateViewName(masterView.Name)
view.LayoutType = masterView.LayoutType
view.HideAttrViewName = masterView.HideAttrViewName
for _, col := range masterView.Table.Columns {
view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{

View file

@ -651,11 +651,12 @@ func getAttributeViewContent(avID string) (content string) {
func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *av.Table, err error) {
ret = &av.Table{
ID: view.ID,
Icon: view.Icon,
Name: view.Name,
Columns: []*av.TableColumn{},
Rows: []*av.TableRow{},
ID: view.ID,
Icon: view.Icon,
Name: view.Name,
HideAttrViewName: view.HideAttrViewName,
Columns: []*av.TableColumn{},
Rows: []*av.TableRow{},
}
// 组装列