An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Database table view supports synchronizing column width to other table views https://github.com/siyuan-note/siyuan/issues/11022
Daniel43d533ce1dc1
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex f69f085ab4..33ef7e58ee 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -44,6 +44,59 @@ import ("github.com/xrash/smetrics")+func (tx *Transaction) doSyncAttrViewTableColWidth(operation *Operation) (ret *TxErr) {+ err := syncAttrViewTableColWidth(operation)+ if err != nil {+ return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}+ }+ return+}++func syncAttrViewTableColWidth(operation *Operation) (err error) {+ attrView, err := av.ParseAttributeView(operation.AvID)+ if err != nil {+ return+ }++ view := attrView.GetView(operation.ID)+ if nil == view {+ err = av.ErrViewNotFound+ logging.LogErrorf("view [%s] not found in attribute view [%s]", operation.ID, operation.AvID)+ return+ }++ var width string+ switch view.LayoutType {+ case av.LayoutTypeTable:+ for _, column := range view.Table.Columns {+ if column.ID == operation.KeyID {+ width = operation.Data.(string)+ break+ }+ }+ case av.LayoutTypeGallery:+ return+ }++ if "" == width {+ return+ }++ for _, v := range attrView.Views {+ if av.LayoutTypeTable == v.LayoutType {+ for _, column := range v.Table.Columns {+ if column.ID == operation.KeyID {+ column.Width = width+ break+ }+ }+ }+ }++ err = av.SaveAttributeView(attrView)+ return+}+func (tx *Transaction) doSetGroupHideEmpty(operation *Operation) (ret *TxErr) {if err := SetGroupHideEmpty(operation.AvID, operation.BlockID, operation.Data.(bool)); nil != err {return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex adaebd97d2..6dc9b1c5a0 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -303,6 +303,8 @@ func performTx(tx *Transaction) (ret *TxErr) {ret = tx.doHideAttrViewGroup(op)case "setGroupHideEmpty":ret = tx.doSetGroupHideEmpty(op)+ case "syncAttrViewTableColWidth":+ ret = tx.doSyncAttrViewTableColWidth(op)}if nil != ret {@@ -1502,7 +1504,7 @@ type Operation struct {Name string `json:"name"` // 属性视图列名Typ string `json:"type"` // 属性视图列类型Format string `json:"format"` // 属性视图列格式化- KeyID string `json:"keyID"` // 属性视列 ID+ KeyID string `json:"keyID"` // 属性视图字段 IDRowID string `json:"rowID"` // 属性视图行 IDIsTwoWay bool `json:"isTwoWay"` // 属性视图关联列是否是双向关系BackRelationKeyID string `json:"backRelationKeyID"` // 属性视图关联列回链关联列的 ID