pict-section-form 1.0.197 → 1.0.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,6 +85,23 @@ Groups organize inputs within a section.
85
85
  | `CSSClasses` | array | No | CSS classes to apply |
86
86
  | `Visible` | boolean | No | Initial visibility (default: true) |
87
87
 
88
+ #### Tabular Group Properties
89
+
90
+ These additional properties apply only to groups with `Layout: "Tabular"`.
91
+ See [Layouts](Layouts.md) for full details and examples.
92
+
93
+ | Property | Type | Description |
94
+ |----------|------|-------------|
95
+ | `RecordManifest` | string | Reference manifest naming the columns |
96
+ | `Headers` | array | Extra stacked / clustered header rows above the prime header |
97
+ | `RowLabels` | array | Left-side label columns (template / row-number / pre-slotted; clusterable) |
98
+ | `DynamicColumns` | array | Generators that build columns at runtime from another array |
99
+ | `EditingControlsPosition` | string | `"right"` (default), `"left"`, or `"hidden"` |
100
+ | `SuppressDefaultColumnHeaderRow` | boolean | Omit the prime column-name header row |
101
+ | `RowSelection` | boolean/object | Add row checkboxes; selection persists in form data |
102
+ | `ColumnSelection` | boolean/object | Add column checkboxes; selection persists in form data |
103
+ | `ColumnSorting` | boolean | Add clickable sort controls to the prime header cells (default off) |
104
+
88
105
  ### Layout Types
89
106
 
90
107
  - `Record` - Standard form layout with rows and columns
package/docs/Layouts.md CHANGED
@@ -160,6 +160,176 @@ TabularTemplate-RowPostfix
160
160
  TabularTemplate-TablePostfix
