@@ -8,12 +8,44 @@ import (
88 "github.com/mendixlabs/mxcli/sdk/workflows"
99)
1010
11+ // ContainerKind represents the type of page container (page, layout, or snippet).
12+ type ContainerKind string
13+
14+ const (
15+ ContainerPage ContainerKind = "page"
16+ ContainerLayout ContainerKind = "layout"
17+ ContainerSnippet ContainerKind = "snippet"
18+ )
19+
20+ // InsertPosition represents where a widget is inserted relative to a target.
21+ type InsertPosition string
22+
23+ const (
24+ InsertBefore InsertPosition = "before"
25+ InsertAfter InsertPosition = "after"
26+ )
27+
28+ // PluggablePropertyOp represents the operation type for SetPluggableProperty.
29+ type PluggablePropertyOp string
30+
31+ const (
32+ PluggableOpAttribute PluggablePropertyOp = "attribute"
33+ PluggableOpAssociation PluggablePropertyOp = "association"
34+ PluggableOpPrimitive PluggablePropertyOp = "primitive"
35+ PluggableOpSelection PluggablePropertyOp = "selection"
36+ PluggableOpDataSource PluggablePropertyOp = "datasource"
37+ PluggableOpWidgets PluggablePropertyOp = "widgets"
38+ PluggableOpTextTemplate PluggablePropertyOp = "texttemplate"
39+ PluggableOpAction PluggablePropertyOp = "action"
40+ PluggableOpAttributeObjects PluggablePropertyOp = "attributeObjects"
41+ )
42+
1143// PageMutator provides fine-grained mutation operations on a single
1244// page, layout, or snippet unit. Obtain one via PageMutationBackend.OpenPageForMutation.
1345// All methods operate on the in-memory representation; call Save to persist.
1446type PageMutator interface {
15- // ContainerType returns " page", " layout" , or " snippet" .
16- ContainerType () string
47+ // ContainerType returns the kind of container ( page, layout, or snippet) .
48+ ContainerType () ContainerKind
1749
1850 // --- Widget property operations ---
1951
@@ -31,8 +63,8 @@ type PageMutator interface {
3163 // --- Widget tree operations ---
3264
3365 // InsertWidget inserts serialized widgets at the given position
34- // relative to the target widget. Position is "before" or "after".
35- InsertWidget (targetWidget string , position string , widgets []pages.Widget ) error
66+ // relative to the target widget.
67+ InsertWidget (targetWidget string , position InsertPosition , widgets []pages.Widget ) error
3668
3769 // DropWidget removes widgets by name from the tree.
3870 DropWidget (widgetRefs []string ) error
@@ -56,11 +88,9 @@ type PageMutator interface {
5688 // --- Pluggable widget operations ---
5789
5890 // SetPluggableProperty sets a typed property on a pluggable widget's object.
59- // propKey is the Mendix property key, opName is the operation type
60- // ("attribute", "association", "primitive", "selection", "datasource",
61- // "widgets", "texttemplate", "action", "attributeObjects").
62- // ctx carries the operation-specific values.
63- SetPluggableProperty (widgetRef string , propKey string , opName string , ctx PluggablePropertyContext ) error
91+ // propKey is the Mendix property key, op identifies the operation type,
92+ // and ctx carries the operation-specific values.
93+ SetPluggableProperty (widgetRef string , propKey string , op PluggablePropertyOp , ctx PluggablePropertyContext ) error
6494
6595 // --- Introspection ---
6696
0 commit comments