@hi-ui/hiui 3.9.0-rc → 3.9.0-rc.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/CHANGELOG.md +2 -1
- package/es/table/BodyTable.js +2 -1
- package/es/table/HeaderTable.js +7 -4
- package/es/table/Row.js +2 -1
- package/es/table/Table.js +4 -1
- package/es/table/index.d.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
# 3.8.0-rc
|
|
4
4
|
|
|
5
5
|
- 新增 `Table` 组件 `hiddenColKeys` 和 `onHiddenColKeysChange` 受控控制列显隐 [#1994](https://github.com/XiaoMi/hiui/issues/1994)
|
|
6
|
-
- 新增 `Input`
|
|
6
|
+
- 新增 `Input` 组件支持 placeholder 受控动态更新 [#1982](https://github.com/XiaoMi/hiui/issues/1982)
|
|
7
|
+
- 新增 `Table` 组件支持 checkAll 复选框右侧自定义操作按钮 [#2007](https://github.com/XiaoMi/hiui/issues/2007)
|
|
7
8
|
- 修复 `Select` 组件高亮词搜索存在正则注入 [#1972](https://github.com/XiaoMi/hiui/issues/1972)
|
|
8
9
|
- 修复 `Table` 组件 resizable 调节列宽功能失效 [#1970](https://github.com/XiaoMi/hiui/issues/1970)
|
|
9
10
|
- 修复 `Input` 组件的 placeholder 没法动态更新 [#1970](https://github.com/XiaoMi/hiui/issues/1982)
|
package/es/table/BodyTable.js
CHANGED
|
@@ -32,6 +32,7 @@ var BodyTable = function BodyTable(_ref) {
|
|
|
32
32
|
emptyContent = _ref.emptyContent;
|
|
33
33
|
|
|
34
34
|
var _useContext = (0, _react.useContext)(_context["default"]),
|
|
35
|
+
checkboxColWidth = _useContext.checkboxColWidth,
|
|
35
36
|
bordered = _useContext.bordered,
|
|
36
37
|
_useContext$data = _useContext.data,
|
|
37
38
|
data = _useContext$data === void 0 ? [] : _useContext$data,
|
|
@@ -238,7 +239,7 @@ var BodyTable = function BodyTable(_ref) {
|
|
|
238
239
|
}, /*#__PURE__*/_react["default"].createElement("table", {
|
|
239
240
|
ref: tableRef
|
|
240
241
|
}, /*#__PURE__*/_react["default"].createElement("colgroup", null, columnsgroup.map(function (c, index) {
|
|
241
|
-
var width = c === 'checkbox' ?
|
|
242
|
+
var width = c === 'checkbox' ? checkboxColWidth : c.width;
|
|
242
243
|
return /*#__PURE__*/_react["default"].createElement("col", {
|
|
243
244
|
key: index,
|
|
244
245
|
className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, "".concat(prefix, "__col__hover--highlight"), showColHighlight && hoverColIndex === c.dataKey)),
|
package/es/table/HeaderTable.js
CHANGED
|
@@ -39,6 +39,7 @@ var HeaderTable = function HeaderTable(_ref) {
|
|
|
39
39
|
var rightFixedIndex = _ref.rightFixedIndex;
|
|
40
40
|
|
|
41
41
|
var _useContext = (0, _react.useContext)(_context["default"]),
|
|
42
|
+
checkboxColWidth = _useContext.checkboxColWidth,
|
|
42
43
|
rowSelection = _useContext.rowSelection,
|
|
43
44
|
propsData = _useContext.data,
|
|
44
45
|
columns = _useContext.columns,
|
|
@@ -189,7 +190,9 @@ var HeaderTable = function HeaderTable(_ref) {
|
|
|
189
190
|
return col.sorter;
|
|
190
191
|
}).map(function (sorterCol) {
|
|
191
192
|
return sorterCol.dataKey;
|
|
192
|
-
}); //
|
|
193
|
+
}); // 自定义 checkboxAll 侧边 icon
|
|
194
|
+
|
|
195
|
+
var checkboxFilterIcon = rowSelection && rowSelection.checkAllOptions && rowSelection.checkAllOptions.filterIcon || null; // ******************** 行渲染 ***********************
|
|
193
196
|
|
|
194
197
|
var renderBaseRow = function renderBaseRow(cols, index, isSticky) {
|
|
195
198
|
var _colums = [rowSelection && index === 0 && 'checkbox', expandedRender && index === 0 && 'expandedButton'].concat(cols).filter(function (column) {
|
|
@@ -214,7 +217,7 @@ var HeaderTable = function HeaderTable(_ref) {
|
|
|
214
217
|
}),
|
|
215
218
|
style: {
|
|
216
219
|
boxSizing: 'border-box',
|
|
217
|
-
width:
|
|
220
|
+
width: checkboxColWidth,
|
|
218
221
|
height: 'auto',
|
|
219
222
|
backgroundColor: '#fbfbfb'
|
|
220
223
|
}
|
|
@@ -232,7 +235,7 @@ var HeaderTable = function HeaderTable(_ref) {
|
|
|
232
235
|
rowSelection.onChange(selectedIds, targetItems, !isAllChecked);
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
|
-
}));
|
|
238
|
+
}), checkboxFilterIcon);
|
|
236
239
|
} else if (c === 'expandedButton') {
|
|
237
240
|
cell = /*#__PURE__*/_react["default"].createElement("th", {
|
|
238
241
|
key: "expandedButton",
|
|
@@ -343,7 +346,7 @@ var HeaderTable = function HeaderTable(_ref) {
|
|
|
343
346
|
return /*#__PURE__*/_react["default"].createElement("col", {
|
|
344
347
|
key: index,
|
|
345
348
|
style: {
|
|
346
|
-
width: c === 'checkbox' ?
|
|
349
|
+
width: c === 'checkbox' ? checkboxColWidth : width,
|
|
347
350
|
minWidth: width
|
|
348
351
|
}
|
|
349
352
|
});
|
package/es/table/Row.js
CHANGED
|
@@ -76,6 +76,7 @@ var Row = function Row(_ref) {
|
|
|
76
76
|
}, [propsExpanded]);
|
|
77
77
|
|
|
78
78
|
var _useContext = (0, _react.useContext)(_context["default"]),
|
|
79
|
+
checkboxColWidth = _useContext.checkboxColWidth,
|
|
79
80
|
errorRowKeys = _useContext.errorRowKeys,
|
|
80
81
|
rowSelection = _useContext.rowSelection,
|
|
81
82
|
highlightedRowKeys = _useContext.highlightedRowKeys,
|
|
@@ -177,7 +178,7 @@ var Row = function Row(_ref) {
|
|
|
177
178
|
}
|
|
178
179
|
}, rowSelection && isFixed !== 'right' && !isSumRow && !isAvgRow && /*#__PURE__*/_react["default"].createElement("td", {
|
|
179
180
|
style: {
|
|
180
|
-
width:
|
|
181
|
+
width: checkboxColWidth
|
|
181
182
|
},
|
|
182
183
|
className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, "".concat(prefix, "__col--sticky"), isSticky))
|
|
183
184
|
}, /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
package/es/table/Table.js
CHANGED
|
@@ -445,9 +445,12 @@ var Table = function Table(_ref) {
|
|
|
445
445
|
} else {
|
|
446
446
|
onDropCallback && updateData();
|
|
447
447
|
}
|
|
448
|
-
}, [data, draggable]);
|
|
448
|
+
}, [data, draggable]); // 自定义设置 checkbox 列宽度
|
|
449
|
+
|
|
450
|
+
var checkboxColWidth = rowSelection && typeof rowSelection.checkboxColWidth === 'number' ? rowSelection.checkboxColWidth : 50;
|
|
449
451
|
return /*#__PURE__*/_react["default"].createElement(_context["default"].Provider, {
|
|
450
452
|
value: {
|
|
453
|
+
checkboxColWidth: checkboxColWidth,
|
|
451
454
|
disabledData: disabledData,
|
|
452
455
|
rowExpandable: rowExpandable,
|
|
453
456
|
setting: setting,
|
package/es/table/index.d.ts
CHANGED
|
@@ -38,10 +38,17 @@ export type TableFixedOption = {
|
|
|
38
38
|
left?: string
|
|
39
39
|
right?: string
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
export type TableCheckAllOptions = {
|
|
43
|
+
filterIcon?: React.ReactNode
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
export type TableRowSelection = {
|
|
42
47
|
selectedRowKeys?: string[] | number[]
|
|
43
48
|
getCheckboxConfig?: (rowData: object) => object
|
|
44
49
|
onChange?: (selectedRowKeys: string | number, targetRow?: object | object[], shouldChecked?: boolean) => void
|
|
50
|
+
checkboxColWidth?: number
|
|
51
|
+
checkAllOptions?: TableCheckAllOptions
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
export type TableHeaderRowReturn = {
|
package/package.json
CHANGED