@openmrs/esm-fast-data-entry-app 1.0.0-pre.9 → 1.0.1-pre.8

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 (133) hide show
  1. package/.eslintrc.js +10 -0
  2. package/.husky/pre-push +1 -6
  3. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
  4. package/.yarn/versions/7ee3eceb.yml +0 -0
  5. package/README.md +39 -12
  6. package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
  7. package/docs/config-icrc-forms.png +0 -0
  8. package/docs/config-other-forms.png +0 -0
  9. package/docs/configuring-form-categories.md +77 -0
  10. package/docs/fde-workflow.mov +0 -0
  11. package/docs/form-workflow-state-diagram.png +0 -0
  12. package/jest.config.json +20 -18
  13. package/package.json +97 -106
  14. package/src/FormBootstrap.tsx +151 -0
  15. package/src/Root.tsx +14 -3
  16. package/src/add-group-modal/AddGroupModal.tsx +209 -0
  17. package/src/add-group-modal/styles.scss +35 -0
  18. package/src/config-schema.ts +63 -31
  19. package/src/context/FormWorkflowContext.tsx +114 -0
  20. package/src/context/FormWorkflowReducer.ts +277 -0
  21. package/src/context/GroupFormWorkflowContext.tsx +141 -0
  22. package/src/context/GroupFormWorkflowReducer.ts +272 -0
  23. package/src/empty-state/EmptyDataIllustration.tsx +51 -0
  24. package/src/empty-state/EmptyState.tsx +33 -0
  25. package/src/empty-state/styles.scss +55 -0
  26. package/src/form-entry-workflow/FormEntryWorkflow.tsx +230 -0
  27. package/src/form-entry-workflow/form-review-card/FormReviewCard.tsx +50 -0
  28. package/src/form-entry-workflow/form-review-card/index.ts +3 -0
  29. package/src/form-entry-workflow/form-review-card/styles.scss +39 -0
  30. package/src/form-entry-workflow/index.ts +3 -0
  31. package/src/form-entry-workflow/patient-banner/PatientBanner.test.tsx +9 -0
  32. package/src/form-entry-workflow/patient-banner/PatientBanner.tsx +86 -0
  33. package/src/form-entry-workflow/patient-banner/index.ts +3 -0
  34. package/src/form-entry-workflow/patient-banner/styles.scss +45 -0
  35. package/src/form-entry-workflow/patient-search-header/PatientSearchHeader.tsx +63 -0
  36. package/src/form-entry-workflow/patient-search-header/index.ts +3 -0
  37. package/src/form-entry-workflow/patient-search-header/styles.scss +22 -0
  38. package/src/form-entry-workflow/styles.scss +64 -0
  39. package/src/form-entry-workflow/workflow-review/WorkflowReview.tsx +35 -0
  40. package/src/form-entry-workflow/workflow-review/index.ts +3 -0
  41. package/src/form-entry-workflow/workflow-review/styles.scss +34 -0
  42. package/src/forms-app-menu-link.tsx +3 -2
  43. package/src/forms-page/FormsPage.tsx +129 -0
  44. package/src/forms-page/forms-table/FormsTable.tsx +131 -0
  45. package/src/forms-page/forms-table/index.ts +3 -0
  46. package/src/forms-page/forms-table/styles.scss +20 -0
  47. package/src/forms-page/index.ts +3 -0
  48. package/src/forms-page/styles.scss +11 -0
  49. package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +413 -0
  50. package/src/group-form-entry-workflow/group-banner/GroupBanner.test.tsx +9 -0
  51. package/src/group-form-entry-workflow/group-banner/GroupBanner.tsx +45 -0
  52. package/src/group-form-entry-workflow/group-banner/index.ts +3 -0
  53. package/src/group-form-entry-workflow/group-banner/styles.scss +60 -0
  54. package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +106 -0
  55. package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +63 -0
  56. package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +93 -0
  57. package/src/group-form-entry-workflow/group-search/compact-group-result.scss +64 -0
  58. package/src/group-form-entry-workflow/group-search/compact-group-search.scss +35 -0
  59. package/src/group-form-entry-workflow/group-search/group-search.scss +94 -0
  60. package/src/group-form-entry-workflow/group-search/mock-group-data.ts +79 -0
  61. package/src/group-form-entry-workflow/group-search/useGroupSearch.ts +14 -0
  62. package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +42 -0
  63. package/src/group-form-entry-workflow/group-search-header/index.ts +3 -0
  64. package/src/group-form-entry-workflow/group-search-header/styles.scss +20 -0
  65. package/src/group-form-entry-workflow/index.ts +3 -0
  66. package/src/group-form-entry-workflow/styles.scss +86 -0
  67. package/src/hooks/index.ts +6 -0
  68. package/src/hooks/useFormState.ts +23 -0
  69. package/src/hooks/useGetAllForms.ts +45 -0
  70. package/src/hooks/useGetEncounter.ts +21 -0
  71. package/src/hooks/useGetPatient.ts +23 -0
  72. package/src/hooks/useKeyPress.ts +31 -0
  73. package/src/hooks/usePostCohort.ts +18 -0
  74. package/src/index.ts +20 -4
  75. package/src/patient-card/PatientCard.tsx +67 -0
  76. package/src/patient-card/index.ts +3 -0
  77. package/src/patient-card/styles.scss +45 -0
  78. package/translations/en.json +49 -4
  79. package/tsconfig.json +26 -23
  80. package/.eslintrc +0 -4
  81. package/.github/workflows/node.js.yml +0 -79
  82. package/.husky/pre-commit +0 -6
  83. package/dist/24.js +0 -3
  84. package/dist/24.js.LICENSE.txt +0 -16
  85. package/dist/24.js.map +0 -1
  86. package/dist/294.js +0 -3
  87. package/dist/294.js.LICENSE.txt +0 -14
  88. package/dist/294.js.map +0 -1
  89. package/dist/296.js +0 -2
  90. package/dist/296.js.map +0 -1
  91. package/dist/299.js +0 -2
  92. package/dist/299.js.map +0 -1
  93. package/dist/382.js +0 -3
  94. package/dist/382.js.LICENSE.txt +0 -8
  95. package/dist/382.js.map +0 -1
  96. package/dist/415.js +0 -2
  97. package/dist/415.js.map +0 -1
  98. package/dist/574.js +0 -1
  99. package/dist/595.js +0 -3
  100. package/dist/595.js.LICENSE.txt +0 -1
  101. package/dist/595.js.map +0 -1
  102. package/dist/69.js +0 -2
  103. package/dist/69.js.map +0 -1
  104. package/dist/735.js +0 -3
  105. package/dist/735.js.LICENSE.txt +0 -29
  106. package/dist/735.js.map +0 -1
  107. package/dist/777.js +0 -2
  108. package/dist/777.js.map +0 -1
  109. package/dist/860.js +0 -2
  110. package/dist/860.js.map +0 -1
  111. package/dist/906.js +0 -2
  112. package/dist/906.js.map +0 -1
  113. package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +0 -369
  114. package/dist/openmrs-esm-fast-data-entry-app.js.map +0 -1
  115. package/dist/openmrs-esm-fast-data-entry-app.old +0 -2
  116. package/src/boxes/extensions/blue-box.tsx +0 -15
  117. package/src/boxes/extensions/box.scss +0 -23
  118. package/src/boxes/extensions/brand-box.tsx +0 -15
  119. package/src/boxes/extensions/red-box.tsx +0 -15
  120. package/src/boxes/slot/boxes.css +0 -23
  121. package/src/boxes/slot/boxes.tsx +0 -19
  122. package/src/forms/FormsRoot.tsx +0 -32
  123. package/src/forms/FormsTable.tsx +0 -64
  124. package/src/forms/mockData.ts +0 -43
  125. package/src/greeter/greeter.css +0 -4
  126. package/src/greeter/greeter.test.tsx +0 -29
  127. package/src/greeter/greeter.tsx +0 -25
  128. package/src/hello.css +0 -3
  129. package/src/hello.test.tsx +0 -45
  130. package/src/hello.tsx +0 -30
  131. package/src/patient-getter/patient-getter.resource.ts +0 -31
  132. package/src/patient-getter/patient-getter.test.tsx +0 -28
  133. package/src/patient-getter/patient-getter.tsx +0 -28
