Browse Source

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

Vanessa 1 year ago
parent
commit
7fc80ed570

+ 18 - 4
app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20230805231614-vqn28eh/20230805231816-h1z9mpc/20230805232018-hgrq0ju.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 	"Properties": {
 		"id": "20230805232018-hgrq0ju",
 		"id": "20230805232018-hgrq0ju",
 		"title": "Connect with third-party cloud storage",
 		"title": "Connect with third-party cloud storage",
-		"updated": "20231217111119"
+		"updated": "20240301091400"
 	},
 	},
 	"Children": [
 	"Children": [
 		{
 		{
@@ -55,7 +55,7 @@
 			"ListData": {},
 			"ListData": {},
 			"Properties": {
 			"Properties": {
 				"id": "20230805232156-kbi85az",
 				"id": "20230805232156-kbi85az",
-				"updated": "20230805232156"
+				"updated": "20240301091400"
 			},
 			},
 			"Children": [
 			"Children": [
 				{
 				{
@@ -121,7 +121,7 @@
 					},
 					},
 					"Properties": {
 					"Properties": {
 						"id": "20230805232156-vqfp7fz",
 						"id": "20230805232156-vqfp7fz",
-						"updated": "20230805232156"
+						"updated": "20240301091400"
 					},
 					},
 					"Children": [
 					"Children": [
 						{
 						{
@@ -129,7 +129,7 @@
 							"Type": "NodeParagraph",
 							"Type": "NodeParagraph",
 							"Properties": {
 							"Properties": {
 								"id": "20230805232156-tliw65p",
 								"id": "20230805232156-tliw65p",
-								"updated": "20230805232156"
+								"updated": "20240301091400"
 							},
 							},
 							"Children": [
 							"Children": [
 								{
 								{
@@ -151,6 +151,20 @@
 									"TextMarkType": "a",
 									"TextMarkType": "a",
 									"TextMarkAHref": "https://koofr.eu/",
 									"TextMarkAHref": "https://koofr.eu/",
 									"TextMarkTextContent": "Koofr"
 									"TextMarkTextContent": "Koofr"
+								},
+								{
+									"Type": "NodeText",
+									"Data": " (Nutstore WebDAV is not supported because of its "
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "a",
+									"TextMarkAHref": "https://help.jianguoyun.com/?p=2064",
+									"TextMarkTextContent": "interface limitations"
+								},
+								{
+									"Type": "NodeText",
+									"Data": ")"
 								}
 								}
 							]
 							]
 						}
 						}

+ 18 - 4
app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20230805222417-2lj3dvk/20230805225107-qm1m2f5/20230805230131-sn7obzb.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 	"Properties": {
 		"id": "20230805230131-sn7obzb",
 		"id": "20230805230131-sn7obzb",
 		"title": "对接第三方云端存储",
 		"title": "对接第三方云端存储",
-		"updated": "20231217111041"
+		"updated": "20240301090951"
 	},
 	},
 	"Children": [
 	"Children": [
 		{
 		{
@@ -55,7 +55,7 @@
 			"ListData": {},
 			"ListData": {},
 			"Properties": {
 			"Properties": {
 				"id": "20230805230746-4q9cmrb",
 				"id": "20230805230746-4q9cmrb",
-				"updated": "20230805230746"
+				"updated": "20240301090951"
 			},
 			},
 			"Children": [
 			"Children": [
 				{
 				{
@@ -121,7 +121,7 @@
 					},
 					},
 					"Properties": {
 					"Properties": {
 						"id": "20230805230746-zb33erf",
 						"id": "20230805230746-zb33erf",
-						"updated": "20230805230746"
+						"updated": "20240301090951"
 					},
 					},
 					"Children": [
 					"Children": [
 						{
 						{
@@ -129,7 +129,7 @@
 							"Type": "NodeParagraph",
 							"Type": "NodeParagraph",
 							"Properties": {
 							"Properties": {
 								"id": "20230805230746-i9fzmzi",
 								"id": "20230805230746-i9fzmzi",
-								"updated": "20230805230746"
+								"updated": "20240301090951"
 							},
 							},
 							"Children": [
 							"Children": [
 								{
 								{
@@ -141,6 +141,20 @@
 									"TextMarkType": "a",
 									"TextMarkType": "a",
 									"TextMarkAHref": "https://infini-cloud.net/",
 									"TextMarkAHref": "https://infini-cloud.net/",
 									"TextMarkTextContent": "InfiniCLOUD"
 									"TextMarkTextContent": "InfiniCLOUD"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "(不支持坚果云 WebDAV,因为其"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "a",
+									"TextMarkAHref": "https://help.jianguoyun.com/?p=2064",
+									"TextMarkTextContent": "接口存在限制"
+								},
+								{
+									"Type": "NodeText",
+									"Data": ")"
 								}
 								}
 							]
 							]
 						}
 						}

+ 18 - 4
app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20230805232636-zh0adz2/20230805232719-04mqbcx/20230805232903-erdoerp.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 	"Properties": {
 		"id": "20230805232903-erdoerp",
 		"id": "20230805232903-erdoerp",
 		"title": "對接第三方雲端存儲",
 		"title": "對接第三方雲端存儲",
-		"updated": "20231217111144"
+		"updated": "20240301091104"
 	},
 	},
 	"Children": [
 	"Children": [
 		{
 		{
@@ -55,7 +55,7 @@
 			"ListData": {},
 			"ListData": {},
 			"Properties": {
 			"Properties": {
 				"id": "20230805232945-ugjx8sl",
 				"id": "20230805232945-ugjx8sl",
-				"updated": "20230805232945"
+				"updated": "20240301091104"
 			},
 			},
 			"Children": [
 			"Children": [
 				{
 				{
@@ -121,7 +121,7 @@
 					},
 					},
 					"Properties": {
 					"Properties": {
 						"id": "20230805232945-2dksutx",
 						"id": "20230805232945-2dksutx",
-						"updated": "20230805232945"
+						"updated": "20240301091104"
 					},
 					},
 					"Children": [
 					"Children": [
 						{
 						{
@@ -129,7 +129,7 @@
 							"Type": "NodeParagraph",
 							"Type": "NodeParagraph",
 							"Properties": {
 							"Properties": {
 								"id": "20230805232945-ayx9zfr",
 								"id": "20230805232945-ayx9zfr",
-								"updated": "20230805232945"
+								"updated": "20240301091104"
 							},
 							},
 							"Children": [
 							"Children": [
 								{
 								{
@@ -151,6 +151,20 @@
 									"TextMarkType": "a",
 									"TextMarkType": "a",
 									"TextMarkAHref": "https://koofr.eu/",
 									"TextMarkAHref": "https://koofr.eu/",
 									"TextMarkTextContent": "Koofr"
 									"TextMarkTextContent": "Koofr"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "(不支援堅果雲 WebDAV,因為其"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "a",
+									"TextMarkAHref": "https://help.jianguoyun.com/?p=2064",
+									"TextMarkTextContent": "介面存在限制"
+								},
+								{
+									"Type": "NodeText",
+									"Data": ")"
 								}
 								}
 							]
 							]
 						}
 						}

+ 11 - 3
kernel/av/filter.go

@@ -42,10 +42,18 @@ const (
 	RelativeDateUnitYear
 	RelativeDateUnitYear
 )
 )
 
 
+type RelativeDateDirection int
+
+const (
+	RelativeDateDirectionBefore = -1
+	RelativeDateDirectionThis   = 0
+	RelativeDateDirectionAfter  = 1
+)
+
 type RelativeDate struct {
 type RelativeDate struct {
-	Count     int              // 数量
-	Unit      RelativeDateUnit // 单位:天、周、月、年
-	Direction int              // 方向:前、现在、后
+	Count     int                   // 数量
+	Unit      RelativeDateUnit      // 单位:0 天、1 周、2 月、3 
+	Direction RelativeDateDirection // 方向:-1 前、0 这、1 
 }
 }
 
 
 type FilterOperator string
 type FilterOperator string

+ 73 - 8
kernel/av/table.go

@@ -101,6 +101,18 @@ func (value *Value) Compare(other *Value) int {
 		}
 		}
 	case KeyTypeNumber:
 	case KeyTypeNumber:
 		if nil != value.Number && nil != other.Number {
 		if nil != value.Number && nil != other.Number {
+			if value.Number.IsNotEmpty {
+				if !other.Number.IsNotEmpty {
+					return 1
+				}
+				return 0
+			} else {
+				if other.Number.IsNotEmpty {
+					return -1
+				}
+				return 0
+			}
+
 			if value.Number.Content > other.Number.Content {
 			if value.Number.Content > other.Number.Content {
 				return 1
 				return 1
 			} else if value.Number.Content < other.Number.Content {
 			} else if value.Number.Content < other.Number.Content {
@@ -111,6 +123,18 @@ func (value *Value) Compare(other *Value) int {
 		}
 		}
 	case KeyTypeDate:
 	case KeyTypeDate:
 		if nil != value.Date && nil != other.Date {
 		if nil != value.Date && nil != other.Date {
+			if value.Date.IsNotEmpty {
+				if !other.Date.IsNotEmpty {
+					return 1
+				}
+				return 0
+			} else {
+				if other.Date.IsNotEmpty {
+					return -1
+				}
+				return 0
+			}
+
 			if value.Date.Content > other.Date.Content {
 			if value.Date.Content > other.Date.Content {
 				return 1
 				return 1
 			} else if value.Date.Content < other.Date.Content {
 			} else if value.Date.Content < other.Date.Content {
@@ -384,13 +408,34 @@ func (value *Value) compareOperator(filter *ViewFilter) bool {
 			var relativeTime time.Time
 			var relativeTime time.Time
 			switch unit {
 			switch unit {
 			case RelativeDateUnitDay:
 			case RelativeDateUnitDay:
-				relativeTime = now.AddDate(0, 0, count*direction)
+				relativeTime = now.AddDate(0, 0, count*int(direction))
+				if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction {
+					// 计算今天的起始时间
+					relativeTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+				}
+
 			case RelativeDateUnitWeek:
 			case RelativeDateUnitWeek:
-				relativeTime = now.AddDate(0, 0, count*7*direction)
+				relativeTime = now.AddDate(0, 0, count*7*int(direction))
+				if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction {
+					// 计算本周的起始时间
+					weekday := int(now.Weekday())
+					if 0 == weekday {
+						weekday = 7
+					}
+					relativeTime = time.Date(now.Year(), now.Month(), now.Day()-weekday+1, 0, 0, 0, 0, now.Location())
+				}
 			case RelativeDateUnitMonth:
 			case RelativeDateUnitMonth:
-				relativeTime = now.AddDate(0, count*direction, 0)
+				relativeTime = now.AddDate(0, count*int(direction), 0)
+				if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction {
+					// 计算本月的起始时间
+					relativeTime = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
+				}
 			case RelativeDateUnitYear:
 			case RelativeDateUnitYear:
-				relativeTime = now.AddDate(count*direction, 0, 0)
+				relativeTime = now.AddDate(count*int(direction), 0, 0)
+				if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction {
+					// 计算今年的起始时间
+					relativeTime = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, now.Location())
+				}
 			}
 			}
 
 
 			valueTime := time.UnixMilli(value.Date.Content)
 			valueTime := time.UnixMilli(value.Date.Content)
@@ -412,13 +457,33 @@ func (value *Value) compareOperator(filter *ViewFilter) bool {
 				unit2 := filter.RelativeDate2.Unit
 				unit2 := filter.RelativeDate2.Unit
 				switch unit2 {
 				switch unit2 {
 				case RelativeDateUnitDay:
 				case RelativeDateUnitDay:
-					relativeTime2 = now.AddDate(0, 0, count*direction)
+					relativeTime2 = now.AddDate(0, 0, count*int(direction))
+					if RelativeDateDirectionThis == direction {
+						// 计算今天的结束时间
+						relativeTime2 = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999999999, now.Location())
+					}
 				case RelativeDateUnitWeek:
 				case RelativeDateUnitWeek:
-					relativeTime2 = now.AddDate(0, 0, count*7*direction)
+					relativeTime2 = now.AddDate(0, 0, count*7*int(direction))
+					if RelativeDateDirectionThis == direction {
+						// 计算本周的结束时间
+						weekday := int(now.Weekday())
+						if 0 == weekday {
+							weekday = 7
+						}
+						relativeTime2 = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location())
+					}
 				case RelativeDateUnitMonth:
 				case RelativeDateUnitMonth:
-					relativeTime2 = now.AddDate(0, count*direction, 0)
+					relativeTime2 = now.AddDate(0, count*int(direction), 0)
+					if RelativeDateDirectionThis == direction {
+						// 计算本月的结束时间
+						relativeTime2 = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond)
+					}
 				case RelativeDateUnitYear:
 				case RelativeDateUnitYear:
-					relativeTime2 = now.AddDate(count*direction, 0, 0)
+					relativeTime2 = now.AddDate(count*int(direction), 0, 0)
+					if RelativeDateDirectionThis == direction {
+						// 计算今年的结束时间
+						relativeTime2 = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond)
+					}
 				}
 				}
 				return (valueTime.After(relativeTime) || valueTime.Equal(relativeTime)) && (valueTime.Before(relativeTime2) || valueTime.Equal(relativeTime2))
 				return (valueTime.After(relativeTime) || valueTime.Equal(relativeTime)) && (valueTime.Before(relativeTime2) || valueTime.Equal(relativeTime2))
 			}
 			}

+ 6 - 1
kernel/model/attribute_view.go

@@ -2534,8 +2534,13 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
 
 
 	if av.KeyTypeNumber == val.Type {
 	if av.KeyTypeNumber == val.Type {
 		if nil != val.Number && !val.Number.IsNotEmpty {
 		if nil != val.Number && !val.Number.IsNotEmpty {
-			// 删除内容为空值
 			val.Number.Content = 0
 			val.Number.Content = 0
+			val.Number.FormattedContent = ""
+		}
+	} else if av.KeyTypeDate == val.Type {
+		if nil != val.Date && !val.Date.IsNotEmpty {
+			val.Date.Content = 0
+			val.Date.FormattedContent = ""
 		}
 		}
 	}
 	}