@openmrs/esm-framework 3.1.15-pre.757 → 3.1.15-pre.759
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/dist/openmrs-esm-framework.js +1 -1
- package/dist/openmrs-esm-framework.js.LICENSE.txt +0 -2
- package/dist/openmrs-esm-framework.js.map +1 -1
- package/docs/API.md +343 -113
- package/docs/interfaces/ConfigStore.md +34 -0
- package/docs/interfaces/ConnectedExtension.md +106 -3
- package/docs/interfaces/ExtensionDetails.md +81 -0
- package/docs/interfaces/ExtensionInfo.md +8 -8
- package/docs/interfaces/ExtensionInstance.md +1 -1
- package/docs/interfaces/ExtensionProps.md +2 -2
- package/docs/interfaces/ExtensionRegistration.md +9 -7
- package/docs/interfaces/ExtensionSlotConfigObject.md +3 -9
- package/docs/interfaces/ExtensionSlotConfigsStore.md +32 -0
- package/docs/interfaces/ExtensionSlotInfo.md +9 -23
- package/docs/interfaces/ExtensionSlotInstance.md +51 -0
- package/docs/interfaces/ExtensionStore.md +17 -2
- package/docs/interfaces/ImplementerToolsConfigStore.md +19 -0
- package/mock.tsx +5 -13
- package/package.json +13 -13
- package/src/integration-tests/extension-config.test.tsx +10 -4
- package/docs/interfaces/AssignedExtension.md +0 -63
- package/docs/interfaces/ExtensionInternalStore.md +0 -34
- package/docs/interfaces/ExtensionSlotState.md +0 -30
package/mock.tsx
CHANGED
|
@@ -203,14 +203,7 @@ export const ExtensionSlot = ({ children }) => <>{children}</>;
|
|
|
203
203
|
|
|
204
204
|
export const Extension = jest.fn().mockImplementation((props: any) => <slot />);
|
|
205
205
|
|
|
206
|
-
export const
|
|
207
|
-
getGlobalStore("extensions", { slots: {} });
|
|
208
|
-
|
|
209
|
-
export const getExtensionInternalStore = () =>
|
|
210
|
-
getGlobalStore("extensions-internal", {
|
|
211
|
-
slots: {},
|
|
212
|
-
extensions: {},
|
|
213
|
-
});
|
|
206
|
+
export const extensionStore = getGlobalStore("extensions", { slots: {} });
|
|
214
207
|
|
|
215
208
|
/* esm-react-utils */
|
|
216
209
|
|
|
@@ -241,11 +234,10 @@ export const createUseStore = (store: Store<any>) => (actions) => {
|
|
|
241
234
|
return { ...state, ...actions };
|
|
242
235
|
};
|
|
243
236
|
|
|
244
|
-
export const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
export const useExtensionStore = createUseStore(getExtensionStore());
|
|
237
|
+
export const useExtensionStore = (actions) => {
|
|
238
|
+
const state = extensionStore.getState();
|
|
239
|
+
return { ...state, ...actions };
|
|
240
|
+
};
|
|
249
241
|
|
|
250
242
|
export const useStore = (store: Store<any>, actions) => {
|
|
251
243
|
const state = store.getState();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-framework",
|
|
3
|
-
"version": "3.1.15-pre.
|
|
3
|
+
"version": "3.1.15-pre.759",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"browser": "dist/openmrs-esm-framework.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@openmrs/esm-api": "^3.1.15-pre.
|
|
39
|
-
"@openmrs/esm-breadcrumbs": "^3.1.15-pre.
|
|
40
|
-
"@openmrs/esm-config": "^3.1.15-pre.
|
|
41
|
-
"@openmrs/esm-error-handling": "^3.1.15-pre.
|
|
42
|
-
"@openmrs/esm-extensions": "^3.1.15-pre.
|
|
43
|
-
"@openmrs/esm-globals": "^3.1.15-pre.
|
|
44
|
-
"@openmrs/esm-offline": "^3.1.15-pre.
|
|
45
|
-
"@openmrs/esm-react-utils": "^3.1.15-pre.
|
|
46
|
-
"@openmrs/esm-state": "^3.1.15-pre.
|
|
47
|
-
"@openmrs/esm-styleguide": "^3.1.15-pre.
|
|
48
|
-
"@openmrs/esm-utils": "^3.1.15-pre.
|
|
38
|
+
"@openmrs/esm-api": "^3.1.15-pre.759",
|
|
39
|
+
"@openmrs/esm-breadcrumbs": "^3.1.15-pre.759",
|
|
40
|
+
"@openmrs/esm-config": "^3.1.15-pre.759",
|
|
41
|
+
"@openmrs/esm-error-handling": "^3.1.15-pre.759",
|
|
42
|
+
"@openmrs/esm-extensions": "^3.1.15-pre.759",
|
|
43
|
+
"@openmrs/esm-globals": "^3.1.15-pre.759",
|
|
44
|
+
"@openmrs/esm-offline": "^3.1.15-pre.759",
|
|
45
|
+
"@openmrs/esm-react-utils": "^3.1.15-pre.759",
|
|
46
|
+
"@openmrs/esm-state": "^3.1.15-pre.759",
|
|
47
|
+
"@openmrs/esm-styleguide": "^3.1.15-pre.759",
|
|
48
|
+
"@openmrs/esm-utils": "^3.1.15-pre.759",
|
|
49
49
|
"dayjs": "^1.10.7"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e1e595a6bffe08babf45116b5c0ebbd7950ee871"
|
|
52
52
|
}
|
|
@@ -2,9 +2,12 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
attach,
|
|
4
4
|
registerExtension,
|
|
5
|
-
|
|
5
|
+
registerExtensionSlot,
|
|
6
|
+
updateExtensionStore,
|
|
7
|
+
ExtensionStore,
|
|
6
8
|
} from "../../../esm-extensions";
|
|
7
9
|
import {
|
|
10
|
+
Extension,
|
|
8
11
|
ExtensionSlot,
|
|
9
12
|
getSyncLifecycle,
|
|
10
13
|
openmrsComponentDecorator,
|
|
@@ -15,7 +18,7 @@ import { render, screen, waitFor } from "@testing-library/react";
|
|
|
15
18
|
|
|
16
19
|
describe("Interaction between configuration and extension systems", () => {
|
|
17
20
|
beforeEach(() => {
|
|
18
|
-
|
|
21
|
+
updateExtensionStore(() => ({ slots: {}, extensions: {} }));
|
|
19
22
|
});
|
|
20
23
|
|
|
21
24
|
test("Config should add, order, and remove extensions within slots", async () => {
|
|
@@ -23,6 +26,7 @@ describe("Interaction between configuration and extension systems", () => {
|
|
|
23
26
|
registerSimpleExtension("Wilma", "esm-flintstone");
|
|
24
27
|
registerSimpleExtension("Barney", "esm-rubble");
|
|
25
28
|
registerSimpleExtension("Betty", "esm-rubble");
|
|
29
|
+
registerExtensionSlot("esm-flintstone", "A slot");
|
|
26
30
|
attach("A slot", "Fred");
|
|
27
31
|
attach("A slot", "Wilma");
|
|
28
32
|
defineConfigSchema("esm-flintstone", {});
|
|
@@ -54,6 +58,8 @@ describe("Interaction between configuration and extension systems", () => {
|
|
|
54
58
|
|
|
55
59
|
test("Extensions should recieve config from module and from 'configure' key", async () => {
|
|
56
60
|
registerSimpleExtension("Wilma", "esm-flintstone", true);
|
|
61
|
+
registerExtensionSlot("esm-flintstone", "Flintstone slot");
|
|
62
|
+
registerExtensionSlot("esm-flintstone", "Future slot");
|
|
57
63
|
defineConfigSchema("esm-flintstone", {
|
|
58
64
|
town: { _type: Type.String, _default: "Bedrock" },
|
|
59
65
|
});
|
|
@@ -99,6 +105,7 @@ describe("Interaction between configuration and extension systems", () => {
|
|
|
99
105
|
|
|
100
106
|
test("Should be possible to attach the same extension twice with different configurations", async () => {
|
|
101
107
|
registerSimpleExtension("pet", "esm-characters", true);
|
|
108
|
+
registerExtensionSlot("esm-flintstone", "Flintstone slot");
|
|
102
109
|
defineConfigSchema("esm-characters", {
|
|
103
110
|
name: { _type: Type.String, _default: "(no-name)" },
|
|
104
111
|
});
|
|
@@ -154,8 +161,7 @@ function registerSimpleExtension(
|
|
|
154
161
|
</div>
|
|
155
162
|
);
|
|
156
163
|
};
|
|
157
|
-
registerExtension({
|
|
158
|
-
name,
|
|
164
|
+
registerExtension(name, {
|
|
159
165
|
moduleName,
|
|
160
166
|
load: getSyncLifecycle(
|
|
161
167
|
takesConfig ? ConfigurableComponent : SimpleComponent,
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
[@openmrs/esm-framework](../API.md) / AssignedExtension
|
|
2
|
-
|
|
3
|
-
# Interface: AssignedExtension
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Properties
|
|
8
|
-
|
|
9
|
-
- [id](AssignedExtension.md#id)
|
|
10
|
-
- [meta](AssignedExtension.md#meta)
|
|
11
|
-
- [name](AssignedExtension.md#name)
|
|
12
|
-
- [offline](AssignedExtension.md#offline)
|
|
13
|
-
- [online](AssignedExtension.md#online)
|
|
14
|
-
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
### id
|
|
18
|
-
|
|
19
|
-
• **id**: `string`
|
|
20
|
-
|
|
21
|
-
#### Defined in
|
|
22
|
-
|
|
23
|
-
[packages/framework/esm-extensions/src/store.ts:71](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L71)
|
|
24
|
-
|
|
25
|
-
___
|
|
26
|
-
|
|
27
|
-
### meta
|
|
28
|
-
|
|
29
|
-
• **meta**: [`ExtensionMeta`](ExtensionMeta.md)
|
|
30
|
-
|
|
31
|
-
#### Defined in
|
|
32
|
-
|
|
33
|
-
[packages/framework/esm-extensions/src/store.ts:73](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L73)
|
|
34
|
-
|
|
35
|
-
___
|
|
36
|
-
|
|
37
|
-
### name
|
|
38
|
-
|
|
39
|
-
• **name**: `string`
|
|
40
|
-
|
|
41
|
-
#### Defined in
|
|
42
|
-
|
|
43
|
-
[packages/framework/esm-extensions/src/store.ts:72](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L72)
|
|
44
|
-
|
|
45
|
-
___
|
|
46
|
-
|
|
47
|
-
### offline
|
|
48
|
-
|
|
49
|
-
• `Optional` **offline**: `boolean` \| `object`
|
|
50
|
-
|
|
51
|
-
#### Defined in
|
|
52
|
-
|
|
53
|
-
[packages/framework/esm-extensions/src/store.ts:75](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L75)
|
|
54
|
-
|
|
55
|
-
___
|
|
56
|
-
|
|
57
|
-
### online
|
|
58
|
-
|
|
59
|
-
• `Optional` **online**: `boolean` \| `object`
|
|
60
|
-
|
|
61
|
-
#### Defined in
|
|
62
|
-
|
|
63
|
-
[packages/framework/esm-extensions/src/store.ts:74](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L74)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
[@openmrs/esm-framework](../API.md) / ExtensionInternalStore
|
|
2
|
-
|
|
3
|
-
# Interface: ExtensionInternalStore
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Properties
|
|
8
|
-
|
|
9
|
-
- [extensions](ExtensionInternalStore.md#extensions)
|
|
10
|
-
- [slots](ExtensionInternalStore.md#slots)
|
|
11
|
-
|
|
12
|
-
## Properties
|
|
13
|
-
|
|
14
|
-
### extensions
|
|
15
|
-
|
|
16
|
-
• **extensions**: `Record`<`string`, [`ExtensionInfo`](ExtensionInfo.md)\>
|
|
17
|
-
|
|
18
|
-
Extensions indexed by name
|
|
19
|
-
|
|
20
|
-
#### Defined in
|
|
21
|
-
|
|
22
|
-
[packages/framework/esm-extensions/src/store.ts:39](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L39)
|
|
23
|
-
|
|
24
|
-
___
|
|
25
|
-
|
|
26
|
-
### slots
|
|
27
|
-
|
|
28
|
-
• **slots**: `Record`<`string`, [`ExtensionSlotInfo`](ExtensionSlotInfo.md)\>
|
|
29
|
-
|
|
30
|
-
Slots indexed by name
|
|
31
|
-
|
|
32
|
-
#### Defined in
|
|
33
|
-
|
|
34
|
-
[packages/framework/esm-extensions/src/store.ts:37](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L37)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
[@openmrs/esm-framework](../API.md) / ExtensionSlotState
|
|
2
|
-
|
|
3
|
-
# Interface: ExtensionSlotState
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Properties
|
|
8
|
-
|
|
9
|
-
- [assignedExtensions](ExtensionSlotState.md#assignedextensions)
|
|
10
|
-
- [moduleName](ExtensionSlotState.md#modulename)
|
|
11
|
-
|
|
12
|
-
## Properties
|
|
13
|
-
|
|
14
|
-
### assignedExtensions
|
|
15
|
-
|
|
16
|
-
• **assignedExtensions**: [`AssignedExtension`](AssignedExtension.md)[]
|
|
17
|
-
|
|
18
|
-
#### Defined in
|
|
19
|
-
|
|
20
|
-
[packages/framework/esm-extensions/src/store.ts:67](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L67)
|
|
21
|
-
|
|
22
|
-
___
|
|
23
|
-
|
|
24
|
-
### moduleName
|
|
25
|
-
|
|
26
|
-
• **moduleName**: `string`
|
|
27
|
-
|
|
28
|
-
#### Defined in
|
|
29
|
-
|
|
30
|
-
[packages/framework/esm-extensions/src/store.ts:66](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-extensions/src/store.ts#L66)
|