@douyinfe/semi-ui 2.34.0-beta.0 → 2.34.1-alpha.2

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 (71) hide show
  1. package/dist/css/semi.css +20 -44
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +33404 -33022
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/breadcrumb/item.js +1 -1
  8. package/lib/cjs/calendar/interface.d.ts +2 -2
  9. package/lib/cjs/card/index.d.ts +36 -4
  10. package/lib/cjs/card/index.js +244 -67
  11. package/lib/cjs/cascader/index.d.ts +0 -2
  12. package/lib/cjs/cascader/index.js +0 -13
  13. package/lib/cjs/form/baseForm.d.ts +1 -1
  14. package/lib/cjs/form/field.d.ts +1 -1
  15. package/lib/cjs/modal/confirm.d.ts +6 -6
  16. package/lib/cjs/steps/basicStep.js +13 -7
  17. package/lib/cjs/steps/basicSteps.js +4 -2
  18. package/lib/cjs/steps/fillStep.js +13 -7
  19. package/lib/cjs/steps/fillSteps.js +3 -2
  20. package/lib/cjs/steps/index.d.ts +1 -0
  21. package/lib/cjs/steps/index.js +5 -2
  22. package/lib/cjs/steps/navStep.js +12 -4
  23. package/lib/cjs/steps/navSteps.js +4 -2
  24. package/lib/cjs/table/Body/index.d.ts +0 -1
  25. package/lib/cjs/table/Body/index.js +3 -3
  26. package/lib/cjs/table/HeadTable.d.ts +4 -4
  27. package/lib/cjs/table/HeadTable.js +3 -3
  28. package/lib/cjs/table/Table.js +4 -29
  29. package/lib/cjs/table/TableCell.js +3 -14
  30. package/lib/cjs/table/TableHeader.d.ts +0 -1
  31. package/lib/cjs/table/TableHeader.js +2 -11
  32. package/lib/cjs/table/TableHeaderRow.js +1 -2
  33. package/lib/cjs/table/interface.d.ts +1 -2
  34. package/lib/cjs/typography/base.d.ts +2 -1
  35. package/lib/cjs/typography/base.js +68 -66
  36. package/lib/cjs/typography/title.d.ts +1 -1
  37. package/lib/cjs/typography/util.d.ts +1 -4
  38. package/lib/cjs/typography/util.js +13 -32
  39. package/lib/es/breadcrumb/item.js +1 -1
  40. package/lib/es/calendar/interface.d.ts +2 -2
  41. package/lib/es/card/index.d.ts +36 -4
  42. package/lib/es/card/index.js +243 -66
  43. package/lib/es/cascader/index.d.ts +0 -2
  44. package/lib/es/cascader/index.js +0 -13
  45. package/lib/es/form/baseForm.d.ts +1 -1
  46. package/lib/es/form/field.d.ts +1 -1
  47. package/lib/es/modal/confirm.d.ts +6 -6
  48. package/lib/es/steps/basicStep.js +12 -7
  49. package/lib/es/steps/basicSteps.js +4 -2
  50. package/lib/es/steps/fillStep.js +12 -7
  51. package/lib/es/steps/fillSteps.js +3 -2
  52. package/lib/es/steps/index.d.ts +1 -0
  53. package/lib/es/steps/index.js +3 -0
  54. package/lib/es/steps/navStep.js +11 -4
  55. package/lib/es/steps/navSteps.js +4 -2
  56. package/lib/es/table/Body/index.d.ts +0 -1
  57. package/lib/es/table/Body/index.js +3 -3
  58. package/lib/es/table/HeadTable.d.ts +4 -4
  59. package/lib/es/table/HeadTable.js +3 -3
  60. package/lib/es/table/Table.js +5 -30
  61. package/lib/es/table/TableCell.js +4 -15
  62. package/lib/es/table/TableHeader.d.ts +0 -1
  63. package/lib/es/table/TableHeader.js +1 -9
  64. package/lib/es/table/TableHeaderRow.js +1 -2
  65. package/lib/es/table/interface.d.ts +1 -2
  66. package/lib/es/typography/base.d.ts +2 -1
  67. package/lib/es/typography/base.js +67 -64
  68. package/lib/es/typography/title.d.ts +1 -1
  69. package/lib/es/typography/util.d.ts +1 -4
  70. package/lib/es/typography/util.js +14 -32
  71. package/package.json +9 -8
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
9
-
10
8
  var _isString2 = _interopRequireDefault(require("lodash/isString"));
