diff --git a/pkg/smart/smart.go b/pkg/smart/form.go similarity index 60% rename from pkg/smart/smart.go rename to pkg/smart/form.go index 724aad4..eb8c433 100644 --- a/pkg/smart/smart.go +++ b/pkg/smart/form.go @@ -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"` @@ -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 @@ -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"` +} diff --git a/pkg/smart/table.go b/pkg/smart/table.go new file mode 100644 index 0000000..52a6134 --- /dev/null +++ b/pkg/smart/table.go @@ -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 +}