@qn-pandora/pandora-component 4.4.3 → 4.4.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +34 -0
- package/CHANGELOG.md +15 -1
- package/es/components/FileResumable/index.js +53 -62
- package/es/components/FileResumable/utils.d.ts +2 -0
- package/es/components/FileResumable/utils.js +17 -0
- package/es/components/Table/ColumnSetting/index.d.ts +1 -0
- package/es/components/Table/ColumnSetting/index.js +16 -8
- package/es/components/Table/ColumnSetting/style.css +10 -1
- package/es/components/Table/ColumnSetting/style.less +6 -1
- package/es/components/Table/constant.d.ts +3 -1
- package/es/components/Table/constant.js +2 -0
- package/es/components/Table/index.d.ts +38 -4
- package/es/components/Table/index.js +290 -37
- package/es/components/Table/style.css +1 -0
- package/es/components/Table/style.less +1 -0
- package/es/index.css +7338 -7328
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.less +16 -16
- package/lib/components/FileResumable/index.js +52 -61
- package/lib/components/FileResumable/utils.d.ts +2 -0
- package/lib/components/FileResumable/utils.js +21 -0
- package/lib/components/Table/ColumnSetting/index.d.ts +1 -0
- package/lib/components/Table/ColumnSetting/index.js +15 -7
- package/lib/components/Table/ColumnSetting/style.css +10 -1
- package/lib/components/Table/ColumnSetting/style.less +6 -1
- package/lib/components/Table/constant.d.ts +3 -1
- package/lib/components/Table/constant.js +2 -0
- package/lib/components/Table/index.d.ts +38 -4
- package/lib/components/Table/index.js +289 -36
- package/lib/components/Table/style.css +1 -0
- package/lib/components/Table/style.less +1 -0
- package/lib/index.css +8990 -8980
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -0
- package/lib/index.less +17 -17
- package/package.json +4 -3
package/CHANGELOG.json
CHANGED
@@ -1,6 +1,40 @@
|
|
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
|
+
},
|
21
|
+
{
|
22
|
+
"version": "4.4.4",
|
23
|
+
"tag": "@qn-pandora/pandora-component_v4.4.4",
|
24
|
+
"date": "Tue, 27 Feb 2024 12:57:54 GMT",
|
25
|
+
"comments": {
|
26
|
+
"patch": [
|
27
|
+
{
|
28
|
+
"comment": "2024-02-27发包"
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"dependency": [
|
32
|
+
{
|
33
|
+
"comment": "Updating dependency \"@qn-pandora/app-sdk\" from `^3.4.3` to `^3.4.4`"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
37
|
+
},
|
4
38
|
{
|
5
39
|
"version": "4.4.3",
|
6
40
|
"tag": "@qn-pandora/pandora-component_v4.4.3",
|
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
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发包
|
11
|
+
|
12
|
+
## 4.4.4
|
13
|
+
Tue, 27 Feb 2024 12:57:54 GMT
|
14
|
+
|
15
|
+
### Patches
|
16
|
+
|
17
|
+
- 2024-02-27发包
|
4
18
|
|
5
19
|
## 4.4.3
|
6
20
|
Fri, 23 Feb 2024 06:02:50 GMT
|
@@ -75,7 +75,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
75
75
|
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
76
76
|
import Resumablejs from 'resumablejs';
|
77
77
|
import uuid from 'uuid';
|
78
|
-
import md5 from 'crypto-js/md5';
|
79
78
|
import { Progress, Tooltip, Upload } from 'antd';
|
80
79
|
import { ConfigContext } from 'antd/es/config-provider';
|
81
80
|
import classnames from 'classnames';
|
@@ -85,7 +84,7 @@ import { appEnv, fileIsExit } from '@qn-pandora/app-sdk';
|
|
85
84
|
import { formatString } from '../../utils/language';
|
86
85
|
import { UploadLocale } from '../../constants/language/upload/type';
|
87
86
|
import { SDK_PREFIX } from '../../constants/style';
|
88
|
-
import { isJpgOrPngOrSvg } from './utils';
|
87
|
+
import { calculateFileMd5, isJpgOrPngOrSvg } from './utils';
|
89
88
|
var Dragger = Upload.Dragger;
|
90
89
|
export default function FileResumable(props) {
|
91
90
|
var _a, _b;
|
@@ -261,67 +260,59 @@ export default function FileResumable(props) {
|
|
261
260
|
onError
|
262
261
|
]);
|
263
262
|
var handleStart = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
264
|
-
var params,
|
265
|
-
var
|
266
|
-
return __generator(this, function (
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
}
|
317
|
-
_d.label = 5;
|
318
|
-
case 5: return [2 /*return*/];
|
319
|
-
}
|
320
|
-
});
|
321
|
-
}); };
|
263
|
+
var params, realFile, extension, md5Str, id, fileId, error_1;
|
264
|
+
var _a, _b, _c;
|
265
|
+
return __generator(this, function (_d) {
|
266
|
+
switch (_d.label) {
|
267
|
+
case 0:
|
268
|
+
params = __assign(__assign({}, query), { persistence: persistence });
|
269
|
+
if (!(fileList.length === 1)) return [3 /*break*/, 6];
|
270
|
+
realFile = fileList[0];
|
271
|
+
extension = realFile.name.split('.').pop().toLowerCase();
|
272
|
+
return [4 /*yield*/, calculateFileMd5(realFile.size > 50 * 1024 * 1024
|
273
|
+
? realFile.slice(0, 2 * 1024 * 1024)
|
274
|
+
: realFile)];
|
275
|
+
case 1:
|
276
|
+
md5Str = _d.sent();
|
277
|
+
id = '';
|
278
|
+
_d.label = 2;
|
279
|
+
case 2:
|
280
|
+
_d.trys.push([2, 4, , 5]);
|
281
|
+
return [4 /*yield*/, fileIsExit({
|
282
|
+
resumableModifyTime: realFile.lastModified,
|
283
|
+
resumableFilename: realFile.name,
|
284
|
+
resumableType: realFile.type || "application/" + extension,
|
285
|
+
resumableFileMd5: md5Str,
|
286
|
+
resumableTotalSize: realFile.size
|
287
|
+
})];
|
288
|
+
case 3:
|
289
|
+
fileId = (_d.sent()).fileId;
|
290
|
+
id = fileId;
|
291
|
+
return [3 /*break*/, 5];
|
292
|
+
case 4:
|
293
|
+
error_1 = _d.sent();
|
294
|
+
handleError(get(error_1, 'message'));
|
295
|
+
return [3 /*break*/, 5];
|
296
|
+
case 5:
|
297
|
+
if (!id) {
|
298
|
+
params.resumableFileMd5 = md5Str;
|
299
|
+
params.resumableModifyTime = realFile.lastModified;
|
300
|
+
params.resumableIdentifier = uuid();
|
301
|
+
params.resumableType = realFile.type || "application/" + extension;
|
302
|
+
(_a = resumable.current) === null || _a === void 0 ? void 0 : _a.updateQuery(params);
|
303
|
+
(_b = resumable.current) === null || _b === void 0 ? void 0 : _b.upload();
|
304
|
+
}
|
305
|
+
else {
|
306
|
+
handleFileSuccess(JSON.stringify({
|
307
|
+
fileId: id
|
308
|
+
}));
|
309
|
+
(_c = resumable.current) === null || _c === void 0 ? void 0 : _c.cancel();
|
310
|
+
}
|
311
|
+
_d.label = 6;
|
312
|
+
case 6:
|
313
|
+
setShowTool(true);
|
314
|
+
return [2 /*return*/];
|
322
315
|
}
|
323
|
-
setShowTool(true);
|
324
|
-
return [2 /*return*/];
|
325
316
|
});
|
326
317
|
}); }, [
|
327
318
|
query,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { includes } from 'lodash';
|
2
|
+
import CryptoJS from 'crypto-js';
|
2
3
|
var MIME_IMAGE_TYPE = [
|
3
4
|
'image/png',
|
4
5
|
'image/jpeg',
|
@@ -15,3 +16,19 @@ export var isJpgOrPngOrSvg = function (type, hexValue) {
|
|
15
16
|
includes(hexValue.toLowerCase(), '3c3f786d') || // svg
|
16
17
|
includes(hexValue.toLowerCase(), '89504e47')));
|
17
18
|
};
|
19
|
+
// 读取文件并计算 MD5
|
20
|
+
export function calculateFileMd5(file) {
|
21
|
+
return new Promise(function (resolve) {
|
22
|
+
var reader = new FileReader();
|
23
|
+
reader.onload = function (event) {
|
24
|
+
var _a;
|
25
|
+
var arrayBuffer = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
|
26
|
+
if (!arrayBuffer)
|
27
|
+
return;
|
28
|
+
var wordArray = CryptoJS.lib.WordArray.create(arrayBuffer);
|
29
|
+
var md5 = CryptoJS.MD5(wordArray).toString();
|
30
|
+
resolve(md5);
|
31
|
+
};
|
32
|
+
reader.readAsArrayBuffer(file);
|
33
|
+
});
|
34
|
+
}
|
@@ -21,8 +21,9 @@ var __spread = (this && this.__spread) || function () {
|
|
21
21
|
import React, { useMemo, useCallback, useState, useContext } from 'react';
|
22
22
|
import classnames from 'classnames';
|
23
23
|
import { includes } from 'lodash';
|
24
|
+
import ReactSortable from 'react-sortablejs';
|
24
25
|
import { Popover, Checkbox, Spin } from 'antd';
|
25
|
-
import { SettingOutlined } from '@ant-design/icons';
|
26
|
+
import { HolderOutlined, SettingOutlined } from '@ant-design/icons';
|
26
27
|
import { ConfigContext } from 'antd/es/config-provider';
|
27
28
|
import { formatString } from '../../../utils/language';
|
28
29
|
import { TableLocale } from '../../../constants/language/table/type';
|
@@ -31,7 +32,7 @@ import NameLimiter from '../../NameLimiter';
|
|
31
32
|
import Input from '../../Input';
|
32
33
|
export var All = '_all';
|
33
34
|
export function ColumnSetting(props) {
|
34
|
-
var overlayClass = props.overlayClass, _a = props.hiddenKeys, hiddenKeys = _a === void 0 ? [] : _a, onHiddenKeysChange = props.onHiddenKeysChange, _b = props.options, options = _b === void 0 ? [] : _b, loading = props.loading;
|
35
|
+
var overlayClass = props.overlayClass, _a = props.hiddenKeys, hiddenKeys = _a === void 0 ? [] : _a, onHiddenKeysChange = props.onHiddenKeysChange, onMove = props.onMove, _b = props.options, options = _b === void 0 ? [] : _b, loading = props.loading;
|
35
36
|
var locale = useContext(ConfigContext).locale;
|
36
37
|
var _c = __read(useState(''), 2), prefix = _c[0], setPrefix = _c[1];
|
37
38
|
var allKeys = useMemo(function () {
|
@@ -80,12 +81,19 @@ export function ColumnSetting(props) {
|
|
80
81
|
React.createElement(Checkbox, { value: All, checked: hiddenKeys.length === 0, onChange: allCheckChange, className: SDK_PREFIX + "-table-column-setting-all-check" }, formatString(TableLocale.check_all, locale)),
|
81
82
|
React.createElement(Input, { value: prefix, allowClear: true, onChange: handlePrefixChange, placeholder: formatString(TableLocale.search, locale), className: SDK_PREFIX + "-table-column-setting-search-input" })),
|
82
83
|
React.createElement("div", null,
|
83
|
-
React.createElement("div", { className: SDK_PREFIX + "-table-column-setting-content" },
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
React.createElement("div", { className: SDK_PREFIX + "-table-column-setting-content" },
|
85
|
+
React.createElement(ReactSortable, { onChange: onMove, options: {
|
86
|
+
group: 'setting-config',
|
87
|
+
animation: 150,
|
88
|
+
preventOnFilter: false
|
89
|
+
} }, realOptions.map(function (item) {
|
90
|
+
return (React.createElement("div", { key: item.value, "data-id": item.value },
|
91
|
+
React.createElement("div", { className: SDK_PREFIX + "-table-column-setting-checkbox-container" },
|
92
|
+
React.createElement("div", { className: SDK_PREFIX + "-table-column-setting-dragholder" },
|
93
|
+
React.createElement(HolderOutlined, null)),
|
94
|
+
React.createElement(Checkbox, { checked: !!realValues.find(function (v) { return v === item.value; }), value: item.value, className: SDK_PREFIX + "-table-column-setting-checkbox", onChange: handleChange },
|
95
|
+
React.createElement("span", { className: SDK_PREFIX + "-table-column-setting-value" }, typeof item.label === 'string' ? (React.createElement(NameLimiter, { name: item.label })) : (item.label))))));
|
96
|
+
})))))) },
|
89
97
|
React.createElement(SettingOutlined, { className: SDK_PREFIX + "-table-column-setting-icon", onClick: function (e) {
|
90
98
|
e.stopPropagation();
|
91
99
|
e.preventDefault();
|
@@ -38,8 +38,17 @@
|
|
38
38
|
overflow: hidden;
|
39
39
|
text-overflow: ellipsis;
|
40
40
|
}
|
41
|
+
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container {
|
42
|
+
margin: 4px 0;
|
43
|
+
display: -webkit-box;
|
44
|
+
display: -ms-flexbox;
|
45
|
+
display: flex;
|
46
|
+
}
|
47
|
+
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container .pandora-sdk-table-column-setting-dragholder {
|
48
|
+
cursor: move;
|
49
|
+
}
|
41
50
|
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container .pandora-sdk-table-column-setting-checkbox {
|
42
|
-
width:
|
51
|
+
width: 120px;
|
43
52
|
overflow: hidden;
|
44
53
|
}
|
45
54
|
.pandora-sdk-table-column-setting-content > div .pandora-sdk-table-column-setting-checkbox-container .pandora-sdk-table-column-setting-checkbox > span:nth-child(2) {
|
@@ -35,8 +35,13 @@
|
|
35
35
|
overflow: hidden;
|
36
36
|
text-overflow: ellipsis;
|
37
37
|
.@{sdk-prefix}-table-column-setting-checkbox-container {
|
38
|
+
margin: 4px 0;
|
39
|
+
display: flex;
|
40
|
+
.@{sdk-prefix}-table-column-setting-dragholder {
|
41
|
+
cursor: move;
|
42
|
+
}
|
38
43
|
.@{sdk-prefix}-table-column-setting-checkbox {
|
39
|
-
width:
|
44
|
+
width: 120px;
|
40
45
|
overflow: hidden;
|
41
46
|
}
|
42
47
|
.@{sdk-prefix}-table-column-setting-checkbox > span:nth-child(2) {
|
@@ -16,5 +16,7 @@ export declare enum ETableDragSaveKey {
|
|
16
16
|
/** 仪表盘 */
|
17
17
|
Dashboard = "Keta_drag_table_dashboard",
|
18
18
|
/** 采集任务 */
|
19
|
-
CollectionTask = "Keta_drag_collection_task"
|
19
|
+
CollectionTask = "Keta_drag_collection_task",
|
20
|
+
/** 北冥事件 */
|
21
|
+
NeuralertEvent = "Keta_drag_neuralert_event"
|
20
22
|
}
|
@@ -19,4 +19,6 @@ export var ETableDragSaveKey;
|
|
19
19
|
ETableDragSaveKey["Dashboard"] = "Keta_drag_table_dashboard";
|
20
20
|
/** 采集任务 */
|
21
21
|
ETableDragSaveKey["CollectionTask"] = "Keta_drag_collection_task";
|
22
|
+
/** 北冥事件 */
|
23
|
+
ETableDragSaveKey["NeuralertEvent"] = "Keta_drag_neuralert_event";
|
22
24
|
})(ETableDragSaveKey || (ETableDragSaveKey = {}));
|
@@ -21,6 +21,17 @@ export interface IOptionItem {
|
|
21
21
|
*/
|
22
22
|
disabled?: boolean | ((selectItems: any[]) => boolean);
|
23
23
|
}
|
24
|
+
export interface ISaveFieldItem {
|
25
|
+
field: string;
|
26
|
+
hide?: boolean;
|
27
|
+
width?: number;
|
28
|
+
index?: number;
|
29
|
+
fixed?: boolean | 'right' | 'left';
|
30
|
+
}
|
31
|
+
export declare enum ETableSettingType {
|
32
|
+
SORT = "sort",
|
33
|
+
RESIZE = "resize"
|
34
|
+
}
|
24
35
|
export interface IColumnType<T> extends ColumnType<T> {
|
25
36
|
colTitle?: string | React.ReactNode;
|
26
37
|
configurable?: boolean;
|
@@ -47,9 +58,9 @@ export interface ITableProps<T> extends Omit<TableProps<T>, 'columns'> {
|
|
47
58
|
hiddenColumns?: string[];
|
48
59
|
onHiddenColumnsChange?: (keys: string[]) => void;
|
49
60
|
columnSettingOverlayClass?: string;
|
50
|
-
draggable?: boolean;
|
51
|
-
|
52
|
-
|
61
|
+
draggable?: boolean | ETableSettingType;
|
62
|
+
saveSettingKey?: string;
|
63
|
+
onSettingChange?: (fields: ISaveFieldItem[]) => void;
|
53
64
|
}
|
54
65
|
/**
|
55
66
|
* pandora2.0风格的表格
|
@@ -66,7 +77,14 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
66
77
|
checkAll: boolean;
|
67
78
|
hiddenColumn: string[] | undefined;
|
68
79
|
columns: IKeyValues[];
|
80
|
+
sortConfig: {
|
81
|
+
sortKeys: string[];
|
82
|
+
fixedRightKeys: string[];
|
83
|
+
fixedLeftKeys: string[];
|
84
|
+
};
|
85
|
+
settingFields: ISaveFieldItem[];
|
69
86
|
UNSAFE_componentWillReceiveProps(nextProps: ITableProps<T>): void;
|
87
|
+
componentWillUnmount(): void;
|
70
88
|
get selectedRowKeys(): React.ReactText[];
|
71
89
|
get rowSelection(): TableRowSelection<T> | undefined;
|
72
90
|
get undisabledData(): readonly T[];
|
@@ -78,13 +96,29 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
|
|
78
96
|
unconfigableKeys: string[];
|
79
97
|
resetKeys: string[];
|
80
98
|
};
|
99
|
+
get resizable(): false | ({
|
100
|
+
x?: string | number | true | undefined;
|
101
|
+
y?: string | number | undefined;
|
102
|
+
} & {
|
103
|
+
scrollToFirstRowOnChange?: boolean | undefined;
|
104
|
+
}) | undefined;
|
105
|
+
get sortable(): boolean;
|
106
|
+
updateSettingConfig(columns: Array<IColumnType<T>>): void;
|
107
|
+
initSettingConfig(): void;
|
108
|
+
updateSettingFields(columns: Array<IColumnType<T>>, settingFields: ISaveFieldItem[]): void;
|
81
109
|
handleHideColumnsChange(keys: string[]): Promise<void> | undefined;
|
82
|
-
|
110
|
+
getSortedColumns(): (IKeyValues<any> | undefined)[];
|
111
|
+
getColumns(): (IKeyValues<any> | undefined)[];
|
83
112
|
getRowKey(row: any, index: number): any;
|
113
|
+
getSortCoulmns(columns: IKeyValues[]): (IKeyValues<any> | undefined)[];
|
84
114
|
setIndeterminate(indeterminate: boolean): void;
|
85
115
|
setCheckAll(checkAll: boolean): void;
|
86
116
|
setHiddenColumn(hiddenColumn?: string[]): void;
|
87
117
|
setColumns(columns: IKeyValues[]): void;
|
118
|
+
setSortKeys(columns: string[]): void;
|
119
|
+
setSettingFields(columns: ISaveFieldItem[]): void;
|
120
|
+
setFixedRightKeys(columns: string[]): void;
|
121
|
+
setFixedLeftKeys(columns: string[]): void;
|
88
122
|
setCheckboxStatus(selectedRowsOfCurrentPage?: T[], dataSource?: T[]): void;
|
89
123
|
handleSelectionChange(selectedRowKeys: React.Key[], selectedRowsOfCurrentPage: any[]): void;
|
90
124
|
onRowSelectionChange(selectedRowKeys: React.Key[], selectedRowsOfCurrentPage: any[]): void;
|