Compare commits

...

9 commits

Author SHA1 Message Date
Vanessa
2570a971a2 🚨
Some checks failed
Release Docker Image / build (push) Has been cancelled
2025-08-26 11:07:19 +08:00
Daniel
a4f025a2c2
🔖 Release v3.3.0 2025-08-26 11:05:10 +08:00
Vanessa
4d07212fee 🚨 2025-08-26 11:04:40 +08:00
Vanessa
877e2c4334 🎨 https://github.com/siyuan-note/siyuan/issues/10659 2025-08-26 11:03:21 +08:00
Vanessa
1017610ec8 Merge remote-tracking branch 'origin/dev' into dev 2025-08-26 10:47:21 +08:00
Vanessa
92447342b6 🎨 https://github.com/siyuan-note/siyuan/issues/10659 2025-08-26 10:47:08 +08:00
Daniel
7b995fd16c
🎨 Improve Add to Database https://github.com/siyuan-note/siyuan/issues/10659 2025-08-26 10:46:41 +08:00
Daniel
b332574217
🎨 Improve av 2025-08-26 10:38:26 +08:00
Daniel
3182f7abb8
🎨 Improve Add to Database https://github.com/siyuan-note/siyuan/issues/10659 2025-08-26 10:01:22 +08:00
13 changed files with 2941 additions and 3742 deletions

View file

@ -9,7 +9,7 @@
<Identity Name="89C2A984.SiYuan"
ProcessorArchitecture="x64"
Publisher="CN=087C656E-C1D9-42D8-8807-CED45A74FC0F"
Version="3.2.1.0"/>
Version="3.3.0.0"/>
<Properties>
<DisplayName>SiYuan</DisplayName>
<PublisherDisplayName>云南链滴科技有限公司</PublisherDisplayName>

View file

