@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.
@@ -280,6 +280,14 @@
280
280
  .kd-select-icon-clear {
281
281
  opacity: 0;
282
282
  z-index: 1;
283
+ top: 0;
284
+ bottom: 0;
285
+ display: -webkit-box;
286
+ display: -ms-flexbox;
287
+ display: flex;
288
+ -webkit-box-align: center;
289
+ -ms-flex-align: center;
290
+ align-items: center;
283
291
  position: absolute;
284
292
  background: #fff;
285
293
  -webkit-transition: opacity 0.15s ease;
@@ -299,6 +307,15 @@
299
307
  text-overflow: ellipsis;
300
308
  right: 28px;
301
309
  left: 0;
310
+ top: 0;
311
+ bottom: 0;
312
+ z-index: -1;
313
+ display: -webkit-box;
314
+ display: -ms-flexbox;
315
+ display: flex;
316
+ -webkit-box-align: center;
317
+ -ms-flex-align: center;
318
+ align-items: center;
302
319
  }
303
320
  .kd-select-borderless {
304
321
  border: none;
@@ -433,18 +450,32 @@
433
450
  max-height: calc(var(--kd-c-select-sizing-height-small, 24px) * 3 - 10px);
434
451
  font-size: var(--kd-c-select-font-size-small, 12px);
435
452
  }
453
+ .kd-select-size-small .kd-select-selection-item {
454
+ min-height: calc(var(--kd-c-select-sizing-height-small, 24px) - 4px);
455
+ line-height: calc(var(--kd-c-select-sizing-height-small, 24px) - 4px);
456
+ }
436
457
  .kd-select-size-middle {
437
458
  min-height: var(--kd-c-select-sizing-height-middle, 30px);
438
459
  max-height: calc(var(--kd-c-select-sizing-height-middle, 30px) * 3 - 10px);
439
460
  font-size: var(--kd-c-select-font-size-middle, 14px);
440
461
  }
462
+ .kd-select-size-middle .kd-select-selection-item {
463
+ min-height: calc(var(--kd-c-select-sizing-height-middle, 30px) - 4px);
464
+ line-height: calc(var(--kd-c-select-sizing-height-middle, 30px) - 4px);
465
+ }
441
466
  .kd-select-size-large {
442
467
  min-height: var(--kd-c-select-sizing-height-large, 36px);
443
468
  max-height: calc(var(--kd-c-select-sizing-height-large, 36px) * 3 - 10px);
444
469
  font-size: var(--kd-c-select-font-size-large, 16px);
445
470
  }
471
+ .kd-select-size-large .kd-select-selection-item {
472
+ min-height: calc(var(--kd-c-select-sizing-height-large, 36px) - 4px);
473
+ line-height: calc(var(--kd-c-select-sizing-height-large, 36px) - 4px);
474
+ }
446
475
  .kd-select-suffix {
447
476
  right: 0;
477
+ top: 0;
478
+ bottom: 0;
448
479
  position: absolute;
449
480
  display: -webkit-box;
450
481
  display: -ms-flexbox;
@@ -467,6 +498,14 @@
467
498
  right: 28px;
468
499
  left: 0;
469
500
  height: 100%;
501
+ top: 0;
502
+ bottom: 0;
503
+ display: -webkit-box;
504
+ display: -ms-flexbox;
505
+ display: flex;
506
+ -webkit-box-align: center;
507
+ -ms-flex-align: center;
508
+ align-items: center;
470
509
  }
