@kdcloudjs/kdesign 1.6.4 → 1.6.6

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 (78) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/kdesign-complete.less +110 -87
  3. package/dist/kdesign.css +44 -32
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +125 -57
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +6 -6
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/_utils/hooks.js +1 -9
  11. package/es/cascader/cascader.js +2 -2
  12. package/es/cascader/style/index.css +4 -1
  13. package/es/cascader/style/index.less +5 -1
  14. package/es/cascader/style/token.less +1 -0
  15. package/es/config-provider/compDefaultProps.d.ts +1 -0
  16. package/es/config-provider/compDefaultProps.js +1 -0
  17. package/es/input/TextArea.d.ts +1 -0
  18. package/es/input/TextArea.js +8 -6
  19. package/es/input/style/index.css +10 -3
  20. package/es/input/style/index.less +7 -0
  21. package/es/input/style/token.less +1 -1
  22. package/es/locale/locale.d.ts +2 -3
  23. package/es/locale/zh-CN.d.ts +2 -0
  24. package/es/locale/zh-CN.js +3 -1
  25. package/es/pagination/pagination.d.ts +3 -0
  26. package/es/pagination/pagination.js +34 -15
  27. package/es/pagination/style/index.css +24 -21
  28. package/es/pagination/style/index.less +85 -79
  29. package/es/rate/rate.js +1 -1
  30. package/es/rate/style/index.css +3 -3
  31. package/es/rate/style/index.less +9 -3
  32. package/es/search/search.js +12 -6
  33. package/es/table/interface.d.ts +8 -0
  34. package/es/table/table.d.ts +2 -2
  35. package/es/table/table.js +18 -6
  36. package/es/tooltip/style/index.css +1 -1
  37. package/es/tooltip/style/token.less +1 -1
  38. package/es/transfer/list.d.ts +1 -1
  39. package/es/transfer/list.js +8 -2
  40. package/es/transfer/transfer.d.ts +1 -1
  41. package/es/transfer/transfer.js +29 -4
  42. package/es/upload/style/index.css +1 -2
  43. package/es/upload/style/index.less +1 -2
  44. package/lib/_utils/hooks.js +1 -9
  45. package/lib/cascader/cascader.js +2 -2
  46. package/lib/cascader/style/index.css +4 -1
  47. package/lib/cascader/style/index.less +5 -1
  48. package/lib/cascader/style/token.less +1 -0
  49. package/lib/config-provider/compDefaultProps.d.ts +1 -0
  50. package/lib/config-provider/compDefaultProps.js +1 -0
  51. package/lib/input/TextArea.d.ts +1 -0
  52. package/lib/input/TextArea.js +9 -7
  53. package/lib/input/style/index.css +10 -3
  54. package/lib/input/style/index.less +7 -0
  55. package/lib/input/style/token.less +1 -1
  56. package/lib/locale/locale.d.ts +2 -3
  57. package/lib/locale/zh-CN.d.ts +2 -0
  58. package/lib/locale/zh-CN.js +3 -1
  59. package/lib/pagination/pagination.d.ts +3 -0
  60. package/lib/pagination/pagination.js +36 -16
  61. package/lib/pagination/style/index.css +24 -21
  62. package/lib/pagination/style/index.less +85 -79
  63. package/lib/rate/rate.js +1 -1
  64. package/lib/rate/style/index.css +3 -3
  65. package/lib/rate/style/index.less +9 -3
  66. package/lib/search/search.js +12 -6
  67. package/lib/table/interface.d.ts +8 -0
  68. package/lib/table/table.d.ts +2 -2
  69. package/lib/table/table.js +17 -4
  70. package/lib/tooltip/style/index.css +1 -1
  71. package/lib/tooltip/style/token.less +1 -1
  72. package/lib/transfer/list.d.ts +1 -1
  73. package/lib/transfer/list.js +8 -1
  74. package/lib/transfer/transfer.d.ts +1 -1
  75. package/lib/transfer/transfer.js +29 -3
  76. package/lib/upload/style/index.css +1 -2
  77. package/lib/upload/style/index.less +1 -2
  78. package/package.json +1 -1
@@ -9,13 +9,19 @@
9
9
  display: inline-flex;
10
10
  justify-content: flex-start;
11
11
  &-size-large {
12
- font-size: @rate-large-font-size;
12
+ .@{kd-prefix}icon {
13
+ font-size: @rate-large-font-size;
14
+ }
13
15
  }
14
16
  &-size-middle {
15
- font-size: @rate-middle-font-size;
17
+ .@{kd-prefix}icon {
18
+ font-size: @rate-middle-font-size;
19
+ }
16
20
  }
