@openmrs/esm-implementer-tools-app 3.1.10-pre.92 → 3.1.12-pre.598
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 +1 -9
- package/__mocks__/react-i18next.js +54 -0
- package/{.babelrc → babel.config.json} +2 -1
- package/dist/266.openmrs-esm-implementer-tools-app.js +3 -0
- package/dist/266.openmrs-esm-implementer-tools-app.js.LICENSE.txt +8 -0
- package/dist/266.openmrs-esm-implementer-tools-app.js.map +1 -0
- package/dist/319.openmrs-esm-implementer-tools-app.js +1 -0
- package/dist/472.openmrs-esm-implementer-tools-app.js +2 -0
- package/dist/472.openmrs-esm-implementer-tools-app.js.map +1 -0
- package/dist/574.openmrs-esm-implementer-tools-app.js +1 -0
- package/dist/728.openmrs-esm-implementer-tools-app.js +2 -0
- package/dist/728.openmrs-esm-implementer-tools-app.js.map +1 -0
- package/dist/965.openmrs-esm-implementer-tools-app.js +3 -0
- package/dist/965.openmrs-esm-implementer-tools-app.js.LICENSE.txt +5 -0
- package/dist/965.openmrs-esm-implementer-tools-app.js.map +1 -0
- package/dist/openmrs-esm-implementer-tools-app.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +170 -0
- package/dist/openmrs-esm-implementer-tools-app.js.map +1 -1
- package/jest.config.js +1 -2
- package/package.json +13 -20
- package/src/backend-dependencies/backend-dependencies.component.tsx +97 -0
- package/src/backend-dependencies/openmrs-backend-dependencies.ts +113 -93
- package/src/backend-dependencies/useBackendDependencies.ts +16 -0
- package/src/config-edit-button/config-edit-button.component.tsx +3 -1
- package/src/configuration/config-tree-for-module.component.tsx +1 -1
- package/src/configuration/config-tree.component.tsx +2 -9
- package/src/configuration/configuration.component.tsx +101 -31
- package/src/configuration/configuration.test.tsx +6 -6
- package/src/configuration/description.component.tsx +3 -1
- package/src/configuration/display-value.tsx +4 -4
- package/src/configuration/editable-value.component.tsx +5 -2
- package/src/configuration/extension-slots-config-tree.tsx +10 -14
- package/src/configuration/layout/subtree.component.tsx +1 -1
- package/src/configuration/layout/tree-container.component.tsx +1 -1
- package/src/configuration/value-editor.tsx +1 -1
- package/src/configuration/value-editors/array-editor.tsx +3 -3
- package/src/configuration/value-editors/extension-slot-add.tsx +1 -1
- package/src/configuration/value-editors/extension-slot-order.tsx +0 -4
- package/src/configuration/value-editors/extension-slot-remove.tsx +19 -7
- package/src/configuration/value-editors/object-editor.tsx +3 -3
- package/src/configuration/value-editors/value-editor-field.tsx +1 -3
- package/src/implementer-tools.button.tsx +33 -0
- package/src/implementer-tools.component.tsx +45 -81
- package/src/implementer-tools.styles.css +5 -9
- package/src/index.ts +35 -9
- package/src/popup/popup.component.tsx +11 -27
- package/src/popup/popup.styles.css +1 -1
- package/src/store.ts +27 -32
- package/src/ui-editor/extension-overlay.component.tsx +1 -1
- package/src/ui-editor/styles.css +7 -0
- package/src/ui-editor/ui-editor.tsx +49 -21
- package/translations/en.json +12 -0
- package/translations/es.json +13 -0
- package/tsconfig.json +1 -0
- package/webpack.config.js +1 -66
- package/__mocks__/openmrs-esm-framework.mock.tsx +0 -142
- package/dist/1.openmrs-esm-implementer-tools-app.js +0 -15
- package/dist/1.openmrs-esm-implementer-tools-app.js.map +0 -1
- package/dist/2.openmrs-esm-implementer-tools-app.js +0 -2
- package/dist/2.openmrs-esm-implementer-tools-app.js.map +0 -1
- package/src/backend-dependencies/backend-dependecies.component.tsx +0 -106
- package/src/backend-dependencies/backend-dependencies-style.css +0 -4
- package/src/backend-dependencies/helpers/backend-dependecies-helper.test.ts +0 -127
- package/src/backend-dependencies/helpers/backend-dependecies-helper.ts +0 -70
- package/src/set-public-path.ts +0 -3
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styles from "./styles.css";
|
|
3
|
+
import Close16 from "@carbon/icons-react/es/close/16";
|
|
4
|
+
import { useExtensionStore, useStore } from "@openmrs/esm-framework";
|
|
5
|
+
import { Button } from "carbon-components-react";
|
|
3
6
|
import { Portal } from "./portal";
|
|
4
7
|
import { ExtensionOverlay } from "./extension-overlay.component";
|
|
5
|
-
import {
|
|
8
|
+
import { ImplementerToolsStore, implementerToolsStore } from "../store";
|
|
6
9
|
|
|
7
10
|
export function UiEditor() {
|
|
8
11
|
const { slots, extensions } = useExtensionStore();
|
|
12
|
+
const { isOpen: implementerToolsIsOpen } = useStore(implementerToolsStore);
|
|
9
13
|
|
|
10
14
|
return (
|
|
11
15
|
<>
|
|
16
|
+
{implementerToolsIsOpen ? null : <ExitButton />}
|
|
12
17
|
{slots
|
|
13
18
|
? Object.entries(slots).map(([slotName, slotInfo]) =>
|
|
14
|
-
Object.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
19
|
+
Object.keys(slotInfo.instances).map((slotModuleName) => (
|
|
20
|
+
<Portal
|
|
21
|
+
key={`slot-overlay-${slotModuleName}-${slotName}`}
|
|
22
|
+
el={document.querySelector(
|
|
23
|
+
`*[data-extension-slot-name="${slotName}"][data-extension-slot-module-name="${slotModuleName}"]`
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<SlotOverlay slotName={slotName} />
|
|
27
|
+
</Portal>
|
|
28
|
+
))
|
|
24
29
|
)
|
|
25
30
|
: null}
|
|
26
31
|
{extensions
|
|
@@ -28,16 +33,17 @@ export function UiEditor() {
|
|
|
28
33
|
Object.entries(extensionInfo.instances).map(
|
|
29
34
|
([slotModuleName, bySlotName]) =>
|
|
30
35
|
Object.entries(bySlotName).map(
|
|
31
|
-
([slotName, extensionInstance]) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
([slotName, extensionInstance]) => (
|
|
37
|
+
<ExtensionOverlay
|
|
38
|
+
key={slotName}
|
|
39
|
+
extensionName={extensionName}
|
|
40
|
+
slotModuleName={slotModuleName}
|
|
41
|
+
slotName={slotName}
|
|
42
|
+
domElement={document.querySelector(
|
|
43
|
+
`*[data-extension-slot-name="${slotName}"][data-extension-slot-module-name="${slotModuleName}"] *[data-extension-id="${extensionInstance.id}"]`
|
|
44
|
+
)}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
41
47
|
)
|
|
42
48
|
)
|
|
43
49
|
)
|
|
@@ -54,3 +60,25 @@ export function SlotOverlay({ slotName }) {
|
|
|
54
60
|
</>
|
|
55
61
|
);
|
|
56
62
|
}
|
|
63
|
+
|
|
64
|
+
const actions = {
|
|
65
|
+
toggleIsUIEditorEnabled({ isUIEditorEnabled }: ImplementerToolsStore) {
|
|
66
|
+
return { isUIEditorEnabled: !isUIEditorEnabled };
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function ExitButton() {
|
|
71
|
+
const { toggleIsUIEditorEnabled } = useStore(implementerToolsStore, actions);
|
|
72
|
+
return (
|
|
73
|
+
<Button
|
|
74
|
+
className={styles.exitButton}
|
|
75
|
+
kind="danger"
|
|
76
|
+
size="sm"
|
|
77
|
+
renderIcon={Close16}
|
|
78
|
+
iconDescription="Exit UI Editor"
|
|
79
|
+
tooltipPosition="left"
|
|
80
|
+
onClick={toggleIsUIEditorEnabled}
|
|
81
|
+
hasIconOnly
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"backendModules": "Backend Modules",
|
|
3
|
+
"clearTemporaryConfig": "Clear Temporary Config",
|
|
4
|
+
"configuration": "Configuration",
|
|
5
|
+
"devConfig": "Dev Config",
|
|
6
|
+
"downloadTemporaryConfig": "Download Temporary Config",
|
|
7
|
+
"edit": "Edit",
|
|
8
|
+
"installedVersion": "Installed Version",
|
|
9
|
+
"missing": "Missing",
|
|
10
|
+
"requiredVersion": "Required Version",
|
|
11
|
+
"uiEditor": "UI Editor"
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"backendModules": "Módulos backend",
|
|
3
|
+
"clearTemporaryConfig": "Borrar configuración temporal",
|
|
4
|
+
"configuration": "Configuración",
|
|
5
|
+
"devConfig": "Configuración de desarrollo",
|
|
6
|
+
"downloadTemporaryConfig": "Descargar configuración temporal",
|
|
7
|
+
"edit": "Editar",
|
|
8
|
+
"installedVersion": "Versión instalada",
|
|
9
|
+
"missing": "Desaparecido",
|
|
10
|
+
"requiredVersion": "Versión requerida",
|
|
11
|
+
"uiEditor": "Editora de interfaz de usuario",
|
|
12
|
+
"implementerTools": "Herramientas de implementación"
|
|
13
|
+
}
|
package/tsconfig.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const { resolve } = require("path");
|
|
3
|
-
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
4
|
-
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
|
5
|
-
|
|
6
|
-
const { peerDependencies } = require("./package.json");
|
|
7
|
-
|
|
8
|
-
module.exports = (env) => ({
|
|
9
|
-
entry: [
|
|
10
|
-
resolve(__dirname, "src/set-public-path.ts"),
|
|
11
|
-
resolve(__dirname, "src/index.ts"),
|
|
12
|
-
],
|
|
13
|
-
output: {
|
|
14
|
-
filename: "openmrs-esm-implementer-tools-app.js",
|
|
15
|
-
path: resolve(__dirname, "dist"),
|
|
16
|
-
libraryTarget: "system",
|
|
17
|
-
},
|
|
18
|
-
devtool: "sourcemap",
|
|
19
|
-
module: {
|
|
20
|
-
rules: [
|
|
21
|
-
{
|
|
22
|
-
parser: {
|
|
23
|
-
system: false,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
test: /\.m?(js|ts|tsx)$/,
|
|
28
|
-
exclude: /(node_modules|bower_components)/,
|
|
29
|
-
use: "babel-loader",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
test: /node_modules\/.+\.css$/i,
|
|
33
|
-
use: ["style-loader", "css-loader"],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
test: /\.css$/,
|
|
37
|
-
use: [
|
|
38
|
-
"style-loader",
|
|
39
|
-
{
|
|
40
|
-
loader: "css-loader",
|
|
41
|
-
options: {
|
|
42
|
-
modules: true,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
resolve: {
|
|
50
|
-
extensions: [".ts", ".js", ".tsx", ".jsx"],
|
|
51
|
-
},
|
|
52
|
-
plugins: [
|
|
53
|
-
new CleanWebpackPlugin(),
|
|
54
|
-
new ForkTsCheckerWebpackPlugin(),
|
|
55
|
-
new BundleAnalyzerPlugin({
|
|
56
|
-
analyzerMode: env && env.analyze ? "static" : "disabled",
|
|
57
|
-
}),
|
|
58
|
-
],
|
|
59
|
-
externals: Object.keys(peerDependencies),
|
|
60
|
-
devServer: {
|
|
61
|
-
disableHostCheck: true,
|
|
62
|
-
headers: {
|
|
63
|
-
"Access-Control-Allow-Origin": "*",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
1
|
+
module.exports = require("openmrs/default-webpack-config");
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import createStore, { Store } from "unistore";
|
|
3
|
-
|
|
4
|
-
interface StoreEntity {
|
|
5
|
-
value: Store<any>;
|
|
6
|
-
active: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type MockedStore<T> = Store<T> & { resetMock: () => void };
|
|
10
|
-
|
|
11
|
-
const initialStates: Record<string, any> = {};
|
|
12
|
-
|
|
13
|
-
const availableStores: Record<string, StoreEntity> = {};
|
|
14
|
-
|
|
15
|
-
export const mockStores = availableStores;
|
|
16
|
-
|
|
17
|
-
export function createGlobalStore<TState>(
|
|
18
|
-
name: string,
|
|
19
|
-
initialState: TState
|
|
20
|
-
): Store<TState> {
|
|
21
|
-
const available = availableStores[name];
|
|
22
|
-
|
|
23
|
-
if (available) {
|
|
24
|
-
if (available.active) {
|
|
25
|
-
console.error(
|
|
26
|
-
"Cannot override an existing store. Make sure that stores are only created once."
|
|
27
|
-
);
|
|
28
|
-
} else {
|
|
29
|
-
available.value.setState(initialState, true);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
available.active = true;
|
|
33
|
-
return available.value;
|
|
34
|
-
} else {
|
|
35
|
-
const store = createStore(initialState);
|
|
36
|
-
initialStates[name] = initialState;
|
|
37
|
-
|
|
38
|
-
availableStores[name] = {
|
|
39
|
-
value: store,
|
|
40
|
-
active: true,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return instrumentedStore(name, store);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function getGlobalStore<TState = any>(
|
|
48
|
-
name: string,
|
|
49
|
-
fallbackState?: TState
|
|
50
|
-
): Store<TState> {
|
|
51
|
-
const available = availableStores[name];
|
|
52
|
-
|
|
53
|
-
if (!available) {
|
|
54
|
-
const store = createStore(fallbackState);
|
|
55
|
-
initialStates[name] = fallbackState;
|
|
56
|
-
availableStores[name] = {
|
|
57
|
-
value: store,
|
|
58
|
-
active: false,
|
|
59
|
-
};
|
|
60
|
-
return instrumentedStore(name, store);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return instrumentedStore(name, available.value);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function instrumentedStore<T>(name: string, store: Store<T>) {
|
|
67
|
-
return ({
|
|
68
|
-
getState: jest.spyOn(store, "getState"),
|
|
69
|
-
setState: jest.spyOn(store, "setState"),
|
|
70
|
-
subscribe: jest.spyOn(store, "subscribe"),
|
|
71
|
-
unsubscribe: jest.spyOn(store, "unsubscribe"),
|
|
72
|
-
resetMock: () => store.setState(initialStates[name]),
|
|
73
|
-
} as any) as MockedStore<T>;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const configInternalStore = createGlobalStore("config-internal", {
|
|
77
|
-
devDefaultsAreOn: false,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export const implementerToolsConfigStore = createGlobalStore(
|
|
81
|
-
"implementer-tools-config",
|
|
82
|
-
{}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
export const temporaryConfigStore = createGlobalStore("temporary-config", {});
|
|
86
|
-
|
|
87
|
-
export enum Type {
|
|
88
|
-
Array = "Array",
|
|
89
|
-
Boolean = "Boolean",
|
|
90
|
-
ConceptUuid = "ConceptUuid",
|
|
91
|
-
Number = "Number",
|
|
92
|
-
Object = "Object",
|
|
93
|
-
String = "String",
|
|
94
|
-
UUID = "UUID",
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function openmrsFetch() {
|
|
98
|
-
return new Promise(() => {});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const setIsUIEditorEnabled = (boolean): void => {};
|
|
102
|
-
|
|
103
|
-
let state = { slots: {}, extensions: {} };
|
|
104
|
-
|
|
105
|
-
export const extensionStore = {
|
|
106
|
-
getState: () => state,
|
|
107
|
-
setState: (val) => {
|
|
108
|
-
state = { ...state, ...val };
|
|
109
|
-
},
|
|
110
|
-
subscribe: (updateFcn) => {
|
|
111
|
-
updateFcn(state);
|
|
112
|
-
return () => {};
|
|
113
|
-
},
|
|
114
|
-
unsubscribe: () => {},
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export const ComponentContext = React.createContext(null);
|
|
118
|
-
|
|
119
|
-
export const openmrsComponentDecorator = jest
|
|
120
|
-
.fn()
|
|
121
|
-
.mockImplementation(() => (component) => component);
|
|
122
|
-
|
|
123
|
-
export const UserHasAccess = jest.fn().mockImplementation((props: any) => {
|
|
124
|
-
return props.children;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export const createUseStore = (store: Store<any>) => (actions) => {
|
|
128
|
-
const state = store.getState();
|
|
129
|
-
return { ...state, ...actions };
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const useExtensionStore = (actions) => {
|
|
133
|
-
const state = extensionStore.getState();
|
|
134
|
-
return { ...state, ...actions };
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export const useStore = (store: Store<any>, actions) => {
|
|
138
|
-
const state = store.getState();
|
|
139
|
-
return { ...state, ...actions };
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const showToast = jest.fn();
|