@awell-health/ui-library 0.1.122 → 0.1.125
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 +17 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48256,6 +48256,9 @@ var Kr=[{
|
|
|
48256
48256
|
if (lodash.exports.isNil(attachment) || lodash.exports.isNil(attachment.contentType)) {
|
|
48257
48257
|
return !required;
|
|
48258
48258
|
}
|
|
48259
|
+
if (acceptedFileTypes.includes('*') || acceptedFileTypes.includes('*/*')) {
|
|
48260
|
+
return true;
|
|
48261
|
+
}
|
|
48259
48262
|
return acceptedFileTypes.includes(attachment.contentType);
|
|
48260
48263
|
};
|
|
48261
48264
|
|
|
@@ -48265,6 +48268,13 @@ var Kr=[{
|
|
|
48265
48268
|
var question = _a.question,control = _a.control,getValues = _a.getValues,labels = _a.labels,_m = _a.inputAutoFocus,inputAutoFocus = _m === void 0 ? false : _m,_o = _a.submitAndMoveToNextQuestion,submitAndMoveToNextQuestion = _o === void 0 ? lodash.exports.noop : _o,_p = _a.onAnswerChange,onAnswerChange = _p === void 0 ? lodash.exports.noop : _p,_q = _a.shouldAutoProgress,shouldAutoProgress = _q === void 0 ? function () {return false;} : _q,onFileUpload = _a.onFileUpload;
|
|
48266
48269
|
var config = question === null || question === void 0 ? void 0 : question.questionConfig;
|
|
48267
48270
|
var _r = useICDClassificationList(question.id),icdClassificationOptions = _r.options,optionsLoading = _r.loading,onIcdClassificationSearchChange = _r.onIcdClassificationSearchChange;
|
|
48271
|
+
var getAcceptedFileTypes = function () {
|
|
48272
|
+
var _a, _b, _c, _d;
|
|
48273
|
+
if ((_b = (_a = config === null || config === void 0 ? void 0 : config.file_storage) === null || _a === void 0 ? void 0 : _a.accepted_file_types) === null || _b === void 0 ? void 0 : _b.includes('document/*')) {
|
|
48274
|
+
return ['*/*'];
|
|
48275
|
+
}
|
|
48276
|
+
return (_d = (_c = config === null || config === void 0 ? void 0 : config.file_storage) === null || _c === void 0 ? void 0 : _c.accepted_file_types) !== null && _d !== void 0 ? _d : ['*/*'];
|
|
48277
|
+
};
|
|
48268
48278
|
switch (question.userQuestionType) {
|
|
48269
48279
|
case exports.UserQuestionType.YesNo:
|
|
48270
48280
|
return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: "", rules: { required: config === null || config === void 0 ? void 0 : config.mandatory }, render: function (_a) {
|
|
@@ -48449,22 +48459,21 @@ var Kr=[{
|
|
|
48449
48459
|
return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
|
|
48450
48460
|
required: config === null || config === void 0 ? void 0 : config.mandatory,
|
|
48451
48461
|
validate: function (value) {
|
|
48452
|
-
var _a
|
|
48462
|
+
var _a;
|
|
48453
48463
|
return isAttachmentValid({
|
|
48454
48464
|
attachmentsValue: value,
|
|
48455
|
-
acceptedFileTypes: (
|
|
48456
|
-
required: (
|
|
48465
|
+
acceptedFileTypes: getAcceptedFileTypes(),
|
|
48466
|
+
required: (_a = config === null || config === void 0 ? void 0 : config.mandatory) !== null && _a !== void 0 ? _a : false });
|
|
48457
48467
|
|
|
48458
48468
|
} },
|
|
48459
48469
|
render: function (_a) {
|
|
48460
|
-
var _b
|
|
48461
|
-
var
|
|
48470
|
+
var _b;
|
|
48471
|
+
var _c = _a.field,onControllerChange = _c.onChange,onBlur = _c.onBlur,value = _c.value;
|
|
48462
48472
|
return jsxRuntime.exports.jsx(SingleFileInputField, { id: question.id, value: custom_json_parser(value, ''), onChange: function (attachment) {
|
|
48473
|
+
console.log('attachment', attachment === null || attachment === void 0 ? void 0 : attachment.contentType);
|
|
48463
48474
|
onControllerChange(JSON.stringify(attachment));
|
|
48464
48475
|
onAnswerChange();
|
|
48465
|
-
}, onBlur: onBlur, accept: (
|
|
48466
|
-
'application/pdf'],
|
|
48467
|
-
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 });
|
|
48476
|
+
}, onBlur: onBlur, accept: getAcceptedFileTypes(), configSlug: (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory });
|
|
48468
48477
|
} });
|
|
48469
48478
|
case exports.UserQuestionType.Image:
|
|
48470
48479
|
return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
|