@openmrs/esm-implementer-tools-app 10.0.1-pre.5752 → 11.0.0
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/.turbo/turbo-lint.log +0 -0
- package/.turbo/turbo-test.log +52 -0
- package/.turbo/turbo-typescript.log +0 -0
- package/dist/3038.js +1 -1
- package/dist/8088.js +1 -1
- package/dist/backend-dependencies/backend-dependencies.component.d.ts +6 -0
- package/dist/backend-dependencies/openmrs-backend-dependencies.d.ts +14 -0
- package/dist/backend-dependencies/openmrs-backend-dependencies.test.d.ts +1 -0
- package/dist/backend-dependencies/useBackendDependencies.d.ts +2 -0
- package/dist/config-edit-button/config-edit-button.component.d.ts +6 -0
- package/dist/configuration/configuration.component.d.ts +2 -0
- package/dist/configuration/configuration.test.d.ts +1 -0
- package/dist/configuration/interactive-editor/config-subtree.component.d.ts +6 -0
- package/dist/configuration/interactive-editor/config-tree-for-module.component.d.ts +6 -0
- package/dist/configuration/interactive-editor/config-tree.component.d.ts +5 -0
- package/dist/configuration/interactive-editor/description.component.d.ts +2 -0
- package/dist/configuration/interactive-editor/display-value.d.ts +5 -0
- package/dist/configuration/interactive-editor/editable-value.component.d.ts +18 -0
- package/dist/configuration/interactive-editor/extension-configure-tree.d.ts +8 -0
- package/dist/configuration/interactive-editor/extension-slots-config-tree.d.ts +9 -0
- package/dist/configuration/interactive-editor/layout/subtree.component.d.ts +9 -0
- package/dist/configuration/interactive-editor/layout/tree-container.component.d.ts +5 -0
- package/dist/configuration/interactive-editor/validators.resource.d.ts +3 -0
- package/dist/configuration/interactive-editor/value-editor.d.ts +14 -0
- package/dist/configuration/interactive-editor/value-editors/array-editor.d.ts +9 -0
- package/dist/configuration/interactive-editor/value-editors/concept-search.d.ts +8 -0
- package/dist/configuration/interactive-editor/value-editors/concept-search.resource.d.ts +24 -0
- package/dist/configuration/interactive-editor/value-editors/extension-slot-add.d.ts +5 -0
- package/dist/configuration/interactive-editor/value-editors/extension-slot-order.d.ts +7 -0
- package/dist/configuration/interactive-editor/value-editors/extension-slot-remove.d.ts +7 -0
- package/dist/configuration/interactive-editor/value-editors/object-editor.d.ts +9 -0
- package/dist/configuration/interactive-editor/value-editors/patient-identifier-type-search.d.ts +7 -0
- package/dist/configuration/interactive-editor/value-editors/patient-identifier-type.resource.d.ts +8 -0
- package/dist/configuration/interactive-editor/value-editors/person-attribute-search.d.ts +7 -0
- package/dist/configuration/interactive-editor/value-editors/person-attribute-search.resource.d.ts +2 -0
- package/dist/configuration/interactive-editor/value-editors/value-editor-field.d.ts +12 -0
- package/dist/configuration/json-editor/json-editor.component.d.ts +8 -0
- package/dist/feature-flags/feature-flags.component.d.ts +2 -0
- package/dist/frontend-modules/frontend-modules.component.d.ts +6 -0
- package/dist/global-implementer-tools-button.test.d.ts +1 -0
- package/dist/global-implementer-tools.component.d.ts +3 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/implementer-tools.button.d.ts +3 -0
- package/dist/implementer-tools.component.d.ts +2 -0
- package/dist/implementer-tools.test.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/openmrs-esm-implementer-tools-app.js +2 -2
- package/dist/openmrs-esm-implementer-tools-app.js.map +1 -1
- package/dist/popup/popup.component.d.ts +11 -0
- package/dist/routes.json +1 -1
- package/dist/store.d.ts +21 -0
- package/dist/types.d.ts +4 -0
- package/dist/ui-editor/extension-overlay.component.d.ts +8 -0
- package/dist/ui-editor/extension-overlay.component.test.d.ts +1 -0
- package/dist/ui-editor/portal.d.ts +4 -0
- package/dist/ui-editor/ui-editor.d.ts +28 -0
- package/dist/ui-editor/ui-editor.test.d.ts +1 -0
- package/package.json +5 -6
package/.turbo/turbo-build.log
CHANGED
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
[1m[46m RUN [49m[22m [36mv4.1.2 [39m[90m/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app[39m
|
|
3
|
+
|
|
4
|
+
[32m✓[39m src/backend-dependencies/openmrs-backend-dependencies.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 119[2mms[22m[39m
|
|
5
|
+
[32m✓[39m src/ui-editor/extension-overlay.component.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 91[2mms[22m[39m
|
|
6
|
+
[32m✓[39m src/ui-editor/ui-editor.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 23[2mms[22m[39m
|
|
7
|
+
[90mstderr[2m | src/global-implementer-tools-button.test.tsx[2m > [22m[2mTesting the global implementer tools button[2m > [22m[2mshould render global Implementer tools
|
|
8
|
+
[22m[39mreact-i18next:: useTranslation: You will need to pass in an i18next instance by using initReactI18next { code: [32m'NO_I18NEXT_INSTANCE'[39m }
|
|
9
|
+
|
|
10
|
+
[32m✓[39m src/global-implementer-tools-button.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 72[2mms[22m[39m
|
|
11
|
+
[90mstderr[2m | src/configuration/configuration.test.tsx[2m > [22m[2mConfiguration[2m > [22m[2mrenders the configuration component inside the implementer tools panel
|
|
12
|
+
[22m[39mreact-i18next:: useTranslation: You will need to pass in an i18next instance by using initReactI18next { code: [32m'NO_I18NEXT_INSTANCE'[39m }
|
|
13
|
+
|
|
14
|
+
[90mstderr[2m | src/configuration/configuration.test.tsx[2m > [22m[2mConfiguration[2m > [22m[2mhandles hovering over config tree items without crashing
|
|
15
|
+
[22m[39mWarning: Failed prop type: The prop `children` is marked as required in `ForwardRef`, but its value is `undefined`.
|
|
16
|
+
at /home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/Text/Text.js:17:3
|
|
17
|
+
at StructuredListCell (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/StructuredList/StructuredList.js:310:5)
|
|
18
|
+
at div
|
|
19
|
+
at StructuredListRow (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/StructuredList/StructuredList.js:145:5)
|
|
20
|
+
at /home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/layout/subtree.component.tsx:9:61
|
|
21
|
+
at ConfigSubtree (/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/config-subtree.component.tsx:13:26)
|
|
22
|
+
at div
|
|
23
|
+
at StructuredListBody (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/StructuredList/StructuredList.js:116:5)
|
|
24
|
+
at div
|
|
25
|
+
at StructuredListWrapper (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/StructuredList/StructuredList.js:27:5)
|
|
26
|
+
at TreeContainer (/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/layout/tree-container.component.tsx:9:26)
|
|
27
|
+
at ConfigTreeForModule (/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/config-tree-for-module.component.tsx:13:32)
|
|
28
|
+
at div
|
|
29
|
+
at div
|
|
30
|
+
at li
|
|
31
|
+
at AccordionItem (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/Accordion/AccordionItem.js:30:3)
|
|
32
|
+
at ul
|
|
33
|
+
at AccordionProvider (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/Accordion/AccordionProvider.js:16:3)
|
|
34
|
+
at Accordion (/home/runner/work/openmrs-esm-core/openmrs-esm-core/node_modules/@carbon/react/lib/components/Accordion/Accordion.js:20:3)
|
|
35
|
+
at ConfigTree (/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/config-tree.component.tsx:15:23)
|
|
36
|
+
at div
|
|
37
|
+
at div
|
|
38
|
+
at Configuration (/home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-implementer-tools-app/src/configuration/configuration.component.tsx:52:56)
|
|
39
|
+
|
|
40
|
+
[32m✓[39m src/configuration/configuration.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[33m 1986[2mms[22m[39m
|
|
41
|
+
[33m[2m✓[22m[39m displays correct boolean value and editor [33m 419[2mms[22m[39m
|
|
42
|
+
[33m[2m✓[22m[39m displays correct UUID value and editor [33m 392[2mms[22m[39m
|
|
43
|
+
[90mstderr[2m | src/implementer-tools.test.tsx[2m > [22m[2mImplementerTools[2m > [22m[2mrenders without dying
|
|
44
|
+
[22m[39mreact-i18next:: useTranslation: You will need to pass in an i18next instance by using initReactI18next { code: [32m'NO_I18NEXT_INSTANCE'[39m }
|
|
45
|
+
|
|
46
|
+
[32m✓[39m src/implementer-tools.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
47
|
+
|
|
48
|
+
[2m Test Files [22m [1m[32m6 passed[39m[22m[90m (6)[39m
|
|
49
|
+
[2m Tests [22m [1m[32m35 passed[39m[22m[90m (35)[39m
|
|
50
|
+
[2m Start at [22m 17:23:54
|
|
51
|
+
[2m Duration [22m 14.83s[2m (transform 9.26s, setup 2.88s, import 27.39s, tests 2.33s, environment 5.15s)[22m
|
|
52
|
+
|
|
File without changes
|
package/dist/3038.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_implementer_tools_app=globalThis.webpackChunk_openmrs_esm_implementer_tools_app||[]).push([["3038"],{4767(e,n,t){var o={"./uk.json":["723","9072"],"./ar.json":["4132","7045"],"./ru_RU.json":["986","8359"],"./uz_UZ.json":["890","7175"],"./fr.json":["4055","6508"],"./sw_KE.json":["8618","903"],"./uz.json":["3584","6377"],"./en.json":["4300","5117"],"./ky.json":["8163","2416"],"./pl.json":["1119","6724"],"./sq.json":["8371","4928"],"./ka.json":["795","1480"],"./si.json":["6859","6904"],"./zh_TW.json":["439","556"],"./de.json":["4944","5145"],"./lg.json":["4618","8695"],"./vi.json":["9214","6371"],"./tr.json":["5241","434"],"./es_MX.json":["8349","1646"],"./tr_TR.json":["9900","1869"],"./zh_CN.json":["9879","5644"],"./en_US.json":["9569","4106"],"./he.json":["4652","2317"],"./id.json":["2690","6047"],"./ku.json":["9895","4348"],"./es.json":["3099","7912"],"./ne.json":["2146","5503"],"./ar_SY.json":["7617","282"],"./uz@Latn.json":["7097","4658"],"./bn.json":["7159","6444"],"./cs.json":["6589","7182"],"./zh.json":["5661","7742"],"./hi_IN.json":["5442","4383"],"./pt_BR.json":["6468","1877"],"./qu.json":["5173","8358"],"./ro_RO.json":["6022","3963"],"./sw.json":["9913","3378"],"./am.json":["1197","9806"],"./pt.json":["6679","5132"],"./it.json":["9538","4111"],"./km.json":["4335","5940"],"./hi.json":["6840","2881"]};function s(e){if(!t.o(o,e))return Promise.resolve().then(function(){var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n});var n=o[e],s=n[0];return t.e(n[1]).then(function(){return t(s)})}s.keys=()=>Object.keys(o),s.id=4767,e.exports=s},5917(e,n,t){"use strict";let o;t.r(n),t.d(n,{implementerTools:()=>U,globalImplementerTools:()=>M,ConfigEditButton:()=>A,implementerToolsButton:()=>D,importTranslation:()=>C});var s=t(
|
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_implementer_tools_app=globalThis.webpackChunk_openmrs_esm_implementer_tools_app||[]).push([["3038"],{4767(e,n,t){var o={"./uk.json":["723","9072"],"./ar.json":["4132","7045"],"./ru_RU.json":["986","8359"],"./uz_UZ.json":["890","7175"],"./fr.json":["4055","6508"],"./sw_KE.json":["8618","903"],"./uz.json":["3584","6377"],"./en.json":["4300","5117"],"./ky.json":["8163","2416"],"./pl.json":["1119","6724"],"./sq.json":["8371","4928"],"./ka.json":["795","1480"],"./si.json":["6859","6904"],"./zh_TW.json":["439","556"],"./de.json":["4944","5145"],"./lg.json":["4618","8695"],"./vi.json":["9214","6371"],"./tr.json":["5241","434"],"./es_MX.json":["8349","1646"],"./tr_TR.json":["9900","1869"],"./zh_CN.json":["9879","5644"],"./en_US.json":["9569","4106"],"./he.json":["4652","2317"],"./id.json":["2690","6047"],"./ku.json":["9895","4348"],"./es.json":["3099","7912"],"./ne.json":["2146","5503"],"./ar_SY.json":["7617","282"],"./uz@Latn.json":["7097","4658"],"./bn.json":["7159","6444"],"./cs.json":["6589","7182"],"./zh.json":["5661","7742"],"./hi_IN.json":["5442","4383"],"./pt_BR.json":["6468","1877"],"./qu.json":["5173","8358"],"./ro_RO.json":["6022","3963"],"./sw.json":["9913","3378"],"./am.json":["1197","9806"],"./pt.json":["6679","5132"],"./it.json":["9538","4111"],"./km.json":["4335","5940"],"./hi.json":["6840","2881"]};function s(e){if(!t.o(o,e))return Promise.resolve().then(function(){var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n});var n=o[e],s=n[0];return t.e(n[1]).then(function(){return t(s)})}s.keys=()=>Object.keys(o),s.id=4767,e.exports=s},5917(e,n,t){"use strict";let o;t.r(n),t.d(n,{implementerTools:()=>U,globalImplementerTools:()=>M,ConfigEditButton:()=>A,implementerToolsButton:()=>D,importTranslation:()=>C});var s=t(5607),r=t(6925),l=t.n(r),i=t(9737),a=t(3639),m=t(1917);let u=function(e,n,t,o){for(var s=e.length,r=t+(o?1:-1);o?r--:++r<s;)if(n(e[r],r,e))return r;return -1},c=function(e){return e!=e},p=function(e,n,t){for(var o=t-1,s=e.length;++o<s;)if(e[o]===n)return o;return -1},d=function(e,n){return!!(null==e?0:e.length)&&(n==n?p(e,n,0):u(e,c,0))>-1},f=function(e,n,t){for(var o=-1,s=null==e?0:e.length;++o<s;)if(t(n,e[o]))return!0;return!1};var b=t(7184),g=t(6105),h=t(5199);let _=function(e,n,t,o){var s=-1,r=d,l=!0,i=e.length,a=[],u=n.length;if(!i)return a;t&&(n=(0,b.A)(n,(0,g.A)(t))),o?(r=f,l=!1):n.length>=200&&(r=h.A,l=!1,n=new m.A(n));e:for(;++s<i;){var c=e[s],p=null==t?c:t(c);if(c=o||0!==c?c:0,l&&p==p){for(var _=u;_--;)if(n[_]===p)continue e;a.push(c)}else r(n,p,o)||a.push(c)}return a};var j=t(5076),E=t(9698),T=t(1937),I=(0,E.A)(function(e,n){return(0,T.A)(e)?_(e,(0,j.A)(n,1,T.A,!0)):[]});async function v(){try{return await k()}catch(e){console.error(e)}return[]}async function k(){let e=[],n=`${s.restBaseUrl}/module?v=custom:(uuid,version)`,t=0,o=e=>e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`${s.restBaseUrl}/${e.replace(/^\/?/,"")}`:null;for(;n&&t<50;)try{let{data:r}=await (0,s.openmrsFetch)(n,{method:"GET"}),l=Array.isArray(r?.results)?r.results:[];e.push(...l);let i=(Array.isArray(r?.links)?r.links:[]).find(e=>"next"===(e.rel||"").toLowerCase());n=o(i?.uri??null),t+=1}catch(e){throw console.error(`Failed to fetch backend modules on request ${t+1} (URL: ${n})`,e),Error(`Failed to fetch backend modules: ${e instanceof Error?e.message:"Unknown error"}`)}return n&&t>=50&&console.warn(`Reached maximum page limit (50) while fetching backend modules. There may be more data available at: ${n}`),e}async function y(){if(!o){let e=(window.installedModules??[]).filter(e=>!!(e[1]?.backendDependencies||e[1]?.optionalBackendDependencies)).map(e=>({backendDependencies:e[1].backendDependencies,optionalBackendDependencies:Object.fromEntries(Object.entries(e[1].optionalBackendDependencies??{}).map(([e,n])=>"string"==typeof n||void 0===n?[e,n]:[e,n.version])),moduleName:e[0]})),n=await v();o=e.map(e=>{var t,o;let r,l,i;return r=[],t=e.backendDependencies,o=n,l=t?I(Object.keys(t),o.map(e=>e.uuid)).map(e=>({uuid:e,version:t[e]})):[],i=function(e,n,t){if(!e)return[];let o={...n,...e},s=Object.keys(o).map(e=>({uuid:e,version:o[e]})),r=new Set(t.map(e=>e.uuid));return s.filter(e=>r.has(e.uuid))}(e.backendDependencies,e.optionalBackendDependencies,n),r.push(...l.map(e=>({name:e.uuid,requiredVersion:e.version,type:"missing"})),...i.map(e=>{var t,o,r,l;let i,a=e.version,m=(t=e,o=n,i=t.uuid,o.find(e=>e.uuid===i)?.version??"");return{name:e.uuid,requiredVersion:a,installedVersion:m,type:(r=a,l=m,(0,s.isVersionSatisfied)(r,l)?"okay":"version-mismatch")}})),{name:e.moduleName,dependencies:r}})}return o}let S=l().lazy(()=>Promise.all([t.e("4012"),t.e("9270"),t.e("3230"),t.e("7143"),t.e("8088")]).then(t.bind(t,4955))),O=l().lazy(()=>Promise.all([t.e("4234"),t.e("7143"),t.e("2920")]).then(t.bind(t,7099)));function w(){let e=(0,r.useMemo)(()=>(window.installedModules??[]).filter(e=>!!e&&!!e[1]).map(e=>({...e[1],name:e[0]})),[]),n=function(){let[e,n]=(0,r.useState)([]);return(0,r.useEffect)(()=>{y().then(n)},[]),e}(),[t,o]=(0,r.useState)(!1),{t:m}=(0,i.useTranslation)();(0,r.useEffect)(()=>{o(e=>e||n.some(e=>e.dependencies.some(e=>"okay"!==e.type)))},[n]),(0,r.useEffect)(()=>{t&&(0,s.showToast)({critical:!1,kind:"error",description:m("checkImplementerToolsMessage","Check the Backend Modules tab in the Implementer Tools for more details"),title:m("modulesWithMissingDependenciesWarning","Some modules have unresolved backend dependencies"),actionButtonLabel:m("viewModules","View modules"),onActionButtonClick:a.s5})},[m,t]);let{isOpen:u,isUIEditorEnabled:c,openTabIndex:p}=(0,s.useStore)(a.bB);return l().createElement("div",{className:"-esm-implementer-tools__implementer-tools-styles__darkTheme___bP8LS"},u?l().createElement(S,{close:a.xq,frontendModules:e,backendDependencies:n,visibleTabIndex:p}):null,c?l().createElement(O,null):null)}var B=t(8326);function A({configPath:e}){let{t:n}=(0,i.useTranslation)();return l().createElement("button",{onClick:()=>{a.bB.setState({configPathBeingEdited:e})}},n("edit","Edit"))}let C=t(4767),N={featureName:"Implementer Tools",moduleName:"@openmrs/esm-implementer-tools-app"},U=(0,s.getSyncLifecycle)(function(){return l().createElement(s.UserHasAccess,{privilege:"O3 Implementer Tools"},l().createElement(w,null))},N),M=(0,s.getSyncLifecycle)(()=>{let{isOpen:e}=(0,s.useStore)(a.bB),{t:n}=(0,i.useTranslation)();return l().createElement(s.UserHasAccess,{privilege:"O3 Implementer Tools"},l().createElement("div",{className:"-esm-implementer-tools__implementer-tools-styles__chevronImplementerToolsButton___sr-8d","data-testid":"globalImplementerToolsButton"},l().createElement("button",{type:"button",onClick:a.xq,"aria-label":n("toggleImplementerTools","Toggle Implementer Tools"),className:"-esm-implementer-tools__implementer-tools-styles__implementerToolsButton___gQojg"},e?l().createElement(s.ChevronDownIcon,{size:16}):l().createElement(s.ChevronUpIcon,{size:16}))))},N),D=(0,s.getSyncLifecycle)(()=>{let{t:e}=(0,i.useTranslation)(),{isOpen:n}=(0,s.useStore)(a.bB);return l().createElement(s.UserHasAccess,{privilege:"O3 Implementer Tools"},l().createElement(B.HeaderGlobalAction,{"aria-label":e("implementerTools","Implementer Tools"),"aria-labelledby":"Implementer Tools",className:"-esm-implementer-tools__implementer-tools-styles__toolStyles___Q2w5z",onClick:a.xq},n?l().createElement(s.CloseIcon,{size:20}):l().createElement(s.ToolsIcon,{size:20})))},N)},3639(e,n,t){"use strict";t.d(n,{bB:()=>o,s5:()=>r,xq:()=>s});let o=(0,t(5607).createGlobalStore)("implementer-tools",{activeItemDescription:null,configPathBeingEdited:null,isOpen:u(),hasAlert:!1,openTabIndex:0,isConfigToolbarOpen:c(),isUIEditorEnabled:p(),isJsonModeEnabled:d(),uiSelectedPath:null}),s=()=>o.setState(e=>({...e,isOpen:!e.isOpen,openTabIndex:0})),r=()=>o.setState(e=>({...e,isOpen:!0,openTabIndex:2})),l=u(),i=c(),a=p(),m=d();function u(){return JSON.parse(localStorage.getItem("openmrs:openmrsImplementerToolsAreOpen")||"false")??!1}function c(){return JSON.parse(localStorage.getItem("openmrs:openmrsImplementerToolsConfigOpen")||"true")??!0}function p(){return JSON.parse(localStorage.getItem("openmrs:isUIEditorEnabled")||"false")??!1}function d(){return JSON.parse(localStorage.getItem("openmrs:getIsJsonModeEnabled")||"false")??!1}o.subscribe(e=>{var n,t,o,s;e.isOpen!=l&&(n=e.isOpen,localStorage.setItem("openmrs:openmrsImplementerToolsAreOpen",JSON.stringify(n)),l=e.isOpen),e.isUIEditorEnabled!=a&&(t=e.isUIEditorEnabled,localStorage.setItem("openmrs:isUIEditorEnabled",JSON.stringify(t)),a=e.isUIEditorEnabled),e.isConfigToolbarOpen!=i&&(o=e.isConfigToolbarOpen,localStorage.setItem("openmrs:openmrsImplementerToolsConfigOpen",JSON.stringify(o)),i=e.isConfigToolbarOpen),e.isJsonModeEnabled!=m&&(s=e.isJsonModeEnabled,localStorage.setItem("openmrs:getIsJsonModeEnabled",JSON.stringify(s)),m=e.isJsonModeEnabled)})}}]);
|
package/dist/8088.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_implementer_tools_app=globalThis.webpackChunk_openmrs_esm_implementer_tools_app||[]).push([["8088"],{4955(e,t,l){l.r(t),l.d(t,{default:()=>eu});var n=l(6925),a=l.n(n),r=l(8326),o=l(9737),s=l(3004),i=l(8395),c=l(9685),m=l(3658),u=l(1819),d=l(1400),_=l(7961),p=l(3639);let E="-esm-implementer-tools__display-value__smallListCell___aYM3U";function f({value:e}){return a().createElement("div",null,Array.isArray(e)?"object"==typeof e[0]?e.map((e,t)=>a().createElement(r.StructuredListRow,{key:`${e}-${t}`},a().createElement(r.StructuredListCell,{className:E},t+1),a().createElement(r.StructuredListCell,{className:E},a().createElement(f,{value:e})))):`[ ${e.join(", ")} ]`:"object"==typeof e&&null!==e?Object.entries(e).map(([e,t],l)=>a().createElement(r.StructuredListRow,{key:`${e}-${l}`},a().createElement(r.StructuredListCell,{className:E},e),a().createElement(r.StructuredListCell,{className:E},a().createElement(f,{value:t})))):"string"==typeof e||"number"==typeof e?e:null==e?"none":JSON.stringify(e))}var g=l(4748);function y({element:e,valueArray:t,setValue:l}){let o=(0,n.useMemo)(()=>(0,g.A)("array-editor-"),[]),c=t??[];return a().createElement(r.Tile,{className:"-esm-implementer-tools__array-editor-styles__arrayEditor___rdN2h"},a().createElement(r.StructuredListWrapper,null,a().createElement(r.StructuredListBody,null,c.map((t,n)=>a().createElement(r.StructuredListRow,{key:`${o}-${n}`},a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{...e._elements,_value:t,_source:e._source},valueType:e._elements?._type??s.Type.Object,value:t,onChange:e=>{let t=(0,i.A)(c);t[n]=e,l(t)}})),a().createElement(r.StructuredListCell,{className:"-esm-implementer-tools__array-editor-styles__buttonCell___rURc1"},a().createElement(r.Button,{renderIcon:e=>a().createElement(s.TrashCanIcon,{...e,size:16}),size:"sm",kind:"ghost",iconDescription:"Remove",hasIconOnly:!0,onClick:()=>{let e=(0,i.A)(c);e.splice(n,1),l(e)}})))),a().createElement(r.StructuredListRow,null,a().createElement(r.StructuredListCell,null,a().createElement(r.Button,{renderIcon:e=>a().createElement(s.AddIcon,{...e,size:16}),size:"sm",iconDescription:"Add",hasIconOnly:!0,onClick:()=>{let t=(0,i.A)(c),n=(e._elements?._type??s.Type.Object)==s.Type.Object?{}:null;t.push(n),l(t)}}))))))}var b=l(749),h=l.n(b);let v="-esm-implementer-tools__uuid-search__bodyShort01___GnMyC",T="-esm-implementer-tools__uuid-search__activeUuid___fIkzQ",S="-esm-implementer-tools__uuid-search__autocomplete___Ij3lP",C="-esm-implementer-tools__uuid-search__listbox___E5zM+",N="-esm-implementer-tools__uuid-search__smallListCell___3PzmD";function k({setConcept:e,value:t}){let{t:l}=(0,o.useTranslation)(),i=(0,n.useMemo)(()=>(0,g.A)(),[]),[c,m]=(0,n.useState)(""),[u,d]=(0,n.useState)(t),{concepts:_,isSearchingConcepts:p}=function(e){let t=`${s.restBaseUrl}/concept/?q=${e}`,{data:l,error:n}=h()(e?t:null,s.openmrsFetch);return{concepts:l?.data?.results??[],error:n,isSearchingConcepts:!n&&!l}}(c);return a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`searchbox-${i}`,labelText:"",type:"text",size:"sm",autoComplete:"off",autoCapitalize:"off","aria-autocomplete":"list","aria-label":l("searchConceptHelperText","Search concepts"),"aria-controls":`searchbox-${i}`,"aria-expanded":_.length>0,placeholder:l("searchConceptHelperText","Search concepts"),onChange:e=>{m(e.target.value)}}),c?p?a().createElement(r.InlineLoading,{className:"-esm-implementer-tools__uuid-search__loader___2YuUQ",description:l("searching","Searching")+"..."}):_&&_.length&&!p?a().createElement(r.StructuredListWrapper,{selection:!0,id:`searchbox-${i}`,className:C},_.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option","aria-selected":"true"},a().createElement(r.StructuredListCell,{onClick:()=>{d(t.uuid),e(t),m("")},className:N},t.display)))):a().createElement(r.Tile,{className:"-esm-implementer-tools__uuid-search__emptyResults___eAdh0"},a().createElement("span",null,l("noConceptsFoundText","No matching concepts found"))):null))}let B=(0,m.getExtensionInternalStore)();function w({value:e,setValue:t}){let[l,o]=(0,n.useState)([]);return(0,n.useEffect)(()=>{function e(e){o(Object.keys(e.extensions))}return e(B.getState()),B.subscribe(e)},[]),a().createElement(r.FilterableMultiSelect,{id:"add-select",items:l.map(e=>({id:e,label:e})),placeholder:"Select extensions",onChange:e=>t(e.selectedItems.map(e=>e.id)),initialSelectedItems:e})}function x({slotName:e,slotModuleName:t,value:l,setValue:n}){let o=(0,m.useCandidateExtensions)(e).map(e=>e.id);return a().createElement(r.FilterableMultiSelect,{id:"add-select",items:o.map(e=>({id:e,label:e})),placeholder:"Select extensions",onChange:e=>n(e.selectedItems.map(e=>e.id)),initialSelectedItems:l,itemToString:e=>e?e?.label:""})}function I({element:e,valueObject:t,setValue:l}){return a().createElement(r.Tile,{className:"-esm-implementer-tools__object-editor-styles__objectEditor___DhdVF"},a().createElement(r.StructuredListWrapper,null,a().createElement(r.StructuredListBody,null,Object.entries(e).map(([n,o])=>n.startsWith("_")?null:a().createElement(r.StructuredListRow,{key:n},a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{_value:n,_source:e._source},valueType:s.Type.String,value:n,onChange:e=>{let a=(0,i.A)(t);a[e]=(0,i.A)(t[n]),delete a[n],l(a)}})),a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{...o,_value:t[n],_source:e._source},valueType:o._type,value:t[n],onChange:e=>{let a=(0,i.A)(t);a[n]=e,l(a)}})))))))}function A({slotName:e,slotModuleName:t,value:l,setValue:n}){return a().createElement("div",null,"Todo: compose array with extension lookup")}var L=l(2067);function M({setPersonAttributeUuid:e,value:t}){let[l,i]=(0,n.useState)(""),[c,m]=(0,n.useState)([]),[u,d]=(0,n.useState)(t),{t:_}=(0,o.useTranslation)(),p=(0,n.useMemo)(()=>(0,g.A)(),[]),E=(0,L.A)(e=>{i(e)},300);return(0,n.useEffect)(()=>{let e=new AbortController;if(l&&l.length>=2)(0,s.openmrsFetch)(`${s.restBaseUrl}/personattributetype/?q=${l}`,{method:"GET"}).then(({data:{results:e}})=>{m(e.slice(0,9))});else m([]);return()=>e.abort()},[l]),a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`search-input-${p}`,labelText:"",type:"text",size:"sm",autoComplete:"off",autoCapitalize:"off","aria-autocomplete":"list",role:"combobox","aria-label":_("searchPersonAttributeHelperText","Person attribute type name"),"aria-controls":`searchbox-${p}`,"aria-expanded":c.length>0,placeholder:_("searchPersonAttributeHelperText","Person attribute type name"),onChange:e=>{E(e.target.value)}}),!!c.length&&a().createElement(r.StructuredListWrapper,{selection:!0,className:C,id:`searchbox-${p}`},c.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option",onClick:()=>{d(t.uuid),i(""),m([]),e(t.uuid)},"aria-selected":"true"},a().createElement(r.StructuredListCell,{className:N},t.display)))),l&&c&&!c.length&&a().createElement("p",{className:v},_("noPersonAttributeFoundText","No matching results found"))))}function P({setPatientIdentifierTypeUuid:e,value:t}){let[l,i]=(0,n.useState)(""),{data:c,isLoading:m}=function(){let{data:e,error:t}=h()(`${s.restBaseUrl}/patientidentifiertype`,s.openmrsFetch);return(0,n.useMemo)(()=>({data:e?.data?.results,isLoading:!e&&!t}),[e,t])}(),[u,d]=(0,n.useState)(t),{t:_}=(0,o.useTranslation)(),p=(0,n.useMemo)(()=>(0,g.A)(),[]),E=(0,n.useMemo)(()=>!m&&l&&""!==l?c?.filter(e=>e.display.toLowerCase().includes(l.toLowerCase())):void 0,[m,l,c]);return a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`search-input-${p}`,labelText:"",type:"text",size:"sm",placeholder:m?_("loading","Loading"):_("searchPersonAttributeHelperText","Person attribute type name"),onChange:e=>i(e.target.value),value:l,disabled:m}),l?E?.length?a().createElement(r.StructuredListWrapper,{selection:!0,className:C,id:`searchbox-${p}`},E?.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option",onClick:()=>{d(t.uuid),e(t.uuid),i("")},"aria-selected":"true"},a().createElement(r.StructuredListCell,{className:N},t.display)))):a().createElement("p",{className:v},_("noPersonAttributeFoundText","No matching results found")):null))}function j({element:e,path:t,valueType:l,value:o,onChange:i,error:c}){let[m]=(0,n.useState)((0,g.A)("value-editor-"));if("remove"===l&&!t)throw Error("Programming error: ValueEditorField initialized for a 'remove' field, but no 'path' is available");return l===s.Type.Array?a().createElement(y,{element:e,valueArray:o,setValue:i}):l===s.Type.Boolean?a().createElement(r.Checkbox,{id:m,checked:o,hideLabel:!0,labelText:"",onChange:(e,{checked:t,id:l})=>i(t),invalid:!!c,invalidText:c}):l===s.Type.ConceptUuid?a().createElement(k,{value:o,setConcept:e=>i(e.uuid)}):l===s.Type.PersonAttributeTypeUuid?a().createElement(M,{value:o,setPersonAttributeUuid:e=>i(e)}):l===s.Type.PatientIdentifierTypeUuid?a().createElement(P,{value:o,setPatientIdentifierTypeUuid:e=>i(e)}):l===s.Type.Number?a().createElement(r.NumberInput,{id:m,value:o,onChange:(e,{value:t})=>i(t?"string"==typeof t?parseInt(t):t:0),hideSteppers:!0,invalid:!!c,invalidText:c}):l===s.Type.String||l===s.Type.UUID?a().createElement(r.TextInput,{id:m,value:o,labelText:"",onChange:e=>i(e.target.value),invalid:!!c,invalidText:c}):"add"===l?a().createElement(w,{value:o??e._value,setValue:i}):"remove"===l&&t?a().createElement(x,{slotName:t[2],slotModuleName:t[0],value:o??e._value,setValue:i}):"order"===l&&t?a().createElement(A,{slotName:t[2],slotModuleName:t[0],value:o??e._value,setValue:i}):"configure"===l&&t?a().createElement(a().Fragment,null,"Todo"):a().createElement(I,{element:e,valueObject:o,setValue:i})}let O=(e,t,l)=>(0,s.translateFrom)("@openmrs/esm-implementer-tools-app",e,t,l),V=(e,t,l)=>{if(!Array.isArray(e))return O("arrayValidationMessage","Value must be an array");for(let l of t){let t=l(e);if(t)return t}if(l)for(let t=0;t<e.length;t++){let n=e[t];if(l._type===s.Type.Object){let e=D(n,[],l);if(e)return e}else{let e=F(n,l._type,l._validators??[],l._elements);if(e)return e}}return null},D=(e,t,l)=>{if(!l||"object"!=typeof e||null===e||Array.isArray(e))return O("objectValidationMessage","Value must be an object");for(let l of t){let t=l(e);if(t)return t}for(let t of Object.keys(l)){if(t.startsWith("_"))continue;let n=l[t],a=e[t];if("object"==typeof n&&null!==n&&"_type"in n)if(n._type===s.Type.Array){let e=V(a,n._validators??[],n._elements);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}else{let e=F(a,n._type,n._validators??[],n._elements);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}else if("object"==typeof n&&null!==n){let e=D(a,[],n);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}}return null},F=(e,t,l,n)=>{switch(t){case s.Type.String:if("string"!=typeof e)return O("stringValidationMessage","Value must be a string");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Number:if("number"!=typeof e)return O("numberValidationMessage","Value must be a number");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Boolean:if("boolean"!=typeof e)return O("booleanValidationMessage","Value must be a boolean");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Array:return V(e,l,n);case s.Type.Object:return D(e,l,n);case s.Type.UUID||s.Type.ConceptUuid||s.Type.PersonAttributeTypeUuid||s.Type.PatientIdentifierTypeUuid:if("string"!=typeof e||!/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|[0-9A-Za-z]{11,36})$/i.test(e))return O("uuidValidationMessage","Value must be a valid UUID string");for(let t of l){let l=t(e);if(l)return l}return null;default:return null}};function R({element:e,customType:t,path:l,handleSaveToConfiguration:o,handleClose:i}){let c,m=(0,n.useRef)(null),[u,d]=(0,n.useState)(e._value),[_,p]=(0,n.useState)(null),E=t??e._type,f=e._validators??[];E===s.Type.Object?c=e:E===s.Type.Array&&(c=e._elements);let g=(0,n.useCallback)(()=>{let e=F(u,E,f,c);e?p(e):(p(null),o(JSON.stringify(u)))},[u,E,f,c,o]);return(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key?i():"Enter"===e.key&&g()};return document.addEventListener("keyup",e),()=>{document.removeEventListener("keyup",e)}},[g,i]),a().createElement("div",{ref:m},a().createElement(j,{element:e,path:l,value:u,onChange:d,valueType:E,error:_}),a().createElement("div",{className:"-esm-implementer-tools__value-editor-styles__errorMessage___tikHy"},E!==s.Type.Number&&E!==s.Type.String&&E!==s.Type.UUID&&E!==s.Type.Boolean&&_),a().createElement("div",{className:"-esm-implementer-tools__value-editor-styles__valueEditorButtons___n8IiM"},a().createElement(r.Button,{renderIcon:e=>a().createElement(s.SaveIcon,{...e,size:16}),kind:"primary",onClick:g},(0,s.getCoreTranslation)("save")),a().createElement(r.Button,{renderIcon:e=>a().createElement(s.CloseIcon,{...e,size:16}),kind:"secondary",onClick:i},(0,s.getCoreTranslation)("cancel"))))}let $={secretButton:"-esm-implementer-tools__editable-value-styles__secretButton___YI7El",error:"-esm-implementer-tools__editable-value-styles__error___2V3ef",overriddenValue:"-esm-implementer-tools__editable-value-styles__overriddenValue___M2WtA",elementValue:"-esm-implementer-tools__editable-value-styles__elementValue___4LWci",editValueButton:"-esm-implementer-tools__editable-value-styles__editValueButton___F6M4N"};function z({path:e,element:t,customType:l}){let[c,u]=(0,n.useState)(),[E,g]=(0,n.useState)(!1),[y,b]=(0,n.useState)(null),h=(0,n.useRef)(null),{t:v}=(0,o.useTranslation)(),T=()=>{g(!1),b(null)};return(0,n.useEffect)(()=>{let t=t=>{t.configPathBeingEdited&&(0,d.A)(t.configPathBeingEdited,e)&&h&&h.current&&(g(!0),h.current.focus())};return t(p.bB.getState()),p.bB.subscribe(t)},[]),(0,n.useEffect)(()=>{let l=p.bB.getState();E&&!(0,d.A)(l.configPathBeingEdited,e)&&p.bB.setState({configPathBeingEdited:e,activeItemDescription:{path:e,source:t._source,description:t._description,value:c}}),!E&&(0,d.A)(l.configPathBeingEdited,e)&&p.bB.setState({configPathBeingEdited:null})},[E]),a().createElement(a().Fragment,null,a().createElement("div",{className:$.line},E?a().createElement(a().Fragment,null,a().createElement(R,{element:t,customType:l,path:e,handleClose:T,handleSaveToConfiguration:t=>{try{let l=JSON.parse(t),n=function e(t,l,n){return l.length>1?t[l[0]]=e(t[l[0]]??{},l.slice(1),n):t[l[0]]=n,t}((0,i.A)(m.temporaryConfigStore.getState()),["config",...e],l);(0,m.clearConfigErrors)(e.join(".")),m.temporaryConfigStore.setState(n),u(t),T()}catch(e){console.warn(e),b("That's not formatted quite right. Try again.")}}})):a().createElement("div",{className:$.elementValue},a().createElement(f,{value:t._value}),a().createElement(r.Button,{kind:"ghost",size:"sm",iconDescription:v("editValueButtonText","Edit"),onClick:()=>g(!0),ref:h,renderIcon:e=>a().createElement(s.EditIcon,{size:16,...e}),hasIconOnly:!0}),"temporary config"==t._source?a().createElement(r.Button,{renderIcon:e=>a().createElement(s.ResetIcon,{size:16,...e}),size:"sm",kind:"ghost",iconDescription:v("resetToDefaultValueButtonText","Reset to default"),hasIconOnly:!0,onClick:()=>{(0,m.clearConfigErrors)(e.join("."));let t=(0,i.A)(m.temporaryConfigStore.getState());(0,_.A)(t,["config",...e]),m.temporaryConfigStore.setState(t)}}):null),y&&a().createElement("div",{className:$.error},y)))}function U({moduleName:e,slotName:t,config:l}){return a().createElement(z,{path:[e,t,"configure"],element:l&&Object.keys(l).length?{_value:l,_source:"",_default:{}}:{_value:void 0,_source:"default",_default:{}},customType:"configure"})}let H="-esm-implementer-tools__layout-styles__labelCell___3iEG5",W="-esm-implementer-tools__layout-styles__label___rSgg8",J="-esm-implementer-tools__layout-styles__structuredList___bWhdd",G="-esm-implementer-tools__layout-styles__structuredListRow___DuyVm",q=a().forwardRef(({leaf:e,label:t,children:l,onMouseEnter:n,onMouseLeave:o},s)=>e?a().createElement(r.StructuredListRow,{className:G,onMouseEnter:n,onMouseLeave:o},a().createElement(r.StructuredListCell,{className:H},a().createElement("span",{className:W,ref:s},t)),a().createElement(r.StructuredListCell,null,l)):a().createElement(a().Fragment,null,a().createElement(r.StructuredListRow,{className:G,onMouseEnter:n,onMouseLeave:o},a().createElement(r.StructuredListCell,{className:H},a().createElement("span",{className:W,ref:s},t)),a().createElement(r.StructuredListCell,null)),a().createElement(r.StructuredListRow,{className:G},a().createElement(r.StructuredListCell,null),a().createElement(r.StructuredListCell,{className:"-esm-implementer-tools__layout-styles__subtreeCell___YTBkc"},a().createElement(r.StructuredListWrapper,{className:J},a().createElement(r.StructuredListBody,null,l))))));var Y=l(3366);function K({extensionsConfig:e,moduleName:t}){return e&&Object.keys(e).length?a().createElement(q,{label:"extension slots",leaf:!1},Object.keys(e).map(l=>a().createElement(Q,{key:l,config:e?.[l],path:[t,"extensionSlots",l]}))):null}function Q({config:e,path:t}){let l=t[0],r=t[2],o=(0,m.useCandidateExtensions)(r),{uiSelectedPath:s}=(0,Y.Pj)(p.bB),i=(0,n.useRef)(null);function c(e){let t=p.bB.getState();(0,d.A)(t.activeItemDescription?.path,e)&&!(0,d.A)(t.configPathBeingEdited,e)&&p.bB.setState({activeItemDescription:void 0})}return(0,n.useEffect)(()=>{(0,d.A)(s,t)&&i.current?.scrollIntoView()},[s]),a().createElement(q,{label:r,ref:i,leaf:!1,onMouseEnter:()=>{!p.bB.getState().configPathBeingEdited&&p.bB.setState({activeItemDescription:{path:[l,r],value:o.map(e=>e.id)}})},onMouseLeave:()=>c([l,r])},["add","remove","order","configure"].map(n=>a().createElement(q,{label:n,key:t.join(".")+n,leaf:!0,onMouseEnter:()=>{var t;return t=e?.[n],void(!p.bB.getState().configPathBeingEdited&&p.bB.setState({activeItemDescription:{path:[l,r,n],source:t?._source,description:{add:"Add an extension to this slot.",remove:"Remove an extension from this slot.",order:"Reorder the extensions in this slot.",configure:"Pass a configuration object directly to one of the extensions in this slot."}[n],value:JSON.stringify(t?._value)}}))},onMouseLeave:()=>c([l,r,n])},"configure"===n?a().createElement(U,{moduleName:l,slotName:r,config:e?.configure?._value}):a().createElement(z,{path:t.concat([n]),element:e?.[n]??{_value:void 0,_source:"default",_default:[]},customType:n}))))}function X({config:e,path:t=[]}){return a().createElement(a().Fragment,null,Object.entries(e).filter(([e])=>!e.startsWith("_")).map(([e,l])=>{let n=t.concat([e]),r=l&&"object"==typeof l&&Object.hasOwn(l,"_value");return a().createElement(q,{label:e,leaf:r,onMouseEnter:()=>(function(e,t){if(!p.bB.getState().configPathBeingEdited){let l=t&&"object"==typeof t&&Object.hasOwn(t,"_value");p.bB.setState({activeItemDescription:{path:e,source:l?t._source:void 0,description:l?t._description:void 0,value:l?JSON.stringify(t._value):void 0}})}})(n,l),onMouseLeave:()=>{let e;return e=p.bB.getState(),void((0,d.A)(e.activeItemDescription?.path,n)&&!(0,d.A)(e.configPathBeingEdited,n)&&p.bB.setState({activeItemDescription:void 0}))},key:`subtree-${n.join(".")}`},r?a().createElement(z,{path:n,element:l}):a().createElement(X,{config:l,path:n}))}))}function Z({children:e}){return a().createElement(r.StructuredListWrapper,{className:J},a().createElement(r.StructuredListBody,null,e))}function ee({config:e,moduleName:t}){return a().createElement(Z,null,a().createElement(K,{extensionsConfig:e.extensionSlots,moduleName:t}),a().createElement(X,{config:(0,u.A)(e,(e,t)=>"extensionSlots"!==t),path:[t]}))}function et({config:e}){let{uiSelectedPath:t}=(0,Y.Pj)(p.bB),l=t?.[0];return a().createElement(r.Accordion,{align:"start"},e&&Object.keys(e).sort().map(t=>{let n=e[t];return Object.keys(n).length?a().createElement(r.AccordionItem,{title:a().createElement("h6",null,t),className:"-esm-implementer-tools__config-tree-styles__fullWidthAccordion___9hGTP",key:`accordion-${t}`,open:l==t||void 0},a().createElement(ee,{config:n,moduleName:t,key:`${t}-config`})):null}))}function el(){let{t:e}=(0,o.useTranslation)(),{activeItemDescription:t}=(0,s.useStore)(p.bB);return a().createElement("div",null,t?a().createElement(a().Fragment,null,a().createElement("h2",{className:"-esm-implementer-tools__description-styles__path___hDPpD"},t.path.slice(1).join(" → ")),a().createElement("p",{className:"-esm-implementer-tools__description-styles__description___m9fKN"},t.description),a().createElement("p",{className:"-esm-implementer-tools__description-styles__source___DxMuN"},"default"===t.source?a().createElement(a().Fragment,null,e("itemDescriptionSourceDefaultText","The current value is the default.")):t.source?a().createElement(a().Fragment,null,e("activeItemSourceText","The current value comes from "),t.source):null),t.value?a().createElement("h4",{className:"-esm-implementer-tools__description-styles__productiveHeading01___YbPWR"},e("value","Value")):null,a().createElement("p",{className:"-esm-implementer-tools__description-styles__value___zxS02"},Array.isArray(t.value)?t.value.map((e,t)=>a().createElement("p",{key:`item-description-value-${t}`},JSON.stringify(e))):JSON.stringify(t.value))):null)}let en={tools:"-esm-implementer-tools__configuration-styles__tools___Srvb6",toolbar:"-esm-implementer-tools__configuration-styles__toolbar___TAdcZ",row:"-esm-implementer-tools__configuration-styles__row___kKqeg",downloadLink:"-esm-implementer-tools__configuration-styles__downloadLink___hX3Dd",mainContent:"-esm-implementer-tools__configuration-styles__mainContent___Y9vzR",configTreePane:"-esm-implementer-tools__configuration-styles__configTreePane___vEp56",descriptionPane:"-esm-implementer-tools__configuration-styles__descriptionPane___eVgAz",toggleToolbarButton:"-esm-implementer-tools__configuration-styles__toggleToolbarButton___RRbqb",toggleButtons:"-esm-implementer-tools__configuration-styles__toggleButtons___XG6Cm",actionButtons:"-esm-implementer-tools__configuration-styles__actionButtons___4jXmw"},ea=a().lazy(()=>Promise.all([l.e("932"),l.e("1389")]).then(l.bind(l,4860))),er={toggleIsUIEditorEnabled:({isUIEditorEnabled:e})=>({isUIEditorEnabled:!e}),toggleIsToolbarOpen:({isConfigToolbarOpen:e})=>({isConfigToolbarOpen:!e}),toggleIsJsonModeEnabled:({isJsonModeEnabled:e})=>({isJsonModeEnabled:!e})},eo=({isConfigToolbarOpen:e,toggleIsToolbarOpen:t})=>a().createElement(r.Button,{hasIconOnly:!0,renderIcon:e?m.ChevronUpIcon:m.ChevronDownIcon,onClick:t,kind:"ghost",size:"sm",tooltipPosition:"left",iconDescription:`${e?"Hide":"Show"} toolbar`}),es=()=>{let{t:e}=(0,o.useTranslation)(),{isUIEditorEnabled:t,toggleIsUIEditorEnabled:l,isJsonModeEnabled:s,toggleIsJsonModeEnabled:u,isConfigToolbarOpen:d,toggleIsToolbarOpen:_}=(0,m.useStoreWithActions)(p.bB,er),{config:E,derivationError:f}=(0,m.useStore)(m.implementerToolsConfigStore),g=(0,m.useStore)((0,m.getExtensionInternalStore)()),y=(0,m.useStore)(m.temporaryConfigStore),[b,h]=(0,n.useState)(""),v=new Blob([JSON.stringify(y.config,void 0,2)],{type:"application/json"}),T=(0,n.useMemo)(()=>{let e=(0,i.A)(E);for(let t of Object.values(g.slots))t.moduleName&&(e[t.moduleName].extensionSlots||(e[t.moduleName].extensionSlots={}),e[t.moduleName].extensionSlots[t.name]||(e[t.moduleName].extensionSlots[t.name]={}));return e},[E,g]),S=(0,n.useMemo)(()=>b?function e(t,l){let n={};for(let r of Object.keys(t))if(r.includes(l))n[r]=(0,i.A)(t[r]);else{var a;if(!((a=t[r]).hasOwnProperty("_default")||a._type||a.hasOwnProperty("_value")||a.hasOwnProperty("_source"))){let a=e(t[r],l);(0,c.A)(a)||(n[r]=a)}}return n}(T,b):T,[b,T]),C=d?"calc(50vh - 7rem)":"calc(50vh - 2rem)";return a().createElement(a().Fragment,null,a().createElement("div",{className:en.tools},a().createElement("div",{className:en.toggleToolbarButton},a().createElement(eo,{isConfigToolbarOpen:d,toggleIsToolbarOpen:_})),d?a().createElement(r.FlexGrid,{style:{padding:"0.5em 1.5em"}},a().createElement(r.Row,{className:en.row},a().createElement(r.Column,null,a().createElement(r.TextInput,{id:"extensionSearch",labelText:e("searchConfiguration","Search configuration"),onChange:e=>h(e.target.value),autoComplete:"off"})),a().createElement(r.Column,{className:en.toggleButtons},a().createElement(r.Toggle,{className:en.toggle,id:"jsonModeSwitch",labelText:e("jsonEditor","JSON editor"),onToggle:u,toggled:s}),a().createElement(r.Toggle,{className:en.toggle,id:"uiEditorSwitch",labelText:e("uiEditor","UI editor"),toggled:t,onToggle:l})),a().createElement(r.Column,{className:en.actionButtons},a().createElement(r.Button,{kind:"danger",iconDescription:"Clear local config",renderIcon:e=>a().createElement(m.TrashCanIcon,{size:16,...e}),onClick:()=>{(0,m.clearConfigErrors)(),m.temporaryConfigStore.setState({config:{}})}},e("clearConfig","Clear local config")),a().createElement(r.Button,{kind:"secondary",iconDescription:"Download config",renderIcon:e=>a().createElement(m.DownloadIcon,{size:16,...e}),onClick:e=>{"downloadConfigBtn"!=e.target.id&&document.getElementById("downloadConfigBtn")?.click()}},a().createElement("a",{id:"downloadConfigBtn",className:en.downloadLink,download:"temporary_config.json",href:window.URL.createObjectURL(v)},e("downloadConfig","Download config")))))):null),f?a().createElement(r.InlineNotification,{kind:"error",lowContrast:!0,hideCloseButton:!0,title:e("configDerivationFailed","This configuration is out of date"),subtitle:`${e("configDerivationFailedSubtitle","The configuration could not be rebuilt, so what is shown below is the last version that did build.")} ${f}`}):null,a().createElement("div",{className:en.mainContent,style:{height:C}},s?a().createElement(ea,{height:C}):a().createElement(a().Fragment,null,a().createElement("div",{className:en.configTreePane},a().createElement(et,{config:S})),a().createElement("div",{className:en.descriptionPane},a().createElement(el,null)))))},ei=({frontendModules:e})=>{let{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"name",header:t("moduleName","Module Name")},{key:"installedVersion",header:t("installedVersion","Installed Version")}],[t]);return a().createElement("div",{className:"-esm-implementer-tools__frontend-modules__container___WFDQG"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:l,getTableProps:o,getHeaderProps:s})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,o(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,l.map(e=>a().createElement(r.TableHeader,s({header:e}),e.header)))),a().createElement(r.TableBody,null,e.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__frontend-modules__moduleHeader___rJZBG"},e.name)),a().createElement(r.TableCell,null,e.version??t("unknownVersion","unknown"))),e.extensions?a().createElement(r.TableRow,{key:`${e.name}-extensions-header`},a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__frontend-modules__moduleComponentHeader___jYzBt"},t("extensions","Extensions"))),a().createElement(r.TableCell,null)):null,(e.extensions??[]).map((t,l)=>a().createElement(r.TableRow,{key:`${e.name}-page-${l}`},a().createElement(r.TableCell,null,t.name),a().createElement(r.TableCell,null))))))))))},ec=({backendDependencies:e})=>{let{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"name",header:t("moduleName","Module Name")},{key:"installedVersion",header:t("installedVersion","Installed version")},{key:"requiredVersion",header:t("requiredVersion","Required version")}],[t]);return a().createElement("div",{className:"-esm-implementer-tools__backend-dependencies-styles__container___0tseS"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:l,getTableProps:o,getHeaderProps:s})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,o(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,l.map(e=>a().createElement(r.TableHeader,s({header:e}),e.header)))),a().createElement(r.TableBody,null,e.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__backend-dependencies-styles__moduleHeader___xPytm"},e.name)),a().createElement(r.TableCell,null),a().createElement(r.TableCell,null)),e.dependencies.map(e=>a().createElement(r.TableRow,{key:e.name},a().createElement(r.TableCell,null,e.name),a().createElement(r.TableCell,null,"missing"===e.type?a().createElement("span",{style:{color:"red"}},t("missing","Missing")):"version-mismatch"===e.type?a().createElement("span",{style:{color:"red"}},e.installedVersion):a().createElement("span",null,e.installedVersion)),a().createElement(r.TableCell,null,e.requiredVersion))))))))))};function em(){let{flags:e}=(0,s.useStore)(m.featureFlagsStore),{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"label",header:t("featureFlag","Feature Flag")},{key:"description",header:t("description","Description")},{key:"enabled",header:t("enabled","Enabled")}],[t]),i=(0,n.useMemo)(()=>Object.entries(e).sort(([e,t],[l,n])=>(t.label??e).localeCompare(n.label||l)).map(([e,{enabled:t,label:l,description:n}])=>({name:e,enabled:t,label:l,description:n})),[e]);return a().createElement("div",{className:"-esm-implementer-tools__feature-flags__container___cDCki"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:e,getTableProps:t,getHeaderProps:l})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,t(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,e.map(e=>a().createElement(r.TableHeader,l({header:e}),e.header)))),a().createElement(r.TableBody,null,i.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("div",{id:`flag-label-${e.name}`,className:"-esm-implementer-tools__feature-flags__header___iJcLP"},e.label),a().createElement("div",{className:"-esm-implementer-tools__feature-flags__helper___mGyu3"},e.name)),a().createElement(r.TableCell,null,a().createElement("span",null,e.description)),a().createElement(r.TableCell,null,a().createElement(r.Toggle,{id:`feature-flag-${e.name}-toggle`,"aria-labelledby":`flag-label-${e.name}`,labelText:"",hideLabel:!0,toggled:e.enabled,onToggle:()=>(0,m.setFeatureFlag)(e.name,!e.enabled)}))))))))))}function eu({close:e,frontendModules:t,backendDependencies:l,visibleTabIndex:i=0}){let{t:c}=(0,o.useTranslation)(),[m,u]=(0,n.useState)(i||0),d=(0,n.useMemo)(()=>0==m?a().createElement(es,null):1===m?a().createElement(ei,{frontendModules:t}):2===m?a().createElement(ec,{backendDependencies:l}):a().createElement(em,null),[m,l,t]);return a().createElement("div",{className:"-esm-implementer-tools__popup-styles__popup___MPkfI"},a().createElement(r.Theme,{theme:"g90"},a().createElement("div",{className:"-esm-implementer-tools__popup-styles__topBar___VryOt"},a().createElement("div",{className:"-esm-implementer-tools__popup-styles__tabs___O2ml7"},a().createElement(r.ContentSwitcher,{className:"-esm-implementer-tools__popup-styles__contentSwitcher___pk43o",selectedIndex:m,onChange:e=>{u(e.index)},size:"lg"},a().createElement(r.Switch,{name:"configuration-tab",text:c("configuration","Configuration"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"frontend-modules-tab",text:c("frontendModules","Frontend modules"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"backend-modules-tab",text:c("backendModules","Backend modules"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"feature-flags-tab",text:c("featureFlags","Feature flags"),className:"darkThemeSwitch"}))),a().createElement("div",null,a().createElement(r.IconButton,{align:"left",className:"-esm-implementer-tools__popup-styles__closeButton___nDcEG",kind:"secondary",label:c("close","Close"),onClick:e},a().createElement(s.CloseIcon,null)))),a().createElement("div",{className:"-esm-implementer-tools__popup-styles__content___KyNJO"},d)))}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_implementer_tools_app=globalThis.webpackChunk_openmrs_esm_implementer_tools_app||[]).push([["8088"],{4955(e,t,l){l.r(t),l.d(t,{default:()=>eu});var n=l(6925),a=l.n(n),r=l(8326),o=l(9737),s=l(5607),i=l(8395),c=l(9685),m=l(3658),u=l(1819),d=l(1400),_=l(7961),p=l(3639);let E="-esm-implementer-tools__display-value__smallListCell___aYM3U";function f({value:e}){return a().createElement("div",null,Array.isArray(e)?"object"==typeof e[0]?e.map((e,t)=>a().createElement(r.StructuredListRow,{key:`${e}-${t}`},a().createElement(r.StructuredListCell,{className:E},t+1),a().createElement(r.StructuredListCell,{className:E},a().createElement(f,{value:e})))):`[ ${e.join(", ")} ]`:"object"==typeof e&&null!==e?Object.entries(e).map(([e,t],l)=>a().createElement(r.StructuredListRow,{key:`${e}-${l}`},a().createElement(r.StructuredListCell,{className:E},e),a().createElement(r.StructuredListCell,{className:E},a().createElement(f,{value:t})))):"string"==typeof e||"number"==typeof e?e:null==e?"none":JSON.stringify(e))}var g=l(4748);function y({element:e,valueArray:t,setValue:l}){let o=(0,n.useMemo)(()=>(0,g.A)("array-editor-"),[]),c=t??[];return a().createElement(r.Tile,{className:"-esm-implementer-tools__array-editor-styles__arrayEditor___rdN2h"},a().createElement(r.StructuredListWrapper,null,a().createElement(r.StructuredListBody,null,c.map((t,n)=>a().createElement(r.StructuredListRow,{key:`${o}-${n}`},a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{...e._elements,_value:t,_source:e._source},valueType:e._elements?._type??s.Type.Object,value:t,onChange:e=>{let t=(0,i.A)(c);t[n]=e,l(t)}})),a().createElement(r.StructuredListCell,{className:"-esm-implementer-tools__array-editor-styles__buttonCell___rURc1"},a().createElement(r.Button,{renderIcon:e=>a().createElement(s.TrashCanIcon,{...e,size:16}),size:"sm",kind:"ghost",iconDescription:"Remove",hasIconOnly:!0,onClick:()=>{let e=(0,i.A)(c);e.splice(n,1),l(e)}})))),a().createElement(r.StructuredListRow,null,a().createElement(r.StructuredListCell,null,a().createElement(r.Button,{renderIcon:e=>a().createElement(s.AddIcon,{...e,size:16}),size:"sm",iconDescription:"Add",hasIconOnly:!0,onClick:()=>{let t=(0,i.A)(c),n=(e._elements?._type??s.Type.Object)==s.Type.Object?{}:null;t.push(n),l(t)}}))))))}var b=l(749),h=l.n(b);let v="-esm-implementer-tools__uuid-search__bodyShort01___GnMyC",T="-esm-implementer-tools__uuid-search__activeUuid___fIkzQ",S="-esm-implementer-tools__uuid-search__autocomplete___Ij3lP",C="-esm-implementer-tools__uuid-search__listbox___E5zM+",N="-esm-implementer-tools__uuid-search__smallListCell___3PzmD";function k({setConcept:e,value:t}){let{t:l}=(0,o.useTranslation)(),i=(0,n.useMemo)(()=>(0,g.A)(),[]),[c,m]=(0,n.useState)(""),[u,d]=(0,n.useState)(t),{concepts:_,isSearchingConcepts:p}=function(e){let t=`${s.restBaseUrl}/concept/?q=${e}`,{data:l,error:n}=h()(e?t:null,s.openmrsFetch);return{concepts:l?.data?.results??[],error:n,isSearchingConcepts:!n&&!l}}(c);return a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`searchbox-${i}`,labelText:"",type:"text",size:"sm",autoComplete:"off",autoCapitalize:"off","aria-autocomplete":"list","aria-label":l("searchConceptHelperText","Search concepts"),"aria-controls":`searchbox-${i}`,"aria-expanded":_.length>0,placeholder:l("searchConceptHelperText","Search concepts"),onChange:e=>{m(e.target.value)}}),c?p?a().createElement(r.InlineLoading,{className:"-esm-implementer-tools__uuid-search__loader___2YuUQ",description:l("searching","Searching")+"..."}):_&&_.length&&!p?a().createElement(r.StructuredListWrapper,{selection:!0,id:`searchbox-${i}`,className:C},_.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option","aria-selected":"true"},a().createElement(r.StructuredListCell,{onClick:()=>{d(t.uuid),e(t),m("")},className:N},t.display)))):a().createElement(r.Tile,{className:"-esm-implementer-tools__uuid-search__emptyResults___eAdh0"},a().createElement("span",null,l("noConceptsFoundText","No matching concepts found"))):null))}let B=(0,m.getExtensionInternalStore)();function w({value:e,setValue:t}){let[l,o]=(0,n.useState)([]);return(0,n.useEffect)(()=>{function e(e){o(Object.keys(e.extensions))}return e(B.getState()),B.subscribe(e)},[]),a().createElement(r.FilterableMultiSelect,{id:"add-select",items:l.map(e=>({id:e,label:e})),placeholder:"Select extensions",onChange:e=>t(e.selectedItems.map(e=>e.id)),initialSelectedItems:e})}function x({slotName:e,slotModuleName:t,value:l,setValue:n}){let o=(0,m.useCandidateExtensions)(e).map(e=>e.id);return a().createElement(r.FilterableMultiSelect,{id:"add-select",items:o.map(e=>({id:e,label:e})),placeholder:"Select extensions",onChange:e=>n(e.selectedItems.map(e=>e.id)),initialSelectedItems:l,itemToString:e=>e?e?.label:""})}function I({element:e,valueObject:t,setValue:l}){return a().createElement(r.Tile,{className:"-esm-implementer-tools__object-editor-styles__objectEditor___DhdVF"},a().createElement(r.StructuredListWrapper,null,a().createElement(r.StructuredListBody,null,Object.entries(e).map(([n,o])=>n.startsWith("_")?null:a().createElement(r.StructuredListRow,{key:n},a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{_value:n,_source:e._source},valueType:s.Type.String,value:n,onChange:e=>{let a=(0,i.A)(t);a[e]=(0,i.A)(t[n]),delete a[n],l(a)}})),a().createElement(r.StructuredListCell,null,a().createElement(j,{element:{...o,_value:t[n],_source:e._source},valueType:o._type,value:t[n],onChange:e=>{let a=(0,i.A)(t);a[n]=e,l(a)}})))))))}function A({slotName:e,slotModuleName:t,value:l,setValue:n}){return a().createElement("div",null,"Todo: compose array with extension lookup")}var L=l(2067);function M({setPersonAttributeUuid:e,value:t}){let[l,i]=(0,n.useState)(""),[c,m]=(0,n.useState)([]),[u,d]=(0,n.useState)(t),{t:_}=(0,o.useTranslation)(),p=(0,n.useMemo)(()=>(0,g.A)(),[]),E=(0,L.A)(e=>{i(e)},300);return(0,n.useEffect)(()=>{let e=new AbortController;if(l&&l.length>=2)(0,s.openmrsFetch)(`${s.restBaseUrl}/personattributetype/?q=${l}`,{method:"GET"}).then(({data:{results:e}})=>{m(e.slice(0,9))});else m([]);return()=>e.abort()},[l]),a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`search-input-${p}`,labelText:"",type:"text",size:"sm",autoComplete:"off",autoCapitalize:"off","aria-autocomplete":"list",role:"combobox","aria-label":_("searchPersonAttributeHelperText","Person attribute type name"),"aria-controls":`searchbox-${p}`,"aria-expanded":c.length>0,placeholder:_("searchPersonAttributeHelperText","Person attribute type name"),onChange:e=>{E(e.target.value)}}),!!c.length&&a().createElement(r.StructuredListWrapper,{selection:!0,className:C,id:`searchbox-${p}`},c.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option",onClick:()=>{d(t.uuid),i(""),m([]),e(t.uuid)},"aria-selected":"true"},a().createElement(r.StructuredListCell,{className:N},t.display)))),l&&c&&!c.length&&a().createElement("p",{className:v},_("noPersonAttributeFoundText","No matching results found"))))}function P({setPatientIdentifierTypeUuid:e,value:t}){let[l,i]=(0,n.useState)(""),{data:c,isLoading:m}=function(){let{data:e,error:t}=h()(`${s.restBaseUrl}/patientidentifiertype`,s.openmrsFetch);return(0,n.useMemo)(()=>({data:e?.data?.results,isLoading:!e&&!t}),[e,t])}(),[u,d]=(0,n.useState)(t),{t:_}=(0,o.useTranslation)(),p=(0,n.useMemo)(()=>(0,g.A)(),[]),E=(0,n.useMemo)(()=>!m&&l&&""!==l?c?.filter(e=>e.display.toLowerCase().includes(l.toLowerCase())):void 0,[m,l,c]);return a().createElement("div",null,u&&a().createElement("p",{className:T},u),a().createElement("div",{className:S},a().createElement(r.Search,{id:`search-input-${p}`,labelText:"",type:"text",size:"sm",placeholder:m?_("loading","Loading"):_("searchPersonAttributeHelperText","Person attribute type name"),onChange:e=>i(e.target.value),value:l,disabled:m}),l?E?.length?a().createElement(r.StructuredListWrapper,{selection:!0,className:C,id:`searchbox-${p}`},E?.map(t=>a().createElement(r.StructuredListRow,{key:t.uuid,role:"option",onClick:()=>{d(t.uuid),e(t.uuid),i("")},"aria-selected":"true"},a().createElement(r.StructuredListCell,{className:N},t.display)))):a().createElement("p",{className:v},_("noPersonAttributeFoundText","No matching results found")):null))}function j({element:e,path:t,valueType:l,value:o,onChange:i,error:c}){let[m]=(0,n.useState)((0,g.A)("value-editor-"));if("remove"===l&&!t)throw Error("Programming error: ValueEditorField initialized for a 'remove' field, but no 'path' is available");return l===s.Type.Array?a().createElement(y,{element:e,valueArray:o,setValue:i}):l===s.Type.Boolean?a().createElement(r.Checkbox,{id:m,checked:o,hideLabel:!0,labelText:"",onChange:(e,{checked:t,id:l})=>i(t),invalid:!!c,invalidText:c}):l===s.Type.ConceptUuid?a().createElement(k,{value:o,setConcept:e=>i(e.uuid)}):l===s.Type.PersonAttributeTypeUuid?a().createElement(M,{value:o,setPersonAttributeUuid:e=>i(e)}):l===s.Type.PatientIdentifierTypeUuid?a().createElement(P,{value:o,setPatientIdentifierTypeUuid:e=>i(e)}):l===s.Type.Number?a().createElement(r.NumberInput,{id:m,value:o,onChange:(e,{value:t})=>i(t?"string"==typeof t?parseInt(t):t:0),hideSteppers:!0,invalid:!!c,invalidText:c}):l===s.Type.String||l===s.Type.UUID?a().createElement(r.TextInput,{id:m,value:o,labelText:"",onChange:e=>i(e.target.value),invalid:!!c,invalidText:c}):"add"===l?a().createElement(w,{value:o??e._value,setValue:i}):"remove"===l&&t?a().createElement(x,{slotName:t[2],slotModuleName:t[0],value:o??e._value,setValue:i}):"order"===l&&t?a().createElement(A,{slotName:t[2],slotModuleName:t[0],value:o??e._value,setValue:i}):"configure"===l&&t?a().createElement(a().Fragment,null,"Todo"):a().createElement(I,{element:e,valueObject:o,setValue:i})}let O=(e,t,l)=>(0,s.translateFrom)("@openmrs/esm-implementer-tools-app",e,t,l),V=(e,t,l)=>{if(!Array.isArray(e))return O("arrayValidationMessage","Value must be an array");for(let l of t){let t=l(e);if(t)return t}if(l)for(let t=0;t<e.length;t++){let n=e[t];if(l._type===s.Type.Object){let e=D(n,[],l);if(e)return e}else{let e=F(n,l._type,l._validators??[],l._elements);if(e)return e}}return null},D=(e,t,l)=>{if(!l||"object"!=typeof e||null===e||Array.isArray(e))return O("objectValidationMessage","Value must be an object");for(let l of t){let t=l(e);if(t)return t}for(let t of Object.keys(l)){if(t.startsWith("_"))continue;let n=l[t],a=e[t];if("object"==typeof n&&null!==n&&"_type"in n)if(n._type===s.Type.Array){let e=V(a,n._validators??[],n._elements);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}else{let e=F(a,n._type,n._validators??[],n._elements);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}else if("object"==typeof n&&null!==n){let e=D(a,[],n);if(e)return O("objectPropertyValidationMessage","Property {{key}}: {{error}}",{key:t,error:e})}}return null},F=(e,t,l,n)=>{switch(t){case s.Type.String:if("string"!=typeof e)return O("stringValidationMessage","Value must be a string");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Number:if("number"!=typeof e)return O("numberValidationMessage","Value must be a number");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Boolean:if("boolean"!=typeof e)return O("booleanValidationMessage","Value must be a boolean");for(let t of l){let l=t(e);if(l)return l}return null;case s.Type.Array:return V(e,l,n);case s.Type.Object:return D(e,l,n);case s.Type.UUID||s.Type.ConceptUuid||s.Type.PersonAttributeTypeUuid||s.Type.PatientIdentifierTypeUuid:if("string"!=typeof e||!/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|[0-9A-Za-z]{11,36})$/i.test(e))return O("uuidValidationMessage","Value must be a valid UUID string");for(let t of l){let l=t(e);if(l)return l}return null;default:return null}};function R({element:e,customType:t,path:l,handleSaveToConfiguration:o,handleClose:i}){let c,m=(0,n.useRef)(null),[u,d]=(0,n.useState)(e._value),[_,p]=(0,n.useState)(null),E=t??e._type,f=e._validators??[];E===s.Type.Object?c=e:E===s.Type.Array&&(c=e._elements);let g=(0,n.useCallback)(()=>{let e=F(u,E,f,c);e?p(e):(p(null),o(JSON.stringify(u)))},[u,E,f,c,o]);return(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key?i():"Enter"===e.key&&g()};return document.addEventListener("keyup",e),()=>{document.removeEventListener("keyup",e)}},[g,i]),a().createElement("div",{ref:m},a().createElement(j,{element:e,path:l,value:u,onChange:d,valueType:E,error:_}),a().createElement("div",{className:"-esm-implementer-tools__value-editor-styles__errorMessage___tikHy"},E!==s.Type.Number&&E!==s.Type.String&&E!==s.Type.UUID&&E!==s.Type.Boolean&&_),a().createElement("div",{className:"-esm-implementer-tools__value-editor-styles__valueEditorButtons___n8IiM"},a().createElement(r.Button,{renderIcon:e=>a().createElement(s.SaveIcon,{...e,size:16}),kind:"primary",onClick:g},(0,s.getCoreTranslation)("save")),a().createElement(r.Button,{renderIcon:e=>a().createElement(s.CloseIcon,{...e,size:16}),kind:"secondary",onClick:i},(0,s.getCoreTranslation)("cancel"))))}let $={secretButton:"-esm-implementer-tools__editable-value-styles__secretButton___YI7El",error:"-esm-implementer-tools__editable-value-styles__error___2V3ef",overriddenValue:"-esm-implementer-tools__editable-value-styles__overriddenValue___M2WtA",elementValue:"-esm-implementer-tools__editable-value-styles__elementValue___4LWci",editValueButton:"-esm-implementer-tools__editable-value-styles__editValueButton___F6M4N"};function z({path:e,element:t,customType:l}){let[c,u]=(0,n.useState)(),[E,g]=(0,n.useState)(!1),[y,b]=(0,n.useState)(null),h=(0,n.useRef)(null),{t:v}=(0,o.useTranslation)(),T=()=>{g(!1),b(null)};return(0,n.useEffect)(()=>{let t=t=>{t.configPathBeingEdited&&(0,d.A)(t.configPathBeingEdited,e)&&h&&h.current&&(g(!0),h.current.focus())};return t(p.bB.getState()),p.bB.subscribe(t)},[]),(0,n.useEffect)(()=>{let l=p.bB.getState();E&&!(0,d.A)(l.configPathBeingEdited,e)&&p.bB.setState({configPathBeingEdited:e,activeItemDescription:{path:e,source:t._source,description:t._description,value:c}}),!E&&(0,d.A)(l.configPathBeingEdited,e)&&p.bB.setState({configPathBeingEdited:null})},[E]),a().createElement(a().Fragment,null,a().createElement("div",{className:$.line},E?a().createElement(a().Fragment,null,a().createElement(R,{element:t,customType:l,path:e,handleClose:T,handleSaveToConfiguration:t=>{try{let l=JSON.parse(t),n=function e(t,l,n){return l.length>1?t[l[0]]=e(t[l[0]]??{},l.slice(1),n):t[l[0]]=n,t}((0,i.A)(m.temporaryConfigStore.getState()),["config",...e],l);(0,m.clearConfigErrors)(e.join(".")),m.temporaryConfigStore.setState(n),u(t),T()}catch(e){console.warn(e),b("That's not formatted quite right. Try again.")}}})):a().createElement("div",{className:$.elementValue},a().createElement(f,{value:t._value}),a().createElement(r.Button,{kind:"ghost",size:"sm",iconDescription:v("editValueButtonText","Edit"),onClick:()=>g(!0),ref:h,renderIcon:e=>a().createElement(s.EditIcon,{size:16,...e}),hasIconOnly:!0}),"temporary config"==t._source?a().createElement(r.Button,{renderIcon:e=>a().createElement(s.ResetIcon,{size:16,...e}),size:"sm",kind:"ghost",iconDescription:v("resetToDefaultValueButtonText","Reset to default"),hasIconOnly:!0,onClick:()=>{(0,m.clearConfigErrors)(e.join("."));let t=(0,i.A)(m.temporaryConfigStore.getState());(0,_.A)(t,["config",...e]),m.temporaryConfigStore.setState(t)}}):null),y&&a().createElement("div",{className:$.error},y)))}function U({moduleName:e,slotName:t,config:l}){return a().createElement(z,{path:[e,t,"configure"],element:l&&Object.keys(l).length?{_value:l,_source:"",_default:{}}:{_value:void 0,_source:"default",_default:{}},customType:"configure"})}let H="-esm-implementer-tools__layout-styles__labelCell___3iEG5",W="-esm-implementer-tools__layout-styles__label___rSgg8",J="-esm-implementer-tools__layout-styles__structuredList___bWhdd",G="-esm-implementer-tools__layout-styles__structuredListRow___DuyVm",q=a().forwardRef(({leaf:e,label:t,children:l,onMouseEnter:n,onMouseLeave:o},s)=>e?a().createElement(r.StructuredListRow,{className:G,onMouseEnter:n,onMouseLeave:o},a().createElement(r.StructuredListCell,{className:H},a().createElement("span",{className:W,ref:s},t)),a().createElement(r.StructuredListCell,null,l)):a().createElement(a().Fragment,null,a().createElement(r.StructuredListRow,{className:G,onMouseEnter:n,onMouseLeave:o},a().createElement(r.StructuredListCell,{className:H},a().createElement("span",{className:W,ref:s},t)),a().createElement(r.StructuredListCell,null)),a().createElement(r.StructuredListRow,{className:G},a().createElement(r.StructuredListCell,null),a().createElement(r.StructuredListCell,{className:"-esm-implementer-tools__layout-styles__subtreeCell___YTBkc"},a().createElement(r.StructuredListWrapper,{className:J},a().createElement(r.StructuredListBody,null,l))))));var Y=l(3366);function K({extensionsConfig:e,moduleName:t}){return e&&Object.keys(e).length?a().createElement(q,{label:"extension slots",leaf:!1},Object.keys(e).map(l=>a().createElement(Q,{key:l,config:e?.[l],path:[t,"extensionSlots",l]}))):null}function Q({config:e,path:t}){let l=t[0],r=t[2],o=(0,m.useCandidateExtensions)(r),{uiSelectedPath:s}=(0,Y.Pj)(p.bB),i=(0,n.useRef)(null);function c(e){let t=p.bB.getState();(0,d.A)(t.activeItemDescription?.path,e)&&!(0,d.A)(t.configPathBeingEdited,e)&&p.bB.setState({activeItemDescription:void 0})}return(0,n.useEffect)(()=>{(0,d.A)(s,t)&&i.current?.scrollIntoView()},[s]),a().createElement(q,{label:r,ref:i,leaf:!1,onMouseEnter:()=>{!p.bB.getState().configPathBeingEdited&&p.bB.setState({activeItemDescription:{path:[l,r],value:o.map(e=>e.id)}})},onMouseLeave:()=>c([l,r])},["add","remove","order","configure"].map(n=>a().createElement(q,{label:n,key:t.join(".")+n,leaf:!0,onMouseEnter:()=>{var t;return t=e?.[n],void(!p.bB.getState().configPathBeingEdited&&p.bB.setState({activeItemDescription:{path:[l,r,n],source:t?._source,description:{add:"Add an extension to this slot.",remove:"Remove an extension from this slot.",order:"Reorder the extensions in this slot.",configure:"Pass a configuration object directly to one of the extensions in this slot."}[n],value:JSON.stringify(t?._value)}}))},onMouseLeave:()=>c([l,r,n])},"configure"===n?a().createElement(U,{moduleName:l,slotName:r,config:e?.configure?._value}):a().createElement(z,{path:t.concat([n]),element:e?.[n]??{_value:void 0,_source:"default",_default:[]},customType:n}))))}function X({config:e,path:t=[]}){return a().createElement(a().Fragment,null,Object.entries(e).filter(([e])=>!e.startsWith("_")).map(([e,l])=>{let n=t.concat([e]),r=l&&"object"==typeof l&&Object.hasOwn(l,"_value");return a().createElement(q,{label:e,leaf:r,onMouseEnter:()=>(function(e,t){if(!p.bB.getState().configPathBeingEdited){let l=t&&"object"==typeof t&&Object.hasOwn(t,"_value");p.bB.setState({activeItemDescription:{path:e,source:l?t._source:void 0,description:l?t._description:void 0,value:l?JSON.stringify(t._value):void 0}})}})(n,l),onMouseLeave:()=>{let e;return e=p.bB.getState(),void((0,d.A)(e.activeItemDescription?.path,n)&&!(0,d.A)(e.configPathBeingEdited,n)&&p.bB.setState({activeItemDescription:void 0}))},key:`subtree-${n.join(".")}`},r?a().createElement(z,{path:n,element:l}):a().createElement(X,{config:l,path:n}))}))}function Z({children:e}){return a().createElement(r.StructuredListWrapper,{className:J},a().createElement(r.StructuredListBody,null,e))}function ee({config:e,moduleName:t}){return a().createElement(Z,null,a().createElement(K,{extensionsConfig:e.extensionSlots,moduleName:t}),a().createElement(X,{config:(0,u.A)(e,(e,t)=>"extensionSlots"!==t),path:[t]}))}function et({config:e}){let{uiSelectedPath:t}=(0,Y.Pj)(p.bB),l=t?.[0];return a().createElement(r.Accordion,{align:"start"},e&&Object.keys(e).sort().map(t=>{let n=e[t];return Object.keys(n).length?a().createElement(r.AccordionItem,{title:a().createElement("h6",null,t),className:"-esm-implementer-tools__config-tree-styles__fullWidthAccordion___9hGTP",key:`accordion-${t}`,open:l==t||void 0},a().createElement(ee,{config:n,moduleName:t,key:`${t}-config`})):null}))}function el(){let{t:e}=(0,o.useTranslation)(),{activeItemDescription:t}=(0,s.useStore)(p.bB);return a().createElement("div",null,t?a().createElement(a().Fragment,null,a().createElement("h2",{className:"-esm-implementer-tools__description-styles__path___hDPpD"},t.path.slice(1).join(" → ")),a().createElement("p",{className:"-esm-implementer-tools__description-styles__description___m9fKN"},t.description),a().createElement("p",{className:"-esm-implementer-tools__description-styles__source___DxMuN"},"default"===t.source?a().createElement(a().Fragment,null,e("itemDescriptionSourceDefaultText","The current value is the default.")):t.source?a().createElement(a().Fragment,null,e("activeItemSourceText","The current value comes from "),t.source):null),t.value?a().createElement("h4",{className:"-esm-implementer-tools__description-styles__productiveHeading01___YbPWR"},e("value","Value")):null,a().createElement("p",{className:"-esm-implementer-tools__description-styles__value___zxS02"},Array.isArray(t.value)?t.value.map((e,t)=>a().createElement("p",{key:`item-description-value-${t}`},JSON.stringify(e))):JSON.stringify(t.value))):null)}let en={tools:"-esm-implementer-tools__configuration-styles__tools___Srvb6",toolbar:"-esm-implementer-tools__configuration-styles__toolbar___TAdcZ",row:"-esm-implementer-tools__configuration-styles__row___kKqeg",downloadLink:"-esm-implementer-tools__configuration-styles__downloadLink___hX3Dd",mainContent:"-esm-implementer-tools__configuration-styles__mainContent___Y9vzR",configTreePane:"-esm-implementer-tools__configuration-styles__configTreePane___vEp56",descriptionPane:"-esm-implementer-tools__configuration-styles__descriptionPane___eVgAz",toggleToolbarButton:"-esm-implementer-tools__configuration-styles__toggleToolbarButton___RRbqb",toggleButtons:"-esm-implementer-tools__configuration-styles__toggleButtons___XG6Cm",actionButtons:"-esm-implementer-tools__configuration-styles__actionButtons___4jXmw"},ea=a().lazy(()=>Promise.all([l.e("932"),l.e("1389")]).then(l.bind(l,4860))),er={toggleIsUIEditorEnabled:({isUIEditorEnabled:e})=>({isUIEditorEnabled:!e}),toggleIsToolbarOpen:({isConfigToolbarOpen:e})=>({isConfigToolbarOpen:!e}),toggleIsJsonModeEnabled:({isJsonModeEnabled:e})=>({isJsonModeEnabled:!e})},eo=({isConfigToolbarOpen:e,toggleIsToolbarOpen:t})=>a().createElement(r.Button,{hasIconOnly:!0,renderIcon:e?m.ChevronUpIcon:m.ChevronDownIcon,onClick:t,kind:"ghost",size:"sm",tooltipPosition:"left",iconDescription:`${e?"Hide":"Show"} toolbar`}),es=()=>{let{t:e}=(0,o.useTranslation)(),{isUIEditorEnabled:t,toggleIsUIEditorEnabled:l,isJsonModeEnabled:s,toggleIsJsonModeEnabled:u,isConfigToolbarOpen:d,toggleIsToolbarOpen:_}=(0,m.useStoreWithActions)(p.bB,er),{config:E,derivationError:f}=(0,m.useStore)(m.implementerToolsConfigStore),g=(0,m.useStore)((0,m.getExtensionInternalStore)()),y=(0,m.useStore)(m.temporaryConfigStore),[b,h]=(0,n.useState)(""),v=new Blob([JSON.stringify(y.config,void 0,2)],{type:"application/json"}),T=(0,n.useMemo)(()=>{let e=(0,i.A)(E);for(let t of Object.values(g.slots))t.moduleName&&(e[t.moduleName].extensionSlots||(e[t.moduleName].extensionSlots={}),e[t.moduleName].extensionSlots[t.name]||(e[t.moduleName].extensionSlots[t.name]={}));return e},[E,g]),S=(0,n.useMemo)(()=>b?function e(t,l){let n={};for(let r of Object.keys(t))if(r.includes(l))n[r]=(0,i.A)(t[r]);else{var a;if(!((a=t[r]).hasOwnProperty("_default")||a._type||a.hasOwnProperty("_value")||a.hasOwnProperty("_source"))){let a=e(t[r],l);(0,c.A)(a)||(n[r]=a)}}return n}(T,b):T,[b,T]),C=d?"calc(50vh - 7rem)":"calc(50vh - 2rem)";return a().createElement(a().Fragment,null,a().createElement("div",{className:en.tools},a().createElement("div",{className:en.toggleToolbarButton},a().createElement(eo,{isConfigToolbarOpen:d,toggleIsToolbarOpen:_})),d?a().createElement(r.FlexGrid,{style:{padding:"0.5em 1.5em"}},a().createElement(r.Row,{className:en.row},a().createElement(r.Column,null,a().createElement(r.TextInput,{id:"extensionSearch",labelText:e("searchConfiguration","Search configuration"),onChange:e=>h(e.target.value),autoComplete:"off"})),a().createElement(r.Column,{className:en.toggleButtons},a().createElement(r.Toggle,{className:en.toggle,id:"jsonModeSwitch",labelText:e("jsonEditor","JSON editor"),onToggle:u,toggled:s}),a().createElement(r.Toggle,{className:en.toggle,id:"uiEditorSwitch",labelText:e("uiEditor","UI editor"),toggled:t,onToggle:l})),a().createElement(r.Column,{className:en.actionButtons},a().createElement(r.Button,{kind:"danger",iconDescription:"Clear local config",renderIcon:e=>a().createElement(m.TrashCanIcon,{size:16,...e}),onClick:()=>{(0,m.clearConfigErrors)(),m.temporaryConfigStore.setState({config:{}})}},e("clearConfig","Clear local config")),a().createElement(r.Button,{kind:"secondary",iconDescription:"Download config",renderIcon:e=>a().createElement(m.DownloadIcon,{size:16,...e}),onClick:e=>{"downloadConfigBtn"!=e.target.id&&document.getElementById("downloadConfigBtn")?.click()}},a().createElement("a",{id:"downloadConfigBtn",className:en.downloadLink,download:"temporary_config.json",href:window.URL.createObjectURL(v)},e("downloadConfig","Download config")))))):null),f?a().createElement(r.InlineNotification,{kind:"error",lowContrast:!0,hideCloseButton:!0,title:e("configDerivationFailed","This configuration is out of date"),subtitle:`${e("configDerivationFailedSubtitle","The configuration could not be rebuilt, so what is shown below is the last version that did build.")} ${f}`}):null,a().createElement("div",{className:en.mainContent,style:{height:C}},s?a().createElement(ea,{height:C}):a().createElement(a().Fragment,null,a().createElement("div",{className:en.configTreePane},a().createElement(et,{config:S})),a().createElement("div",{className:en.descriptionPane},a().createElement(el,null)))))},ei=({frontendModules:e})=>{let{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"name",header:t("moduleName","Module Name")},{key:"installedVersion",header:t("installedVersion","Installed Version")}],[t]);return a().createElement("div",{className:"-esm-implementer-tools__frontend-modules__container___WFDQG"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:l,getTableProps:o,getHeaderProps:s})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,o(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,l.map(e=>a().createElement(r.TableHeader,s({header:e}),e.header)))),a().createElement(r.TableBody,null,e.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__frontend-modules__moduleHeader___rJZBG"},e.name)),a().createElement(r.TableCell,null,e.version??t("unknownVersion","unknown"))),e.extensions?a().createElement(r.TableRow,{key:`${e.name}-extensions-header`},a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__frontend-modules__moduleComponentHeader___jYzBt"},t("extensions","Extensions"))),a().createElement(r.TableCell,null)):null,(e.extensions??[]).map((t,l)=>a().createElement(r.TableRow,{key:`${e.name}-page-${l}`},a().createElement(r.TableCell,null,t.name),a().createElement(r.TableCell,null))))))))))},ec=({backendDependencies:e})=>{let{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"name",header:t("moduleName","Module Name")},{key:"installedVersion",header:t("installedVersion","Installed version")},{key:"requiredVersion",header:t("requiredVersion","Required version")}],[t]);return a().createElement("div",{className:"-esm-implementer-tools__backend-dependencies-styles__container___0tseS"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:l,getTableProps:o,getHeaderProps:s})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,o(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,l.map(e=>a().createElement(r.TableHeader,s({header:e}),e.header)))),a().createElement(r.TableBody,null,e.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("span",{className:"-esm-implementer-tools__backend-dependencies-styles__moduleHeader___xPytm"},e.name)),a().createElement(r.TableCell,null),a().createElement(r.TableCell,null)),e.dependencies.map(e=>a().createElement(r.TableRow,{key:e.name},a().createElement(r.TableCell,null,e.name),a().createElement(r.TableCell,null,"missing"===e.type?a().createElement("span",{style:{color:"red"}},t("missing","Missing")):"version-mismatch"===e.type?a().createElement("span",{style:{color:"red"}},e.installedVersion):a().createElement("span",null,e.installedVersion)),a().createElement(r.TableCell,null,e.requiredVersion))))))))))};function em(){let{flags:e}=(0,s.useStore)(m.featureFlagsStore),{t}=(0,o.useTranslation)(),l=(0,n.useMemo)(()=>[{key:"label",header:t("featureFlag","Feature Flag")},{key:"description",header:t("description","Description")},{key:"enabled",header:t("enabled","Enabled")}],[t]),i=(0,n.useMemo)(()=>Object.entries(e).sort(([e,t],[l,n])=>(t.label??e).localeCompare(n.label||l)).map(([e,{enabled:t,label:l,description:n}])=>({name:e,enabled:t,label:l,description:n})),[e]);return a().createElement("div",{className:"-esm-implementer-tools__feature-flags__container___cDCki"},a().createElement(r.DataTable,{rows:[],headers:l},({headers:e,getTableProps:t,getHeaderProps:l})=>a().createElement(r.TableContainer,{title:""},a().createElement(r.Table,t(),a().createElement(r.TableHead,null,a().createElement(r.TableRow,null,e.map(e=>a().createElement(r.TableHeader,l({header:e}),e.header)))),a().createElement(r.TableBody,null,i.map(e=>a().createElement(n.Fragment,{key:e.name},a().createElement(r.TableRow,null,a().createElement(r.TableCell,null,a().createElement("div",{id:`flag-label-${e.name}`,className:"-esm-implementer-tools__feature-flags__header___iJcLP"},e.label),a().createElement("div",{className:"-esm-implementer-tools__feature-flags__helper___mGyu3"},e.name)),a().createElement(r.TableCell,null,a().createElement("span",null,e.description)),a().createElement(r.TableCell,null,a().createElement(r.Toggle,{id:`feature-flag-${e.name}-toggle`,"aria-labelledby":`flag-label-${e.name}`,labelText:"",hideLabel:!0,toggled:e.enabled,onToggle:()=>(0,m.setFeatureFlag)(e.name,!e.enabled)}))))))))))}function eu({close:e,frontendModules:t,backendDependencies:l,visibleTabIndex:i=0}){let{t:c}=(0,o.useTranslation)(),[m,u]=(0,n.useState)(i||0),d=(0,n.useMemo)(()=>0==m?a().createElement(es,null):1===m?a().createElement(ei,{frontendModules:t}):2===m?a().createElement(ec,{backendDependencies:l}):a().createElement(em,null),[m,l,t]);return a().createElement("div",{className:"-esm-implementer-tools__popup-styles__popup___MPkfI"},a().createElement(r.Theme,{theme:"g90"},a().createElement("div",{className:"-esm-implementer-tools__popup-styles__topBar___VryOt"},a().createElement("div",{className:"-esm-implementer-tools__popup-styles__tabs___O2ml7"},a().createElement(r.ContentSwitcher,{className:"-esm-implementer-tools__popup-styles__contentSwitcher___pk43o",selectedIndex:m,onChange:e=>{u(e.index)},size:"lg"},a().createElement(r.Switch,{name:"configuration-tab",text:c("configuration","Configuration"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"frontend-modules-tab",text:c("frontendModules","Frontend modules"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"backend-modules-tab",text:c("backendModules","Backend modules"),className:"darkThemeSwitch"}),a().createElement(r.Switch,{name:"feature-flags-tab",text:c("featureFlags","Feature flags"),className:"darkThemeSwitch"}))),a().createElement("div",null,a().createElement(r.IconButton,{align:"left",className:"-esm-implementer-tools__popup-styles__closeButton___nDcEG",kind:"secondary",label:c("close","Close"),onClick:e},a().createElement(s.CloseIcon,null)))),a().createElement("div",{className:"-esm-implementer-tools__popup-styles__content___KyNJO"},d)))}}}]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ResolvedDependenciesModule } from './openmrs-backend-dependencies';
|
|
3
|
+
export interface BackendDependencies {
|
|
4
|
+
backendDependencies: Array<ResolvedDependenciesModule>;
|
|
5
|
+
}
|
|
6
|
+
export declare const BackendDependencies: React.FC<BackendDependencies>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ResolvedBackendModuleType = 'missing' | 'version-mismatch' | 'okay';
|
|
2
|
+
export interface ResolvedBackendModule {
|
|
3
|
+
name: string;
|
|
4
|
+
requiredVersion: string;
|
|
5
|
+
installedVersion?: string;
|
|
6
|
+
type: ResolvedBackendModuleType;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolvedDependenciesModule {
|
|
9
|
+
name: string;
|
|
10
|
+
dependencies: Array<ResolvedBackendModule>;
|
|
11
|
+
}
|
|
12
|
+
export declare function checkModules(): Promise<Array<ResolvedDependenciesModule>>;
|
|
13
|
+
export declare function hasInvalidDependencies(frontendModules: Array<ResolvedDependenciesModule>): boolean;
|
|
14
|
+
export declare function clearCache(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ConfigValue, type Config, type Validator, type Type } from '@openmrs/esm-framework/src/internal';
|
|
3
|
+
import { type CustomValueType } from './value-editor';
|
|
4
|
+
export interface EditableValueProps {
|
|
5
|
+
path: Array<string>;
|
|
6
|
+
element: ConfigValueDescriptor;
|
|
7
|
+
customType?: CustomValueType;
|
|
8
|
+
}
|
|
9
|
+
export interface ConfigValueDescriptor {
|
|
10
|
+
_value: ConfigValue;
|
|
11
|
+
_source: string;
|
|
12
|
+
_default?: ConfigValue;
|
|
13
|
+
_description?: string;
|
|
14
|
+
_elements?: Config | ConfigValueDescriptor;
|
|
15
|
+
_validators?: Array<Validator>;
|
|
16
|
+
_type?: Type;
|
|
17
|
+
}
|
|
18
|
+
export default function EditableValue({ path, element, customType }: EditableValueProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtensionSlotConfigureValueObject } from '@openmrs/esm-framework';
|
|
3
|
+
export interface ExtensionConfigureTreeProps {
|
|
4
|
+
moduleName: string;
|
|
5
|
+
slotName: string;
|
|
6
|
+
config?: ExtensionSlotConfigureValueObject;
|
|
7
|
+
}
|
|
8
|
+
export declare function ExtensionConfigureTree({ moduleName, slotName, config }: ExtensionConfigureTreeProps): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ExtensionSlotsConfigTreeProps {
|
|
3
|
+
extensionsConfig: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
moduleName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ExtensionSlotsConfigTree({ extensionsConfig, moduleName }: ExtensionSlotsConfigTreeProps): React.JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SubtreeProps {
|
|
3
|
+
leaf: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
onMouseEnter?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
7
|
+
onMouseLeave?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Subtree: React.ForwardRefExoticComponent<SubtreeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Type, type ConfigValue, type ConfigSchema, type Validator } from '@openmrs/esm-framework';
|
|
2
|
+
import type { CustomValueType } from './value-editor';
|
|
3
|
+
export declare const validateValue: (value: ConfigValue, fieldType: Type | CustomValueType | undefined, validators: Array<Validator>, elementSchema?: ConfigSchema) => any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Type } from '@openmrs/esm-framework';
|
|
3
|
+
import type { ConfigValueDescriptor } from './editable-value.component';
|
|
4
|
+
export type CustomValueType = 'add' | 'remove' | 'order' | 'configure';
|
|
5
|
+
export type ValueType = CustomValueType | Type;
|
|
6
|
+
interface ValueEditorProps {
|
|
7
|
+
element: ConfigValueDescriptor;
|
|
8
|
+
customType?: CustomValueType;
|
|
9
|
+
path: Array<string>;
|
|
10
|
+
handleSaveToConfiguration: (val: string) => void;
|
|
11
|
+
handleClose: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ValueEditor({ element, customType, path, handleSaveToConfiguration, handleClose }: ValueEditorProps): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfigValueDescriptor } from '../editable-value.component';
|
|
3
|
+
interface ArrayEditorProps {
|
|
4
|
+
element: ConfigValueDescriptor;
|
|
5
|
+
valueArray: Array<any>;
|
|
6
|
+
setValue: (value: Array<any>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ArrayEditor({ element, valueArray, setValue }: ArrayEditorProps): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Concept } from './concept-search.resource';
|
|
3
|
+
interface ConceptSearchBoxProps {
|
|
4
|
+
setConcept: (concept: Concept) => void;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ConceptSearchBox({ setConcept, value }: ConceptSearchBoxProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type Concept = {
|
|
2
|
+
answers: Array<ConceptAnswer>;
|
|
3
|
+
display: string;
|
|
4
|
+
mappings: Array<Mappings>;
|
|
5
|
+
uuid: string;
|
|
6
|
+
};
|
|
7
|
+
type ConceptAnswer = {
|
|
8
|
+
display: string;
|
|
9
|
+
uuid: string;
|
|
10
|
+
};
|
|
11
|
+
type Mappings = {
|
|
12
|
+
display: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function useConceptLookup(query: string): {
|
|
15
|
+
concepts: Concept[];
|
|
16
|
+
error: Error | undefined;
|
|
17
|
+
isSearchingConcepts: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function useGetConceptByUuid(conceptUuid: string): {
|
|
20
|
+
concept: Concept | null;
|
|
21
|
+
error: Error | undefined;
|
|
22
|
+
isLoadingConcept: boolean;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfigValueDescriptor } from '../editable-value.component';
|
|
3
|
+
interface ObjectEditorProps {
|
|
4
|
+
element: ConfigValueDescriptor;
|
|
5
|
+
valueObject: Record<string | symbol | number, any>;
|
|
6
|
+
setValue: (value: Record<string | symbol | number, any>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ObjectEditor({ element, valueObject, setValue }: ObjectEditorProps): React.JSX.Element;
|
|
9
|
+
export {};
|
package/dist/configuration/interactive-editor/value-editors/patient-identifier-type-search.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PatientIdentifierTypeSearchBoxProps {
|
|
3
|
+
value: string;
|
|
4
|
+
setPatientIdentifierTypeUuid: (patientIdentifierTypeUuid: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PatientIdentifierTypeSearchBox({ setPatientIdentifierTypeUuid, value, }: PatientIdentifierTypeSearchBoxProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PersonAttributeTypeSearchBoxProps {
|
|
3
|
+
value: string;
|
|
4
|
+
setPersonAttributeUuid: (personAttributeType: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PersonAttributeTypeSearchBox({ setPersonAttributeUuid, value }: PersonAttributeTypeSearchBoxProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfigValueDescriptor } from '../editable-value.component';
|
|
3
|
+
import type { ValueType } from '../value-editor';
|
|
4
|
+
export interface ValueEditorFieldProps {
|
|
5
|
+
element: ConfigValueDescriptor;
|
|
6
|
+
path?: Array<string>;
|
|
7
|
+
valueType?: ValueType;
|
|
8
|
+
value: any;
|
|
9
|
+
onChange: (value: any) => void;
|
|
10
|
+
error?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function ValueEditorField({ element, path, valueType, value, onChange, error }: ValueEditorFieldProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'ace-builds/src-noconflict/mode-json';
|
|
3
|
+
import 'ace-builds/src-noconflict/theme-dracula';
|
|
4
|
+
export interface JsonEditorProps {
|
|
5
|
+
/** A CSS value */
|
|
6
|
+
height: string;
|
|
7
|
+
}
|
|
8
|
+
export default function JsonEditor({ height }: JsonEditorProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|