@qn-pandora/pandora-component 4.4.4 → 4.4.5
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/CHANGELOG.json +17 -0
- package/CHANGELOG.md +8 -1
- package/es/components/Table/index.d.ts +9 -1
- package/es/components/Table/index.js +109 -106
- package/es/index.css +3324 -3324
- package/es/index.less +17 -17
- package/lib/components/Table/index.d.ts +9 -1
- package/lib/components/Table/index.js +109 -106
- package/lib/index.css +7266 -7266
- package/lib/index.less +17 -17
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qn-pandora/pandora-component",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "4.4.5",
|
|
6
|
+
"tag": "@qn-pandora/pandora-component_v4.4.5",
|
|
7
|
+
"date": "Thu, 29 Feb 2024 08:29:44 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "2024-02-29发包"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@qn-pandora/app-sdk\" from `^3.4.4` to `^3.4.5`"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
4
21
|
{
|
|
5
22
|
"version": "4.4.4",
|
|
6
23
|
"tag": "@qn-pandora/pandora-component_v4.4.4",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @qn-pandora/pandora-component
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 29 Feb 2024 08:29:44 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.4.5
|
|
6
|
+
Thu, 29 Feb 2024 08:29:44 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- 2024-02-29发包
|
|
4
11
|
|
|
5
12
|
## 4.4.4
|
|
6
13
|
Tue, 27 Feb 2024 12:57:54 GMT
|
|
@@ -84,6 +84,7 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
|
84
84
|
};
|
|
85
85
|
settingFields: ISaveFieldItem[];
|
|
86
86
|
UNSAFE_componentWillReceiveProps(nextProps: ITableProps<T>): void;
|
|
87
|
+
componentWillUnmount(): void;
|
|
87
88
|
get selectedRowKeys(): React.ReactText[];
|
|
88
89
|
get rowSelection(): TableRowSelection<T> | undefined;
|
|
89
90
|
get undisabledData(): readonly T[];
|
|
@@ -95,9 +96,16 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
|
95
96
|
unconfigableKeys: string[];
|
|
96
97
|
resetKeys: string[];
|
|
97
98
|
};
|
|
98
|
-
get resizable():
|
|
99
|
+
get resizable(): false | ({
|
|
100
|
+
x?: string | number | true | undefined;
|
|
101
|
+
y?: string | number | undefined;
|
|
102
|
+
} & {
|
|
103
|
+
scrollToFirstRowOnChange?: boolean | undefined;
|
|
104
|
+
}) | undefined;
|
|
99
105
|
get sortable(): boolean;
|
|
106
|
+
updateSettingConfig(columns: Array<IColumnType<T>>): void;
|
|
100
107
|
initSettingConfig(): void;
|
|
108
|
+
updateSettingFields(columns: Array<IColumnType<T>>, settingFields: ISaveFieldItem[]): void;
|
|
101
109
|
handleHideColumnsChange(keys: string[]): Promise<void> | undefined;
|
|
102
110
|
getSortedColumns(): (IKeyValues<any> | undefined)[];
|
|
103
111
|
getColumns(): (IKeyValues<any> | undefined)[];
|
|
@@ -134,10 +134,19 @@ var Table = /** @class */ (function (_super) {
|
|
|
134
134
|
this.setHiddenColumn(nextProps.hiddenColumns);
|
|
135
135
|
}
|
|
136
136
|
if (nextProps.columns !== this.props.columns) {
|
|
137
|
-
|
|
138
|
-
nextProps.draggable === ETableSettingType.RESIZE
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
if ((nextProps.scroll && nextProps.draggable === true) ||
|
|
138
|
+
nextProps.draggable === ETableSettingType.RESIZE) {
|
|
139
|
+
this.updateSettingConfig(nextProps.columns);
|
|
140
|
+
this.setColumns(this.getResizeColumns(nextProps.columns));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.setColumns(nextProps.columns || []);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
Table.prototype.componentWillUnmount = function () {
|
|
148
|
+
if (this.props.saveSettingKey) {
|
|
149
|
+
localStorage.setItem(this.props.saveSettingKey, JSON.stringify(this.settingFields));
|
|
141
150
|
}
|
|
142
151
|
};
|
|
143
152
|
Object.defineProperty(Table.prototype, "selectedRowKeys", {
|
|
@@ -250,8 +259,9 @@ var Table = /** @class */ (function (_super) {
|
|
|
250
259
|
Object.defineProperty(Table.prototype, "resizable", {
|
|
251
260
|
get: function () {
|
|
252
261
|
var _a, _b;
|
|
253
|
-
return (((_a = this.props) === null || _a === void 0 ? void 0 : _a.draggable) === true ||
|
|
254
|
-
((_b = this.props) === null || _b === void 0 ? void 0 : _b.draggable) === ETableSettingType.RESIZE)
|
|
262
|
+
return ((((_a = this.props) === null || _a === void 0 ? void 0 : _a.draggable) === true ||
|
|
263
|
+
((_b = this.props) === null || _b === void 0 ? void 0 : _b.draggable) === ETableSettingType.RESIZE) &&
|
|
264
|
+
this.props.scroll);
|
|
255
265
|
},
|
|
256
266
|
enumerable: true,
|
|
257
267
|
configurable: true
|
|
@@ -265,95 +275,80 @@ var Table = /** @class */ (function (_super) {
|
|
|
265
275
|
enumerable: true,
|
|
266
276
|
configurable: true
|
|
267
277
|
});
|
|
278
|
+
Table.prototype.updateSettingConfig = function (columns) {
|
|
279
|
+
this.updateSettingFields(columns, this.settingFields);
|
|
280
|
+
};
|
|
268
281
|
Table.prototype.initSettingConfig = function () {
|
|
269
|
-
var
|
|
270
|
-
var _a = this.props, saveSettingKey = _a.saveSettingKey, _b = _a.hiddenColumns, hiddenColumns = _b === void 0 ? [] : _b;
|
|
282
|
+
var saveSettingKey = this.props.saveSettingKey;
|
|
271
283
|
var settingFields = [];
|
|
284
|
+
if (saveSettingKey) {
|
|
285
|
+
var settingStr = localStorage.getItem(saveSettingKey);
|
|
286
|
+
var settingConfig = !!settingStr && JSON.parse(settingStr);
|
|
287
|
+
if (isArray(settingConfig)) {
|
|
288
|
+
settingFields = settingConfig;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
this.updateSettingFields(this.props.columns, settingFields);
|
|
292
|
+
};
|
|
293
|
+
Table.prototype.updateSettingFields = function (columns, settingFields) {
|
|
294
|
+
var _a = this.props.hiddenColumns, hiddenColumns = _a === void 0 ? [] : _a;
|
|
272
295
|
var sortableColumns = [];
|
|
273
296
|
var leftColumns = [];
|
|
274
297
|
var rightColumns = [];
|
|
275
298
|
var hideKeys = [];
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
leftColumns.push(field);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
rightColumns.push(field);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
// 未配置过的列
|
|
304
|
-
this.columns
|
|
305
|
-
.filter(function (f) { return !settingFields.find(function (field) { return field.field === f.dataIndex; }); })
|
|
306
|
-
.map(function (column) {
|
|
307
|
-
if (!column.fixed) {
|
|
308
|
-
sortableColumns.push({
|
|
309
|
-
field: column.dataIndex,
|
|
310
|
-
fixed: column.fixed
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
else if (column.fixed === 'left' || column.fixed === true) {
|
|
314
|
-
leftColumns.push({
|
|
315
|
-
field: column.dataIndex,
|
|
316
|
-
fixed: column.fixed
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
rightColumns.push({
|
|
321
|
-
field: column.dataIndex,
|
|
322
|
-
fixed: column.fixed
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
});
|
|
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
|
+
}
|
|
326
319
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
+
}
|
|
349
344
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
345
|
+
});
|
|
346
|
+
this.setFixedLeftKeys(leftColumns.map(function (t) { return t.field; }));
|
|
347
|
+
this.setFixedRightKeys(rightColumns.map(function (t) { return t.field; }));
|
|
348
|
+
this.setSortKeys(sortableColumns.map(function (t) { return t.field; }));
|
|
349
|
+
this.setHiddenColumn(__spread(new Set(__spread(hiddenColumns, hideKeys))));
|
|
350
|
+
newSettingFields = __spread(leftColumns, sortableColumns, rightColumns);
|
|
351
|
+
this.setSettingFields(newSettingFields);
|
|
357
352
|
};
|
|
358
353
|
// 隐藏key
|
|
359
354
|
Table.prototype.handleHideColumnsChange = function (keys) {
|
|
@@ -452,9 +447,6 @@ var Table = /** @class */ (function (_super) {
|
|
|
452
447
|
this.sortConfig = __assign(__assign({}, this.sortConfig), { sortKeys: columns });
|
|
453
448
|
};
|
|
454
449
|
Table.prototype.setSettingFields = function (columns) {
|
|
455
|
-
if (this.props.saveSettingKey) {
|
|
456
|
-
localStorage.setItem(this.props.saveSettingKey, JSON.stringify(columns));
|
|
457
|
-
}
|
|
458
450
|
this.settingFields = columns;
|
|
459
451
|
};
|
|
460
452
|
Table.prototype.setFixedRightKeys = function (columns) {
|
|
@@ -560,18 +552,14 @@ var Table = /** @class */ (function (_super) {
|
|
|
560
552
|
};
|
|
561
553
|
Table.prototype.getResizeColumns = function (columns) {
|
|
562
554
|
var _this = this;
|
|
563
|
-
var fields;
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
var width = (_a = fields.find(function (f) { return f.field === dataIndex; })) === null || _a === void 0 ? void 0 : _a.width;
|
|
572
|
-
return isNumber(width) ? __assign(__assign({}, col), { width: width }) : col;
|
|
573
|
-
});
|
|
574
|
-
}
|
|
555
|
+
var fields = this.settingFields;
|
|
556
|
+
if ((fields === null || fields === void 0 ? void 0 : fields.length) && isArray(fields)) {
|
|
557
|
+
columns = columns === null || columns === void 0 ? void 0 : columns.map(function (col) {
|
|
558
|
+
var _a;
|
|
559
|
+
var dataIndex = get(col, 'dataIndex');
|
|
560
|
+
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;
|
|
561
|
+
return isNumber(width) ? __assign(__assign({}, col), { width: width }) : col;
|
|
562
|
+
});
|
|
575
563
|
}
|
|
576
564
|
var transformColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (it) {
|
|
577
565
|
if (get(it, 'resizable') && _this.resizable) {
|
|
@@ -591,12 +579,13 @@ var Table = /** @class */ (function (_super) {
|
|
|
591
579
|
return transformColumns;
|
|
592
580
|
};
|
|
593
581
|
Table.prototype.componentDidMount = function () {
|
|
594
|
-
|
|
595
|
-
? this.getResizeColumns(this.props.columns)
|
|
596
|
-
: this.props.columns);
|
|
582
|
+
var _a;
|
|
597
583
|
if (this.sortable || this.resizable) {
|
|
598
584
|
this.initSettingConfig();
|
|
599
585
|
}
|
|
586
|
+
this.setColumns(this.resizable && ((_a = this.settingFields) === null || _a === void 0 ? void 0 : _a.length)
|
|
587
|
+
? this.getResizeColumns(this.props.columns)
|
|
588
|
+
: this.props.columns);
|
|
600
589
|
};
|
|
601
590
|
Table.prototype.render = function () {
|
|
602
591
|
var _a, _b;
|
|
@@ -608,7 +597,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
608
597
|
// getCheckboxProps只能放到tableBatchWrapper里,因为selectedRowKeys在那个组件计算
|
|
609
598
|
rowSelection: batchOptions && this.props.rowSelection
|
|
610
599
|
? this.rowSelection
|
|
611
|
-
: this.props.rowSelection, rowClassName: this.getRowClassName, components: __assign(__assign({}, (components || {})), (this.resizable
|
|
600
|
+
: this.props.rowSelection, rowClassName: this.getRowClassName, components: __assign(__assign({}, (components || {})), (this.resizable
|
|
612
601
|
? {
|
|
613
602
|
header: {
|
|
614
603
|
cell: ResizableTitle
|
|
@@ -704,6 +693,13 @@ var Table = /** @class */ (function (_super) {
|
|
|
704
693
|
__metadata("design:type", Object),
|
|
705
694
|
__metadata("design:paramtypes", [])
|
|
706
695
|
], Table.prototype, "sortable", null);
|
|
696
|
+
__decorate([
|
|
697
|
+
bind,
|
|
698
|
+
action,
|
|
699
|
+
__metadata("design:type", Function),
|
|
700
|
+
__metadata("design:paramtypes", [Array]),
|
|
701
|
+
__metadata("design:returntype", void 0)
|
|
702
|
+
], Table.prototype, "updateSettingConfig", null);
|
|
707
703
|
__decorate([
|
|
708
704
|
bind,
|
|
709
705
|
action,
|
|
@@ -711,6 +707,13 @@ var Table = /** @class */ (function (_super) {
|
|
|
711
707
|
__metadata("design:paramtypes", []),
|
|
712
708
|
__metadata("design:returntype", void 0)
|
|
713
709
|
], Table.prototype, "initSettingConfig", null);
|
|
710
|
+
__decorate([
|
|
711
|
+
bind,
|
|
712
|
+
action,
|
|
713
|
+
__metadata("design:type", Function),
|
|
714
|
+
__metadata("design:paramtypes", [Array, Array]),
|
|
715
|
+
__metadata("design:returntype", void 0)
|
|
716
|
+
], Table.prototype, "updateSettingFields", null);
|
|
714
717
|
__decorate([
|
|
715
718
|
bind,
|
|
716
719
|
__metadata("design:type", Function),
|