@cratis/scene.blueprint.bookings 0.0.0-stage → 4.71.0
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/README.md +66 -2
- package/blueprint.ts +16 -0
- package/blueprintCatalog.json +123 -0
- package/bookingsApplication.ts +28 -0
- package/bookingsParts.ts +58 -0
- package/bookingsQueries.ts +60 -0
- package/bookingsScreenSet.ts +22 -0
- package/dist/cjs/blueprint.js +19 -0
- package/dist/cjs/blueprint.js.map +1 -0
- package/dist/cjs/bookingsApplication.js +49 -0
- package/dist/cjs/bookingsApplication.js.map +1 -0
- package/dist/cjs/bookingsParts.js +151 -0
- package/dist/cjs/bookingsParts.js.map +1 -0
- package/dist/cjs/bookingsQueries.js +68 -0
- package/dist/cjs/bookingsQueries.js.map +1 -0
- package/dist/cjs/bookingsScreenSet.js +47 -0
- package/dist/cjs/bookingsScreenSet.js.map +1 -0
- package/dist/cjs/index.js +69 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/manifest.js +90 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/navigation.js +117 -0
- package/dist/cjs/navigation.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/packageName.js +8 -0
- package/dist/cjs/packageName.js.map +1 -0
- package/dist/cjs/screens/index.js +22 -0
- package/dist/cjs/screens/index.js.map +1 -0
- package/dist/cjs/templateProvenance.js +24 -0
- package/dist/cjs/templateProvenance.js.map +1 -0
- package/dist/cjs/templates/calendarTemplate.js +109 -0
- package/dist/cjs/templates/calendarTemplate.js.map +1 -0
- package/dist/cjs/templates/formTemplates.js +50 -0
- package/dist/cjs/templates/formTemplates.js.map +1 -0
- package/dist/cjs/templates/index.js +27 -0
- package/dist/cjs/templates/index.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +167 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/recordTemplates.js +129 -0
- package/dist/cjs/templates/recordTemplates.js.map +1 -0
- package/dist/cjs/templates/wizardTemplate.js +73 -0
- package/dist/cjs/templates/wizardTemplate.js.map +1 -0
- package/dist/esm/blueprint.d.ts +3 -0
- package/dist/esm/blueprint.d.ts.map +1 -0
- package/dist/esm/blueprint.js +17 -0
- package/dist/esm/blueprint.js.map +1 -0
- package/dist/esm/bookingsApplication.d.ts +10 -0
- package/dist/esm/bookingsApplication.d.ts.map +1 -0
- package/dist/esm/bookingsApplication.js +44 -0
- package/dist/esm/bookingsApplication.js.map +1 -0
- package/dist/esm/bookingsParts.d.ts +16 -0
- package/dist/esm/bookingsParts.d.ts.map +1 -0
- package/dist/esm/bookingsParts.js +133 -0
- package/dist/esm/bookingsParts.js.map +1 -0
- package/dist/esm/bookingsQueries.d.ts +41 -0
- package/dist/esm/bookingsQueries.d.ts.map +1 -0
- package/dist/esm/bookingsQueries.js +60 -0
- package/dist/esm/bookingsQueries.js.map +1 -0
- package/dist/esm/bookingsScreenSet.d.ts +7 -0
- package/dist/esm/bookingsScreenSet.d.ts.map +1 -0
- package/dist/esm/bookingsScreenSet.js +45 -0
- package/dist/esm/bookingsScreenSet.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/manifest.d.ts +3 -0
- package/dist/esm/manifest.d.ts.map +1 -0
- package/dist/esm/manifest.js +88 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/navigation.d.ts +5 -0
- package/dist/esm/navigation.d.ts.map +1 -0
- package/dist/esm/navigation.js +113 -0
- package/dist/esm/navigation.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageName.d.ts +2 -0
- package/dist/esm/packageName.d.ts.map +1 -0
- package/dist/esm/packageName.js +6 -0
- package/dist/esm/packageName.js.map +1 -0
- package/dist/esm/screens/index.d.ts +3 -0
- package/dist/esm/screens/index.d.ts.map +1 -0
- package/dist/esm/screens/index.js +20 -0
- package/dist/esm/screens/index.js.map +1 -0
- package/dist/esm/templateProvenance.d.ts +3 -0
- package/dist/esm/templateProvenance.d.ts.map +1 -0
- package/dist/esm/templateProvenance.js +22 -0
- package/dist/esm/templateProvenance.js.map +1 -0
- package/dist/esm/templates/calendarTemplate.d.ts +3 -0
- package/dist/esm/templates/calendarTemplate.d.ts.map +1 -0
- package/dist/esm/templates/calendarTemplate.js +107 -0
- package/dist/esm/templates/calendarTemplate.js.map +1 -0
- package/dist/esm/templates/formTemplates.d.ts +3 -0
- package/dist/esm/templates/formTemplates.d.ts.map +1 -0
- package/dist/esm/templates/formTemplates.js +48 -0
- package/dist/esm/templates/formTemplates.js.map +1 -0
- package/dist/esm/templates/index.d.ts +8 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +18 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +4 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +164 -0
- package/dist/esm/templates/listTemplates.js.map +1 -0
- package/dist/esm/templates/recordTemplates.d.ts +3 -0
- package/dist/esm/templates/recordTemplates.d.ts.map +1 -0
- package/dist/esm/templates/recordTemplates.js +127 -0
- package/dist/esm/templates/recordTemplates.js.map +1 -0
- package/dist/esm/templates/wizardTemplate.d.ts +3 -0
- package/dist/esm/templates/wizardTemplate.d.ts.map +1 -0
- package/dist/esm/templates/wizardTemplate.js +71 -0
- package/dist/esm/templates/wizardTemplate.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/index.ts +14 -0
- package/manifest.ts +41 -0
- package/navigation.ts +54 -0
- package/package.json +78 -4
- package/packageName.ts +5 -0
- package/sampleData/bookings-en.json +1057 -0
- package/screens/index.ts +20 -0
- package/templateProvenance.ts +15 -0
- package/templates/calendarTemplate.ts +57 -0
- package/templates/formTemplates.ts +33 -0
- package/templates/index.ts +18 -0
- package/templates/listTemplates.ts +106 -0
- package/templates/recordTemplates.ts +78 -0
- package/templates/wizardTemplate.ts +29 -0
- package/thumbnails/BookingPage.svg +17 -0
- package/thumbnails/BookingsCalendar.svg +34 -0
- package/thumbnails/BookingsList.svg +29 -0
- package/thumbnails/BookingsQuickCreateBooking.svg +12 -0
- package/thumbnails/NewBookingWizard.svg +15 -0
- package/thumbnails/ResourcesList.svg +29 -0
- package/thumbnails/bookings.svg +14 -0
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Scene
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Describing a user interface without describing a platform** — Scene is the UI model of the Cratis
|
|
4
|
+
model-first layer (experimental).
|
|
5
|
+
|
|
6
|
+
The object model and runtime for Screenplay-based UIs: `Scene.Model` (platform-agnostic screens, layouts,
|
|
7
|
+
forms, contribution points, ui profiles and themes), `Scene.Engine` (binding/resolution runtime), and
|
|
8
|
+
`Scene.React` (the React renderer).
|
|
9
|
+
|
|
10
|
+
## Packages / Deployables
|
|
11
|
+
|
|
12
|
+
[](http://nuget.org/packages/Cratis.Scene.Model)
|
|
13
|
+
[](https://www.npmjs.com/package/@cratis/scene.model)
|
|
14
|
+
[](https://www.npmjs.com/package/@cratis/scene.engine)
|
|
15
|
+
[](https://www.npmjs.com/package/@cratis/scene.react)
|
|
16
|
+
|
|
17
|
+
## Builds
|
|
18
|
+
|
|
19
|
+
[](https://github.com/cratis/scene/actions/workflows/dotnet-build.yml)
|
|
20
|
+
[](https://github.com/cratis/scene/actions/workflows/javascript-build.yml)
|
|
21
|
+
|
|
22
|
+
## Description
|
|
23
|
+
|
|
24
|
+
Scene owns the *object model and runtime* half of the Screenplay stack. In the model-first pipeline,
|
|
25
|
+
[Screenplay](https://github.com/Cratis/Screenplay) describes an event-sourced, CQRS system,
|
|
26
|
+
[Stage](https://github.com/Cratis/Stage) renders it into a running application, and Scene is how that
|
|
27
|
+
application's user interface is described — independently of any rendering platform.
|
|
28
|
+
|
|
29
|
+
`Scene.Model` is the platform-agnostic
|
|
30
|
+
C# object model that [Stage](https://github.com/Cratis/Stage) translates Screenplay's parsed language constructs into, and that [Studio](https://github.com/Cratis/Studio)'s
|
|
31
|
+
design-time tooling reads and writes. `Scene.Engine` walks that graph, resolves bindings (data, action, form,
|
|
32
|
+
navigation contribution) and drives whichever renderer is plugged in — it does not know React exists.
|
|
33
|
+
`Scene.React` is one renderer implementing the abstract vocabulary against real React/DOM; sibling positions
|
|
34
|
+
are reserved for future `Scene.Native` / `Scene.Desktop` renderers. Vendor and internal component packages
|
|
35
|
+
(PrimeReact, internal widget libraries) are adapters plugging into the renderer contract, not part of it.
|
|
36
|
+
|
|
37
|
+
The design-time editor built on top of this object model lives in Studio, not here — see
|
|
38
|
+
[StudioIssues#156](https://github.com/Cratis/StudioIssues/issues/156).
|
|
39
|
+
|
|
40
|
+
## Support
|
|
41
|
+
|
|
42
|
+
Cratis is an open community, and we are glad to help users, teams evaluating the stack, and contributors.
|
|
43
|
+
|
|
44
|
+
| Channel | Details |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Discord | Join the community on [Discord](https://discord.gg/kt4AMpV8WV) for questions and discussions |
|
|
47
|
+
| GitHub Issues | [Report bugs or request features](https://github.com/Cratis/Scene/issues) |
|
|
48
|
+
| Documentation | Read the docs at [cratis.io](https://cratis.io) |
|
|
49
|
+
|
|
50
|
+
## The Cratis ecosystem
|
|
51
|
+
|
|
52
|
+
This project is part of [Cratis](https://www.cratis.io) — free, MIT-licensed tools for building event-sourced and CQRS applications.
|
|
53
|
+
|
|
54
|
+
- **[Chronicle](https://github.com/Cratis/Chronicle)** — event-sourcing database and runtime. Orleans-based kernel, pluggable storage (MongoDB default; PostgreSQL, SQL Server, SQLite, in-memory), language-agnostic gRPC contracts. [Docs](https://www.cratis.io/chronicle/)
|
|
55
|
+
- **Chronicle clients** — first-class [.NET SDK](https://github.com/Cratis/Chronicle), plus [TypeScript](https://github.com/Cratis/Chronicle.TypeScript), [Kotlin/Java](https://github.com/Cratis/Chronicle.Kotlin), and [Elixir](https://github.com/Cratis/Chronicle.Elixir); [Python](https://github.com/Cratis/Chronicle.Python) coming soon (pre-alpha). AI agents connect through the [Chronicle MCP server](https://github.com/Cratis/Chronicle.Mcp).
|
|
56
|
+
- **[Arc](https://github.com/Cratis/Arc)** — opinionated CQRS framework for ASP.NET Core with commands, queries, validation, authorization, and TypeScript proxy generation. Works without event sourcing. [Docs](https://www.cratis.io/arc/)
|
|
57
|
+
- **[Components](https://github.com/Cratis/Components)** — React components aligned with Arc patterns. [Docs](https://www.cratis.io/components/)
|
|
58
|
+
- **[CLI](https://github.com/Cratis/cli) + Workbench** — inspect and diagnose Chronicle from the terminal or the browser. [Docs](https://www.cratis.io/cli/)
|
|
59
|
+
- **Model-first layer (experimental)** — [Studio](https://github.com/Cratis/Studio), [Screenplay](https://github.com/Cratis/Screenplay), [Stage](https://github.com/Cratis/Stage), Scene (this repository), [Prologue](https://github.com/Cratis/Prologue)
|
|
60
|
+
- **Supporting** — [Fundamentals](https://github.com/Cratis/Fundamentals), [Specifications](https://github.com/Cratis/Specifications), [Synopsis](https://github.com/Cratis/Synopsis), [Lens](https://github.com/Cratis/Lens), [Narrator](https://github.com/Cratis/Narrator), and free [AI tooling](https://github.com/Cratis/AI) (preview); [Ensemble](https://github.com/Cratis/Ensemble) coming soon (pre-release)
|
|
61
|
+
- **[Samples](https://github.com/Cratis/Samples)** — runnable event sourcing and CQRS samples for the whole stack
|
|
62
|
+
|
|
63
|
+
Everything Cratis publishes today is MIT licensed and free to use.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
Part of the [Cratis](https://www.cratis.io) platform · [MIT](./LICENSE)
|
package/blueprint.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScenePackageBundle } from '@cratis/scene.react';
|
|
5
|
+
import { bookingsBlueprintManifest } from './manifest';
|
|
6
|
+
import { bookingsScreens } from './screens';
|
|
7
|
+
import { bookingsDialogTemplates, bookingsScreenTemplates } from './templates';
|
|
8
|
+
|
|
9
|
+
/** This blueprint as a loadable bundle: the manifest names things, this provides them. It provides no component - every component is the foundation's. */
|
|
10
|
+
export const bookingsBlueprint: ScenePackageBundle = {
|
|
11
|
+
manifest: bookingsBlueprintManifest,
|
|
12
|
+
components: {},
|
|
13
|
+
screenTemplates: bookingsScreenTemplates,
|
|
14
|
+
dialogTemplates: bookingsDialogTemplates,
|
|
15
|
+
screens: bookingsScreens,
|
|
16
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"blueprints": [
|
|
4
|
+
{
|
|
5
|
+
"package": "Cratis.Blueprint.Bookings",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"domain": "bookings",
|
|
8
|
+
"displayName": "Bookings",
|
|
9
|
+
"description": "Bookings for shared rooms, equipment and vehicles: a booking calendar, a booking list, a booking page, the resources and a wizard that books one in four steps.",
|
|
10
|
+
"thumbnail": "thumbnails/bookings.svg",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"licenseUrl": "https://github.com/Cratis/Scene/blob/main/LICENSE",
|
|
13
|
+
"dependencies": [
|
|
14
|
+
{
|
|
15
|
+
"name": "Cratis.Blueprint.Default",
|
|
16
|
+
"versionRange": "^1.0.0"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"screens": [
|
|
20
|
+
{
|
|
21
|
+
"name": "bookings.calendar",
|
|
22
|
+
"title": "Calendar",
|
|
23
|
+
"description": "Every booking on a calendar: who has what, and when.",
|
|
24
|
+
"template": "BookingsCalendar",
|
|
25
|
+
"order": 0
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "bookings.list",
|
|
29
|
+
"title": "Bookings",
|
|
30
|
+
"description": "Every booking with its resource, time and status.",
|
|
31
|
+
"template": "BookingsList",
|
|
32
|
+
"order": 1
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "bookings.record",
|
|
36
|
+
"title": "Booking",
|
|
37
|
+
"description": "One booking: key facts, its attendees, its extras and its activity.",
|
|
38
|
+
"template": "BookingPage",
|
|
39
|
+
"parent": "bookings.list"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "bookings.resources",
|
|
43
|
+
"title": "Resources",
|
|
44
|
+
"description": "The rooms, equipment and vehicles that can be booked.",
|
|
45
|
+
"template": "ResourcesList",
|
|
46
|
+
"order": 2
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "bookings.new",
|
|
50
|
+
"title": "New booking",
|
|
51
|
+
"description": "Book a room, equipment or a vehicle in four short steps.",
|
|
52
|
+
"template": "NewBookingWizard",
|
|
53
|
+
"order": 3
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"templates": [
|
|
57
|
+
{
|
|
58
|
+
"name": "BookingsCalendar",
|
|
59
|
+
"kind": "ScreenTemplate",
|
|
60
|
+
"displayName": "Bookings calendar",
|
|
61
|
+
"description": "Every booking on the day it falls, on a month, a week or as an agenda, with the status told in words.",
|
|
62
|
+
"type": "Calendar",
|
|
63
|
+
"category": "Business / Bookings",
|
|
64
|
+
"thumbnail": "thumbnails/BookingsCalendar.svg"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "BookingsList",
|
|
68
|
+
"kind": "ScreenTemplate",
|
|
69
|
+
"displayName": "Bookings list",
|
|
70
|
+
"description": "Every booking with its resource, who booked it, date and time and status, filtered by resource, status, person and date.",
|
|
71
|
+
"type": "List",
|
|
72
|
+
"category": "Business / Bookings",
|
|
73
|
+
"thumbnail": "thumbnails/BookingsList.svg"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "BookingPage",
|
|
77
|
+
"kind": "ScreenTemplate",
|
|
78
|
+
"displayName": "Booking page",
|
|
79
|
+
"description": "One booking: status, date, hours and people, its details, attendees and extras, and its activity.",
|
|
80
|
+
"type": "Detail",
|
|
81
|
+
"category": "Business / Bookings",
|
|
82
|
+
"thumbnail": "thumbnails/BookingPage.svg"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "ResourcesList",
|
|
86
|
+
"kind": "ScreenTemplate",
|
|
87
|
+
"displayName": "Resources list",
|
|
88
|
+
"description": "The rooms, equipment and vehicles that can be booked, with their capacity, location and whether each is free.",
|
|
89
|
+
"type": "List",
|
|
90
|
+
"category": "Business / Bookings",
|
|
91
|
+
"thumbnail": "thumbnails/ResourcesList.svg"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "NewBookingWizard",
|
|
95
|
+
"kind": "ScreenTemplate",
|
|
96
|
+
"displayName": "New booking wizard",
|
|
97
|
+
"description": "Resource, time, details, then review and book; the step survives a refresh and an invalid step blocks Next and says why.",
|
|
98
|
+
"type": "Wizard",
|
|
99
|
+
"category": "Business / Bookings",
|
|
100
|
+
"thumbnail": "thumbnails/NewBookingWizard.svg"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "BookingsQuickCreateBooking",
|
|
104
|
+
"kind": "DialogTemplate",
|
|
105
|
+
"displayName": "Bookings quick create booking",
|
|
106
|
+
"description": "A short form that creates one booking without leaving the page.",
|
|
107
|
+
"type": "Dialog",
|
|
108
|
+
"category": "Business / Bookings",
|
|
109
|
+
"thumbnail": "thumbnails/BookingsQuickCreateBooking.svg"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"sampleData": [
|
|
113
|
+
{
|
|
114
|
+
"id": "bookings-en",
|
|
115
|
+
"title": "Bookings · English",
|
|
116
|
+
"locale": "en-GB",
|
|
117
|
+
"path": "sampleData/bookings-en.json",
|
|
118
|
+
"default": true
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UiProfile } from '@cratis/scene.model';
|
|
5
|
+
import { ApplicationStructureIndex } from '@cratis/scene.engine';
|
|
6
|
+
import { ApplicationDocument, CompositionOptions, defaultLayouts, previewProfile } from '@cratis/scene.blueprint.default';
|
|
7
|
+
import { bookingsNavigation, bookingsStructure } from './navigation';
|
|
8
|
+
import { bookingsScreens } from './screens';
|
|
9
|
+
import { bookingsDialogTemplates, bookingsScreenTemplates } from './templates';
|
|
10
|
+
|
|
11
|
+
/** The id of the sample-data pack a new application starts with. */
|
|
12
|
+
export const bookingsDefaultSampleDataId = 'bookings-en';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The example application of the blueprint: the foundation's layouts, the Bookings templates, the quick-create dialogs and their 5 screens, rendering against the
|
|
16
|
+
* foundation's packages with the default sample-data pack chosen. This is what a gallery previews and what the conformance fixture
|
|
17
|
+
* (`Samples/Bookings/bookings.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
|
|
18
|
+
*/
|
|
19
|
+
export function bookingsApplication(sampleData: string = bookingsDefaultSampleDataId): ApplicationDocument {
|
|
20
|
+
const profile: UiProfile = { ...previewProfile(undefined), name: 'Bookings', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };
|
|
21
|
+
return { layouts: defaultLayouts, screenTemplates: bookingsScreenTemplates, dialogTemplates: bookingsDialogTemplates, screens: bookingsScreens, uiProfiles: [profile] };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What a host composes the screens with: the application's logo, which the shell's topbar shows. */
|
|
25
|
+
export const bookingsComposition: CompositionOptions = { logo: bookingsNavigation.application.logo };
|
|
26
|
+
|
|
27
|
+
/** The structure and navigation the shell's regions show and the items' destinations resolve against. */
|
|
28
|
+
export const bookingsNavigationModel = () => ({ structure: new ApplicationStructureIndex(bookingsStructure), navigation: bookingsNavigation });
|
package/bookingsParts.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Behavior, BindingSourceKind, DialogTemplate, ExternalComponent, InteractionActionKind, InteractionTriggerKind, NavigateAction, OpenDialogAction, SceneElement, ScreenTemplate, TemplateMetadata, TemplateScope,
|
|
6
|
+
} from '@cratis/scene.model';
|
|
7
|
+
import { component, panel } from '@cratis/scene.blueprint.default';
|
|
8
|
+
import { bookingsTemplateProvenance } from './templateProvenance';
|
|
9
|
+
|
|
10
|
+
export { component, panel };
|
|
11
|
+
|
|
12
|
+
/** The category of every template of this blueprint (spec Part B 1.2: `Business / <domain>`). */
|
|
13
|
+
export const bookingsCategory = 'Business / Bookings';
|
|
14
|
+
|
|
15
|
+
/** The package-relative thumbnail of a template. */
|
|
16
|
+
export const thumbnailOf = (templateName: string): string => `thumbnails/${templateName}.svg`;
|
|
17
|
+
|
|
18
|
+
/** The metadata of a screen template of this blueprint: provenance, a type from the vocabulary, the category, a thumbnail and the levels it applies at. */
|
|
19
|
+
export const bookingsMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace' | 'Calendar' | 'Timeline' | 'Inbox' | 'Profile' | 'Wizard', scopes: TemplateScope[]): TemplateMetadata =>
|
|
20
|
+
({ ...bookingsTemplateProvenance, type, category: bookingsCategory, thumbnail: thumbnailOf(name), scopes });
|
|
21
|
+
|
|
22
|
+
/** A button of the foundation: a verb, its emphasis, and the permission rule every action declares (spec Part B 1.5). */
|
|
23
|
+
export const actionButton = (id: string, label: string, emphasis: 'primary' | 'secondary' | 'quiet' | 'danger', extra: Record<string, unknown> = {}, behaviors?: Behavior[]): ExternalComponent =>
|
|
24
|
+
({ ...component(id, 'actionButton', { label, emphasis, permission: 'enabled', ...extra }), ...(behaviors ? { behaviors } : {}) });
|
|
25
|
+
|
|
26
|
+
/** What pressing an element does: open the named dialog template over the page. */
|
|
27
|
+
export const opensDialog = (dialogTemplate: string): Behavior[] =>
|
|
28
|
+
[{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.OpenDialog, dialogTemplate } as OpenDialogAction] }] }];
|
|
29
|
+
|
|
30
|
+
/** What pressing an element does: go to the named screen. */
|
|
31
|
+
export const goesTo = (screen: string): Behavior[] =>
|
|
32
|
+
[{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.Navigate, screen } as NavigateAction] }] }];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What choosing a row of a list does: open the record page, handing it the chosen row's id. The list is single-selection, so choosing a row is
|
|
36
|
+
* opening it - the way a table of records works everywhere.
|
|
37
|
+
*/
|
|
38
|
+
export const opensRecordOnSelect = (listId: string, screen: string): Behavior[] => [{
|
|
39
|
+
bindings: [{
|
|
40
|
+
trigger: { kind: InteractionTriggerKind.Select },
|
|
41
|
+
actions: [{ kind: InteractionActionKind.Navigate, screen, arguments: [{ name: 'id', value: { kind: BindingSourceKind.ComponentProperty, componentId: listId, path: 'value' } }] } as NavigateAction],
|
|
42
|
+
}],
|
|
43
|
+
}];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* What choosing a row of a list does: open the named dialog over the page - a side sheet with the row's detail, so the list stays where it was.
|
|
47
|
+
*/
|
|
48
|
+
export const opensDialogOnSelect = (dialogTemplate: string): Behavior[] =>
|
|
49
|
+
[{ bindings: [{ trigger: { kind: InteractionTriggerKind.Select }, actions: [{ kind: InteractionActionKind.OpenDialog, dialogTemplate } as OpenDialogAction] }] }];
|
|
50
|
+
|
|
51
|
+
/** What a Cancel or Close control does: close the dialog it was opened from. */
|
|
52
|
+
export const closesDialog = (): Behavior[] => [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.CloseDialog }] }] }];
|
|
53
|
+
|
|
54
|
+
/** An element with the given behaviors attached. */
|
|
55
|
+
export const withBehaviors = <T extends SceneElement>(element: T, behaviors: Behavior[]): T => ({ ...element, behaviors });
|
|
56
|
+
|
|
57
|
+
export type BookingsScreenTemplate = ScreenTemplate;
|
|
58
|
+
export type BookingsDialogTemplate = DialogTemplate;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { BindingExpression, BindingSourceKind } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A property taken from a query result - never a value. A bookings template declares *where* its data comes from and the sample-data pack, or the real
|
|
8
|
+
* query, supplies the rows (spec SD1); `path` reaches into the result (`0.value` is the first row's `value`, an empty path is the whole result).
|
|
9
|
+
*/
|
|
10
|
+
export const fromQuery = (query: string, path = ''): BindingExpression => ({ kind: BindingSourceKind.QueryResult, query, path });
|
|
11
|
+
|
|
12
|
+
/** The queries of the screens that are not a plain list. Each is a shape the sample-data pack supplies rows for. */
|
|
13
|
+
export const BookingsQuery = {
|
|
14
|
+
/** One row: the `locale` and `currency` the figures and dates are formatted in. */
|
|
15
|
+
Settings: 'BookingsSettings',
|
|
16
|
+
BookingEvents: 'BookingEvents',
|
|
17
|
+
BookingEventColumns: 'BookingEventColumns',
|
|
18
|
+
BookingWizardSteps: 'BookingWizardSteps',
|
|
19
|
+
BookingResourceSections: 'BookingResourceSections',
|
|
20
|
+
BookingWhenSections: 'BookingWhenSections',
|
|
21
|
+
BookingDetailSections: 'BookingDetailSections',
|
|
22
|
+
BookingReviewSections: 'BookingReviewSections',
|
|
23
|
+
BookingReviewValues: 'BookingReviewValues',
|
|
24
|
+
FormErrors: 'BookingsFormErrors',
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
/** The entities a template is made for. */
|
|
28
|
+
export enum BookingsEntityKind {
|
|
29
|
+
Booking = 'Booking',
|
|
30
|
+
Resource = 'Resource',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The read model (and so the shape) the records of each entity are queried from. */
|
|
34
|
+
export const bookingsEntityPlural: Record<BookingsEntityKind, string> = {
|
|
35
|
+
[BookingsEntityKind.Booking]: 'Bookings',
|
|
36
|
+
[BookingsEntityKind.Resource]: 'Resources',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The queries one entity's templates bind to, named from the entity so a template never spells one out: the records, the columns and filter fields of the
|
|
41
|
+
* list, its saved views and column choices, the selection, the sections of the quick form, and what the record page shows.
|
|
42
|
+
*/
|
|
43
|
+
export const bookingsQueriesOf = (entity: BookingsEntityKind) => ({
|
|
44
|
+
rows: bookingsEntityPlural[entity],
|
|
45
|
+
columns: `${entity}Columns`,
|
|
46
|
+
filterFields: `${entity}FilterFields`,
|
|
47
|
+
views: `${entity}Views`,
|
|
48
|
+
columnChoices: `${entity}ColumnChoices`,
|
|
49
|
+
selection: `${entity}Selection`,
|
|
50
|
+
quickSections: `${entity}QuickSections`,
|
|
51
|
+
record: `${entity}Record`,
|
|
52
|
+
sections: `${entity}Sections`,
|
|
53
|
+
summary: `${entity}Summary`,
|
|
54
|
+
activity: `${entity}Activity`,
|
|
55
|
+
tabs: `${entity}Tabs`,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/** The locale and currency of the data, bound onto every component that formats a figure or a date. */
|
|
59
|
+
export const localeOfData = { locale: fromQuery(BookingsQuery.Settings, '0.locale') };
|
|
60
|
+
export const currencyOfData = { ...localeOfData, currency: fromQuery(BookingsQuery.Settings, '0.currency') };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { BlueprintScreen } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/** One ready-to-use screen: the qualified name that is also its place in the application (`bookings.list.record` would be the `record` feature of `list`). */
|
|
7
|
+
export interface BookingsScreenDefinition extends BlueprintScreen {
|
|
8
|
+
template: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The screens the blueprint brings, in navigation order. This one list is what the manifest's screen set, the `Screen` instances, the application structure
|
|
14
|
+
* and the navigation are all derived from, so they cannot disagree about which screens exist or where they sit.
|
|
15
|
+
*/
|
|
16
|
+
export const bookingsScreenDefinitions: BookingsScreenDefinition[] = [
|
|
17
|
+
{ name: 'bookings.calendar', title: 'Calendar', template: 'BookingsCalendar', order: 0, description: 'Every booking on a calendar: who has what, and when.' },
|
|
18
|
+
{ name: 'bookings.list', title: 'Bookings', template: 'BookingsList', order: 1, description: 'Every booking with its resource, time and status.' },
|
|
19
|
+
{ name: 'bookings.record', title: 'Booking', template: 'BookingPage', parent: 'bookings.list', description: 'One booking: key facts, its attendees, its extras and its activity.' },
|
|
20
|
+
{ name: 'bookings.resources', title: 'Resources', template: 'ResourcesList', order: 2, description: 'The rooms, equipment and vehicles that can be booked.' },
|
|
21
|
+
{ name: 'bookings.new', title: 'New booking', template: 'NewBookingWizard', order: 3, description: 'Book a room, equipment or a vehicle in four short steps.' },
|
|
22
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var manifest = require('./manifest.js');
|
|
4
|
+
var index = require('./screens/index.js');
|
|
5
|
+
var index$1 = require('./templates/index.js');
|
|
6
|
+
var formTemplates = require('./templates/formTemplates.js');
|
|
7
|
+
|
|
8
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
9
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
10
|
+
/** This blueprint as a loadable bundle: the manifest names things, this provides them. It provides no component - every component is the foundation's. */ const bookingsBlueprint = {
|
|
11
|
+
manifest: manifest.bookingsBlueprintManifest,
|
|
12
|
+
components: {},
|
|
13
|
+
screenTemplates: index$1.bookingsScreenTemplates,
|
|
14
|
+
dialogTemplates: formTemplates.bookingsDialogs,
|
|
15
|
+
screens: index.bookingsScreens
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.bookingsBlueprint = bookingsBlueprint;
|
|
19
|
+
//# sourceMappingURL=blueprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blueprint.js","sources":["../../blueprint.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScenePackageBundle } from '@cratis/scene.react';\nimport { bookingsBlueprintManifest } from './manifest';\nimport { bookingsScreens } from './screens';\nimport { bookingsDialogTemplates, bookingsScreenTemplates } from './templates';\n\n/** This blueprint as a loadable bundle: the manifest names things, this provides them. It provides no component - every component is the foundation's. */\nexport const bookingsBlueprint: ScenePackageBundle = {\n manifest: bookingsBlueprintManifest,\n components: {},\n screenTemplates: bookingsScreenTemplates,\n dialogTemplates: bookingsDialogTemplates,\n screens: bookingsScreens,\n};\n"],"names":["bookingsBlueprint","manifest","bookingsBlueprintManifest","components","screenTemplates","bookingsScreenTemplates","dialogTemplates","bookingsDialogTemplates","screens","bookingsScreens"],"mappings":";;;;;;;AAAA;AACA;AAOA,2JACO,MAAMA,iBAAAA,GAAwC;IACjDC,QAAAA,EAAUC,kCAAAA;AACVC,IAAAA,UAAAA,EAAY,EAAC;IACbC,eAAAA,EAAiBC,+BAAAA;IACjBC,eAAAA,EAAiBC,6BAAAA;IACjBC,OAAAA,EAASC;AACb;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
4
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
5
|
+
var navigation = require('./navigation.js');
|
|
6
|
+
var index = require('./screens/index.js');
|
|
7
|
+
var index$1 = require('./templates/index.js');
|
|
8
|
+
var formTemplates = require('./templates/formTemplates.js');
|
|
9
|
+
|
|
10
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
11
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
12
|
+
/** The id of the sample-data pack a new application starts with. */ const bookingsDefaultSampleDataId = 'bookings-en';
|
|
13
|
+
/**
|
|
14
|
+
* The example application of the blueprint: the foundation's layouts, the Bookings templates, the quick-create dialogs and their 5 screens, rendering against the
|
|
15
|
+
* foundation's packages with the default sample-data pack chosen. This is what a gallery previews and what the conformance fixture
|
|
16
|
+
* (`Samples/Bookings/bookings.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
|
|
17
|
+
*/ function bookingsApplication(sampleData = bookingsDefaultSampleDataId) {
|
|
18
|
+
const profile = {
|
|
19
|
+
...scene_blueprint_default.previewProfile(undefined),
|
|
20
|
+
name: 'Bookings',
|
|
21
|
+
sampleData: {
|
|
22
|
+
activePack: sampleData,
|
|
23
|
+
mappings: [],
|
|
24
|
+
bindings: []
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
layouts: scene_blueprint_default.defaultLayouts,
|
|
29
|
+
screenTemplates: index$1.bookingsScreenTemplates,
|
|
30
|
+
dialogTemplates: formTemplates.bookingsDialogs,
|
|
31
|
+
screens: index.bookingsScreens,
|
|
32
|
+
uiProfiles: [
|
|
33
|
+
profile
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** What a host composes the screens with: the application's logo, which the shell's topbar shows. */ const bookingsComposition = {
|
|
38
|
+
logo: navigation.bookingsNavigation.application.logo
|
|
39
|
+
};
|
|
40
|
+
/** The structure and navigation the shell's regions show and the items' destinations resolve against. */ const bookingsNavigationModel = ()=>({
|
|
41
|
+
structure: new scene_engine.ApplicationStructureIndex(navigation.bookingsStructure),
|
|
42
|
+
navigation: navigation.bookingsNavigation
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
exports.bookingsApplication = bookingsApplication;
|
|
46
|
+
exports.bookingsComposition = bookingsComposition;
|
|
47
|
+
exports.bookingsDefaultSampleDataId = bookingsDefaultSampleDataId;
|
|
48
|
+
exports.bookingsNavigationModel = bookingsNavigationModel;
|
|
49
|
+
//# sourceMappingURL=bookingsApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookingsApplication.js","sources":["../../bookingsApplication.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UiProfile } from '@cratis/scene.model';\nimport { ApplicationStructureIndex } from '@cratis/scene.engine';\nimport { ApplicationDocument, CompositionOptions, defaultLayouts, previewProfile } from '@cratis/scene.blueprint.default';\nimport { bookingsNavigation, bookingsStructure } from './navigation';\nimport { bookingsScreens } from './screens';\nimport { bookingsDialogTemplates, bookingsScreenTemplates } from './templates';\n\n/** The id of the sample-data pack a new application starts with. */\nexport const bookingsDefaultSampleDataId = 'bookings-en';\n\n/**\n * The example application of the blueprint: the foundation's layouts, the Bookings templates, the quick-create dialogs and their 5 screens, rendering against the\n * foundation's packages with the default sample-data pack chosen. This is what a gallery previews and what the conformance fixture\n * (`Samples/Bookings/bookings.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.\n */\nexport function bookingsApplication(sampleData: string = bookingsDefaultSampleDataId): ApplicationDocument {\n const profile: UiProfile = { ...previewProfile(undefined), name: 'Bookings', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };\n return { layouts: defaultLayouts, screenTemplates: bookingsScreenTemplates, dialogTemplates: bookingsDialogTemplates, screens: bookingsScreens, uiProfiles: [profile] };\n}\n\n/** What a host composes the screens with: the application's logo, which the shell's topbar shows. */\nexport const bookingsComposition: CompositionOptions = { logo: bookingsNavigation.application.logo };\n\n/** The structure and navigation the shell's regions show and the items' destinations resolve against. */\nexport const bookingsNavigationModel = () => ({ structure: new ApplicationStructureIndex(bookingsStructure), navigation: bookingsNavigation });\n"],"names":["bookingsDefaultSampleDataId","bookingsApplication","sampleData","profile","previewProfile","undefined","name","activePack","mappings","bindings","layouts","defaultLayouts","screenTemplates","bookingsScreenTemplates","dialogTemplates","bookingsDialogTemplates","screens","bookingsScreens","uiProfiles","bookingsComposition","logo","bookingsNavigation","application","bookingsNavigationModel","structure","ApplicationStructureIndex","bookingsStructure","navigation"],"mappings":";;;;;;;;;AAAA;AACA;AASA,qEACO,MAAMA,2BAAAA,GAA8B;AAE3C;;;;AAIC,IACM,SAASC,mBAAAA,CAAoBC,UAAAA,GAAqBF,2BAA2B,EAAA;AAChF,IAAA,MAAMG,OAAAA,GAAqB;AAAE,QAAA,GAAGC,uCAAeC,SAAAA,CAAU;QAAEC,IAAAA,EAAM,UAAA;QAAYJ,UAAAA,EAAY;YAAEK,UAAAA,EAAYL,UAAAA;AAAYM,YAAAA,QAAAA,EAAU,EAAE;AAAEC,YAAAA,QAAAA,EAAU;AAAG;AAAE,KAAA;IAChJ,OAAO;QAAEC,OAAAA,EAASC,sCAAAA;QAAgBC,eAAAA,EAAiBC,+BAAAA;QAAyBC,eAAAA,EAAiBC,6BAAAA;QAAyBC,OAAAA,EAASC,qBAAAA;QAAiBC,UAAAA,EAAY;AAACf,YAAAA;AAAQ;AAAC,KAAA;AAC1K;AAEA,sGACO,MAAMgB,mBAAAA,GAA0C;IAAEC,IAAAA,EAAMC,6BAAAA,CAAmBC,WAAW,CAACF;AAAK;AAEnG,0GACO,MAAMG,uBAAAA,GAA0B,KAAO;AAAEC,QAAAA,SAAAA,EAAW,IAAIC,sCAAAA,CAA0BC,4BAAAA,CAAAA;QAAoBC,UAAAA,EAAYN;AAAmB,KAAA;;;;;"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
5
|
+
var templateProvenance = require('./templateProvenance.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/** The category of every template of this blueprint (spec Part B 1.2: `Business / <domain>`). */ const bookingsCategory = 'Business / Bookings';
|
|
10
|
+
/** The package-relative thumbnail of a template. */ const thumbnailOf = (templateName)=>`thumbnails/${templateName}.svg`;
|
|
11
|
+
/** The metadata of a screen template of this blueprint: provenance, a type from the vocabulary, the category, a thumbnail and the levels it applies at. */ const bookingsMetadata = (name, type, scopes)=>({
|
|
12
|
+
...templateProvenance.bookingsTemplateProvenance,
|
|
13
|
+
type,
|
|
14
|
+
category: bookingsCategory,
|
|
15
|
+
thumbnail: thumbnailOf(name),
|
|
16
|
+
scopes
|
|
17
|
+
});
|
|
18
|
+
/** A button of the foundation: a verb, its emphasis, and the permission rule every action declares (spec Part B 1.5). */ const actionButton = (id, label, emphasis, extra = {}, behaviors)=>({
|
|
19
|
+
...scene_blueprint_default.component(id, 'actionButton', {
|
|
20
|
+
label,
|
|
21
|
+
emphasis,
|
|
22
|
+
permission: 'enabled',
|
|
23
|
+
...extra
|
|
24
|
+
}),
|
|
25
|
+
...behaviors ? {
|
|
26
|
+
behaviors
|
|
27
|
+
} : {}
|
|
28
|
+
});
|
|
29
|
+
/** What pressing an element does: open the named dialog template over the page. */ const opensDialog = (dialogTemplate)=>[
|
|
30
|
+
{
|
|
31
|
+
bindings: [
|
|
32
|
+
{
|
|
33
|
+
trigger: {
|
|
34
|
+
kind: scene_model.InteractionTriggerKind.Click
|
|
35
|
+
},
|
|
36
|
+
actions: [
|
|
37
|
+
{
|
|
38
|
+
kind: scene_model.InteractionActionKind.OpenDialog,
|
|
39
|
+
dialogTemplate
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
/** What pressing an element does: go to the named screen. */ const goesTo = (screen)=>[
|
|
47
|
+
{
|
|
48
|
+
bindings: [
|
|
49
|
+
{
|
|
50
|
+
trigger: {
|
|
51
|
+
kind: scene_model.InteractionTriggerKind.Click
|
|
52
|
+
},
|
|
53
|
+
actions: [
|
|
54
|
+
{
|
|
55
|
+
kind: scene_model.InteractionActionKind.Navigate,
|
|
56
|
+
screen
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* What choosing a row of a list does: open the record page, handing it the chosen row's id. The list is single-selection, so choosing a row is
|
|
65
|
+
* opening it - the way a table of records works everywhere.
|
|
66
|
+
*/ const opensRecordOnSelect = (listId, screen)=>[
|
|
67
|
+
{
|
|
68
|
+
bindings: [
|
|
69
|
+
{
|
|
70
|
+
trigger: {
|
|
71
|
+
kind: scene_model.InteractionTriggerKind.Select
|
|
72
|
+
},
|
|
73
|
+
actions: [
|
|
74
|
+
{
|
|
75
|
+
kind: scene_model.InteractionActionKind.Navigate,
|
|
76
|
+
screen,
|
|
77
|
+
arguments: [
|
|
78
|
+
{
|
|
79
|
+
name: 'id',
|
|
80
|
+
value: {
|
|
81
|
+
kind: scene_model.BindingSourceKind.ComponentProperty,
|
|
82
|
+
componentId: listId,
|
|
83
|
+
path: 'value'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
/**
|
|
94
|
+
* What choosing a row of a list does: open the named dialog over the page - a side sheet with the row's detail, so the list stays where it was.
|
|
95
|
+
*/ const opensDialogOnSelect = (dialogTemplate)=>[
|
|
96
|
+
{
|
|
97
|
+
bindings: [
|
|
98
|
+
{
|
|
99
|
+
trigger: {
|
|
100
|
+
kind: scene_model.InteractionTriggerKind.Select
|
|
101
|
+
},
|
|
102
|
+
actions: [
|
|
103
|
+
{
|
|
104
|
+
kind: scene_model.InteractionActionKind.OpenDialog,
|
|
105
|
+
dialogTemplate
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
/** What a Cancel or Close control does: close the dialog it was opened from. */ const closesDialog = ()=>[
|
|
113
|
+
{
|
|
114
|
+
bindings: [
|
|
115
|
+
{
|
|
116
|
+
trigger: {
|
|
117
|
+
kind: scene_model.InteractionTriggerKind.Click
|
|
118
|
+
},
|
|
119
|
+
actions: [
|
|
120
|
+
{
|
|
121
|
+
kind: scene_model.InteractionActionKind.CloseDialog
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
/** An element with the given behaviors attached. */ const withBehaviors = (element, behaviors)=>({
|
|
129
|
+
...element,
|
|
130
|
+
behaviors
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
Object.defineProperty(exports, "component", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function () { return scene_blueprint_default.component; }
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "panel", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () { return scene_blueprint_default.panel; }
|
|
140
|
+
});
|
|
141
|
+
exports.actionButton = actionButton;
|
|
142
|
+
exports.bookingsCategory = bookingsCategory;
|
|
143
|
+
exports.bookingsMetadata = bookingsMetadata;
|
|
144
|
+
exports.closesDialog = closesDialog;
|
|
145
|
+
exports.goesTo = goesTo;
|
|
146
|
+
exports.opensDialog = opensDialog;
|
|
147
|
+
exports.opensDialogOnSelect = opensDialogOnSelect;
|
|
148
|
+
exports.opensRecordOnSelect = opensRecordOnSelect;
|
|
149
|
+
exports.thumbnailOf = thumbnailOf;
|
|
150
|
+
exports.withBehaviors = withBehaviors;
|
|
151
|
+
//# sourceMappingURL=bookingsParts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookingsParts.js","sources":["../../bookingsParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Behavior, BindingSourceKind, DialogTemplate, ExternalComponent, InteractionActionKind, InteractionTriggerKind, NavigateAction, OpenDialogAction, SceneElement, ScreenTemplate, TemplateMetadata, TemplateScope,\n} from '@cratis/scene.model';\nimport { component, panel } from '@cratis/scene.blueprint.default';\nimport { bookingsTemplateProvenance } from './templateProvenance';\n\nexport { component, panel };\n\n/** The category of every template of this blueprint (spec Part B 1.2: `Business / <domain>`). */\nexport const bookingsCategory = 'Business / Bookings';\n\n/** The package-relative thumbnail of a template. */\nexport const thumbnailOf = (templateName: string): string => `thumbnails/${templateName}.svg`;\n\n/** The metadata of a screen template of this blueprint: provenance, a type from the vocabulary, the category, a thumbnail and the levels it applies at. */\nexport const bookingsMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace' | 'Calendar' | 'Timeline' | 'Inbox' | 'Profile' | 'Wizard', scopes: TemplateScope[]): TemplateMetadata =>\n ({ ...bookingsTemplateProvenance, type, category: bookingsCategory, thumbnail: thumbnailOf(name), scopes });\n\n/** A button of the foundation: a verb, its emphasis, and the permission rule every action declares (spec Part B 1.5). */\nexport const actionButton = (id: string, label: string, emphasis: 'primary' | 'secondary' | 'quiet' | 'danger', extra: Record<string, unknown> = {}, behaviors?: Behavior[]): ExternalComponent =>\n ({ ...component(id, 'actionButton', { label, emphasis, permission: 'enabled', ...extra }), ...(behaviors ? { behaviors } : {}) });\n\n/** What pressing an element does: open the named dialog template over the page. */\nexport const opensDialog = (dialogTemplate: string): Behavior[] =>\n [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.OpenDialog, dialogTemplate } as OpenDialogAction] }] }];\n\n/** What pressing an element does: go to the named screen. */\nexport const goesTo = (screen: string): Behavior[] =>\n [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.Navigate, screen } as NavigateAction] }] }];\n\n/**\n * What choosing a row of a list does: open the record page, handing it the chosen row's id. The list is single-selection, so choosing a row is\n * opening it - the way a table of records works everywhere.\n */\nexport const opensRecordOnSelect = (listId: string, screen: string): Behavior[] => [{\n bindings: [{\n trigger: { kind: InteractionTriggerKind.Select },\n actions: [{ kind: InteractionActionKind.Navigate, screen, arguments: [{ name: 'id', value: { kind: BindingSourceKind.ComponentProperty, componentId: listId, path: 'value' } }] } as NavigateAction],\n }],\n}];\n\n/**\n * What choosing a row of a list does: open the named dialog over the page - a side sheet with the row's detail, so the list stays where it was.\n */\nexport const opensDialogOnSelect = (dialogTemplate: string): Behavior[] =>\n [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Select }, actions: [{ kind: InteractionActionKind.OpenDialog, dialogTemplate } as OpenDialogAction] }] }];\n\n/** What a Cancel or Close control does: close the dialog it was opened from. */\nexport const closesDialog = (): Behavior[] => [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.CloseDialog }] }] }];\n\n/** An element with the given behaviors attached. */\nexport const withBehaviors = <T extends SceneElement>(element: T, behaviors: Behavior[]): T => ({ ...element, behaviors });\n\nexport type BookingsScreenTemplate = ScreenTemplate;\nexport type BookingsDialogTemplate = DialogTemplate;\n"],"names":["bookingsCategory","thumbnailOf","templateName","bookingsMetadata","name","type","scopes","bookingsTemplateProvenance","category","thumbnail","actionButton","id","label","emphasis","extra","behaviors","component","permission","opensDialog","dialogTemplate","bindings","trigger","kind","InteractionTriggerKind","Click","actions","InteractionActionKind","OpenDialog","goesTo","screen","Navigate","opensRecordOnSelect","listId","Select","arguments","value","BindingSourceKind","ComponentProperty","componentId","path","opensDialogOnSelect","closesDialog","CloseDialog","withBehaviors","element"],"mappings":"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"}
|