Skip to content

Commit 24ef6c6

Browse files
committed
!3 add component: amis
improve api; add component: amis; improve api
1 parent c15a7d9 commit 24ef6c6

File tree

148 files changed

+257
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+257
-176
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ Explore our [documentation](https://amisgo.pages.dev) for in-depth tutorials and
3838

3939
## Examples
4040

41-
Check out our [examples repository](https://github.com/zrcoder/amisgo-examples).
41+
Check out our [examples repository](https://github.com/zrcoder/amisgo-examples).
42+
43+
## Issues and Contributions
44+
45+
This project is primarily maintained on Gitee. For issues or pull requests, please visit https://gitee.com/rdor/amisgo

comp.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func (a *App) AnchorNav() comp.AnchorNav { return icomp.NewA
1111
func (a *App) App() comp.App { return icomp.NewApp() }
1212
func (a *App) Audio() comp.Audio { return icomp.NewAudio() }
1313
func (a *App) Avatar() comp.Avatar { return icomp.NewAvatar() }
14+
func (a *App) Amis() comp.Amis { return icomp.NewAmis() }
1415
func (a *App) Barcode() comp.Barcode { return icomp.NewBarcode() }
1516
func (a *App) Breadcrumb() comp.Breadcrumb { return icomp.NewBreadcrumb() }
1617
func (a *App) Button() comp.Action { return icomp.NewButton(a.mux) }
@@ -225,16 +226,16 @@ func (a *App) Api() comp.Api { return icomp.NewApi() }
225226
func (a *App) BreadcrumbItem() comp.BreadcrumbItem { return icomp.NewBreadcrumbItem() }
226227
func (a *App) Column() comp.Column { return icomp.NewColumn() }
227228
func (a *App) Event() comp.Event { return icomp.NewEvent() }
228-
func (a *App) EventActions(actions ...any) icomp.EventActions {
229+
func (a *App) EventActions(actions ...comp.EventAction) icomp.EventActions {
229230
return icomp.NewEventActions(actions...)
230231
}
231232
func (a *App) EventAction() comp.EventAction { return icomp.NewEventAction() }
232233
func (a *App) EventActionToast() comp.EventAction { return icomp.NewEventActionToast() }
233-
func (a *App) EventActionDrawer(drawer ...any) icomp.EventAction {
234+
func (a *App) EventActionDrawer(drawer ...comp.Drawer) icomp.EventAction {
234235
return icomp.NewEventActionDrawer(drawer...)
235236
}
236237

237-
func (a *App) EventActionDialog(dialog ...any) icomp.EventAction {
238+
func (a *App) EventActionDialog(dialog ...comp.Dialog) icomp.EventAction {
238239
return icomp.NewEventActionDialog(dialog...)
239240
}
240241
func (a *App) EventActionArgs() comp.EventActionArgs { return icomp.NewEventActionArgs() }
@@ -249,3 +250,4 @@ func (a *App) PropertyItem() comp.PropertyItem { return icomp.NewPropertyI
249250
func (a *App) PullRefresh() comp.PullRefresh { return icomp.NewPullRefresh() }
250251
func (a *App) Rule() comp.Rule { return icomp.NewRule() }
251252
func (a *App) Tab() comp.Tab { return icomp.NewTab() }
253+
func (a *App) CarouselOption() comp.CarouselOption { return icomp.NewCarouselOption() }

comp/comp.go

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type (
1111
App = comp.App
1212
Audio = comp.Audio
1313
Avatar = comp.Avatar
14+
Amis = comp.Amis
1415
Barcode = comp.Barcode
1516
Breadcrumb = comp.Breadcrumb
1617
Button = comp.Action
@@ -238,4 +239,5 @@ type (
238239
ChartSeri = comp.ChartSeri
239240
ListItem = comp.ListItem
240241
TimelineItem = comp.TimelineItem
242+
CarouselOption = comp.CarouselOption
241243
)

internal/comp/action.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ func (a Action) Dialog(value Dialog) Action {
3535
}
3636

3737
// Drawer configures the drawer that appears when the button is clicked.
38-
func (a Action) Drawer(value any) Action {
38+
func (a Action) Drawer(value Drawer) Action {
3939
return a.set("drawer", value)
4040
}
4141

4242
// Toast configures the toast that appears when the button is clicked.
43-
func (a Action) Toast(value any) Action {
43+
func (a Action) Toast(value Toast) Action {
4444
return a.set("toast", value)
4545
}
4646

@@ -282,7 +282,7 @@ func (v Action) OnClick(value string) Action {
282282
}
283283

284284
// OnEvent sets the event action configuration for the button.
285-
func (v Action) OnEvent(value any) Action {
285+
func (v Action) OnEvent(value Event) Action {
286286
return v.set("onEvent", value)
287287
}
288288

internal/comp/alert.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (a Alert) set(key string, value any) Alert {
1616
}
1717

1818
// Actions sets the actions area
19-
func (a Alert) Actions(value string) Alert {
19+
func (a Alert) Actions(value Action) Alert {
2020
return a.set("actions", value)
2121
}
2222

@@ -81,7 +81,7 @@ func (a Alert) Level(value string) Alert {
8181
}
8282

8383
// OnEvent sets the event action configuration
84-
func (a Alert) OnEvent(value any) Alert {
84+
func (a Alert) OnEvent(value Event) Alert {
8585
return a.set("onEvent", value)
8686
}
8787

internal/comp/amis.go

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package comp
2+
3+
import "github.com/zrcoder/amisgo/schema"
4+
5+
type Amis schema.Schema
6+
7+
func NewAmis() Amis {
8+
return Amis{"type": "amis"}
9+
}
10+
11+
func (a Amis) set(key string, value any) Amis {
12+
a[key] = value
13+
return a
14+
}
15+
16+
func (a Amis) Name(value string) Amis {
17+
return a.set("name", value)
18+
}
19+
20+
func (a Amis) Props(value any) Amis {
21+
return a.set("props", value)
22+
}

internal/comp/anchorNav.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (a AnchorNav) Links(value string) AnchorNav {
7777
}
7878

7979
// OnEvent configures event-driven actions
80-
func (a AnchorNav) OnEvent(value any) AnchorNav {
80+
func (a AnchorNav) OnEvent(value Event) AnchorNav {
8181
return a.set("onEvent", value)
8282
}
8383

internal/comp/anchorNavSection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (a AnchorNavSection) ID(value string) AnchorNavSection {
6565
}
6666

6767
// OnEvent sets the event action configuration.
68-
func (a AnchorNavSection) OnEvent(value any) AnchorNavSection {
68+
func (a AnchorNavSection) OnEvent(value Event) AnchorNavSection {
6969
return a.set("onEvent", value)
7070
}
7171

internal/comp/audio.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (a Audio) Loop(value bool) Audio {
7070
}
7171

7272
// OnEvent sets the event action configuration.
73-
func (a Audio) OnEvent(value any) Audio {
73+
func (a Audio) OnEvent(value Event) Audio {
7474
return a.set("onEvent", value)
7575
}
7676

internal/comp/avatar.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (a Avatar) OnError(value string) Avatar {
9595
}
9696

9797
// OnEvent configures event-driven actions
98-
func (a Avatar) OnEvent(value any) Avatar {
98+
func (a Avatar) OnEvent(value Event) Avatar {
9999
return a.set("onEvent", value)
100100
}
101101

internal/comp/breadcrum.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (b Breadcrumb) ItemClassName(value string) Breadcrumb {
3535
}
3636

3737
// Items configures the breadcrumb items
38-
func (b Breadcrumb) Items(value ...any) Breadcrumb {
38+
func (b Breadcrumb) Items(value ...BreadcrumbItem) Breadcrumb {
3939
return b.set("items", value)
4040
}
4141

internal/comp/buttonGroup.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (bg ButtonGroup) BtnLevel(value string) ButtonGroup {
3737
}
3838

3939
// Buttons configures the collection of buttons
40-
func (bg ButtonGroup) Buttons(value ...any) ButtonGroup {
40+
func (bg ButtonGroup) Buttons(value ...Action) ButtonGroup {
4141
return bg.set("buttons", value)
4242
}
4343

@@ -77,7 +77,7 @@ func (bg ButtonGroup) ID(value string) ButtonGroup {
7777
}
7878

7979
// OnEvent configures event-driven actions
80-
func (bg ButtonGroup) OnEvent(value any) ButtonGroup {
80+
func (bg ButtonGroup) OnEvent(value Event) ButtonGroup {
8181
return bg.set("onEvent", value)
8282
}
8383

internal/comp/buttonToolBar.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (bt ButtonToolbar) ID(value string) ButtonToolbar {
6161
}
6262

6363
// OnEvent configures event-driven actions
64-
func (bt ButtonToolbar) OnEvent(value any) ButtonToolbar {
64+
func (bt ButtonToolbar) OnEvent(value Event) ButtonToolbar {
6565
return bt.set("onEvent", value)
6666
}
6767

internal/comp/calendar.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (c Calendar) LargeMode(value bool) Calendar {
5555
}
5656

5757
// OnEvent configures event-driven actions
58-
func (c Calendar) OnEvent(value any) Calendar {
58+
func (c Calendar) OnEvent(value Event) Calendar {
5959
return c.set("onEvent", value)
6060
}
6161

internal/comp/card.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package comp
33
import "github.com/zrcoder/amisgo/schema"
44

55
// Card represents a Card component renderer
6-
type Card schema.Schema
6+
type Card schema.Schema
77

88
func NewCard() Card {
99
return Card{"type": "card"}
@@ -15,7 +15,7 @@ func (c Card) set(key string, value any) Card {
1515
}
1616

1717
// Actions configures the card's action buttons or menu
18-
func (c Card) Actions(value string) Card {
18+
func (c Card) Actions(value Action) Card {
1919
return c.set("actions", value)
2020
}
2121

@@ -90,7 +90,7 @@ func (c Card) Media(value string) Card {
9090
}
9191

9292
// OnEvent configures event-driven actions
93-
func (c Card) OnEvent(value any) Card {
93+
func (c Card) OnEvent(value Event) Card {
9494
return c.set("onEvent", value)
9595
}
9696

internal/comp/cards.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (c Cards) MasonryLayout(value bool) Cards {
120120
}
121121

122122
// OnEvent configures event-driven actions
123-
func (c Cards) OnEvent(value any) Cards {
123+
func (c Cards) OnEvent(value Event) Cards {
124124
return c.set("onEvent", value)
125125
}
126126

internal/comp/carousel.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ func (c Carousel) Name(value string) Carousel {
110110
}
111111

112112
// OnEvent configures event-driven actions
113-
func (c Carousel) OnEvent(value any) Carousel {
113+
func (c Carousel) OnEvent(value Event) Carousel {
114114
return c.set("onEvent", value)
115115
}
116116

117117
// Options sets the collection of carousel items
118-
func (c Carousel) Options(value ...any) Carousel {
118+
func (c Carousel) Options(value ...CarouselOption) Carousel {
119119
return c.set("options", value)
120120
}
121121

internal/comp/carouselOption.go

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package comp
2+
3+
import "github.com/zrcoder/amisgo/schema"
4+
5+
type CarouselOption schema.Schema
6+
7+
func NewCarouselOption() CarouselOption {
8+
return CarouselOption{}
9+
}
10+
11+
func (co CarouselOption) set(key string, value any) CarouselOption {
12+
co[key] = value
13+
return co
14+
}
15+
16+
func (co CarouselOption) Image(value string) CarouselOption {
17+
return co.set("image", value)
18+
}
19+
20+
func (co CarouselOption) Href(value string) CarouselOption {
21+
return co.set("href", value)
22+
}
23+
24+
func (co CarouselOption) ImageClassName(value string) CarouselOption {
25+
return co.set("imageClassName", value)
26+
}
27+
28+
func (co CarouselOption) Title(value string) CarouselOption {
29+
return co.set("title", value)
30+
}
31+
32+
func (co CarouselOption) TitleClassName(value string) CarouselOption {
33+
return co.set("titleClassName", value)
34+
}
35+
36+
func (co CarouselOption) Description(value string) CarouselOption {
37+
return co.set("description", value)
38+
}
39+
40+
func (co CarouselOption) DescriptionClassName(value string) CarouselOption {
41+
return co.set("descriptionClassName", value)
42+
}
43+
44+
func (co CarouselOption) Html(value string) CarouselOption {
45+
return co.set("html", value)
46+
}

internal/comp/chainedSelect.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func (c ChainedSelect) Name(value string) ChainedSelect {
241241
}
242242

243243
// OnEvent configures event-driven actions for the component
244-
func (c ChainedSelect) OnEvent(value any) ChainedSelect {
244+
func (c ChainedSelect) OnEvent(value Event) ChainedSelect {
245245
return c.set("onEvent", value)
246246
}
247247

internal/comp/chart.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c Chart) ClickAction(value string) Chart {
4646

4747
// Config sets the ECharts configuration, supporting data mapping
4848
// If data mapping is used, set TrackExpression to ensure synchronous updates
49-
func (c Chart) Config(value any) Chart {
49+
func (c Chart) Config(value ChartCfg) Chart {
5050
return c.set("config", value)
5151
}
5252

@@ -132,7 +132,7 @@ func (c Chart) Name(value string) Chart {
132132
}
133133

134134
// OnEvent configures event-driven actions for the chart
135-
func (c Chart) OnEvent(value any) Chart {
135+
func (c Chart) OnEvent(value Event) Chart {
136136
return c.set("onEvent", value)
137137
}
138138

internal/comp/checkbox.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (c Checkbox) Name(value string) Checkbox {
155155
}
156156

157157
// OnEvent configures event-driven actions for the checkbox
158-
func (c Checkbox) OnEvent(value any) Checkbox {
158+
func (c Checkbox) OnEvent(value Event) Checkbox {
159159
return c.set("onEvent", value)
160160
}
161161

internal/comp/checkboxes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (c Checkboxes) Name(value string) Checkboxes {
261261
}
262262

263263
// OnEvent configures event-driven actions for the checkboxes
264-
func (c Checkboxes) OnEvent(value any) Checkboxes {
264+
func (c Checkboxes) OnEvent(value Event) Checkboxes {
265265
return c.set("onEvent", value)
266266
}
267267

internal/comp/collapse.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (c Collapse) MountOnEnter(value bool) Collapse {
110110
}
111111

112112
// OnEvent configures event-driven actions for the component
113-
func (c Collapse) OnEvent(value any) Collapse {
113+
func (c Collapse) OnEvent(value Event) Collapse {
114114
return c.set("onEvent", value)
115115
}
116116

internal/comp/collapseGroup.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (c CollapseGroup) Accordion(value bool) CollapseGroup {
1919
return c.set("accordion", value)
2020
}
2121

22-
// ActiveKey sets the currently active panel(s)
22+
// ActiveKey sets the currently active panel(s), Array<string | number | never> | string | number
2323
func (c CollapseGroup) ActiveKey(value any) CollapseGroup {
2424
return c.set("activeKey", value)
2525
}
@@ -80,7 +80,7 @@ func (c CollapseGroup) ID(value string) CollapseGroup {
8080
}
8181

8282
// OnEvent configures event-driven actions for the collapse group
83-
func (c CollapseGroup) OnEvent(value any) CollapseGroup {
83+
func (c CollapseGroup) OnEvent(value Event) CollapseGroup {
8484
return c.set("onEvent", value)
8585
}
8686

internal/comp/color.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (c Color) ID(value string) Color {
5555
}
5656

5757
// OnEvent configures event-driven actions for the color picker
58-
func (c Color) OnEvent(value any) Color {
58+
func (c Color) OnEvent(value Event) Color {
5959
return c.set("onEvent", value)
6060
}
6161

internal/comp/column.go

+5
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,8 @@ func (c Column) Valign(value string) Column {
163163
func (c Column) Buttons(value ...any) Column {
164164
return c.Set("buttons", value)
165165
}
166+
167+
// PopOver sets the pop-over
168+
func (c Column) PopOver(value any) Column {
169+
return c.Set("popOver", value)
170+
}

0 commit comments

Comments
 (0)