@openmrs/esm-styleguide 10.0.1-pre.5498 → 10.0.1-pre.5501
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/.turbo/turbo-build.log +1 -1
- package/dist/workspaces2/active-workspace-window.component.d.ts.map +1 -1
- package/dist/workspaces2/active-workspace-window.component.js +1 -0
- package/dist/workspaces2/workspace2.component.d.ts +5 -0
- package/dist/workspaces2/workspace2.component.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/workspaces2/active-workspace-window.component.tsx +1 -0
- package/src/workspaces2/active-workspace-window.test.tsx +38 -1
- package/src/workspaces2/workspace2.component.tsx +5 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[0] Successfully compiled: 123 files, copied 168 files with swc (
|
|
1
|
+
[0] Successfully compiled: 123 files, copied 168 files with swc (224.95ms)
|
|
2
2
|
[0] swc --strip-leading-paths --copy-files src -d dist && svgo -rf dist --quiet exited with code 0
|
|
3
3
|
[1] tsc --project tsconfig.build.json exited with code 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAA8D,MAAM,yBAAyB,CAAC;AAOxH,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4CzD,CAAC;
|
|
1
|
+
{"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAA8D,MAAM,yBAAyB,CAAC;AAOxH,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4CzD,CAAC;AA4IF,eAAe,qBAAqB,CAAC"}
|
|
@@ -112,6 +112,7 @@ const ActiveWorkspace = ({ lifeCycle, openedWorkspace, openedWindow, isRootWorks
|
|
|
112
112
|
workspaceProps: openedWorkspace.props,
|
|
113
113
|
windowProps: openedWindow.props,
|
|
114
114
|
groupProps: openedGroup && openedGroup.props ? openedGroup.props : null,
|
|
115
|
+
workspaceMeta: workspace2Store.getState().registeredWorkspacesByName[openedWorkspace.workspaceName]?.meta ?? {},
|
|
115
116
|
isRootWorkspace,
|
|
116
117
|
isLeafWorkspace,
|
|
117
118
|
windowName: openedWindow.windowName,
|
|
@@ -27,6 +27,11 @@ export interface Workspace2DefinitionProps<WorkspaceProps extends object = objec
|
|
|
27
27
|
workspaceProps: WorkspaceProps | null;
|
|
28
28
|
windowProps: WindowProps | null;
|
|
29
29
|
groupProps: GroupProps | null;
|
|
30
|
+
/**
|
|
31
|
+
* The workspace's `meta` from its registration (the `meta` field of its `workspaces2` entry in
|
|
32
|
+
* `routes.json`).
|
|
33
|
+
*/
|
|
34
|
+
workspaceMeta?: Readonly<Record<string, unknown>>;
|
|
30
35
|
workspaceName: string;
|
|
31
36
|
windowName: string;
|
|
32
37
|
isRootWorkspace: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,C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
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "10.0.1-pre.
|
|
3
|
+
"version": "10.0.1-pre.5501",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"module": "dist/internal.js",
|
|
@@ -78,18 +78,18 @@
|
|
|
78
78
|
"react-aria-components": "^1.7.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@openmrs/esm-api": "^10.0.1-pre.
|
|
82
|
-
"@openmrs/esm-config": "^10.0.1-pre.
|
|
83
|
-
"@openmrs/esm-emr-api": "^10.0.1-pre.
|
|
84
|
-
"@openmrs/esm-error-handling": "^10.0.1-pre.
|
|
85
|
-
"@openmrs/esm-extensions": "^10.0.1-pre.
|
|
86
|
-
"@openmrs/esm-globals": "^10.0.1-pre.
|
|
87
|
-
"@openmrs/esm-navigation": "^10.0.1-pre.
|
|
88
|
-
"@openmrs/esm-react-utils": "^10.0.1-pre.
|
|
89
|
-
"@openmrs/esm-routes": "^10.0.1-pre.
|
|
90
|
-
"@openmrs/esm-state": "^10.0.1-pre.
|
|
91
|
-
"@openmrs/esm-translations": "^10.0.1-pre.
|
|
92
|
-
"@openmrs/esm-utils": "^10.0.1-pre.
|
|
81
|
+
"@openmrs/esm-api": "^10.0.1-pre.5501",
|
|
82
|
+
"@openmrs/esm-config": "^10.0.1-pre.5501",
|
|
83
|
+
"@openmrs/esm-emr-api": "^10.0.1-pre.5501",
|
|
84
|
+
"@openmrs/esm-error-handling": "^10.0.1-pre.5501",
|
|
85
|
+
"@openmrs/esm-extensions": "^10.0.1-pre.5501",
|
|
86
|
+
"@openmrs/esm-globals": "^10.0.1-pre.5501",
|
|
87
|
+
"@openmrs/esm-navigation": "^10.0.1-pre.5501",
|
|
88
|
+
"@openmrs/esm-react-utils": "^10.0.1-pre.5501",
|
|
89
|
+
"@openmrs/esm-routes": "^10.0.1-pre.5501",
|
|
90
|
+
"@openmrs/esm-state": "^10.0.1-pre.5501",
|
|
91
|
+
"@openmrs/esm-translations": "^10.0.1-pre.5501",
|
|
92
|
+
"@openmrs/esm-utils": "^10.0.1-pre.5501",
|
|
93
93
|
"dayjs": "1.x",
|
|
94
94
|
"i18next": "25.x",
|
|
95
95
|
"react": "18.x",
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
"swr": "2.x"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@openmrs/esm-api": "10.0.1-pre.
|
|
103
|
-
"@openmrs/esm-config": "10.0.1-pre.
|
|
104
|
-
"@openmrs/esm-emr-api": "10.0.1-pre.
|
|
105
|
-
"@openmrs/esm-error-handling": "10.0.1-pre.
|
|
106
|
-
"@openmrs/esm-extensions": "10.0.1-pre.
|
|
107
|
-
"@openmrs/esm-globals": "10.0.1-pre.
|
|
108
|
-
"@openmrs/esm-navigation": "10.0.1-pre.
|
|
109
|
-
"@openmrs/esm-react-utils": "10.0.1-pre.
|
|
110
|
-
"@openmrs/esm-routes": "10.0.1-pre.
|
|
111
|
-
"@openmrs/esm-state": "10.0.1-pre.
|
|
112
|
-
"@openmrs/esm-translations": "10.0.1-pre.
|
|
113
|
-
"@openmrs/esm-utils": "10.0.1-pre.
|
|
102
|
+
"@openmrs/esm-api": "10.0.1-pre.5501",
|
|
103
|
+
"@openmrs/esm-config": "10.0.1-pre.5501",
|
|
104
|
+
"@openmrs/esm-emr-api": "10.0.1-pre.5501",
|
|
105
|
+
"@openmrs/esm-error-handling": "10.0.1-pre.5501",
|
|
106
|
+
"@openmrs/esm-extensions": "10.0.1-pre.5501",
|
|
107
|
+
"@openmrs/esm-globals": "10.0.1-pre.5501",
|
|
108
|
+
"@openmrs/esm-navigation": "10.0.1-pre.5501",
|
|
109
|
+
"@openmrs/esm-react-utils": "10.0.1-pre.5501",
|
|
110
|
+
"@openmrs/esm-routes": "10.0.1-pre.5501",
|
|
111
|
+
"@openmrs/esm-state": "10.0.1-pre.5501",
|
|
112
|
+
"@openmrs/esm-translations": "10.0.1-pre.5501",
|
|
113
|
+
"@openmrs/esm-utils": "10.0.1-pre.5501",
|
|
114
114
|
"@swc/cli": "0.8.1",
|
|
115
115
|
"@swc/core": "1.15.21",
|
|
116
116
|
"@types/geopattern": "^1.2.9",
|
|
@@ -150,6 +150,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
|
150
150
|
workspaceProps: openedWorkspace.props,
|
|
151
151
|
windowProps: openedWindow.props,
|
|
152
152
|
groupProps: openedGroup && openedGroup.props ? openedGroup.props : null,
|
|
153
|
+
workspaceMeta: workspace2Store.getState().registeredWorkspacesByName[openedWorkspace.workspaceName]?.meta ?? {},
|
|
153
154
|
isRootWorkspace,
|
|
154
155
|
isLeafWorkspace,
|
|
155
156
|
windowName: openedWindow.windowName,
|
|
@@ -9,8 +9,15 @@ vi.mock('@openmrs/esm-routes', () => ({
|
|
|
9
9
|
loadLifeCycles: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
+
// Captures the props single-spa-react's <Parcel> is handed, so the passthrough of workspace props
|
|
13
|
+
// (workspaceMeta included) can be asserted. Hoisted so the mock factory can reference it.
|
|
14
|
+
const { parcelProps } = vi.hoisted(() => ({ parcelProps: [] as Array<Record<string, any>> }));
|
|
15
|
+
|
|
12
16
|
vi.mock('single-spa-react/parcel', () => ({
|
|
13
|
-
default: (
|
|
17
|
+
default: (props: { config: { name: string } }) => {
|
|
18
|
+
parcelProps.push(props);
|
|
19
|
+
return <div data-testid="parcel">{props.config.name}</div>;
|
|
20
|
+
},
|
|
14
21
|
}));
|
|
15
22
|
|
|
16
23
|
const mockLoadLifeCycles = vi.mocked(loadLifeCycles);
|
|
@@ -37,6 +44,7 @@ describe('ActiveWorkspaceWindow', () => {
|
|
|
37
44
|
component: 'form',
|
|
38
45
|
window: 'test-window',
|
|
39
46
|
moduleName: 'test-module',
|
|
47
|
+
meta: { columns: 3, title: 'Form' },
|
|
40
48
|
},
|
|
41
49
|
'admit-workspace': {
|
|
42
50
|
name: 'admit-workspace',
|
|
@@ -55,6 +63,7 @@ describe('ActiveWorkspaceWindow', () => {
|
|
|
55
63
|
|
|
56
64
|
afterEach(() => {
|
|
57
65
|
vi.clearAllMocks();
|
|
66
|
+
parcelProps.length = 0;
|
|
58
67
|
});
|
|
59
68
|
|
|
60
69
|
it('does not render a replaced workspace with the previous workspace lifecycle at the same stack position', async () => {
|
|
@@ -96,4 +105,32 @@ describe('ActiveWorkspaceWindow', () => {
|
|
|
96
105
|
});
|
|
97
106
|
expect(screen.getByTestId('parcel')).toHaveTextContent('admit-lifecycle');
|
|
98
107
|
});
|
|
108
|
+
|
|
109
|
+
it("passes the workspace's registered meta to the parcel via workspaceMeta", async () => {
|
|
110
|
+
mockLoadLifeCycles.mockResolvedValue({ name: 'form-lifecycle' } as never);
|
|
111
|
+
|
|
112
|
+
const formWorkspace = makeOpenedWorkspace('form-workspace', 'uuid-form');
|
|
113
|
+
render(<ActiveWorkspaceWindow openedWindow={makeOpenedWindow([formWorkspace])} showActionMenu={false} />);
|
|
114
|
+
|
|
115
|
+
await act(async () => {
|
|
116
|
+
await Promise.resolve();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const props = parcelProps.find((p) => p.config.name === 'form-lifecycle');
|
|
120
|
+
expect(props?.workspaceMeta).toEqual({ columns: 3, title: 'Form' });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('passes an empty workspaceMeta when the workspace declares no meta', async () => {
|
|
124
|
+
mockLoadLifeCycles.mockResolvedValue({ name: 'admit-lifecycle' } as never);
|
|
125
|
+
|
|
126
|
+
const admitWorkspace = makeOpenedWorkspace('admit-workspace', 'uuid-admit');
|
|
127
|
+
render(<ActiveWorkspaceWindow openedWindow={makeOpenedWindow([admitWorkspace])} showActionMenu={false} />);
|
|
128
|
+
|
|
129
|
+
await act(async () => {
|
|
130
|
+
await Promise.resolve();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const props = parcelProps.find((p) => p.config.name === 'admit-lifecycle');
|
|
134
|
+
expect(props?.workspaceMeta).toEqual({});
|
|
135
|
+
});
|
|
99
136
|
});
|
|
@@ -41,6 +41,11 @@ export interface Workspace2DefinitionProps<
|
|
|
41
41
|
workspaceProps: WorkspaceProps | null;
|
|
42
42
|
windowProps: WindowProps | null;
|
|
43
43
|
groupProps: GroupProps | null;
|
|
44
|
+
/**
|
|
45
|
+
* The workspace's `meta` from its registration (the `meta` field of its `workspaces2` entry in
|
|
46
|
+
* `routes.json`).
|
|
47
|
+
*/
|
|
48
|
+
workspaceMeta?: Readonly<Record<string, unknown>>;
|
|
44
49
|
workspaceName: string;
|
|
45
50
|
windowName: string;
|
|
46
51
|
isRootWorkspace: boolean;
|