17
21
  &-size-small {
18
- font-size: @rate-small-font-size;
22
+ .@{kd-prefix}icon {
23
+ font-size: @rate-small-font-size;
24
+ }
19
25
  }
20
26
  }
21
27
  .@{rate-prefix-cls}-item {
@@ -85,7 +85,9 @@ var InternalSearch = function InternalSearch(props, ref) {
85
85
  type = searchProps.type,
86
86
  placeholder = searchProps.placeholder,
87
87
  onSearch = searchProps.onSearch,
88
- restProps = __rest(searchProps, ["prefixCls", "className", "style", "size", "disabled", "onPressEnter", "prefix", "suffix", "borderType", "children", "type", "placeholder", "onSearch"]);
88
+ onFocus = searchProps.onFocus,
89
+ onBlur = searchProps.onBlur,
90
+ restProps = __rest(searchProps, ["prefixCls", "className", "style", "size", "disabled", "onPressEnter", "prefix", "suffix", "borderType", "children", "type", "placeholder", "onSearch", "onFocus", "onBlur"]);
89
91
 
90
92
  (0, _devwarning.default)(_interface.SearchSizeTypes.indexOf(size) === -1, 'search', "cannot found search size '".concat(size, "'"));
91
93
  (0, _devwarning.default)(_interface.BorderTypes.indexOf(borderType) === -1, 'search', "cannot found search borderType '".concat(borderType, "'"));
@@ -104,12 +106,14 @@ var InternalSearch = function InternalSearch(props, ref) {
104
106
  var handlePressEnter = (0, _react.useCallback)(function (_, event) {
105
107
  onPressEnter && (onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(searchRef.current.value, event));
106
108
  }, [onPressEnter, searchRef]);
107
- var handleFocus = (0, _react.useCallback)(function () {
109
+ var handleFocus = (0, _react.useCallback)(function (event) {
108
110
  setFocused(true);
109
- }, []);
110
- var handleBlur = (0, _react.useCallback)(function () {
111
+ onFocus && onFocus(event);
112
+ }, [onFocus]);
113
+ var handleBlur = (0, _react.useCallback)(function (event) {
111
114
  setFocused(false);
112
- }, []);
115
+ onBlur && onBlur(event);
116
+ }, [onBlur]);
113
117
  var renderPrefix = (0, _react.useCallback)(function () {
114
118
  if (!prefix) {
115
119
  return null;
@@ -142,7 +146,9 @@ var InternalSearch = function InternalSearch(props, ref) {
142
146
  onSearch: onSearch,
143
147
  className: className,
144
148
  style: style,
145
- placeholder: placeholder
149
+ placeholder: placeholder,
150
+ onFocus: onFocus,
151
+ onBlur: onBlur
146
152
  }), children);
147
153
  }
148
154
 
@@ -10,6 +10,14 @@ declare type TablePropsOfComponents = Pick<BaseTableProps, 'components'> & {
10
10
  };
11
11
  };
12
12
  declare type TablePropsOfExtend = Omit<BaseTableProps, 'components'>;
13
+ export declare type TableApi = {
14
+ getColumns: () => any[];
15
+ getDataSource: () => any[];
16
+ getFooterDataSource: () => any[];
17
+ };
18
+ export declare type TableInstance = {
19
+ api: TableApi;
20
+ };
13
21
  export interface TableProps extends TablePropsOfExtend, TablePropsOfComponents {
14
22
  rowSelection?: TableRowSelection;
15
23
  prefixCls?: string;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { TableProps } from './interface';
3
- declare function Table(props: TableProps): JSX.Element;
3
+ declare const Table: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<unknown>>;
4
4
  export default Table;
@@ -59,7 +59,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
59
59
 
60
60
  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; }
61
61
 
62
- function Table(props) {
62
+ var Table = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
63
63
  var columns = props.columns,
64
64
  dataSource = props.dataSource,
65
65
  columnDrag = props.columnDrag,
@@ -107,19 +107,32 @@ function Table(props) {
107
107
  columns: columns,
108
108
  dataSource: dataSource
109
109
  });
110
+ var pipelineRef = (0, _react.useRef)(pipeline);
111
+ pipelineRef.current = pipeline;
110
112
 
111
113
  if (footerDataSource) {
112
114
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
113
115
  // @ts-ignore
114
116
  pipeline.footerDataSource(footerDataSource);
115
117
  }
118
+
119
+ (0, _react.useImperativeHandle)(ref, function () {
120
+ var _a, _b, _c;
121
+
122
+ return {
123
+ api: {
124
+ getColumns: (_a = pipelineRef.current.getColumns) === null || _a === void 0 ? void 0 : _a.bind(pipelineRef.current),
125
+ getDataSource: (_b = pipelineRef.current.getDataSource) === null || _b === void 0 ? void 0 : _b.bind(pipelineRef.current),
126
+ getFooterDataSource: (_c = pipelineRef.current.getFooterDataSource) === null || _c === void 0 ? void 0 : _c.bind(pipelineRef.current)
127
+ }
128
+ };
129
+ });
116
130
  /* -------------------------------------------------------------------------- */
117
131
 
118
132
  /* features */
119
133
 
120
134
  /* -------------------------------------------------------------------------- */
121
135
 
122
-
123
136
  (0, _rowSelection.default)(pipeline, rowSelection);
124
137
  (0, _rowDetail.default)(pipeline, rowDetail);
125
138
  (0, _filter2.default)(pipeline, filter);
@@ -174,7 +187,7 @@ function Table(props) {
174
187
  scrollbarWidth: scrollbarWidth,
175
188
  scrollLoad: scrollLoad
176
189
  }));
