@openmrs/esm-form-engine-lib 3.1.5-pre.1998 → 3.1.5-pre.2001
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
@@ -18,7 +18,7 @@ interface BehaviourProperty {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
/**
|
21
|
-
*
|
21
|
+
* Convenience function for loading form(s) associated to a given package or form version.
|
22
22
|
*
|
23
23
|
* @param packageName The package associated with the form
|
24
24
|
* @param formNamespace The form namespace
|
@@ -145,15 +145,16 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array<Be
|
|
145
145
|
behaviourOverrides,
|
146
146
|
);
|
147
147
|
}
|
148
|
-
// TODO: Apply parentOverrides to pages if applicable
|
149
148
|
const pageBehaviour = page.behaviours?.find((behaviour) => behaviour.intent === (intent?.intent || intent));
|
150
149
|
if (pageBehaviour) {
|
151
|
-
page.hide = pageBehaviour
|
152
|
-
page.readonly = pageBehaviour
|
150
|
+
page.hide = pageBehaviour.hide ?? page.hide;
|
151
|
+
page.readonly = pageBehaviour.readonly ?? page.readonly;
|
153
152
|
} else {
|
154
153
|
const fallBackBehaviour = page.behaviours?.find((behaviour) => behaviour.intent === '*');
|
155
|
-
|
156
|
-
|
154
|
+
if (fallBackBehaviour) {
|
155
|
+
page.hide = fallBackBehaviour.hide ?? page.hide;
|
156
|
+
page.readonly = fallBackBehaviour.readonly ?? page.readonly;
|
157
|
+
}
|
157
158
|
}
|
158
159
|
|
159
160
|
// filter page-level markdown behaviour
|
@@ -164,10 +165,9 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array<Be
|
|
164
165
|
page.sections = page.sections || [];
|
165
166
|
|
166
167
|
page.sections.forEach((section) => {
|
167
|
-
// TODO: Apply parentOverrides to sections if applicable
|
168
168
|
const secBehaviour = section.behaviours?.find((behaviour) => behaviour.intent === intent?.intent || intent);
|
169
169
|
if (secBehaviour) {
|
170
|
-
section.hide = secBehaviour
|
170
|
+
section.hide = secBehaviour.hide ?? section.hide;
|
171
171
|
} else {
|
172
172
|
const fallBackBehaviour = section.behaviours?.find((behaviour) => behaviour.intent === '*');
|
173
173
|
section.hide = fallBackBehaviour?.hide ?? section.hide;
|
@@ -213,7 +213,7 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array<Be
|
|
213
213
|
function updateQuestionRequiredBehaviour(question, intent: string) {
|
214
214
|
const requiredIntentBehaviour = question.behaviours?.find((behaviour) => behaviour.intent === intent);
|
215
215
|
|
216
|
-
const defaultIntentBehaviour = question.behaviours?.find((
|
216
|
+
const defaultIntentBehaviour = question.behaviours?.find((behaviour) => behaviour.intent === '*');
|
217
217
|
// If both required and default intents exist, combine them and update to question
|
218
218
|
if (requiredIntentBehaviour || defaultIntentBehaviour) {
|
219
219
|
// Remove the intent name props from each object
|