@rainbow-oh/yee-c 0.9.2 → 0.11.0
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/dist/cjs/Button/demo/icon.js +1 -1
- package/dist/cjs/Input/style/index.less +1 -0
- package/dist/cjs/Table/demo/resizable.d.ts +3 -0
- package/dist/cjs/Table/demo/resizable.js +143 -0
- package/dist/cjs/Table/hooks/useColumnResize.d.ts +30 -0
- package/dist/cjs/Table/hooks/useColumnResize.js +217 -0
- package/dist/cjs/Table/hooks/useColumns.d.ts +3 -1
- package/dist/cjs/Table/hooks/useColumns.js +14 -3
- package/dist/cjs/Table/interface.d.ts +49 -0
- package/dist/cjs/Table/style/index.less +42 -0
- package/dist/cjs/Table/table.js +62 -9
- package/dist/cjs/Table/theader/cell.js +46 -4
- package/dist/cjs/Table/util/index.d.ts +19 -1
- package/dist/cjs/Table/util/index.js +22 -0
- package/dist/cjs/Tabs/demo/overflow-center.d.ts +3 -0
- package/dist/cjs/Tabs/demo/overflow-center.js +54 -0
- package/dist/cjs/Tabs/hooks/useNavListMove.d.ts +2 -1
- package/dist/cjs/Tabs/hooks/useNavListMove.js +51 -16
- package/dist/cjs/Tabs/hooks/useTabScroll.d.ts +1 -0
- package/dist/cjs/Tabs/hooks/useTabScroll.js +5 -1
- package/dist/cjs/Tabs/interface.d.ts +10 -1
- package/dist/cjs/Tabs/style/index.less +5 -0
- package/dist/cjs/Tabs/tab-header/index.d.ts +1 -0
- package/dist/cjs/Tabs/tab-header/index.js +11 -3
- package/dist/cjs/Tabs/tabs.js +4 -1
- package/dist/cjs/Upload/demo/auto-upload.d.ts +3 -0
- package/dist/cjs/Upload/demo/auto-upload.js +65 -0
- package/dist/cjs/Upload/demo/basic.js +5 -10
- package/dist/cjs/Upload/demo/controlled.js +4 -4
- package/dist/cjs/Upload/demo/pictureWall.js +14 -13
- package/dist/cjs/Upload/dragger.d.ts +2 -1
- package/dist/cjs/Upload/dragger.js +32 -21
- package/dist/cjs/Upload/index.d.ts +1 -1
- package/dist/cjs/Upload/interface.d.ts +67 -120
- package/dist/cjs/Upload/style/index.less +40 -13
- package/dist/cjs/Upload/upload.d.ts +2 -2
- package/dist/cjs/Upload/upload.js +435 -185
- package/dist/cjs/Upload/uploaded-list/index.d.ts +2 -1
- package/dist/cjs/Upload/uploaded-list/index.js +6 -3
- package/dist/cjs/Upload/uploaded-list/uploaded-item.d.ts +6 -3
- package/dist/cjs/Upload/uploaded-list/uploaded-item.js +127 -138
- package/dist/cjs/locale/interface.d.ts +1 -0
- package/dist/cjs/locale/lang/en_US.js +2 -1
- package/dist/cjs/locale/lang/ja_JP.js +2 -1
- package/dist/cjs/locale/lang/zh_CN.js +2 -1
- package/dist/cjs/locale/lang/zh_TW.js +2 -1
- package/dist/cjs/style/size.css +2 -1
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -2
- package/dist/cjs/utils/ax/core.d.ts +3 -1
- package/dist/cjs/utils/ax/core.js +24 -37
- package/dist/cjs/utils/ax/index.d.ts +3 -1
- package/dist/cjs/utils/folder-scanner.d.ts +1 -1
- package/dist/cjs/utils/folder-scanner.js +43 -34
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Button/demo/icon.js +7 -4
- package/dist/esm/Input/style/index.less +1 -0
- package/dist/esm/Table/demo/resizable.d.ts +3 -0
- package/dist/esm/Table/demo/resizable.js +110 -0
- package/dist/esm/Table/hooks/useColumnResize.d.ts +30 -0
- package/dist/esm/Table/hooks/useColumnResize.js +206 -0
- package/dist/esm/Table/hooks/useColumns.d.ts +3 -1
- package/dist/esm/Table/hooks/useColumns.js +9 -4
- package/dist/esm/Table/interface.d.ts +49 -0
- package/dist/esm/Table/style/index.less +42 -0
- package/dist/esm/Table/table.js +83 -13
- package/dist/esm/Table/theader/cell.js +38 -3
- package/dist/esm/Table/util/index.d.ts +19 -1
- package/dist/esm/Table/util/index.js +37 -0
- package/dist/esm/Tabs/demo/overflow-center.d.ts +3 -0
- package/dist/esm/Tabs/demo/overflow-center.js +61 -0
- package/dist/esm/Tabs/hooks/useNavListMove.d.ts +2 -1
- package/dist/esm/Tabs/hooks/useNavListMove.js +62 -25
- package/dist/esm/Tabs/hooks/useTabScroll.d.ts +1 -0
- package/dist/esm/Tabs/hooks/useTabScroll.js +9 -0
- package/dist/esm/Tabs/interface.d.ts +10 -1
- package/dist/esm/Tabs/style/index.less +5 -0
- package/dist/esm/Tabs/tab-header/index.d.ts +1 -0
- package/dist/esm/Tabs/tab-header/index.js +15 -3
- package/dist/esm/Tabs/tabs.js +4 -2
- package/dist/esm/Upload/demo/auto-upload.d.ts +3 -0
- package/dist/esm/Upload/demo/auto-upload.js +42 -0
- package/dist/esm/Upload/demo/basic.js +5 -11
- package/dist/esm/Upload/demo/controlled.js +8 -6
- package/dist/esm/Upload/demo/pictureWall.js +17 -14
- package/dist/esm/Upload/dragger.d.ts +2 -1
- package/dist/esm/Upload/dragger.js +10 -5
- package/dist/esm/Upload/index.d.ts +1 -1
- package/dist/esm/Upload/interface.d.ts +67 -120
- package/dist/esm/Upload/style/index.less +40 -13
- package/dist/esm/Upload/upload.d.ts +2 -2
- package/dist/esm/Upload/upload.js +573 -271
- package/dist/esm/Upload/uploaded-list/index.d.ts +2 -1
- package/dist/esm/Upload/uploaded-list/index.js +9 -4
- package/dist/esm/Upload/uploaded-list/uploaded-item.d.ts +6 -3
- package/dist/esm/Upload/uploaded-list/uploaded-item.js +145 -150
- package/dist/esm/locale/interface.d.ts +1 -0
- package/dist/esm/locale/lang/en_US.js +2 -1
- package/dist/esm/locale/lang/ja_JP.js +2 -1
- package/dist/esm/locale/lang/zh_CN.js +2 -1
- package/dist/esm/locale/lang/zh_TW.js +2 -1
- package/dist/esm/style/size.css +2 -1
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -2
- package/dist/esm/utils/ax/core.d.ts +3 -1
- package/dist/esm/utils/ax/core.js +32 -40
- package/dist/esm/utils/ax/index.d.ts +3 -1
- package/dist/esm/utils/folder-scanner.d.ts +1 -1
- package/dist/esm/utils/folder-scanner.js +76 -75
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Button/demo/icon.tsx +5 -3
- package/src/Input/style/index.less +1 -0
- package/src/Table/demo/resizable.tsx +106 -0
- package/src/Table/hooks/useColumnResize.ts +224 -0
- package/src/Table/hooks/useColumns.ts +18 -3
- package/src/Table/index.en-US.md +7 -0
- package/src/Table/index.zh-CN.md +7 -0
- package/src/Table/interface.ts +52 -0
- package/src/Table/style/index.less +42 -0
- package/src/Table/table-resize.test.tsx +234 -0
- package/src/Table/table.tsx +90 -13
- package/src/Table/theader/cell.tsx +52 -2
- package/src/Table/util/index.ts +44 -1
- package/src/Tabs/demo/overflow-center.tsx +35 -0
- package/src/Tabs/hooks/useNavListMove.ts +60 -18
- package/src/Tabs/hooks/useTabScroll.ts +7 -1
- package/src/Tabs/index.en-US.md +33 -31
- package/src/Tabs/index.zh-CN.md +33 -31
- package/src/Tabs/interface.ts +10 -1
- package/src/Tabs/style/index.less +5 -0
- package/src/Tabs/tab-header/index.tsx +14 -3
- package/src/Tabs/tabs.tsx +2 -0
- package/src/Upload/demo/auto-upload.tsx +35 -0
- package/src/Upload/demo/basic.tsx +7 -11
- package/src/Upload/demo/controlled.tsx +12 -8
- package/src/Upload/demo/directory.tsx +3 -4
- package/src/Upload/demo/drag.tsx +5 -12
- package/src/Upload/demo/multiple.tsx +3 -4
- package/src/Upload/demo/pictureWall.tsx +22 -21
- package/src/Upload/dragger.tsx +47 -34
- package/src/Upload/index.en-US.md +63 -43
- package/src/Upload/index.ts +8 -1
- package/src/Upload/index.zh-CN.md +62 -42
- package/src/Upload/interface.ts +68 -120
- package/src/Upload/style/index.less +40 -13
- package/src/Upload/upload.tsx +546 -215
- package/src/Upload/uploaded-list/index.tsx +9 -5
- package/src/Upload/uploaded-list/uploaded-item.tsx +199 -228
- package/src/locale/interface.ts +1 -0
- package/src/locale/lang/en_US.ts +1 -0
- package/src/locale/lang/ja_JP.ts +1 -0
- package/src/locale/lang/zh_CN.ts +1 -0
- package/src/locale/lang/zh_TW.ts +1 -0
- package/src/style/size.css +2 -1
- package/src/utils/ax/core.ts +28 -41
- package/src/utils/folder-scanner.ts +51 -37
- package/src/version.ts +1 -1
|
@@ -60,8 +60,6 @@ function buildUrl(config) {
|
|
|
60
60
|
return fullpath;
|
|
61
61
|
}
|
|
62
62
|
var Ax = class {
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
64
|
-
// constructor() {}
|
|
65
63
|
request(configOrUrl) {
|
|
66
64
|
var _a;
|
|
67
65
|
let config = getDefaultConfig();
|
|
@@ -83,9 +81,10 @@ var Ax = class {
|
|
|
83
81
|
body: config.data
|
|
84
82
|
}));
|
|
85
83
|
}
|
|
86
|
-
|
|
84
|
+
let xhr;
|
|
85
|
+
const request = new Promise((resolve, reject) => {
|
|
87
86
|
var _a2;
|
|
88
|
-
|
|
87
|
+
xhr = new XMLHttpRequest();
|
|
89
88
|
const {
|
|
90
89
|
headers,
|
|
91
90
|
timeout,
|
|
@@ -98,7 +97,6 @@ var Ax = class {
|
|
|
98
97
|
onTimeout,
|
|
99
98
|
onLoaded,
|
|
100
99
|
formDataWithBoundary = true
|
|
101
|
-
// Set boundary for form-data upload type
|
|
102
100
|
} = config;
|
|
103
101
|
if ((!data || (0, import_utils.getType)(data) === "FormData") && headers) {
|
|
104
102
|
if (formDataWithBoundary) {
|
|
@@ -113,64 +111,53 @@ var Ax = class {
|
|
|
113
111
|
xhr.timeout = timeout;
|
|
114
112
|
}
|
|
115
113
|
xhr.upload.onprogress = function(event) {
|
|
116
|
-
|
|
117
|
-
onUploadProgress(event, xhr);
|
|
118
|
-
}
|
|
114
|
+
onUploadProgress == null ? void 0 : onUploadProgress(event, xhr);
|
|
119
115
|
};
|
|
120
116
|
xhr.onreadystatechange = function() {
|
|
121
|
-
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
117
|
+
if ((xhr == null ? void 0 : xhr.readyState) === XMLHttpRequest.DONE) {
|
|
122
118
|
if (xhr.status >= 200 && xhr.status <= 299) {
|
|
123
119
|
const type = this.getResponseHeader("content-type") || "";
|
|
124
120
|
const isJsonType = type.indexOf("application/json") > -1;
|
|
125
|
-
let
|
|
121
|
+
let responseData;
|
|
126
122
|
if (isJsonType) {
|
|
127
123
|
try {
|
|
128
|
-
|
|
129
|
-
} catch (
|
|
130
|
-
|
|
124
|
+
responseData = JSON.parse(xhr.response);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
responseData = xhr.response;
|
|
131
127
|
}
|
|
132
128
|
} else {
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
if (onSuccess) {
|
|
136
|
-
onSuccess(data2, xhr);
|
|
129
|
+
responseData = xhr.response;
|
|
137
130
|
}
|
|
138
|
-
|
|
131
|
+
onSuccess == null ? void 0 : onSuccess(responseData, xhr);
|
|
132
|
+
resolve(responseData);
|
|
139
133
|
} else {
|
|
140
|
-
|
|
141
|
-
onError(xhr.response, xhr);
|
|
142
|
-
}
|
|
134
|
+
onError == null ? void 0 : onError(xhr.response, xhr);
|
|
143
135
|
reject({ status: "error", error: xhr.response });
|
|
144
136
|
}
|
|
145
137
|
}
|
|
146
138
|
};
|
|
147
139
|
xhr.onprogress = function(event) {
|
|
148
|
-
|
|
149
|
-
onProgress(event, xhr);
|
|
150
|
-
}
|
|
140
|
+
onProgress == null ? void 0 : onProgress(event, xhr);
|
|
151
141
|
};
|
|
152
142
|
xhr.onloadend = function(event) {
|
|
153
|
-
|
|
154
|
-
onLoaded(event, xhr);
|
|
155
|
-
}
|
|
143
|
+
onLoaded == null ? void 0 : onLoaded(event, xhr);
|
|
156
144
|
xhr = null;
|
|
157
145
|
};
|
|
158
|
-
xhr.onerror = function(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
146
|
+
xhr.onerror = function(error) {
|
|
147
|
+
onError == null ? void 0 : onError(xhr.response, xhr);
|
|
148
|
+
reject({ status: "error", error });
|
|
149
|
+
};
|
|
150
|
+
xhr.onabort = function(event) {
|
|
151
|
+
reject({ status: "abort", error: event });
|
|
164
152
|
};
|
|
165
153
|
xhr.ontimeout = function(event) {
|
|
166
|
-
|
|
167
|
-
onTimeout(event, xhr);
|
|
168
|
-
}
|
|
154
|
+
onTimeout == null ? void 0 : onTimeout(event, xhr);
|
|
169
155
|
reject({ status: "timeout", error: event });
|
|
170
|
-
xhr = null;
|
|
171
156
|
};
|
|
172
157
|
xhr.send(data || null);
|
|
173
158
|
});
|
|
159
|
+
request.abort = () => xhr == null ? void 0 : xhr.abort();
|
|
160
|
+
return request;
|
|
174
161
|
}
|
|
175
162
|
};
|
|
176
163
|
["delete", "get", "head", "options"].forEach((method) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function folderScanner(entry:
|
|
1
|
+
export default function folderScanner(entry: FileSystemEntry, filesList?: File[]): Promise<File[]>;
|
|
@@ -42,39 +42,48 @@ __export(folder_scanner_exports, {
|
|
|
42
42
|
default: () => folderScanner
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(folder_scanner_exports);
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
(entries)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
45
|
+
var readAllEntries = (reader) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const entries = [];
|
|
48
|
+
const readNextBatch = () => {
|
|
49
|
+
reader.readEntries((batch) => {
|
|
50
|
+
if (batch.length === 0) {
|
|
51
|
+
resolve(entries);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
entries.push(...batch);
|
|
55
|
+
readNextBatch();
|
|
56
|
+
}, reject);
|
|
57
|
+
};
|
|
58
|
+
readNextBatch();
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var readFile = (entry) => {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
entry.file((file) => {
|
|
64
|
+
const path = entry.fullPath.replace(/^\//, "");
|
|
65
|
+
Object.defineProperty(file, "webkitRelativePath", {
|
|
66
|
+
configurable: true,
|
|
67
|
+
value: path
|
|
68
|
+
});
|
|
69
|
+
resolve(file);
|
|
70
|
+
}, reject);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
function folderScanner(_0) {
|
|
74
|
+
return __async(this, arguments, function* (entry, filesList = []) {
|
|
75
|
+
if (entry.isFile) {
|
|
76
|
+
filesList.push(yield readFile(entry));
|
|
77
|
+
return filesList;
|
|
78
|
+
}
|
|
79
|
+
if (entry.isDirectory) {
|
|
80
|
+
const reader = entry.createReader();
|
|
81
|
+
const entries = yield readAllEntries(reader);
|
|
82
|
+
const nestedFiles = yield Promise.all(
|
|
83
|
+
entries.map((nestedEntry) => folderScanner(nestedEntry, []))
|
|
84
|
+
);
|
|
85
|
+
filesList.push(...nestedFiles.flat());
|
|
86
|
+
}
|
|
87
|
+
return filesList;
|
|
79
88
|
});
|
|
80
89
|
}
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button } from "../..";
|
|
1
|
+
import { Button, Tooltip } from "../..";
|
|
2
2
|
import { Download, Plus, Search } from 'lucide-react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export default (function () {
|
|
@@ -6,7 +6,8 @@ export default (function () {
|
|
|
6
6
|
type: "primary",
|
|
7
7
|
icon: /*#__PURE__*/React.createElement(Search, {
|
|
8
8
|
size: 16
|
|
9
|
-
})
|
|
9
|
+
}),
|
|
10
|
+
title: "search"
|
|
10
11
|
}, "Search"), /*#__PURE__*/React.createElement("span", {
|
|
11
12
|
style: {
|
|
12
13
|
margin: '0 10px'
|
|
@@ -24,13 +25,15 @@ export default (function () {
|
|
|
24
25
|
style: {
|
|
25
26
|
margin: '0 10px'
|
|
26
27
|
}
|
|
27
|
-
}), /*#__PURE__*/React.createElement(
|
|
28
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
29
|
+
title: "Search"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
28
31
|
shape: "circle",
|
|
29
32
|
type: "primary",
|
|
30
33
|
icon: /*#__PURE__*/React.createElement(Search, {
|
|
31
34
|
size: 16
|
|
32
35
|
})
|
|
33
|
-
}), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
36
|
+
})), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
34
37
|
icon: /*#__PURE__*/React.createElement(Search, {
|
|
35
38
|
size: 16
|
|
36
39
|
})
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
border: var(--yee-input-border-width) solid var(--yee-input-border-color);
|
|
14
14
|
border-radius: var(--yee-input-border-radius, 4px);
|
|
15
15
|
font-family: var(--yee-font-family);
|
|
16
|
+
outline: inherit;
|
|
16
17
|
|
|
17
18
|
&:not(@{pls}-disabled):hover {
|
|
18
19
|
border-color: var(--yee-input-hover-border-color);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { Table } from "../..";
|
|
14
|
+
import React from 'react';
|
|
15
|
+
var columns = [{
|
|
16
|
+
title: 'Name',
|
|
17
|
+
dataIndex: 'name',
|
|
18
|
+
key: 'name',
|
|
19
|
+
fixed: 'left',
|
|
20
|
+
width: 140,
|
|
21
|
+
minWidth: 100
|
|
22
|
+
}, {
|
|
23
|
+
title: 'Age',
|
|
24
|
+
dataIndex: 'age',
|
|
25
|
+
key: 'age',
|
|
26
|
+
width: 100,
|
|
27
|
+
sorter: true
|
|
28
|
+
}, {
|
|
29
|
+
title: 'Address',
|
|
30
|
+
dataIndex: 'address',
|
|
31
|
+
key: 'address',
|
|
32
|
+
width: 240
|
|
33
|
+
}, {
|
|
34
|
+
title: 'Company',
|
|
35
|
+
dataIndex: 'company',
|
|
36
|
+
key: 'company',
|
|
37
|
+
width: 180
|
|
38
|
+
}, {
|
|
39
|
+
title: 'Email',
|
|
40
|
+
dataIndex: 'email',
|
|
41
|
+
key: 'email',
|
|
42
|
+
width: 240
|
|
43
|
+
}, {
|
|
44
|
+
// Opt this column out of resizing while the rest stay resizable.
|
|
45
|
+
title: 'Action',
|
|
46
|
+
key: 'action',
|
|
47
|
+
fixed: 'right',
|
|
48
|
+
width: 100,
|
|
49
|
+
resizable: false,
|
|
50
|
+
render: function render(record) {
|
|
51
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
52
|
+
onClick: function onClick() {
|
|
53
|
+
return console.log(record);
|
|
54
|
+
}
|
|
55
|
+
}, "View");
|
|
56
|
+
}
|
|
57
|
+
}];
|
|
58
|
+
var dataSource = [{
|
|
59
|
+
key: '1',
|
|
60
|
+
name: 'John Brown',
|
|
61
|
+
age: 32,
|
|
62
|
+
address: 'New York No. 1 Lake Park',
|
|
63
|
+
company: 'Acme Inc.',
|
|
64
|
+
email: 'john.brown@example.com'
|
|
65
|
+
}, {
|
|
66
|
+
key: '2',
|
|
67
|
+
name: 'Jim Green',
|
|
68
|
+
age: 42,
|
|
69
|
+
address: 'London No. 1 Lake Park',
|
|
70
|
+
company: 'Globex',
|
|
71
|
+
email: 'jim.green@example.com'
|
|
72
|
+
}, {
|
|
73
|
+
key: '3',
|
|
74
|
+
name: 'Joe Black',
|
|
75
|
+
age: 28,
|
|
76
|
+
address: 'Sidney No. 1 Lake Park',
|
|
77
|
+
company: 'Initech',
|
|
78
|
+
email: 'joe.black@example.com'
|
|
79
|
+
}];
|
|
80
|
+
export default (function () {
|
|
81
|
+
var _React$useState = React.useState({}),
|
|
82
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
83
|
+
widths = _React$useState2[0],
|
|
84
|
+
setWidths = _React$useState2[1];
|
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, {
|
|
86
|
+
resizable: true,
|
|
87
|
+
columns: columns,
|
|
88
|
+
dataSource: dataSource,
|
|
89
|
+
rowKey: "key",
|
|
90
|
+
pagination: false,
|
|
91
|
+
scroll: {
|
|
92
|
+
x: 1000
|
|
93
|
+
},
|
|
94
|
+
onColumnResizeEnd: function onColumnResizeEnd(width, column) {
|
|
95
|
+
return setWidths(function (current) {
|
|
96
|
+
var _column$key;
|
|
97
|
+
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, String((_column$key = column.key) !== null && _column$key !== void 0 ? _column$key : column.dataIndex), width));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
101
|
+
style: {
|
|
102
|
+
marginTop: 12
|
|
103
|
+
}
|
|
104
|
+
}, "\u6700\u8FD1\u8C03\u6574\uFF1A", Object.keys(widths).length ? Object.entries(widths).map(function (_ref) {
|
|
105
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
106
|
+
key = _ref2[0],
|
|
107
|
+
width = _ref2[1];
|
|
108
|
+
return "".concat(key, "=").concat(width, "px");
|
|
109
|
+
}).join(',') : '拖动表头右边缘试试'));
|
|
110
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WrapedColumnProps } from '../interface';
|
|
3
|
+
interface UseColumnResizeOptions {
|
|
4
|
+
tableRef: React.RefObject<HTMLTableElement | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Latest leaf columns. Passed as a ref because the columns are themselves
|
|
7
|
+
* derived from `resizedWidths`; depending on the array would make every
|
|
8
|
+
* width change rebuild the drag handlers mid-drag.
|
|
9
|
+
*/
|
|
10
|
+
columnsRef: React.RefObject<WrapedColumnProps[]>;
|
|
11
|
+
onColumnResize?: (width: number, column: WrapedColumnProps) => void;
|
|
12
|
+
onColumnResizeEnd?: (width: number, column: WrapedColumnProps) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Pointer (and keyboard) driven column resizing.
|
|
16
|
+
*
|
|
17
|
+
* The table normally lets the browser distribute widths (`width: 100%` with an
|
|
18
|
+
* `auto` layout), which means writing a width onto one column would silently
|
|
19
|
+
* steal space from its neighbours. So the first resize interaction snapshots the
|
|
20
|
+
* rendered width of *every* column; from then on the table is fully px
|
|
21
|
+
* controlled and a drag only moves the column it grabbed.
|
|
22
|
+
*/
|
|
23
|
+
export default function useColumnResize({ tableRef, columnsRef, onColumnResize, onColumnResizeEnd, }: UseColumnResizeOptions): {
|
|
24
|
+
resizedWidths: Record<string, number>;
|
|
25
|
+
resizingKey: string | null;
|
|
26
|
+
onResizeStart: (event: React.PointerEvent<HTMLElement>, resizeKey: string) => void;
|
|
27
|
+
onResizeStep: (resizeKey: string, direction: number) => void;
|
|
28
|
+
resetResizedWidths: () => void;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import useLatest from "../../hooks/useLatest";
|
|
15
|
+
/** Floor for a dragged column when it declares no `minWidth` of its own. */
|
|
16
|
+
var DEFAULT_MIN_COLUMN_WIDTH = 40;
|
|
17
|
+
|
|
18
|
+
/** Width delta applied per arrow key press when a handle has focus. */
|
|
19
|
+
var KEYBOARD_STEP = 8;
|
|
20
|
+
var clampWidth = function clampWidth(width, column) {
|
|
21
|
+
var _column$minWidth;
|
|
22
|
+
var min = Math.max((_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : DEFAULT_MIN_COLUMN_WIDTH, 0);
|
|
23
|
+
var max = column.maxWidth;
|
|
24
|
+
if (width < min) return min;
|
|
25
|
+
if (max !== undefined && width > max) return max;
|
|
26
|
+
return Math.round(width);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Pointer (and keyboard) driven column resizing.
|
|
31
|
+
*
|
|
32
|
+
* The table normally lets the browser distribute widths (`width: 100%` with an
|
|
33
|
+
* `auto` layout), which means writing a width onto one column would silently
|
|
34
|
+
* steal space from its neighbours. So the first resize interaction snapshots the
|
|
35
|
+
* rendered width of *every* column; from then on the table is fully px
|
|
36
|
+
* controlled and a drag only moves the column it grabbed.
|
|
37
|
+
*/
|
|
38
|
+
export default function useColumnResize(_ref) {
|
|
39
|
+
var tableRef = _ref.tableRef,
|
|
40
|
+
columnsRef = _ref.columnsRef,
|
|
41
|
+
onColumnResize = _ref.onColumnResize,
|
|
42
|
+
onColumnResizeEnd = _ref.onColumnResizeEnd;
|
|
43
|
+
var _React$useState = React.useState({}),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
resizedWidths = _React$useState2[0],
|
|
46
|
+
setResizedWidths = _React$useState2[1];
|
|
47
|
+
var _React$useState3 = React.useState(null),
|
|
48
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
49
|
+
resizingKey = _React$useState4[0],
|
|
50
|
+
setResizingKey = _React$useState4[1];
|
|
51
|
+
|
|
52
|
+
// Callbacks are consumer supplied and usually re-created every render; reading
|
|
53
|
+
// them from a ref keeps `onResizeStart` stable.
|
|
54
|
+
var onColumnResizeRef = useLatest(onColumnResize);
|
|
55
|
+
var onColumnResizeEndRef = useLatest(onColumnResizeEnd);
|
|
56
|
+
var resizedWidthsRef = useLatest(resizedWidths);
|
|
57
|
+
var frameRef = React.useRef(0);
|
|
58
|
+
var teardownRef = React.useRef(null);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Read the rendered width of every column off the `<col>` elements. Returns
|
|
62
|
+
* null when the measurement cannot be trusted, in which case the interaction
|
|
63
|
+
* is abandoned rather than applying a partial snapshot (a partial snapshot
|
|
64
|
+
* would leave holes once the layout switches to `fixed`).
|
|
65
|
+
*/
|
|
66
|
+
var snapshotWidths = React.useCallback(function () {
|
|
67
|
+
var _tableRef$current;
|
|
68
|
+
var columns = columnsRef.current || [];
|
|
69
|
+
var colElements = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.querySelectorAll(':scope > colgroup > col');
|
|
70
|
+
if (!colElements || colElements.length !== columns.length) return null;
|
|
71
|
+
if (!columns.length) return null;
|
|
72
|
+
var snapshot = {};
|
|
73
|
+
for (var index = 0; index < columns.length; index += 1) {
|
|
74
|
+
var _columns$index;
|
|
75
|
+
var key = (_columns$index = columns[index]) === null || _columns$index === void 0 ? void 0 : _columns$index.resizeKey;
|
|
76
|
+
var _width = Math.round(colElements[index].getBoundingClientRect().width);
|
|
77
|
+
if (!key || !Number.isFinite(_width) || _width <= 0) return null;
|
|
78
|
+
snapshot[key] = _width;
|
|
79
|
+
}
|
|
80
|
+
return snapshot;
|
|
81
|
+
}, [columnsRef, tableRef]);
|
|
82
|
+
var findColumn = React.useCallback(function (resizeKey) {
|
|
83
|
+
return (columnsRef.current || []).find(function (column) {
|
|
84
|
+
return column.resizeKey === resizeKey;
|
|
85
|
+
});
|
|
86
|
+
}, [columnsRef]);
|
|
87
|
+
var onResizeStart = React.useCallback(function (event, resizeKey) {
|
|
88
|
+
// Ignore secondary buttons, and never let the drag reach the sorter click
|
|
89
|
+
// handler or start a native text selection.
|
|
90
|
+
if (event.button !== 0) return;
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
var column = findColumn(resizeKey);
|
|
94
|
+
if (!column) return;
|
|
95
|
+
var snapshot = snapshotWidths();
|
|
96
|
+
if (!snapshot) return;
|
|
97
|
+
var startX = event.clientX;
|
|
98
|
+
var startWidth = snapshot[resizeKey];
|
|
99
|
+
var latestWidth = startWidth;
|
|
100
|
+
setResizingKey(resizeKey);
|
|
101
|
+
setResizedWidths(snapshot);
|
|
102
|
+
document.body.style.userSelect = 'none';
|
|
103
|
+
document.body.style.cursor = 'col-resize';
|
|
104
|
+
var applyWidth = function applyWidth(clientX) {
|
|
105
|
+
var _onColumnResizeRef$cu;
|
|
106
|
+
var next = clampWidth(startWidth + (clientX - startX), column);
|
|
107
|
+
if (next === latestWidth) return;
|
|
108
|
+
latestWidth = next;
|
|
109
|
+
setResizedWidths(function (current) {
|
|
110
|
+
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, resizeKey, next));
|
|
111
|
+
});
|
|
112
|
+
(_onColumnResizeRef$cu = onColumnResizeRef.current) === null || _onColumnResizeRef$cu === void 0 || _onColumnResizeRef$cu.call(onColumnResizeRef, next, column);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// pointermove fires far more often than the browser can paint, and every
|
|
116
|
+
// width change relayouts the whole table, so coalesce to one per frame.
|
|
117
|
+
var onPointerMove = function onPointerMove(moveEvent) {
|
|
118
|
+
var clientX = moveEvent.clientX;
|
|
119
|
+
if (frameRef.current) cancelAnimationFrame(frameRef.current);
|
|
120
|
+
frameRef.current = requestAnimationFrame(function () {
|
|
121
|
+
frameRef.current = 0;
|
|
122
|
+
applyWidth(clientX);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Detaching listeners and restoring the document is split out from `stop`
|
|
127
|
+
// so that unmounting mid-drag can clean up without emitting a resize-end
|
|
128
|
+
// event or touching state on a gone component.
|
|
129
|
+
// Collected as closures so that `teardown` does not have to name the
|
|
130
|
+
// handlers it removes (`stop` is defined after it, and they are mutual).
|
|
131
|
+
var detachers = [];
|
|
132
|
+
var bind = function bind(type, handler) {
|
|
133
|
+
window.addEventListener(type, handler);
|
|
134
|
+
detachers.push(function () {
|
|
135
|
+
return window.removeEventListener(type, handler);
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
var teardown = function teardown() {
|
|
139
|
+
if (frameRef.current) {
|
|
140
|
+
cancelAnimationFrame(frameRef.current);
|
|
141
|
+
frameRef.current = 0;
|
|
142
|
+
}
|
|
143
|
+
detachers.forEach(function (detach) {
|
|
144
|
+
return detach();
|
|
145
|
+
});
|
|
146
|
+
detachers.length = 0;
|
|
147
|
+
document.body.style.userSelect = '';
|
|
148
|
+
document.body.style.cursor = '';
|
|
149
|
+
teardownRef.current = null;
|
|
150
|
+
};
|
|
151
|
+
var stop = function stop() {
|
|
152
|
+
var _onColumnResizeEndRef;
|
|
153
|
+
teardown();
|
|
154
|
+
setResizingKey(null);
|
|
155
|
+
(_onColumnResizeEndRef = onColumnResizeEndRef.current) === null || _onColumnResizeEndRef === void 0 || _onColumnResizeEndRef.call(onColumnResizeEndRef, latestWidth, column);
|
|
156
|
+
};
|
|
157
|
+
teardownRef.current = teardown;
|
|
158
|
+
bind('pointermove', onPointerMove);
|
|
159
|
+
bind('pointerup', stop);
|
|
160
|
+
bind('pointercancel', stop);
|
|
161
|
+
}, [findColumn, snapshotWidths, onColumnResizeRef, onColumnResizeEndRef]);
|
|
162
|
+
|
|
163
|
+
/** Keyboard equivalent of a drag, so the handle is operable without a mouse. */
|
|
164
|
+
var onResizeStep = React.useCallback(function (resizeKey, direction) {
|
|
165
|
+
var _onColumnResizeRef$cu2, _onColumnResizeEndRef2;
|
|
166
|
+
var column = findColumn(resizeKey);
|
|
167
|
+
if (!column) return;
|
|
168
|
+
var base = resizedWidthsRef.current;
|
|
169
|
+
var snapshot = base[resizeKey] === undefined ? snapshotWidths() : base;
|
|
170
|
+
if (!snapshot) return;
|
|
171
|
+
var next = clampWidth(snapshot[resizeKey] + direction * KEYBOARD_STEP, column);
|
|
172
|
+
if (next === snapshot[resizeKey]) return;
|
|
173
|
+
setResizedWidths(_objectSpread(_objectSpread({}, snapshot), {}, _defineProperty({}, resizeKey, next)));
|
|
174
|
+
(_onColumnResizeRef$cu2 = onColumnResizeRef.current) === null || _onColumnResizeRef$cu2 === void 0 || _onColumnResizeRef$cu2.call(onColumnResizeRef, next, column);
|
|
175
|
+
(_onColumnResizeEndRef2 = onColumnResizeEndRef.current) === null || _onColumnResizeEndRef2 === void 0 || _onColumnResizeEndRef2.call(onColumnResizeEndRef, next, column);
|
|
176
|
+
}, [findColumn, snapshotWidths, resizedWidthsRef, onColumnResizeRef, onColumnResizeEndRef]);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Forget the snapshot. Called when the column set changes: widths keyed to
|
|
180
|
+
* columns that no longer exist would under-report the total table width.
|
|
181
|
+
*/
|
|
182
|
+
var resetResizedWidths = React.useCallback(function () {
|
|
183
|
+
setResizedWidths(function (current) {
|
|
184
|
+
return Object.keys(current).length ? {} : current;
|
|
185
|
+
});
|
|
186
|
+
}, []);
|
|
187
|
+
|
|
188
|
+
// Unmounting mid-drag must not leave listeners or body styles behind.
|
|
189
|
+
React.useEffect(function () {
|
|
190
|
+
return function () {
|
|
191
|
+
var _teardownRef$current;
|
|
192
|
+
return (_teardownRef$current = teardownRef.current) === null || _teardownRef$current === void 0 ? void 0 : _teardownRef$current.call(teardownRef);
|
|
193
|
+
};
|
|
194
|
+
}, []);
|
|
195
|
+
|
|
196
|
+
// Not gated on any `enabled` flag: the state stays empty until something drags,
|
|
197
|
+
// and handles are only rendered for columns that opted in, so an unused Table
|
|
198
|
+
// pays nothing and a column-level `resizable` works with no table-level flag.
|
|
199
|
+
return {
|
|
200
|
+
resizedWidths: resizedWidths,
|
|
201
|
+
resizingKey: resizingKey,
|
|
202
|
+
onResizeStart: onResizeStart,
|
|
203
|
+
onResizeStep: onResizeStep,
|
|
204
|
+
resetResizedWidths: resetResizedWidths
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ColumnProps, ExpandableType, RowSelectionType, WrapedColumnProps } from '../interface';
|
|
3
|
-
export default function useColumns({ children, columns, rowSelection, expandable, measuredColumnWidths, }: {
|
|
3
|
+
export default function useColumns({ children, columns, rowSelection, expandable, measuredColumnWidths, resizable, resizedWidths, }: {
|
|
4
4
|
children?: React.ReactElement<ColumnProps> | React.ReactElement<ColumnProps>[];
|
|
5
5
|
columns: ColumnProps[];
|
|
6
6
|
rowSelection?: RowSelectionType;
|
|
7
7
|
expandable?: ExpandableType;
|
|
8
8
|
measuredColumnWidths?: number[];
|
|
9
|
+
resizable?: boolean;
|
|
10
|
+
resizedWidths?: Record<string, number>;
|
|
9
11
|
}): {
|
|
10
12
|
wrapedColumns: WrapedColumnProps[];
|
|
11
13
|
headerRows: import("../interface").HeaderCell[][];
|