intelicoreact 1.1.28 → 1.1.30
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.
|
@@ -0,0 +1,139 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
21
|
+
|
|
22
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
+
|
|
26
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
|
+
|
|
28
|
+
var _Input = _interopRequireDefault(require("../Input/Input"));
|
|
29
|
+
|
|
30
|
+
var _Button = _interopRequireDefault(require("../../UI/Button/Button"));
|
|
31
|
+
|
|
32
|
+
var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
|
|
33
|
+
|
|
34
|
+
require("./InputWithAction.scss");
|
|
35
|
+
|
|
36
|
+
var _excluded = ["className", "inputClassName", "isHideAction", "actionLabel", "doAction", "actionContent", "actionProps", "isNoChangeAfterAction", "isWithCopy", "copyLabel", "copy", "disabled", "isInputZoneDisabled", "isInputDisabled", "isLodaing", "onChange", "value"];
|
|
37
|
+
|
|
38
|
+
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); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
var RC = 'input-with-action';
|
|
43
|
+
|
|
44
|
+
var InputWithAction = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
45
|
+
var className = props.className,
|
|
46
|
+
inputClassName = props.inputClassName,
|
|
47
|
+
_props$isHideAction = props.isHideAction,
|
|
48
|
+
isHideAction = _props$isHideAction === void 0 ? false : _props$isHideAction,
|
|
49
|
+
_props$actionLabel = props.actionLabel,
|
|
50
|
+
actionLabel = _props$actionLabel === void 0 ? 'Generate' : _props$actionLabel,
|
|
51
|
+
_doAction = props.doAction,
|
|
52
|
+
actionContent = props.actionContent,
|
|
53
|
+
actionProps = props.actionProps,
|
|
54
|
+
_props$isNoChangeAfte = props.isNoChangeAfterAction,
|
|
55
|
+
isNoChangeAfterAction = _props$isNoChangeAfte === void 0 ? false : _props$isNoChangeAfte,
|
|
56
|
+
_props$isWithCopy = props.isWithCopy,
|
|
57
|
+
isWithCopy = _props$isWithCopy === void 0 ? true : _props$isWithCopy,
|
|
58
|
+
_props$copyLabel = props.copyLabel,
|
|
59
|
+
copyLabel = _props$copyLabel === void 0 ? 'Copy' : _props$copyLabel,
|
|
60
|
+
_copy = props.copy,
|
|
61
|
+
disabled = props.disabled,
|
|
62
|
+
isInputZoneDisabled = props.isInputZoneDisabled,
|
|
63
|
+
isInputDisabled = props.isInputDisabled,
|
|
64
|
+
isLodaing = props.isLodaing,
|
|
65
|
+
onChange = props.onChange,
|
|
66
|
+
value = props.value,
|
|
67
|
+
inputProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
68
|
+
|
|
69
|
+
var _useState = (0, _react.useState)(false),
|
|
70
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
71
|
+
isLocalLoading = _useState2[0],
|
|
72
|
+
setIsLocalLoading = _useState2[1];
|
|
73
|
+
|
|
74
|
+
var handle = {
|
|
75
|
+
doAction: function () {
|
|
76
|
+
var _doAction2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
77
|
+
var result;
|
|
78
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
79
|
+
while (1) {
|
|
80
|
+
switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
setIsLocalLoading(true);
|
|
83
|
+
_context.next = 3;
|
|
84
|
+
return _doAction === null || _doAction === void 0 ? void 0 : _doAction(value, actionProps);
|
|
85
|
+
|
|
86
|
+
case 3:
|
|
87
|
+
result = _context.sent;
|
|
88
|
+
if (!isNoChangeAfterAction) onChange(result);
|
|
89
|
+
setIsLocalLoading(false);
|
|
90
|
+
return _context.abrupt("return", result);
|
|
91
|
+
|
|
92
|
+
case 7:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context.stop();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, _callee);
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
function doAction() {
|
|
101
|
+
return _doAction2.apply(this, arguments);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return doAction;
|
|
105
|
+
}(),
|
|
106
|
+
copy: function copy() {
|
|
107
|
+
if (typeof _copy === 'function') _copy(value);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
(0, _react.useEffect)(function () {
|
|
111
|
+
if (isLocalLoading !== isLodaing) setIsLocalLoading(isLodaing);
|
|
112
|
+
}, [isLodaing]);
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
114
|
+
className: (0, _classnames.default)(RC, className, (0, _defineProperty2.default)({}, "".concat(RC, "_disabled"), disabled))
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
+
className: (0, _classnames.default)("".concat(RC, "__input-zone"), (0, _defineProperty2.default)({}, "".concat(RC, "__input-zone_disabled"), isInputZoneDisabled))
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, inputProps, {
|
|
118
|
+
ref: ref,
|
|
119
|
+
value: value,
|
|
120
|
+
disabled: isInputDisabled,
|
|
121
|
+
onChange: onChange,
|
|
122
|
+
className: (0, _classnames.default)("".concat(RC, "__input"), inputClassName)
|
|
123
|
+
})), !isHideAction && actionContent, !isHideAction && !actionContent && /*#__PURE__*/_react.default.createElement("span", {
|
|
124
|
+
className: (0, _classnames.default)("".concat(RC, "__action-container")),
|
|
125
|
+
onClick: function onClick() {
|
|
126
|
+
return handle.doAction();
|
|
127
|
+
}
|
|
128
|
+
}, actionLabel), isLocalLoading && /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
129
|
+
size: "small"
|
|
130
|
+
})), isWithCopy && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
131
|
+
className: "".concat(RC, "__coppy-button"),
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
return handle.copy();
|
|
134
|
+
}
|
|
135
|
+
}, copyLabel));
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
var _default = InputWithAction;
|
|
139
|
+
exports.default = _default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.input-with-action {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: 100%;
|
|
4
|
+
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-flow: row nowrap;
|
|
7
|
+
justify-content: flex-start;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
&__input-zone {
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-flow: row nowrap;
|
|
15
|
+
justify-content: flex-start;
|
|
16
|
+
align-items: center;
|
|
17
|
+
|
|
18
|
+
position: relative;
|
|
19
|
+
padding: 0 10px;
|
|
20
|
+
border: 1px solid #E2E5EC;
|
|
21
|
+
border-radius: 3px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__action-container {
|
|
25
|
+
margin-left: 8px;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
user-select: none
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__coppy-button {
|
|
31
|
+
margin-left: 8px;
|
|
32
|
+
user-select: none
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&_disabled,
|
|
36
|
+
&__input-zone_disabled {
|
|
37
|
+
opacity: 0.5;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input__wrap {
|
|
42
|
+
flex-grow: 1;
|
|
43
|
+
border: none;
|
|
44
|
+
|
|
45
|
+
&_focus {
|
|
46
|
+
filter: none;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.input {
|
|
51
|
+
padding-left: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.lds-ring_small {
|
|
55
|
+
width: 20px;
|
|
56
|
+
height: 20px;
|
|
57
|
+
|
|
58
|
+
& div {
|
|
59
|
+
border-width: 3px !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -251,7 +251,7 @@ var InputAddress = function InputAddress(_ref) {
|
|
|
251
251
|
className: (0, _classnames.default)('input-address__list--item', {
|
|
252
252
|
'input-address__list--item-hightlighted': i === hightlightedIndex
|
|
253
253
|
}),
|
|
254
|
-
|
|
254
|
+
onMouseDown: function onMouseDown(e) {
|
|
255
255
|
return setQueryAsItem(e, item);
|
|
256
256
|
}
|
|
257
257
|
}, item);
|