🎨 Keep the width when duplicating database table view field https://github.com/siyuan-note/siyuan/issues/11552
This commit is contained in:
parent
68585e21e3
commit
cb41abb7bd
5 changed files with 11 additions and 28 deletions
|
@ -36,8 +36,8 @@ export const duplicateCol = (options: {
|
|||
const blockId = options.blockElement.getAttribute("data-node-id");
|
||||
transaction(options.protyle, [{
|
||||
action: "duplicateAttrViewKey",
|
||||
keyID:newColData.id,
|
||||
nextID:options.colId,
|
||||
keyID: options.colId,
|
||||
nextID: newColData.id,
|
||||
avID: options.data.id,
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
|
|
|
@ -952,7 +952,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
|
|||
}
|
||||
view.Table.Sorts = tmpSorts
|
||||
|
||||
viewable, err = sql.RenderAttributeViewTable(attrView, view, query, GetBlockAttrsWithoutWaitWriting)
|
||||
viewable = sql.RenderAttributeViewTable(attrView, view, query, GetBlockAttrsWithoutWaitWriting)
|
||||
}
|
||||
|
||||
viewable.FilterRows(attrView)
|
||||
|
@ -1966,7 +1966,7 @@ func addAttributeViewBlock(now int64, avID, blockID, previousBlockID, addingBloc
|
|||
// 如果存在过滤条件,则将过滤条件应用到新添加的块上
|
||||
view, _ := getAttrViewViewByBlockID(attrView, blockID)
|
||||
if nil != view && 0 < len(view.Table.Filters) && !ignoreFillFilter {
|
||||
viewable, _ := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
viewable := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
viewable.FilterRows(attrView)
|
||||
viewable.SortRows(attrView)
|
||||
|
||||
|
|
|
@ -75,11 +75,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) {
|
|||
}
|
||||
|
||||
name := util.FilterFileName(getAttrViewName(attrView))
|
||||
table, err := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
if nil != err {
|
||||
logging.LogErrorf("render attribute view [%s] table failed: %s", avID, err)
|
||||
return
|
||||
}
|
||||
table := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
|
||||
// 遵循视图过滤和排序规则 Use filtering and sorting of current view settings when exporting database blocks https://github.com/siyuan-note/siyuan/issues/10474
|
||||
table.FilterRows(attrView)
|
||||
|
@ -2237,11 +2233,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
|
|||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
table, err := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
if nil != err {
|
||||
logging.LogErrorf("render attribute view [%s] table failed: %s", avID, err)
|
||||
return ast.WalkContinue
|
||||
}
|
||||
table := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
|
||||
// 遵循视图过滤和排序规则 Use filtering and sorting of current view settings when exporting database blocks https://github.com/siyuan-note/siyuan/issues/10474
|
||||
table.FilterRows(attrView)
|
||||
|
|
|
@ -314,11 +314,7 @@ func RenderTemplate(p, id string, preview bool) (tree *parse.Tree, dom string, e
|
|||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
table, renderErr := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
if nil != renderErr {
|
||||
logging.LogErrorf("render attribute view [%s] table failed: %s", n.AttributeViewID, renderErr)
|
||||
return ast.WalkContinue
|
||||
}
|
||||
table := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
|
||||
var aligns []int
|
||||
for range table.Columns {
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
)
|
||||
|
||||
func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query string,
|
||||
GetBlockAttrsWithoutWaitWriting func(id string) (ret map[string]string)) (ret *av.Table, err error) {
|
||||
GetBlockAttrsWithoutWaitWriting func(id string) (ret map[string]string)) (ret *av.Table) {
|
||||
if nil == GetBlockAttrsWithoutWaitWriting {
|
||||
GetBlockAttrsWithoutWaitWriting = func(id string) (ret map[string]string) {
|
||||
ret = cache.GetBlockIAL(id)
|
||||
|
@ -59,8 +59,8 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
|
|||
for _, col := range view.Table.Columns {
|
||||
key, getErr := attrView.GetKey(col.ID)
|
||||
if nil != getErr {
|
||||
err = getErr
|
||||
return
|
||||
logging.LogWarnf("get key [%s] failed: %s", col.ID, getErr)
|
||||
continue
|
||||
}
|
||||
|
||||
ret.Columns = append(ret.Columns, &av.TableColumn{
|
||||
|
@ -587,12 +587,7 @@ func getAttributeViewContent(avID string,
|
|||
return
|
||||
}
|
||||
|
||||
table, err := RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
if nil != err {
|
||||
content = strings.TrimSpace(buf.String())
|
||||
return
|
||||
}
|
||||
|
||||
table := RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
|
||||
for _, col := range table.Columns {
|
||||
buf.WriteString(col.Name)
|
||||
buf.WriteByte(' ')
|
||||
|
|
Loading…
Add table
Reference in a new issue