Skip to content

Commit

Permalink
智能表单
Browse files Browse the repository at this point in the history
  • Loading branch information
zgwit committed Oct 29, 2024
1 parent 82597c2 commit 63ffad2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
41 changes: 41 additions & 0 deletions pkg/smart/smart.go → pkg/smart/form.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
package smart

/**
智能表单
类型
text:
password:
number:
slider:
radio:
rate:
select:
tags:
color:
checkbox:
switch:
textarea:
date:
time:
datetime:
file:
image:
images:
object:
list:
table:
*/

type Field struct {
Key string `json:"key"`
Label string `json:"label"`
Expand All @@ -14,7 +41,16 @@ type Field struct {
Max float64 `json:"max,omitempty"`
Step float64 `json:"step,omitempty"`

Disabled bool `json:"disabled,omitempty"`
Hidden bool `json:"hidden,omitempty"`

Array bool `json:"array,omitempty"`
Children []Field `json:"children,omitempty"` //子级?

Auto []AutoOption `json:"auto,omitempty"`

Time bool `json:"time,omitempty"`
Upload string `json:"upload,omitempty"` //上传路径
}

type Form []Field
Expand All @@ -24,3 +60,8 @@ type SelectOption struct {
Label string `json:"label"`
Disabled bool `json:"disabled,omitempty"`
}

type AutoOption struct {
Label string `json:"label"`
Value any `json:"value"`
}
12 changes: 12 additions & 0 deletions pkg/smart/table.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package smart

type TableColumn struct {
Key string
Label string
Keyword bool
Sortable bool
Filter map[string]any
Date bool
Ellipsis bool
Break bool
}

0 comments on commit 63ffad2

Please sign in to comment.