intelicoreact 1.4.94 → 1.4.96
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/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +6 -4
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +10 -6
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +5 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +1 -1
- package/package.json +1 -1
|
@@ -55,6 +55,7 @@ const accordionData = (accordionTitle, accordionListContent) => {
|
|
|
55
55
|
})));
|
|
56
56
|
};
|
|
57
57
|
const FileLoaderDescription = _ref => {
|
|
58
|
+
var _files$map;
|
|
58
59
|
let {
|
|
59
60
|
//? Для корректности работы стоит пробрасывать какой-то из id
|
|
60
61
|
id,
|
|
@@ -73,7 +74,7 @@ const FileLoaderDescription = _ref => {
|
|
|
73
74
|
...props
|
|
74
75
|
} = _ref;
|
|
75
76
|
const uniqueFileLoaderDescriptionId = "".concat(id || testId || fieldKey || "component-".concat(_utils.uuid === null || _utils.uuid === void 0 ? void 0 : (0, _utils.uuid)()));
|
|
76
|
-
const [fields, setFields] = (0, _react.useState)(files !== null &&
|
|
77
|
+
const [fields, setFields] = (0, _react.useState)((_files$map = files === null || files === void 0 ? void 0 : files.map(getStructure)) !== null && _files$map !== void 0 ? _files$map : [(0, _utils.clone)(uploadTriggerStucture)]);
|
|
77
78
|
const generateUniqueFileName = (files, name) => {
|
|
78
79
|
let fileName = name;
|
|
79
80
|
const [nameWithoutExtension, extension] = name.split(/(?=\.[^.]+$)/);
|
|
@@ -110,7 +111,7 @@ const FileLoaderDescription = _ref => {
|
|
|
110
111
|
...item,
|
|
111
112
|
error: ""
|
|
112
113
|
}));
|
|
113
|
-
const changedField = output.find(item => id
|
|
114
|
+
const changedField = output.find(item => id === item.id);
|
|
114
115
|
if (!file) {
|
|
115
116
|
//? Нет файла - значит это экшн удаления
|
|
116
117
|
handle.applyFields(output.filter(item => item.id !== (changedField === null || changedField === void 0 ? void 0 : changedField.id)));
|
|
@@ -159,10 +160,11 @@ const FileLoaderDescription = _ref => {
|
|
|
159
160
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
160
161
|
className: "".concat(RC, "__file-descr"),
|
|
161
162
|
title: filesDescription
|
|
162
|
-
}, filesDescription), fields.map(field => {
|
|
163
|
+
}, filesDescription), fields.map((field, i) => {
|
|
163
164
|
return /*#__PURE__*/_react.default.createElement(_FileLoaderLocal.default, {
|
|
164
165
|
className: "".concat(RC, "__list-item"),
|
|
165
|
-
key: field.id,
|
|
166
|
+
key: "".concat(field.id, "-").concat(i),
|
|
167
|
+
fieldId: field.id,
|
|
166
168
|
id: "loader-".concat(uniqueFileLoaderDescriptionId, "-field-").concat(field.id),
|
|
167
169
|
error: field.error,
|
|
168
170
|
outerError: field.outerError,
|
|
@@ -16,6 +16,7 @@ const FileLoaderLocal = _ref => {
|
|
|
16
16
|
let {
|
|
17
17
|
groupId,
|
|
18
18
|
id,
|
|
19
|
+
fieldId,
|
|
19
20
|
fieldKey,
|
|
20
21
|
label,
|
|
21
22
|
error,
|
|
@@ -55,7 +56,7 @@ const FileLoaderLocal = _ref => {
|
|
|
55
56
|
var _name$match, _name$split, _e$target, _e$target2;
|
|
56
57
|
const name = getFileName(e.target.value);
|
|
57
58
|
const valueExtension = name === null || name === void 0 || (_name$match = name.match(/[^\.]+$/)) === null || _name$match === void 0 ? void 0 : _name$match[0];
|
|
58
|
-
const fileName = (_name$split = name.split(
|
|
59
|
+
const fileName = (_name$split = name.split(".")) === null || _name$split === void 0 ? void 0 : _name$split[0];
|
|
59
60
|
const latinRegex = /^[A-Za-z\u00C0-\u00FF0-9!@#\$%\^\&*\)\(+=._-\s]+$/;
|
|
60
61
|
const file = (_e$target = e.target) === null || _e$target === void 0 || (_e$target = _e$target.files) === null || _e$target === void 0 ? void 0 : _e$target[0];
|
|
61
62
|
if (isFileSizeOutOfLimit((_e$target2 = e.target) === null || _e$target2 === void 0 || (_e$target2 = _e$target2.files) === null || _e$target2 === void 0 ? void 0 : _e$target2[0])) {
|
|
@@ -104,9 +105,10 @@ const FileLoaderLocal = _ref => {
|
|
|
104
105
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
105
106
|
"data-testid": "input--file-loader-local--key-".concat(testId),
|
|
106
107
|
className: (0, _classnames.default)("file-loader-local", className, {
|
|
107
|
-
[
|
|
108
|
+
["file-loader-local_outer-error"]: Boolean(outerError)
|
|
108
109
|
})
|
|
109
|
-
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
110
|
+
}, (fieldId === "uploadTrigger" || !value) && /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
111
|
+
key: id,
|
|
110
112
|
onChange: handle.change,
|
|
111
113
|
className: "file-loader-local__file-input",
|
|
112
114
|
id: fieldKey || "file-input-".concat(id).concat(groupId ? "-".concat(groupId) : ""),
|
|
@@ -115,7 +117,9 @@ const FileLoaderLocal = _ref => {
|
|
|
115
117
|
required: isRequired,
|
|
116
118
|
accept: accept
|
|
117
119
|
}, attributesOfNativeInput)), /*#__PURE__*/_react.default.createElement("label", {
|
|
118
|
-
className: "file-loader-local__label-box",
|
|
120
|
+
className: (0, _classnames.default)("file-loader-local__label-box", {
|
|
121
|
+
"file-loader-local__label-box--upload-trigger": fieldId === "uploadTrigger" || !value
|
|
122
|
+
}),
|
|
119
123
|
htmlFor: fieldKey || "file-input-".concat(id).concat(groupId ? "-".concat(groupId) : "")
|
|
120
124
|
}, !value && /*#__PURE__*/_react.default.createElement(_reactFeather.Download, {
|
|
121
125
|
className: "file-loader-local__upload-icon"
|
|
@@ -132,12 +136,12 @@ const FileLoaderLocal = _ref => {
|
|
|
132
136
|
className: "file-loader-local__label-text"
|
|
133
137
|
}, value || label), error && /*#__PURE__*/_react.default.createElement("span", {
|
|
134
138
|
className: "file-loader-local__error"
|
|
135
|
-
}, error), typeof outerError ===
|
|
139
|
+
}, error), typeof outerError === "string" && /*#__PURE__*/_react.default.createElement("span", {
|
|
136
140
|
className: "file-loader-local__error"
|
|
137
141
|
}, outerError))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
|
|
138
142
|
className: "file-loader-local__trash-icon",
|
|
139
143
|
onClick: () => onChange({
|
|
140
|
-
id,
|
|
144
|
+
id: fieldId,
|
|
141
145
|
groupId
|
|
142
146
|
})
|
|
143
147
|
}), renderRequiredLabel()));
|
|
@@ -52,9 +52,12 @@
|
|
|
52
52
|
font-size: 14px;
|
|
53
53
|
font-weight: 400;
|
|
54
54
|
line-height: 20px;
|
|
55
|
-
cursor: pointer;
|
|
56
55
|
|
|
57
56
|
color: #1f7499;
|
|
57
|
+
|
|
58
|
+
&--upload-trigger {
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
&__upload-icon {
|
|
@@ -77,6 +80,7 @@
|
|
|
77
80
|
max-height: 16px;
|
|
78
81
|
|
|
79
82
|
color: #f06d8d;
|
|
83
|
+
cursor: pointer;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
&__label-wrapper {
|
|
@@ -172,7 +172,7 @@ const NumericInput = _ref => {
|
|
|
172
172
|
if (inputValue !== value) setIsFocused(true);
|
|
173
173
|
setInputValueFormated(isPriceInput && (inputValue === null || inputValue === void 0 ? void 0 : inputValue.length) > 0 ? isFocused ? (0, _fieldValueFormatters.formatToRemoveComa)(inputValue) : (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue) : inputValue);
|
|
174
174
|
setIntMemoVal((0, _fieldValueFormatters.formatToRemoveComa)(inputValue));
|
|
175
|
-
if (typeof onChange === "function") onChange(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toString());
|
|
175
|
+
if (typeof onChange === "function" && value !== undefined && +inputValue !== +value) onChange(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toString());
|
|
176
176
|
}, [inputValue]);
|
|
177
177
|
|
|
178
178
|
//On Integer Value Change
|