shineout 1.12.13-beta.1 → 1.12.13-beta.2
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/css/Select/Result.js +41 -7
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/dist/shineout.js +2053 -2270
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/Select/Result.js +36 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/Select/Result.js +41 -7
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/css/Select/ResultItem.js +0 -71
- package/es/Select/ResultItem.js +0 -54
- package/lib/Select/ResultItem.js +0 -71
package/css/Select/Result.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
6
|
|
|
7
7
|
exports.__esModule = true;
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.IS_NOT_MATCHED_VALUE = void 0;
|
|
9
9
|
|
|
10
10
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
11
|
|
|
@@ -41,14 +41,16 @@ var _classname = require("../utils/classname");
|
|
|
41
41
|
|
|
42
42
|
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
|
|
43
43
|
|
|
44
|
-
var
|
|
45
|
-
|
|
44
|
+
var IS_NOT_MATCHED_VALUE = 'IS_NOT_MATCHED_VALUE';
|
|
46
45
|
/**
|
|
47
46
|
* get result className from resultClassName attr
|
|
48
47
|
* @param {function | string} f props => resultClassName
|
|
49
48
|
* @param {any} value result value
|
|
50
49
|
* @returns {string | null}
|
|
51
50
|
*/
|
|
51
|
+
|
|
52
|
+
exports.IS_NOT_MATCHED_VALUE = IS_NOT_MATCHED_VALUE;
|
|
53
|
+
|
|
52
54
|
var getResultClassName = function getResultClassName(f, value) {
|
|
53
55
|
if ((0, _is.isFunc)(f)) {
|
|
54
56
|
return f((0, _is.isObject)(value) && value.IS_NOT_MATCHED_VALUE ? value.value : value);
|
|
@@ -68,7 +70,37 @@ var getResultContent = function getResultContent(data, renderResult, renderUnmat
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
return renderResult(data);
|
|
71
|
-
};
|
|
73
|
+
}; // eslint-disable-next-line
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function Item(props) {
|
|
77
|
+
// eslint-disable-next-line react/prop-types
|
|
78
|
+
var value = props.value,
|
|
79
|
+
onClick = props.onClick,
|
|
80
|
+
resultClassName = props.resultClassName,
|
|
81
|
+
_props$title = props.title,
|
|
82
|
+
title = _props$title === void 0 ? false : _props$title,
|
|
83
|
+
only = props.only,
|
|
84
|
+
getDataByValue = props.getDataByValue,
|
|
85
|
+
getContent = props.getContent,
|
|
86
|
+
isDisabled = props.isDisabled;
|
|
87
|
+
var data = getDataByValue(value);
|
|
88
|
+
var disabled = isDisabled(data);
|
|
89
|
+
var content = getContent(data);
|
|
90
|
+
if (data === null) return null;
|
|
91
|
+
var click = disabled || !onClick ? undefined : function () {
|
|
92
|
+
return onClick(data);
|
|
93
|
+
};
|
|
94
|
+
var synDisabled = disabled || !click;
|
|
95
|
+
return _react.default.createElement("a", {
|
|
96
|
+
title: title && (0, _is.isString)(content) ? content : null,
|
|
97
|
+
tabIndex: -1,
|
|
98
|
+
className: (0, _classnames.default)((0, _styles.selectClass)((0, _classname.getDirectionClass)('item'), disabled && (0, _classname.getDirectionClass)('disabled'), synDisabled && (0, _classname.getDirectionClass)('ban'), only && 'item-only'), getResultClassName(resultClassName, data))
|
|
99
|
+
}, content, !synDisabled && _react.default.createElement("span", {
|
|
100
|
+
className: (0, _styles.selectClass)('indicator', 'close'),
|
|
101
|
+
onClick: click
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
72
104
|
|
|
73
105
|
var Result =
|
|
74
106
|
/*#__PURE__*/
|
|
@@ -132,11 +164,12 @@ function (_PureComponent) {
|
|
|
132
164
|
var _this$props = this.props,
|
|
133
165
|
compressed = _this$props.compressed,
|
|
134
166
|
onFilter = _this$props.onFilter,
|
|
135
|
-
values = _this$props.values
|
|
167
|
+
values = _this$props.values,
|
|
168
|
+
data = _this$props.data;
|
|
136
169
|
|
|
137
170
|
if (compressed) {
|
|
138
171
|
if (this.isCompressedBound()) return;
|
|
139
|
-
var shouldRest = !(0, _shallowEqual.default)(preProps.values, values);
|
|
172
|
+
var shouldRest = !(0, _shallowEqual.default)(preProps.values, values) || (data || []).length !== (preProps.data || []).length;
|
|
140
173
|
|
|
141
174
|
if (shouldRest) {
|
|
142
175
|
this.resetMore();
|
|
@@ -196,7 +229,7 @@ function (_PureComponent) {
|
|
|
196
229
|
getResultByValue = _this$props3.getResultByValue;
|
|
197
230
|
if (value === null) return null;
|
|
198
231
|
var more = this.getCompressedBound();
|
|
199
|
-
return _react.default.createElement(
|
|
232
|
+
return _react.default.createElement(Item, {
|
|
200
233
|
key: index,
|
|
201
234
|
only: more === 1,
|
|
202
235
|
value: value,
|
|
@@ -419,6 +452,7 @@ Result.propTypes = {
|
|
|
419
452
|
setInputReset: _propTypes.default.func,
|
|
420
453
|
bindFocusInputFunc: _propTypes.default.func,
|
|
421
454
|
// collapse: PropTypes.func,
|
|
455
|
+
data: _propTypes.default.array,
|
|
422
456
|
compressed: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
|
|
423
457
|
compressedBound: _propTypes.default.number,
|
|
424
458
|
trim: _propTypes.default.bool,
|
package/css/index.d.ts
CHANGED