471
510
  .kd-select .kd-select-single .kd-select-selection-search-input {
472
511
  outline: 0;
@@ -525,9 +564,6 @@
525
564
  align-items: center;
526
565
  vertical-align: middle;
527
566
  max-width: 100%;
528
- height: 20px;
529
- line-height: 20px;
530
- margin: 2px 8px 2px 0;
531
567
  cursor: default;
532
568
  -webkit-user-select: none;
533
569
  -moz-user-select: none;
@@ -46,6 +46,10 @@
46
46
  &-clear {
47
47
  opacity: 0;
48
48
  z-index: 1;
49
+ top: 0;
50
+ bottom: 0;
51
+ display: flex;
52
+ align-items: center;
49
53
  position: absolute;
50
54
  background: #fff;
51
55
  transition: opacity 0.15s ease;
@@ -66,6 +70,11 @@
66
70
  text-overflow: ellipsis;
67
71
  right: 28px;
68
72
  left: 0;
73
+ top: 0;
74
+ bottom: 0;
75
+ z-index: -1;
76
+ display: flex;
77
+ align-items: center;
69
78
  }
70
79
 
71
80
  &-borderless {
@@ -220,6 +229,8 @@
220
229
 
221
230
  &-suffix {
222
231
  right: 0;
232
+ top: 0;
233
+ bottom: 0;
223
234
  position: absolute;
224
235
  display: flex;
225
236
  flex: 0;
@@ -235,6 +246,10 @@
235
246
  right: 28px;
236
247
  left: 0;
237
248
  height: 100%;
249
+ top: 0;
250
+ bottom: 0;
251
+ display: flex;
252
+ align-items: center;
238
253
  &-input {
239
254
  outline: 0;
240
255
  border-radius: 0;
@@ -289,9 +304,6 @@
289
304
  align-items: center;
290
305
  vertical-align: middle;
291
306
  max-width: 100%;
292
- height: 20px;
293
- line-height: 20px;
294
- margin: 2px 8px 2px 0;
295
307
  cursor: default;
296
308
  user-select: none;
297
309
  &-small {
@@ -19,6 +19,11 @@
19
19
  min-height: @height;
20
20
  max-height: calc(@maxHeight * 3 - 10px);
21
21
  font-size: @fontSize;
22
+
23
+ .@{select-prefix-cls}-selection-item {
24
+ min-height: calc(@height - 4px);
25
+ line-height: calc(@height - 4px);
26
+ }
22
27
  }
23
28
 
24
29
  .over() {
@@ -52,7 +57,6 @@
52
57
  }
53
58
  }
54
59
 
55
-
56
60
  @keyframes SlideUpIn {
57
61
  0% {
58
62
  transform: scaleY(0.8);
@@ -77,4 +81,4 @@
77
81
  transform-origin: 100% 100%;
78
82
  opacity: 0;
79
83
  }
80
- }
84
+ }
@@ -109,6 +109,17 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
109
109
  }, []);
110
110
  var getDefaultCheckbox = function getDefaultCheckbox() {
111
111
  var _context20, _context21;
112
+ var inputProps = {
113
+ type: 'checkbox',
114
+ className: inputClassName,
115
+ onChange: handleChange,
116
+ checked: selected,
117
+ disabled: mergedDisabled,
118
+ name: mergedName
119
+ };
120
+ if ((value !== null && value !== void 0 ? value : '') !== '') {
121
+ inputProps.value = value;
122
+ }
112
123
  return (
113
124
  /*#__PURE__*/
114
125
  // eslint-disable-next-line
@@ -118,30 +129,24 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
118
129
  ref: labelRef
119
130
  }, rest), /*#__PURE__*/_react.default.createElement("span", {
120
131
  className: checkedWrapperClassName
121
- }, selected && /*#__PURE__*/_react.default.createElement("span", {
132
+ }, selected ? /*#__PURE__*/_react.default.createElement("span", {
122
133
  className: innerIconClassName
123
134
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
124
135
  type: "right-bold",
125
136
  className: (0, _concat.default)(_context20 = "".concat(checkboxPrefixCls, "-")).call(_context20, mergedCheckboxType, "-inner-icon")
126
- })), /*#__PURE__*/_react.default.createElement("input", {
137
+ })) : null, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
127
138
  type: "checkbox",
