chore: update templ and templui

This commit is contained in:
juancwu 2026-04-12 16:07:06 +00:00
commit 61eaa268ab
89 changed files with 25776 additions and 8231 deletions

View file

@ -1,4 +1,4 @@
// templui component chart - version: v1.2.0 installed by templui v1.2.0
// templui component chart - version: v1.9.5 installed by templui v1.9.5
// 📚 Documentation: https://templui.io/docs/components/charts
package chart
@ -53,11 +53,17 @@ type Config struct {
BeginAtZero *bool `json:"beginAtZero,omitempty"`
}
type ScriptConfig struct {
RawConfig map[string]any `json:"rawConfig,omitempty"`
GeneratedConfig *Config `json:"generatedConfig,omitempty"`
}
type Props struct {
ID string
Variant Variant
Data Data
Options Options
RawConfig map[string]any
ShowLegend bool
ShowXAxis bool
ShowYAxis bool
@ -96,27 +102,37 @@ templ Chart(props ...Props) {
<canvas id={ canvasId } data-tui-chart-id={ dataId }></canvas>
</div>
{{
chartConfig := Config{
Type: p.Variant,
Data: p.Data,
Options: p.Options,
ShowLegend: p.ShowLegend,
ShowXAxis: p.ShowXAxis,
ShowYAxis: p.ShowYAxis,
ShowXLabels: p.ShowXLabels,
ShowYLabels: p.ShowYLabels,
ShowXGrid: p.ShowXGrid,
ShowYGrid: p.ShowYGrid,
Horizontal: p.Horizontal,
Stacked: p.Stacked,
YMin: p.YMin,
YMax: p.YMax,
BeginAtZero: p.BeginAtZero,
scriptConfig := ScriptConfig{
RawConfig: p.RawConfig,
}
if p.RawConfig == nil {
generatedConfig := Config{
Type: p.Variant,
Data: p.Data,
Options: p.Options,
ShowLegend: p.ShowLegend,
ShowXAxis: p.ShowXAxis,
ShowYAxis: p.ShowYAxis,
ShowXLabels: p.ShowXLabels,
ShowYLabels: p.ShowYLabels,
ShowXGrid: p.ShowXGrid,
ShowYGrid: p.ShowYGrid,
Horizontal: p.Horizontal,
Stacked: p.Stacked,
YMin: p.YMin,
YMax: p.YMax,
BeginAtZero: p.BeginAtZero,
}
scriptConfig.GeneratedConfig = &generatedConfig
}
}}
@templ.JSONScript(dataId, chartConfig)
@templ.JSONScript(dataId, scriptConfig)
}
var scriptOnce = templ.NewOnceHandle()
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/chart.min.js") }></script>
@scriptOnce.Once() {
@utils.ComponentScript("chart")
}
}