@openmrs/esm-form-engine-lib 3.1.3-pre.1735 → 3.1.3-pre.1738
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,15 +1,25 @@
|
|
1
|
-
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
1
|
+
import { openmrsFetch, OpenmrsResource, restBaseUrl } from '@openmrs/esm-framework';
|
2
2
|
import { BaseOpenMRSDataSource } from './data-source';
|
3
3
|
|
4
4
|
export class SelectConceptAnswersDatasource extends BaseOpenMRSDataSource {
|
5
5
|
constructor() {
|
6
|
-
super(
|
6
|
+
super(
|
7
|
+
`${restBaseUrl}/concept/:conceptUuid?v=custom:(uuid,display,setMembers:(uuid,display),answers:(uuid,display))`,
|
8
|
+
);
|
9
|
+
}
|
10
|
+
|
11
|
+
fetchSingleItem(uuid: string): Promise<OpenmrsResource | null> {
|
12
|
+
return openmrsFetch(this.buildUrl(uuid)).then(({ data }) => data);
|
7
13
|
}
|
8
14
|
|
9
15
|
fetchData(searchTerm: string, config?: Record<string, any>): Promise<any[]> {
|
10
|
-
const apiUrl = this.
|
16
|
+
const apiUrl = this.buildUrl(config.referencedValue || config.concept);
|
11
17
|
return openmrsFetch(apiUrl).then(({ data }) => {
|
12
18
|
return data['setMembers'].length ? data['setMembers'] : data['answers'];
|
13
19
|
});
|
14
20
|
}
|
21
|
+
|
22
|
+
private buildUrl(conceptUuid: string): string {
|
23
|
+
return this.url.replace(':conceptUuid', conceptUuid);
|
24
|
+
}
|
15
25
|
}
|