@kdcloudjs/kdesign 1.7.28 → 1.7.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.
- package/CHANGELOG.md +30 -0
- package/dist/kdesign-complete.less +27 -8
- package/dist/kdesign.css +44 -7
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +175 -137
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +6 -6
- package/dist/kdesign.min.js.map +1 -1
- package/es/checkbox/checkbox.js +17 -12
- package/es/city-picker/city-picker.js +36 -22
- package/es/city-picker/style/index.css +4 -3
- package/es/city-picker/style/index.less +2 -1
- package/es/city-picker/style/token.less +3 -2
- package/es/grid/col.d.ts +1 -1
- package/es/grid/col.js +46 -31
- package/es/grid/row.d.ts +9 -1
- package/es/grid/row.js +20 -15
- package/es/select/select.js +10 -10
- package/es/select/style/index.css +39 -3
- package/es/select/style/index.less +15 -3
- package/es/select/style/mixin.less +6 -2
- package/lib/checkbox/checkbox.js +17 -12
- package/lib/city-picker/city-picker.js +36 -22
- package/lib/city-picker/style/index.css +4 -3
- package/lib/city-picker/style/index.less +2 -1
- package/lib/city-picker/style/token.less +3 -2
- package/lib/grid/col.d.ts +1 -1
- package/lib/grid/col.js +48 -33
- package/lib/grid/row.d.ts +9 -1
- package/lib/grid/row.js +24 -18
- package/lib/select/select.js +10 -10
- package/lib/select/style/index.css +39 -3
- package/lib/select/style/index.less +15 -3
- package/lib/select/style/mixin.less +6 -2
- package/package.json +1 -1
package/es/checkbox/checkbox.js
CHANGED
|
@@ -97,6 +97,17 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
97
97
|
}, []);
|
|
98
98
|
var getDefaultCheckbox = function getDefaultCheckbox() {
|
|
99
99
|
var _context20, _context21;
|
|
100
|
+
var inputProps = {
|
|
101
|
+
type: 'checkbox',
|
|
102
|
+
className: inputClassName,
|
|
103
|
+
onChange: handleChange,
|
|
104
|
+
checked: selected,
|
|
105
|
+
disabled: mergedDisabled,
|
|
106
|
+
name: mergedName
|
|
107
|
+
};
|
|
108
|
+
if ((value !== null && value !== void 0 ? value : '') !== '') {
|
|
109
|
+
inputProps.value = value;
|
|
110
|
+
}
|
|
100
111
|
return (
|
|
101
112
|
/*#__PURE__*/
|
|
102
113
|
// eslint-disable-next-line
|
|
@@ -106,30 +117,24 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
106
117
|
ref: labelRef
|
|
107
118
|
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
108
119
|
className: checkedWrapperClassName
|
|
109
|
-
}, selected
|
|
120
|
+
}, selected ? /*#__PURE__*/React.createElement("span", {
|
|
110
121
|
className: innerIconClassName
|
|
111
122
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
112
123
|
type: "right-bold",
|
|
113
124
|
className: _concatInstanceProperty(_context20 = "".concat(checkboxPrefixCls, "-")).call(_context20, mergedCheckboxType, "-inner-icon")
|
|
114
|
-
})), /*#__PURE__*/React.createElement("input", {
|
|
125
|
+
})) : null, /*#__PURE__*/React.createElement("input", _extends({
|
|
115
126
|
type: "checkbox",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
ref: ref,
|
|
119
|
-
value: value,
|
|
120
|
-
checked: selected,
|
|
121
|
-
disabled: mergedDisabled,
|
|
122
|
-
name: mergedName
|
|
123
|
-
})), children && /*#__PURE__*/React.createElement("span", {
|
|
127
|
+
ref: ref
|
|
128
|
+
}, inputProps))), children ? /*#__PURE__*/React.createElement("span", {
|
|
124
129
|
className: "".concat(checkboxPrefixCls, "-children")
|
|
125
|
-
}, children), !isDefaultType()
|
|
130
|
+
}, children) : null, !isDefaultType() ? /*#__PURE__*/React.createElement("span", {
|
|
126
131
|
className: triangleClassName
|
|
127
132
|
}, /*#__PURE__*/React.createElement("span", {
|
|
128
133
|
className: innerIconClassName
|
|
129
134
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
130
135
|
type: "right-bold",
|
|
131
136
|
className: _concatInstanceProperty(_context21 = "".concat(checkboxPrefixCls, "-")).call(_context21, mergedCheckboxType, "-inner-icon")
|
|
132
|
-
}))))
|
|
137
|
+
}))) : null)
|
|
133
138
|
);
|
|
134
139
|
};
|
|
135
140
|
return getDefaultCheckbox();
|
|
@@ -23,7 +23,7 @@ var getCityId = function getCityId(data) {
|
|
|
23
23
|
return data;
|
|
24
24
|
};
|
|
25
25
|
var InternalSelect = function InternalSelect(props, ref) {
|
|
26
|
-
var _context, _classNames3,
|
|
26
|
+
var _context, _classNames3, _classNames6;
|
|
27
27
|
var _useContext = useContext(ConfigContext),
|
|
28
28
|
getPrefixCls = _useContext.getPrefixCls,
|
|
29
29
|
prefixCls = _useContext.prefixCls,
|
|
@@ -102,14 +102,18 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
102
102
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
103
103
|
focusd = _useState6[0],
|
|
104
104
|
setFocusd = _useState6[1];
|
|
105
|
-
var _useState7 = useState(
|
|
105
|
+
var _useState7 = useState(false),
|
|
106
106
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var _useState9 = useState(
|
|
107
|
+
afterChangeFocus = _useState8[0],
|
|
108
|
+
setAfterChangeFocus = _useState8[1];
|
|
109
|
+
var _useState9 = useState(null),
|
|
110
110
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
seletedCity = _useState10[0],
|
|
112
|
+
setSeletedCity = _useState10[1];
|
|
113
|
+
var _useState11 = useState('domestic'),
|
|
114
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
115
|
+
tabsValue = _useState12[0],
|
|
116
|
+
setTabsValue = _useState12[1];
|
|
113
117
|
var isDomestic = function isDomestic(type) {
|
|
114
118
|
return type === 'domestic';
|
|
115
119
|
};
|
|
@@ -144,6 +148,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
144
148
|
var handleBlur = useCallback(function (e) {
|
|
145
149
|
e.stopPropagation();
|
|
146
150
|
setFocusd(false);
|
|
151
|
+
setAfterChangeFocus(false);
|
|
147
152
|
onBlur && onBlur(e);
|
|
148
153
|
}, [onBlur]);
|
|
149
154
|
useEffect(function () {
|
|
@@ -193,7 +198,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
193
198
|
className: "".concat(selectPrefixCls, "-icon-clear"),
|
|
194
199
|
ref: clearRef
|
|
195
200
|
}, clearIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
196
|
-
type: "close
|
|
201
|
+
type: "close"
|
|
197
202
|
})), showArrow && /*#__PURE__*/React.createElement("span", {
|
|
198
203
|
className: arrowIconCls
|
|
199
204
|
}, suffixIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -224,9 +229,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
224
229
|
}));
|
|
225
230
|
};
|
|
226
231
|
var handleOption = function handleOption(city) {
|
|
232
|
+
var _a;
|
|
227
233
|
handleVisibleChange(false);
|
|
228
234
|
city.type = tabsValue === 'domestic' ? 'domestic' : 'foreign';
|
|
229
235
|
(city === null || city === void 0 ? void 0 : city.id) !== initValue && (onChange === null || onChange === void 0 ? void 0 : onChange(city === null || city === void 0 ? void 0 : city.id, city));
|
|
236
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
237
|
+
setAfterChangeFocus(true);
|
|
230
238
|
if (typeof value === 'undefined') {
|
|
231
239
|
setSeletedCity(city);
|
|
232
240
|
setInitValue(city === null || city === void 0 ? void 0 : city.id);
|
|
@@ -239,7 +247,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
239
247
|
}
|
|
240
248
|
return /*#__PURE__*/React.createElement("div", {
|
|
241
249
|
className: "".concat(selectPrefixCls, "-list"),
|
|
242
|
-
ref: optionsListRef
|
|
250
|
+
ref: optionsListRef,
|
|
251
|
+
onMouseDown: function onMouseDown(e) {
|
|
252
|
+
return e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
253
|
+
}
|
|
243
254
|
}, _mapInstanceProperty(data).call(data, function (item, index) {
|
|
244
255
|
return /*#__PURE__*/React.createElement(Option, {
|
|
245
256
|
key: item.id,
|
|
@@ -310,9 +321,11 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
310
321
|
}
|
|
311
322
|
}, [type, tabsValue]);
|
|
312
323
|
var renderSingle = function renderSingle() {
|
|
324
|
+
var _classNames5;
|
|
313
325
|
var hiddenStyle = !!searchValue || (initValue !== null && initValue !== void 0 ? initValue : '') !== '' ? {
|
|
314
326
|
visibility: 'hidden'
|
|
315
327
|
} : undefined;
|
|
328
|
+
var itemCls = classNames((_classNames5 = {}, _defineProperty(_classNames5, "".concat(selectPrefixCls, "-content-item"), true), _defineProperty(_classNames5, "".concat(selectPrefixCls, "-content-item-seleted"), afterChangeFocus), _classNames5));
|
|
316
329
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
317
330
|
className: singleCls,
|
|
318
331
|
ref: selectionRef
|
|
@@ -329,18 +342,18 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
329
342
|
onBlur: handleBlur,
|
|
330
343
|
readOnly: !!disabled
|
|
331
344
|
}), !searchValue && /*#__PURE__*/React.createElement("span", {
|
|
332
|
-
className:
|
|
345
|
+
className: itemCls,
|
|
333
346
|
title: seletedCity === null || seletedCity === void 0 ? void 0 : seletedCity.name
|
|
334
347
|
}, seletedCity === null || seletedCity === void 0 ? void 0 : seletedCity.name)), !searchValue && /*#__PURE__*/React.createElement("span", {
|
|
335
348
|
className: "".concat(selectPrefixCls, "-content-info")
|
|
336
349
|
}, _renderCityInfo(seletedCity))), /*#__PURE__*/React.createElement("span", {
|
|
337
350
|
className: "".concat(selectPrefixCls, "-placeholder"),
|
|
338
351
|
style: hiddenStyle
|
|
339
|
-
}, placeholder), /*#__PURE__*/React.createElement("span", {
|
|
352
|
+
}, !disabled ? placeholder : null), /*#__PURE__*/React.createElement("span", {
|
|
340
353
|
className: "".concat(selectPrefixCls, "-suffix")
|
|
341
354
|
}, renderSuffix())));
|
|
342
355
|
};
|
|
343
|
-
var singleCls = classNames(commCls, (
|
|
356
|
+
var singleCls = classNames(commCls, (_classNames6 = {}, _defineProperty(_classNames6, "".concat(selectPrefixCls, "-disabled"), disabled), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-focused"), !disabled && focusd || optionShow), _classNames6));
|
|
344
357
|
useEffect(function () {
|
|
345
358
|
if (optionShow && !disabled) {
|
|
346
359
|
var onDropdownVisibleChange = selectProps.onDropdownVisibleChange;
|
|
@@ -377,16 +390,17 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
377
390
|
}
|
|
378
391
|
return -1;
|
|
379
392
|
};
|
|
380
|
-
var
|
|
381
|
-
|
|
382
|
-
activeIndex =
|
|
383
|
-
setActiveIndex =
|
|
393
|
+
var _useState13 = useState(-1),
|
|
394
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
395
|
+
activeIndex = _useState14[0],
|
|
396
|
+
setActiveIndex = _useState14[1];
|
|
384
397
|
var initActiveIndex = function initActiveIndex() {
|
|
385
|
-
|
|
398
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
399
|
+
setActiveIndex(index === undefined ? getActiveIndex(0) : index);
|
|
386
400
|
};
|
|
387
401
|
useEffect(function () {
|
|
388
|
-
initActiveIndex();
|
|
389
|
-
}, [searchValue, tabsValue]);
|
|
402
|
+
initActiveIndex(searchValue ? undefined : -1);
|
|
403
|
+
}, [searchValue, tabsValue, curkeyboardList]);
|
|
390
404
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
391
405
|
var _a, _b, _c;
|
|
392
406
|
var which = e.which;
|
|
@@ -410,11 +424,11 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
410
424
|
var item = curkeyboardList[activeIndex];
|
|
411
425
|
if (!item) return;
|
|
412
426
|
handleOption(item);
|
|
413
|
-
|
|
427
|
+
handleVisibleChange(false);
|
|
414
428
|
break;
|
|
415
429
|
}
|
|
416
430
|
case KeyCode.ESC:
|
|
417
|
-
|
|
431
|
+
handleVisibleChange(false);
|
|
418
432
|
break;
|
|
419
433
|
default:
|
|
420
434
|
break;
|
|
@@ -470,7 +484,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
470
484
|
};
|
|
471
485
|
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
472
486
|
if (!visible) {
|
|
473
|
-
initActiveIndex();
|
|
487
|
+
initActiveIndex(-1);
|
|
474
488
|
}
|
|
475
489
|
if (visible !== optionShow) {
|
|
476
490
|
props.visible === undefined && setOptionShow(visible);
|
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
background: #fff;
|
|
171
171
|
-webkit-transition: opacity 0.15s ease;
|
|
172
172
|
transition: opacity 0.15s ease;
|
|
173
|
+
font-size: var(--kd-c-city-picker-icon-clear-font-size, 16px);
|
|
173
174
|
}
|
|
174
175
|
.kd-city-picker-icon-clear:hover {
|
|
175
176
|
color: var(--kd-c-city-picker-color-border-hover, var(--kd-g-color-theme, #5582f3));
|
|
@@ -239,10 +240,10 @@
|
|
|
239
240
|
opacity: 1;
|
|
240
241
|
}
|
|
241
242
|
.kd-city-picker-wrapper .kd-city-picker-icon-clear {
|
|
242
|
-
color: var(--kd-c-city-picker-icon-clear-color-text, #
|
|
243
|
+
color: var(--kd-c-city-picker-icon-clear-color-text, #666666);
|
|
243
244
|
}
|
|
244
245
|
.kd-city-picker-wrapper .kd-city-picker-icon-clear:hover {
|
|
245
|
-
color: var(--kd-c-city-picker-icon-clear-color-text-hover, #
|
|
246
|
+
color: var(--kd-c-city-picker-icon-clear-color-text-hover, var(--kd-g-color-theme, #5582f3));
|
|
246
247
|
}
|
|
247
248
|
.kd-city-picker-show-search {
|
|
248
249
|
cursor: text;
|
|
@@ -419,7 +420,7 @@
|
|
|
419
420
|
.kd-city-picker-focused {
|
|
420
421
|
border-color: var(--kd-c-city-picker-color-border-foucs, var(--kd-g-color-theme, #5582f3)) !important;
|
|
421
422
|
}
|
|
422
|
-
.kd-city-picker-focused .kd-city-picker-content-item {
|
|
423
|
+
.kd-city-picker-focused .kd-city-picker-content-item:not(.kd-city-picker-content-item-seleted) {
|
|
423
424
|
color: var(--kd-c-city-picker-placeholder-color-text, #b2b2b2);
|
|
424
425
|
}
|
|
425
426
|
.kd-city-picker-disabled {
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
top: 0;
|
|
62
62
|
background: #fff;
|
|
63
63
|
transition: opacity 0.15s ease;
|
|
64
|
+
font-size: @city-picker-clear-font-size;
|
|
64
65
|
&:hover {
|
|
65
66
|
color: @city-picker-g-color-border-hover;
|
|
66
67
|
}
|
|
@@ -297,7 +298,7 @@
|
|
|
297
298
|
&-focused {
|
|
298
299
|
.focusColor();
|
|
299
300
|
|
|
300
|
-
.@{city-picker-prefix-cls}-content-item {
|
|
301
|
+
.@{city-picker-prefix-cls}-content-item:not(.@{city-picker-prefix-cls}-content-item-seleted) {
|
|
301
302
|
color: @city-picker-placeholder-color;
|
|
302
303
|
}
|
|
303
304
|
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
@city-picker-color-background-disabled: var(~'@{city-picker-custom-prefix}-color-background-disabled', #fff);
|
|
18
18
|
@city-picker-color-text-disabled: var(~'@{city-picker-custom-prefix}-color-text-disabled', @color-disabled);
|
|
19
19
|
@city-picker-arrow-icon-color-text-disabled: var(~'@{city-picker-custom-prefix}-arrow-icon-color-text-disabled', #b2b2b2);
|
|
20
|
-
@city-picker-clear-color: var(~'@{city-picker-custom-prefix}-icon-clear-color-text', #
|
|
21
|
-
@city-picker-clear-color-hover: var(~'@{city-picker-custom-prefix}-icon-clear-color-text-hover',
|
|
20
|
+
@city-picker-clear-color: var(~'@{city-picker-custom-prefix}-icon-clear-color-text', #666666);
|
|
21
|
+
@city-picker-clear-color-hover: var(~'@{city-picker-custom-prefix}-icon-clear-color-text-hover', @color-theme);
|
|
22
22
|
@city-picker-list-item-color-selected: var(~'@{city-picker-custom-prefix}-list-item-color-text-selected', @color-theme);
|
|
23
23
|
@city-picker-highlight-color: var(~'@{city-picker-custom-prefix}-highlight-color-text', @color-theme);
|
|
24
24
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
@city-picker-large-font-size: var(~'@{city-picker-custom-prefix}-font-size-large', 16px); // 大号字体
|
|
28
28
|
@city-picker-middle-font-size: var(~'@{city-picker-custom-prefix}-font-size-middle', 14px); // 中号高度
|
|
29
29
|
@city-picker-small-font-size: var(~'@{city-picker-custom-prefix}-font-size-small', 12px); // 小号高度
|
|
30
|
+
@city-picker-clear-font-size: var(~'@{city-picker-custom-prefix}-icon-clear-font-size', 16px);
|
|
30
31
|
|
|
31
32
|
// line-height
|
|
32
33
|
@city-picker-dropdown-line-height: var(~'@{city-picker-custom-prefix}-dropdown-line-height', 22px);
|
package/es/grid/col.d.ts
CHANGED
package/es/grid/col.js
CHANGED
|
@@ -1,35 +1,52 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
2
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
3
|
-
|
|
4
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
7
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useContext } from 'react';
|
|
4
13
|
import classNames from 'classnames';
|
|
5
14
|
import { getCompProps } from '../_utils';
|
|
6
15
|
import { ConfigContext } from '../config-provider';
|
|
7
16
|
import { testBrowserType } from '../_utils/testBrowserType';
|
|
17
|
+
import { GapContext } from './row';
|
|
8
18
|
var Col = function Col(props) {
|
|
9
19
|
var _React$useContext = React.useContext(ConfigContext),
|
|
10
20
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
11
21
|
pkgPrefixCls = _React$useContext.prefixCls,
|
|
12
22
|
userDefaultProps = _React$useContext.compDefaultProps;
|
|
13
23
|
// 属性需要合并一遍用户定义的默认属性
|
|
14
|
-
var
|
|
15
|
-
xs =
|
|
16
|
-
sm =
|
|
17
|
-
md =
|
|
18
|
-
lg =
|
|
19
|
-
xl =
|
|
20
|
-
flex =
|
|
21
|
-
span =
|
|
22
|
-
pull =
|
|
23
|
-
push =
|
|
24
|
-
style =
|
|
25
|
-
order =
|
|
26
|
-
offset =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
var _a = getCompProps('Col', userDefaultProps, props),
|
|
25
|
+
xs = _a.xs,
|
|
26
|
+
sm = _a.sm,
|
|
27
|
+
md = _a.md,
|
|
28
|
+
lg = _a.lg,
|
|
29
|
+
xl = _a.xl,
|
|
30
|
+
flex = _a.flex,
|
|
31
|
+
span = _a.span,
|
|
32
|
+
pull = _a.pull,
|
|
33
|
+
push = _a.push,
|
|
34
|
+
style = _a.style,
|
|
35
|
+
order = _a.order,
|
|
36
|
+
offset = _a.offset,
|
|
37
|
+
children = _a.children,
|
|
38
|
+
className = _a.className,
|
|
39
|
+
customPrefixcls = _a.prefixCls,
|
|
40
|
+
others = __rest(_a, ["xs", "sm", "md", "lg", "xl", "flex", "span", "pull", "push", "style", "order", "offset", "children", "className", "prefixCls"]);
|
|
41
|
+
var rowGroup = useContext(GapContext);
|
|
42
|
+
var mergedWinWidth = rowGroup.winWidth;
|
|
43
|
+
var gap = rowGroup.gap;
|
|
31
44
|
// 浏览器名称
|
|
32
|
-
var
|
|
45
|
+
var isSogouOrIE = testBrowserType(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
|
|
46
|
+
var colGapStyle = {
|
|
47
|
+
padding: "0 ".concat(gap.h / 2, "px")
|
|
48
|
+
};
|
|
49
|
+
if (isSogouOrIE && gap.v) colGapStyle.marginBottom = gap.v;
|
|
33
50
|
// className前缀
|
|
34
51
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'col', customPrefixcls);
|
|
35
52
|
var columns = 24;
|
|
@@ -40,23 +57,23 @@ var Col = function Col(props) {
|
|
|
40
57
|
offset: offset,
|
|
41
58
|
order: order
|
|
42
59
|
};
|
|
43
|
-
if (xs &&
|
|
60
|
+
if (xs && mergedWinWidth > 0) {
|
|
44
61
|
if (xs.constructor === Number) base.span = xs;
|
|
45
62
|
if (xs.constructor === Object) base = _extends(_extends({}, base), xs);
|
|
46
63
|
}
|
|
47
|
-
if (sm &&
|
|
64
|
+
if (sm && mergedWinWidth >= 600) {
|
|
48
65
|
if (sm.constructor === Number) base.span = sm;
|
|
49
66
|
if (sm.constructor === Object) base = _extends(_extends({}, base), sm);
|
|
50
67
|
}
|
|
51
|
-
if (md &&
|
|
68
|
+
if (md && mergedWinWidth >= 1024) {
|
|
52
69
|
if (md.constructor === Number) base.span = md;
|
|
53
70
|
if (md.constructor === Object) base = _extends(_extends({}, base), md);
|
|
54
71
|
}
|
|
55
|
-
if (lg &&
|
|
72
|
+
if (lg && mergedWinWidth >= 1280) {
|
|
56
73
|
if (lg.constructor === Number) base.span = lg;
|
|
57
74
|
if (lg.constructor === Object) base = _extends(_extends({}, base), lg);
|
|
58
75
|
}
|
|
59
|
-
if (xl &&
|
|
76
|
+
if (xl && mergedWinWidth >= 1920) {
|
|
60
77
|
if (xl.constructor === Number) base.span = xl;
|
|
61
78
|
if (xl.constructor === Object) base = _extends(_extends({}, base), xl);
|
|
62
79
|
}
|
|
@@ -76,20 +93,18 @@ var Col = function Col(props) {
|
|
|
76
93
|
}
|
|
77
94
|
}
|
|
78
95
|
}
|
|
79
|
-
var styleString = _extends({
|
|
96
|
+
var styleString = _extends(_extends({
|
|
80
97
|
flex: flexstr,
|
|
81
98
|
maxWidth: width,
|
|
82
99
|
order: base.order,
|
|
83
100
|
left: base.push && base.push / columns * 100 + '%',
|
|
84
101
|
right: base.pull && base.pull / columns * 100 + '%',
|
|
85
102
|
marginLeft: base.offset && base.offset / columns * 100 + '%'
|
|
86
|
-
}, style);
|
|
87
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: classNames(prefixCls, className,
|
|
89
|
-
'sogou-col': isSogou
|
|
90
|
-
}),
|
|
103
|
+
}, colGapStyle), style);
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
105
|
+
className: classNames(prefixCls, className),
|
|
91
106
|
style: styleString
|
|
92
|
-
}, children);
|
|
107
|
+
}, others), children);
|
|
93
108
|
};
|
|
94
109
|
Col.displayName = 'Col';
|
|
95
110
|
export default Col;
|
package/es/grid/row.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type Align = 'top' | 'middle' | 'bottom' | 'stretch';
|
|
3
3
|
declare type Justify = 'start' | 'end' | 'center' | 'space-around' | 'space-between';
|
|
4
4
|
interface gutterObject {
|
|
@@ -17,5 +17,13 @@ export interface RowProps {
|
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
18
|
gutter?: number | gutterObject | Array<number | gutterObject>;
|
|
19
19
|
}
|
|
20
|
+
export interface GridContext {
|
|
21
|
+
gap: {
|
|
22
|
+
v: number;
|
|
23
|
+
h: number;
|
|
24
|
+
};
|
|
25
|
+
winWidth: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const GapContext: React.Context<GridContext>;
|
|
20
28
|
declare const Row: React.FC<RowProps>;
|
|
21
29
|
export default Row;
|
package/es/grid/row.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
|
-
import
|
|
4
|
-
import * as React from 'react';
|
|
3
|
+
import React, { createContext } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { getCompProps } from '../_utils';
|
|
7
6
|
import { ConfigContext } from '../config-provider';
|
|
@@ -21,8 +20,14 @@ function getGap(gutter, width) {
|
|
|
21
20
|
if (xl && width >= 1920) gap = xl;
|
|
22
21
|
return gap;
|
|
23
22
|
}
|
|
23
|
+
export var GapContext = /*#__PURE__*/createContext({
|
|
24
|
+
gap: {
|
|
25
|
+
h: 0,
|
|
26
|
+
v: 0
|
|
27
|
+
},
|
|
28
|
+
winWidth: window.innerWidth
|
|
29
|
+
});
|
|
24
30
|
var Row = function Row(props) {
|
|
25
|
-
var _context;
|
|
26
31
|
var _React$useContext = React.useContext(ConfigContext),
|
|
27
32
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
28
33
|
pkgPrefixCls = _React$useContext.prefixCls,
|
|
@@ -38,7 +43,7 @@ var Row = function Row(props) {
|
|
|
38
43
|
justify = _getCompProps.justify,
|
|
39
44
|
customPrefixcls = _getCompProps.prefixCls;
|
|
40
45
|
// 浏览器名称
|
|
41
|
-
var
|
|
46
|
+
var isSogouOrIe = testBrowserType(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
|
|
42
47
|
// className前缀
|
|
43
48
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'row', customPrefixcls);
|
|
44
49
|
var _React$useState = React.useState(window.innerWidth),
|
|
@@ -70,9 +75,10 @@ var Row = function Row(props) {
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
var rowStyle = {
|
|
73
|
-
'
|
|
78
|
+
'row-gap': "".concat(gap.v, "px"),
|
|
79
|
+
margin: "0 ".concat(-1 * gap.h / 2, "px")
|
|
74
80
|
};
|
|
75
|
-
if (gap.v) rowStyle['
|
|
81
|
+
if (gap.v && isSogouOrIe) rowStyle['margin-bottom'] = "".concat(-1 * gap.v, "px");
|
|
76
82
|
var toalign = {
|
|
77
83
|
top: 'flex-start',
|
|
78
84
|
middle: 'center',
|
|
@@ -82,22 +88,21 @@ var Row = function Row(props) {
|
|
|
82
88
|
start: 'flex-start',
|
|
83
89
|
end: 'flex-end'
|
|
84
90
|
};
|
|
85
|
-
var styleString = _extends(_extends(_extends({},
|
|
91
|
+
var styleString = _extends(_extends(_extends({}, rowStyle), style), {
|
|
86
92
|
alignItems: toalign[align] || align,
|
|
87
93
|
justifyContent: tojustify[justify] || justify
|
|
88
94
|
});
|
|
89
|
-
return /*#__PURE__*/React.createElement(
|
|
95
|
+
return /*#__PURE__*/React.createElement(GapContext.Provider, {
|
|
96
|
+
value: {
|
|
97
|
+
gap: gap,
|
|
98
|
+
winWidth: winWidth
|
|
99
|
+
}
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
101
|
className: classNames(prefixCls, className, {
|
|
91
102
|
nowrap: !wrap
|
|
92
|
-
}, {
|
|
93
|
-
'sogou-row': isSogou
|
|
94
103
|
}),
|
|
95
104
|
style: styleString
|
|
96
|
-
},
|
|
97
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
98
|
-
winWidth: winWidth
|
|
99
|
-
});
|
|
100
|
-
}));
|
|
105
|
+
}, children));
|
|
101
106
|
};
|
|
102
107
|
Row.displayName = 'Row';
|
|
103
108
|
export default Row;
|
package/es/select/select.js
CHANGED
|
@@ -456,7 +456,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
456
456
|
var arrowIconCls = classNames((_classNames7 = {}, _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow"), true), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames7));
|
|
457
457
|
var iconShow = allowClear && !disabled && ((isMultiple ? mulOptions.length > 0 : (singleVal !== null && singleVal !== void 0 ? singleVal : '') !== '') || searchValue);
|
|
458
458
|
var clearIconCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-icon-clear"), true));
|
|
459
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, iconShow
|
|
459
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, iconShow ? /*#__PURE__*/React.createElement("span", {
|
|
460
460
|
onClick: handleReset,
|
|
461
461
|
onMouseDown: function onMouseDown(e) {
|
|
462
462
|
return e.preventDefault();
|
|
@@ -465,11 +465,11 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
465
465
|
ref: clearRef
|
|
466
466
|
}, clearIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
467
467
|
type: "close-solid"
|
|
468
|
-
})), showArrow
|
|
468
|
+
})) : null, showArrow ? /*#__PURE__*/React.createElement("span", {
|
|
469
469
|
className: arrowIconCls
|
|
470
470
|
}, suffixIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
471
471
|
type: "arrow-down"
|
|
472
|
-
})));
|
|
472
|
+
})) : null);
|
|
473
473
|
};
|
|
474
474
|
var renderOption = function renderOption(child, index) {
|
|
475
475
|
if ((child === null || child === void 0 ? void 0 : child.props) && (child.type.displayName === 'Option' || child.type.name === 'Option')) {
|
|
@@ -568,7 +568,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
568
568
|
className: dropDownCls,
|
|
569
569
|
style: dropdownStyle,
|
|
570
570
|
ref: dropDownRef
|
|
571
|
-
}, !dropdownRender && childrenToRender.length > 0
|
|
571
|
+
}, !dropdownRender && childrenToRender.length > 0 ? dropRender(eleOptionList, heightStyle) : null, renderNotContent(), /*#__PURE__*/React.createElement("div", null, dropdownRender ? dropdownRender(dropRender(childrenToRender, heightStyle)) : null), isMultiple && realChildren.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
572
572
|
className: multipleFooterCls
|
|
573
573
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
574
574
|
style: checkboxStyle,
|
|
@@ -577,7 +577,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
577
577
|
onChange: handleSelectAll
|
|
578
578
|
}, "\u5168\u9009"), /*#__PURE__*/React.createElement("span", {
|
|
579
579
|
className: "".concat(selectPrefixCls, "-multiple-footer-hadSelected")
|
|
580
|
-
}, "\u5DF2\u9009", /*#__PURE__*/React.createElement("span", null, selectedVal.length), "\u9879"))));
|
|
580
|
+
}, "\u5DF2\u9009", /*#__PURE__*/React.createElement("span", null, selectedVal.length), "\u9879")) : null));
|
|
581
581
|
};
|
|
582
582
|
// 处理多选tag
|
|
583
583
|
var handleMaxTagHolder = useCallback(function () {
|
|
@@ -652,10 +652,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
652
652
|
return /*#__PURE__*/React.createElement("div", {
|
|
653
653
|
className: multipleCls,
|
|
654
654
|
ref: selectionRef
|
|
655
|
-
}, Array.isArray(mulOptions)
|
|
655
|
+
}, Array.isArray(mulOptions) ? /*#__PURE__*/React.createElement(React.Fragment, null, _mapInstanceProperty(mulOptions).call(mulOptions, function (item, index) {
|
|
656
656
|
var label = item.label,
|
|
657
657
|
value = item.value;
|
|
658
|
-
return
|
|
658
|
+
return !maxTagCount || index <= maxTagCount - 1 ? /*#__PURE__*/React.createElement("span", {
|
|
659
659
|
key: value,
|
|
660
660
|
className: classNames("".concat(selectPrefixCls, "-selection-tag")),
|
|
661
661
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -677,12 +677,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
677
677
|
return handleRemove(e, value);
|
|
678
678
|
},
|
|
679
679
|
"data-tag": value
|
|
680
|
-
}, label));
|
|
680
|
+
}, label)) : null;
|
|
681
681
|
}), maxTagCount && mulOptions.length > maxTagCount ? maxTagPlaceholder ? handleMaxTagHolder() : /*#__PURE__*/React.createElement("span", {
|
|
682
682
|
className: itemCls
|
|
683
683
|
}, /*#__PURE__*/React.createElement("span", {
|
|
684
684
|
className: "".concat(selectPrefixCls, "-selection-item-content")
|
|
685
|
-
}, "\u5171", mulOptions.length, "\u9879")) : null), /*#__PURE__*/React.createElement("span", {
|
|
685
|
+
}, "\u5171", mulOptions.length, "\u9879")) : null) : null, /*#__PURE__*/React.createElement("span", {
|
|
686
686
|
className: "".concat(selectPrefixCls, "-selection-search"),
|
|
687
687
|
style: {
|
|
688
688
|
width: inputWidth
|
|
@@ -700,7 +700,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
700
700
|
className: "".concat(selectPrefixCls, "-selection-search-mirror")
|
|
701
701
|
}, searchValue, "\xA0")), /*#__PURE__*/React.createElement("span", {
|
|
702
702
|
className: "".concat(selectPrefixCls, "-placeholder")
|
|
703
|
-
}, !mulOptions.length && !searchValue
|
|
703
|
+
}, !mulOptions.length && !searchValue ? placeholder : null), /*#__PURE__*/React.createElement("span", {
|
|
704
704
|
className: "".concat(selectPrefixCls, "-suffix")
|
|
705
705
|
}, renderSuffix()));
|
|
706
706
|
};
|