@kdcloudjs/kdesign 1.7.27 → 1.7.28

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.
@@ -15,6 +15,13 @@ import usePopper from '../_utils/usePopper';
15
15
  import Option from './option';
16
16
  import escapeRegExp from 'lodash/escapeRegExp';
17
17
  import KeyCode from '../_utils/KeyCode';
18
+ import isObject from 'lodash/isObject';
19
+ var getCityId = function getCityId(data) {
20
+ if (isObject(data)) {
21
+ return data === null || data === void 0 ? void 0 : data.id;
22
+ }
23
+ return data;
24
+ };
18
25
  var InternalSelect = function InternalSelect(props, ref) {
19
26
  var _context, _classNames3, _classNames5;
20
27
  var _useContext = useContext(ConfigContext),
@@ -64,8 +71,8 @@ var InternalSelect = function InternalSelect(props, ref) {
64
71
  itemRender = selectProps.itemRender,
65
72
  onTabPaneChange = selectProps.onTabPaneChange;
66
73
  var _useMergedState = useMergedState(undefined, {
67
- value: value,
68
- defaultValue: defaultValue
74
+ value: getCityId(value),
75
+ defaultValue: getCityId(defaultValue)
69
76
  }),
70
77
  _useMergedState2 = _slicedToArray(_useMergedState, 2),
71
78
  initValue = _useMergedState2[0],
@@ -114,6 +121,10 @@ var InternalSelect = function InternalSelect(props, ref) {
114
121
  useEffect(function () {
115
122
  var _context2;
116
123
  if (typeof value === 'undefined') return;
124
+ if (isObject(value)) {
125
+ setSeletedCity(value);
126
+ return;
127
+ }
117
128
  var cityList = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(commonList), _toConsumableArray(domesticList), _toConsumableArray(foreignList));
118
129
  var city = _findInstanceProperty(cityList).call(cityList, function (city) {
119
130
  return city.id === value;
@@ -214,6 +225,7 @@ var InternalSelect = function InternalSelect(props, ref) {
214
225
  };
215
226
  var handleOption = function handleOption(city) {
216
227
  handleVisibleChange(false);
228
+ city.type = tabsValue === 'domestic' ? 'domestic' : 'foreign';
217
229
  (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));
218
230
  if (typeof value === 'undefined') {
219
231
  setSeletedCity(city);
@@ -279,17 +291,22 @@ var InternalSelect = function InternalSelect(props, ref) {
279
291
  var symbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', ';
280
292
  if (!data) return null;
281
293
  if (isDomestic(type)) {
282
- var _context4;
294
+ var _context5;
283
295
  if (isCommon) {
284
296
  var _context3;
285
297
  var _curVal = (data === null || data === void 0 ? void 0 : data.province) ? data === null || data === void 0 ? void 0 : data.province : data === null || data === void 0 ? void 0 : data.country;
286
298
  return _concatInstanceProperty(_context3 = "".concat(flag && _curVal ? symbol : '')).call(_context3, _curVal);
287
299
  }
288
- var curVal = tabsValue === 'domestic' ? data === null || data === void 0 ? void 0 : data.province : data === null || data === void 0 ? void 0 : data.country;
289
- return _concatInstanceProperty(_context4 = "".concat(flag && curVal ? symbol : '')).call(_context4, curVal);
300
+ if (data === null || data === void 0 ? void 0 : data.type) {
301
+ var _context4;
302
+ var _curVal2 = data.type === 'domestic' ? (data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country) : data === null || data === void 0 ? void 0 : data.country;
303
+ return _concatInstanceProperty(_context4 = "".concat(flag && _curVal2 ? symbol : '')).call(_context4, _curVal2);
304
+ }
305
+ var curVal = tabsValue === 'domestic' ? (data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country) : data === null || data === void 0 ? void 0 : data.country;
306
+ return _concatInstanceProperty(_context5 = "".concat(flag && curVal ? symbol : '')).call(_context5, curVal);
290
307
  } else {
291
- var _context5, _context6, _context7;
292
- return _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = "".concat(flag && ((data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country)) ? symbol : '')).call(_context7, data === null || data === void 0 ? void 0 : data.province)).call(_context6, (data === null || data === void 0 ? void 0 : data.country) && (data === null || data === void 0 ? void 0 : data.province) ? symbol : '')).call(_context5, data === null || data === void 0 ? void 0 : data.country);
308
+ var _context6, _context7, _context8;
309
+ return _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _concatInstanceProperty(_context8 = "".concat(flag && ((data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country)) ? symbol : '')).call(_context8, data === null || data === void 0 ? void 0 : data.province)).call(_context7, (data === null || data === void 0 ? void 0 : data.country) && (data === null || data === void 0 ? void 0 : data.province) ? symbol : '')).call(_context6, data === null || data === void 0 ? void 0 : data.country);
293
310
  }
294
311
  }, [type, tabsValue]);
295
312
  var renderSingle = function renderSingle() {
@@ -4,6 +4,7 @@ export declare type City = {
4
4
  country?: string;
5
5
  province?: string;
6
6
  name?: string;
7
+ type?: 'domestic' | 'foreign';
7
8
  [key: string]: any;
8
9
  };
9
10
  export declare const BorderTypes: ["none", "underline", "bordered"];
@@ -33,7 +34,7 @@ export interface CityPickerProps {
33
34
  clearIcon?: React.ReactNode;
34
35
  suffixIcon?: React.ReactNode;
35
36
  optionHighlightProps?: string;
36
- value?: string | number;
37
+ value?: string | number | City;
37
38
  defaultValue?: string | number;
38
39
  description?: React.ReactNode;
39
40
  showDescription?: boolean;
@@ -166,6 +166,7 @@
166
166
  opacity: 0;
167
167
  z-index: 1;
168
168
  position: absolute;
169
+ top: 0;
169
170
  background: #fff;
170
171
  -webkit-transition: opacity 0.15s ease;
171
172
  transition: opacity 0.15s ease;
@@ -181,6 +182,14 @@
181
182
  text-overflow: ellipsis;
182
183
  right: 24px;
183
184
  left: 0;
185
+ top: 0;
186
+ bottom: 0;
187
+ display: -webkit-box;
188
+ display: -ms-flexbox;
189
+ display: flex;
190
+ -webkit-box-align: center;
191
+ -ms-flex-align: center;
192
+ align-items: center;
184
193
  }
185
194
  .kd-city-picker-borderless {
186
195
  border: none;
@@ -387,6 +396,8 @@
387
396
  }
388
397
  .kd-city-picker-suffix {
389
398
  right: 0;
399
+ top: 0;
400
+ bottom: 0;
390
401
  position: absolute;
391
402
  display: -webkit-box;
392
403
  display: -ms-flexbox;
@@ -58,6 +58,7 @@
58
58
  opacity: 0;
59
59
  z-index: 1;
60
60
  position: absolute;
61
+ top: 0;
61
62
  background: #fff;
62
63
  transition: opacity 0.15s ease;
63
64
  &:hover {
@@ -74,6 +75,10 @@
74
75
  text-overflow: ellipsis;
75
76
  right: 24px;
76
77
  left: 0;
78
+ top: 0;
79
+ bottom: 0;
80
+ display: flex;
81
+ align-items: center;
77
82
  }
78
83
 
79
84
  &-borderless {
@@ -277,6 +282,8 @@
277
282
 
278
283
  &-suffix {
279
284
  right: 0;
285
+ top: 0;
286
+ bottom: 0;
280
287
  position: absolute;
281
288
  display: flex;
282
289
  flex: 0;
package/es/grid/col.js CHANGED
@@ -29,7 +29,7 @@ var Col = function Col(props) {
29
29
  className = _getCompProps.className,
30
30
  customPrefixcls = _getCompProps.prefixCls;
31
31
  // 浏览器名称
32
- var isSogou = testBrowserType(/^sogou/i, 0);
32
+ var isSogou = testBrowserType(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
33
33
  // className前缀
34
34
  var prefixCls = getPrefixCls(pkgPrefixCls, 'col', customPrefixcls);
35
35
  var columns = 24;
package/es/grid/row.js CHANGED
@@ -38,7 +38,7 @@ var Row = function Row(props) {
38
38
  justify = _getCompProps.justify,
39
39
  customPrefixcls = _getCompProps.prefixCls;
40
40
  // 浏览器名称
41
- var isSogou = testBrowserType(/^sogou/i, 0);
41
+ var isSogou = testBrowserType(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
42
42
  // className前缀
43
43
  var prefixCls = getPrefixCls(pkgPrefixCls, 'row', customPrefixcls);
44
44
  var _React$useState = React.useState(window.innerWidth),
@@ -629,9 +629,9 @@ var InternalSelect = function InternalSelect(props, ref) {
629
629
  onFocus: handleFocus,
630
630
  onBlur: handleBlur,
631
631
  readOnly: !isShowSearch || !!disabled
632
- })), singleVal && !searchValue && /*#__PURE__*/React.createElement("span", {
632
+ })), singleVal && !searchValue ? /*#__PURE__*/React.createElement("span", {
633
633
  className: "".concat(selectPrefixCls, "-selection-item")
634
- }, singleVal), /*#__PURE__*/React.createElement("span", {
634
+ }, singleVal) : null, /*#__PURE__*/React.createElement("span", {
635
635
  className: "".concat(selectPrefixCls, "-placeholder"),
636
636
  style: hiddenStyle
637
637
  }, placeholder), /*#__PURE__*/React.createElement("span", {
@@ -282,7 +282,7 @@
282
282
  @radio-border-width: 1px;
283
283
  @radio-margin-right: 8px;
284
284
  @radio-transition-fn: cubic-bezier(0.075, 0.82, 0.165, 1);
285
- @radio-circle-size: 13px;
285
+ @radio-circle-size: 14px;
286
286
  @radio-square-height: 32px;
287
287
  @radio-square-padding: 0 20px;
288
288
  @radio-button-height: 24px;
@@ -706,4 +706,4 @@
706
706
  @advancedSelector-dropdown-options-height: 32px;
707
707
  @advancedSelector-hover-bg: @hover-color;
708
708
 
709
- /* ----------- AdvancedSelector ——————---- end */
709
+ /* ----------- AdvancedSelector ——————---- end */
@@ -25,8 +25,15 @@ var _usePopper = _interopRequireDefault(require("../_utils/usePopper"));
25
25
  var _option = _interopRequireDefault(require("./option"));
26
26
  var _escapeRegExp = _interopRequireDefault(require("lodash/escapeRegExp"));
27
27
  var _KeyCode = _interopRequireDefault(require("../_utils/KeyCode"));
28
+ var _isObject = _interopRequireDefault(require("lodash/isObject"));
28
29
  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); }
29
30
  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; }
31
+ var getCityId = function getCityId(data) {
32
+ if ((0, _isObject.default)(data)) {
33
+ return data === null || data === void 0 ? void 0 : data.id;
34
+ }
35
+ return data;
36
+ };
30
37
  var InternalSelect = function InternalSelect(props, ref) {
31
38
  var _context, _classNames3, _classNames5;
32
39
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
@@ -76,8 +83,8 @@ var InternalSelect = function InternalSelect(props, ref) {
76
83
  itemRender = selectProps.itemRender,
77
84
  onTabPaneChange = selectProps.onTabPaneChange;
78
85
  var _useMergedState = (0, _hooks.useMergedState)(undefined, {
79
- value: value,
80
- defaultValue: defaultValue
86
+ value: getCityId(value),
87
+ defaultValue: getCityId(defaultValue)
81
88
  }),
82
89
  _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
83
90
  initValue = _useMergedState2[0],
@@ -126,6 +133,10 @@ var InternalSelect = function InternalSelect(props, ref) {
126
133
  (0, _react.useEffect)(function () {
127
134
  var _context2;
128
135
  if (typeof value === 'undefined') return;
136
+ if ((0, _isObject.default)(value)) {
137
+ setSeletedCity(value);
138
+ return;
139
+ }
129
140
  var cityList = (0, _concat.default)(_context2 = []).call(_context2, (0, _toConsumableArray2.default)(commonList), (0, _toConsumableArray2.default)(domesticList), (0, _toConsumableArray2.default)(foreignList));
130
141
  var city = (0, _find.default)(cityList).call(cityList, function (city) {
131
142
  return city.id === value;
@@ -226,6 +237,7 @@ var InternalSelect = function InternalSelect(props, ref) {
226
237
  };
227
238
  var handleOption = function handleOption(city) {
228
239
  handleVisibleChange(false);
240
+ city.type = tabsValue === 'domestic' ? 'domestic' : 'foreign';
229
241
  (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));
230
242
  if (typeof value === 'undefined') {
231
243
  setSeletedCity(city);
@@ -291,17 +303,22 @@ var InternalSelect = function InternalSelect(props, ref) {
291
303
  var symbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', ';
292
304
  if (!data) return null;
293
305
  if (isDomestic(type)) {
294
- var _context4;
306
+ var _context5;
295
307
  if (isCommon) {
296
308
  var _context3;
297
309
  var _curVal = (data === null || data === void 0 ? void 0 : data.province) ? data === null || data === void 0 ? void 0 : data.province : data === null || data === void 0 ? void 0 : data.country;
298
310
  return (0, _concat.default)(_context3 = "".concat(flag && _curVal ? symbol : '')).call(_context3, _curVal);
299
311
  }
300
- var curVal = tabsValue === 'domestic' ? data === null || data === void 0 ? void 0 : data.province : data === null || data === void 0 ? void 0 : data.country;
301
- return (0, _concat.default)(_context4 = "".concat(flag && curVal ? symbol : '')).call(_context4, curVal);
312
+ if (data === null || data === void 0 ? void 0 : data.type) {
313
+ var _context4;
314
+ var _curVal2 = data.type === 'domestic' ? (data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country) : data === null || data === void 0 ? void 0 : data.country;
315
+ return (0, _concat.default)(_context4 = "".concat(flag && _curVal2 ? symbol : '')).call(_context4, _curVal2);
316
+ }
317
+ var curVal = tabsValue === 'domestic' ? (data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country) : data === null || data === void 0 ? void 0 : data.country;
318
+ return (0, _concat.default)(_context5 = "".concat(flag && curVal ? symbol : '')).call(_context5, curVal);
302
319
  } else {
303
- var _context5, _context6, _context7;
304
- return (0, _concat.default)(_context5 = (0, _concat.default)(_context6 = (0, _concat.default)(_context7 = "".concat(flag && ((data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country)) ? symbol : '')).call(_context7, data === null || data === void 0 ? void 0 : data.province)).call(_context6, (data === null || data === void 0 ? void 0 : data.country) && (data === null || data === void 0 ? void 0 : data.province) ? symbol : '')).call(_context5, data === null || data === void 0 ? void 0 : data.country);
320
+ var _context6, _context7, _context8;
321
+ return (0, _concat.default)(_context6 = (0, _concat.default)(_context7 = (0, _concat.default)(_context8 = "".concat(flag && ((data === null || data === void 0 ? void 0 : data.province) || (data === null || data === void 0 ? void 0 : data.country)) ? symbol : '')).call(_context8, data === null || data === void 0 ? void 0 : data.province)).call(_context7, (data === null || data === void 0 ? void 0 : data.country) && (data === null || data === void 0 ? void 0 : data.province) ? symbol : '')).call(_context6, data === null || data === void 0 ? void 0 : data.country);
305
322
  }
306
323
  }, [type, tabsValue]);
307
324
  var renderSingle = function renderSingle() {
@@ -4,6 +4,7 @@ export declare type City = {
4
4
  country?: string;
5
5
  province?: string;
6
6
  name?: string;
7
+ type?: 'domestic' | 'foreign';
7
8
  [key: string]: any;
8
9
  };
9
10
  export declare const BorderTypes: ["none", "underline", "bordered"];
@@ -33,7 +34,7 @@ export interface CityPickerProps {
33
34
  clearIcon?: React.ReactNode;
34
35
  suffixIcon?: React.ReactNode;
35
36
  optionHighlightProps?: string;
36
- value?: string | number;
37
+ value?: string | number | City;
37
38
  defaultValue?: string | number;
38
39
  description?: React.ReactNode;
39
40
  showDescription?: boolean;
@@ -166,6 +166,7 @@
166
166
  opacity: 0;
167
167
  z-index: 1;
168
168
  position: absolute;
169
+ top: 0;
169
170
  background: #fff;
170
171
  -webkit-transition: opacity 0.15s ease;
171
172
  transition: opacity 0.15s ease;
@@ -181,6 +182,14 @@
181
182
  text-overflow: ellipsis;
182
183
  right: 24px;
183
184
  left: 0;
185
+ top: 0;
186
+ bottom: 0;
187
+ display: -webkit-box;
188
+ display: -ms-flexbox;
189
+ display: flex;
190
+ -webkit-box-align: center;
191
+ -ms-flex-align: center;
192
+ align-items: center;
184
193
  }
185
194
  .kd-city-picker-borderless {
186
195
  border: none;
@@ -387,6 +396,8 @@
387
396
  }
388
397
  .kd-city-picker-suffix {
389
398
  right: 0;
399
+ top: 0;
400
+ bottom: 0;
390
401
  position: absolute;
391
402
  display: -webkit-box;
392
403
  display: -ms-flexbox;
@@ -58,6 +58,7 @@
58
58
  opacity: 0;
59
59
  z-index: 1;
60
60
  position: absolute;
61
+ top: 0;
61
62
  background: #fff;
62
63
  transition: opacity 0.15s ease;
63
64
  &:hover {
@@ -74,6 +75,10 @@
74
75
  text-overflow: ellipsis;
75
76
  right: 24px;
76
77
  left: 0;
78
+ top: 0;
79
+ bottom: 0;
80
+ display: flex;
81
+ align-items: center;
77
82
  }
78
83
 
79
84
  &-borderless {
@@ -277,6 +282,8 @@
277
282
 
278
283
  &-suffix {
279
284
  right: 0;
285
+ top: 0;
286
+ bottom: 0;
280
287
  position: absolute;
281
288
  display: flex;
282
289
  flex: 0;
package/lib/grid/col.js CHANGED
@@ -41,7 +41,7 @@ var Col = function Col(props) {
41
41
  className = _getCompProps.className,
42
42
  customPrefixcls = _getCompProps.prefixCls;
43
43
  // 浏览器名称
44
- var isSogou = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0);
44
+ var isSogou = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
45
45
  // className前缀
46
46
  var prefixCls = getPrefixCls(pkgPrefixCls, 'col', customPrefixcls);
47
47
  var columns = 24;
package/lib/grid/row.js CHANGED
@@ -50,7 +50,7 @@ var Row = function Row(props) {
50
50
  justify = _getCompProps.justify,
51
51
  customPrefixcls = _getCompProps.prefixCls;
52
52
  // 浏览器名称
53
- var isSogou = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0);
53
+ var isSogou = (0, _testBrowserType.testBrowserType)(/^sogou/i, 0) || /Trident|MSIE/.test(navigator.userAgent);
54
54
  // className前缀
55
55
  var prefixCls = getPrefixCls(pkgPrefixCls, 'row', customPrefixcls);
56
56
  var _React$useState = React.useState(window.innerWidth),
@@ -641,9 +641,9 @@ var InternalSelect = function InternalSelect(props, ref) {
641
641
  onFocus: handleFocus,
642
642
  onBlur: handleBlur,
643
643
  readOnly: !isShowSearch || !!disabled
644
- })), singleVal && !searchValue && /*#__PURE__*/_react.default.createElement("span", {
644
+ })), singleVal && !searchValue ? /*#__PURE__*/_react.default.createElement("span", {
645
645
  className: "".concat(selectPrefixCls, "-selection-item")
646
- }, singleVal), /*#__PURE__*/_react.default.createElement("span", {
646
+ }, singleVal) : null, /*#__PURE__*/_react.default.createElement("span", {
647
647
  className: "".concat(selectPrefixCls, "-placeholder"),
648
648
  style: hiddenStyle
649
649
  }, placeholder), /*#__PURE__*/_react.default.createElement("span", {
@@ -282,7 +282,7 @@
282
282
  @radio-border-width: 1px;
283
283
  @radio-margin-right: 8px;
284
284
  @radio-transition-fn: cubic-bezier(0.075, 0.82, 0.165, 1);
285
- @radio-circle-size: 13px;
285
+ @radio-circle-size: 14px;
286
286
  @radio-square-height: 32px;
287
287
  @radio-square-padding: 0 20px;
288
288
  @radio-button-height: 24px;
@@ -706,4 +706,4 @@
706
706
  @advancedSelector-dropdown-options-height: 32px;
707
707
  @advancedSelector-hover-bg: @hover-color;
708
708
 
709
- /* ----------- AdvancedSelector ——————---- end */
709
+ /* ----------- AdvancedSelector ——————---- end */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.7.27",
3
+ "version": "1.7.28",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [