@openmrs/esm-fast-data-entry-app 1.0.0-pre.36 → 1.0.0-pre.44

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.
Files changed (46) hide show
  1. package/.github/pull_request_template.md +18 -0
  2. package/README.md +37 -12
  3. package/dist/120.js +2 -0
  4. package/dist/{147.js.LICENSE.txt → 120.js.LICENSE.txt} +6 -0
  5. package/dist/574.js +1 -1
  6. package/dist/61.js +1 -0
  7. package/dist/804.js +1 -1
  8. package/dist/84.js +1 -0
  9. package/dist/990.js +1 -0
  10. package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
  11. package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +72 -72
  12. package/dist/openmrs-esm-fast-data-entry-app.old +1 -1
  13. package/docs/config-icrc-forms.png +0 -0
  14. package/docs/config-other-forms.png +0 -0
  15. package/docs/configuring-form-categories.md +77 -0
  16. package/docs/fde-workflow.mov +0 -0
  17. package/docs/form-workflow-state-diagram.png +0 -0
  18. package/package.json +1 -1
  19. package/src/FormBootstrap.tsx +2 -0
  20. package/src/Root.tsx +6 -9
  21. package/src/context/FormWorkflowContext.tsx +43 -15
  22. package/src/context/FormWorkflowReducer.ts +41 -0
  23. package/src/form-entry-workflow/FormEntryWorkflow.tsx +116 -54
  24. package/src/form-entry-workflow/styles.scss +13 -6
  25. package/src/form-review-card/FormReviewCard.tsx +50 -0
  26. package/src/form-review-card/index.ts +3 -0
  27. package/src/form-review-card/styles.scss +38 -0
  28. package/src/hooks/index.ts +3 -1
  29. package/src/hooks/useFormState.ts +23 -0
  30. package/src/hooks/useGetEncounter.ts +22 -0
  31. package/src/patient-banner/PatientBanner.test.tsx +1 -1
  32. package/src/patient-banner/PatientBanner.tsx +51 -105
  33. package/src/patient-banner/styles.scss +13 -28
  34. package/src/patient-card/PatientCard.tsx +2 -2
  35. package/src/patient-card/styles.scss +6 -5
  36. package/src/patient-search-header/PatientSearchHeader.tsx +3 -1
  37. package/src/patient-search-header/styles.scss +6 -2
  38. package/src/workflow-review/WorkflowReview.tsx +36 -0
  39. package/src/workflow-review/index.ts +3 -0
  40. package/src/workflow-review/styles.scss +34 -0
  41. package/translations/en.json +1 -0
  42. package/dist/147.js +0 -2
  43. package/dist/508.js +0 -1
  44. package/dist/634.js +0 -2
  45. package/dist/634.js.LICENSE.txt +0 -5
  46. package/dist/954.js +0 -1
@@ -5,10 +5,9 @@
5
5
  "initial": false,
6
6
  "entry": false,
7
7
  "recorded": false,
8
- "size": 4640,
8
+ "size": 93704,
9
9
  "sizes": {
10
- "consume-shared": 42,
11
- "javascript": 4598
10
+ "javascript": 93704
12
11
  },
13
12
  "names": [],
14
13
  "idHints": [],
@@ -16,10 +15,34 @@
16
15
  "@openmrs/esm-fast-data-entry-app"
17
16
  ],
18
17
  "files": [
19
- "132.js"
18
+ "61.js"
19
+ ],
20
+ "auxiliaryFiles": [],
21
+ "hash": "34793f4c5b80e9bbd78b",
22
+ "childrenByOrder": {}
23
+ },
24
+ {
25
+ "rendered": true,
26
+ "initial": false,
27
+ "entry": false,
28
+ "recorded": false,
29
+ "reason": "split chunk (cache group: defaultVendors)",
30
+ "size": 1173789,
31
+ "sizes": {
32
+ "javascript": 1173789
33
+ },
34
+ "names": [],
35
+ "idHints": [
36
+ "vendors"
37
+ ],
38
+ "runtime": [
39
+ "@openmrs/esm-fast-data-entry-app"
40
+ ],
41
+ "files": [
42
+ "84.js"
20
43
  ],
21
44
  "auxiliaryFiles": [],
22
- "hash": "8235eb0760aae881dc5f",
45
+ "hash": "55982fc7e0a0b19c44d3",
23
46
  "childrenByOrder": {}
24
47
  },
