@cratis/scene.blueprint.hr 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.
- package/README.md +66 -2
- package/blueprint.ts +16 -0
- package/blueprintCatalog.json +164 -0
- package/dist/cjs/blueprint.js +19 -0
- package/dist/cjs/blueprint.js.map +1 -0
- package/dist/cjs/hrApplication.js +49 -0
- package/dist/cjs/hrApplication.js.map +1 -0
- package/dist/cjs/hrParts.js +131 -0
- package/dist/cjs/hrParts.js.map +1 -0
- package/dist/cjs/hrQueries.js +67 -0
- package/dist/cjs/hrQueries.js.map +1 -0
- package/dist/cjs/hrScreenSet.js +61 -0
- package/dist/cjs/hrScreenSet.js.map +1 -0
- package/dist/cjs/index.js +69 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/manifest.js +65 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/navigation.js +135 -0
- package/dist/cjs/navigation.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/packageName.js +8 -0
- package/dist/cjs/packageName.js.map +1 -0
- package/dist/cjs/screens/index.js +22 -0
- package/dist/cjs/screens/index.js.map +1 -0
- package/dist/cjs/templateProvenance.js +24 -0
- package/dist/cjs/templateProvenance.js.map +1 -0
- package/dist/cjs/templates/formTemplates.js +51 -0
- package/dist/cjs/templates/formTemplates.js.map +1 -0
- package/dist/cjs/templates/index.js +30 -0
- package/dist/cjs/templates/index.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +210 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/orgChartTemplate.js +63 -0
- package/dist/cjs/templates/orgChartTemplate.js.map +1 -0
- package/dist/cjs/templates/recordTemplates.js +181 -0
- package/dist/cjs/templates/recordTemplates.js.map +1 -0
- package/dist/esm/blueprint.d.ts +3 -0
- package/dist/esm/blueprint.d.ts.map +1 -0
- package/dist/esm/blueprint.js +17 -0
- package/dist/esm/blueprint.js.map +1 -0
- package/dist/esm/hrApplication.d.ts +10 -0
- package/dist/esm/hrApplication.d.ts.map +1 -0
- package/dist/esm/hrApplication.js +44 -0
- package/dist/esm/hrApplication.js.map +1 -0
- package/dist/esm/hrParts.d.ts +15 -0
- package/dist/esm/hrParts.d.ts.map +1 -0
- package/dist/esm/hrParts.js +114 -0
- package/dist/esm/hrParts.js.map +1 -0
- package/dist/esm/hrQueries.d.ts +38 -0
- package/dist/esm/hrQueries.d.ts.map +1 -0
- package/dist/esm/hrQueries.js +59 -0
- package/dist/esm/hrQueries.js.map +1 -0
- package/dist/esm/hrScreenSet.d.ts +7 -0
- package/dist/esm/hrScreenSet.d.ts.map +1 -0
- package/dist/esm/hrScreenSet.js +59 -0
- package/dist/esm/hrScreenSet.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/manifest.d.ts +3 -0
- package/dist/esm/manifest.d.ts.map +1 -0
- package/dist/esm/manifest.js +63 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/navigation.d.ts +5 -0
- package/dist/esm/navigation.d.ts.map +1 -0
- package/dist/esm/navigation.js +131 -0
- package/dist/esm/navigation.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageName.d.ts +2 -0
- package/dist/esm/packageName.d.ts.map +1 -0
- package/dist/esm/packageName.js +6 -0
- package/dist/esm/packageName.js.map +1 -0
- package/dist/esm/screens/index.d.ts +3 -0
- package/dist/esm/screens/index.d.ts.map +1 -0
- package/dist/esm/screens/index.js +20 -0
- package/dist/esm/screens/index.js.map +1 -0
- package/dist/esm/templateProvenance.d.ts +3 -0
- package/dist/esm/templateProvenance.d.ts.map +1 -0
- package/dist/esm/templateProvenance.js +22 -0
- package/dist/esm/templateProvenance.js.map +1 -0
- package/dist/esm/templates/formTemplates.d.ts +3 -0
- package/dist/esm/templates/formTemplates.d.ts.map +1 -0
- package/dist/esm/templates/formTemplates.js +49 -0
- package/dist/esm/templates/formTemplates.js.map +1 -0
- package/dist/esm/templates/index.d.ts +7 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +19 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +6 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +205 -0
- package/dist/esm/templates/listTemplates.js.map +1 -0
- package/dist/esm/templates/orgChartTemplate.d.ts +3 -0
- package/dist/esm/templates/orgChartTemplate.d.ts.map +1 -0
- package/dist/esm/templates/orgChartTemplate.js +61 -0
- package/dist/esm/templates/orgChartTemplate.js.map +1 -0
- package/dist/esm/templates/recordTemplates.d.ts +4 -0
- package/dist/esm/templates/recordTemplates.d.ts.map +1 -0
- package/dist/esm/templates/recordTemplates.js +178 -0
- package/dist/esm/templates/recordTemplates.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/hrApplication.ts +28 -0
- package/hrParts.ts +52 -0
- package/hrQueries.ts +59 -0
- package/hrScreenSet.ts +24 -0
- package/index.ts +14 -0
- package/manifest.ts +41 -0
- package/navigation.ts +59 -0
- package/package.json +78 -4
- package/packageName.ts +5 -0
- package/sampleData/hr-nordic.json +1659 -0
- package/screens/index.ts +20 -0
- package/templateProvenance.ts +15 -0
- package/templates/formTemplates.ts +34 -0
- package/templates/index.ts +21 -0
- package/templates/listTemplates.ts +109 -0
- package/templates/orgChartTemplate.ts +27 -0
- package/templates/recordTemplates.ts +75 -0
- package/thumbnails/HrEmployeeDirectory.svg +29 -0
- package/thumbnails/HrEmployeePage.svg +18 -0
- package/thumbnails/HrOnboardingChecklist.svg +18 -0
- package/thumbnails/HrOnboardingList.svg +13 -0
- package/thumbnails/HrOrgChart.svg +20 -0
- package/thumbnails/HrQuickCreateEmployee.svg +12 -0
- package/thumbnails/HrRequestTimeOff.svg +12 -0
- package/thumbnails/HrTimeOffBalanceList.svg +13 -0
- package/thumbnails/HrTimeOffList.svg +13 -0
- package/thumbnails/hr.svg +14 -0
package/hrApplication.ts
ADDED
|
@@ -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 { hrNavigation, hrStructure } from './navigation';
|
|
8
|
+
import { hrScreens } from './screens';
|
|
9
|
+
import { hrDialogTemplates, hrScreenTemplates } from './templates';
|
|
10
|
+
|
|
11
|
+
/** The id of the sample-data pack a new application starts with. */
|
|
12
|
+
export const hrDefaultSampleDataId = 'hr-nordic';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The example application of the blueprint: the foundation's layouts, the HR People and Time Off templates and quick-create dialogs and its seven 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/Hr/hr.play`) declares in Screenplay: the document, the structure and the navigation are the three things an application is made of.
|
|
18
|
+
*/
|
|
19
|
+
export function hrApplication(sampleData: string = hrDefaultSampleDataId): ApplicationDocument {
|
|
20
|
+
const profile: UiProfile = { ...previewProfile(undefined), name: 'HR People and Time Off', sampleData: { activePack: sampleData, mappings: [], bindings: [] } };
|
|
21
|
+
return { layouts: defaultLayouts, screenTemplates: hrScreenTemplates, dialogTemplates: hrDialogTemplates, screens: hrScreens, 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 hrComposition: CompositionOptions = { logo: hrNavigation.application.logo };
|
|
26
|
+
|
|
27
|
+
/** The structure and navigation the shell's regions show and the items' destinations resolve against. */
|
|
28
|
+
export const hrNavigationModel = () => ({ structure: new ApplicationStructureIndex(hrStructure), navigation: hrNavigation });
|
package/hrParts.ts
ADDED
|
@@ -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 { hrTemplateProvenance } 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 hrCategory = 'Business / HR';
|
|
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 hrMetadata = (name: string, type: 'Dashboard' | 'List' | 'Board' | 'Detail' | 'Form' | 'Dialog' | 'Workspace', scopes: TemplateScope[]): TemplateMetadata =>
|
|
20
|
+
({ ...hrTemplateProvenance, type, category: hrCategory, 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 HrScreenTemplate = ScreenTemplate;
|
|
52
|
+
export type HrDialogTemplate = DialogTemplate;
|
package/hrQueries.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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 HR 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 HrQuery = {
|
|
14
|
+
/** One row: the `locale` the figures and dates are formatted in. */
|
|
15
|
+
Settings: 'HrSettings',
|
|
16
|
+
RecordTabs: 'HrRecordTabs',
|
|
17
|
+
OrgNodes: 'OrgNodes',
|
|
18
|
+
FormErrors: 'HrFormErrors',
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
/** The HR entities a template is made for. */
|
|
22
|
+
export enum HrEntityKind {
|
|
23
|
+
Employee = 'Employee',
|
|
24
|
+
TimeOff = 'TimeOff',
|
|
25
|
+
Balance = 'Balance',
|
|
26
|
+
Onboarding = 'Onboarding',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The read model (and so the shape) the records of each entity are queried from. */
|
|
30
|
+
export const hrEntityPlural: Record<HrEntityKind, string> = {
|
|
31
|
+
[HrEntityKind.Employee]: 'Employees',
|
|
32
|
+
[HrEntityKind.TimeOff]: 'TimeOffRequests',
|
|
33
|
+
[HrEntityKind.Balance]: 'Balances',
|
|
34
|
+
[HrEntityKind.Onboarding]: 'Onboardings',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 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
|
|
39
|
+
* list, its saved views and column choices, the selection, the sections of the full and the quick form, and the record the page shows.
|
|
40
|
+
*/
|
|
41
|
+
export const hrQueriesOf = (entity: HrEntityKind) => ({
|
|
42
|
+
rows: hrEntityPlural[entity],
|
|
43
|
+
columns: `${entity}Columns`,
|
|
44
|
+
filterFields: `${entity}FilterFields`,
|
|
45
|
+
views: `${entity}Views`,
|
|
46
|
+
columnChoices: `${entity}ColumnChoices`,
|
|
47
|
+
selection: `${entity}Selection`,
|
|
48
|
+
sections: `${entity}Sections`,
|
|
49
|
+
quickSections: `${entity}QuickSections`,
|
|
50
|
+
record: `${entity}Record`,
|
|
51
|
+
summary: `${entity}Summary`,
|
|
52
|
+
documents: `${entity}Documents`,
|
|
53
|
+
activity: `${entity}Activity`,
|
|
54
|
+
tasks: `${entity}Tasks`,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/** The locale and currency of the data, bound onto every component that formats a figure or a date. */
|
|
58
|
+
export const localeOfData = { locale: fromQuery(HrQuery.Settings, '0.locale') };
|
|
59
|
+
export const currencyOfData = { ...localeOfData, currency: fromQuery(HrQuery.Settings, '0.currency') };
|
package/hrScreenSet.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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 (`hr.directory.record` is the `record` feature of `directory` in the `hr` module). */
|
|
7
|
+
export interface HrScreenDefinition 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 hrScreenDefinitions: HrScreenDefinition[] = [
|
|
17
|
+
{ name: 'hr.directory', title: 'Directory', template: 'HrEmployeeDirectory', order: 0, description: 'Everyone in the company as cards with their photo, title, department and contact.' },
|
|
18
|
+
{ name: 'hr.directory.record', title: 'Employee', template: 'HrEmployeePage', parent: 'hr.directory', description: 'One employee: personal and job information, documents and time-off balance.' },
|
|
19
|
+
{ name: 'hr.org', title: 'Org chart', template: 'HrOrgChart', order: 1, description: 'Who reports to whom, as a tree.' },
|
|
20
|
+
{ name: 'hr.timeoff', title: 'Time off', template: 'HrTimeOffList', order: 2, description: 'Time-off requests to approve, with who is away and for how long.' },
|
|
21
|
+
{ name: 'hr.timeoff.balances', title: 'Balances', template: 'HrTimeOffBalanceList', parent: 'hr.timeoff', description: 'What each employee has taken and has left.' },
|
|
22
|
+
{ name: 'hr.onboarding', title: 'Onboarding', template: 'HrOnboardingList', order: 3, description: 'New hires and how far along their onboarding is.' },
|
|
23
|
+
{ name: 'hr.onboarding.record', title: 'Onboarding checklist', template: 'HrOnboardingChecklist', parent: 'hr.onboarding', description: 'One new hire\'s checklist: sections of tasks, each with an owner and a due date.' },
|
|
24
|
+
];
|
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 './hrQueries';
|
|
7
|
+
export * from './hrParts';
|
|
8
|
+
export * from './hrScreenSet';
|
|
9
|
+
export * from './templates';
|
|
10
|
+
export * from './screens';
|
|
11
|
+
export * from './navigation';
|
|
12
|
+
export * from './manifest';
|
|
13
|
+
export * from './blueprint';
|
|
14
|
+
export * from './hrApplication';
|
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 { hrBlueprintName } from './packageName';
|
|
6
|
+
import { hrScreenDefinitions } from './hrScreenSet';
|
|
7
|
+
import { hrDialogTemplates, hrScreenTemplates } from './templates';
|
|
8
|
+
|
|
9
|
+
const description = 'People, the org chart, time off and onboarding for an HR team: a directory of cards, employee pages, an org tree, time-off requests and balances, and onboarding checklists.';
|
|
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 hrBlueprintManifest: ScenePackage = {
|
|
17
|
+
name: hrBlueprintName,
|
|
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: hrScreenTemplates.map(template => template.name),
|
|
24
|
+
dialogTemplates: hrDialogTemplates.map(template => template.name),
|
|
25
|
+
themes: [],
|
|
26
|
+
displayName: 'HR People and Time Off',
|
|
27
|
+
description,
|
|
28
|
+
module: '@cratis/scene.blueprint.hr',
|
|
29
|
+
license: 'MIT',
|
|
30
|
+
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
|
|
31
|
+
sampleData: [{ id: 'hr-nordic', title: 'HR · Nordic', locale: 'nb-NO', path: 'sampleData/hr-nordic.json' }],
|
|
32
|
+
blueprint: {
|
|
33
|
+
domain: 'hr',
|
|
34
|
+
description,
|
|
35
|
+
thumbnail: 'thumbnails/hr.svg',
|
|
36
|
+
screenSet: hrScreenDefinitions.map(({ name, title, description: screenDescription, template, parent, order }) => ({
|
|
37
|
+
name, title, description: screenDescription, template, ...(parent === undefined ? {} : { parent }), ...(order === undefined ? {} : { order }),
|
|
38
|
+
})),
|
|
39
|
+
defaultSampleData: 'hr-nordic',
|
|
40
|
+
},
|
|
41
|
+
};
|
package/navigation.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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 { hrScreenDefinitions } from './hrScreenSet';
|
|
6
|
+
|
|
7
|
+
/** The module the blueprint's screens live in, and so the first segment of every screen's qualified name. */
|
|
8
|
+
export const hrModule = 'hr';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The application structure the screen set implies: one module, `hr`, a feature for each screen and the sub-features beneath it (`hr.directory.record` is the
|
|
12
|
+
* `record` feature of `directory`). 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 hrStructure: ApplicationStructure = (() => {
|
|
15
|
+
interface Node { id: string; name: string; features: Node[]; slices: never[] }
|
|
16
|
+
const root: Node = { id: hrModule, name: 'HR', features: [], slices: [] };
|
|
17
|
+
for (const screen of hrScreenDefinitions) {
|
|
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 four places an HR team goes: Directory, Org chart, Time off (with its requests and its balances beneath it) and Onboarding.
|
|
35
|
+
*/
|
|
36
|
+
export const hrNavigation: NavigationModel = {
|
|
37
|
+
application: {
|
|
38
|
+
logo: { image: '', title: 'HR' },
|
|
39
|
+
regions: [{ region: NavigationRegionKind.Topbar, items: [{ id: 'hr', title: 'HR', target: { module: hrModule } }] }],
|
|
40
|
+
},
|
|
41
|
+
modules: [{
|
|
42
|
+
module: hrModule,
|
|
43
|
+
regions: [{
|
|
44
|
+
region: NavigationRegionKind.Sidebar,
|
|
45
|
+
mode: NavigationRegionMode.Override,
|
|
46
|
+
items: [
|
|
47
|
+
{ id: 'directory', title: 'Directory', target: { module: hrModule, feature: 'directory' } },
|
|
48
|
+
{ id: 'org', title: 'Org chart', target: { module: hrModule, feature: 'org' } },
|
|
49
|
+
{
|
|
50
|
+
id: 'timeoff', title: 'Time off', target: { module: hrModule, feature: 'timeoff' }, children: [
|
|
51
|
+
{ id: 'requests', title: 'Requests', target: { module: hrModule, feature: 'timeoff' } },
|
|
52
|
+
{ id: 'balances', title: 'Balances', target: { module: hrModule, feature: 'timeoff.balances' } },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{ id: 'onboarding', title: 'Onboarding', target: { module: hrModule, feature: 'onboarding' } },
|
|
56
|
+
],
|
|
57
|
+
}],
|
|
58
|
+
}],
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"name": "@cratis/scene.blueprint.hr",
|
|
3
|
+
"version": "4.53.1",
|
|
4
|
+
"description": "People, the org chart, time off and onboarding for an HR team.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cratis",
|
|
7
|
+
"scene",
|
|
8
|
+
"react",
|
|
9
|
+
"ui",
|
|
10
|
+
"blueprint",
|
|
11
|
+
"hr"
|
|
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 hrBlueprintName = 'Cratis.Blueprint.Hr';
|