@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
@@ -48,6 +48,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
48
48
|
__setModuleDefault(result, mod);
|
49
49
|
return result;
|
50
50
|
};
|
51
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
52
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
53
|
+
};
|
51
54
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
52
55
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
53
56
|
};
|
@@ -86,7 +89,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
86
89
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
87
90
|
};
|
88
91
|
Object.defineProperty(exports, "__esModule", { value: true });
|
89
|
-
exports.ETableSettingType = void 0;
|
90
92
|
var React = __importStar(require("react"));
|
91
93
|
var classnames_1 = __importDefault(require("classnames"));
|
92
94
|
var mobx_react_1 = require("mobx-react");
|
@@ -95,7 +97,6 @@ var lodash_1 = require("lodash");
|
|
95
97
|
var antd_1 = require("antd");
|
96
98
|
var config_provider_1 = require("antd/es/config-provider");
|
97
99
|
var app_sdk_1 = require("@qn-pandora/app-sdk");
|
98
|
-
var pandora_component_icons_1 = require("@qn-pandora/pandora-component-icons");
|
99
100
|
var bind_1 = __importDefault(require("../../utils/bind"));
|
100
101
|
var language_1 = require("../../utils/language");
|
101
102
|
var style_1 = require("../../constants/style");
|
@@ -103,11 +104,15 @@ var type_1 = require("../../constants/language/table/type");
|
|
103
104
|
var ColumnTag_1 = require("./ColumnTag/ColumnTag");
|
104
105
|
var ColumnSetting_1 = __importDefault(require("./ColumnSetting"));
|
105
106
|
var ResizableTitle_1 = __importDefault(require("./ResizableTitle"));
|
106
|
-
var
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
107
|
+
var EmptyText_1 = __importDefault(require("./EmptyText"));
|
108
|
+
var util_1 = require("./util");
|
109
|
+
var type_2 = require("./type");
|
110
|
+
__exportStar(require("./type"), exports);
|
111
|
+
/**
|
112
|
+
* 表格提供自定义多选, 通过 rowSelection对象的selectedRowKeys和onChange来控制多选的状态
|
113
|
+
* 需要注意的是, 当在外部进行增删改或者外部需要控制选择状态时, 例如删除之后清空全选状态, 需要受控
|
114
|
+
* 传入selectedRowKeys值。
|
115
|
+
*/
|
111
116
|
/**
|
112
117
|
* pandora2.0风格的表格
|
113
118
|
*/
|
@@ -120,9 +125,7 @@ var Table = /** @class */ (function (_super) {
|
|
120
125
|
_this.hiddenColumn = _this.props.hiddenColumns;
|
121
126
|
_this.columns = [];
|
122
127
|
_this.sortConfig = {
|
123
|
-
sortKeys: []
|
124
|
-
fixedRightKeys: [],
|
125
|
-
fixedLeftKeys: []
|
128
|
+
sortKeys: []
|
126
129
|
};
|
127
130
|
_this.settingFields = [];
|
128
131
|
return _this;
|
@@ -138,30 +141,34 @@ var Table = /** @class */ (function (_super) {
|
|
138
141
|
(lastRowSelection &&
|
139
142
|
!lodash_1.isEqual(lastRowSelection.selectedRowKeys, rowSelection.selectedRowKeys)))) {
|
140
143
|
var selectedRowKeys_1 = rowSelection.selectedRowKeys || [];
|
141
|
-
var
|
142
|
-
var selectedRowKeysOfCurrentPage_1 =
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
var _a = nextProps.dataSource, dataSource = _a === void 0 ? [] : _a;
|
145
|
+
var selectedRowKeysOfCurrentPage_1 = [];
|
146
|
+
var selectedRowsOfCurrentPage_1 = [];
|
147
|
+
dataSource.forEach(function (item, index) {
|
148
|
+
var rowKey = _this.getRowKey(item, index);
|
149
|
+
if (selectedRowKeys_1.includes(rowKey)) {
|
150
|
+
selectedRowKeysOfCurrentPage_1.push(rowKey);
|
151
|
+
selectedRowsOfCurrentPage_1.push(item);
|
152
|
+
}
|
147
153
|
});
|
148
154
|
// 数据源变化时重新设置多选框是否为全选状态或部分选中状态
|
149
|
-
this.setCheckboxStatus(
|
155
|
+
this.setCheckboxStatus(selectedRowsOfCurrentPage_1, lodash_1.size(nextProps.dataSource));
|
150
156
|
// 更新外部组件rowSelection状态
|
151
157
|
// this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage)
|
152
158
|
if (rowSelection && rowSelection.onChange) {
|
153
159
|
rowSelection.onChange(lodash_1.union(selectedRowKeysOfCurrentPage_1, selectedRowKeys_1), selectedRows && rowKey
|
154
|
-
? lodash_1.unionBy(
|
155
|
-
:
|
160
|
+
? lodash_1.unionBy(selectedRowsOfCurrentPage_1, selectedRows, rowKey)
|
161
|
+
: selectedRowsOfCurrentPage_1, { type: 'single' });
|
156
162
|
}
|
157
163
|
}
|
164
|
+
// 更新隐藏的key
|
158
165
|
if (!lodash_1.isEqual(nextProps.hiddenColumns, this.props.hiddenColumns)) {
|
159
166
|
this.setHiddenColumn(nextProps.hiddenColumns);
|
160
167
|
}
|
161
168
|
if (nextProps.columns !== this.props.columns) {
|
162
169
|
if ((nextProps.scroll && nextProps.draggable === true) ||
|
163
|
-
nextProps.draggable === ETableSettingType.RESIZE) {
|
164
|
-
this.
|
170
|
+
nextProps.draggable === type_2.ETableSettingType.RESIZE) {
|
171
|
+
this.updateSettingFields(nextProps.columns, this.settingFields, nextProps.hiddenColumns || []);
|
165
172
|
this.setColumns(this.getResizeColumns(nextProps.columns));
|
166
173
|
}
|
167
174
|
else {
|
@@ -176,8 +183,7 @@ var Table = /** @class */ (function (_super) {
|
|
176
183
|
};
|
177
184
|
Object.defineProperty(Table.prototype, "selectedRowKeys", {
|
178
185
|
get: function () {
|
179
|
-
|
180
|
-
return (rowSelection && rowSelection.selectedRowKeys) || [];
|
186
|
+
return lodash_1.get(this.props.rowSelection, 'selectedRowKeys', []);
|
181
187
|
},
|
182
188
|
enumerable: false,
|
183
189
|
configurable: true
|
@@ -213,167 +219,80 @@ var Table = /** @class */ (function (_super) {
|
|
213
219
|
enumerable: false,
|
214
220
|
configurable: true
|
215
221
|
});
|
216
|
-
Object.defineProperty(Table.prototype, "emptyTextComp", {
|
217
|
-
get: function () {
|
218
|
-
var emptyText = this.props.emptyText;
|
219
|
-
if (!emptyText) {
|
220
|
-
return (React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty" },
|
221
|
-
React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty-icon" },
|
222
|
-
React.createElement(pandora_component_icons_1.EmptyIcon, null)),
|
223
|
-
React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty-text" }, language_1.formatString(type_1.TableLocale.empty, this.context.locale))));
|
224
|
-
}
|
225
|
-
if (typeof emptyText === 'string' || typeof emptyText === 'number') {
|
226
|
-
return (React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty" },
|
227
|
-
React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty-icon" },
|
228
|
-
React.createElement(pandora_component_icons_1.EmptyIcon, null)),
|
229
|
-
React.createElement("div", { className: style_1.SDK_PREFIX + "-table-empty-text" }, emptyText)));
|
230
|
-
}
|
231
|
-
return emptyText;
|
232
|
-
},
|
233
|
-
enumerable: false,
|
234
|
-
configurable: true
|
235
|
-
});
|
236
222
|
Object.defineProperty(Table.prototype, "columnsSettingOptions", {
|
237
223
|
// 列设置 options
|
238
224
|
get: function () {
|
239
225
|
var options = [];
|
240
226
|
var _a = this.props.columns, columns = _a === void 0 ? [] : _a;
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
227
|
+
// sortKeys 来保证数据的准确性
|
228
|
+
this.sortConfig.sortKeys.forEach(function (key) {
|
229
|
+
var target = columns.find(function (col) { var _a; return ((_a = col.key) === null || _a === void 0 ? void 0 : _a.toString()) === key; });
|
230
|
+
if (target && target.key) {
|
245
231
|
options.push({
|
246
|
-
label:
|
247
|
-
value:
|
232
|
+
label: target.colTitle || target.title,
|
233
|
+
value: target.key.toString()
|
248
234
|
});
|
249
235
|
}
|
250
236
|
});
|
251
|
-
return
|
252
|
-
.map(function (key) { return options.find(function (option) { return option.value === key; }); })
|
253
|
-
.filter(function (f) { return !!f; });
|
237
|
+
return options;
|
254
238
|
},
|
255
239
|
enumerable: false,
|
256
240
|
configurable: true
|
257
241
|
});
|
258
242
|
Object.defineProperty(Table.prototype, "columnKeys", {
|
259
243
|
get: function () {
|
260
|
-
|
261
|
-
var allKeys = [];
|
262
|
-
var unconfigableKeys = [];
|
263
|
-
var resetKeys = [];
|
264
|
-
columns.forEach(function (col) {
|
265
|
-
if (col.key) {
|
266
|
-
if (col.configurable === false) {
|
267
|
-
unconfigableKeys.push(col.key.toString());
|
268
|
-
}
|
269
|
-
else {
|
270
|
-
resetKeys.push(col.key.toString());
|
271
|
-
}
|
272
|
-
allKeys.push(col.key.toString());
|
273
|
-
}
|
274
|
-
});
|
275
|
-
return {
|
276
|
-
allKeys: allKeys,
|
277
|
-
unconfigableKeys: unconfigableKeys,
|
278
|
-
resetKeys: resetKeys
|
279
|
-
};
|
244
|
+
return util_1.getColumnKeys(this.props.columns || []);
|
280
245
|
},
|
281
246
|
enumerable: false,
|
282
247
|
configurable: true
|
283
248
|
});
|
284
249
|
Object.defineProperty(Table.prototype, "resizable", {
|
285
250
|
get: function () {
|
286
|
-
var _a,
|
287
|
-
return ((
|
288
|
-
|
289
|
-
this.props.scroll);
|
251
|
+
var _a = this.props, draggable = _a.draggable, scroll = _a.scroll;
|
252
|
+
return !!((draggable === true || draggable === type_2.ETableSettingType.RESIZE) &&
|
253
|
+
scroll);
|
290
254
|
},
|
291
255
|
enumerable: false,
|
292
256
|
configurable: true
|
293
257
|
});
|
294
258
|
Object.defineProperty(Table.prototype, "sortable", {
|
295
259
|
get: function () {
|
296
|
-
var
|
297
|
-
return
|
298
|
-
((_b = this.props) === null || _b === void 0 ? void 0 : _b.draggable) === ETableSettingType.SORT);
|
260
|
+
var draggable = this.props.draggable;
|
261
|
+
return draggable === true || draggable === type_2.ETableSettingType.SORT;
|
299
262
|
},
|
300
263
|
enumerable: false,
|
301
264
|
configurable: true
|
302
265
|
});
|
303
|
-
Table.prototype
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
var
|
311
|
-
|
312
|
-
|
313
|
-
|
266
|
+
Object.defineProperty(Table.prototype, "showSetting", {
|
267
|
+
// 是否支持列设置按钮
|
268
|
+
get: function () {
|
269
|
+
// showColumnSetting 需要同 draggable 配合使用
|
270
|
+
// 1、showColumnSetting = false, 不显示
|
271
|
+
// 2、draggable = sort 或者 draggable === true时才显示
|
272
|
+
// 3、draggable === resize 且 showColumnSetting = true时才显示(resize模式下必须显示设置showColumnSetting=true,才会显示列设置按钮)
|
273
|
+
var _a = this.props, showColumnSetting = _a.showColumnSetting, draggable = _a.draggable;
|
274
|
+
if (showColumnSetting === false)
|
275
|
+
return false;
|
276
|
+
if (draggable === type_2.ETableSettingType.SORT || draggable === true)
|
277
|
+
return true;
|
278
|
+
if (draggable === type_2.ETableSettingType.RESIZE && showColumnSetting === true) {
|
279
|
+
return true;
|
314
280
|
}
|
315
|
-
|
316
|
-
|
281
|
+
return false;
|
282
|
+
},
|
283
|
+
enumerable: false,
|
284
|
+
configurable: true
|
285
|
+
});
|
286
|
+
Table.prototype.initSettingConfig = function () {
|
287
|
+
var _a = this.props, saveSettingKey = _a.saveSettingKey, columns = _a.columns, _b = _a.hiddenColumns, hiddenColumns = _b === void 0 ? [] : _b;
|
288
|
+
var settingFields = util_1.getLocalSettings(saveSettingKey);
|
289
|
+
this.updateSettingFields(columns, settingFields, hiddenColumns);
|
317
290
|
};
|
318
|
-
Table.prototype.updateSettingFields = function (columns, settingFields) {
|
319
|
-
var _a =
|
320
|
-
var sortableColumns = [];
|
321
|
-
var leftColumns = [];
|
322
|
-
var rightColumns = [];
|
323
|
-
var hideKeys = [];
|
324
|
-
// 已配置的列和实际的对不上
|
325
|
-
// 可能新增或者删除列的情况
|
326
|
-
var newSettingFields = [];
|
327
|
-
// 已配置列
|
328
|
-
// 旧类型数据为对象类型,未配置
|
329
|
-
settingFields.map(function (field) {
|
330
|
-
var find = columns.find(function (column) { var _a; return ((_a = column) === null || _a === void 0 ? void 0 : _a.dataIndex) === field.field; });
|
331
|
-
if (find) {
|
332
|
-
if (field.hide) {
|
333
|
-
hideKeys.push(field.field);
|
334
|
-
}
|
335
|
-
if (!find.fixed) {
|
336
|
-
sortableColumns.push(field);
|
337
|
-
}
|
338
|
-
else if (find.fixed === 'left' || find.fixed === true) {
|
339
|
-
leftColumns.push(field);
|
340
|
-
}
|
341
|
-
else {
|
342
|
-
rightColumns.push(field);
|
343
|
-
}
|
344
|
-
}
|
345
|
-
});
|
346
|
-
// 未配置过的列
|
347
|
-
columns
|
348
|
-
.filter(function (f) { return !settingFields.find(function (field) { return field.field === f.dataIndex; }); })
|
349
|
-
.map(function (column) {
|
350
|
-
if (column.dataIndex) {
|
351
|
-
if (!column.fixed) {
|
352
|
-
sortableColumns.push({
|
353
|
-
field: column.dataIndex.toString(),
|
354
|
-
fixed: column.fixed
|
355
|
-
});
|
356
|
-
}
|
357
|
-
else if (column.fixed === 'left' || column.fixed === true) {
|
358
|
-
leftColumns.push({
|
359
|
-
field: column.dataIndex.toString(),
|
360
|
-
fixed: column.fixed
|
361
|
-
});
|
362
|
-
}
|
363
|
-
else {
|
364
|
-
rightColumns.push({
|
365
|
-
field: column.dataIndex.toString(),
|
366
|
-
fixed: column.fixed
|
367
|
-
});
|
368
|
-
}
|
369
|
-
}
|
370
|
-
});
|
371
|
-
this.setFixedLeftKeys(leftColumns.map(function (t) { return t.field; }));
|
372
|
-
this.setFixedRightKeys(rightColumns.map(function (t) { return t.field; }));
|
291
|
+
Table.prototype.updateSettingFields = function (columns, settingFields, hiddenColumns) {
|
292
|
+
var _a = util_1.getSortAndHiddenKeys(columns, settingFields, hiddenColumns), sortableColumns = _a.sortableColumns, resultHiddenColumns = _a.hiddenColumns;
|
373
293
|
this.setSortKeys(sortableColumns.map(function (t) { return t.field; }));
|
374
|
-
this.setHiddenColumn(
|
375
|
-
|
376
|
-
this.setSettingFields(newSettingFields);
|
294
|
+
this.setHiddenColumn(resultHiddenColumns);
|
295
|
+
this.setSettingFields(sortableColumns);
|
377
296
|
};
|
378
297
|
// 隐藏key
|
379
298
|
Table.prototype.handleHideColumnsChange = function (keys) {
|
@@ -384,66 +303,46 @@ var Table = /** @class */ (function (_super) {
|
|
384
303
|
return app_sdk_1.toaster.warning(language_1.formatString(type_1.TableLocale.hide_column_tooltip, this.context.locale));
|
385
304
|
}
|
386
305
|
var newSettingFields = this.settingFields.map(function (field) {
|
387
|
-
|
388
|
-
return __assign(__assign({}, field), { hide: true });
|
389
|
-
}
|
390
|
-
return __assign(__assign({}, field), { hide: false });
|
306
|
+
return __assign(__assign({}, field), { hide: lodash_1.includes(keys, field.field) });
|
391
307
|
});
|
392
308
|
this.setHiddenColumn(keys);
|
393
309
|
this.setSettingFields(newSettingFields);
|
394
310
|
(_b = (_a = this.props).onHiddenColumnsChange) === null || _b === void 0 ? void 0 : _b.call(_a, keys);
|
395
311
|
};
|
396
|
-
Table.prototype.
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
312
|
+
Table.prototype.getColumns = function () {
|
313
|
+
// 注意: 如果没有传columns, 可能渲染的是table 的children ,无需在处理columns
|
314
|
+
/**
|
315
|
+
* <Table>
|
316
|
+
* <Table.Column title="name" dataIndex="name"></Table.Column>
|
317
|
+
* <Table.Column title="age" dataIndex="name"></Table.Column>
|
318
|
+
* </Table>
|
319
|
+
*/
|
320
|
+
if (lodash_1.isUndefined(this.columns))
|
321
|
+
return this.columns;
|
322
|
+
var _a = this.props, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
|
323
|
+
// 显示列设置按钮,默认就会开启列隐藏功能
|
324
|
+
// 1、看是否支持排序, 排序 + 列隐藏, 排序用 sort 函数就行(sort 函数具有列隐藏的能力)
|
325
|
+
// 2、看是否 resize, resize + 列隐藏 可能需要添加空白列 addEmptyColumn
|
326
|
+
var allCols = __spread(this.columns);
|
327
|
+
if (!this.showSetting) {
|
328
|
+
// 如果不显示列设置按钮, 那么排序功能不支持
|
329
|
+
if (this.resizable) {
|
330
|
+
allCols = util_1.addEmptyColumn(allCols, this.hiddenColumn, this.resizable && needEmptyColumn);
|
402
331
|
}
|
403
|
-
return
|
404
|
-
}));
|
405
|
-
var fixedRightColumn = this.columns.filter(function (column) {
|
406
|
-
return lodash_1.includes(_this.sortConfig.fixedRightKeys, column.key);
|
407
|
-
});
|
408
|
-
var fixedLeftColumn = this.columns.filter(function (column) {
|
409
|
-
return lodash_1.includes(_this.sortConfig.fixedLeftKeys, column.key);
|
410
|
-
});
|
411
|
-
return __spread(fixedLeftColumn, this.getSortCoulmns(selectedCols), fixedRightColumn);
|
412
|
-
};
|
413
|
-
// 如果支持拖拽,在屏幕宽度大于table总的列宽的时候,添加一个空白列,宽度auto.
|
414
|
-
// 空白列添加到右固定列的前面
|
415
|
-
Table.prototype.transfromColumns = function (columns, needEmptyColumn) {
|
416
|
-
if (!this.resizable || needEmptyColumn === false)
|
417
|
-
return columns;
|
418
|
-
var cols = __spread(columns);
|
419
|
-
var firstFixedRightIndex = cols.findIndex(function (item) { return lodash_1.get(item, 'fixed') === 'right'; });
|
420
|
-
var column = {
|
421
|
-
title: '',
|
422
|
-
dataIndex: '__empty__',
|
423
|
-
key: '__empty__'
|
424
|
-
};
|
425
|
-
if (firstFixedRightIndex === -1) {
|
426
|
-
cols.push(column);
|
332
|
+
return allCols;
|
427
333
|
}
|
428
|
-
|
429
|
-
|
334
|
+
if (this.sortable) {
|
335
|
+
allCols = util_1.getSortedCoulmns(allCols, this.sortConfig.sortKeys || [], this.hiddenColumn || []);
|
430
336
|
}
|
431
|
-
|
432
|
-
|
433
|
-
Table.prototype.getColumns = function () {
|
434
|
-
var _a = this.props, showColumnSetting = _a.showColumnSetting, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
|
435
|
-
if (!showColumnSetting) {
|
436
|
-
return this.transfromColumns(this.columns, needEmptyColumn);
|
337
|
+
if (this.resizable) {
|
338
|
+
allCols = util_1.addEmptyColumn(allCols, this.hiddenColumn, this.resizable && needEmptyColumn);
|
437
339
|
}
|
438
|
-
//
|
439
|
-
var columnsSettingOptions = this.columnsSettingOptions;
|
440
|
-
var allCols = this.getSortedColumns();
|
441
|
-
this.transfromColumns(allCols, needEmptyColumn);
|
340
|
+
// 需要添加设置按钮
|
442
341
|
var length = allCols.length;
|
443
342
|
if (length > 0) {
|
444
343
|
var title = (React.createElement("span", { className: style_1.SDK_PREFIX + "-last-column-title" },
|
445
344
|
React.createElement("span", { className: style_1.SDK_PREFIX + "-last-column-setting" },
|
446
|
-
React.createElement(ColumnSetting_1.default, { options: columnsSettingOptions, hiddenKeys: this.hiddenColumn, onHiddenKeysChange: this.handleHideColumnsChange, onMove: this.setSortKeys, overlayClass: columnSettingOverlayClass }))));
|
345
|
+
React.createElement(ColumnSetting_1.default, { options: this.columnsSettingOptions, hiddenKeys: this.hiddenColumn, onHiddenKeysChange: this.handleHideColumnsChange, onMove: this.setSortKeys, overlayClass: columnSettingOverlayClass, sortable: this.sortable }))));
|
447
346
|
allCols.push({
|
448
347
|
title: title,
|
449
348
|
dataIndex: '__setting__',
|
@@ -457,14 +356,9 @@ var Table = /** @class */ (function (_super) {
|
|
457
356
|
Table.prototype.getRowKey = function (row, index) {
|
458
357
|
var rowKey = this.props.rowKey;
|
459
358
|
if (typeof rowKey === 'function') {
|
460
|
-
return rowKey(row, index);
|
359
|
+
return rowKey(row, index).toString();
|
461
360
|
}
|
462
|
-
return rowKey ? row
|
463
|
-
};
|
464
|
-
Table.prototype.getSortCoulmns = function (columns) {
|
465
|
-
return this.sortConfig.sortKeys
|
466
|
-
.map(function (key) { return columns.find(function (column) { return column.dataIndex === key; }); })
|
467
|
-
.filter(function (f) { return !!f; });
|
361
|
+
return rowKey && typeof rowKey == 'string' ? lodash_1.get(row, rowKey) : index;
|
468
362
|
};
|
469
363
|
Table.prototype.setIndeterminate = function (indeterminate) {
|
470
364
|
this.indeterminate = indeterminate;
|
@@ -495,39 +389,32 @@ var Table = /** @class */ (function (_super) {
|
|
495
389
|
Table.prototype.setSettingFields = function (columns) {
|
496
390
|
this.settingFields = columns;
|
497
391
|
};
|
498
|
-
Table.prototype.setFixedRightKeys = function (columns) {
|
499
|
-
this.sortConfig = __assign(__assign({}, this.sortConfig), { fixedRightKeys: columns });
|
500
|
-
};
|
501
|
-
Table.prototype.setFixedLeftKeys = function (columns) {
|
502
|
-
this.sortConfig = __assign(__assign({}, this.sortConfig), { fixedLeftKeys: columns });
|
503
|
-
};
|
504
392
|
// 设置全选checkout的状态
|
505
|
-
Table.prototype.setCheckboxStatus = function (selectedRowsOfCurrentPage,
|
393
|
+
Table.prototype.setCheckboxStatus = function (selectedRowsOfCurrentPage, dataSourceLength) {
|
506
394
|
if (selectedRowsOfCurrentPage === void 0) { selectedRowsOfCurrentPage = []; }
|
507
|
-
if (dataSource === void 0) { dataSource = []; }
|
508
395
|
this.setIndeterminate(!!selectedRowsOfCurrentPage.length &&
|
509
|
-
selectedRowsOfCurrentPage.length <
|
396
|
+
selectedRowsOfCurrentPage.length < dataSourceLength);
|
510
397
|
this.setCheckAll(!!selectedRowsOfCurrentPage.length &&
|
511
|
-
selectedRowsOfCurrentPage.length ===
|
398
|
+
selectedRowsOfCurrentPage.length === dataSourceLength);
|
512
399
|
};
|
513
|
-
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
400
|
+
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
514
401
|
var dataSource = this.props.dataSource;
|
515
402
|
// 更新CheckBox状态
|
516
|
-
this.setCheckboxStatus(selectedRowsOfCurrentPage, dataSource);
|
403
|
+
this.setCheckboxStatus(selectedRowsOfCurrentPage, lodash_1.size(dataSource));
|
517
404
|
// 更新外部组件rowSelection状态
|
518
|
-
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
405
|
+
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
519
406
|
};
|
520
|
-
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
407
|
+
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
521
408
|
var _a = this.props, rowSelection = _a.rowSelection, selectedRows = _a.selectedRows, rowKey = _a.rowKey, dataSource = _a.dataSource;
|
522
409
|
if (rowSelection && rowSelection.onChange) {
|
523
410
|
if (selectedRows && rowKey) {
|
524
411
|
var a = lodash_1.differenceBy(dataSource, selectedRowsOfCurrentPage, rowKey);
|
525
412
|
var b = lodash_1.differenceBy(selectedRows, a, rowKey);
|
526
413
|
var rows = lodash_1.unionBy(b, selectedRowsOfCurrentPage, rowKey);
|
527
|
-
rowSelection.onChange(selectedRowKeys, rows);
|
414
|
+
rowSelection.onChange(selectedRowKeys, rows, info);
|
528
415
|
}
|
529
416
|
else {
|
530
|
-
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
417
|
+
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
531
418
|
}
|
532
419
|
}
|
533
420
|
};
|
@@ -540,12 +427,13 @@ var Table = /** @class */ (function (_super) {
|
|
540
427
|
: lodash_1.xor(selectedRowKeys, this.keysOfCurrentPage);
|
541
428
|
this.setCheckAll(e.target.checked);
|
542
429
|
this.setIndeterminate(false);
|
543
|
-
this.onRowSelectionChange(selectedRowKeys, currentRows
|
430
|
+
this.onRowSelectionChange(selectedRowKeys, currentRows, {
|
431
|
+
type: selectedRowKeys.length > 0 ? 'all' : 'none'
|
432
|
+
});
|
544
433
|
};
|
545
434
|
Table.prototype.handleBatchOptionClick = function (option) {
|
546
|
-
|
547
|
-
|
548
|
-
}
|
435
|
+
var _a;
|
436
|
+
(_a = option.onClick) === null || _a === void 0 ? void 0 : _a.call(option, this.selectedRowKeys);
|
549
437
|
};
|
550
438
|
Table.prototype.getRowClassName = function (record, index, indent) {
|
551
439
|
var rowClassName = this.props.rowClassName;
|
@@ -570,87 +458,56 @@ var Table = /** @class */ (function (_super) {
|
|
570
458
|
return noneSelected || disabled;
|
571
459
|
};
|
572
460
|
Table.prototype.handleResize = function (col, size, oldColumn) {
|
573
|
-
console.log('handleResize', col, size);
|
574
461
|
var newColumns = __spread(oldColumn);
|
462
|
+
var sizeMap = {};
|
575
463
|
newColumns.forEach(function (item) {
|
464
|
+
// 更新宽度
|
576
465
|
if (lodash_1.get(item, 'dataIndex') === col.dataIndex) {
|
577
466
|
item.width = size.width;
|
578
467
|
}
|
468
|
+
// 更新sizeMap
|
469
|
+
if (item.dataIndex && lodash_1.isNumber(item.width) && !isNaN(item.width)) {
|
470
|
+
sizeMap[item.dataIndex] = item.width;
|
471
|
+
}
|
579
472
|
});
|
580
|
-
var sizeMap = {};
|
581
473
|
var setttingFields = this.settingFields;
|
582
|
-
|
583
|
-
if (
|
584
|
-
|
585
|
-
!isNaN(element.width)) {
|
586
|
-
sizeMap[element.dataIndex] = element.width;
|
474
|
+
setttingFields.forEach(function (field) {
|
475
|
+
if (sizeMap[field.field]) {
|
476
|
+
field.width = sizeMap[field.field];
|
587
477
|
}
|
588
478
|
});
|
589
479
|
if (this.props.onSettingChange) {
|
590
|
-
setttingFields.forEach(function (field) {
|
591
|
-
if (sizeMap[field.field]) {
|
592
|
-
field.width = sizeMap[field.field];
|
593
|
-
}
|
594
|
-
});
|
595
480
|
this.props.onSettingChange(setttingFields);
|
596
481
|
}
|
597
482
|
else if (this.resizable && this.props.saveSettingKey) {
|
598
|
-
setttingFields.forEach(function (field) {
|
599
|
-
if (sizeMap[field.field]) {
|
600
|
-
field.width = sizeMap[field.field];
|
601
|
-
}
|
602
|
-
});
|
603
483
|
this.setSettingFields(setttingFields);
|
604
484
|
}
|
605
485
|
this.setColumns(newColumns);
|
606
486
|
};
|
607
487
|
Table.prototype.getResizeColumns = function (columns) {
|
608
|
-
|
609
|
-
var fields = this.settingFields;
|
610
|
-
if ((fields === null || fields === void 0 ? void 0 : fields.length) && lodash_1.isArray(fields)) {
|
611
|
-
columns = columns === null || columns === void 0 ? void 0 : columns.map(function (col) {
|
612
|
-
var _a;
|
613
|
-
var dataIndex = lodash_1.get(col, 'dataIndex');
|
614
|
-
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;
|
615
|
-
return lodash_1.isNumber(width) ? __assign(__assign({}, col), { width: width }) : col;
|
616
|
-
});
|
617
|
-
}
|
618
|
-
var transformColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (it, index) {
|
619
|
-
if (lodash_1.get(it, 'resizable') && _this.resizable) {
|
620
|
-
return __assign(__assign({}, it), { ellipsis: {
|
621
|
-
showTitle: true
|
622
|
-
}, onHeaderCell: function (col) {
|
623
|
-
var _a;
|
624
|
-
return ({
|
625
|
-
width: col.width,
|
626
|
-
// !传入newColumn,而不传入column是因为需要拿到有onHeaderCell的值,外面collumn的变化内部监听不到
|
627
|
-
onResize: function (_, _a) {
|
628
|
-
var size = _a.size;
|
629
|
-
_this.handleResize(col, size, transformColumns);
|
630
|
-
},
|
631
|
-
isLastColumn: index === ((_a = (columns || [])) === null || _a === void 0 ? void 0 : _a.length) - 1
|
632
|
-
});
|
633
|
-
} });
|
634
|
-
}
|
635
|
-
return it;
|
636
|
-
});
|
637
|
-
return transformColumns;
|
488
|
+
return util_1.getResizeColumns(columns || [], this.settingFields, this.resizable, this.handleResize);
|
638
489
|
};
|
639
490
|
Table.prototype.componentDidMount = function () {
|
640
491
|
var _a;
|
641
|
-
|
642
|
-
|
492
|
+
var _b = this.props, columns = _b.columns, saveSettingKey = _b.saveSettingKey, _c = _b.hiddenColumns, hiddenColumns = _c === void 0 ? [] : _c;
|
493
|
+
var settingFields = util_1.getLocalSettings(saveSettingKey);
|
494
|
+
if (this.showSetting) {
|
495
|
+
this.updateSettingFields(columns, settingFields, hiddenColumns);
|
496
|
+
}
|
497
|
+
else {
|
498
|
+
this.setSettingFields(settingFields);
|
643
499
|
}
|
644
|
-
this.
|
645
|
-
? this.getResizeColumns(
|
646
|
-
:
|
500
|
+
var transformColumns = this.resizable && ((_a = this.settingFields) === null || _a === void 0 ? void 0 : _a.length)
|
501
|
+
? this.getResizeColumns(columns)
|
502
|
+
: columns;
|
503
|
+
this.setColumns(transformColumns);
|
647
504
|
};
|
648
505
|
Table.prototype.render = function () {
|
649
506
|
var _a, _b;
|
650
507
|
var _this = this;
|
651
508
|
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"]);
|
652
509
|
return (React.createElement("div", null,
|
653
|
-
React.createElement(antd_1.Table, __assign({ scroll: scroll, locale: __assign({ emptyText: this.
|
510
|
+
React.createElement(antd_1.Table, __assign({ scroll: scroll, locale: __assign({ emptyText: (React.createElement(EmptyText_1.default, { locale: this.context.locale, emptyText: emptyText })) }, locale), columns: this.getColumns() }, restProps, { className: classnames_1.default(style_1.SDK_PREFIX + "-table-wrapper", (_a = {}, _a[style_1.SDK_PREFIX + "-table-scrollX"] = lodash_1.get(scroll, 'x'), _a), (_b = {}, _b[style_1.SDK_PREFIX + "-table-scrollY"] = lodash_1.get(scroll, 'y'), _b), className),
|
654
511
|
// 涉及到权限
|
655
512
|
// getCheckboxProps只能放到tableBatchWrapper里,因为selectedRowKeys在那个组件计算
|
656
513
|
rowSelection: batchOptions && this.props.rowSelection
|
@@ -696,7 +553,7 @@ var Table = /** @class */ (function (_super) {
|
|
696
553
|
], Table.prototype, "hiddenColumn", void 0);
|
697
554
|
__decorate([
|
698
555
|
mobx_1.observable.ref,
|
699
|
-
__metadata("design:type",
|
556
|
+
__metadata("design:type", Object)
|
700
557
|
], Table.prototype, "columns", void 0);
|
701
558
|
__decorate([
|
702
559
|
mobx_1.observable.ref,
|
@@ -708,7 +565,7 @@ var Table = /** @class */ (function (_super) {
|
|
708
565
|
], Table.prototype, "settingFields", void 0);
|
709
566
|
__decorate([
|
710
567
|
mobx_1.computed,
|
711
|
-
__metadata("design:type",
|
568
|
+
__metadata("design:type", Array),
|
712
569
|
__metadata("design:paramtypes", [])
|
713
570
|
], Table.prototype, "selectedRowKeys", null);
|
714
571
|
__decorate([
|
@@ -726,11 +583,6 @@ var Table = /** @class */ (function (_super) {
|
|
726
583
|
__metadata("design:type", Object),
|
727
584
|
__metadata("design:paramtypes", [])
|
728
585
|
], Table.prototype, "keysOfCurrentPage", null);
|
729
|
-
__decorate([
|
730
|
-
mobx_1.computed,
|
731
|
-
__metadata("design:type", Object),
|
732
|
-
__metadata("design:paramtypes", [])
|
733
|
-
], Table.prototype, "emptyTextComp", null);
|
734
586
|
__decorate([
|
735
587
|
mobx_1.computed,
|
736
588
|
__metadata("design:type", Object),
|
@@ -752,12 +604,10 @@ var Table = /** @class */ (function (_super) {
|
|
752
604
|
__metadata("design:paramtypes", [])
|
753
605
|
], Table.prototype, "sortable", null);
|
754
606
|
__decorate([
|
755
|
-
|
756
|
-
|
757
|
-
__metadata("design:
|
758
|
-
|
759
|
-
__metadata("design:returntype", void 0)
|
760
|
-
], Table.prototype, "updateSettingConfig", null);
|
607
|
+
mobx_1.computed,
|
608
|
+
__metadata("design:type", Object),
|
609
|
+
__metadata("design:paramtypes", [])
|
610
|
+
], Table.prototype, "showSetting", null);
|
761
611
|
__decorate([
|
762
612
|
bind_1.default,
|
763
613
|
mobx_1.action,
|
@@ -769,7 +619,7 @@ var Table = /** @class */ (function (_super) {
|
|
769
619
|
bind_1.default,
|
770
620
|
mobx_1.action,
|
771
621
|
__metadata("design:type", Function),
|
772
|
-
__metadata("design:paramtypes", [Array, Array]),
|
622
|
+
__metadata("design:paramtypes", [Array, Array, Array]),
|
773
623
|
__metadata("design:returntype", void 0)
|
774
624
|
], Table.prototype, "updateSettingFields", null);
|
775
625
|
__decorate([
|
@@ -778,18 +628,6 @@ var Table = /** @class */ (function (_super) {
|
|
778
628
|
__metadata("design:paramtypes", [Array]),
|
779
629
|
__metadata("design:returntype", void 0)
|
780
630
|
], Table.prototype, "handleHideColumnsChange", null);
|
781
|
-
__decorate([
|
782
|
-
bind_1.default,
|
783
|
-
__metadata("design:type", Function),
|
784
|
-
__metadata("design:paramtypes", []),
|
785
|
-
__metadata("design:returntype", void 0)
|
786
|
-
], Table.prototype, "getSortedColumns", null);
|
787
|
-
__decorate([
|
788
|
-
bind_1.default,
|
789
|
-
__metadata("design:type", Function),
|
790
|
-
__metadata("design:paramtypes", [Array, Boolean]),
|
791
|
-
__metadata("design:returntype", void 0)
|
792
|
-
], Table.prototype, "transfromColumns", null);
|
793
631
|
__decorate([
|
794
632
|
bind_1.default,
|
795
633
|
__metadata("design:type", Function),
|
@@ -802,12 +640,6 @@ var Table = /** @class */ (function (_super) {
|
|
802
640
|
__metadata("design:paramtypes", [Object, Number]),
|
803
641
|
__metadata("design:returntype", void 0)
|
804
642
|
], Table.prototype, "getRowKey", null);
|
805
|
-
__decorate([
|
806
|
-
bind_1.default,
|
807
|
-
__metadata("design:type", Function),
|
808
|
-
__metadata("design:paramtypes", [Array]),
|
809
|
-
__metadata("design:returntype", void 0)
|
810
|
-
], Table.prototype, "getSortCoulmns", null);
|
811
643
|
__decorate([
|
812
644
|
bind_1.default,
|
813
645
|
mobx_1.action,
|
@@ -833,7 +665,7 @@ var Table = /** @class */ (function (_super) {
|
|
833
665
|
bind_1.default,
|
834
666
|
mobx_1.action,
|
835
667
|
__metadata("design:type", Function),
|
836
|
-
__metadata("design:paramtypes", [
|
668
|
+
__metadata("design:paramtypes", [Object]),
|
837
669
|
__metadata("design:returntype", void 0)
|
838
670
|
], Table.prototype, "setColumns", null);
|
839
671
|
__decorate([
|
@@ -850,36 +682,22 @@ var Table = /** @class */ (function (_super) {
|
|
850
682
|
__metadata("design:paramtypes", [Array]),
|
851
683
|
__metadata("design:returntype", void 0)
|
852
684
|
], Table.prototype, "setSettingFields", null);
|
853
|
-
__decorate([
|
854
|
-
bind_1.default,
|
855
|
-
mobx_1.action,
|
856
|
-
__metadata("design:type", Function),
|
857
|
-
__metadata("design:paramtypes", [Array]),
|
858
|
-
__metadata("design:returntype", void 0)
|
859
|
-
], Table.prototype, "setFixedRightKeys", null);
|
860
|
-
__decorate([
|
861
|
-
bind_1.default,
|
862
|
-
mobx_1.action,
|
863
|
-
__metadata("design:type", Function),
|
864
|
-
__metadata("design:paramtypes", [Array]),
|
865
|
-
__metadata("design:returntype", void 0)
|
866
|
-
], Table.prototype, "setFixedLeftKeys", null);
|
867
685
|
__decorate([
|
868
686
|
bind_1.default,
|
869
687
|
__metadata("design:type", Function),
|
870
|
-
__metadata("design:paramtypes", [Array,
|
688
|
+
__metadata("design:paramtypes", [Array, Number]),
|
871
689
|
__metadata("design:returntype", void 0)
|
872
690
|
], Table.prototype, "setCheckboxStatus", null);
|
873
691
|
__decorate([
|
874
692
|
bind_1.default,
|
875
693
|
__metadata("design:type", Function),
|
876
|
-
__metadata("design:paramtypes", [Array, Array]),
|
694
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
877
695
|
__metadata("design:returntype", void 0)
|
878
696
|
], Table.prototype, "handleSelectionChange", null);
|
879
697
|
__decorate([
|
880
698
|
bind_1.default,
|
881
699
|
__metadata("design:type", Function),
|
882
|
-
__metadata("design:paramtypes", [Array, Array]),
|
700
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
883
701
|
__metadata("design:returntype", void 0)
|
884
702
|
], Table.prototype, "onRowSelectionChange", null);
|
885
703
|
__decorate([
|