@openmrs/esm-form-engine-lib 3.0.0-pre.1626 → 3.0.0-pre.1636
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/openmrs-esm-form-engine-lib.js +1 -1
- package/package.json +1 -1
- package/src/components/inputs/date/date.component.tsx +1 -1
- package/src/components/inputs/ui-select-extended/ui-select-extended.test.tsx +0 -1
- package/src/form-engine.test.tsx +0 -1
- package/src/hooks/{useConcepts.tsx → useConcepts.ts} +1 -2
- package/src/hooks/useDataSourceDependentValue.ts +1 -1
- package/src/hooks/{useFormJson.tsx → useFormJson.ts} +2 -0
- package/src/hooks/{usePatientData.tsx → usePatientData.ts} +1 -1
- package/src/hooks/useClobData.tsx +0 -21
- package/src/hooks/useFieldValidationResults.ts +0 -18
- package/src/hooks/useFormsConfig.tsx +0 -27
- package/src/hooks/useRestMaxResultsCount.ts +0 -5
- package/src/hooks/useSystemSetting.ts +0 -36
- package/src/hooks/{useEncounter.tsx → useEncounter.ts} +0 -0
- package/src/hooks/{useEncounterRole.tsx → useEncounterRole.ts} +1 -1
- package/src/hooks/{useFormCollapse.tsx → useFormCollapse.ts} +1 -1
@@ -1 +1 @@
|
|
1
|
-
var _openmrs_esm_form_engine_lib;(()=>{"use strict";var e,r,t,n,o,i,a,l,s,u,f,p,d,c,h,m,v,g,b,y,w,_={8008:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(690),t.e(585),t.e(72),t.e(385),t.e(
|
1
|
+
var _openmrs_esm_form_engine_lib;(()=>{"use strict";var e,r,t,n,o,i,a,l,s,u,f,p,d,c,h,m,v,g,b,y,w,_={8008:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(690),t.e(585),t.e(72),t.e(385),t.e(219)]).then((()=>()=>t(7219)))},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),i=(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:()=>i})}},P={};function S(e){var r=P[e];if(void 0!==r)return r.exports;var t=P[e]={id:e,loaded:!1,exports:{}};return _[e].call(t.exports,t,t.exports,S),t.loaded=!0,t.exports}S.m=_,S.c=P,S.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return S.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,S.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 o=Object.create(null);S.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var a=2&n&&t;"object"==typeof a&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>i[e]=()=>t[e]));return i.default=()=>t,S.d(o,i),o},S.d=(e,r)=>{for(var t in r)S.o(r,t)&&!S.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},S.f={},S.e=e=>Promise.all(Object.keys(S.f).reduce(((r,t)=>(S.f[t](e,r),r)),[])),S.u=e=>e+".js",S.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),S.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@openmrs/esm-form-engine-lib:",S.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var a,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var f=s[u];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){a=f;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,S.nc&&a.setAttribute("nonce",S.nc),a.setAttribute("data-webpack",n+o),a.src=e),t[e]=[r];var p=(r,n)=>{a.onerror=a.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),l&&document.head.appendChild(a)}},S.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},S.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{S.S={};var e={},r={};S.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];S.o(S.S,t)||(S.S[t]={});var i=S.S[t],a="@openmrs/esm-form-engine-lib",l=(e,r,t,n)=>{var o=i[e]=i[e]||{},l=o[r];(!l||!l.loaded&&(!n!=!l.eager?n:a>l.from))&&(o[r]={get:t,from:a,eager:!!n})},s=[];return"default"===t&&(l("@openmrs/esm-framework","6.0.1-pre.2541",(()=>Promise.all([S.e(151),S.e(72),S.e(766)]).then((()=>()=>S(5151))))),l("@openmrs/esm-patient-common-lib","8.2.1-pre.6187",(()=>Promise.all([S.e(289),S.e(690),S.e(72),S.e(465),S.e(385),S.e(70)]).then((()=>()=>S(4289))))),l("dayjs","1.11.13",(()=>S.e(353).then((()=>()=>S(4353))))),l("i18next","23.16.0",(()=>S.e(635).then((()=>()=>S(2635))))),l("react-i18next","11.18.6",(()=>Promise.all([S.e(979),S.e(72)]).then((()=>()=>S(2979))))),l("react","18.3.1",(()=>S.e(540).then((()=>()=>S(6540))))),l("swr/_internal","2.2.5",(()=>Promise.all([S.e(993),S.e(72)]).then((()=>()=>S(4993))))),l("swr/immutable","2.2.5",(()=>Promise.all([S.e(225),S.e(72),S.e(465)]).then((()=>()=>S(4225))))),l("swr/infinite","2.2.5",(()=>Promise.all([S.e(41),S.e(72),S.e(465)]).then((()=>()=>S(3041)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;S.g.importScripts&&(e=S.g.location+"");var r=S.g.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(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),S.p=e})(),o=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},i=(e,r)=>{e=o(e),r=o(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var n=e[t],i=(typeof n)[0];if(t>=r.length)return"u"==i;var a=r[t],l=(typeof a)[0];if(i!=l)return"o"==i&&"n"==l||"s"==l||"u"==i;if("o"!=i&&"u"!=i&&n!=a)return n<a;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(l=e[o]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(o=1;o<e.length;o++){var l=e[o];i.push(0===l?"not("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():a(l))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},l=(e,r)=>{if(0 in e){r=o(r);var t=e[0],n=t<0;n&&(t=-t-1);for(var i=0,a=1,s=!0;;a++,i++){var u,f,p=a<e.length?(typeof e[a])[0]:"";if(i>=r.length||"o"==(f=(typeof(u=r[i]))[0]))return!s||("u"==p?a>t&&!n:""==p!=n);if("u"==f){if(!s||"u"!=p)return!1}else if(s)if(p==f)if(a<=t){if(u!=e[a])return!1}else{if(n?u>e[a]:u<e[a])return!1;u!=e[a]&&(s=!1)}else if("s"!=p&&"n"!=p){if(n||a<=t)return!1;s=!1,a--}else{if(a<=t||f<p!=n)return!1;s=!1}else"s"!=p&&"n"!=p&&(s=!1,a--)}}var d=[],c=d.pop.bind(d);for(i=1;i<e.length;i++){var h=e[i];d.push(1==h?c()|c():2==h?c()&c():h?l(h,r):!c())}return!!c()},s=(e,r)=>e&&S.o(e,r),u=e=>(e.loaded=1,e.get()),f=e=>Object.keys(e).reduce(((r,t)=>(e[t].eager&&(r[t]=e[t]),r)),{}),p=(e,r,t)=>{var n=t?f(e[r]):e[r];return Object.keys(n).reduce(((e,r)=>!e||!n[e].loaded&&i(e,r)?r:e),0)},d=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+a(n)+")",c=e=>{throw new Error(e)},h=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},m=(e,r,t)=>t?t():((e,r)=>c("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),v=(e=>function(r,t,n,o,i){var a=S.I(r);return a&&a.then&&!n?a.then(e.bind(e,r,S.S[r],t,!1,o,i)):e(r,S.S[r],t,n,o,i)})(((e,r,t,n,o,i)=>{if(!s(r,t))return m(e,t,i);var a=p(r,t,n);return l(o,a)||h(d(r,t,a,o)),u(r[t][a])})),g={},b={6072:()=>v("default","react",!1,[1,18],(()=>S.e(540).then((()=>()=>S(6540))))),6766:()=>v("default","i18next",!1,[1,23],(()=>S.e(635).then((()=>()=>S(2635))))),8465:()=>v("default","swr/_internal",!1,[1,2],(()=>S.e(993).then((()=>()=>S(4993))))),3941:()=>v("default","react-i18next",!1,[1,11],(()=>S.e(979).then((()=>()=>S(2979))))),5972:()=>v("default","@openmrs/esm-framework",!1,[1,5],(()=>Promise.all([S.e(151),S.e(766)]).then((()=>()=>S(5151))))),6656:()=>v("default","@openmrs/esm-patient-common-lib",!1,[1,8],(()=>Promise.all([S.e(289),S.e(465)]).then((()=>()=>S(4289))))),4209:()=>v("default","swr/immutable",!1,[1,2],(()=>Promise.all([S.e(225),S.e(465)]).then((()=>()=>S(4225))))),231:()=>v("default","dayjs",!1,[1,1],(()=>S.e(353).then((()=>()=>S(4353))))),6339:()=>v("default","swr/infinite",!1,[1,2],(()=>Promise.all([S.e(41),S.e(465)]).then((()=>()=>S(3041)))))},y={70:[4209],72:[6072],219:[231,4209,6339],385:[3941,5972,6656],465:[8465],766:[6766]},w={},S.f.consumes=(e,r)=>{S.o(y,e)&&y[e].forEach((e=>{if(S.o(g,e))return r.push(g[e]);if(!w[e]){var t=r=>{g[e]=0,S.m[e]=t=>{delete S.c[e],t.exports=r()}};w[e]=!0;var n=r=>{delete g[e],S.m[e]=t=>{throw delete S.c[e],r}};try{var o=b[e]();o.then?r.push(g[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}}))},(()=>{var e={719:0};S.f.j=(r,t)=>{var n=S.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(385|465|72|766)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var i=S.p+S.u(r),a=new Error;S.l(i,(t=>{if(S.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;a.message="Loading chunk "+r+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[i,a,l]=t,s=0;if(i.some((r=>0!==e[r]))){for(n in a)S.o(a,n)&&(S.m[n]=a[n]);l&&l(S)}for(r&&r(t);s<i.length;s++)o=i[s],S.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_openmrs_esm_form_engine_lib=globalThis.webpackChunk_openmrs_esm_form_engine_lib||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),S.nc=void 0;var j=S(8008);_openmrs_esm_form_engine_lib=j})();
|
package/package.json
CHANGED
@@ -113,7 +113,7 @@ const DateField: React.FC<FormFieldInputProps> = ({ field, value: dateValue, err
|
|
113
113
|
id={field.id}
|
114
114
|
labelText={timePickerLabel}
|
115
115
|
placeholder="HH:MM"
|
116
|
-
pattern="(1[012]|[1-9]):[0-5][0-9]
|
116
|
+
pattern="(1[012]|[1-9]):[0-5][0-9]$"
|
117
117
|
type="time"
|
118
118
|
disabled={field.datePickerFormat === 'timer' ? field.isDisabled : !dateValue ? true : false}
|
119
119
|
invalid={errors.length > 0}
|
@@ -14,7 +14,6 @@ const mockUsePatient = jest.mocked(usePatient);
|
|
14
14
|
const mockUseSession = jest.mocked(useSession);
|
15
15
|
global.ResizeObserver = require('resize-observer-polyfill');
|
16
16
|
|
17
|
-
jest.mock('../../../hooks/useRestMaxResultsCount', () => jest.fn().mockReturnValue({ systemSetting: { value: '50' } }));
|
18
17
|
jest.mock('lodash-es/debounce', () => jest.fn((fn) => fn));
|
19
18
|
|
20
19
|
jest.mock('lodash-es', () => ({
|
package/src/form-engine.test.tsx
CHANGED
@@ -92,7 +92,6 @@ jest.mock('../src/api', () => {
|
|
92
92
|
};
|
93
93
|
});
|
94
94
|
|
95
|
-
jest.mock('./hooks/useRestMaxResultsCount', () => jest.fn().mockReturnValue({ systemSetting: { value: '50' } }));
|
96
95
|
jest.mock('./hooks/useEncounterRole', () => ({
|
97
96
|
useEncounterRole: jest.fn().mockReturnValue({
|
98
97
|
isLoading: false,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
|
-
import { type FetchResponse, type OpenmrsResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
3
2
|
import useSWRInfinite from 'swr/infinite';
|
3
|
+
import { type FetchResponse, type OpenmrsResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
4
4
|
|
5
5
|
type ConceptFetchResponse = FetchResponse<{ results: Array<OpenmrsResource> }>;
|
6
6
|
|
@@ -12,7 +12,6 @@ export function useConcepts(references: Set<string>): {
|
|
12
12
|
isLoading: boolean;
|
13
13
|
error: Error | undefined;
|
14
14
|
} {
|
15
|
-
|
16
15
|
const chunkSize = 100;
|
17
16
|
const totalCount = references.size;
|
18
17
|
const totalPages = Math.ceil(totalCount / chunkSize);
|
@@ -1,6 +1,6 @@
|
|
1
|
+
import { useWatch } from 'react-hook-form';
|
1
2
|
import { type FormField } from '../types';
|
2
3
|
import { useFormProviderContext } from '../provider/form-provider';
|
3
|
-
import { useWatch } from 'react-hook-form';
|
4
4
|
|
5
5
|
const useDataSourceDependentValue = (field: FormField) => {
|
6
6
|
const dependentField = field.questionOptions['config']?.referencedField;
|
@@ -9,6 +9,7 @@ import { moduleName } from '../globals';
|
|
9
9
|
export function useFormJson(formUuid: string, rawFormJson: any, encounterUuid: string, formSessionIntent: string) {
|
10
10
|
const [formJson, setFormJson] = useState<FormSchema>(null);
|
11
11
|
const [error, setError] = useState(validateFormsArgs(formUuid, rawFormJson));
|
12
|
+
|
12
13
|
useEffect(() => {
|
13
14
|
const setFormJsonWithTranslations = (formJson: FormSchema) => {
|
14
15
|
if (formJson?.translations) {
|
@@ -17,6 +18,7 @@ export function useFormJson(formUuid: string, rawFormJson: any, encounterUuid: s
|
|
17
18
|
}
|
18
19
|
setFormJson(formJson);
|
19
20
|
};
|
21
|
+
|
20
22
|
loadFormJson(formUuid, rawFormJson, formSessionIntent)
|
21
23
|
.then((formJson) => {
|
22
24
|
setFormJsonWithTranslations({ ...formJson, encounter: encounterUuid });
|
@@ -24,7 +24,7 @@ const patientGenderMap = {
|
|
24
24
|
export const usePatientData = (patientUuid) => {
|
25
25
|
const { patient, isLoading: isLoadingPatient, error: patientError } = usePatient(patientUuid);
|
26
26
|
if (patient && !isLoadingPatient) {
|
27
|
-
// This is
|
27
|
+
// This is for backward compatibility with the Angular form engine
|
28
28
|
patient['age'] = calculateAge(new Date(patient?.birthDate));
|
29
29
|
patient['sex'] = patientGenderMap[patient.gender] ?? 'U';
|
30
30
|
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
2
|
-
import { useMemo } from 'react';
|
3
|
-
import { type FormSchema, type OpenmrsForm } from '../types';
|
4
|
-
import useSWRImmutable from 'swr/immutable';
|
5
|
-
|
6
|
-
export function useClobData(form: OpenmrsForm) {
|
7
|
-
const valueReferenceUuid = useMemo(
|
8
|
-
() => form?.resources?.find(({ name }) => name === 'JSON schema').valueReference,
|
9
|
-
[form],
|
10
|
-
);
|
11
|
-
const { data, error } = useSWRImmutable<{ data: FormSchema }, Error>(
|
12
|
-
valueReferenceUuid ? `${restBaseUrl}/clobdata/${valueReferenceUuid}` : null,
|
13
|
-
openmrsFetch,
|
14
|
-
);
|
15
|
-
|
16
|
-
return {
|
17
|
-
clobdata: data?.data,
|
18
|
-
clobdataError: error || null,
|
19
|
-
isLoadingClobData: (!data && !error) || false,
|
20
|
-
};
|
21
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { type FormField } from '../types';
|
3
|
-
|
4
|
-
export function useFieldValidationResults(field: FormField) {
|
5
|
-
const [errors, setErrors] = useState([]);
|
6
|
-
const [warnings, setWarnings] = useState([]);
|
7
|
-
|
8
|
-
useEffect(() => {
|
9
|
-
if (field.meta?.submission?.errors) {
|
10
|
-
setErrors(field.meta.submission.errors);
|
11
|
-
}
|
12
|
-
if (field.meta?.submission?.warnings) {
|
13
|
-
setWarnings(field.meta.submission.warnings);
|
14
|
-
}
|
15
|
-
}, [field.meta?.submission]);
|
16
|
-
|
17
|
-
return { errors, warnings, setErrors, setWarnings };
|
18
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import get from 'lodash-es/get';
|
3
|
-
import { getConfig } from '@openmrs/esm-framework';
|
4
|
-
import { ConceptTrue, ConceptFalse } from '../constants';
|
5
|
-
|
6
|
-
export interface FormsConfig {
|
7
|
-
conceptTrue: string;
|
8
|
-
conceptFalse: string;
|
9
|
-
}
|
10
|
-
const defaultOptions: FormsConfig = {
|
11
|
-
conceptTrue: ConceptTrue,
|
12
|
-
conceptFalse: ConceptFalse,
|
13
|
-
};
|
14
|
-
|
15
|
-
export function useFormsConfig(moduleName: string, configPath: string) {
|
16
|
-
const [config, setConfig] = useState<FormsConfig>(defaultOptions);
|
17
|
-
|
18
|
-
useEffect(() => {
|
19
|
-
if (moduleName && configPath) {
|
20
|
-
getConfig(moduleName).then((c) => {
|
21
|
-
setConfig({ config, ...get(c, configPath, config) });
|
22
|
-
});
|
23
|
-
}
|
24
|
-
}, [moduleName, configPath, config]);
|
25
|
-
|
26
|
-
return config;
|
27
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { openmrsFetch, restBaseUrl, showSnackbar } from '@openmrs/esm-framework';
|
2
|
-
import { useEffect } from 'react';
|
3
|
-
import { useTranslation } from 'react-i18next';
|
4
|
-
import useSWRImmutable from 'swr/immutable';
|
5
|
-
|
6
|
-
export interface SystemSetting {
|
7
|
-
uuid: string;
|
8
|
-
property: string;
|
9
|
-
value: string;
|
10
|
-
}
|
11
|
-
|
12
|
-
export default function useSystemSetting(setting: string) {
|
13
|
-
const { t } = useTranslation();
|
14
|
-
const apiUrl = `${restBaseUrl}/systemsetting/${setting}?v=custom:(value)`;
|
15
|
-
const { data, error, isLoading } = useSWRImmutable<{ data: SystemSetting }, Error>(apiUrl, openmrsFetch);
|
16
|
-
|
17
|
-
useEffect(() => {
|
18
|
-
if (error) {
|
19
|
-
showSnackbar({
|
20
|
-
title: t('error', 'Error'),
|
21
|
-
subtitle: error?.message,
|
22
|
-
kind: 'error',
|
23
|
-
isLowContrast: false,
|
24
|
-
});
|
25
|
-
}
|
26
|
-
}, [error]);
|
27
|
-
|
28
|
-
return {
|
29
|
-
systemSetting: data?.data,
|
30
|
-
error: error,
|
31
|
-
isLoading: isLoading,
|
32
|
-
isValueUuid:
|
33
|
-
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(data?.data?.value) ||
|
34
|
-
/^[0-9a-f]{36}$/i.test(data?.data?.value),
|
35
|
-
};
|
36
|
-
}
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { type OpenmrsResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
2
1
|
import useSWRImmutable from 'swr/immutable';
|
2
|
+
import { type OpenmrsResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
3
3
|
|
4
4
|
export function useEncounterRole() {
|
5
5
|
const { data, error, isLoading } = useSWRImmutable<{ data: { results: Array<OpenmrsResource> } }, Error>(
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { FormExpanded, SessionMode } from '../types';
|
2
1
|
import { useCallback, useEffect, useState } from 'react';
|
2
|
+
import type { FormExpanded, SessionMode } from '../types';
|
3
3
|
|
4
4
|
export function useFormCollapse(sessionMode: SessionMode) {
|
5
5
|
const [isFormExpanded, setIsFormExpanded] = useState<FormExpanded>(undefined);
|