@lemon-fe/components 0.1.33 → 0.1.43

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.
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties, Key, ReactElement } from 'react';
2
+ import type { TableRowSelection } from 'antd/lib/table/interface';
2
3
  import type { FilterItemType } from '../Filter/typings';
3
4
  import type { ColumnType } from '../BaseTable/typings';
4
5
  interface Props<RecordType, ParamsType> {
@@ -45,6 +46,7 @@ interface Props<RecordType, ParamsType> {
45
46
  style?: CSSProperties;
46
47
  }) => ReactElement;
47
48
  };
49
+ rowSelection?: TableRowSelection<RecordType>;
48
50
  }
49
51
  export default function SelectView<RecordType, ParamsType extends Record<string, any>>(props: Props<RecordType, ParamsType>): JSX.Element;
50
52
  export {};
@@ -41,7 +41,8 @@ export default function SelectView(props) {
41
41
  multiple = _props$multiple === void 0 ? true : _props$multiple,
42
42
  rowKey = props.rowKey,
43
43
  filter = props.filter,
44
- dataSource = props.dataSource;
44
+ dataSource = props.dataSource,
45
+ rowSelection = props.rowSelection;
45
46
  var prefixCls = "".concat(PREFIX_CLS, "-select-view");
46
47
 
47
48
  var _useState = useState(value || []),
@@ -170,15 +171,23 @@ export default function SelectView(props) {
170
171
  }, /*#__PURE__*/React.createElement(Table, {
171
172
  actionRef: list,
172
173
  rowKey: rowKey,
173
- rowSelection: {
174
+ rowSelection: _objectSpread({
174
175
  type: multiple ? 'checkbox' : 'radio',
175
176
  preserveSelectedRowKeys: true,
176
177
  selectedRowKeys: dataKeys,
177
178
  onChange: function onChange(keys, rows) {
178
179
  return handleChangeData(keys, rows);
179
180
  }
180
- },
181
+ }, rowSelection),
181
182
  onRow: function onRow(row) {
183
+ if (rowSelection !== undefined && rowSelection.getCheckboxProps !== undefined) {
184
+ var extra = rowSelection.getCheckboxProps(row);
185
+
186
+ if (extra.disabled) {
187
+ return {};
188
+ }
189
+ }
190
+
182
191
  return {
183
192
  onClick: function onClick() {
184
193
  var key = getRowKey(row);
@@ -189,7 +198,7 @@ export default function SelectView(props) {
189
198
  return item === key;
190
199
  });
191
200
 
192
- if (index > 0) {
201
+ if (index >= 0) {
193
202
  keys.splice(index, 1);
194
203
  } else {
195
204
  keys.push(key);
@@ -235,13 +244,13 @@ export default function SelectView(props) {
235
244
  }, /*#__PURE__*/React.createElement(Table, {
236
245
  dataSource: data,
237
246
  columns: selectedColumns,
238
- rowSelection: {
247
+ rowSelection: _objectSpread({
239
248
  preserveSelectedRowKeys: true,
240
249
  selectedRowKeys: selectedKeys,
241
250
  onChange: function onChange(_, rows) {
242
251
  return setSelected(rows);
243
252
  }
244
- },
253
+ }, rowSelection),
245
254
  rowKey: rowKey
246
255
  }))))));
247
256
  }
package/es/overrides.less CHANGED
@@ -48,6 +48,10 @@ a[title='站长统计'] {
48
48
  }
49
49
  }
50
50
 
51
+ .ant-table-tbody > tr.ant-table-row-selected > td {
52
+ border-color: @table-border-color;
53
+ }
54
+
51
55
  .ant-table-cell {
52
56
  .ant-checkbox-checked .ant-checkbox-inner::after {
53
57
  transition: none !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.33",
3
+ "version": "0.1.43",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -41,5 +41,5 @@
41
41
  "react": "^17.0.2",
42
42
  "react-dom": "^17.0.2"
43
43
  },
44
- "gitHead": "f2fb06c1754f97d24276e0df5e3116665ac57380"
44
+ "gitHead": "ddcaf1a6b0e663addb2e833ad6f172bb7e83e356"
45
45
  }