@cratis/scene.blueprint.inventory 0.0.0-stage → 4.53.1

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.
Files changed (138) hide show
  1. package/README.md +66 -2
  2. package/blueprint.ts +16 -0
  3. package/blueprintCatalog.json +190 -0
  4. package/dist/cjs/blueprint.js +19 -0
  5. package/dist/cjs/blueprint.js.map +1 -0
  6. package/dist/cjs/index.js +72 -0
  7. package/dist/cjs/index.js.map +1 -0
  8. package/dist/cjs/inventoryApplication.js +49 -0
  9. package/dist/cjs/inventoryApplication.js.map +1 -0
  10. package/dist/cjs/inventoryParts.js +131 -0
  11. package/dist/cjs/inventoryParts.js.map +1 -0
  12. package/dist/cjs/inventoryQueries.js +72 -0
  13. package/dist/cjs/inventoryQueries.js.map +1 -0
  14. package/dist/cjs/inventoryScreenSet.js +69 -0
  15. package/dist/cjs/inventoryScreenSet.js.map +1 -0
  16. package/dist/cjs/manifest.js +65 -0
  17. package/dist/cjs/manifest.js.map +1 -0
  18. package/dist/cjs/navigation.js +143 -0
  19. package/dist/cjs/navigation.js.map +1 -0
  20. package/dist/cjs/package.json +3 -0
  21. package/dist/cjs/packageName.js +8 -0
  22. package/dist/cjs/packageName.js.map +1 -0
  23. package/dist/cjs/screens/index.js +22 -0
  24. package/dist/cjs/screens/index.js.map +1 -0
  25. package/dist/cjs/templateProvenance.js +24 -0
  26. package/dist/cjs/templateProvenance.js.map +1 -0
  27. package/dist/cjs/templates/dashboardTemplate.js +92 -0
  28. package/dist/cjs/templates/dashboardTemplate.js.map +1 -0
  29. package/dist/cjs/templates/formTemplates.js +94 -0
  30. package/dist/cjs/templates/formTemplates.js.map +1 -0
  31. package/dist/cjs/templates/index.js +34 -0
  32. package/dist/cjs/templates/index.js.map +1 -0
  33. package/dist/cjs/templates/listTemplates.js +212 -0
  34. package/dist/cjs/templates/listTemplates.js.map +1 -0
  35. package/dist/cjs/templates/locationsTemplate.js +63 -0
  36. package/dist/cjs/templates/locationsTemplate.js.map +1 -0
  37. package/dist/cjs/templates/recordTemplates.js +111 -0
  38. package/dist/cjs/templates/recordTemplates.js.map +1 -0
  39. package/dist/esm/blueprint.d.ts +3 -0
  40. package/dist/esm/blueprint.d.ts.map +1 -0
  41. package/dist/esm/blueprint.js +17 -0
  42. package/dist/esm/blueprint.js.map +1 -0
  43. package/dist/esm/index.d.ts +12 -0
  44. package/dist/esm/index.d.ts.map +1 -0
  45. package/dist/esm/index.js +18 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/inventoryApplication.d.ts +10 -0
  48. package/dist/esm/inventoryApplication.d.ts.map +1 -0
  49. package/dist/esm/inventoryApplication.js +44 -0
  50. package/dist/esm/inventoryApplication.js.map +1 -0
  51. package/dist/esm/inventoryParts.d.ts +15 -0
  52. package/dist/esm/inventoryParts.d.ts.map +1 -0
  53. package/dist/esm/inventoryParts.js +114 -0
  54. package/dist/esm/inventoryParts.js.map +1 -0
  55. package/dist/esm/inventoryQueries.d.ts +44 -0
  56. package/dist/esm/inventoryQueries.d.ts.map +1 -0
  57. package/dist/esm/inventoryQueries.js +64 -0
  58. package/dist/esm/inventoryQueries.js.map +1 -0
  59. package/dist/esm/inventoryScreenSet.d.ts +7 -0
  60. package/dist/esm/inventoryScreenSet.d.ts.map +1 -0
  61. package/dist/esm/inventoryScreenSet.js +67 -0
  62. package/dist/esm/inventoryScreenSet.js.map +1 -0
  63. package/dist/esm/manifest.d.ts +3 -0
  64. package/dist/esm/manifest.d.ts.map +1 -0
  65. package/dist/esm/manifest.js +63 -0
  66. package/dist/esm/manifest.js.map +1 -0
  67. package/dist/esm/navigation.d.ts +5 -0
  68. package/dist/esm/navigation.d.ts.map +1 -0
  69. package/dist/esm/navigation.js +139 -0
  70. package/dist/esm/navigation.js.map +1 -0
  71. package/dist/esm/package.json +3 -0
  72. package/dist/esm/packageName.d.ts +2 -0
  73. package/dist/esm/packageName.d.ts.map +1 -0
  74. package/dist/esm/packageName.js +6 -0
  75. package/dist/esm/packageName.js.map +1 -0
  76. package/dist/esm/screens/index.d.ts +3 -0
  77. package/dist/esm/screens/index.d.ts.map +1 -0
  78. package/dist/esm/screens/index.js +20 -0
  79. package/dist/esm/screens/index.js.map +1 -0
  80. package/dist/esm/templateProvenance.d.ts +3 -0
  81. package/dist/esm/templateProvenance.d.ts.map +1 -0
  82. package/dist/esm/templateProvenance.js +22 -0
  83. package/dist/esm/templateProvenance.js.map +1 -0
  84. package/dist/esm/templates/dashboardTemplate.d.ts +3 -0
  85. package/dist/esm/templates/dashboardTemplate.d.ts.map +1 -0
  86. package/dist/esm/templates/dashboardTemplate.js +90 -0
  87. package/dist/esm/templates/dashboardTemplate.js.map +1 -0
  88. package/dist/esm/templates/formTemplates.d.ts +5 -0
  89. package/dist/esm/templates/formTemplates.d.ts.map +1 -0
  90. package/dist/esm/templates/formTemplates.js +90 -0
  91. package/dist/esm/templates/formTemplates.js.map +1 -0
  92. package/dist/esm/templates/index.d.ts +8 -0
  93. package/dist/esm/templates/index.d.ts.map +1 -0
  94. package/dist/esm/templates/index.js +22 -0
  95. package/dist/esm/templates/index.js.map +1 -0
  96. package/dist/esm/templates/listTemplates.d.ts +6 -0
  97. package/dist/esm/templates/listTemplates.d.ts.map +1 -0
  98. package/dist/esm/templates/listTemplates.js +207 -0
  99. package/dist/esm/templates/listTemplates.js.map +1 -0
  100. package/dist/esm/templates/locationsTemplate.d.ts +3 -0
  101. package/dist/esm/templates/locationsTemplate.d.ts.map +1 -0
  102. package/dist/esm/templates/locationsTemplate.js +61 -0
  103. package/dist/esm/templates/locationsTemplate.js.map +1 -0
  104. package/dist/esm/templates/recordTemplates.d.ts +3 -0
  105. package/dist/esm/templates/recordTemplates.d.ts.map +1 -0
  106. package/dist/esm/templates/recordTemplates.js +109 -0
  107. package/dist/esm/templates/recordTemplates.js.map +1 -0
  108. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  109. package/index.ts +14 -0
  110. package/inventoryApplication.ts +28 -0
  111. package/inventoryParts.ts +52 -0
  112. package/inventoryQueries.ts +64 -0
  113. package/inventoryScreenSet.ts +25 -0
  114. package/manifest.ts +41 -0
  115. package/navigation.ts +60 -0
  116. package/package.json +78 -4
  117. package/packageName.ts +5 -0
  118. package/sampleData/inventory-warehouse.json +1770 -0
  119. package/screens/index.ts +20 -0
  120. package/templateProvenance.ts +15 -0
  121. package/templates/dashboardTemplate.ts +45 -0
  122. package/templates/formTemplates.ts +60 -0
  123. package/templates/index.ts +25 -0
  124. package/templates/listTemplates.ts +109 -0
  125. package/templates/locationsTemplate.ts +36 -0
  126. package/templates/recordTemplates.ts +45 -0
  127. package/thumbnails/InventoryAdjustStock.svg +12 -0
  128. package/thumbnails/InventoryCheckInOut.svg +17 -0
  129. package/thumbnails/InventoryDashboard.svg +14 -0
  130. package/thumbnails/InventoryItemGallery.svg +29 -0
  131. package/thumbnails/InventoryItemList.svg +13 -0
  132. package/thumbnails/InventoryItemPage.svg +18 -0
  133. package/thumbnails/InventoryLocations.svg +20 -0
  134. package/thumbnails/InventoryMovementList.svg +13 -0
  135. package/thumbnails/InventoryQuickCreateItem.svg +12 -0
  136. package/thumbnails/InventoryQuickCreateSupplier.svg +12 -0
  137. package/thumbnails/InventorySupplierList.svg +13 -0
  138. package/thumbnails/inventory.svg +14 -0
