@ampath/esm-reports-app 1.0.0-next.47 → 1.0.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/410.js +1 -1
- package/dist/{143.css → 907.css} +1 -1
- package/dist/907.css.map +1 -0
- package/dist/907.js +1 -0
- package/dist/907.js.map +1 -0
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/common/report-header/index.ts +1 -0
- package/src/common/report-header/use-location-details.ts +58 -0
- package/src/common/report-register/register-columns.ts +12 -0
- package/src/common/report-register/register-layout.component.tsx +7 -1
- package/src/common/report-register/register-table.scss +9 -0
- package/src/common/report-register/rows-to-csv.ts +35 -5
- package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +16 -3
- package/src/reports/moh-240/moh-240-header.component.tsx +7 -4
- package/src/reports/moh-240/moh-240.columns.ts +42 -1
- package/src/reports/moh-240/moh-240.component.tsx +3 -2
- package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +3 -4
- package/src/reports/moh-240/sub-reports/page-summary.component.tsx +143 -93
- package/src/reports/moh-505/moh-505-header.component.tsx +7 -4
- package/src/reports/moh-706/moh-706-header.component.tsx +7 -4
- package/src/reports/moh-706/sub-reports/blood-chemistry/blood-chemistry.component.tsx +16 -16
- package/src/reports/moh-706/sub-reports/specimen-referral-to-higher-levels/specimen-referral-to-higher-levels.component.tsx +2 -2
- package/src/reports/moh-717/moh-717.component.tsx +5 -3
- package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +4 -0
- package/src/reports/moh-740/types/index.ts +1 -0
- package/src/resources/moh-706.resource.ts +9 -2
- package/src/resources/patient-list-page.ts +0 -1
- package/dist/143.css.map +0 -1
- package/dist/143.js +0 -1
- package/dist/143.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var _ampath_esm_reports_app;!function(){var e="undefined"!=typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw new Error("@ampath/esm-reports-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var r=e._FEDERATION_RUNTIME_CORE_FROM;r&&r.version&&"2.8"!==String(r.version).split(".").slice(0,2).join(".")&&console.warn("@ampath/esm-reports-app was built against Module Federation 2.8.x but the app shell provides "+r.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{"use strict";var e,r,t,n,a,o,i={2464(e,r,t){var n={};function a(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}t.r(n),t.d(n,{Module:()=>p.Module,ModuleFederation:()=>p.ModuleFederation,createInstance:()=>h,getInstance:()=>M,getRemoteEntry:()=>p.getRemoteEntry,getRemoteInfo:()=>p.getRemoteInfo,init:()=>m,loadRemote:()=>g,loadScript:()=>p.loadScript,loadScriptNode:()=>p.loadScriptNode,loadShare:()=>y,loadShareSync:()=>S,preloadRemote:()=>b,registerGlobalPlugins:()=>p.registerGlobalPlugins,registerPlugins:()=>E,registerRemotes:()=>v,registerShared:()=>R});const o=["script"];function i(e){const{webpackRequire:r,moduleToHandlerMapping:t}=e,{consumesLoadingData:n,initializeSharingData:a}=r,{sharedFallback:o,bundlerRuntime:i,libraryType:s}=r.federation;if(n&&!n._updated){const{moduleIdToConsumeDataMapping:a={},initialConsumes:c=[],chunkMapping:l={}}=n;if(Object.entries(a).forEach(([e,n])=>{t[e]||(t[e]={getter:o?i?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:r,libraryType:s}):n.fallback,treeShakingGetter:o?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:o?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){const{initialConsumes:r=[]}=e;c.forEach(e=>{r.includes(e)||r.push(e)})}if("chunkMapping"in e){const{chunkMapping:r={}}=e;Object.entries(l).forEach(([e,t])=>{r[e]||(r[e]=[]),t.forEach(t=>{r[e].includes(t)||r[e].push(t)})})}n._updated=1}if(a&&!a._updated){const{federation:e}=r;if(!e.instance||!a.scopeToSharingDataMapping)return;const t={};for(let[e,r]of Object.entries(a.scopeToSharingDataMapping))for(let n of r)if("object"==typeof n&&null!==n){const{name:r,version:a,factory:o,eager:i,singleton:s,requiredVersion:c,strictVersion:l}=n,p={requiredVersion:`^${a}`},u=function(e){return void 0!==e};u(s)&&(p.singleton=s),u(c)&&(p.requiredVersion=c),u(i)&&(p.eager=i),u(l)&&(p.strictVersion=l);const d={version:a,scope:[e],shareConfig:p,get:o};t[r]?t[r].push(d):t[r]=[d]}e.instance.registerShared(t),a._updated=1}}const s=self._OPENMRS_FEDERATION_SDK;function c(e,r){const t=e.federation.usedExports;if(t)return t[r]}const l="RUNTIME-012",p=self._FEDERATION_RUNTIME_CORE;function u(e,r){return p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(t=>!("@ampath/esm-reports-app:1.0.0-next.47"!==t.options.id&&(t.options.name!==e||t.options.version||r)&&(t.options.name!==e||!r||t.options.version!==r)))}const d=self._OPENMRS_FEDERATION_ERROR_CODES;function h(e){const r=new((0,p.getGlobalFederationConstructor)()||p.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,p.setGlobalFederationInstance)(r),r}let f=null;function m(e){const r=u(e.name,e.version),t={...e,id:e.id||""};return r?(r.initOptions(t),f||(f=r),r):(f=h(t),f)}function g(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadRemote.apply(f,e)}function y(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShare.apply(f,e)}function S(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShareSync.apply(f,e)}function b(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.preloadRemote.apply(f,e)}function v(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerRemotes.apply(f,e)}function E(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerPlugins.apply(f,e)}function M(e){return e?p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:f}function R(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerShared.apply(f,e)}(0,p.setGlobalFederationConstructor)(p.ModuleFederation);const k={global:{...p.helpers.global,getGlobalFederationInstance:u},share:p.helpers.share,utils:p.helpers.utils},_={remotes:function(e){!function(e){const{webpackRequire:r,idToExternalAndNameMapping:t={},idToRemoteMap:n={},chunkMapping:a={}}=e,{remotesLoadingData:o}=r,i=r.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!o||o._updated||!i)return;const{chunkMapping:s,moduleIdToRemoteDataMapping:c}=o;if(s&&c){for(let[e,r]of Object.entries(c))if(t[e]||(t[e]=[r.shareScope,r.name,r.externalModuleId]),!n[e]&&i[r.remoteName]){const t=i[r.remoteName];n[e]||=[],t.forEach(r=>{n[e].includes(r)||n[e].push(r)})}a&&Object.entries(s).forEach(([e,r])=>{a[e]||(a[e]=[]),r.forEach(r=>{a[e].includes(r)||a[e].push(r)})}),o._updated=1}}(e);const{chunkId:r,promises:t,webpackRequire:n,chunkMapping:i,idToExternalAndNameMapping:c,idToRemoteMap:l}=e;a(n),n.o(i,r)&&i[r].forEach(e=>{let r=n.R;r||(r=[]);const a=c[e],i=l[e]||[];if(r.indexOf(a)>=0)return;if(r.push(a),a.p)return t.push(a.p);const p=r=>{r||(r=new Error("Container missing")),"string"==typeof r.message&&(r.message+=`\nwhile loading "${a[1]}" from ${a[2]}`),n.m[e]=()=>{throw r},a.p=0},u=(e,r,n,o,i,s)=>{try{const c=e(r,n);if(!c||!c.then)return i(c,o,s);{const e=c.then(e=>i(e,o),p);if(!s)return e;t.push(a.p=e)}}catch(e){p(e)}};var d=(e,t,n)=>u(t.get,a[1],r,0,h,n),h=r=>{a.p=1,n.m[e]=e=>{e.exports=r()}};1===i.length&&o.includes(i[0].externalType)&&i[0].name?u(()=>{try{const e=(0,s.decodeName)(i[0].name,s.ENCODE_NAME_PREFIX)+a[1].slice(1),r=n.federation.instance,t=()=>n.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===r.options.shareStrategy){const e=Array.isArray(a[0])?a[0]:[a[0]];return Promise.all(e.map(e=>r.sharedHandler.initializeSharing(e))).then(()=>t())}return t()}catch(e){p(e)}},a[2],0,0,h,1):u(n,a[2],0,0,(e,r,t)=>e?u(n.I,a[0],0,e,d,t):p(),1)})},consumes:function(e){i(e);const{chunkId:r,promises:t,installedModules:n,webpackRequire:o,chunkMapping:s,moduleToHandlerMapping:p}=e;a(o),o.o(s,r)&&s[r].forEach(e=>{if(o.o(n,e))return t.push(n[e]);const r=r=>{n[e]=0,o.m[e]=t=>{delete o.c[e];const n=r(),{shareInfo:a}=p[e];if(a?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=a.shareConfig.layer)}catch(e){}t.exports=n}},a=r=>{delete n[e],o.m[e]=t=>{throw delete o.c[e],r}};try{const i=o.federation.instance;if(!i)throw new Error("Federation instance not found!");const{shareKey:s,getter:u,shareInfo:d,treeShakingGetter:h}=p[e],f=c(o,s),m={...d};Array.isArray(m.scope)&&Array.isArray(m.scope[0])&&(m.scope=m.scope[0]),f&&(m.treeShaking={usedExports:f,useIn:[i.options.name]});const g=i.loadShare(s,{customShareInfo:m}).then(e=>{if(!1===e){if("function"!=typeof u)throw new Error(((e,r,t)=>{const n=[`${[r[e]]} #${e}`];return t&&n.push(`args: ${JSON.stringify(t)}`),n.push((e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`)(e)),n.join("\n")})(l,{[l]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:s}));return h?.()||u()}return e});g.then?t.push(n[e]=g.then(r).catch(a)):r(g)}catch(e){a(e)}})},I:function({shareScopeName:e,webpackRequire:r,initPromises:t,initTokens:n,initScope:i}){const s=Array.isArray(e)?e:[e];var c=[];return s.forEach(s=>{c.push(function(s){i||(i=[]);const c=r.federation.instance;var l=n[s];if(l||(l=n[s]={from:c.name}),i.indexOf(l)>=0)return;i.push(l);const p=t[s];if(p)return p;var u=t=>{var n=e=>{return r="Initialization of sharing external failed: "+e,"undefined"!=typeof console&&console.warn&&console.warn(r);var r};try{var a=r(t);if(!a)return;var o=t=>t&&t.init&&t.init(r.S[s],i,{shareScopeMap:r.S||{},shareScopeKeys:e});if(a.then)return d.push(a.then(o,n));var c=o(a);if(c&&"boolean"!=typeof c&&c.then)return d.push(c.catch(n))}catch(e){n(e)}};const d=c.initializeSharing(s,{strategy:c.options.shareStrategy,initScope:i,from:"build"});a(r);const h=r.federation.bundlerRuntimeOptions.remotes;return h&&Object.keys(h.idToRemoteMap).forEach(e=>{const r=h.idToRemoteMap[e],t=h.idToExternalAndNameMapping[e][2];if(r.length>1)u(t);else if(1===r.length){const e=r[0];o.includes(e.externalType)||u(t)}}),d.length?t[s]=Promise.all(d).then(()=>t[s]=!0):t[s]=!0}(s))}),Promise.all(c).then(()=>!0)},S:{},installInitialConsumes:function(e){i(e);const{moduleToHandlerMapping:r,webpackRequire:t,installedModules:n,initialConsumes:a,asyncLoad:o}=e,s=[];a.forEach(e=>{s.push([e,()=>function(e){const{moduleId:r,moduleToHandlerMapping:t,webpackRequire:n,asyncLoad:a}=e,o=n.federation.instance;if(!o)throw new Error("Federation instance not found!");const{shareKey:i,shareInfo:s}=t[r];try{const e=c(n,i),r={...s};return e&&(r.treeShaking={usedExports:e,useIn:[o.options.name]}),a?o.loadShare(i,{customShareInfo:r}):o.loadShareSync(i,{customShareInfo:r})}catch(e){throw console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.'),console.error("The original error message is as follows: "),e}}({moduleId:e,moduleToHandlerMapping:r,webpackRequire:t,asyncLoad:o})])});const l=(e,a)=>{t.m[e]=o=>{n[e]=0,delete t.c[e];const i=a();if("function"!=typeof i)throw new Error(`Shared module is not available for eager consumption: ${e}`);const s=i(),{shareInfo:c}=r[e];if(c?.shareConfig?.layer&&s&&"object"==typeof s)try{s.hasOwnProperty("layer")&&void 0!==s.layer||(s.layer=c.shareConfig.layer)}catch(e){}o.exports=s}};if(o)return Promise.all(s.map(async([e,r])=>{const t=await r();l(e,()=>t)}));s.forEach(([e,r])=>{l(e,r)})},initContainerEntry:function(e){const{webpackRequire:r,shareScope:t,initScope:n,shareScopeKey:a,remoteEntryInitOptions:o}=e;if(!r.S)return;if(!r.federation||!r.federation.instance||!r.federation.initOptions)return;const i=r.federation.instance;i.initOptions({name:r.federation.initOptions.name,remotes:[],...o});const s=o?.shareScopeKeys,c=o?.shareScopeMap;if(a&&"string"!=typeof a)a.forEach(e=>{if(!s||!c)return void i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}});c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})});else{const e=a||"default";Array.isArray(s)?s.forEach(e=>{c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})}):i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}})}return r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),Array.isArray(a)?Boolean(r.federation.initOptions.shared)?r.I(a,n):Promise.all(a.map(e=>r.I(e,n))).then(()=>!0):r.I(a||"default",n)},init:function({webpackRequire:e}){const{initOptions:r,runtime:n,sharedFallback:a,bundlerRuntime:o,libraryType:i}=e.federation;if(!r)throw new Error("initOptions is required!");{const n=function(){return{name:"tree-shake-plugin",beforeInit(r){const{userOptions:n,origin:s,options:c}=r,l=n.version||c.version;if(!a)return r;const u=n.shared||{},d=[];Object.keys(u).forEach(r=>{(Array.isArray(u[r])?u[r]:[u[r]]).forEach(t=>{d.push([r,t]),"get"in t&&(t.treeShaking||={},t.treeShaking.get=t.get,t.get=o.getSharedFallbackGetter({shareKey:r,factory:t.get,webpackRequire:e,libraryType:i,version:t.version}))})});const h=k.global.getGlobalSnapshotInfoByModuleInfo({name:s.name,version:l});return h&&"shared"in h?(Object.keys(c.shared||{}).forEach(e=>{c.shared[e].forEach(r=>{d.push([e,r])})}),d.forEach(([e,r])=>{((e,r)=>{const n=h.shared.find(r=>r.sharedName===e);if(!n)return;const{treeShaking:a}=r;if(!a)return;const{secondarySharedTreeShakingName:o,secondarySharedTreeShakingEntry:c,treeShakingStatus:l}=n;a.status!==l&&(a.status=l,c&&i&&o&&(a.get=async()=>{const e=await(0,p.getRemoteEntry)({origin:s,remoteInfo:{name:o,entry:c,type:i,entryGlobalName:o,shareScope:"default"}});return await e.init(s,t.federation.bundlerRuntime),e.get()}))})(e,r)}),r):r}}};r.plugins||=[],r.plugins.push(n())}return n.init(r)},getSharedFallbackGetter:({shareKey:e,factory:r,version:t,webpackRequire:n,libraryType:a="global"})=>{const{runtime:o,instance:i,bundlerRuntime:s,sharedFallback:c}=n.federation;if(!c)return r;const l=c[e];if(!l)return r;const p=t?l.find(e=>e[1]===t):l[0];if(!p)throw new Error(`No fallback item found for shareKey: ${e} and version: ${t}`);return()=>o.getRemoteEntry({origin:n.federation.instance,remoteInfo:{name:p[2],entry:`${n.p}${p[0]}`,type:a,entryGlobalName:p[2],shareScope:"default"}}).then(r=>{if(!r)throw new Error(`Failed to load fallback entry for shareKey: ${e} and version: ${t}`);return r.init(n.federation.instance,s).then(()=>r.get())})}},w={runtime:n,instance:void 0,initOptions:void 0,bundlerRuntime:_,attachShareScopeMap:a,bundlerRuntimeOptions:{}};if(!t.federation.runtime||!t.federation.bundlerRuntime){var I=t.federation;for(var T in t.federation={},w)t.federation[T]=w[T];for(var T in I)t.federation[T]=I[T]}t.federation.instance||(t.federation.instance=t.federation.bundlerRuntime.init({webpackRequire:t}),t.federation.attachShareScopeMap&&t.federation.attachShareScopeMap(t),t.federation.installInitialConsumes&&t.federation.installInitialConsumes())},9421(e,r,t){var n={"./start":()=>Promise.all([t.e(31),t.e(435),t.e(410)]).then(()=>()=>t(5410))},a=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),o=(e,r,n)=>t.federation.bundlerRuntime.initContainerEntry({webpackRequire:t,shareScope:e,initScope:r,remoteEntryInitOptions:n,shareScopeKey:"default"});t.d(r,{get:()=>a,init:()=>o})}},s={};function c(e){var r=s[e];if(void 0!==r)return r.exports;var t=s[e]={exports:{}},n={id:e,module:t,factory:i[e],require:c};return c.i.forEach(function(e){e(n)}),t=n.module,n.factory.call(t.exports,t,t.exports,n.require),t.exports}c.m=i,c.c=s,c.i=[],c.x=e=>{},c.federation||(c.federation={initOptions:{name:"@ampath/esm-reports-app",remotes:[],shareStrategy:"version-first"},chunkMatcher:function(e){return!/^(31|435|680|987)$/.test(e)},rootOutputDir:"",bundlerRuntimeOptions:{remotes:{remoteInfos:{},webpackRequire:c,idToRemoteMap:{},chunkMapping:{},idToExternalAndNameMapping:{}}}},c.consumesLoadingData={},c.remotesLoadingData={}),c.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return c.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var a=Object.create(null);c.r(a);var o={};e=e||[null,r({}),r([]),r(r)];for(var i=2&n&&t;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>t[e]);return o.default=()=>t,c.d(a,o),a},c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((r,t)=>(c.f[t](e,r),r),[])),c.u=e=>e+".js",c.miniCssF=e=>e+".css",c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@ampath/esm-reports-app:",c.l=(e,r,a,o)=>{if(t[e])t[e].push(r);else{var i,s;if(void 0!==a)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+a){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack",n+a),i.src=e),t[e]=[r];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(h);var a=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),r)return r(n)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),s&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{c.S={};var e={},r={};c.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];c.o(c.S,t)||(c.S[t]={});var o=c.S[t],i="@ampath/esm-reports-app",s=(e,r,t,n)=>{var a=o[e]=o[e]||{},s=a[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(a[r]={get:t,from:i,eager:!!n})},l=[];return"default"===t&&(s("@openmrs/esm-framework","11.0.1-pre.5776",()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295))),s("dayjs","1.11.20",()=>c.e(353).then(()=>()=>c(4353))),s("react-i18next","16.6.6",()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311))),s("react-router-dom","6.30.3",()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282))),s("react","18.3.1",()=>c.e(540).then(()=>()=>c(6540)))),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{c.federation.initOptions.shared={"@openmrs/esm-framework":[{version:"11.0.1-pre.5776",get:()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"*",strictVersion:!1,singleton:!0,layer:null}}],dayjs:[{version:"1.11.20",get:()=>c.e(353).then(()=>()=>c(4353)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"1.x",strictVersion:!1,singleton:!0,layer:null}}],"react-i18next":[{version:"16.6.6",get:()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"16.x",strictVersion:!1,singleton:!0,layer:null}}],"react-router-dom":[{version:"6.30.3",get:()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"6.x",strictVersion:!1,singleton:!0,layer:null}}],react:[{version:"18.3.1",get:()=>c.e(540).then(()=>()=>c(6540)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"18.x",strictVersion:!1,singleton:!0,layer:null}}]},c.S={};var e={},r={};c.I=(t,n)=>c.federation.bundlerRuntime.I({shareScopeName:t,webpackRequire:c,initPromises:e,initTokens:r,initScope:n})})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e})(),(()=>{var e={};c.consumesLoadingData.moduleIdToConsumeDataMapping={6031:{fallback:()=>c.e(540).then(()=>()=>c(6540)),shareScope:["default"],singleton:!0,requiredVersion:"18.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react"},6435:{fallback:()=>Promise.all([c.e(961),c.e(282)]).then(()=>()=>c(282)),shareScope:["default"],singleton:!0,requiredVersion:"6.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-router-dom"},7693:{fallback:()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(680),c.e(987)]).then(()=>()=>c(9295)),shareScope:["default"],singleton:!0,requiredVersion:"*",strictVersion:!1,eager:!1,layer:void 0,shareKey:"@openmrs/esm-framework"},7680:{fallback:()=>c.e(353).then(()=>()=>c(4353)),shareScope:["default"],singleton:!0,requiredVersion:"1.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"dayjs"},3987:{fallback:()=>c.e(311).then(()=>()=>c(3311)),shareScope:["default"],singleton:!0,requiredVersion:"16.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-i18next"}};var r={};c.consumesLoadingData.chunkMapping={31:[6031],410:[7693],435:[6435],680:[7680],987:[3987]},c.f.consumes=(t,n)=>{c.federation.bundlerRuntime.consumes({chunkMapping:c.consumesLoadingData.chunkMapping,installedModules:e,chunkId:t,moduleToHandlerMapping:r,promises:n,webpackRequire:c})}})(),(()=>{if("undefined"!=typeof document){var e={462:0};c.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{143:1,295:1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var n=c.miniCssF(e),a=c.p+n;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var a=(i=t[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(a===e||a===r))return i}var o=document.getElementsByTagName("style");for(n=0;n<o.length;n++){var i;if((a=(i=o[n]).getAttribute("data-href"))===e||a===r)return i}})(n,a))return r();((e,r,t,n,a)=>{var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",c.nc&&(o.nonce=c.nc),o.onerror=o.onload=t=>{if(o.onerror=o.onload=null,"load"===t.type)n();else{var i=t&&t.type,s=t&&t.target&&t.target.href||r,c=new Error("Loading CSS chunk "+e+" failed.\n("+i+": "+s+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=i,c.request=s,o.parentNode&&o.parentNode.removeChild(o),a(c)}},o.href=r,document.head.appendChild(o)})(e,a,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),a=c.x,o=!1,c.x=()=>{if(o||(o=!0,c(2464)),"function"==typeof a)return a();console.warn("[Module Federation] prevStartup is not a function, skipping startup execution")},(()=>{var e={462:0};c.f.j=(r,t)=>{var n=c.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(31|435|680|987)$/.test(r))e[r]=0;else{var a=new Promise((t,a)=>n=e[r]=[t,a]);t.push(n[2]=a);var o=c.p+c.u(r),i=new Error;c.l(o,t=>{if(c.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[o,i,s]=t,l=0;if(o.some(r=>0!==e[r])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);s&&s(c)}for(r&&r(t);l<o.length;l++)a=o[l],c.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_ampath_esm_reports_app=self.webpackChunk_ampath_esm_reports_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),c.x();var l=c(9421);_ampath_esm_reports_app=l})();
|
|
1
|
+
var _ampath_esm_reports_app;!function(){var e="undefined"!=typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw new Error("@ampath/esm-reports-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var r=e._FEDERATION_RUNTIME_CORE_FROM;r&&r.version&&"2.8"!==String(r.version).split(".").slice(0,2).join(".")&&console.warn("@ampath/esm-reports-app was built against Module Federation 2.8.x but the app shell provides "+r.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{"use strict";var e,r,t,n,a,o,i={2464(e,r,t){var n={};function a(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}t.r(n),t.d(n,{Module:()=>p.Module,ModuleFederation:()=>p.ModuleFederation,createInstance:()=>h,getInstance:()=>M,getRemoteEntry:()=>p.getRemoteEntry,getRemoteInfo:()=>p.getRemoteInfo,init:()=>m,loadRemote:()=>g,loadScript:()=>p.loadScript,loadScriptNode:()=>p.loadScriptNode,loadShare:()=>y,loadShareSync:()=>S,preloadRemote:()=>b,registerGlobalPlugins:()=>p.registerGlobalPlugins,registerPlugins:()=>E,registerRemotes:()=>v,registerShared:()=>R});const o=["script"];function i(e){const{webpackRequire:r,moduleToHandlerMapping:t}=e,{consumesLoadingData:n,initializeSharingData:a}=r,{sharedFallback:o,bundlerRuntime:i,libraryType:s}=r.federation;if(n&&!n._updated){const{moduleIdToConsumeDataMapping:a={},initialConsumes:c=[],chunkMapping:l={}}=n;if(Object.entries(a).forEach(([e,n])=>{t[e]||(t[e]={getter:o?i?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:r,libraryType:s}):n.fallback,treeShakingGetter:o?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:o?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){const{initialConsumes:r=[]}=e;c.forEach(e=>{r.includes(e)||r.push(e)})}if("chunkMapping"in e){const{chunkMapping:r={}}=e;Object.entries(l).forEach(([e,t])=>{r[e]||(r[e]=[]),t.forEach(t=>{r[e].includes(t)||r[e].push(t)})})}n._updated=1}if(a&&!a._updated){const{federation:e}=r;if(!e.instance||!a.scopeToSharingDataMapping)return;const t={};for(let[e,r]of Object.entries(a.scopeToSharingDataMapping))for(let n of r)if("object"==typeof n&&null!==n){const{name:r,version:a,factory:o,eager:i,singleton:s,requiredVersion:c,strictVersion:l}=n,p={requiredVersion:`^${a}`},u=function(e){return void 0!==e};u(s)&&(p.singleton=s),u(c)&&(p.requiredVersion=c),u(i)&&(p.eager=i),u(l)&&(p.strictVersion=l);const d={version:a,scope:[e],shareConfig:p,get:o};t[r]?t[r].push(d):t[r]=[d]}e.instance.registerShared(t),a._updated=1}}const s=self._OPENMRS_FEDERATION_SDK;function c(e,r){const t=e.federation.usedExports;if(t)return t[r]}const l="RUNTIME-012",p=self._FEDERATION_RUNTIME_CORE;function u(e,r){return p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(t=>!("@ampath/esm-reports-app:1.0.0-next.49"!==t.options.id&&(t.options.name!==e||t.options.version||r)&&(t.options.name!==e||!r||t.options.version!==r)))}const d=self._OPENMRS_FEDERATION_ERROR_CODES;function h(e){const r=new((0,p.getGlobalFederationConstructor)()||p.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,p.setGlobalFederationInstance)(r),r}let f=null;function m(e){const r=u(e.name,e.version),t={...e,id:e.id||""};return r?(r.initOptions(t),f||(f=r),r):(f=h(t),f)}function g(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadRemote.apply(f,e)}function y(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShare.apply(f,e)}function S(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShareSync.apply(f,e)}function b(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.preloadRemote.apply(f,e)}function v(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerRemotes.apply(f,e)}function E(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerPlugins.apply(f,e)}function M(e){return e?p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:f}function R(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerShared.apply(f,e)}(0,p.setGlobalFederationConstructor)(p.ModuleFederation);const k={global:{...p.helpers.global,getGlobalFederationInstance:u},share:p.helpers.share,utils:p.helpers.utils},_={remotes:function(e){!function(e){const{webpackRequire:r,idToExternalAndNameMapping:t={},idToRemoteMap:n={},chunkMapping:a={}}=e,{remotesLoadingData:o}=r,i=r.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!o||o._updated||!i)return;const{chunkMapping:s,moduleIdToRemoteDataMapping:c}=o;if(s&&c){for(let[e,r]of Object.entries(c))if(t[e]||(t[e]=[r.shareScope,r.name,r.externalModuleId]),!n[e]&&i[r.remoteName]){const t=i[r.remoteName];n[e]||=[],t.forEach(r=>{n[e].includes(r)||n[e].push(r)})}a&&Object.entries(s).forEach(([e,r])=>{a[e]||(a[e]=[]),r.forEach(r=>{a[e].includes(r)||a[e].push(r)})}),o._updated=1}}(e);const{chunkId:r,promises:t,webpackRequire:n,chunkMapping:i,idToExternalAndNameMapping:c,idToRemoteMap:l}=e;a(n),n.o(i,r)&&i[r].forEach(e=>{let r=n.R;r||(r=[]);const a=c[e],i=l[e]||[];if(r.indexOf(a)>=0)return;if(r.push(a),a.p)return t.push(a.p);const p=r=>{r||(r=new Error("Container missing")),"string"==typeof r.message&&(r.message+=`\nwhile loading "${a[1]}" from ${a[2]}`),n.m[e]=()=>{throw r},a.p=0},u=(e,r,n,o,i,s)=>{try{const c=e(r,n);if(!c||!c.then)return i(c,o,s);{const e=c.then(e=>i(e,o),p);if(!s)return e;t.push(a.p=e)}}catch(e){p(e)}};var d=(e,t,n)=>u(t.get,a[1],r,0,h,n),h=r=>{a.p=1,n.m[e]=e=>{e.exports=r()}};1===i.length&&o.includes(i[0].externalType)&&i[0].name?u(()=>{try{const e=(0,s.decodeName)(i[0].name,s.ENCODE_NAME_PREFIX)+a[1].slice(1),r=n.federation.instance,t=()=>n.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===r.options.shareStrategy){const e=Array.isArray(a[0])?a[0]:[a[0]];return Promise.all(e.map(e=>r.sharedHandler.initializeSharing(e))).then(()=>t())}return t()}catch(e){p(e)}},a[2],0,0,h,1):u(n,a[2],0,0,(e,r,t)=>e?u(n.I,a[0],0,e,d,t):p(),1)})},consumes:function(e){i(e);const{chunkId:r,promises:t,installedModules:n,webpackRequire:o,chunkMapping:s,moduleToHandlerMapping:p}=e;a(o),o.o(s,r)&&s[r].forEach(e=>{if(o.o(n,e))return t.push(n[e]);const r=r=>{n[e]=0,o.m[e]=t=>{delete o.c[e];const n=r(),{shareInfo:a}=p[e];if(a?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=a.shareConfig.layer)}catch(e){}t.exports=n}},a=r=>{delete n[e],o.m[e]=t=>{throw delete o.c[e],r}};try{const i=o.federation.instance;if(!i)throw new Error("Federation instance not found!");const{shareKey:s,getter:u,shareInfo:d,treeShakingGetter:h}=p[e],f=c(o,s),m={...d};Array.isArray(m.scope)&&Array.isArray(m.scope[0])&&(m.scope=m.scope[0]),f&&(m.treeShaking={usedExports:f,useIn:[i.options.name]});const g=i.loadShare(s,{customShareInfo:m}).then(e=>{if(!1===e){if("function"!=typeof u)throw new Error(((e,r,t)=>{const n=[`${[r[e]]} #${e}`];return t&&n.push(`args: ${JSON.stringify(t)}`),n.push((e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`)(e)),n.join("\n")})(l,{[l]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:s}));return h?.()||u()}return e});g.then?t.push(n[e]=g.then(r).catch(a)):r(g)}catch(e){a(e)}})},I:function({shareScopeName:e,webpackRequire:r,initPromises:t,initTokens:n,initScope:i}){const s=Array.isArray(e)?e:[e];var c=[];return s.forEach(s=>{c.push(function(s){i||(i=[]);const c=r.federation.instance;var l=n[s];if(l||(l=n[s]={from:c.name}),i.indexOf(l)>=0)return;i.push(l);const p=t[s];if(p)return p;var u=t=>{var n=e=>{return r="Initialization of sharing external failed: "+e,"undefined"!=typeof console&&console.warn&&console.warn(r);var r};try{var a=r(t);if(!a)return;var o=t=>t&&t.init&&t.init(r.S[s],i,{shareScopeMap:r.S||{},shareScopeKeys:e});if(a.then)return d.push(a.then(o,n));var c=o(a);if(c&&"boolean"!=typeof c&&c.then)return d.push(c.catch(n))}catch(e){n(e)}};const d=c.initializeSharing(s,{strategy:c.options.shareStrategy,initScope:i,from:"build"});a(r);const h=r.federation.bundlerRuntimeOptions.remotes;return h&&Object.keys(h.idToRemoteMap).forEach(e=>{const r=h.idToRemoteMap[e],t=h.idToExternalAndNameMapping[e][2];if(r.length>1)u(t);else if(1===r.length){const e=r[0];o.includes(e.externalType)||u(t)}}),d.length?t[s]=Promise.all(d).then(()=>t[s]=!0):t[s]=!0}(s))}),Promise.all(c).then(()=>!0)},S:{},installInitialConsumes:function(e){i(e);const{moduleToHandlerMapping:r,webpackRequire:t,installedModules:n,initialConsumes:a,asyncLoad:o}=e,s=[];a.forEach(e=>{s.push([e,()=>function(e){const{moduleId:r,moduleToHandlerMapping:t,webpackRequire:n,asyncLoad:a}=e,o=n.federation.instance;if(!o)throw new Error("Federation instance not found!");const{shareKey:i,shareInfo:s}=t[r];try{const e=c(n,i),r={...s};return e&&(r.treeShaking={usedExports:e,useIn:[o.options.name]}),a?o.loadShare(i,{customShareInfo:r}):o.loadShareSync(i,{customShareInfo:r})}catch(e){throw console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.'),console.error("The original error message is as follows: "),e}}({moduleId:e,moduleToHandlerMapping:r,webpackRequire:t,asyncLoad:o})])});const l=(e,a)=>{t.m[e]=o=>{n[e]=0,delete t.c[e];const i=a();if("function"!=typeof i)throw new Error(`Shared module is not available for eager consumption: ${e}`);const s=i(),{shareInfo:c}=r[e];if(c?.shareConfig?.layer&&s&&"object"==typeof s)try{s.hasOwnProperty("layer")&&void 0!==s.layer||(s.layer=c.shareConfig.layer)}catch(e){}o.exports=s}};if(o)return Promise.all(s.map(async([e,r])=>{const t=await r();l(e,()=>t)}));s.forEach(([e,r])=>{l(e,r)})},initContainerEntry:function(e){const{webpackRequire:r,shareScope:t,initScope:n,shareScopeKey:a,remoteEntryInitOptions:o}=e;if(!r.S)return;if(!r.federation||!r.federation.instance||!r.federation.initOptions)return;const i=r.federation.instance;i.initOptions({name:r.federation.initOptions.name,remotes:[],...o});const s=o?.shareScopeKeys,c=o?.shareScopeMap;if(a&&"string"!=typeof a)a.forEach(e=>{if(!s||!c)return void i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}});c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})});else{const e=a||"default";Array.isArray(s)?s.forEach(e=>{c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})}):i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}})}return r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),Array.isArray(a)?Boolean(r.federation.initOptions.shared)?r.I(a,n):Promise.all(a.map(e=>r.I(e,n))).then(()=>!0):r.I(a||"default",n)},init:function({webpackRequire:e}){const{initOptions:r,runtime:n,sharedFallback:a,bundlerRuntime:o,libraryType:i}=e.federation;if(!r)throw new Error("initOptions is required!");{const n=function(){return{name:"tree-shake-plugin",beforeInit(r){const{userOptions:n,origin:s,options:c}=r,l=n.version||c.version;if(!a)return r;const u=n.shared||{},d=[];Object.keys(u).forEach(r=>{(Array.isArray(u[r])?u[r]:[u[r]]).forEach(t=>{d.push([r,t]),"get"in t&&(t.treeShaking||={},t.treeShaking.get=t.get,t.get=o.getSharedFallbackGetter({shareKey:r,factory:t.get,webpackRequire:e,libraryType:i,version:t.version}))})});const h=k.global.getGlobalSnapshotInfoByModuleInfo({name:s.name,version:l});return h&&"shared"in h?(Object.keys(c.shared||{}).forEach(e=>{c.shared[e].forEach(r=>{d.push([e,r])})}),d.forEach(([e,r])=>{((e,r)=>{const n=h.shared.find(r=>r.sharedName===e);if(!n)return;const{treeShaking:a}=r;if(!a)return;const{secondarySharedTreeShakingName:o,secondarySharedTreeShakingEntry:c,treeShakingStatus:l}=n;a.status!==l&&(a.status=l,c&&i&&o&&(a.get=async()=>{const e=await(0,p.getRemoteEntry)({origin:s,remoteInfo:{name:o,entry:c,type:i,entryGlobalName:o,shareScope:"default"}});return await e.init(s,t.federation.bundlerRuntime),e.get()}))})(e,r)}),r):r}}};r.plugins||=[],r.plugins.push(n())}return n.init(r)},getSharedFallbackGetter:({shareKey:e,factory:r,version:t,webpackRequire:n,libraryType:a="global"})=>{const{runtime:o,instance:i,bundlerRuntime:s,sharedFallback:c}=n.federation;if(!c)return r;const l=c[e];if(!l)return r;const p=t?l.find(e=>e[1]===t):l[0];if(!p)throw new Error(`No fallback item found for shareKey: ${e} and version: ${t}`);return()=>o.getRemoteEntry({origin:n.federation.instance,remoteInfo:{name:p[2],entry:`${n.p}${p[0]}`,type:a,entryGlobalName:p[2],shareScope:"default"}}).then(r=>{if(!r)throw new Error(`Failed to load fallback entry for shareKey: ${e} and version: ${t}`);return r.init(n.federation.instance,s).then(()=>r.get())})}},w={runtime:n,instance:void 0,initOptions:void 0,bundlerRuntime:_,attachShareScopeMap:a,bundlerRuntimeOptions:{}};if(!t.federation.runtime||!t.federation.bundlerRuntime){var I=t.federation;for(var T in t.federation={},w)t.federation[T]=w[T];for(var T in I)t.federation[T]=I[T]}t.federation.instance||(t.federation.instance=t.federation.bundlerRuntime.init({webpackRequire:t}),t.federation.attachShareScopeMap&&t.federation.attachShareScopeMap(t),t.federation.installInitialConsumes&&t.federation.installInitialConsumes())},9421(e,r,t){var n={"./start":()=>Promise.all([t.e(31),t.e(435),t.e(410)]).then(()=>()=>t(5410))},a=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),o=(e,r,n)=>t.federation.bundlerRuntime.initContainerEntry({webpackRequire:t,shareScope:e,initScope:r,remoteEntryInitOptions:n,shareScopeKey:"default"});t.d(r,{get:()=>a,init:()=>o})}},s={};function c(e){var r=s[e];if(void 0!==r)return r.exports;var t=s[e]={exports:{}},n={id:e,module:t,factory:i[e],require:c};return c.i.forEach(function(e){e(n)}),t=n.module,n.factory.call(t.exports,t,t.exports,n.require),t.exports}c.m=i,c.c=s,c.i=[],c.x=e=>{},c.federation||(c.federation={initOptions:{name:"@ampath/esm-reports-app",remotes:[],shareStrategy:"version-first"},chunkMatcher:function(e){return!/^(31|435|680|987)$/.test(e)},rootOutputDir:"",bundlerRuntimeOptions:{remotes:{remoteInfos:{},webpackRequire:c,idToRemoteMap:{},chunkMapping:{},idToExternalAndNameMapping:{}}}},c.consumesLoadingData={},c.remotesLoadingData={}),c.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return c.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var a=Object.create(null);c.r(a);var o={};e=e||[null,r({}),r([]),r(r)];for(var i=2&n&&t;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>t[e]);return o.default=()=>t,c.d(a,o),a},c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((r,t)=>(c.f[t](e,r),r),[])),c.u=e=>e+".js",c.miniCssF=e=>e+".css",c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@ampath/esm-reports-app:",c.l=(e,r,a,o)=>{if(t[e])t[e].push(r);else{var i,s;if(void 0!==a)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+a){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack",n+a),i.src=e),t[e]=[r];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(h);var a=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),r)return r(n)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),s&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{c.S={};var e={},r={};c.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];c.o(c.S,t)||(c.S[t]={});var o=c.S[t],i="@ampath/esm-reports-app",s=(e,r,t,n)=>{var a=o[e]=o[e]||{},s=a[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(a[r]={get:t,from:i,eager:!!n})},l=[];return"default"===t&&(s("@openmrs/esm-framework","11.0.1-pre.5776",()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295))),s("dayjs","1.11.20",()=>c.e(353).then(()=>()=>c(4353))),s("react-i18next","16.6.6",()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311))),s("react-router-dom","6.30.3",()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282))),s("react","18.3.1",()=>c.e(540).then(()=>()=>c(6540)))),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{c.federation.initOptions.shared={"@openmrs/esm-framework":[{version:"11.0.1-pre.5776",get:()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"*",strictVersion:!1,singleton:!0,layer:null}}],dayjs:[{version:"1.11.20",get:()=>c.e(353).then(()=>()=>c(4353)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"1.x",strictVersion:!1,singleton:!0,layer:null}}],"react-i18next":[{version:"16.6.6",get:()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"16.x",strictVersion:!1,singleton:!0,layer:null}}],"react-router-dom":[{version:"6.30.3",get:()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"6.x",strictVersion:!1,singleton:!0,layer:null}}],react:[{version:"18.3.1",get:()=>c.e(540).then(()=>()=>c(6540)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"18.x",strictVersion:!1,singleton:!0,layer:null}}]},c.S={};var e={},r={};c.I=(t,n)=>c.federation.bundlerRuntime.I({shareScopeName:t,webpackRequire:c,initPromises:e,initTokens:r,initScope:n})})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e})(),(()=>{var e={};c.consumesLoadingData.moduleIdToConsumeDataMapping={6031:{fallback:()=>c.e(540).then(()=>()=>c(6540)),shareScope:["default"],singleton:!0,requiredVersion:"18.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react"},6435:{fallback:()=>Promise.all([c.e(961),c.e(282)]).then(()=>()=>c(282)),shareScope:["default"],singleton:!0,requiredVersion:"6.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-router-dom"},7693:{fallback:()=>Promise.all([c.e(961),c.e(427),c.e(478),c.e(295),c.e(680),c.e(987)]).then(()=>()=>c(9295)),shareScope:["default"],singleton:!0,requiredVersion:"*",strictVersion:!1,eager:!1,layer:void 0,shareKey:"@openmrs/esm-framework"},7680:{fallback:()=>c.e(353).then(()=>()=>c(4353)),shareScope:["default"],singleton:!0,requiredVersion:"1.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"dayjs"},3987:{fallback:()=>c.e(311).then(()=>()=>c(3311)),shareScope:["default"],singleton:!0,requiredVersion:"16.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-i18next"}};var r={};c.consumesLoadingData.chunkMapping={31:[6031],410:[7693],435:[6435],680:[7680],987:[3987]},c.f.consumes=(t,n)=>{c.federation.bundlerRuntime.consumes({chunkMapping:c.consumesLoadingData.chunkMapping,installedModules:e,chunkId:t,moduleToHandlerMapping:r,promises:n,webpackRequire:c})}})(),(()=>{if("undefined"!=typeof document){var e={462:0};c.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{295:1,907:1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var n=c.miniCssF(e),a=c.p+n;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var a=(i=t[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(a===e||a===r))return i}var o=document.getElementsByTagName("style");for(n=0;n<o.length;n++){var i;if((a=(i=o[n]).getAttribute("data-href"))===e||a===r)return i}})(n,a))return r();((e,r,t,n,a)=>{var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",c.nc&&(o.nonce=c.nc),o.onerror=o.onload=t=>{if(o.onerror=o.onload=null,"load"===t.type)n();else{var i=t&&t.type,s=t&&t.target&&t.target.href||r,c=new Error("Loading CSS chunk "+e+" failed.\n("+i+": "+s+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=i,c.request=s,o.parentNode&&o.parentNode.removeChild(o),a(c)}},o.href=r,document.head.appendChild(o)})(e,a,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),a=c.x,o=!1,c.x=()=>{if(o||(o=!0,c(2464)),"function"==typeof a)return a();console.warn("[Module Federation] prevStartup is not a function, skipping startup execution")},(()=>{var e={462:0};c.f.j=(r,t)=>{var n=c.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(31|435|680|987)$/.test(r))e[r]=0;else{var a=new Promise((t,a)=>n=e[r]=[t,a]);t.push(n[2]=a);var o=c.p+c.u(r),i=new Error;c.l(o,t=>{if(c.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[o,i,s]=t,l=0;if(o.some(r=>0!==e[r])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);s&&s(c)}for(r&&r(t);l<o.length;l++)a=o[l],c.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_ampath_esm_reports_app=self.webpackChunk_ampath_esm_reports_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),c.x();var l=c(9421);_ampath_esm_reports_app=l})();
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"ampath-reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","privileges":["O3 View Reports Dashboard"],"meta":{"name":"reports","slot":"ampath-reports-dashboard-slot","title":"Reports"},"online":true,"offline":true},{"component":"root","name":"ampath-reports-dashboard-root","slot":"ampath-reports-dashboard-slot","privileges":["O3 View Reports Dashboard"]}],"pages":[],"version":"1.0.0-next.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"ampath-reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","privileges":["O3 View Reports Dashboard"],"meta":{"name":"reports","slot":"ampath-reports-dashboard-slot","title":"Reports"},"online":true,"offline":true},{"component":"root","name":"ampath-reports-dashboard-root","slot":"ampath-reports-dashboard-slot","privileges":["O3 View Reports Dashboard"]}],"pages":[],"version":"1.0.0-next.49"}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-location-details';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { openmrsFetch, useSession } from '@openmrs/esm-framework';
|
|
3
|
+
|
|
4
|
+
export interface LocationDetails {
|
|
5
|
+
county?: string;
|
|
6
|
+
subCounty?: string;
|
|
7
|
+
/** The location attribute carrying the Kenya Master Health Facility List code */
|
|
8
|
+
kmhflCode?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The extra masthead facts the MOH forms print but the session object does
|
|
13
|
+
* not carry: County / Sub-County map to the location's address fields, and
|
|
14
|
+
* the KMHFL code is whichever location attribute's type names the master
|
|
15
|
+
* facility list (its exact type name varies by server, so the type is
|
|
16
|
+
* matched by name). Values stay blank until the location answers.
|
|
17
|
+
*/
|
|
18
|
+
export function useLocationDetails(): LocationDetails {
|
|
19
|
+
const session = useSession();
|
|
20
|
+
const locationUuid = session?.sessionLocation?.uuid;
|
|
21
|
+
const [details, setDetails] = useState<LocationDetails>({});
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!locationUuid) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const abortController = new AbortController();
|
|
29
|
+
|
|
30
|
+
openmrsFetch(
|
|
31
|
+
`/ws/rest/v1/location/${locationUuid}?v=custom:(display,stateProvince,countyDistrict,attributes:(display,attributeType:(display)))`,
|
|
32
|
+
{ signal: abortController.signal },
|
|
33
|
+
)
|
|
34
|
+
.then(async (response) => {
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const location = await response.json();
|
|
40
|
+
const kmhfl = (location?.attributes ?? []).find((attribute: any) =>
|
|
41
|
+
/kmhfl|mfl|master health facility/i.test(attribute?.attributeType?.display ?? ''),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
setDetails({
|
|
45
|
+
county: location?.stateProvince || undefined,
|
|
46
|
+
subCounty: location?.countyDistrict || undefined,
|
|
47
|
+
kmhflCode: kmhfl?.display || undefined,
|
|
48
|
+
});
|
|
49
|
+
})
|
|
50
|
+
.catch(() => {
|
|
51
|
+
/* the header simply keeps its blanks when the lookup fails */
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return () => abortController.abort();
|
|
55
|
+
}, [locationUuid]);
|
|
56
|
+
|
|
57
|
+
return details;
|
|
58
|
+
}
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
export interface RegisterColumn {
|
|
3
3
|
header: string;
|
|
4
4
|
value: (row: Record<string, any>, index: number) => unknown;
|
|
5
|
+
/**
|
|
6
|
+
* Keep the cell as text in the CSV so Excel never reinterprets it:
|
|
7
|
+
* identifiers lose leading zeros and phone numbers become `#NAME?`
|
|
8
|
+
* formulas when the spreadsheet parses them as numbers.
|
|
9
|
+
*/
|
|
10
|
+
text?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Allow the cell to wrap on screen. Registers keep their columns
|
|
13
|
+
* `nowrap` so short cells stay compact; prose columns (diagnoses,
|
|
14
|
+
* referrals, comments) would otherwise stretch the whole row wide.
|
|
15
|
+
*/
|
|
16
|
+
wrap?: boolean;
|
|
5
17
|
}
|
|
6
18
|
|
|
7
19
|
/** The age bands the registers tabulate against, in the order they appear */
|
|
@@ -44,6 +44,11 @@ interface RegisterLayoutProps {
|
|
|
44
44
|
/** The register's own columns. Without them the export falls back to the
|
|
45
45
|
response's raw fields, which will not match the printed form. */
|
|
46
46
|
columns?: RegisterColumn[];
|
|
47
|
+
/**
|
|
48
|
+
* The printed form's own sub-headings (e.g. its column letters), written as
|
|
49
|
+
* a second CSV row so exports stay line-numbered against the paper form.
|
|
50
|
+
*/
|
|
51
|
+
subHeaders?: string[];
|
|
47
52
|
/** The register table. Optional: MOH 510 has no table implemented yet. */
|
|
48
53
|
children?: React.ReactNode;
|
|
49
54
|
}
|
|
@@ -73,6 +78,7 @@ const RegisterLayout: React.FC<RegisterLayoutProps> = ({
|
|
|
73
78
|
onPageChange,
|
|
74
79
|
fetchAll,
|
|
75
80
|
columns,
|
|
81
|
+
subHeaders,
|
|
76
82
|
children,
|
|
77
83
|
}) => {
|
|
78
84
|
/* The same register serves every indicator that links to it, so without this
|
|
@@ -127,7 +133,7 @@ const RegisterLayout: React.FC<RegisterLayoutProps> = ({
|
|
|
127
133
|
.replace(/^-|-$/g, '')
|
|
128
134
|
.toLowerCase();
|
|
129
135
|
|
|
130
|
-
downloadCsv(columns ? columnsToCsv(all, columns) : rowsToCsv(all), `${slug}.csv`);
|
|
136
|
+
downloadCsv(columns ? columnsToCsv(all, columns, { subHeaderRow: subHeaders }) : rowsToCsv(all), `${slug}.csv`);
|
|
131
137
|
} catch (error) {
|
|
132
138
|
showReportError('the register export', error);
|
|
133
139
|
} finally {
|
|
@@ -44,6 +44,15 @@
|
|
|
44
44
|
white-space: nowrap;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/* Long prose columns (diagnoses, referrals, comments) wrap inside a bounded
|
|
48
|
+
width instead of stretching the row past the fold. */
|
|
49
|
+
.tableBordered td.wrapCell {
|
|
50
|
+
white-space: normal;
|
|
51
|
+
min-width: 8rem;
|
|
52
|
+
max-width: 16rem;
|
|
53
|
+
overflow-wrap: anywhere;
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
.tableStriped tbody tr:nth-of-type(odd) {
|
|
48
57
|
background-color: $ui-01;
|
|
49
58
|
}
|
|
@@ -11,17 +11,47 @@ import { type RegisterColumn } from './register-columns';
|
|
|
11
11
|
* wants anyway.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Forces text Excel cannot mangle. A cell starting with `=`, `+`, `-` or `@`
|
|
16
|
+
* is parsed as a formula (`+2547...` becomes `#NAME?`), and a long digit-only
|
|
17
|
+
* cell is reinterpreted as a number (leading zeros dropped, switched to
|
|
18
|
+
* scientific notation), so both are emitted as an explicit text formula
|
|
19
|
+
* (`"..."` quoted inside `=`, which Excel renders as literal text).
|
|
20
|
+
*/
|
|
21
|
+
const FORMULA_PREFIX = /^[=+\-@]/;
|
|
22
|
+
const LONG_DIGITS = /^\d{9,}$/;
|
|
23
|
+
|
|
24
|
+
function escapeCell(value: unknown, forceText = false): string {
|
|
15
25
|
const text = value === null || value === undefined ? '' : String(value).replace(/\s+/g, ' ').trim();
|
|
16
26
|
|
|
27
|
+
if (forceText && text !== '') {
|
|
28
|
+
return `="${text.replace(/"/g, '""')}"`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (text !== '' && (FORMULA_PREFIX.test(text) || LONG_DIGITS.test(text))) {
|
|
32
|
+
return `="${text.replace(/"/g, '""')}"`;
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
18
36
|
}
|
|
19
37
|
|
|
20
38
|
/** Serialises using the register's own columns, so the file matches the form */
|
|
21
|
-
export function columnsToCsv(
|
|
22
|
-
|
|
39
|
+
export function columnsToCsv(
|
|
40
|
+
rows: Array<Record<string, any>>,
|
|
41
|
+
columns: RegisterColumn[],
|
|
42
|
+
options?: {
|
|
43
|
+
/** A second header row (e.g. the printed form's column letters) */
|
|
44
|
+
subHeaderRow?: string[];
|
|
45
|
+
},
|
|
46
|
+
): string {
|
|
47
|
+
const headerRows = [
|
|
23
48
|
columns.map((column) => escapeCell(column.header)).join(','),
|
|
24
|
-
...
|
|
49
|
+
...(options?.subHeaderRow ? [options.subHeaderRow.map((cell) => escapeCell(cell)).join(',')] : []),
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
return [
|
|
53
|
+
...headerRows,
|
|
54
|
+
...rows.map((row, index) => columns.map((column) => escapeCell(column.value(row, index), column.text)).join(',')),
|
|
25
55
|
].join('\r\n');
|
|
26
56
|
}
|
|
27
57
|
|
|
@@ -38,7 +68,7 @@ export function rowsToCsv(rows: Array<Record<string, any>>): string {
|
|
|
38
68
|
const columns = Array.from(keys);
|
|
39
69
|
|
|
40
70
|
return [
|
|
41
|
-
columns.map(escapeCell).join(','),
|
|
71
|
+
columns.map((column) => escapeCell(column)).join(','),
|
|
42
72
|
...rows.map((row) => columns.map((column) => escapeCell(row[column])).join(',')),
|
|
43
73
|
].join('\r\n');
|
|
44
74
|
}
|
|
@@ -15,11 +15,19 @@ interface DatatableWrapperProps {
|
|
|
15
15
|
rows: Omit<DataTableRow<any[]>, 'cells'>[];
|
|
16
16
|
headers: DataTableHeader[];
|
|
17
17
|
subHeaders?: string[];
|
|
18
|
+
/** Header keys whose cells wrap instead of stretching the row (`wrap: true` columns) */
|
|
19
|
+
wrapKeys?: readonly string[];
|
|
18
20
|
/** Applied to the table, so a register can use its own stylesheet */
|
|
19
21
|
className?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
const DatatableWrapper: React.FC<DatatableWrapperProps> = ({
|
|
24
|
+
const DatatableWrapper: React.FC<DatatableWrapperProps> = ({
|
|
25
|
+
rows,
|
|
26
|
+
headers,
|
|
27
|
+
subHeaders = [],
|
|
28
|
+
wrapKeys = [],
|
|
29
|
+
className,
|
|
30
|
+
}) => {
|
|
23
31
|
return (
|
|
24
32
|
<DataTable rows={rows} headers={headers}>
|
|
25
33
|
{({ rows, headers, getTableProps, getHeaderProps, getRowProps, getCellProps }) => (
|
|
@@ -41,8 +49,13 @@ const DatatableWrapper: React.FC<DatatableWrapperProps> = ({ rows, headers, subH
|
|
|
41
49
|
<TableBody>
|
|
42
50
|
{rows.map((row) => (
|
|
43
51
|
<TableRow {...getRowProps({ row })}>
|
|
44
|
-
{row.cells.map((cell) => (
|
|
45
|
-
<TableCell
|
|
52
|
+
{row.cells.map((cell, i) => (
|
|
53
|
+
<TableCell
|
|
54
|
+
{...getCellProps({ cell })}
|
|
55
|
+
className={wrapKeys.includes(headers[i]?.key) ? 'wrapCell' : undefined}
|
|
56
|
+
>
|
|
57
|
+
{cell.value}
|
|
58
|
+
</TableCell>
|
|
46
59
|
))}
|
|
47
60
|
</TableRow>
|
|
48
61
|
))}
|
|
@@ -3,6 +3,7 @@ import dayjs from 'dayjs';
|
|
|
3
3
|
import TableWrapper from '../table-wrapper/table-wrapper.component';
|
|
4
4
|
import TableRowMapper from '../table-wrapper/table-row-mapper.component';
|
|
5
5
|
import { getCell } from '../../utils/utils';
|
|
6
|
+
import { useLocationDetails } from '../../common/report-header';
|
|
6
7
|
import styles from './moh-240.scss';
|
|
7
8
|
|
|
8
9
|
interface MOH240HeaderProps {
|
|
@@ -14,19 +15,21 @@ interface MOH240HeaderProps {
|
|
|
14
15
|
const asDate = (value?: string) => (value ? dayjs(value).format('DD/MM/YYYY') : '');
|
|
15
16
|
|
|
16
17
|
const MOH240Header: React.FC<MOH240HeaderProps> = ({ facility = '', startDate, endDate }) => {
|
|
18
|
+
const { county, subCounty, kmhflCode } = useLocationDetails();
|
|
19
|
+
|
|
17
20
|
const tableRows = useMemo(() => {
|
|
18
21
|
return [
|
|
19
22
|
{
|
|
20
|
-
tableCells: [getCell('', 'County:', 1, 1, true), getCell('', '', 3)],
|
|
23
|
+
tableCells: [getCell('', 'County:', 1, 1, true), getCell('', county ?? '', 3)],
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
|
-
tableCells: [getCell('', 'Sub-County:', 1, 1, true), getCell('', '', 3)],
|
|
26
|
+
tableCells: [getCell('', 'Sub-County:', 1, 1, true), getCell('', subCounty ?? '', 3)],
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
29
|
tableCells: [getCell('', 'Health Facility:', 1, 1, true), getCell('', facility, 3)],
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
|
-
tableCells: [getCell('', 'KMHFL Code:', 1, 1, true), getCell('', '', 3)],
|
|
32
|
+
tableCells: [getCell('', 'KMHFL Code:', 1, 1, true), getCell('', kmhflCode ?? '', 3)],
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
35
|
tableCells: [
|
|
@@ -45,7 +48,7 @@ const MOH240Header: React.FC<MOH240HeaderProps> = ({ facility = '', startDate, e
|
|
|
45
48
|
],
|
|
46
49
|
},
|
|
47
50
|
];
|
|
48
|
-
}, [facility, startDate, endDate]);
|
|
51
|
+
}, [county, subCounty, kmhflCode, facility, startDate, endDate]);
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
<div className={styles.headerSection}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RegisterColumn } from '../../common/report-register';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
2
3
|
|
|
3
4
|
/** The register's columns, in the order the printed MOH 240 prints them */
|
|
4
5
|
export const MOH_240_HEADERS = [
|
|
@@ -36,6 +37,19 @@ export const MOH_240_SUB_HEADERS = MOH_240_HEADERS.map((_, i) =>
|
|
|
36
37
|
i < 26 ? String.fromCharCode(65 + i) : `A${String.fromCharCode(65 + i - 26)}`,
|
|
37
38
|
);
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Columns whose values must stay text in the CSV: identifiers lose leading
|
|
42
|
+
* zeros and phone numbers open as `#NAME?` formulas when Excel parses them
|
|
43
|
+
* as numbers.
|
|
44
|
+
*/
|
|
45
|
+
export const MOH_240_TEXT_KEYS = ['lab_no', 'opd_ip_ref_no', 'telephone_number', 'receipt_number'];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Prose columns allowed to wrap on screen; everything else stays `nowrap` so
|
|
49
|
+
* one long value cannot stretch the 27-column row past the fold.
|
|
50
|
+
*/
|
|
51
|
+
export const MOH_240_WRAP_KEYS = ['clinical_diagnosis', 'type_of_specimen', 'referrals', 'comments'];
|
|
52
|
+
|
|
39
53
|
/**
|
|
40
54
|
* The results column carries whichever indicator the drill-down was opened for,
|
|
41
55
|
* so it is read from a field named by that indicator rather than from `results`.
|
|
@@ -53,12 +67,39 @@ export function resultFieldFor(indicator: string): string {
|
|
|
53
67
|
return indicator;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Formats a datetime column the way the printed form reads it. Values the
|
|
72
|
+
* payload already sends as `DD/MM/YYYY` pass through untouched; only raw ISO
|
|
73
|
+
* datetimes (`2026-08-19T10:18:14.000Z`) are reformatted, so screen and CSV
|
|
74
|
+
* agree no matter which shape the endpoint returns.
|
|
75
|
+
*/
|
|
76
|
+
export function formatRegisterDate(value: unknown): string {
|
|
77
|
+
if (value === null || value === undefined || value === '') {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
const text = String(value).trim();
|
|
81
|
+
return /^\d{4}-\d{2}-\d{2}/.test(text) ? dayjs(text).format('DD/MM/YYYY') : text;
|
|
82
|
+
}
|
|
83
|
+
|
|
56
84
|
/** Exported with the register's own headings, so the CSV matches the form */
|
|
57
85
|
export function moh240Columns(indicator: string): RegisterColumn[] {
|
|
58
86
|
const resultField = resultFieldFor(indicator);
|
|
59
87
|
|
|
60
88
|
return MOH_240_HEADERS.map(({ key, header }) => ({
|
|
61
89
|
header,
|
|
62
|
-
value: (row: Record<string, any>) =>
|
|
90
|
+
value: (row: Record<string, any>) => {
|
|
91
|
+
if (key === 'results') {
|
|
92
|
+
// The lab-706 register sends the row's translated result directly;
|
|
93
|
+
// the per-indicator field remains the fallback for payloads that
|
|
94
|
+
// only carry the test slots.
|
|
95
|
+
return row.results ?? row[resultField] ?? '';
|
|
96
|
+
}
|
|
97
|
+
if (key === 'test_datetime') {
|
|
98
|
+
return formatRegisterDate(row[key]);
|
|
99
|
+
}
|
|
100
|
+
return row[key] ?? '';
|
|
101
|
+
},
|
|
102
|
+
text: (MOH_240_TEXT_KEYS as readonly string[]).includes(key) || undefined,
|
|
103
|
+
wrap: (MOH_240_WRAP_KEYS as readonly string[]).includes(key) || undefined,
|
|
63
104
|
}));
|
|
64
105
|
}
|
|
@@ -5,7 +5,7 @@ import { useSession } from '@openmrs/esm-framework';
|
|
|
5
5
|
import Moh240Register from './sub-reports/moh-240-register.component';
|
|
6
6
|
import Moh240PageSummary from './sub-reports/page-summary.component';
|
|
7
7
|
import MOH240Header from './moh-240-header.component';
|
|
8
|
-
import { moh240Columns } from './moh-240.columns';
|
|
8
|
+
import { MOH_240_SUB_HEADERS, moh240Columns } from './moh-240.columns';
|
|
9
9
|
import { getMoh706PatientList } from '../../resources/moh-706.resource';
|
|
10
10
|
import { getMoh505PatientList } from '../../resources/moh-505.resource';
|
|
11
11
|
import { RegisterLayout, usePatientList } from '../../common/report-register';
|
|
@@ -61,11 +61,12 @@ const Moh240Report: React.FC = () => {
|
|
|
61
61
|
onPageChange={onPageChange}
|
|
62
62
|
fetchAll={fetchAll}
|
|
63
63
|
columns={moh240Columns(indicators)}
|
|
64
|
+
subHeaders={MOH_240_SUB_HEADERS}
|
|
64
65
|
>
|
|
65
66
|
<div className={styles.sheet}>
|
|
66
67
|
<MOH240Header facility={session?.sessionLocation?.display ?? ''} startDate={startDate} endDate={endDate} />
|
|
67
68
|
<Moh240Register patientList={patientList} indicator={indicators} />
|
|
68
|
-
<Moh240PageSummary />
|
|
69
|
+
<Moh240PageSummary rows={patientList} />
|
|
69
70
|
</div>
|
|
70
71
|
</RegisterLayout>
|
|
71
72
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import DatatableWrapper from '../../datatable-wrapper/datatable-wrapper.component';
|
|
3
|
-
import { MOH_240_HEADERS, MOH_240_SUB_HEADERS,
|
|
3
|
+
import { MOH_240_HEADERS, MOH_240_SUB_HEADERS, MOH_240_WRAP_KEYS, formatRegisterDate } from '../moh-240.columns';
|
|
4
4
|
import tableStyles from '../../../common/report-register/register-table.scss';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
|
|
@@ -10,13 +10,11 @@ interface Moh240RegisterProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const Moh240Register: React.FC<Moh240RegisterProps> = ({ patientList = [], indicator = '' }) => {
|
|
13
|
-
const resultField = resultFieldFor(indicator);
|
|
14
|
-
|
|
15
13
|
const rows = patientList.map((patient, index) => {
|
|
16
14
|
const row: { id: string } & Record<string, any> = { id: String(index) };
|
|
17
15
|
|
|
18
16
|
MOH_240_HEADERS.forEach(({ key }) => {
|
|
19
|
-
row[key] = (key === '
|
|
17
|
+
row[key] = (key === 'test_datetime' ? formatRegisterDate(patient[key]) : patient[key]) || '';
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
return row;
|
|
@@ -28,6 +26,7 @@ const Moh240Register: React.FC<Moh240RegisterProps> = ({ patientList = [], indic
|
|
|
28
26
|
headers={[...MOH_240_HEADERS]}
|
|
29
27
|
rows={rows}
|
|
30
28
|
subHeaders={MOH_240_SUB_HEADERS}
|
|
29
|
+
wrapKeys={MOH_240_WRAP_KEYS}
|
|
31
30
|
className={classNames(tableStyles.table, tableStyles.tableBordered, tableStyles.tableStriped)}
|
|
32
31
|
/>
|
|
33
32
|
</div>
|