@qn-pandora/pandora-component 5.0.2 → 5.1.1
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/es/components/AutoComplete/index.js +2 -2
- package/es/components/AutoComplete/style.css +110 -22
- package/es/components/Breadcrumb/style.css +13 -3
- package/es/components/Button/style.css +215 -109
- package/es/components/Card/RowExtra/style.css +6 -0
- package/es/components/Card/style.css +50 -55
- package/es/components/CheckTransformList/style.css +327 -103
- package/es/components/Checkbox/style.css +5 -0
- package/es/components/CheckboxList/style.css +5 -0
- package/es/components/Collapse/style.css +34 -2
- package/es/components/DateTimePicker/Base/style.css +446 -56
- package/es/components/DateTimePicker/DisplayInput/style.css +218 -40
- package/es/components/DateTimePicker/index.js +1 -1
- package/es/components/DateTimePicker/style.css +77 -46
- package/es/components/Descriptions/style.css +77 -46
- 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 +8 -0
- package/es/components/FileResumable/style.css +12 -42
- package/es/components/Input/index.d.ts +1 -1
- package/es/components/Input/style.css +218 -40
- package/es/components/Menu/style.css +16 -7
- package/es/components/Modal/style.css +10 -7
- package/es/components/NameLimiter/index.js +1 -1
- package/es/components/NameLimiter/style.css +83 -55
- package/es/components/OptionList/InlineOptionList/style.css +21 -8
- package/es/components/OptionList/OptionItem/style.css +83 -55
- package/es/components/OptionList/PopoverOptionList/index.js +1 -1
- package/es/components/OptionList/PopoverOptionList/style.css +77 -46
- package/es/components/OptionList/style.css +181 -109
- package/es/components/RadioGroup/style.css +27 -16
- package/es/components/RangeInput/style.css +581 -64
- package/es/components/RemarkName/style.css +83 -55
- package/es/components/Selector/style.css +110 -22
- package/es/components/Spin/style.css +8 -6
- package/es/components/Steps/style.css +43 -5
- package/es/components/Table/ColumnSetting/style.css +2 -5
- package/es/components/Table/ColumnSetting/style.less +2 -3
- package/es/components/Table/index.d.ts +12 -9
- package/es/components/Table/index.js +73 -84
- package/es/components/Table/style.css +99 -61
- package/es/components/Tabs/style.css +117 -68
- 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/TreeSelector/style.css +21 -9
- package/es/index.css +4134 -3054
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.less +16 -15
- package/lib/components/AutoComplete/index.js +2 -2
- package/lib/components/AutoComplete/style.css +110 -22
- package/lib/components/Breadcrumb/style.css +13 -3
- package/lib/components/Button/style.css +215 -109
- package/lib/components/Card/RowExtra/style.css +6 -0
- package/lib/components/Card/style.css +50 -55
- package/lib/components/CheckTransformList/style.css +327 -103
- package/lib/components/Checkbox/style.css +5 -0
- package/lib/components/CheckboxList/style.css +5 -0
- package/lib/components/Collapse/style.css +34 -2
- package/lib/components/DateTimePicker/Base/style.css +446 -56
- package/lib/components/DateTimePicker/DisplayInput/style.css +218 -40
- package/lib/components/DateTimePicker/index.js +1 -1
- package/lib/components/DateTimePicker/style.css +77 -46
- package/lib/components/Descriptions/style.css +77 -46
- 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 +8 -0
- package/lib/components/FileResumable/style.css +12 -42
- package/lib/components/Input/index.d.ts +1 -1
- package/lib/components/Input/style.css +218 -40
- package/lib/components/Menu/style.css +16 -7
- package/lib/components/Modal/style.css +10 -7
- package/lib/components/NameLimiter/index.js +1 -1
- package/lib/components/NameLimiter/style.css +83 -55
- package/lib/components/OptionList/InlineOptionList/style.css +21 -8
- package/lib/components/OptionList/OptionItem/style.css +83 -55
- package/lib/components/OptionList/PopoverOptionList/index.js +1 -1
- package/lib/components/OptionList/PopoverOptionList/style.css +77 -46
- package/lib/components/OptionList/style.css +181 -109
- package/lib/components/RadioGroup/style.css +27 -16
- package/lib/components/RangeInput/style.css +581 -64
- package/lib/components/RemarkName/style.css +83 -55
- package/lib/components/Selector/style.css +110 -22
- package/lib/components/Spin/style.css +8 -6
- package/lib/components/Steps/style.css +43 -5
- package/lib/components/Table/ColumnSetting/style.css +2 -5
- package/lib/components/Table/ColumnSetting/style.less +2 -3
- package/lib/components/Table/index.d.ts +12 -9
- package/lib/components/Table/index.js +73 -84
- package/lib/components/Table/style.css +99 -61
- package/lib/components/Tabs/style.css +117 -68
- 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/TreeSelector/style.css +21 -9
- package/lib/index.css +10899 -9819
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -1
- package/lib/index.less +23 -22
- package/package.json +7 -6
@@ -1,7 +1,6 @@
|
|
1
1
|
.pandora-sdk-table-column-setting-popover {
|
2
2
|
padding: 10px;
|
3
3
|
width: 100%;
|
4
|
-
width: 600px;
|
5
4
|
max-height: 300px;
|
6
5
|
overflow-y: auto;
|
7
6
|
}
|
@@ -29,9 +28,6 @@
|
|
29
28
|
flex-wrap: wrap;
|
30
29
|
}
|
31
30
|
.pandora-sdk-table-column-setting-content > div {
|
32
|
-
-webkit-box-flex: 0;
|
33
|
-
-ms-flex: 0 0 33.33%;
|
34
|
-
flex: 0 0 33.33%;
|
35
31
|
-webkit-box-sizing: border-box;
|
36
32
|
box-sizing: border-box;
|
37
33
|
position: relative;
|
@@ -48,7 +44,8 @@
|
|
48
44
|
cursor: move;
|
49
45
|
}
|
50
46
|
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container .pandora-sdk-table-column-setting-checkbox {
|
51
|
-
width:
|
47
|
+
width: 100%;
|
48
|
+
min-width: 120px;
|
52
49
|
overflow: hidden;
|
53
50
|
}
|
54
51
|
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container .pandora-sdk-table-column-setting-checkbox > span:nth-child(2) {
|
@@ -3,7 +3,6 @@
|
|
3
3
|
.@{sdk-prefix}-table-column-setting-popover {
|
4
4
|
padding: 10px;
|
5
5
|
width: 100%;
|
6
|
-
width: 600px;
|
7
6
|
.@{sdk-prefix}-table-column-setting-header {
|
8
7
|
border-bottom: 1px solid @border-color-base;
|
9
8
|
display: flex;
|
@@ -29,7 +28,6 @@
|
|
29
28
|
}
|
30
29
|
|
31
30
|
.@{sdk-prefix}-table-column-setting-content > div {
|
32
|
-
flex: 0 0 33.33%;
|
33
31
|
box-sizing: border-box;
|
34
32
|
position: relative;
|
35
33
|
overflow: hidden;
|
@@ -41,7 +39,8 @@
|
|
41
39
|
cursor: move;
|
42
40
|
}
|
43
41
|
.@{sdk-prefix}-table-column-setting-checkbox {
|
44
|
-
width:
|
42
|
+
width: 100%;
|
43
|
+
min-width: 120px;
|
45
44
|
overflow: hidden;
|
46
45
|
}
|
47
46
|
.@{sdk-prefix}-table-column-setting-checkbox > span:nth-child(2) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { TableProps, ColumnType, ColumnGroupType } from 'antd/es/table';
|
3
|
-
import { TableRowSelection } from 'antd/es/table/interface';
|
3
|
+
import type { TableRowSelection, RowSelectMethod } from 'antd/es/table/interface';
|
4
4
|
import { IOption } from './ColumnSetting';
|
5
5
|
/**
|
6
6
|
* 表格提供自定义多选, 通过 rowSelection对象的selectedRowKeys和onChange来控制多选的状态
|
@@ -85,8 +85,6 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
85
85
|
columns: IKeyValues[];
|
86
86
|
sortConfig: {
|
87
87
|
sortKeys: string[];
|
88
|
-
fixedRightKeys: string[];
|
89
|
-
fixedLeftKeys: string[];
|
90
88
|
};
|
91
89
|
settingFields: ISaveFieldItem[];
|
92
90
|
UNSAFE_componentWillReceiveProps(nextProps: ITableProps<T>): void;
|
@@ -104,11 +102,14 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
104
102
|
};
|
105
103
|
get resizable(): false | ({
|
106
104
|
x?: string | number | true | undefined;
|
107
|
-
y?: string | number | undefined;
|
105
|
+
y?: string | number | undefined; /**
|
106
|
+
* 禁用当前操作
|
107
|
+
*/
|
108
108
|
} & {
|
109
109
|
scrollToFirstRowOnChange?: boolean | undefined;
|
110
110
|
}) | undefined;
|
111
111
|
get sortable(): boolean;
|
112
|
+
get showSetting(): boolean;
|
112
113
|
updateSettingConfig(columns: Array<IColumnType<T>>): void;
|
113
114
|
initSettingConfig(): void;
|
114
115
|
updateSettingFields(columns: Array<IColumnType<T>>, settingFields: ISaveFieldItem[]): void;
|
@@ -117,18 +118,20 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
117
118
|
transfromColumns(columns: IKeyValues[], needEmptyColumn?: boolean): IKeyValues<any>[];
|
118
119
|
getColumns(): IKeyValues<any>[];
|
119
120
|
getRowKey(row: any, index: number): any;
|
120
|
-
|
121
|
+
sortCoulmns(columns: IKeyValues[]): IKeyValues<any>[];
|
121
122
|
setIndeterminate(indeterminate: boolean): void;
|
122
123
|
setCheckAll(checkAll: boolean): void;
|
123
124
|
setHiddenColumn(hiddenColumn?: string[]): void;
|
124
125
|
setColumns(columns: IKeyValues[]): void;
|
125
126
|
setSortKeys(columns: string[]): void;
|
126
127
|
setSettingFields(columns: ISaveFieldItem[]): void;
|
127
|
-
setFixedRightKeys(columns: string[]): void;
|
128
|
-
setFixedLeftKeys(columns: string[]): void;
|
129
128
|
setCheckboxStatus(selectedRowsOfCurrentPage?: T[], dataSource?: T[]): void;
|
130
|
-
handleSelectionChange(selectedRowKeys: React.Key[], selectedRowsOfCurrentPage: any[]
|
131
|
-
|
129
|
+
handleSelectionChange(selectedRowKeys: React.Key[], selectedRowsOfCurrentPage: any[], info: {
|
130
|
+
type: RowSelectMethod;
|
131
|
+
}): void;
|
132
|
+
onRowSelectionChange(selectedRowKeys: React.Key[], selectedRowsOfCurrentPage: any[], info: {
|
133
|
+
type: RowSelectMethod;
|
134
|
+
}): void;
|
132
135
|
handleCheckAllChange(e: any): void;
|
133
136
|
handleBatchOptionClick(option: IOptionItem): void;
|
134
137
|
getRowClassName(record: any, index: number, indent: number): string;
|
@@ -120,9 +120,7 @@ var Table = /** @class */ (function (_super) {
|
|
120
120
|
_this.hiddenColumn = _this.props.hiddenColumns;
|
121
121
|
_this.columns = [];
|
122
122
|
_this.sortConfig = {
|
123
|
-
sortKeys: []
|
124
|
-
fixedRightKeys: [],
|
125
|
-
fixedLeftKeys: []
|
123
|
+
sortKeys: []
|
126
124
|
};
|
127
125
|
_this.settingFields = [];
|
128
126
|
return _this;
|
@@ -152,7 +150,7 @@ var Table = /** @class */ (function (_super) {
|
|
152
150
|
if (rowSelection && rowSelection.onChange) {
|
153
151
|
rowSelection.onChange(lodash_1.union(selectedRowKeysOfCurrentPage_1, selectedRowKeys_1), selectedRows && rowKey
|
154
152
|
? lodash_1.unionBy(selectedRowsOfCurrentPage, selectedRows, rowKey)
|
155
|
-
: selectedRowsOfCurrentPage);
|
153
|
+
: selectedRowsOfCurrentPage, { type: 'single' });
|
156
154
|
}
|
157
155
|
}
|
158
156
|
if (!lodash_1.isEqual(nextProps.hiddenColumns, this.props.hiddenColumns)) {
|
@@ -239,15 +237,14 @@ var Table = /** @class */ (function (_super) {
|
|
239
237
|
var options = [];
|
240
238
|
var _a = this.props.columns, columns = _a === void 0 ? [] : _a;
|
241
239
|
columns.forEach(function (col) {
|
242
|
-
if (col.key &&
|
243
|
-
col.key.toString().length > 0 &&
|
244
|
-
col.configurable !== false) {
|
240
|
+
if (col.key && col.key.toString().length > 0) {
|
245
241
|
options.push({
|
246
242
|
label: col.colTitle || col.title,
|
247
243
|
value: col.key.toString()
|
248
244
|
});
|
249
245
|
}
|
250
246
|
});
|
247
|
+
// sortKeys 来保证数据的准确性
|
251
248
|
return this.sortConfig.sortKeys
|
252
249
|
.map(function (key) { return options.find(function (option) { return option.value === key; }); })
|
253
250
|
.filter(function (f) { return !!f; });
|
@@ -263,7 +260,8 @@ var Table = /** @class */ (function (_super) {
|
|
263
260
|
var resetKeys = [];
|
264
261
|
columns.forEach(function (col) {
|
265
262
|
if (col.key) {
|
266
|
-
|
263
|
+
// 不可配置,或者列固定的列,(在这里统称不可配置的列)
|
264
|
+
if (col.configurable === false || col.fixed) {
|
267
265
|
unconfigableKeys.push(col.key.toString());
|
268
266
|
}
|
269
267
|
else {
|
@@ -300,6 +298,19 @@ var Table = /** @class */ (function (_super) {
|
|
300
298
|
enumerable: false,
|
301
299
|
configurable: true
|
302
300
|
});
|
301
|
+
Object.defineProperty(Table.prototype, "showSetting", {
|
302
|
+
get: function () {
|
303
|
+
// showColumnSetting 需要同 draggable 配合使用, 如果设置不显示列设置按钮, 则不需要显示,其他时候只有 draggable = sort 或者 draggable === true时才显示,
|
304
|
+
var _a = this.props, showColumnSetting = _a.showColumnSetting, draggable = _a.draggable;
|
305
|
+
if (showColumnSetting === false)
|
306
|
+
return false;
|
307
|
+
if (draggable === ETableSettingType.SORT || draggable === true)
|
308
|
+
return true;
|
309
|
+
return false;
|
310
|
+
},
|
311
|
+
enumerable: false,
|
312
|
+
configurable: true
|
313
|
+
});
|
303
314
|
Table.prototype.updateSettingConfig = function (columns) {
|
304
315
|
this.updateSettingFields(columns, this.settingFields);
|
305
316
|
};
|
@@ -307,10 +318,15 @@ var Table = /** @class */ (function (_super) {
|
|
307
318
|
var saveSettingKey = this.props.saveSettingKey;
|
308
319
|
var settingFields = [];
|
309
320
|
if (saveSettingKey) {
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
321
|
+
try {
|
322
|
+
var settingStr = localStorage.getItem(saveSettingKey);
|
323
|
+
var settingConfig = !!settingStr && JSON.parse(settingStr);
|
324
|
+
if (lodash_1.isArray(settingConfig)) {
|
325
|
+
settingFields = settingConfig;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
catch (error) {
|
329
|
+
throw new Error("parse " + saveSettingKey + " error: " + error + ", please check the data format");
|
314
330
|
}
|
315
331
|
}
|
316
332
|
this.updateSettingFields(this.props.columns, settingFields);
|
@@ -318,12 +334,9 @@ var Table = /** @class */ (function (_super) {
|
|
318
334
|
Table.prototype.updateSettingFields = function (columns, settingFields) {
|
319
335
|
var _a = this.props.hiddenColumns, hiddenColumns = _a === void 0 ? [] : _a;
|
320
336
|
var sortableColumns = [];
|
321
|
-
var leftColumns = [];
|
322
|
-
var rightColumns = [];
|
323
337
|
var hideKeys = [];
|
324
338
|
// 已配置的列和实际的对不上
|
325
339
|
// 可能新增或者删除列的情况
|
326
|
-
var newSettingFields = [];
|
327
340
|
// 已配置列
|
328
341
|
// 旧类型数据为对象类型,未配置
|
329
342
|
settingFields.map(function (field) {
|
@@ -332,14 +345,8 @@ var Table = /** @class */ (function (_super) {
|
|
332
345
|
if (field.hide) {
|
333
346
|
hideKeys.push(field.field);
|
334
347
|
}
|
335
|
-
if (!find.fixed) {
|
336
|
-
sortableColumns.push(field);
|
337
|
-
}
|
338
|
-
else if (find.fixed === 'left' || find.fixed === true) {
|
339
|
-
leftColumns.push(field);
|
340
|
-
}
|
341
348
|
else {
|
342
|
-
|
349
|
+
sortableColumns.push(field);
|
343
350
|
}
|
344
351
|
}
|
345
352
|
});
|
@@ -348,32 +355,18 @@ var Table = /** @class */ (function (_super) {
|
|
348
355
|
.filter(function (f) { return !settingFields.find(function (field) { return field.field === f.dataIndex; }); })
|
349
356
|
.map(function (column) {
|
350
357
|
if (column.dataIndex) {
|
351
|
-
|
358
|
+
// 不是列固定,并且可配置,才可以展示拖拽
|
359
|
+
if (!(column.fixed || column.configurable === false)) {
|
352
360
|
sortableColumns.push({
|
353
361
|
field: column.dataIndex.toString(),
|
354
362
|
fixed: column.fixed
|
355
363
|
});
|
356
364
|
}
|
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
365
|
}
|
370
366
|
});
|
371
|
-
this.setFixedLeftKeys(leftColumns.map(function (t) { return t.field; }));
|
372
|
-
this.setFixedRightKeys(rightColumns.map(function (t) { return t.field; }));
|
373
367
|
this.setSortKeys(sortableColumns.map(function (t) { return t.field; }));
|
374
368
|
this.setHiddenColumn(__spread(new Set(__spread(hiddenColumns, hideKeys))));
|
375
|
-
|
376
|
-
this.setSettingFields(newSettingFields);
|
369
|
+
this.setSettingFields(sortableColumns);
|
377
370
|
};
|
378
371
|
// 隐藏key
|
379
372
|
Table.prototype.handleHideColumnsChange = function (keys) {
|
@@ -394,21 +387,28 @@ var Table = /** @class */ (function (_super) {
|
|
394
387
|
(_b = (_a = this.props).onHiddenColumnsChange) === null || _b === void 0 ? void 0 : _b.call(_a, keys);
|
395
388
|
};
|
396
389
|
Table.prototype.getSortedColumns = function () {
|
397
|
-
var _this = this;
|
398
390
|
var hiddenColumn = this.hiddenColumn || [];
|
399
|
-
var
|
400
|
-
|
401
|
-
|
391
|
+
var fixedRightColumn = [];
|
392
|
+
var fixedLeftColumn = [];
|
393
|
+
var selectedCols = [];
|
394
|
+
var unconfigurableCols = [];
|
395
|
+
var source = this.columns || [];
|
396
|
+
source.forEach(function (column) {
|
397
|
+
if (column.fixed === 'left' || column.fixed === true) {
|
398
|
+
fixedLeftColumn.push(column);
|
399
|
+
}
|
400
|
+
else if (column.fixed === 'right') {
|
401
|
+
fixedRightColumn.push(column);
|
402
|
+
}
|
403
|
+
else if (column.configurable === false) {
|
404
|
+
unconfigurableCols.push(column);
|
405
|
+
}
|
406
|
+
else if (!lodash_1.includes(hiddenColumn, column.key)) {
|
407
|
+
selectedCols.push(column);
|
402
408
|
}
|
403
|
-
return false;
|
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
409
|
});
|
411
|
-
|
410
|
+
// 顺序应该是: 左固定列、不可配置列、排序列、右固定列
|
411
|
+
return __spread(fixedLeftColumn, unconfigurableCols, (this.sortable ? this.sortCoulmns(selectedCols) : selectedCols), fixedRightColumn);
|
412
412
|
};
|
413
413
|
// 如果支持拖拽,在屏幕宽度大于table总的列宽的时候,添加一个空白列,宽度auto.
|
414
414
|
// 空白列添加到右固定列的前面
|
@@ -431,12 +431,14 @@ var Table = /** @class */ (function (_super) {
|
|
431
431
|
return cols;
|
432
432
|
};
|
433
433
|
Table.prototype.getColumns = function () {
|
434
|
-
var _a = this.props,
|
435
|
-
|
434
|
+
var _a = this.props, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
|
435
|
+
// 如果不显示列设置按钮,直接返回columns
|
436
|
+
if (!this.showSetting) {
|
436
437
|
return this.transfromColumns(this.columns, needEmptyColumn);
|
437
438
|
}
|
438
439
|
// 获取到列设置的options
|
439
440
|
var columnsSettingOptions = this.columnsSettingOptions;
|
441
|
+
// 列排序或者列隐藏
|
440
442
|
var allCols = this.getSortedColumns();
|
441
443
|
this.transfromColumns(allCols, needEmptyColumn);
|
442
444
|
var length = allCols.length;
|
@@ -461,7 +463,7 @@ var Table = /** @class */ (function (_super) {
|
|
461
463
|
}
|
462
464
|
return rowKey ? row[rowKey] : index;
|
463
465
|
};
|
464
|
-
Table.prototype.
|
466
|
+
Table.prototype.sortCoulmns = function (columns) {
|
465
467
|
return this.sortConfig.sortKeys
|
466
468
|
.map(function (key) { return columns.find(function (column) { return column.dataIndex === key; }); })
|
467
469
|
.filter(function (f) { return !!f; });
|
@@ -495,12 +497,6 @@ var Table = /** @class */ (function (_super) {
|
|
495
497
|
Table.prototype.setSettingFields = function (columns) {
|
496
498
|
this.settingFields = columns;
|
497
499
|
};
|
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
500
|
// 设置全选checkout的状态
|
505
501
|
Table.prototype.setCheckboxStatus = function (selectedRowsOfCurrentPage, dataSource) {
|
506
502
|
if (selectedRowsOfCurrentPage === void 0) { selectedRowsOfCurrentPage = []; }
|
@@ -510,24 +506,24 @@ var Table = /** @class */ (function (_super) {
|
|
510
506
|
this.setCheckAll(!!selectedRowsOfCurrentPage.length &&
|
511
507
|
selectedRowsOfCurrentPage.length === lodash_1.size(dataSource));
|
512
508
|
};
|
513
|
-
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
509
|
+
Table.prototype.handleSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
514
510
|
var dataSource = this.props.dataSource;
|
515
511
|
// 更新CheckBox状态
|
516
512
|
this.setCheckboxStatus(selectedRowsOfCurrentPage, dataSource);
|
517
513
|
// 更新外部组件rowSelection状态
|
518
|
-
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
514
|
+
this.onRowSelectionChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
519
515
|
};
|
520
|
-
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage) {
|
516
|
+
Table.prototype.onRowSelectionChange = function (selectedRowKeys, selectedRowsOfCurrentPage, info) {
|
521
517
|
var _a = this.props, rowSelection = _a.rowSelection, selectedRows = _a.selectedRows, rowKey = _a.rowKey, dataSource = _a.dataSource;
|
522
518
|
if (rowSelection && rowSelection.onChange) {
|
523
519
|
if (selectedRows && rowKey) {
|
524
520
|
var a = lodash_1.differenceBy(dataSource, selectedRowsOfCurrentPage, rowKey);
|
525
521
|
var b = lodash_1.differenceBy(selectedRows, a, rowKey);
|
526
522
|
var rows = lodash_1.unionBy(b, selectedRowsOfCurrentPage, rowKey);
|
527
|
-
rowSelection.onChange(selectedRowKeys, rows);
|
523
|
+
rowSelection.onChange(selectedRowKeys, rows, info);
|
528
524
|
}
|
529
525
|
else {
|
530
|
-
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage);
|
526
|
+
rowSelection.onChange(selectedRowKeys, selectedRowsOfCurrentPage, info);
|
531
527
|
}
|
532
528
|
}
|
533
529
|
};
|
@@ -540,7 +536,9 @@ var Table = /** @class */ (function (_super) {
|
|
540
536
|
: lodash_1.xor(selectedRowKeys, this.keysOfCurrentPage);
|
541
537
|
this.setCheckAll(e.target.checked);
|
542
538
|
this.setIndeterminate(false);
|
543
|
-
this.onRowSelectionChange(selectedRowKeys, currentRows
|
539
|
+
this.onRowSelectionChange(selectedRowKeys, currentRows, {
|
540
|
+
type: selectedRowKeys.length > 0 ? 'all' : 'none'
|
541
|
+
});
|
544
542
|
};
|
545
543
|
Table.prototype.handleBatchOptionClick = function (option) {
|
546
544
|
if (option.onClick) {
|
@@ -638,7 +636,7 @@ var Table = /** @class */ (function (_super) {
|
|
638
636
|
};
|
639
637
|
Table.prototype.componentDidMount = function () {
|
640
638
|
var _a;
|
641
|
-
if (this.
|
639
|
+
if (this.showSetting) {
|
642
640
|
this.initSettingConfig();
|
643
641
|
}
|
644
642
|
this.setColumns(this.resizable && ((_a = this.settingFields) === null || _a === void 0 ? void 0 : _a.length)
|
@@ -751,6 +749,11 @@ var Table = /** @class */ (function (_super) {
|
|
751
749
|
__metadata("design:type", Object),
|
752
750
|
__metadata("design:paramtypes", [])
|
753
751
|
], Table.prototype, "sortable", null);
|
752
|
+
__decorate([
|
753
|
+
mobx_1.computed,
|
754
|
+
__metadata("design:type", Object),
|
755
|
+
__metadata("design:paramtypes", [])
|
756
|
+
], Table.prototype, "showSetting", null);
|
754
757
|
__decorate([
|
755
758
|
bind_1.default,
|
756
759
|
mobx_1.action,
|
@@ -807,7 +810,7 @@ var Table = /** @class */ (function (_super) {
|
|
807
810
|
__metadata("design:type", Function),
|
808
811
|
__metadata("design:paramtypes", [Array]),
|
809
812
|
__metadata("design:returntype", void 0)
|
810
|
-
], Table.prototype, "
|
813
|
+
], Table.prototype, "sortCoulmns", null);
|
811
814
|
__decorate([
|
812
815
|
bind_1.default,
|
813
816
|
mobx_1.action,
|
@@ -850,20 +853,6 @@ var Table = /** @class */ (function (_super) {
|
|
850
853
|
__metadata("design:paramtypes", [Array]),
|
851
854
|
__metadata("design:returntype", void 0)
|
852
855
|
], 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
856
|
__decorate([
|
868
857
|
bind_1.default,
|
869
858
|
__metadata("design:type", Function),
|
@@ -873,13 +862,13 @@ var Table = /** @class */ (function (_super) {
|
|
873
862
|
__decorate([
|
874
863
|
bind_1.default,
|
875
864
|
__metadata("design:type", Function),
|
876
|
-
__metadata("design:paramtypes", [Array, Array]),
|
865
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
877
866
|
__metadata("design:returntype", void 0)
|
878
867
|
], Table.prototype, "handleSelectionChange", null);
|
879
868
|
__decorate([
|
880
869
|
bind_1.default,
|
881
870
|
__metadata("design:type", Function),
|
882
|
-
__metadata("design:paramtypes", [Array, Array]),
|
871
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
883
872
|
__metadata("design:returntype", void 0)
|
884
873
|
], Table.prototype, "onRowSelectionChange", null);
|
885
874
|
__decorate([
|