@ -1,6 +1,6 @@
{
"name": "SiYuan",
"version": "3.2.1",
"version": "3.3.0",
"description": "Refactor your thinking",
"homepage": "https://b3log.org/siyuan",
"main": "./electron/main.js",

6538
app/pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -255,10 +255,10 @@ ${checkUpdateHTML}
});
});
about.element.querySelector("#vacuumDataIndex").addEventListener("click", () => {
fetchPost("/api/system/vacuumDataIndex", {}, (response) => {});
fetchPost("/api/system/vacuumDataIndex", {}, () => {});
});
about.element.querySelector("#rebuildDataIndex").addEventListener("click", () => {
fetchPost("/api/system/rebuildDataIndex", {}, (response) => {});
fetchPost("/api/system/rebuildDataIndex", {}, () => {});
});
about.element.querySelector("#exportLog").addEventListener("click", () => {
fetchPost("/api/system/exportLog", {}, (response) => {

View file

@ -300,12 +300,12 @@ export const initAbout = () => {
event.stopPropagation();
break;
} else if (target.id === "vacuumDataIndex") {
fetchPost("/api/system/vacuumDataIndex", {}, (response) => {});
fetchPost("/api/system/vacuumDataIndex", {}, () => {});
event.preventDefault();
event.stopPropagation();
break;
} else if (target.id === "rebuildDataIndex") {
fetchPost("/api/system/rebuildDataIndex", {}, (response) => {});
fetchPost("/api/system/rebuildDataIndex", {}, () => {});
event.preventDefault();
event.stopPropagation();
break;

View file

@ -9,7 +9,7 @@ import {updateAttrViewCellAnimation} from "./action";
import {focusBlock} from "../../util/selection";
import {setPosition} from "../../../util/setPosition";
import * as dayjs from "dayjs";
import {getFieldsByData} from "./view";
import {getFieldsByData, getViewName} from "./view";
import {getColId} from "./col";
import {getFieldIdByCellElement} from "./row";
import {isMobile} from "../../../util/functions";
@ -21,6 +21,7 @@ interface IAVItem {
hPath: string;
viewName: string;
viewID: string;
viewLayout: string;
}
const genSearchList = (element: Element, keyword: string, avId?: string, excludes = true, cb?: () => void) => {
@ -32,10 +33,10 @@ const genSearchList = (element: Element, keyword: string, avId?: string, exclude
response.data.results.forEach((item: IAVItem & { children: IAVItem[] }, index: number) => {
const hasChildren = item.children && item.children.length > 0 && excludes;
html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}" data-av-id="${item.avID}" data-block-id="${item.blockID}">
<span class="b3-list-item__toggle b3-list-item__toggle--hl${excludes ? "" : " fn__none"}" style="align-self: flex-start;margin-top: 4px;">
<span class="b3-list-item__toggle b3-list-item__toggle--hl${excludes ? "" : " fn__none"}" style="height:auto;align-self: stretch;margin: 4px 0;">
<svg class="b3-list-item__arrow">${hasChildren ? '<use xlink:href="#iconRight"></use>' : ""}</svg>
</span>
<span class="fn__space"></span>
<span class="fn__space--small"></span>
<div class="b3-list-item--two fn__flex-1">
<div class="b3-list-item__first">
<span class="b3-list-item__text">${escapeHtml(item.avName || window.siyuan.languages._kernel[267])}</span>
@ -47,9 +48,10 @@ const genSearchList = (element: Element, keyword: string, avId?: string, exclude
if (hasChildren) {
html += '<div class="fn__none">';
item.children.forEach((subItem) => {
const viewDefaultName = getViewName(subItem.viewLayout);
html += `<div style="padding-left: 48px;" class="b3-list-item b3-list-item--narrow" data-av-id="${subItem.avID}" data-view-id="${subItem.viewID}">
<span class="b3-list-item__text">${escapeHtml(subItem.avName || window.siyuan.languages._kernel[267])}</span>
<span class="b3-list-item__meta">${escapeHtml(subItem.viewName)}</span>
<span class="b3-list-item__meta">${escapeHtml(subItem.viewName)}${viewDefaultName === subItem.viewName ? "" : " - " + viewDefaultName}</span>
</div>`;
});
html += "</div>";

View file

@ -331,6 +331,10 @@ func addAttributeViewBlocks(c *gin.Context) {
if blockIDArg := arg["blockID"]; nil != blockIDArg {
blockID = blockIDArg.(string)
}
var viewID string
if viewIDArg := arg["viewID"]; nil != viewIDArg {
viewID = viewIDArg.(string)
}
var groupID string
if groupIDArg := arg["groupID"]; nil != groupIDArg {
groupID = groupIDArg.(string)
@ -351,7 +355,7 @@ func addAttributeViewBlocks(c *gin.Context) {
ignoreDefaultFill = arg["ignoreDefaultFill"].(bool)
}
err := model.AddAttributeViewBlock(nil, srcs, avID, blockID, groupID, previousID, ignoreDefaultFill, map[string]interface{}{})
err := model.AddAttributeViewBlock(nil, srcs, avID, blockID, viewID, groupID, previousID, ignoreDefaultFill, map[string]interface{}{})
if err != nil {
ret.Code = -1
ret.Msg = err.Error()

View file

@ -138,18 +138,17 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, rowID st
return true
}
switch filter.Operator {
case FilterOperatorIsEmpty:
return value.IsEmpty()
case FilterOperatorIsNotEmpty:
return !value.IsEmpty()
}
if nil != value.Rollup && KeyTypeRollup == value.Type && nil != filter.Value && KeyTypeRollup == filter.Value.Type &&
nil != filter.Value.Rollup && 0 < len(filter.Value.Rollup.Contents) {
// 单独处理汇总类型的比较
// 处理为空和不为空
switch filter.Operator {
case FilterOperatorIsEmpty:
return 0 == len(value.Rollup.Contents)
case FilterOperatorIsNotEmpty:
return 0 != len(value.Rollup.Contents)
}
// 处理值比较
key, _ := attrView.GetKey(value.KeyID)
if nil == key {
@ -215,14 +214,6 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, rowID st
nil != filter.Value.Relation && 0 < len(filter.Value.Relation.BlockIDs) {
// 单独处理关联类型的比较
// 处理为空和不为空
switch filter.Operator {
case FilterOperatorIsEmpty:
return 0 == len(value.Relation.Contents)
case FilterOperatorIsNotEmpty:
return 0 != len(value.Relation.Contents)
}
for _, relationValue := range value.Relation.Contents {
filterValue := &Value{Type: KeyTypeBlock, Block: &ValueBlock{Content: filter.Value.Relation.BlockIDs[0]}}
@ -256,6 +247,13 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, rowID st
}
func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDate, operator FilterOperator) bool {
switch operator {
case FilterOperatorIsEmpty:
return value.IsEmpty()
case FilterOperatorIsNotEmpty:
return !value.IsEmpty()
}
switch value.Type {
case KeyTypeBlock:
if nil != value.Block && nil != other && nil != other.Block {
@ -284,10 +282,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
return value.Number.Content < other.Number.Content
case FilterOperatorIsLessOrEqual:
return value.Number.Content <= other.Number.Content
case FilterOperatorIsEmpty:
return !value.Number.IsNotEmpty
case FilterOperatorIsNotEmpty:
return value.Number.IsNotEmpty
}
}
case KeyTypeDate:
@ -298,13 +292,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
}
if nil != value.Date {
switch operator {
case FilterOperatorIsEmpty:
return !value.Date.IsNotEmpty
case FilterOperatorIsNotEmpty:
return value.Date.IsNotEmpty
}
if !value.Date.IsNotEmpty {
// 空值不进行比较,直接排除
// Database date filter excludes empty values https://github.com/siyuan-note/siyuan/issues/11061
@ -352,12 +339,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
case KeyTypeSelect, KeyTypeMSelect:
if nil != value.MSelect {
if 1 > len(other.MSelect) {
switch operator {
case FilterOperatorIsEmpty:
return value.IsEmpty()
case FilterOperatorIsNotEmpty:
return !value.IsEmpty()
}
return true
}
@ -423,10 +404,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
}
}
return !contains
case FilterOperatorIsEmpty:
return 0 == len(value.MAsset) || 1 == len(value.MAsset) && "" == value.MAsset[0].Content
case FilterOperatorIsNotEmpty:
return 0 != len(value.MAsset) && !(1 == len(value.MAsset) && "" == value.MAsset[0].Content)
}
}
case KeyTypeTemplate:
@ -482,10 +459,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
return true
}
return strings.HasSuffix(value.Template.Content, other.Template.Content)
case FilterOperatorIsEmpty:
return "" == strings.TrimSpace(value.Template.Content)
case FilterOperatorIsNotEmpty:
return "" != strings.TrimSpace(value.Template.Content)
}
}
case KeyTypeCheckbox:
@ -498,13 +471,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
}
}
}
switch operator {
case FilterOperatorIsEmpty:
return value.IsEmpty()
case FilterOperatorIsNotEmpty:
return !value.IsEmpty()
}
return false
}

View file

@ -355,7 +355,7 @@ func (value *Value) IsEmpty() bool {
if nil == value.Template {
return true
}
return "" == value.Template.Content
return "" == strings.TrimSpace(value.Template.Content)
case KeyTypeCreated:
if nil == value.Created {
return true

View file

@ -1232,13 +1232,14 @@ func GetAttributeView(avID string) (ret *av.AttributeView) {
}
type AvSearchResult struct {
AvID string `json:"avID"`
AvName string `json:"avName"`
ViewName string `json:"viewName"`
ViewID string `json:"viewID"`
BlockID string `json:"blockID"`
HPath string `json:"hPath"`
Children []*AvSearchResult `json:"children,omitempty"`
AvID string `json:"avID"`
AvName string `json:"avName"`
ViewName string `json:"viewName"`
ViewID string `json:"viewID"`
ViewLayout av.LayoutType `json:"viewLayout"`
BlockID string `json:"blockID"`
HPath string `json:"hPath"`
Children []*AvSearchResult `json:"children,omitempty"`
}
type AvSearchTempResult struct {
@ -1392,12 +1393,13 @@ func SearchAttributeView(keyword string, excludeAvIDs []string) (ret []*AvSearch
for _, view := range attrView.Views {
child := &AvSearchResult{
AvID: avID,
AvName: existAv.AvName,
ViewName: view.Name,
ViewID: view.ID,
BlockID: blockID,
HPath: hPath,
AvID: avID,
AvName: existAv.AvName,
ViewName: view.Name,
ViewID: view.ID,
ViewLayout: view.LayoutType,
BlockID: blockID,
HPath: hPath,
}
parent.Children = append(parent.Children, child)
}
@ -2962,14 +2964,14 @@ func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr)
operation.Context = map[string]interface{}{}
}
err := AddAttributeViewBlock(tx, operation.Srcs, operation.AvID, operation.BlockID, operation.GroupID, operation.PreviousID, operation.IgnoreDefaultFill, operation.Context)
err := AddAttributeViewBlock(tx, operation.Srcs, operation.AvID, operation.BlockID, operation.ViewID, operation.GroupID, operation.PreviousID, operation.IgnoreDefaultFill, operation.Context)
if err != nil {
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID, dbBlockID, groupID, previousItemID string, ignoreDefaultFill bool, context map[string]interface{}) (err error) {
func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID, dbBlockID, viewID, groupID, previousItemID string, ignoreDefaultFill bool, context map[string]interface{}) (err error) {
slices.Reverse(srcs) // https://github.com/siyuan-note/siyuan/issues/11286
now := time.Now().UnixMilli()
@ -3004,14 +3006,14 @@ func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID,
if nil != src["content"] {
srcContent = src["content"].(string)
}
if avErr := addAttributeViewBlock(now, avID, dbBlockID, groupID, previousItemID, srcItemID, boundBlockID, srcContent, isDetached, ignoreDefaultFill, tree, tx, context); nil != avErr {
if avErr := addAttributeViewBlock(now, avID, dbBlockID, viewID, groupID, previousItemID, srcItemID, boundBlockID, srcContent, isDetached, ignoreDefaultFill, tree, tx, context); nil != avErr {
return avErr
}
}
return
}
func addAttributeViewBlock(now int64, avID, dbBlockID, groupID, previousItemID, addingItemID, addingBoundBlockID, addingBlockContent string, isDetached, ignoreDefaultFill bool, tree *parse.Tree, tx *Transaction, context map[string]interface{}) (err error) {
func addAttributeViewBlock(now int64, avID, dbBlockID, viewID, groupID, previousItemID, addingItemID, addingBoundBlockID, addingBlockContent string, isDetached, ignoreDefaultFill bool, tree *parse.Tree, tx *Transaction, context map[string]interface{}) (err error) {
var node *ast.Node
if !isDetached {
node = treenode.GetNodeInTree(tree, addingBoundBlockID)
@ -3083,6 +3085,14 @@ func addAttributeViewBlock(now int64, avID, dbBlockID, groupID, previousItemID,
return
}
if "" != viewID {
view = attrView.GetView(viewID)
if nil == view {
logging.LogErrorf("get view by view ID [%s] failed", viewID)
return av.ErrViewNotFound
}
}
groupView := view
if "" != groupID {
groupView = view.GetGroupByID(groupID)

View file

@ -991,7 +991,7 @@ func DuplicateDoc(tree *parse.Tree) {
AddAttributeViewBlock(nil, []map[string]interface{}{{
"id": n.ID,
"isDetached": false,
}}, avID, "", "", "", false, map[string]interface{}{})
}}, avID, "", "", "", "", false, map[string]interface{}{})
ReloadAttrView(avID)
}
return ast.WalkContinue

View file

@ -1099,7 +1099,7 @@ func (tx *Transaction) doLargeInsert(previousID string) (ret *TxErr) {
AddAttributeViewBlock(tx, []map[string]interface{}{{
"id": insertedNode.ID,
"isDetached": false,
}}, avID, "", "", previousID, false, map[string]interface{}{})
}}, avID, "", "", "", previousID, false, map[string]interface{}{})
ReloadAttrView(avID)
}
@ -1284,7 +1284,7 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
AddAttributeViewBlock(tx, []map[string]interface{}{{
"id": insertedNode.ID,
"isDetached": false,
}}, avID, "", "", previousID, false, map[string]interface{}{})
}}, avID, "", "", "", previousID, false, map[string]interface{}{})
ReloadAttrView(avID)
}
@ -1727,6 +1727,7 @@ type Operation struct {
Layout av.LayoutType `json:"layout"` // 属性视图布局类型
GroupID string `json:"groupID"` // 属性视图分组视图 ID
TargetGroupID string `json:"targetGroupID"` // 属性视图目标分组视图 ID
ViewID string `json:"viewID"` // 属性视图视图 ID
IgnoreDefaultFill bool `json:"ignoreDefaultFill"` // 是否忽略默认填充
Context map[string]interface{} `json:"context"` // 上下文信息

View file

@ -45,7 +45,7 @@ import (
var Mode = "prod"
const (
Ver = "3.2.1"
Ver = "3.3.0"
IsInsider = false
// env vars as fallback for commandline parameters