mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
97d1a6e3c1
5 changed files with 69 additions and 11 deletions
4
app/stage/protyle/js/lute/lute.min.js
vendored
4
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1666,8 +1666,8 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) {
|
|||
}
|
||||
}
|
||||
sort.Float64s(values)
|
||||
if len(values) > 0 {
|
||||
if len(values)%2 == 0 {
|
||||
if 0 < len(values) {
|
||||
if 0 == len(values)%2 {
|
||||
col.Calc.Result = &Value{Number: NewFormattedValueNumber((values[len(values)/2-1]+values[len(values)/2])/2, col.NumberFormat)}
|
||||
} else {
|
||||
col.Calc.Result = &Value{Number: NewFormattedValueNumber(values[len(values)/2], col.NumberFormat)}
|
||||
|
|
|
|||
|
|
@ -748,7 +748,11 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) {
|
|||
}
|
||||
sort.Float64s(numbers)
|
||||
if 0 < len(numbers) {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(numbers[len(numbers)/2], destKey.NumberFormat)}}
|
||||
if 0 == len(numbers)%2 {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber((numbers[len(numbers)/2-1]+numbers[len(numbers)/2])/2, destKey.NumberFormat)}}
|
||||
} else {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(numbers[len(numbers)/2], destKey.NumberFormat)}}
|
||||
}
|
||||
}
|
||||
case CalcOperatorMin:
|
||||
minVal := math.MaxFloat64
|
||||
|
|
@ -759,7 +763,9 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) {
|
|||
}
|
||||
}
|
||||
}
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(minVal, destKey.NumberFormat)}}
|
||||
if math.MaxFloat64 != minVal {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(minVal, destKey.NumberFormat)}}
|
||||
}
|
||||
case CalcOperatorMax:
|
||||
maxVal := -math.MaxFloat64
|
||||
for _, v := range r.Contents {
|
||||
|
|
@ -769,10 +775,15 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) {
|
|||
}
|
||||
}
|
||||
}
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(maxVal, destKey.NumberFormat)}}
|
||||
if -math.MaxFloat64 != maxVal {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(maxVal, destKey.NumberFormat)}}
|
||||
}
|
||||
case CalcOperatorRange:
|
||||
minVal := math.MaxFloat64
|
||||
maxVal := -math.MaxFloat64
|
||||
earliest := int64(0)
|
||||
latest := int64(0)
|
||||
var isNotTime, hasEndDate bool
|
||||
for _, v := range r.Contents {
|
||||
if KeyTypeNumber == v.Type && nil != v.Number && v.Number.IsNotEmpty {
|
||||
if v.Number.Content < minVal {
|
||||
|
|
@ -781,9 +792,56 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) {
|
|||
if v.Number.Content > maxVal {
|
||||
maxVal = v.Number.Content
|
||||
}
|
||||
} else if KeyTypeDate == v.Type && nil != v.Date && v.Date.IsNotEmpty {
|
||||
if 0 == earliest || v.Date.Content < earliest {
|
||||
earliest = v.Date.Content
|
||||
isNotTime = v.Date.IsNotTime
|
||||
hasEndDate = v.Date.HasEndDate
|
||||
}
|
||||
if 0 == latest || v.Date.Content > latest {
|
||||
latest = v.Date.Content
|
||||
isNotTime = v.Date.IsNotTime
|
||||
hasEndDate = v.Date.HasEndDate
|
||||
}
|
||||
}
|
||||
}
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(maxVal-minVal, destKey.NumberFormat)}}
|
||||
|
||||
if math.MaxFloat64 != minVal && -math.MaxFloat64 != maxVal {
|
||||
r.Contents = []*Value{{Type: KeyTypeNumber, Number: NewFormattedValueNumber(maxVal-minVal, destKey.NumberFormat)}}
|
||||
}
|
||||
if 0 != earliest && 0 != latest {
|
||||
r.Contents = []*Value{{Date: NewFormattedValueDate(earliest, latest, DateFormatDuration, isNotTime, hasEndDate)}}
|
||||
}
|
||||
case CalcOperatorEarliest:
|
||||
earliest := int64(0)
|
||||
var isNotTime, hasEndDate bool
|
||||
for _, v := range r.Contents {
|
||||
if KeyTypeDate == v.Type && nil != v.Date && v.Date.IsNotEmpty {
|
||||
if 0 == earliest || v.Date.Content < earliest {
|
||||
earliest = v.Date.Content
|
||||
isNotTime = v.Date.IsNotTime
|
||||
hasEndDate = v.Date.HasEndDate
|
||||
}
|
||||
}
|
||||
}
|
||||
if 0 != earliest {
|
||||
r.Contents = []*Value{{Date: NewFormattedValueDate(earliest, 0, DateFormatNone, isNotTime, hasEndDate)}}
|
||||
}
|
||||
case CalcOperatorLatest:
|
||||
latest := int64(0)
|
||||
var isNotTime, hasEndDate bool
|
||||
for _, v := range r.Contents {
|
||||
if KeyTypeDate == v.Type && nil != v.Date && v.Date.IsNotEmpty {
|
||||
if 0 == latest || latest < v.Date.Content {
|
||||
latest = v.Date.Content
|
||||
isNotTime = v.Date.IsNotEmpty
|
||||
hasEndDate = v.Date.HasEndDate
|
||||
}
|
||||
}
|
||||
}
|
||||
if 0 != latest {
|
||||
r.Contents = []*Value{{Date: NewFormattedValueDate(latest, 0, DateFormatNone, isNotTime, hasEndDate)}}
|
||||
}
|
||||
case CalcOperatorChecked:
|
||||
countChecked := 0
|
||||
for _, v := range r.Contents {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/88250/clipboard v0.1.5
|
||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30
|
||||
github.com/88250/lute v1.7.7-0.20240401143834-d9833d77bf0d
|
||||
github.com/88250/lute v1.7.7-0.20240406152030-c259e44d4972
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||
|
|
|
|||
|
|
@ -10,8 +10,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.20240324024901-3c1bb82cba30 h1:IeE4DVRWnVpcbMj7gGZoSMiBWs3h/ihiyOmualS1Mas=
|
||||
github.com/88250/gulu v1.2.3-0.20240324024901-3c1bb82cba30/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
||||
github.com/88250/lute v1.7.7-0.20240401143834-d9833d77bf0d h1:1pcQey1XuBc9y4t8K5dAEEx+d/+SVGIx7A2WecWkCuI=
|
||||
github.com/88250/lute v1.7.7-0.20240401143834-d9833d77bf0d/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/lute v1.7.7-0.20240406152030-c259e44d4972 h1:+9XWeigIl7gnPIbFQ/PX8LTdIUFjasMywc0/C2fveoM=
|
||||
github.com/88250/lute v1.7.7-0.20240406152030-c259e44d4972/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue