@cratis/scene.blueprint.administration 0.0.0-stage → 4.50.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.
Files changed (134) hide show
  1. package/administrationApplication.ts +28 -0
  2. package/administrationParts.ts +52 -0
  3. package/administrationQueries.ts +62 -0
  4. package/administrationScreenSet.ts +22 -0
  5. package/blueprint.ts +16 -0
  6. package/blueprintCatalog.json +132 -0
  7. package/dist/cjs/administrationApplication.js +49 -0
  8. package/dist/cjs/administrationApplication.js.map +1 -0
  9. package/dist/cjs/administrationParts.js +131 -0
  10. package/dist/cjs/administrationParts.js.map +1 -0
  11. package/dist/cjs/administrationQueries.js +69 -0
  12. package/dist/cjs/administrationQueries.js.map +1 -0
  13. package/dist/cjs/administrationScreenSet.js +47 -0
  14. package/dist/cjs/administrationScreenSet.js.map +1 -0
  15. package/dist/cjs/blueprint.js +19 -0
  16. package/dist/cjs/blueprint.js.map +1 -0
  17. package/dist/cjs/index.js +68 -0
  18. package/dist/cjs/index.js.map +1 -0
  19. package/dist/cjs/manifest.js +65 -0
  20. package/dist/cjs/manifest.js.map +1 -0
  21. package/dist/cjs/navigation.js +117 -0
  22. package/dist/cjs/navigation.js.map +1 -0
  23. package/dist/cjs/package.json +3 -0
  24. package/dist/cjs/packageName.js +8 -0
  25. package/dist/cjs/packageName.js.map +1 -0
  26. package/dist/cjs/screens/index.js +22 -0
  27. package/dist/cjs/screens/index.js.map +1 -0
  28. package/dist/cjs/templateProvenance.js +24 -0
  29. package/dist/cjs/templateProvenance.js.map +1 -0
  30. package/dist/cjs/templates/dialogTemplates.js +51 -0
  31. package/dist/cjs/templates/dialogTemplates.js.map +1 -0
  32. package/dist/cjs/templates/index.js +27 -0
  33. package/dist/cjs/templates/index.js.map +1 -0
  34. package/dist/cjs/templates/listTemplates.js +157 -0
  35. package/dist/cjs/templates/listTemplates.js.map +1 -0
  36. package/dist/cjs/templates/recordTemplates.js +103 -0
  37. package/dist/cjs/templates/recordTemplates.js.map +1 -0
  38. package/dist/cjs/templates/rolesTemplate.js +65 -0
  39. package/dist/cjs/templates/rolesTemplate.js.map +1 -0
  40. package/dist/cjs/templates/settingsTemplate.js +45 -0
  41. package/dist/cjs/templates/settingsTemplate.js.map +1 -0
  42. package/dist/esm/administrationApplication.d.ts +10 -0
  43. package/dist/esm/administrationApplication.d.ts.map +1 -0
  44. package/dist/esm/administrationApplication.js +44 -0
  45. package/dist/esm/administrationApplication.js.map +1 -0
  46. package/dist/esm/administrationParts.d.ts +15 -0
  47. package/dist/esm/administrationParts.d.ts.map +1 -0
  48. package/dist/esm/administrationParts.js +114 -0
  49. package/dist/esm/administrationParts.js.map +1 -0
  50. package/dist/esm/administrationQueries.d.ts +42 -0
  51. package/dist/esm/administrationQueries.d.ts.map +1 -0
  52. package/dist/esm/administrationQueries.js +61 -0
  53. package/dist/esm/administrationQueries.js.map +1 -0
  54. package/dist/esm/administrationScreenSet.d.ts +7 -0
  55. package/dist/esm/administrationScreenSet.d.ts.map +1 -0
  56. package/dist/esm/administrationScreenSet.js +45 -0
  57. package/dist/esm/administrationScreenSet.js.map +1 -0
  58. package/dist/esm/blueprint.d.ts +3 -0
  59. package/dist/esm/blueprint.d.ts.map +1 -0
  60. package/dist/esm/blueprint.js +17 -0
  61. package/dist/esm/blueprint.js.map +1 -0
  62. package/dist/esm/index.d.ts +12 -0
  63. package/dist/esm/index.d.ts.map +1 -0
  64. package/dist/esm/index.js +18 -0
  65. package/dist/esm/index.js.map +1 -0
  66. package/dist/esm/manifest.d.ts +3 -0
  67. package/dist/esm/manifest.d.ts.map +1 -0
  68. package/dist/esm/manifest.js +63 -0
  69. package/dist/esm/manifest.js.map +1 -0
  70. package/dist/esm/navigation.d.ts +5 -0
  71. package/dist/esm/navigation.d.ts.map +1 -0
  72. package/dist/esm/navigation.js +113 -0
  73. package/dist/esm/navigation.js.map +1 -0
  74. package/dist/esm/package.json +3 -0
  75. package/dist/esm/packageName.d.ts +2 -0
  76. package/dist/esm/packageName.d.ts.map +1 -0
  77. package/dist/esm/packageName.js +6 -0
  78. package/dist/esm/packageName.js.map +1 -0
  79. package/dist/esm/screens/index.d.ts +3 -0
  80. package/dist/esm/screens/index.d.ts.map +1 -0
  81. package/dist/esm/screens/index.js +20 -0
  82. package/dist/esm/screens/index.js.map +1 -0
  83. package/dist/esm/templateProvenance.d.ts +3 -0
  84. package/dist/esm/templateProvenance.d.ts.map +1 -0
  85. package/dist/esm/templateProvenance.js +22 -0
  86. package/dist/esm/templateProvenance.js.map +1 -0
  87. package/dist/esm/templates/dialogTemplates.d.ts +3 -0
  88. package/dist/esm/templates/dialogTemplates.d.ts.map +1 -0
  89. package/dist/esm/templates/dialogTemplates.js +49 -0
  90. package/dist/esm/templates/dialogTemplates.js.map +1 -0
  91. package/dist/esm/templates/index.d.ts +8 -0
  92. package/dist/esm/templates/index.d.ts.map +1 -0
  93. package/dist/esm/templates/index.js +18 -0
  94. package/dist/esm/templates/index.js.map +1 -0
  95. package/dist/esm/templates/listTemplates.d.ts +4 -0
  96. package/dist/esm/templates/listTemplates.d.ts.map +1 -0
  97. package/dist/esm/templates/listTemplates.js +154 -0
  98. package/dist/esm/templates/listTemplates.js.map +1 -0
  99. package/dist/esm/templates/recordTemplates.d.ts +3 -0
  100. package/dist/esm/templates/recordTemplates.d.ts.map +1 -0
  101. package/dist/esm/templates/recordTemplates.js +101 -0
  102. package/dist/esm/templates/recordTemplates.js.map +1 -0
  103. package/dist/esm/templates/rolesTemplate.d.ts +3 -0
  104. package/dist/esm/templates/rolesTemplate.d.ts.map +1 -0
  105. package/dist/esm/templates/rolesTemplate.js +63 -0
  106. package/dist/esm/templates/rolesTemplate.js.map +1 -0
  107. package/dist/esm/templates/settingsTemplate.d.ts +3 -0
  108. package/dist/esm/templates/settingsTemplate.d.ts.map +1 -0
  109. package/dist/esm/templates/settingsTemplate.js +43 -0
  110. package/dist/esm/templates/settingsTemplate.js.map +1 -0
  111. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  112. package/index.ts +14 -0
  113. package/manifest.ts +41 -0
  114. package/navigation.ts +54 -0
  115. package/package.json +79 -5
  116. package/packageName.ts +5 -0
  117. package/sampleData/admin-default.json +1034 -0
  118. package/screens/index.ts +20 -0
  119. package/templateProvenance.ts +15 -0
  120. package/templates/dialogTemplates.ts +34 -0
  121. package/templates/index.ts +23 -0
  122. package/templates/listTemplates.ts +94 -0
  123. package/templates/recordTemplates.ts +44 -0
  124. package/templates/rolesTemplate.ts +39 -0
  125. package/templates/settingsTemplate.ts +28 -0
  126. package/thumbnails/AdministrationAuditLog.svg +13 -0
  127. package/thumbnails/AdministrationInviteUser.svg +12 -0
  128. package/thumbnails/AdministrationQuickCreateRole.svg +12 -0
  129. package/thumbnails/AdministrationRoles.svg +20 -0
  130. package/thumbnails/AdministrationSettings.svg +17 -0
  131. package/thumbnails/AdministrationUserList.svg +13 -0
  132. package/thumbnails/AdministrationUserPage.svg +18 -0
  133. package/thumbnails/administration.svg +14 -0
  134. package/README.md +0 -3
@@ -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 { administrationNavigation, administrationStructure } from './navigation';
8
+ import { administrationScreens } from './screens';
9
+ import { administrationDialogTemplates, administrationScreenTemplates } from './templates';
10
+
11
+ /** The id of the sample-data pack a new application starts with. */
12
+ export const administrationDefaultSampleDataId = 'admin-default';
13
+
14
+ /**
15
+ * The example application of the blueprint: the foundation's layouts, the Administration templates and quick-create dialogs and its five 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/Administration/administration.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
18
+ */
19
+ export function administrationApplication(sampleData: string = administrationDefaultSampleDataId): ApplicationDocument {
20
+ const profile: UiProfile = { ...previewProfile(undefined), name: 'Administration', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };
21
+ return { layouts: defaultLayouts, screenTemplates: administrationScreenTemplates, dialogTemplates: administrationDialogTemplates, screens: administrationScreens, 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 administrationComposition: CompositionOptions = { logo: administrationNavigation.application.logo };
26
+
27
+ /** The structure and navigation the shell's regions show and the items' destinations resolve against. */
28
+ export const administrationNavigationModel = () => ({ structure: new ApplicationStructureIndex(administrationStructure), navigation: administrationNavigation });
@@ -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 { administrationTemplateProvenance } 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 administrationCategory = 'Business / Administration';
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 administrationMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace', scopes: TemplateScope[]): TemplateMetadata =>
20
+ ({ ...administrationTemplateProvenance, type, category: administrationCategory, 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 AdministrationScreenTemplate = ScreenTemplate;
52
+ export type AdministrationDialogTemplate = DialogTemplate;
@@ -0,0 +1,62 @@
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 Administration template declares *where* its data comes from and the sample-data pack, or the real
8
+ * query, supplies the rows (spec SD1); `path` reaches into the result (`0.value` is the first row's `value`, an empty path is the whole result).
9
+ */
10
+ export const fromQuery = (query: string, path = ''): BindingExpression => ({ kind: BindingSourceKind.QueryResult, query, path });
11
+
12
+ /** The queries of the screens that are not a plain list. Each is a shape the sample-data pack supplies rows for. */
13
+ export const AdministrationQuery = {
14
+ /** One row: the `locale` the figures and dates are formatted in. */
15
+ Settings: 'AdminSettings',
16
+ RecordTabs: 'AdministrationRecordTabs',
17
+ RoleList: 'AdministrationRoles',
18
+ RoleColumns: 'AdministrationRoleColumns',
19
+ /** The roles as the permission matrix reads them: an `id` and a `label` each. */
20
+ MatrixRoles: 'AdministrationMatrixRoles',
21
+ Permissions: 'AdministrationPermissions',
22
+ Grants: 'AdministrationGrants',
23
+ SettingsSections: 'AdministrationSettingsSections',
24
+ SettingsValues: 'AdministrationSettingsValues',
25
+ FormErrors: 'AdministrationFormErrors',
26
+ } as const;
27
+
28
+ /** The entities a template is made for. */
29
+ export enum AdministrationEntityKind {
30
+ User = 'User',
31
+ Audit = 'Audit',
32
+ }
33
+
34
+ /** The read model (and so the shape) the records of each entity are queried from. */
35
+ export const administrationEntityPlural: Record<AdministrationEntityKind, string> = {
36
+ [AdministrationEntityKind.User]: 'Users',
37
+ [AdministrationEntityKind.Audit]: 'AuditEntries',
38
+ };
39
+
40
+ /**
41
+ * 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
42
+ * list, its saved views and column choices, the selection, the sections of the quick form, and what the record page shows.
43
+ */
44
+ export const administrationQueriesOf = (entity: AdministrationEntityKind) => ({
45
+ rows: administrationEntityPlural[entity],
46
+ columns: `${entity}Columns`,
47
+ filterFields: `${entity}FilterFields`,
48
+ views: `${entity}Views`,
49
+ columnChoices: `${entity}ColumnChoices`,
50
+ selection: `${entity}Selection`,
51
+ quickSections: `${entity}QuickSections`,
52
+ record: `${entity}Record`,
53
+ sections: `${entity}Sections`,
54
+ summary: `${entity}Summary`,
55
+ roles: `${entity}Roles`,
56
+ sessions: `${entity}Sessions`,
57
+ activity: `${entity}Activity`,
58
+ });
59
+
60
+ /** The locale and currency of the data, bound onto every component that formats a figure or a date. */
61
+ export const localeOfData = { locale: fromQuery(AdministrationQuery.Settings, '0.locale') };
62
+ export const currencyOfData = { ...localeOfData, currency: fromQuery(AdministrationQuery.Settings, '0.currency') };
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { BlueprintScreen } from '@cratis/scene.model';
5
+
6
+ /** One ready-to-use screen: the qualified name that is also its place in the application (`admin.users.record` is the `record` feature of `users` in the `admin` module). */
7
+ export interface AdministrationScreenDefinition 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 administrationScreenDefinitions: AdministrationScreenDefinition[] = [
17
+ { name: 'admin.users', title: 'Users', template: 'AdministrationUserList', order: 0, description: 'Everyone with an account: role, status and when they were last active; invite someone.' },
18
+ { name: 'admin.users.record', title: 'User', template: 'AdministrationUserPage', parent: 'admin.users', description: 'One user: profile, role assignments and sessions.' },
19
+ { name: 'admin.roles', title: 'Roles and permissions', template: 'AdministrationRoles', order: 1, description: 'The roles on the left and what the chosen role may do on the right.' },
20
+ { name: 'admin.settings', title: 'Settings', template: 'AdministrationSettings', order: 2, description: 'General, branding and notification settings of the organization.' },
21
+ { name: 'admin.audit', title: 'Audit log', template: 'AdministrationAuditLog', order: 3, description: 'Who did what to what and when, read only; filtered and exported.' },
22
+ ];
package/blueprint.ts ADDED
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { ScenePackageBundle } from '@cratis/scene.react';
5
+ import { administrationBlueprintManifest } from './manifest';
6
+ import { administrationScreens } from './screens';
7
+ import { administrationDialogTemplates, administrationScreenTemplates } from './templates';
8
+
9
+ /** This blueprint as a loadable bundle: the manifest names things, this provides them. It provides no component - every component is the foundation's. */
10
+ export const administrationBlueprint: ScenePackageBundle = {
11
+ manifest: administrationBlueprintManifest,
12
+ components: {},
13
+ screenTemplates: administrationScreenTemplates,
14
+ dialogTemplates: administrationDialogTemplates,
15
+ screens: administrationScreens,
16
+ };
@@ -0,0 +1,132 @@
1
+ {
2
+ "schema": 1,
3
+ "blueprints": [
4
+ {
5
+ "package": "Cratis.Blueprint.Administration",
6
+ "version": "1.0.0",
7
+ "domain": "administration",
8
+ "displayName": "Administration",
9
+ "description": "Users, roles and permissions, settings and an audit log for an administrator: a user list and page, a roles list beside its permission matrix, a settings form and a read-only audit log.",
10
+ "thumbnail": "thumbnails/administration.svg",
11
+ "license": "MIT",
12
+ "licenseUrl": "https://github.com/Cratis/Scene/blob/main/LICENSE",
13
+ "dependencies": [
14
+ {
15
+ "name": "Cratis.Blueprint.Default",
16
+ "versionRange": "^1.0.0"
17
+ }
18
+ ],
19
+ "screens": [
20
+ {
21
+ "name": "admin.users",
22
+ "title": "Users",
23
+ "description": "Everyone with an account: role, status and when they were last active; invite someone.",
24
+ "template": "AdministrationUserList",
25
+ "order": 0
26
+ },
27
+ {
28
+ "name": "admin.users.record",
29
+ "title": "User",
30
+ "description": "One user: profile, role assignments and sessions.",
31
+ "template": "AdministrationUserPage",
32
+ "parent": "admin.users"
33
+ },
34
+ {
35
+ "name": "admin.roles",
36
+ "title": "Roles and permissions",
37
+ "description": "The roles on the left and what the chosen role may do on the right.",
38
+ "template": "AdministrationRoles",
39
+ "order": 1
40
+ },
41
+ {
42
+ "name": "admin.settings",
43
+ "title": "Settings",
44
+ "description": "General, branding and notification settings of the organization.",
45
+ "template": "AdministrationSettings",
46
+ "order": 2
47
+ },
48
+ {
49
+ "name": "admin.audit",
50
+ "title": "Audit log",
51
+ "description": "Who did what to what and when, read only; filtered and exported.",
52
+ "template": "AdministrationAuditLog",
53
+ "order": 3
54
+ }
55
+ ],
56
+ "templates": [
57
+ {
58
+ "name": "AdministrationUserList",
59
+ "kind": "ScreenTemplate",
60
+ "displayName": "Administration users",
61
+ "description": "Users with name, email, role, status and last active, filtered by role, status and last active; an invite action.",
62
+ "type": "List",
63
+ "category": "Business / Administration",
64
+ "thumbnail": "thumbnails/AdministrationUserList.svg"
65
+ },
66
+ {
67
+ "name": "AdministrationUserPage",
68
+ "kind": "ScreenTemplate",
69
+ "displayName": "Administration user page",
70
+ "description": "One user: profile, role assignments and sessions.",
71
+ "type": "Detail",
72
+ "category": "Business / Administration",
73
+ "thumbnail": "thumbnails/AdministrationUserPage.svg"
74
+ },
75
+ {
76
+ "name": "AdministrationRoles",
77
+ "kind": "ScreenTemplate",
78
+ "displayName": "Administration roles and permissions",
79
+ "description": "The roles on the left and the permission matrix of the chosen role on the right.",
80
+ "type": "Workspace",
81
+ "category": "Business / Administration",
82
+ "thumbnail": "thumbnails/AdministrationRoles.svg"
83
+ },
84
+ {
85
+ "name": "AdministrationSettings",
86
+ "kind": "ScreenTemplate",
87
+ "displayName": "Administration settings",
88
+ "description": "General, branding and notification settings, each section with its own Save.",
89
+ "type": "Form",
90
+ "category": "Business / Administration",
91
+ "thumbnail": "thumbnails/AdministrationSettings.svg"
92
+ },
93
+ {
94
+ "name": "AdministrationAuditLog",
95
+ "kind": "ScreenTemplate",
96
+ "displayName": "Administration audit log",
97
+ "description": "Time, actor, action and target of every change, filtered by actor, action and date range; exportable.",
98
+ "type": "List",
99
+ "category": "Business / Administration",
100
+ "thumbnail": "thumbnails/AdministrationAuditLog.svg"
101
+ },
102
+ {
103
+ "name": "AdministrationInviteUser",
104
+ "kind": "DialogTemplate",
105
+ "displayName": "Administration quick create invitation",
106
+ "description": "A short form that invites someone by email with a role, without leaving the page.",
107
+ "type": "Dialog",
108
+ "category": "Business / Administration",
109
+ "thumbnail": "thumbnails/AdministrationInviteUser.svg"
110
+ },
111
+ {
112
+ "name": "AdministrationQuickCreateRole",
113
+ "kind": "DialogTemplate",
114
+ "displayName": "Administration quick create role",
115
+ "description": "A short form that creates one role without leaving the page.",
116
+ "type": "Dialog",
117
+ "category": "Business / Administration",
118
+ "thumbnail": "thumbnails/AdministrationQuickCreateRole.svg"
119
+ }
120
+ ],
121
+ "sampleData": [
122
+ {
123
+ "id": "admin-default",
124
+ "title": "Administration · Default",
125
+ "locale": "en-GB",
126
+ "path": "sampleData/admin-default.json",
127
+ "default": true
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var scene_engine = require('@cratis/scene.engine');
4
+ var scene_blueprint_default = require('@cratis/scene.blueprint.default');
5
+ var navigation = require('./navigation.js');
6
+ var index = require('./screens/index.js');
7
+ var index$1 = require('./templates/index.js');
8
+ var dialogTemplates = require('./templates/dialogTemplates.js');
9
+
10
+ // Copyright (c) Cratis. All rights reserved.
11
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
12
+ /** The id of the sample-data pack a new application starts with. */ const administrationDefaultSampleDataId = 'admin-default';
13
+ /**
14
+ * The example application of the blueprint: the foundation's layouts, the Administration templates and quick-create dialogs and its five screens, rendering against the
15
+ * foundation's packages with the default sample-data pack chosen. This is what a gallery previews and what the conformance fixture
16
+ * (`Samples/Administration/administration.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
17
+ */ function administrationApplication(sampleData = administrationDefaultSampleDataId) {
18
+ const profile = {
19
+ ...scene_blueprint_default.previewProfile(undefined),
20
+ name: 'Administration',
21
+ sampleData: {
22
+ activePack: sampleData,
23
+ mappings: [],
24
+ bindings: []
25
+ }
26
+ };
27
+ return {
28
+ layouts: scene_blueprint_default.defaultLayouts,
29
+ screenTemplates: index$1.administrationScreenTemplates,
30
+ dialogTemplates: dialogTemplates.administrationDialogs,
31
+ screens: index.administrationScreens,
32
+ uiProfiles: [
33
+ profile
34
+ ]
35
+ };
36
+ }
37
+ /** What a host composes the screens with: the application's logo, which the shell's topbar shows. */ const administrationComposition = {
38
+ logo: navigation.administrationNavigation.application.logo
39
+ };
40
+ /** The structure and navigation the shell's regions show and the items' destinations resolve against. */ const administrationNavigationModel = ()=>({
41
+ structure: new scene_engine.ApplicationStructureIndex(navigation.administrationStructure),
42
+ navigation: navigation.administrationNavigation
43
+ });
44
+
45
+ exports.administrationApplication = administrationApplication;
46
+ exports.administrationComposition = administrationComposition;
47
+ exports.administrationDefaultSampleDataId = administrationDefaultSampleDataId;
48
+ exports.administrationNavigationModel = administrationNavigationModel;
49
+ //# sourceMappingURL=administrationApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"administrationApplication.js","sources":["../../administrationApplication.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UiProfile } from '@cratis/scene.model';\nimport { ApplicationStructureIndex } from '@cratis/scene.engine';\nimport { ApplicationDocument, CompositionOptions, defaultLayouts, previewProfile } from '@cratis/scene.blueprint.default';\nimport { administrationNavigation, administrationStructure } from './navigation';\nimport { administrationScreens } from './screens';\nimport { administrationDialogTemplates, administrationScreenTemplates } from './templates';\n\n/** The id of the sample-data pack a new application starts with. */\nexport const administrationDefaultSampleDataId = 'admin-default';\n\n/**\n * The example application of the blueprint: the foundation's layouts, the Administration templates and quick-create dialogs and its five screens, rendering against the\n * foundation's packages with the default sample-data pack chosen. This is what a gallery previews and what the conformance fixture\n * (`Samples/Administration/administration.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.\n */\nexport function administrationApplication(sampleData: string = administrationDefaultSampleDataId): ApplicationDocument {\n const profile: UiProfile = { ...previewProfile(undefined), name: 'Administration', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };\n return { layouts: defaultLayouts, screenTemplates: administrationScreenTemplates, dialogTemplates: administrationDialogTemplates, screens: administrationScreens, uiProfiles: [profile] };\n}\n\n/** What a host composes the screens with: the application's logo, which the shell's topbar shows. */\nexport const administrationComposition: CompositionOptions = { logo: administrationNavigation.application.logo };\n\n/** The structure and navigation the shell's regions show and the items' destinations resolve against. */\nexport const administrationNavigationModel = () => ({ structure: new ApplicationStructureIndex(administrationStructure), navigation: administrationNavigation });\n"],"names":["administrationDefaultSampleDataId","administrationApplication","sampleData","profile","previewProfile","undefined","name","activePack","mappings","bindings","layouts","defaultLayouts","screenTemplates","administrationScreenTemplates","dialogTemplates","administrationDialogTemplates","screens","administrationScreens","uiProfiles","administrationComposition","logo","administrationNavigation","application","administrationNavigationModel","structure","ApplicationStructureIndex","administrationStructure","navigation"],"mappings":";;;;;;;;;AAAA;AACA;AASA,qEACO,MAAMA,iCAAAA,GAAoC;AAEjD;;;;AAIC,IACM,SAASC,yBAAAA,CAA0BC,UAAAA,GAAqBF,iCAAiC,EAAA;AAC5F,IAAA,MAAMG,OAAAA,GAAqB;AAAE,QAAA,GAAGC,uCAAeC,SAAAA,CAAU;QAAEC,IAAAA,EAAM,gBAAA;QAAkBJ,UAAAA,EAAY;YAAEK,UAAAA,EAAYL,UAAAA;AAAYM,YAAAA,QAAAA,EAAU,EAAE;AAAEC,YAAAA,QAAAA,EAAU;AAAG;AAAE,KAAA;IACtJ,OAAO;QAAEC,OAAAA,EAASC,sCAAAA;QAAgBC,eAAAA,EAAiBC,qCAAAA;QAA+BC,eAAAA,EAAiBC,qCAAAA;QAA+BC,OAAAA,EAASC,2BAAAA;QAAuBC,UAAAA,EAAY;AAACf,YAAAA;AAAQ;AAAC,KAAA;AAC5L;AAEA,sGACO,MAAMgB,yBAAAA,GAAgD;IAAEC,IAAAA,EAAMC,mCAAAA,CAAyBC,WAAW,CAACF;AAAK;AAE/G,0GACO,MAAMG,6BAAAA,GAAgC,KAAO;AAAEC,QAAAA,SAAAA,EAAW,IAAIC,sCAAAA,CAA0BC,kCAAAA,CAAAA;QAA0BC,UAAAA,EAAYN;AAAyB,KAAA;;;;;"}
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var scene_blueprint_default = require('@cratis/scene.blueprint.default');
5
+ var templateProvenance = require('./templateProvenance.js');
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /** The category of every template of this blueprint (spec Part B 1.2: `Business / <domain>`). */ const administrationCategory = 'Business / Administration';
10
+ /** The package-relative thumbnail of a template. */ const thumbnailOf = (templateName)=>`thumbnails/${templateName}.svg`;
11
+ /** The metadata of a screen template of this blueprint: provenance, a type from the vocabulary, the category, a thumbnail and the levels it applies at. */ const administrationMetadata = (name, type, scopes)=>({
12
+ ...templateProvenance.administrationTemplateProvenance,
13
+ type,
14
+ category: administrationCategory,
15
+ thumbnail: thumbnailOf(name),
16
+ scopes
17
+ });
18
+ /** A button of the foundation: a verb, its emphasis, and the permission rule every action declares (spec Part B 1.5). */ const actionButton = (id, label, emphasis, extra = {}, behaviors)=>({
19
+ ...scene_blueprint_default.component(id, 'actionButton', {
20
+ label,
21
+ emphasis,
22
+ permission: 'enabled',
23
+ ...extra
24
+ }),
25
+ ...behaviors ? {
26
+ behaviors
27
+ } : {}
28
+ });
29
+ /** What pressing an element does: open the named dialog template over the page. */ const opensDialog = (dialogTemplate)=>[
30
+ {
31
+ bindings: [
32
+ {
33
+ trigger: {
34
+ kind: scene_model.InteractionTriggerKind.Click
35
+ },
36
+ actions: [
37
+ {
38
+ kind: scene_model.InteractionActionKind.OpenDialog,
39
+ dialogTemplate
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ ];
46
+ /** What pressing an element does: go to the named screen. */ const goesTo = (screen)=>[
47
+ {
48
+ bindings: [
49
+ {
50
+ trigger: {
51
+ kind: scene_model.InteractionTriggerKind.Click
52
+ },
53
+ actions: [
54
+ {
55
+ kind: scene_model.InteractionActionKind.Navigate,
56
+ screen
57
+ }
58
+ ]
59
+ }
60
+ ]
61
+ }
62
+ ];
63
+ /**
64
+ * What choosing a row of a list does: open the record page, handing it the chosen row's id. The list is single-selection, so choosing a row is
65
+ * opening it - the way a table of records works everywhere.
66
+ */ const opensRecordOnSelect = (listId, screen)=>[
67
+ {
68
+ bindings: [
69
+ {
70
+ trigger: {
71
+ kind: scene_model.InteractionTriggerKind.Select
72
+ },
73
+ actions: [
74
+ {
75
+ kind: scene_model.InteractionActionKind.Navigate,
76
+ screen,
77
+ arguments: [
78
+ {
79
+ name: 'id',
80
+ value: {
81
+ kind: scene_model.BindingSourceKind.ComponentProperty,
82
+ componentId: listId,
83
+ path: 'value'
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ }
90
+ ]
91
+ }
92
+ ];
93
+ /** What a Cancel or Close control does: close the dialog it was opened from. */ const closesDialog = ()=>[
94
+ {
95
+ bindings: [
96
+ {
97
+ trigger: {
98
+ kind: scene_model.InteractionTriggerKind.Click
99
+ },
100
+ actions: [
101
+ {
102
+ kind: scene_model.InteractionActionKind.CloseDialog
103
+ }
104
+ ]
105
+ }
106
+ ]
107
+ }
108
+ ];
109
+ /** An element with the given behaviors attached. */ const withBehaviors = (element, behaviors)=>({
110
+ ...element,
111
+ behaviors
112
+ });
113
+
114
+ Object.defineProperty(exports, "component", {
115
+ enumerable: true,
116
+ get: function () { return scene_blueprint_default.component; }
117
+ });
118
+ Object.defineProperty(exports, "panel", {
119
+ enumerable: true,
120
+ get: function () { return scene_blueprint_default.panel; }
121
+ });
122
+ exports.actionButton = actionButton;
123
+ exports.administrationCategory = administrationCategory;
124
+ exports.administrationMetadata = administrationMetadata;
125
+ exports.closesDialog = closesDialog;
126
+ exports.goesTo = goesTo;
127
+ exports.opensDialog = opensDialog;
128
+ exports.opensRecordOnSelect = opensRecordOnSelect;
129
+ exports.thumbnailOf = thumbnailOf;
130
+ exports.withBehaviors = withBehaviors;
131
+ //# sourceMappingURL=administrationParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"administrationParts.js","sources":["../../administrationParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Behavior, BindingSourceKind, DialogTemplate, ExternalComponent, InteractionActionKind, InteractionTriggerKind, NavigateAction, OpenDialogAction, SceneElement, ScreenTemplate, TemplateMetadata, TemplateScope,\n} from '@cratis/scene.model';\nimport { component, panel } from '@cratis/scene.blueprint.default';\nimport { administrationTemplateProvenance } from './templateProvenance';\n\nexport { component, panel };\n\n/** The category of every template of this blueprint (spec Part B 1.2: `Business / <domain>`). */\nexport const administrationCategory = 'Business / Administration';\n\n/** The package-relative thumbnail of a template. */\nexport const thumbnailOf = (templateName: string): string => `thumbnails/${templateName}.svg`;\n\n/** The metadata of a screen template of this blueprint: provenance, a type from the vocabulary, the category, a thumbnail and the levels it applies at. */\nexport const administrationMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace', scopes: TemplateScope[]): TemplateMetadata =>\n ({ ...administrationTemplateProvenance, type, category: administrationCategory, thumbnail: thumbnailOf(name), scopes });\n\n/** A button of the foundation: a verb, its emphasis, and the permission rule every action declares (spec Part B 1.5). */\nexport const actionButton = (id: string, label: string, emphasis: 'primary' | 'secondary' | 'quiet' | 'danger', extra: Record<string, unknown> = {}, behaviors?: Behavior[]): ExternalComponent =>\n ({ ...component(id, 'actionButton', { label, emphasis, permission: 'enabled', ...extra }), ...(behaviors ? { behaviors } : {}) });\n\n/** What pressing an element does: open the named dialog template over the page. */\nexport const opensDialog = (dialogTemplate: string): Behavior[] =>\n [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.OpenDialog, dialogTemplate } as OpenDialogAction] }] }];\n\n/** What pressing an element does: go to the named screen. */\nexport const goesTo = (screen: string): Behavior[] =>\n [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.Navigate, screen } as NavigateAction] }] }];\n\n/**\n * What choosing a row of a list does: open the record page, handing it the chosen row's id. The list is single-selection, so choosing a row is\n * opening it - the way a table of records works everywhere.\n */\nexport const opensRecordOnSelect = (listId: string, screen: string): Behavior[] => [{\n bindings: [{\n trigger: { kind: InteractionTriggerKind.Select },\n actions: [{ kind: InteractionActionKind.Navigate, screen, arguments: [{ name: 'id', value: { kind: BindingSourceKind.ComponentProperty, componentId: listId, path: 'value' } }] } as NavigateAction],\n }],\n}];\n\n/** What a Cancel or Close control does: close the dialog it was opened from. */\nexport const closesDialog = (): Behavior[] => [{ bindings: [{ trigger: { kind: InteractionTriggerKind.Click }, actions: [{ kind: InteractionActionKind.CloseDialog }] }] }];\n\n/** An element with the given behaviors attached. */\nexport const withBehaviors = <T extends SceneElement>(element: T, behaviors: Behavior[]): T => ({ ...element, behaviors });\n\nexport type AdministrationScreenTemplate = ScreenTemplate;\nexport type AdministrationDialogTemplate = DialogTemplate;\n"],"names":["administrationCategory","thumbnailOf","templateName","administrationMetadata","name","type","scopes","administrationTemplateProvenance","category","thumbnail","actionButton","id","label","emphasis","extra","behaviors","component","permission","opensDialog","dialogTemplate","bindings","trigger","kind","InteractionTriggerKind","Click","actions","InteractionActionKind","OpenDialog","goesTo","screen","Navigate","opensRecordOnSelect","listId","Select","arguments","value","BindingSourceKind","ComponentProperty","componentId","path","closesDialog","CloseDialog","withBehaviors","element"],"mappings":";;;;;;AAAA;AACA;AAUA,kGACO,MAAMA,sBAAAA,GAAyB;AAEtC,qDACO,MAAMC,WAAAA,GAAc,CAACC,YAAAA,GAAiC,CAAC,WAAW,EAAEA,YAAAA,CAAa,IAAI;AAE5F,4JACO,MAAMC,sBAAAA,GAAyB,CAACC,IAAAA,EAAcC,IAAAA,EAAmFC,UACnI;AAAE,QAAA,GAAGC,mDAAgC;AAAEF,QAAAA,IAAAA;QAAMG,QAAAA,EAAUR,sBAAAA;AAAwBS,QAAAA,SAAAA,EAAWR,WAAAA,CAAYG,IAAAA,CAAAA;AAAOE,QAAAA;AAAO,KAAA;AAEzH,0HACO,MAAMI,YAAAA,GAAe,CAACC,EAAAA,EAAYC,KAAAA,EAAeC,QAAAA,EAAwDC,KAAAA,GAAiC,EAAE,EAAEC,aAChJ;QAAE,GAAGC,iCAAAA,CAAUL,IAAI,cAAA,EAAgB;AAAEC,YAAAA,KAAAA;AAAOC,YAAAA,QAAAA;YAAUI,UAAAA,EAAY,SAAA;AAAW,YAAA,GAAGH;SAAM,CAAE;AAAE,QAAA,GAAIC,SAAAA,GAAY;AAAEA,YAAAA;AAAU,SAAA,GAAI;AAAI,KAAA;AAEnI,oFACO,MAAMG,WAAAA,GAAc,CAACC,cAAAA,GACxB;AAAC,QAAA;YAAEC,QAAAA,EAAU;AAAC,gBAAA;oBAAEC,OAAAA,EAAS;AAAEC,wBAAAA,IAAAA,EAAMC,mCAAuBC;AAAM,qBAAA;oBAAGC,OAAAA,EAAS;AAAC,wBAAA;AAAEH,4BAAAA,IAAAA,EAAMI,kCAAsBC,UAAU;AAAER,4BAAAA;AAAe;AAAsB;AAAC;AAAE;AAAC;;AAElK,8DACO,MAAMS,MAAAA,GAAS,CAACC,MAAAA,GACnB;AAAC,QAAA;YAAET,QAAAA,EAAU;AAAC,gBAAA;oBAAEC,OAAAA,EAAS;AAAEC,wBAAAA,IAAAA,EAAMC,mCAAuBC;AAAM,qBAAA;oBAAGC,OAAAA,EAAS;AAAC,wBAAA;AAAEH,4BAAAA,IAAAA,EAAMI,kCAAsBI,QAAQ;AAAED,4BAAAA;AAAO;AAAoB;AAAC;AAAE;AAAC;;AAEtJ;;;AAGC,IACM,MAAME,mBAAAA,GAAsB,CAACC,QAAgBH,MAAAA,GAA+B;AAAC,QAAA;YAChFT,QAAAA,EAAU;AAAC,gBAAA;oBACPC,OAAAA,EAAS;AAAEC,wBAAAA,IAAAA,EAAMC,mCAAuBU;AAAO,qBAAA;oBAC/CR,OAAAA,EAAS;AAAC,wBAAA;AAAEH,4BAAAA,IAAAA,EAAMI,kCAAsBI,QAAQ;AAAED,4BAAAA,MAAAA;4BAAQK,SAAAA,EAAW;AAAC,gCAAA;oCAAE9B,IAAAA,EAAM,IAAA;oCAAM+B,KAAAA,EAAO;AAAEb,wCAAAA,IAAAA,EAAMc,8BAAkBC,iBAAiB;wCAAEC,WAAAA,EAAaN,MAAAA;wCAAQO,IAAAA,EAAM;AAAQ;AAAE;AAAE;AAAC;AAAoB;AACxM;AAAE;AACN;;AAEA,iFACO,MAAMC,YAAAA,GAAe,IAAkB;AAAC,QAAA;YAAEpB,QAAAA,EAAU;AAAC,gBAAA;oBAAEC,OAAAA,EAAS;AAAEC,wBAAAA,IAAAA,EAAMC,mCAAuBC;AAAM,qBAAA;oBAAGC,OAAAA,EAAS;AAAC,wBAAA;AAAEH,4BAAAA,IAAAA,EAAMI,kCAAsBe;AAAY;AAAE;AAAC;AAAE;AAAC;;AAEzK,qDACO,MAAMC,gBAAgB,CAAyBC,OAAAA,EAAY5B,aAA8B;AAAE,QAAA,GAAG4B,OAAO;AAAE5B,QAAAA;AAAU,KAAA;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /**
8
+ * A property taken from a query result - never a value. An Administration template declares *where* its data comes from and the sample-data pack, or the real
9
+ * 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).
10
+ */ const fromQuery = (query, path = '')=>({
11
+ kind: scene_model.BindingSourceKind.QueryResult,
12
+ query,
13
+ path
14
+ });
15
+ /** The queries of the screens that are not a plain list. Each is a shape the sample-data pack supplies rows for. */ const AdministrationQuery = {
16
+ /** One row: the `locale` the figures and dates are formatted in. */ Settings: 'AdminSettings',
17
+ RecordTabs: 'AdministrationRecordTabs',
18
+ RoleList: 'AdministrationRoles',
19
+ RoleColumns: 'AdministrationRoleColumns',
20
+ /** The roles as the permission matrix reads them: an `id` and a `label` each. */ MatrixRoles: 'AdministrationMatrixRoles',
21
+ Permissions: 'AdministrationPermissions',
22
+ Grants: 'AdministrationGrants',
23
+ SettingsSections: 'AdministrationSettingsSections',
24
+ SettingsValues: 'AdministrationSettingsValues',
25
+ FormErrors: 'AdministrationFormErrors'
26
+ };
27
+ /** The entities a template is made for. */ var AdministrationEntityKind = /*#__PURE__*/ function(AdministrationEntityKind) {
28
+ AdministrationEntityKind["User"] = "User";
29
+ AdministrationEntityKind["Audit"] = "Audit";
30
+ return AdministrationEntityKind;
31
+ }({});
32
+ /** The read model (and so the shape) the records of each entity are queried from. */ const administrationEntityPlural = {
33
+ ["User"]: 'Users',
34
+ ["Audit"]: 'AuditEntries'
35
+ };
36
+ /**
37
+ * 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
38
+ * list, its saved views and column choices, the selection, the sections of the quick form, and what the record page shows.
39
+ */ const administrationQueriesOf = (entity)=>({
40
+ rows: administrationEntityPlural[entity],
41
+ columns: `${entity}Columns`,
42
+ filterFields: `${entity}FilterFields`,
43
+ views: `${entity}Views`,
44
+ columnChoices: `${entity}ColumnChoices`,
45
+ selection: `${entity}Selection`,
46
+ quickSections: `${entity}QuickSections`,
47
+ record: `${entity}Record`,
48
+ sections: `${entity}Sections`,
49
+ summary: `${entity}Summary`,
50
+ roles: `${entity}Roles`,
51
+ sessions: `${entity}Sessions`,
52
+ activity: `${entity}Activity`
53
+ });
54
+ /** The locale and currency of the data, bound onto every component that formats a figure or a date. */ const localeOfData = {
55
+ locale: fromQuery(AdministrationQuery.Settings, '0.locale')
56
+ };
57
+ const currencyOfData = {
58
+ ...localeOfData,
59
+ currency: fromQuery(AdministrationQuery.Settings, '0.currency')
60
+ };
61
+
62
+ exports.AdministrationEntityKind = AdministrationEntityKind;
63
+ exports.AdministrationQuery = AdministrationQuery;
64
+ exports.administrationEntityPlural = administrationEntityPlural;
65
+ exports.administrationQueriesOf = administrationQueriesOf;
66
+ exports.currencyOfData = currencyOfData;
67
+ exports.fromQuery = fromQuery;
68
+ exports.localeOfData = localeOfData;
69
+ //# sourceMappingURL=administrationQueries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"administrationQueries.js","sources":["../../administrationQueries.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 { BindingExpression, BindingSourceKind } from '@cratis/scene.model';\n\n/**\n * A property taken from a query result - never a value. An Administration template declares *where* its data comes from and the sample-data pack, or the real\n * 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).\n */\nexport const fromQuery = (query: string, path = ''): BindingExpression => ({ kind: BindingSourceKind.QueryResult, query, path });\n\n/** The queries of the screens that are not a plain list. Each is a shape the sample-data pack supplies rows for. */\nexport const AdministrationQuery = {\n /** One row: the `locale` the figures and dates are formatted in. */\n Settings: 'AdminSettings',\n RecordTabs: 'AdministrationRecordTabs',\n RoleList: 'AdministrationRoles',\n RoleColumns: 'AdministrationRoleColumns',\n /** The roles as the permission matrix reads them: an `id` and a `label` each. */\n MatrixRoles: 'AdministrationMatrixRoles',\n Permissions: 'AdministrationPermissions',\n Grants: 'AdministrationGrants',\n SettingsSections: 'AdministrationSettingsSections',\n SettingsValues: 'AdministrationSettingsValues',\n FormErrors: 'AdministrationFormErrors',\n} as const;\n\n/** The entities a template is made for. */\nexport enum AdministrationEntityKind {\n User = 'User',\n Audit = 'Audit',\n}\n\n/** The read model (and so the shape) the records of each entity are queried from. */\nexport const administrationEntityPlural: Record<AdministrationEntityKind, string> = {\n [AdministrationEntityKind.User]: 'Users',\n [AdministrationEntityKind.Audit]: 'AuditEntries',\n};\n\n/**\n * 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\n * list, its saved views and column choices, the selection, the sections of the quick form, and what the record page shows.\n */\nexport const administrationQueriesOf = (entity: AdministrationEntityKind) => ({\n rows: administrationEntityPlural[entity],\n columns: `${entity}Columns`,\n filterFields: `${entity}FilterFields`,\n views: `${entity}Views`,\n columnChoices: `${entity}ColumnChoices`,\n selection: `${entity}Selection`,\n quickSections: `${entity}QuickSections`,\n record: `${entity}Record`,\n sections: `${entity}Sections`,\n summary: `${entity}Summary`,\n roles: `${entity}Roles`,\n sessions: `${entity}Sessions`,\n activity: `${entity}Activity`,\n});\n\n/** The locale and currency of the data, bound onto every component that formats a figure or a date. */\nexport const localeOfData = { locale: fromQuery(AdministrationQuery.Settings, '0.locale') };\nexport const currencyOfData = { ...localeOfData, currency: fromQuery(AdministrationQuery.Settings, '0.currency') };\n"],"names":["fromQuery","query","path","kind","BindingSourceKind","QueryResult","AdministrationQuery","Settings","RecordTabs","RoleList","RoleColumns","MatrixRoles","Permissions","Grants","SettingsSections","SettingsValues","FormErrors","AdministrationEntityKind","administrationEntityPlural","administrationQueriesOf","entity","rows","columns","filterFields","views","columnChoices","selection","quickSections","record","sections","summary","roles","sessions","activity","localeOfData","locale","currencyOfData","currency"],"mappings":";;;;AAAA;AACA;AAIA;;;UAIaA,SAAAA,GAAY,CAACC,OAAeC,IAAAA,GAAO,EAAE,IAAyB;AAAEC,QAAAA,IAAAA,EAAMC,8BAAkBC,WAAW;AAAEJ,QAAAA,KAAAA;AAAOC,QAAAA;AAAK,KAAA;AAE9H,qHACO,MAAMI,mBAAAA,GAAsB;AAC/B,yEACAC,QAAAA,EAAU,eAAA;IACVC,UAAAA,EAAY,0BAAA;IACZC,QAAAA,EAAU,qBAAA;IACVC,WAAAA,EAAa,2BAAA;AACb,sFACAC,WAAAA,EAAa,2BAAA;IACbC,WAAAA,EAAa,2BAAA;IACbC,MAAAA,EAAQ,sBAAA;IACRC,gBAAAA,EAAkB,gCAAA;IAClBC,cAAAA,EAAgB,8BAAA;IAChBC,UAAAA,EAAY;AAChB;AAEA,4CACO,IAAKC,wBAAAA,iBAAAA,SAAAA,wBAAAA,EAAAA;;;AAAAA,IAAAA,OAAAA,wBAAAA;AAGX,CAAA,CAAA,EAAA;AAED,sFACO,MAAMC,0BAAAA,GAAuE;AAChF,IAAA,CAAA,MAAA,GAAiC,OAAA;AACjC,IAAA,CAAA,OAAA,GAAkC;AACtC;AAEA;;;AAGC,IACM,MAAMC,uBAAAA,GAA0B,CAACC,UAAsC;QAC1EC,IAAAA,EAAMH,0BAA0B,CAACE,MAAAA,CAAO;QACxCE,OAAAA,EAAS,CAAA,EAAGF,MAAAA,CAAO,OAAO,CAAC;QAC3BG,YAAAA,EAAc,CAAA,EAAGH,MAAAA,CAAO,YAAY,CAAC;QACrCI,KAAAA,EAAO,CAAA,EAAGJ,MAAAA,CAAO,KAAK,CAAC;QACvBK,aAAAA,EAAe,CAAA,EAAGL,MAAAA,CAAO,aAAa,CAAC;QACvCM,SAAAA,EAAW,CAAA,EAAGN,MAAAA,CAAO,SAAS,CAAC;QAC/BO,aAAAA,EAAe,CAAA,EAAGP,MAAAA,CAAO,aAAa,CAAC;QACvCQ,MAAAA,EAAQ,CAAA,EAAGR,MAAAA,CAAO,MAAM,CAAC;QACzBS,QAAAA,EAAU,CAAA,EAAGT,MAAAA,CAAO,QAAQ,CAAC;QAC7BU,OAAAA,EAAS,CAAA,EAAGV,MAAAA,CAAO,OAAO,CAAC;QAC3BW,KAAAA,EAAO,CAAA,EAAGX,MAAAA,CAAO,KAAK,CAAC;QACvBY,QAAAA,EAAU,CAAA,EAAGZ,MAAAA,CAAO,QAAQ,CAAC;QAC7Ba,QAAAA,EAAU,CAAA,EAAGb,MAAAA,CAAO,QAAQ;AAChC,KAAA;AAEA,wGACO,MAAMc,YAAAA,GAAe;IAAEC,MAAAA,EAAQnC,SAAAA,CAAUM,mBAAAA,CAAoBC,QAAQ,EAAE,UAAA;AAAY;MAC7E6B,cAAAA,GAAiB;AAAE,IAAA,GAAGF,YAAY;IAAEG,QAAAA,EAAUrC,SAAAA,CAAUM,mBAAAA,CAAoBC,QAAQ,EAAE,YAAA;AAAc;;;;;;;;"}