@cratis/scene.blueprint.bookings 0.0.0-stage → 4.78.3
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 +69 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTemplates.js","sources":["../../../templates/listTemplates.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 { InteractionActionKind, InteractionTriggerKind, NotificationLevel, NotifyAction, ScreenTemplate, TemplateScope } from '@cratis/scene.model';\nimport { listScreenTemplate } from '@cratis/scene.blueprint.default';\nimport { BookingsEntityKind, fromQuery, bookingsQueriesOf, localeOfData } from '../bookingsQueries';\nimport { actionButton, component, goesTo, bookingsMetadata, opensDialog, opensDialogOnSelect, opensRecordOnSelect, withBehaviors } from '../bookingsParts';\n\nconst listScopes = [TemplateScope.Module, TemplateScope.Feature];\n\n/** The Export button: it tells the user the export has started, which is what the shell does for a long-running action it does not wait on. */\nconst exportAction = (id: string) => withBehaviors(actionButton(id, 'Export', 'secondary'), [{\n bindings: [{\n trigger: { kind: InteractionTriggerKind.Click },\n actions: [{ kind: InteractionActionKind.Notify, level: NotificationLevel.Info, message: { text: 'The export has started.' } } as unknown as NotifyAction],\n }],\n}]);\n\ninterface ListOptions {\n name: string;\n entity: BookingsEntityKind;\n displayName: string;\n description: string;\n title: string;\n subtitle: string;\n searchLabel: string;\n urlKey: string;\n /** The primary action of the header: a quick-create dialog to open, or a screen to go to. */\n primary: { label: string; dialog?: string; screen?: string };\n rowActions: string[];\n bulkActions: string[];\n titleField: string;\n /** The screen a chosen row opens; the list then selects one row at a time. Absent, rows are selected many at a time for the bulk bar. */\n recordScreen?: string;\n /** The side sheet a chosen row opens instead of a record page; the list then selects one row at a time. */\n recordDialog?: string;\n /** Group the rows (`variant: grouped`) by this field. */\n grouped?: { groupBy: string };\n /** Rows are not selectable at all: a record of what happened, which nobody edits. */\n readOnly?: boolean;\n /** Show the records as cards, each with the picture its `imageField` names. */\n cards?: { imageField?: string };\n /** Tint a row by the tone in this field (always beside a status column that says the same in words). */\n toneField?: string;\n}\n\n/**\n * One list: the foundation `ListScreen` with its header, toolbar, filters, list and bulk bar filled for an entity. The slots, arrangement and\n * every behavior - sort, search, paging and selection in the address, the table collapsing to cards on a phone - are the foundation's.\n */\nfunction listTemplateOf(options: ListOptions): ScreenTemplate {\n const queries = bookingsQueriesOf(options.entity);\n const id = options.name;\n const listId = `${id}-records`;\n const primary = withBehaviors(actionButton(`${id}-primary`, options.primary.label, 'primary'), options.primary.dialog ? opensDialog(options.primary.dialog) : goesTo(options.primary.screen!));\n const list = component(listId, 'dataList', {\n label: options.title, rows: fromQuery(queries.rows), columns: fromQuery(queries.columns), titleField: options.titleField, pageSize: options.cards ? 12 : 10, urlKey: options.urlKey, ...localeOfData,\n rowActions: options.rowActions,\n ...(options.readOnly ? {} : { selectionMode: options.recordScreen || options.recordDialog ? 'single' : 'multiple' }),\n ...(options.cards ? { variant: 'cards', ...(options.cards.imageField ? { imageField: options.cards.imageField } : {}) } : {}),\n ...(options.grouped ? { variant: 'grouped', groupBy: options.grouped.groupBy } : {}),\n ...(options.toneField ? { toneField: options.toneField } : {}),\n });\n\n return {\n name: options.name,\n fitsSlot: 'content',\n slots: listScreenTemplate.slots,\n arrangement: listScreenTemplate.arrangement,\n content: {\n header: [component(`${id}-header`, 'pageHeader', { title: options.title, subtitle: options.subtitle }, { actions: [exportAction(`${id}-export`), primary] })],\n toolbar: [\n component(`${id}-search`, 'globalSearch', { placeholder: options.searchLabel, label: options.searchLabel, urlKey: `${options.urlKey}q` }),\n component(`${id}-views`, 'savedViewsMenu', { views: fromQuery(queries.views), savePermission: 'enabled', managePermission: 'enabled' }),\n component(`${id}-columns`, 'columnChooser', { columns: fromQuery(queries.columnChoices) }),\n ],\n filters: [component(`${id}-filter`, 'filterBuilder', { fields: fromQuery(queries.filterFields), ...localeOfData })],\n list: [options.recordScreen ? withBehaviors(list, opensRecordOnSelect(listId, options.recordScreen)) : options.recordDialog ? withBehaviors(list, opensDialogOnSelect(options.recordDialog)) : list],\n bulkBar: options.recordScreen || options.recordDialog || options.readOnly ? [] : [component(`${id}-bulk`, 'bulkBar', { selection: fromQuery(queries.selection), actions: options.bulkActions })],\n footer: [],\n },\n displayName: options.displayName,\n description: options.description,\n metadata: bookingsMetadata(options.name, 'List', listScopes),\n };\n}\n\n\n/** The bookings: every booking with its resource, who booked it, when and its status. Choosing a booking opens it. */\nexport const bookingsListTemplate = listTemplateOf({\n name: 'BookingsList',\n entity: BookingsEntityKind.Booking, displayName: 'Bookings list', description: 'Every booking with its resource, who booked it, date and time and status, filtered by resource, status, person and date.', title: 'Bookings', subtitle: 'Everything that has been booked', searchLabel: 'Search bookings', urlKey: 'bookings',\n primary: { label: 'Quick booking', dialog: 'BookingsQuickCreateBooking' },\n rowActions: ['Open', 'Cancel booking'], bulkActions: [],\n titleField: 'reference', recordScreen: 'bookings.record'\n});\n\n/** The resources: the rooms, equipment and vehicles that can be booked, as cards with their type, capacity, location and whether each is free. */\nexport const resourcesListTemplate = listTemplateOf({\n name: 'ResourcesList',\n entity: BookingsEntityKind.Resource, displayName: 'Resources list', description: 'The rooms, equipment and vehicles that can be booked, with their capacity, location and whether each is free.', title: 'Resources', subtitle: 'What can be booked', searchLabel: 'Search resources', urlKey: 'resources',\n primary: { label: 'Book a resource', screen: 'bookings.new' },\n rowActions: ['Book'], bulkActions: [],\n titleField: 'name',\n readOnly: true, cards: {}\n});\n"],"names":["listScopes","TemplateScope","Module","Feature","exportAction","id","withBehaviors","actionButton","bindings","trigger","kind","InteractionTriggerKind","Click","actions","InteractionActionKind","Notify","level","NotificationLevel","Info","message","text","listTemplateOf","options","queries","bookingsQueriesOf","entity","name","listId","primary","label","dialog","opensDialog","goesTo","screen","list","component","title","rows","fromQuery","columns","titleField","pageSize","cards","urlKey","localeOfData","rowActions","readOnly","selectionMode","recordScreen","recordDialog","variant","imageField","grouped","groupBy","toneField","fitsSlot","slots","listScreenTemplate","arrangement","content","header","subtitle","toolbar","placeholder","searchLabel","views","savePermission","managePermission","columnChoices","filters","fields","filterFields","opensRecordOnSelect","opensDialogOnSelect","bulkBar","selection","bulkActions","footer","displayName","description","metadata","bookingsMetadata","bookingsListTemplate","BookingsEntityKind","Booking","resourcesListTemplate","Resource"],"mappings":";;;;;AAAA;AACA;AAOA,MAAMA,UAAAA,GAAa;AAACC,IAAAA,aAAAA,CAAcC,MAAM;AAAED,IAAAA,aAAAA,CAAcE;AAAQ,CAAA;AAEhE,gJACA,MAAMC,YAAAA,GAAe,CAACC,KAAeC,aAAAA,CAAcC,YAAAA,CAAaF,EAAAA,EAAI,QAAA,EAAU,WAAA,CAAA,EAAc;AAAC,QAAA;YACzFG,QAAAA,EAAU;AAAC,gBAAA;oBACPC,OAAAA,EAAS;AAAEC,wBAAAA,IAAAA,EAAMC,uBAAuBC;AAAM,qBAAA;oBAC9CC,OAAAA,EAAS;AAAC,wBAAA;AAAEH,4BAAAA,IAAAA,EAAMI,sBAAsBC,MAAM;AAAEC,4BAAAA,KAAAA,EAAOC,kBAAkBC,IAAI;4BAAEC,OAAAA,EAAS;gCAAEC,IAAAA,EAAM;AAA0B;AAAE;AAA6B;AAC7J;AAAE;AACN;AAAE,KAAA,CAAA;AA8BF;;;IAIA,SAASC,eAAeC,OAAoB,EAAA;IACxC,MAAMC,OAAAA,GAAUC,iBAAAA,CAAkBF,OAAAA,CAAQG,MAAM,CAAA;IAChD,MAAMpB,EAAAA,GAAKiB,QAAQI,IAAI;AACvB,IAAA,MAAMC,MAAAA,GAAS,CAAA,EAAGtB,EAAAA,CAAG,QAAQ,CAAC;AAC9B,IAAA,MAAMuB,OAAAA,GAAUtB,aAAAA,C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,EAAE,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAiEpE,eAAO,MAAM,mBAAmB,gBAS9B,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { TemplateScope } from '@cratis/scene.model';
|
|
2
|
+
import { recordPageTemplate, component } from '@cratis/scene.blueprint.default';
|
|
3
|
+
import { localeOfData, fromQuery, currencyOfData, bookingsQueriesOf, BookingsEntityKind } from '../bookingsQueries.js';
|
|
4
|
+
import { bookingsMetadata, withBehaviors, goesTo, actionButton, opensDialog } from '../bookingsParts.js';
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* One record page: the foundation `RecordPage` with the record's own title, its status and key facts at the top, its fields and the lists that belong to it in the
|
|
10
|
+
* main region, and the activity beside it. What it shows is the record the list handed it the id of.
|
|
11
|
+
*/ function recordPageOf(options) {
|
|
12
|
+
const queries = bookingsQueriesOf(options.entity);
|
|
13
|
+
const id = options.name;
|
|
14
|
+
return {
|
|
15
|
+
name: options.name,
|
|
16
|
+
fitsSlot: 'content',
|
|
17
|
+
slots: recordPageTemplate.slots,
|
|
18
|
+
arrangement: recordPageTemplate.arrangement,
|
|
19
|
+
content: {
|
|
20
|
+
header: [
|
|
21
|
+
component(`${id}-header`, 'pageHeader', {
|
|
22
|
+
title: fromQuery(queries.record, `0.${options.titleField}`),
|
|
23
|
+
subtitle: fromQuery(queries.record, '0.summary')
|
|
24
|
+
}, {
|
|
25
|
+
actions: [
|
|
26
|
+
withBehaviors(actionButton(`${id}-back`, options.backLabel, 'secondary'), goesTo(options.backScreen)),
|
|
27
|
+
...options.actions.map((action)=>withBehaviors(actionButton(`${id}-${action.id}`, action.label, action.emphasis), action.dialog ? opensDialog(action.dialog) : goesTo(action.screen)))
|
|
28
|
+
]
|
|
29
|
+
})
|
|
30
|
+
],
|
|
31
|
+
summary: [
|
|
32
|
+
component(`${id}-status`, 'statusChip', {
|
|
33
|
+
status: fromQuery(queries.summary, '0.status'),
|
|
34
|
+
tone: fromQuery(queries.summary, '0.tone')
|
|
35
|
+
}),
|
|
36
|
+
...options.facts.map((fact)=>component(`${id}-${fact.id}`, 'statCard', {
|
|
37
|
+
label: fact.label,
|
|
38
|
+
value: fromQuery(queries.summary, `0.${fact.field}`),
|
|
39
|
+
...fact.format ? {
|
|
40
|
+
format: fact.format
|
|
41
|
+
} : {},
|
|
42
|
+
...currencyOfData
|
|
43
|
+
}))
|
|
44
|
+
],
|
|
45
|
+
tabs: [
|
|
46
|
+
component(`${id}-tabs`, 'tabSet', {
|
|
47
|
+
tabs: fromQuery(queries.tabs),
|
|
48
|
+
urlKey: 'tab',
|
|
49
|
+
label: `${options.displayName} sections`
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
main: [
|
|
53
|
+
component(`${id}-form`, 'formScreenBody', {
|
|
54
|
+
mode: 'readOnly',
|
|
55
|
+
sections: fromQuery(queries.sections),
|
|
56
|
+
values: fromQuery(queries.record, '0'),
|
|
57
|
+
...currencyOfData
|
|
58
|
+
}),
|
|
59
|
+
...options.extras.map((extra)=>component(`${id}-${extra.key.toLowerCase()}`, 'dataList', {
|
|
60
|
+
label: extra.label,
|
|
61
|
+
rows: fromQuery(`${options.entity}${extra.key}`),
|
|
62
|
+
columns: fromQuery(`${options.entity}${extra.key}Columns`),
|
|
63
|
+
titleField: extra.titleField,
|
|
64
|
+
pageSize: extra.pageSize ?? 8,
|
|
65
|
+
...currencyOfData
|
|
66
|
+
}))
|
|
67
|
+
],
|
|
68
|
+
related: [],
|
|
69
|
+
activity: [
|
|
70
|
+
component(`${id}-activity`, 'activityFeed', {
|
|
71
|
+
label: 'Activity',
|
|
72
|
+
entries: fromQuery(queries.activity),
|
|
73
|
+
...localeOfData
|
|
74
|
+
})
|
|
75
|
+
],
|
|
76
|
+
aside: []
|
|
77
|
+
},
|
|
78
|
+
displayName: options.displayName,
|
|
79
|
+
description: options.description,
|
|
80
|
+
metadata: bookingsMetadata(options.name, 'Detail', [
|
|
81
|
+
TemplateScope.Feature,
|
|
82
|
+
TemplateScope.Subfeature
|
|
83
|
+
])
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** The booking page: the booking reference as its title, its status, date, hours and people at the top, its details, attendees and extras in the main region, and the activity beside it. */ const bookingPageTemplate = recordPageOf({
|
|
87
|
+
name: 'BookingPage',
|
|
88
|
+
entity: BookingsEntityKind.Booking,
|
|
89
|
+
displayName: 'Booking page',
|
|
90
|
+
description: 'One booking: status, date, hours and people, its details, attendees and extras, and its activity.',
|
|
91
|
+
titleField: 'reference',
|
|
92
|
+
backScreen: 'bookings.list',
|
|
93
|
+
backLabel: 'Back to bookings',
|
|
94
|
+
facts: [
|
|
95
|
+
{
|
|
96
|
+
id: 'date',
|
|
97
|
+
label: 'Date',
|
|
98
|
+
field: 'date'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'hours',
|
|
102
|
+
label: 'Hours',
|
|
103
|
+
field: 'hours'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'people',
|
|
107
|
+
label: 'People',
|
|
108
|
+
field: 'people'
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
extras: [
|
|
112
|
+
{
|
|
113
|
+
key: 'Attendees',
|
|
114
|
+
label: 'Attendees',
|
|
115
|
+
titleField: 'name'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: 'Extras',
|
|
119
|
+
label: 'Extras',
|
|
120
|
+
titleField: 'item'
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
actions: []
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export { bookingPageTemplate };
|
|
127
|
+
//# sourceMappingURL=recordTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordTemplates.js","sources":["../../../templates/recordTemplates.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 { ScreenTemplate, TemplateScope } from '@cratis/scene.model';\nimport { recordPageTemplate } from '@cratis/scene.blueprint.default';\nimport { BookingsEntityKind, currencyOfData, fromQuery, localeOfData, bookingsQueriesOf } from '../bookingsQueries';\nimport { actionButton, component, goesTo, bookingsMetadata, opensDialog, withBehaviors } from '../bookingsParts';\n\ninterface Fact { id: string; label: string; field: string; format?: 'currency' | 'percent' }\ninterface Extra { key: string; label: string; titleField: string; pageSize?: number }\ninterface Action { id: string; label: string; emphasis: 'primary' | 'secondary' | 'quiet' | 'danger'; dialog?: string; screen?: string }\n\ninterface RecordOptions {\n name: string;\n entity: BookingsEntityKind;\n displayName: string;\n description: string;\n titleField: string;\n backScreen: string;\n backLabel: string;\n facts: Fact[];\n extras: Extra[];\n actions: Action[];\n}\n\n/**\n * One record page: the foundation `RecordPage` with the record's own title, its status and key facts at the top, its fields and the lists that belong to it in the\n * main region, and the activity beside it. What it shows is the record the list handed it the id of.\n */\nfunction recordPageOf(options: RecordOptions): ScreenTemplate {\n const queries = bookingsQueriesOf(options.entity);\n const id = options.name;\n return {\n name: options.name,\n fitsSlot: 'content',\n slots: recordPageTemplate.slots,\n arrangement: recordPageTemplate.arrangement,\n content: {\n header: [component(`${id}-header`, 'pageHeader', { title: fromQuery(queries.record, `0.${options.titleField}`), subtitle: fromQuery(queries.record, '0.summary') }, {\n actions: [\n withBehaviors(actionButton(`${id}-back`, options.backLabel, 'secondary'), goesTo(options.backScreen)),\n ...options.actions.map(action => withBehaviors(actionButton(`${id}-${action.id}`, action.label, action.emphasis), action.dialog ? opensDialog(action.dialog) : goesTo(action.screen!))),\n ],\n })],\n summary: [\n component(`${id}-status`, 'statusChip', { status: fromQuery(queries.summary, '0.status'), tone: fromQuery(queries.summary, '0.tone') }),\n ...options.facts.map(fact => component(`${id}-${fact.id}`, 'statCard', {\n label: fact.label, value: fromQuery(queries.summary, `0.${fact.field}`), ...(fact.format ? { format: fact.format } : {}), ...currencyOfData,\n })),\n ],\n tabs: [component(`${id}-tabs`, 'tabSet', { tabs: fromQuery(queries.tabs), urlKey: 'tab', label: `${options.displayName} sections` })],\n main: [\n component(`${id}-form`, 'formScreenBody', { mode: 'readOnly', sections: fromQuery(queries.sections), values: fromQuery(queries.record, '0'), ...currencyOfData }),\n ...options.extras.map(extra => component(`${id}-${extra.key.toLowerCase()}`, 'dataList', {\n label: extra.label, rows: fromQuery(`${options.entity}${extra.key}`), columns: fromQuery(`${options.entity}${extra.key}Columns`), titleField: extra.titleField, pageSize: extra.pageSize ?? 8, ...currencyOfData,\n })),\n ],\n related: [],\n activity: [component(`${id}-activity`, 'activityFeed', { label: 'Activity', entries: fromQuery(queries.activity), ...localeOfData })],\n aside: [],\n },\n displayName: options.displayName,\n description: options.description,\n metadata: bookingsMetadata(options.name, 'Detail', [TemplateScope.Feature, TemplateScope.Subfeature]),\n };\n}\n\n/** The booking page: the booking reference as its title, its status, date, hours and people at the top, its details, attendees and extras in the main region, and the activity beside it. */\nexport const bookingPageTemplate = recordPageOf({\n name: 'BookingPage', entity: BookingsEntityKind.Booking, displayName: 'Booking page', description: 'One booking: status, date, hours and people, its details, attendees and extras, and its activity.', titleField: 'reference', backScreen: 'bookings.list', backLabel: 'Back to bookings',\n facts: [\n { id: 'date', label: 'Date', field: 'date' },\n { id: 'hours', label: 'Hours', field: 'hours' },\n { id: 'people', label: 'People', field: 'people' },\n ],\n extras: [{ key: 'Attendees', label: 'Attendees', titleField: 'name' }, { key: 'Extras', label: 'Extras', titleField: 'item' }],\n actions: [],\n});\n"],"names":["recordPageOf","options","queries","bookingsQueriesOf","entity","id","name","fitsSlot","slots","recordPageTemplate","arrangement","content","header","component","title","fromQuery","record","titleField","subtitle","actions","withBehaviors","actionButton","backLabel","goesTo","backScreen","map","action","label","emphasis","dialog","opensDialog","screen","summary","status","tone","facts","fact","value","field","format","currencyOfData","tabs","urlKey","displayName","main","mode","sections","values","extras","extra","key","toLowerCase","rows","columns","pageSize","related","activity","entries","localeOfData","aside","description","metadata","bookingsMetadata","TemplateScope","Feature","Subfeature","bookingPageTemplate","BookingsEntityKind","Booking"],"mappings":";;;;;AAAA;AACA;AAwBA;;;IAIA,SAASA,aAAaC,OAAsB,EAAA;IACxC,MAAMC,OAAAA,GAAUC,iBAAAA,CAAkBF,OAAAA,CAAQG,MAAM,CAAA;IAChD,MAAMC,EAAAA,GAAKJ,QAAQK,IAAI;IACvB,OAAO;AACHA,QAAAA,IAAAA,EAAML,QAAQK,IAAI;QAClBC,QAAAA,EAAU,SAAA;AACVC,QAAAA,KAAAA,EAAOC,mBAAmBD,KAAK;AAC/BE,QAAAA,WAAAA,EAAaD,mBAAmBC,WAAW;QAC3CC,OAAAA,EAAS;YACLC,MAAAA,EAAQ;AAACC,gBAAAA,SAAAA,CAAU,CAAA,EAAGR,EAAAA,CAAG,OAAO,CAAC,EAAE,YAAA,EAAc;oBAAES,KAAAA,EAAOC,SAAAA,CAAUb,QAAQc,MAAM,EAAE,CAAC,EAAE,EAAEf,OAAAA,CAAQgB,UAAU,CAAA,CAAE,CAAA;oBAAGC,QAAAA,EAAUH,SAAAA,CAAUb,OAAAA,CAAQc,MAAM,EAAE,WAAA;iBAAa,EAAG;oBAChKG,OAAAA,EAAS;AACLC,wBAAAA,aAAAA,CAAcC,YAAAA,CAAa,CAAA,EAAGhB,EAAAA,CAAG,KAAK,CAAC,EAAEJ,OAAAA,CAAQqB,SAAS,EAAE,WAAA,CAAA,EAAcC,MAAAA,CAAOtB,OAAAA,CAAQuB,UAAU,CAAA,CAAA;AAChGvB,wBAAAA,GAAAA,OAAAA,CAAQkB,OAAO,CAACM,GAAG,CAACC,CAAAA,MAAAA,GAAUN,aAAAA,CAAcC,YAAAA,CAAa,CAAA,EAAGhB,EAAAA,CAAG,CAAC,EAAEqB,OAAOrB,EAAE,CAAA,CAAE,EAAEqB,MAAAA,CAAOC,KAAK,EAAED,MAAAA,CAAOE,QAAQ,GAAGF,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Template.d.ts","sourceRoot":"","sources":["../../../templates/wizardTemplate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAMpE,eAAO,MAAM,wBAAwB,EAAE,cAmBtC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TemplateScope } from '@cratis/scene.model';
|
|
2
|
+
import { component, wizardScreenTemplate } from '@cratis/scene.blueprint.default';
|
|
3
|
+
import { fromQuery, BookingsQuery, currencyOfData, localeOfData } from '../bookingsQueries.js';
|
|
4
|
+
import { bookingsMetadata } from '../bookingsParts.js';
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/** The new-booking wizard: what you need, when you need it, a few details, then a review. The step the person has reached survives a refresh and an invalid step blocks Next and says why. */ const newBookingWizardTemplate = {
|
|
9
|
+
name: 'NewBookingWizard',
|
|
10
|
+
fitsSlot: 'content',
|
|
11
|
+
slots: wizardScreenTemplate.slots,
|
|
12
|
+
arrangement: wizardScreenTemplate.arrangement,
|
|
13
|
+
content: {
|
|
14
|
+
header: [
|
|
15
|
+
component('NewBookingWizard-header', 'pageHeader', {
|
|
16
|
+
title: 'New booking',
|
|
17
|
+
subtitle: 'Four short steps'
|
|
18
|
+
})
|
|
19
|
+
],
|
|
20
|
+
progress: [
|
|
21
|
+
component('NewBookingWizard-progress', 'wizardProgress', {
|
|
22
|
+
steps: fromQuery(BookingsQuery.BookingWizardSteps),
|
|
23
|
+
urlKey: 'step'
|
|
24
|
+
}, {
|
|
25
|
+
resource: [
|
|
26
|
+
component('NewBookingWizard-resource', 'formScreenBody', {
|
|
27
|
+
mode: 'create',
|
|
28
|
+
sections: fromQuery(BookingsQuery.BookingResourceSections),
|
|
29
|
+
errors: fromQuery(BookingsQuery.FormErrors, '0'),
|
|
30
|
+
...localeOfData
|
|
31
|
+
})
|
|
32
|
+
],
|
|
33
|
+
when: [
|
|
34
|
+
component('NewBookingWizard-when', 'formScreenBody', {
|
|
35
|
+
mode: 'create',
|
|
36
|
+
sections: fromQuery(BookingsQuery.BookingWhenSections),
|
|
37
|
+
errors: fromQuery(BookingsQuery.FormErrors, '0'),
|
|
38
|
+
...localeOfData
|
|
39
|
+
})
|
|
40
|
+
],
|
|
41
|
+
details: [
|
|
42
|
+
component('NewBookingWizard-details', 'formScreenBody', {
|
|
43
|
+
mode: 'create',
|
|
44
|
+
sections: fromQuery(BookingsQuery.BookingDetailSections),
|
|
45
|
+
errors: fromQuery(BookingsQuery.FormErrors, '0'),
|
|
46
|
+
...localeOfData
|
|
47
|
+
})
|
|
48
|
+
],
|
|
49
|
+
review: [
|
|
50
|
+
component('NewBookingWizard-review', 'formScreenBody', {
|
|
51
|
+
mode: 'readOnly',
|
|
52
|
+
sections: fromQuery(BookingsQuery.BookingReviewSections),
|
|
53
|
+
values: fromQuery(BookingsQuery.BookingReviewValues, '0'),
|
|
54
|
+
...currencyOfData
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
],
|
|
59
|
+
step: [],
|
|
60
|
+
actions: []
|
|
61
|
+
},
|
|
62
|
+
displayName: 'New booking wizard',
|
|
63
|
+
description: 'Resource, time, details, then review and book; the step survives a refresh and an invalid step blocks Next and says why.',
|
|
64
|
+
metadata: bookingsMetadata('NewBookingWizard', 'Wizard', [
|
|
65
|
+
TemplateScope.Feature,
|
|
66
|
+
TemplateScope.Subfeature
|
|
67
|
+
])
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { newBookingWizardTemplate };
|
|
71
|
+
//# sourceMappingURL=wizardTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardTemplate.js","sources":["../../../templates/wizardTemplate.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 { ScreenTemplate, TemplateScope } from '@cratis/scene.model';\nimport { wizardScreenTemplate } from '@cratis/scene.blueprint.default';\nimport { BookingsQuery, currencyOfData, fromQuery, localeOfData } from '../bookingsQueries';\nimport { bookingsMetadata, component } from '../bookingsParts';\n\n/** The new-booking wizard: what you need, when you need it, a few details, then a review. The step the person has reached survives a refresh and an invalid step blocks Next and says why. */\nexport const newBookingWizardTemplate: ScreenTemplate = {\n name: 'NewBookingWizard',\n fitsSlot: 'content',\n slots: wizardScreenTemplate.slots,\n arrangement: wizardScreenTemplate.arrangement,\n content: {\n header: [component('NewBookingWizard-header', 'pageHeader', { title: 'New booking', subtitle: 'Four short steps' })],\n progress: [component('NewBookingWizard-progress', 'wizardProgress', { steps: fromQuery(BookingsQuery.BookingWizardSteps), urlKey: 'step' }, {\n resource: [component('NewBookingWizard-resource', 'formScreenBody', { mode: 'create', sections: fromQuery(BookingsQuery.BookingResourceSections), errors: fromQuery(BookingsQuery.FormErrors, '0'), ...localeOfData })],\n when: [component('NewBookingWizard-when', 'formScreenBody', { mode: 'create', sections: fromQuery(BookingsQuery.BookingWhenSections), errors: fromQuery(BookingsQuery.FormErrors, '0'), ...localeOfData })],\n details: [component('NewBookingWizard-details', 'formScreenBody', { mode: 'create', sections: fromQuery(BookingsQuery.BookingDetailSections), errors: fromQuery(BookingsQuery.FormErrors, '0'), ...localeOfData })],\n review: [component('NewBookingWizard-review', 'formScreenBody', { mode: 'readOnly', sections: fromQuery(BookingsQuery.BookingReviewSections), values: fromQuery(BookingsQuery.BookingReviewValues, '0'), ...currencyOfData })],\n })],\n step: [],\n actions: [],\n },\n displayName: 'New booking wizard',\n description: 'Resource, time, details, then review and book; the step survives a refresh and an invalid step blocks Next and says why.',\n metadata: bookingsMetadata('NewBookingWizard', 'Wizard', [TemplateScope.Feature, TemplateScope.Subfeature]),\n};\n"],"names":["newBookingWizardTemplate","name","fitsSlot","slots","wizardScreenTemplate","arrangement","content","header","component","title","subtitle","progress","steps","fromQuery","BookingsQuery","BookingWizardSteps","urlKey","resource","mode","sections","BookingResourceSections","errors","FormErrors","localeOfData","when","BookingWhenSections","details","BookingDetailSections","review","BookingReviewSections","values","BookingReviewValues","currencyOfData","step","actions","displayName","description","metadata","bookingsMetadata","TemplateScope","Feature","Subfeature"],"mappings":";;;;;AAAA;AACA;AAOA,+LACO,MAAMA,wBAAAA,GAA2C;IACpDC,IAAAA,EAAM,kBAAA;IACNC,QAAAA,EAAU,SAAA;AACVC,IAAAA,KAAAA,EAAOC,qBAAqBD,KAAK;AACjCE,IAAAA,WAAAA,EAAaD,qBAAqBC,WAAW;IAC7CC,OAAAA,EAAS;QACLC,MAAAA,EAAQ;AAACC,YAAAA,SAAAA,CAAU,2BAA2B,YAAA,EAAc;gBAAEC,KAAAA,EAAO,aAAA;gBAAeC,QAAAA,EAAU;AAAmB,aAAA;AAAG,SAAA;QACpHC,QAAAA,EAAU;AAACH,YAAAA,SAAAA,CAAU,6BAA6B,gBAAA,EAAkB;gBAAEI,KAAAA,EAAOC,SAAAA,CAAUC,cAAcC,kBAAkB,CAAA;gBAAGC,MAAAA,EAAQ;aAAO,EAAG;gBACxIC,QAAAA,EAAU;AAACT,oBAAAA,SAAAA,CAAU,6BAA6B,gBAAA,EAAkB;wBAAEU,IAAAA,EAAM,QAAA;wBAAUC,QAAAA,EAAUN,SAAAA,CAAUC,cAAcM,uBAAuB,CAAA;wBAAGC,MAAAA,EAAQR,SAAAA,CAAUC,aAAAA,CAAcQ,UAAU,EAAE,GAAA,CAAA;AAAM,wBAAA,GAAGC;AAAa,qBAAA;AAAG,iBAAA;gBACvNC,IAAAA,EAAM;AAAChB,oBAAAA,SAAAA,CAAU,yBAAyB,gBAAA,EAAkB;wBAAEU,IAAAA,EAAM,QAAA;wBAAUC,QAAAA,EAAUN,SAAAA,CAAUC,cAAcW,mBAAmB,CAAA;wBAAGJ,MAAAA,EAAQR,SAAAA,CAAUC,aAAAA,CAAcQ,UAAU,EAAE,GAAA,CAAA;AAAM,wBAAA,GAAGC;AAAa,qB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