@kdcloudjs/kdesign 1.7.23 → 1.7.24

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/kdesign-complete.less +18 -7
  3. package/dist/kdesign.css +46 -8
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +425 -180
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +4 -4
  8. package/dist/kdesign.min.js +8 -8
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/_utils/usePopper.js +36 -19
  11. package/es/city-picker/city-picker.js +6 -3
  12. package/es/city-picker/interface.d.ts +1 -0
  13. package/es/city-picker/style/index.css +2 -0
  14. package/es/city-picker/style/index.less +1 -0
  15. package/es/input-number/inputNumber.js +5 -2
  16. package/es/radio/style/index.css +1 -0
  17. package/es/radio/style/index.less +1 -0
  18. package/es/search/search.js +2 -1
  19. package/es/select/select.js +3 -2
  20. package/es/select/style/index.css +6 -3
  21. package/es/select/style/index.less +10 -4
  22. package/es/select/style/token.less +1 -1
  23. package/es/style/core/motion/slide.less +5 -2
  24. package/es/style/index.css +36 -4
  25. package/es/table/api.js +19 -3
  26. package/lib/_utils/usePopper.js +36 -19
  27. package/lib/city-picker/city-picker.js +6 -3
  28. package/lib/city-picker/interface.d.ts +1 -0
  29. package/lib/city-picker/style/index.css +2 -0
  30. package/lib/city-picker/style/index.less +1 -0
  31. package/lib/input-number/inputNumber.js +5 -2
  32. package/lib/radio/style/index.css +1 -0
  33. package/lib/radio/style/index.less +1 -0
  34. package/lib/search/search.js +2 -1
  35. package/lib/select/select.js +3 -2
  36. package/lib/select/style/index.css +6 -3
  37. package/lib/select/style/index.less +10 -4
  38. package/lib/select/style/token.less +1 -1
  39. package/lib/style/core/motion/slide.less +5 -2
  40. package/lib/style/index.css +36 -4
  41. package/lib/table/api.js +19 -3
  42. package/package.json +2 -2
@@ -61,7 +61,8 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
61
61
  suffix = inputNumberProps.suffix,
62
62
  formatter = inputNumberProps.formatter,
63
63
  className = inputNumberProps.className,
64
- others = __rest(inputNumberProps, ["value", "defaultValue", "mustInScope", "decimalLength", "mustInPrecisionScope", "digitLength", "onChange", "symbol", "zeroShow", "showDecimalTailZero", "code", "roundMethod", "mask", "stepOption", "min", "minMark", "max", "maxMark", "numberMode", "prefix", "suffix", "formatter", "className"]);
64
+ onKeyDown = inputNumberProps.onKeyDown,
65
+ others = __rest(inputNumberProps, ["value", "defaultValue", "mustInScope", "decimalLength", "mustInPrecisionScope", "digitLength", "onChange", "symbol", "zeroShow", "showDecimalTailZero", "code", "roundMethod", "mask", "stepOption", "min", "minMark", "max", "maxMark", "numberMode", "prefix", "suffix", "formatter", "className", "onKeyDown"]);
65
66
  var initVal = value === undefined ? defaultValue : value;
66
67
  var _useState = (0, _react.useState)((0, _numberUtil.serialization)(initVal !== undefined ? initVal + '' : '')),
67
68
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -185,12 +186,13 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
185
186
  return resultNumerical;
186
187
  };