128
- className: inputClassName,
129
- onChange: handleChange,
130
- ref: ref,
131
- value: value,
132
- checked: selected,
133
- disabled: mergedDisabled,
134
- name: mergedName
135
- })), children && /*#__PURE__*/_react.default.createElement("span", {
139
+ ref: ref
140
+ }, inputProps))), children ? /*#__PURE__*/_react.default.createElement("span", {
136
141
  className: "".concat(checkboxPrefixCls, "-children")
137
- }, children), !isDefaultType() && /*#__PURE__*/_react.default.createElement("span", {
142
+ }, children) : null, !isDefaultType() ? /*#__PURE__*/_react.default.createElement("span", {
138
143
  className: triangleClassName
139
144
  }, /*#__PURE__*/_react.default.createElement("span", {
140
145
  className: innerIconClassName
141
146
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
142
147
  type: "right-bold",
143
148
  className: (0, _concat.default)(_context21 = "".concat(checkboxPrefixCls, "-")).call(_context21, mergedCheckboxType, "-inner-icon")
144
- }))))
149
+ }))) : null)
145
150
  );
146
151
  };
147
152
  return getDefaultCheckbox();
@@ -35,7 +35,7 @@ var getCityId = function getCityId(data) {
35
35
  return data;
36
36
  };
37
37
  var InternalSelect = function InternalSelect(props, ref) {
38
- var _context, _classNames3, _classNames5;
38
+ var _context, _classNames3, _classNames6;
39
39
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
40
40
  getPrefixCls = _useContext.getPrefixCls,
41
41
  prefixCls = _useContext.prefixCls,
@@ -114,14 +114,18 @@ var InternalSelect = function InternalSelect(props, ref) {
114
114
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
115
115
  focusd = _useState6[0],
116
116
  setFocusd = _useState6[1];
117
- var _useState7 = (0, _react.useState)(null),
117
+ var _useState7 = (0, _react.useState)(false),
118
118
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
119
- seletedCity = _useState8[0],
120
- setSeletedCity = _useState8[1];
121
- var _useState9 = (0, _react.useState)('domestic'),
119
+ afterChangeFocus = _useState8[0],
120
+ setAfterChangeFocus = _useState8[1];
121
+ var _useState9 = (0, _react.useState)(null),
122
122
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
123
- tabsValue = _useState10[0],
124
- setTabsValue = _useState10[1];
123
+ seletedCity = _useState10[0],
124
+ setSeletedCity = _useState10[1];
125
+ var _useState11 = (0, _react.useState)('domestic'),
126
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
127
+ tabsValue = _useState12[0],
128
+ setTabsValue = _useState12[1];
125
129
  var isDomestic = function isDomestic(type) {
126
130
  return type === 'domestic';
127
131
  };
@@ -156,6 +160,7 @@ var InternalSelect = function InternalSelect(props, ref) {
156
160
  var handleBlur = (0, _react.useCallback)(function (e) {
157
161
  e.stopPropagation();
158
162
  setFocusd(false);
163
+ setAfterChangeFocus(false);
159
164
  onBlur && onBlur(e);
160
165
  }, [onBlur]);
161
166
  (0, _react.useEffect)(function () {
@@ -205,7 +210,7 @@ var InternalSelect = function InternalSelect(props, ref) {
205
210
  className: "".concat(selectPrefixCls, "-icon-clear"),
206
211
  ref: clearRef
207
212
  }, clearIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
208
- type: "close-solid"
213
+ type: "close"
209
214
  })), showArrow && /*#__PURE__*/_react.default.createElement("span", {
210
215
  className: arrowIconCls
211
216
  }, suffixIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
@@ -236,9 +241,12 @@ var InternalSelect = function InternalSelect(props, ref) {
236
241
  }));
237
242
  };
238
243
  var handleOption = function handleOption(city) {
244
+ var _a;
239
245
  handleVisibleChange(false);
240
246
  city.type = tabsValue === 'domestic' ? 'domestic' : 'foreign';
241
247
  (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));
