@elaraai/east-ui 1.0.80 → 1.0.82
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.
- package/dist/src/charts/chart/index.d.ts +4 -0
- package/dist/src/charts/chart/index.d.ts.map +1 -1
- package/dist/src/charts/spec/index.d.ts +8 -0
- package/dist/src/charts/spec/index.d.ts.map +1 -1
- package/dist/src/collections/deck/index.d.ts +8 -0
- package/dist/src/collections/deck/index.d.ts.map +1 -1
- package/dist/src/collections/index.d.ts +2 -2
- package/dist/src/collections/index.d.ts.map +1 -1
- package/dist/src/collections/index.js.map +1 -1
- package/dist/src/collections/library/index.d.ts +4 -0
- package/dist/src/collections/library/index.d.ts.map +1 -1
- package/dist/src/collections/library/types.d.ts +4 -0
- package/dist/src/collections/library/types.d.ts.map +1 -1
- package/dist/src/collections/matrix/index.d.ts +56 -19
- package/dist/src/collections/matrix/index.d.ts.map +1 -1
- package/dist/src/collections/matrix/index.js +38 -24
- package/dist/src/collections/matrix/index.js.map +1 -1
- package/dist/src/collections/plan/assemble.d.ts +655 -2113
- package/dist/src/collections/plan/assemble.d.ts.map +1 -1
- package/dist/src/collections/plan/assemble.js +159 -136
- package/dist/src/collections/plan/assemble.js.map +1 -1
- package/dist/src/collections/plan/builders.d.ts +193 -40
- package/dist/src/collections/plan/builders.d.ts.map +1 -1
- package/dist/src/collections/plan/builders.js +162 -32
- package/dist/src/collections/plan/builders.js.map +1 -1
- package/dist/src/collections/plan/factories.d.ts +290 -116
- package/dist/src/collections/plan/factories.d.ts.map +1 -1
- package/dist/src/collections/plan/factories.js +281 -156
- package/dist/src/collections/plan/factories.js.map +1 -1
- package/dist/src/collections/plan/index.d.ts +111 -58
- package/dist/src/collections/plan/index.d.ts.map +1 -1
- package/dist/src/collections/plan/index.js +62 -31
- package/dist/src/collections/plan/index.js.map +1 -1
- package/dist/src/collections/plan/ir.d.ts +759 -1769
- package/dist/src/collections/plan/ir.d.ts.map +1 -1
- package/dist/src/collections/plan/ir.js +51 -27
- package/dist/src/collections/plan/ir.js.map +1 -1
- package/dist/src/collections/plan/pick.d.ts +89 -71
- package/dist/src/collections/plan/pick.d.ts.map +1 -1
- package/dist/src/collections/plan/pick.js +101 -86
- package/dist/src/collections/plan/pick.js.map +1 -1
- package/dist/src/collections/plan/root.d.ts +164 -77
- package/dist/src/collections/plan/root.d.ts.map +1 -1
- package/dist/src/collections/plan/root.js +350 -42
- package/dist/src/collections/plan/root.js.map +1 -1
- package/dist/src/collections/plan/series.d.ts +12524 -10527
- package/dist/src/collections/plan/series.d.ts.map +1 -1
- package/dist/src/collections/plan/series.js +1596 -298
- package/dist/src/collections/plan/series.js.map +1 -1
- package/dist/src/collections/plan/types.d.ts +6115 -2802
- package/dist/src/collections/plan/types.d.ts.map +1 -1
- package/dist/src/collections/plan/types.js +575 -170
- package/dist/src/collections/plan/types.js.map +1 -1
- package/dist/src/collections/sheet/bridge.d.ts +154 -43
- package/dist/src/collections/sheet/bridge.d.ts.map +1 -1
- package/dist/src/collections/sheet/bridge.js +383 -240
- package/dist/src/collections/sheet/bridge.js.map +1 -1
- package/dist/src/collections/sheet/columns.d.ts +66 -16
- package/dist/src/collections/sheet/columns.d.ts.map +1 -1
- package/dist/src/collections/sheet/columns.js +25 -25
- package/dist/src/collections/sheet/columns.js.map +1 -1
- package/dist/src/collections/sheet/context-bridge.d.ts +48 -0
- package/dist/src/collections/sheet/context-bridge.d.ts.map +1 -0
- package/dist/src/collections/sheet/context-bridge.js +216 -0
- package/dist/src/collections/sheet/context-bridge.js.map +1 -0
- package/dist/src/collections/sheet/draft-bridge.d.ts +37 -0
- package/dist/src/collections/sheet/draft-bridge.d.ts.map +1 -0
- package/dist/src/collections/sheet/draft-bridge.js +153 -0
- package/dist/src/collections/sheet/draft-bridge.js.map +1 -0
- package/dist/src/collections/sheet/drafts.d.ts +14 -0
- package/dist/src/collections/sheet/drafts.d.ts.map +1 -0
- package/dist/src/collections/sheet/drafts.js +14 -0
- package/dist/src/collections/sheet/drafts.js.map +1 -0
- package/dist/src/collections/sheet/editing-bridge.d.ts +36 -0
- package/dist/src/collections/sheet/editing-bridge.d.ts.map +1 -0
- package/dist/src/collections/sheet/editing-bridge.js +196 -0
- package/dist/src/collections/sheet/editing-bridge.js.map +1 -0
- package/dist/src/collections/sheet/editing-types.d.ts +268 -0
- package/dist/src/collections/sheet/editing-types.d.ts.map +1 -0
- package/dist/src/collections/sheet/editing-types.js +34 -0
- package/dist/src/collections/sheet/editing-types.js.map +1 -0
- package/dist/src/collections/sheet/edits.d.ts +37 -0
- package/dist/src/collections/sheet/edits.d.ts.map +1 -0
- package/dist/src/collections/sheet/edits.js +31 -0
- package/dist/src/collections/sheet/edits.js.map +1 -0
- package/dist/src/collections/sheet/group.d.ts +165 -0
- package/dist/src/collections/sheet/group.d.ts.map +1 -0
- package/dist/src/collections/sheet/group.js +52 -0
- package/dist/src/collections/sheet/group.js.map +1 -0
- package/dist/src/collections/sheet/index.d.ts +171 -27
- package/dist/src/collections/sheet/index.d.ts.map +1 -1
- package/dist/src/collections/sheet/index.js +99 -17
- package/dist/src/collections/sheet/index.js.map +1 -1
- package/dist/src/collections/sheet/link.d.ts +22 -16
- package/dist/src/collections/sheet/link.d.ts.map +1 -1
- package/dist/src/collections/sheet/link.js +18 -12
- package/dist/src/collections/sheet/link.js.map +1 -1
- package/dist/src/collections/sheet/registers.d.ts +152 -5
- package/dist/src/collections/sheet/registers.d.ts.map +1 -1
- package/dist/src/collections/sheet/registers.js +154 -5
- package/dist/src/collections/sheet/registers.js.map +1 -1
- package/dist/src/collections/sheet/root.d.ts +175 -26
- package/dist/src/collections/sheet/root.d.ts.map +1 -1
- package/dist/src/collections/sheet/root.js +150 -26
- package/dist/src/collections/sheet/root.js.map +1 -1
- package/dist/src/collections/sheet/seed-bridge.d.ts +14 -0
- package/dist/src/collections/sheet/seed-bridge.d.ts.map +1 -0
- package/dist/src/collections/sheet/seed-bridge.js +51 -0
- package/dist/src/collections/sheet/seed-bridge.js.map +1 -0
- package/dist/src/collections/sheet/sub-rows.d.ts +249 -0
- package/dist/src/collections/sheet/sub-rows.d.ts.map +1 -0
- package/dist/src/collections/sheet/sub-rows.js +222 -0
- package/dist/src/collections/sheet/sub-rows.js.map +1 -0
- package/dist/src/collections/sheet/transactions.d.ts +76 -0
- package/dist/src/collections/sheet/transactions.d.ts.map +1 -0
- package/dist/src/collections/sheet/transactions.js +40 -0
- package/dist/src/collections/sheet/transactions.js.map +1 -0
- package/dist/src/collections/sheet/types.d.ts +12034 -3651
- package/dist/src/collections/sheet/types.d.ts.map +1 -1
- package/dist/src/collections/sheet/types.js +365 -48
- package/dist/src/collections/sheet/types.js.map +1 -1
- package/dist/src/collections/table/index.d.ts +98 -123
- package/dist/src/collections/table/index.d.ts.map +1 -1
- package/dist/src/collections/table/index.js +97 -111
- package/dist/src/collections/table/index.js.map +1 -1
- package/dist/src/collections/table/types.d.ts +87 -31
- package/dist/src/collections/table/types.d.ts.map +1 -1
- package/dist/src/collections/table/types.js +51 -26
- package/dist/src/collections/table/types.js.map +1 -1
- package/dist/src/collections/value-tree/flatten.d.ts.map +1 -1
- package/dist/src/collections/value-tree/flatten.js +4 -1
- package/dist/src/collections/value-tree/flatten.js.map +1 -1
- package/dist/src/component.d.ts +5075 -4079
- package/dist/src/component.d.ts.map +1 -1
- package/dist/src/component.js +46 -46
- package/dist/src/component.js.map +1 -1
- package/dist/src/contracts/approval.d.ts +10 -8
- package/dist/src/contracts/approval.d.ts.map +1 -1
- package/dist/src/contracts/approval.js +10 -8
- package/dist/src/contracts/approval.js.map +1 -1
- package/dist/src/contracts/drag.d.ts +11 -9
- package/dist/src/contracts/drag.d.ts.map +1 -1
- package/dist/src/contracts/drag.js +28 -21
- package/dist/src/contracts/drag.js.map +1 -1
- package/dist/src/contracts/editing.d.ts +1283 -0
- package/dist/src/contracts/editing.d.ts.map +1 -0
- package/dist/src/contracts/editing.js +711 -0
- package/dist/src/contracts/editing.js.map +1 -0
- package/dist/src/contracts/index.d.ts +2 -1
- package/dist/src/contracts/index.d.ts.map +1 -1
- package/dist/src/contracts/index.js +2 -1
- package/dist/src/contracts/index.js.map +1 -1
- package/dist/src/contracts/pick.d.ts +6 -7
- package/dist/src/contracts/pick.d.ts.map +1 -1
- package/dist/src/contracts/pick.js +6 -7
- package/dist/src/contracts/pick.js.map +1 -1
- package/dist/src/contracts/review.d.ts +3 -1
- package/dist/src/contracts/review.d.ts.map +1 -1
- package/dist/src/contracts/review.js +3 -1
- package/dist/src/contracts/review.js.map +1 -1
- package/dist/src/contracts/source.d.ts +270 -80
- package/dist/src/contracts/source.d.ts.map +1 -1
- package/dist/src/contracts/source.js +357 -58
- package/dist/src/contracts/source.js.map +1 -1
- package/dist/src/display/chip-rail/index.d.ts.map +1 -1
- package/dist/src/display/chip-rail/index.js +10 -10
- package/dist/src/display/chip-rail/index.js.map +1 -1
- package/dist/src/extension.d.ts +2 -1
- package/dist/src/extension.d.ts.map +1 -1
- package/dist/src/extension.js +2 -1
- package/dist/src/extension.js.map +1 -1
- package/dist/src/format/index.d.ts +1 -154
- package/dist/src/format/index.d.ts.map +1 -1
- package/dist/src/format/types.d.ts +35 -23
- package/dist/src/format/types.d.ts.map +1 -1
- package/dist/src/format/types.js +16 -14
- package/dist/src/format/types.js.map +1 -1
- package/dist/src/forms/field/index.js +4 -4
- package/dist/src/forms/field/index.js.map +1 -1
- package/dist/src/forms/file-upload/index.js +16 -16
- package/dist/src/forms/file-upload/index.js.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +8 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +11 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/layout/box/index.d.ts.map +1 -1
- package/dist/src/layout/box/index.js +47 -47
- package/dist/src/layout/box/index.js.map +1 -1
- package/dist/src/layout/flex/index.d.ts.map +1 -1
- package/dist/src/layout/flex/index.js +47 -47
- package/dist/src/layout/flex/index.js.map +1 -1
- package/dist/src/layout/grid/index.js +11 -11
- package/dist/src/layout/grid/index.js.map +1 -1
- package/dist/src/layout/scroll-area/index.d.ts.map +1 -1
- package/dist/src/layout/scroll-area/index.js +8 -8
- package/dist/src/layout/scroll-area/index.js.map +1 -1
- package/dist/src/layout/separator/index.d.ts.map +1 -1
- package/dist/src/layout/separator/index.js +6 -6
- package/dist/src/layout/separator/index.js.map +1 -1
- package/dist/src/layout/stack/index.d.ts.map +1 -1
- package/dist/src/layout/stack/index.js +46 -46
- package/dist/src/layout/stack/index.js.map +1 -1
- package/dist/src/layout/sticky/index.d.ts.map +1 -1
- package/dist/src/layout/sticky/index.js +8 -8
- package/dist/src/layout/sticky/index.js.map +1 -1
- package/dist/src/overlays/action-bar/index.d.ts.map +1 -1
- package/dist/src/overlays/action-bar/index.js +8 -8
- package/dist/src/overlays/action-bar/index.js.map +1 -1
- package/dist/src/platform/index.d.ts +1 -1
- package/dist/src/platform/index.d.ts.map +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/platform/index.js.map +1 -1
- package/dist/src/platform/slice/impl.d.ts +62 -51
- package/dist/src/platform/slice/impl.d.ts.map +1 -1
- package/dist/src/platform/slice/impl.js +155 -72
- package/dist/src/platform/slice/impl.js.map +1 -1
- package/dist/src/platform/slice/index.d.ts +3744 -2226
- package/dist/src/platform/slice/index.d.ts.map +1 -1
- package/dist/src/platform/slice/index.js +43 -1
- package/dist/src/platform/slice/index.js.map +1 -1
- package/dist/src/runtime/collections/deck.d.ts +4 -0
- package/dist/src/runtime/collections/deck.d.ts.map +1 -1
- package/dist/src/runtime/collections/matrix.d.ts +10 -9
- package/dist/src/runtime/collections/matrix.d.ts.map +1 -1
- package/dist/src/runtime/collections/matrix.js +11 -6
- package/dist/src/runtime/collections/matrix.js.map +1 -1
- package/dist/src/runtime/collections/plan.d.ts +148 -65
- package/dist/src/runtime/collections/plan.d.ts.map +1 -1
- package/dist/src/runtime/collections/plan.js +155 -67
- package/dist/src/runtime/collections/plan.js.map +1 -1
- package/dist/src/runtime/collections/sheet.d.ts +56 -23
- package/dist/src/runtime/collections/sheet.d.ts.map +1 -1
- package/dist/src/runtime/collections/sheet.js +30 -22
- package/dist/src/runtime/collections/sheet.js.map +1 -1
- package/dist/src/runtime/collections/table.d.ts +18 -11
- package/dist/src/runtime/collections/table.d.ts.map +1 -1
- package/dist/src/runtime/collections/table.js +7 -4
- package/dist/src/runtime/collections/table.js.map +1 -1
- package/dist/src/shared/reify.d.ts +4 -46
- package/dist/src/shared/reify.d.ts.map +1 -1
- package/dist/src/shared/reify.js +4 -61
- package/dist/src/shared/reify.js.map +1 -1
- package/dist/src/shared/tree.d.ts +88 -0
- package/dist/src/shared/tree.d.ts.map +1 -0
- package/dist/src/shared/tree.js +134 -0
- package/dist/src/shared/tree.js.map +1 -0
- package/dist/src/slice/breakdown/index.d.ts +4 -0
- package/dist/src/slice/breakdown/index.d.ts.map +1 -1
- package/dist/src/slice/breakdown/types.d.ts +4 -0
- package/dist/src/slice/breakdown/types.d.ts.map +1 -1
- package/dist/src/slice/cohort/index.d.ts +24 -4
- package/dist/src/slice/cohort/index.d.ts.map +1 -1
- package/dist/src/slice/cohort/index.js +8 -4
- package/dist/src/slice/cohort/index.js.map +1 -1
- package/dist/src/slice/cohort/types.d.ts +11 -0
- package/dist/src/slice/cohort/types.d.ts.map +1 -1
- package/dist/src/slice/cohort/types.js +7 -0
- package/dist/src/slice/cohort/types.js.map +1 -1
- package/dist/src/slice/filter/index.d.ts +4 -0
- package/dist/src/slice/filter/index.d.ts.map +1 -1
- package/dist/src/slice/filter/types.d.ts +4 -0
- package/dist/src/slice/filter/types.d.ts.map +1 -1
- package/dist/src/slice/index.d.ts +736 -0
- package/dist/src/slice/index.d.ts.map +1 -1
- package/dist/src/slice/legend/index.d.ts +4 -0
- package/dist/src/slice/legend/index.d.ts.map +1 -1
- package/dist/src/slice/legend/types.d.ts +4 -0
- package/dist/src/slice/legend/types.d.ts.map +1 -1
- package/dist/src/slice/rail/index.d.ts +8 -4
- package/dist/src/slice/rail/index.d.ts.map +1 -1
- package/dist/src/slice/rail/index.js.map +1 -1
- package/dist/src/slice/range/index.d.ts +4 -0
- package/dist/src/slice/range/index.d.ts.map +1 -1
- package/dist/src/slice/range/types.d.ts +4 -0
- package/dist/src/slice/range/types.d.ts.map +1 -1
- package/dist/src/slice/search/index.d.ts +4 -0
- package/dist/src/slice/search/index.d.ts.map +1 -1
- package/dist/src/slice/search/types.d.ts +4 -0
- package/dist/src/slice/search/types.d.ts.map +1 -1
- package/dist/src/slice/summary/index.d.ts +4 -0
- package/dist/src/slice/summary/index.d.ts.map +1 -1
- package/dist/src/slice/summary/types.d.ts +4 -0
- package/dist/src/slice/summary/types.d.ts.map +1 -1
- package/dist/src/typography/code/index.js +1 -1
- package/dist/src/typography/code/index.js.map +1 -1
- package/dist/src/typography/code-block/index.js +7 -7
- package/dist/src/typography/code-block/index.js.map +1 -1
- package/dist/src/typography/heading/index.js +2 -2
- package/dist/src/typography/heading/index.js.map +1 -1
- package/dist/src/typography/list/index.js +1 -1
- package/dist/src/typography/list/index.js.map +1 -1
- package/dist/src/typography/mark/index.js +1 -1
- package/dist/src/typography/mark/index.js.map +1 -1
- package/dist/src/typography/note/index.js +1 -1
- package/dist/src/typography/note/index.js.map +1 -1
- package/dist/src/typography/numeric/index.d.ts +3 -308
- package/dist/src/typography/numeric/index.d.ts.map +1 -1
- package/dist/src/typography/numeric/index.js +4 -4
- package/dist/src/typography/numeric/index.js.map +1 -1
- package/dist/src/typography/numeric/types.d.ts +1 -154
- package/dist/src/typography/numeric/types.d.ts.map +1 -1
- package/dist/src/typography/text/index.js +1 -1
- package/dist/src/typography/text/index.js.map +1 -1
- package/dist/test/collections/matrix.examples.d.ts +7 -3
- package/dist/test/collections/matrix.examples.d.ts.map +1 -1
- package/dist/test/collections/matrix.examples.js +55 -24
- package/dist/test/collections/matrix.examples.js.map +1 -1
- package/dist/test/collections/paged-source.examples.d.ts +4 -0
- package/dist/test/collections/paged-source.examples.d.ts.map +1 -1
- package/dist/test/collections/paged-source.examples.js +98 -13
- package/dist/test/collections/paged-source.examples.js.map +1 -1
- package/dist/test/collections/plan.examples.d.ts +101 -26
- package/dist/test/collections/plan.examples.d.ts.map +1 -1
- package/dist/test/collections/plan.examples.js +1481 -755
- package/dist/test/collections/plan.examples.js.map +1 -1
- package/dist/test/collections/sheet-link.examples.d.ts +7 -0
- package/dist/test/collections/sheet-link.examples.d.ts.map +1 -0
- package/dist/test/collections/sheet-link.examples.js +41 -0
- package/dist/test/collections/sheet-link.examples.js.map +1 -0
- package/dist/test/collections/sheet-transactions.examples.d.ts +7 -0
- package/dist/test/collections/sheet-transactions.examples.d.ts.map +1 -0
- package/dist/test/collections/sheet-transactions.examples.js +58 -0
- package/dist/test/collections/sheet-transactions.examples.js.map +1 -0
- package/dist/test/collections/sheet.examples.d.ts +52 -5
- package/dist/test/collections/sheet.examples.d.ts.map +1 -1
- package/dist/test/collections/sheet.examples.js +500 -158
- package/dist/test/collections/sheet.examples.js.map +1 -1
- package/dist/test/collections/table.examples.d.ts +31 -3
- package/dist/test/collections/table.examples.d.ts.map +1 -1
- package/dist/test/collections/table.examples.js +188 -28
- package/dist/test/collections/table.examples.js.map +1 -1
- package/dist/test/contracts/editing.examples.d.ts +7 -0
- package/dist/test/contracts/editing.examples.d.ts.map +1 -0
- package/dist/test/contracts/editing.examples.js +58 -0
- package/dist/test/contracts/editing.examples.js.map +1 -0
- package/dist/test/layout/splitter.examples.d.ts.map +1 -1
- package/dist/test/layout/splitter.examples.js +3 -1
- package/dist/test/layout/splitter.examples.js.map +1 -1
- package/dist/test/platform/slice.examples.d.ts.map +1 -1
- package/dist/test/platform/slice.examples.js +1 -0
- package/dist/test/platform/slice.examples.js.map +1 -1
- package/dist/test/slice/slice.examples.d.ts.map +1 -1
- package/dist/test/slice/slice.examples.js +5 -2
- package/dist/test/slice/slice.examples.js.map +1 -1
- package/package.json +4 -3
- package/dist/src/collections/plan/data-forms.d.ts +0 -332
- package/dist/src/collections/plan/data-forms.d.ts.map +0 -1
- package/dist/src/collections/plan/data-forms.js +0 -212
- package/dist/src/collections/plan/data-forms.js.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Sheet.subRows` and `Sheet.subRow` — sub rows (#844,
|
|
7
|
+
* `libs/east-ui/docs/proposals/Sheet Sub Rows - DX Proposal.md`): read-only
|
|
8
|
+
* rows under a line (or a flat row) that share none of the sheet's columns.
|
|
9
|
+
*
|
|
10
|
+
* `Sheet.subRows(R, { field: (item, row) => Sheet.subRow({ … }) })` is keyed
|
|
11
|
+
* like `columns`: each key names an `Array<T>` field of the type the columns
|
|
12
|
+
* are built over, and its mapper turns one element into a sub row. Key order
|
|
13
|
+
* is display order. The builder only CAPTURES; the root compiles each mapper
|
|
14
|
+
* once and the bridge calls it inside the row projection (`bridge.ts`).
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
import { type EastType, type ExprType, type SubtypeExprOrValue, ArrayType, OptionType, StringType, type StructType } from "@elaraai/east";
|
|
19
|
+
import { SheetSubRowType } from "./types.js";
|
|
20
|
+
import type { SheetFieldKey } from "./columns.js";
|
|
21
|
+
/**
|
|
22
|
+
* The keys of a row struct whose field is an `Array` — what a sub-row source
|
|
23
|
+
* may name.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam R - The type the columns are built over
|
|
26
|
+
*/
|
|
27
|
+
export type SheetArrayField<R extends StructType> = {
|
|
28
|
+
[K in SheetFieldKey<R>]: R["fields"][K] extends ArrayType<EastType> ? K : never;
|
|
29
|
+
}[SheetFieldKey<R>];
|
|
30
|
+
/**
|
|
31
|
+
* The element type one of those fields holds — a struct, a variant, a string…
|
|
32
|
+
*
|
|
33
|
+
* @typeParam R - The type the columns are built over
|
|
34
|
+
* @typeParam K - The array field
|
|
35
|
+
*/
|
|
36
|
+
export type SheetElementOf<R extends StructType, K extends SheetArrayField<R>> = R["fields"][K] extends ArrayType<infer T extends EastType> ? T : never;
|
|
37
|
+
/**
|
|
38
|
+
* The sub-row sources — keyed by `R`'s array fields; each value maps one
|
|
39
|
+
* element (and, when it needs it, the row) to a sub row.
|
|
40
|
+
*
|
|
41
|
+
* @typeParam R - The type the columns are built over
|
|
42
|
+
*/
|
|
43
|
+
export type SheetSubRowSources<R extends StructType> = {
|
|
44
|
+
[K in SheetArrayField<R>]?: (item: ExprType<SheetElementOf<R, K>>, row: ExprType<R>) => SubtypeExprOrValue<SheetSubRowType>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* What `Sheet.subRows` returns and the `subRows` prop takes — it captures
|
|
48
|
+
* only, like a group declaration.
|
|
49
|
+
*
|
|
50
|
+
* @typeParam R - The type the columns are built over
|
|
51
|
+
*/
|
|
52
|
+
export interface SheetSubRowsValue<R extends StructType> {
|
|
53
|
+
/** The type the sources were declared over — checked against the columns' at build time. */
|
|
54
|
+
readonly rowType: R;
|
|
55
|
+
/** The sources, in display order. */
|
|
56
|
+
readonly sources: SheetSubRowSources<R>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Declares where a sheet's sub rows come from — `Sheet.subRows(R, { … })`.
|
|
60
|
+
*
|
|
61
|
+
* @typeParam R - The type the columns are built over (a grouped sheet: the line type)
|
|
62
|
+
* @param rowType - The row type value
|
|
63
|
+
* @param sources - Array field → mapper to a sub row, in display order
|
|
64
|
+
* @returns The declaration the `subRows` prop takes
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* // .tsx file with the `@jsxImportSource @elaraai/east-ui` pragma
|
|
69
|
+
* import { ArrayType, East, FloatType, IntegerType, OptionType, StringType, StructType, VariantType, none, some, variant } from "@elaraai/east";
|
|
70
|
+
* import { Reactive, Sheet, State, UIComponentType } from "@elaraai/east-ui";
|
|
71
|
+
*
|
|
72
|
+
* const sheet = East.function([], UIComponentType, (_$) => (
|
|
73
|
+
* <Reactive>{$ => {
|
|
74
|
+
* const OperationType = StructType({
|
|
75
|
+
* id: StringType, code: StringType, name: StringType, materials: ArrayType(StringType),
|
|
76
|
+
* station: OptionType(StringType), by: OptionType(StringType),
|
|
77
|
+
* });
|
|
78
|
+
* const BookingType = VariantType({
|
|
79
|
+
* space: StructType({ area: StringType, units: IntegerType }),
|
|
80
|
+
* labour: StructType({ team: StringType, people: IntegerType, hours: FloatType }),
|
|
81
|
+
* equipment: StructType({ resource: StringType }),
|
|
82
|
+
* });
|
|
83
|
+
* const JobType = StructType({
|
|
84
|
+
* task: StringType, qty: OptionType(FloatType), notes: StringType,
|
|
85
|
+
* operations: ArrayType(OperationType), // no column — shown as sub rows
|
|
86
|
+
* bookings: ArrayType(BookingType), // no column — shown as sub rows
|
|
87
|
+
* });
|
|
88
|
+
* const OrderType = StructType({ id: StringType, name: StringType, jobs: ArrayType(JobType) });
|
|
89
|
+
* const orders = $.let(State.bind([ArrayType(OrderType)], "sheet_subrows_orders", [
|
|
90
|
+
* { id: "wo-1042", name: "WO-1042 · Frames", jobs: [
|
|
91
|
+
* { task: "Assemble frames", qty: some(40.0), notes: "Two benches", operations: [
|
|
92
|
+
* { id: "WO-1042-1", code: "CUT", name: "Cut rails to length", materials: ["Rail stock × 80"], station: some("Saw 2"), by: none },
|
|
93
|
+
* { id: "WO-1042-2", code: "ASM", name: "Assemble frame", materials: ["M6 bolts × 12", "Frame kit"], station: some("Bench 7"), by: some("Assembly") },
|
|
94
|
+
* ], bookings: [
|
|
95
|
+
* variant("labour", { team: "Assembly", people: 2n, hours: 12.0 }),
|
|
96
|
+
* variant("equipment", { resource: "Torque driver" }),
|
|
97
|
+
* ] },
|
|
98
|
+
* { task: "Inspect frames", qty: some(40.0), notes: "", operations: [], bookings: [
|
|
99
|
+
* variant("space", { area: "Test bay", units: 2n }),
|
|
100
|
+
* ] },
|
|
101
|
+
* ] },
|
|
102
|
+
* { id: "wo-1043", name: "WO-1043 · Housings", jobs: [
|
|
103
|
+
* { task: "Paint housings", qty: some(250.0), notes: "Primer first", operations: [
|
|
104
|
+
* { id: "WO-1043-1", code: "PNT", name: "Prime and paint", materials: ["Primer", "Topcoat"], station: none, by: none },
|
|
105
|
+
* ], bookings: [] },
|
|
106
|
+
* ] },
|
|
107
|
+
* ]));
|
|
108
|
+
* return (
|
|
109
|
+
* <Sheet
|
|
110
|
+
* data={orders}
|
|
111
|
+
* id="id"
|
|
112
|
+
* group={Sheet.group(OrderType, "jobs", { title: "name", noun: { singular: "order", plural: "orders" } })}
|
|
113
|
+
* columns={{
|
|
114
|
+
* task: Sheet.column.text(JobType, { header: "Task", width: "220px" }),
|
|
115
|
+
* qty: Sheet.column.quantity(JobType, { header: "Qty", width: "96px" }),
|
|
116
|
+
* notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
|
|
117
|
+
* }}
|
|
118
|
+
* subRows={Sheet.subRows(JobType, {
|
|
119
|
+
* operations: (op) => Sheet.subRow({
|
|
120
|
+
* code: op.code,
|
|
121
|
+
* name: op.name,
|
|
122
|
+
* chips: op.materials,
|
|
123
|
+
* facets: { station: op.station, by: op.by }, // a none drops out
|
|
124
|
+
* id: op.id,
|
|
125
|
+
* }),
|
|
126
|
+
* bookings: (b) => b.match({
|
|
127
|
+
* space: (_$2, s) => Sheet.subRow({ code: "CLAIM", name: East.str`${s.area} · ${s.units} units` }),
|
|
128
|
+
* labour: (_$2, l) => Sheet.subRow({ code: "LABOUR", name: East.str`${l.team} · ${l.people} people · ${l.hours} person-hours` }),
|
|
129
|
+
* equipment: (_$2, e) => Sheet.subRow({ code: "EQUIPMENT", name: e.resource }),
|
|
130
|
+
* }),
|
|
131
|
+
* })}
|
|
132
|
+
* newRow={East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "", operations: [], bookings: [] }))}
|
|
133
|
+
* newGroup={East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(OrderType), () => Sheet.patch(OrderType, { jobs: [] }))}
|
|
134
|
+
* onUpdate={orders.write}
|
|
135
|
+
* style={{ height: "420px" }}
|
|
136
|
+
* />
|
|
137
|
+
* );
|
|
138
|
+
* }}</Reactive>
|
|
139
|
+
* ));
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function createSubRows<R extends StructType>(rowType: R, sources: SheetSubRowSources<R>): SheetSubRowsValue<R>;
|
|
143
|
+
/**
|
|
144
|
+
* The literal-record input of `Sheet.subRow({ … })`.
|
|
145
|
+
*
|
|
146
|
+
* @property code - The lead's code; an `Option` becomes its value or `""`
|
|
147
|
+
* @property name - The lead's words
|
|
148
|
+
* @property chips - The detail's parameter chips
|
|
149
|
+
* @property facets - Label → value, in display order; a `none` value drops the facet
|
|
150
|
+
* @property id - The record the sub row traces to; an `Option` becomes its value or `""`
|
|
151
|
+
*/
|
|
152
|
+
export interface SheetSubRowInput {
|
|
153
|
+
/** The lead's code. */
|
|
154
|
+
code?: SubtypeExprOrValue<StringType | OptionType<StringType>>;
|
|
155
|
+
/** The lead's words. */
|
|
156
|
+
name: SubtypeExprOrValue<StringType>;
|
|
157
|
+
/** The detail's parameter chips. */
|
|
158
|
+
chips?: SubtypeExprOrValue<ArrayType<StringType>>;
|
|
159
|
+
/** Label → value; a `none` value drops the facet. */
|
|
160
|
+
facets?: Record<string, SubtypeExprOrValue<StringType | OptionType<StringType>>>;
|
|
161
|
+
/** The record the sub row traces to. */
|
|
162
|
+
id?: SubtypeExprOrValue<StringType | OptionType<StringType>>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Builds one sub row — `Sheet.subRow({ code?, name, chips?, facets?, id? })`.
|
|
166
|
+
* What is left out is filled in: `code` and `id` become `""`, `chips` and
|
|
167
|
+
* `facets` `[]`; a facet whose value is `none` drops out.
|
|
168
|
+
*
|
|
169
|
+
* @param input - The sub row's fields ({@link SheetSubRowInput})
|
|
170
|
+
* @returns An expression of `Sheet.Types.SubRow`
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```tsx
|
|
174
|
+
* // .tsx file with the `@jsxImportSource @elaraai/east-ui` pragma
|
|
175
|
+
* import { ArrayType, East, FloatType, IntegerType, OptionType, StringType, StructType, VariantType, none, some, variant } from "@elaraai/east";
|
|
176
|
+
* import { Reactive, Sheet, State, UIComponentType } from "@elaraai/east-ui";
|
|
177
|
+
*
|
|
178
|
+
* const sheet = East.function([], UIComponentType, (_$) => (
|
|
179
|
+
* <Reactive>{$ => {
|
|
180
|
+
* const OperationType = StructType({
|
|
181
|
+
* id: StringType, code: StringType, name: StringType, materials: ArrayType(StringType),
|
|
182
|
+
* station: OptionType(StringType), by: OptionType(StringType),
|
|
183
|
+
* });
|
|
184
|
+
* const BookingType = VariantType({
|
|
185
|
+
* space: StructType({ area: StringType, units: IntegerType }),
|
|
186
|
+
* labour: StructType({ team: StringType, people: IntegerType, hours: FloatType }),
|
|
187
|
+
* equipment: StructType({ resource: StringType }),
|
|
188
|
+
* });
|
|
189
|
+
* const JobType = StructType({
|
|
190
|
+
* task: StringType, qty: OptionType(FloatType), notes: StringType,
|
|
191
|
+
* operations: ArrayType(OperationType), // no column — shown as sub rows
|
|
192
|
+
* bookings: ArrayType(BookingType), // no column — shown as sub rows
|
|
193
|
+
* });
|
|
194
|
+
* const OrderType = StructType({ id: StringType, name: StringType, jobs: ArrayType(JobType) });
|
|
195
|
+
* const orders = $.let(State.bind([ArrayType(OrderType)], "sheet_subrows_orders", [
|
|
196
|
+
* { id: "wo-1042", name: "WO-1042 · Frames", jobs: [
|
|
197
|
+
* { task: "Assemble frames", qty: some(40.0), notes: "Two benches", operations: [
|
|
198
|
+
* { id: "WO-1042-1", code: "CUT", name: "Cut rails to length", materials: ["Rail stock × 80"], station: some("Saw 2"), by: none },
|
|
199
|
+
* { id: "WO-1042-2", code: "ASM", name: "Assemble frame", materials: ["M6 bolts × 12", "Frame kit"], station: some("Bench 7"), by: some("Assembly") },
|
|
200
|
+
* ], bookings: [
|
|
201
|
+
* variant("labour", { team: "Assembly", people: 2n, hours: 12.0 }),
|
|
202
|
+
* variant("equipment", { resource: "Torque driver" }),
|
|
203
|
+
* ] },
|
|
204
|
+
* { task: "Inspect frames", qty: some(40.0), notes: "", operations: [], bookings: [
|
|
205
|
+
* variant("space", { area: "Test bay", units: 2n }),
|
|
206
|
+
* ] },
|
|
207
|
+
* ] },
|
|
208
|
+
* { id: "wo-1043", name: "WO-1043 · Housings", jobs: [
|
|
209
|
+
* { task: "Paint housings", qty: some(250.0), notes: "Primer first", operations: [
|
|
210
|
+
* { id: "WO-1043-1", code: "PNT", name: "Prime and paint", materials: ["Primer", "Topcoat"], station: none, by: none },
|
|
211
|
+
* ], bookings: [] },
|
|
212
|
+
* ] },
|
|
213
|
+
* ]));
|
|
214
|
+
* return (
|
|
215
|
+
* <Sheet
|
|
216
|
+
* data={orders}
|
|
217
|
+
* id="id"
|
|
218
|
+
* group={Sheet.group(OrderType, "jobs", { title: "name", noun: { singular: "order", plural: "orders" } })}
|
|
219
|
+
* columns={{
|
|
220
|
+
* task: Sheet.column.text(JobType, { header: "Task", width: "220px" }),
|
|
221
|
+
* qty: Sheet.column.quantity(JobType, { header: "Qty", width: "96px" }),
|
|
222
|
+
* notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
|
|
223
|
+
* }}
|
|
224
|
+
* subRows={Sheet.subRows(JobType, {
|
|
225
|
+
* operations: (op) => Sheet.subRow({
|
|
226
|
+
* code: op.code,
|
|
227
|
+
* name: op.name,
|
|
228
|
+
* chips: op.materials,
|
|
229
|
+
* facets: { station: op.station, by: op.by }, // a none drops out
|
|
230
|
+
* id: op.id,
|
|
231
|
+
* }),
|
|
232
|
+
* bookings: (b) => b.match({
|
|
233
|
+
* space: (_$2, s) => Sheet.subRow({ code: "CLAIM", name: East.str`${s.area} · ${s.units} units` }),
|
|
234
|
+
* labour: (_$2, l) => Sheet.subRow({ code: "LABOUR", name: East.str`${l.team} · ${l.people} people · ${l.hours} person-hours` }),
|
|
235
|
+
* equipment: (_$2, e) => Sheet.subRow({ code: "EQUIPMENT", name: e.resource }),
|
|
236
|
+
* }),
|
|
237
|
+
* })}
|
|
238
|
+
* newRow={East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "", operations: [], bookings: [] }))}
|
|
239
|
+
* newGroup={East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(OrderType), () => Sheet.patch(OrderType, { jobs: [] }))}
|
|
240
|
+
* onUpdate={orders.write}
|
|
241
|
+
* style={{ height: "420px" }}
|
|
242
|
+
* />
|
|
243
|
+
* );
|
|
244
|
+
* }}</Reactive>
|
|
245
|
+
* ));
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export declare function createSubRow(input: SheetSubRowInput): ExprType<SheetSubRowType>;
|
|
249
|
+
//# sourceMappingURL=sub-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-rows.d.ts","sourceRoot":"","sources":["../../../../src/collections/sheet/sub-rows.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,kBAAkB,EAGvB,SAAS,EACT,UAAU,EACV,UAAU,EACV,KAAK,UAAU,EAGlB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAkB,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI;KAC/C,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK;CAClF,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,IACzE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,UAAU,IAAI;KAClD,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAC,eAAe,CAAC;CAC9H,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,UAAU;IACnD,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAEpH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC7B,uBAAuB;IACvB,IAAI,CAAC,EAAE,kBAAkB,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,wBAAwB;IACxB,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACrC,oCAAoC;IACpC,KAAK,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjF,wCAAwC;IACxC,EAAE,CAAC,EAAE,kBAAkB,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;CAChE;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,CAa/E"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Sheet.subRows` and `Sheet.subRow` — sub rows (#844,
|
|
7
|
+
* `libs/east-ui/docs/proposals/Sheet Sub Rows - DX Proposal.md`): read-only
|
|
8
|
+
* rows under a line (or a flat row) that share none of the sheet's columns.
|
|
9
|
+
*
|
|
10
|
+
* `Sheet.subRows(R, { field: (item, row) => Sheet.subRow({ … }) })` is keyed
|
|
11
|
+
* like `columns`: each key names an `Array<T>` field of the type the columns
|
|
12
|
+
* are built over, and its mapper turns one element into a sub row. Key order
|
|
13
|
+
* is display order. The builder only CAPTURES; the root compiles each mapper
|
|
14
|
+
* once and the bridge calls it inside the row projection (`bridge.ts`).
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
import { East, Expr, ArrayType, OptionType, StringType, some, none, } from "@elaraai/east";
|
|
19
|
+
import { SheetFacetType, SheetSubRowType } from "./types.js";
|
|
20
|
+
/**
|
|
21
|
+
* Declares where a sheet's sub rows come from — `Sheet.subRows(R, { … })`.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam R - The type the columns are built over (a grouped sheet: the line type)
|
|
24
|
+
* @param rowType - The row type value
|
|
25
|
+
* @param sources - Array field → mapper to a sub row, in display order
|
|
26
|
+
* @returns The declaration the `subRows` prop takes
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // .tsx file with the `@jsxImportSource @elaraai/east-ui` pragma
|
|
31
|
+
* import { ArrayType, East, FloatType, IntegerType, OptionType, StringType, StructType, VariantType, none, some, variant } from "@elaraai/east";
|
|
32
|
+
* import { Reactive, Sheet, State, UIComponentType } from "@elaraai/east-ui";
|
|
33
|
+
*
|
|
34
|
+
* const sheet = East.function([], UIComponentType, (_$) => (
|
|
35
|
+
* <Reactive>{$ => {
|
|
36
|
+
* const OperationType = StructType({
|
|
37
|
+
* id: StringType, code: StringType, name: StringType, materials: ArrayType(StringType),
|
|
38
|
+
* station: OptionType(StringType), by: OptionType(StringType),
|
|
39
|
+
* });
|
|
40
|
+
* const BookingType = VariantType({
|
|
41
|
+
* space: StructType({ area: StringType, units: IntegerType }),
|
|
42
|
+
* labour: StructType({ team: StringType, people: IntegerType, hours: FloatType }),
|
|
43
|
+
* equipment: StructType({ resource: StringType }),
|
|
44
|
+
* });
|
|
45
|
+
* const JobType = StructType({
|
|
46
|
+
* task: StringType, qty: OptionType(FloatType), notes: StringType,
|
|
47
|
+
* operations: ArrayType(OperationType), // no column — shown as sub rows
|
|
48
|
+
* bookings: ArrayType(BookingType), // no column — shown as sub rows
|
|
49
|
+
* });
|
|
50
|
+
* const OrderType = StructType({ id: StringType, name: StringType, jobs: ArrayType(JobType) });
|
|
51
|
+
* const orders = $.let(State.bind([ArrayType(OrderType)], "sheet_subrows_orders", [
|
|
52
|
+
* { id: "wo-1042", name: "WO-1042 · Frames", jobs: [
|
|
53
|
+
* { task: "Assemble frames", qty: some(40.0), notes: "Two benches", operations: [
|
|
54
|
+
* { id: "WO-1042-1", code: "CUT", name: "Cut rails to length", materials: ["Rail stock × 80"], station: some("Saw 2"), by: none },
|
|
55
|
+
* { id: "WO-1042-2", code: "ASM", name: "Assemble frame", materials: ["M6 bolts × 12", "Frame kit"], station: some("Bench 7"), by: some("Assembly") },
|
|
56
|
+
* ], bookings: [
|
|
57
|
+
* variant("labour", { team: "Assembly", people: 2n, hours: 12.0 }),
|
|
58
|
+
* variant("equipment", { resource: "Torque driver" }),
|
|
59
|
+
* ] },
|
|
60
|
+
* { task: "Inspect frames", qty: some(40.0), notes: "", operations: [], bookings: [
|
|
61
|
+
* variant("space", { area: "Test bay", units: 2n }),
|
|
62
|
+
* ] },
|
|
63
|
+
* ] },
|
|
64
|
+
* { id: "wo-1043", name: "WO-1043 · Housings", jobs: [
|
|
65
|
+
* { task: "Paint housings", qty: some(250.0), notes: "Primer first", operations: [
|
|
66
|
+
* { id: "WO-1043-1", code: "PNT", name: "Prime and paint", materials: ["Primer", "Topcoat"], station: none, by: none },
|
|
67
|
+
* ], bookings: [] },
|
|
68
|
+
* ] },
|
|
69
|
+
* ]));
|
|
70
|
+
* return (
|
|
71
|
+
* <Sheet
|
|
72
|
+
* data={orders}
|
|
73
|
+
* id="id"
|
|
74
|
+
* group={Sheet.group(OrderType, "jobs", { title: "name", noun: { singular: "order", plural: "orders" } })}
|
|
75
|
+
* columns={{
|
|
76
|
+
* task: Sheet.column.text(JobType, { header: "Task", width: "220px" }),
|
|
77
|
+
* qty: Sheet.column.quantity(JobType, { header: "Qty", width: "96px" }),
|
|
78
|
+
* notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
|
|
79
|
+
* }}
|
|
80
|
+
* subRows={Sheet.subRows(JobType, {
|
|
81
|
+
* operations: (op) => Sheet.subRow({
|
|
82
|
+
* code: op.code,
|
|
83
|
+
* name: op.name,
|
|
84
|
+
* chips: op.materials,
|
|
85
|
+
* facets: { station: op.station, by: op.by }, // a none drops out
|
|
86
|
+
* id: op.id,
|
|
87
|
+
* }),
|
|
88
|
+
* bookings: (b) => b.match({
|
|
89
|
+
* space: (_$2, s) => Sheet.subRow({ code: "CLAIM", name: East.str`${s.area} · ${s.units} units` }),
|
|
90
|
+
* labour: (_$2, l) => Sheet.subRow({ code: "LABOUR", name: East.str`${l.team} · ${l.people} people · ${l.hours} person-hours` }),
|
|
91
|
+
* equipment: (_$2, e) => Sheet.subRow({ code: "EQUIPMENT", name: e.resource }),
|
|
92
|
+
* }),
|
|
93
|
+
* })}
|
|
94
|
+
* newRow={East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "", operations: [], bookings: [] }))}
|
|
95
|
+
* newGroup={East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(OrderType), () => Sheet.patch(OrderType, { jobs: [] }))}
|
|
96
|
+
* onUpdate={orders.write}
|
|
97
|
+
* style={{ height: "420px" }}
|
|
98
|
+
* />
|
|
99
|
+
* );
|
|
100
|
+
* }}</Reactive>
|
|
101
|
+
* ));
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export function createSubRows(rowType, sources) {
|
|
105
|
+
return { rowType, sources };
|
|
106
|
+
}
|
|
107
|
+
/** A `String` or `Option<String>` input as an `Option<String>` expression, its shape read once at build time. */
|
|
108
|
+
function optionalText(v) {
|
|
109
|
+
if (typeof v === "string")
|
|
110
|
+
return East.value(some(v), OptionType(StringType));
|
|
111
|
+
if (v instanceof Expr) {
|
|
112
|
+
if (Expr.type(v) === StringType) {
|
|
113
|
+
return East.value(some(v), OptionType(StringType));
|
|
114
|
+
}
|
|
115
|
+
return v;
|
|
116
|
+
}
|
|
117
|
+
return East.value(v, OptionType(StringType));
|
|
118
|
+
}
|
|
119
|
+
/** A `String` or `Option<String>` input as display text, `""` for none. */
|
|
120
|
+
function textOrBlank(v) {
|
|
121
|
+
if (v === undefined)
|
|
122
|
+
return East.value("", StringType);
|
|
123
|
+
return optionalText(v).match({ some: (_$, s) => s, none: (_$) => "" });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Builds one sub row — `Sheet.subRow({ code?, name, chips?, facets?, id? })`.
|
|
127
|
+
* What is left out is filled in: `code` and `id` become `""`, `chips` and
|
|
128
|
+
* `facets` `[]`; a facet whose value is `none` drops out.
|
|
129
|
+
*
|
|
130
|
+
* @param input - The sub row's fields ({@link SheetSubRowInput})
|
|
131
|
+
* @returns An expression of `Sheet.Types.SubRow`
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* // .tsx file with the `@jsxImportSource @elaraai/east-ui` pragma
|
|
136
|
+
* import { ArrayType, East, FloatType, IntegerType, OptionType, StringType, StructType, VariantType, none, some, variant } from "@elaraai/east";
|
|
137
|
+
* import { Reactive, Sheet, State, UIComponentType } from "@elaraai/east-ui";
|
|
138
|
+
*
|
|
139
|
+
* const sheet = East.function([], UIComponentType, (_$) => (
|
|
140
|
+
* <Reactive>{$ => {
|
|
141
|
+
* const OperationType = StructType({
|
|
142
|
+
* id: StringType, code: StringType, name: StringType, materials: ArrayType(StringType),
|
|
143
|
+
* station: OptionType(StringType), by: OptionType(StringType),
|
|
144
|
+
* });
|
|
145
|
+
* const BookingType = VariantType({
|
|
146
|
+
* space: StructType({ area: StringType, units: IntegerType }),
|
|
147
|
+
* labour: StructType({ team: StringType, people: IntegerType, hours: FloatType }),
|
|
148
|
+
* equipment: StructType({ resource: StringType }),
|
|
149
|
+
* });
|
|
150
|
+
* const JobType = StructType({
|
|
151
|
+
* task: StringType, qty: OptionType(FloatType), notes: StringType,
|
|
152
|
+
* operations: ArrayType(OperationType), // no column — shown as sub rows
|
|
153
|
+
* bookings: ArrayType(BookingType), // no column — shown as sub rows
|
|
154
|
+
* });
|
|
155
|
+
* const OrderType = StructType({ id: StringType, name: StringType, jobs: ArrayType(JobType) });
|
|
156
|
+
* const orders = $.let(State.bind([ArrayType(OrderType)], "sheet_subrows_orders", [
|
|
157
|
+
* { id: "wo-1042", name: "WO-1042 · Frames", jobs: [
|
|
158
|
+
* { task: "Assemble frames", qty: some(40.0), notes: "Two benches", operations: [
|
|
159
|
+
* { id: "WO-1042-1", code: "CUT", name: "Cut rails to length", materials: ["Rail stock × 80"], station: some("Saw 2"), by: none },
|
|
160
|
+
* { id: "WO-1042-2", code: "ASM", name: "Assemble frame", materials: ["M6 bolts × 12", "Frame kit"], station: some("Bench 7"), by: some("Assembly") },
|
|
161
|
+
* ], bookings: [
|
|
162
|
+
* variant("labour", { team: "Assembly", people: 2n, hours: 12.0 }),
|
|
163
|
+
* variant("equipment", { resource: "Torque driver" }),
|
|
164
|
+
* ] },
|
|
165
|
+
* { task: "Inspect frames", qty: some(40.0), notes: "", operations: [], bookings: [
|
|
166
|
+
* variant("space", { area: "Test bay", units: 2n }),
|
|
167
|
+
* ] },
|
|
168
|
+
* ] },
|
|
169
|
+
* { id: "wo-1043", name: "WO-1043 · Housings", jobs: [
|
|
170
|
+
* { task: "Paint housings", qty: some(250.0), notes: "Primer first", operations: [
|
|
171
|
+
* { id: "WO-1043-1", code: "PNT", name: "Prime and paint", materials: ["Primer", "Topcoat"], station: none, by: none },
|
|
172
|
+
* ], bookings: [] },
|
|
173
|
+
* ] },
|
|
174
|
+
* ]));
|
|
175
|
+
* return (
|
|
176
|
+
* <Sheet
|
|
177
|
+
* data={orders}
|
|
178
|
+
* id="id"
|
|
179
|
+
* group={Sheet.group(OrderType, "jobs", { title: "name", noun: { singular: "order", plural: "orders" } })}
|
|
180
|
+
* columns={{
|
|
181
|
+
* task: Sheet.column.text(JobType, { header: "Task", width: "220px" }),
|
|
182
|
+
* qty: Sheet.column.quantity(JobType, { header: "Qty", width: "96px" }),
|
|
183
|
+
* notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
|
|
184
|
+
* }}
|
|
185
|
+
* subRows={Sheet.subRows(JobType, {
|
|
186
|
+
* operations: (op) => Sheet.subRow({
|
|
187
|
+
* code: op.code,
|
|
188
|
+
* name: op.name,
|
|
189
|
+
* chips: op.materials,
|
|
190
|
+
* facets: { station: op.station, by: op.by }, // a none drops out
|
|
191
|
+
* id: op.id,
|
|
192
|
+
* }),
|
|
193
|
+
* bookings: (b) => b.match({
|
|
194
|
+
* space: (_$2, s) => Sheet.subRow({ code: "CLAIM", name: East.str`${s.area} · ${s.units} units` }),
|
|
195
|
+
* labour: (_$2, l) => Sheet.subRow({ code: "LABOUR", name: East.str`${l.team} · ${l.people} people · ${l.hours} person-hours` }),
|
|
196
|
+
* equipment: (_$2, e) => Sheet.subRow({ code: "EQUIPMENT", name: e.resource }),
|
|
197
|
+
* }),
|
|
198
|
+
* })}
|
|
199
|
+
* newRow={East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "", operations: [], bookings: [] }))}
|
|
200
|
+
* newGroup={East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(OrderType), () => Sheet.patch(OrderType, { jobs: [] }))}
|
|
201
|
+
* onUpdate={orders.write}
|
|
202
|
+
* style={{ height: "420px" }}
|
|
203
|
+
* />
|
|
204
|
+
* );
|
|
205
|
+
* }}</Reactive>
|
|
206
|
+
* ));
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function createSubRow(input) {
|
|
210
|
+
const facets = Object.entries(input.facets ?? {}).map(([label, value]) => optionalText(value).match({
|
|
211
|
+
some: (_$, v) => East.value(some({ label, value: v }), OptionType(SheetFacetType)),
|
|
212
|
+
none: (_$) => East.value(none, OptionType(SheetFacetType)),
|
|
213
|
+
}));
|
|
214
|
+
return East.value({
|
|
215
|
+
code: textOrBlank(input.code),
|
|
216
|
+
name: input.name,
|
|
217
|
+
chips: input.chips ?? East.value([], ArrayType(StringType)),
|
|
218
|
+
facets: East.value(facets, ArrayType(OptionType(SheetFacetType))).filterMap((_$, f) => f),
|
|
219
|
+
id: textOrBlank(input.id),
|
|
220
|
+
}, SheetSubRowType);
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=sub-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-rows.js","sourceRoot":"","sources":["../../../../src/collections/sheet/sub-rows.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIH,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,UAAU,EAEV,IAAI,EACJ,IAAI,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA6C7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,UAAU,aAAa,CAAuB,OAAU,EAAE,OAA8B;IAC1F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC;AAwBD,iHAAiH;AACjH,SAAS,YAAY,CAAC,CAA0D;IAC5E,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9E,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,IAAI,CAAC,CAAmB,CAAC,KAAK,UAAU,EAAE,CAAC;YAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAyB,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,CAAqC,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAA+C,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,2EAA2E;AAC3E,SAAS,WAAW,CAAC,CAAsE;IACvF,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACvD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,UAAU,YAAY,CAAC,KAAuB;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CACrE,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;QACtB,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QAClF,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;KAC7D,CAAC,CAAC,CAAC;IACR,OAAO,IAAI,CAAC,KAAK,CAAC;QACd,IAAI,EAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;QAC/B,IAAI,EAAI,KAAK,CAAC,IAAI;QAClB,KAAK,EAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACzF,EAAE,EAAM,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;KAChC,EAAE,eAAe,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The Sheet's names for the shared editing contract (`contracts/editing.ts`,
|
|
7
|
+
* #879) — each one the `Editing` namespace's own value (`Sheet.apply` is
|
|
8
|
+
* `Editing.apply`, `Sheet.Types.ChangeSet` is `Editing.Types.ChangeSet`) — and
|
|
9
|
+
* the transaction types only a sheet has: a new row's destination among a
|
|
10
|
+
* group's children, and the `newRow` / `newGroup` contexts.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { IntegerType, StringType, StructType, VariantType } from "@elaraai/east";
|
|
15
|
+
export { EditingPositionType as SheetPositionType, EditingPlacementType as SheetEntryPlacementType, EditingFieldIssueType as SheetFieldIssueType, EditingReadinessType as SheetReadinessType, EditingIssueType as SheetIssueType, EditingBatchReadinessType as SheetBatchReadinessType, EditingOriginType as SheetOriginType, EditingApplyResultType as SheetApplyResultType, EditingDraftFieldType as SheetDraftFieldType, EditingDraftTypeFor as SheetDraftTypeFor, EditingBaseTypeFor as SheetBaseTypeFor, EditingChangeTypeFor as SheetChangeTypeFor, EditingChangeSetTypeFor as SheetChangeSetTypeFor, EditingAppliedTypeFor as SheetAppliedTypeFor, applyEditing as applySheet, type EditingDraftOf as SheetDraftOf, } from "../../contracts/editing.js";
|
|
16
|
+
/**
|
|
17
|
+
* A new row's destination: a top-level entry's placement, or a position among
|
|
18
|
+
* a group's children.
|
|
19
|
+
*
|
|
20
|
+
* @property entry - A top-level entry, at its placement
|
|
21
|
+
* @property child - A child row of the group with this id, at this index
|
|
22
|
+
*/
|
|
23
|
+
export declare const SheetRowDestinationType: VariantType<{
|
|
24
|
+
readonly entry: VariantType<{
|
|
25
|
+
readonly ordered: VariantType<{
|
|
26
|
+
readonly start: import("@elaraai/east").NullType;
|
|
27
|
+
readonly end: import("@elaraai/east").NullType;
|
|
28
|
+
readonly before: StringType;
|
|
29
|
+
readonly after: StringType;
|
|
30
|
+
}>;
|
|
31
|
+
readonly keyOrder: import("@elaraai/east").NullType;
|
|
32
|
+
}>;
|
|
33
|
+
readonly child: StructType<{
|
|
34
|
+
readonly group: StringType;
|
|
35
|
+
readonly index: IntegerType;
|
|
36
|
+
}>;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* What a `newRow` constructor is told.
|
|
40
|
+
*
|
|
41
|
+
* @property destination - Where the new row goes
|
|
42
|
+
*/
|
|
43
|
+
export declare const SheetNewRowType: StructType<{
|
|
44
|
+
readonly destination: VariantType<{
|
|
45
|
+
readonly entry: VariantType<{
|
|
46
|
+
readonly ordered: VariantType<{
|
|
47
|
+
readonly start: import("@elaraai/east").NullType;
|
|
48
|
+
readonly end: import("@elaraai/east").NullType;
|
|
49
|
+
readonly before: StringType;
|
|
50
|
+
readonly after: StringType;
|
|
51
|
+
}>;
|
|
52
|
+
readonly keyOrder: import("@elaraai/east").NullType;
|
|
53
|
+
}>;
|
|
54
|
+
readonly child: StructType<{
|
|
55
|
+
readonly group: StringType;
|
|
56
|
+
readonly index: IntegerType;
|
|
57
|
+
}>;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* What a `newGroup` constructor is told.
|
|
62
|
+
*
|
|
63
|
+
* @property place - Where the new group goes
|
|
64
|
+
*/
|
|
65
|
+
export declare const SheetNewGroupType: StructType<{
|
|
66
|
+
readonly place: VariantType<{
|
|
67
|
+
readonly ordered: VariantType<{
|
|
68
|
+
readonly start: import("@elaraai/east").NullType;
|
|
69
|
+
readonly end: import("@elaraai/east").NullType;
|
|
70
|
+
readonly before: StringType;
|
|
71
|
+
readonly after: StringType;
|
|
72
|
+
}>;
|
|
73
|
+
readonly keyOrder: import("@elaraai/east").NullType;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=transactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../../src/collections/sheet/transactions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjF,OAAO,EACH,mBAAmB,IAAI,iBAAiB,EACxC,oBAAoB,IAAI,uBAAuB,EAC/C,qBAAqB,IAAI,mBAAmB,EAC5C,oBAAoB,IAAI,kBAAkB,EAC1C,gBAAgB,IAAI,cAAc,EAClC,yBAAyB,IAAI,uBAAuB,EACpD,iBAAiB,IAAI,eAAe,EACpC,sBAAsB,IAAI,oBAAoB,EAC9C,qBAAqB,IAAI,mBAAmB,EAC5C,mBAAmB,IAAI,iBAAiB,EACxC,kBAAkB,IAAI,gBAAgB,EACtC,oBAAoB,IAAI,kBAAkB,EAC1C,uBAAuB,IAAI,qBAAqB,EAChD,qBAAqB,IAAI,mBAAmB,EAC5C,YAAY,IAAI,UAAU,EAC1B,KAAK,cAAc,IAAI,YAAY,GACtC,MAAM,4BAA4B,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;EAGlC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;EAAuD,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;EAA8C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The Sheet's names for the shared editing contract (`contracts/editing.ts`,
|
|
7
|
+
* #879) — each one the `Editing` namespace's own value (`Sheet.apply` is
|
|
8
|
+
* `Editing.apply`, `Sheet.Types.ChangeSet` is `Editing.Types.ChangeSet`) — and
|
|
9
|
+
* the transaction types only a sheet has: a new row's destination among a
|
|
10
|
+
* group's children, and the `newRow` / `newGroup` contexts.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { IntegerType, StringType, StructType, VariantType } from "@elaraai/east";
|
|
15
|
+
import { EditingPlacementType } from "../../contracts/editing.js";
|
|
16
|
+
export { EditingPositionType as SheetPositionType, EditingPlacementType as SheetEntryPlacementType, EditingFieldIssueType as SheetFieldIssueType, EditingReadinessType as SheetReadinessType, EditingIssueType as SheetIssueType, EditingBatchReadinessType as SheetBatchReadinessType, EditingOriginType as SheetOriginType, EditingApplyResultType as SheetApplyResultType, EditingDraftFieldType as SheetDraftFieldType, EditingDraftTypeFor as SheetDraftTypeFor, EditingBaseTypeFor as SheetBaseTypeFor, EditingChangeTypeFor as SheetChangeTypeFor, EditingChangeSetTypeFor as SheetChangeSetTypeFor, EditingAppliedTypeFor as SheetAppliedTypeFor, applyEditing as applySheet, } from "../../contracts/editing.js";
|
|
17
|
+
/**
|
|
18
|
+
* A new row's destination: a top-level entry's placement, or a position among
|
|
19
|
+
* a group's children.
|
|
20
|
+
*
|
|
21
|
+
* @property entry - A top-level entry, at its placement
|
|
22
|
+
* @property child - A child row of the group with this id, at this index
|
|
23
|
+
*/
|
|
24
|
+
export const SheetRowDestinationType = VariantType({
|
|
25
|
+
entry: EditingPlacementType,
|
|
26
|
+
child: StructType({ group: StringType, index: IntegerType }),
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* What a `newRow` constructor is told.
|
|
30
|
+
*
|
|
31
|
+
* @property destination - Where the new row goes
|
|
32
|
+
*/
|
|
33
|
+
export const SheetNewRowType = StructType({ destination: SheetRowDestinationType });
|
|
34
|
+
/**
|
|
35
|
+
* What a `newGroup` constructor is told.
|
|
36
|
+
*
|
|
37
|
+
* @property place - Where the new group goes
|
|
38
|
+
*/
|
|
39
|
+
export const SheetNewGroupType = StructType({ place: EditingPlacementType });
|
|
40
|
+
//# sourceMappingURL=transactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../../../src/collections/sheet/transactions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EACH,mBAAmB,IAAI,iBAAiB,EACxC,oBAAoB,IAAI,uBAAuB,EAC/C,qBAAqB,IAAI,mBAAmB,EAC5C,oBAAoB,IAAI,kBAAkB,EAC1C,gBAAgB,IAAI,cAAc,EAClC,yBAAyB,IAAI,uBAAuB,EACpD,iBAAiB,IAAI,eAAe,EACpC,sBAAsB,IAAI,oBAAoB,EAC9C,qBAAqB,IAAI,mBAAmB,EAC5C,mBAAmB,IAAI,iBAAiB,EACxC,kBAAkB,IAAI,gBAAgB,EACtC,oBAAoB,IAAI,kBAAkB,EAC1C,uBAAuB,IAAI,qBAAqB,EAChD,qBAAqB,IAAI,mBAAmB,EAC5C,YAAY,IAAI,UAAU,GAE7B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IAC/C,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC"}
|