@lemon-fe/components 1.5.7-alpha.4 → 1.5.7-alpha.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/es/data-grid/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const Editors: {
|
|
|
17
17
|
Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
18
18
|
Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
19
19
|
Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
20
|
-
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "
|
|
20
|
+
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "virtual" | "optionFilterProp" | "options" | "listHeight"> & {
|
|
21
21
|
fieldNames?: {
|
|
22
22
|
label: string;
|
|
23
23
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -1054,8 +1054,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1054
1054
|
rowActions = _this$props8.rowActions,
|
|
1055
1055
|
rowSelection = _this$props8.rowSelection,
|
|
1056
1056
|
locale = _this$props8.locale,
|
|
1057
|
-
enableEstimateInitialColumnWidth = _this$props8.enableEstimateInitialColumnWidth
|
|
1058
|
-
keepInitialWidthWhenEstimate = _this$props8.keepInitialWidthWhenEstimate;
|
|
1057
|
+
enableEstimateInitialColumnWidth = _this$props8.enableEstimateInitialColumnWidth;
|
|
1059
1058
|
var leafColIds = [];
|
|
1060
1059
|
var groups = new Map();
|
|
1061
1060
|
var map = function map(cols) {
|
|
@@ -1122,8 +1121,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1122
1121
|
}
|
|
1123
1122
|
var headerName = (_opts$headerName = opts.headerName) !== null && _opts$headerName !== void 0 ? _opts$headerName : def.headerName;
|
|
1124
1123
|
var sortable = (_opts$sortable = opts.sortable) !== null && _opts$sortable !== void 0 ? _opts$sortable : def.sortable;
|
|
1125
|
-
if (enableEstimateInitialColumnWidth && headerName
|
|
1126
|
-
|
|
1124
|
+
if (enableEstimateInitialColumnWidth && headerName) {
|
|
1125
|
+
var _def$initialWidth;
|
|
1126
|
+
opts.initialWidth = Math.max(Math.min(getTextWidth(headerName) * 14 + 36 + (sortable ? 10 : 0) + (opts.headerComponentParams !== undefined ? 24 : 0), ESTIMATE_INITIAL_COLUMN_MAX_WIDTH), (_def$initialWidth = def.initialWidth) !== null && _def$initialWidth !== void 0 ? _def$initialWidth : 0);
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
1129
|
// editable
|
|
@@ -297,11 +297,7 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
|
|
|
297
297
|
useValueFormatterForExport?: boolean;
|
|
298
298
|
};
|
|
299
299
|
/**
|
|
300
|
-
* @depscription 启用预估初始列宽
|
|
300
|
+
* @depscription 启用预估初始列宽 启用后根据字符长度计算宽度,如果列传入了initialWidth,取两者较大值
|
|
301
301
|
*/
|
|
302
302
|
enableEstimateInitialColumnWidth?: boolean;
|
|
303
|
-
/**
|
|
304
|
-
* @depscription 与enableEstimateInitialColumnWidth搭配使用,如果col传入了initialWidth,则不会进行预估初始列宽设置
|
|
305
|
-
*/
|
|
306
|
-
keepInitialWidthWhenEstimate?: boolean;
|
|
307
303
|
}
|
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
|
+
// windows下当前单元格样式拉丁字母大致宽度比例
|
|
5
|
+
var latinWidth = {
|
|
6
|
+
A: 0.75,
|
|
7
|
+
B: 0.75,
|
|
8
|
+
C: 0.75,
|
|
9
|
+
D: 0.75,
|
|
10
|
+
E: 0.67,
|
|
11
|
+
F: 0.6,
|
|
12
|
+
G: 0.82,
|
|
13
|
+
H: 0.75,
|
|
14
|
+
I: 0.3,
|
|
15
|
+
J: 0.6,
|
|
16
|
+
K: 0.75,
|
|
17
|
+
L: 0.6,
|
|
18
|
+
M: 0.97,
|
|
19
|
+
N: 0.75,
|
|
20
|
+
O: 0.82,
|
|
21
|
+
P: 0.67,
|
|
22
|
+
Q: 0.82,
|
|
23
|
+
R: 0.75,
|
|
24
|
+
S: 0.67,
|
|
25
|
+
T: 0.67,
|
|
26
|
+
U: 0.75,
|
|
27
|
+
V: 0.67,
|
|
28
|
+
W: 0.97,
|
|
29
|
+
X: 0.67,
|
|
30
|
+
Y: 0.67,
|
|
31
|
+
Z: 0.67,
|
|
32
|
+
a: 0.6,
|
|
33
|
+
b: 0.67,
|
|
34
|
+
c: 0.6,
|
|
35
|
+
d: 0.67,
|
|
36
|
+
e: 0.6,
|
|
37
|
+
f: 0.37,
|
|
38
|
+
g: 0.67,
|
|
39
|
+
h: 0.6,
|
|
40
|
+
i: 0.3,
|
|
41
|
+
j: 0.3,
|
|
42
|
+
k: 0.6,
|
|
43
|
+
l: 0.3,
|
|
44
|
+
m: 0.97,
|
|
45
|
+
n: 0.6,
|
|
46
|
+
o: 0.67,
|
|
47
|
+
p: 0.67,
|
|
48
|
+
q: 0.67,
|
|
49
|
+
r: 0.37,
|
|
50
|
+
s: 0.6,
|
|
51
|
+
t: 0.37,
|
|
52
|
+
u: 0.6,
|
|
53
|
+
v: 0.52,
|
|
54
|
+
w: 0.82,
|
|
55
|
+
x: 0.6,
|
|
56
|
+
y: 0.52,
|
|
57
|
+
z: 0.52
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// 越南语独立的拉丁字母
|
|
61
|
+
var vietnameseSpecial = {
|
|
62
|
+
đ: 'd',
|
|
63
|
+
Đ: 'D',
|
|
64
|
+
ă: 'a',
|
|
65
|
+
Ă: 'A',
|
|
66
|
+
â: 'a',
|
|
67
|
+
Â: 'A',
|
|
68
|
+
ê: 'e',
|
|
69
|
+
Ê: 'E',
|
|
70
|
+
ô: 'o',
|
|
71
|
+
Ô: 'O',
|
|
72
|
+
ơ: 'o',
|
|
73
|
+
Ơ: 'O',
|
|
74
|
+
ư: 'u',
|
|
75
|
+
Ư: 'U'
|
|
76
|
+
};
|
|
4
77
|
export function getTextWidth(text) {
|
|
5
78
|
var width = 0;
|
|
6
79
|
var _iterator = _createForOfIteratorHelper(text),
|
|
@@ -21,14 +94,15 @@ export function getTextWidth(text) {
|
|
|
21
94
|
continue;
|
|
22
95
|
}
|
|
23
96
|
|
|
24
|
-
//
|
|
97
|
+
// 泰文、高棉文、缅甸文、老挝文;
|
|
25
98
|
if (isSEAComplexScript(code)) {
|
|
26
99
|
width += 1;
|
|
27
100
|
continue;
|
|
28
101
|
}
|
|
29
102
|
|
|
30
103
|
// 拉丁字母、数字、标点;覆盖英文、马来文、越南语预组合字符
|
|
31
|
-
|
|
104
|
+
var letter = char.normalize('NFD')[0];
|
|
105
|
+
width += latinWidth[vietnameseSpecial[letter] || letter] || 0.6;
|
|
32
106
|
}
|
|
33
107
|
} catch (err) {
|
|
34
108
|
_iterator.e(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.5.7-alpha.
|
|
3
|
+
"version": "1.5.7-alpha.5",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://registry.npmjs.org"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6171749dce121811f94a7d5d0c7e0c6782c5e4d5"
|
|
62
62
|
}
|