25
48
  {
@@ -28,9 +51,9 @@
28
51
  "entry": false,
29
52
  "recorded": false,
30
53
  "reason": "split chunk (cache group: defaultVendors)",
31
- "size": 1228188,
54
+ "size": 584328,
32
55
  "sizes": {
33
- "javascript": 1228188
56
+ "javascript": 584328
34
57
  },
35
58
  "names": [],
36
59
  "idHints": [
@@ -40,10 +63,32 @@
40
63
  "@openmrs/esm-fast-data-entry-app"
41
64
  ],
42
65
  "files": [
43
- "147.js"
66
+ "120.js"
67
+ ],
68
+ "auxiliaryFiles": [],
69
+ "hash": "f581f85666374b1d2278",
70
+ "childrenByOrder": {}
71
+ },
72
+ {
73
+ "rendered": true,
74
+ "initial": false,
75
+ "entry": false,
76
+ "recorded": false,
77
+ "size": 4640,
78
+ "sizes": {
79
+ "consume-shared": 42,
80
+ "javascript": 4598
81
+ },
82
+ "names": [],
83
+ "idHints": [],
84
+ "runtime": [
85
+ "@openmrs/esm-fast-data-entry-app"
86
+ ],
87
+ "files": [
88
+ "132.js"
44
89
  ],
45
90
  "auxiliaryFiles": [],
46
- "hash": "a0e70fe34abee6f2ac03",
91
+ "hash": "0acb35e5baa813bb01ed",
47
92
  "childrenByOrder": {}
48
93
  },
49
94
  {
@@ -63,7 +108,7 @@
63
108
  ],
64
109
  "files": [],
65
110
  "auxiliaryFiles": [],
66
- "hash": "d2469fb289389c7befb0",
111
+ "hash": "dab26d723f608869beb5",
67
112
  "childrenByOrder": {}
68
113
  },
69
114
  {
@@ -87,7 +132,7 @@
87
132
  "247.js"
88
133
  ],
89
134
  "auxiliaryFiles": [],
90
- "hash": "ca184d1423a681d7ee65",
135
+ "hash": "c1818560c4302f8dcdb2",
91
136
  "childrenByOrder": {}
92
137
  },
93
138
  {
@@ -153,29 +198,7 @@
153
198
  "openmrs-esm-fast-data-entry-app.js"
154
199
  ],
155
200
  "auxiliaryFiles": [],
156
- "hash": "6b52d22808fb8ef3592f",
157
- "childrenByOrder": {}
158
- },
159
- {
160
- "rendered": true,
161
- "initial": false,
162
- "entry": false,
163
- "recorded": false,
164
- "size": 39501,
165
- "sizes": {
166
- "javascript": 39459,
167
- "consume-shared": 42
168
- },
169
- "names": [],
170
- "idHints": [],
171
- "runtime": [
172
- "@openmrs/esm-fast-data-entry-app"
173
- ],
174
- "files": [
175
- "508.js"
176
- ],
177
- "auxiliaryFiles": [],
178
- "hash": "3a49fef17f96dcb110e1",
201
+ "hash": "98d9156103fddd3603ce",
179
202
  "childrenByOrder": {}
180
203
  },
181
204
  {
@@ -199,7 +222,7 @@
199
222
  "536.js"
200
223
  ],
201
224
  "auxiliaryFiles": [],
202
- "hash": "b405c8e0fad403077d27",
225
+ "hash": "02cd3834df15f9fca816",
203
226
  "childrenByOrder": {}
204
227
  },
205
228
  {
@@ -207,9 +230,9 @@
207
230
  "initial": false,
208
231
  "entry": false,
209
232
  "recorded": false,
210
- "size": 500,
233
+ "size": 524,
211
234
  "sizes": {
212
- "javascript": 500
235
+ "javascript": 524
213
236
  },
214
237
  "names": [],
215
238
  "idHints": [],
@@ -220,7 +243,7 @@
220
243
  "574.js"
221
244
  ],
222
245
  "auxiliaryFiles": [],
223
- "hash": "db14a6f90d9c9b3967f6",
246
+ "hash": "59e4cbdf174350d269b8",
224
247
  "childrenByOrder": {}
225
248
  },
226
249
  {
@@ -244,31 +267,7 @@
244
267
  "595.js"
245
268
  ],
246
269
  "auxiliaryFiles": [],
247
- "hash": "51d7e5987315341aac79",
248
- "childrenByOrder": {}
249
- },
250
- {
251
- "rendered": true,
252
- "initial": false,
253
- "entry": false,
254
- "recorded": false,
255
- "reason": "split chunk (cache group: defaultVendors)",
256
- "size": 529929,
257
- "sizes": {
258
- "javascript": 529929
259
- },
260
- "names": [],
261
- "idHints": [
262
- "vendors"
263
- ],
264
- "runtime": [
265
- "@openmrs/esm-fast-data-entry-app"
266
- ],
267
- "files": [
268
- "634.js"
269
- ],
270
- "auxiliaryFiles": [],
271
- "hash": "841cf22613737f6af352",
270
+ "hash": "b8ecf178efc7072e7d36",
272
271
  "childrenByOrder": {}
273
272
  },
