@openmrs/esm-implementer-tools-app 5.3.3-pre.1237 → 5.3.3-pre.1247
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 +45 -45
- package/__mocks__/react-i18next.js +10 -15
- package/dist/426.js.map +1 -1
- package/dist/560.js +1 -1
- package/dist/560.js.map +1 -1
- package/dist/587.js.map +1 -1
- package/dist/727.js +1 -1
- package/dist/727.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +13 -13
- package/dist/routes.json +1 -1
- package/jest.config.js +7 -7
- package/package.json +3 -3
- package/src/backend-dependencies/backend-dependencies.component.tsx +19 -29
- package/src/backend-dependencies/backend-dependencies.styles.scss +2 -2
- package/src/backend-dependencies/openmrs-backend-dependencies.ts +22 -43
- package/src/backend-dependencies/useBackendDependencies.ts +5 -9
- package/src/config-edit-button/config-edit-button.component.tsx +5 -7
- package/src/configuration/configuration.component.tsx +30 -57
- package/src/configuration/configuration.styles.scss +4 -4
- package/src/configuration/configuration.test.tsx +92 -115
- package/src/configuration/interactive-editor/config-subtree.component.tsx +10 -18
- package/src/configuration/interactive-editor/config-tree-for-module.component.tsx +8 -17
- package/src/configuration/interactive-editor/config-tree.component.tsx +5 -9
- package/src/configuration/interactive-editor/description.component.tsx +12 -27
- package/src/configuration/interactive-editor/description.styles.scss +7 -7
- package/src/configuration/interactive-editor/display-value.scss +2 -2
- package/src/configuration/interactive-editor/display-value.tsx +18 -22
- package/src/configuration/interactive-editor/editable-value.component.tsx +19 -44
- package/src/configuration/interactive-editor/editable-value.styles.scss +2 -2
- package/src/configuration/interactive-editor/extension-configure-tree.tsx +7 -11
- package/src/configuration/interactive-editor/extension-slots-config-tree.tsx +24 -56
- package/src/configuration/interactive-editor/layout/subtree.component.tsx +8 -31
- package/src/configuration/interactive-editor/layout/tree-container.component.tsx +3 -3
- package/src/configuration/interactive-editor/value-editor.scss +2 -2
- package/src/configuration/interactive-editor/value-editor.tsx +19 -35
- package/src/configuration/interactive-editor/value-editors/array-editor.tsx +12 -19
- package/src/configuration/interactive-editor/value-editors/concept-search.resource.tsx +4 -7
- package/src/configuration/interactive-editor/value-editors/concept-search.styles.scss +7 -7
- package/src/configuration/interactive-editor/value-editors/concept-search.tsx +15 -32
- package/src/configuration/interactive-editor/value-editors/extension-slot-add.tsx +4 -9
- package/src/configuration/interactive-editor/value-editors/extension-slot-order.tsx +2 -7
- package/src/configuration/interactive-editor/value-editors/extension-slot-remove.tsx +4 -9
- package/src/configuration/interactive-editor/value-editors/object-editor.tsx +10 -20
- package/src/configuration/interactive-editor/value-editors/patient-identifier-type-search.tsx +21 -47
- package/src/configuration/interactive-editor/value-editors/patient-identifier-type.resource.tsx +8 -8
- package/src/configuration/interactive-editor/value-editors/person-attribute-search.resource.tsx +6 -11
- package/src/configuration/interactive-editor/value-editors/person-attribute-search.tsx +20 -47
- package/src/configuration/interactive-editor/value-editors/uuid-search.scss +6 -6
- package/src/configuration/interactive-editor/value-editors/value-editor-field.tsx +27 -54
- package/src/configuration/json-editor/json-editor.component.tsx +11 -17
- package/src/declarations.d.ts +3 -3
- package/src/feature-flags/feature-flags.component.tsx +16 -26
- package/src/feature-flags/frontend-modules.scss +3 -3
- package/src/frontend-modules/frontend-modules.component.tsx +14 -22
- package/src/frontend-modules/frontend-modules.scss +3 -3
- package/src/global-implementer-tools-button.test.tsx +7 -7
- package/src/global-implementer-tools.component.tsx +6 -9
- package/src/hooks.ts +2 -2
- package/src/implementer-tools.button.tsx +8 -8
- package/src/implementer-tools.component.tsx +16 -32
- package/src/implementer-tools.styles.scss +6 -6
- package/src/implementer-tools.test.tsx +3 -3
- package/src/index.ts +11 -25
- package/src/popup/popup.component.tsx +16 -30
- package/src/popup/popup.styles.scss +1 -1
- package/src/store.ts +19 -44
- package/src/types.ts +1 -1
- package/src/ui-editor/extension-overlay.component.tsx +6 -14
- package/src/ui-editor/portal.tsx +1 -1
- package/src/ui-editor/ui-editor.tsx +24 -34
- package/webpack.config.js +1 -1
package/src/store.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGlobalStore } from
|
|
1
|
+
import { createGlobalStore } from '@openmrs/esm-framework';
|
|
2
2
|
|
|
3
3
|
export interface ImplementerToolsStore {
|
|
4
4
|
activeItemDescription?: ActiveItemDescription;
|
|
@@ -18,19 +18,16 @@ export interface ActiveItemDescription {
|
|
|
18
18
|
source?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const implementerToolsStore = createGlobalStore<ImplementerToolsStore>(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isJsonModeEnabled: getIsJsonModeEnabled(),
|
|
32
|
-
}
|
|
33
|
-
);
|
|
21
|
+
export const implementerToolsStore = createGlobalStore<ImplementerToolsStore>('implementer-tools', {
|
|
22
|
+
activeItemDescription: undefined,
|
|
23
|
+
configPathBeingEdited: null,
|
|
24
|
+
isOpen: getIsImplementerToolsOpen(),
|
|
25
|
+
hasAlert: false,
|
|
26
|
+
openTabIndex: 0,
|
|
27
|
+
isConfigToolbarOpen: getIsConfigToolbarOpen(),
|
|
28
|
+
isUIEditorEnabled: getIsUIEditorEnabled(),
|
|
29
|
+
isJsonModeEnabled: getIsJsonModeEnabled(),
|
|
30
|
+
});
|
|
34
31
|
|
|
35
32
|
export const setHasAlert = (value: boolean) =>
|
|
36
33
|
implementerToolsStore.setState((state) => ({
|
|
@@ -79,55 +76,33 @@ implementerToolsStore.subscribe((state) => {
|
|
|
79
76
|
});
|
|
80
77
|
|
|
81
78
|
function getIsImplementerToolsOpen(): boolean {
|
|
82
|
-
return (
|
|
83
|
-
JSON.parse(
|
|
84
|
-
localStorage.getItem("openmrs:openmrsImplementerToolsAreOpen") || "false"
|
|
85
|
-
) ?? false
|
|
86
|
-
);
|
|
79
|
+
return JSON.parse(localStorage.getItem('openmrs:openmrsImplementerToolsAreOpen') || 'false') ?? false;
|
|
87
80
|
}
|
|
88
81
|
|
|
89
82
|
function setIsImplementerToolsOpen(value: boolean): void {
|
|
90
|
-
localStorage.setItem(
|
|
91
|
-
"openmrs:openmrsImplementerToolsAreOpen",
|
|
92
|
-
JSON.stringify(value)
|
|
93
|
-
);
|
|
83
|
+
localStorage.setItem('openmrs:openmrsImplementerToolsAreOpen', JSON.stringify(value));
|
|
94
84
|
}
|
|
95
85
|
|
|
96
86
|
function getIsConfigToolbarOpen(): boolean {
|
|
97
|
-
return (
|
|
98
|
-
JSON.parse(
|
|
99
|
-
localStorage.getItem("openmrs:openmrsImplementerToolsConfigOpen") ||
|
|
100
|
-
"true"
|
|
101
|
-
) ?? true
|
|
102
|
-
);
|
|
87
|
+
return JSON.parse(localStorage.getItem('openmrs:openmrsImplementerToolsConfigOpen') || 'true') ?? true;
|
|
103
88
|
}
|
|
104
89
|
|
|
105
90
|
function setIsConfigToolbarOpen(value: boolean): void {
|
|
106
|
-
localStorage.setItem(
|
|
107
|
-
"openmrs:openmrsImplementerToolsConfigOpen",
|
|
108
|
-
JSON.stringify(value)
|
|
109
|
-
);
|
|
91
|
+
localStorage.setItem('openmrs:openmrsImplementerToolsConfigOpen', JSON.stringify(value));
|
|
110
92
|
}
|
|
111
93
|
|
|
112
94
|
function getIsUIEditorEnabled(): boolean {
|
|
113
|
-
return (
|
|
114
|
-
JSON.parse(localStorage.getItem("openmrs:isUIEditorEnabled") || "false") ??
|
|
115
|
-
false
|
|
116
|
-
);
|
|
95
|
+
return JSON.parse(localStorage.getItem('openmrs:isUIEditorEnabled') || 'false') ?? false;
|
|
117
96
|
}
|
|
118
97
|
|
|
119
98
|
function setIsUIEditorEnabled(enabled: boolean) {
|
|
120
|
-
localStorage.setItem(
|
|
99
|
+
localStorage.setItem('openmrs:isUIEditorEnabled', JSON.stringify(enabled));
|
|
121
100
|
}
|
|
122
101
|
|
|
123
102
|
function getIsJsonModeEnabled(): boolean {
|
|
124
|
-
return (
|
|
125
|
-
JSON.parse(
|
|
126
|
-
localStorage.getItem("openmrs:getIsJsonModeEnabled") || "false"
|
|
127
|
-
) ?? false
|
|
128
|
-
);
|
|
103
|
+
return JSON.parse(localStorage.getItem('openmrs:getIsJsonModeEnabled') || 'false') ?? false;
|
|
129
104
|
}
|
|
130
105
|
|
|
131
106
|
function setIsJsonModeEnabled(enabled: boolean) {
|
|
132
|
-
localStorage.setItem(
|
|
107
|
+
localStorage.setItem('openmrs:getIsJsonModeEnabled', JSON.stringify(enabled));
|
|
133
108
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import { Portal } from
|
|
3
|
-
import styles from
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Portal } from './portal';
|
|
3
|
+
import styles from './styles.css';
|
|
4
4
|
|
|
5
5
|
export interface ExtensionOverlayProps {
|
|
6
6
|
extensionName: string;
|
|
@@ -9,27 +9,19 @@ export interface ExtensionOverlayProps {
|
|
|
9
9
|
domElement: HTMLElement | null;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function ExtensionOverlay({
|
|
13
|
-
extensionName,
|
|
14
|
-
slotModuleName,
|
|
15
|
-
slotName,
|
|
16
|
-
domElement,
|
|
17
|
-
}: ExtensionOverlayProps) {
|
|
12
|
+
export function ExtensionOverlay({ extensionName, slotModuleName, slotName, domElement }: ExtensionOverlayProps) {
|
|
18
13
|
const [overlayDomElement, setOverlayDomElement] = useState<HTMLElement>();
|
|
19
14
|
|
|
20
15
|
useEffect(() => {
|
|
21
16
|
if (domElement) {
|
|
22
|
-
const newOverlayDomElement = document.createElement(
|
|
17
|
+
const newOverlayDomElement = document.createElement('div');
|
|
23
18
|
domElement.parentElement?.appendChild(newOverlayDomElement);
|
|
24
19
|
setOverlayDomElement(newOverlayDomElement);
|
|
25
20
|
}
|
|
26
21
|
}, [domElement]);
|
|
27
22
|
|
|
28
23
|
return overlayDomElement ? (
|
|
29
|
-
<Portal
|
|
30
|
-
key={`extension-overlay-${slotModuleName}-${slotName}-${extensionName}`}
|
|
31
|
-
el={overlayDomElement}
|
|
32
|
-
>
|
|
24
|
+
<Portal key={`extension-overlay-${slotModuleName}-${slotName}-${extensionName}`} el={overlayDomElement}>
|
|
33
25
|
<Content extensionId={extensionName} />
|
|
34
26
|
</Portal>
|
|
35
27
|
) : null;
|
package/src/ui-editor/portal.tsx
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import styles from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import {
|
|
9
|
-
import { Close } from "@carbon/react/icons";
|
|
10
|
-
import { Portal } from "./portal";
|
|
11
|
-
import { ExtensionOverlay } from "./extension-overlay.component";
|
|
12
|
-
import { ImplementerToolsStore, implementerToolsStore } from "../store";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './styles.css';
|
|
3
|
+
import { getExtensionInternalStore, useStore, useStoreWithActions } from '@openmrs/esm-framework/src/internal';
|
|
4
|
+
import { Button } from '@carbon/react';
|
|
5
|
+
import { Close } from '@carbon/react/icons';
|
|
6
|
+
import { Portal } from './portal';
|
|
7
|
+
import { ExtensionOverlay } from './extension-overlay.component';
|
|
8
|
+
import { ImplementerToolsStore, implementerToolsStore } from '../store';
|
|
13
9
|
|
|
14
10
|
export default function UiEditor() {
|
|
15
11
|
const { slots, extensions } = useStore(getExtensionInternalStore());
|
|
@@ -23,7 +19,7 @@ export default function UiEditor() {
|
|
|
23
19
|
<Portal
|
|
24
20
|
key={`slot-overlay-${slotInfo.moduleName}-${slotName}`}
|
|
25
21
|
el={document.querySelector(
|
|
26
|
-
`*[data-extension-slot-name="${slotName}"][data-extension-slot-module-name="${slotInfo.moduleName}"]
|
|
22
|
+
`*[data-extension-slot-name="${slotName}"][data-extension-slot-module-name="${slotInfo.moduleName}"]`,
|
|
27
23
|
)}
|
|
28
24
|
>
|
|
29
25
|
<SlotOverlay slotName={slotName} />
|
|
@@ -32,22 +28,19 @@ export default function UiEditor() {
|
|
|
32
28
|
: null}
|
|
33
29
|
{extensions
|
|
34
30
|
? Object.entries(extensions).map(([extensionName, extensionInfo]) =>
|
|
35
|
-
Object.entries(extensionInfo.instances).map(
|
|
36
|
-
([
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
)
|
|
50
|
-
)
|
|
31
|
+
Object.entries(extensionInfo.instances).map(([slotModuleName, bySlotName]) =>
|
|
32
|
+
Object.entries(bySlotName).map(([slotName, extensionInstance]) => (
|
|
33
|
+
<ExtensionOverlay
|
|
34
|
+
key={slotName}
|
|
35
|
+
extensionName={extensionName}
|
|
36
|
+
slotModuleName={slotModuleName}
|
|
37
|
+
slotName={slotName}
|
|
38
|
+
domElement={document.querySelector(
|
|
39
|
+
`*[data-extension-slot-name="${slotName}"][data-extension-slot-module-name="${slotModuleName}"] *[data-extension-id="${extensionInstance.id}"]`,
|
|
40
|
+
)}
|
|
41
|
+
/>
|
|
42
|
+
)),
|
|
43
|
+
),
|
|
51
44
|
)
|
|
52
45
|
: null}
|
|
53
46
|
</>
|
|
@@ -58,7 +51,7 @@ export function SlotOverlay({ slotName }) {
|
|
|
58
51
|
return (
|
|
59
52
|
<>
|
|
60
53
|
<div className={styles.slotOverlay}></div>
|
|
61
|
-
<div className={styles.slotName}>{
|
|
54
|
+
<div className={styles.slotName}>{'Slot: ' + slotName}</div>
|
|
62
55
|
</>
|
|
63
56
|
);
|
|
64
57
|
}
|
|
@@ -70,10 +63,7 @@ const actions = {
|
|
|
70
63
|
};
|
|
71
64
|
|
|
72
65
|
export function ExitButton() {
|
|
73
|
-
const { toggleIsUIEditorEnabled } = useStoreWithActions(
|
|
74
|
-
implementerToolsStore,
|
|
75
|
-
actions
|
|
76
|
-
);
|
|
66
|
+
const { toggleIsUIEditorEnabled } = useStoreWithActions(implementerToolsStore, actions);
|
|
77
67
|
return (
|
|
78
68
|
<Button
|
|
79
69
|
className={styles.exitButton}
|
package/webpack.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require(
|
|
1
|
+
module.exports = require('openmrs/default-webpack-config');
|