@elaraai/e3-ui 1.0.86 → 1.0.87
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/bind/data-indexed.d.ts +159 -0
- package/dist/src/bind/data-indexed.d.ts.map +1 -0
- package/dist/src/bind/data-indexed.js +105 -0
- package/dist/src/bind/data-indexed.js.map +1 -0
- package/dist/src/bind/data.d.ts +5 -3
- package/dist/src/bind/data.d.ts.map +1 -1
- package/dist/src/bind/data.js +6 -0
- package/dist/src/bind/data.js.map +1 -1
- package/dist/src/bind/record.d.ts +34 -23
- package/dist/src/bind/record.d.ts.map +1 -1
- package/dist/src/bind/record.js +46 -19
- package/dist/src/bind/record.js.map +1 -1
- package/dist/src/calendar/index.d.ts +2923 -0
- package/dist/src/calendar/index.d.ts.map +1 -0
- package/dist/src/calendar/index.js +135 -0
- package/dist/src/calendar/index.js.map +1 -0
- package/dist/src/decision/queue.d.ts +3 -3
- package/dist/src/decision/queue.d.ts.map +1 -1
- package/dist/src/decision/queue.js +2 -2
- package/dist/src/decision/queue.js.map +1 -1
- package/dist/src/decision/types.d.ts +4 -0
- package/dist/src/decision/types.d.ts.map +1 -1
- package/dist/src/decision/types.js +4 -0
- package/dist/src/decision/types.js.map +1 -1
- package/dist/src/flowchart/canvas.d.ts +114 -0
- package/dist/src/flowchart/canvas.d.ts.map +1 -0
- package/dist/src/flowchart/canvas.js +84 -0
- package/dist/src/flowchart/canvas.js.map +1 -0
- package/dist/src/flowchart/flowchart.d.ts +79 -0
- package/dist/src/flowchart/flowchart.d.ts.map +1 -0
- package/dist/src/flowchart/flowchart.js +9 -0
- package/dist/src/flowchart/flowchart.js.map +1 -0
- package/dist/src/flowchart/index.d.ts +305 -0
- package/dist/src/flowchart/index.d.ts.map +1 -0
- package/dist/src/flowchart/index.js +267 -0
- package/dist/src/flowchart/index.js.map +1 -0
- package/dist/src/flowchart/library.d.ts +720 -0
- package/dist/src/flowchart/library.d.ts.map +1 -0
- package/dist/src/flowchart/library.js +611 -0
- package/dist/src/flowchart/library.js.map +1 -0
- package/dist/src/flowchart/over.d.ts +234 -0
- package/dist/src/flowchart/over.d.ts.map +1 -0
- package/dist/src/flowchart/over.js +220 -0
- package/dist/src/flowchart/over.js.map +1 -0
- package/dist/src/flowchart/patch.d.ts +64 -0
- package/dist/src/flowchart/patch.d.ts.map +1 -0
- package/dist/src/flowchart/patch.js +67 -0
- package/dist/src/flowchart/patch.js.map +1 -0
- package/dist/src/flowchart/payload.d.ts +8220 -0
- package/dist/src/flowchart/payload.d.ts.map +1 -0
- package/dist/src/flowchart/payload.js +521 -0
- package/dist/src/flowchart/payload.js.map +1 -0
- package/dist/src/flowchart/types.d.ts +393 -0
- package/dist/src/flowchart/types.d.ts.map +1 -0
- package/dist/src/flowchart/types.js +216 -0
- package/dist/src/flowchart/types.js.map +1 -0
- package/dist/src/flowchart/values.d.ts +267 -0
- package/dist/src/flowchart/values.d.ts.map +1 -0
- package/dist/src/flowchart/values.js +216 -0
- package/dist/src/flowchart/values.js.map +1 -0
- package/dist/src/flowchart/window.d.ts +521 -0
- package/dist/src/flowchart/window.d.ts.map +1 -0
- package/dist/src/flowchart/window.js +69 -0
- package/dist/src/flowchart/window.js.map +1 -0
- package/dist/src/index.d.ts +25 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +35 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +72 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plan/assemble.d.ts +2224 -0
- package/dist/src/plan/assemble.d.ts.map +1 -0
- package/dist/src/plan/assemble.js +210 -0
- package/dist/src/plan/assemble.js.map +1 -0
- package/dist/src/plan/builders.d.ts +790 -0
- package/dist/src/plan/builders.d.ts.map +1 -0
- package/dist/src/plan/builders.js +749 -0
- package/dist/src/plan/builders.js.map +1 -0
- package/dist/src/plan/event-rows.d.ts +2565 -0
- package/dist/src/plan/event-rows.d.ts.map +1 -0
- package/dist/src/plan/event-rows.js +689 -0
- package/dist/src/plan/event-rows.js.map +1 -0
- package/dist/src/plan/factories.d.ts +458 -0
- package/dist/src/plan/factories.d.ts.map +1 -0
- package/dist/src/plan/factories.js +484 -0
- package/dist/src/plan/factories.js.map +1 -0
- package/dist/src/plan/index.d.ts +672 -0
- package/dist/src/plan/index.d.ts.map +1 -0
- package/dist/src/plan/index.js +532 -0
- package/dist/src/plan/index.js.map +1 -0
- package/dist/src/plan/ir.d.ts +2594 -0
- package/dist/src/plan/ir.d.ts.map +1 -0
- package/dist/src/plan/ir.js +78 -0
- package/dist/src/plan/ir.js.map +1 -0
- package/dist/src/plan/library.d.ts +772 -0
- package/dist/src/plan/library.d.ts.map +1 -0
- package/dist/src/plan/library.js +424 -0
- package/dist/src/plan/library.js.map +1 -0
- package/dist/src/plan/ordered-source.d.ts +27 -0
- package/dist/src/plan/ordered-source.d.ts.map +1 -0
- package/dist/src/plan/ordered-source.js +48 -0
- package/dist/src/plan/ordered-source.js.map +1 -0
- package/dist/src/plan/over.d.ts +247 -0
- package/dist/src/plan/over.d.ts.map +1 -0
- package/dist/src/plan/over.js +266 -0
- package/dist/src/plan/over.js.map +1 -0
- package/dist/src/plan/pick.d.ts +78 -0
- package/dist/src/plan/pick.d.ts.map +1 -0
- package/dist/src/plan/pick.js +146 -0
- package/dist/src/plan/pick.js.map +1 -0
- package/dist/src/plan/plan.d.ts +11611 -0
- package/dist/src/plan/plan.d.ts.map +1 -0
- package/dist/src/plan/plan.js +428 -0
- package/dist/src/plan/plan.js.map +1 -0
- package/dist/src/plan/refs.d.ts +218 -0
- package/dist/src/plan/refs.d.ts.map +1 -0
- package/dist/src/plan/refs.js +226 -0
- package/dist/src/plan/refs.js.map +1 -0
- package/dist/src/plan/root.d.ts +290 -0
- package/dist/src/plan/root.d.ts.map +1 -0
- package/dist/src/plan/root.js +463 -0
- package/dist/src/plan/root.js.map +1 -0
- package/dist/src/plan/series.d.ts +13554 -0
- package/dist/src/plan/series.d.ts.map +1 -0
- package/dist/src/plan/series.js +1921 -0
- package/dist/src/plan/series.js.map +1 -0
- package/dist/src/plan/types.d.ts +12400 -0
- package/dist/src/plan/types.d.ts.map +1 -0
- package/dist/src/plan/types.js +1335 -0
- package/dist/src/plan/types.js.map +1 -0
- package/dist/src/roster/coverage.d.ts +240 -0
- package/dist/src/roster/coverage.d.ts.map +1 -0
- package/dist/src/roster/coverage.js +109 -0
- package/dist/src/roster/coverage.js.map +1 -0
- package/dist/src/roster/index.d.ts +4028 -0
- package/dist/src/roster/index.d.ts.map +1 -0
- package/dist/src/roster/index.js +115 -0
- package/dist/src/roster/index.js.map +1 -0
- package/dist/src/roster/library.d.ts +106 -0
- package/dist/src/roster/library.d.ts.map +1 -0
- package/dist/src/roster/library.js +78 -0
- package/dist/src/roster/library.js.map +1 -0
- package/dist/src/roster/people.d.ts +50 -0
- package/dist/src/roster/people.d.ts.map +1 -0
- package/dist/src/roster/people.js +32 -0
- package/dist/src/roster/people.js.map +1 -0
- package/dist/src/roster/rules.d.ts +275 -0
- package/dist/src/roster/rules.d.ts.map +1 -0
- package/dist/src/roster/rules.js +162 -0
- package/dist/src/roster/rules.js.map +1 -0
- package/dist/src/roster/types.d.ts +672 -0
- package/dist/src/roster/types.d.ts.map +1 -0
- package/dist/src/roster/types.js +248 -0
- package/dist/src/roster/types.js.map +1 -0
- package/dist/src/roster/visibility.d.ts +66 -0
- package/dist/src/roster/visibility.d.ts.map +1 -0
- package/dist/src/roster/visibility.js +25 -0
- package/dist/src/roster/visibility.js.map +1 -0
- package/dist/src/schedule/days.d.ts +54 -0
- package/dist/src/schedule/days.d.ts.map +1 -0
- package/dist/src/schedule/days.js +68 -0
- package/dist/src/schedule/days.js.map +1 -0
- package/dist/src/schedule/events.d.ts +433 -0
- package/dist/src/schedule/events.d.ts.map +1 -0
- package/dist/src/schedule/events.js +851 -0
- package/dist/src/schedule/events.js.map +1 -0
- package/dist/src/schedule/index.d.ts +150 -0
- package/dist/src/schedule/index.d.ts.map +1 -0
- package/dist/src/schedule/index.js +132 -0
- package/dist/src/schedule/index.js.map +1 -0
- package/dist/src/schedule/library.d.ts +70 -0
- package/dist/src/schedule/library.d.ts.map +1 -0
- package/dist/src/schedule/library.js +102 -0
- package/dist/src/schedule/library.js.map +1 -0
- package/dist/src/schedule/patch.d.ts +74 -0
- package/dist/src/schedule/patch.d.ts.map +1 -0
- package/dist/src/schedule/patch.js +68 -0
- package/dist/src/schedule/patch.js.map +1 -0
- package/dist/src/schedule/record-window.d.ts +189 -0
- package/dist/src/schedule/record-window.d.ts.map +1 -0
- package/dist/src/schedule/record-window.js +95 -0
- package/dist/src/schedule/record-window.js.map +1 -0
- package/dist/src/schedule/resources.d.ts +165 -0
- package/dist/src/schedule/resources.d.ts.map +1 -0
- package/dist/src/schedule/resources.js +234 -0
- package/dist/src/schedule/resources.js.map +1 -0
- package/dist/src/schedule/templates.d.ts +47 -0
- package/dist/src/schedule/templates.d.ts.map +1 -0
- package/dist/src/schedule/templates.js +61 -0
- package/dist/src/schedule/templates.js.map +1 -0
- package/dist/src/schedule/types.d.ts +1677 -0
- package/dist/src/schedule/types.d.ts.map +1 -0
- package/dist/src/schedule/types.js +374 -0
- package/dist/src/schedule/types.js.map +1 -0
- package/dist/src/schedule/window.d.ts +154 -0
- package/dist/src/schedule/window.d.ts.map +1 -0
- package/dist/src/schedule/window.js +363 -0
- package/dist/src/schedule/window.js.map +1 -0
- package/dist/src/sheet/bridge.d.ts +385 -0
- package/dist/src/sheet/bridge.d.ts.map +1 -0
- package/dist/src/sheet/bridge.js +809 -0
- package/dist/src/sheet/bridge.js.map +1 -0
- package/dist/src/sheet/columns.d.ts +410 -0
- package/dist/src/sheet/columns.d.ts.map +1 -0
- package/dist/src/sheet/columns.js +99 -0
- package/dist/src/sheet/columns.js.map +1 -0
- package/dist/src/sheet/context-bridge.d.ts +48 -0
- package/dist/src/sheet/context-bridge.d.ts.map +1 -0
- package/dist/src/sheet/context-bridge.js +216 -0
- package/dist/src/sheet/context-bridge.js.map +1 -0
- package/dist/src/sheet/draft-bridge.d.ts +37 -0
- package/dist/src/sheet/draft-bridge.d.ts.map +1 -0
- package/dist/src/sheet/draft-bridge.js +153 -0
- package/dist/src/sheet/draft-bridge.js.map +1 -0
- package/dist/src/sheet/drafts.d.ts +14 -0
- package/dist/src/sheet/drafts.d.ts.map +1 -0
- package/dist/src/sheet/drafts.js +14 -0
- package/dist/src/sheet/drafts.js.map +1 -0
- package/dist/src/sheet/editing-bridge.d.ts +40 -0
- package/dist/src/sheet/editing-bridge.d.ts.map +1 -0
- package/dist/src/sheet/editing-bridge.js +231 -0
- package/dist/src/sheet/editing-bridge.js.map +1 -0
- package/dist/src/sheet/editing-types.d.ts +268 -0
- package/dist/src/sheet/editing-types.d.ts.map +1 -0
- package/dist/src/sheet/editing-types.js +34 -0
- package/dist/src/sheet/editing-types.js.map +1 -0
- package/dist/src/sheet/edits.d.ts +37 -0
- package/dist/src/sheet/edits.d.ts.map +1 -0
- package/dist/src/sheet/edits.js +31 -0
- package/dist/src/sheet/edits.js.map +1 -0
- package/dist/src/sheet/fields.d.ts +693 -0
- package/dist/src/sheet/fields.d.ts.map +1 -0
- package/dist/src/sheet/fields.js +280 -0
- package/dist/src/sheet/fields.js.map +1 -0
- package/dist/src/sheet/group.d.ts +165 -0
- package/dist/src/sheet/group.d.ts.map +1 -0
- package/dist/src/sheet/group.js +52 -0
- package/dist/src/sheet/group.js.map +1 -0
- package/dist/src/sheet/index.d.ts +542 -0
- package/dist/src/sheet/index.d.ts.map +1 -0
- package/dist/src/sheet/index.js +387 -0
- package/dist/src/sheet/index.js.map +1 -0
- package/dist/src/sheet/library.d.ts +284 -0
- package/dist/src/sheet/library.d.ts.map +1 -0
- package/dist/src/sheet/library.js +259 -0
- package/dist/src/sheet/library.js.map +1 -0
- package/dist/src/sheet/link.d.ts +398 -0
- package/dist/src/sheet/link.d.ts.map +1 -0
- package/dist/src/sheet/link.js +228 -0
- package/dist/src/sheet/link.js.map +1 -0
- package/dist/src/sheet/record.d.ts +75 -0
- package/dist/src/sheet/record.d.ts.map +1 -0
- package/dist/src/sheet/record.js +128 -0
- package/dist/src/sheet/record.js.map +1 -0
- package/dist/src/sheet/registers.d.ts +681 -0
- package/dist/src/sheet/registers.d.ts.map +1 -0
- package/dist/src/sheet/registers.js +671 -0
- package/dist/src/sheet/registers.js.map +1 -0
- package/dist/src/sheet/root.d.ts +329 -0
- package/dist/src/sheet/root.d.ts.map +1 -0
- package/dist/src/sheet/root.js +511 -0
- package/dist/src/sheet/root.js.map +1 -0
- package/dist/src/sheet/seed-bridge.d.ts +14 -0
- package/dist/src/sheet/seed-bridge.d.ts.map +1 -0
- package/dist/src/sheet/seed-bridge.js +51 -0
- package/dist/src/sheet/seed-bridge.js.map +1 -0
- package/dist/src/sheet/sheet.d.ts +11819 -0
- package/dist/src/sheet/sheet.d.ts.map +1 -0
- package/dist/src/sheet/sheet.js +236 -0
- package/dist/src/sheet/sheet.js.map +1 -0
- package/dist/src/sheet/sub-rows.d.ts +299 -0
- package/dist/src/sheet/sub-rows.d.ts.map +1 -0
- package/dist/src/sheet/sub-rows.js +272 -0
- package/dist/src/sheet/sub-rows.js.map +1 -0
- package/dist/src/sheet/templates.d.ts +161 -0
- package/dist/src/sheet/templates.d.ts.map +1 -0
- package/dist/src/sheet/templates.js +122 -0
- package/dist/src/sheet/templates.js.map +1 -0
- package/dist/src/sheet/transactions.d.ts +76 -0
- package/dist/src/sheet/transactions.d.ts.map +1 -0
- package/dist/src/sheet/transactions.js +40 -0
- package/dist/src/sheet/transactions.js.map +1 -0
- package/dist/src/sheet/types.d.ts +15226 -0
- package/dist/src/sheet/types.d.ts.map +1 -0
- package/dist/src/sheet/types.js +1070 -0
- package/dist/src/sheet/types.js.map +1 -0
- package/dist/src/sheet/views.d.ts +29 -0
- package/dist/src/sheet/views.d.ts.map +1 -0
- package/dist/src/sheet/views.js +43 -0
- package/dist/src/sheet/views.js.map +1 -0
- package/dist/src/studio/component.d.ts.map +1 -1
- package/dist/src/studio/component.js +11 -8
- package/dist/src/studio/component.js.map +1 -1
- package/dist/src/utils/derive.d.ts +134 -8
- package/dist/src/utils/derive.d.ts.map +1 -1
- package/dist/src/utils/derive.js +409 -7
- package/dist/src/utils/derive.js.map +1 -1
- package/dist/src/utils/ordered-source.d.ts +38 -0
- package/dist/src/utils/ordered-source.d.ts.map +1 -0
- package/dist/src/utils/ordered-source.js +45 -0
- package/dist/src/utils/ordered-source.js.map +1 -0
- package/dist/src/utils/row-inspector.d.ts +36 -0
- package/dist/src/utils/row-inspector.d.ts.map +1 -0
- package/dist/src/utils/row-inspector.js +49 -0
- package/dist/src/utils/row-inspector.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts +21 -19
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +122 -122
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/bind/record/record.examples.js +9 -9
- package/dist/test/bind/record/record.examples.js.map +1 -1
- package/dist/test/calendar/calendar-records.examples.d.ts +228 -0
- package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar-records.examples.js +91 -0
- package/dist/test/calendar/calendar-records.examples.js.map +1 -0
- package/dist/test/calendar/calendar.examples.d.ts +776 -0
- package/dist/test/calendar/calendar.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar.examples.js +336 -0
- package/dist/test/calendar/calendar.examples.js.map +1 -0
- package/dist/test/decision/journal.examples.d.ts +28 -28
- package/dist/test/decision/journal.examples.d.ts.map +1 -1
- package/dist/test/decision/journal.examples.js +4 -4
- package/dist/test/decision/journal.examples.js.map +1 -1
- package/dist/test/decision/queue.examples.d.ts.map +1 -1
- package/dist/test/decision/queue.examples.js +5 -7
- package/dist/test/decision/queue.examples.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +3713 -0
- package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -0
- package/dist/test/flowchart/flowchart.examples.js +465 -0
- package/dist/test/flowchart/flowchart.examples.js.map +1 -0
- package/dist/test/plan/plan-events.examples.d.ts +3666 -0
- package/dist/test/plan/plan-events.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-events.examples.js +773 -0
- package/dist/test/plan/plan-events.examples.js.map +1 -0
- package/dist/test/plan/plan-records.examples.d.ts +3 -0
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-records.examples.js +45 -0
- package/dist/test/plan/plan-records.examples.js.map +1 -0
- package/dist/test/plan/plan-windows.examples.d.ts +588 -0
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-windows.examples.js +170 -0
- package/dist/test/plan/plan-windows.examples.js.map +1 -0
- package/dist/test/plan/plan.examples.d.ts +8095 -0
- package/dist/test/plan/plan.examples.d.ts.map +1 -0
- package/dist/test/plan/plan.examples.js +2500 -0
- package/dist/test/plan/plan.examples.js.map +1 -0
- package/dist/test/roster/domain.examples.d.ts +367 -0
- package/dist/test/roster/domain.examples.d.ts.map +1 -0
- package/dist/test/roster/domain.examples.js +72 -0
- package/dist/test/roster/domain.examples.js.map +1 -0
- package/dist/test/roster/roster-records.examples.d.ts +729 -0
- package/dist/test/roster/roster-records.examples.d.ts.map +1 -0
- package/dist/test/roster/roster-records.examples.js +86 -0
- package/dist/test/roster/roster-records.examples.js.map +1 -0
- package/dist/test/roster/roster.examples.d.ts +750 -0
- package/dist/test/roster/roster.examples.d.ts.map +1 -0
- package/dist/test/roster/roster.examples.js +198 -0
- package/dist/test/roster/roster.examples.js.map +1 -0
- package/dist/test/roster/warehouse.d.ts +87 -0
- package/dist/test/roster/warehouse.d.ts.map +1 -0
- package/dist/test/roster/warehouse.js +883 -0
- package/dist/test/roster/warehouse.js.map +1 -0
- package/dist/test/sheet/sheet-link.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-link.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-link.examples.js +41 -0
- package/dist/test/sheet/sheet-link.examples.js.map +1 -0
- package/dist/test/sheet/sheet-records.examples.d.ts +421 -0
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-records.examples.js +79 -0
- package/dist/test/sheet/sheet-records.examples.js.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.js +58 -0
- package/dist/test/sheet/sheet-transactions.examples.js.map +1 -0
- package/dist/test/sheet/sheet.examples.d.ts +5562 -0
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet.examples.js +1178 -0
- package/dist/test/sheet/sheet.examples.js.map +1 -0
- package/dist/test/studio/studio.examples.d.ts.map +1 -1
- package/dist/test/studio/studio.examples.js +11 -11
- package/dist/test/studio/studio.examples.js.map +1 -1
- package/package.json +12 -9
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
* `Schedule.patch(R, { … })` (#1195): what a card dropped on an event sets —
|
|
7
|
+
* a patch over an event kind's row type, every field an `Option`, the fields
|
|
8
|
+
* it leaves out `none`. It is built as the Sheet's `Sheet.patch` is. A
|
|
9
|
+
* builder's library tab returns one from its `drop` (`Plan.library.tab`), and
|
|
10
|
+
* the patch's type names the event kind whose events take the drop.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { OptionType, StructType, type ExprType, type SubtypeExprOrValue } from "@elaraai/east";
|
|
15
|
+
/**
|
|
16
|
+
* The TS type of `Schedule.Types.Patch(R)`: every field of `R` as an `Option`.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam R - The event kind's row type
|
|
19
|
+
*/
|
|
20
|
+
export type SchedulePatchOf<R extends StructType> = StructType<{
|
|
21
|
+
[K in keyof R["fields"]]: OptionType<R["fields"][K]>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* The literal-record input of `Schedule.patch(R, …)`: every field of `R`
|
|
25
|
+
* optional, each a literal or an expression of the field's type; a field left
|
|
26
|
+
* out is `none`.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam R - The event kind's row type
|
|
29
|
+
*/
|
|
30
|
+
export type SchedulePatchInput<R extends StructType> = {
|
|
31
|
+
[K in keyof R["fields"]]?: SubtypeExprOrValue<R["fields"][K]>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* `Schedule.Types.Patch(R)`: a patch over an event kind's row type — every
|
|
35
|
+
* field of `R` as an `Option`, `none` leaving the event's field as it is.
|
|
36
|
+
*
|
|
37
|
+
* @typeParam R - The event kind's row type
|
|
38
|
+
* @param rowType - The row type value
|
|
39
|
+
* @returns The patch type
|
|
40
|
+
*/
|
|
41
|
+
export declare function SchedulePatchTypeFor<R extends StructType>(rowType: R): SchedulePatchOf<R>;
|
|
42
|
+
/**
|
|
43
|
+
* Builds a patch over an event kind's row type — `Schedule.patch(R, { … })`:
|
|
44
|
+
* the fields it sets, every other field `none`. A library card's `drop`
|
|
45
|
+
* returns one, the fields a card dropped on an event sets
|
|
46
|
+
* (`Plan.library.tab`).
|
|
47
|
+
*
|
|
48
|
+
* @typeParam R - The event kind's row type
|
|
49
|
+
* @param rowType - The row type value
|
|
50
|
+
* @param record - The fields to set
|
|
51
|
+
* @returns An expression of `Schedule.Types.Patch(R)`
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* import { DateTimeType, DictType, OptionType, StringType, StructType } from "@elaraai/east";
|
|
56
|
+
* import { Plan, Record, Schedule } from "@elaraai/e3-ui";
|
|
57
|
+
* import e3 from "@elaraai/e3";
|
|
58
|
+
*
|
|
59
|
+
* const JobType = StructType({
|
|
60
|
+
* title: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType),
|
|
61
|
+
* press: OptionType(StringType), customer: StringType,
|
|
62
|
+
* });
|
|
63
|
+
* const CustomerType = StructType({ name: StringType, town: StringType });
|
|
64
|
+
* const customers = e3.record("customers", DictType(StringType, CustomerType), new Map());
|
|
65
|
+
*
|
|
66
|
+
* // Inside a Plan's Reactive body: a card per customer, which sets the job it is dropped on.
|
|
67
|
+
* const customerTab = Plan.library.tab(Record.bind(customers, []).read(), {
|
|
68
|
+
* name: "Customers", icon: "building", label: (c) => c.name,
|
|
69
|
+
* drop: (c) => Schedule.patch(JobType, { customer: c.name }),
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function schedulePatch<R extends StructType>(rowType: R, record: SchedulePatchInput<R>): ExprType<SchedulePatchOf<R>>;
|
|
74
|
+
//# sourceMappingURL=patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/schedule/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAQ,UAAU,EAAE,UAAU,EAA6B,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEhI;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI,UAAU,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAAC;AAEzH;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,UAAU,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEzH;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAIzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAO3H"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* `Schedule.patch(R, { … })` (#1195): what a card dropped on an event sets —
|
|
7
|
+
* a patch over an event kind's row type, every field an `Option`, the fields
|
|
8
|
+
* it leaves out `none`. It is built as the Sheet's `Sheet.patch` is. A
|
|
9
|
+
* builder's library tab returns one from its `drop` (`Plan.library.tab`), and
|
|
10
|
+
* the patch's type names the event kind whose events take the drop.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { East, OptionType, StructType, none, some } from "@elaraai/east";
|
|
15
|
+
/**
|
|
16
|
+
* `Schedule.Types.Patch(R)`: a patch over an event kind's row type — every
|
|
17
|
+
* field of `R` as an `Option`, `none` leaving the event's field as it is.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam R - The event kind's row type
|
|
20
|
+
* @param rowType - The row type value
|
|
21
|
+
* @returns The patch type
|
|
22
|
+
*/
|
|
23
|
+
export function SchedulePatchTypeFor(rowType) {
|
|
24
|
+
const fields = {};
|
|
25
|
+
for (const [name, type] of Object.entries(rowType.fields))
|
|
26
|
+
fields[name] = OptionType(type);
|
|
27
|
+
return StructType(fields);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds a patch over an event kind's row type — `Schedule.patch(R, { … })`:
|
|
31
|
+
* the fields it sets, every other field `none`. A library card's `drop`
|
|
32
|
+
* returns one, the fields a card dropped on an event sets
|
|
33
|
+
* (`Plan.library.tab`).
|
|
34
|
+
*
|
|
35
|
+
* @typeParam R - The event kind's row type
|
|
36
|
+
* @param rowType - The row type value
|
|
37
|
+
* @param record - The fields to set
|
|
38
|
+
* @returns An expression of `Schedule.Types.Patch(R)`
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { DateTimeType, DictType, OptionType, StringType, StructType } from "@elaraai/east";
|
|
43
|
+
* import { Plan, Record, Schedule } from "@elaraai/e3-ui";
|
|
44
|
+
* import e3 from "@elaraai/e3";
|
|
45
|
+
*
|
|
46
|
+
* const JobType = StructType({
|
|
47
|
+
* title: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType),
|
|
48
|
+
* press: OptionType(StringType), customer: StringType,
|
|
49
|
+
* });
|
|
50
|
+
* const CustomerType = StructType({ name: StringType, town: StringType });
|
|
51
|
+
* const customers = e3.record("customers", DictType(StringType, CustomerType), new Map());
|
|
52
|
+
*
|
|
53
|
+
* // Inside a Plan's Reactive body: a card per customer, which sets the job it is dropped on.
|
|
54
|
+
* const customerTab = Plan.library.tab(Record.bind(customers, []).read(), {
|
|
55
|
+
* name: "Customers", icon: "building", label: (c) => c.name,
|
|
56
|
+
* drop: (c) => Schedule.patch(JobType, { customer: c.name }),
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function schedulePatch(rowType, record) {
|
|
61
|
+
const fields = {};
|
|
62
|
+
const given = record;
|
|
63
|
+
for (const name of Object.keys(rowType.fields)) {
|
|
64
|
+
fields[name] = given[name] !== undefined ? some(given[name]) : none;
|
|
65
|
+
}
|
|
66
|
+
return East.value(fields, SchedulePatchTypeFor(rowType));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/schedule/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAyD,MAAM,eAAe,CAAC;AAkBhI;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAuB,OAAU;IACjE,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAkC,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACvH,OAAO,UAAU,CAAC,MAAM,CAAkC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,aAAa,CAAuB,OAAU,EAAE,MAA6B;IACzF,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAiC,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAkC,CAAC,EAAE,CAAC;QACzE,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxG,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAiC,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
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
|
+
/** Schedule's typed adapter to record Slice's indexed queries. */
|
|
6
|
+
import { ArrayType, DateTimeType, DictType, FunctionType, IntegerType, OptionType, StringType, StructType, type EastType, type ExprType, type SubtypeExprOrValue } from "@elaraai/east";
|
|
7
|
+
/** Minimal typed query reader; additional index-entry fields remain opaque. */
|
|
8
|
+
export declare function ScheduleRecordSliceType<K extends EastType, R extends EastType>(key: K, row: R): StructType<{
|
|
9
|
+
readonly data: StructType<{
|
|
10
|
+
readonly id: StringType;
|
|
11
|
+
readonly revision: FunctionType<[], OptionType<StringType>>;
|
|
12
|
+
}>;
|
|
13
|
+
readonly pageWhere: FunctionType<[DictType<StringType, import("@elaraai/east").VariantType<{
|
|
14
|
+
readonly values: ArrayType<StringType>;
|
|
15
|
+
readonly range: StructType<{
|
|
16
|
+
readonly from: StringType;
|
|
17
|
+
readonly to: StringType;
|
|
18
|
+
}>;
|
|
19
|
+
readonly prefix: StringType;
|
|
20
|
+
}>>, IntegerType, IntegerType], OptionType<ArrayType<StructType<{
|
|
21
|
+
readonly key: K;
|
|
22
|
+
readonly row: OptionType<R>;
|
|
23
|
+
}>>>>;
|
|
24
|
+
readonly key: StringType;
|
|
25
|
+
readonly config: StructType<{
|
|
26
|
+
readonly fields: ArrayType<StructType<{
|
|
27
|
+
readonly fieldId: StringType;
|
|
28
|
+
readonly label: StringType;
|
|
29
|
+
readonly kind: StringType;
|
|
30
|
+
readonly optional: import("@elaraai/east").BooleanType;
|
|
31
|
+
readonly multiple: import("@elaraai/east").BooleanType;
|
|
32
|
+
readonly set: import("@elaraai/east").BooleanType;
|
|
33
|
+
readonly values: ArrayType<StructType<{
|
|
34
|
+
readonly value: StringType;
|
|
35
|
+
readonly label: StringType;
|
|
36
|
+
}>>;
|
|
37
|
+
readonly format: OptionType<import("@elaraai/east").VariantType<{
|
|
38
|
+
readonly number: import("@elaraai/east").NullType;
|
|
39
|
+
readonly currency: StructType<{
|
|
40
|
+
readonly code: StringType;
|
|
41
|
+
readonly compact: import("@elaraai/east").BooleanType;
|
|
42
|
+
}>;
|
|
43
|
+
readonly percent: import("@elaraai/east").NullType;
|
|
44
|
+
readonly compact: import("@elaraai/east").NullType;
|
|
45
|
+
readonly date: StringType;
|
|
46
|
+
readonly time: StringType;
|
|
47
|
+
readonly datetime: StringType;
|
|
48
|
+
}>>;
|
|
49
|
+
}>>;
|
|
50
|
+
readonly indexes: ArrayType<StructType<{
|
|
51
|
+
readonly name: StringType;
|
|
52
|
+
readonly fields: ArrayType<StringType>;
|
|
53
|
+
readonly sets: import("@elaraai/east").SetType<StringType>;
|
|
54
|
+
readonly structured: import("@elaraai/east").BooleanType;
|
|
55
|
+
readonly interval: OptionType<StructType<{
|
|
56
|
+
readonly from: StringType;
|
|
57
|
+
readonly to: StringType;
|
|
58
|
+
readonly optional: import("@elaraai/east").BooleanType;
|
|
59
|
+
}>>;
|
|
60
|
+
}>>;
|
|
61
|
+
readonly range: OptionType<StringType>;
|
|
62
|
+
readonly search: ArrayType<StringType>;
|
|
63
|
+
readonly presets: ArrayType<StructType<{
|
|
64
|
+
readonly id: StringType;
|
|
65
|
+
readonly name: StringType;
|
|
66
|
+
readonly where: DictType<StringType, import("@elaraai/east").VariantType<{
|
|
67
|
+
readonly values: ArrayType<StringType>;
|
|
68
|
+
readonly range: StructType<{
|
|
69
|
+
readonly from: StringType;
|
|
70
|
+
readonly to: StringType;
|
|
71
|
+
}>;
|
|
72
|
+
readonly prefix: StringType;
|
|
73
|
+
}>>;
|
|
74
|
+
}>>;
|
|
75
|
+
}>;
|
|
76
|
+
readonly read: FunctionType<[], StructType<{
|
|
77
|
+
readonly where: DictType<StringType, import("@elaraai/east").VariantType<{
|
|
78
|
+
readonly values: ArrayType<StringType>;
|
|
79
|
+
readonly range: StructType<{
|
|
80
|
+
readonly from: StringType;
|
|
81
|
+
readonly to: StringType;
|
|
82
|
+
}>;
|
|
83
|
+
readonly prefix: StringType;
|
|
84
|
+
}>>;
|
|
85
|
+
readonly preset: OptionType<StringType>;
|
|
86
|
+
readonly resolution: OptionType<import("@elaraai/east").VariantType<{
|
|
87
|
+
readonly auto: import("@elaraai/east").NullType;
|
|
88
|
+
readonly hour: import("@elaraai/east").NullType;
|
|
89
|
+
readonly day: import("@elaraai/east").NullType;
|
|
90
|
+
readonly week: import("@elaraai/east").NullType;
|
|
91
|
+
readonly month: import("@elaraai/east").NullType;
|
|
92
|
+
readonly quarter: import("@elaraai/east").NullType;
|
|
93
|
+
readonly year: import("@elaraai/east").NullType;
|
|
94
|
+
}>>;
|
|
95
|
+
}>>;
|
|
96
|
+
readonly write: FunctionType<[StructType<{
|
|
97
|
+
readonly where: DictType<StringType, import("@elaraai/east").VariantType<{
|
|
98
|
+
readonly values: ArrayType<StringType>;
|
|
99
|
+
readonly range: StructType<{
|
|
100
|
+
readonly from: StringType;
|
|
101
|
+
readonly to: StringType;
|
|
102
|
+
}>;
|
|
103
|
+
readonly prefix: StringType;
|
|
104
|
+
}>>;
|
|
105
|
+
readonly preset: OptionType<StringType>;
|
|
106
|
+
readonly resolution: OptionType<import("@elaraai/east").VariantType<{
|
|
107
|
+
readonly auto: import("@elaraai/east").NullType;
|
|
108
|
+
readonly hour: import("@elaraai/east").NullType;
|
|
109
|
+
readonly day: import("@elaraai/east").NullType;
|
|
110
|
+
readonly week: import("@elaraai/east").NullType;
|
|
111
|
+
readonly month: import("@elaraai/east").NullType;
|
|
112
|
+
readonly quarter: import("@elaraai/east").NullType;
|
|
113
|
+
readonly year: import("@elaraai/east").NullType;
|
|
114
|
+
}>>;
|
|
115
|
+
}>], import("@elaraai/east").NullType>;
|
|
116
|
+
readonly choose: FunctionType<[StringType, ArrayType<StringType>], import("@elaraai/east").NullType>;
|
|
117
|
+
readonly range: FunctionType<[StringType, StringType, StringType], import("@elaraai/east").NullType>;
|
|
118
|
+
readonly prefix: FunctionType<[StringType, StringType], import("@elaraai/east").NullType>;
|
|
119
|
+
readonly clear: FunctionType<[StringType], import("@elaraai/east").NullType>;
|
|
120
|
+
readonly clearAll: FunctionType<[], import("@elaraai/east").NullType>;
|
|
121
|
+
readonly count: FunctionType<[], OptionType<IntegerType>>;
|
|
122
|
+
readonly countWhere: FunctionType<[DictType<StringType, import("@elaraai/east").VariantType<{
|
|
123
|
+
readonly values: ArrayType<StringType>;
|
|
124
|
+
readonly range: StructType<{
|
|
125
|
+
readonly from: StringType;
|
|
126
|
+
readonly to: StringType;
|
|
127
|
+
}>;
|
|
128
|
+
readonly prefix: StringType;
|
|
129
|
+
}>>], OptionType<IntegerType>>;
|
|
130
|
+
readonly total: FunctionType<[], OptionType<IntegerType>>;
|
|
131
|
+
readonly domain: FunctionType<[StringType], OptionType<StructType<{
|
|
132
|
+
readonly from: StringType;
|
|
133
|
+
readonly to: StringType;
|
|
134
|
+
}>>>;
|
|
135
|
+
readonly values: FunctionType<[StringType], ArrayType<StructType<{
|
|
136
|
+
readonly value: StringType;
|
|
137
|
+
readonly label: StringType;
|
|
138
|
+
readonly count: OptionType<IntegerType>;
|
|
139
|
+
readonly selected: import("@elaraai/east").BooleanType;
|
|
140
|
+
readonly error: OptionType<StringType>;
|
|
141
|
+
}>>>;
|
|
142
|
+
readonly suggest: FunctionType<[StringType, StringType], OptionType<ArrayType<StructType<{
|
|
143
|
+
readonly value: StringType;
|
|
144
|
+
readonly label: StringType;
|
|
145
|
+
readonly count: OptionType<IntegerType>;
|
|
146
|
+
readonly selected: import("@elaraai/east").BooleanType;
|
|
147
|
+
readonly error: OptionType<StringType>;
|
|
148
|
+
}>>>>;
|
|
149
|
+
readonly replaces: FunctionType<[StringType], ArrayType<StringType>>;
|
|
150
|
+
readonly togglePreset: FunctionType<[StringType], import("@elaraai/east").NullType>;
|
|
151
|
+
readonly setResolution: FunctionType<[OptionType<import("@elaraai/east").VariantType<{
|
|
152
|
+
readonly auto: import("@elaraai/east").NullType;
|
|
153
|
+
readonly hour: import("@elaraai/east").NullType;
|
|
154
|
+
readonly day: import("@elaraai/east").NullType;
|
|
155
|
+
readonly week: import("@elaraai/east").NullType;
|
|
156
|
+
readonly month: import("@elaraai/east").NullType;
|
|
157
|
+
readonly quarter: import("@elaraai/east").NullType;
|
|
158
|
+
readonly year: import("@elaraai/east").NullType;
|
|
159
|
+
}>>], import("@elaraai/east").NullType>;
|
|
160
|
+
readonly retry: FunctionType<[], import("@elaraai/east").NullType>;
|
|
161
|
+
readonly sourceId: StringType;
|
|
162
|
+
readonly readEntry: FunctionType<[StringType], OptionType<OptionType<import("@elaraai/east").BlobType>>>;
|
|
163
|
+
readonly contains: FunctionType<[DictType<StringType, import("@elaraai/east").VariantType<{
|
|
164
|
+
readonly values: ArrayType<StringType>;
|
|
165
|
+
readonly range: StructType<{
|
|
166
|
+
readonly from: StringType;
|
|
167
|
+
readonly to: StringType;
|
|
168
|
+
}>;
|
|
169
|
+
readonly prefix: StringType;
|
|
170
|
+
}>>, StringType], OptionType<import("@elaraai/east").BooleanType>>;
|
|
171
|
+
}>;
|
|
172
|
+
/** A record Slice over the event record's original key and row types. */
|
|
173
|
+
export type ScheduleRecordSlice<K extends EastType, R extends EastType> = SubtypeExprOrValue<ReturnType<typeof ScheduleRecordSliceType<K, R>>>;
|
|
174
|
+
/**
|
|
175
|
+
* Read a visible interval or backlog through the same declared Slice paths.
|
|
176
|
+
* This reads only the chosen result, in bounded pages. Index bounds own all
|
|
177
|
+
* membership and distinct counts; no row predicate implements narrowing.
|
|
178
|
+
* @param input - The author's typed Slice handle.
|
|
179
|
+
* @param key - Original record key type.
|
|
180
|
+
* @param row - Record row type.
|
|
181
|
+
* @param start - Interval start field.
|
|
182
|
+
* @param end - Interval end field (the same field for an instant).
|
|
183
|
+
* @param optional - Whether the time fields admit backlog rows.
|
|
184
|
+
* @param backlog - Read Unset starts instead of a scheduled interval.
|
|
185
|
+
* @param label - Kind name used by authoring errors.
|
|
186
|
+
* @returns A window reader compatible with the existing Schedule seams.
|
|
187
|
+
*/
|
|
188
|
+
export declare function scheduleRecordWindow(input: unknown, key: EastType, row: EastType, start: string, end: string, optional: boolean, backlog: boolean, label: string): ExprType<FunctionType<[DateTimeType, DateTimeType], OptionType<DictType<EastType, EastType>>>>;
|
|
189
|
+
//# sourceMappingURL=record-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-window.d.ts","sourceRoot":"","sources":["../../../src/schedule/record-window.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kEAAkE;AAClE,OAAO,EACH,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAc,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC/D,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EACrG,MAAM,eAAe,CAAC;AAGvB,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7F;AACD,yEAAyE;AACzE,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,IAAI,kBAAkB,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/I;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EACzG,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAgEtJ"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
/** Schedule's typed adapter to record Slice's indexed queries. */
|
|
6
|
+
import { ArrayType, DateTimeType, DictType, East, Expr, FunctionType, IntegerType, OptionType, StringType, StructType, isSubtype, isTypeEqual, none, some, variant, } from "@elaraai/east";
|
|
7
|
+
import { RecordSliceBindType, RecordSliceChoiceType, RecordSliceWhereType, recordSliceReadPlatform } from "@elaraai/east-ui/internal";
|
|
8
|
+
/** Minimal typed query reader; additional index-entry fields remain opaque. */
|
|
9
|
+
export function ScheduleRecordSliceType(key, row) {
|
|
10
|
+
return StructType({ ...RecordSliceBindType.fields,
|
|
11
|
+
data: StructType({ id: StringType, revision: FunctionType([], OptionType(StringType)) }),
|
|
12
|
+
pageWhere: FunctionType([RecordSliceWhereType, IntegerType, IntegerType], OptionType(ArrayType(StructType({ key, row: OptionType(row) })))),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Read a visible interval or backlog through the same declared Slice paths.
|
|
17
|
+
* This reads only the chosen result, in bounded pages. Index bounds own all
|
|
18
|
+
* membership and distinct counts; no row predicate implements narrowing.
|
|
19
|
+
* @param input - The author's typed Slice handle.
|
|
20
|
+
* @param key - Original record key type.
|
|
21
|
+
* @param row - Record row type.
|
|
22
|
+
* @param start - Interval start field.
|
|
23
|
+
* @param end - Interval end field (the same field for an instant).
|
|
24
|
+
* @param optional - Whether the time fields admit backlog rows.
|
|
25
|
+
* @param backlog - Read Unset starts instead of a scheduled interval.
|
|
26
|
+
* @param label - Kind name used by authoring errors.
|
|
27
|
+
* @returns A window reader compatible with the existing Schedule seams.
|
|
28
|
+
*/
|
|
29
|
+
export function scheduleRecordWindow(input, key, row, start, end, optional, backlog, label) {
|
|
30
|
+
const value = East.value(input);
|
|
31
|
+
const Type = ScheduleRecordSliceType(key, row);
|
|
32
|
+
const type = Expr.type(value);
|
|
33
|
+
const fields = type.type === "Struct" ? type.fields : {};
|
|
34
|
+
const data = fields.data;
|
|
35
|
+
const page = fields.pageWhere;
|
|
36
|
+
const output = page?.type === "Function" ? page.output : undefined;
|
|
37
|
+
const collection = output?.type === "Variant" ? output.cases.some : undefined;
|
|
38
|
+
const entry = collection?.type === "Array" ? collection.value : undefined;
|
|
39
|
+
const fits = page?.type === "Function" && page.inputs.length === Type.fields.pageWhere.inputs.length
|
|
40
|
+
&& page.inputs.every((input, i) => isTypeEqual(input, Type.fields.pageWhere.inputs[i]))
|
|
41
|
+
&& entry?.type === "Struct" && entry.fields.key !== undefined && entry.fields.row !== undefined
|
|
42
|
+
&& isTypeEqual(entry.fields.key, key) && isTypeEqual(entry.fields.row, OptionType(row))
|
|
43
|
+
&& data?.type === "Struct"
|
|
44
|
+
&& Object.entries(Type.fields.data.fields).every(([name, expected]) => data.fields[name] !== undefined && isSubtype(data.fields[name], expected))
|
|
45
|
+
&& Object.entries(RecordSliceBindType.fields).every(([name, expected]) => fields[name] !== undefined && isSubtype(fields[name], expected));
|
|
46
|
+
if (!fits)
|
|
47
|
+
throw new Error(`${label}: slice must be Slice.bindRecord over this event record with joined rows`);
|
|
48
|
+
const source = value;
|
|
49
|
+
const Held = DictType(key, row);
|
|
50
|
+
return East.function([DateTimeType, DateTimeType], OptionType(Held), ($, from, to) => {
|
|
51
|
+
const src = $.const(source);
|
|
52
|
+
$.if(src.config.range.match({ none: () => true, some: (_$2, field) => field.notEqual(start) }), $2 => {
|
|
53
|
+
$2.error(`${label}: set the record Slice range to '${start}' so navigation and filters share one window`);
|
|
54
|
+
});
|
|
55
|
+
const supported = $.let(false);
|
|
56
|
+
$.for(src.config.indexes, ($2, index) => {
|
|
57
|
+
$2.match(index.interval, { some: ($3, interval) => {
|
|
58
|
+
$3.if(interval.from.equal(start).and(() => interval.to.equal(end)), $4 => { $4.assign(supported, true); });
|
|
59
|
+
} });
|
|
60
|
+
});
|
|
61
|
+
$.if(supported.not(), $2 => { $2.error(`${label}: declare an interval index for ${start} and ${end} to preserve overlapping events`); });
|
|
62
|
+
const where = $.let(new Map(), RecordSliceWhereType);
|
|
63
|
+
const state = $.const(src.read());
|
|
64
|
+
$.for(state.where, ($2, choice, field) => {
|
|
65
|
+
$2.if(field.notEqual(start), $3 => { $3(where.insert(field, choice)); });
|
|
66
|
+
});
|
|
67
|
+
const time = $.let(backlog ? variant("values", [East.print(East.value(none, OptionType(DateTimeType)))])
|
|
68
|
+
: variant("range", { from: East.print(optional ? East.value(some(from), OptionType(DateTimeType)) : from),
|
|
69
|
+
to: East.print(optional ? East.value(some(to), OptionType(DateTimeType)) : to) }), RecordSliceChoiceType);
|
|
70
|
+
if (!backlog) {
|
|
71
|
+
$.match(state.where.tryGet(start), { some: ($2, choice) => {
|
|
72
|
+
$2.match(choice, { values: ($3, values) => { $3.assign(time, variant("values", values)); } });
|
|
73
|
+
} });
|
|
74
|
+
}
|
|
75
|
+
$(where.insert(start, time));
|
|
76
|
+
const result = $.let(none, OptionType(Held));
|
|
77
|
+
// Preserve the actual window's wire type (including its index key and
|
|
78
|
+
// covering value); only the two validated entry fields are inspected.
|
|
79
|
+
const Entries = collection;
|
|
80
|
+
$.match(recordSliceReadPlatform([Entries], src.data.id, src.data.revision, src.countWhere, src.pageWhere, where), {
|
|
81
|
+
some: ($2, entries) => {
|
|
82
|
+
const held = $2.let(new Map(), Held);
|
|
83
|
+
$2.for(entries, ($3, entry) => {
|
|
84
|
+
$3.match(entry.row, {
|
|
85
|
+
none: $4 => { $4.error(`${label}: slice requires Data.bindPaged with join: true`); },
|
|
86
|
+
some: ($4, value) => { $4(held.insert(entry.key, value)); },
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
$2.assign(result, some(held));
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=record-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-window.js","sourceRoot":"","sources":["../../../src/schedule/record-window.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kEAAkE;AAClE,OAAO,EACH,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC5G,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAC9C,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEtI,+EAA+E;AAC/E,MAAM,UAAU,uBAAuB,CAAyC,GAAM,EAAE,GAAM;IAC1F,OAAO,UAAU,CAAC,EAAE,GAAG,mBAAmB,CAAC,MAAM;QAC7C,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACxF,SAAS,EAAE,YAAY,CAAC,CAAC,oBAAoB,EAAE,WAAW,EAAE,WAAW,CAAC,EACpE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACxE,CAAC,CAAC;AACP,CA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AAE,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAY,EAAE,KAAc,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChF,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;gBACH,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAClC,CAAC;SACJ,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC,CAA8G,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
* `Schedule.resources(source, config)` (#1218, `Calendar Spec.md` §4.2): one
|
|
7
|
+
* resource kind — people, presses, sites — read from any `Dict<K, R>`, usually
|
|
8
|
+
* a record's `read()`, or a window at a time from a paged read of one. A
|
|
9
|
+
* schedule never writes them: their keys are what an event's resource field
|
|
10
|
+
* holds.
|
|
11
|
+
*
|
|
12
|
+
* Plan's options sit beside the Calendar's (#1190, `Plan Builder Spec.md`
|
|
13
|
+
* §4.2): the group strip a resource sits under, the resource of its kind it
|
|
14
|
+
* nests under, its gutter (sub line, value slot and status dot), how a
|
|
15
|
+
* parent's bands roll up and whether it starts folded, and the read-only
|
|
16
|
+
* series under each resource (`measures`). The Calendar takes no notice of
|
|
17
|
+
* them: `build(slot)` is its kind, and `buildPlan(slot)` Plan's.
|
|
18
|
+
*
|
|
19
|
+
* A kind given its resources as a paged read — `Data.bindPaged(record)`, told
|
|
20
|
+
* from a `Dict` by its East type, as the Plan's `data` is (#1199, PB55) — is
|
|
21
|
+
* paged on a Plan as a paged canvas pages its blocks: its rows come a window
|
|
22
|
+
* of resources at a time as the canvas scrolls, the key search seeks a
|
|
23
|
+
* resource by its key, and one resource is read by its key — its name where an
|
|
24
|
+
* event names it — so its resources are never read whole, and the kind on the
|
|
25
|
+
* wire lists none. A window comes in the resources' key order, so a group
|
|
26
|
+
* strip or a parent, which gather resources from anywhere in it, are refused
|
|
27
|
+
* beside one, and the keys are Strings, as the canvas seeks them. The Calendar
|
|
28
|
+
* reads a kind's resources whole, and refuses a paged one.
|
|
29
|
+
*
|
|
30
|
+
* @packageDocumentation
|
|
31
|
+
*/
|
|
32
|
+
import { BooleanType, DictType, FunctionType, OptionType, StringType, type EastType, type ExprType, type SubtypeExprOrValue } from "@elaraai/east";
|
|
33
|
+
import { StatusValueType } from "@elaraai/east-ui";
|
|
34
|
+
import type { PagedValue } from "../bind/data.js";
|
|
35
|
+
import { type PlanSeriesValue } from "../plan/series.js";
|
|
36
|
+
import { PlanRollupType, type PlanAxisKindLiteral, type PlanRollupLiteral } from "../plan/types.js";
|
|
37
|
+
import { PlanResourceRowType, PlanResourcesType, ScheduleResourcesType } from "./types.js";
|
|
38
|
+
/** The key a schedule's definitions carry their sort under. */
|
|
39
|
+
export declare const SCHEDULE_DEF: unique symbol;
|
|
40
|
+
/**
|
|
41
|
+
* How a resource kind shows.
|
|
42
|
+
*
|
|
43
|
+
* @typeParam K - The kind's key type
|
|
44
|
+
* @typeParam R - Its row type
|
|
45
|
+
*/
|
|
46
|
+
export interface ScheduleResourcesConfig<K extends EastType, R extends EastType> {
|
|
47
|
+
/** The kind's name: its column and row headers, the timeline's group, the filter. */
|
|
48
|
+
name: string;
|
|
49
|
+
/** Its Font Awesome icon. */
|
|
50
|
+
icon: string;
|
|
51
|
+
/** A resource's name. */
|
|
52
|
+
label: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<StringType>;
|
|
53
|
+
/** A resource's second line. */
|
|
54
|
+
meta?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<OptionType<StringType>>;
|
|
55
|
+
/** Plan: the group strip a resource sits under (a hall), which the grain folds to its summary. */
|
|
56
|
+
group?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<StringType>;
|
|
57
|
+
/** Plan: the key's text of the resource of its kind it nests under, whose bands roll its events up; `none` at the top. */
|
|
58
|
+
parent?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<OptionType<StringType>>;
|
|
59
|
+
/** Plan: the gutter's sub line. */
|
|
60
|
+
sub?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<OptionType<StringType>>;
|
|
61
|
+
/** Plan: the gutter's value slot. */
|
|
62
|
+
value?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<OptionType<StringType>>;
|
|
63
|
+
/** Plan: the gutter's status dot. */
|
|
64
|
+
status?: (row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<OptionType<StatusValueType>>;
|
|
65
|
+
/** Plan: how a parent's bands roll its children's events up, as `Plan.series.span`'s (`"union"`, the default). */
|
|
66
|
+
rollup?: SubtypeExprOrValue<PlanRollupType> | PlanRollupLiteral;
|
|
67
|
+
/** Plan: whether a resource with resources under it starts folded — a constant, or per resource. */
|
|
68
|
+
collapsed?: boolean | ((row: ExprType<R>, key: ExprType<K>) => SubtypeExprOrValue<BooleanType>);
|
|
69
|
+
/** Plan: the read-only rows under each resource, in order — `Plan.series.heat`, `table` or `chart` over the resources' rows. */
|
|
70
|
+
measures?: readonly PlanSeriesValue<PlanAxisKindLiteral>[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A resource kind, declared: what a builder's `resources` takes, by slot.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam K - The kind's key type
|
|
76
|
+
* @typeParam R - Its row type
|
|
77
|
+
*/
|
|
78
|
+
export interface ScheduleResourceKind<K extends EastType, R extends EastType> {
|
|
79
|
+
/** What it is. */
|
|
80
|
+
readonly [SCHEDULE_DEF]: "resources";
|
|
81
|
+
/** The kind's key type: what an event's resource field must hold. */
|
|
82
|
+
readonly keyType: K;
|
|
83
|
+
/** Its row type. */
|
|
84
|
+
readonly rowType: R;
|
|
85
|
+
/** Its name. */
|
|
86
|
+
readonly name: string;
|
|
87
|
+
/** Its Font Awesome icon: what a builder's library lists the kind with (#1195). */
|
|
88
|
+
readonly icon: string;
|
|
89
|
+
/** Plan: the read-only series under each resource, in order. */
|
|
90
|
+
readonly measures: readonly PlanSeriesValue<PlanAxisKindLiteral>[];
|
|
91
|
+
/** Plan: the paged read of the resources, its rows a window at a time (#1199); `undefined` when they are read whole. */
|
|
92
|
+
readonly window: ExprType<EastType> | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Plan: the resources as the kind was given them, a `Dict` of `rowType` by
|
|
95
|
+
* `keyType` — read again where a Plan draws them (#1192); `undefined` for a
|
|
96
|
+
* kind paged a window at a time (#1199), whose resources are never read
|
|
97
|
+
* whole. Its type is erased, as `window`'s is, so a kind of any rows is one
|
|
98
|
+
* of any other.
|
|
99
|
+
*/
|
|
100
|
+
readonly source: ExprType<DictType<EastType, EastType>> | undefined;
|
|
101
|
+
/** Plan: one resource as Plan's builder takes it, from its row and key: its label, group, parent and gutter. Erased, as `source` is. */
|
|
102
|
+
readonly planRow: ExprType<FunctionType<[EastType, EastType], PlanResourceRowType>>;
|
|
103
|
+
/** Plan: whether the kind's resources sit under group strips (`group`). */
|
|
104
|
+
readonly grouped: boolean;
|
|
105
|
+
/** Plan: whether a resource may nest under another of its kind (`parent`). */
|
|
106
|
+
readonly nested: boolean;
|
|
107
|
+
/** Plan: how a parent's bands roll its children's events up. */
|
|
108
|
+
readonly rollup: ExprType<PlanRollupType>;
|
|
109
|
+
/**
|
|
110
|
+
* The kind on the wire, under its slot: the Calendar's.
|
|
111
|
+
*
|
|
112
|
+
* @param slot - The builder's slot name for it
|
|
113
|
+
* @returns The kind, its rows resolved
|
|
114
|
+
* @throws {Error} For a kind paged a window at a time (#1199): the Calendar reads its resources whole
|
|
115
|
+
*/
|
|
116
|
+
build(slot: string): ExprType<ScheduleResourcesType>;
|
|
117
|
+
/**
|
|
118
|
+
* The kind on the wire as Plan's builder takes it, under its slot.
|
|
119
|
+
*
|
|
120
|
+
* @param slot - The builder's slot name for it
|
|
121
|
+
* @returns The kind, its rows resolved with their groups, parents and gutters
|
|
122
|
+
*/
|
|
123
|
+
buildPlan(slot: string): ExprType<PlanResourcesType>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Declares a resource kind (see the module docs).
|
|
127
|
+
*
|
|
128
|
+
* @typeParam K - The kind's key type
|
|
129
|
+
* @typeParam R - Its row type
|
|
130
|
+
* @param rows - The resources, keyed: usually a record's `read()`
|
|
131
|
+
* @param config - Its name, its icon, each resource's label and second line, and Plan's options
|
|
132
|
+
* @returns The kind, for a builder's `resources`
|
|
133
|
+
* @throws {Error} When `rows` is not a `Dict`, or a paged read of one (#1199) keyed by anything but a String or
|
|
134
|
+
* beside `group` or `parent`; a `window`, which is gone; a `rollup` that is not a way to roll up; and a measure that
|
|
135
|
+
* is not a `Plan.series.heat`, `table` or `chart` over the resources' rows written in place, that nests, or whose
|
|
136
|
+
* key another measure has
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* import { DictType, East, StringType, StructType, some } from "@elaraai/east";
|
|
140
|
+
* import { Reactive, UIComponentType } from "@elaraai/east-ui";
|
|
141
|
+
* import { Calendar, Record, Schedule } from "@elaraai/e3-ui";
|
|
142
|
+
* import e3 from "@elaraai/e3";
|
|
143
|
+
*
|
|
144
|
+
* const PressType = StructType({ name: StringType, hall: StringType });
|
|
145
|
+
* const presses = e3.record("presses", DictType(StringType, PressType), new Map());
|
|
146
|
+
*
|
|
147
|
+
* // Inside a builder's Reactive body: a row per press, its hall under its name.
|
|
148
|
+
* const press = Schedule.resources(Record.bind(presses, []).read(), {
|
|
149
|
+
* name: "Presses", icon: "print", label: (p) => p.name, meta: (p) => some(p.hall),
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export declare function scheduleResources<K extends EastType, R extends EastType>(rows: ExprType<DictType<K, R>>, config: ScheduleResourcesConfig<K, R>): ScheduleResourceKind<K, R>;
|
|
154
|
+
/**
|
|
155
|
+
* Declares a resource kind paged a window at a time (#1199, see the module
|
|
156
|
+
* docs): its resources a paged read of their record, keyed by String.
|
|
157
|
+
*
|
|
158
|
+
* @typeParam R - Its row type
|
|
159
|
+
* @param rows - The resources, a window at a time: `Data.bindPaged(record)`
|
|
160
|
+
* @param config - Its name, its icon, each resource's label and second line, and Plan's options but `group` and `parent`
|
|
161
|
+
* @returns The kind, for a builder's `resources`
|
|
162
|
+
* @throws {Error} As the whole form does, naming the paged read
|
|
163
|
+
*/
|
|
164
|
+
export declare function scheduleResources<R extends EastType>(rows: PagedValue<DictType<StringType, R>>, config: ScheduleResourcesConfig<StringType, R>): ScheduleResourceKind<StringType, R>;
|
|
165
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/schedule/resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACQ,WAAW,EAAE,QAAQ,EAAQ,YAAY,EAAE,UAAU,EAAE,UAAU,EAC5E,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EACxD,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAA2B,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGpH,+DAA+D;AAC/D,eAAO,MA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