@openmrs/esm-patient-forms-app 11.3.1-pre.9447 → 11.3.1-pre.9455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -15
- package/dist/1197.js +1 -1
- package/dist/1197.js.map +1 -0
- package/dist/2608.js +1 -0
- package/dist/2608.js.map +1 -0
- package/dist/3578.js +1 -0
- package/dist/4341.js +1 -0
- package/dist/4341.js.map +1 -0
- package/dist/5277.js +1 -0
- package/dist/5277.js.map +1 -0
- package/dist/5696.js +1 -1
- package/dist/5696.js.map +1 -1
- package/dist/5764.js +1 -0
- package/dist/5764.js.map +1 -0
- package/dist/5792.js +2 -0
- package/dist/{7906.js.LICENSE.txt → 5792.js.LICENSE.txt} +10 -0
- package/dist/5792.js.map +1 -0
- package/dist/7003.js +1 -1
- package/dist/7003.js.map +1 -1
- package/dist/7007.js +1 -1
- package/dist/7007.js.map +1 -1
- package/dist/707.js +1 -1
- package/dist/707.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-forms-app.js +1 -1
- package/dist/openmrs-esm-patient-forms-app.js.buildmanifest.json +180 -137
- package/dist/openmrs-esm-patient-forms-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/clinical-form-action-button.component.tsx +13 -40
- package/src/clinical-form-action-button.test.tsx +23 -22
- package/src/config-schema.ts +1 -1
- package/src/forms/exported-form-entry.workspace.tsx +37 -0
- package/src/forms/exported-forms-dashboard.workspace.tsx +43 -0
- package/src/forms/form-entry.component.tsx +138 -0
- package/src/forms/form-entry.resources.ts +37 -0
- package/src/forms/form-entry.test.tsx +14 -28
- package/src/forms/form-entry.workspace.tsx +25 -99
- package/src/forms/forms-dashboard.component.tsx +13 -58
- package/src/forms/forms-dashboard.test.tsx +3 -15
- package/src/forms/forms-dashboard.workspace.tsx +34 -10
- package/src/forms/forms-list.component.tsx +20 -41
- package/src/forms/forms-list.test.tsx +2 -2
- package/src/forms/forms-table.component.tsx +1 -1
- package/src/hooks/use-forms.ts +3 -4
- package/src/index.ts +6 -8
- package/src/offline-forms/use-offline-form-encounters.ts +2 -2
- package/src/offline.ts +5 -7
- package/src/routes.json +13 -49
- package/dist/1123.js +0 -2
- package/dist/1123.js.LICENSE.txt +0 -9
- package/dist/1123.js.map +0 -1
- package/dist/2773.js +0 -1
- package/dist/2773.js.map +0 -1
- package/dist/4078.js +0 -1
- package/dist/4078.js.map +0 -1
- package/dist/7906.js +0 -2
- package/dist/7906.js.map +0 -1
- package/dist/8803.js +0 -1
- package/dist/8803.js.map +0 -1
- package/src/htmlformentry/html-form-entry.workspace.tsx +0 -54
|
@@ -1,73 +1,28 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Tile } from '@carbon/react';
|
|
4
|
-
import { ResponsiveWrapper, useConfig, useConnectivity } from '@openmrs/esm-framework';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
EmptyDataIllustration,
|
|
8
|
-
type Form,
|
|
9
|
-
launchFormEntryOrHtmlForms,
|
|
10
|
-
mapFormsToHtmlFormEntryForms,
|
|
11
|
-
} from '@openmrs/esm-patient-common-lib';
|
|
12
|
-
import type { ConfigObject } from '../config-schema';
|
|
4
|
+
import { ResponsiveWrapper, useConfig, useConnectivity, type Visit } from '@openmrs/esm-framework';
|
|
5
|
+
import { EmptyDataIllustration, type Form } from '@openmrs/esm-patient-common-lib';
|
|
6
|
+
import type { FormEntryConfigSchema } from '../config-schema';
|
|
13
7
|
import { useForms } from '../hooks/use-forms';
|
|
14
8
|
import FormsList from './forms-list.component';
|
|
15
9
|
import styles from './forms-dashboard.scss';
|
|
16
10
|
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
interface FormsDashbaordProps {
|
|
12
|
+
handleFormOpen: (form: Form, encounterUuid: string) => void;
|
|
13
|
+
patient: fhir.Patient;
|
|
14
|
+
visitContext: Visit;
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
const FormsDashboard: React.FC<
|
|
24
|
-
patientUuid,
|
|
25
|
-
clinicalFormsWorkspaceName,
|
|
26
|
-
formEntryWorkspaceName,
|
|
27
|
-
htmlFormEntryWorkspaceName,
|
|
28
|
-
visitContext,
|
|
29
|
-
}) => {
|
|
17
|
+
const FormsDashboard: React.FC<FormsDashbaordProps> = ({ handleFormOpen, patient, visitContext }) => {
|
|
30
18
|
const { t } = useTranslation();
|
|
31
|
-
const config = useConfig<
|
|
19
|
+
const config = useConfig<FormEntryConfigSchema>();
|
|
32
20
|
const isOnline = useConnectivity();
|
|
33
21
|
const {
|
|
34
22
|
data: forms,
|
|
35
|
-
allForms,
|
|
36
23
|
error,
|
|
37
24
|
mutateForms,
|
|
38
|
-
} = useForms(
|
|
39
|
-
|
|
40
|
-
const htmlFormEntryForms = useMemo(() => {
|
|
41
|
-
return mapFormsToHtmlFormEntryForms(allForms, config.htmlFormEntryForms);
|
|
42
|
-
}, [config.htmlFormEntryForms, allForms]);
|
|
43
|
-
|
|
44
|
-
const handleFormOpen = useCallback(
|
|
45
|
-
(form: Form, encounterUuid: string) => {
|
|
46
|
-
launchFormEntryOrHtmlForms(
|
|
47
|
-
htmlFormEntryForms,
|
|
48
|
-
patientUuid,
|
|
49
|
-
form,
|
|
50
|
-
visitContext?.uuid,
|
|
51
|
-
encounterUuid,
|
|
52
|
-
visitContext?.visitType.uuid,
|
|
53
|
-
visitContext?.startDatetime,
|
|
54
|
-
visitContext?.stopDatetime,
|
|
55
|
-
mutateForms,
|
|
56
|
-
clinicalFormsWorkspaceName,
|
|
57
|
-
formEntryWorkspaceName,
|
|
58
|
-
htmlFormEntryWorkspaceName,
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
[
|
|
62
|
-
visitContext,
|
|
63
|
-
htmlFormEntryForms,
|
|
64
|
-
mutateForms,
|
|
65
|
-
patientUuid,
|
|
66
|
-
clinicalFormsWorkspaceName,
|
|
67
|
-
formEntryWorkspaceName,
|
|
68
|
-
htmlFormEntryWorkspaceName,
|
|
69
|
-
],
|
|
70
|
-
);
|
|
25
|
+
} = useForms(patient.id, visitContext?.uuid, undefined, undefined, !isOnline, config.orderBy);
|
|
71
26
|
|
|
72
27
|
const sections = useMemo(() => {
|
|
73
28
|
return config.formSections?.map((formSection) => ({
|
|
@@ -92,14 +47,14 @@ const FormsDashboard: React.FC<FormsDashboardProps> = ({
|
|
|
92
47
|
return (
|
|
93
48
|
<div className={styles.container}>
|
|
94
49
|
{sections.length === 0 ? (
|
|
95
|
-
<FormsList
|
|
50
|
+
<FormsList forms={forms} error={error} handleFormOpen={handleFormOpen} />
|
|
96
51
|
) : (
|
|
97
52
|
sections.map((section) => {
|
|
98
53
|
return (
|
|
99
54
|
<FormsList
|
|
100
55
|
key={`form-section-${section.name}`}
|
|
101
56
|
sectionName={section.name}
|
|
102
|
-
|
|
57
|
+
forms={section.availableForms}
|
|
103
58
|
error={error}
|
|
104
59
|
handleFormOpen={handleFormOpen}
|
|
105
60
|
/>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
|
|
4
|
-
import { configSchema, type
|
|
5
|
-
import { mockCurrentVisit } from '__mocks__';
|
|
4
|
+
import { configSchema, type FormEntryConfigSchema } from '../config-schema';
|
|
6
5
|
import FormsDashboard from './forms-dashboard.component';
|
|
7
6
|
import { mockPatient } from 'tools';
|
|
8
7
|
|
|
9
|
-
const mockUseConfig = jest.mocked(useConfig<
|
|
8
|
+
const mockUseConfig = jest.mocked(useConfig<FormEntryConfigSchema>);
|
|
10
9
|
|
|
11
10
|
jest.mock('../hooks/use-forms', () => ({
|
|
12
11
|
useForms: jest.fn().mockReturnValueOnce({
|
|
@@ -21,18 +20,7 @@ mockUseConfig.mockReturnValue({ ...getDefaultsFromConfigSchema(configSchema), ht
|
|
|
21
20
|
|
|
22
21
|
describe('FormsDashboard', () => {
|
|
23
22
|
test('renders an empty state if there are no forms persisted on the server', async () => {
|
|
24
|
-
render(
|
|
25
|
-
<FormsDashboard
|
|
26
|
-
promptBeforeClosing={jest.fn()}
|
|
27
|
-
closeWorkspace={jest.fn()}
|
|
28
|
-
closeWorkspaceWithSavedChanges={jest.fn()}
|
|
29
|
-
patientUuid={mockPatient.id}
|
|
30
|
-
patient={mockPatient}
|
|
31
|
-
setTitle={jest.fn()}
|
|
32
|
-
visitContext={mockCurrentVisit}
|
|
33
|
-
mutateVisitContext={null}
|
|
34
|
-
/>,
|
|
35
|
-
);
|
|
23
|
+
render(<FormsDashboard handleFormOpen={jest.fn()} patient={mockPatient} visitContext={null} />);
|
|
36
24
|
|
|
37
25
|
expect(screen.getByText(/there are no forms to display/i)).toBeInTheDocument();
|
|
38
26
|
});
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import FormsDashboard from './forms-dashboard.component';
|
|
3
4
|
import styles from './forms-dashboard-workspace.scss';
|
|
4
|
-
import { type
|
|
5
|
-
import { ExtensionSlot } from '@openmrs/esm-framework';
|
|
5
|
+
import { type Form, type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
|
|
6
|
+
import { ExtensionSlot, Workspace2 } from '@openmrs/esm-framework';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This workspace lists a table of available forms. When clicking on a row, it launches
|
|
10
|
+
* either the form-entry workspace or the html-form-entry workspace.
|
|
11
|
+
*
|
|
12
|
+
* This workspace must only be used within the patient chart.
|
|
13
|
+
* @see exported-forms-dashboard.workspace.tsx
|
|
14
|
+
*/
|
|
15
|
+
const FormsDashboardWorkspace: React.FC<PatientWorkspace2DefinitionProps<{}, {}>> = ({
|
|
16
|
+
launchChildWorkspace,
|
|
17
|
+
groupProps: { patient, patientUuid, visitContext },
|
|
18
|
+
}) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const handleFormOpen = useCallback(
|
|
21
|
+
(form: Form, encounterUuid: string) => {
|
|
22
|
+
launchChildWorkspace('patient-form-entry-workspace', {
|
|
23
|
+
form,
|
|
24
|
+
encounterUuid,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
[launchChildWorkspace],
|
|
28
|
+
);
|
|
9
29
|
|
|
10
30
|
return (
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
31
|
+
<Workspace2 title={t('clinicalForms', 'Clinical forms')} hasUnsavedChanges={false}>
|
|
32
|
+
<div className={styles.container}>
|
|
33
|
+
<ExtensionSlot name="visit-context-header-slot" state={{ patientUuid }} />
|
|
34
|
+
<FormsDashboard {...{ patient, visitContext, handleFormOpen }} />
|
|
35
|
+
</div>
|
|
36
|
+
</Workspace2>
|
|
15
37
|
);
|
|
16
|
-
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default FormsDashboardWorkspace;
|
|
@@ -9,7 +9,7 @@ import FormsTable from './forms-table.component';
|
|
|
9
9
|
import styles from './forms-list.scss';
|
|
10
10
|
|
|
11
11
|
export type FormsListProps = {
|
|
12
|
-
|
|
12
|
+
forms?: Array<CompletedFormInfo>;
|
|
13
13
|
error?: any;
|
|
14
14
|
sectionName?: string;
|
|
15
15
|
handleFormOpen: (form: Form, encounterUuid: string) => void;
|
|
@@ -20,32 +20,23 @@ export type FormsListProps = {
|
|
|
20
20
|
* t('forms', 'Forms')
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
const FormsList: React.FC<FormsListProps> = ({
|
|
23
|
+
const FormsList: React.FC<FormsListProps> = ({ forms, error, sectionName, handleFormOpen }) => {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const [searchTerm, setSearchTerm] = useState('');
|
|
26
26
|
const isTablet = useLayoutType() === 'tablet';
|
|
27
|
-
const [locale, setLocale] = useState(window.i18next.language ?? navigator.language);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (window.i18next?.on) {
|
|
31
|
-
const languageChanged = (lng: string) => setLocale(lng);
|
|
32
|
-
window.i18next.on('languageChanged', languageChanged);
|
|
33
|
-
return () => window.i18next.off('languageChanged', languageChanged);
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
27
|
|
|
37
28
|
const handleSearch = useMemo(() => debounce((searchTerm) => setSearchTerm(searchTerm), 300), []);
|
|
38
29
|
|
|
39
30
|
const filteredForms = useMemo(() => {
|
|
40
31
|
if (!searchTerm) {
|
|
41
|
-
return
|
|
32
|
+
return forms;
|
|
42
33
|
}
|
|
43
34
|
|
|
44
35
|
return fuzzy
|
|
45
|
-
.filter(searchTerm,
|
|
36
|
+
.filter(searchTerm, forms, { extract: (formInfo) => formInfo.form.display ?? formInfo.form.name })
|
|
46
37
|
.sort((r1, r2) => r1.score - r2.score)
|
|
47
38
|
.map((result) => result.original);
|
|
48
|
-
}, [
|
|
39
|
+
}, [forms, searchTerm]);
|
|
49
40
|
|
|
50
41
|
const tableHeaders = useMemo(() => {
|
|
51
42
|
return [
|
|
@@ -75,42 +66,30 @@ const FormsList: React.FC<FormsListProps> = ({ completedForms, error, sectionNam
|
|
|
75
66
|
[filteredForms],
|
|
76
67
|
);
|
|
77
68
|
|
|
78
|
-
if (!
|
|
69
|
+
if (!forms && !error) {
|
|
79
70
|
return <DataTableSkeleton role="progressbar" />;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
|
-
if (
|
|
73
|
+
if (forms?.length === 0) {
|
|
83
74
|
return <></>;
|
|
84
75
|
}
|
|
85
76
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<FormsTable
|
|
90
|
-
tableHeaders={tableHeaders}
|
|
91
|
-
tableRows={tableRows}
|
|
92
|
-
isTablet={isTablet}
|
|
93
|
-
handleSearch={handleSearch}
|
|
94
|
-
handleFormOpen={handleFormOpen}
|
|
95
|
-
/>
|
|
96
|
-
</ResponsiveWrapper>
|
|
97
|
-
);
|
|
98
|
-
} else {
|
|
99
|
-
return (
|
|
100
|
-
<ResponsiveWrapper>
|
|
77
|
+
return (
|
|
78
|
+
<ResponsiveWrapper>
|
|
79
|
+
{sectionName && (
|
|
101
80
|
<div className={isTablet ? styles.tabletHeading : styles.desktopHeading}>
|
|
102
81
|
<h4>{t(sectionName)}</h4>
|
|
103
82
|
</div>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
83
|
+
)}
|
|
84
|
+
<FormsTable
|
|
85
|
+
tableHeaders={tableHeaders}
|
|
86
|
+
tableRows={tableRows}
|
|
87
|
+
isTablet={isTablet}
|
|
88
|
+
handleSearch={handleSearch}
|
|
89
|
+
handleFormOpen={handleFormOpen}
|
|
90
|
+
/>
|
|
91
|
+
</ResponsiveWrapper>
|
|
92
|
+
);
|
|
114
93
|
};
|
|
115
94
|
|
|
116
95
|
export default FormsList;
|
|
@@ -7,7 +7,7 @@ import FormsList, { type FormsListProps } from './forms-list.component';
|
|
|
7
7
|
jest.mock('lodash-es/debounce', () => jest.fn((fn) => fn));
|
|
8
8
|
|
|
9
9
|
const defaultProps: FormsListProps & { reset: () => void } = {
|
|
10
|
-
|
|
10
|
+
forms: [],
|
|
11
11
|
handleFormOpen: jest.fn(),
|
|
12
12
|
reset() {
|
|
13
13
|
this.completedForms = [];
|
|
@@ -25,7 +25,7 @@ beforeEach(async () => {
|
|
|
25
25
|
it('renders a list of forms fetched from the server', async () => {
|
|
26
26
|
const user = userEvent.setup();
|
|
27
27
|
|
|
28
|
-
renderFormsList({
|
|
28
|
+
renderFormsList({ forms: forms.map((form) => ({ form, associatedEncounters: [] })) });
|
|
29
29
|
|
|
30
30
|
const searchbox = screen.getByRole('searchbox');
|
|
31
31
|
expect(searchbox).toBeInTheDocument();
|
|
@@ -71,7 +71,7 @@ const FormsTable = ({ tableHeaders, tableRows, isTablet, handleSearch, handleFor
|
|
|
71
71
|
<Link
|
|
72
72
|
style={{ cursor: 'pointer' }}
|
|
73
73
|
onClick={() => {
|
|
74
|
-
handleFormOpen(tableRows[i].form,
|
|
74
|
+
handleFormOpen(tableRows[i].form, null);
|
|
75
75
|
}}
|
|
76
76
|
role="presentation"
|
|
77
77
|
className={styles.formName}
|
package/src/hooks/use-forms.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
userHasAccess,
|
|
10
10
|
useSession,
|
|
11
11
|
} from '@openmrs/esm-framework';
|
|
12
|
-
import type {
|
|
12
|
+
import type { FormEntryConfigSchema } from '../config-schema';
|
|
13
13
|
import type { ListResponse, Form, EncounterWithFormRef, CompletedFormInfo } from '../types';
|
|
14
14
|
import {
|
|
15
15
|
customEncounterRepresentation,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { isValidOfflineFormEncounter } from '../offline-forms/offline-form-helpers';
|
|
21
21
|
|
|
22
22
|
function useCustomFormsUrl(patientUuid: string, visitUuid: string) {
|
|
23
|
-
const { customFormsUrl, showHtmlFormEntryForms } = useConfig<
|
|
23
|
+
const { customFormsUrl, showHtmlFormEntryForms } = useConfig<FormEntryConfigSchema>();
|
|
24
24
|
const hasCustomFormsUrl = Boolean(customFormsUrl);
|
|
25
25
|
|
|
26
26
|
const baseUrl = hasCustomFormsUrl ? customFormsUrl : showHtmlFormEntryForms ? formEncounterUrl : formEncounterUrlPoc;
|
|
@@ -78,7 +78,7 @@ export function useForms(
|
|
|
78
78
|
cachedOfflineFormsOnly = false,
|
|
79
79
|
orderBy: 'name' | 'most-recent' = 'name',
|
|
80
80
|
) {
|
|
81
|
-
const { htmlFormEntryForms } = useConfig<
|
|
81
|
+
const { htmlFormEntryForms } = useConfig<FormEntryConfigSchema>();
|
|
82
82
|
const allFormsRes = useFormEncounters(cachedOfflineFormsOnly, patientUuid, visitUuid);
|
|
83
83
|
const encountersRes = useEncountersWithFormRef(patientUuid, startDate, endDate);
|
|
84
84
|
const pastEncounters = encountersRes.data?.data?.results ?? [];
|
|
@@ -122,7 +122,6 @@ export function useForms(
|
|
|
122
122
|
data: formsToDisplay,
|
|
123
123
|
error: allFormsRes.error,
|
|
124
124
|
isValidating: allFormsRes.isValidating || encountersRes.isValidating,
|
|
125
|
-
allForms: allFormsRes.data,
|
|
126
125
|
mutateForms,
|
|
127
126
|
};
|
|
128
127
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
subscribePrecacheStaticDependencies,
|
|
5
5
|
syncAllDynamicOfflineData,
|
|
6
6
|
} from '@openmrs/esm-framework';
|
|
7
|
-
import { ComponentType } from 'react';
|
|
8
7
|
import { configSchema } from './config-schema';
|
|
9
8
|
import { setupDynamicFormDataHandler, setupPatientFormSync } from './offline';
|
|
10
9
|
|
|
@@ -25,22 +24,21 @@ export function startupApp() {
|
|
|
25
24
|
subscribePrecacheStaticDependencies(() => syncAllDynamicOfflineData('form'));
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
// t('clinicalForm', 'Clinical form')
|
|
29
27
|
export const patientFormEntryWorkspace = getAsyncLifecycle(() => import('./forms/form-entry.workspace'), options);
|
|
30
28
|
|
|
31
|
-
export const
|
|
32
|
-
() => import('./
|
|
29
|
+
export const exportedPatientFormEntryWorkspace = getAsyncLifecycle(
|
|
30
|
+
() => import('./forms/exported-form-entry.workspace'),
|
|
33
31
|
options,
|
|
34
32
|
);
|
|
35
33
|
|
|
36
|
-
// t('clinicalForms', 'Clinical forms')
|
|
37
34
|
export const clinicalFormsWorkspace = getAsyncLifecycle(() => import('./forms/forms-dashboard.workspace'), options);
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
|
|
36
|
+
export const exportedClinicalFormsWorkspace = getAsyncLifecycle(
|
|
37
|
+
() => import('./forms/exported-forms-dashboard.workspace'),
|
|
40
38
|
options,
|
|
41
39
|
);
|
|
42
40
|
|
|
43
|
-
export const
|
|
41
|
+
export const clinicalFormActionButton = getAsyncLifecycle(
|
|
44
42
|
() => import('./clinical-form-action-button.component'),
|
|
45
43
|
options,
|
|
46
44
|
);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useConfig } from '@openmrs/esm-framework';
|
|
2
2
|
import { useFormEncounters } from '../hooks/use-forms';
|
|
3
3
|
import { isValidOfflineFormEncounter } from './offline-form-helpers';
|
|
4
|
-
import { type
|
|
4
|
+
import { type FormEntryConfigSchema } from '../config-schema';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns an `SWRResult` of those form encounters that work with offline mode.
|
|
8
8
|
*/
|
|
9
9
|
export function useValidOfflineFormEncounters() {
|
|
10
10
|
const formEncountersSwr = useFormEncounters();
|
|
11
|
-
const config = useConfig<
|
|
11
|
+
const config = useConfig<FormEntryConfigSchema>();
|
|
12
12
|
return {
|
|
13
13
|
...formEncountersSwr,
|
|
14
14
|
data: formEncountersSwr.data?.filter((form) => isValidOfflineFormEncounter(form, config.htmlFormEntryForms)),
|
package/src/offline.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { escapeRegExp } from 'lodash-es';
|
|
2
2
|
import {
|
|
3
|
+
launchWorkspace2,
|
|
3
4
|
makeUrl,
|
|
4
5
|
messageOmrsServiceWorker,
|
|
5
6
|
omrsOfflineCachingStrategyHttpHeaderName,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
type SyncProcessOptions,
|
|
11
12
|
type Visit,
|
|
12
13
|
} from '@openmrs/esm-framework';
|
|
13
|
-
import { launchFormEntry } from '@openmrs/esm-patient-common-lib';
|
|
14
14
|
import { formEncounterUrl, formEncounterUrlPoc } from './constants';
|
|
15
15
|
import { type Form } from './types';
|
|
16
16
|
|
|
@@ -33,12 +33,10 @@ const patientFormSyncItem = 'patient-form';
|
|
|
33
33
|
export async function setupPatientFormSync() {
|
|
34
34
|
setupOfflineSync<PatientFormSyncItemContent>(patientFormSyncItem, ['visit'], syncPatientForm, {
|
|
35
35
|
onBeginEditSyncItem(syncItem) {
|
|
36
|
-
|
|
37
|
-
syncItem.content.
|
|
38
|
-
syncItem.
|
|
39
|
-
|
|
40
|
-
'Form Entry',
|
|
41
|
-
);
|
|
36
|
+
launchWorkspace2('patient-form-entry-workspace', {
|
|
37
|
+
form: syncItem.content.form,
|
|
38
|
+
encounterUuid: syncItem.content._id,
|
|
39
|
+
});
|
|
42
40
|
},
|
|
43
41
|
});
|
|
44
42
|
}
|
package/src/routes.json
CHANGED
|
@@ -29,64 +29,28 @@
|
|
|
29
29
|
"slot": "offline-tools-page-forms-slot",
|
|
30
30
|
"offline": true,
|
|
31
31
|
"online": true
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "clinical-form-action-menu",
|
|
35
|
-
"component": "clinicalFormActionMenu",
|
|
36
|
-
"slot": "action-menu-patient-chart-items-slot",
|
|
37
|
-
"offline": true,
|
|
38
|
-
"online": true,
|
|
39
|
-
"order": 2
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "clinical-forms-workspaceExtension",
|
|
43
|
-
"component": "clinicalFormsWorkspaceExtension",
|
|
44
|
-
"slot": "ward-patient-clinical-forms-workspace-slot"
|
|
45
32
|
}
|
|
46
33
|
],
|
|
47
|
-
"
|
|
34
|
+
"workspaces2": [
|
|
48
35
|
{
|
|
49
36
|
"name": "patient-form-entry-workspace",
|
|
50
|
-
"title": "clinicalForm",
|
|
51
37
|
"component": "patientFormEntryWorkspace",
|
|
52
|
-
"
|
|
53
|
-
"canMaximize": true,
|
|
54
|
-
"canHide": true,
|
|
55
|
-
"width": "wider"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "ward-patient-form-entry-workspace",
|
|
59
|
-
"title": "clinicalForm",
|
|
60
|
-
"component": "patientFormEntryWorkspace",
|
|
61
|
-
"type": "ward-patient-clinical-form",
|
|
62
|
-
"canMaximize": true,
|
|
63
|
-
"canHide": false,
|
|
64
|
-
"width": "wider"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"name": "patient-html-form-entry-workspace",
|
|
68
|
-
"title": "clinicalForm",
|
|
69
|
-
"component": "patientHtmlFormEntryWorkspace",
|
|
70
|
-
"type": "clinical-form",
|
|
71
|
-
"canMaximize": true,
|
|
72
|
-
"canHide": false,
|
|
73
|
-
"width": "extra-wide"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"name": "ward-patient-html-form-entry-workspace",
|
|
77
|
-
"title": "clinicalForm",
|
|
78
|
-
"component": "patientHtmlFormEntryWorkspace",
|
|
79
|
-
"type": "ward-patient-clinical-form",
|
|
80
|
-
"canMaximize": true,
|
|
81
|
-
"canHide": false,
|
|
82
|
-
"width": "extra-wide"
|
|
38
|
+
"window": "patient-chart-clinical-forms"
|
|
83
39
|
},
|
|
84
40
|
{
|
|
85
41
|
"name": "clinical-forms-workspace",
|
|
86
|
-
"title": "clinicalForms",
|
|
87
42
|
"component": "clinicalFormsWorkspace",
|
|
88
|
-
"
|
|
89
|
-
|
|
43
|
+
"window": "patient-chart-clinical-forms"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"workspaceWindows2": [
|
|
47
|
+
{
|
|
48
|
+
"name": "patient-chart-clinical-forms",
|
|
49
|
+
"icon": "clinicalFormActionButton",
|
|
50
|
+
"order": 3,
|
|
51
|
+
"width": "extra-wide",
|
|
52
|
+
"group": "patient-chart",
|
|
53
|
+
"canMaximize": true
|
|
90
54
|
}
|
|
91
55
|
]
|
|
92
56
|
}
|
package/dist/1123.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 1123.js.LICENSE.txt */
|
|
2
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_forms_app=globalThis.webpackChunk_openmrs_esm_patient_forms_app||[]).push([[1123],{58139:(e,n,t)=>{e.exports=t(93296)},71123:(e,n,t)=>{t.d(n,{Ay:()=>o,BE:()=>d,iX:()=>s.useSWRConfig});var r=t(1343),i=t(58139),s=t(55434);const a=r.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((n=>{e.status="fulfilled",e.value=n}),(n=>{e.status="rejected",e.reason=n})),e)}),u={dedupe:!0},d=s.OBJECT.defineProperty(s.SWRConfig,"defaultValue",{value:s.defaultConfig}),o=(0,s.withArgs)(((e,n,t)=>{const{cache:d,compare:o,suspense:c,fallbackData:f,revalidateOnMount:l,revalidateIfStale:E,refreshInterval:g,refreshWhenHidden:v,refreshWhenOffline:p,keepPreviousData:h}=t,[R,S,U,_]=s.SWRGlobalState.get(d),[m,T]=(0,s.serialize)(e),V=(0,r.useRef)(!1),b=(0,r.useRef)(!1),C=(0,r.useRef)(m),y=(0,r.useRef)(n),w=(0,r.useRef)(t),L=()=>w.current,O=()=>L().isVisible()&&L().isOnline(),[I,k,D,A]=(0,s.createCacheHelper)(d,m),N=(0,r.useRef)({}).current,F=(0,s.isUndefined)(f)?t.fallback[m]:f,P=(e,n)=>{for(const t in N){const r=t;if("data"===r){if(!o(e[r],n[r])){if(!(0,s.isUndefined)(e[r]))return!1;if(!o(q,n[r]))return!1}}else if(n[r]!==e[r])return!1}return!0},j=(0,r.useMemo)((()=>{const e=!!m&&!!n&&((0,s.isUndefined)(l)?!L().isPaused()&&!c&&(!!(0,s.isUndefined)(E)||E):l),t=n=>{const t=(0,s.mergeObjects)(n);return delete t._k,e?{isValidating:!0,isLoading:!0,...t}:t},r=I(),i=A(),a=t(r),u=r===i?a:t(i);let d=a;return[()=>{const e=t(I());return P(e,d)?(d.data=e.data,d.isLoading=e.isLoading,d.isValidating=e.isValidating,d.error=e.error,d):(d=e,e)},()=>u]}),[d,m]),x=(0,i.useSyncExternalStore)((0,r.useCallback)((e=>D(m,((n,t)=>{P(t,n)||e()}))),[d,m]),j[0],j[1]),W=!V.current,M=R[m]&&R[m].length>0,G=x.data,B=(0,s.isUndefined)(G)?F:G,H=x.error,Y=(0,r.useRef)(B),q=h?(0,s.isUndefined)(G)?Y.current:G:B,z=!(M&&!(0,s.isUndefined)(H))&&(W&&!(0,s.isUndefined)(l)?l:!L().isPaused()&&(c?!(0,s.isUndefined)(B)&&E:(0,s.isUndefined)(B)||E)),J=!!(m&&n&&W&&z),X=(0,s.isUndefined)(x.isValidating)?J:x.isValidating,K=(0,s.isUndefined)(x.isLoading)?J:x.isLoading,Q=(0,r.useCallback)((async e=>{const n=y.current;if(!m||!n||b.current||L().isPaused())return!1;let r,i,a=!0;const u=e||{},d=!U[m]||!u.dedupe,c=()=>s.IS_REACT_LEGACY?!b.current&&m===C.current&&V.current:m===C.current,f={isValidating:!1,isLoading:!1},l=()=>{k(f)},E=()=>{const e=U[m];e&&e[1]===i&&delete U[m]},g={isValidating:!0};(0,s.isUndefined)(I().data)&&(g.isLoading=!0);try{if(d&&(k(g),t.loadingTimeout&&(0,s.isUndefined)(I().data)&&setTimeout((()=>{a&&c()&&L().onLoadingSlow(m,t)}),t.loadingTimeout),U[m]=[n(T),(0,s.getTimestamp)()]),[r,i]=U[m],r=await r,d&&setTimeout(E,t.dedupingInterval),!U[m]||U[m][1]!==i)return d&&c()&&L().onDiscarded(m),!1;f.error=s.UNDEFINED;const e=S[m];if(!(0,s.isUndefined)(e)&&(i<=e[0]||i<=e[1]||0===e[1]))return l(),d&&c()&&L().onDiscarded(m),!1;const u=I().data;f.data=o(u,r)?u:r,d&&c()&&L().onSuccess(r,m,t)}catch(e){E();const n=L(),{shouldRetryOnError:t}=n;n.isPaused()||(f.error=e,d&&c()&&(n.onError(e,m,n),(!0===t||(0,s.isFunction)(t)&&t(e))&&(L().revalidateOnFocus&&L().revalidateOnReconnect&&!O()||n.onErrorRetry(e,m,n,(e=>{const n=R[m];n&&n[0]&&n[0](s.revalidateEvents.ERROR_REVALIDATE_EVENT,e)}),{retryCount:(u.retryCount||0)+1,dedupe:!0}))))}return a=!1,l(),!0}),[m,d]),Z=(0,r.useCallback)(((...e)=>(0,s.internalMutate)(d,C.current,...e)),[]);if((0,s.useIsomorphicLayoutEffect)((()=>{y.current=n,w.current=t,(0,s.isUndefined)(G)||(Y.current=G)})),(0,s.useIsomorphicLayoutEffect)((()=>{if(!m)return;const e=Q.bind(s.UNDEFINED,u);let n=0;const t=(0,s.subscribeCallback)(m,R,((t,r={})=>{if(t==s.revalidateEvents.FOCUS_EVENT){const t=Date.now();L().revalidateOnFocus&&t>n&&O()&&(n=t+L().focusThrottleInterval,e())}else if(t==s.revalidateEvents.RECONNECT_EVENT)L().revalidateOnReconnect&&O()&&e();else{if(t==s.revalidateEvents.MUTATE_EVENT)return Q();if(t==s.revalidateEvents.ERROR_REVALIDATE_EVENT)return Q(r)}}));return b.current=!1,C.current=m,V.current=!0,k({_k:T}),z&&((0,s.isUndefined)(B)||s.IS_SERVER?e():(0,s.rAF)(e)),()=>{b.current=!0,t()}}),[m]),(0,s.useIsomorphicLayoutEffect)((()=>{let e;function n(){const n=(0,s.isFunction)(g)?g(I().data):g;n&&-1!==e&&(e=setTimeout(t,n))}function t(){I().error||!v&&!L().isVisible()||!p&&!L().isOnline()?n():Q(u).then(n)}return n(),()=>{e&&(clearTimeout(e),e=-1)}}),[g,v,p,m]),(0,r.useDebugValue)(q),c&&(0,s.isUndefined)(B)&&m){if(!s.IS_REACT_LEGACY&&s.IS_SERVER)throw new Error("Fallback data is required when using suspense in SSR.");y.current=n,w.current=t,b.current=!1;const e=_[m];if(!(0,s.isUndefined)(e)){const n=Z(e);a(n)}if(!(0,s.isUndefined)(H))throw H;{const e=Q(u);(0,s.isUndefined)(q)||(e.status="fulfilled",e.value=!0),a(e)}}return{mutate:Z,get data(){return N.data=!0,q},get error(){return N.error=!0,H},get isValidating(){return N.isValidating=!0,X},get isLoading(){return N.isLoading=!0,K}}}))},93296:(e,n,t)=>{var r=t(1343),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},s=r.useState,a=r.useEffect,u=r.useLayoutEffect,d=r.useDebugValue;function o(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!i(e,t)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),r=s({inst:{value:t,getSnapshot:n}}),i=r[0].inst,c=r[1];return u((function(){i.value=t,i.getSnapshot=n,o(i)&&c({inst:i})}),[e,t,n]),a((function(){return o(i)&&c({inst:i}),e((function(){o(i)&&c({inst:i})}))}),[e]),d(t),t};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c}}]);
|
package/dist/1123.js.LICENSE.txt
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license React
|
|
3
|
-
* use-sync-external-store-shim.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
package/dist/1123.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1123.js","mappings":";6JAGEA,EAAOC,QAAU,EAAjB,6GCGF,MAGMC,EAAM,OAAoB,CAAEC,IAC9B,GAAuB,YAAnBA,EAAQC,OACR,MAAMD,EACH,GAAuB,cAAnBA,EAAQC,OACf,OAAOD,EAAQE,MACZ,KAAuB,aAAnBF,EAAQC,OACTD,EAAQG,QAEdH,EAAQC,OAAS,UACjBD,EAAQI,MAAMC,IACVL,EAAQC,OAAS,YACjBD,EAAQE,MAAQG,KAChBC,IACAN,EAAQC,OAAS,WACjBD,EAAQG,OAASG,KAEfN,EAEb,GACKO,EAAc,CAChBC,Q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tD,GACA,CAACO,EAAW3K,EAAO2D,IAErBsG,GACE,WAEE,OADAE,EAAuBC,IAASS,EAAY,CAAET,KAAMA,IAC7CO,GAAU,WACfR,EAAuBC,IAASS,EAAY,CAAET,KAAMA,GACtD,GACF,GACA,CAACO,IAEHrB,EAActJ,GACPA,CACT,EAoBAJ,EAAQmF,0BACN,IAAW2E,EAAM3E,qBAAuB2E,EAAM3E,qBAAuBwF","sources":["webpack://@openmrs/esm-patient-forms-app/../../node_modules/use-sync-external-store/shim/index.js","webpack://@openmrs/esm-patient-forms-app/../../node_modules/swr/dist/core/index.mjs","webpack://@openmrs/esm-patient-forms-app/../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"],"names":["module","exports","use","promise","status","value","reason","then","v","e","WITH_DEDUPE","dedupe","SWRConfig","OBJECT","defineProperty","defaultConfig","useSWR","withArgs","_key","fetcher","config","cache","compare","suspense","fallbackData","revalidateOnMount","revalidateIfStale","refreshInterval","refreshWhenHidden","refreshWhenOffline","keepPreviousData","EVENT_REVALIDATORS","MUTATION","FETCH","PRELOAD","SWRGlobalState","get","key","fnArg","serialize","initialMountedRef","useRef","unmountedRef","keyRef","fetcherRef","configRef","getConfig","current","isActive","isVisible","isOnline","getCache","setCache","subscribeCache","getInitialCache","createCacheHelper","stateDependencies","fallback","isUndefined","isEqual","prev","_","t","returnedData","getSnapshot","useMemo","shouldStartRequest","isPaused","getSelectedCache","state","snapshot","mergeObjects","_k","isValidating","isLoading","cachedData","initialData","clientSnapshot","serverSnapshot","memorizedSnapshot","newSnapshot","data","error","cached","useSyncExternalStore","useCallback","callback","isInitialMount","hasRevalidator","length","laggyDataRef","shouldDoInitialRevalidation","defaultValidatingState","revalidate","async","revalidateOpts","currentFetcher","newData","startAt","loading","opts","shouldStartNewRequest","callbackSafeguard","IS_REACT_LEGACY","finalState","finishRequestAndUpdateState","cleanupState","requestInfo","initialState","loadingTimeout","setTimeout","onLoadingSlow","getTimestamp","dedupingInterval","onDiscarded","UNDEFINED","mutationInfo","cacheData","onSuccess","err","currentConfig","shouldRetryOnError","onError","isFunction","revalidateOnFocus","revalidateOnReconnect","onErrorRetry","_opts","revalidators","revalidateEvents","ERROR_REVALIDATE_EVENT","retryCount","boundMutate","args","internalMutate","useIsomorphicLayoutEffect","softRevalidate","bind","nextFocusRevalidatedAt","unsubEvents","subscribeCallback","type","FOCUS_EVENT","now","Date","focusThrottleInterval","RECONNECT_EVENT","MUTATE_EVENT","IS_SERVER","rAF","timer","next","interval","execute","clearTimeout","useDebugValue","Error","req","mutate","React","objectIs","Object","is","x","y","useState","useEffect","useLayoutEffect","checkIfSnapshotChanged","inst","latestGetSnapshot","nextValue","shim","window","document","createElement","subscribe","_useState","forceUpdate"],"sourceRoot":""}
|
package/dist/2773.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_forms_app=globalThis.webpackChunk_openmrs_esm_patient_forms_app||[]).push([[2773],{66449:(e,r,n)=>{n.d(r,{A:()=>l});var t=n(30977),o=n.n(t),a=n(95924),i=n.n(a)()(o());i.push([e.id,".-esm-patient-forms__html-form-entry-wrapper__wrapper___bkx4M{width:95%;border:none;margin:0;padding:0;display:none}","",{version:3,sources:["webpack://./src/htmlformentry/html-form-entry-wrapper.scss"],names:[],mappings:"AAAA,8DACE,SAAA,CACA,WAAA,CACA,QAAA,CACA,SAAA,CACA,YAAA",sourcesContent:[".wrapper {\n width: 95%;\n border: none;\n margin: 0;\n padding: 0;\n display: none;\n}\n"],sourceRoot:""}]),i.locals={wrapper:"-esm-patient-forms__html-form-entry-wrapper__wrapper___bkx4M"};const l=i},72773:(e,r,n)=>{n.r(r),n.d(r,{default:()=>C});var t=n(1343),o=n.n(t),a=n(72591),i=n.n(a),l=n(1740),s=n.n(l),u=n(88128),c=n.n(u),d=n(30855),p=n.n(d),m=n(93051),f=n.n(m),v=n(73656),A=n.n(v),h=n(66449),y={};y.styleTagTransform=A(),y.setAttributes=p(),y.insert=c().bind(null,"head"),y.domAPI=s(),y.insertStyleElement=f(),i()(h.A,y);const b=h.A&&h.A.locals?h.A.locals:void 0;var w=n(79278);function g(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}const _=function(e){var r,n,a=e.closeWorkspaceWithSavedChanges,i=e.src,l=(0,t.useRef)(),s=(r=(0,t.useState)(!0),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,r){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var t,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(a.push(t.value),!r||a.length!==r);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(r,n)||function(e,r){if(e){if("string"==typeof e)return g(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,r):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],c=s[1];(0,t.useEffect)((function(){var e=function(e){return"close-workspace"===(null==e?void 0:e.data)&&a()};return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}}),[a]);var d=(0,t.useCallback)((function(){var e,r,n;c(!1),l.current.contentWindow.addEventListener("beforeunload",(function(){return c(!0)}));var t=l.current,o=l.current.contentDocument;null===(e=o.querySelector("header"))||void 0===e||e.remove(),null===(r=o.querySelector(".patient-header"))||void 0===r||r.remove(),null===(n=o.querySelector("#breadcrumbs"))||void 0===n||n.remove(),t.style.display="block",t.height=o.body.scrollHeight+50+"px";var a=o.createElement("style");a.innerHTML="@media screen {\n body { background: white; }\n }",o.head.appendChild(a)}),[]);return o().createElement("div",null,u&&o().createElement(w.OuH,null),o().createElement("iframe",{ref:l,src:i,className:b.wrapper,onLoad:d}))},C=function(e){var r=e.patientUuid,n=e.closeWorkspaceWithSavedChanges,t=e.promptBeforeClosing,a=e.formInfo,i=e.visitContext,l=a||{},s=l.encounterUuid,u=l.visitUuid,c=l.htmlForm;t((function(){return!0}));var d=s?c.formEditUiPage:c.formUiPage,p="".concat(window.openmrsBase,"/htmlformentryui/htmlform/").concat(d,".page?"),m=new URLSearchParams;m.append("patientId",r),(u||(null==i?void 0:i.uuid))&&m.append("visitId",null!=u?u:null==i?void 0:i.uuid),s&&m.append("encounterId",s),c.formUiResource?m.append("definitionUiResource",c.formUiResource):m.append("formUuid",c.formUuid),m.append("returnUrl","post-message:close-workspace");var f=a&&r;return o().createElement("div",null,f&&o().createElement(_,{src:p+m,closeWorkspaceWithSavedChanges:n}))}}}]);
|
package/dist/2773.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"2773.js","mappings":"iNAGIA,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,uHAAwH,GAAG,CAAC,QAAU,EAAE,QAAU,CAAC,8DAA8D,MAAQ,GAAG,SAAW,0DAA0D,eAAiB,CAAC,kGAAkG,WAAa,MAE3cH,EAAwBI,OAAS,CAChC,QAAW,gEAEZ,S,yMCCIC,EAAU,CAAC,EAEfA,EAAQC,kBAAoB,IAC5BD,EAAQE,cAAgB,IAElBF,EAAQG,OAAS,SAAc,KAAM,QAE3CH,EAAQI,OAAS,IACjBJ,EAAQK,mBAAqB,IAEhB,IAAI,IAASL,GAKnB,QAAe,KAAW,IAAQD,OAAS,IAAQA,YAASO,E,yHCqBnE,QAtCkE,Y,QAAGC,EAAAA,EAAAA,+BAAgCC,EAAAA,EAAAA,IAC7FC,GAAYC,EAAAA,EAAAA,UAC4BC,G,GAAAA,EAAAA,EAAAA,WAAS,G,EAAA,E,+zBAAhDC,EAAuCD,EAAAA,GAAtBE,EA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AgBE,EAASE,eAAiBF,EAASG,WAC5DC,EAAM,GAAkDH,OAA/CnC,OAAOuC,YAAY,8BAAmC,OAAPJ,EAAO,UAC/DK,EAAe,IAAIC,gBACzBD,EAAaE,OAAO,YAAad,IAC7BK,IAAaF,aAAAA,EAAAA,EAAcY,QAC7BH,EAAaE,OAAO,UAAWT,QAAAA,EAAaF,aAAAA,EAAAA,EAAcY,MAExDX,GACFQ,EAAaE,OAAO,cAAeV,GAEjCE,EAASU,eACXJ,EAAaE,OAAO,uBAAwBR,EAASU,gBAErDJ,EAAaE,OAAO,WAAYR,EAASW,UAE3CL,EAAaE,OAAO,YAAa,gCAEjC,IAAMI,EAAwBhB,GAAYF,EAC1C,OACE,kBAACN,MAAAA,KACEwB,GACC,kBAACC,EAAoBA,CACnBzD,IAAKgD,EAAME,EACXnD,+BAAgCA,IAK1C,C","sources":["webpack://@openmrs/esm-patient-forms-app/./src/htmlformentry/html-form-entry-wrapper.scss","webpack://@openmrs/esm-patient-forms-app/./src/htmlformentry/html-form-entry-wrapper.scss?6ded","webpack://@openmrs/esm-patient-forms-app/./src/htmlformentry/html-form-entry-wrapper.component.tsx","webpack://@openmrs/esm-patient-forms-app/./src/htmlformentry/html-form-entry.workspace.tsx"],"names":["___CSS_LOADER_EXPORT___","push","module","id","locals","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","undefined","closeWorkspaceWithSavedChanges","src","iframeRef","useRef","useState","isIframeLoading","setIsIframeLoading","useEffect","callback","event","data","window","addEventListener","removeEventListener","onLoad","useCallback","dashboard","current","contentWindow","iframe","contentDocument","querySelector","remove","style","display","height","body","scrollHeight","styleTag","createElement","innerHTML","head","appendChild","div","InlineLoading","ref","className","styles","wrapper","patientUuid","promptBeforeClosing","formInfo","visitContext","encounterUuid","visitUuid","htmlForm","uiPage","formEditUiPage","formUiPage","url","openmrsBase","searchParams","URLSearchParams","append","uuid","formUiResource","formUuid","showFormAndLoadedData","HtmlFormEntryWrapper"],"sourceRoot":""}
|