11
9
 
12
10
  var _merge2 = _interopRequireDefault(require("lodash/merge"));
@@ -17,6 +15,8 @@ var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
17
15
 
18
16
  var _react = _interopRequireWildcard(require("react"));
19
17
 
18
+ var _reactDom = _interopRequireDefault(require("react-dom"));
19
+
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
22
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -41,8 +41,6 @@ var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer")
41
41
 
42
42
  var _utils = require("../_utils");
43
43
 
44
- var _resizeObserver = _interopRequireDefault(require("../resizeObserver"));
45
-
46
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
45
 
48
46
  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; }
@@ -137,7 +135,7 @@ class Base extends _react.Component {
137
135
  return false;
138
136
  }
139
137
 
140
- const updateOverflow = rows <= 1 ? this.wrapperRef.current.scrollWidth > this.wrapperRef.current.offsetWidth : this.wrapperRef.current.scrollHeight > this.wrapperRef.current.offsetHeight;
138
+ const updateOverflow = rows <= 1 ? this.wrapperRef.current.scrollWidth > this.wrapperRef.current.clientWidth : this.wrapperRef.current.scrollHeight > this.wrapperRef.current.offsetHeight;
141
139
  return updateOverflow;
142
140
  };
143
141
 
@@ -201,7 +199,8 @@ class Base extends _react.Component {
201
199
 
202
200
  if (expandable && !expanded || collapsible && expanded) {
203
201
  this.setState({
204
- expanded: !expanded
202
+ expanded: !expanded,
203
+ first: false
205
204
  });
206
205
  }
207
206
  };
@@ -229,24 +228,24 @@ class Base extends _react.Component {
229
228
  };
230
229
 