248
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
249
+ setAfterChangeFocus(true);
242
250
  if (typeof value === 'undefined') {
243
251
  setSeletedCity(city);
244
252
  setInitValue(city === null || city === void 0 ? void 0 : city.id);
@@ -251,7 +259,10 @@ var InternalSelect = function InternalSelect(props, ref) {
251
259
  }
252
260
  return /*#__PURE__*/_react.default.createElement("div", {
253
261
  className: "".concat(selectPrefixCls, "-list"),
254
- ref: optionsListRef
262
+ ref: optionsListRef,
263
+ onMouseDown: function onMouseDown(e) {
264
+ return e === null || e === void 0 ? void 0 : e.preventDefault();
265
+ }
255
266
  }, (0, _map.default)(data).call(data, function (item, index) {
256
267
  return /*#__PURE__*/_react.default.createElement(_option.default, {
257
268
  key: item.id,
@@ -322,9 +333,11 @@ var InternalSelect = function InternalSelect(props, ref) {
322
333
  }
323
334
  }, [type, tabsValue]);
324
335
  var renderSingle = function renderSingle() {
336
+ var _classNames5;
325
337
  var hiddenStyle = !!searchValue || (initValue !== null && initValue !== void 0 ? initValue : '') !== '' ? {
326
338
  visibility: 'hidden'
327
339
  } : undefined;
340
+ var itemCls = (0, _classnames.default)((_classNames5 = {}, (0, _defineProperty2.default)(_classNames5, "".concat(selectPrefixCls, "-content-item"), true), (0, _defineProperty2.default)(_classNames5, "".concat(selectPrefixCls, "-content-item-seleted"), afterChangeFocus), _classNames5));
328
341
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
329
342
  className: singleCls,
330
343
  ref: selectionRef
@@ -341,18 +354,18 @@ var InternalSelect = function InternalSelect(props, ref) {
341
354
  onBlur: handleBlur,
342
355
  readOnly: !!disabled
343
356
  }), !searchValue && /*#__PURE__*/_react.default.createElement("span", {
344
- className: "".concat(selectPrefixCls, "-content-item"),
357
+ className: itemCls,
345
358
  title: seletedCity === null || seletedCity === void 0 ? void 0 : seletedCity.name
346
359
  }, seletedCity === null || seletedCity === void 0 ? void 0 : seletedCity.name)), !searchValue && /*#__PURE__*/_react.default.createElement("span", {
347
360
  className: "".concat(selectPrefixCls, "-content-info")
348
361
  }, _renderCityInfo(seletedCity))), /*#__PURE__*/_react.default.createElement("span", {
349
362
  className: "".concat(selectPrefixCls, "-placeholder"),
350
363
  style: hiddenStyle
351
- }, placeholder), /*#__PURE__*/_react.default.createElement("span", {
364
+ }, !disabled ? placeholder : null), /*#__PURE__*/_react.default.createElement("span", {
352
365
  className: "".concat(selectPrefixCls, "-suffix")
353
366
  }, renderSuffix())));
354
367
  };
