@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
@@ -0,0 +1,207 @@
1
+ import { TemplateScope, NotificationLevel, InteractionActionKind, InteractionTriggerKind } from '@cratis/scene.model';
2
+ import { component, listScreenTemplate } from '@cratis/scene.blueprint.default';
3
+ import { inventoryQueriesOf, localeOfData, fromQuery, InventoryEntityKind } from '../inventoryQueries.js';
4
+ import { withBehaviors, opensDialog, goesTo, actionButton, inventoryMetadata, opensRecordOnSelect } from '../inventoryParts.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 Inventory 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 = inventoryQueriesOf(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 ? 'single' : 'multiple'
51
+ },
52
+ ...options.cards ? {
53
+ variant: 'cards',
54
+ imageField: options.cards.imageField
55
+ } : {},
56
+ ...options.toneField ? {
57
+ toneField: options.toneField
58
+ } : {}
59
+ });
60
+ return {
61
+ name: options.name,
62
+ fitsSlot: 'content',
63
+ slots: listScreenTemplate.slots,
64
+ arrangement: listScreenTemplate.arrangement,
65
+ content: {
66
+ header: [
67
+ component(`${id}-header`, 'pageHeader', {
68
+ title: options.title,
69
+ subtitle: options.subtitle
70
+ }, {
71
+ actions: [
72
+ exportAction(`${id}-export`),
73
+ primary
74
+ ]
75
+ })
76
+ ],
77
+ toolbar: [
78
+ component(`${id}-search`, 'globalSearch', {
79
+ placeholder: options.searchLabel,
80
+ label: options.searchLabel,
81
+ urlKey: `${options.urlKey}q`
82
+ }),
83
+ component(`${id}-views`, 'savedViewsMenu', {
84
+ views: fromQuery(queries.views),
85
+ savePermission: 'enabled',
86
+ managePermission: 'enabled'
87
+ }),
88
+ component(`${id}-columns`, 'columnChooser', {
89
+ columns: fromQuery(queries.columnChoices)
90
+ })
91
+ ],
92
+ filters: [
93
+ component(`${id}-filter`, 'filterBuilder', {
94
+ fields: fromQuery(queries.filterFields),
95
+ ...localeOfData
96
+ })
97
+ ],
98
+ list: [
99
+ options.recordScreen ? withBehaviors(list, opensRecordOnSelect(listId, options.recordScreen)) : list
100
+ ],
101
+ bulkBar: options.recordScreen || options.readOnly ? [] : [
102
+ component(`${id}-bulk`, 'bulkBar', {
103
+ selection: fromQuery(queries.selection),
104
+ actions: options.bulkActions
105
+ })
106
+ ],
107
+ footer: []
108
+ },
109
+ displayName: options.displayName,
110
+ description: options.description,
111
+ metadata: inventoryMetadata(options.name, 'List', listScopes)
112
+ };
113
+ }
114
+ /** The items: what is stored, how much of it and where. Items running low are tinted and say "Low stock" in their status. Choosing a row opens the item. */ const inventoryItemListTemplate = listTemplateOf({
115
+ name: 'InventoryItemList',
116
+ entity: InventoryEntityKind.Item,
117
+ displayName: 'Inventory items',
118
+ description: 'Items with sku, category, location, quantity and status, low stock highlighted, filtered by category, location and status.',
119
+ title: 'Items',
120
+ subtitle: 'Everything in stock, low stock highlighted',
121
+ searchLabel: 'Search items',
122
+ urlKey: 'items',
123
+ primary: {
124
+ label: 'New item',
125
+ dialog: 'InventoryQuickCreateItem'
126
+ },
127
+ rowActions: [
128
+ 'Adjust stock',
129
+ 'Check out',
130
+ 'Archive'
131
+ ],
132
+ bulkActions: [],
133
+ titleField: 'name',
134
+ recordScreen: 'inventory.items.record',
135
+ toneField: 'tone'
136
+ });
137
+ /** The items as a gallery: the same records as cards, each with its picture, for finding a thing by how it looks. */ const inventoryItemGalleryTemplate = listTemplateOf({
138
+ name: 'InventoryItemGallery',
139
+ entity: InventoryEntityKind.Item,
140
+ displayName: 'Inventory item gallery',
141
+ description: 'Items as cards with a picture, sku, quantity and status, low stock highlighted.',
142
+ title: 'Item gallery',
143
+ subtitle: 'Items by how they look',
144
+ searchLabel: 'Search items',
145
+ urlKey: 'gallery',
146
+ primary: {
147
+ label: 'New item',
148
+ dialog: 'InventoryQuickCreateItem'
149
+ },
150
+ rowActions: [
151
+ 'Adjust stock',
152
+ 'Check out',
153
+ 'Archive'
154
+ ],
155
+ bulkActions: [],
156
+ titleField: 'name',
157
+ recordScreen: 'inventory.items.record',
158
+ toneField: 'tone',
159
+ cards: {
160
+ imageField: 'photo'
161
+ }
162
+ });
163
+ /** The movements: every time stock came in, went out, moved or was corrected, newest first. Nothing in it is edited. */ const inventoryMovementListTemplate = listTemplateOf({
164
+ name: 'InventoryMovementList',
165
+ entity: InventoryEntityKind.Movement,
166
+ displayName: 'Inventory movements',
167
+ description: 'Check ins, check outs, transfers and adjustments with the item, quantity, location and who did it.',
168
+ title: 'Movements',
169
+ subtitle: 'What came in, went out and moved',
170
+ searchLabel: 'Search movements',
171
+ urlKey: 'movements',
172
+ primary: {
173
+ label: 'Check in or out',
174
+ screen: 'inventory.movements.check'
175
+ },
176
+ rowActions: [
177
+ 'View item'
178
+ ],
179
+ bulkActions: [],
180
+ titleField: 'item',
181
+ readOnly: true
182
+ });
183
+ /** The suppliers: who items are bought from, how to reach them and how many items they supply. */ const inventorySupplierListTemplate = listTemplateOf({
184
+ name: 'InventorySupplierList',
185
+ entity: InventoryEntityKind.Supplier,
186
+ displayName: 'Inventory suppliers',
187
+ description: 'Suppliers with their contact, the items they supply and their status.',
188
+ title: 'Suppliers',
189
+ subtitle: 'Where the stock comes from',
190
+ searchLabel: 'Search suppliers',
191
+ urlKey: 'suppliers',
192
+ primary: {
193
+ label: 'New supplier',
194
+ dialog: 'InventoryQuickCreateSupplier'
195
+ },
196
+ rowActions: [
197
+ 'Edit',
198
+ 'Deactivate'
199
+ ],
200
+ bulkActions: [
201
+ 'Deactivate'
202
+ ],
203
+ titleField: 'name'
204
+ });
205
+
206
+ export { inventoryItemGalleryTemplate, inventoryItemListTemplate, inventoryMovementListTemplate, inventorySupplierListTemplate };
207
+ //# 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 { InventoryEntityKind, fromQuery, inventoryQueriesOf, localeOfData } from '../inventoryQueries';\nimport { actionButton, component, goesTo, inventoryMetadata, opensDialog, opensRecordOnSelect, withBehaviors } from '../inventoryParts';\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: InventoryEntityKind;\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 /** 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 Inventory 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 = inventoryQueriesOf(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 ? 'single' : 'multiple' }),\n ...(options.cards ? { variant: 'cards', imageField: options.cards.imageField } : {}),\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)) : list],\n bulkBar: options.recordScreen || 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: inventoryMetadata(options.name, 'List', listScopes),\n };\n}\n\n/** The items: what is stored, how much of it and where. Items running low are tinted and say \"Low stock\" in their status. Choosing a row opens the item. */\nexport const inventoryItemListTemplate = listTemplateOf({\n name: 'InventoryItemList', entity: InventoryEntityKind.Item, displayName: 'Inventory items', description: 'Items with sku, category, location, quantity and status, low stock highlighted, filtered by category, location and status.',\n title: 'Items', subtitle: 'Everything in stock, low stock highlighted', searchLabel: 'Search items', urlKey: 'items', primary: { label: 'New item', dialog: 'InventoryQuickCreateItem' },\n rowActions: ['Adjust stock', 'Check out', 'Archive'], bulkActions: [], titleField: 'name', recordScreen: 'inventory.items.record', toneField: 'tone',\n});\n\n/** The items as a gallery: the same records as cards, each with its picture, for finding a thing by how it looks. */\nexport const inventoryItemGalleryTemplate = listTemplateOf({\n name: 'InventoryItemGallery', entity: InventoryEntityKind.Item, displayName: 'Inventory item gallery', description: 'Items as cards with a picture, sku, quantity and status, low stock highlighted.',\n title: 'Item gallery', subtitle: 'Items by how they look', searchLabel: 'Search items', urlKey: 'gallery', primary: { label: 'New item', dialog: 'InventoryQuickCreateItem' },\n rowActions: ['Adjust stock', 'Check out', 'Archive'], bulkActions: [], titleField: 'name', recordScreen: 'inventory.items.record', toneField: 'tone', cards: { imageField: 'photo' },\n});\n\n/** The movements: every time stock came in, went out, moved or was corrected, newest first. Nothing in it is edited. */\nexport const inventoryMovementListTemplate = listTemplateOf({\n name: 'InventoryMovementList', entity: InventoryEntityKind.Movement, displayName: 'Inventory movements', description: 'Check ins, check outs, transfers and adjustments with the item, quantity, location and who did it.',\n title: 'Movements', subtitle: 'What came in, went out and moved', searchLabel: 'Search movements', urlKey: 'movements', primary: { label: 'Check in or out', screen: 'inventory.movements.check' },\n rowActions: ['View item'], bulkActions: [], titleField: 'item', readOnly: true,\n});\n\n/** The suppliers: who items are bought from, how to reach them and how many items they supply. */\nexport const inventorySupplierListTemplate = listTemplateOf({\n name: 'InventorySupplierList', entity: InventoryEntityKind.Supplier, displayName: 'Inventory suppliers', description: 'Suppliers with their contact, the items they supply and their status.',\n title: 'Suppliers', subtitle: 'Where the stock comes from', searchLabel: 'Search suppliers', urlKey: 'suppliers', primary: { label: 'New supplier', dialog: 'InventoryQuickCreateSupplier' },\n rowActions: ['Edit', 'Deactivate'], bulkActions: ['Deactivate'], titleField: 'name',\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","inventoryQueriesOf","entity","name","listId","primary","label","dialog","opensDialog","goesTo","screen","list","component","title","rows","fromQuery","columns","titleField","pageSize","cards","urlKey","localeOfData","rowActions","readOnly","selectionMode","recordScreen","variant","imageField","toneField","fitsSlot","slots","listScreenTemplate","arrangement","content","header","subtitle","toolbar","placeholder","searchLabel","views","savePermission","managePermission","columnChoices","filters","fields","filterFields","opensRecordOnSelect","bulkBar","selection","bulkActions","footer","displayName","description","metadata","inventoryMetadata","inventoryItemListTemplate","InventoryEntityKind","Item","inventoryItemGalleryTemplate","inventoryMovementListTemplate","Movement","inventorySupplierListTemplate","Supplier"],"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,M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;AACvL,CAAA;AAEA,yHACO,MAAMgC,6BAAAA,GAAgC7D,cAAAA,CAAe;IACxDK,IAAAA,EAAM,uBAAA;AAAyBD,IAAAA,MAAAA,EAAQsD,oBAAoBI,QAAQ;IAAET,WAAAA,EAAa,qBAAA;IAAuBC,WAAAA,EAAa,oGAAA;IACtHvC,KAAAA,EAAO,WAAA;IAAasB,QAAAA,EAAU,kCAAA;IAAoCG,WAAAA,EAAa,kBAAA;IAAoBlB,MAAAA,EAAQ,WAAA;IAAaf,OAAAA,EAAS;QAAEC,KAAAA,EAAO,iBAAA;QAAmBI,MAAAA,EAAQ;AAA4B,KAAA;IACjMY,UAAAA,EAAY;AAAC,QAAA;AAAY,KAAA;AAAE2B,IAAAA,WAAAA,EAAa,EAAE;IAAEhC,UAAAA,EAAY,MAAA;IAAQM,QAAAA,EAAU;AAC9E,CAAA;AAEA,mGACO,MAAMsC,6BAAAA,GAAgC/D,cAAAA,CAAe;IACxDK,IAAAA,EAAM,uBAAA;AAAyBD,IAAAA,MAAAA,EAAQsD,oBAAoBM,QAAQ;IAAEX,WAAAA,EAAa,qBAAA;IAAuBC,WAAAA,EAAa,uEAAA;IACtHvC,KAAAA,EAAO,WAAA;IAAasB,QAAAA,EAAU,4BAAA;IAA8BG,WAAAA,EAAa,kBAAA;IAAoBlB,MAAAA,EAAQ,WAAA;IAAaf,OAAAA,EAAS;QAAEC,KAAAA,EAAO,cAAA;QAAgBC,MAAAA,EAAQ;AAA+B,KAAA;IAC3Le,UAAAA,EAAY;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAa,KAAA;IAAE2B,WAAAA,EAAa;AAAC,QAAA;AAAa,KAAA;IAAEhC,UAAAA,EAAY;AACjF,CAAA;;"}
@@ -0,0 +1,3 @@
1
+ import { ScreenTemplate } from '@cratis/scene.model';
2
+ export declare const inventoryLocationsTemplate: ScreenTemplate;
3
+ //# sourceMappingURL=locationsTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationsTemplate.d.ts","sourceRoot":"","sources":["../../../templates/locationsTemplate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAWpE,eAAO,MAAM,0BAA0B,EAAE,cAqBxC,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { TemplateScope } from '@cratis/scene.model';
2
+ import { component, masterDetailScreenTemplate } from '@cratis/scene.blueprint.default';
3
+ import { localeOfData, fromQuery, InventoryQuery } from '../inventoryQueries.js';
4
+ import { inventoryMetadata, withBehaviors, opensDialog, actionButton } from '../inventoryParts.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
+ * The locations: the foundation `MasterDetail` with the tree of locations - warehouse, aisle, shelf - on the left and, on the right, what is stored in the one
10
+ * chosen, or in everything beneath it. The tree keeps the chosen location in the address under the parameter the contents list searches by, and a
11
+ * location's id is its path, so the contents are every row whose location starts with it - and a link or a refresh restores the choice. On a phone the two become a navigation stack. It fills the shell's `content` slot itself
12
+ * rather than the module workspace's, so a module without a workspace can use it.
13
+ */ const inventoryLocationsTemplate = {
14
+ name: 'InventoryLocations',
15
+ fitsSlot: 'content',
16
+ slots: masterDetailScreenTemplate.slots,
17
+ arrangement: masterDetailScreenTemplate.arrangement,
18
+ content: {
19
+ list: [
20
+ component('inventory-locations-tree', 'orgTree', {
21
+ nodes: fromQuery(InventoryQuery.LocationNodes),
22
+ expandedDepth: 2,
23
+ urlKey: 'contentsq',
24
+ strings: {
25
+ orgTree: 'Locations',
26
+ orgReports: '{count} locations beneath'
27
+ },
28
+ ...localeOfData
29
+ })
30
+ ],
31
+ details: [
32
+ component('inventory-locations-header', 'pageHeader', {
33
+ title: 'Contents',
34
+ subtitle: 'What is stored in the chosen location and beneath it'
35
+ }, {
36
+ actions: [
37
+ withBehaviors(actionButton('inventory-locations-adjust', 'Adjust stock', 'primary'), opensDialog('InventoryAdjustStock'))
38
+ ]
39
+ }),
40
+ component('inventory-locations-contents', 'dataList', {
41
+ label: 'Location contents',
42
+ rows: fromQuery(InventoryQuery.LocationContents),
43
+ columns: fromQuery(InventoryQuery.LocationContentColumns),
44
+ titleField: 'name',
45
+ pageSize: 10,
46
+ toneField: 'tone',
47
+ urlKey: 'contents',
48
+ ...localeOfData
49
+ })
50
+ ]
51
+ },
52
+ displayName: 'Inventory locations',
53
+ description: 'The tree of locations beside what is stored in the chosen location.',
54
+ metadata: inventoryMetadata('InventoryLocations', 'Workspace', [
55
+ TemplateScope.Module,
56
+ TemplateScope.Feature
57
+ ])
58
+ };
59
+
60
+ export { inventoryLocationsTemplate };
61
+ //# sourceMappingURL=locationsTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationsTemplate.js","sources":["../../../templates/locationsTemplate.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 { masterDetailScreenTemplate } from '@cratis/scene.blueprint.default';\nimport { InventoryQuery, fromQuery, localeOfData } from '../inventoryQueries';\nimport { actionButton, component, inventoryMetadata, opensDialog, withBehaviors } from '../inventoryParts';\n\n/**\n * The locations: the foundation `MasterDetail` with the tree of locations - warehouse, aisle, shelf - on the left and, on the right, what is stored in the one\n * chosen, or in everything beneath it. The tree keeps the chosen location in the address under the parameter the contents list searches by, and a\n * location's id is its path, so the contents are every row whose location starts with it - and a link or a refresh restores the choice. On a phone the two become a navigation stack. It fills the shell's `content` slot itself\n * rather than the module workspace's, so a module without a workspace can use it.\n */\nexport const inventoryLocationsTemplate: ScreenTemplate = {\n name: 'InventoryLocations',\n fitsSlot: 'content',\n slots: masterDetailScreenTemplate.slots,\n arrangement: masterDetailScreenTemplate.arrangement,\n content: {\n list: [component('inventory-locations-tree', 'orgTree', {\n nodes: fromQuery(InventoryQuery.LocationNodes), expandedDepth: 2, urlKey: 'contentsq', strings: { orgTree: 'Locations', orgReports: '{count} locations beneath' }, ...localeOfData,\n })],\n details: [\n component('inventory-locations-header', 'pageHeader', { title: 'Contents', subtitle: 'What is stored in the chosen location and beneath it' }, {\n actions: [withBehaviors(actionButton('inventory-locations-adjust', 'Adjust stock', 'primary'), opensDialog('InventoryAdjustStock'))],\n }),\n component('inventory-locations-contents', 'dataList', {\n label: 'Location contents', rows: fromQuery(InventoryQuery.LocationContents), columns: fromQuery(InventoryQuery.LocationContentColumns), titleField: 'name', pageSize: 10, toneField: 'tone', urlKey: 'contents', ...localeOfData,\n }),\n ],\n },\n displayName: 'Inventory locations',\n description: 'The tree of locations beside what is stored in the chosen location.',\n metadata: inventoryMetadata('InventoryLocations', 'Workspace', [TemplateScope.Module, TemplateScope.Feature]),\n};\n"],"names":["inventoryLocationsTemplate","name","fitsSlot","slots","masterDetailScreenTemplate","arrangement","content","list","component","nodes","fromQuery","InventoryQuery","LocationNodes","expandedDepth","urlKey","strings","orgTree","orgReports","localeOfData","details","title","subtitle","actions","withBehaviors","actionButton","opensDialog","label","rows","LocationContents","columns","LocationContentColumns","titleField","pageSize","toneField","displayName","description","metadata","inventoryMetadata","TemplateScope","Module","Feature"],"mappings":";;;;;AAAA;AACA;AAOA;;;;;UAMaA,0BAAAA,GAA6C;IACtDC,IAAAA,EAAM,oBAAA;IACNC,QAAAA,EAAU,SAAA;AACVC,IAAAA,KAAAA,EAAOC,2BAA2BD,KAAK;AACvCE,IAAAA,WAAAA,EAAaD,2BAA2BC,WAAW;IACnDC,OAAAA,EAAS;QACLC,IAAAA,EAAM;AAACC,YAAAA,SAAAA,CAAU,4BAA4B,SAAA,EAAW;gBACpDC,KAAAA,EAAOC,SAAAA,CAAUC,eAAeC,aAAa,CAAA;gBAAGC,aAAAA,EAAe,CAAA;gBAAGC,MAAAA,EAAQ,WAAA;gBAAaC,OAAAA,EAAS;oBAAEC,OAAAA,EAAS,WAAA;oBAAaC,UAAAA,EAAY;AAA4B,iBAAA;AAAG,gBAAA,GAAGC;AAC1K,aAAA;AAAG,SAAA;QACHC,OAAAA,EAAS;AACLX,YAAAA,SAAAA,CAAU,8BAA8B,YAAA,EAAc;gBAAEY,KAAAA,EAAO,UAAA;gBAAYC,QAAAA,EAAU;aAAuD,EAAG;gBAC3IC,OAAAA,EAAS;AAACC,oBAAAA,aAAAA,CAAcC,YAAAA,CAAa,4BAAA,EAA8B,cAAA,EAAgB,SAAA,CAAA,EAAYC,WAAAA,CAAY,sBAAA,CAAA;AAAyB;AACxI,aAAA,CAAA;AACAjB,YAAAA,SAAAA,CAAU,gCAAgC,UAAA,EAAY;gBAClDkB,KAAAA,EAAO,mBAAA;gBAAqBC,IAAAA,EAAMjB,SAAAA,CAAUC,eAAeiB,gBAAgB,CAAA;gBAAGC,OAAAA,EAASnB,SAAAA,CAAUC,eAAemB,sBAAsB,CAAA;gBAAGC,UAAAA,EAAY,MAAA;gBAAQC,QAAAA,EAAU,EAAA;gBAAIC,SAAAA,EAAW,MAAA;gBAAQnB,MAAAA,EAAQ,UAAA;AAAY,gBAAA,GAAGI;AACzN,aAAA;AACH;AACL,KAAA;IACAgB,WAAAA,EAAa,qBAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,QAAAA,EAAUC,iBAAAA,CAAkB,sBAAsB,WAAA,EAAa;AAACC,QAAAA,aAAAA,CAAcC,MAAM;AAAED,QAAAA,aAAAA,CAAcE;AAAQ,KAAA;AAChH;;"}
@@ -0,0 +1,3 @@
1
+ import { ScreenTemplate } from '@cratis/scene.model';
2
+ export declare const inventoryItemPageTemplate: ScreenTemplate;
3
+ //# sourceMappingURL=recordTemplates.d.ts.map
@@ -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;AAWpE,eAAO,MAAM,yBAAyB,EAAE,cA8BvC,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { TemplateScope } from '@cratis/scene.model';
2
+ import { component, recordPageTemplate } from '@cratis/scene.blueprint.default';
3
+ import { localeOfData, fromQuery, inventoryQueriesOf, InventoryEntityKind, InventoryQuery, currencyOfData } from '../inventoryQueries.js';
4
+ import { inventoryMetadata, withBehaviors, goesTo, actionButton, opensDialog } from '../inventoryParts.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 queries = inventoryQueriesOf(InventoryEntityKind.Item);
9
+ /**
10
+ * The item page: the foundation `RecordPage` with the item's name as its title, Adjust stock and Check out as its actions, its key facts under it, the record's
11
+ * fields with the supplier's details, the stock of the item in each location and its movement history as related lists, and the cycle counts to do beside it.
12
+ */ const inventoryItemPageTemplate = {
13
+ name: 'InventoryItemPage',
14
+ fitsSlot: 'content',
15
+ slots: recordPageTemplate.slots,
16
+ arrangement: recordPageTemplate.arrangement,
17
+ content: {
18
+ header: [
19
+ component('InventoryItemPage-header', 'pageHeader', {
20
+ title: fromQuery(queries.record, '0.name'),
21
+ subtitle: 'Item'
22
+ }, {
23
+ actions: [
24
+ withBehaviors(actionButton('InventoryItemPage-check', 'Check out', 'secondary'), goesTo('inventory.movements.check')),
25
+ withBehaviors(actionButton('InventoryItemPage-adjust', 'Adjust stock', 'primary'), opensDialog('InventoryAdjustStock'))
26
+ ]
27
+ })
28
+ ],
29
+ summary: [
30
+ component('InventoryItemPage-status', 'statusChip', {
31
+ status: fromQuery(queries.summary, '0.status'),
32
+ tone: fromQuery(queries.summary, '0.tone')
33
+ }),
34
+ component('InventoryItemPage-onhand', 'statCard', {
35
+ label: 'On hand',
36
+ value: fromQuery(queries.summary, '0.onHand'),
37
+ ...localeOfData
38
+ }),
39
+ component('InventoryItemPage-reorder', 'statCard', {
40
+ label: 'Reorder level',
41
+ value: fromQuery(queries.summary, '0.reorderLevel'),
42
+ ...localeOfData
43
+ }),
44
+ component('InventoryItemPage-value', 'statCard', {
45
+ label: 'Stock value',
46
+ value: fromQuery(queries.summary, '0.stockValue'),
47
+ format: 'currency',
48
+ fractionDigits: 0,
49
+ ...currencyOfData
50
+ })
51
+ ],
52
+ tabs: [
53
+ component('InventoryItemPage-tabs', 'tabSet', {
54
+ tabs: fromQuery(InventoryQuery.RecordTabs),
55
+ urlKey: 'tab',
56
+ label: 'Item sections'
57
+ })
58
+ ],
59
+ main: [
60
+ component('InventoryItemPage-form', 'formScreenBody', {
61
+ mode: 'readOnly',
62
+ sections: fromQuery(queries.sections),
63
+ values: fromQuery(queries.record, '0'),
64
+ ...localeOfData
65
+ })
66
+ ],
67
+ related: [
68
+ component('InventoryItemPage-stock', 'dataList', {
69
+ label: 'Stock by location',
70
+ rows: fromQuery(queries.stockByLocation),
71
+ columns: fromQuery('StockByLocationColumns'),
72
+ titleField: 'location',
73
+ pageSize: 5,
74
+ ...localeOfData
75
+ }),
76
+ component('InventoryItemPage-movements', 'dataList', {
77
+ label: 'Movement history',
78
+ rows: fromQuery(queries.movements),
79
+ columns: fromQuery(inventoryQueriesOf(InventoryEntityKind.Movement).columns),
80
+ titleField: 'item',
81
+ pageSize: 5,
82
+ ...localeOfData
83
+ })
84
+ ],
85
+ activity: [
86
+ component('InventoryItemPage-activity', 'activityFeed', {
87
+ label: 'Activity',
88
+ entries: fromQuery(queries.activity),
89
+ ...localeOfData
90
+ })
91
+ ],
92
+ aside: [
93
+ component('InventoryItemPage-tasks', 'checklistSection', {
94
+ label: 'Cycle counts',
95
+ sections: fromQuery(queries.tasks),
96
+ ...localeOfData
97
+ })
98
+ ]
99
+ },
100
+ displayName: 'Inventory item page',
101
+ description: 'One item: key facts, its fields and supplier, its stock by location and its movement history.',
102
+ metadata: inventoryMetadata('InventoryItemPage', 'Detail', [
103
+ TemplateScope.Feature,
104
+ TemplateScope.Subfeature
105
+ ])
106
+ };
107
+
108
+ export { inventoryItemPageTemplate };
109
+ //# 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 { InventoryEntityKind, InventoryQuery, currencyOfData, fromQuery, inventoryQueriesOf, localeOfData } from '../inventoryQueries';\nimport { actionButton, component, goesTo, inventoryMetadata, opensDialog, withBehaviors } from '../inventoryParts';\n\nconst queries = inventoryQueriesOf(InventoryEntityKind.Item);\n\n/**\n * The item page: the foundation `RecordPage` with the item's name as its title, Adjust stock and Check out as its actions, its key facts under it, the record's\n * fields with the supplier's details, the stock of the item in each location and its movement history as related lists, and the cycle counts to do beside it.\n */\nexport const inventoryItemPageTemplate: ScreenTemplate = {\n name: 'InventoryItemPage',\n fitsSlot: 'content',\n slots: recordPageTemplate.slots,\n arrangement: recordPageTemplate.arrangement,\n content: {\n header: [component('InventoryItemPage-header', 'pageHeader', { title: fromQuery(queries.record, '0.name'), subtitle: 'Item' }, {\n actions: [\n withBehaviors(actionButton('InventoryItemPage-check', 'Check out', 'secondary'), goesTo('inventory.movements.check')),\n withBehaviors(actionButton('InventoryItemPage-adjust', 'Adjust stock', 'primary'), opensDialog('InventoryAdjustStock')),\n ],\n })],\n summary: [\n component('InventoryItemPage-status', 'statusChip', { status: fromQuery(queries.summary, '0.status'), tone: fromQuery(queries.summary, '0.tone') }),\n component('InventoryItemPage-onhand', 'statCard', { label: 'On hand', value: fromQuery(queries.summary, '0.onHand'), ...localeOfData }),\n component('InventoryItemPage-reorder', 'statCard', { label: 'Reorder level', value: fromQuery(queries.summary, '0.reorderLevel'), ...localeOfData }),\n component('InventoryItemPage-value', 'statCard', { label: 'Stock value', value: fromQuery(queries.summary, '0.stockValue'), format: 'currency', fractionDigits: 0, ...currencyOfData }),\n ],\n tabs: [component('InventoryItemPage-tabs', 'tabSet', { tabs: fromQuery(InventoryQuery.RecordTabs), urlKey: 'tab', label: 'Item sections' })],\n main: [component('InventoryItemPage-form', 'formScreenBody', { mode: 'readOnly', sections: fromQuery(queries.sections), values: fromQuery(queries.record, '0'), ...localeOfData })],\n related: [\n component('InventoryItemPage-stock', 'dataList', { label: 'Stock by location', rows: fromQuery(queries.stockByLocation), columns: fromQuery('StockByLocationColumns'), titleField: 'location', pageSize: 5, ...localeOfData }),\n component('InventoryItemPage-movements', 'dataList', { label: 'Movement history', rows: fromQuery(queries.movements), columns: fromQuery(inventoryQueriesOf(InventoryEntityKind.Movement).columns), titleField: 'item', pageSize: 5, ...localeOfData }),\n ],\n activity: [component('InventoryItemPage-activity', 'activityFeed', { label: 'Activity', entries: fromQuery(queries.activity), ...localeOfData })],\n aside: [component('InventoryItemPage-tasks', 'checklistSection', { label: 'Cycle counts', sections: fromQuery(queries.tasks), ...localeOfData })],\n },\n displayName: 'Inventory item page',\n description: 'One item: key facts, its fields and supplier, its stock by location and its movement history.',\n metadata: inventoryMetadata('InventoryItemPage', 'Detail', [TemplateScope.Feature, TemplateScope.Subfeature]),\n};\n"],"names":["queries","inventoryQueriesOf","InventoryEntityKind","Item","inventoryItemPageTemplate","name","fitsSlot","slots","recordPageTemplate","arrangement","content","header","component","title","fromQuery","record","subtitle","actions","withBehaviors","actionButton","goesTo","opensDialog","summary","status","tone","label","value","localeOfData","format","fractionDigits","currencyOfData","tabs","InventoryQuery","RecordTabs","urlKey","main","mode","sections","values","related","rows","stockByLocation","columns","titleField","pageSize","movements","Movement","activity","entries","aside","tasks","displayName","description","metadata","inventoryMetadata","TemplateScope","Feature","Subfeature"],"mappings":";;;;;AAAA;AACA;AAOA,MAAMA,OAAAA,GAAUC,kBAAAA,CAAmBC,mBAAAA,CAAoBC,IAAI,CAAA;AAE3D;;;UAIaC,yBAAAA,GAA4C;IACrDC,IAAAA,EAAM,mBAAA;IACNC,QAAAA,EAAU,SAAA;AACVC,IAAAA,KAAAA,EAAOC,mBAAmBD,KAAK;AAC/BE,IAAAA,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