@@ -0,0 +1,18 @@
1
+ import { openmrsFetch } from "@openmrs/esm-framework";
2
+
3
+ const usePostCohort = () => {
4
+ const cohortURL = `/ws/rest/v1/cohortm/cohort`;
5
+ const fetcher = openmrsFetch(cohortURL, {
6
+ method: "POST",
7
+ headers: {
8
+ "Content-Type": "application/json",
9
+ },
10
+ body: {
11
+ name: "Magenta",
12
+ cohortType: "hello",
13
+ },
14
+ });
15
+ return fetcher;
16
+ };
17
+
18
+ export default usePostCohort;
package/src/index.ts CHANGED
@@ -5,9 +5,17 @@
5
5
  * microfrontend.
6
6
  */
7
7
 
8
- import { getAsyncLifecycle, defineConfigSchema } from "@openmrs/esm-framework";
8
+ import {
9
+ getAsyncLifecycle,
10
+ defineConfigSchema,
11
+ registerBreadcrumbs,
12
+ } from "@openmrs/esm-framework";
9
13
  import { configSchema } from "./config-schema";
10
14
 
15
+ declare let __VERSION__: string;
16
+ // __VERSION__ is replaced by Webpack with the version from package.json
17
+ const version = __VERSION__;
18
+
11
19
  /**
12
20
  * This tells the app shell how to obtain translation files: that they
13
21
  * are JSON files in the directory `../translations` (which you should
@@ -44,15 +52,23 @@ const backendDependencies = {
44
52
  * `/openmrs/spa/hello`.
45
53
  */