161
161
  ```
162
162
 
163
+ ### Stacked & Clustered Headers
164
+
165
+ By default a tabular group has a single header row, one cell per column. The
166
+ optional `Headers` property adds **extra header rows stacked above** that
167
+ default ("prime") row. Each entry in `Headers` is one header row; each row is
168
+ an array of cells.
169
+
170
+ | Cell property | Type | Description |
171
+ |---------------|------|-------------|
172
+ | `Label` | string | Header text |
173
+ | `ColumnSpan` | number | Number of data columns this cell spans (default 1) — this is how you "cluster" |
174
+ | `CSSClass` | string | Optional class applied to the `<th>` |
175
+
176
+ ```json
177
+ {
178
+ "Hash": "GradebookGrid",
179
+ "Layout": "Tabular",
180
+ "RecordSetAddress": "Grades",
181
+ "RecordManifest": "GradeRowEditor",
182
+ "Headers": [
183
+ [
184
+ { "Label": "First Semester", "ColumnSpan": 3, "CSSClass": "term-banner" },
185
+ { "Label": "Second Semester", "ColumnSpan": 4, "CSSClass": "term-banner" }
186
+ ]
187
+ ]
188
+ }
189
+ ```
190
+
191
+ Each header row's `ColumnSpan` total should equal the number of data columns;
192
+ a mismatch is logged as a warning and the header will visually misalign.
193
+ Header rows render top-to-bottom in array order, directly above the prime
194
+ column-name row.
195
+
196
+ ### Row Label Columns
197
+
198
+ The `RowLabels` property adds one or more **label columns down the left side**
199
+ of the table (before the data columns). Each entry describes one label column.
200
+
201
+ | Property | Type | Description |
202
+ |----------|------|-------------|
203
+ | `Name` | string | Header text for the label column |
204
+ | `Template` | string | A Pict template resolved per row — the row record is at `Record.Value`, the row index at `Record.Key` |
205
+ | `RowNumber` | boolean | When `true`, the label is the 1-based row number |
206
+ | `SourceAddress` | string | An app-data address of a pre-slotted array; element `[rowIndex]` is the label |
207
+ | `Cluster` | boolean | When `true`, consecutive equal labels collapse into one cell with `rowspan` |
208
+ | `CSSClass` | string | Optional class applied to the label `<td>` |
209
+
210
+ Provide exactly one of `Template`, `RowNumber`, or `SourceAddress` per entry.
211
+
212
+ ```json
213
+ "RowLabels": [
214
+ { "Name": "Section", "Template": "{~D:Record.Value.Section~}", "Cluster": true },
215
+ { "Name": "Student", "Template": "{~D:Record.Value.StudentName~}" },
216
+ { "Name": "#", "RowNumber": true }
217
+ ]
218
+ ```
219
+
220
+ `Cluster: true` is what produces the "merged cell" look — a column of repeated
221
+ values (e.g. a class section) renders as a single tall cell spanning its run
222
+ of rows. Any label column may be clustered; there is no "prime" label column.
223
+
224
+ ### Dynamic Columns
225
+
226
+ `DynamicColumns` generates table columns at runtime from **another array** in
227
+ the form data — for example, one grade column per assignment. Each entry is a
228
+ generator:
229
+
230
+ | Property | Type | Description |
231
+ |----------|------|-------------|
232
+ | `SourceAddress` | string | App-data address of the array driving the columns |
233
+ | `HashTemplate` | string | Template producing each column's unique descriptor hash |
234
+ | `NameTemplate` | string | Template producing each column's header text |
235
+ | `InformaryDataAddressTemplate` | string | Template producing the per-row data address the cell binds to |
236
+ | `HeaderGroupTemplate` | string | Optional — template producing a cluster label; auto-adds a clustered super-header row |
237
+ | `DataType` | string | Data type for the generated descriptors |
238
+ | `PictForm` | object | `PictForm` block merged onto each generated descriptor (e.g. `InputType`) |
239
+ | `InsertAt` | string/object | `"End"` (default), `"Start"`, or `{ "After": "<hash>" }` |
240
+
241
+ Inside each template the **source row** is the record (`Record.Field`).
242
+
243
+ ```json
244
+ "DynamicColumns": [
245
+ {
246
+ "SourceAddress": "Assignments",
247
+ "HashTemplate": "Grade_{~D:Record.IDAssignment~}",
248
+ "NameTemplate": "{~D:Record.Title~}",
249
+ "InformaryDataAddressTemplate": "Grades.{~D:Record.IDAssignment~}",
250
+ "HeaderGroupTemplate": "{~D:Record.Topic~}",
251
+ "DataType": "Number",
252
+ "PictForm": { "InputType": "Number" }
253
+ }
254
+ ]
255
+ ```
256
+
257
+ Dynamic columns are **non-destructive**: when a source row is removed the
258
+ generated column disappears, but the underlying row data at the
259
+ `InformaryDataAddress` is left untouched — re-adding the source row brings the
260
+ column back with its data intact. The columns re-resolve automatically as the
261
+ source array changes; no manual refresh call is needed.
262
+
263
+ When `HeaderGroupTemplate` is set, an extra clustered super-header row is
264
+ synthesized automatically: consecutive generated columns sharing the same
265
+ header-group value merge into one spanning cell (e.g. assignments clustered by
266
+ topic).
267
+
268
+ ### Editing Controls Position
269
+
270
+ Tabular rows render del / up / down controls. `EditingControlsPosition`
271
+ controls where:
272
+
273
+ | Value | Behavior |
274
+ |-------|----------|
275
+ | `"right"` | Default — controls in a trailing column |
276
+ | `"left"` | Controls in a leading column, before the data columns |
277
+ | `"hidden"` | No editing controls (read-only style table) |
278
+
279
+ ```json
280
+ { "Layout": "Tabular", "EditingControlsPosition": "hidden" }
281
+ ```
282
+
283
+ ### Suppressing the Default Header Row
284
+
285
+ Set `SuppressDefaultColumnHeaderRow: true` to omit the prime column-name row
286
+ entirely — useful when custom `Headers` rows fully describe the columns.
287
+
288
+ ### Selectable Rows & Columns
289
+
290
+ `RowSelection` and `ColumnSelection` add checkboxes that let the user pick
291
+ rows / columns. The selected state is **stored in the form data**, so it
292
+ persists with a save and can be read by solvers.
293
+
294
+ Set either to `true` for defaults, or to an object:
295
+
296
+ | Property | Type | Description |
297
+ |----------|------|-------------|
298
+ | `Enabled` | boolean | Set `false` to disable (same as omitting) |
299
+ | `DataAddress` | string | Where the boolean selection array is stored (default `<GroupHash>_RowSelection` / `_ColumnSelection`) |
300
+ | `HighlightClass` | string | Class auto-applied to selected rows/columns; set to `""` for solver-driven highlighting only |
301
+ | `HeaderLabel` | string | Header text for the row-selection column |
302
+
303
+ ```json
304
+ {
305
+ "Layout": "Tabular",
306
+ "RecordSetAddress": "Grades",
307
+ "RowSelection": true,
308
+ "ColumnSelection": true
309
+ }
310
+ ```
311
+
312
+ Checking a row (or column) highlights every cell across (or down) it and
313
+ writes `true` into the selection array at the configured address. Because the
314
+ array lives in the marshalled form data it round-trips with save / load.
315
+
316
+ ### Column Sorting
317
+
318
+ `ColumnSorting: true` (off by default) injects a clickable sort control — a
319
+ `<span>` carrying a sort SVG glyph from Pict's icon registry — into every
320
+ prime header cell.
321
+
322
+ ```json
323
+ { "Layout": "Tabular", "RecordSetAddress": "Students", "ColumnSorting": true }
324
+ ```
325
+
326
+ Clicking a column's control sorts the record set ascending; clicking the
327
+ active column again toggles to descending. The glyph reflects state: a neutral
328
+ double-arrow on idle columns, an up / down arrow on the active column. Sorting
329
+ works for both static and dynamic columns (dynamic columns sort by their
330
+ `InformaryDataAddress` value). Values that parse as numbers sort numerically;
331
+ others sort lexically.
332
+
163
333
  ## RecordSet Layout
164
334
 
165
335
  Similar to tabular but renders each record as a full form section rather
package/docs/README.md CHANGED
@@ -77,7 +77,7 @@ npm install pict-section-form
77
77
 
78
78
  - [simple_form](examples/simple_form/) - Basic form with solvers and visibility control
79
79
  - [simple_table](examples/simple_table/) - Minimal tabular layout example
80
- - [gradebook](examples/gradebook/) - Multi-table app with localStorage
80
+ - [gradebook](examples/gradebook/) - Advanced tabular recordsets: stacked headers, row labels, dynamic columns, selection, sorting
81
81
  - [complex_table](examples/complex_table/) - Full-featured with charts and entity bundles
82
82
 
83
83
  ## Related Packages
package/docs/Solvers.md CHANGED
@@ -211,6 +211,40 @@ aggregate values from arrays:
211
211
  ]
212
212
  ```