187
188
  var handleStepChang = function handleStepChang(type) {
189
+ var _a, _b;
188
190
  var step = stepOption.step === undefined ? 1 : parseFloat(stepOption.step);
189
191
  if (typeof step !== 'number') {
190
192
  (0, _devwarning.default)(true, 'inputNumber', "stepOption.step\u5FC5\u987B\u4E3A\u4E00\u4E2A\u6570\u503C");
191
193
  return false;
192
194
  }
193
- var startingNumber = parseFloat(inputNumberRef.current.value) || 0;
195
+ var startingNumber = parseFloat((_b = (_a = inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.value) || 0;
194
196
  var calculationResults = new _big.default(startingNumber)[type](step).valueOf();
195
197
  var legalNumber = verifiValue(calculationResults);
196
198
  if (legalNumber === false) {
@@ -205,6 +207,7 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
205
207
  };
206
208
  var handleKeyDown = function handleKeyDown(event) {
207
209
  var _context11;
210
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
208
211
  if (!stepOption || props.disabled || props.readOnly) {
209
212
  return;
210
213
  }
@@ -127,6 +127,7 @@
127
127
  font-size: var(--kd-c-radio-font-size, var(--kd-g-font-size-small, 12px));
128
128
  max-width: var(--kd-c-radio-default-label-max-width);
129
129
  overflow: hidden;
130
+ min-height: var(--kd-c-radio-square-sizing-width-height, 14px);
130
131
  }
131
132
  .kd-radio::before {
132
133
  position: absolute;
@@ -24,6 +24,7 @@
24
24
  font-size: @radio-font-size;
25
25
  max-width: @radio-default-label-max-width;
26
26
  overflow: hidden;
27
+ min-height: @radio-circle-size;
27
28
 
28
29
  &::before {
29
30
  position: absolute;
@@ -71,7 +71,8 @@ var InternalSearch = function InternalSearch(props, ref) {
71
71
  onSearch && (onSearch === null || onSearch === void 0 ? void 0 : onSearch(event));
72
72
  }, [onSearch]);
73
73
  var handlePressEnter = (0, _react.useCallback)(function (_, event) {
74
- onPressEnter && (onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(searchRef.current.value, event));
74
+ var _a, _b;
75
+ onPressEnter && (onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter((_b = (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.value, event));
75
76
  }, [onPressEnter, searchRef]);
76
77
  var handleFocus = (0, _react.useCallback)(function (event) {
77
78
  setFocused(true);
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
34
34
  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; }
35
35
  var INPUT_MIN_WIDTH = 4; // 输入框最小宽度
36
36
  var InternalSelect = function InternalSelect(props, ref) {
37
- var _context, _classNames6, _classNames12;
37
+ var _context, _classNames6, _classNames12, _context5;
38
38
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
39
39
  getPrefixCls = _useContext.getPrefixCls,
40
40
  prefixCls = _useContext.prefixCls,
@@ -806,6 +806,7 @@ var InternalSelect = function InternalSelect(props, ref) {
806
806
  offset = 1;
807
807
  } else if (which === _KeyCode.default.ENTER) {
808
808
  var item = filledOptions[activeIndex];
809
+ if (!item) return;
809
810
  var key = ((_a = item.props) === null || _a === void 0 ? void 0 : _a.value) || item.value;
810
811
  var label = ((_b = item.props) === null || _b === void 0 ? void 0 : _b.children) || item.label;
811
812
  handleOption(key, label, true);
@@ -881,7 +882,7 @@ var InternalSelect = function InternalSelect(props, ref) {
881
882
  }
882
883
  };
883
884
  var popperProps = (0, _extends2.default)((0, _extends2.default)({}, selectProps), {
884
- prefixCls: selectPrefixCls,
885
+ prefixCls: (0, _concat.default)(_context5 = "".concat(selectPrefixCls, "-dropdown-panel")).call(_context5, isMultiple ? " ".concat(selectPrefixCls, "-multiple-dropdown-panel") : ''),
885
886
  placement: 'bottomLeft',
886
887
  popperStyle: catchStyle(),
887
888
  defaultVisible: optionShow,
@@ -359,7 +359,7 @@
359
359
  z-index: var(--kd-c-select-z-index, var(--kd-g-z-index-popper, 1050));
360
360
  -webkit-box-sizing: border-box;
361
361
  box-sizing: border-box;
362
- padding: 8px 0;
362
+ padding: var(--kd-c-select-dropdown-spacing-padding-vertical, 8px) 0;
363
363
  margin: 0;
364
364
  overflow: auto;
365
365
  font-size: var(--kd-c-select-dropdown-font-size, 12px);
@@ -382,6 +382,9 @@
382
382
  .kd-select-dropdown-search-hidden {
383
383
  display: none;
384
384
  }
385
+ .kd-select-multiple-dropdown-panel .kd-select-dropdown {
386
+ padding-bottom: 0;
387
+ }
385
388
  .kd-select-item {
386
389
  position: relative;
387
390
  display: block;
@@ -648,8 +651,8 @@
648
651
  align-items: center;
649
652
  width: 100%;
650
653
  padding: 0 12px;
651
- height: 32px;
652
- line-height: 32px;
654
+ height: 40px;
655
+ line-height: 40px;
653
656
  border-top: 1px solid #d9d9d9;
654
657
  -webkit-box-sizing: border-box;
655
658
  box-sizing: border-box;
@@ -132,10 +132,10 @@
132
132
  left: 0;
133
133
  z-index: @select-z-index;
134
134
  box-sizing: border-box;
135
- padding: 8px 0; // update
135
+ padding: @select-dropdown-padding-vertical 0;
136
136
  margin: 0;
137
137
  overflow: auto;
138
- font-size: @select-list-font-size; // update
138
+ font-size: @select-list-font-size;
139
139
  font-variant: initial;
140
140
  background-color: @select-dropdown-bg;
141
141
  border-radius: @select-g-radius-border;
@@ -159,6 +159,12 @@
159
159
  }
160
160
  }
161
161
 
162
+ &-multiple-dropdown-panel {
163
+ .@{select-prefix-cls}-dropdown {
164
+ padding-bottom: 0;
165
+ }
166
+ }
167
+
162
168
  // 下拉列表选项
163
169
  &-item {
164
170
  .item();
@@ -404,8 +410,8 @@
404
410
  align-items: center;
405
411
  width: 100%;
406
412
  padding: 0 12px;
407
- height: 32px;
408
- line-height: 32px;
413
+ height: 40px;
414
+ line-height: 40px;
409
415
  border-top: 1px solid #d9d9d9;
410
416
  box-sizing: border-box;
411
417
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  @select-custom-prefix: ~'--@{kd-prefix}-c-select';
4
4
 
5
-
6
5
  // color
7
6
  @select-dropdown-bg: var(~'@{select-custom-prefix}-dropdown-color-background', @color-background);
8
7
  @select-disabled-option-bg: var(~'@{select-custom-prefix}-item-color-background-disabled', #fff);
@@ -45,6 +44,7 @@
45
44
  // spacing
46
45
  @select-bordered: var(~'@{select-custom-prefix}-bordered-spacing-padding-left', 8px);
47
46
  @select-wrapper-padding: var(~'@{select-custom-prefix}-wrapper-spacing-padding', 1px 28px 1px 0);
47
+ @select-dropdown-padding-vertical: var(~'@{select-custom-prefix}-dropdown-spacing-padding-vertical', 8px);
48
48
 
49
49
  // radius
50
50
  @select-g-radius-border: var(~'@{select-custom-prefix}-radius-border', @radius-border);
@@ -31,12 +31,15 @@
31
31
  .slide-motion(topLeft, kdSlideDown, kd-cascader-menus);
32
32
  .slide-motion(bottomLeft, kdSlideUp, kd-cascader-menus);
33
33
 
34
- .slide-motion(topLeft, kdSlideDown, kd-select);
35
- .slide-motion(bottomLeft, kdSlideUp, kd-select);
34
+ .slide-motion(topLeft, kdSlideDown, kd-select-dropdown-panel);
35
+ .slide-motion(bottomLeft, kdSlideUp, kd-select-dropdown-panel);
36
36
 
37
37
  .slide-motion(topLeft, kdSlideDown, kd-date-picker-panel);
38
38
  .slide-motion(bottomLeft, kdSlideUp, kd-date-picker-panel);
39
39
 
40
+ .slide-motion(topLeft, kdSlideDown, kd-city-picker-dropdown);
41
+ .slide-motion(bottomLeft, kdSlideUp, kd-city-picker-dropdown);
42
+
40
43
  @keyframes kdSlideCenterIn {
41
44
  0% {
42
45
  opacity: 0;
@@ -1361,7 +1361,7 @@
1361
1361
  -webkit-animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1362
1362
  animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1363
1363
  }
1364
- .kd-select.topLeft-active {
1364
+ .kd-select-dropdown-panel.topLeft-active {
1365
1365
  -webkit-animation-name: kdSlideDownIn;
1366
1366
  animation-name: kdSlideDownIn;
1367
1367
  -webkit-animation-duration: calc(0.3s - 0.1s);
@@ -1369,7 +1369,7 @@
1369
1369
  -webkit-animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1370
1370
  animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1371
1371
  }
1372
- .kd-select.topLeft.hidden {
1372
+ .kd-select-dropdown-panel.topLeft.hidden {
1373
1373
  -webkit-animation-name: kdSlideDownOut;
1374
1374
  animation-name: kdSlideDownOut;
1375
1375
  -webkit-animation-duration: 0.1s;
@@ -1377,7 +1377,7 @@
1377
1377
  -webkit-animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1378
1378
  animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1379
1379
  }
1380
- .kd-select.bottomLeft-active {
1380
+ .kd-select-dropdown-panel.bottomLeft-active {
1381
1381
  -webkit-animation-name: kdSlideUpIn;
1382
1382
  animation-name: kdSlideUpIn;
1383
1383
  -webkit-animation-duration: calc(0.3s - 0.1s);
@@ -1385,7 +1385,7 @@
1385
1385
  -webkit-animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1386
1386
  animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1387
1387
  }
1388
- .kd-select.bottomLeft.hidden {
1388
+ .kd-select-dropdown-panel.bottomLeft.hidden {
1389
1389
  -webkit-animation-name: kdSlideUpOut;
1390
1390
  animation-name: kdSlideUpOut;
1391
1391
  -webkit-animation-duration: 0.1s;
@@ -1425,6 +1425,38 @@
1425
1425
  -webkit-animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1426
1426
  animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1427
1427
  }
1428
+ .kd-city-picker-dropdown.topLeft-active {
1429
+ -webkit-animation-name: kdSlideDownIn;
1430
+ animation-name: kdSlideDownIn;
1431
+ -webkit-animation-duration: calc(0.3s - 0.1s);
1432
+ animation-duration: calc(0.3s - 0.1s);
1433
+ -webkit-animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1434
+ animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1435
+ }
1436
+ .kd-city-picker-dropdown.topLeft.hidden {
1437
+ -webkit-animation-name: kdSlideDownOut;
1438
+ animation-name: kdSlideDownOut;
1439
+ -webkit-animation-duration: 0.1s;
1440
+ animation-duration: 0.1s;
1441
+ -webkit-animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1442
+ animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1443
+ }
1444
+ .kd-city-picker-dropdown.bottomLeft-active {
1445
+ -webkit-animation-name: kdSlideUpIn;
1446
+ animation-name: kdSlideUpIn;
1447
+ -webkit-animation-duration: calc(0.3s - 0.1s);
1448
+ animation-duration: calc(0.3s - 0.1s);
1449
+ -webkit-animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1450
+ animation-timing-function: cubic-bezier(0, 0.4, 0.4, 1);
1451
+ }
1452
+ .kd-city-picker-dropdown.bottomLeft.hidden {
1453
+ -webkit-animation-name: kdSlideUpOut;
1454
+ animation-name: kdSlideUpOut;
1455
+ -webkit-animation-duration: 0.1s;
1456
+ animation-duration: 0.1s;
1457
+ -webkit-animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1458
+ animation-timing-function: cubic-bezier(0.4, 0, 1, 0.6);
1459
+ }
1428
1460
  @-webkit-keyframes kdSlideCenterIn {
1429
1461
  0% {
1430
1462
  opacity: 0;
package/lib/table/api.js CHANGED
@@ -84,7 +84,7 @@ function getApi(pipelineRef) {
84
84
  * @returns
85
85
  */
86
86
  function ensureColumnVisible(code) {
87
- var _a, _b;
87
+ var _a, _b, _c, _d;
88
88
  var pipeline = pipelineRef.current;
89
89
  var tableBodyContainer = (_a = pipeline.ref) === null || _a === void 0 ? void 0 : _a.current.domHelper.tableBody;
90
90
  var tableScroll = (_b = pipeline.ref) === null || _b === void 0 ? void 0 : _b.current.domHelper.stickyScroll;
@@ -100,14 +100,30 @@ function getApi(pipelineRef) {
100
100
  var colLeft = (0, _slice.default)(columnNodes).call(columnNodes, 0, index).reduce(function (acc, col) {
101
101
  return acc + col.width;
102
102
  }, 0);
103
+ var lockColumnLeft = 0;
104
+ var lockColumnRight = 0;
105
+ for (var i = 0; i < columnNodes.length; i++) {
106
+ if ((_c = columnNodes[i]) === null || _c === void 0 ? void 0 : _c.lock) {
107
+ lockColumnLeft += columnNodes[i].width;
108
+ } else {
109
+ break;
110
+ }
111
+ }
112
+ for (var _i = columnNodes.length - 1; _i >= 0; _i--) {
113
+ if ((_d = columnNodes[_i]) === null || _d === void 0 ? void 0 : _d.lock) {
114
+ lockColumnRight += columnNodes[_i].width;
115
+ } else {
116
+ break;
117
+ }
118
+ }
103
119
  var colLeftPixel = colLeft; // 目标列前面列宽总和
104
120
  var colRightPixel = colLeftPixel + column.width;
105
121
  var viewportWidth = tableBodyContainer.clientWidth; // 表体容器的宽度
106
122
  var scrollPosition = tableScroll.scrollLeft; // 滚动条滚动的距离
107
123
  var vScrollLeft = scrollPosition;
108
124
  var vScrollRight = scrollPosition + viewportWidth;
109
- var pxLeft = colLeftPixel;
110
- var pxRight = colRightPixel - viewportWidth;
125
+ var pxLeft = colLeftPixel - lockColumnLeft;
126
+ var pxRight = colRightPixel - viewportWidth + lockColumnRight;
111
127
  var colBeforeViewport = vScrollLeft > colLeftPixel; // 滚动距离大于目标列前面列宽总和,说明目标列在视口之前
112
128
  var colPastViewport = vScrollRight < colRightPixel; // 目标列是视口之后
113
129
  var colToSmallForViewport = viewportWidth < column.width;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.7.23",
3
+ "version": "1.7.24",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [
@@ -78,7 +78,7 @@
78
78
  "@babel/runtime-corejs3": "^7.11.2",
79
79
  "@babel/standalone": "^7.14.3",
80
80
  "@kdcloudjs/kdesign-icons": "^1.0.0",
81
- "@kdcloudjs/table": "1.1.6-canary.2",
81
+ "@kdcloudjs/table": "1.2.0-canary.1",
82
82
  "@popperjs/core": "^2.5.4",
83
83
  "@types/js-cookie": "^3.0.3",
84
84
  "async-validator": "^3.5.1",