Skip to content

Commit

Permalink
Merge pull request #41 from DmiTryAgain/master
Browse files Browse the repository at this point in the history
Support type='number' setting in multifilters (#10)
  • Loading branch information
sas1024 authored Jul 21, 2023
2 parents 41f6392 + 8cd0c99 commit 72c29e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class MultiListFilters extends EntityListFilters {
values: null,
settings: {
placeholder: '',
type: 'number',
component: 'v-text-field'
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class MultiListFilters extends EntityListFilters {
values: null,
settings: {
placeholder: '',
type: 'number',
component: 'v-text-field'
}
},
Expand Down
3 changes: 3 additions & 0 deletions generators/vt-template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ export default class MultiListFilters extends EntityListFilters {
values: null,
settings: {
placeholder: '',
[[- if and .IsNumber ( eq .SearchType "input" ) ]]
type: 'number',
[[- end ]]
[[- if and (or .IsCheckBox ( eq .SearchType "select")) (not .IsFK) ]]
itemText: 'text',
itemValue: 'value',
Expand Down
5 changes: 5 additions & 0 deletions generators/vt-template/vt_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type InputData struct {

IsArray bool
IsCheckBox bool
IsNumber bool
Params []template.HTML
}

Expand Down Expand Up @@ -156,6 +157,10 @@ func PackInput(tmpl mfd.TmplAttribute, vtEntity mfd.VTEntity, isSearch bool) Inp
inp.IsCheckBox = true
}

if mfd.MakeJSType(tmpl.VTAttribute.Attribute.GoType, tmpl.VTAttribute.Attribute.IsArray) == "number" {
inp.IsNumber = true
}

if strings.EqualFold(tmpl.Name, "alias") {
if title := vtEntity.Entity.TitleAttribute(); title != nil {
trasliteratingValue := template.HTML(mfd.VarName(title.Name))
Expand Down

0 comments on commit 72c29e5

Please sign in to comment.