274
273
  {
@@ -289,7 +288,7 @@
289
288
  "776.js"
290
289
  ],
291
290
  "auxiliaryFiles": [],
292
- "hash": "54b00a900043f229185d",
291
+ "hash": "6e66cb877869f3408d72",
293
292
  "childrenByOrder": {}
294
293
  },
295
294
  {
@@ -297,10 +296,10 @@
297
296
  "initial": false,
298
297
  "entry": false,
299
298
  "recorded": false,
300
- "size": 9764,
299
+ "size": 1110,
301
300
  "sizes": {
302
301
  "consume-shared": 42,
303
- "javascript": 9722
302
+ "javascript": 1068
304
303
  },
305
304
  "names": [],
306
305
  "idHints": [],
@@ -311,7 +310,7 @@
311
310
  "804.js"
312
311
  ],
313
312
  "auxiliaryFiles": [],
314
- "hash": "9412414bb5d0f5c426f2",
313
+ "hash": "32e1df11234c73081ee7",
315
314
  "childrenByOrder": {}
316
315
  },
317
316
  {
@@ -359,7 +358,7 @@
359
358
  "935.js"
360
359
  ],
361
360
  "auxiliaryFiles": [],
362
- "hash": "17d62cf22498c82c2597",
361
+ "hash": "240b76706798c516be37",
363
362
  "childrenByOrder": {}
364
363
  },
365
364
  {
@@ -367,9 +366,10 @@
367
366
  "initial": false,
368
367
  "entry": false,
369
368
  "recorded": false,
370
- "size": 51122,
369
+ "size": 44076,
371
370
  "sizes": {
372
- "javascript": 51122
371
+ "javascript": 44034,
372
+ "consume-shared": 42
373
373
  },
374
374
  "names": [],
375
375
  "idHints": [],
@@ -377,10 +377,10 @@
377
377
  "@openmrs/esm-fast-data-entry-app"
378
378
  ],
379
379
  "files": [
380
- "954.js"
380
+ "990.js"
381
381
  ],
382
382
  "auxiliaryFiles": [],
383
- "hash": "c5062be67a9b065ff8df",
383
+ "hash": "70a1838bac7961d64f3f",
384
384
  "childrenByOrder": {}
385
385
  }
386
386
  ]
