@openmrs/esm-dispensing-app 1.2.2-pre.264 → 1.2.2-pre.267

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.
@@ -5,10 +5,10 @@
5
5
  "initial": true,
6
6
  "entry": true,
7
7
  "recorded": false,
8
- "size": 2709831,
8
+ "size": 2709817,
9
9
  "sizes": {
10
10
  "consume-shared": 252,
11
- "javascript": 2688743,
11
+ "javascript": 2688729,
12
12
  "share-init": 252,
13
13
  "runtime": 20584
14
14
  },
@@ -25,7 +25,7 @@
25
25
  "auxiliaryFiles": [
26
26
  "main.js.map"
27
27
  ],
28
- "hash": "509eb8ca3cb28d37",
28
+ "hash": "5e73008657c660d7",
29
29
  "childrenByOrder": {}
30
30
  },
31
31
  {
@@ -323,9 +323,9 @@
323
323
  "initial": false,
324
324
  "entry": false,
325
325
  "recorded": false,
326
- "size": 397085,
326
+ "size": 397071,
327
327
  "sizes": {
328
- "javascript": 396875,
328
+ "javascript": 396861,
329
329
  "consume-shared": 210
330
330
  },
331
331
  "names": [],
@@ -339,7 +339,7 @@
339
339
  "auxiliaryFiles": [
340
340
  "985.js.map"
341
341
  ],
342
- "hash": "c7e0be54649ffd5e",
342
+ "hash": "987f1ac5215ba53a",
343
343
  "childrenByOrder": {}
344
344
  },
345
345
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"backendDependencies":{"fhir2":"^1.2.0","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}}],"version":"1.2.2-pre.264"}
1
+ {"backendDependencies":{"fhir2":"^1.2.0","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}}],"version":"1.2.2-pre.267"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-dispensing-app",
3
- "version": "1.2.2-pre.264",
3
+ "version": "1.2.2-pre.267",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Medication dispensing application",
6
6
  "browser": "dist/openmrs-esm-dispensing-app.js",
@@ -8,22 +8,15 @@ import { useConfig } from "@openmrs/esm-framework";
8
8
  import { PharmacyConfig } from "../config-schema";
9
9
  import { SimpleLocation } from "../types";
10
10
 
11
- enum TabTypes {
12
- STARRED,
13
- SYSTEM,
14
- USER,
15
- ALL,
16
- }
17
-
18
11
  const PrescriptionTabLists: React.FC = () => {
19
12
  const { t } = useTranslation();
20
13
  const config = useConfig() as PharmacyConfig;
21
14
  const { filterLocations, isLoading: isFilterLocationsLoading } =
22
15
  useLocationForFiltering(config);
23
- const [selectedTab, setSelectedTab] = useState(TabTypes.STARRED);
24
16
  const [searchTermUserInput, setSearchTermUserInput] = useState(""); // we have a separate "searchTermUserInput" and "searchTerm" in order to debounce
25
17
  const [searchTerm, setSearchTerm] = useState("");
26
18
  const [location, setLocation] = useState("");
19
+ const [selectedTab, setSelectedTab] = useState(0);
27
20
 
28
21
  const tabs = [
29
22
  {
@@ -47,14 +40,19 @@ const PrescriptionTabLists: React.FC = () => {
47
40
  return () => clearTimeout(debounceFn);
48
41
  }, [searchTermUserInput]);
49
42
 
43
+ // we use this to only render the tab panel that is currently selected, see O3-2777
44
+ const handleTabChange = (event) => {
45
+ setSelectedTab(event.selectedIndex);
46
+ };
47
+
50
48
  return (
51
49
  <main className={`omrs-main-content ${styles.prescriptionListContainer}`}>
52
50
  <section className={styles.prescriptionTabsContainer}>
53
51
  <Tabs
54
52
  className={styles.prescriptionTabs}
53
+ onChange={handleTabChange}
55
54
  type="container"
56
55
  tabContentClassName={styles.hiddenTabsContent}
57
- onSelectionChange={setSelectedTab}
58
56
  >
59
57
  <TabList
60
58
  aria-label={t("tabList", "Tab List")}
@@ -118,12 +116,14 @@ const PrescriptionTabLists: React.FC = () => {
118
116
  </div>
119
117
  <TabPanels>
120
118
  {tabs.map((tab, index) => {
121
- return (
119
+ return index === selectedTab ? (
122
120
  <PrescriptionTabPanel
123
121
  location={location}
124
122
  searchTerm={searchTerm}
125
123
  status={tab.status}
126
124
  />
125
+ ) : (
126
+ <></>
127
127
  );
128
128
  })}
129
129
  </TabPanels>
File without changes