tntd 1.4.32 → 1.4.33-beta.1
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/components/Ellipsis/index.js +47 -15
- package/components/QueryListScene/QueryForm.js +4 -4
- package/components/QueryListScene/createActions.js +4 -4
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24089 -23289
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +7 -10
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +79 -111
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +33 -40
- package/es/DevelopmentLogin/LoginModal.js +33 -46
- package/es/DevelopmentLogin/index.js +14 -18
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +100 -79
- package/es/Handle/index.js +46 -64
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +12 -15
- package/es/Img/Contain.js +26 -31
- package/es/Img/Cover.js +43 -57
- package/es/Img/index.js +39 -48
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +39 -94
- package/es/Layout/Application.js +28 -74
- package/es/Layout/Avatar.js +30 -67
- package/es/Layout/CompatibleLanguage.js +41 -96
- package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
- package/es/Layout/EnterpriseLayout/Language.js +16 -34
- package/es/Layout/EnterpriseLayout/Theme.js +18 -36
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
- package/es/Layout/GlobalNavigation/index.js +22 -56
- package/es/Layout/Header.js +26 -47
- package/es/Layout/HeaderActions.js +45 -59
- package/es/Layout/HeaderNavs.js +24 -51
- package/es/Layout/HeaderTabs.js +53 -106
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +16 -34
- package/es/Layout/Layout.js +88 -110
- package/es/Layout/Logo.js +17 -33
- package/es/Layout/OrgAppList.js +64 -109
- package/es/Layout/SideMenu.js +67 -128
- package/es/Layout/Theme.js +25 -63
- package/es/Layout/index.js +28 -37
- package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
- package/es/Layout/paaslayout/Header.js +23 -46
- package/es/Layout/paaslayout/Logo.js +4 -14
- package/es/Layout/paaslayout/SideMenu.js +41 -80
- package/es/Layout/paaslayout/index.js +77 -104
- package/es/Layout/storage.js +10 -9
- package/es/LoadingButton/index.js +18 -27
- package/es/Modal/index.js +42 -51
- package/es/Page/Box.js +36 -43
- package/es/Page/index.js +56 -71
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +7 -11
- package/es/QueryForm/Field/Select.js +34 -44
- package/es/QueryForm/Field/SelectInput.js +31 -46
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +46 -78
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +79 -140
- package/es/QueryListScene/List.js +83 -139
- package/es/QueryListScene/QueryForm.js +54 -91
- package/es/QueryListScene/QueryListScene.js +29 -47
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +13 -14
- package/es/QueryListScene/createActions.js +4 -4
- package/es/Select/DropDownWrap.js +32 -55
- package/es/Select/index.js +140 -232
- package/es/Table/ResizableTable/index.js +29 -43
- package/es/Table/index.js +20 -19
- package/es/Title/index.js +23 -25
- package/es/locale.js +1 -5
- package/es/utils/checkAuth.js +6 -8
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +17 -27
- package/lib/ArrayInput/icon.js +7 -9
- package/lib/ArrayInput/index.js +82 -131
- package/lib/AuthContext.js +2 -6
- package/lib/Columns/index.js +36 -54
- package/lib/DevelopmentLogin/LoginModal.js +36 -63
- package/lib/DevelopmentLogin/index.js +21 -31
- package/lib/Ellipsis/Svg/CopySVG.js +15 -18
- package/lib/Ellipsis/Svg/TickSVG.js +10 -13
- package/lib/Ellipsis/index.js +105 -93
- package/lib/Handle/index.js +51 -87
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/iconList.js +1 -2
- package/lib/Icon/index.js +16 -26
- package/lib/Img/Contain.js +29 -40
- package/lib/Img/Cover.js +48 -72
- package/lib/Img/index.js +42 -58
- package/lib/Layout/ActionsContext.js +1 -5
- package/lib/Layout/AppList.js +45 -124
- package/lib/Layout/Application.js +31 -92
- package/lib/Layout/Avatar.js +36 -91
- package/lib/Layout/CompatibleLanguage.js +44 -116
- package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
- package/lib/Layout/EnterpriseLayout/Language.js +22 -54
- package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
- package/lib/Layout/EnterpriseLayout/index.js +17 -27
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
- package/lib/Layout/GlobalNavigation/index.js +28 -80
- package/lib/Layout/Header.js +36 -68
- package/lib/Layout/HeaderActions.js +51 -81
- package/lib/Layout/HeaderNavs.js +30 -70
- package/lib/Layout/HeaderTabs.js +58 -127
- package/lib/Layout/Iconfont.js +4 -9
- package/lib/Layout/Language.js +22 -54
- package/lib/Layout/Layout.js +93 -134
- package/lib/Layout/Logo.js +26 -47
- package/lib/Layout/OrgAppList.js +69 -133
- package/lib/Layout/SideMenu.js +72 -151
- package/lib/Layout/Theme.js +28 -79
- package/lib/Layout/createActions.js +3 -9
- package/lib/Layout/images/index.js +5 -36
- package/lib/Layout/index.js +35 -63
- package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
- package/lib/Layout/paaslayout/Header.js +30 -60
- package/lib/Layout/paaslayout/Logo.js +11 -24
- package/lib/Layout/paaslayout/SideMenu.js +44 -93
- package/lib/Layout/paaslayout/index.js +82 -128
- package/lib/Layout/storage.js +26 -68
- package/lib/LoadingButton/index.js +21 -36
- package/lib/Modal/index.js +45 -62
- package/lib/Page/Box.js +38 -50
- package/lib/Page/index.js +58 -84
- package/lib/Page/utils.js +5 -16
- package/lib/QueryForm/Field/Checkbox.js +10 -19
- package/lib/QueryForm/Field/Select.js +39 -60
- package/lib/QueryForm/Field/SelectInput.js +36 -65
- package/lib/QueryForm/Field/fieldsMap.js +6 -23
- package/lib/QueryForm/Field/index.js +50 -91
- package/lib/QueryForm/createActions.js +9 -16
- package/lib/QueryForm/index.js +83 -165
- package/lib/QueryForm/useForm.js +1 -6
- package/lib/QueryListScene/List.js +89 -153
- package/lib/QueryListScene/QueryForm.js +58 -101
- package/lib/QueryListScene/QueryListScene.js +31 -56
- package/lib/QueryListScene/Title.js +6 -11
- package/lib/QueryListScene/Toolbar.js +16 -22
- package/lib/QueryListScene/createActions.js +7 -13
- package/lib/QueryListScene/index.js +5 -19
- package/lib/QueryListScene/useActions.js +1 -6
- package/lib/Select/DropDownWrap.js +35 -63
- package/lib/Select/index.js +142 -245
- package/lib/Table/ResizableTable/index.js +31 -54
- package/lib/Table/index.js +21 -34
- package/lib/Title/index.js +26 -34
- package/lib/index.js +36 -57
- package/lib/locale.js +9 -25
- package/lib/utils/checkAuth.js +9 -16
- package/lib/utils/findMenuInfoByPath.js +3 -12
- package/lib/utils/index.js +26 -60
- package/package.json +3 -2
package/lib/Select/index.js
CHANGED
|
@@ -1,61 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
require("antd/lib/empty/style");
|
|
9
|
-
|
|
10
9
|
var _empty = _interopRequireDefault(require("antd/lib/empty"));
|
|
11
|
-
|
|
12
10
|
require("antd/lib/select/style");
|
|
13
|
-
|
|
14
11
|
var _select = _interopRequireDefault(require("antd/lib/select"));
|
|
15
|
-
|
|
16
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
13
|
var _DropDownWrap = _interopRequireDefault(require("./DropDownWrap"));
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
43
|
-
|
|
44
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
45
|
-
|
|
46
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
47
|
-
|
|
48
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
-
|
|
52
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
53
|
-
|
|
54
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
55
|
-
|
|
14
|
+
var _excluded = ["dropdownStyle", "optionLabelProp", "dropdownClassName"];
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
24
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
25
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
26
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
27
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
28
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
30
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
31
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
32
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
33
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
34
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
35
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
56
36
|
// 页面实际渲染的下拉菜单数量,实际为 2 * ITEM_ELEMENT_NUMBER
|
|
57
|
-
var ITEM_ELEMENT_NUMBER = 30;
|
|
58
|
-
|
|
37
|
+
var ITEM_ELEMENT_NUMBER = 30;
|
|
38
|
+
// Select size 配置
|
|
59
39
|
var ITEM_HEIGHT_CFG = {
|
|
60
40
|
small: 24,
|
|
61
41
|
large: 40,
|
|
@@ -67,23 +47,14 @@ var ARROW_CODE = {
|
|
|
67
47
|
};
|
|
68
48
|
var DROPDOWN_HEIGHT = 224;
|
|
69
49
|
var Option = _select["default"].Option;
|
|
70
|
-
|
|
71
|
-
var SuperSelect =
|
|
72
|
-
/*#__PURE__*/
|
|
73
|
-
function (_PureComponent) {
|
|
74
|
-
_inherits(SuperSelect, _PureComponent);
|
|
75
|
-
|
|
50
|
+
var SuperSelect = /*#__PURE__*/function (_PureComponent) {
|
|
76
51
|
function SuperSelect(props) {
|
|
77
52
|
var _this;
|
|
78
|
-
|
|
79
53
|
_classCallCheck(this, SuperSelect);
|
|
80
|
-
|
|
81
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(SuperSelect).call(this, props));
|
|
82
|
-
|
|
54
|
+
_this = _callSuper(this, SuperSelect, [props]);
|
|
83
55
|
_this.turnChildren = function (children) {
|
|
84
56
|
if (!children) return [];
|
|
85
57
|
var arr = [];
|
|
86
|
-
|
|
87
58
|
if (children && children.props) {
|
|
88
59
|
arr.push(children);
|
|
89
60
|
} else {
|
|
@@ -97,61 +68,47 @@ function (_PureComponent) {
|
|
|
97
68
|
}
|
|
98
69
|
});
|
|
99
70
|
}
|
|
100
|
-
|
|
101
71
|
return arr;
|
|
102
72
|
};
|
|
103
|
-
|
|
104
73
|
_this.formulaWidth = function () {
|
|
105
74
|
// 获取dom设置宽度
|
|
106
75
|
var _this$props = _this.props,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
76
|
+
arr2 = _this$props.children,
|
|
77
|
+
_this$props$dropdownM = _this$props.dropdownMatchSelectWidth,
|
|
78
|
+
dropdownMatchSelectWidth = _this$props$dropdownM === void 0 ? true : _this$props$dropdownM,
|
|
79
|
+
maxWidth = _this$props.maxWidth;
|
|
111
80
|
var selectDom = document.getElementById(_this.id);
|
|
112
81
|
var selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
|
|
113
82
|
var arr = [];
|
|
114
83
|
var formulaMaxWidth = 10;
|
|
115
|
-
|
|
116
84
|
if (!dropdownMatchSelectWidth) {
|
|
117
85
|
formulaMaxWidth = maxWidth || 10;
|
|
118
86
|
}
|
|
119
|
-
|
|
120
87
|
if (!dropdownMatchSelectWidth && !maxWidth) {
|
|
121
88
|
var children = _this.turnChildren(arr2);
|
|
122
|
-
|
|
123
89
|
for (var i = 0; i < children.length; i++) {
|
|
124
90
|
var val = children[i].props.children;
|
|
125
|
-
|
|
126
91
|
var textWidth = _this.getTextPixelWith(val);
|
|
127
|
-
|
|
128
92
|
arr.push(textWidth.toFixed(2));
|
|
129
93
|
}
|
|
130
|
-
|
|
131
94
|
if (arr.length > 0) {
|
|
132
95
|
formulaMaxWidth = Math.max.apply(Math, arr);
|
|
133
96
|
}
|
|
134
97
|
}
|
|
135
|
-
|
|
136
98
|
_this.setState({
|
|
137
99
|
selectWidth: selectWidth,
|
|
138
100
|
maxWidth: formulaMaxWidth
|
|
139
101
|
});
|
|
140
102
|
};
|
|
141
|
-
|
|
103
|
+
// 获取单行文本的像素宽度
|
|
142
104
|
_this.getTextPixelWith = function (text) {
|
|
143
105
|
var fontStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '14px';
|
|
144
106
|
var canvas = document.createElement('canvas'); // 创建 canvas 画布
|
|
145
|
-
|
|
146
107
|
var context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
|
|
147
|
-
|
|
148
108
|
context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
|
|
149
|
-
|
|
150
109
|
var dimension = context.measureText(text); // 测量文字
|
|
151
|
-
|
|
152
110
|
return dimension.width;
|
|
153
111
|
};
|
|
154
|
-
|
|
155
112
|
_this.getItemStyle = function (i) {
|
|
156
113
|
return {
|
|
157
114
|
position: 'absolute',
|
|
@@ -160,91 +117,75 @@ function (_PureComponent) {
|
|
|
160
117
|
height: _this.ITEM_HEIGHT
|
|
161
118
|
};
|
|
162
119
|
};
|
|
163
|
-
|
|
164
120
|
_this.addEvent = function () {
|
|
165
|
-
_this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName));
|
|
166
|
-
|
|
121
|
+
_this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName));
|
|
122
|
+
// 下拉菜单未展开时元素不存在
|
|
167
123
|
if (!_this.scrollEle) return;
|
|
168
|
-
|
|
169
124
|
_this.scrollEle.addEventListener('scroll', _this.onScroll, false);
|
|
170
|
-
|
|
171
125
|
_this.inputEle = document.querySelector("#".concat(_this.id));
|
|
172
126
|
if (!_this.inputEle) return;
|
|
173
|
-
|
|
174
127
|
_this.inputEle.addEventListener('keydown', _this.onKeyDown, false);
|
|
175
128
|
};
|
|
176
|
-
|
|
129
|
+
// 模拟 antd select 按下 上下箭头 键时滚动列表
|
|
177
130
|
_this.onKeyDown = function (e) {
|
|
178
131
|
var _ref = e || {},
|
|
179
|
-
|
|
180
|
-
|
|
132
|
+
keyCode = _ref.keyCode;
|
|
181
133
|
setTimeout(function () {
|
|
182
134
|
var activeItem = document.querySelector(".".concat(_this.dropdownClassName, " .ant-select-dropdown-menu-item-active"));
|
|
183
135
|
if (!activeItem) return;
|
|
184
136
|
var offsetTop = activeItem.offsetTop;
|
|
185
137
|
var isUp = ARROW_CODE[keyCode] === 'up';
|
|
186
|
-
var isDown = ARROW_CODE[keyCode] === 'down';
|
|
138
|
+
var isDown = ARROW_CODE[keyCode] === 'down';
|
|
187
139
|
|
|
140
|
+
// 在所有列表第一行按上键
|
|
188
141
|
if (offsetTop - _this.prevTop > DROPDOWN_HEIGHT && isUp) {
|
|
189
142
|
_this.scrollEle.scrollTo(0, _this.allHeight - DROPDOWN_HEIGHT);
|
|
190
|
-
|
|
191
143
|
_this.prevTop = _this.allHeight;
|
|
192
144
|
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
145
|
+
}
|
|
195
146
|
|
|
147
|
+
// 在所有列表中最后一行按下键
|
|
196
148
|
if (_this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown) {
|
|
197
149
|
_this.scrollEle.scrollTo(0, 0);
|
|
198
|
-
|
|
199
150
|
_this.prevTop = 0;
|
|
200
151
|
return;
|
|
201
152
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
153
|
+
_this.prevTop = offsetTop;
|
|
154
|
+
// 向下滚动到下拉框最后一行时,向下滚动一行的高度
|
|
205
155
|
if (offsetTop > _this.scrollEle.scrollTop + DROPDOWN_HEIGHT - _this.ITEM_HEIGHT + 10 && isDown) {
|
|
206
156
|
_this.scrollEle.scrollTo(0, _this.scrollTop + _this.ITEM_HEIGHT);
|
|
207
|
-
|
|
208
157
|
return;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
158
|
+
}
|
|
159
|
+
// 向上滚动到下拉框第一一行时,向上滚动一行的高度
|
|
212
160
|
if (offsetTop < _this.scrollEle.scrollTop && isUp) {
|
|
213
161
|
_this.scrollEle.scrollTo(0, _this.scrollTop - _this.ITEM_HEIGHT);
|
|
214
162
|
}
|
|
215
163
|
}, 100);
|
|
216
164
|
};
|
|
217
|
-
|
|
218
165
|
_this.onScroll = function () {
|
|
219
166
|
return _this.throttleByHeight(_this.onScrollReal);
|
|
220
167
|
};
|
|
221
|
-
|
|
222
168
|
_this.onScrollReal = function () {
|
|
223
169
|
_this.allList = _this.getUseChildrenList();
|
|
224
|
-
|
|
225
170
|
var _this$getStartAndEndI = _this.getStartAndEndIndex(),
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
171
|
+
startIndex = _this$getStartAndEndI.startIndex,
|
|
172
|
+
endIndex = _this$getStartAndEndI.endIndex;
|
|
173
|
+
_this.prevScrollTop = _this.scrollTop;
|
|
174
|
+
// 重新渲染列表组件 Wrap
|
|
231
175
|
var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
|
|
232
|
-
|
|
233
176
|
_this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
234
177
|
};
|
|
235
|
-
|
|
236
178
|
_this.throttleByHeight = function () {
|
|
237
|
-
_this.scrollTop = _this.scrollEle.scrollTop;
|
|
238
|
-
|
|
179
|
+
_this.scrollTop = _this.scrollEle.scrollTop;
|
|
180
|
+
// 滚动的高度
|
|
239
181
|
var delta = _this.prevScrollTop - _this.scrollTop;
|
|
240
182
|
delta = delta < 0 ? 0 - delta : delta;
|
|
241
183
|
delta > _this.reactDelta && _this.onScrollReal();
|
|
242
184
|
};
|
|
243
|
-
|
|
185
|
+
// 列表可展示所有 children
|
|
244
186
|
_this.getUseChildrenList = function () {
|
|
245
187
|
return _this.state.filterChildren || _this.state.children;
|
|
246
188
|
};
|
|
247
|
-
|
|
248
189
|
_this.getStartAndEndIndex = function () {
|
|
249
190
|
// 滚动后显示在列表可视区中的第一个 item 的 index
|
|
250
191
|
var showIndex = Number((_this.scrollTop / _this.ITEM_HEIGHT).toFixed(0));
|
|
@@ -255,74 +196,67 @@ function (_PureComponent) {
|
|
|
255
196
|
endIndex: endIndex
|
|
256
197
|
};
|
|
257
198
|
};
|
|
258
|
-
|
|
199
|
+
// 须使用 setTimeout 确保在 dom 加载完成之后添加事件
|
|
259
200
|
_this.setSuperDrowDownMenu = function (visible) {
|
|
260
201
|
if (!visible) return;
|
|
261
202
|
_this.allList = _this.getUseChildrenList();
|
|
262
|
-
|
|
263
203
|
if (!_this.eventTimer || !_this.scrollEle) {
|
|
264
204
|
_this.eventTimer = setTimeout(function () {
|
|
265
205
|
return _this.addEvent();
|
|
266
206
|
}, 0);
|
|
267
207
|
} else {
|
|
268
|
-
var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
|
|
269
|
-
|
|
208
|
+
var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
|
|
209
|
+
// 下拉列表单独重新渲染
|
|
270
210
|
var _this$getStartAndEndI2 = _this.getStartAndEndIndex(),
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
211
|
+
startIndex = _this$getStartAndEndI2.startIndex,
|
|
212
|
+
endIndex = _this$getStartAndEndI2.endIndex;
|
|
274
213
|
setTimeout(function () {
|
|
275
214
|
_this.wrap && _this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
276
215
|
}, 0);
|
|
277
216
|
}
|
|
278
217
|
};
|
|
279
|
-
|
|
280
218
|
_this.onDropdownVisibleChange = function (visible) {
|
|
281
219
|
var onDropdownVisibleChange = _this.props.onDropdownVisibleChange;
|
|
282
220
|
onDropdownVisibleChange && onDropdownVisibleChange(visible);
|
|
283
221
|
var _this$state = _this.state,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
222
|
+
value = _this$state.value,
|
|
223
|
+
children = _this$state.children;
|
|
224
|
+
// 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
|
|
287
225
|
if (!visible) {
|
|
288
226
|
// 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
|
|
289
227
|
setTimeout(function () {
|
|
290
228
|
_this.setState({
|
|
291
229
|
filterChildren: null
|
|
292
230
|
});
|
|
293
|
-
|
|
294
231
|
_this.setDefaultScrollTop(value);
|
|
295
|
-
}, 100);
|
|
232
|
+
}, 100);
|
|
233
|
+
// this.removeEvent();
|
|
296
234
|
} else {
|
|
297
235
|
// this.addEvent();
|
|
298
236
|
if (value) {
|
|
299
237
|
// 如果已有 value, 设置默认滚动位置
|
|
300
|
-
_this.setDefaultScrollTop();
|
|
301
|
-
|
|
302
|
-
|
|
238
|
+
_this.setDefaultScrollTop();
|
|
239
|
+
// 设置下拉列表显示数据
|
|
303
240
|
_this.setSuperDrowDownMenu(visible);
|
|
304
241
|
} else if (!value && value !== 0 && children && children.length > 0) {
|
|
305
242
|
// 无数据时,下拉回归至第一个
|
|
306
243
|
var val = children[0].props.value;
|
|
307
|
-
|
|
308
244
|
_this.setDefaultScrollTop(val);
|
|
309
245
|
}
|
|
310
246
|
}
|
|
311
247
|
};
|
|
312
|
-
|
|
313
248
|
_this.onDeselect = function (value) {
|
|
314
249
|
var onDeselect = _this.props.onDeselect;
|
|
315
250
|
onDeselect && onDeselect(value);
|
|
316
251
|
};
|
|
317
|
-
|
|
252
|
+
// 在搜索重新计算下拉滚动条高度
|
|
318
253
|
_this.onChange = function (value, opt) {
|
|
319
254
|
var _this$props2 = _this.props,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
255
|
+
showSearch = _this$props2.showSearch,
|
|
256
|
+
onChange = _this$props2.onChange,
|
|
257
|
+
autoClearSearchValue = _this$props2.autoClearSearchValue,
|
|
258
|
+
maxCount = _this$props2.maxCount,
|
|
259
|
+
mode = _this$props2.mode;
|
|
326
260
|
if (showSearch || _this.isMultiple) {
|
|
327
261
|
// 搜索模式下选择后是否需要重置搜索状态
|
|
328
262
|
if (autoClearSearchValue !== false) {
|
|
@@ -334,7 +268,6 @@ function (_PureComponent) {
|
|
|
334
268
|
});
|
|
335
269
|
}
|
|
336
270
|
}
|
|
337
|
-
|
|
338
271
|
if (mode === 'multiple') {
|
|
339
272
|
if (value.length <= maxCount) {
|
|
340
273
|
_this.setState({
|
|
@@ -346,27 +279,21 @@ function (_PureComponent) {
|
|
|
346
279
|
value: value
|
|
347
280
|
});
|
|
348
281
|
}
|
|
349
|
-
|
|
350
282
|
onChange && onChange(value, opt);
|
|
351
|
-
|
|
352
283
|
if (mode !== 'multiple') {
|
|
353
284
|
_this.select && _this.select.blur();
|
|
354
285
|
}
|
|
355
286
|
};
|
|
356
|
-
|
|
357
287
|
_this.onSearch = function (v) {
|
|
358
288
|
var _this$props3 = _this.props,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
289
|
+
showSearch = _this$props3.showSearch,
|
|
290
|
+
onSearch = _this$props3.onSearch,
|
|
291
|
+
filterOption = _this$props3.filterOption,
|
|
292
|
+
arr = _this$props3.children;
|
|
364
293
|
var children = _this.turnChildren(arr);
|
|
365
|
-
|
|
366
294
|
if (showSearch && filterOption !== false) {
|
|
367
295
|
// 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
|
|
368
296
|
var filterChildren = null;
|
|
369
|
-
|
|
370
297
|
if (typeof filterOption === 'function') {
|
|
371
298
|
filterChildren = children.filter(function (item) {
|
|
372
299
|
return filterOption(v, item);
|
|
@@ -375,17 +302,18 @@ function (_PureComponent) {
|
|
|
375
302
|
filterChildren = children.filter(function (item) {
|
|
376
303
|
return _this.filterOption(v, item);
|
|
377
304
|
});
|
|
378
|
-
}
|
|
379
|
-
|
|
305
|
+
}
|
|
380
306
|
|
|
307
|
+
// 搜索框有值,去除disabled=true的children
|
|
381
308
|
var newFilterChild = [];
|
|
382
309
|
filterChildren && filterChildren.forEach(function (item, index) {
|
|
383
310
|
if (!item.props.disabled) {
|
|
384
311
|
newFilterChild.push(item);
|
|
385
312
|
}
|
|
386
313
|
});
|
|
387
|
-
filterChildren = newFilterChild;
|
|
314
|
+
filterChildren = newFilterChild;
|
|
388
315
|
|
|
316
|
+
// 设置下拉列表显示数据
|
|
389
317
|
_this.setState({
|
|
390
318
|
filterChildren: v === '' ? null : filterChildren
|
|
391
319
|
}, function () {
|
|
@@ -393,77 +321,62 @@ function (_PureComponent) {
|
|
|
393
321
|
// 搜索后需要重置滚动位置到0,防止上次 scrollTop 位置无数据
|
|
394
322
|
if (filterChildren) {
|
|
395
323
|
_this.scrollTop = 0;
|
|
396
|
-
|
|
397
324
|
_this.scrollEle.scrollTo(0, 0);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
325
|
+
}
|
|
326
|
+
// 搜索成功后需要重新设置列表的总高度
|
|
401
327
|
_this.setSuperDrowDownMenu(true);
|
|
402
328
|
}, 0);
|
|
403
329
|
});
|
|
404
330
|
}
|
|
405
|
-
|
|
406
331
|
onSearch && onSearch(v);
|
|
407
332
|
};
|
|
408
|
-
|
|
409
333
|
_this.filterOption = function (v, option) {
|
|
410
334
|
// 自定义过滤对应的 option 属性配置
|
|
411
335
|
var filterProps = _this.props.optionFilterProp || 'value';
|
|
412
336
|
return "".concat(option.props[filterProps]).indexOf(v) >= 0;
|
|
413
337
|
};
|
|
414
|
-
|
|
415
338
|
_this.setDefaultScrollTop = function (data) {
|
|
416
339
|
var value = _this.state.value;
|
|
417
340
|
var arr = _this.props.children;
|
|
418
|
-
|
|
419
341
|
var children = _this.turnChildren(arr);
|
|
420
|
-
|
|
421
342
|
var val = data || data === 0 ? data : value;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
|
|
428
|
-
var _ret = function () {
|
|
343
|
+
var _loop = function _loop() {
|
|
344
|
+
var item = children[i];
|
|
345
|
+
var itemValue = item.props.value;
|
|
346
|
+
if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
|
|
429
347
|
var targetScrollTop = i * _this.ITEM_HEIGHT;
|
|
430
348
|
setTimeout(function () {
|
|
431
349
|
if (!_this.scrollEle) {
|
|
432
350
|
_this.addEvent();
|
|
433
351
|
}
|
|
434
|
-
|
|
435
352
|
_this.scrollEle && _this.scrollEle.scrollTo(0, targetScrollTop);
|
|
436
353
|
}, 100);
|
|
437
354
|
return {
|
|
438
355
|
v: void 0
|
|
439
356
|
};
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
_ret;
|
|
360
|
+
for (var i = 0; i < children.length; i++) {
|
|
361
|
+
_ret = _loop();
|
|
362
|
+
if (_ret) return _ret.v;
|
|
444
363
|
}
|
|
445
364
|
};
|
|
446
|
-
|
|
447
365
|
_this.removeEvent = function () {
|
|
448
366
|
if (!_this.scrollEle) return;
|
|
449
|
-
|
|
450
367
|
_this.scrollEle.removeEventListener('scroll', _this.onScroll, false);
|
|
451
|
-
|
|
452
368
|
if (!_this.inputEle) return;
|
|
453
|
-
|
|
454
369
|
_this.inputEle.removeEventListener('keydown', _this.onKeyDown, false);
|
|
455
370
|
};
|
|
456
|
-
|
|
457
371
|
var _mode = props.mode,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
372
|
+
defaultValue = props.defaultValue,
|
|
373
|
+
_value = props.value,
|
|
374
|
+
optionHeight = props.optionHeight,
|
|
375
|
+
_arr = props.children;
|
|
462
376
|
_this.isMultiple = ['tags', 'multiple'].includes(_mode);
|
|
377
|
+
var _children = _this.turnChildren(_arr);
|
|
463
378
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
379
|
+
// 设置默认 value
|
|
467
380
|
var defaultV = _this.isMultiple ? [] : '';
|
|
468
381
|
defaultV = _value || defaultValue || defaultV;
|
|
469
382
|
_this.state = {
|
|
@@ -473,62 +386,60 @@ function (_PureComponent) {
|
|
|
473
386
|
value: defaultV,
|
|
474
387
|
maxWidth: null,
|
|
475
388
|
selectWidth: null
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
_this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
|
|
479
|
-
|
|
480
|
-
_this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
|
|
481
|
-
|
|
482
|
-
_this.reactDelta = _this.visibleDomHeight / 3;
|
|
483
|
-
|
|
484
|
-
_this.isStopReact = false;
|
|
485
|
-
|
|
486
|
-
_this.prevScrollTop = 0;
|
|
487
|
-
|
|
389
|
+
};
|
|
390
|
+
// 下拉菜单项行高
|
|
391
|
+
_this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
|
|
392
|
+
// 可视区 dom 高度
|
|
393
|
+
_this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
|
|
394
|
+
// 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
|
|
395
|
+
_this.reactDelta = _this.visibleDomHeight / 3;
|
|
396
|
+
// 是否拖动滚动条快速滚动状态
|
|
397
|
+
_this.isStopReact = false;
|
|
398
|
+
// 上一次滚动的 scrollTop 值
|
|
399
|
+
_this.prevScrollTop = 0;
|
|
400
|
+
// 上一次按下方向键时 scrollTop 值
|
|
488
401
|
_this.prevTop = 0;
|
|
489
|
-
_this.scrollTop = 0;
|
|
402
|
+
_this.scrollTop = 0;
|
|
490
403
|
|
|
404
|
+
// className
|
|
491
405
|
_this.dropdownClassName = "dc".concat(+new Date());
|
|
492
406
|
_this.id = "sid".concat(+new Date());
|
|
493
407
|
return _this;
|
|
494
408
|
}
|
|
495
|
-
|
|
496
|
-
_createClass(SuperSelect, [{
|
|
409
|
+
_inherits(SuperSelect, _PureComponent);
|
|
410
|
+
return _createClass(SuperSelect, [{
|
|
497
411
|
key: "componentDidMount",
|
|
498
412
|
value: function componentDidMount() {
|
|
499
413
|
var _this2 = this;
|
|
500
|
-
|
|
501
414
|
// defaultOpens=true 时添加滚动事件
|
|
502
415
|
setTimeout(function () {
|
|
503
416
|
_this2.addEvent();
|
|
504
417
|
}, 500);
|
|
505
418
|
var arr = this.props.children;
|
|
506
|
-
var children = this.turnChildren(arr);
|
|
507
|
-
|
|
508
|
-
this.formulaWidth();
|
|
419
|
+
var children = this.turnChildren(arr);
|
|
420
|
+
// if (children && children.length > 0) {
|
|
421
|
+
this.formulaWidth();
|
|
422
|
+
// }
|
|
509
423
|
}
|
|
510
424
|
}, {
|
|
511
425
|
key: "componentDidUpdate",
|
|
512
426
|
value: function componentDidUpdate(prevProps) {
|
|
513
427
|
var _this$props4 = this.props,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
428
|
+
mode = _this$props4.mode,
|
|
429
|
+
defaultValue = _this$props4.defaultValue,
|
|
430
|
+
value = _this$props4.value,
|
|
431
|
+
children = _this$props4.children;
|
|
518
432
|
var arr = this.turnChildren(children);
|
|
519
|
-
|
|
520
433
|
if (prevProps.children !== children) {
|
|
521
434
|
this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
522
435
|
this.setState({
|
|
523
436
|
children: arr || [],
|
|
524
437
|
filterChildren: null
|
|
525
438
|
});
|
|
526
|
-
|
|
527
439
|
if (arr && arr.length > 0) {
|
|
528
440
|
this.formulaWidth();
|
|
529
441
|
}
|
|
530
442
|
}
|
|
531
|
-
|
|
532
443
|
if (prevProps.value !== value) {
|
|
533
444
|
// 更新时设置默认 value
|
|
534
445
|
var defaultV = this.isMultiple ? [] : '';
|
|
@@ -547,52 +458,44 @@ function (_PureComponent) {
|
|
|
547
458
|
key: "render",
|
|
548
459
|
value: function render() {
|
|
549
460
|
var _this3 = this;
|
|
550
|
-
|
|
551
461
|
var _this$state2 = this.state,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
462
|
+
maxWidth = _this$state2.maxWidth,
|
|
463
|
+
selectWidth = _this$state2.selectWidth;
|
|
555
464
|
var _this$props5 = this.props,
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
465
|
+
dropdownStyle = _this$props5.dropdownStyle,
|
|
466
|
+
optionLabelProp = _this$props5.optionLabelProp,
|
|
467
|
+
dropdownClassName = _this$props5.dropdownClassName,
|
|
468
|
+
props = _objectWithoutProperties(_this$props5, _excluded);
|
|
561
469
|
this.allList = this.getUseChildrenList();
|
|
562
470
|
this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
|
|
563
|
-
|
|
564
471
|
var _this$getStartAndEndI3 = this.getStartAndEndIndex(),
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
472
|
+
startIndex = _this$getStartAndEndI3.startIndex,
|
|
473
|
+
endIndex = _this$getStartAndEndI3.endIndex;
|
|
568
474
|
var dynamicWidth = maxWidth;
|
|
569
|
-
|
|
570
475
|
if (this.allList.length === 0 || maxWidth < selectWidth) {
|
|
571
476
|
dynamicWidth = selectWidth;
|
|
572
477
|
}
|
|
573
|
-
|
|
574
|
-
dropdownStyle = _objectSpread({
|
|
478
|
+
dropdownStyle = _objectSpread(_objectSpread({
|
|
575
479
|
maxHeight: "".concat(DROPDOWN_HEIGHT, "px")
|
|
576
|
-
}, dropdownStyle, {
|
|
480
|
+
}, dropdownStyle), {}, {
|
|
577
481
|
overflow: 'auto',
|
|
578
482
|
position: 'relative',
|
|
579
483
|
maxWidth: dynamicWidth
|
|
580
484
|
});
|
|
581
|
-
var value = this.state.value;
|
|
582
|
-
|
|
583
|
-
var _props = _objectSpread({}, props);
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
delete _props.value; // value 为空字符会隐藏 placeholder,改为 undefined
|
|
485
|
+
var value = this.state.value;
|
|
486
|
+
// 判断处于 antd Form 中时不自动设置 value
|
|
487
|
+
var _props = _objectSpread({}, props);
|
|
488
|
+
// 先删除 value,再手动赋值,防止空 value 影响 placeholder
|
|
489
|
+
delete _props.value;
|
|
587
490
|
|
|
491
|
+
// value 为空字符会隐藏 placeholder,改为 undefined
|
|
588
492
|
if (typeof value === 'string' && !value) {
|
|
589
493
|
_props.value = undefined;
|
|
590
494
|
} else {
|
|
591
495
|
_props.value = value;
|
|
592
496
|
}
|
|
593
|
-
|
|
594
497
|
optionLabelProp = optionLabelProp || 'children';
|
|
595
|
-
return _react["default"].createElement(_select["default"], _extends({}, _props, {
|
|
498
|
+
return /*#__PURE__*/_react["default"].createElement(_select["default"], _extends({}, _props, {
|
|
596
499
|
id: this.id,
|
|
597
500
|
onSearch: this.onSearch,
|
|
598
501
|
onChange: this.onChange,
|
|
@@ -606,34 +509,28 @@ function (_PureComponent) {
|
|
|
606
509
|
},
|
|
607
510
|
dropdownRender: function dropdownRender(menu, props) {
|
|
608
511
|
if (_this3.allList.length === 0) {
|
|
609
|
-
return _react["default"].createElement("div", {
|
|
512
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
610
513
|
style: {
|
|
611
514
|
padding: '5px 12px'
|
|
612
515
|
}
|
|
613
|
-
}, _react["default"].createElement(_empty["default"], {
|
|
516
|
+
}, /*#__PURE__*/_react["default"].createElement(_empty["default"], {
|
|
614
517
|
image: _empty["default"].PRESENTED_IMAGE_SIMPLE
|
|
615
518
|
}));
|
|
616
519
|
}
|
|
617
|
-
|
|
618
|
-
return _react["default"].createElement(_DropDownWrap["default"], _extends({
|
|
520
|
+
return /*#__PURE__*/_react["default"].createElement(_DropDownWrap["default"], {
|
|
619
521
|
startIndex: startIndex,
|
|
620
522
|
endIndex: endIndex,
|
|
621
523
|
allHeight: _this3.allHeight,
|
|
622
524
|
menu: menu,
|
|
623
|
-
itemHeight: _this3.ITEM_HEIGHT
|
|
624
|
-
}, {
|
|
525
|
+
itemHeight: _this3.ITEM_HEIGHT,
|
|
625
526
|
ref: function ref(ele) {
|
|
626
527
|
_this3.wrap = ele;
|
|
627
528
|
}
|
|
628
|
-
})
|
|
529
|
+
});
|
|
629
530
|
}
|
|
630
531
|
}), this.allList);
|
|
631
532
|
}
|
|
632
533
|
}]);
|
|
633
|
-
|
|
634
|
-
return SuperSelect;
|
|
635
534
|
}(_react.PureComponent);
|
|
636
|
-
|
|
637
535
|
SuperSelect.Option = Option;
|
|
638
|
-
var _default = SuperSelect;
|
|
639
|
-
exports["default"] = _default;
|
|
536
|
+
var _default = exports["default"] = SuperSelect;
|