@@ -1 +1 @@
1
- System.register("@openmrs/esm-fast-data-entry-app",[],(function(e,r){return{execute:function(){e((()=>{var e,t,n,o,a,i,s,u,l,f,d,p,c,h,m={1858:(e,r,t)=>{(0,t(2722).s)(1)},2722:(e,r,t)=>{const n=t(3905).R;r.s=function(e){if(e||(e=1),!t.y.meta||!t.y.meta.url)throw console.error("__system_context__",t.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");t.p=n(t.y.meta.url,e)}},5356:(e,r,t)=>{t(1858)},3905:(e,r,t)=>{r.R=function(e,r){var t=document.createElement("a");t.href=e;for(var n="/"===t.pathname[0]?t.pathname:"/"+t.pathname,o=0,a=n.length;o!==r&&a>=0;)"/"===n[--a]&&o++;if(o!==r)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+r+") is greater than the number of directories ("+o+") in the URL path "+e);var i=n.slice(0,a+1);return t.protocol+"//"+t.host+i};Number.isInteger},6751:(e,r,t)=>{"use strict";var n={app:()=>t.e(132).then((()=>()=>t(8132)))},o=(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),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},v={};function y(e){var r=v[e];if(void 0!==r)return r.exports;var t=v[e]={id:e,loaded:!1,exports:{}};return m[e].call(t.exports,t,t.exports,y),t.loaded=!0,t.exports}return y.m=m,y.c=v,y.y=r,y.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return y.d(r,{a:r}),r},y.d=(e,r)=>{for(var t in r)y.o(r,t)&&!y.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},y.f={},y.e=e=>Promise.all(Object.keys(y.f).reduce(((r,t)=>(y.f[t](e,r),r)),[])),y.u=e=>e+".js",y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},t="@openmrs/esm-fast-data-entry-app:",y.l=(r,n,o,a)=>{if(e[r])e[r].push(n);else{var i,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var f=u[l];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==t+o){i=f;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,y.nc&&i.setAttribute("nonce",y.nc),i.setAttribute("data-webpack",t+o),i.src=r),e[r]=[n];var d=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[r];if(delete e[r],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),t)return t(n)},p=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)}},y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{y.S={};var e={},r={};y.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];y.o(y.S,t)||(y.S[t]={});var a=y.S[t],i="@openmrs/esm-fast-data-entry-app",s=(e,r,t,n)=>{var o=a[e]=a[e]||{},s=o[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(o[r]={get:t,from:i,eager:!!n})},u=[];return"default"===t&&(s("@openmrs/esm-framework","3.4.1-pre.161",(()=>Promise.all([y.e(595),y.e(211)]).then((()=>()=>y(595))))),s("carbon-icons","7.0.7",(()=>y.e(906).then((()=>()=>y(906))))),s("react-dom","16.14.0",(()=>Promise.all([y.e(935),y.e(211)]).then((()=>()=>y(3935))))),s("react-i18next","11.18.1",(()=>Promise.all([y.e(247),y.e(211)]).then((()=>()=>y(8247))))),s("react-router-dom","5.3.3",(()=>Promise.all([y.e(536),y.e(211)]).then((()=>()=>y(536))))),s("react","16.14.0",(()=>y.e(294).then((()=>()=>y(7294)))))),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),y.p="",n=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},o=(e,r)=>{e=n(e),r=n(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var o=e[t],a=(typeof o)[0];if(t>=r.length)return"u"==a;var i=r[t],s=(typeof i)[0];if(a!=s)return"o"==a&&"n"==s||"s"==s||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;t++}},a=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,t+="u"==(typeof(s=e[o]))[0]?"-":(n>0?".":"")+(n=2,s);return t}var i=[];for(o=1;o<e.length;o++){var s=e[o];i.push(0===s?"not("+u()+")":1===s?"("+u()+" || "+u()+")":2===s?i.pop()+" "+i.pop():a(s))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},i=(e,r)=>{if(0 in e){r=n(r);var t=e[0],o=t<0;o&&(t=-t-1);for(var a=0,s=1,u=!0;;s++,a++){var l,f,d=s<e.length?(typeof e[s])[0]:"";if(a>=r.length||"o"==(f=(typeof(l=r[a]))[0]))return!u||("u"==d?s>t&&!o:""==d!=o);if("u"==f){if(!u||"u"!=d)return!1}else if(u)if(d==f)if(s<=t){if(l!=e[s])return!1}else{if(o?l>e[s]:l<e[s])return!1;l!=e[s]&&(u=!1)}else if("s"!=d&&"n"!=d){if(o||s<=t)return!1;u=!1,s--}else{if(s<=t||f<d!=o)return!1;u=!1}else"s"!=d&&"n"!=d&&(u=!1,s--)}}var p=[],c=p.pop.bind(p);for(a=1;a<e.length;a++){var h=e[a];p.push(1==h?c()|c():2==h?c()&c():h?i(h,r):!c())}return!!c()},s=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&o(e,r)?r:e),0)},u=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+a(n)+")",l=(e,r,t,n)=>{var o=s(e,t);return i(n,o)||"undefined"!=typeof console&&console.warn&&console.warn(u(e,t,o,n)),f(e[t][o])},f=e=>(e.loaded=1,e.get()),d=(e=>function(r,t,n,o){var a=y.I(r);return a&&a.then?a.then(e.bind(e,r,y.S[r],t,n,o)):e(0,y.S[r],t,n,o)})(((e,r,t,n,o)=>r&&y.o(r,t)?l(r,0,t,n):o())),p={},c={311:()=>d("default","@openmrs/esm-framework",[1,"next"],(()=>Promise.all([y.e(595),y.e(211)]).then((()=>()=>y(595))))),4211:()=>d("default","react",[1,16,14],(()=>y.e(294).then((()=>()=>y(7294))))),2221:()=>d("default","react-router-dom",[1,5,0,0],(()=>y.e(536).then((()=>()=>y(536))))),3397:()=>d("default","react-i18next",[1,11],(()=>y.e(247).then((()=>()=>y(8247))))),8408:()=>d("default","react-dom",[1,16,0],(()=>y.e(935).then((()=>()=>y(3935)))))},h={132:[311],211:[4211],397:[3397],508:[8408],804:[2221]},y.f.consumes=(e,r)=>{y.o(h,e)&&h[e].forEach((e=>{if(y.o(p,e))return r.push(p[e]);var t=r=>{p[e]=0,y.m[e]=t=>{delete y.c[e],t.exports=r()}},n=r=>{delete p[e],y.m[e]=t=>{throw delete y.c[e],r}};try{var o=c[e]();o.then?r.push(p[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}))},(()=>{var e={447:0};y.f.j=(r,t)=>{var n=y.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(211|397)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=y.p+y.u(r),i=new Error;y.l(a,(t=>{if(y.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,s]=t,u=0;if(a.some((r=>0!==e[r]))){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);s&&s(y)}for(r&&r(t);u<a.length;u++)o=a[u],y.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),y.nc=void 0,y(5356),y(6751)})())}}}));
1
+ System.register("@openmrs/esm-fast-data-entry-app",[],(function(e,r){return{execute:function(){e((()=>{var e,t,n,o,a,i,s,u,l,f,d,p,c,h,m={1858:(e,r,t)=>{(0,t(2722).s)(1)},2722:(e,r,t)=>{const n=t(3905).R;r.s=function(e){if(e||(e=1),!t.y.meta||!t.y.meta.url)throw console.error("__system_context__",t.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");t.p=n(t.y.meta.url,e)}},5356:(e,r,t)=>{t(1858)},3905:(e,r,t)=>{r.R=function(e,r){var t=document.createElement("a");t.href=e;for(var n="/"===t.pathname[0]?t.pathname:"/"+t.pathname,o=0,a=n.length;o!==r&&a>=0;)"/"===n[--a]&&o++;if(o!==r)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+r+") is greater than the number of directories ("+o+") in the URL path "+e);var i=n.slice(0,a+1);return t.protocol+"//"+t.host+i};Number.isInteger},6751:(e,r,t)=>{"use strict";var n={app:()=>t.e(132).then((()=>()=>t(8132)))},o=(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),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},v={};function y(e){var r=v[e];if(void 0!==r)return r.exports;var t=v[e]={id:e,loaded:!1,exports:{}};return m[e].call(t.exports,t,t.exports,y),t.loaded=!0,t.exports}return y.m=m,y.c=v,y.y=r,y.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return y.d(r,{a:r}),r},y.d=(e,r)=>{for(var t in r)y.o(r,t)&&!y.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},y.f={},y.e=e=>Promise.all(Object.keys(y.f).reduce(((r,t)=>(y.f[t](e,r),r)),[])),y.u=e=>e+".js",y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},t="@openmrs/esm-fast-data-entry-app:",y.l=(r,n,o,a)=>{if(e[r])e[r].push(n);else{var i,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var f=u[l];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==t+o){i=f;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,y.nc&&i.setAttribute("nonce",y.nc),i.setAttribute("data-webpack",t+o),i.src=r),e[r]=[n];var d=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[r];if(delete e[r],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),t)return t(n)},p=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)}},y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{y.S={};var e={},r={};y.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];y.o(y.S,t)||(y.S[t]={});var a=y.S[t],i="@openmrs/esm-fast-data-entry-app",s=(e,r,t,n)=>{var o=a[e]=a[e]||{},s=o[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(o[r]={get:t,from:i,eager:!!n})},u=[];return"default"===t&&(s("@openmrs/esm-framework","3.4.1-pre.161",(()=>Promise.all([y.e(595),y.e(211)]).then((()=>()=>y(595))))),s("carbon-icons","7.0.7",(()=>y.e(906).then((()=>()=>y(906))))),s("react-dom","16.14.0",(()=>Promise.all([y.e(935),y.e(211)]).then((()=>()=>y(3935))))),s("react-i18next","11.18.1",(()=>Promise.all([y.e(247),y.e(211)]).then((()=>()=>y(8247))))),s("react-router-dom","5.3.3",(()=>Promise.all([y.e(536),y.e(211)]).then((()=>()=>y(536))))),s("react","16.14.0",(()=>y.e(294).then((()=>()=>y(7294)))))),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),y.p="",n=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},o=(e,r)=>{e=n(e),r=n(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var o=e[t],a=(typeof o)[0];if(t>=r.length)return"u"==a;var i=r[t],s=(typeof i)[0];if(a!=s)return"o"==a&&"n"==s||"s"==s||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;t++}},a=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,t+="u"==(typeof(s=e[o]))[0]?"-":(n>0?".":"")+(n=2,s);return t}var i=[];for(o=1;o<e.length;o++){var s=e[o];i.push(0===s?"not("+u()+")":1===s?"("+u()+" || "+u()+")":2===s?i.pop()+" "+i.pop():a(s))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},i=(e,r)=>{if(0 in e){r=n(r);var t=e[0],o=t<0;o&&(t=-t-1);for(var a=0,s=1,u=!0;;s++,a++){var l,f,d=s<e.length?(typeof e[s])[0]:"";if(a>=r.length||"o"==(f=(typeof(l=r[a]))[0]))return!u||("u"==d?s>t&&!o:""==d!=o);if("u"==f){if(!u||"u"!=d)return!1}else if(u)if(d==f)if(s<=t){if(l!=e[s])return!1}else{if(o?l>e[s]:l<e[s])return!1;l!=e[s]&&(u=!1)}else if("s"!=d&&"n"!=d){if(o||s<=t)return!1;u=!1,s--}else{if(s<=t||f<d!=o)return!1;u=!1}else"s"!=d&&"n"!=d&&(u=!1,s--)}}var p=[],c=p.pop.bind(p);for(a=1;a<e.length;a++){var h=e[a];p.push(1==h?c()|c():2==h?c()&c():h?i(h,r):!c())}return!!c()},s=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&o(e,r)?r:e),0)},u=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+a(n)+")",l=(e,r,t,n)=>{var o=s(e,t);return i(n,o)||"undefined"!=typeof console&&console.warn&&console.warn(u(e,t,o,n)),f(e[t][o])},f=e=>(e.loaded=1,e.get()),d=(e=>function(r,t,n,o){var a=y.I(r);return a&&a.then?a.then(e.bind(e,r,y.S[r],t,n,o)):e(0,y.S[r],t,n,o)})(((e,r,t,n,o)=>r&&y.o(r,t)?l(r,0,t,n):o())),p={},c={311:()=>d("default","@openmrs/esm-framework",[1,"next"],(()=>Promise.all([y.e(595),y.e(211)]).then((()=>()=>y(595))))),4211:()=>d("default","react",[1,16,14],(()=>y.e(294).then((()=>()=>y(7294))))),2221:()=>d("default","react-router-dom",[1,5,0,0],(()=>y.e(536).then((()=>()=>y(536))))),3397:()=>d("default","react-i18next",[1,11],(()=>y.e(247).then((()=>()=>y(8247))))),8408:()=>d("default","react-dom",[1,16,0],(()=>y.e(935).then((()=>()=>y(3935)))))},h={132:[311],211:[4211],397:[3397],804:[2221],990:[8408]},y.f.consumes=(e,r)=>{y.o(h,e)&&h[e].forEach((e=>{if(y.o(p,e))return r.push(p[e]);var t=r=>{p[e]=0,y.m[e]=t=>{delete y.c[e],t.exports=r()}},n=r=>{delete p[e],y.m[e]=t=>{throw delete y.c[e],r}};try{var o=c[e]();o.then?r.push(p[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}))},(()=>{var e={447:0};y.f.j=(r,t)=>{var n=y.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(211|397)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=y.p+y.u(r),i=new Error;y.l(a,(t=>{if(y.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,s]=t,u=0;if(a.some((r=>0!==e[r]))){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);s&&s(y)}for(r&&r(t);u<a.length;u++)o=a[u],y.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),y.nc=void 0,y(5356),y(6751)})())}}}));
Binary file
Binary file
@@ -0,0 +1,77 @@
1
+ # Configuring Form Categories for Fast Data Entry App
2
+
3
+ Configuration of which Form Categories to show, and which forms exist within each category is possible via configuration of Fast Data Entry App (config-schema)[../src/config-schema.ts]. For example, the configuration would setup one category "ICRC Forms" which contains one form, DASS-21. Note that formUUID must match the form UUID on the backend instance, and name is only for human readability and has no actual function.
4
+
5
+ ```json
6
+ {
7
+ "@openmrs/esm-fast-data-entry-app": {
8
+ "formCategories": [
9
+ {
10
+ "name": "ICRC Forms",
11
+ "forms": [
12
+ {
13
+ "formUUID": "373086b0-0a65-3763-ab83-21b8867bbc6f",
14
+ "name": "DASS-21"
15
+ }
16
+ ]
17
+ }
18
+ ],
19
+ "formCategoriesToShow": [
20
+ "ICRC Forms"
21
+ ]
22
+ }
23
+ }
24
+ ```
25
+
26
+ This config results in the following UI:
27
+
28
+ !(Configure ICRC Forms)[config-icrc-forms.png]
29
+
30
+ Note that All Forms is always present and contains all forms the system can find.
31
+
32
+ Let's see another example. The following config will load up one more form category called "Other Forms" to show, but both entries in that form category are not able to be found in the system, so no forms will render when we navigate to the "Other Forms". Also note that "Third Category of Forms" is declared, but since it's not included in the formCategoriesToShow array it is not displayed on the UI.
33
+
34
+ ```json
35
+ {
36
+ "@openmrs/esm-fast-data-entry-app": {
37
+ "formCategories": [{
38
+ "name": "ICRC Forms",
39
+ "forms": [{
40
+ "formUUID": "373086b0-0a65-3763-ab83-21b8867bbc6f",
41
+ "name": "DASS-21"
42
+ }]
43
+ },
44
+ {
45
+ "name": "Other Forms",
46
+ "forms": [{
47
+ "formUUID": "00000000-0a65-3763-ab83-21b",
48
+ "name": "No Matching UUID"
49
+ },
50
+ {
51
+ "formUUID": "This isn't a UUID!",
52
+ "name": "Invalid UUID"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "name": "Third Category of Forms",
58
+ "forms": [{
59
+ "formUUID": "ce7a6da7-444a-3038-bfc2-334ff84b86c0",
60
+ "name": "CRIES-8"
61
+ }]
62
+ }
63
+ ],
64
+ "formCategoriesToShow": [
65
+ "ICRC Forms",
66
+ "Other Forms"
67
+ ]
68
+ }
69
+ }
70
+ ```
71
+
72
+ This will render the following UI
73
+
74
+ !(Configure Other Forms)[config-other-forms.png]
75
+
76
+
77
+ For more information on using the OpenMRS configuration system see (this page)[https://o3-dev.docs.openmrs.org/#/main/config]
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-fast-data-entry-app",
3
- "version": "1.0.0-pre.36",
3
+ "version": "1.0.0-pre.44",
4
4
  "license": "MPL-2.0",
5
5
  "description": "An OpenMRS 3.x microfrontend",
6
6
  "browser": "dist/openmrs-esm-fast-data-entry-app.js",
@@ -104,6 +104,7 @@ interface FormParams {
104
104
  visitUuid?: string;
105
105
  visitTypeUuid?: string;
106
106
  encounterUuid?: string;
107
+ showDiscardSubmitButtons?: boolean;
107
108
  handlePostResponse?: (Encounter) => void;
108
109
  }
109
110
 
@@ -132,6 +133,7 @@ const FormBootstrap = ({
132
133
  encounterUuid: encounterUuid ?? "",
133
134
  closeWorkspace: () => {},
134
135
  handlePostResponse,
136
+ showDiscardSubmitButtons: false,
135
137
  }}
136
138
  />
137
139
  )}
package/src/Root.tsx CHANGED
@@ -1,21 +1,18 @@
1
1
  import React from "react";
2
2
  import { BrowserRouter, Route, Switch } from "react-router-dom";
3
3
  import { appPath } from "./constant";
4
- import { FormWorkflowProvider } from "./context/FormWorkflowContext";
5
4
  const FormsPage = React.lazy(() => import("./forms-page"));
6
5
  const FormEntryWorkflow = React.lazy(() => import("./form-entry-workflow"));
7
6
 
8
7
  const Root = () => {
9
8
  return (
10
9
  <main>
11
- <FormWorkflowProvider>
12
- <BrowserRouter basename={appPath}>
13
- <Switch>
14
- <Route exact path="/" children={<FormsPage />} />
15
- <Route path="/:formUuid?" children={<FormEntryWorkflow />} />
16
- </Switch>
17
- </BrowserRouter>
18
- </FormWorkflowProvider>
10
+ <BrowserRouter basename={appPath}>
11
+ <Switch>
12
+ <Route exact path="/" children={<FormsPage />} />
13
+ <Route path="/:formUuid?" children={<FormEntryWorkflow />} />
14
+ </Switch>
15
+ </BrowserRouter>
19
16
  </main>
20
17
  );
21
18
  };
@@ -1,34 +1,62 @@
1
- import React, { useReducer } from "react";
1
+ import React, { useEffect, useMemo, useReducer } from "react";
2
2
  import reducer from "./FormWorkflowReducer";
3
+ import { useParams } from "react-router-dom";
4
+ interface ParamTypes {
5
+ formUuid: string;
6
+ }
3
7
 
4
8
  const initialState = {
9
+ formUuid: null,
5
10
  patientUuids: [],
6
11
  activePatientUuid: null,
7
12
  activeEncounterUuid: null,
8
13
  encounters: {},
14
+ workflowState: null,
9
15
  addPatient: (uuid: string | number) => {},
10
16
  openPatientSearch: () => {},
11
17
  saveEncounter: (encounterUuid: string | number) => {},
12
18
  editEncounter: (patientUuid: string | number) => {},
19
+ submitForNext: () => {},
20
+ submitForReview: () => {},
21
+ goToReview: () => {},
13
22
  };
14
23
 
15
24
  const FormWorkflowContext = React.createContext(initialState);
16
25
 
17
26
  const FormWorkflowProvider = ({ children }) => {
18
- const [state, dispatch] = useReducer(reducer, initialState);
19
-
20
- const actions = {
21
- addPatient: (patientUuid) =>
22
- dispatch({ type: "ADD_PATIENT", patientUuid: patientUuid }),
23
- openPatientSearch: () => dispatch({ type: "OPEN_PATIENT_SEARCH" }),
24
- saveEncounter: (encounterUuid) =>
25
- dispatch({
26
- type: "SAVE_ENCOUNTER",
27
- encounterUuid,
28
- }),
29
- editEncounter: (patientUuid) =>
30
- dispatch({ type: "EDIT_ENCOUNTER", patientUuid }),
31
- };
27
+ const { formUuid: paramFormUuid } = useParams() as ParamTypes;
28
+ const [state, dispatch] = useReducer(reducer, { ...initialState });
29
+
30
+ const actions = useMemo(
31
+ () => ({
32
+ addPatient: (patientUuid) =>
33
+ dispatch({ type: "ADD_PATIENT", patientUuid }),
34
+ openPatientSearch: () => dispatch({ type: "OPEN_PATIENT_SEARCH" }),
35
+ saveEncounter: (encounterUuid) =>
36
+ dispatch({
37
+ type: "SAVE_ENCOUNTER",
38
+ encounterUuid,
39
+ }),
40
+ submitForNext: () => dispatch({ type: "SUBMIT_FOR_NEXT" }),
41
+ submitForReview: () => dispatch({ type: "SUBMIT_FOR_REVIEW" }),
42
+ editEncounter: (patientUuid) =>
43
+ dispatch({ type: "EDIT_ENCOUNTER", patientUuid }),
44
+ goToReview: () => dispatch({ type: "GO_TO_REVIEW" }),
45
+ }),
46
+ []
47
+ );
48
+
49
+ // if formUuid isn't a part of state yet, grab it from the url params
50
+ useEffect(() => {
51
+ if (!state.formUuid && paramFormUuid) {
52
+ dispatch({ type: "UPDATE_FORM_UUID", formUuid: paramFormUuid });
53
+ }
54
+ }, [paramFormUuid, state.formUuid]);
55
+
56
+ useEffect(() => {
57
+ actions.openPatientSearch();
58
+ }, [actions]);
59
+
32
60
  return (
33
61
  <FormWorkflowContext.Provider value={{ ...state, ...actions }}>
34
62
  {children}
@@ -6,6 +6,7 @@ const reducer = (state, action) => {
6
6
  patientUuids: [...state.patientUuids, action.patientUuid],
7
7
  activePatientUuid: action.patientUuid,
8
8
  activeEncounterUuid: null,
9
+ workflowState: "EDIT_FORM",
9
10
  };
10
11
  case "OPEN_PATIENT_SEARCH":
11
12
  // this will need to be updated once AMPATH hook is available
@@ -13,6 +14,7 @@ const reducer = (state, action) => {
13
14
  ...state,
14
15
  activePatientUuid: null,
15
16
  activeEncounterUuid: null,
17
+ workflowState: "NEW_PATIENT",
16
18
  };
17
19
  case "SAVE_ENCOUNTER":
18
20
  return {
@@ -23,12 +25,51 @@ const reducer = (state, action) => {
23
25
  },
24
26
  activePatientUuid: null,
25
27
  activeEncounterUuid: null,
28
+ workflowState:
29
+ state.workflowState === "SUBMIT_FOR_NEXT"
30
+ ? "NEW_PATIENT"
31
+ : state.workflowState === "SUBMIT_FOR_REVIEW"
32
+ ? "REVIEW"
33
+ : state.workflowState,
26
34
  };
27
35
  case "EDIT_ENCOUNTER":
28
36
  return {
29
37
  ...state,
30
38
  activeEncounterUuid: state.encounters[action.patientUuid],
31
39
  activePatientUuid: action.patientUuid,
40
+ workflowState: "EDIT_FORM",
41
+ };
42
+ case "SUBMIT_FOR_NEXT":
43
+ window.dispatchEvent(
44
+ new CustomEvent("ampath-form-action", {
45
+ detail: { formUuid: state.formUuid, action: "onSubmit" },
46
+ })
47
+ );
48
+ return {
49
+ ...state,
50
+ workflowState: "SUBMIT_FOR_NEXT",
51
+ };
52
+ case "SUBMIT_FOR_REVIEW":
53
+ window.dispatchEvent(
54
+ new CustomEvent("ampath-form-action", {
55
+ detail: { formUuid: state.formUuid, action: "onSubmit" },
56
+ })
57
+ );
58
+ return {
59
+ ...state,
60
+ workflowState: "SUBMIT_FOR_REVIEW",
61
+ };
62
+ case "UPDATE_FORM_UUID":
63
+ return {
64
+ ...state,
65
+ formUuid: action.formUuid,
66
+ };
67
+ case "GO_TO_REVIEW":
68
+ return {
69
+ ...state,
70
+ activeEncounterUuid: null,
71
+ activePatientUuid: null,
72
+ workflowState: "REVIEW",
32
73
  };
33
74
  default:
34
75
  return state;