@qn-pandora/pandora-component 5.1.0 → 5.1.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.
- package/README.md +36 -36
- package/es/components/AutoComplete/index.js +2 -2
- package/es/components/AutoComplete/style.css +127 -39
- package/es/components/AutoComplete/style.less +8 -8
- package/es/components/Breadcrumb/style.css +13 -3
- package/es/components/Breadcrumb/style.less +9 -9
- package/es/components/Button/style.css +282 -176
- package/es/components/Button/style.less +51 -51
- package/es/components/Card/RowExtra/style.css +6 -0
- package/es/components/Card/RowExtra/style.less +8 -8
- package/es/components/Card/SearchInput/style.less +8 -8
- package/es/components/Card/style.css +61 -66
- package/es/components/Card/style.less +11 -11
- package/es/components/CheckTransformList/style.css +345 -121
- package/es/components/CheckTransformList/style.less +35 -35
- package/es/components/Checkbox/index.js +9 -1
- package/es/components/Checkbox/style.css +5 -0
- package/es/components/Checkbox/style.less +5 -5
- package/es/components/CheckboxList/style.css +10 -5
- package/es/components/CheckboxList/style.less +11 -11
- package/es/components/Collapse/style.css +35 -3
- package/es/components/Collapse/style.less +58 -58
- package/es/components/CollapsiblePanel/style.less +63 -63
- package/es/components/DateTimePicker/Base/index.d.ts +3 -0
- package/es/components/DateTimePicker/Base/index.js +51 -6
- package/es/components/DateTimePicker/Base/style.css +508 -112
- package/es/components/DateTimePicker/Base/style.less +167 -160
- package/es/components/DateTimePicker/BaseMobile/Absolute/style.less +35 -35
- package/es/components/DateTimePicker/BaseMobile/style.less +32 -32
- package/es/components/DateTimePicker/Collapse/Panel/style.less +26 -26
- package/es/components/DateTimePicker/DisplayInput/index.js +3 -1
- package/es/components/DateTimePicker/DisplayInput/style.css +231 -53
- package/es/components/DateTimePicker/DisplayInput/style.less +9 -9
- package/es/components/DateTimePicker/constants.d.ts +9 -3
- package/es/components/DateTimePicker/constants.js +1 -0
- package/es/components/DateTimePicker/index.js +1 -1
- package/es/components/DateTimePicker/style.css +77 -46
- package/es/components/DateTimePicker/style.less +19 -19
- package/es/components/DateTimePicker/time.d.ts +1 -0
- package/es/components/DateTimePicker/time.js +1 -0
- package/es/components/DateTimePicker/transform.js +4 -2
- package/es/components/Descriptions/style.css +77 -46
- package/es/components/Descriptions/style.less +16 -16
- package/es/components/Drawer/CloseIcon/style.less +8 -8
- package/es/components/Drawer/index.d.ts +6 -6
- package/es/components/Drawer/index.js +4 -4
- package/es/components/Drawer/style.css +244 -169
- package/es/components/Drawer/style.less +69 -61
- package/es/components/FileResumable/index.js +2 -3
- package/es/components/FileResumable/style.css +20 -50
- package/es/components/FileResumable/style.less +94 -94
- package/es/components/FlameGraph/customTooltip.d.ts +22 -0
- package/es/components/FlameGraph/customTooltip.js +91 -0
- package/es/components/FlameGraph/index.d.ts +16 -0
- package/es/components/FlameGraph/index.js +96 -0
- package/es/components/FlameGraph/style.css +8 -0
- package/es/components/FlameGraph/style.less +14 -0
- package/es/components/Input/index.d.ts +1 -1
- package/es/components/Input/style.css +231 -53
- package/es/components/Input/style.less +12 -12
- package/es/components/KeyValuePair/style.less +25 -25
- package/es/components/Menu/Option.d.ts +1 -1
- package/es/components/Menu/Option.js +12 -4
- package/es/components/Menu/style.css +31 -22
- package/es/components/Menu/style.less +18 -18
- package/es/components/Modal/style.css +11 -8
- package/es/components/Modal/style.less +30 -30
- package/es/components/NameExplainTooltip/style.css +1 -1
- package/es/components/NameExplainTooltip/style.less +10 -10
- package/es/components/NameLimiter/index.js +1 -1
- package/es/components/NameLimiter/style.css +83 -55
- package/es/components/NameLimiter/style.less +19 -19
- package/es/components/OptionList/InlineOptionList/style.css +22 -9
- package/es/components/OptionList/InlineOptionList/style.less +16 -16
- package/es/components/OptionList/OptionItem/style.css +85 -57
- package/es/components/OptionList/OptionItem/style.less +25 -25
- package/es/components/OptionList/PopoverOptionList/index.js +1 -1
- package/es/components/OptionList/PopoverOptionList/style.css +80 -49
- package/es/components/OptionList/PopoverOptionList/style.less +30 -30
- package/es/components/OptionList/style.css +187 -115
- package/es/components/OptionList/style.less +3 -3
- package/es/components/RadioGroup/style.css +51 -40
- package/es/components/RadioGroup/style.less +41 -41
- package/es/components/RangeInput/style.css +604 -87
- package/es/components/RangeInput/style.less +37 -37
- package/es/components/RemarkName/style.css +83 -55
- package/es/components/RemarkName/style.less +2 -2
- package/es/components/Selector/style.css +127 -39
- package/es/components/Selector/style.less +99 -99
- package/es/components/Spin/style.css +10 -8
- package/es/components/Spin/style.less +26 -26
- package/es/components/Steps/ControlButton/style.less +5 -5
- package/es/components/Steps/style.css +59 -21
- package/es/components/Steps/style.less +48 -48
- package/es/components/Table/ColumnSetting/index.d.ts +1 -0
- package/es/components/Table/ColumnSetting/index.js +19 -14
- package/es/components/Table/ColumnSetting/style.css +2 -5
- package/es/components/Table/ColumnSetting/style.less +50 -51
- package/es/components/Table/ColumnTag/style.css +4 -4
- package/es/components/Table/ColumnTag/style.less +40 -40
- package/es/components/Table/EmptyText.d.ts +7 -0
- package/es/components/Table/EmptyText.js +22 -0
- package/es/components/Table/ResizableTitle/style.less +25 -25
- package/es/components/Table/index.d.ts +19 -88
- package/es/components/Table/index.js +142 -326
- package/es/components/Table/style.css +146 -98
- package/es/components/Table/style.less +364 -345
- package/es/components/Table/type.d.ts +63 -0
- package/es/components/Table/type.js +5 -0
- package/es/components/Table/util.d.ts +58 -0
- package/es/components/Table/util.js +218 -0
- package/es/components/Tabs/style.css +127 -78
- package/es/components/Tabs/style.less +33 -33
- package/es/components/TagList/Tag/style.css +5 -5
- package/es/components/TagList/Tag/style.less +72 -72
- package/es/components/TagList/TagSwitch/style.css +1 -1
- package/es/components/TagList/TagSwitch/style.less +28 -28
- package/es/components/TagList/style.css +6 -6
- package/es/components/TagList/style.less +28 -28
- package/es/components/Timeline/TimelineItem/style.css +1 -1
- package/es/components/Timeline/TimelineItem/style.less +49 -49
- package/es/components/Timeline/style.less +23 -23
- package/es/components/TopologyChart/index.d.ts +7 -0
- package/es/components/TopologyChart/index.js +19 -0
- package/es/components/TopologyChart/style.css +14 -0
- package/es/components/TopologyChart/style.less +14 -0
- package/es/components/Transfer/List/style.less +19 -19
- package/es/components/Transfer/ListBody/style.less +18 -18
- package/es/components/Transfer/style.less +14 -14
- package/es/components/TreeSelector/style.css +42 -30
- package/es/components/TreeSelector/style.less +56 -56
- package/es/constants/language/datetime/en.js +4 -2
- package/es/constants/language/datetime/type.d.ts +4 -2
- package/es/constants/language/datetime/zh.js +4 -2
- package/es/index.css +9067 -7963
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/index.less +56 -54
- package/es/style/mixin.less +45 -45
- package/es/style/theme.less +416 -416
- package/lib/components/AutoComplete/index.js +2 -2
- package/lib/components/AutoComplete/style.css +127 -39
- package/lib/components/AutoComplete/style.less +8 -8
- package/lib/components/Breadcrumb/style.css +13 -3
- package/lib/components/Breadcrumb/style.less +9 -9
- package/lib/components/Button/style.css +282 -176
- package/lib/components/Button/style.less +51 -51
- package/lib/components/Card/RowExtra/style.css +6 -0
- package/lib/components/Card/RowExtra/style.less +8 -8
- package/lib/components/Card/SearchInput/style.less +8 -8
- package/lib/components/Card/style.css +61 -66
- package/lib/components/Card/style.less +11 -11
- package/lib/components/CheckTransformList/style.css +345 -121
- package/lib/components/CheckTransformList/style.less +35 -35
- package/lib/components/Checkbox/index.js +9 -1
- package/lib/components/Checkbox/style.css +5 -0
- package/lib/components/Checkbox/style.less +5 -5
- package/lib/components/CheckboxList/style.css +10 -5
- package/lib/components/CheckboxList/style.less +11 -11
- package/lib/components/Collapse/style.css +35 -3
- package/lib/components/Collapse/style.less +58 -58
- package/lib/components/CollapsiblePanel/style.less +63 -63
- package/lib/components/DateTimePicker/Base/index.d.ts +3 -0
- package/lib/components/DateTimePicker/Base/index.js +51 -6
- package/lib/components/DateTimePicker/Base/style.css +508 -112
- package/lib/components/DateTimePicker/Base/style.less +167 -160
- package/lib/components/DateTimePicker/BaseMobile/Absolute/style.less +35 -35
- package/lib/components/DateTimePicker/BaseMobile/style.less +32 -32
- package/lib/components/DateTimePicker/Collapse/Panel/style.less +26 -26
- package/lib/components/DateTimePicker/DisplayInput/index.js +3 -1
- package/lib/components/DateTimePicker/DisplayInput/style.css +231 -53
- package/lib/components/DateTimePicker/DisplayInput/style.less +9 -9
- package/lib/components/DateTimePicker/constants.d.ts +9 -3
- package/lib/components/DateTimePicker/constants.js +1 -0
- package/lib/components/DateTimePicker/index.js +1 -1
- package/lib/components/DateTimePicker/style.css +77 -46
- package/lib/components/DateTimePicker/style.less +19 -19
- package/lib/components/DateTimePicker/time.d.ts +1 -0
- package/lib/components/DateTimePicker/time.js +1 -0
- package/lib/components/DateTimePicker/transform.js +4 -2
- package/lib/components/Descriptions/style.css +77 -46
- package/lib/components/Descriptions/style.less +16 -16
- package/lib/components/Drawer/CloseIcon/style.less +8 -8
- package/lib/components/Drawer/index.d.ts +6 -6
- package/lib/components/Drawer/index.js +4 -4
- package/lib/components/Drawer/style.css +244 -169
- package/lib/components/Drawer/style.less +69 -61
- package/lib/components/FileResumable/index.js +2 -3
- package/lib/components/FileResumable/style.css +20 -50
- package/lib/components/FileResumable/style.less +94 -94
- package/lib/components/FlameGraph/customTooltip.d.ts +22 -0
- package/lib/components/FlameGraph/customTooltip.js +114 -0
- package/lib/components/FlameGraph/index.d.ts +16 -0
- package/lib/components/FlameGraph/index.js +117 -0
- package/lib/components/FlameGraph/style.css +8 -0
- package/lib/components/FlameGraph/style.less +14 -0
- package/lib/components/Input/index.d.ts +1 -1
- package/lib/components/Input/style.css +231 -53
- package/lib/components/Input/style.less +12 -12
- package/lib/components/KeyValuePair/style.less +25 -25
- package/lib/components/Menu/Option.d.ts +1 -1
- package/lib/components/Menu/Option.js +17 -25
- package/lib/components/Menu/style.css +31 -22
- package/lib/components/Menu/style.less +18 -18
- package/lib/components/Modal/style.css +11 -8
- package/lib/components/Modal/style.less +30 -30
- package/lib/components/NameExplainTooltip/style.css +1 -1
- package/lib/components/NameExplainTooltip/style.less +10 -10
- package/lib/components/NameLimiter/index.js +1 -1
- package/lib/components/NameLimiter/style.css +83 -55
- package/lib/components/NameLimiter/style.less +19 -19
- package/lib/components/OptionList/InlineOptionList/style.css +22 -9
- package/lib/components/OptionList/InlineOptionList/style.less +16 -16
- package/lib/components/OptionList/OptionItem/style.css +85 -57
- package/lib/components/OptionList/OptionItem/style.less +25 -25
- package/lib/components/OptionList/PopoverOptionList/index.js +1 -1
- package/lib/components/OptionList/PopoverOptionList/style.css +80 -49
- package/lib/components/OptionList/PopoverOptionList/style.less +30 -30
- package/lib/components/OptionList/style.css +187 -115
- package/lib/components/OptionList/style.less +3 -3
- package/lib/components/RadioGroup/style.css +51 -40
- package/lib/components/RadioGroup/style.less +41 -41
- package/lib/components/RangeInput/style.css +604 -87
- package/lib/components/RangeInput/style.less +37 -37
- package/lib/components/RemarkName/style.css +83 -55
- package/lib/components/RemarkName/style.less +2 -2
- package/lib/components/Selector/style.css +127 -39
- package/lib/components/Selector/style.less +99 -99
- package/lib/components/Spin/style.css +10 -8
- package/lib/components/Spin/style.less +26 -26
- package/lib/components/Steps/ControlButton/style.less +5 -5
- package/lib/components/Steps/style.css +59 -21
- package/lib/components/Steps/style.less +48 -48
- package/lib/components/Table/ColumnSetting/index.d.ts +1 -0
- package/lib/components/Table/ColumnSetting/index.js +19 -14
- package/lib/components/Table/ColumnSetting/style.css +2 -5
- package/lib/components/Table/ColumnSetting/style.less +50 -51
- package/lib/components/Table/ColumnTag/style.css +4 -4
- package/lib/components/Table/ColumnTag/style.less +40 -40
- package/lib/components/Table/EmptyText.d.ts +7 -0
- package/lib/components/Table/EmptyText.js +27 -0
- package/lib/components/Table/ResizableTitle/style.less +25 -25
- package/lib/components/Table/index.d.ts +19 -88
- package/lib/components/Table/index.js +145 -327
- package/lib/components/Table/style.css +146 -98
- package/lib/components/Table/style.less +364 -345
- package/lib/components/Table/type.d.ts +63 -0
- package/lib/components/Table/type.js +8 -0
- package/lib/components/Table/util.d.ts +58 -0
- package/lib/components/Table/util.js +227 -0
- package/lib/components/Tabs/style.css +127 -78
- package/lib/components/Tabs/style.less +33 -33
- package/lib/components/TagList/Tag/style.css +5 -5
- package/lib/components/TagList/Tag/style.less +72 -72
- package/lib/components/TagList/TagSwitch/style.css +1 -1
- package/lib/components/TagList/TagSwitch/style.less +28 -28
- package/lib/components/TagList/style.css +6 -6
- package/lib/components/TagList/style.less +28 -28
- package/lib/components/Timeline/TimelineItem/style.css +1 -1
- package/lib/components/Timeline/TimelineItem/style.less +49 -49
- package/lib/components/Timeline/style.less +23 -23
- package/lib/components/TopologyChart/index.d.ts +7 -0
- package/lib/components/TopologyChart/index.js +28 -0
- package/lib/components/TopologyChart/style.css +14 -0
- package/lib/components/TopologyChart/style.less +14 -0
- package/lib/components/Transfer/List/style.less +19 -19
- package/lib/components/Transfer/ListBody/style.less +18 -18
- package/lib/components/Transfer/style.less +14 -14
- package/lib/components/TreeSelector/style.css +42 -30
- package/lib/components/TreeSelector/style.less +56 -56
- package/lib/constants/language/datetime/en.js +4 -2
- package/lib/constants/language/datetime/type.d.ts +4 -2
- package/lib/constants/language/datetime/zh.js +4 -2
- package/lib/index.css +4782 -3678
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -1
- package/lib/index.less +56 -54
- package/lib/style/mixin.less +45 -45
- package/lib/style/theme.less +416 -416
- package/package.json +10 -6
@@ -66,11 +66,10 @@ import * as React from 'react';
|
|
66
66
|
import classnames from 'classnames';
|
67
67
|
import { observer } from 'mobx-react';
|
68
68
|
import { observable, action, computed } from 'mobx';
|
69
|
-
import { size, xor, union, unionBy, differenceBy, get, isEqual, includes, isNumber,
|
69
|
+
import { size, xor, union, unionBy, differenceBy, get, isEqual, includes, isNumber, isUndefined } from 'lodash';
|
70
70
|
import { Table as AntTable, Checkbox } from 'antd';
|
71
71
|
import { ConfigContext } from 'antd/es/config-provider';
|
72
72
|
import { toaster as toasterStore } from '@qn-pandora/app-sdk';
|
73
|
-
import { EmptyIcon } from '@qn-pandora/pandora-component-icons';
|
74
73
|
import bind from '../../utils/bind';
|
75
74
|
import { formatString } from '../../utils/language';
|
76
75
|
import { SDK_PREFIX } from '../../constants/style';
|
@@ -78,11 +77,15 @@ import { TableLocale } from '../../constants/language/table/type';
|
|
78
77
|
import { ColumnTag } from './ColumnTag/ColumnTag';
|
79
78
|
import ColumnSetting from './ColumnSetting';
|
80
79
|
import ResizableTitle from './ResizableTitle';
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
import EmptyText from './EmptyText';
|
81
|
+
import { addEmptyColumn, getSortAndHiddenKeys, getSortedCoulmns, getColumnKeys, getResizeColumns, getLocalSettings } from './util';
|
82
|
+
import { ETableSettingType } from './type';
|
83
|
+
export * from './type';
|
84
|
+
/**
|
85
|
+
* 表格提供自定义多选, 通过 rowSelection对象的selectedRowKeys和onChange来控制多选的状态
|
86
|
+
* 需要注意的是, 当在外部进行增删改或者外部需要控制选择状态时, 例如删除之后清空全选状态, 需要受控
|
87
|
+
* 传入selectedRowKeys值。
|
88
|
+
*/
|
86
89
|
/**
|
87
90
|
* pandora2.0风格的表格
|
88
91
|
*/
|
@@ -95,9 +98,7 @@ var Table = /** @class */ (function (_super) {
|
|
95
98
|
_this.hiddenColumn = _this.props.hiddenColumns;
|
96
99
|
_this.columns = [];
|
97
100
|
_this.sortConfig = {
|
98
|
-
sortKeys: []
|
99
|
-
fixedRightKeys: [],
|
100
|
-
fixedLeftKeys: []
|
101
|
+
sortKeys: []
|
101
102
|
};
|
102
103
|
_this.settingFields = [];
|
103
104
|
return _this;
|
@@ -113,30 +114,34 @@ var Table = /** @class */ (function (_super) {
|
|
113
114
|
(lastRowSelection &&
|
114
115
|
!isEqual(lastRowSelection.selectedRowKeys, rowSelection.selectedRowKeys)))) {
|
115
116
|
var selectedRowKeys_1 = rowSelection.selectedRowKeys || [];
|
116
|
-
var
|
117
|
-
var selectedRowKeysOfCurrentPage_1 =
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
var _a = nextProps.dataSource, dataSource = _a === void 0 ? [] : _a;
|
118
|
+
var selectedRowKeysOfCurrentPage_1 = [];
|
119
|
+
var selectedRowsOfCurrentPage_1 = [];
|
120
|
+
dataSource.forEach(function (item, index) {
|
121
|
+
var rowKey = _this.getRowKey(item, index);
|
122
|
+
if (selectedRowKeys_1.includes(rowKey)) {
|
123
|
+
selectedRowKeysOfCurrentPage_1.push(rowKey);
|
124
|
+
selectedRowsOfCurrentPage_1.push(item);
|
125
|
+
}
|
122
126
|
});
|
123
127
|
// 数据源变化时重新设置多选框是否为全选状态或部分选中状态
|
124
|
-
this.setCheckboxStatus(
|
128
|
+
this.setCheckboxStatus(selectedRowsOfCurrentPage_1, size(nextProps.dataSource));
|
125
129
|
// 更新外部组件rowSelection状态
|
126
130
|
// this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage)
|
127
131
|
if (rowSelection && rowSelection.onChange) {
|
128
132
|
rowSelection.onChange(union(selectedRowKeysOfCurrentPage_1, selectedRowKeys_1), selectedRows && rowKey
|
129
|
-
? unionBy(
|
130
|
-
:
|
133
|
+
? unionBy(selectedRowsOfCurrentPage_1, selectedRows, rowKey)
|
134
|
+
: selectedRowsOfCurrentPage_1, { type: 'single' });
|
131
135
|
}
|
132
136
|
}
|
137
|
+
// 更新隐藏的key
|
133
138
|
if (!isEqual(nextProps.hiddenColumns, this.props.hiddenColumns)) {
|
134
139
|
this.setHiddenColumn(nextProps.hiddenColumns);
|
135
140
|
}
|
136
141
|
if (nextProps.columns !== this.props.columns) {
|
137
142
|
if ((nextProps.scroll && nextProps.draggable === true) ||
|
138
143
|
nextProps.draggable === ETableSettingType.RESIZE) {
|
139
|
-
this.
|
144
|
+
this.updateSettingFields(nextProps.columns, this.settingFields, nextProps.hiddenColumns || []);
|
140
145
|
this.setColumns(this.getResizeColumns(nextProps.columns));
|
141
146
|
}
|
142
147
|
else {
|
@@ -151,8 +156,7 @@ var Table = /** @class */ (function (_super) {
|
|
151
156
|
};
|
152
157
|
Object.defineProperty(Table.prototype, "selectedRowKeys", {
|
153
158
|
get: function () {
|
154
|
-
|
155
|
-
return (rowSelection && rowSelection.selectedRowKeys) || [];
|
159
|
+
return get(this.props.rowSelection, 'selectedRowKeys', []);
|
156
160
|
},
|
157
161
|
enumerable: false,
|
158
162
|
configurable: true
|
@@ -188,167 +192,80 @@ var Table = /** @class */ (function (_super) {
|
|
188
192
|
enumerable: false,
|
189
193
|
configurable: true
|
190
194
|
});
|
191
|
-
Object.defineProperty(Table.prototype, "emptyTextComp", {
|
192
|
-
get: function () {
|
193
|
-
var emptyText = this.props.emptyText;
|
194
|
-
if (!emptyText) {
|
195
|
-
return (React.createElement("div", { className: SDK_PREFIX + "-table-empty" },
|
196
|
-
React.createElement("div", { className: SDK_PREFIX + "-table-empty-icon" },
|
197
|
-
React.createElement(EmptyIcon, null)),
|
198
|
-
React.createElement("div", { className: SDK_PREFIX + "-table-empty-text" }, formatString(TableLocale.empty, this.context.locale))));
|
199
|
-
}
|
200
|
-
if (typeof emptyText === 'string' || typeof emptyText === 'number') {
|
201
|
-
return (React.createElement("div", { className: SDK_PREFIX + "-table-empty" },
|
202
|
-
React.createElement("div", { className: SDK_PREFIX + "-table-empty-icon" },
|
203
|
-
React.createElement(EmptyIcon, null)),
|
204
|
-
React.createElement("div", { className: SDK_PREFIX + "-table-empty-text" }, emptyText)));
|
205
|
-
}
|
206
|
-
return emptyText;
|
207
|
-
},
|
208
|
-
enumerable: false,
|
209
|
-
configurable: true
|
210
|
-
});
|
211
195
|
Object.defineProperty(Table.prototype, "columnsSettingOptions", {
|
212
196
|
// 列设置 options
|
213
197
|
get: function () {
|
214
198
|
var options = [];
|
215
199
|
var _a = this.props.columns, columns = _a === void 0 ? [] : _a;
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
200
|
+
// sortKeys 来保证数据的准确性
|
201
|
+
this.sortConfig.sortKeys.forEach(function (key) {
|
202
|
+
var target = columns.find(function (col) { var _a; return ((_a = col.key) === null || _a === void 0 ? void 0 : _a.toString()) === key; });
|
203
|
+
if (target && target.key) {
|
220
204
|
options.push({
|
221
|
-
label:
|
222
|
-
value:
|
205
|
+
label: target.colTitle || target.title,
|
206
|
+
value: target.key.toString()
|
223
207
|
});
|
224
208
|
}
|
225
209
|
});
|
226
|
-
return
|
227
|
-
.map(function (key) { return options.find(function (option) { return option.value === key; }); })
|
228
|
-
.filter(function (f) { return !!f; });
|
210
|
+
return options;
|
229
211
|
},
|
230
212
|
enumerable: false,
|
231
213
|
configurable: true
|
232
214
|
});
|
233
215
|
Object.defineProperty(Table.prototype, "columnKeys", {
|
234
216
|
get: function () {
|
235
|
-
|
236
|
-
var allKeys = [];
|
237
|
-
var unconfigableKeys = [];
|
238
|
-
var resetKeys = [];
|
239
|
-
columns.forEach(function (col) {
|
240
|
-
if (col.key) {
|
241
|
-
if (col.configurable === false) {
|
242
|
-
unconfigableKeys.push(col.key.toString());
|
243
|
-
}
|
244
|
-
else {
|
245
|
-
resetKeys.push(col.key.toString());
|
246
|
-
}
|
247
|
-
allKeys.push(col.key.toString());
|
248
|
-
}
|
249
|
-
});
|
250
|
-
return {
|
251
|
-
allKeys: allKeys,
|
252
|
-
unconfigableKeys: unconfigableKeys,
|
253
|
-
resetKeys: resetKeys
|
254
|
-
};
|
217
|
+
return getColumnKeys(this.props.columns || []);
|
255
218
|
},
|
256
219
|
enumerable: false,
|
257
220
|
configurable: true
|
258
221
|
});
|
259
222
|
Object.defineProperty(Table.prototype, "resizable", {
|
260
223
|
get: function () {
|
261
|
-
var _a,
|
262
|
-
return ((
|
263
|
-
|
264
|
-
this.props.scroll);
|
224
|
+
var _a = this.props, draggable = _a.draggable, scroll = _a.scroll;
|
225
|
+
return !!((draggable === true || draggable === ETableSettingType.RESIZE) &&
|
226
|
+
scroll);
|
265
227
|
},
|
266
228
|
enumerable: false,
|
267
229
|
configurable: true
|
268
230
|
});
|
269
231
|
Object.defineProperty(Table.prototype, "sortable", {
|
270
232
|
get: function () {
|
271
|
-
var
|
272
|
-
return
|
273
|
-
((_b = this.props) === null || _b === void 0 ? void 0 : _b.draggable) === ETableSettingType.SORT);
|
233
|
+
var draggable = this.props.draggable;
|
234
|
+
return draggable === true || draggable === ETableSettingType.SORT;
|
274
235
|
},
|
275
236
|
enumerable: false,
|
276
237
|
configurable: true
|
277
238
|
});
|
278
|
-
Table.prototype
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
var
|
286
|
-
|
287
|
-
|
288
|
-
|
239
|
+
Object.defineProperty(Table.prototype, "showSetting", {
|
240
|
+
// 是否支持列设置按钮
|
241
|
+
get: function () {
|
242
|
+
// showColumnSetting 需要同 draggable 配合使用
|
243
|
+
// 1、showColumnSetting = false, 不显示
|
244
|
+
// 2、draggable = sort 或者 draggable === true时才显示
|
245
|
+
// 3、draggable === resize 且 showColumnSetting = true时才显示(resize模式下必须显示设置showColumnSetting=true,才会显示列设置按钮)
|
246
|
+
var _a = this.props, showColumnSetting = _a.showColumnSetting, draggable = _a.draggable;
|
247
|
+
if (showColumnSetting === false)
|
248
|
+
return false;
|
249
|
+
if (draggable === ETableSettingType.SORT || draggable === true)
|
250
|
+
return true;
|
251
|
+
if (draggable === ETableSettingType.RESIZE && showColumnSetting === true) {
|
252
|
+
return true;
|
289
253
|
}
|
290
|
-
|
291
|
-
|
254
|
+
return false;
|
255
|
+
},
|
256
|
+
enumerable: false,
|
257
|
+
configurable: true
|
258
|
+
});
|
259
|
+
Table.prototype.initSettingConfig = function () {
|
260
|
+
var _a = this.props, saveSettingKey = _a.saveSettingKey, columns = _a.columns, _b = _a.hiddenColumns, hiddenColumns = _b === void 0 ? [] : _b;
|
261
|
+
var settingFields = getLocalSettings(saveSettingKey);
|
262
|
+
this.updateSettingFields(columns, settingFields, hiddenColumns);
|
292
263
|
};
|
293
|
-
Table.prototype.updateSettingFields = function (columns, settingFields) {
|
294
|
-
var _a =
|
295
|
-
var sortableColumns = [];
|
296
|
-
var leftColumns = [];
|
297
|
-
var rightColumns = [];
|
298
|
-
var hideKeys = [];
|
299
|
-
// 已配置的列和实际的对不上
|
300
|
-
// 可能新增或者删除列的情况
|
301
|
-
var newSettingFields = [];
|
302
|
-
// 已配置列
|
303
|
-
// 旧类型数据为对象类型,未配置
|
304
|
-
settingFields.map(function (field) {
|
305
|
-
var find = columns.find(function (column) { var _a; return ((_a = column) === null || _a === void 0 ? void 0 : _a.dataIndex) === field.field; });
|
306
|
-
if (find) {
|
307
|
-
if (field.hide) {
|
308
|
-
hideKeys.push(field.field);
|
309
|
-
}
|
310
|
-
if (!find.fixed) {
|
311
|
-
sortableColumns.push(field);
|
312
|
-
}
|
313
|
-
else if (find.fixed === 'left' || find.fixed === true) {
|
314
|
-
leftColumns.push(field);
|
315
|
-
}
|
316
|
-
else {
|
317
|
-
rightColumns.push(field);
|
318
|
-
}
|
319
|
-
}
|
320
|
-
});
|
321
|
-
// 未配置过的列
|
322
|
-
columns
|
323
|
-
.filter(function (f) { return !settingFields.find(function (field) { return field.field === f.dataIndex; }); })
|
324
|
-
.map(function (column) {
|
325
|
-
if (column.dataIndex) {
|
326
|
-
if (!column.fixed) {
|
327
|
-
sortableColumns.push({
|
328
|
-
field: column.dataIndex.toString(),
|
329
|
-
fixed: column.fixed
|
330
|
-
});
|
331
|
-
}
|
332
|
-
else if (column.fixed === 'left' || column.fixed === true) {
|
333
|
-
leftColumns.push({
|
334
|
-
field: column.dataIndex.toString(),
|
335
|
-
fixed: column.fixed
|
336
|
-
});
|
337
|
-
}
|
338
|
-
else {
|
339
|
-
rightColumns.push({
|
340
|
-
field: column.dataIndex.toString(),
|
341
|
-
fixed: column.fixed
|
342
|
-
});
|
343
|
-
}
|
344
|
-
}
|
345
|
-
});
|
346
|
-
this.setFixedLeftKeys(leftColumns.map(function (t) { return t.field; }));
|
347
|
-
this.setFixedRightKeys(rightColumns.map(function (t) { return t.field; }));
|
264
|
+
Table.prototype.updateSettingFields = function (columns, settingFields, hiddenColumns) {
|
265
|
+
var _a = getSortAndHiddenKeys(columns, settingFields, hiddenColumns), sortableColumns = _a.sortableColumns, resultHiddenColumns = _a.hiddenColumns;
|
348
266
|
this.setSortKeys(sortableColumns.map(function (t) { return t.field; }));
|
349
|
-
this.setHiddenColumn(
|
350
|
-
|
351
|
-
this.setSettingFields(newSettingFields);
|
267
|
+
this.setHiddenColumn(resultHiddenColumns);
|
268
|
+
this.setSettingFields(sortableColumns);
|
352
269
|
};
|
353
270
|
// 隐藏key
|
354
271
|
Table.prototype.handleHideColumnsChange = function (keys) {
|
@@ -359,66 +276,46 @@ var Table = /** @class */ (function (_super) {
|
|
359
276
|
return toasterStore.warning(formatString(TableLocale.hide_column_tooltip, this.context.locale));
|
360
277
|
}
|
361
278
|
var newSettingFields = this.settingFields.map(function (field) {
|
362
|
-
|
363
|
-
return __assign(__assign({}, field), { hide: true });
|
364
|
-
}
|
365
|
-
return __assign(__assign({}, field), { hide: false });
|
279
|
+
return __assign(__assign({}, field), { hide: includes(keys, field.field) });
|
366
280
|
});
|
367
281
|
this.setHiddenColumn(keys);
|
368
282
|
this.setSettingFields(newSettingFields);
|
369
283
|
(_b = (_a = this.props).onHiddenColumnsChange) === null || _b === void 0 ? void 0 : _b.call(_a, keys);
|
370
284
|
};
|
371
|
-
Table.prototype.
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
285
|
+
Table.prototype.getColumns = function () {
|
286
|
+
// 注意: 如果没有传columns, 可能渲染的是table 的children ,无需在处理columns
|
287
|
+
/**
|
288
|
+
* <Table>
|
289
|
+
* <Table.Column title="name" dataIndex="name"></Table.Column>
|
290
|
+
* <Table.Column title="age" dataIndex="name"></Table.Column>
|
291
|
+
* </Table>
|
292
|
+
*/
|
293
|
+
if (isUndefined(this.columns))
|
294
|
+
return this.columns;
|
295
|
+
var _a = this.props, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
|
296
|
+
// 显示列设置按钮,默认就会开启列隐藏功能
|
297
|
+
// 1、看是否支持排序, 排序 + 列隐藏, 排序用 sort 函数就行(sort 函数具有列隐藏的能力)
|
298
|
+
// 2、看是否 resize, resize + 列隐藏 可能需要添加空白列 addEmptyColumn
|
299
|
+
var allCols = __spread(this.columns);
|
300
|
+
if (!this.showSetting) {
|
301
|
+
// 如果不显示列设置按钮, 那么排序功能不支持
|
302
|
+
if (this.resizable) {
|
303
|
+
allCols = addEmptyColumn(allCols, this.hiddenColumn, this.resizable && needEmptyColumn);
|
377
304
|
}
|
378
|
-
return
|
379
|
-
}));
|
380
|
-
var fixedRightColumn = this.columns.filter(function (column) {
|
381
|
-
return includes(_this.sortConfig.fixedRightKeys, column.key);
|
382
|
-
});
|
383
|
-
var fixedLeftColumn = this.columns.filter(function (column) {
|
384
|
-
return includes(_this.sortConfig.fixedLeftKeys, column.key);
|
385
|
-
});
|
386
|
-
return __spread(fixedLeftColumn, this.getSortCoulmns(selectedCols), fixedRightColumn);
|
387
|
-
};
|
388
|
-
// 如果支持拖拽,在屏幕宽度大于table总的列宽的时候,添加一个空白列,宽度auto.
|
389
|
-
// 空白列添加到右固定列的前面
|
390
|
-
Table.prototype.transfromColumns = function (columns, needEmptyColumn) {
|
391
|
-
if (!this.resizable || needEmptyColumn === false)
|
392
|
-
return columns;
|
393
|
-
var cols = __spread(columns);
|
394
|
-
var firstFixedRightIndex = cols.findIndex(function (item) { return get(item, 'fixed') === 'right'; });
|
395
|
-
var column = {
|
396
|
-
title: '',
|
397
|
-
dataIndex: '__empty__',
|
398
|
-
key: '__empty__'
|
399
|
-
};
|
400
|
-
if (firstFixedRightIndex === -1) {
|
401
|
-
cols.push(column);
|
305
|
+
return allCols;
|
402
306
|
}
|
403
|
-
|
404
|
-
|
307
|
+
if (this.sortable) {
|
308
|
+
allCols = getSortedCoulmns(allCols, this.sortConfig.sortKeys || [], this.hiddenColumn || []);
|
405
309
|
}
|
406
|
-
|
407
|
-
|
408
|
-
Table.prototype.getColumns = function () {
|
409
|
-
var _a = this.props, showColumnSetting = _a.showColumnSetting, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
|
410
|
-
if (!showColumnSetting) {
|
411
|
-
return this.transfromColumns(this.columns, needEmptyColumn);
|
310
|
+
if (this.resizable) {
|
311
|
+
allCols = addEmptyColumn(allCols, this.hiddenColumn, this.resizable && needEmptyColumn);
|
412
312
|
}
|
413
|
-
//
|
414
|
-
var columnsSettingOptions = this.columnsSettingOptions;
|
415
|
-
var allCols = this.getSortedColumns();
|
416
|
-
this.transfromColumns(allCols, needEmptyColumn);
|
313
|
+
// 需要添加设置按钮
|
417
314
|
var length = allCols.length;
|
418
315
|
if (length > 0) {
|
419
316
|
var title = (React.createElement("span", { className: SDK_PREFIX + "-last-column-title" },
|
420
317
|
React.createElement("span", { className: SDK_PREFIX + "-last-column-setting" },
|
421
|
-
React.createElement(ColumnSetting, { options: columnsSettingOptions, hiddenKeys: this.hiddenColumn, onHiddenKeysChange: this.handleHideColumnsChange, onMove: this.setSortKeys, overlayClass: columnSettingOverlayClass }))));
|
318
|
+
React.createElement(ColumnSetting, { options: this.columnsSettingOptions, hiddenKeys: this.hiddenColumn, onHiddenKeysChange: this.handleHideColumnsChange, onMove: this.setSortKeys, overlayClass: columnSettingOverlayClass, sortable: this.sortable }))));
|
422
319
|
allCols.push({
|
423
320
|
title: title,
|
424
321
|
dataIndex: '__setting__',
|
@@ -432,14 +329,9 @@ var Table = /** @class */ (function (_super) {
|
|
432
329
|
Table.prototype.getRowKey = function (row, index) {
|
433
330
|
var rowKey = this.props.rowKey;
|
434
331
|
if (typeof rowKey === 'function') {
|
435
|
-
return rowKey(row, index);
|
332
|
+
return rowKey(row, index).toString();
|
436
333
|
}
|
437
|
-
return rowKey ? row
|
438
|
-
};
|
439
|
-
Table.prototype.getSortCoulmns = function (columns) {
|
440
|
-
return this.sortConfig.sortKeys
|
441
|
-
.map(function (key) { return columns.find(function (column) { return column.dataIndex === key; }); })
|
442
|
-
.filter(function (f) { return !!f; });
|
334
|
+
return rowKey && typeof rowKey == 'string' ? get(row, rowKey) : index;
|
443
335
|
};
|
444
336
|
Table.prototype.setIndeterminate = function (indeterminate) {
|
445
337
|
this.indeterminate = indeterminate;
|
@@ -470,39 +362,32 @@ var Table = /** @class */ (function (_super) {
|
|
470
362
|
Table.prototype.setSettingFields = function (columns) {
|
471
363
|
this.settingFields = columns;
|
472
364
|
};
|
473
|
-
Table.prototype.setFixedRightKeys = function (columns) {
|
474
|
-
this.sortConfig = __assign(__assign({}, this.sortConfig), { fixedRightKeys: columns });
|
475
|
-
};
|
476
|
-
Table.prototype.setFixedLeftKeys = function (columns) {
|
477
|
-
this.sortConfig = __assign(__assign({}, this.sortConfig), { fixedLeftKeys: columns });
|
478
|
-
};
|
479
365
|
// 设置全选checkout的状态
|
480
|
-
Table.prototype.setCheckboxStatus = function (selectedRowsOfCurrentPage,
|
366
|
+
Table.prototype.setCheckboxStatus = function (selectedRowsOfCurrentPage, dataSourceLength) {
|
481
367
|
if (selectedRowsOfCurrentPage === void 0) { selectedRowsOfCurrentPage = []; }
|
482
|
-
if (dataSource === void 0) { dataSource = []; }
|
483
368
|
this.setIndeterminate(!!selectedRowsOfCurrentPage.length &&
|
484
|
-
selectedRowsOfCurrentPage.length <
|
369
|
+
selectedRowsOfCurrentPage.length < dataSourceLength);
|
485
370
|
this.setCheckAll(!!selectedRowsOfCurrentPage.length &&
|
486
|
-
selectedRowsOfCurrentPage.length ===
|
371
|
+
selectedRowsOfCurrentPage.length === dataSourceLength);
|
487
372
|
};
|
488
|
-
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
373
|
+
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
489
374
|
var dataSource = this.props.dataSource;
|
490
375
|
// 更新CheckBox状态
|
491
|
-
this.setCheckboxStatus(selectedRowsOfCurrentPage, dataSource);
|
376
|
+
this.setCheckboxStatus(selectedRowsOfCurrentPage, size(dataSource));
|
492
377
|
// 更新外部组件rowSelection状态
|
493
|
-
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
378
|
+
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
494
379
|
};
|
495
|
-
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
380
|
+
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
496
381
|
var _a = this.props, rowSelection = _a.rowSelection, selectedRows = _a.selectedRows, rowKey = _a.rowKey, dataSource = _a.dataSource;
|
497
382
|
if (rowSelection && rowSelection.onChange) {
|
498
383
|
if (selectedRows && rowKey) {
|
499
384
|
var a = differenceBy(dataSource, selectedRowsOfCurrentPage, rowKey);
|
500
385
|
var b = differenceBy(selectedRows, a, rowKey);
|
501
386
|
var rows = unionBy(b, selectedRowsOfCurrentPage, rowKey);
|
502
|
-
rowSelection.onChange(selectedRowKeys, rows);
|
387
|
+
rowSelection.onChange(selectedRowKeys, rows, info);
|
503
388
|
}
|
504
389
|
else {
|
505
|
-
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
390
|
+
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
506
391
|
}
|
507
392
|
}
|
508
393
|
};
|
@@ -515,12 +400,13 @@ var Table = /** @class */ (function (_super) {
|
|
515
400
|
: xor(selectedRowKeys, this.keysOfCurrentPage);
|
516
401
|
this.setCheckAll(e.target.checked);
|
517
402
|
this.setIndeterminate(false);
|
518
|
-
this.onRowSelectionChange(selectedRowKeys, currentRows
|
403
|
+
this.onRowSelectionChange(selectedRowKeys, currentRows, {
|
404
|
+
type: selectedRowKeys.length > 0 ? 'all' : 'none'
|
405
|
+
});
|
519
406
|
};
|
520
407
|
Table.prototype.handleBatchOptionClick = function (option) {
|
521
|
-
|
522
|
-
|
523
|
-
}
|
408
|
+
var _a;
|
409
|
+
(_a = option.onClick) === null || _a === void 0 ? void 0 : _a.call(option, this.selectedRowKeys);
|
524
410
|
};
|
525
411
|
Table.prototype.getRowClassName = function (record, index, indent) {
|
526
412
|
var rowClassName = this.props.rowClassName;
|
@@ -545,87 +431,56 @@ var Table = /** @class */ (function (_super) {
|
|
545
431
|
return noneSelected || disabled;
|
546
432
|
};
|
547
433
|
Table.prototype.handleResize = function (col, size, oldColumn) {
|
548
|
-
console.log('handleResize', col, size);
|
549
434
|
var newColumns = __spread(oldColumn);
|
435
|
+
var sizeMap = {};
|
550
436
|
newColumns.forEach(function (item) {
|
437
|
+
// 更新宽度
|
551
438
|
if (get(item, 'dataIndex') === col.dataIndex) {
|
552
439
|
item.width = size.width;
|
553
440
|
}
|
441
|
+
// 更新sizeMap
|
442
|
+
if (item.dataIndex && isNumber(item.width) && !isNaN(item.width)) {
|
443
|
+
sizeMap[item.dataIndex] = item.width;
|
444
|
+
}
|
554
445
|
});
|
555
|
-
var sizeMap = {};
|
556
446
|
var setttingFields = this.settingFields;
|
557
|
-
|
558
|
-
if (
|
559
|
-
|
560
|
-
!isNaN(element.width)) {
|
561
|
-
sizeMap[element.dataIndex] = element.width;
|
447
|
+
setttingFields.forEach(function (field) {
|
448
|
+
if (sizeMap[field.field]) {
|
449
|
+
field.width = sizeMap[field.field];
|
562
450
|
}
|
563
451
|
});
|
564
452
|
if (this.props.onSettingChange) {
|
565
|
-
setttingFields.forEach(function (field) {
|
566
|
-
if (sizeMap[field.field]) {
|
567
|
-
field.width = sizeMap[field.field];
|
568
|
-
}
|
569
|
-
});
|
570
453
|
this.props.onSettingChange(setttingFields);
|
571
454
|
}
|
572
455
|
else if (this.resizable && this.props.saveSettingKey) {
|
573
|
-
setttingFields.forEach(function (field) {
|
574
|
-
if (sizeMap[field.field]) {
|
575
|
-
field.width = sizeMap[field.field];
|
576
|
-
}
|
577
|
-
});
|
578
456
|
this.setSettingFields(setttingFields);
|
579
457
|
}
|
580
458
|
this.setColumns(newColumns);
|
581
459
|
};
|
582
460
|
Table.prototype.getResizeColumns = function (columns) {
|
583
|
-
|
584
|
-
var fields = this.settingFields;
|
585
|
-
if ((fields === null || fields === void 0 ? void 0 : fields.length) && isArray(fields)) {
|
586
|
-
columns = columns === null || columns === void 0 ? void 0 : columns.map(function (col) {
|
587
|
-
var _a;
|
588
|
-
var dataIndex = get(col, 'dataIndex');
|
589
|
-
var width = (_a = fields === null || fields === void 0 ? void 0 : fields.find(function (f) { return f.field === dataIndex; })) === null || _a === void 0 ? void 0 : _a.width;
|
590
|
-
return isNumber(width) ? __assign(__assign({}, col), { width: width }) : col;
|
591
|
-
});
|
592
|
-
}
|
593
|
-
var transformColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (it, index) {
|
594
|
-
if (get(it, 'resizable') && _this.resizable) {
|
595
|
-
return __assign(__assign({}, it), { ellipsis: {
|
596
|
-
showTitle: true
|
597
|
-
}, onHeaderCell: function (col) {
|
598
|
-
var _a;
|
599
|
-
return ({
|
600
|
-
width: col.width,
|
601
|
-
// !传入newColumn,而不传入column是因为需要拿到有onHeaderCell的值,外面collumn的变化内部监听不到
|
602
|
-
onResize: function (_, _a) {
|
603
|
-
var size = _a.size;
|
604
|
-
_this.handleResize(col, size, transformColumns);
|
605
|
-
},
|
606
|
-
isLastColumn: index === ((_a = (columns || [])) === null || _a === void 0 ? void 0 : _a.length) - 1
|
607
|
-
});
|
608
|
-
} });
|
609
|
-
}
|
610
|
-
return it;
|
611
|
-
});
|
612
|
-
return transformColumns;
|
461
|
+
return getResizeColumns(columns || [], this.settingFields, this.resizable, this.handleResize);
|
613
462
|
};
|
614
463
|
Table.prototype.componentDidMount = function () {
|
615
464
|
var _a;
|
616
|
-
|
617
|
-
|
465
|
+
var _b = this.props, columns = _b.columns, saveSettingKey = _b.saveSettingKey, _c = _b.hiddenColumns, hiddenColumns = _c === void 0 ? [] : _c;
|
466
|
+
var settingFields = getLocalSettings(saveSettingKey);
|
467
|
+
if (this.showSetting) {
|
468
|
+
this.updateSettingFields(columns, settingFields, hiddenColumns);
|
469
|
+
}
|
470
|
+
else {
|
471
|
+
this.setSettingFields(settingFields);
|
618
472
|
}
|
619
|
-
this.
|
620
|
-
? this.getResizeColumns(
|
621
|
-
:
|
473
|
+
var transformColumns = this.resizable && ((_a = this.settingFields) === null || _a === void 0 ? void 0 : _a.length)
|
474
|
+
? this.getResizeColumns(columns)
|
475
|
+
: columns;
|
476
|
+
this.setColumns(transformColumns);
|
622
477
|
};
|
623
478
|
Table.prototype.render = function () {
|
624
479
|
var _a, _b;
|
625
480
|
var _this = this;
|
626
481
|
var _c = this.props, className = _c.className, batchOptions = _c.batchOptions, scroll = _c.scroll, locale = _c.locale, emptyText = _c.emptyText, columns = _c.columns, components = _c.components, draggable = _c.draggable, restProps = __rest(_c, ["className", "batchOptions", "scroll", "locale", "emptyText", "columns", "components", "draggable"]);
|
627
482
|
return (React.createElement("div", null,
|
628
|
-
React.createElement(AntTable, __assign({ scroll: scroll, locale: __assign({ emptyText: this.
|
483
|
+
React.createElement(AntTable, __assign({ scroll: scroll, locale: __assign({ emptyText: (React.createElement(EmptyText, { locale: this.context.locale, emptyText: emptyText })) }, locale), columns: this.getColumns() }, restProps, { className: classnames(SDK_PREFIX + "-table-wrapper", (_a = {}, _a[SDK_PREFIX + "-table-scrollX"] = get(scroll, 'x'), _a), (_b = {}, _b[SDK_PREFIX + "-table-scrollY"] = get(scroll, 'y'), _b), className),
|
629
484
|
// 涉及到权限
|
630
485
|
// getCheckboxProps只能放到tableBatchWrapper里,因为selectedRowKeys在那个组件计算
|
631
486
|
rowSelection: batchOptions && this.props.rowSelection
|
@@ -671,7 +526,7 @@ var Table = /** @class */ (function (_super) {
|
|
671
526
|
], Table.prototype, "hiddenColumn", void 0);
|
672
527
|
__decorate([
|
673
528
|
observable.ref,
|
674
|
-
__metadata("design:type",
|
529
|
+
__metadata("design:type", Object)
|
675
530
|
], Table.prototype, "columns", void 0);
|
676
531
|
__decorate([
|
677
532
|
observable.ref,
|
@@ -683,7 +538,7 @@ var Table = /** @class */ (function (_super) {
|
|
683
538
|
], Table.prototype, "settingFields", void 0);
|
684
539
|
__decorate([
|
685
540
|
computed,
|
686
|
-
__metadata("design:type",
|
541
|
+
__metadata("design:type", Array),
|
687
542
|
__metadata("design:paramtypes", [])
|
688
543
|
], Table.prototype, "selectedRowKeys", null);
|
689
544
|
__decorate([
|
@@ -701,11 +556,6 @@ var Table = /** @class */ (function (_super) {
|
|
701
556
|
__metadata("design:type", Object),
|
702
557
|
__metadata("design:paramtypes", [])
|
703
558
|
], Table.prototype, "keysOfCurrentPage", null);
|
704
|
-
__decorate([
|
705
|
-
computed,
|
706
|
-
__metadata("design:type", Object),
|
707
|
-
__metadata("design:paramtypes", [])
|
708
|
-
], Table.prototype, "emptyTextComp", null);
|
709
559
|
__decorate([
|
710
560
|
computed,
|
711
561
|
__metadata("design:type", Object),
|
@@ -727,12 +577,10 @@ var Table = /** @class */ (function (_super) {
|
|
727
577
|
__metadata("design:paramtypes", [])
|
728
578
|
], Table.prototype, "sortable", null);
|
729
579
|
__decorate([
|
730
|
-
|
731
|
-
|
732
|
-
__metadata("design:
|
733
|
-
|
734
|
-
__metadata("design:returntype", void 0)
|
735
|
-
], Table.prototype, "updateSettingConfig", null);
|
580
|
+
computed,
|
581
|
+
__metadata("design:type", Object),
|
582
|
+
__metadata("design:paramtypes", [])
|
583
|
+
], Table.prototype, "showSetting", null);
|
736
584
|
__decorate([
|
737
585
|
bind,
|
738
586
|
action,
|
@@ -744,7 +592,7 @@ var Table = /** @class */ (function (_super) {
|
|
744
592
|
bind,
|
745
593
|
action,
|
746
594
|
__metadata("design:type", Function),
|
747
|
-
__metadata("design:paramtypes", [Array, Array]),
|
595
|
+
__metadata("design:paramtypes", [Array, Array, Array]),
|
748
596
|
__metadata("design:returntype", void 0)
|
749
597
|
], Table.prototype, "updateSettingFields", null);
|
750
598
|
__decorate([
|
@@ -753,18 +601,6 @@ var Table = /** @class */ (function (_super) {
|
|
753
601
|
__metadata("design:paramtypes", [Array]),
|
754
602
|
__metadata("design:returntype", void 0)
|
755
603
|
], Table.prototype, "handleHideColumnsChange", null);
|
756
|
-
__decorate([
|
757
|
-
bind,
|
758
|
-
__metadata("design:type", Function),
|
759
|
-
__metadata("design:paramtypes", []),
|
760
|
-
__metadata("design:returntype", void 0)
|
761
|
-
], Table.prototype, "getSortedColumns", null);
|
762
|
-
__decorate([
|
763
|
-
bind,
|
764
|
-
__metadata("design:type", Function),
|
765
|
-
__metadata("design:paramtypes", [Array, Boolean]),
|
766
|
-
__metadata("design:returntype", void 0)
|
767
|
-
], Table.prototype, "transfromColumns", null);
|
768
604
|
__decorate([
|
769
605
|
bind,
|
770
606
|
__metadata("design:type", Function),
|
@@ -777,12 +613,6 @@ var Table = /** @class */ (function (_super) {
|
|
777
613
|
__metadata("design:paramtypes", [Object, Number]),
|
778
614
|
__metadata("design:returntype", void 0)
|
779
615
|
], Table.prototype, "getRowKey", null);
|
780
|
-
__decorate([
|
781
|
-
bind,
|
782
|
-
__metadata("design:type", Function),
|
783
|
-
__metadata("design:paramtypes", [Array]),
|
784
|
-
__metadata("design:returntype", void 0)
|
785
|
-
], Table.prototype, "getSortCoulmns", null);
|
786
616
|
__decorate([
|
787
617
|
bind,
|
788
618
|
action,
|
@@ -808,7 +638,7 @@ var Table = /** @class */ (function (_super) {
|
|
808
638
|
bind,
|
809
639
|
action,
|
810
640
|
__metadata("design:type", Function),
|
811
|
-
__metadata("design:paramtypes", [
|
641
|
+
__metadata("design:paramtypes", [Object]),
|
812
642
|
__metadata("design:returntype", void 0)
|
813
643
|
], Table.prototype, "setColumns", null);
|
814
644
|
__decorate([
|
@@ -825,36 +655,22 @@ var Table = /** @class */ (function (_super) {
|
|
825
655
|
__metadata("design:paramtypes", [Array]),
|
826
656
|
__metadata("design:returntype", void 0)
|
827
657
|
], Table.prototype, "setSettingFields", null);
|
828
|
-
__decorate([
|
829
|
-
bind,
|
830
|
-
action,
|
831
|
-
__metadata("design:type", Function),
|
832
|
-
__metadata("design:paramtypes", [Array]),
|
833
|
-
__metadata("design:returntype", void 0)
|
834
|
-
], Table.prototype, "setFixedRightKeys", null);
|
835
|
-
__decorate([
|
836
|
-
bind,
|
837
|
-
action,
|
838
|
-
__metadata("design:type", Function),
|
839
|
-
__metadata("design:paramtypes", [Array]),
|
840
|
-
__metadata("design:returntype", void 0)
|
841
|
-
], Table.prototype, "setFixedLeftKeys", null);
|
842
658
|
__decorate([
|
843
659
|
bind,
|
844
660
|
__metadata("design:type", Function),
|
845
|
-
__metadata("design:paramtypes", [Array,
|
661
|
+
__metadata("design:paramtypes", [Array, Number]),
|
846
662
|
__metadata("design:returntype", void 0)
|
847
663
|
], Table.prototype, "setCheckboxStatus", null);
|
848
664
|
__decorate([
|
849
665
|
bind,
|
850
666
|
__metadata("design:type", Function),
|
851
|
-
__metadata("design:paramtypes", [Array, Array]),
|
667
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
852
668
|
__metadata("design:returntype", void 0)
|
853
669
|
], Table.prototype, "handleSelectionChange", null);
|
854
670
|
__decorate([
|
855
671
|
bind,
|
856
672
|
__metadata("design:type", Function),
|
857
|
-
__metadata("design:paramtypes", [Array, Array]),
|
673
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
858
674
|
__metadata("design:returntype", void 0)
|
859
675
|
], Table.prototype, "onRowSelectionChange", null);
|
860
676
|
__decorate([
|