Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-02-23 18:09:26 +08:00
commit 0226bbb310
7 changed files with 34 additions and 22 deletions

View file

@ -20,7 +20,7 @@ Refactor your thinking
<br><br>
<a title="Twitter" target="_blank" href="https://twitter.com/b3logos"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/b3logos?label=Follow&style=social"></a>
<br><br>
<a href="https://www.producthunt.com/posts/siyuan?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-siyuan" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=394475&theme=light" alt="SiYuan - WYSIWYG&#0032;Block&#0032;Ref&#0032;E2EE&#0032;Sync&#0032;Local&#0045;first | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
<a href="https://www.producthunt.com/products/siyuan/reviews?utm_source=badge-product_rating&utm_medium=badge&utm_souce=badge-siyuan" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/product_rating.svg?product_id=534576&theme=light" alt="SiYuan - A&#0032;privacy&#0045;first&#0032;personal&#0032;knowledge&#0032;management&#0032;software | Product Hunt" style="width: 242px; height: 108px;" width="242" height="108" /></a>
</p>
<p align="center">

View file

@ -20,7 +20,7 @@
<br><br>
<a title="Twitter" target="_blank" href="https://twitter.com/b3logos"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/b3logos?label=Follow&style=social"></a>
<br><br>
<a href="https://www.producthunt.com/posts/siyuan?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-siyuan" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=394475&theme=light" alt="SiYuan - WYSIWYG&#0032;Block&#0032;Ref&#0032;E2EE&#0032;Sync&#0032;Local&#0045;first | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
<a href="https://www.producthunt.com/products/siyuan/reviews?utm_source=badge-product_rating&utm_medium=badge&utm_souce=badge-siyuan" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/product_rating.svg?product_id=534576&theme=light" alt="SiYuan - A&#0032;privacy&#0045;first&#0032;personal&#0032;knowledge&#0032;management&#0032;software | Product Hunt" style="width: 242px; height: 108px;" width="242" height="108" /></a>
</p>
<p align="center">

View file

@ -53,7 +53,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"dayjs": "^1.11.5",
"electron": "28.2.1",
"electron": "29.0.1",
"electron-builder": "^24.9.1",
"encoding": "^0.1.13",
"esbuild-loader": "^3.0.1",

24
app/pnpm-lock.yaml generated
View file

@ -7,7 +7,7 @@ settings:
dependencies:
'@electron/remote':
specifier: ^2.1.2
version: 2.1.2(electron@28.2.1)
version: 2.1.2(electron@29.0.1)
devDependencies:
'@types/node':
@ -32,8 +32,8 @@ devDependencies:
specifier: ^1.11.5
version: 1.11.5
electron:
specifier: 28.2.1
version: 28.2.1
specifier: 29.0.1
version: 29.0.1
electron-builder:
specifier: ^24.9.1
version: 24.9.1
@ -161,12 +161,12 @@ packages:
- supports-color
dev: true
/@electron/remote@2.1.2(electron@28.2.1):
/@electron/remote@2.1.2(electron@29.0.1):
resolution: {integrity: sha512-EPwNx+nhdrTBxyCqXt/pftoQg/ybtWDW3DUWHafejvnB1ZGGfMpv6e15D8KeempocjXe78T7WreyGGb3mlZxdA==}
peerDependencies:
electron: '>= 13.0.0'
dependencies:
electron: 28.2.1
electron: 29.0.1
dev: false
/@electron/universal@1.4.1:
@ -582,6 +582,11 @@ packages:
/@types/node@18.13.0:
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
/@types/node@20.11.20:
resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==}
dependencies:
undici-types: 5.26.5
/@types/plist@3.0.2:
resolution: {integrity: sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==}
requiresBuild: true
@ -1670,14 +1675,14 @@ packages:
resolution: {integrity: sha512-YoVeFrGd/7ROjz4R9uPoND1K/hSRC/xADy9639ZmIZeJSaBnKdYx3I6LMPsY7CXLpK7JFgKQVzeZ/dk2br6Eaw==}
dev: true
/electron@28.2.1:
resolution: {integrity: sha512-wlzXf+OvOiVlBf9dcSeMMf7Q+N6DG+wtgFbMK0sA/JpIJcdosRbLMQwLg/LTwNVKIbmayqFLDp4FmmFkEMhbYA==}
/electron@29.0.1:
resolution: {integrity: sha512-hsQr9clm8NCAMv4uhHlXThHn52UAgrHgyz3ubBAxZIPuUcpKVDtg4HPmx4hbmHIbYICI5OyLN3Ztp7rS+Dn4Lw==}
engines: {node: '>= 12.20.55'}
hasBin: true
requiresBuild: true
dependencies:
'@electron/get': 2.0.2
'@types/node': 18.13.0
'@types/node': 20.11.20
extract-zip: 2.0.1
transitivePeerDependencies:
- supports-color
@ -3638,6 +3643,9 @@ packages:
hasBin: true
dev: true
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
/universalify@0.1.2:
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
engines: {node: '>= 4.0.0'}

View file

@ -1298,50 +1298,54 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {
}
case CalcOperatorEarliest:
earliest := int64(0)
var isNotTime bool
var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {
earliest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != earliest {
col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, 0, DateFormatNone, isNotTime)}
col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, 0, DateFormatNone, isNotTime, hasEndDate)}
}
case CalcOperatorLatest:
latest := int64(0)
var isNotTime bool
var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == latest || latest < row.Cells[colIndex].Value.Date.Content {
latest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != latest {
col.Calc.Result = &Value{Date: NewFormattedValueDate(latest, 0, DateFormatNone, isNotTime)}
col.Calc.Result = &Value{Date: NewFormattedValueDate(latest, 0, DateFormatNone, isNotTime, hasEndDate)}
}
case CalcOperatorRange:
earliest := int64(0)
latest := int64(0)
var isNotTime bool
var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {
earliest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
if 0 == latest || latest < row.Cells[colIndex].Value.Date.Content {
latest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != earliest && 0 != latest {
col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, latest, DateFormatDuration, isNotTime)}
col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, latest, DateFormatDuration, isNotTime, hasEndDate)}
}
}
}

View file

@ -301,7 +301,7 @@ const (
DateFormatDuration DateFormat = "duration"
)
func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime bool) (ret *ValueDate) {
func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime, hasEndDate bool) (ret *ValueDate) {
var formatted string
contentTime := time.UnixMilli(content)
if 0 == content || contentTime.IsZero() {
@ -321,7 +321,7 @@ func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime
formatted = contentTime.Format("2006-01-02 15:04")
}
if 0 < content2 {
if hasEndDate {
var formattedContent2 string
content2Time := time.UnixMilli(content2)
if isNotTime {
@ -343,7 +343,7 @@ func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime
ret = &ValueDate{
Content: content,
Content2: content2,
HasEndDate: false,
HasEndDate: hasEndDate,
IsNotTime: true,
FormattedContent: formatted,
}

View file

@ -117,7 +117,7 @@ func ExportAv2CSV(avID string) (zipPath string, err error) {
if nil != cell.Value {
if av.KeyTypeDate == cell.Value.Type {
if nil != cell.Value.Date {
cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime)
cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime, cell.Value.Date.HasEndDate)
}
} else if av.KeyTypeCreated == cell.Value.Type {
if nil != cell.Value.Created {
@ -2274,7 +2274,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,
if nil != cell.Value {
if av.KeyTypeDate == cell.Value.Type {
if nil != cell.Value.Date {
cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime)
cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime, cell.Value.Date.HasEndDate)
}
} else if av.KeyTypeCreated == cell.Value.Type {
if nil != cell.Value.Created {