177
- }
178
-
190
+ });
191
+ Table.displayName = 'Table';
179
192
  var _default = Table;
180
193
  exports.default = _default;
@@ -114,7 +114,7 @@
114
114
  -webkit-font-feature-settings: 'tnum';
115
115
  font-feature-settings: 'tnum';
116
116
  max-width: var(--kd-c-tooltip-sizing-max-width, 360px);
117
- padding: var(--kd-c-tooltip-spacing-padding-vertical, 8px) var(--kd-c-tooltip-spacing-padding-vertical, 12px);
117
+ padding: var(--kd-c-tooltip-spacing-padding-vertical, 8px) var(--kd-c-tooltip-spacing-padding-horizontal, 12px);
118
118
  color: var(--kd-c-tooltip-color-text, var(--kd-g-color-text-primary, #212121));
119
119
  border-radius: var(--kd-c-tooltip-radius-border, var(--kd-g-radius-border, 2px));
120
120
  font-size: var(--kd-c-tooltip-color-text, var(--kd-g-font-size-small, 12px));
@@ -11,7 +11,7 @@
11
11
 
12
12
  // spacing
13
13
  @tooltip-vertical-gap: var(~'@{tooltip-custom-prefix}-spacing-padding-vertical', 8px);
14
- @tooltip-horizontal-gap: var(~'@{tooltip-custom-prefix}-spacing-padding-vertical', 12px);
14
+ @tooltip-horizontal-gap: var(~'@{tooltip-custom-prefix}-spacing-padding-horizontal', 12px);
15
15
 
16
16
  // sizing
17
17
  @tooltip-max-width: var(~'@{tooltip-custom-prefix}-sizing-max-width', 360px);
@@ -32,5 +32,5 @@ export interface TransferListProps {
32
32
  showRemove?: boolean;
33
33
  pagination?: PaginationType;
34
34
  }
35
- declare const TransferList: React.FC<TransferListProps>;
35
+ declare const TransferList: React.ForwardRefExoticComponent<TransferListProps & React.RefAttributes<unknown>>;
36
36
  export default TransferList;
@@ -49,7 +49,7 @@ function isRenderResultPlainObject(result) {
49
49
  return result && ! /*#__PURE__*/_react.default.isValidElement(result) && Object.prototype.toString.call(result) === '[object Object]';
50
50
  }
51
51
 
52
- var TransferList = function TransferList(props) {
52
+ var ITransferList = function ITransferList(props, ref) {
53
53
  var _classNames;
54
54
 
55
55
  var prefixCls = props.prefixCls,
@@ -80,6 +80,11 @@ var TransferList = function TransferList(props) {
80
80
 
81
81
 
82
82
  var footerDom = footer && footer(props);
83
+ (0, _react.useImperativeHandle)(ref, function () {
84
+ return {
85
+ onClear: onClear
86
+ };
87
+ });
83
88
 
84
89
  var renderItem = function renderItem(item) {
85
90
  var renderResult = render(item);
@@ -258,6 +263,8 @@ var TransferList = function TransferList(props) {
258
263
  }, getSelectAllLabel(checkedKeys.length, filteredItems.length))), listBody, listFooter);
259
264
  };
260
265
 
266
+ var TransferList = /*#__PURE__*/_react.default.forwardRef(ITransferList);
267
+
261
268
  TransferList.defaultProps = {
262
269
  dataSource: [],
263
270
  titleText: '',
@@ -29,5 +29,5 @@ export interface TransferProps {
29
29
  pagination?: PaginationType;
30
30
  footer?: (props: TransferListProps) => React.ReactNode;
31
31
  }
32
- declare const Transfer: React.FC<TransferProps>;
32
+ declare const Transfer: React.ForwardRefExoticComponent<TransferProps & React.RefAttributes<unknown>>;
33
33
  export default Transfer;
@@ -47,7 +47,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
47
47
 
48
48
  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; }
49
49
 
50
- var Transfer = function Transfer(props) {
50
+ var InternalTransfer = function InternalTransfer(props, ref) {
51
51
  var _classNames;
52
52
 
53
53
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
@@ -108,6 +108,8 @@ var Transfer = function Transfer(props) {
108
108
  targetSelectedKeys = _useState4[0],
109
109
  setTargetSelectedKeys = _useState4[1];
110
110
 
111
+ var leftListRef = (0, _react.useRef)(null);
112
+ var rightListRef = (0, _react.useRef)(null);
111
113
  var leftActive = targetSelectedKeys.length > 0;
112
114
  var rightActive = sourceSelectedKeys.length > 0;
113
115
  var mergedPagination = !children && pagination;
@@ -115,6 +117,25 @@ var Transfer = function Transfer(props) {
115
117
  var rightTitle = titles[1] || transferLang.rightTitle;
116
118
  var leftPlaceholder = searchPlaceholder[0] || transferLang.searchPlaceholder[0];
117
119
  var rightPlaceholder = searchPlaceholder[1] || transferLang.searchPlaceholder[1];
120
+ (0, _react.useImperativeHandle)(ref, function () {
121
+ return {
122
+ clearSearch: clearSearch
123
+ };
124
+ });
125
+
126
+ var clearSearch = function clearSearch(position) {
127
+ var _a, _b;
128
+
129
+ if (position === 'left' || position === undefined) {
130
+ ;
131
+ (_a = leftListRef === null || leftListRef === void 0 ? void 0 : leftListRef.current) === null || _a === void 0 ? void 0 : _a.onClear();
132
+ }
133
+
134
+ if (position === 'right' || position === undefined) {
135
+ ;
136
+ (_b = rightListRef === null || rightListRef === void 0 ? void 0 : rightListRef.current) === null || _b === void 0 ? void 0 : _b.onClear();
137
+ }
138
+ };
118
139
 
119
140
  var setStateKeys = function setStateKeys(direction, keys) {
120
141
  if (direction === 'left') {
@@ -334,7 +355,8 @@ var Transfer = function Transfer(props) {
334
355
  showSelectAll: showSelectAll,
335
356
  pagination: mergedPagination,
336
357
  noDataContent: handleNoDataContent(noDataContent, 'left'),
337
- footer: footer
358
+ footer: footer,
359
+ ref: leftListRef
338
360
  }), /*#__PURE__*/_react.default.createElement(_operation.default, {
339
361
  className: "".concat(transferPrefixCls, "-operation"),
340
362
  rightActive: rightActive,
@@ -368,9 +390,13 @@ var Transfer = function Transfer(props) {
368
390
  pagination: mergedPagination,
369
391
  noDataContent: handleNoDataContent(noDataContent, 'right'),
370
392
  footer: footer,
371
- showRemove: oneWay
393
+ showRemove: oneWay,
394
+ ref: rightListRef
372
395
  }));
373
396
  };
374
397
 
398
+ var Transfer = /*#__PURE__*/_react.default.forwardRef(InternalTransfer);
399
+
400
+ Transfer.displayName = 'Transfer';
375
401
  var _default = Transfer;
376
402
  exports.default = _default;
@@ -207,7 +207,6 @@
207
207
  visibility: visible;
208
208
  -webkit-transform: translateX(0);
209
209
  transform: translateX(0);
210
- background-color: var(--kd-c-upload-color-background-hover, var(--kd-g-color-hover, #f5f5f5));
211
210
  }
212
211
  .kd-upload .kd-upload-text-list-item.error i,
213
212
  .kd-upload .kd-upload-text-list-item.error .kd-upload-text-list-item-name {
@@ -234,7 +233,7 @@
234
233
  padding: 0 var(--kd-c-upload-text-list-item-padding-horizontal, 20px);
235
234
  height: var(--kd-c-upload-list-item-height, 44px);
236
235
  line-height: var(--kd-c-upload-list-item-height, 44px);
237
- background-color: transparent;
236
+ background: transparent;
238
237
  opacity: 0;
239
238
  visibility: hidden;
240
239
  -webkit-transform: translateX(5px);
@@ -80,7 +80,6 @@
80
80
  opacity: 1;
81
81
  visibility: visible;
82
82
  transform: translateX(0);
83
- background-color: @upload-background-color-hover;
84
83
  }
85
84
  }
86
85
 
@@ -113,7 +112,7 @@
113
112
  padding: 0 @upload-text-list-item-padding-horizontal;
114
113
  height: @upload-list-item-height;
115
114
  line-height: @upload-list-item-height;
116
- background-color: transparent;
115
+ background: transparent;
117
116
  opacity: 0;
118
117
  visibility: hidden;
119
118
  transform: translateX(5px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [