@awell-health/ui-library 0.1.131 → 0.1.134
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 +35 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48142,6 +48142,20 @@ var Kr=[{
|
|
|
48142
48142
|
error: undefined } :
|
|
48143
48143
|
|
|
48144
48144
|
undefined),selectedFile = _h[0],setSelectedFile = _h[1];
|
|
48145
|
+
React.useEffect(function () {
|
|
48146
|
+
var _a, _b, _c, _d, _e;
|
|
48147
|
+
if (!lodash.exports.isNil(value) && !lodash.exports.isEmpty(value) && !selectedFile) {
|
|
48148
|
+
setSelectedFile({
|
|
48149
|
+
id: (_a = value.filename) !== null && _a !== void 0 ? _a : 'untitled',
|
|
48150
|
+
name: (_b = value.filename) !== null && _b !== void 0 ? _b : 'untitled',
|
|
48151
|
+
size: (_c = value.size) !== null && _c !== void 0 ? _c : 0,
|
|
48152
|
+
type: (_d = value.contentType) !== null && _d !== void 0 ? _d : '',
|
|
48153
|
+
url: (_e = value.url) !== null && _e !== void 0 ? _e : '',
|
|
48154
|
+
progress: 100,
|
|
48155
|
+
error: undefined });
|
|
48156
|
+
|
|
48157
|
+
}
|
|
48158
|
+
}, [value]);
|
|
48145
48159
|
var convertErrorMessage = function (error) {
|
|
48146
48160
|
if (error === 'Failed to fetch') {
|
|
48147
48161
|
return 'File upload failed. Please remove this file and try again.';
|
|
@@ -48473,6 +48487,7 @@ var Kr=[{
|
|
|
48473
48487
|
var _b, _c, _d;
|
|
48474
48488
|
var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value,fieldError = _a.fieldState.error;
|
|
48475
48489
|
return jsxRuntime.exports.jsx(SingleFileInputField, { id: question.id, value: custom_json_parser(value, ''), onChange: function (attachment) {
|
|
48490
|
+
console.log('attachment', attachment === null || attachment === void 0 ? void 0 : attachment.contentType);
|
|
48476
48491
|
onControllerChange(attachment ? JSON.stringify(attachment) : '');
|
|
48477
48492
|
onAnswerChange();
|
|
48478
48493
|
}, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : undefined, configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory, error: fieldError === null || fieldError === void 0 ? void 0 : fieldError.message });
|
|
@@ -48947,9 +48962,15 @@ var Kr=[{
|
|
|
48947
48962
|
}
|
|
48948
48963
|
};
|
|
48949
48964
|
var isEmpty = function (value) {
|
|
48950
|
-
|
|
48951
|
-
|
|
48952
|
-
|
|
48965
|
+
if (lodash.exports.isNil(value))
|
|
48966
|
+
return true;
|
|
48967
|
+
if (Array.isArray(value))
|
|
48968
|
+
return value.length === 0;
|
|
48969
|
+
if (typeof value === 'string')
|
|
48970
|
+
return value.length === 0;
|
|
48971
|
+
if (typeof value === 'object')
|
|
48972
|
+
return Object.keys(value).length === 0;
|
|
48973
|
+
return false;
|
|
48953
48974
|
};
|
|
48954
48975
|
var calculatePercentageCompleted = function (_a) {
|
|
48955
48976
|
var currentQuestionId = _a.currentQuestionId,allQuestions = _a.allQuestions;
|
|
@@ -49190,22 +49211,25 @@ var Kr=[{
|
|
|
49190
49211
|
});
|
|
49191
49212
|
});};
|
|
49192
49213
|
var submitForm = function () {return __awaiter(void 0, void 0, void 0, function () {
|
|
49193
|
-
var error_2, formErrors;
|
|
49214
|
+
var currentVisibleQuestions, error_2, formErrors;
|
|
49194
49215
|
return __generator(this, function (_a) {
|
|
49195
49216
|
switch (_a.label) {
|
|
49196
49217
|
case 0:
|
|
49197
|
-
|
|
49198
|
-
|
|
49218
|
+
currentVisibleQuestions = visibleQuestions;
|
|
49219
|
+
_a.label = 1;
|
|
49199
49220
|
case 1:
|
|
49200
|
-
_a.
|
|
49201
|
-
return [
|
|
49221
|
+
_a.trys.push([1, 3,, 4]);
|
|
49222
|
+
return [4, updateQuestionVisibility()];
|
|
49202
49223
|
case 2:
|
|
49224
|
+
currentVisibleQuestions = _a.sent();
|
|
49225
|
+
return [3, 4];
|
|
49226
|
+
case 3:
|
|
49203
49227
|
error_2 = _a.sent();
|
|
49204
49228
|
console.error('Failed to evaluate display conditions:', error_2);
|
|
49205
49229
|
setFormHasErrors(true);
|
|
49206
49230
|
return [2];
|
|
49207
|
-
case
|
|
49208
|
-
formErrors =
|
|
49231
|
+
case 4:
|
|
49232
|
+
formErrors = currentVisibleQuestions.flatMap(function (vq) {
|
|
49209
49233
|
return getErrorsForQuestion(vq, formMethods, errorLabels, isValidE164Number, validateDateResponse, validateNumberResponse, validateEmailResponse, validateAttachmentsResponse, validateInputValidationResponse);
|
|
49210
49234
|
});
|
|
49211
49235
|
setErrors(formErrors);
|
|
@@ -49407,7 +49431,7 @@ var Kr=[{
|
|
|
49407
49431
|
if (doNextQuestionExist) {
|
|
49408
49432
|
return [2, handleGoToNextQuestion()];
|
|
49409
49433
|
}
|
|
49410
|
-
hasErrors = handleCheckForErrors(
|
|
49434
|
+
hasErrors = handleCheckForErrors(updatedQuestions === null || updatedQuestions === void 0 ? void 0 : updatedQuestions[current]);
|
|
49411
49435
|
if (!hasErrors) {
|
|
49412
49436
|
formMethods.handleSubmit(handleConvertAndSubmitForm, function (rhfErrors) {
|
|
49413
49437
|
console.error('Form validation errors:', rhfErrors);
|