231
230
  this.renderExpandable = () => {
232
- const {
233
- expanded,
234
- isTruncated
235
- } = this.state;
236
- if (!isTruncated) return null;
237
231
  const {
238
232
  expandText,
239
233
  expandable,
240
234
  collapseText,
241
235
  collapsible
242
236
  } = this.getEllipsisOpt();
237
+ const {
238
+ expanded,
239
+ first
240
+ } = this.state;
243
241
  const noExpandText = !expandable && (0, _isUndefined2.default)(expandText);
244
242
  const noCollapseText = !collapsible && (0, _isUndefined2.default)(collapseText);
245
243
  let text;
246
244
 
247
245
  if (!expanded && !noExpandText) {
248
246
  text = expandText;
249
- } else if (expanded && !noCollapseText) {
247
+ } else if (expanded && !first && !noCollapseText) {
248
+ // if expanded is true but the text is initally mounted, we dont show collapseText
250
249
  text = collapseText;
251
250
  }
252
251
 
@@ -311,9 +310,11 @@ class Base extends _react.Component {
311
310
 
312
311
  this.getEllipsisStyle = () => {
313
312
  const {
314
- ellipsis,
315
- component
313
+ ellipsis
316
314
  } = this.props;
315
+ const {
316
+ expandable
317
+ } = this.getEllipsisOpt();
317
318
 
318
319
  if (!ellipsis) {
319
320
  return {
@@ -327,25 +328,23 @@ class Base extends _react.Component {
327
328
  rows
328
329
  } = this.getEllipsisOpt();
329
330
  const {
330
- expanded
331
+ isOverflowed,
332
+ expanded,
333
+ isTruncated
331
334
  } = this.state;
332
335
  const useCSS = !expanded && this.canUseCSSEllipsis();
333
336
  const ellipsisCls = (0, _classnames.default)({
334
337
  [`${prefixCls}-ellipsis`]: true,
335
338
  [`${prefixCls}-ellipsis-single-line`]: rows === 1,
336
339
  [`${prefixCls}-ellipsis-multiple-line`]: rows > 1,
337
- // component === 'span', Text component, It should be externally displayed inline
338
- [`${prefixCls}-ellipsis-multiple-line-text`]: rows > 1 && component === 'span',
339
- [`${prefixCls}-ellipsis-overflow-ellipsis`]: rows === 1 && useCSS,
340
- // component === 'span', Text component, It should be externally displayed inline
341
- [`${prefixCls}-ellipsis-overflow-ellipsis-text`]: rows === 1 && useCSS && component === 'span'
340
+ [`${prefixCls}-ellipsis-overflow-ellipsis`]: rows === 1 && useCSS
342
341
  });
343
342
  const ellipsisStyle = useCSS && rows > 1 ? {
344
343
  WebkitLineClamp: rows
345
344
  } : {};
346
345
  return {
347
346
  ellipsisCls,
348
- ellipsisStyle
347
+ ellipsisStyle: isOverflowed ? ellipsisStyle : {}
349
348
  };
350
349
  };
351
350
 
@@ -359,6 +358,7 @@ class Base extends _react.Component {
359
358
  const {
360
359
  isTruncated,
361
360
  expanded,
361
+ isOverflowed,
362
362
  ellipsisContent
363
363
  } = this.state;
364
364
 
@@ -375,10 +375,12 @@ class Base extends _react.Component {
375
375
  // ellipsis
376
376
  // if text is overflow in container
377
377
  isOverflowed: true,
378
- ellipsisContent: props.children,
378
+ ellipsisContent: null,
379
379
  expanded: false,
380
380
  // if text is truncated with js
381
- isTruncated: true,
381
+ isTruncated: false,
382
+ // record if has click expanded
383
+ first: true,
382
384
  prevChildren: null
383
385
  };
384
386
  this.wrapperRef = /*#__PURE__*/_react.default.createRef();
@@ -388,7 +390,8 @@ class Base extends _react.Component {
388
390
 
389
391
  componentDidMount() {
390
392
  if (this.props.ellipsis) {
391
- this.onResize();
393
+ this.getEllipsisState();
394
+ window.addEventListener('resize', this.onResize);
392
395
  }
393
396
  }
394
397
 
@@ -402,9 +405,10 @@ class Base extends _react.Component {
402
405
  if (props.ellipsis && prevChildren !== props.children) {
403
406
  // reset ellipsis state if children update
404
407
  newState.isOverflowed = true;
405
- newState.ellipsisContent = props.children;
408
+ newState.ellipsisContent = null;
406
409
  newState.expanded = false;
407
- newState.isTruncated = true;
410
+ newState.isTruncated = false;
411
+ newState.first = true;
408
412
  }
409
413
 
410
414
  return newState;
@@ -416,12 +420,16 @@ class Base extends _react.Component {
416
420
  this.forceUpdate();
417
421
 
418
422
  if (this.props.ellipsis) {
419
- this.onResize();
423
+ this.getEllipsisState();
420
424
  }
421
425
  }
422
426
  }
423
427
 
424
428
  componentWillUnmount() {
429
+ if (this.props.ellipsis) {
430
+ window.removeEventListener('resize', this.onResize);
431
+ }
432
+
425
433
  if (this.rafId) {
426
434
  window.cancelAnimationFrame(this.rafId);
427
435
  }
@@ -443,45 +451,45 @@ class Base extends _react.Component {
443
451
  }
444
452
 
445
453
  const {
454
+ ellipsisContent,
455
+ isOverflowed,
456
+ isTruncated,
446
457
  expanded
447
458
  } = this.state;
448
- const canUseCSSEllipsis = this.canUseCSSEllipsis(); // Currently only text truncation is supported, if there is non-text,
449
- // both css truncation and js truncation should throw a warning
459
+ const updateOverflow = this.shouldTruncated(rows);
460
+ const canUseCSSEllipsis = this.canUseCSSEllipsis();
461
+ const needUpdate = updateOverflow !== isOverflowed;
450
462
 
451
- (0, _warning.default)('children' in this.props && typeof children !== 'string', "[Semi Typography] 'Only children with pure text could be used with ellipsis at this moment."); // If children is null, css/js truncated flag isTruncate is false
452
-
453
- if ((0, _isNull2.default)(children)) {
454
- this.setState({
455
- isTruncated: false,
456
- isOverflowed: false
457
- });
463
+ if (!rows || rows < 0 || expanded) {
458
464
  return undefined;
459
465
  }
460
466
 
461
- if (!rows || rows < 0 || expanded) {
467
+ if (canUseCSSEllipsis) {
468
+ if (needUpdate) {
469
+ this.setState({
470
+ expanded: !updateOverflow
471
+ });
472
+ }
473
+
462
474
  return undefined;
463
475
  }
464
476
 
465
- if (canUseCSSEllipsis) {
466
- const updateOverflow = this.shouldTruncated(rows); // isOverflowed needs to be updated to show tooltip when using css ellipsis
477
+ const extraNode = [this.expandRef.current, this.copyRef && this.copyRef.current];
478
+ (0, _warning.default)('children' in this.props && typeof children !== 'string', "[Semi Typography] 'Only children with pure text could be used with ellipsis at this moment.");
479
+ const content = (0, _util.default)(_reactDom.default.findDOMNode(this.wrapperRef.current), rows, children, extraNode, ELLIPSIS_STR, suffix, pos);
467
480
 
481
+ if (children === content) {
468
482
  this.setState({
483
+ expanded: true
484
+ });
485
+ } else if (ellipsisContent !== content || isOverflowed !== updateOverflow) {
486
+ this.setState({
487
+ ellipsisContent: content,
469
488
  isOverflowed: updateOverflow,
470
- isTruncated: false
489
+ isTruncated: children !== content
471
490
  });
472
- return undefined;
473
491
  }
474
492
 
475
- const extraNode = {
476
- expand: this.expandRef.current,
477
- copy: this.copyRef && this.copyRef.current
478
- };
479
- const content = (0, _util.default)(this.wrapperRef.current, rows, // Perform type conversion on children to prevent component crash due to non-string type of children
480
- String(children), extraNode, ELLIPSIS_STR, suffix, pos);
481
- this.setState({
482
- ellipsisContent: content,
483
- isTruncated: children !== content
484
- });
485
493
  return undefined;
486
494
  }
487
495
 
@@ -490,8 +498,6 @@ class Base extends _react.Component {
490
498
  }
491
499
 
492
500
  renderCopy() {
493
- var _a;
494
-
495
501
  const {
496
502
  copyable,
497
503
  children
@@ -499,30 +505,28 @@ class Base extends _react.Component {
499
505
 
500
506
  if (!copyable) {
501
507
  return null;
502
- } // If it is configured in the content of copyable, the copied content will be the content in copyable
503
-
508
+ }
504
509
 
505
- const willCopyContent = (_a = copyable === null || copyable === void 0 ? void 0 : copyable.content) !== null && _a !== void 0 ? _a : children;
506
510
  let copyContent;
507
511
  let hasObject = false;
508
512
 
509
- if (Array.isArray(willCopyContent)) {
513
+ if (Array.isArray(children)) {
510
514
  copyContent = '';
511
- willCopyContent.forEach(value => {
515
+ children.forEach(value => {
512
516
  if (typeof value === 'object') {
513
517
  hasObject = true;
514
518
  }
515
519
 
516
520
  copyContent += String(value);
517
521
  });
518
- } else if (typeof willCopyContent !== 'object') {
519
- copyContent = String(willCopyContent);
522
+ } else if (typeof children !== 'object') {
523
+ copyContent = String(children);
520
524
  } else {
521
525
  hasObject = true;
522
- copyContent = String(willCopyContent);
526
+ copyContent = String(children);
523
527
  }
524
528
 
525
- (0, _warning.default)(hasObject, 'Content to be copied in Typography is a object, it will case a [object Object] mistake when copy to clipboard.');
529
+ (0, _warning.default)(hasObject, 'Children in Typography is a object, it will case a [object Object] mistake when copy to clipboard.');
526
530
  const copyConfig = Object.assign({
527
531
  content: copyContent,
528
532
  duration: 3
@@ -633,15 +637,13 @@ class Base extends _react.Component {
633
637
  }
634
638
 
635
639
  render() {
636
- return /*#__PURE__*/_react.default.createElement(_resizeObserver.default, {
637
- onResize: this.onResize
638
- }, /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
640
+ return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
639
641
  componentName: "Typography"
640
642
  }, locale => {
641
643
  this.expandStr = locale.expand;
642
644
  this.collapseStr = locale.collapse;
643
645
  return this.renderTipWrapper();
644
- }));
646
+ });
645
647
  }
646
648
 
647
649
  }
@@ -38,7 +38,7 @@ export default class Title extends PureComponent<TitleProps> {
38
38
  underline: PropTypes.Requireable<boolean>;
39
39
  strong: PropTypes.Requireable<boolean>;
40
40
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
41
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
41
+ heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 6 | 5>;
42
42
  style: PropTypes.Requireable<object>;
43
43
  className: PropTypes.Requireable<string>;
44
44
  component: PropTypes.Requireable<string>;
@@ -1,5 +1,2 @@
1
- declare const getRenderText: (originEle: HTMLElement, rows: number, content: string, fixedContent: {
2
- expand: Node;
3
- copy: Node;
4
- }, ellipsisStr: string, suffix: string, ellipsisPos: string) => string;
1
+ declare const getRenderText: (originEle: HTMLElement, rows: number, content: string, fixedContent: any[], ellipsisStr: string, suffix: string, ellipsisPos: string) => string;
5
2
  export default getRenderText;
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _omit2 = _interopRequireDefault(require("lodash/omit"));
9
-
10
8
  var _reactDom = _interopRequireDefault(require("react-dom"));
11
9
 
12
10
  var _react = _interopRequireDefault(require("react"));
@@ -76,29 +74,20 @@ const getRenderText = function (originEle, rows) {
76
74
 
77
75
 
78
76
  function inRange() {
79
- // console.log('inrange?', ellipsisContainer.scrollHeight, ellipsisContainer.scrollHeight < maxHeight);
77
+ // console.log('inrange?', ellipsisContainer.scrollHeight, ellipsisContainer.scrollHeight < maxHeight)
80
78
  return ellipsisContainer.scrollHeight < maxHeight;
81
79
  } // ========================= Find match ellipsis content =========================
82
80
  // Create origin content holder
83
81
 
84
82
 
85
83
  const ellipsisContentHolder = document.createElement('span');
86
- const textNode = document.createTextNode(content);
87
- ellipsisContentHolder.appendChild(textNode);
88
-
89
- if (suffix.length > 0) {
90
- const ellipsisTextNode = document.createTextNode(suffix);
91
- ellipsisContentHolder.appendChild(ellipsisTextNode);
92
- }
93
-
94
- ellipsisContainer.appendChild(ellipsisContentHolder); // Expand node needs to be added only when text needTruncated
84
+ const ellipsisTextNode = document.createTextNode(suffix);
85
+ ellipsisContentHolder.appendChild(ellipsisTextNode);
86
+ ellipsisContainer.appendChild(ellipsisContentHolder);
87
+ fixedContent.map(node => node && ellipsisContainer.appendChild(node.cloneNode(true))); // Append before fixed nodes
95
88
 
96
- Object.values((0, _omit2.default)(fixedContent, 'expand')).map(node => node && ellipsisContainer.appendChild(node.cloneNode(true)));
97
-
98
- function appendExpandNode() {
99
- ellipsisContainer.innerHTML = '';
100
- ellipsisContainer.appendChild(ellipsisContentHolder);
101
- Object.values(fixedContent).map(node => node && ellipsisContainer.appendChild(node.cloneNode(true)));
89
+ function appendChildNode(node) {
90
+ ellipsisContentHolder.insertBefore(node, ellipsisTextNode);
102
91
  }
103
92
 
104
93
  function getCurrentText(text, pos) {
@@ -108,7 +97,7 @@ const getRenderText = function (originEle, rows) {
108
97
  return ellipsisStr;
109
98
  }
110
99
 
111
- if (ellipsisPos === 'end') {
100
+ if (ellipsisPos === 'end' || pos > end - pos) {
112
101
  return text.slice(0, pos) + ellipsisStr;
113
102
  }
114
103
 
@@ -130,8 +119,8 @@ const getRenderText = function (originEle, rows) {
130
119
  const currentStepText = getCurrentText(fullText, step);
131
120
  textNode.textContent = currentStepText;
132
121
 
133
- if (inRange()) {
134
- return currentStepText;
122
+ if (inRange() || !currentStepText) {
123
+ return step === fullText.length ? fullText : currentStepText;
135
124
  }
136
125
  }
137
126
  } else if (endLoc === 0) {
@@ -145,17 +134,9 @@ const getRenderText = function (originEle, rows) {
145
134
  return measureText(textNode, fullText, startLoc, midLoc, lastSuccessLoc);
146
135
  }
147
136
 
148
- let resText = content; // First judge whether the total length of fullText, plus suffix (possible)
149
- // and copied icon (possible) meets expectations?
150
- // If it does not meet expectations, add an expand button to find the largest content that meets size limit
151
- // 首先判断总文本长度,加上可能有的 suffix,复制按钮长度,看结果是否符合预期
152
- // 如果不符合预期,则再加上展开按钮,找最大符合尺寸的内容
153
-
154
- if (!inRange()) {
155
- appendExpandNode();
156
- resText = measureText(textNode, content, 0, ellipsisPos === 'middle' ? Math.floor(content.length / 2) : content.length);
157
- }
158
-
137
+ const textNode = document.createTextNode(content);
138
+ appendChildNode(textNode);
139
+ const resText = measureText(textNode, content);
159
140
  ellipsisContainer.innerHTML = '';
160
141
  return resText;
161
142
  };
@@ -111,7 +111,7 @@ export default class BreadcrumbItem extends BaseComponent {
111
111
  },
112
112
  // icon={this.renderIcon(icon)}
113
113
  style: {
114
- maxWidth: width
114
+ width
115
115
  },
116
116
  size: compact ? 'small' : 'normal'
117
117
  }, children)));
@@ -2,7 +2,7 @@
2
2
  import { strings } from '@douyinfe/semi-foundation/lib/es/calendar/constants';
3
3
  import type { ArrayElement } from '../_base/base';
4
4
  import type { BaseProps } from '../_base/baseComponent';
5
- import type { EventObject, weekStartsOnEnum } from '@douyinfe/semi-foundation/lib/es/calendar/foundation';
5
+ import type { EventObject, weeekStartsOnEnum } from '@douyinfe/semi-foundation/lib/es/calendar/foundation';
6
6
  export interface CalendarProps extends BaseProps {
7
7
  displayValue?: Date;
8
8
  range?: Date[];
@@ -10,7 +10,7 @@ export interface CalendarProps extends BaseProps {
10
10
  events?: EventObject[];
11
11
  mode?: ArrayElement<typeof strings.MODE>;
12
12
  showCurrTime?: boolean;
13
- weekStartsOn?: weekStartsOnEnum;
13
+ weekStartsOn?: weeekStartsOnEnum;
14
14
  scrollTop?: number;
15
15
  onClick?: (e: React.MouseEvent, value: Date) => void;
16
16
  onClose?: (e: React.MouseEvent) => void;
@@ -42,8 +42,44 @@ export interface CardProps {
42
42
  /** aria label */
43
43
  'aria-label'?: string;
44
44
  }
45
+ export interface CardHeaderProps {
46
+ title?: ReactNode;
47
+ headerExtraContent?: ReactNode;
48
+ header?: ReactNode;
49
+ headerLine?: boolean;
50
+ headerStyle?: CSSProperties;
51
+ }
52
+ export interface CardFooterProps {
53
+ footer?: ReactNode;
54
+ footerLine?: boolean;
55
+ footerStyle?: CSSProperties;
56
+ }
57
+ export interface CardBodyProps {
58
+ cover: ReactNode;
59
+ children: ReactNode;
60
+ actions: ReactNode[];
61
+ loading: boolean;
62
+ bodyStyle?: CSSProperties;
63
+ }
64
+ declare class Header extends PureComponent<CardHeaderProps> {
65
+ static elementType: string;
66
+ render(): JSX.Element;
67
+ }
68
+ declare class Footer extends PureComponent<CardFooterProps> {
69
+ static elementType: string;
70
+ render(): JSX.Element;
71
+ }
72
+ declare class Body extends PureComponent<CardBodyProps> {
73
+ static elementType: string;
74
+ renderCover: () => ReactNode;
75
+ renderBody: () => ReactNode;
76
+ render(): JSX.Element;
77
+ }
45
78
  declare class Card extends PureComponent<CardProps> {
46
79
  static Meta: typeof Meta;
80
+ static Header: typeof Header;
81
+ static Footer: typeof Footer;
82
+ static Body: typeof Body;
47
83
  static propTypes: {
48
84
  actions: PropTypes.Requireable<any[]>;
49
85
  bodyStyle: PropTypes.Requireable<object>;
@@ -70,10 +106,6 @@ declare class Card extends PureComponent<CardProps> {
70
106
  headerLine: boolean;
71
107
  loading: boolean;
72
108
  };
73
- renderHeader: () => ReactNode;
74
- renderCover: () => ReactNode;
75
- renderBody: () => ReactNode;
76
- renderFooter: () => ReactNode;
77
109
  render(): ReactNode;
78
110
  }
79
111
  export default Card;