46
54
  function setupOpenMRS() {
47
- const moduleName = "@openmrs/esm-fast-data-entry";
55
+ const moduleName = "@openmrs/esm-fast-data-entry-app";
48
56
 
49
57
  const options = {
50
- featureName: "fast-data-entry",
58
+ featureName: "fast-data-entry-app",
51
59
  moduleName,
52
60
  };
53
61
 
54
62
  defineConfigSchema(moduleName, configSchema);
55
63
 
64
+ registerBreadcrumbs([
65
+ {
66
+ path: `${window.spaBase}/forms`,
67
+ title: "Forms",
68
+ parent: `${window.spaBase}/home`,
69
+ },
70
+ ]);
71
+
56
72
  return {
57
73
  pages: [
58
74
  {
@@ -72,4 +88,4 @@ function setupOpenMRS() {
72
88
  };
73
89
  }
74
90
 
75
- export { backendDependencies, importTranslation, setupOpenMRS };
91
+ export { backendDependencies, importTranslation, setupOpenMRS, version };
@@ -0,0 +1,67 @@
1
+ import { CheckmarkOutline, WarningAlt } from "@carbon/react/icons";
2
+ import { SkeletonText } from "@carbon/react";
3
+ import React from "react";
4
+ import useGetPatient from "../hooks/useGetPatient";
5
+ import styles from "./styles.scss";
6
+
7
+ const CardContainer = ({ onClick = () => undefined, active, children }) => {
8
+ return (
9
+ <div
10
+ onClick={onClick}
11
+ className={`${styles.cardContainer} ${!active && styles.inactiveCard}`}
12
+ role="button"
13
+ tabIndex={0}
14
+ >
15
+ {children}
16
+ </div>
17
+ );
18
+ };
19
+
20
+ const PatientCard = ({
21
+ patientUuid,
22
+ activePatientUuid,
23
+ editEncounter,
24
+ encounters,
25
+ }) => {
26
+ const patient = useGetPatient(patientUuid);
27
+ const givenName = patient?.name?.[0]?.given?.[0];
28
+ const familyName = patient?.name?.[0]?.family;
29
+ const identifier = patient?.identifier?.[0]?.value;
30
+
31
+ if (!patient) {
32
+ return (
33
+ <CardContainer active={true}>
34
+ <SkeletonText className={styles.skeletonText} />
35
+ </CardContainer>
36
+ );
37
+ }
38
+
39
+ const active = activePatientUuid === patientUuid;
40
+
41
+ return (
42
+ <CardContainer
43
+ onClick={active ? () => undefined : () => editEncounter(patientUuid)}
44
+ active={active}
45
+ >
46
+ <div className={styles.patientInfo}>
47
+ <div className={styles.identifier}>{identifier}</div>
48
+ <div
49
+ className={`${styles.displayName} ${
50
+ active && styles.activeDisplayName
51
+ }`}
52
+ >
53
+ {givenName} {familyName}
54
+ </div>
55
+ </div>
56
+ <div>
57
+ {patientUuid in encounters ? (
58
+ <CheckmarkOutline size={16} className={styles.statusSuccess} />
59
+ ) : (
60
+ <WarningAlt size={16} className={styles.statusWarning} />
61
+ )}
62
+ </div>
63
+ </CardContainer>
64
+ );
65
+ };
66
+
67
+ export default PatientCard;
@@ -0,0 +1,3 @@
1
+ import PatientCard from "./PatientCard";
2
+
3
+ export default PatientCard;
@@ -0,0 +1,45 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/colors';
3
+ // @use '@carbon/styles/scss/type';
4
+ // @import '~@openmrs/esm-styleguide/src/vars';
5
+
6
+ .cardContainer {
7
+ padding: spacing.$spacing-05;
8
+ display: flex;
9
+ }
10
+
11
+ .skeletonText {
12
+ max-width: 8rem;
13
+ }
14
+
15
+ .identifier {
16
+ font-weight: 300;
17
+ font-size: 0.8rem;
18
+ line-height: 0.9rem;
19
+ }
20
+
21
+ .displayName {
22
+ font-weight: bold;
23
+ }
24
+
25
+ .activeDisplayName {
26
+ color: colors.$blue-50;
27
+ }
28
+
29
+ .inactiveCard {
30
+ &:hover {
31
+ background-color: colors.$gray-30;
32
+ }
33
+ }
34
+
35
+ .patientInfo {
36
+ flex-grow: 1;
37
+ }
38
+
39
+ .statusSuccess {
40
+ fill: colors.$green-60;
41
+ }
42
+
43
+ .statusWarning {
44
+ fill: colors.$yellow-40;
45
+ }
@@ -1,4 +1,49 @@
1
- {
2
- "casualGreeting": "hey",
3
- "formalGreeting": "hello"
4
- }
1
+ {
2
+ "actions": "Actions",
3
+ "allFieldsRequired": "All fields are required unless marked optional",
4
+ "areYouSure": "Are you sure?",
5
+ "cancel": "Cancel",
6
+ "cancelExplanation": "You will lose any unsaved changes on the current form. Do you want to discard the current session?",
7
+ "chooseGroupError": "Please choose a group.",
8
+ "createNewPatient": "Create new patient",
9
+ "createGroup": "Create Group",
10
+ "createNewGroup": "Create New Group",
11
+ "createNewSession": "Create New Session",
12
+ "complete": "Complete",
13
+ "dataErrorMessage": "Something went wrong loading data from the server.",
14
+ "description": "Description",
15
+ "discard": "Discard",
16
+ "error": "Error",
17
+ "errorCoppy": "Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above.",
18
+ "errorLoadingData": "Error Loading Data",
19
+ "fastDataEntry": "Fast Data Entry",
20
+ "fillForm": "Fill Form",
21
+ "formName": "Form Name",
22
+ "goToForm": "Go To Form",
23
+ "group": "Group",
24
+ "groupNameError": "Please enter a group name.",
25
+ "members": "members",
26
+ "newGroupName": "New Group Name",
27
+ "nextPatient": "Next Patient",
28
+ "noFormsFound": "No Forms To Show",
29
+ "noFormsFoundMessage": "No forms could be found for this category. Please double check the form concept uuids and access permissions.",
30
+ "noGroupsFoundMessage": "Sorry, no groups have been found",
31
+ "noPatientError": "Please enter at least one patient.",
32
+ "or": "or",
33
+ "orLabelName": "OR label name",
34
+ "practitionerName": "Practitioner Name",
35
+ "remove": "Remove",
36
+ "resumeSession": "Resume Session",
37
+ "resumeGroupSession": "Resume Group Session",
38
+ "saveAndComplete": "Save & Complete",
39
+ "saveExplanation": "Do you want to save the current form and exit the workflow?",
40
+ "saveSession": "Save Session",
41
+ "searchResultsText": "search result(s)",
42
+ "selectPatientFirst": "Please select a patient first",
43
+ "sessionDate": "Session Date",
44
+ "sessionDetails": "Session details",
45
+ "sessionName": "Session Name",
46
+ "sessionNotes": "Session Notes",
47
+ "startGroupSession": "Start Group Session",
48
+ "trySearchWithPatientUniqueID": "Try searching with the cohort's description"
49
+ }
package/tsconfig.json CHANGED
@@ -1,23 +1,26 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "module": "esnext",
5
- "allowSyntheticDefaultImports": true,
6
- "jsx": "react",
7
- "skipLibCheck": true,
8
- "moduleResolution": "node",
9
- "lib": [
10
- "dom",
11
- "es5",
12
- "scripthost",
13
- "es2015",
14
- "es2015.promise",
15
- "es2016.array.include",
16
- "es2018",
17
- "es2020"
18
- ],
19
- "resolveJsonModule": true,
20
- "noEmit": true,
21
- "target": "esnext"
22
- }
23
- }
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "module": "esnext",
5
+ "allowSyntheticDefaultImports": true,
6
+ "jsx": "react",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "node",
9
+ "lib": [
10
+ "dom",
11
+ "es5",
12
+ "scripthost",
13
+ "es2015",
14
+ "es2015.promise",
15
+ "es2016.array.include",
16
+ "es2018",
17
+ "es2020"
18
+ ],
19
+ "resolveJsonModule": true,
20
+ "noEmit": true,
21
+ "target": "esnext",
22
+ // "paths": {
23
+ // "@openmrs/*": ["./node_modules/@openmrs/*"]
24
+ // }
25
+ }
26
+ }
package/.eslintrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "extends": ["ts-react-important-stuff", "plugin:prettier/recommended"]
4
- }
@@ -1,79 +0,0 @@
1
- name: Node.js CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- branches: [main]
8
- release:
9
- types:
10
- - created
11
-
12
- env:
13
- ESM_NAME: "@openmrs/esm-fast-data-entry-app"
14
- JS_NAME: "openmrs-esm-fast-data-entry-app.js"
15
-
16
- jobs:
17
- build:
18
- runs-on: ubuntu-latest
19
-
20
- steps:
21
- - uses: actions/checkout@v2
22
- - name: Use Node.js
23
- uses: actions/setup-node@v1
24
- with:
25
- node-version: "16.x"
26
- - run: yarn
27
- - run: yarn lint
28
- - run: yarn coverage
29
- - run: yarn typescript
30
- - run: yarn build
31
- - name: Upload Artifacts
32
- uses: actions/upload-artifact@v2
33
- with:
34
- name: dist
35
- path: |
36
- dist
37
-
38
- pre_release:
39
- runs-on: ubuntu-latest
40
-
41
- needs: build
42
-
43
- if: ${{ github.event_name == 'push' }}
44
-
45
- steps:
46
- - uses: actions/checkout@v2
47
- - name: Download Artifacts
48
- uses: actions/download-artifact@v2
49
- - name: Use Node.js
50
- uses: actions/setup-node@v1
51
- with:
52
- node-version: "16.x"
53
- registry-url: "https://registry.npmjs.org"
54
- - run: npm install
55
- - run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
56
- - run: npm publish --tag next
57
- env:
58
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
59
-
60
- release:
61
- runs-on: ubuntu-latest
62
-
63
- needs: build
64
-
65
- if: ${{ github.event_name == 'release' }}
66
-
67
- steps:
68
- - uses: actions/checkout@v2
69
- - name: Download Artifacts
70
- uses: actions/download-artifact@v2
71
- - name: Use Node.js
72
- uses: actions/setup-node@v1
73
- with:
74
- node-version: "16.x"
75
- registry-url: 'https://registry.npmjs.org'
76
- - run: yarn
77
- - run: yarn publish
78
- env:
79
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
package/.husky/pre-commit DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- set -e # die on error
5
-
6
- npx pretty-quick --staged