@douyinfe/semi-ui 2.34.0 → 2.34.1-alpha.3
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.
- package/dist/css/semi.css +21 -45
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +41228 -40825
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/anchor/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/breadcrumb/item.js +1 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/calendar/interface.d.ts +2 -2
- package/lib/cjs/card/index.d.ts +37 -4
- package/lib/cjs/card/index.js +248 -67
- package/lib/cjs/cascader/index.d.ts +0 -2
- package/lib/cjs/cascader/index.js +0 -13
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +2 -2
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/field.d.ts +2 -2
- package/lib/cjs/form/group.js +2 -4
- package/lib/cjs/image/image.d.ts +0 -4
- package/lib/cjs/image/image.js +1 -23
- package/lib/cjs/image/preview.d.ts +1 -1
- package/lib/cjs/image/preview.js +16 -9
- package/lib/cjs/image/previewContext.d.ts +0 -1
- package/lib/cjs/input/index.d.ts +1 -1
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +19 -19
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/steps/basicStep.js +13 -7
- package/lib/cjs/steps/basicSteps.js +4 -2
- package/lib/cjs/steps/fillStep.js +13 -7
- package/lib/cjs/steps/fillSteps.js +3 -2
- package/lib/cjs/steps/index.d.ts +1 -0
- package/lib/cjs/steps/index.js +5 -2
- package/lib/cjs/steps/navStep.js +12 -4
- package/lib/cjs/steps/navSteps.js +4 -2
- package/lib/cjs/switch/index.d.ts +1 -1
- package/lib/cjs/table/Body/index.d.ts +0 -1
- package/lib/cjs/table/Body/index.js +3 -3
- package/lib/cjs/table/HeadTable.d.ts +4 -4
- package/lib/cjs/table/HeadTable.js +3 -3
- package/lib/cjs/table/Table.d.ts +2 -2
- package/lib/cjs/table/Table.js +14 -41
- package/lib/cjs/table/TableCell.js +3 -14
- package/lib/cjs/table/TableHeader.d.ts +0 -1
- package/lib/cjs/table/TableHeader.js +2 -11
- package/lib/cjs/table/TableHeaderRow.js +1 -2
- package/lib/cjs/table/index.d.ts +1 -1
- package/lib/cjs/table/interface.d.ts +1 -2
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +1 -1
- package/lib/cjs/typography/base.d.ts +2 -1
- package/lib/cjs/typography/base.js +68 -66
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/typography/util.d.ts +1 -4
- package/lib/cjs/typography/util.js +13 -36
- package/lib/es/anchor/index.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/breadcrumb/item.js +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/calendar/interface.d.ts +2 -2
- package/lib/es/card/index.d.ts +37 -4
- package/lib/es/card/index.js +247 -66
- package/lib/es/cascader/index.d.ts +0 -2
- package/lib/es/cascader/index.js +0 -13
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +2 -2
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/field.d.ts +2 -2
- package/lib/es/form/group.js +2 -4
- package/lib/es/image/image.d.ts +0 -4
- package/lib/es/image/image.js +1 -23
- package/lib/es/image/preview.d.ts +1 -1
- package/lib/es/image/preview.js +16 -9
- package/lib/es/image/previewContext.d.ts +0 -1
- package/lib/es/input/index.d.ts +1 -1
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +19 -19
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/steps/basicStep.js +12 -7
- package/lib/es/steps/basicSteps.js +4 -2
- package/lib/es/steps/fillStep.js +12 -7
- package/lib/es/steps/fillSteps.js +3 -2
- package/lib/es/steps/index.d.ts +1 -0
- package/lib/es/steps/index.js +3 -0
- package/lib/es/steps/navStep.js +11 -4
- package/lib/es/steps/navSteps.js +4 -2
- package/lib/es/switch/index.d.ts +1 -1
- package/lib/es/table/Body/index.d.ts +0 -1
- package/lib/es/table/Body/index.js +3 -3
- package/lib/es/table/HeadTable.d.ts +4 -4
- package/lib/es/table/HeadTable.js +3 -3
- package/lib/es/table/Table.d.ts +2 -2
- package/lib/es/table/Table.js +14 -41
- package/lib/es/table/TableCell.js +4 -15
- package/lib/es/table/TableHeader.d.ts +0 -1
- package/lib/es/table/TableHeader.js +1 -9
- package/lib/es/table/TableHeaderRow.js +1 -2
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/table/interface.d.ts +1 -2
- package/lib/es/tagInput/index.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +1 -1
- package/lib/es/typography/base.d.ts +2 -1
- package/lib/es/typography/base.js +67 -64
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/typography/util.d.ts +1 -4
- package/lib/es/typography/util.js +14 -36
- package/package.json +9 -8
package/lib/cjs/table/Table.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
9
|
-
|
|
10
8
|
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
11
9
|
|
|
12
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
13
11
|
|
|
14
12
|
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
15
13
|
|
|
14
|
+
var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
|
|
15
|
+
|
|
16
16
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
17
17
|
|
|
18
18
|
var _each2 = _interopRequireDefault(require("lodash/each"));
|
|
@@ -504,12 +504,8 @@ class Table extends _baseComponent.default {
|
|
|
504
504
|
|
|
505
505
|
this.addFnsInColumn = function () {
|
|
506
506
|
let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
507
|
-
const {
|
|
508
|
-
prefixCls
|
|
509
|
-
} = _this.props;
|
|
510
507
|
|
|
511
508
|
if (column && (column.sorter || column.filters || column.useFullRender)) {
|
|
512
|
-
let hasSorterOrFilter = false;
|
|
513
509
|
const {
|
|
514
510
|
dataIndex,
|
|
515
511
|
title: rawTitle,
|
|
@@ -528,12 +524,9 @@ class Table extends _baseComponent.default {
|
|
|
528
524
|
const stateSortOrder = (0, _get2.default)(curQuery, 'sortOrder');
|
|
529
525
|
const defaultSortOrder = (0, _get2.default)(curQuery, 'defaultSortOrder', false);
|
|
530
526
|
const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
531
|
-
const showEllipsisTitle = (0, _utils.shouldShowEllipsisTitle)(column.ellipsis);
|
|
532
527
|
|
|
533
|
-
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement(
|
|
534
|
-
|
|
535
|
-
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE,
|
|
536
|
-
title: showEllipsisTitle && typeof rawTitle === 'string' ? rawTitle : undefined
|
|
528
|
+
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
529
|
+
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
|
|
537
530
|
}, rawTitle);
|
|
538
531
|
|
|
539
532
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
@@ -547,7 +540,6 @@ class Table extends _baseComponent.default {
|
|
|
547
540
|
});
|
|
548
541
|
|
|
549
542
|
useFullRender && (titleMap.sorter = sorter);
|
|
550
|
-
hasSorterOrFilter = true;
|
|
551
543
|
titleArr.push(sorter);
|
|
552
544
|
} else {
|
|
553
545
|
titleArr.push(TitleNode);
|
|
@@ -567,13 +559,10 @@ class Table extends _baseComponent.default {
|
|
|
567
559
|
}));
|
|
568
560
|
|
|
569
561
|
useFullRender && (titleMap.filter = filter);
|
|
570
|
-
hasSorterOrFilter = true;
|
|
571
562
|
titleArr.push(filter);
|
|
572
563
|
}
|
|
573
564
|
|
|
574
|
-
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) :
|
|
575
|
-
className: `${prefixCls}-operate-wrapper`
|
|
576
|
-
}, titleArr) : titleArr;
|
|
565
|
+
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
|
|
577
566
|
column = Object.assign(Object.assign({}, column), {
|
|
578
567
|
title: newTitle
|
|
579
568
|
});
|
|
@@ -718,10 +707,9 @@ class Table extends _baseComponent.default {
|
|
|
718
707
|
sticky
|
|
719
708
|
} = props;
|
|
720
709
|
const selectedRowKeysSet = (0, _get2.default)(rowSelection, 'selectedRowKeysSet', new Set());
|
|
721
|
-
const tableLayout = this.adapter.getTableLayout();
|
|
722
710
|
const headTable = fixed || useFixedHeader ? /*#__PURE__*/_react.default.createElement(_HeadTable.default, {
|
|
723
711
|
key: "head",
|
|
724
|
-
|
|
712
|
+
anyColumnFixed: anyColumnFixed,
|
|
725
713
|
ref: headerRef,
|
|
726
714
|
columns: filteredColumns,
|
|
727
715
|
prefixCls: prefixCls,
|
|
@@ -746,7 +734,6 @@ class Table extends _baseComponent.default {
|
|
|
746
734
|
handleWheel: this.handleWheel,
|
|
747
735
|
handleBodyScroll: this.handleBodyScroll,
|
|
748
736
|
anyColumnFixed: anyColumnFixed,
|
|
749
|
-
tableLayout: tableLayout,
|
|
750
737
|
includeHeader: includeHeader,
|
|
751
738
|
showHeader: showHeader,
|
|
752
739
|
scroll: scroll,
|
|
@@ -881,9 +868,6 @@ class Table extends _baseComponent.default {
|
|
|
881
868
|
|
|
882
869
|
const queries = _foundation.default.initColumnsFilteredValueAndSorterOrder((0, _utils2.cloneDeep)(cachedflattenColumns));
|
|
883
870
|
|
|
884
|
-
const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(this.props.dataSource, queries);
|
|
885
|
-
const newPagination = (0, _isPlainObject2.default)(this.props.pagination) ? this.props.pagination : {};
|
|
886
|
-
const pageData = this.foundation.getCurrentPageData(filteredSortedDataSource, newPagination, queries);
|
|
887
871
|
this.state = {
|
|
888
872
|
/**
|
|
889
873
|
* Cached props
|
|
@@ -897,11 +881,11 @@ class Table extends _baseComponent.default {
|
|
|
897
881
|
* State calculated based on prop
|
|
898
882
|
*/
|
|
899
883
|
queries,
|
|
900
|
-
dataSource:
|
|
884
|
+
dataSource: [],
|
|
901
885
|
flattenData: [],
|
|
902
886
|
expandedRowKeys: [...(props.expandedRowKeys || []), ...(props.defaultExpandedRowKeys || [])],
|
|
903
887
|
rowSelection: props.rowSelection ? (0, _isObject2.default)(props.rowSelection) ? Object.assign({}, props.rowSelection) : {} : null,
|
|
904
|
-
pagination:
|
|
888
|
+
pagination: props.pagination && typeof props.pagination === 'object' ? Object.assign({}, props.pagination) : props.pagination || false,
|
|
905
889
|
|
|
906
890
|
/**
|
|
907
891
|
* Internal state
|
|
@@ -1085,18 +1069,6 @@ class Table extends _baseComponent.default {
|
|
|
1085
1069
|
|
|
1086
1070
|
return false;
|
|
1087
1071
|
},
|
|
1088
|
-
getTableLayout: () => {
|
|
1089
|
-
let isFixed = false;
|
|
1090
|
-
const {
|
|
1091
|
-
flattenColumns
|
|
1092
|
-
} = this.state;
|
|
1093
|
-
|
|
1094
|
-
if (Array.isArray(flattenColumns)) {
|
|
1095
|
-
isFixed = flattenColumns.some(column => Boolean(column.ellipsis) || Boolean(column.fixed));
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
return isFixed ? 'fixed' : 'auto';
|
|
1099
|
-
},
|
|
1100
1072
|
setHeadWidths: function (headWidths) {
|
|
1101
1073
|
let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1102
1074
|
|
|
@@ -1482,11 +1454,12 @@ class Table extends _baseComponent.default {
|
|
|
1482
1454
|
* TODO: After merging issue 1007, you can place it in the constructor to complete
|
|
1483
1455
|
* The reason is that #1007 exposes the parameters required by getCurrentPageData in the constructor
|
|
1484
1456
|
*/
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1457
|
+
|
|
1458
|
+
if ((0, _isNull2.default)(dataSource)) {
|
|
1459
|
+
const pageData = this.foundation.getCurrentPageData(this.props.dataSource);
|
|
1460
|
+
dataSource = pageData.dataSource;
|
|
1461
|
+
pagination = pageData.pagination;
|
|
1462
|
+
}
|
|
1490
1463
|
|
|
1491
1464
|
const props = Object.assign(Object.assign(Object.assign({}, rest), this.state), {
|
|
1492
1465
|
// props not in rest
|
|
@@ -320,8 +320,7 @@ class TableCell extends _baseComponent.default {
|
|
|
320
320
|
} = this.context;
|
|
321
321
|
const isRTL = direction === 'rtl';
|
|
322
322
|
const {
|
|
323
|
-
className
|
|
324
|
-
ellipsis
|
|
323
|
+
className
|
|
325
324
|
} = column;
|
|
326
325
|
const fixedLeftFlag = fixedLeft || typeof fixedLeft === 'number';
|
|
327
326
|
const fixedRightFlag = fixedRight || typeof fixedRight === 'number';
|
|
@@ -340,14 +339,6 @@ class TableCell extends _baseComponent.default {
|
|
|
340
339
|
realExpandIcon,
|
|
341
340
|
tdProps: newTdProps
|
|
342
341
|
} = renderTextResult;
|
|
343
|
-
let title;
|
|
344
|
-
const shouldShowTitle = (0, _utils.shouldShowEllipsisTitle)(ellipsis);
|
|
345
|
-
|
|
346
|
-
if (shouldShowTitle) {
|
|
347
|
-
if (typeof text === 'string') {
|
|
348
|
-
title = text;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
342
|
|
|
352
343
|
if (rowSpan === 0 || colSpan === 0) {
|
|
353
344
|
return null;
|
|
@@ -376,15 +367,13 @@ class TableCell extends _baseComponent.default {
|
|
|
376
367
|
[`${prefixCls}-cell-fixed-left`]: isFixedLeft,
|
|
377
368
|
[`${prefixCls}-cell-fixed-left-last`]: isFixedLeftLast,
|
|
378
369
|
[`${prefixCls}-cell-fixed-right`]: isFixedRight,
|
|
379
|
-
[`${prefixCls}-cell-fixed-right-first`]: isFixedRightFirst
|
|
380
|
-
[`${prefixCls}-row-cell-ellipsis`]: ellipsis
|
|
370
|
+
[`${prefixCls}-cell-fixed-right-first`]: isFixedRightFirst
|
|
381
371
|
});
|
|
382
372
|
return /*#__PURE__*/_react.default.createElement(BodyCell, Object.assign({
|
|
383
373
|
role: "gridcell",
|
|
384
374
|
"aria-colindex": colIndex + 1,
|
|
385
375
|
className: columnCls,
|
|
386
|
-
onClick: this.handleClick
|
|
387
|
-
title: title
|
|
376
|
+
onClick: this.handleClick
|
|
388
377
|
}, newTdProps, {
|
|
389
378
|
ref: this.setRef
|
|
390
379
|
}), inner);
|
|
@@ -23,7 +23,6 @@ export interface TableHeaderCell {
|
|
|
23
23
|
rowSpan?: number;
|
|
24
24
|
colSpan?: number;
|
|
25
25
|
colEnd?: number;
|
|
26
|
-
title?: string;
|
|
27
26
|
}
|
|
28
27
|
declare const _default: React.ForwardRefExoticComponent<Omit<TableHeaderProps, "forwardedRef"> & React.RefAttributes<HTMLDivElement>>;
|
|
29
28
|
export default _default;
|
|
@@ -11,13 +11,11 @@ var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
14
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
17
15
|
|
|
18
|
-
var
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _constants = require("@douyinfe/semi-foundation/lib/cjs/table/constants");
|
|
21
19
|
|
|
22
20
|
var _TableHeaderRow = _interopRequireDefault(require("./TableHeaderRow"));
|
|
23
21
|
|
|
@@ -76,13 +74,6 @@ function parseHeaderRows(columns) {
|
|
|
76
74
|
cell.colEnd = cell.colStart + colSpan - 1;
|
|
77
75
|
rows[rowIndex].push(cell);
|
|
78
76
|
currentColIndex += colSpan;
|
|
79
|
-
const ellipsis = column === null || column === void 0 ? void 0 : column.ellipsis;
|
|
80
|
-
const shouldShowTitle = (0, _utils.shouldShowEllipsisTitle)(ellipsis);
|
|
81
|
-
|
|
82
|
-
if (shouldShowTitle && typeof cell.children === 'string') {
|
|
83
|
-
cell.title = cell.children;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
77
|
return colSpan;
|
|
87
78
|
});
|
|
88
79
|
return colSpans;
|
|
@@ -149,8 +149,7 @@ class TableHeaderRow extends _baseComponent.default {
|
|
|
149
149
|
[`${prefixCls}-cell-fixed-left`]: fixedLeft,
|
|
150
150
|
[`${prefixCls}-cell-fixed-left-last`]: fixedLeftLast,
|
|
151
151
|
[`${prefixCls}-cell-fixed-right`]: fixedRight,
|
|
152
|
-
[`${prefixCls}-cell-fixed-right-first`]: fixedRightFirst
|
|
153
|
-
[`${prefixCls}-row-head-ellipsis`]: column.ellipsis
|
|
152
|
+
[`${prefixCls}-cell-fixed-right-first`]: fixedRightFirst
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
if (headWidths.length && slicedColumns.length) {
|
package/lib/cjs/table/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
|
|
|
16
16
|
components: PropTypes.Requireable<any>;
|
|
17
17
|
bordered: PropTypes.Requireable<boolean>;
|
|
18
18
|
loading: PropTypes.Requireable<boolean>;
|
|
19
|
-
size: PropTypes.Requireable<"
|
|
19
|
+
size: PropTypes.Requireable<"small" | "default" | "middle">;
|
|
20
20
|
tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
|
|
21
21
|
columns: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
22
|
align: PropTypes.Requireable<"left" | "right" | "center">;
|
|
@@ -6,7 +6,7 @@ import { DropdownProps } from '../dropdown';
|
|
|
6
6
|
import { Locale } from '../locale/interface';
|
|
7
7
|
import { ArrayElement } from '../_base/base';
|
|
8
8
|
import { strings } from '@douyinfe/semi-foundation/lib/cjs/table/constants';
|
|
9
|
-
import { BaseRowKeyType, BaseSortOrder, BaseGroupBy, BaseGroupByFn, BaseFixed, BaseAlign, BaseChangeInfoSorter, BaseSorter, BaseFilter, BaseChangeInfoFilter, BaseIncludeGroupRecord
|
|
9
|
+
import { BaseRowKeyType, BaseSortOrder, BaseGroupBy, BaseGroupByFn, BaseFixed, BaseAlign, BaseChangeInfoSorter, BaseSorter, BaseFilter, BaseChangeInfoFilter, BaseIncludeGroupRecord } from '@douyinfe/semi-foundation/lib/cjs/table/foundation';
|
|
10
10
|
import { ScrollDirection, CSSDirection } from 'react-window';
|
|
11
11
|
export interface TableProps<RecordType extends Record<string, any> = any> extends BaseProps {
|
|
12
12
|
bordered?: boolean;
|
|
@@ -89,7 +89,6 @@ export interface ColumnProps<RecordType extends Record<string, any> = any> {
|
|
|
89
89
|
onFilter?: OnFilter<RecordType>;
|
|
90
90
|
onFilterDropdownVisibleChange?: OnFilterDropdownVisibleChange;
|
|
91
91
|
onHeaderCell?: OnHeaderCell<RecordType>;
|
|
92
|
-
ellipsis?: BaseEllipsis;
|
|
93
92
|
}
|
|
94
93
|
export declare type Align = BaseAlign;
|
|
95
94
|
export declare type SortOrder = BaseSortOrder;
|
|
@@ -96,7 +96,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
96
96
|
onAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
97
97
|
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
98
98
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
99
|
-
size: PropTypes.Requireable<"
|
|
99
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
100
100
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
101
101
|
prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
102
102
|
suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -132,7 +132,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
132
132
|
secondStep: PropTypes.Requireable<number>;
|
|
133
133
|
focusOnOpen: PropTypes.Requireable<boolean>;
|
|
134
134
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
135
|
-
size: PropTypes.Requireable<"
|
|
135
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
136
136
|
panels: PropTypes.Requireable<PropTypes.InferProps<{
|
|
137
137
|
panelHeader: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
138
138
|
panelFooter: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -49,7 +49,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
49
49
|
secondStep: import("prop-types").Requireable<number>;
|
|
50
50
|
focusOnOpen: import("prop-types").Requireable<boolean>;
|
|
51
51
|
autoFocus: import("prop-types").Requireable<boolean>;
|
|
52
|
-
size: import("prop-types").Requireable<"
|
|
52
|
+
size: import("prop-types").Requireable<"small" | "default" | "large">;
|
|
53
53
|
panels: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
54
54
|
panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
55
55
|
panelFooter: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
@@ -27,9 +27,10 @@ interface BaseTypographyState {
|
|
|
27
27
|
editable: boolean;
|
|
28
28
|
copied: boolean;
|
|
29
29
|
isOverflowed: boolean;
|
|
30
|
-
ellipsisContent:
|
|
30
|
+
ellipsisContent: string;
|
|
31
31
|
expanded: boolean;
|
|
32
32
|
isTruncated: boolean;
|
|
33
|
+
first: boolean;
|
|
33
34
|
prevChildren: React.ReactNode;
|
|
34
35
|
}
|
|
35
36
|
export default class Base extends Component<BaseTypographyProps, BaseTypographyState> {
|
|
@@ -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.
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
378
|
+
ellipsisContent: null,
|
|
379
379
|
expanded: false,
|
|
380
380
|
// if text is truncated with js
|
|
381
|
-
isTruncated:
|
|
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.
|
|
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 =
|
|
408
|
+
newState.ellipsisContent = null;
|
|
406
409
|
newState.expanded = false;
|
|
407
|
-
newState.isTruncated =
|
|
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.
|
|
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
|
|
449
|
-
|
|
459
|
+
const updateOverflow = this.shouldTruncated(rows);
|
|
460
|
+
const canUseCSSEllipsis = this.canUseCSSEllipsis();
|
|
461
|
+
const needUpdate = updateOverflow !== isOverflowed;
|
|
450
462
|
|
|
451
|
-
|
|
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 (
|
|
467
|
+
if (canUseCSSEllipsis) {
|
|
468
|
+
if (needUpdate) {
|
|
469
|
+
this.setState({
|
|
470
|
+
expanded: !updateOverflow
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
462
474
|
return undefined;
|
|
463
475
|
}
|
|
464
476
|
|
|
465
|
-
|
|
466
|
-
|
|
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:
|
|
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
|
-
}
|
|
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(
|
|
513
|
+
if (Array.isArray(children)) {
|
|
510
514
|
copyContent = '';
|
|
511
|
-
|
|
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
|
|
519
|
-
copyContent = String(
|
|
522
|
+
} else if (typeof children !== 'object') {
|
|
523
|
+
copyContent = String(children);
|
|
520
524
|
} else {
|
|
521
525
|
hasObject = true;
|
|
522
|
-
copyContent = String(
|
|
526
|
+
copyContent = String(children);
|
|
523
527
|
}
|
|
524
528
|
|
|
525
|
-
(0, _warning.default)(hasObject, '
|
|
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(
|
|
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<
|
|
41
|
+
heading: PropTypes.Requireable<4 | 2 | 1 | 6 | 3 | 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;
|