@openmrs/esm-patient-common-lib 7.0.2-pre.3795 → 7.0.2-pre.3814

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-common-lib",
3
- "version": "7.0.2-pre.3795",
3
+ "version": "7.0.2-pre.3814",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Library for common patient chart components",
6
6
  "browser": "dist/openmrs-esm-patient-common-lib.js",
@@ -38,5 +38,5 @@
38
38
  "react": "18.x",
39
39
  "single-spa": "6.x"
40
40
  },
41
- "gitHead": "9cea718964ab0991a69914f347128d628ea08c0d"
41
+ "gitHead": "824f92345387bcc46b07f64dc68ebd654de09211"
42
42
  }
@@ -1,5 +1,3 @@
1
- import { closeWorkspace } from '../workspaces';
2
-
3
1
  /* The possible states a workspace window can be opened in. */
4
2
  export type WorkspaceWindowState = 'maximized' | 'hidden' | 'normal';
5
3
 
@@ -35,6 +33,11 @@ export interface DefaultWorkspaceProps {
35
33
  * this workspace is closed; e.g. if there is unsaved data.
36
34
  */
37
35
  promptBeforeClosing(testFcn: () => boolean): void;
36
+ /**
37
+ * Call this function to close the workspace after the form is saved. This function
38
+ * will directly close the workspace without any prompt
39
+ */
40
+ closeWorkspaceWithSavedChanges(closeWorkspaceOptions?: CloseWorkspaceOptions): void;
38
41
  patientUuid: string;
39
42
  handlePostResponse?(): void;
40
43
  }
@@ -24,6 +24,7 @@ export interface WorkspaceStoreState {
24
24
  export interface OpenWorkspace extends WorkspaceRegistration {
25
25
  additionalProps: object;
26
26
  closeWorkspace(closeWorkspaceOptions?: CloseWorkspaceOptions): boolean;
27
+ closeWorkspaceWithSavedChanges(closeWorkspaceOptions?: CloseWorkspaceOptions): boolean;
27
28
  promptBeforeClosing(testFcn: () => boolean): void;
28
29
  }
29
30
 
@@ -163,6 +164,8 @@ export function launchPatientWorkspace(name: string, additionalProps?: object) {
163
164
  const newWorkspace = {
164
165
  ...workspace,
165
166
  closeWorkspace: (options: CloseWorkspaceOptions = {}) => closeWorkspace(name, options),
167
+ closeWorkspaceWithSavedChanges: (options: CloseWorkspaceOptions) =>
168
+ closeWorkspace(name, { ignoreChanges: true, ...options }),
166
169
  promptBeforeClosing: (testFcn) => promptBeforeClosing(name, testFcn),
167
170
  additionalProps,
168
171
  };