@cratis/scene.blueprint.vendors 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 +107 -0
- package/dist/cjs/blueprint.js +19 -0
- package/dist/cjs/blueprint.js.map +1 -0
- package/dist/cjs/index.js +68 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/manifest.js +87 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/navigation.js +109 -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/boardTemplate.js +78 -0
- package/dist/cjs/templates/boardTemplate.js.map +1 -0
- package/dist/cjs/templates/dashboardTemplates.js +151 -0
- package/dist/cjs/templates/dashboardTemplates.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 +25 -0
- package/dist/cjs/templates/index.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +145 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/recordTemplates.js +135 -0
- package/dist/cjs/templates/recordTemplates.js.map +1 -0
- package/dist/cjs/vendorsApplication.js +49 -0
- package/dist/cjs/vendorsApplication.js.map +1 -0
- package/dist/cjs/vendorsParts.js +151 -0
- package/dist/cjs/vendorsParts.js.map +1 -0
- package/dist/cjs/vendorsQueries.js +64 -0
- package/dist/cjs/vendorsQueries.js.map +1 -0
- package/dist/cjs/vendorsScreenSet.js +40 -0
- package/dist/cjs/vendorsScreenSet.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/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 +85 -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 +105 -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/boardTemplate.d.ts +3 -0
- package/dist/esm/templates/boardTemplate.d.ts.map +1 -0
- package/dist/esm/templates/boardTemplate.js +76 -0
- package/dist/esm/templates/boardTemplate.js.map +1 -0
- package/dist/esm/templates/dashboardTemplates.d.ts +3 -0
- package/dist/esm/templates/dashboardTemplates.d.ts.map +1 -0
- package/dist/esm/templates/dashboardTemplates.js +149 -0
- package/dist/esm/templates/dashboardTemplates.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 +17 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +3 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +143 -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 +133 -0
- package/dist/esm/templates/recordTemplates.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/vendorsApplication.d.ts +10 -0
- package/dist/esm/vendorsApplication.d.ts.map +1 -0
- package/dist/esm/vendorsApplication.js +44 -0
- package/dist/esm/vendorsApplication.js.map +1 -0
- package/dist/esm/vendorsParts.d.ts +16 -0
- package/dist/esm/vendorsParts.d.ts.map +1 -0
- package/dist/esm/vendorsParts.js +133 -0
- package/dist/esm/vendorsParts.js.map +1 -0
- package/dist/esm/vendorsQueries.d.ts +38 -0
- package/dist/esm/vendorsQueries.d.ts.map +1 -0
- package/dist/esm/vendorsQueries.js +56 -0
- package/dist/esm/vendorsQueries.js.map +1 -0
- package/dist/esm/vendorsScreenSet.d.ts +7 -0
- package/dist/esm/vendorsScreenSet.d.ts.map +1 -0
- package/dist/esm/vendorsScreenSet.js +38 -0
- package/dist/esm/vendorsScreenSet.js.map +1 -0
- package/index.ts +14 -0
- package/manifest.ts +41 -0
- package/navigation.ts +53 -0
- package/package.json +78 -4
- package/packageName.ts +5 -0
- package/sampleData/vendors-en.json +863 -0
- package/screens/index.ts +20 -0
- package/templateProvenance.ts +15 -0
- package/templates/boardTemplate.ts +54 -0
- package/templates/dashboardTemplates.ts +76 -0
- package/templates/formTemplates.ts +33 -0
- package/templates/index.ts +18 -0
- package/templates/listTemplates.ts +96 -0
- package/templates/recordTemplates.ts +78 -0
- package/thumbnails/VendorPage.svg +17 -0
- package/thumbnails/VendorsList.svg +29 -0
- package/thumbnails/VendorsOnboardingBoard.svg +23 -0
- package/thumbnails/VendorsPerformance.svg +15 -0
- package/thumbnails/VendorsQuickCreateVendor.svg +12 -0
- package/thumbnails/vendors.svg +14 -0
- package/vendorsApplication.ts +28 -0
- package/vendorsParts.ts +58 -0
- package/vendorsQueries.ts +56 -0
- package/vendorsScreenSet.ts +21 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TemplateScope } from '@cratis/scene.model';
|
|
2
|
+
import { quickCreateDialogTemplate, component } from '@cratis/scene.blueprint.default';
|
|
3
|
+
import { localeOfData, fromQuery, VendorsQuery } from '../vendorsQueries.js';
|
|
4
|
+
import { vendorsMetadata, withBehaviors, closesDialog } from '../vendorsParts.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 quick-create dialog: the foundation `QuickCreateDialog` - a short form opened from a page to make one record without leaving it - with the fields
|
|
10
|
+
* that thing needs to get started.
|
|
11
|
+
*/ function quickCreateOf(name, title, sections, noun, submit) {
|
|
12
|
+
return {
|
|
13
|
+
name,
|
|
14
|
+
slots: quickCreateDialogTemplate.slots,
|
|
15
|
+
content: {
|
|
16
|
+
header: [
|
|
17
|
+
component(`${name}-frame`, 'dialogFrame', {
|
|
18
|
+
title,
|
|
19
|
+
subtitle: 'Only what is needed to get started'
|
|
20
|
+
})
|
|
21
|
+
],
|
|
22
|
+
body: [
|
|
23
|
+
withBehaviors(component(`${name}-form`, 'formScreenBody', {
|
|
24
|
+
mode: 'create',
|
|
25
|
+
saveAndNew: false,
|
|
26
|
+
strings: {
|
|
27
|
+
formSave: submit
|
|
28
|
+
},
|
|
29
|
+
sections: fromQuery(sections),
|
|
30
|
+
errors: fromQuery(VendorsQuery.FormErrors, '0'),
|
|
31
|
+
...localeOfData
|
|
32
|
+
}), closesDialog())
|
|
33
|
+
],
|
|
34
|
+
actions: []
|
|
35
|
+
},
|
|
36
|
+
displayName: `Vendors quick create ${noun}`,
|
|
37
|
+
description: `A short form that creates one ${noun} without leaving the page.`,
|
|
38
|
+
metadata: vendorsMetadata(name, 'Dialog', [
|
|
39
|
+
TemplateScope.Slice
|
|
40
|
+
])
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The quick dialogs of the blueprint. */ const vendorsDialogs = [
|
|
44
|
+
quickCreateOf('VendorsQuickCreateVendor', 'New vendor', 'VendorQuickSections', 'vendor', 'Create')
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export { vendorsDialogs };
|
|
48
|
+
//# sourceMappingURL=formTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formTemplates.js","sources":["../../../templates/formTemplates.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 { DialogTemplate, TemplateScope } from '@cratis/scene.model';\nimport { quickCreateDialogTemplate } from '@cratis/scene.blueprint.default';\nimport { VendorsQuery, fromQuery, localeOfData } from '../vendorsQueries';\nimport { closesDialog, component, vendorsMetadata, withBehaviors } from '../vendorsParts';\n\n/**\n * One quick-create dialog: the foundation `QuickCreateDialog` - a short form opened from a page to make one record without leaving it - with the fields\n * that thing needs to get started.\n */\nfunction quickCreateOf(name: string, title: string, sections: string, noun: string, submit: string): DialogTemplate {\n return {\n name,\n slots: quickCreateDialogTemplate.slots,\n content: {\n header: [component(`${name}-frame`, 'dialogFrame', { title, subtitle: 'Only what is needed to get started' })],\n body: [withBehaviors(component(`${name}-form`, 'formScreenBody', {\n mode: 'create', saveAndNew: false, strings: { formSave: submit }, sections: fromQuery(sections), errors: fromQuery(VendorsQuery.FormErrors, '0'), ...localeOfData,\n }), closesDialog())],\n actions: [],\n },\n displayName: `Vendors quick create ${noun}`,\n description: `A short form that creates one ${noun} without leaving the page.`,\n metadata: vendorsMetadata(name, 'Dialog', [TemplateScope.Slice]),\n };\n}\n\n/** The quick dialogs of the blueprint. */\nexport const vendorsDialogs: DialogTemplate[] = [\n quickCreateOf('VendorsQuickCreateVendor', 'New vendor', 'VendorQuickSections', 'vendor', 'Create'),\n];\n"],"names":["quickCreateOf","name","title","sections","noun","submit","slots","quickCreateDialogTemplate","content","header","component","subtitle","body","withBehaviors","mode","saveAndNew","strings","formSave","fromQuery","errors","VendorsQuery","FormErrors","localeOfData","closesDialog","actions","displayName","description","metadata","vendorsMetadata","TemplateScope","Slice","vendorsDialogs"],"mappings":";;;;;AAAA;AACA;AAOA;;;IAIA,SAASA,aAAAA,CAAcC,IAAY,EAAEC,KAAa,EAAEC,QAAgB,EAAEC,IAAY,EAAEC,MAAc,EAAA;IAC9F,OAAO;AACHJ,QAAAA,IAAAA;AACAK,QAAAA,KAAAA,EAAOC,0BAA0BD,KAAK;QACtCE,OAAAA,EAAS;YACLC,MAAAA,EAAQ;AAACC,gBAAAA,SAAAA,CAAU,CAAA,EAAGT,IAAAA,CAAK,MAAM,CAAC,EAAE,aAAA,EAAe;AAAEC,oBAAAA,KAAAA;oBAAOS,QAAAA,EAAU;AAAqC,iBAAA;AAAG,aAAA;YAC9GC,IAAAA,EAAM;AAACC,gBAAAA,aAAAA,CAAcH,UAAU,CAAA,EAAGT,IAAAA,CAAK,KAAK,CAAC,EAAE,gBAAA,EAAkB;oBAC7Da,IAAAA,EAAM,QAAA;oBAAUC,UAAAA,EAAY,KAAA;oBAAOC,OAAAA,EAAS;wBAAEC,QAAAA,EAAUZ;AAAO,qBAAA;AAAGF,oBAAAA,QAAAA,EAAUe,SAAAA,CAAUf,QAAAA,CAAAA;oBAAWgB,MAAAA,EAAQD,SAAAA,CAAUE,YAAAA,CAAaC,UAAU,EAAE,GAAA,CAAA;AAAM,oBAAA,GAAGC;iBACzJ,CAAA,EAAIC,YAAAA,EAAAA;AAAgB,aAAA;AACpBC,YAAAA,OAAAA,EAAS;AACb,SAAA;QACAC,WAAAA,EAAa,CAAC,qBAAqB,EAAErB,IAAAA,CAAAA,CAAM;AAC3CsB,QAAAA,WAAAA,EAAa,CAAC,8BAA8B,EAAEtB,IAAAA,CAAK,0BAA0B,CAAC;QAC9EuB,QAAAA,EAAUC,eAAAA,CAAgB3B,MAAM,QAAA,EAAU;AAAC4B,YAAAA,aAAAA,CAAcC;AAAM,SAAA;AACnE,KAAA;AACJ;AAEA,2CACO,MAAMC,cAAAA,GAAmC;IAC5C/B,aAAAA,CAAc,0BAAA,EAA4B,YAAA,EAAc,qBAAA,EAAuB,QAAA,EAAU,QAAA;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './listTemplates';
|
|
2
|
+
export * from './recordTemplates';
|
|
3
|
+
export * from './boardTemplate';
|
|
4
|
+
export * from './dashboardTemplates';
|
|
5
|
+
export * from './formTemplates';
|
|
6
|
+
export declare const vendorsScreenTemplates: import("@cratis/scene.model/screens").ScreenTemplate[];
|
|
7
|
+
export { vendorsDialogs as vendorsDialogTemplates } from './formTemplates';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../templates/index.ts"],"names":[],"mappings":"AAQA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAGhC,eAAO,MAAM,sBAAsB,wDAAmG,CAAC;AAEvI,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { vendorsListTemplate } from './listTemplates.js';
|
|
2
|
+
import { vendorPageTemplate } from './recordTemplates.js';
|
|
3
|
+
import { vendorsOnboardingTemplate } from './boardTemplate.js';
|
|
4
|
+
import { vendorsPerformanceTemplate } from './dashboardTemplates.js';
|
|
5
|
+
export { vendorsDialogs as vendorsDialogTemplates, vendorsDialogs } from './formTemplates.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
|
+
/** Every screen template this blueprint provides, in the order the manifest lists them. */ const vendorsScreenTemplates = [
|
|
10
|
+
vendorsListTemplate,
|
|
11
|
+
vendorPageTemplate,
|
|
12
|
+
vendorsOnboardingTemplate,
|
|
13
|
+
vendorsPerformanceTemplate
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export { vendorPageTemplate, vendorsListTemplate, vendorsOnboardingTemplate, vendorsPerformanceTemplate, vendorsScreenTemplates };
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../templates/index.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 { vendorsListTemplate } from './listTemplates';\nimport { vendorPageTemplate } from './recordTemplates';\nimport { vendorsOnboardingTemplate } from './boardTemplate';\nimport { vendorsPerformanceTemplate } from './dashboardTemplates';\n\nexport * from './listTemplates';\nexport * from './recordTemplates';\nexport * from './boardTemplate';\nexport * from './dashboardTemplates';\nexport * from './formTemplates';\n\n/** Every screen template this blueprint provides, in the order the manifest lists them. */\nexport const vendorsScreenTemplates = [vendorsListTemplate, vendorPageTemplate, vendorsOnboardingTemplate, vendorsPerformanceTemplate];\n\nexport { vendorsDialogs as vendorsDialogTemplates } from './formTemplates';\n"],"names":["vendorsScreenTemplates","vendorsListTemplate","vendorPageTemplate","vendorsOnboardingTemplate","vendorsPerformanceTemplate"],"mappings":";;;;;;AAAA;AACA;AAaA,4FACO,MAAMA,sBAAAA,GAAyB;AAACC,IAAAA,mBAAAA;AAAqBC,IAAAA,kBAAAA;AAAoBC,IAAAA,yBAAAA;AAA2BC,IAAAA;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTemplates.d.ts","sourceRoot":"","sources":["../../../templates/listTemplates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkF,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAsFpJ,eAAO,MAAM,mBAAmB,gBAM9B,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { TemplateScope, NotificationLevel, InteractionActionKind, InteractionTriggerKind } from '@cratis/scene.model';
|
|
2
|
+
import { component, listScreenTemplate } from '@cratis/scene.blueprint.default';
|
|
3
|
+
import { localeOfData, fromQuery, vendorsQueriesOf, VendorsEntityKind } from '../vendorsQueries.js';
|
|
4
|
+
import { withBehaviors, opensDialog, goesTo, actionButton, vendorsMetadata, opensRecordOnSelect, opensDialogOnSelect } from '../vendorsParts.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
|
+
const listScopes = [
|
|
9
|
+
TemplateScope.Module,
|
|
10
|
+
TemplateScope.Feature
|
|
11
|
+
];
|
|
12
|
+
/** 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. */ const exportAction = (id)=>withBehaviors(actionButton(id, 'Export', 'secondary'), [
|
|
13
|
+
{
|
|
14
|
+
bindings: [
|
|
15
|
+
{
|
|
16
|
+
trigger: {
|
|
17
|
+
kind: InteractionTriggerKind.Click
|
|
18
|
+
},
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
kind: InteractionActionKind.Notify,
|
|
22
|
+
level: NotificationLevel.Info,
|
|
23
|
+
message: {
|
|
24
|
+
text: 'The export has started.'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* One list: the foundation `ListScreen` with its header, toolbar, filters, list and bulk bar filled for an entity. The slots, arrangement and
|
|
34
|
+
* every behavior - sort, search, paging and selection in the address, the table collapsing to cards on a phone - are the foundation's.
|
|
35
|
+
*/ function listTemplateOf(options) {
|
|
36
|
+
const queries = vendorsQueriesOf(options.entity);
|
|
37
|
+
const id = options.name;
|
|
38
|
+
const listId = `${id}-records`;
|
|
39
|
+
const primary = withBehaviors(actionButton(`${id}-primary`, options.primary.label, 'primary'), options.primary.dialog ? opensDialog(options.primary.dialog) : goesTo(options.primary.screen));
|
|
40
|
+
const list = component(listId, 'dataList', {
|
|
41
|
+
label: options.title,
|
|
42
|
+
rows: fromQuery(queries.rows),
|
|
43
|
+
columns: fromQuery(queries.columns),
|
|
44
|
+
titleField: options.titleField,
|
|
45
|
+
pageSize: options.cards ? 12 : 10,
|
|
46
|
+
urlKey: options.urlKey,
|
|
47
|
+
...localeOfData,
|
|
48
|
+
rowActions: options.rowActions,
|
|
49
|
+
...options.readOnly ? {} : {
|
|
50
|
+
selectionMode: options.recordScreen || options.recordDialog ? 'single' : 'multiple'
|
|
51
|
+
},
|
|
52
|
+
...options.cards ? {
|
|
53
|
+
variant: 'cards',
|
|
54
|
+
...options.cards.imageField ? {
|
|
55
|
+
imageField: options.cards.imageField
|
|
56
|
+
} : {}
|
|
57
|
+
} : {},
|
|
58
|
+
...options.grouped ? {
|
|
59
|
+
variant: 'grouped',
|
|
60
|
+
groupBy: options.grouped.groupBy
|
|
61
|
+
} : {},
|
|
62
|
+
...options.toneField ? {
|
|
63
|
+
toneField: options.toneField
|
|
64
|
+
} : {}
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
name: options.name,
|
|
68
|
+
fitsSlot: 'content',
|
|
69
|
+
slots: listScreenTemplate.slots,
|
|
70
|
+
arrangement: listScreenTemplate.arrangement,
|
|
71
|
+
content: {
|
|
72
|
+
header: [
|
|
73
|
+
component(`${id}-header`, 'pageHeader', {
|
|
74
|
+
title: options.title,
|
|
75
|
+
subtitle: options.subtitle
|
|
76
|
+
}, {
|
|
77
|
+
actions: [
|
|
78
|
+
exportAction(`${id}-export`),
|
|
79
|
+
primary
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
],
|
|
83
|
+
toolbar: [
|
|
84
|
+
component(`${id}-search`, 'globalSearch', {
|
|
85
|
+
placeholder: options.searchLabel,
|
|
86
|
+
label: options.searchLabel,
|
|
87
|
+
urlKey: `${options.urlKey}q`
|
|
88
|
+
}),
|
|
89
|
+
component(`${id}-views`, 'savedViewsMenu', {
|
|
90
|
+
views: fromQuery(queries.views),
|
|
91
|
+
savePermission: 'enabled',
|
|
92
|
+
managePermission: 'enabled'
|
|
93
|
+
}),
|
|
94
|
+
component(`${id}-columns`, 'columnChooser', {
|
|
95
|
+
columns: fromQuery(queries.columnChoices)
|
|
96
|
+
})
|
|
97
|
+
],
|
|
98
|
+
filters: [
|
|
99
|
+
component(`${id}-filter`, 'filterBuilder', {
|
|
100
|
+
fields: fromQuery(queries.filterFields),
|
|
101
|
+
...localeOfData
|
|
102
|
+
})
|
|
103
|
+
],
|
|
104
|
+
list: [
|
|
105
|
+
options.recordScreen ? withBehaviors(list, opensRecordOnSelect(listId, options.recordScreen)) : options.recordDialog ? withBehaviors(list, opensDialogOnSelect(options.recordDialog)) : list
|
|
106
|
+
],
|
|
107
|
+
bulkBar: options.recordScreen || options.recordDialog || options.readOnly ? [] : [
|
|
108
|
+
component(`${id}-bulk`, 'bulkBar', {
|
|
109
|
+
selection: fromQuery(queries.selection),
|
|
110
|
+
actions: options.bulkActions
|
|
111
|
+
})
|
|
112
|
+
],
|
|
113
|
+
footer: []
|
|
114
|
+
},
|
|
115
|
+
displayName: options.displayName,
|
|
116
|
+
description: options.description,
|
|
117
|
+
metadata: vendorsMetadata(options.name, 'List', listScopes)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** The vendors: every vendor with its category, country, spend this year, rating and status. Choosing a vendor opens it. */ const vendorsListTemplate = listTemplateOf({
|
|
121
|
+
name: 'VendorsList',
|
|
122
|
+
entity: VendorsEntityKind.Vendor,
|
|
123
|
+
displayName: 'Vendors list',
|
|
124
|
+
description: 'Every vendor with its category, country, spend, rating and status, filtered by category, status, country and account manager.',
|
|
125
|
+
title: 'Vendors',
|
|
126
|
+
subtitle: 'Everyone you buy from',
|
|
127
|
+
searchLabel: 'Search vendors',
|
|
128
|
+
urlKey: 'vendors',
|
|
129
|
+
primary: {
|
|
130
|
+
label: 'New vendor',
|
|
131
|
+
dialog: 'VendorsQuickCreateVendor'
|
|
132
|
+
},
|
|
133
|
+
rowActions: [
|
|
134
|
+
'Open',
|
|
135
|
+
'Suspend'
|
|
136
|
+
],
|
|
137
|
+
bulkActions: [],
|
|
138
|
+
titleField: 'name',
|
|
139
|
+
recordScreen: 'vendors.record'
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export { vendorsListTemplate };
|
|
143
|
+
//# sourceMappingURL=listTemplates.js.map
|
|
@@ -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 { VendorsEntityKind, fromQuery, vendorsQueriesOf, localeOfData } from '../vendorsQueries';\nimport { actionButton, component, goesTo, vendorsMetadata, opensDialog, opensDialogOnSelect, opensRecordOnSelect, withBehaviors } from '../vendorsParts';\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: VendorsEntityKind;\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 = vendorsQueriesOf(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: vendorsMetadata(options.name, 'List', listScopes),\n };\n}\n\n\n/** The vendors: every vendor with its category, country, spend this year, rating and status. Choosing a vendor opens it. */\nexport const vendorsListTemplate = listTemplateOf({\n name: 'VendorsList',\n entity: VendorsEntityKind.Vendor, displayName: 'Vendors list', description: 'Every vendor with its category, country, spend, rating and status, filtered by category, status, country and account manager.', title: 'Vendors', subtitle: 'Everyone you buy from', searchLabel: 'Search vendors', urlKey: 'vendors',\n primary: { label: 'New vendor', dialog: 'VendorsQuickCreateVendor' },\n rowActions: ['Open', 'Suspend'], bulkActions: [],\n titleField: 'name', recordScreen: 'vendors.record'\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","vendorsQueriesOf","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","vendorsMetadata","vendorsListTemplate","VendorsEntityKind","Vendor"],"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,gBAAAA,CAAiBF,OAAAA,CAAQG,MAAM,CAAA;IAC/C,MAAMpB,EAAAA,GAAKiB,QAAQI,IAAI;AACvB,IAAA,MAAMC,MAAAA,GAAS,CAAA,EAAGtB,EAAAA,CAAG,QAAQ,CAAC;AAC9B,IAAA,MAAMuB,OAAAA,GAAUtB,aAAAA,CAAcC,YAAAA,CAAa,CAAA,EAAGF,EAAAA,CAAG,QAAQ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CAAe;IAC9CK,IAAAA,EAAM,aAAA;AACND,IAAAA,MAAAA,EAAQ0D,kBAAkBC,MAAM;IAAEN,WAAAA,EAAa,cAAA;IAAgBC,WAAAA,EAAa,+HAAA;IAAiI3C,KAAAA,EAAO,SAAA;IAAWyB,QAAAA,EAAU,uBAAA;IAAyBG,WAAAA,EAAa,gBAAA;IAAkBrB,MAAAA,EAAQ,SAAA;IACzSf,OAAAA,EAAS;QAAEC,KAAAA,EAAO,YAAA;QAAcC,MAAAA,EAAQ;AAA2B,KAAA;IACnEe,UAAAA,EAAY;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAU,KAAA;AAAE+B,IAAAA,WAAAA,EAAa,EAAE;IAChDpC,UAAAA,EAAY,MAAA;IAAQQ,YAAAA,EAAc;AACtC,CAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordTemplates.d.ts","sourceRoot":"","sources":["../../../templates/recordTemplates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAiEpE,eAAO,MAAM,kBAAkB,gBAS7B,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { TemplateScope } from '@cratis/scene.model';
|
|
2
|
+
import { recordPageTemplate, component } from '@cratis/scene.blueprint.default';
|
|
3
|
+
import { localeOfData, fromQuery, currencyOfData, vendorsQueriesOf, VendorsEntityKind } from '../vendorsQueries.js';
|
|
4
|
+
import { vendorsMetadata, withBehaviors, goesTo, actionButton, opensDialog } from '../vendorsParts.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 = vendorsQueriesOf(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: vendorsMetadata(options.name, 'Detail', [
|
|
81
|
+
TemplateScope.Feature,
|
|
82
|
+
TemplateScope.Subfeature
|
|
83
|
+
])
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** The vendor page: the vendor's name as its title, its status, spend, rating and open orders at the top, its details, contacts, purchase orders and certificates in the main region, and the activity beside it. */ const vendorPageTemplate = recordPageOf({
|
|
87
|
+
name: 'VendorPage',
|
|
88
|
+
entity: VendorsEntityKind.Vendor,
|
|
89
|
+
displayName: 'Vendor page',
|
|
90
|
+
description: 'One vendor: status, spend, rating and open orders, its details, contacts, purchase orders and certificates, and its activity.',
|
|
91
|
+
titleField: 'name',
|
|
92
|
+
backScreen: 'vendors.list',
|
|
93
|
+
backLabel: 'Back to vendors',
|
|
94
|
+
facts: [
|
|
95
|
+
{
|
|
96
|
+
id: 'spend',
|
|
97
|
+
label: 'Spend this year',
|
|
98
|
+
field: 'spend',
|
|
99
|
+
format: 'currency'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'rating',
|
|
103
|
+
label: 'Rating',
|
|
104
|
+
field: 'rating'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 'open',
|
|
108
|
+
label: 'Open orders',
|
|
109
|
+
field: 'openOrders'
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
extras: [
|
|
113
|
+
{
|
|
114
|
+
key: 'Contacts',
|
|
115
|
+
label: 'Contacts',
|
|
116
|
+
titleField: 'name'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'Orders',
|
|
120
|
+
label: 'Purchase orders',
|
|
121
|
+
titleField: 'number'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: 'Certificates',
|
|
125
|
+
label: 'Certificates',
|
|
126
|
+
titleField: 'name'
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
actions: []
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export { vendorPageTemplate };
|
|
133
|
+
//# 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 { VendorsEntityKind, currencyOfData, fromQuery, localeOfData, vendorsQueriesOf } from '../vendorsQueries';\nimport { actionButton, component, goesTo, vendorsMetadata, opensDialog, withBehaviors } from '../vendorsParts';\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: VendorsEntityKind;\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 = vendorsQueriesOf(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: vendorsMetadata(options.name, 'Detail', [TemplateScope.Feature, TemplateScope.Subfeature]),\n };\n}\n\n/** The vendor page: the vendor's name as its title, its status, spend, rating and open orders at the top, its details, contacts, purchase orders and certificates in the main region, and the activity beside it. */\nexport const vendorPageTemplate = recordPageOf({\n name: 'VendorPage', entity: VendorsEntityKind.Vendor, displayName: 'Vendor page', description: 'One vendor: status, spend, rating and open orders, its details, contacts, purchase orders and certificates, and its activity.', titleField: 'name', backScreen: 'vendors.list', backLabel: 'Back to vendors',\n facts: [\n { id: 'spend', label: 'Spend this year', field: 'spend', format: 'currency' },\n { id: 'rating', label: 'Rating', field: 'rating' },\n { id: 'open', label: 'Open orders', field: 'openOrders' },\n ],\n extras: [{ key: 'Contacts', label: 'Contacts', titleField: 'name' }, { key: 'Orders', label: 'Purchase orders', titleField: 'number' }, { key: 'Certificates', label: 'Certificates', titleField: 'name' }],\n actions: [],\n});\n"],"names":["recordPageOf","options","queries","vendorsQueriesOf","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","vendorsMetadata","TemplateScope","Feature","Subfeature","vendorPageTemplate","VendorsEntityKind","Vendor"],"mappings":";;;;;AAAA;AACA;AAwBA;;;IAIA,SAASA,aAAaC,OAAsB,EAAA;IACxC,MAAMC,OAAAA,GAAUC,gBAAAA,CAAiBF,OAAAA,CAAQG,MAAM,CAAA;IAC/C,MAAMC,EAAAA,GAAKJ,QAAQK,IAAI;IACvB,OAAO;AACHA,QAAAA,IAAAA,EAAML,QAAQK,IAAI;QAClBC,QAAAA,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