213
213
 
214
+ ### Tabular Row & Column Styling
215
+
216
+ These functions style a whole row or whole column of a tabular group — every
217
+ cell across or down. The highlight pair toggles a CSS class on a `1` / `0`
218
+ flag; the color pair sets (`1`) or clears (`0`) an inline background color.
219
+ None of them touch form data — they are purely presentational and re-applied
220
+ on each solve.
221
+
222
+ | Function | Description |
223
+ |----------|-------------|
224
+ | `HighlightTabularRow(sectionHash, groupHash, rowIndex, flag)` | Add (`1`) / remove (`0`) the `pict-tabular-row-highlight` class on every cell of a row |
225
+ | `HighlightTabularColumn(sectionHash, groupHash, columnIndex, flag)` | Add (`1`) / remove (`0`) the `pict-tabular-column-highlight` class on every cell of a column |
226
+ | `ColorTabularRow(sectionHash, groupHash, rowIndex, color, flag)` | Set (`1`) / clear (`0`) the background color on every cell of a row |
227
+ | `ColorTabularColumn(sectionHash, groupHash, columnIndex, color, flag)` | Set (`1`) / clear (`0`) the background color on every cell of a column |
228
+
229
+ `rowIndex` is the zero-based row. `columnIndex` is the column's input index
230
+ (its position among the group's descriptors). The highlight classes are
231
+ defined by pict-section-form; their tint follows the
232
+ `--pict-tabular-highlight-color` CSS custom property.
233
+
234
+ #### Tabular Styling Examples
235
+
236
+ ```json
237
+ "Solvers": [
238
+ "ColorTabularRow('Performance', 'PerformanceGrid', 0, IF(getSectionTabularFormData('Performance', 'PerformanceGrid', 0, 'Average'), '>=', 85, '#BFE3BF', '#EBB8B8'), 1)",
239
+ "HighlightTabularColumn('Gradebook', 'GradebookGrid', 4, 1)"
240
+ ]
241
+ ```
242
+
243
+ These pair naturally with the `RowSelection` / `ColumnSelection` tabular
244
+ options (see [Layouts](Layouts.md)): the selection state is stored in the form
245
+ data, and a solver can read it and call the highlight/color functions to drive
246
+ presentation.
247
+
214
248
  ### Solver Control Functions
215
249
 
216
250
  | Function | Description |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "Name": "pict-section-form",
3
- "Version": "1.0.197",
3
+ "Version": "1.0.198",
4
4
  "Description": "Pict dynamic form sections",
5
- "GeneratedAt": "2026-05-21T02:52:57.836Z",
6
- "GitCommit": "29398f7"
5
+ "GeneratedAt": "2026-05-22T01:39:07.526Z",
6
+ "GitCommit": "6af8e90"
7
7
  }
