@openmrs/esm-implementer-tools-app 10.0.1-pre.5263 → 10.0.1-pre.5299
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 +3 -3
- package/dist/2920.js +1 -1
- package/dist/2920.js.map +1 -1
- package/dist/5117.js +1 -1
- package/dist/5117.js.map +1 -1
- package/dist/8088.js +1 -1
- package/dist/8088.js.map +1 -1
- package/dist/{7889.js → 9893.js} +1 -1
- package/dist/9893.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/openmrs-esm-implementer-tools-app.js +2 -2
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +38 -38
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/configuration/configuration.component.tsx +14 -2
- package/src/configuration/configuration.test.tsx +23 -1
- package/src/configuration/interactive-editor/extension-slots-config-tree.tsx +5 -3
- package/src/configuration/interactive-editor/value-editors/extension-slot-remove.tsx +2 -2
- package/src/ui-editor/ui-editor.test.tsx +76 -27
- package/src/ui-editor/ui-editor.tsx +26 -27
- package/translations/en.json +2 -0
- package/dist/7889.js.map +0 -1
|
@@ -5,7 +5,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import { Button } from '@carbon/react';
|
|
6
6
|
import {
|
|
7
7
|
CloseIcon,
|
|
8
|
-
type
|
|
8
|
+
type ExtensionRendering,
|
|
9
|
+
type ExtensionRenderingsStore,
|
|
10
|
+
getExtensionRenderingsStore,
|
|
9
11
|
getExtensionInternalStore,
|
|
10
12
|
useStore,
|
|
11
13
|
useStoreWithActions,
|
|
@@ -31,31 +33,30 @@ export interface ExtensionOverlayTarget {
|
|
|
31
33
|
extensionName: string;
|
|
32
34
|
slotModuleName: string;
|
|
33
35
|
slotName: string;
|
|
34
|
-
|
|
36
|
+
extensionRendering: ExtensionRendering;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `Object.entries`) yields array indices as the module name and instance property names as the slot
|
|
41
|
-
* name, so the generated selectors never match a real extension DOM node.
|
|
40
|
+
* Turns the rendering store's records into overlay targets, each naming a slot and extension to look
|
|
41
|
+
* for in the DOM. Not every rendering has a matching node.
|
|
42
42
|
*/
|
|
43
43
|
export function getExtensionOverlayTargets(
|
|
44
|
-
|
|
44
|
+
renderings: ExtensionRenderingsStore['renderings'] | undefined,
|
|
45
45
|
): Array<ExtensionOverlayTarget> {
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})),
|
|
53
|
-
);
|
|
46
|
+
return Array.from(renderings?.values() ?? [], (extensionRendering) => ({
|
|
47
|
+
extensionName: extensionRendering.extensionName,
|
|
48
|
+
slotModuleName: extensionRendering.slotModuleName,
|
|
49
|
+
slotName: extensionRendering.slotName,
|
|
50
|
+
extensionRendering,
|
|
51
|
+
}));
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
export default function UiEditor() {
|
|
57
55
|
const { t } = useTranslation();
|
|
58
56
|
const { slots, extensions } = useStore(getExtensionInternalStore());
|
|
57
|
+
// Depended on as a whole below: the rendering map is mutated in place, so only the state
|
|
58
|
+
// object around it changes identity when an extension mounts or unmounts.
|
|
59
|
+
const renderingsState = useStore(getExtensionRenderingsStore());
|
|
59
60
|
const { isOpen: areImplementerToolsOpen } = useStore(implementerToolsStore);
|
|
60
61
|
|
|
61
62
|
const getExtensionCount = (slotName: string, moduleName: string) => {
|
|
@@ -94,16 +95,14 @@ export default function UiEditor() {
|
|
|
94
95
|
.filter((x): x is NonNullable<typeof x> => Boolean(x));
|
|
95
96
|
}, [slots]);
|
|
96
97
|
|
|
97
|
-
const extensionElements = useMemo(
|
|
98
|
-
() =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
[extensions],
|
|
106
|
-
);
|
|
98
|
+
const extensionElements = useMemo(() => {
|
|
99
|
+
return getExtensionOverlayTargets(renderingsState.renderings).map((target) => ({
|
|
100
|
+
...target,
|
|
101
|
+
element: document.querySelector(
|
|
102
|
+
`*[data-extension-rendering-id="${CSS.escape(target.extensionRendering.renderingId)}"]`,
|
|
103
|
+
) as HTMLElement | null,
|
|
104
|
+
}));
|
|
105
|
+
}, [renderingsState]);
|
|
107
106
|
|
|
108
107
|
return (
|
|
109
108
|
<>
|
|
@@ -123,12 +122,12 @@ export default function UiEditor() {
|
|
|
123
122
|
),
|
|
124
123
|
)}
|
|
125
124
|
{extensionElements.map(
|
|
126
|
-
({ extensionName, slotModuleName, slotName,
|
|
125
|
+
({ extensionName, slotModuleName, slotName, extensionRendering, element }) =>
|
|
127
126
|
element && (
|
|
128
127
|
<ExtensionOverlay
|
|
129
128
|
domElement={element}
|
|
130
129
|
extensionName={extensionName}
|
|
131
|
-
key={
|
|
130
|
+
key={extensionRendering.renderingId}
|
|
132
131
|
slotModuleName={slotModuleName}
|
|
133
132
|
slotName={slotName}
|
|
134
133
|
/>
|
package/translations/en.json
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"checkImplementerToolsMessage": "Check the Backend Modules tab in the Implementer Tools for more details",
|
|
7
7
|
"clearConfig": "Clear local config",
|
|
8
8
|
"close": "Close",
|
|
9
|
+
"configDerivationFailed": "This configuration is out of date",
|
|
10
|
+
"configDerivationFailedSubtitle": "The configuration could not be rebuilt, so what is shown below is the last version that did build.",
|
|
9
11
|
"configuration": "Configuration",
|
|
10
12
|
"description": "Description",
|
|
11
13
|
"downloadConfig": "Download config",
|