mirror of
https://github.com/acaloiaro/frm
synced 2026-07-21 10:12:23 +00:00
feat: randomize question options
This commit is contained in:
parent
a10a52dcb7
commit
9e686f546d
11 changed files with 507 additions and 257 deletions
|
|
@ -161,6 +161,11 @@
|
|||
${sqlc}/bin/sqlc generate && echo sqlc generate done
|
||||
'';
|
||||
};
|
||||
|
||||
jjd = {
|
||||
description = "jujutsu diff, specialized for templ projects";
|
||||
exec = ''jj diff '~ glob:"**/*_templ.txt" & ~ glob:"**/*_templ.go"' --git'';
|
||||
};
|
||||
};
|
||||
|
||||
processes.frm-server = {
|
||||
|
|
|
|||
|
|
@ -456,6 +456,11 @@ func UpdateFields(w http.ResponseWriter, r *http.Request) {
|
|||
field.Options = toFormFieldOption(draft.Fields[fieldID], fieldValues)
|
||||
case fieldName == "option_labels":
|
||||
field.OptionLabels = fieldValues
|
||||
case fieldName == "option_ordering":
|
||||
field.OptionOrder, err = types.FormFieldOptionOrderString(fieldValues[0])
|
||||
if err != nil {
|
||||
field.OptionOrder = types.OptionOrderNatural
|
||||
}
|
||||
// field logic, target field chosen
|
||||
case fieldGroup == builder.FieldGroupLogic && fieldName == builder.FieldLogicTargetFieldID:
|
||||
targetFieldID, err := uuid.Parse(fieldValues[0])
|
||||
|
|
|
|||
108
types/formfieldoptionorder_enumer.go
Normal file
108
types/formfieldoptionorder_enumer.go
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
// Code generated by "enumer -type FormFieldOptionOrder -trimprefix FormFieldOptionOrder -transform=snake -json -text"; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const _FormFieldOptionOrderName = "option_order_naturaloption_order_random"
|
||||
|
||||
var _FormFieldOptionOrderIndex = [...]uint8{0, 20, 39}
|
||||
|
||||
const _FormFieldOptionOrderLowerName = "option_order_naturaloption_order_random"
|
||||
|
||||
func (i FormFieldOptionOrder) String() string {
|
||||
if i < 0 || i >= FormFieldOptionOrder(len(_FormFieldOptionOrderIndex)-1) {
|
||||
return fmt.Sprintf("FormFieldOptionOrder(%d)", i)
|
||||
}
|
||||
return _FormFieldOptionOrderName[_FormFieldOptionOrderIndex[i]:_FormFieldOptionOrderIndex[i+1]]
|
||||
}
|
||||
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
func _FormFieldOptionOrderNoOp() {
|
||||
var x [1]struct{}
|
||||
_ = x[OptionOrderNatural-(0)]
|
||||
_ = x[OptionOrderRandom-(1)]
|
||||
}
|
||||
|
||||
var _FormFieldOptionOrderValues = []FormFieldOptionOrder{OptionOrderNatural, OptionOrderRandom}
|
||||
|
||||
var _FormFieldOptionOrderNameToValueMap = map[string]FormFieldOptionOrder{
|
||||
_FormFieldOptionOrderName[0:20]: OptionOrderNatural,
|
||||
_FormFieldOptionOrderLowerName[0:20]: OptionOrderNatural,
|
||||
_FormFieldOptionOrderName[20:39]: OptionOrderRandom,
|
||||
_FormFieldOptionOrderLowerName[20:39]: OptionOrderRandom,
|
||||
}
|
||||
|
||||
var _FormFieldOptionOrderNames = []string{
|
||||
_FormFieldOptionOrderName[0:20],
|
||||
_FormFieldOptionOrderName[20:39],
|
||||
}
|
||||
|
||||
// FormFieldOptionOrderString retrieves an enum value from the enum constants string name.
|
||||
// Throws an error if the param is not part of the enum.
|
||||
func FormFieldOptionOrderString(s string) (FormFieldOptionOrder, error) {
|
||||
if val, ok := _FormFieldOptionOrderNameToValueMap[s]; ok {
|
||||
return val, nil
|
||||
}
|
||||
|
||||
if val, ok := _FormFieldOptionOrderNameToValueMap[strings.ToLower(s)]; ok {
|
||||
return val, nil
|
||||
}
|
||||
return 0, fmt.Errorf("%s does not belong to FormFieldOptionOrder values", s)
|
||||
}
|
||||
|
||||
// FormFieldOptionOrderValues returns all values of the enum
|
||||
func FormFieldOptionOrderValues() []FormFieldOptionOrder {
|
||||
return _FormFieldOptionOrderValues
|
||||
}
|
||||
|
||||
// FormFieldOptionOrderStrings returns a slice of all String values of the enum
|
||||
func FormFieldOptionOrderStrings() []string {
|
||||
strs := make([]string, len(_FormFieldOptionOrderNames))
|
||||
copy(strs, _FormFieldOptionOrderNames)
|
||||
return strs
|
||||
}
|
||||
|
||||
// IsAFormFieldOptionOrder returns "true" if the value is listed in the enum definition. "false" otherwise
|
||||
func (i FormFieldOptionOrder) IsAFormFieldOptionOrder() bool {
|
||||
for _, v := range _FormFieldOptionOrderValues {
|
||||
if i == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface for FormFieldOptionOrder
|
||||
func (i FormFieldOptionOrder) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(i.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface for FormFieldOptionOrder
|
||||
func (i *FormFieldOptionOrder) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return fmt.Errorf("FormFieldOptionOrder should be a string, got %s", data)
|
||||
}
|
||||
|
||||
var err error
|
||||
*i, err = FormFieldOptionOrderString(s)
|
||||
return err
|
||||
}
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface for FormFieldOptionOrder
|
||||
func (i FormFieldOptionOrder) MarshalText() ([]byte, error) {
|
||||
return []byte(i.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface for FormFieldOptionOrder
|
||||
func (i *FormFieldOptionOrder) UnmarshalText(text []byte) error {
|
||||
var err error
|
||||
*i, err = FormFieldOptionOrderString(string(text))
|
||||
return err
|
||||
}
|
||||
|
|
@ -3,13 +3,16 @@ package types
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math/rand/v2"
|
||||
"slices"
|
||||
"sort"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ErrRequiredNoValueProvided is a form validation error for required fields missing values
|
||||
var ErrRequiredNoValueProvided = errors.New("This field is required")
|
||||
var ErrUnknownOpitonProvided = errors.New("This field is required, please choose a valid option")
|
||||
var ErrUnknownOptionProvided = errors.New("This field is required, please choose a valid option")
|
||||
|
||||
// ValidationErrors is a mapping of form field IDs to the errors validating values submitted to those fields
|
||||
type ValidationErrors map[string]error
|
||||
|
|
@ -53,6 +56,16 @@ const (
|
|||
FieldLogicComparatorNot // target field value is "not" the subject value
|
||||
)
|
||||
|
||||
// FormFieldOptionOrder enum enumerates all possible ways to order FieldOptions
|
||||
//
|
||||
//go:generate enumer -type FormFieldOptionOrder -trimprefix FormFieldOptionOrder -transform=snake -json -text
|
||||
type FormFieldOptionOrder int
|
||||
|
||||
const (
|
||||
OptionOrderNatural FormFieldOptionOrder = iota // FieldOptions are ordered naturally according to their order field
|
||||
OptionOrderRandom // FieldOptions are ordered randomly
|
||||
)
|
||||
|
||||
// FieldLogicTriggerAction enum enumerates all possible field logic trigger actions
|
||||
//
|
||||
//go:generate enumer -type FieldLogicTriggerAction -trimprefix FieldLogicTriggerAction -transform=snake -json -text
|
||||
|
|
@ -60,7 +73,7 @@ type FieldLogicTriggerAction int
|
|||
|
||||
const (
|
||||
FieldLogicTriggerShow FieldLogicTriggerAction = iota // make the field visible to the user
|
||||
FieldLogicTriggerRequire FieldLogicTriggerAction = iota // require the user to enter a value
|
||||
FieldLogicTriggerRequire // require the user to enter a value
|
||||
)
|
||||
|
||||
// FormFields is a collection of form fields associated with a Form
|
||||
|
|
@ -78,17 +91,18 @@ type FieldOptions []Option
|
|||
|
||||
// FormField is a field associated with a form
|
||||
type FormField struct {
|
||||
ID uuid.UUID `json:"id"` // field's unique id
|
||||
Order int `json:"order"` // order in which the field appears on forms
|
||||
Label string `json:"label"` // field's label (name)
|
||||
Logic *FieldLogic `json:"logic"` // UI logic for this field
|
||||
Options FieldOptions `json:"options"` // single/multi-select options
|
||||
OptionLabels []string `json:"option_labels"` // option labels are shown below [types.FormFieldTypeSingleChoice] options
|
||||
Placeholder string `json:"placeholder"` // placeholder value
|
||||
Required bool `json:"required"` // whether the field is required
|
||||
Hidden bool `json:"hidden"` // whether the field is hidden
|
||||
Type FormFieldType `json:"type"` // field type
|
||||
DataType FormFieldDataType `json:"data_type"` // the data type for form submissions to this field
|
||||
ID uuid.UUID `json:"id"` // field's unique id
|
||||
Order int `json:"order"` // order in which the field appears on forms
|
||||
Label string `json:"label"` // field's label (name)
|
||||
Logic *FieldLogic `json:"logic"` // UI logic for this field
|
||||
Options FieldOptions `json:"options"` // single/multi-select options
|
||||
OptionLabels []string `json:"option_labels"` // option labels are shown below [types.FormFieldTypeSingleChoice] options
|
||||
OptionOrder FormFieldOptionOrder `json:"option_order"` // the order in which options appear to viewers
|
||||
Placeholder string `json:"placeholder"` // placeholder value
|
||||
Required bool `json:"required"` // whether the field is required
|
||||
Hidden bool `json:"hidden"` // whether the field is hidden
|
||||
Type FormFieldType `json:"type"` // field type
|
||||
DataType FormFieldDataType `json:"data_type"` // the data type for form submissions to this field
|
||||
}
|
||||
|
||||
// FormFieldSubmission is a form submission for a particular form field. Form submissions consists of one or more form field submission
|
||||
|
|
@ -142,6 +156,20 @@ func (f FormFieldSortByOrder) Len() int { return len(f) }
|
|||
func (f FormFieldSortByOrder) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
|
||||
func (f FormFieldSortByOrder) Less(i, j int) bool { return f[i].Order < f[j].Order }
|
||||
|
||||
// FormFieldOptionSortNatural implements sort.Interface for [[]Option], sorting options naturally by Order
|
||||
type FormFieldOptionSortNatural []Option
|
||||
|
||||
func (f FormFieldOptionSortNatural) Len() int { return len(f) }
|
||||
func (f FormFieldOptionSortNatural) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
|
||||
func (f FormFieldOptionSortNatural) Less(i, j int) bool { return f[i].Order < f[j].Order }
|
||||
|
||||
// FormFieldOptionSortRand implements sort.Interface for [[]Option], sorting options randomly
|
||||
type FormFieldOptionSortRand []Option
|
||||
|
||||
func (f FormFieldOptionSortRand) Len() int { return len(f) }
|
||||
func (f FormFieldOptionSortRand) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
|
||||
func (f FormFieldOptionSortRand) Less(i, j int) bool { return rand.Int64()%2 == 0 }
|
||||
|
||||
// Validate validates values submitted to a form field
|
||||
func (f FormField) Validate(value []string) (err error) {
|
||||
if f.Required {
|
||||
|
|
@ -164,7 +192,7 @@ func (f FormField) Validate(value []string) (err error) {
|
|||
}
|
||||
|
||||
if !allValid(f, value) {
|
||||
return ErrUnknownOpitonProvided
|
||||
return ErrUnknownOptionProvided
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
|
|
@ -186,16 +214,17 @@ func (f FormField) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
d := struct {
|
||||
ID uuid.UUID `json:"id"` // field's unique id
|
||||
Order int `json:"order"` // order in which the field appears on forms
|
||||
Label string `json:"label"` // field's label (name)
|
||||
Logic *FieldLogic `json:"logic"` // field's logic configuration
|
||||
Options FieldOptions `json:"options"` // single/multi-select options
|
||||
OptionLabels []string `json:"option_labels"` // labels for [FormFieldTypeSingleChoice] options
|
||||
Placeholder string `json:"placeholder"` // placeholder value
|
||||
Required bool `json:"required"` // whether the field is required
|
||||
Hidden bool `json:"hidden"` // whether the field is hidden
|
||||
Type FormFieldType `json:"type"` // field type
|
||||
ID uuid.UUID `json:"id"` // field's unique id
|
||||
Order int `json:"order"` // order in which the field appears on forms
|
||||
Label string `json:"label"` // field's label (name)
|
||||
Logic *FieldLogic `json:"logic"` // field's logic configuration
|
||||
Options FieldOptions `json:"options"` // single/multi-select options
|
||||
OptionLabels []string `json:"option_labels"` // labels for [FormFieldTypeSingleChoice] options
|
||||
OptionOrder FormFieldOptionOrder `json:"option_order"` // the order in which options appear
|
||||
Placeholder string `json:"placeholder"` // placeholder value
|
||||
Required bool `json:"required"` // whether the field is required
|
||||
Hidden bool `json:"hidden"` // whether the field is hidden
|
||||
Type FormFieldType `json:"type"` // field type
|
||||
}{
|
||||
|
||||
ID: id,
|
||||
|
|
@ -203,6 +232,7 @@ func (f FormField) MarshalJSON() ([]byte, error) {
|
|||
Label: f.Label,
|
||||
Options: f.Options,
|
||||
OptionLabels: f.OptionLabels,
|
||||
OptionOrder: f.OptionOrder,
|
||||
Placeholder: f.Placeholder,
|
||||
Required: f.Required,
|
||||
Hidden: f.Hidden,
|
||||
|
|
@ -213,6 +243,22 @@ func (f FormField) MarshalJSON() ([]byte, error) {
|
|||
return json.Marshal(d)
|
||||
}
|
||||
|
||||
// SortedOptions returns a field's options sorted according to its [OptionOrder]
|
||||
func (f *FormField) SortedOptions() (sorted []Option) {
|
||||
sorted = slices.Clone(f.Options)
|
||||
switch f.OptionOrder {
|
||||
case OptionOrderNatural:
|
||||
sort.Sort(FormFieldOptionSortNatural(sorted))
|
||||
return
|
||||
case OptionOrderRandom:
|
||||
sort.Sort(FormFieldOptionSortRand(sorted))
|
||||
return
|
||||
default:
|
||||
sort.Sort(FormFieldOptionSortNatural(sorted))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// allValid checks if all field submission values are valid options
|
||||
func allValid(field FormField, subset []string) bool {
|
||||
set := make(map[string]bool)
|
||||
|
|
|
|||
|
|
@ -295,22 +295,21 @@ templ fieldSettingsConfiguration(form frm.Form, field types.FormField) {
|
|||
autocomplete="off"
|
||||
_={ fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent) }
|
||||
/>
|
||||
<div class="pt-3">
|
||||
<label for={ fields.FieldName(field, "", "placeholder") } class="pr-1">
|
||||
Placeholder
|
||||
</label>
|
||||
<input
|
||||
id={ fields.FieldName(field, "", "placeholder") }
|
||||
name={ fields.FieldName(field, "", "placeholder") }
|
||||
type="text"
|
||||
class="w-full rounded-md"
|
||||
value={ field.Placeholder }
|
||||
autocomplete="off"
|
||||
_={ fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent) }
|
||||
/>
|
||||
</div>
|
||||
switch field.Type {
|
||||
case types.FormFieldTypeTextSingle, types.FormFieldTypeTextMultiple:
|
||||
<div class="pt-3">
|
||||
<label for={ fields.FieldName(field, "", "placeholder") } class="pr-1">
|
||||
Placeholder
|
||||
</label>
|
||||
</div>
|
||||
<input
|
||||
id={ fields.FieldName(field, "", "placeholder") }
|
||||
name={ fields.FieldName(field, "", "placeholder") }
|
||||
type="text"
|
||||
class="w-full rounded-md"
|
||||
value={ field.Placeholder }
|
||||
autocomplete="off"
|
||||
_={ fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent) }
|
||||
/>
|
||||
case types.FormFieldTypeMultiSelect, types.FormFieldTypeSingleSelect, types.FormFieldTypeSingleChoice, types.FormFieldTypeSingleChoiceSpaced:
|
||||
<div class="pt-3">
|
||||
<label for={ fields.FieldName(field, "", "options") } class="pr-1">
|
||||
|
|
@ -342,6 +341,20 @@ templ fieldSettingsConfiguration(form frm.Form, field types.FormField) {
|
|||
SelectionChangeEvent: FieldsFormUpdateEvent,
|
||||
})
|
||||
}
|
||||
<div class="pt-3">
|
||||
<label for={ fields.FieldName(field, "", "option_ordering") } class="pr-1">
|
||||
Option Ordering
|
||||
</label>
|
||||
</div>
|
||||
@selector.Selector(selector.SelectArgs{
|
||||
ID: fields.FieldName(field, "", "option_ordering"),
|
||||
Name: fields.FieldName(field, "", "option_ordering"),
|
||||
Placeholder: "Choose option ordering",
|
||||
Multiple: false,
|
||||
SearchDisabled: true,
|
||||
Options: optionOrderingOptions(field),
|
||||
SelectionChangeEvent: FieldsFormUpdateEvent,
|
||||
})
|
||||
}
|
||||
<div class="pt-3">
|
||||
<label for={ fields.FieldName(field, "", "required") } class="pr-1">
|
||||
|
|
@ -451,6 +464,19 @@ templ fieldLogicConfiguration(form frm.Form, field types.FormField) {
|
|||
</div>
|
||||
}
|
||||
|
||||
// optionOrderingOptions returns the available orderings for options
|
||||
func optionOrderingOptions(field types.FormField) (options []selector.Option) {
|
||||
for _, ordering := range types.FormFieldOptionOrderValues() {
|
||||
options = append(options,
|
||||
selector.Option{
|
||||
Value: ordering.String(),
|
||||
Label: orderingLabelFor(ordering),
|
||||
Selected: field.OptionOrder == ordering,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// comparatorOptionsFor returns the comparators available for a logic field given its Type
|
||||
func comparatorOptionsFor(field types.FormField) (options selector.FieldOptions) {
|
||||
switch field.Type {
|
||||
|
|
@ -491,6 +517,17 @@ func logicActionOptions(field types.FormField) (options []selector.Option) {
|
|||
return
|
||||
}
|
||||
|
||||
func orderingLabelFor(ordering types.FormFieldOptionOrder) string {
|
||||
switch ordering {
|
||||
case types.OptionOrderNatural:
|
||||
return "Order options naturally"
|
||||
case types.OptionOrderRandom:
|
||||
return "Order options randomly"
|
||||
}
|
||||
|
||||
return "Unknown ordering"
|
||||
}
|
||||
|
||||
func actionLabelFor(action types.FieldLogicTriggerAction) string {
|
||||
switch action {
|
||||
case types.FieldLogicTriggerShow:
|
||||
|
|
|
|||
|
|
@ -976,96 +976,91 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\"> ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\"><div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var42 string
|
||||
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 299, Col: 58}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" class=\"pr-1\">Placeholder</label> <input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var43 string
|
||||
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 303, Col: 51}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var44 string
|
||||
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 304, Col: 53}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "\" type=\"text\" class=\"w-full rounded-md\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var45 string
|
||||
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(field.Placeholder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 307, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" autocomplete=\"off\" _=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var46 string
|
||||
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 309, Col: 86}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
switch field.Type {
|
||||
case types.FormFieldTypeTextSingle, types.FormFieldTypeTextMultiple:
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "<div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var42 string
|
||||
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 301, Col: 60}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\" class=\"pr-1\">Placeholder</label></div><input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var43 string
|
||||
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 306, Col: 52}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var44 string
|
||||
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "placeholder"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 307, Col: 54}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" type=\"text\" class=\"w-full rounded-md\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var45 string
|
||||
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(field.Placeholder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 310, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\" autocomplete=\"off\" _=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var46 string
|
||||
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 312, Col: 87}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
case types.FormFieldTypeMultiSelect, types.FormFieldTypeSingleSelect, types.FormFieldTypeSingleChoice, types.FormFieldTypeSingleChoiceSpaced:
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<div class=\"pt-3\"><label for=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "<div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var47 string
|
||||
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "options"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 316, Col: 56}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 315, Col: 56}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "\" class=\"pr-1\">Options</label></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "\" class=\"pr-1\">Options</label></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1081,25 +1076,25 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, " ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, " ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Type == types.FormFieldTypeSingleChoice {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "<div class=\"pt-3\"><label for=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "<div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var48 string
|
||||
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "option_labels"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 331, Col: 63}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 330, Col: 63}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "\" class=\"pr-1\">Option labels</label></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "\" class=\"pr-1\">Option labels</label></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1116,62 +1111,91 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, " <div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var49 string
|
||||
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "option_ordering"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 345, Col: 64}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "\" class=\"pr-1\">Option Ordering</label></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = selector.Selector(selector.SelectArgs{
|
||||
ID: fields.FieldName(field, "", "option_ordering"),
|
||||
Name: fields.FieldName(field, "", "option_ordering"),
|
||||
Placeholder: "Choose option ordering",
|
||||
Multiple: false,
|
||||
SearchDisabled: true,
|
||||
Options: optionOrderingOptions(field),
|
||||
SelectionChangeEvent: FieldsFormUpdateEvent,
|
||||
}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "<div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var49 string
|
||||
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "required"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 347, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "\" class=\"pr-1\">Required</label></div><input id=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "<div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var50 string
|
||||
templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "required"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 352, Col: 47}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 360, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "\" name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "\" class=\"pr-1\">Required</label></div><input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var51 string
|
||||
templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "required"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 353, Col: 49}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 365, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "\" type=\"checkbox\" class=\"checkbox checkbox-primary\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Required {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, " checked")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, " _=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var52 string
|
||||
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
|
||||
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "required"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 366, Col: 49}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "\" type=\"checkbox\" class=\"checkbox checkbox-primary\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Required {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, " checked")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, " _=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var53 string
|
||||
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
|
||||
on click
|
||||
if my.checked
|
||||
set <input[name='%s']/>'s checked to false
|
||||
|
|
@ -1179,67 +1203,67 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
then trigger '%s'`,
|
||||
fields.FieldName(field, "", "hidden"), FieldsFormUpdateEvent))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 365, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "\"><div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var53 string
|
||||
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "hidden"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 368, Col: 53}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 378, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "\" class=\"pr-1\">Hidden</label></div><input id=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "\"><div class=\"pt-3\"><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var54 string
|
||||
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "hidden"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 373, Col: 45}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 381, Col: 53}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "\" name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "\" class=\"pr-1\">Hidden</label></div><input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var55 string
|
||||
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "hidden"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 374, Col: 47}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 386, Col: 45}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "\" type=\"checkbox\" class=\"checkbox checkbox-primary\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Hidden {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, " checked")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, " _=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var56 string
|
||||
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
|
||||
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, "", "hidden"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 387, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "\" type=\"checkbox\" class=\"checkbox checkbox-primary\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Hidden {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, " checked")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, " _=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var57 string
|
||||
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
|
||||
on click
|
||||
if my.checked
|
||||
set <input[name='%s']/>'s checked to false
|
||||
|
|
@ -1247,13 +1271,13 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
then trigger '%s'`,
|
||||
fields.FieldName(field, "", "required"), FieldsFormUpdateEvent))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 386, Col: 68}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 399, Col: 68}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "\"><div class=\"py-3 divide-y\"><label for=\"delete-field\" class=\"pr-1\">Danger zone</label></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "\"><div class=\"py-3 divide-y\"><label for=\"delete-field\" class=\"pr-1\">Danger zone</label></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1265,7 +1289,7 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "</div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1289,64 +1313,64 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var57 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var57 == nil {
|
||||
templ_7745c5c3_Var57 = templ.NopComponent
|
||||
templ_7745c5c3_Var58 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var58 == nil {
|
||||
templ_7745c5c3_Var58 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var58 string
|
||||
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("field-%s-logic", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 402, Col: 59}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "\" class=\"flex flex-col gap-5 hidden\"><div><div data-hx-get=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var59 string
|
||||
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(frm.BuilderPathFormField(ctx, form.ID, field.ID.String(), "/logic/choices"))
|
||||
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("field-%s-logic", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 405, Col: 93}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 415, Col: 59}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "\" data-hx-trigger=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "\" class=\"flex flex-col gap-5 hidden\"><div><div data-hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var60 string
|
||||
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(FieldsFormUpdateEvent)
|
||||
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(frm.BuilderPathFormField(ctx, form.ID, field.ID.String(), "/logic/choices"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 406, Col: 43}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 418, Col: 93}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "\" data-hx-swap=\"innerHTML\" data-hx-target=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "\" data-hx-trigger=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var61 string
|
||||
templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("#logic-field-value-chooser-%s", field.ID.String()))
|
||||
templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(FieldsFormUpdateEvent)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 408, Col: 84}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 419, Col: 43}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "\" data-hx-on:htmx:config-request=\"event.detail.parameters['id'] = event.detail.triggeringEvent.detail.value\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "\" data-hx-swap=\"innerHTML\" data-hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var62 string
|
||||
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("#logic-field-value-chooser-%s", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 421, Col: 84}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "\" data-hx-on:htmx:config-request=\"event.detail.parameters['id'] = event.detail.triggeringEvent.detail.value\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1361,7 +1385,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "</div></div><div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "</div></div><div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1376,20 +1400,20 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "</div><div><div id=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "</div><div><div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var62 string
|
||||
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("logic-field-value-chooser-%s", field.ID.String()))
|
||||
var templ_7745c5c3_Var63 string
|
||||
templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("logic-field-value-chooser-%s", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 433, Col: 71}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 446, Col: 71}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1399,7 +1423,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "</div></div><div><p class=\"pb-3\">Choose action(s)</p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "</div></div><div><p class=\"pb-3\">Choose action(s)</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1414,7 +1438,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "</div></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -1422,6 +1446,19 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
|
|||
})
|
||||
}
|
||||
|
||||
// optionOrderingOptions returns the available orderings for options
|
||||
func optionOrderingOptions(field types.FormField) (options []selector.Option) {
|
||||
for _, ordering := range types.FormFieldOptionOrderValues() {
|
||||
options = append(options,
|
||||
selector.Option{
|
||||
Value: ordering.String(),
|
||||
Label: orderingLabelFor(ordering),
|
||||
Selected: field.OptionOrder == ordering,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// comparatorOptionsFor returns the comparators available for a logic field given its Type
|
||||
func comparatorOptionsFor(field types.FormField) (options selector.FieldOptions) {
|
||||
switch field.Type {
|
||||
|
|
@ -1462,6 +1499,17 @@ func logicActionOptions(field types.FormField) (options []selector.Option) {
|
|||
return
|
||||
}
|
||||
|
||||
func orderingLabelFor(ordering types.FormFieldOptionOrder) string {
|
||||
switch ordering {
|
||||
case types.OptionOrderNatural:
|
||||
return "Order options naturally"
|
||||
case types.OptionOrderRandom:
|
||||
return "Order options randomly"
|
||||
}
|
||||
|
||||
return "Unknown ordering"
|
||||
}
|
||||
|
||||
func actionLabelFor(action types.FieldLogicTriggerAction) string {
|
||||
switch action {
|
||||
case types.FieldLogicTriggerShow:
|
||||
|
|
@ -1493,9 +1541,9 @@ func LogicConfiguratorStepThree(form frm.Form, field types.FormField, targetFiel
|
|||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var63 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var63 == nil {
|
||||
templ_7745c5c3_Var63 = templ.NopComponent
|
||||
templ_7745c5c3_Var64 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var64 == nil {
|
||||
templ_7745c5c3_Var64 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
switch targetField.Type {
|
||||
|
|
@ -1512,69 +1560,69 @@ func LogicConfiguratorStepThree(form frm.Form, field types.FormField, targetFiel
|
|||
return templ_7745c5c3_Err
|
||||
}
|
||||
case types.FormFieldTypeTextSingle, types.FormFieldTypeTextMultiple:
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "<input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var64 string
|
||||
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s-logic-chosen-field-value", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 522, Col: 70}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "\" name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "<input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var65 string
|
||||
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, FieldGroupLogic, FieldLogicTargetFieldValue))
|
||||
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s-logic-chosen-field-value", field.ID.String()))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 523, Col: 79}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 559, Col: 70}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "\" type=\"text\" class=\"bg-gray-50\" placeholder=\"Enter a value\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var66 string
|
||||
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(fields.FieldName(field, FieldGroupLogic, FieldLogicTargetFieldValue))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 560, Col: 79}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "\" type=\"text\" class=\"bg-gray-50\" placeholder=\"Enter a value\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if field.Logic != nil && len(field.Logic.TriggerValues) > 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, " value=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, " value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var66 string
|
||||
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(field.Logic.TriggerValues[0])
|
||||
var templ_7745c5c3_Var67 string
|
||||
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(field.Logic.TriggerValues[0])
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 528, Col: 41}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 565, Col: 41}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, " _=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, " _=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var67 string
|
||||
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent))
|
||||
var templ_7745c5c3_Var68 string
|
||||
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("on keyup debounced at 600ms trigger '%s'", FieldsFormUpdateEvent))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 530, Col: 86}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/builder/builder.templ`, Line: 567, Col: 86}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,18 +62,19 @@
|
|||
\" name=\"
|
||||
\" type=\"text\" class=\"w-full rounded-md\" value=\"
|
||||
\" autocomplete=\"off\" _=\"
|
||||
\">
|
||||
<div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Placeholder</label></div><input id=\"
|
||||
\"><div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Placeholder</label> <input id=\"
|
||||
\" name=\"
|
||||
\" type=\"text\" class=\"w-full rounded-md\" value=\"
|
||||
\" autocomplete=\"off\" _=\"
|
||||
\">
|
||||
\"></div>
|
||||
<div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Options</label></div>
|
||||
|
||||
<div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Option labels</label></div>
|
||||
<div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Option Ordering</label></div>
|
||||
<div class=\"pt-3\"><label for=\"
|
||||
\" class=\"pr-1\">Required</label></div><input id=\"
|
||||
\" name=\"
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ templ selectView(field types.FormField) {
|
|||
Required: field.Required,
|
||||
Placeholder: field.Placeholder,
|
||||
Multiple: field.Type == types.FormFieldTypeMultiSelect,
|
||||
Options: ToSelectorOpts(field.Options, false),
|
||||
Options: ToSelectorOpts(field.SortedOptions(), false),
|
||||
SearchDisabled: true,
|
||||
EditItems: false,
|
||||
Hyperscript: fmt.Sprintf("on change trigger field_change(field_id: '%s', value: my.value)", field.ID.String()),
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ func selectView(field types.FormField) templ.Component {
|
|||
Required: field.Required,
|
||||
Placeholder: field.Placeholder,
|
||||
Multiple: field.Type == types.FormFieldTypeMultiSelect,
|
||||
Options: ToSelectorOpts(field.Options, false),
|
||||
Options: ToSelectorOpts(field.SortedOptions(), false),
|
||||
SearchDisabled: true,
|
||||
EditItems: false,
|
||||
Hyperscript: fmt.Sprintf("on change trigger field_change(field_id: '%s', value: my.value)", field.ID.String()),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ templ SingleChoice(field types.FormField) {
|
|||
@LabeledField(field) {
|
||||
<div class="w-full">
|
||||
<div class="join w-full">
|
||||
for _, option := range field.Options {
|
||||
for _, option := range field.SortedOptions() {
|
||||
<label class="join-item h-auto flex-grow shrink btn has-[:checked]:bg-sky-400 first:border-x-0 last:border-r-0 border-y-0 border-black bg-sky-50 py-3">
|
||||
<!-- the input field is hidden with opacity, width, and height, but available for HTML validation when 'required' -->
|
||||
<input
|
||||
|
|
@ -50,7 +50,7 @@ templ SingleChoiceSpaced(field types.FormField) {
|
|||
@LabeledField(field) {
|
||||
<div class="w-full">
|
||||
<div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
|
||||
for _, option := range field.Options {
|
||||
for _, option := range field.SortedOptions() {
|
||||
<label
|
||||
class="flex gap-2 w-auto h-auto btn bg-sky-50 has-[:checked]:bg-sky-400 has-[:checked]:border-sky-500 py-3"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ func SingleChoice(field types.FormField) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, option := range field.Options {
|
||||
for _, option := range field.SortedOptions() {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<label class=\"join-item h-auto flex-grow shrink btn has-[:checked]:bg-sky-400 first:border-x-0 last:border-r-0 border-y-0 border-black bg-sky-50 py-3\"><!-- the input field is hidden with opacity, width, and height, but available for HTML validation when 'required' --><input class=\"opacity-0 w-0 h-0\" type=\"radio\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
|
|
@ -244,7 +244,7 @@ func SingleChoiceSpaced(field types.FormField) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, option := range field.Options {
|
||||
for _, option := range field.SortedOptions() {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<label class=\"flex gap-2 w-auto h-auto btn bg-sky-50 has-[:checked]:bg-sky-400 has-[:checked]:border-sky-500 py-3\"><span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
|
|
|
|||
Loading…
Reference in a new issue