package/index.ts ADDED
@@ -0,0 +1,14 @@
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
+ export * from './packageName';
5
+ export * from './templateProvenance';
6
+ export * from './inventoryQueries';
7
+ export * from './inventoryParts';
8
+ export * from './inventoryScreenSet';
9
+ export * from './templates';
10
+ export * from './screens';
11
+ export * from './navigation';
12
+ export * from './manifest';
13
+ export * from './blueprint';
14
+ export * from './inventoryApplication';
@@ -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 { inventoryNavigation, inventoryStructure } from './navigation';
8
+ import { inventoryScreens } from './screens';
9
+ import { inventoryDialogTemplates, inventoryScreenTemplates } from './templates';
10
+
11
+ /** The id of the sample-data pack a new application starts with. */
12
+ export const inventoryDefaultSampleDataId = 'inventory-warehouse';
13
+
14
+ /**
15
+ * The example application of the blueprint: the foundation's layouts, the Inventory and Assets templates and quick-create dialogs and its eight 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/Inventory/inventory.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
18
+ */
19
+ export function inventoryApplication(sampleData: string = inventoryDefaultSampleDataId): ApplicationDocument {
20
+ const profile: UiProfile = { ...previewProfile(undefined), name: 'Inventory and Assets', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };
21
+ return { layouts: defaultLayouts, screenTemplates: inventoryScreenTemplates, dialogTemplates: inventoryDialogTemplates, screens: inventoryScreens, 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 inventoryComposition: CompositionOptions = { logo: inventoryNavigation.application.logo };
26
+
27
+ /** The structure and navigation the shell's regions show and the items' destinations resolve against. */
28
+ export const inventoryNavigationModel = () => ({ structure: new ApplicationStructureIndex(inventoryStructure), navigation: inventoryNavigation });
@@ -0,0 +1,52 @@
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 { inventoryTemplateProvenance } 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 inventoryCategory = 'Business / Inventory';
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 inventoryMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace', scopes: TemplateScope[]): TemplateMetadata =>
20
+ ({ ...inventoryTemplateProvenance, type, category: inventoryCategory, 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
+ /** What a Cancel or Close control does: close the dialog it was opened from. */
46
+ export const closesDialog = (): Behavior[] => [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.CloseDialog }] }] }];
47
+
48
+ /** An element with the given behaviors attached. */
49
+ export const withBehaviors = <T extends SceneElement>(element: T, behaviors: Behavior[]): T => ({ ...element, behaviors });
50
+
51
+ export type InventoryScreenTemplate = ScreenTemplate;
52
+ export type InventoryDialogTemplate = DialogTemplate;
@@ -0,0 +1,64 @@
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. An Inventory 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 dashboard, the pages and the screens that are not a plain list. Each is a shape the sample-data pack supplies rows for. */
13
+ export const InventoryQuery = {
14
+ /** One row: the `locale` the figures and dates are formatted in and the `currency` of the amounts. */
15
+ Settings: 'InventorySettings',
16
+ Kpis: 'InventoryKpis',
17
+ TopMovers: 'InventoryTopMovers',
18
+ LowStock: 'InventoryLowStock',
19
+ RecentMovements: 'RecentMovements',
20
+ RecordTabs: 'InventoryRecordTabs',
21
+ LocationNodes: 'LocationNodes',
22
+ LocationContents: 'LocationContents',
23
+ LocationContentColumns: 'LocationContentColumns',
24
+ FormErrors: 'InventoryFormErrors',
25
+ } as const;
26
+
27
+ /** The Inventory entities a template is made for. */
28
+ export enum InventoryEntityKind {
29
+ Item = 'Item',
30
+ Movement = 'Movement',
31
+ Supplier = 'Supplier',
32
+ }
33
+
34
+ /** The plural of each entity: the read model (and so the shape) its records are queried from. */
35
+ export const inventoryEntityPlural: Record<InventoryEntityKind, string> = {
36
+ [InventoryEntityKind.Item]: 'Items',
37
+ [InventoryEntityKind.Movement]: 'Movements',
38
+ [InventoryEntityKind.Supplier]: 'Suppliers',
39
+ };
40
+
41
+ /**
42
+ * 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
43
+ * list, its saved views and column choices, the selection, the sections of the full and the quick form, and the record the page shows.
44
+ */
45
+ export const inventoryQueriesOf = (entity: InventoryEntityKind) => ({
46
+ rows: inventoryEntityPlural[entity],
47
+ columns: `${entity}Columns`,
48
+ filterFields: `${entity}FilterFields`,
49
+ views: `${entity}Views`,
50
+ columnChoices: `${entity}ColumnChoices`,
51
+ selection: `${entity}Selection`,
52
+ sections: `${entity}Sections`,
53
+ quickSections: `${entity}QuickSections`,
54
+ record: `${entity}Record`,
55
+ summary: `${entity}Summary`,
56
+ stockByLocation: `${entity}StockByLocation`,
57
+ movements: `${entity}Movements`,
58
+ activity: `${entity}Activity`,
59
+ tasks: `${entity}Tasks`,
60
+ });
61
+
62
+ /** The locale and currency of the data, bound onto every component that formats a figure or a date. */
63
+ export const localeOfData = { locale: fromQuery(InventoryQuery.Settings, '0.locale') };
64
+ export const currencyOfData = { ...localeOfData, currency: fromQuery(InventoryQuery.Settings, '0.currency') };
@@ -0,0 +1,25 @@
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 (`inventory.items.record` is the `record` feature of `items` in the `inventory` module). */
7
+ export interface InventoryScreenDefinition 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 inventoryScreenDefinitions: InventoryScreenDefinition[] = [
17
+ { name: 'inventory.dashboard', title: 'Dashboard', template: 'InventoryDashboard', order: 0, description: 'Low stock, stock value, top movers and recent movements.' },
18
+ { name: 'inventory.items', title: 'Items', template: 'InventoryItemList', order: 1, description: 'Every item with its stock, low stock highlighted.' },
19
+ { name: 'inventory.items.gallery', title: 'Item gallery', template: 'InventoryItemGallery', parent: 'inventory.items', order: 0, description: 'Every item as a card with its picture.' },
20
+ { name: 'inventory.items.record', title: 'Item', template: 'InventoryItemPage', parent: 'inventory.items', description: 'One item with its stock by location, movement history and supplier.' },
21
+ { name: 'inventory.locations', title: 'Locations', template: 'InventoryLocations', order: 2, description: 'The location tree beside what is stored in the chosen location.' },
22
+ { name: 'inventory.movements', title: 'Movements', template: 'InventoryMovementList', order: 3, description: 'Every check in, check out, transfer and adjustment.' },
23
+ { name: 'inventory.movements.check', title: 'Check in or out', template: 'InventoryCheckInOut', parent: 'inventory.movements', description: 'Scan or search an item and check it in or out, from a phone.' },
24
+ { name: 'inventory.suppliers', title: 'Suppliers', template: 'InventorySupplierList', order: 4, description: 'The suppliers items are bought from.' },
25
+ ];
package/manifest.ts ADDED
@@ -0,0 +1,41 @@
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 { PackageKind, ScenePackage } from '@cratis/scene.model';
5
+ import { inventoryBlueprintName } from './packageName';
6
+ import { inventoryScreenDefinitions } from './inventoryScreenSet';
7
+ import { inventoryDialogTemplates, inventoryScreenTemplates } from './templates';
8
+
9
+ const description = 'Items, locations, movements and suppliers for a warehouse: a dashboard, item lists and cards, item pages, a location tree, stock adjustment and check in and out.';
10
+
11
+ /**
12
+ * This blueprint's declaration. A domain blueprint depends on the foundation set (`Cratis.Blueprint.Default`) and reuses its layouts, slots,
13
+ * components and themes - it ships none of its own - and adds what is specific to the domain: templates, a ready-to-use screen set, sample data
14
+ * and thumbnails. The package `version` is the blueprint's version: it is what a template reference pins and what "update available" compares.
15
+ */
16
+ export const inventoryBlueprintManifest: ScenePackage = {
17
+ name: inventoryBlueprintName,
18
+ version: '1.0.0',
19
+ kind: PackageKind.Blueprint,
20
+ dependencies: [{ name: 'Cratis.Blueprint.Default', versionRange: '^1.0.0' }],
21
+ components: [],
22
+ layouts: [],
23
+ screenTemplates: inventoryScreenTemplates.map(template => template.name),
24
+ dialogTemplates: inventoryDialogTemplates.map(template => template.name),
25
+ themes: [],
26
+ displayName: 'Inventory and Assets',
27
+ description,
28
+ module: '@cratis/scene.blueprint.inventory',
29
+ license: 'MIT',
30
+ licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
31
+ sampleData: [{ id: 'inventory-warehouse', title: 'Inventory · Warehouse', locale: 'en-GB', path: 'sampleData/inventory-warehouse.json' }],
32
+ blueprint: {
33
+ domain: 'inventory',
34
+ description,
35
+ thumbnail: 'thumbnails/inventory.svg',
36
+ screenSet: inventoryScreenDefinitions.map(({ name, title, description: screenDescription, template, parent, order }) => ({
37
+ name, title, description: screenDescription, template, ...(parent === undefined ? {} : { parent }), ...(order === undefined ? {} : { order }),
38
+ })),
39
+ defaultSampleData: 'inventory-warehouse',
40
+ },
41
+ };
package/navigation.ts ADDED
@@ -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 { ApplicationStructure, NavigationModel, NavigationRegionKind, NavigationRegionMode } from '@cratis/scene.model';
5
+ import { inventoryScreenDefinitions } from './inventoryScreenSet';
6
+
7
+ /** The module the blueprint's screens live in, and so the first segment of every screen's qualified name. */
8
+ export const inventoryModule = 'inventory';
9
+
10
+ /**
11
+ * The application structure the screen set implies: one module, `inventory`, a feature for each screen and the sub-features beneath it (`inventory.items.record` is the
12
+ * `record` feature of `items`). Derived from the screen names, so a screen added to the set is part of the structure without a second edit.
13
+ */
14
+ export const inventoryStructure: ApplicationStructure = (() => {
15
+ interface Node { id: string; name: string; features: Node[]; slices: never[] }
16
+ const root: Node = { id: inventoryModule, name: 'Inventory', features: [], slices: [] };
17
+ for (const screen of inventoryScreenDefinitions) {
18
+ let parent = root;
19
+ for (const id of screen.name.split('.').slice(1)) {
20
+ let node = parent.features.find(candidate => candidate.id === id);
21
+ if (!node) {
22
+ node = { id, name: screen.title, features: [], slices: [] };
23
+ parent.features.push(node);
24
+ }
25
+ parent = node;
26
+ }
27
+ }
28
+
29
+ return { modules: [{ id: root.id, name: root.name, features: root.features }] } as unknown as ApplicationStructure;
30
+ })();
31
+
32
+ /**
33
+ * The navigation of the application the blueprint is: the topbar names the module, and the module's sidebar - which overrides the application's - lists
34
+ * the five places a warehouse goes: Dashboard, Items (with the table and the gallery beneath it), Locations, Movements and Suppliers.
35
+ */
36
+ export const inventoryNavigation: NavigationModel = {
37
+ application: {
38
+ logo: { image: '', title: 'Inventory' },
39
+ regions: [{ region: NavigationRegionKind.Topbar, items: [{ id: 'inventory', title: 'Inventory', target: { module: inventoryModule } }] }],
40
+ },
41
+ modules: [{
42
+ module: inventoryModule,
43
+ regions: [{
44
+ region: NavigationRegionKind.Sidebar,
45
+ mode: NavigationRegionMode.Override,
46
+ items: [
47
+ { id: 'dashboard', title: 'Dashboard', target: { module: inventoryModule, feature: 'dashboard' } },
48
+ {
49
+ id: 'items', title: 'Items', target: { module: inventoryModule, feature: 'items' }, children: [
50
+ { id: 'item-table', title: 'Table', target: { module: inventoryModule, feature: 'items' } },
51
+ { id: 'item-gallery', title: 'Gallery', target: { module: inventoryModule, feature: 'items.gallery' } },
52
+ ],
53
+ },
54
+ { id: 'locations', title: 'Locations', target: { module: inventoryModule, feature: 'locations' } },
55
+ { id: 'movements', title: 'Movements', target: { module: inventoryModule, feature: 'movements' } },
56
+ { id: 'suppliers', title: 'Suppliers', target: { module: inventoryModule, feature: 'suppliers' } },
57
+ ],
58
+ }],
59
+ }],
60
+ };
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
- "name": "@cratis/scene.blueprint.inventory",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
2
+ "name": "@cratis/scene.blueprint.inventory",
3
+ "version": "4.53.1",
4
+ "description": "Items, locations, movements and suppliers for a warehouse.",
5
+ "keywords": [
6
+ "cratis",
7
+ "scene",
8
+ "react",
9
+ "ui",
10
+ "blueprint",
11
+ "inventory"
12
+ ],
13
+ "author": "Cratis",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Cratis/Scene.git"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "sampleData",
25
+ "thumbnails",
26
+ "blueprintCatalog.json",
27
+ "**/*.ts",
28
+ "**/*.tsx",
29
+ "!**/for_*/**"
30
+ ],
31
+ "main": "dist/cjs/index.js",
32
+ "module": "dist/esm/index.js",
33
+ "types": "dist/esm/index.d.ts",
34
+ "exports": {
35
+ "./package.json": "./package.json",
36
+ ".": {
37
+ "types": "./dist/esm/index.d.ts",
38
+ "require": "./dist/cjs/index.js",
39
+ "import": "./dist/esm/index.js"
40
+ }
41
+ },
42
+ "scripts": {
43
+ "prepare": "yarn g:build",
44
+ "clean": "yarn g:clean",
45
+ "build": "yarn g:build",
46
+ "lint": "yarn g:lint",
47
+ "lint:ci": "yarn g:lint:ci",
48
+ "test": "yarn g:test",
49
+ "test:browser": "yarn g:test --config ./vitest.browser.config.mts",
50
+ "ci": "yarn g:ci",
51
+ "up": "yarn g:up"
52
+ },
53
+ "dependencies": {
54
+ "@cratis/scene.blueprint.default": "4.53.1",
55
+ "@cratis/scene.engine": "4.53.1",
56
+ "@cratis/scene.model": "4.53.1",
57
+ "@cratis/scene.react": "4.53.1"
58
+ },
59
+ "devDependencies": {
60
+ "@cratis/scene.blueprint.default": "4.53.1",
61
+ "@cratis/scene.engine": "4.53.1",
62
+ "@cratis/scene.model": "4.53.1",
63
+ "@cratis/scene.react": "4.53.1",
64
+ "@primereact/core": "11.2.0",
65
+ "@primereact/headless": "11.2.0",
66
+ "primeicons": "8.0.2",
67
+ "primereact": "11.2.0",
68
+ "react": "^19.3.0",
69
+ "react-dom": "^19.3.0"
70
+ },
71
+ "peerDependencies": {
72
+ "@cratis/components": "^4.1.1",
73
+ "@primereact/core": "^11.0.0",
74
+ "@primereact/headless": "^11.0.0",
75
+ "primeicons": "^8.0.0",
76
+ "primereact": "^11.0.0",
77
+ "react": "^19.0.0",
78
+ "react-dom": "^19.0.0"
79
+ }
6
80
  }
package/packageName.ts ADDED
@@ -0,0 +1,5 @@
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
+ /** The name this blueprint is known by inside a `ui profile`; every component registry key is built from it. */
5
+ export const inventoryBlueprintName = 'Cratis.Blueprint.Inventory';