intelicoreact 1.0.30 → 1.0.31
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 +95 -0
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +134 -0
- package/dist/Atomic/FormElements/FileLoader/partial/AnyOuterClass.scss +9 -0
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +173 -0
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +59 -0
- package/dist/Atomic/FormElements/Input/Input.js +0 -2
- package/dist/Atomic/FormElements/InputColor/InputColor.js +36 -13
- package/dist/Atomic/FormElements/InputLink/InputLink.js +117 -0
- package/dist/Atomic/FormElements/InputLink/InputLink.scss +53 -0
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +14 -11
- package/dist/Atomic/Layout/Spinner/Spinner.scss +5 -3
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +3 -2
- package/dist/Functions/fieldValueFormatters.js +35 -9
- package/dist/Functions/useInputHighlightError.js +84 -0
- 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,95 @@
|
|
|
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
|
+
onChange = props.onChange,
|
|
38
|
+
doLoad = props.doLoad,
|
|
39
|
+
className = props.className,
|
|
40
|
+
placeholder = props.placeholder,
|
|
41
|
+
uploadIcon = props.uploadIcon,
|
|
42
|
+
downloadIcon = props.downloadIcon,
|
|
43
|
+
deleteIcon = props.deleteIcon,
|
|
44
|
+
spiner = props.spiner,
|
|
45
|
+
isIconAfter = props.isIconAfter,
|
|
46
|
+
isBlockNullValues = props.isBlockNullValues,
|
|
47
|
+
filterFiles = props.filterFiles,
|
|
48
|
+
processErrors = props.processErrors,
|
|
49
|
+
_props$isUseLinkTitle = props.isUseLinkTitle,
|
|
50
|
+
isUseLinkTitle = _props$isUseLinkTitle === void 0 ? false : _props$isUseLinkTitle,
|
|
51
|
+
disabled = props.disabled,
|
|
52
|
+
error = props.error,
|
|
53
|
+
_props$isDisableError = props.isDisableErrorsClass,
|
|
54
|
+
isDisableErrorsClass = _props$isDisableError === void 0 ? true : _props$isDisableError;
|
|
55
|
+
|
|
56
|
+
var _useState = (0, _react.useState)(false),
|
|
57
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
58
|
+
isLoadContent = _useState2[0],
|
|
59
|
+
setIsLoadContent = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useState3 = (0, _react.useState)(false),
|
|
62
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
63
|
+
dragenter = _useState4[0],
|
|
64
|
+
setDragenter = _useState4[1];
|
|
65
|
+
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
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))
|
|
68
|
+
}, isLoadContent && spiner, value ? /*#__PURE__*/_react.default.createElement(_LoadedContent.default, {
|
|
69
|
+
RC: RC,
|
|
70
|
+
value: value,
|
|
71
|
+
onDelete: function onDelete() {
|
|
72
|
+
return onChange(null);
|
|
73
|
+
},
|
|
74
|
+
icon: downloadIcon,
|
|
75
|
+
isIconAfter: isIconAfter,
|
|
76
|
+
deleteIcon: deleteIcon,
|
|
77
|
+
isUseLinkTitle: isUseLinkTitle
|
|
78
|
+
}) : /*#__PURE__*/_react.default.createElement(_LoadZone.default, {
|
|
79
|
+
RC: RC,
|
|
80
|
+
fieldKey: fieldKey,
|
|
81
|
+
onChange: onChange,
|
|
82
|
+
icon: uploadIcon,
|
|
83
|
+
doLoad: doLoad,
|
|
84
|
+
dragenter: dragenter,
|
|
85
|
+
setDragenter: setDragenter,
|
|
86
|
+
setIsLoadContent: setIsLoadContent,
|
|
87
|
+
placeholder: placeholder,
|
|
88
|
+
filterFiles: filterFiles,
|
|
89
|
+
processErrors: processErrors,
|
|
90
|
+
isBlockNullValues: isBlockNullValues
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var _default = FileLoader;
|
|
95
|
+
exports.default = _default;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// @import '../../scss/main.scss';
|
|
2
|
+
|
|
3
|
+
.file-loader {
|
|
4
|
+
position: relative;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 28px;
|
|
8
|
+
padding: 4px 6px 4px 5px;
|
|
9
|
+
border: 1px solid #E2E5EC;
|
|
10
|
+
border-radius: 3px;
|
|
11
|
+
background-color: #FFF;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-flow: row nowrap;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
|
|
17
|
+
&_hover {
|
|
18
|
+
filter: drop-shadow(0 0 4px rgb(93 120 255 / 50%));
|
|
19
|
+
border-color: #6B81DD;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&_load-zone {
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&_load-content {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__value-link {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
width: fit-content;
|
|
33
|
+
height: 100%;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-flow: row nowrap;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
align-items: center;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
outline: none;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 400;
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
line-height: 20px;
|
|
44
|
+
color: #166EAD;
|
|
45
|
+
|
|
46
|
+
svg {
|
|
47
|
+
width: 16px;
|
|
48
|
+
height: 16px;
|
|
49
|
+
color: #9AA0B9;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__value-name {
|
|
54
|
+
margin-left: 4px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__value-link_icon-after {
|
|
58
|
+
.file-loader__value-name {
|
|
59
|
+
margin-left: 0;
|
|
60
|
+
margin-right: 4px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__delete-value-button {
|
|
65
|
+
width: 16px;
|
|
66
|
+
height: 16px;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
|
|
69
|
+
svg {
|
|
70
|
+
height: 100%;
|
|
71
|
+
width: auto;
|
|
72
|
+
color: #F06D8D;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__icon-block {
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
width: 16px;
|
|
79
|
+
height: 16px;
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: calc(50% - 8px);
|
|
82
|
+
left: 5px;
|
|
83
|
+
color: #9AA0B9;
|
|
84
|
+
|
|
85
|
+
svg {
|
|
86
|
+
height: 100%;
|
|
87
|
+
width: auto;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&__input-label {
|
|
92
|
+
box-sizing: border-box;
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
padding: 4px 6px 4px 25px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
|
|
98
|
+
font-style: normal;
|
|
99
|
+
font-weight: 300;
|
|
100
|
+
font-size: 13px;
|
|
101
|
+
line-height: 20px;
|
|
102
|
+
color: #1E1E2D;
|
|
103
|
+
|
|
104
|
+
&_no-icon {
|
|
105
|
+
padding-left: 5px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__input {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.loader-box {
|
|
114
|
+
opacity: 0.2;
|
|
115
|
+
|
|
116
|
+
.lds-ring.lds-ring_little {
|
|
117
|
+
width: 20px;
|
|
118
|
+
height: 20px;
|
|
119
|
+
|
|
120
|
+
div {
|
|
121
|
+
border-width: 2px !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&_error {
|
|
127
|
+
border-color: #F06D8D;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&_disabled {
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
opacity: 0.5;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
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);
|
|
96
|
+
|
|
97
|
+
case 17:
|
|
98
|
+
_context.t2 = _context.sent;
|
|
99
|
+
(0, _context.t1)(_context.t2);
|
|
100
|
+
|
|
101
|
+
case 19:
|
|
102
|
+
setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(false);
|
|
103
|
+
|
|
104
|
+
case 20:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
function change(_x) {
|
|
113
|
+
return _change.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return change;
|
|
117
|
+
}(),
|
|
118
|
+
dragover: function dragover(e) {
|
|
119
|
+
e.stopPropagation();
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
return false;
|
|
122
|
+
},
|
|
123
|
+
dragenter: function dragenter(e) {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
setDragenter(true);
|
|
127
|
+
return false;
|
|
128
|
+
},
|
|
129
|
+
dragleave: function dragleave(e) {
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
setDragenter(false);
|
|
133
|
+
return false;
|
|
134
|
+
},
|
|
135
|
+
drop: function drop(e) {
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
setDragenter(false);
|
|
139
|
+
handle.change(e);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
(0, _react.useEffect)(function () {
|
|
144
|
+
var dropbox = document.getElementById(dropZoneId);
|
|
145
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragenter', handle.dragenter, false);
|
|
146
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragover', handle.dragover, false);
|
|
147
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragleave', handle.dragleave, false);
|
|
148
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('drop', handle.drop, false);
|
|
149
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener('dragend', handle.dragleave, false);
|
|
150
|
+
return function () {
|
|
151
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragenter', handle.dragenter, false);
|
|
152
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragover', handle.dragover, false);
|
|
153
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragleave', handle.dragleave, false);
|
|
154
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('drop', handle.drop, false);
|
|
155
|
+
dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener('dragend', handle.dragleave, false);
|
|
156
|
+
};
|
|
157
|
+
}, [fieldKey, doLoad]);
|
|
158
|
+
return doLoad && typeof doLoad === 'function' ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
+
className: (0, _classnames.default)("".concat(RC, "__icon-block"))
|
|
160
|
+
}, icon), /*#__PURE__*/_react.default.createElement("label", {
|
|
161
|
+
id: dropZoneId,
|
|
162
|
+
className: (0, _classnames.default)("".concat(RC, "__input-label"), (0, _defineProperty2.default)({}, "".concat(RC, "__input-label_no-icon"), !icon)),
|
|
163
|
+
htmlFor: fieldKey
|
|
164
|
+
}, placeholder, /*#__PURE__*/_react.default.createElement("input", {
|
|
165
|
+
id: fieldKey,
|
|
166
|
+
className: (0, _classnames.default)("".concat(RC, "__input")),
|
|
167
|
+
type: "file",
|
|
168
|
+
onChange: handle.change
|
|
169
|
+
}))) : 'develop error: no doLoad';
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
var _default = LoadZone;
|
|
173
|
+
exports.default = _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
require("../FileLoader.scss");
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var LoadedContent = function LoadedContent(props) {
|
|
31
|
+
var RC = props.RC,
|
|
32
|
+
value = props.value,
|
|
33
|
+
onDelete = props.onDelete,
|
|
34
|
+
icon = props.icon,
|
|
35
|
+
isIconAfter = props.isIconAfter,
|
|
36
|
+
deleteIcon = props.deleteIcon,
|
|
37
|
+
isUseLinkTitle = props.isUseLinkTitle;
|
|
38
|
+
var additionalProps = (0, _react.useMemo)(function () {
|
|
39
|
+
return _objectSpread(_objectSpread({}, isUseLinkTitle ? {
|
|
40
|
+
title: value.path
|
|
41
|
+
} : {}), {}, {
|
|
42
|
+
key: "LoadedContent-isNotUseLinkTitle-".concat(isUseLinkTitle)
|
|
43
|
+
});
|
|
44
|
+
}, [isUseLinkTitle]);
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", (0, _extends2.default)({}, additionalProps, {
|
|
46
|
+
href: value.path,
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noreferrer",
|
|
49
|
+
className: (0, _classnames.default)("".concat(RC, "__value-link"), (0, _defineProperty2.default)({}, "".concat(RC, "__value-link_icon-after"), isIconAfter))
|
|
50
|
+
}), !isIconAfter && icon, /*#__PURE__*/_react.default.createElement("span", {
|
|
51
|
+
className: (0, _classnames.default)("".concat(RC, "__value-name"))
|
|
52
|
+
}, value.name), isIconAfter && icon), /*#__PURE__*/_react.default.createElement("span", {
|
|
53
|
+
className: (0, _classnames.default)("".concat(RC, "__delete-value-button")),
|
|
54
|
+
onClick: onDelete
|
|
55
|
+
}, deleteIcon || 'X'));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var _default = LoadedContent;
|
|
59
|
+
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
|
|
|
@@ -0,0 +1,117 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
var _reactFeather = require("react-feather");
|
|
21
|
+
|
|
22
|
+
var _Input = _interopRequireDefault(require("../Input/Input"));
|
|
23
|
+
|
|
24
|
+
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
25
|
+
|
|
26
|
+
require("./InputLink.scss");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["icon", "value", "withHttpsPrefix", "onRedirect", "testId", "onChange", "withDelete"];
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
var InputColor = function InputColor(_ref) {
|
|
35
|
+
var icon = _ref.icon,
|
|
36
|
+
value = _ref.value,
|
|
37
|
+
_ref$withHttpsPrefix = _ref.withHttpsPrefix,
|
|
38
|
+
withHttpsPrefix = _ref$withHttpsPrefix === void 0 ? {
|
|
39
|
+
isTurnOn: false,
|
|
40
|
+
isSecure: false,
|
|
41
|
+
isBorderErrorWithEmptyHost: false
|
|
42
|
+
} : _ref$withHttpsPrefix,
|
|
43
|
+
onRedirect = _ref.onRedirect,
|
|
44
|
+
_ref$testId = _ref.testId,
|
|
45
|
+
testId = _ref$testId === void 0 ? 'input' : _ref$testId,
|
|
46
|
+
onChange = _ref.onChange,
|
|
47
|
+
withDelete = _ref.withDelete,
|
|
48
|
+
args = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
49
|
+
|
|
50
|
+
var _ref2 = withHttpsPrefix || {},
|
|
51
|
+
isSecure = _ref2.isSecure,
|
|
52
|
+
isPrefix = _ref2.isTurnOn;
|
|
53
|
+
|
|
54
|
+
var inputRef = (0, _react.useRef)(null);
|
|
55
|
+
var handle = {
|
|
56
|
+
redirect: function redirect() {
|
|
57
|
+
var _ref3 = withHttpsPrefix || {},
|
|
58
|
+
isBorderErrorWithEmptyHost = _ref3.isBorderErrorWithEmptyHost,
|
|
59
|
+
isSecure = _ref3.isSecure,
|
|
60
|
+
isPrefix = _ref3.isTurnOn;
|
|
61
|
+
|
|
62
|
+
if (isPrefix && isBorderErrorWithEmptyHost) {
|
|
63
|
+
if (isSecure && (value === null || value === void 0 ? void 0 : value.length) <= 8 || !isSecure && (value === null || value === void 0 ? void 0 : value.length) <= 7) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
window.open("http".concat(isSecure ? 's' : '', "://").concat(value.replace(/https?:\/\/?/g, '')), '_blank');
|
|
69
|
+
onRedirect === null || onRedirect === void 0 ? void 0 : onRedirect();
|
|
70
|
+
},
|
|
71
|
+
change: function change(e) {
|
|
72
|
+
var _inputRef$current;
|
|
73
|
+
|
|
74
|
+
var inputValue = e !== null && e !== void 0 && e.target ? (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(e.target.value) : (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(e);
|
|
75
|
+
var cursorPosition = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.selectionStart;
|
|
76
|
+
|
|
77
|
+
if (isSecure && cursorPosition <= 8 || !isSecure && cursorPosition <= 7) {
|
|
78
|
+
cursorPosition++;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
var _inputRef$current2;
|
|
83
|
+
|
|
84
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setSelectionRange(cursorPosition, cursorPosition);
|
|
85
|
+
}, 0);
|
|
86
|
+
if (isPrefix) inputValue = (0, _fieldValueFormatters.formatToReplaceAllWhiteSpace)(inputValue.replace(/https?:\/\/?/g, ''));
|
|
87
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue.toString());
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: (0, _classnames.default)('inputLink', {
|
|
92
|
+
'inputLink--withDelete': withDelete && value && value.length > 0
|
|
93
|
+
})
|
|
94
|
+
}, isPrefix && /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: (0, _classnames.default)('inputColor__prefix')
|
|
96
|
+
}, isSecure ? 'https://' : 'http://'), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
97
|
+
withDelete: withDelete,
|
|
98
|
+
value: value,
|
|
99
|
+
onChange: handle.change,
|
|
100
|
+
testId: "inputLink--key-".concat(testId),
|
|
101
|
+
type: "text",
|
|
102
|
+
autoComplete: "url",
|
|
103
|
+
ref: inputRef,
|
|
104
|
+
className: (0, _classnames.default)({
|
|
105
|
+
'prefix-gutter--secured': isPrefix && isSecure,
|
|
106
|
+
'prefix-gutter--no-secured': isPrefix && !isSecure
|
|
107
|
+
})
|
|
108
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
onClick: function onClick() {
|
|
110
|
+
return handle.redirect();
|
|
111
|
+
},
|
|
112
|
+
className: (0, _classnames.default)('inputLink__icon pointer')
|
|
113
|
+
}, value && (icon || /*#__PURE__*/_react.default.createElement(_reactFeather.ExternalLink, null))));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var _default = InputColor;
|
|
117
|
+
exports.default = _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.inputLink {
|
|
2
|
+
position: relative;
|
|
3
|
+
&__icon {
|
|
4
|
+
width: fit-content;
|
|
5
|
+
height: fit-content;
|
|
6
|
+
position: absolute;
|
|
7
|
+
right: 5px;
|
|
8
|
+
top: 50%;
|
|
9
|
+
transform: translateY(-50%);
|
|
10
|
+
z-index: 1;
|
|
11
|
+
svg {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
min-width: 16px;
|
|
16
|
+
max-width: 16px;
|
|
17
|
+
min-height: 16px;
|
|
18
|
+
max-height: 16px;
|
|
19
|
+
|
|
20
|
+
stroke: #6b81dd;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.input {
|
|
24
|
+
padding-right: 25px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.input__close {
|
|
28
|
+
right: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.prefix-gutter--secured {
|
|
33
|
+
padding-left: 52px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.prefix-gutter--no-secured {
|
|
37
|
+
padding-left: 45px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.inputColor__prefix {
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
font-weight: 400;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 50%;
|
|
47
|
+
transform: translateY(-50%);
|
|
48
|
+
left: 11px;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
cursor: default;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
@@ -215,13 +215,13 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
var setListContainerStyles = function setListContainerStyles() {
|
|
218
|
-
var _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma,
|
|
218
|
+
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _dl$getBoundingClient, _sw$getBoundingClient;
|
|
219
219
|
|
|
220
220
|
var lc = getListContainer();
|
|
221
221
|
if (!lc || !isOpen) return false;
|
|
222
222
|
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
223
223
|
|
|
224
|
-
var _ref6 = (dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect())
|
|
224
|
+
var _ref6 = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {},
|
|
225
225
|
width = _ref6.width,
|
|
226
226
|
height = _ref6.height,
|
|
227
227
|
left = _ref6.left,
|
|
@@ -232,15 +232,19 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
232
232
|
var margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace('px', '')) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0);
|
|
233
233
|
var maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0 ? void 0 : (_getComputedStyle2$ma = _getComputedStyle2.maxHeight) === null || _getComputedStyle2$ma === void 0 ? void 0 : _getComputedStyle2$ma.replace('px', '')) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0);
|
|
234
234
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
235
|
-
var delta = ((_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height) - ((_dl$getBoundingClient = dl.getBoundingClientRect()) === null || _dl$getBoundingClient === void 0 ? void 0 : _dl$getBoundingClient.height);
|
|
236
235
|
var toTop = top - margin;
|
|
237
236
|
var toBottom = windowHeight - top - height - margin * 2;
|
|
238
|
-
var
|
|
237
|
+
var dlHeight = dl === null || dl === void 0 ? void 0 : (_dl$getBoundingClient = dl.getBoundingClientRect()) === null || _dl$getBoundingClient === void 0 ? void 0 : _dl$getBoundingClient.height;
|
|
238
|
+
var swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
239
|
+
var controlsHeight = swHeight - dlHeight;
|
|
240
|
+
if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
|
|
241
|
+
var maxSwHeight = toTop - margin >= maxHeight || toBottom - margin >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
239
242
|
var listPos = toTop < toBottom || toBottom >= swHeight ? 'bottom' : 'top';
|
|
243
|
+
if (swHeight > (listPos === 'top' ? toTop : toBottom)) swHeight = (listPos === 'top' ? toTop : toBottom) - 3 * margin;
|
|
240
244
|
lc.style.minWidth = "".concat(width, "px");
|
|
241
245
|
lc.style.left = "".concat(left, "px");
|
|
242
|
-
lc.style.top = "".concat(listPos === 'bottom' ? top + height : top - swHeight -
|
|
243
|
-
dl.style.maxHeight = "".concat(
|
|
246
|
+
lc.style.top = "".concat(listPos === 'bottom' ? top + height : top - swHeight - 2 * margin, "px");
|
|
247
|
+
dl.style.maxHeight = "".concat(maxSwHeight - controlsHeight, "px");
|
|
244
248
|
};
|
|
245
249
|
|
|
246
250
|
var renderListContainer = function renderListContainer() {
|
|
@@ -282,10 +286,6 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
282
286
|
}, footerContent) : null);
|
|
283
287
|
};
|
|
284
288
|
|
|
285
|
-
(0, _react.useEffect)(function () {
|
|
286
|
-
initListContainer();
|
|
287
|
-
}, []);
|
|
288
|
-
|
|
289
289
|
var closeList = function closeList(e) {
|
|
290
290
|
var _inputRef$current;
|
|
291
291
|
|
|
@@ -293,6 +293,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
293
293
|
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
|
|
294
294
|
};
|
|
295
295
|
|
|
296
|
+
(0, _react.useLayoutEffect)(function () {
|
|
297
|
+
initListContainer();
|
|
298
|
+
}, []);
|
|
296
299
|
(0, _react.useLayoutEffect)(function () {
|
|
297
300
|
window.addEventListener('resize', setListContainerStyles);
|
|
298
301
|
window.addEventListener('mousewheel', closeList);
|
|
@@ -303,7 +306,7 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
303
306
|
window.removeEventListener('mouseup', handleClickOutside);
|
|
304
307
|
};
|
|
305
308
|
}, [getListContainer]);
|
|
306
|
-
(0, _react.
|
|
309
|
+
(0, _react.useLayoutEffect)(function () {
|
|
307
310
|
setListContainerStyles();
|
|
308
311
|
}, [isOpen, chosenOptions]);
|
|
309
312
|
(0, _react.useEffect)(function () {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.lds-ring.lds-ring_little {
|
|
29
|
+
top: calc(50% - 15px);
|
|
29
30
|
width: 30px;
|
|
30
31
|
height: 30px;
|
|
31
32
|
}
|
|
@@ -48,10 +49,11 @@
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
.lds-ring_little div {
|
|
51
|
-
top: -
|
|
52
|
+
top: -15%;
|
|
53
|
+
left: -15%;
|
|
52
54
|
|
|
53
|
-
width:
|
|
54
|
-
height:
|
|
55
|
+
width: 100% !important;
|
|
56
|
+
height: 100% !important;
|
|
55
57
|
|
|
56
58
|
border: 4px solid #000 !important;
|
|
57
59
|
border-color: #000 transparent transparent !important;
|
|
@@ -18,7 +18,8 @@ var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
|
18
18
|
require("./ButtonsBar.scss");
|
|
19
19
|
|
|
20
20
|
var ButtonsBar = function ButtonsBar(_ref) {
|
|
21
|
-
var
|
|
21
|
+
var className = _ref.className,
|
|
22
|
+
rejectBtnLabel = _ref.rejectBtnLabel,
|
|
22
23
|
rejectBtnIcon = _ref.rejectBtnIcon,
|
|
23
24
|
rejectBtnVariant = _ref.rejectBtnVariant,
|
|
24
25
|
rejectBtnClass = _ref.rejectBtnClass,
|
|
@@ -36,7 +37,7 @@ var ButtonsBar = function ButtonsBar(_ref) {
|
|
|
36
37
|
_ref$testIdSecondBtn = _ref.testIdSecondBtn,
|
|
37
38
|
testIdSecondBtn = _ref$testIdSecondBtn === void 0 ? 'test-btn-bar-second' : _ref$testIdSecondBtn;
|
|
38
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
-
className: "button-bar"
|
|
40
|
+
className: (0, _classnames.default)("button-bar", className)
|
|
40
41
|
}, rejectLink ? /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
41
42
|
className: "text-decoration-none",
|
|
42
43
|
to: rejectLink
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.formatToReplaceAllWhiteSpace = formatToReplaceAllWhiteSpace;
|
|
6
7
|
exports.filterNumeric = exports.filterFloat = exports.formatToHex = exports.formatToLimitLength = exports.formatNumberValueToMask = exports.formatToCutOffDotAtTheEnd = exports.formatToOnlyASCIICodeText = exports.formatToLetters = exports.formatToPriceWithUSD = exports.formatToTwoDigitAfterDot = exports.formatToDollarSign = exports.formatToAddBitDepthPoints = exports.formatToRemoveComa = exports.formatOnlyNumbers = exports.intlNumbersFormatter = exports.getSafelyValue = void 0;
|
|
7
8
|
|
|
8
9
|
// The first word "format" in the function name means a logic in which the function transforms the incoming value in any case.
|
|
9
10
|
// The first word "filter" in the function name means a logic in which the function works as a changer for sequential input
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* If the value is not undefined or null, return the value's toString() method, otherwise return an
|
|
14
|
+
* empty string.
|
|
15
|
+
*/
|
|
10
16
|
var getSafelyValue = function getSafelyValue(value) {
|
|
11
17
|
var _value$toString;
|
|
12
18
|
|
|
@@ -214,19 +220,39 @@ var formatToLimitLength = function formatToLimitLength(inputValue, limit) {
|
|
|
214
220
|
var value = getSafelyValue(inputValue);
|
|
215
221
|
return limit && typeof limit === 'number' && !Number.isNaN(limit) && (value === null || value === void 0 ? void 0 : value.length) > limit ? value.substr(0, limit) : value;
|
|
216
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* It takes a string and returns a hexadecimal string
|
|
225
|
+
* @param inputValue - The value to be formatted.
|
|
226
|
+
* @param withSharp - boolean - if true, the returned value will have a sharp (#) at the beginning.
|
|
227
|
+
* @returns A function that takes two arguments, inputValue and withSharp.
|
|
228
|
+
*/
|
|
229
|
+
|
|
217
230
|
|
|
218
231
|
exports.formatToLimitLength = formatToLimitLength;
|
|
219
232
|
|
|
220
|
-
var formatToHex = function formatToHex(
|
|
233
|
+
var formatToHex = function formatToHex(_ref2) {
|
|
234
|
+
var inputValue = _ref2.inputValue,
|
|
235
|
+
withSharp = _ref2.withSharp;
|
|
221
236
|
var value = getSafelyValue(inputValue);
|
|
222
|
-
return "
|
|
223
|
-
};
|
|
237
|
+
return "".concat(withSharp ? '#' : '').concat(value.toString().replace(/[^a-f0-9]/gi, ''));
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* It takes a string and returns a string with all white space removed
|
|
241
|
+
* @param str - The string to be formatted.
|
|
242
|
+
* @returns A string with all white space removed.
|
|
243
|
+
*/
|
|
224
244
|
|
|
225
245
|
|
|
226
246
|
exports.formatToHex = formatToHex;
|
|
227
247
|
|
|
248
|
+
function formatToReplaceAllWhiteSpace(str) {
|
|
249
|
+
var value = getSafelyValue(str);
|
|
250
|
+
return value.replace(/\s+/g, '');
|
|
251
|
+
} // *** filter ***
|
|
252
|
+
|
|
253
|
+
|
|
228
254
|
var filterFloat = function filterFloat(inputValue) {
|
|
229
|
-
var
|
|
255
|
+
var _ref3;
|
|
230
256
|
|
|
231
257
|
var decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
232
258
|
var value = getSafelyValue(inputValue);
|
|
@@ -236,7 +262,7 @@ var filterFloat = function filterFloat(inputValue) {
|
|
|
236
262
|
};
|
|
237
263
|
|
|
238
264
|
if (value.length === 1 && (value[0] === '.' || value[0] === ',')) return '0.';
|
|
239
|
-
var output = (
|
|
265
|
+
var output = (_ref3 = '' + value) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/,/g, '.');
|
|
240
266
|
if (value.length > 1 && value[0] === '0' && value[1] !== '.' && value[0] !== ',') output = value.slice(1);
|
|
241
267
|
var previousValue = '' + output.slice(0, -1);
|
|
242
268
|
var lastSym = '' + output.slice(-1);
|
|
@@ -247,10 +273,10 @@ var filterFloat = function filterFloat(inputValue) {
|
|
|
247
273
|
exports.filterFloat = filterFloat;
|
|
248
274
|
|
|
249
275
|
var filterNumeric = function filterNumeric(value, settings) {
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
type =
|
|
253
|
-
decimalPlaces =
|
|
276
|
+
var _ref4 = settings || {},
|
|
277
|
+
_ref4$type = _ref4.type,
|
|
278
|
+
type = _ref4$type === void 0 ? 'float' : _ref4$type,
|
|
279
|
+
decimalPlaces = _ref4.decimalPlaces;
|
|
254
280
|
|
|
255
281
|
var executor = type === 'float' ? filterFloat : formatOnlyNumbers;
|
|
256
282
|
return executor(getSafelyValue(value), decimalPlaces);
|
|
@@ -0,0 +1,84 @@
|
|
|
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 = exports.useInputHighlightError = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _index = require("../Constants/index.constants");
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var useInputHighlightError = function useInputHighlightError(_ref) {
|
|
23
|
+
var value = _ref.value,
|
|
24
|
+
blinkTime = _ref.blinkTime,
|
|
25
|
+
isUseErrorsBlink = _ref.isUseErrorsBlink;
|
|
26
|
+
var DEFAULT_BLINK_TIME = 100;
|
|
27
|
+
|
|
28
|
+
var _useState = (0, _react.useState)(false),
|
|
29
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
|
+
isToHighlightError = _useState2[0],
|
|
31
|
+
setIsToHighlightError = _useState2[1];
|
|
32
|
+
|
|
33
|
+
var _useState3 = (0, _react.useState)(false),
|
|
34
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
35
|
+
isAttemptToChange = _useState4[0],
|
|
36
|
+
setIsAttemptToChange = _useState4[1];
|
|
37
|
+
|
|
38
|
+
var _useState5 = (0, _react.useState)(value),
|
|
39
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
40
|
+
prevValue = _useState6[0],
|
|
41
|
+
setPreviousValue = _useState6[1];
|
|
42
|
+
|
|
43
|
+
function hasHighlightError(e) {
|
|
44
|
+
var changedValue = "".concat(value !== null && value !== void 0 ? value : '');
|
|
45
|
+
var previousValue = "".concat(prevValue !== null && prevValue !== void 0 ? prevValue : '');
|
|
46
|
+
var short = previousValue.length <= changedValue.length ? previousValue : changedValue;
|
|
47
|
+
var long = previousValue.length > changedValue.length ? previousValue : changedValue;
|
|
48
|
+
var infoAboutDifferencesSameness = short.split('').reduce(function (acc, symbol, idx) {
|
|
49
|
+
if (acc.countOn && symbol === long[idx]) acc.same.push(symbol);else {
|
|
50
|
+
acc.countOn = false;
|
|
51
|
+
acc.differences.push([idx, symbol]);
|
|
52
|
+
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, {
|
|
55
|
+
same: [],
|
|
56
|
+
countOn: true,
|
|
57
|
+
differences: []
|
|
58
|
+
});
|
|
59
|
+
var samePart = infoAboutDifferencesSameness.same.join('');
|
|
60
|
+
var differencesLength = infoAboutDifferencesSameness.differences.length;
|
|
61
|
+
var currentSet = changedValue === null || changedValue === void 0 ? void 0 : changedValue.replace(samePart, '');
|
|
62
|
+
if (!_index.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
(0, _react.useEffect)(function () {
|
|
66
|
+
if (isUseErrorsBlink && isAttemptToChange) {
|
|
67
|
+
setIsAttemptToChange(null);
|
|
68
|
+
setIsToHighlightError(true);
|
|
69
|
+
setTimeout(function () {
|
|
70
|
+
setIsToHighlightError(false);
|
|
71
|
+
}, blinkTime || DEFAULT_BLINK_TIME);
|
|
72
|
+
}
|
|
73
|
+
}, [isAttemptToChange]);
|
|
74
|
+
return {
|
|
75
|
+
isToHighlightError: isToHighlightError,
|
|
76
|
+
setPreviousValue: setPreviousValue,
|
|
77
|
+
setIsToHighlightError: setIsToHighlightError,
|
|
78
|
+
hasHighlightError: hasHighlightError
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.useInputHighlightError = useInputHighlightError;
|
|
83
|
+
var _default = useInputHighlightError;
|
|
84
|
+
exports.default = _default;
|