Skip to content

Commit f68236b

Browse files
akoclaude
andcommitted
feat: add DesktopColumns/TabletColumns/PhoneColumns properties to GALLERY widget
Support responsive column control for Gallery via MDL syntax. The three properties map to the pluggable widget's desktopItems/tabletItems/phoneItems PrimitiveValue fields. DESCRIBE emits non-default values only (default: 1). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ebcfb04 commit f68236b

File tree

13 files changed

+105
-10
lines changed

13 files changed

+105
-10
lines changed

.claude/skills/mendix/create-page.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,15 @@ DATAVIEW dataView1 (DataSource: $Customer) {
462462

463463
### GALLERY Widget
464464

465-
Display items in card layout with selection:
465+
Display items in card layout with selection and responsive columns:
466466

467467
```sql
468468
GALLERY galleryName (
469469
DataSource: DATABASE FROM Module.Entity SORT BY Name ASC,
470-
Selection: Single|Multiple|None
470+
Selection: Single|Multiple|None,
471+
DesktopColumns: 3,
472+
TabletColumns: 2,
473+
PhoneColumns: 1
471474
) {
472475
TEMPLATE template1 {
473476
DYNAMICTEXT name (Content: '{1}', ContentParams: [{1} = Name], RenderMode: H4)

.claude/skills/mendix/custom-widgets.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ Card-layout list with optional template content and filters.
1414
```sql
1515
GALLERY galleryName (
1616
DataSource: DATABASE FROM Module.Entity SORT BY Name ASC,
17-
Selection: Single | Multiple | None
17+
Selection: Single | Multiple | None,
18+
DesktopColumns: 3,
19+
TabletColumns: 2,
20+
PhoneColumns: 1
1821
) {
1922
TEMPLATE template1 {
2023
DYNAMICTEXT title (Content: '{1}', ContentParams: [{1} = Name], RenderMode: H4)
@@ -32,6 +35,7 @@ GALLERY galleryName (
3235
- `TEMPLATE` block -> mapped to `content` property (child widgets rendered per row)
3336
- `FILTER` block -> mapped to `filtersPlaceholder` property (shown above list)
3437
- `Selection: None` omits the selection property (default if omitted)
38+
- `DesktopColumns`, `TabletColumns`, `PhoneColumns` control responsive grid columns (default: 1 each, omit if default)
3539
- Children written directly under GALLERY (no container) go to the first slot with `mdlContainer: "TEMPLATE"`
3640

3741
### COMBOBOX

cmd/mxcli/help_topics/page.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ DATA WIDGETS
111111

112112
GALLERY galleryName (
113113
DataSource: DATABASE Module.Entity,
114-
Selection: Single
114+
Selection: Single,
115+
DesktopColumns: 3,
116+
TabletColumns: 2,
117+
PhoneColumns: 1
115118
) {
116119
DYNAMICTEXT txtName (Content: '{1}', ContentParams: [{1} = Name], RenderMode: H4)
117120
}

cmd/mxcli/skills/create-page.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,15 @@ DATAVIEW dataView1 (DataSource: $Customer) {
462462

463463
### GALLERY Widget
464464

465-
Display items in card layout with selection:
465+
Display items in card layout with selection and responsive columns:
466466

467467
```sql
468468
GALLERY galleryName (
469469
DataSource: DATABASE FROM Module.Entity SORT BY Name ASC,
470-
Selection: Single|Multiple|None
470+
Selection: Single|Multiple|None,
471+
DesktopColumns: 3,
472+
TabletColumns: 2,
473+
PhoneColumns: 1
471474
) {
472475
TEMPLATE template1 {
473476
DYNAMICTEXT name (Content: '{1}', ContentParams: [{1} = Name], RenderMode: H4)

docs-site/src/internals/widget-engine.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ Each pluggable widget has a definition file that maps MDL syntax to template pro
8282
"propertyMappings": [
8383
{"propertyKey": "datasource", "source": "DataSource", "operation": "datasource"},
8484
{"propertyKey": "itemSelection", "source": "Selection", "operation": "selection", "default": "Single"},
85+
{"propertyKey": "desktopItems", "source": "DesktopColumns", "default": "1", "operation": "primitive"},
86+
{"propertyKey": "tabletItems", "source": "TabletColumns", "default": "1", "operation": "primitive"},
87+
{"propertyKey": "phoneItems", "source": "PhoneColumns", "default": "1", "operation": "primitive"},
8588
{"propertyKey": "pageSize", "value": "20", "operation": "primitive"}
8689
],
8790
"childSlots": [

docs-site/src/language/widget-types.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,25 @@ GALLERY galProducts (DataSource: DATABASE MyModule.Product) {
167167
}
168168
```
169169

170+
**Responsive column properties** control how many columns the grid uses per breakpoint:
171+
172+
| Property | Description | Default |
173+
|----------|-------------|---------|
174+
| `DesktopColumns` | Number of columns on desktop | `1` |
175+
| `TabletColumns` | Number of columns on tablet | `1` |
176+
| `PhoneColumns` | Number of columns on phone | `1` |
177+
178+
```sql
179+
GALLERY galBoard (
180+
DataSource: DATABASE MyModule.Cell,
181+
DesktopColumns: 9,
182+
TabletColumns: 4,
183+
PhoneColumns: 2
184+
) {
185+
DYNAMICTEXT txtVal (Content: '{1}', Attribute: Value)
186+
}
187+
```
188+
170189
## Input Widgets
171190

172191
All input widgets share common properties:

docs-site/src/reference/page/create-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The widget tree inside `{ ... }` defines the page content. Widgets are nested hi
6060
| `DATAVIEW` | Displays/edits a single object | `DataSource` |
6161
| `LISTVIEW` | Renders a list of objects | `DataSource`, `PageSize` |
6262
| `DATAGRID` | Tabular data display with columns | `DataSource`, `PageSize`, `Pagination` |
63-
| `GALLERY` | Card-based list display | `DataSource`, `PageSize` |
63+
| `GALLERY` | Card-based list display | `DataSource`, `DesktopColumns`, `TabletColumns`, `PhoneColumns` |
6464

6565
**Input Widgets**
6666

docs/06-mdl-reference/grammar-reference.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4110,9 +4110,20 @@ galleryWidget
41104110
: GALLERY qualifiedName? widgetOptions?
41114111
| gallerySource?
41124112
| (SELECTION (SINGLE | MULTIPLE))?
4113+
| (DESKTOPCOLUMNS NUMBER)?
4114+
| (TABLETCOLUMNS NUMBER)?
4115+
| (PHONECOLUMNS NUMBER)?
41134116
| (BEGIN galleryContent END)?
41144117
```
41154118
4119+
**Responsive column properties:**
4120+
4121+
| Property | Description | Default |
4122+
|----------|-------------|---------|
4123+
| `DesktopColumns` | Grid columns on desktop | `1` |
4124+
| `TabletColumns` | Grid columns on tablet | `1` |
4125+
| `PhoneColumns` | Grid columns on phone | `1` |
4126+
41164127
**Railroad Diagram:**
41174128
41184129
```mermaid

mdl-examples/doctype-tests/03-page-examples.mdl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,35 @@ CREATE PAGE PgTest.P023_Gallery_MultiSelect
14581458
}
14591459

14601460

1461+
/**
1462+
* Gallery with responsive column properties.
1463+
* DesktopColumns, TabletColumns, PhoneColumns control the grid layout per breakpoint.
1464+
*/
1465+
CREATE PAGE PgTest.P024_Gallery_Columns
1466+
(
1467+
Title: 'Gallery with Columns',
1468+
Layout: Atlas_Core.Atlas_Default,
1469+
Url: 'p024_gallery_columns'
1470+
)
1471+
{
1472+
LAYOUTGRID mainGrid {
1473+
ROW row1 {
1474+
COLUMN col1 (DesktopWidth: 12) {
1475+
GALLERY cellGrid (
1476+
DataSource: DATABASE PgTest.Product,
1477+
DesktopColumns: 4,
1478+
TabletColumns: 2,
1479+
PhoneColumns: 1
1480+
) {
1481+
TEMPLATE template1 {
1482+
DYNAMICTEXT prodName (Content: '{1}', ContentParams: [{1} = Name], RenderMode: H4)
1483+
}
1484+
}
1485+
}
1486+
}
1487+
}
1488+
}
1489+
14611490
-- MARK: Microflow Actions with Parameters
14621491

14631492
-- ============================================================================

mdl/executor/cmd_pages_describe.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ type rawWidget struct {
517517
Pagination string // "buttons", "virtualScrolling", "loadMore"
518518
PagingPosition string // "bottom", "top", "both"
519519
ShowPagingButtons string // "always", "auto"
520+
// Gallery column properties
521+
DesktopColumns string // e.g. "9", "4"
522+
TabletColumns string // e.g. "4", "2"
523+
PhoneColumns string // e.g. "2", "1"
520524
// ComboBox association mode properties
521525
CaptionAttribute string // Display attribute for association-mode ComboBox
522526
// GroupBox properties

0 commit comments

Comments
 (0)