intelicoreact 1.0.30 → 1.0.32
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/Dropdown/Dropdown.js +4 -3
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +98 -0
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +155 -0
- package/dist/Atomic/FormElements/FileLoader/partial/AnyOuterClass.scss +9 -0
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +175 -0
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +100 -0
- package/dist/Atomic/FormElements/Input/Input.js +0 -2
- package/dist/Atomic/FormElements/InputColor/InputColor.js +36 -13
- package/dist/Atomic/FormElements/InputColor/InputColor.scss +7 -4
- package/dist/Atomic/FormElements/InputLink/InputLink.js +117 -0
- package/dist/Atomic/FormElements/InputLink/InputLink.scss +58 -0
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +2 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +14 -11
- package/dist/Atomic/Layout/Spinner/Spinner.scss +6 -3
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +4 -0
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +3 -2
- package/dist/Functions/fieldValueFormatters.js +40 -12
- package/dist/Functions/operations.js +2 -1
- package/dist/Functions/useInputHighlightError.js +84 -0
- package/dist/Functions/usePasswordChecker.js +1 -1
- package/dist/Functions/utils.js +86 -2
- package/package.json +1 -1
|
@@ -275,7 +275,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
var setListContainerStyles = function setListContainerStyles() {
|
|
278
|
-
var _dropdownRef$current$, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma;
|
|
278
|
+
var _dropdownRef$current$, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _sw$getBoundingClient;
|
|
279
279
|
|
|
280
280
|
var lc = getListContainer();
|
|
281
281
|
if (!lc || !isOpen) return false;
|
|
@@ -293,12 +293,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
293
293
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
294
294
|
var toTop = top - margin;
|
|
295
295
|
var toBottom = windowHeight - top - height - margin * 2;
|
|
296
|
-
var swHeight =
|
|
296
|
+
var swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
297
|
+
var maxSwHeight = toTop >= maxHeight || toBottom >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
297
298
|
var listPos = toTop < toBottom || toBottom >= swHeight ? 'bottom' : 'top';
|
|
298
299
|
lc.style.minWidth = "".concat(width, "px");
|
|
299
300
|
lc.style.left = "".concat(left, "px");
|
|
300
301
|
lc.style.top = "".concat(listPos === 'bottom' ? top + height : top - swHeight - 3 * margin, "px");
|
|
301
|
-
sw.style.maxHeight = "".concat(
|
|
302
|
+
sw.style.maxHeight = "".concat(maxSwHeight, "px");
|
|
302
303
|
};
|
|
303
304
|
|
|
304
305
|
var renderListContainer = function renderListContainer() {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
var _LoadZone = _interopRequireDefault(require("./partial/LoadZone"));
|
|
21
|
+
|
|
22
|
+
var _LoadedContent = _interopRequireDefault(require("./partial/LoadedContent"));
|
|
23
|
+
|
|
24
|
+
require("./FileLoader.scss");
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
var RC = 'file-loader';
|
|
31
|
+
|
|
32
|
+
var FileLoader = function FileLoader(props) {
|
|
33
|
+
var _cn;
|
|
34
|
+
|
|
35
|
+
var fieldKey = props.fieldKey,
|
|
36
|
+
value = props.value,
|
|
37
|
+
disabled = props.disabled,
|
|
38
|
+
error = props.error,
|
|
39
|
+
className = props.className,
|
|
40
|
+
placeholder = props.placeholder,
|
|
41
|
+
onChange = props.onChange,
|
|
42
|
+
doLoad = props.doLoad,
|
|
43
|
+
filterFiles = props.filterFiles,
|
|
44
|
+
processErrors = props.processErrors,
|
|
45
|
+
isBlockNullValues = props.isBlockNullValues,
|
|
46
|
+
_props$isDisableError = props.isDisableErrorsClass,
|
|
47
|
+
isDisableErrorsClass = _props$isDisableError === void 0 ? true : _props$isDisableError,
|
|
48
|
+
uploadIcon = props.uploadIcon,
|
|
49
|
+
downloadIcon = props.downloadIcon,
|
|
50
|
+
deleteIcon = props.deleteIcon,
|
|
51
|
+
spiner = props.spiner,
|
|
52
|
+
isIconAfter = props.isIconAfter,
|
|
53
|
+
_props$isLinkTypeDown = props.isLinkTypeDownload,
|
|
54
|
+
isLinkTypeDownload = _props$isLinkTypeDown === void 0 ? false : _props$isLinkTypeDown,
|
|
55
|
+
_props$isUseLinkTitle = props.isUseLinkTitle,
|
|
56
|
+
isUseLinkTitle = _props$isUseLinkTitle === void 0 ? false : _props$isUseLinkTitle;
|
|
57
|
+
|
|
58
|
+
var _useState = (0, _react.useState)(false),
|
|
59
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
60
|
+
isLoadContent = _useState2[0],
|
|
61
|
+
setIsLoadContent = _useState2[1];
|
|
62
|
+
|
|
63
|
+
var _useState3 = (0, _react.useState)(false),
|
|
64
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
65
|
+
dragenter = _useState4[0],
|
|
66
|
+
setDragenter = _useState4[1];
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: (0, _classnames.default)(RC, className, (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "_load-content"), isLoadContent), (0, _defineProperty2.default)(_cn, "".concat(RC, "_load-zone"), !value), (0, _defineProperty2.default)(_cn, "".concat(RC, "_hover"), dragenter), (0, _defineProperty2.default)(_cn, "".concat(RC, "_disabled"), disabled), (0, _defineProperty2.default)(_cn, "".concat(RC, "_error"), !isDisableErrorsClass && !!error), _cn))
|
|
70
|
+
}, isLoadContent && spiner, value ? /*#__PURE__*/_react.default.createElement(_LoadedContent.default, {
|
|
71
|
+
RC: RC,
|
|
72
|
+
value: value,
|
|
73
|
+
onDelete: function onDelete() {
|
|
74
|
+
return onChange(null);
|
|
75
|
+
},
|
|
76
|
+
icon: downloadIcon,
|
|
77
|
+
isIconAfter: isIconAfter,
|
|
78
|
+
deleteIcon: deleteIcon,
|
|
79
|
+
isUseLinkTitle: isUseLinkTitle,
|
|
80
|
+
isLinkTypeDownload: isLinkTypeDownload
|
|
81
|
+
}) : /*#__PURE__*/_react.default.createElement(_LoadZone.default, {
|
|
82
|
+
RC: RC,
|
|
83
|
+
fieldKey: fieldKey,
|
|
84
|
+
onChange: onChange,
|
|
85
|
+
icon: uploadIcon,
|
|
86
|
+
doLoad: doLoad,
|
|
87
|
+
dragenter: dragenter,
|
|
88
|
+
setDragenter: setDragenter,
|
|
89
|
+
setIsLoadContent: setIsLoadContent,
|
|
90
|
+
placeholder: placeholder,
|
|
91
|
+
filterFiles: filterFiles,
|
|
92
|
+
processErrors: processErrors,
|
|
93
|
+
isBlockNullValues: isBlockNullValues
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var _default = FileLoader;
|
|
98
|
+
exports.default = _default;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// @import '../../scss/main.scss';
|
|
2
|
+
|
|
3
|
+
.file-loader {
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
flex-flow: row nowrap;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 28px;
|
|
14
|
+
padding: 4px 6px 4px 5px;
|
|
15
|
+
|
|
16
|
+
border: 1px solid #E2E5EC;
|
|
17
|
+
border-radius: 3px;
|
|
18
|
+
background-color: #FFF;
|
|
19
|
+
|
|
20
|
+
&_hover {
|
|
21
|
+
border-color: #6B81DD;
|
|
22
|
+
filter: drop-shadow(0 0 4px rgb(93 120 255 / 50%));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&_load-zone {
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&_load-content {
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__value-link {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
flex-flow: row nowrap;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
width: fit-content;
|
|
41
|
+
height: 100%;
|
|
42
|
+
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
|
|
45
|
+
color: #166EAD;
|
|
46
|
+
outline: none;
|
|
47
|
+
|
|
48
|
+
font-size: 13px;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
font-style: normal;
|
|
51
|
+
line-height: 20px;
|
|
52
|
+
|
|
53
|
+
svg {
|
|
54
|
+
width: 16px;
|
|
55
|
+
height: 16px;
|
|
56
|
+
|
|
57
|
+
color: #9AA0B9;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__value-name {
|
|
62
|
+
margin-left: 4px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__value-link_icon-after {
|
|
66
|
+
.file-loader__value-name {
|
|
67
|
+
margin-right: 4px;
|
|
68
|
+
margin-left: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__delete-value-button {
|
|
73
|
+
width: 16px;
|
|
74
|
+
height: 16px;
|
|
75
|
+
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
|
|
78
|
+
svg {
|
|
79
|
+
width: auto;
|
|
80
|
+
height: 100%;
|
|
81
|
+
|
|
82
|
+
color: #F06D8D;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__icon-block {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: calc(50% - 8px);
|
|
89
|
+
left: 5px;
|
|
90
|
+
|
|
91
|
+
width: 16px;
|
|
92
|
+
height: 16px;
|
|
93
|
+
|
|
94
|
+
pointer-events: none;
|
|
95
|
+
|
|
96
|
+
color: #9AA0B9;
|
|
97
|
+
|
|
98
|
+
svg {
|
|
99
|
+
width: auto;
|
|
100
|
+
height: 100%;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&__input-label {
|
|
105
|
+
box-sizing: border-box;
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 100%;
|
|
108
|
+
padding: 4px 6px 4px 25px;
|
|
109
|
+
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
|
|
112
|
+
color: #1E1E2D;
|
|
113
|
+
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
font-weight: 300;
|
|
116
|
+
|
|
117
|
+
font-style: normal;
|
|
118
|
+
line-height: 20px;
|
|
119
|
+
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
text-overflow: ellipsis;
|
|
123
|
+
|
|
124
|
+
&_no-icon {
|
|
125
|
+
padding-left: 5px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__input {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.loader-box {
|
|
134
|
+
opacity: 0.2;
|
|
135
|
+
|
|
136
|
+
.lds-ring.lds-ring_little {
|
|
137
|
+
width: 20px;
|
|
138
|
+
height: 20px;
|
|
139
|
+
|
|
140
|
+
div {
|
|
141
|
+
border-width: 2px !important;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&_error {
|
|
147
|
+
border-color: #F06D8D;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&_disabled {
|
|
151
|
+
pointer-events: none;
|
|
152
|
+
|
|
153
|
+
opacity: 0.5;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
22
|
+
require("../FileLoader.scss");
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
var DEFAULT_MAX_FILE_SIZE = 1024 * 1024 * 5; //5Мб
|
|
29
|
+
|
|
30
|
+
var FILTER_FILES_DEFAULT = function FILTER_FILES_DEFAULT(file) {
|
|
31
|
+
return file.size <= DEFAULT_MAX_FILE_SIZE ? file : null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var LoadZone = function LoadZone(_ref) {
|
|
35
|
+
var RC = _ref.RC,
|
|
36
|
+
fieldKey = _ref.fieldKey,
|
|
37
|
+
onChange = _ref.onChange,
|
|
38
|
+
doLoad = _ref.doLoad,
|
|
39
|
+
setDragenter = _ref.setDragenter,
|
|
40
|
+
setIsLoadContent = _ref.setIsLoadContent,
|
|
41
|
+
icon = _ref.icon,
|
|
42
|
+
_ref$placeholder = _ref.placeholder,
|
|
43
|
+
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
44
|
+
_ref$filterFiles = _ref.filterFiles,
|
|
45
|
+
filterFiles = _ref$filterFiles === void 0 ? FILTER_FILES_DEFAULT : _ref$filterFiles,
|
|
46
|
+
processErrors = _ref.processErrors,
|
|
47
|
+
isBlockNullValues = _ref.isBlockNullValues;
|
|
48
|
+
var dropZoneId = "dropZone-".concat(fieldKey);
|
|
49
|
+
var handle = {
|
|
50
|
+
change: function () {
|
|
51
|
+
var _change = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
52
|
+
var file, validatedFile;
|
|
53
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
54
|
+
while (1) {
|
|
55
|
+
switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(true);
|
|
58
|
+
file = e.type === 'change' ? e.target.files[0] : e.dataTransfer.files[0];
|
|
59
|
+
|
|
60
|
+
if (!filterFiles) {
|
|
61
|
+
_context.next = 8;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_context.next = 5;
|
|
66
|
+
return filterFiles(file);
|
|
67
|
+
|
|
68
|
+
case 5:
|
|
69
|
+
_context.t0 = _context.sent;
|
|
70
|
+
_context.next = 9;
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
case 8:
|
|
74
|
+
_context.t0 = file;
|
|
75
|
+
|
|
76
|
+
case 9:
|
|
77
|
+
validatedFile = _context.t0;
|
|
78
|
+
|
|
79
|
+
if (!(processErrors && !validatedFile)) {
|
|
80
|
+
_context.next = 13;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_context.next = 13;
|
|
85
|
+
return processErrors(file);
|
|
86
|
+
|
|
87
|
+
case 13:
|
|
88
|
+
if (!(!isBlockNullValues || validatedFile)) {
|
|
89
|
+
_context.next = 19;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_context.t1 = onChange;
|
|
94
|
+
_context.next = 17;
|
|
95
|
+
return doLoad(validatedFile).catch(function () {
|
|
96
|
+
return null;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
case 17:
|
|
100
|
+
_context.t2 = _context.sent;
|
|
101
|
+
(0, _context.t1)(_context.t2);
|
|
102
|
+
|
|
103
|
+
case 19:
|
|
104
|
+
setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(false);
|
|
105
|
+
|
|
106
|
+
case 20:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context.stop();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
}));
|
|
113
|
+
|
|
114
|
+
function change(_x) {
|
|
115
|
+
return _change.apply(this, arguments);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return change;
|
|
119
|
+
}(),
|
|
120
|
+
dragover: function dragover(e) {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
return false;
|
|
124
|
+
},
|
|
125
|
+
dragenter: function dragenter(e) {
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
setDragenter(true);
|
|
129
|
+
return false;
|
|
130
|
+
},
|
|
131
|
+
dragleave: function dragleave(e) {
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
setDragenter(false);
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
drop: function drop(e) {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
setDragenter(false);
|
|
141
|
+
handle.change(e);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
(0, _react.useEffect)(function () {
|
|
146
|
+
var dropbox = document.getElementById(dropZoneId);
|
|
147
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragenter', handle.dragenter, false);
|
|
148
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragover', handle.dragover, false);
|
|
149
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragleave', handle.dragleave, false);
|
|
150
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('drop', handle.drop, false);
|
|
151
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragend', handle.dragleave, false);
|
|
152
|
+
return function () {
|
|
153
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragenter', handle.dragenter, false);
|
|
154
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragover', handle.dragover, false);
|
|
155
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragleave', handle.dragleave, false);
|
|
156
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('drop', handle.drop, false);
|
|
157
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragend', handle.dragleave, false);
|
|
158
|
+
};
|
|
159
|
+
}, [fieldKey, doLoad]);
|
|
160
|
+
return doLoad && typeof doLoad === 'function' ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
161
|
+
className: (0, _classnames.default)("".concat(RC, "__icon-block"))
|
|
162
|
+
}, icon), /*#__PURE__*/_react.default.createElement("label", {
|
|
163
|
+
id: dropZoneId,
|
|
164
|
+
className: (0, _classnames.default)("".concat(RC, "__input-label"), (0, _defineProperty2.default)({}, "".concat(RC, "__input-label_no-icon"), !icon)),
|
|
165
|
+
htmlFor: fieldKey
|
|
166
|
+
}, placeholder, /*#__PURE__*/_react.default.createElement("input", {
|
|
167
|
+
id: fieldKey,
|
|
168
|
+
className: (0, _classnames.default)("".concat(RC, "__input")),
|
|
169
|
+
type: "file",
|
|
170
|
+
onChange: handle.change
|
|
171
|
+
}))) : 'develop error: no doLoad';
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
var _default = LoadZone;
|
|
175
|
+
exports.default = _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
|
+
|
|
24
|
+
var _utils = require("../../../../Functions/utils");
|
|
25
|
+
|
|
26
|
+
require("../FileLoader.scss");
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
36
|
+
var LoadedContent = function LoadedContent(props) {
|
|
37
|
+
var RC = props.RC,
|
|
38
|
+
value = props.value,
|
|
39
|
+
onDelete = props.onDelete,
|
|
40
|
+
icon = props.icon,
|
|
41
|
+
isIconAfter = props.isIconAfter,
|
|
42
|
+
deleteIcon = props.deleteIcon,
|
|
43
|
+
isUseLinkTitle = props.isUseLinkTitle,
|
|
44
|
+
isLinkTypeDownload = props.isLinkTypeDownload;
|
|
45
|
+
var handle = {
|
|
46
|
+
download: function () {
|
|
47
|
+
var _download = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
48
|
+
var target;
|
|
49
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
50
|
+
while (1) {
|
|
51
|
+
switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
target = e.target.tagName === 'SPAN' || e.target.tagName === 'svg' ? e.target.parentNode : e.target;
|
|
56
|
+
(0, _utils.downloadFile)({
|
|
57
|
+
url: target.href,
|
|
58
|
+
name: value.name
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
case 4:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, _callee);
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
function download(_x) {
|
|
70
|
+
return _download.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return download;
|
|
74
|
+
}()
|
|
75
|
+
};
|
|
76
|
+
var additionalProps = (0, _react.useMemo)(function () {
|
|
77
|
+
return _objectSpread(_objectSpread(_objectSpread({}, isUseLinkTitle ? {
|
|
78
|
+
title: isLinkTypeDownload ? "Download ".concat(value.name) : value.path
|
|
79
|
+
} : {}), isLinkTypeDownload ? {
|
|
80
|
+
onClick: handle.download
|
|
81
|
+
} : {
|
|
82
|
+
target: '_blank'
|
|
83
|
+
}), {}, {
|
|
84
|
+
key: "LoadedContent-isNotUseLinkTitle-".concat(isUseLinkTitle, "-isLinkTypeDownload-").concat(isLinkTypeDownload)
|
|
85
|
+
});
|
|
86
|
+
}, [isUseLinkTitle, isLinkTypeDownload]);
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", (0, _extends2.default)({}, additionalProps, {
|
|
88
|
+
href: value.path,
|
|
89
|
+
rel: "noreferrer",
|
|
90
|
+
className: (0, _classnames.default)("".concat(RC, "__value-link"), (0, _defineProperty2.default)({}, "".concat(RC, "__value-link_icon-after"), isIconAfter))
|
|
91
|
+
}), !isIconAfter && icon, /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
+
className: (0, _classnames.default)("".concat(RC, "__value-name"))
|
|
93
|
+
}, value.name), isIconAfter && icon), /*#__PURE__*/_react.default.createElement("span", {
|
|
94
|
+
className: (0, _classnames.default)("".concat(RC, "__delete-value-button")),
|
|
95
|
+
onClick: onDelete
|
|
96
|
+
}, deleteIcon || 'X'));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var _default = LoadedContent;
|
|
100
|
+
exports.default = _default;
|
|
@@ -53,7 +53,6 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
53
53
|
onKeyDown = _ref$onKeyDown === void 0 ? function () {} : _ref$onKeyDown,
|
|
54
54
|
isNotBlinkErrors = _ref.isNotBlinkErrors,
|
|
55
55
|
isPriceInput = _ref.isPriceInput,
|
|
56
|
-
isHexFormat = _ref.isHexFormat,
|
|
57
56
|
onlyNumbers = _ref.onlyNumbers,
|
|
58
57
|
isOnlyString = _ref.isOnlyString,
|
|
59
58
|
disabled = _ref.disabled,
|
|
@@ -201,7 +200,6 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
201
200
|
}
|
|
202
201
|
|
|
203
202
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
204
|
-
if (isHexFormat) inputValue = (0, _fieldValueFormatters.formatToHex)(inputValue);
|
|
205
203
|
if (symbolsLimit && inputValue.length > +symbolsLimit) inputValue = inputValue.substring(0, +symbolsLimit);
|
|
206
204
|
if (isCropFirstNool && inputValue[0] == 0) return '';
|
|
207
205
|
if (onlyNumbers && isOnlyString || isOnlyString) inputValue = (0, _fieldValueFormatters.formatToLetters)(inputValue, softStringMode);else if (onlyNumbers) inputValue = handle.correctMinMax(inputValue, 'max');
|
|
@@ -11,37 +11,60 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
14
|
var _react = _interopRequireDefault(require("react"));
|
|
17
15
|
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
18
|
var _Input = _interopRequireDefault(require("../Input/Input"));
|
|
19
19
|
|
|
20
|
+
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
21
|
+
|
|
20
22
|
require("./InputColor.scss");
|
|
21
23
|
|
|
22
|
-
var _excluded = ["className", "symbolsLimit", "
|
|
24
|
+
var _excluded = ["value", "className", "symbolsLimit", "onChange", "withHexFormat", "initialHexOfColorBlock", "testId"];
|
|
23
25
|
|
|
24
|
-
//todo подумать куда повесить класснейм
|
|
25
26
|
var InputColor = function InputColor(_ref) {
|
|
26
|
-
var
|
|
27
|
+
var value = _ref.value,
|
|
28
|
+
className = _ref.className,
|
|
27
29
|
symbolsLimit = _ref.symbolsLimit,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_ref$
|
|
31
|
-
|
|
30
|
+
onChange = _ref.onChange,
|
|
31
|
+
_ref$withHexFormat = _ref.withHexFormat,
|
|
32
|
+
withHexFormat = _ref$withHexFormat === void 0 ? {
|
|
33
|
+
withSharp: true,
|
|
34
|
+
isTurnOn: true
|
|
35
|
+
} : _ref$withHexFormat,
|
|
36
|
+
_ref$initialHexOfColo = _ref.initialHexOfColorBlock,
|
|
37
|
+
initialHexOfColorBlock = _ref$initialHexOfColo === void 0 ? 'transparent' : _ref$initialHexOfColo,
|
|
38
|
+
_ref$testId = _ref.testId,
|
|
39
|
+
testId = _ref$testId === void 0 ? 'inputColor' : _ref$testId,
|
|
32
40
|
args = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
+
// HANDLES
|
|
42
|
+
var handle = {
|
|
43
|
+
change: function change(e) {
|
|
44
|
+
var inputValue = e !== null && e !== void 0 && e.target ? e.target.value : e;
|
|
45
|
+
inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
46
|
+
if (withHexFormat !== null && withHexFormat !== void 0 && withHexFormat.isTurnOn) inputValue = (0, _fieldValueFormatters.formatToHex)({
|
|
47
|
+
inputValue: inputValue,
|
|
48
|
+
withSharp: withHexFormat === null || withHexFormat === void 0 ? void 0 : withHexFormat.withSharp
|
|
49
|
+
});
|
|
50
|
+
if (symbolsLimit && inputValue.length > +symbolsLimit) inputValue = inputValue.substring(0, +symbolsLimit);
|
|
51
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
33
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
55
|
className: (0, _classnames.default)('inputColor', className)
|
|
35
56
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
36
57
|
className: (0, _classnames.default)('inputColor__color-block'),
|
|
37
58
|
style: {
|
|
38
|
-
backgroundColor:
|
|
59
|
+
backgroundColor: value && value.length === 7 ? value : initialHexOfColorBlock
|
|
39
60
|
}
|
|
40
61
|
}), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
62
|
+
value: value,
|
|
63
|
+
onChange: handle.change,
|
|
41
64
|
symbolsLimit: symbolsLimit || 7,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
65
|
+
className: (0, _classnames.default)('input inputColor__input'),
|
|
66
|
+
type: "text",
|
|
67
|
+
testId: testId
|
|
45
68
|
})));
|
|
46
69
|
};
|
|
47
70
|
|