@@ -11,7 +11,7 @@ and patterns.
11
11
  | [simple_form](simple_form/) | Basic | Calculated fields, visibility control, solvers |
12
12
  | [simple_table](simple_table/) | Basic | Tabular layout, nested data, reference manifests |
13
13
  | [simple_distill](simple_distill/) | Intermediate | Entity bundles, trigger groups, templated inputs |
14
- | [gradebook](gradebook/) | Intermediate | Multiple tables, localStorage persistence |
14
+ | [gradebook](gradebook/) | Intermediate | Stacked headers, row labels, dynamic columns, selection, sorting |
15
15
  | [postcard_example](postcard_example/) | Intermediate | Theme switching, navigation, custom providers |
16
16
  | [complex_table](complex_table/) | Advanced | Charts, row solvers, entity requests, pick lists |
17
17
  | [complex_tuigrid](complex_tuigrid/) | Advanced | TuiGrid, aggregations, DateTime inputs |
@@ -26,7 +26,8 @@ and patterns.
26
26
  manifests
27
27
 
28
28
  ### Intermediate Patterns
29
- 3. **[gradebook](gradebook/)** - Multiple tables with localStorage persistence
29
+ 3. **[gradebook](gradebook/)** - Advanced tabular recordsets: stacked headers,
30
+ row labels, dynamic columns, selection, sorting, and styling solvers
30
31
  4. **[postcard_example](postcard_example/)** - Theme system and navigation patterns
31
32
  5. **[simple_distill](simple_distill/)** - Entity relationships and trigger groups
32
33
 
@@ -97,14 +98,19 @@ node ServeExamples.js
97
98
  | Basic Inputs | [x] | [x] | [x] | [x] | [x] | [x] | [x] | [x] |
98
99
  | Tabular Layout | | [x] | | [x] | | [x] | | [x] |
99
100
  | TuiGrid | | | | | | | [x] | [x] |
100
- | Solvers | [x] | | [x] | | | [x] | [x] | |
101
- | Row Solvers | | | | | | [x] | [x] | |
101
+ | Solvers | [x] | | [x] | [x] | | [x] | [x] | |
102
+ | Row Solvers | | | | [x] | | [x] | [x] | |
102
103
  | Pick Lists | | | [x] | | | [x] | [x] | |
103
104
  | Entity Bundles | | | [x] | | | [x] | | |
104
105
  | Trigger Groups | | | [x] | | | [x] | | |
105
- | localStorage | | | | [x] | | | | [x] |
106
+ | localStorage | | | | | | | | [x] |
106
107
  | Custom Themes | | | | | [x] | | | |
107
- | Navigation | | | | | [x] | | | [x] |
108
+ | Navigation | | | | [x] | [x] | | | [x] |
108
109
  | Charts | | | | | | [x] | | |
109
110
  | DateTime | | | | | | [x] | [x] | |
110
111
  | JSON Editor | | | | | | | | [x] |
112
+ | Stacked Headers | | | | [x] | | | | |
113
+ | Row Labels | | | | [x] | | | | |
114
+ | Dynamic Columns | | | | [x] | | | | |
115
+ | Row/Column Selection | | | | [x] | | | | |
116
+ | Column Sorting | | | | [x] | | | | |