@awell-health/ui-library 0.1.52 → 0.1.53

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/dist/index.js CHANGED
@@ -37693,6 +37693,17 @@ Check the top-level render call using <` + t + ">.");
37693
37693
  }
37694
37694
  return [];
37695
37695
  };
37696
+ var getDirtyFieldValues = function (formMethods) {
37697
+ var dirtyFields = formMethods.formState.dirtyFields,getValues = formMethods.getValues;
37698
+ var allValues = getValues();
37699
+ var dirtyValues = Object.keys(dirtyFields).reduce(function (acc, key) {
37700
+ if (dirtyFields[key]) {
37701
+ acc[key] = allValues[key];
37702
+ }
37703
+ return acc;
37704
+ }, {});
37705
+ return dirtyValues;
37706
+ };
37696
37707
 
37697
37708
  var useTraditionalForm = function (_a) {
37698
37709
  var questions = _a.questions,evaluateDisplayConditions = _a.evaluateDisplayConditions,onSubmit = _a.onSubmit,errorLabels = _a.errorLabels,storedAnswers = _a.storedAnswers,_b = _a.autosaveAnswers,autosaveAnswers = _b === void 0 ? true : _b,onAnswersChange = _a.onAnswersChange;
@@ -37716,7 +37727,7 @@ Check the top-level render call using <` + t + ">.");
37716
37727
  return __generator(this, function (_a) {
37717
37728
  switch (_a.label) {
37718
37729
  case 0:
37719
- formValuesInput = convertToAwellInput(formMethods.getValues());
37730
+ formValuesInput = convertToAwellInput(getDirtyFieldValues(formMethods));
37720
37731
  return [4, evaluateDisplayConditions(formValuesInput)];
37721
37732
  case 1:
37722
37733
  evaluationResults = _a.sent();
@@ -37812,7 +37823,7 @@ Check the top-level render call using <` + t + ">.");
37812
37823
  switch (_a.label) {
37813
37824
  case 0:
37814
37825
  setIsEvaluatingQuestionVisibility(true);
37815
- formValuesInput = convertToAwellInput(formMethods.getValues());
37826
+ formValuesInput = convertToAwellInput(getDirtyFieldValues(formMethods));
37816
37827
  return [4, evaluateDisplayConditions(formValuesInput)];
37817
37828
  case 1:
37818
37829
  evaluationResults = _a.sent();
@@ -25,4 +25,5 @@ export declare const getErrorsForQuestion: (currentQuestion: QuestionWithVisibil
25
25
  isValid: boolean;
26
26
  errorType?: NumberValidationErrorType;
27
27
  }) => Array<FormError>;
28
+ export declare const getDirtyFieldValues: (formMethods: UseFormReturn) => Record<string, AnswerValue>;
28
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/ui-library",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "private": false,
5
5
  "description": "UI components to integrate with Awell Health",
6
6
  "repository": {
@@ -193,4 +193,4 @@
193
193
  ]
194
194
  },
195
195
  "homepage": "https://github.com/awell-health/ui-library#readme"
196
- }
196
+ }