355
- var singleCls = (0, _classnames.default)(commCls, (_classNames5 = {}, (0, _defineProperty2.default)(_classNames5, "".concat(selectPrefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames5, "".concat(selectPrefixCls, "-focused"), !disabled && focusd || optionShow), _classNames5));
368
+ var singleCls = (0, _classnames.default)(commCls, (_classNames6 = {}, (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-focused"), !disabled && focusd || optionShow), _classNames6));
356
369
  (0, _react.useEffect)(function () {
357
370
  if (optionShow && !disabled) {
358
371
  var onDropdownVisibleChange = selectProps.onDropdownVisibleChange;
@@ -389,16 +402,17 @@ var InternalSelect = function InternalSelect(props, ref) {
389
402
  }
390
403
  return -1;
391
404
  };
392
- var _useState11 = (0, _react.useState)(getActiveIndex(0)),
393
- _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
394
- activeIndex = _useState12[0],
395
- setActiveIndex = _useState12[1];
405
+ var _useState13 = (0, _react.useState)(-1),
406
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
407
+ activeIndex = _useState14[0],
408
+ setActiveIndex = _useState14[1];
396
409
  var initActiveIndex = function initActiveIndex() {
397
- setActiveIndex(getActiveIndex(0));
410
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
411
+ setActiveIndex(index === undefined ? getActiveIndex(0) : index);
398
412
  };
399
413
  (0, _react.useEffect)(function () {
400
- initActiveIndex();
401
- }, [searchValue, tabsValue]);
414
+ initActiveIndex(searchValue ? undefined : -1);
415
+ }, [searchValue, tabsValue, curkeyboardList]);
402
416
  var onInternalKeyDown = function onInternalKeyDown(e) {
403
417
  var _a, _b, _c;
404
418
  var which = e.which;
@@ -422,11 +436,11 @@ var InternalSelect = function InternalSelect(props, ref) {
422
436
  var item = curkeyboardList[activeIndex];
423
437
  if (!item) return;
424
438
  handleOption(item);
425
- setOptionShow(false);
439
+ handleVisibleChange(false);
426
440
  break;
427
441
  }
428
442
  case _KeyCode.default.ESC:
429
- setOptionShow(false);
443
+ handleVisibleChange(false);
430
444
  break;
431
445
  default:
432
446
  break;
@@ -482,7 +496,7 @@ var InternalSelect = function InternalSelect(props, ref) {
482
496
  };
483
497
  var handleVisibleChange = function handleVisibleChange(visible) {
484
498
  if (!visible) {
485
- initActiveIndex();
499
+ initActiveIndex(-1);
486
500
  }
487
501
  if (visible !== optionShow) {
488
502
  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, #d9d9d9);
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, #999);
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', #d9d9d9);
21
- @city-picker-clear-color-hover: var(~'@{city-picker-custom-prefix}-icon-clear-color-text-hover', #999);
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/lib/grid/col.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  interface ColBase {
3
3
  span?: number;
4
4
  pull?: number;
package/lib/grid/col.js CHANGED
@@ -8,40 +8,57 @@ Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports.default = void 0;
11
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
12
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
- var React = _interopRequireWildcard(require("react"));
12
+ var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
13
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
14
+ var _react = _interopRequireWildcard(require("react"));
14
15
  var _classnames = _interopRequireDefault(require("classnames"));
15
16
  var _utils = require("../_utils");
16
17
  var _configProvider = require("../config-provider");
17
18
  var _testBrowserType = require("../_utils/testBrowserType");
19
+ var _row = require("./row");
18
20
  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
21
  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; }
22
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
23
+ var t = {};
24
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
25
+ if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
27
+ }
28
+ return t;
29
+ };
20
30
  var Col = function Col(props) {
21
- var _React$useContext = React.useContext(_configProvider.ConfigContext),
31
+ var _React$useContext = _react.default.useContext(_configProvider.ConfigContext),
22
32
  getPrefixCls = _React$useContext.getPrefixCls,
23
33
  pkgPrefixCls = _React$useContext.prefixCls,
24
34
  userDefaultProps = _React$useContext.compDefaultProps;
25
35
  // 属性需要合并一遍用户定义的默认属性
26
- var _getCompProps = (0, _utils.getCompProps)('Col', userDefaultProps, props),
27
- xs = _getCompProps.xs,
28
- sm = _getCompProps.sm,
29
- md = _getCompProps.md,
30
- lg = _getCompProps.lg,
31
- xl = _getCompProps.xl,
32
- flex = _getCompProps.flex,
33
- span = _getCompProps.span,
34
- pull = _getCompProps.pull,
35
- push = _getCompProps.push,
36
- style = _getCompProps.style,
37
- order = _getCompProps.order,
38
- offset = _getCompProps.offset,
39
- winWidth = _getCompProps.winWidth,
40
- children = _getCompProps.children,
41
- className = _getCompProps.className,
42
- customPrefixcls = _getCompProps.prefixCls;
36
+ var _a = (0, _utils.getCompProps)('Col', userDefaultProps, props),
37
+ xs = _a.xs,
38
+ sm = _a.sm,
39
+ md = _a.md,
40
+ lg = _a.lg,
41
+ xl = _a.xl,
42
+ flex = _a.flex,
43
+ span = _a.span,
44
+ pull = _a.pull,
45
+ push = _a.push,
46
+ style = _a.style,
47
+ order = _a.order,
48
+ offset = _a.offset,
49
+ children = _a.children,
50
+ className = _a.className,
51
+ customPrefixcls = _a.prefixCls,
52
+ others = __rest(_a, ["xs", "sm", "md", "lg", "xl", "flex", "span", "pull", "push", "style", "order", "offset", "children", "className", "prefixCls"]);
53
+ var rowGroup = (0, _react.useContext)(_row.GapContext);
54
+ var mergedWinWidth = rowGroup.winWidth;
55
+ var gap = rowGroup.gap;
43
56
  // 浏览器名称
44
- var isSogou = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
57
+ var isSogouOrIE = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
58
+ var colGapStyle = {
59
+ padding: "0 ".concat(gap.h / 2, "px")
60
+ };
61
+ if (isSogouOrIE && gap.v) colGapStyle.marginBottom = gap.v;
45
62
  // className前缀
46
63
  var prefixCls = getPrefixCls(pkgPrefixCls, 'col', customPrefixcls);
47
64
  var columns = 24;
@@ -52,23 +69,23 @@ var Col = function Col(props) {
52
69
  offset: offset,
53
70
  order: order
54
71
  };
55
- if (xs && winWidth > 0) {
72
+ if (xs && mergedWinWidth > 0) {
56
73
  if (xs.constructor === Number) base.span = xs;
57
74
  if (xs.constructor === Object) base = (0, _extends2.default)((0, _extends2.default)({}, base), xs);
58
75
  }
59
- if (sm && winWidth >= 600) {
76
+ if (sm && mergedWinWidth >= 600) {
60
77
  if (sm.constructor === Number) base.span = sm;
61
78
  if (sm.constructor === Object) base = (0, _extends2.default)((0, _extends2.default)({}, base), sm);
62
79
  }
63
- if (md && winWidth >= 1024) {
80
+ if (md && mergedWinWidth >= 1024) {
64
81
  if (md.constructor === Number) base.span = md;
65
82
  if (md.constructor === Object) base = (0, _extends2.default)((0, _extends2.default)({}, base), md);
66
83
  }
67
- if (lg && winWidth >= 1280) {
84
+ if (lg && mergedWinWidth >= 1280) {
68
85
  if (lg.constructor === Number) base.span = lg;
69
86
  if (lg.constructor === Object) base = (0, _extends2.default)((0, _extends2.default)({}, base), lg);
70
87
  }
71
- if (xl && winWidth >= 1920) {
88
+ if (xl && mergedWinWidth >= 1920) {
72
89
  if (xl.constructor === Number) base.span = xl;
73
90
  if (xl.constructor === Object) base = (0, _extends2.default)((0, _extends2.default)({}, base), xl);
74
91
  }
@@ -88,20 +105,18 @@ var Col = function Col(props) {
88
105
  }
89
106
  }
90
107
  }
91
- var styleString = (0, _extends2.default)({
108
+ var styleString = (0, _extends2.default)((0, _extends2.default)({
92
109
  flex: flexstr,
93
110
  maxWidth: width,
94
111
  order: base.order,
95
112
  left: base.push && base.push / columns * 100 + '%',
96
113
  right: base.pull && base.pull / columns * 100 + '%',
97
114
  marginLeft: base.offset && base.offset / columns * 100 + '%'
98
- }, style);
99
- return /*#__PURE__*/React.createElement("div", {
100
- className: (0, _classnames.default)(prefixCls, className, {
101
- 'sogou-col': isSogou
102
- }),
115
+ }, colGapStyle), style);
116
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
117
+ className: (0, _classnames.default)(prefixCls, className),
103
118
  style: styleString
104
- }, children);
119
+ }, others), children);
105
120
  };
106
121
  Col.displayName = 'Col';
107
122
  var _default = Col;
package/lib/grid/row.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
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;