mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0e8d07ac4d
6 changed files with 50 additions and 7 deletions
2
app/stage/protyle/js/lute/lute.min.js
vendored
2
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -558,6 +558,13 @@ func filterTextContent(operator FilterOperator, valueContent, otherValueContent
|
|||
|
||||
func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterOperator, otherValueStart, otherValueEnd time.Time, direction RelativeDateDirection, otherValueStart2, otherValueEnd2 time.Time, direction2 RelativeDateDirection) bool {
|
||||
valueTime := time.UnixMilli(valueMills)
|
||||
|
||||
if otherValueStart.After(otherValueStart2) {
|
||||
tmpStart, tmpEnd := otherValueStart2, otherValueEnd2
|
||||
otherValueStart2, otherValueEnd2 = otherValueStart, otherValueEnd
|
||||
otherValueStart, otherValueEnd = tmpStart, tmpEnd
|
||||
}
|
||||
|
||||
switch operator {
|
||||
case FilterOperatorIsEqual:
|
||||
return (valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && valueTime.Before(otherValueEnd)
|
||||
|
@ -649,6 +656,13 @@ func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterO
|
|||
|
||||
func filterTime(valueMills int64, valueIsNotEmpty bool, otherValueMills, otherValueMills2 int64, operator FilterOperator) bool {
|
||||
valueTime := time.UnixMilli(valueMills)
|
||||
|
||||
if 0 != otherValueMills2 && otherValueMills > otherValueMills2 {
|
||||
tmp := otherValueMills2
|
||||
otherValueMills2 = otherValueMills
|
||||
otherValueMills = tmp
|
||||
}
|
||||
|
||||
otherValueTime := time.UnixMilli(otherValueMills)
|
||||
otherValueStart := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 0, 0, 0, 0, otherValueTime.Location())
|
||||
otherValueEnd := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 23, 59, 59, 999999999, otherValueTime.Location())
|
||||
|
@ -666,6 +680,9 @@ func filterTime(valueMills int64, valueIsNotEmpty bool, otherValueMills, otherVa
|
|||
case FilterOperatorIsLessOrEqual:
|
||||
return valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd)
|
||||
case FilterOperatorIsBetween:
|
||||
if 0 == otherValueMills || 0 == otherValueMills2 {
|
||||
return true
|
||||
}
|
||||
otherValueTime2 := time.UnixMilli(otherValueMills2)
|
||||
otherValueEnd2 := time.Date(otherValueTime2.Year(), otherValueTime2.Month(), otherValueTime2.Day(), 23, 59, 59, 999999999, otherValueTime2.Location())
|
||||
return (valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && (valueTime.Before(otherValueEnd2) || valueTime.Equal(otherValueEnd2))
|
||||
|
@ -857,15 +874,27 @@ func (filter *ViewFilter) GetAffectValue(key *Key, addingBlockID string) (ret *V
|
|||
case FilterOperatorIsNotEqual:
|
||||
ret.Date = &ValueDate{Content: util.CurrentTimeMillis(), IsNotEmpty: true}
|
||||
case FilterOperatorIsGreater:
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content + 1000*60, IsNotEmpty: true}
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content + 1000*60*60*24, IsNotEmpty: true}
|
||||
case FilterOperatorIsGreaterOrEqual:
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content, IsNotEmpty: true}
|
||||
case FilterOperatorIsLess:
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content - 1000*60, IsNotEmpty: true}
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content - 1000*60*60*24, IsNotEmpty: true}
|
||||
case FilterOperatorIsLessOrEqual:
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content, IsNotEmpty: true}
|
||||
case FilterOperatorIsBetween:
|
||||
ret.Date = &ValueDate{Content: filter.Value.Date.Content - 1000*60, IsNotEmpty: true}
|
||||
start := filter.Value.Date.Content
|
||||
end := filter.Value.Date.Content2
|
||||
if start > end {
|
||||
tmp := end
|
||||
end = start
|
||||
start = tmp
|
||||
}
|
||||
now := util.CurrentTimeMillis()
|
||||
if start <= now && now <= end {
|
||||
ret.Date = &ValueDate{Content: now, IsNotEmpty: true}
|
||||
return
|
||||
}
|
||||
ret.Date = &ValueDate{Content: start, IsNotEmpty: true}
|
||||
case FilterOperatorIsEmpty:
|
||||
ret.Date = &ValueDate{Content: 0, IsNotEmpty: false}
|
||||
case FilterOperatorIsNotEmpty:
|
||||
|
|
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
|
||||
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689
|
||||
github.com/88250/lute v1.7.7-0.20250809022544-9aa600742e38
|
||||
github.com/88250/lute v1.7.7-0.20250821111531-5829333cadc9
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||
github.com/ConradIrwin/font v0.2.1
|
||||
|
|
|
@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
|
|||
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689 h1:39y5g7vnFAIcXhTN3IXPk7h2xBhC4a9hBTykDhHJqRY=
|
||||
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689/go.mod h1:c8uVw25vW2W4dhJ/j4iYsX5H1hc19spim266jO5x2hU=
|
||||
github.com/88250/lute v1.7.7-0.20250809022544-9aa600742e38 h1:5KSB/JkJcAcT8fvJ/ls2vy5K6aWxgTipkR4cG8O9SPQ=
|
||||
github.com/88250/lute v1.7.7-0.20250809022544-9aa600742e38/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
|
||||
github.com/88250/lute v1.7.7-0.20250821111531-5829333cadc9 h1:ZvzypJeVN1JhEsFJx9jQl0HjhcmIySIm/Or8Fpcd7AA=
|
||||
github.com/88250/lute v1.7.7-0.20250821111531-5829333cadc9/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
@ -148,6 +148,13 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
|
|||
newValue = getNewValueByNearItem(nearItem, keyValues.Key, addingItemID)
|
||||
}
|
||||
if nil != newValue {
|
||||
if av.KeyTypeDate == keyValues.Key.Type {
|
||||
if nil != nearItem {
|
||||
nearValue := getNewValueByNearItem(nearItem, keyValues.Key, addingItemID)
|
||||
newValue.Date.IsNotTime = nearValue.Date.IsNotTime
|
||||
}
|
||||
}
|
||||
|
||||
ret[keyValues.Key.ID] = newValue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,6 +224,13 @@ func RenderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplCo
|
|||
dataModel["entryUpdated"] = time.UnixMilli(v.Block.Updated)
|
||||
}
|
||||
dataModel[keyValue.Key.Name] = v.String(true)
|
||||
} else if av.KeyTypeMSelect == v.Type {
|
||||
dataModel[keyValue.Key.Name+"_str"] = v.String(true)
|
||||
var contents []string
|
||||
for _, s := range v.MSelect {
|
||||
contents = append(contents, s.Content)
|
||||
}
|
||||
dataModel[keyValue.Key.Name] = contents
|
||||
} else {
|
||||
dataModel[keyValue.Key.Name] = v.String(true)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue