diff --git a/db/create_forms_test.go b/db/create_forms_test.go
index 7a50d19..14618f8 100644
--- a/db/create_forms_test.go
+++ b/db/create_forms_test.go
@@ -13,6 +13,10 @@ import (
"github.com/google/uuid"
)
+var (
+ workspaceID = uuid.New()
+)
+
func TestCreateAndUpdateForm(t *testing.T) {
const nameUpdate = "Tell us about you"
fieldID := uuid.MustParse("1afd4bf9-42a4-4dfe-b359-d46a65ce5ba5")
@@ -60,7 +64,7 @@ func TestCreateAndUpdateForm(t *testing.T) {
ctx := context.Background()
frms, err := frm.New(frm.Args{
PostgresURL: os.Getenv("POSTGRES_URL"),
- WorkspaceID: uuid.New(),
+ WorkspaceID: workspaceID,
})
if err != nil {
t.Error(err)
@@ -82,7 +86,7 @@ func TestCreateAndUpdateForm(t *testing.T) {
}
f, err = internal.Q(ctx, frms.PostgresURL).SaveDraft(ctx, internal.SaveDraftParams{
- ID: 1,
+ ID: f.ID,
Name: nameUpdate,
Fields: updatedFields,
WorkspaceID: frms.WorkspaceID,
diff --git a/db/migrations/20241105222317_add_forms_table.sql.up.sql b/db/migrations/20241105222317_add_forms_table.sql.up.sql
index 439227e..7c2e6ff 100644
--- a/db/migrations/20241105222317_add_forms_table.sql.up.sql
+++ b/db/migrations/20241105222317_add_forms_table.sql.up.sql
@@ -14,7 +14,7 @@ CREATE TYPE form_status AS ENUM (
-- workspaces represent users, tenants, groupings, etc. in external systems
CREATE TABLE IF NOT EXISTS forms (
id BIGINT PRIMARY KEY DEFAULT nextval('form_ids'),
- form_id BIGINT REFERENCES forms(id),
+ form_id BIGINT REFERENCES forms(id) ON DELETE CASCADE,
workspace_id UUID NOT NULL,
name text not null,
fields jsonb default '{}' NOT NULL,
diff --git a/db/queries.sql b/db/queries.sql
index df9a5f2..7677090 100644
--- a/db/queries.sql
+++ b/db/queries.sql
@@ -5,6 +5,13 @@ FROM forms
WHERE workspace_id = @workspace_id
AND id = @id;
+-- name: DeleteForm :exec
+
+DELETE
+FROM forms
+WHERE workspace_id = @workspace_id
+ AND id = @id;
+
-- name: GetDraft :one
SELECT *
@@ -17,7 +24,11 @@ WHERE workspace_id = @workspace_id
SELECT *
FROM forms
-WHERE workspace_id = @workspace_id;
+WHERE workspace_id = @workspace_id
+ AND status = any(CASE
+ WHEN cardinality(@statuses::form_status[]) > 0 THEN @statuses::form_status[]
+ ELSE enum_range(NULL::form_status)::form_status[]
+ END::form_status[]);
-- name: ListDrafts :many
diff --git a/env.sample b/env.sample
index e69de29..8b13789 100644
--- a/env.sample
+++ b/env.sample
@@ -0,0 +1 @@
+
diff --git a/frm.go b/frm.go
index b81eef2..025a0be 100644
--- a/frm.go
+++ b/frm.go
@@ -8,6 +8,10 @@ import (
"github.com/google/uuid"
)
+const (
+ EventDraftCreated = "frmDraftCreated" // htmx event sent when new drafts are created
+)
+
var ErrCannotDetermineWorkspace = errors.New("workspace cannot be determine without WorkspaceID or WorkspaceIDUrlParam")
// Frm is the primary API into frm
@@ -24,6 +28,8 @@ type Args struct {
WorkspaceIDUrlParam string
}
+type FormStatus internal.FormStatus
+
// New initializes a new frm instance
//
// If the frm database hasn't been initiailized, the database is initialized
@@ -61,10 +67,21 @@ func (f *Frm) GetForm(ctx context.Context, id int64) (form Form, err error) {
return
}
+type ListFormsArgs struct {
+ Statuses []FormStatus
+}
+
// ListForms lists all forms for the current workspace
-func (f *Frm) ListForms(ctx context.Context) (forms []Form, err error) {
+func (f *Frm) ListForms(ctx context.Context, args ListFormsArgs) (forms []Form, err error) {
var fs Forms
- fs, err = internal.Q(ctx, f.PostgresURL).ListForms(ctx, f.WorkspaceID)
+ statuses := []internal.FormStatus{}
+ for _, s := range args.Statuses {
+ statuses = append(statuses, (internal.FormStatus)(s))
+ }
+ fs, err = internal.Q(ctx, f.PostgresURL).ListForms(ctx, internal.ListFormsParams{
+ WorkspaceID: f.WorkspaceID,
+ Statuses: statuses,
+ })
if err != nil {
return
}
diff --git a/handlers/handlers.go b/handlers/handlers.go
index 54b0a16..6a2f709 100644
--- a/handlers/handlers.go
+++ b/handlers/handlers.go
@@ -15,6 +15,7 @@ import (
"github.com/acaloiaro/frm/types"
"github.com/acaloiaro/frm/ui"
"github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
)
type contextKey string
@@ -34,8 +35,8 @@ func StaticAssetHandler(w http.ResponseWriter, r *http.Request) {
http.FileServer(http.FS(static.Assets)).ServeHTTP(w, r)
}
-// FormEditor displays the form editor and previewer
-func FormEditor(w http.ResponseWriter, r *http.Request) {
+// DraftEditor displays the form editor and previewer
+func DraftEditor(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
f, err := instance(ctx)
if err != nil {
@@ -554,8 +555,50 @@ func DeleteField(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
-// NewDraft creates a new draft an existing form
+// NewDraft creates a new draft from scratch or an existing form
func NewDraft(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+ formID, _ := formID(ctx)
+ f, err := instance(ctx)
+ if err != nil {
+ slog.Error("unable to create draft", "error", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ q := internal.Q(ctx, f.PostgresURL)
+
+ draftParams := &internal.SaveDraftParams{
+ WorkspaceID: f.WorkspaceID,
+ Fields: types.FormFields{},
+ }
+ if formID != nil {
+ form, err := q.GetForm(ctx, internal.GetFormParams{
+ WorkspaceID: f.WorkspaceID,
+ ID: *formID,
+ })
+ if err != nil && errors.Is(err, pgx.ErrNoRows) {
+ w.WriteHeader(http.StatusNotFound)
+ } else if err != nil {
+ slog.Error("unable to create draft", "error", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ draftParams.FormID = &form.ID
+ draftParams.Name = form.Name
+ draftParams.Fields = form.Fields
+ } else {
+ draftParams.Name = "New form"
+ }
+
+ draft, err := q.SaveDraft(ctx, *draftParams)
+ if err != nil {
+ slog.Error("unable to create draft", "error", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ w.Header().Add("HX-Trigger", fmt.Sprintf("{\"%s\": {\"draft_id\": \"%d\"}}", frm.EventDraftCreated, draft.ID))
+ w.WriteHeader(http.StatusCreated)
}
// PublishDraft copies drafts to published forms
@@ -567,7 +610,7 @@ func PublishDraft(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
return
}
- formID, err := formID(ctx)
+ draftID, err := formID(ctx)
if err != nil {
slog.Error("unable to publish draft", "error", err)
w.WriteHeader(http.StatusNotFound)
@@ -576,7 +619,7 @@ func PublishDraft(w http.ResponseWriter, r *http.Request) {
draft, err := internal.Q(ctx, f.PostgresURL).GetDraft(ctx, internal.GetDraftParams{
WorkspaceID: f.WorkspaceID,
- ID: *formID,
+ ID: *draftID,
})
if err != nil {
slog.Error("unable to publish draft", "error", err)
@@ -594,6 +637,35 @@ func PublishDraft(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
}
+// DeleteForm deletes forms
+func DeleteForm(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+ f, err := instance(ctx)
+ if err != nil {
+ slog.Error("unable to delete form", "error", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ formID, err := formID(ctx)
+ if err != nil {
+ slog.Error("unable to delete form", "error", err)
+ w.WriteHeader(http.StatusNotFound)
+ return
+ }
+
+ err = internal.Q(ctx, f.PostgresURL).DeleteForm(ctx, internal.DeleteFormParams{
+ WorkspaceID: f.WorkspaceID,
+ ID: *formID,
+ })
+ if err != nil {
+ slog.Error("unable to delete form", "error", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusOK)
+}
+
// instance returns the frm instance from the request context
func instance(ctx context.Context) (i *frm.Frm, err error) {
var ok bool
diff --git a/internal/default.go b/internal/default.go
index 63ee785..65b539d 100644
--- a/internal/default.go
+++ b/internal/default.go
@@ -28,6 +28,11 @@ var pool *pgxpool.Pool
type Forms []Form
+var enumTypes = []string{
+ "form_status",
+ "_form_status", // array of form statuses
+}
+
// getPool returns a database pool for the specified connection string
func getPool(ctx context.Context, databaseURL string) (p *pgxpool.Pool, err error) {
if pool == nil {
@@ -38,6 +43,19 @@ func getPool(ctx context.Context, databaseURL string) (p *pgxpool.Pool, err erro
return
}
+ // this after conect hook allows pgx to correclty encode enum types as query params
+ // reference: https://github.com/jackc/pgx/issues/1549#issuecomment-1467107173
+ poolConfig.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
+ for _, typ := range enumTypes {
+ t, err := conn.LoadType(ctx, typ)
+ if err != nil {
+ return err
+ }
+ conn.TypeMap().RegisterType(t)
+ }
+ return nil
+ }
+
err = InitializeDB(ctx, databaseURL)
if err != nil {
err = fmt.Errorf("database failed to initialize: %v", err)
@@ -92,7 +110,7 @@ func InitializeDB(ctx context.Context, postgresURL string) (err error) {
// TODO not all db crdentials have permission to do this. Fail gracefully when user lacks permission
func createIfNotExist(ctx context.Context, cfg *pgx.ConnConfig) (err error) {
dbName := cfg.Database
- cfg.Database = ""
+ cfg.Database = "postgres"
cfg.RuntimeParams = nil
conn, err := pgx.ConnectConfig(context.Background(), cfg)
@@ -147,7 +165,6 @@ func pgConnectionString(postgresURL string, disableSSL bool, options ...string)
if err != nil {
return
}
-
options = append(options, "x-migrations-table=frm_migrations")
if disableSSL {
diff --git a/internal/queries.sql.go b/internal/queries.sql.go
index 8c99389..59b98fe 100644
--- a/internal/queries.sql.go
+++ b/internal/queries.sql.go
@@ -12,6 +12,30 @@ import (
uuid "github.com/google/uuid"
)
+const deleteForm = `-- name: DeleteForm :exec
+
+DELETE
+FROM forms
+WHERE workspace_id = $1
+ AND id = $2
+`
+
+type DeleteFormParams struct {
+ WorkspaceID uuid.UUID `json:"workspace_id"`
+ ID int64 `json:"id"`
+}
+
+// DeleteForm
+//
+// DELETE
+// FROM forms
+// WHERE workspace_id = $1
+// AND id = $2
+func (q *Queries) DeleteForm(ctx context.Context, arg DeleteFormParams) error {
+ _, err := q.db.Exec(ctx, deleteForm, arg.WorkspaceID, arg.ID)
+ return err
+}
+
const getDraft = `-- name: GetDraft :one
SELECT id, form_id, workspace_id, name, fields, status, created_at, updated_at
@@ -139,15 +163,28 @@ const listForms = `-- name: ListForms :many
SELECT id, form_id, workspace_id, name, fields, status, created_at, updated_at
FROM forms
WHERE workspace_id = $1
+ AND status = any(CASE
+ WHEN cardinality($2::form_status[]) > 0 THEN $2::form_status[]
+ ELSE enum_range(NULL::form_status)::form_status[]
+ END::form_status[])
`
+type ListFormsParams struct {
+ WorkspaceID uuid.UUID `json:"workspace_id"`
+ Statuses []FormStatus `json:"statuses"`
+}
+
// ListForms
//
// SELECT id, form_id, workspace_id, name, fields, status, created_at, updated_at
// FROM forms
// WHERE workspace_id = $1
-func (q *Queries) ListForms(ctx context.Context, workspaceID uuid.UUID) ([]Form, error) {
- rows, err := q.db.Query(ctx, listForms, workspaceID)
+// AND status = any(CASE
+// WHEN cardinality($2::form_status[]) > 0 THEN $2::form_status[]
+// ELSE enum_range(NULL::form_status)::form_status[]
+// END::form_status[])
+func (q *Queries) ListForms(ctx context.Context, arg ListFormsParams) ([]Form, error) {
+ rows, err := q.db.Query(ctx, listForms, arg.WorkspaceID, arg.Statuses)
if err != nil {
return nil, err
}
diff --git a/routers/frmchi/router.go b/routers/frmchi/router.go
index 4c339ff..38ee3c1 100644
--- a/routers/frmchi/router.go
+++ b/routers/frmchi/router.go
@@ -31,8 +31,10 @@ func Mount(router chi.Router, mountPoint string, f *frm.Frm) {
r.NotFound(handlers.StaticAssetHandler)
rc := r.With(addRequestContext)
- rc.Get(fmt.Sprintf("/{%s}", urlParamFormID), handlers.FormEditor)
- rc.Get(fmt.Sprintf("/{%s}/draft", urlParamFormID), handlers.NewDraft)
+ rc.Post("/draft", handlers.NewDraft)
+ rc.Get(fmt.Sprintf("/{%s}", urlParamFormID), handlers.DraftEditor)
+ rc.Delete(fmt.Sprintf("/{%s}", urlParamFormID), handlers.DeleteForm)
+ rc.Post(fmt.Sprintf("/{%s}/draft", urlParamFormID), handlers.NewDraft)
rc.Put(fmt.Sprintf("/{%s}/publish", urlParamFormID), handlers.PublishDraft)
rc.Put(fmt.Sprintf("/{%s}/fields/order", urlParamFormID), handlers.UpdateFieldOrder)
rc.Get(fmt.Sprintf("/{%s}/logic_configurator/{%s}/step3", urlParamFormID, urlParamFieldID), handlers.LogicConfiguratorStep3)
diff --git a/ui/common_templ.go b/ui/common_templ.go
index c74941c..3a09d3c 100644
--- a/ui/common_templ.go
+++ b/ui/common_templ.go
@@ -84,7 +84,7 @@ func HeroIcon(style string, name string) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -137,7 +137,7 @@ func button(args buttonArgs, attrs templ.Attributes) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -209,7 +209,7 @@ func mutedButton(args buttonArgs, attrs templ.Attributes) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -247,7 +247,7 @@ func mutedButton(args buttonArgs, attrs templ.Attributes) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -277,7 +277,7 @@ func FormBuilderNavTitle(form frm.Form) templ.Component {
templ_7745c5c3_Var11 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -320,7 +320,7 @@ func FormBuilderNav(form frm.Form) templ.Component {
templ_7745c5c3_Var13 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -403,7 +403,7 @@ func head(pageTitle string) templ.Component {
templ_7745c5c3_Var15 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -416,7 +416,7 @@ func head(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" :: ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -429,7 +429,7 @@ func head(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -445,7 +445,7 @@ func head(pageTitle string) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -624,7 +624,7 @@ func head(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 34)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -679,7 +679,7 @@ func App(pageTitle string) templ.Component {
templ_7745c5c3_Var33 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 35)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -687,7 +687,7 @@ func App(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 36)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -695,7 +695,7 @@ func App(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 37)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -703,7 +703,7 @@ func App(pageTitle string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 38)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -745,7 +745,7 @@ func Builder(form frm.Form) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 39)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -753,7 +753,7 @@ func Builder(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 40)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -761,7 +761,7 @@ func Builder(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 41)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -769,7 +769,7 @@ func Builder(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 42)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -777,7 +777,7 @@ func Builder(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 43)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -813,7 +813,7 @@ func FormSettings(form frm.Form) templ.Component {
templ_7745c5c3_Var36 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 44)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -903,7 +903,7 @@ func builderColumnLeft(form frm.Form) templ.Component {
templ_7745c5c3_Var41 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 50)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -915,7 +915,7 @@ func builderColumnLeft(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 51)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -945,7 +945,7 @@ func FormPreview(form frm.Form) templ.Component {
templ_7745c5c3_Var42 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 52)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -953,7 +953,7 @@ func FormPreview(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 53)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -982,7 +982,7 @@ func FieldTypeIcon(fieldType types.FormFieldType) templ.Component {
templ_7745c5c3_Var43 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 54)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -998,7 +998,7 @@ func FieldTypeIcon(fieldType types.FormFieldType) templ.Component {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 55)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1028,7 +1028,7 @@ func FormFields(form frm.Form) templ.Component {
templ_7745c5c3_Var44 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 56)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1036,7 +1036,7 @@ func FormFields(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 57)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1065,7 +1065,7 @@ func FormFieldsForm(form frm.Form) templ.Component {
templ_7745c5c3_Var45 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 58)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1205,7 +1205,7 @@ func requiredFieldIndicator() templ.Component {
templ_7745c5c3_Var51 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 69)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("*")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1267,12 +1267,12 @@ func builderColumnRight(form frm.Form) templ.Component {
templ_7745c5c3_Var52 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 70)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1332,7 +1332,7 @@ func builderColumnRight(form frm.Form) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 77)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1369,7 +1369,7 @@ func FormFieldConfigurator(form frm.Form) templ.Component {
templ_7745c5c3_Var56 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 78)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1505,7 +1505,7 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
templ_7745c5c3_Var61 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 89)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1617,7 +1617,7 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 98)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if field.Type == types.FormFieldTypeSingleSelect || field.Type == types.FormFieldTypeMultiSelect {
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 108)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1769,7 +1769,7 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 110)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1917,7 +1917,7 @@ func fieldSettingsConfiguration(form frm.Form, field types.FormField) templ.Comp
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 123)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1946,7 +1946,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
templ_7745c5c3_Var88 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 124)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2013,7 +2013,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 129)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2028,7 +2028,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 130)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2051,7 +2051,7 @@ func fieldLogicConfiguration(form frm.Form, field types.FormField) templ.Compone
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 132)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2184,7 +2184,7 @@ func LogicConfiguratorStepThree(form frm.Form, field types.FormField, targetFiel
return templ_7745c5c3_Err
}
case types.FormFieldTypeTextSingle, types.FormFieldTypeTextMultiple:
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 139)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2327,7 +2327,7 @@ func formFieldTypeLabel(fieldType types.FormFieldType) templ.Component {
templ_7745c5c3_Var103 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 146)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2335,38 +2335,38 @@ func formFieldTypeLabel(fieldType types.FormFieldType) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 147)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2395,7 +2395,7 @@ func fieldLabel(field types.FormField) templ.Component {
templ_7745c5c3_Var104 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 154)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2421,7 +2421,7 @@ func fieldLabel(field types.FormField) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 156)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2431,7 +2431,7 @@ func fieldLabel(field types.FormField) templ.Component {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 157)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2475,7 +2475,7 @@ func FormView(form frm.Form, isPreview bool) templ.Component {
templ_7745c5c3_Var107 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 158)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/ui/common_templ.txt b/ui/common_templ.txt
deleted file mode 100644
index 22a2456..0000000
--- a/ui/common_templ.txt
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
-
- ::
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-*
-
-
-
-
-
-
-
-Single-line text
-Multi-line text
-Single select
-Multi select
-I unno
-
-
-
-
-
diff --git a/ui/selector/selector_templ.go b/ui/selector/selector_templ.go
index bd807fb..65e4f57 100644
--- a/ui/selector/selector_templ.go
+++ b/ui/selector/selector_templ.go
@@ -154,7 +154,7 @@ func Selector(args SelectArgs) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -193,22 +193,22 @@ func Selector(args SelectArgs) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if args.Required {
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("*")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(args.OptionsContent) > 0 {
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for item, component := range args.OptionsContent {
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -356,17 +356,17 @@ func Selector(args SelectArgs) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 25)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/ui/selector/selector_templ.txt b/ui/selector/selector_templ.txt
deleted file mode 100644
index 42bf2ff..0000000
--- a/ui/selector/selector_templ.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-*
-
-
-
-