@zat-design/sisyphus-react 3.6.6-beta.3 → 3.6.6-beta.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.
@@ -591,7 +591,7 @@ var RenderField = function RenderField(_ref) {
591
591
  }) : null;
592
592
  return _jsx(FieldProvider, {
593
593
  value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
594
- children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
594
+ children: !originalTitle || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
595
595
  title: originalTitle,
596
596
  placement: "topLeft",
597
597
  open: changed ? undefined : false,
@@ -221,7 +221,9 @@ var ProCascader = function ProCascader(props) {
221
221
  // 如果没有在当前层级的选项中找到匹配的 value,返回 null
222
222
  return null;
223
223
  };
224
- var _selectedOptions = findSelectedOptions(service ? serviceData : realDataSource, addressValue);
224
+ var _selectedOptions = useMemo(function () {
225
+ return findSelectedOptions(service ? serviceData : realDataSource, addressValue);
226
+ }, [service, serviceData, realDataSource, addressValue]);
225
227
  var handleAddressChange = function handleAddressChange(e) {
226
228
  var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
227
229
  if (onChange) {
@@ -338,7 +338,7 @@ export var ProSelect = function ProSelect(props, ref) {
338
338
  title: OptionRender(item),
339
339
  children: OptionRender(item)
340
340
  }) : _jsx("span", {
341
- title: "".concat(item[code], "-").concat(item[label]),
341
+ title: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
342
342
  children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
343
343
  })
344
344
  }, item[code])
@@ -72,11 +72,12 @@ export interface PaginationProps {
72
72
  pageNum: number;
73
73
  pageSize: number;
74
74
  }
75
+ type RowSelectionTypeWithPick = Pick<TableProps<any>, 'rowSelection'>['rowSelection'];
75
76
  export interface RequestOptions<T, R> {
76
77
  form?: FormInstance;
77
78
  isResetQuery?: boolean;
78
79
  rowKey?: string | GetRowKey<R>;
79
- rowSelection?: boolean;
80
+ rowSelection?: boolean | RowSelectionTypeWithPick;
80
81
  rowSelectType?: RowSelectionType;
81
82
  rowSelections?: boolean;
82
83
  extraParams?: Partial<T>;
@@ -11,7 +11,7 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
11
11
  selectedRowKeys: Key[];
12
12
  onChange(rowKeys: Key[], rows: any[]): void;
13
13
  onSelectAll: (selected: boolean) => void;
14
- getCheckboxProps: () => {
14
+ getCheckboxProps: (record?: any) => {
15
15
  className: string;
16
16
  };
17
17
  selections: boolean | ({
@@ -57,7 +57,7 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
57
57
  selectedRowKeys: Key[];
58
58
  onChange(rowKeys: Key[], rows: any[]): void;
59
59
  onSelectAll: (selected: boolean) => void;
60
- getCheckboxProps: () => {
60
+ getCheckboxProps: (record?: any) => {
61
61
  className: string;
62
62
  };
63
63
  selections: boolean | ({
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
9
  var _excluded = ["page", "filters", "sorter"];
10
10
  import { useCallback, useMemo, useState } from 'react';
11
11
  import { useRequest, useSetState, useDeepCompareEffect } from 'ahooks';
12
- import { pickBy } from 'lodash';
12
+ import { pickBy, isObject, merge, set, isEqual } from 'lodash';
13
13
  import { defaultPage } from './index';
14
14
  import { isListResult } from './utils';
15
15
  import locale, { formatMessage } from '../locale';
@@ -313,7 +313,7 @@ function useAntdTable(service, options, useRequestOptions) {
313
313
  }));
314
314
  }
315
315
  }, [extraParams]);
316
- var rowSelection = {
316
+ var _rowSelection = {
317
317
  fixed: true,
318
318
  type: rowSelectType,
319
319
  columnWidth: rowSelections ? 64 : undefined,
@@ -355,7 +355,7 @@ function useAntdTable(service, options, useRequestOptions) {
355
355
  });
356
356
  }
357
357
  },
358
- getCheckboxProps: function getCheckboxProps() {
358
+ getCheckboxProps: function getCheckboxProps(record) {
359
359
  return {
360
360
  className: allSelected && rowSelections ? 'checkbox-disabled' : ''
361
361
  };
@@ -424,6 +424,20 @@ function useAntdTable(service, options, useRequestOptions) {
424
424
  }()
425
425
  }] : false
426
426
  };
427
+ var rowSelection = isObject(returnRowSelection) ? merge(_rowSelection, returnRowSelection) : _rowSelection;
428
+ if (isObject(returnRowSelection) && !isEqual(rowSelection, _rowSelection)) {
429
+ // getCheckboxProps需要特殊兼容原有的逻辑,特殊处理
430
+ var isHasGetCheckboxProps = Reflect.ownKeys(returnRowSelection).includes('getCheckboxProps');
431
+ if (isHasGetCheckboxProps) {
432
+ set(rowSelection, 'getCheckboxProps', function (record) {
433
+ var _rowSelection$getChec;
434
+ var passReturnObjects = (_rowSelection$getChec = rowSelection.getCheckboxProps(record)) !== null && _rowSelection$getChec !== void 0 ? _rowSelection$getChec : {};
435
+ return _objectSpread({
436
+ className: allSelected && rowSelections ? 'checkbox-disabled' : ''
437
+ }, passReturnObjects);
438
+ });
439
+ }
440
+ }
427
441
  var selectedTip = allSelected || selectedRowKeys.length ? formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable5 = locale.ProTable) === null || _locale$ProTable5 === void 0 ? void 0 : _locale$ProTable5.selectAll, {
428
442
  selectedNum: allSelected ? total : selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length
429
443
  }) : null;
@@ -594,7 +594,7 @@ var RenderField = function RenderField(_ref) {
594
594
  }) : null;
595
595
  return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
596
596
  value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
597
- children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
597
+ children: !originalTitle || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
598
598
  title: originalTitle,
599
599
  placement: "topLeft",
600
600
  open: changed ? undefined : false,
@@ -221,7 +221,9 @@ var ProCascader = function ProCascader(props) {
221
221
  // 如果没有在当前层级的选项中找到匹配的 value,返回 null
222
222
  return null;
223
223
  };
224
- var _selectedOptions = findSelectedOptions(service ? serviceData : realDataSource, addressValue);
224
+ var _selectedOptions = (0, _react.useMemo)(function () {
225
+ return findSelectedOptions(service ? serviceData : realDataSource, addressValue);
226
+ }, [service, serviceData, realDataSource, addressValue]);
225
227
  var handleAddressChange = function handleAddressChange(e) {
226
228
  var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
227
229
  if (onChange) {
@@ -341,7 +341,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
341
341
  title: OptionRender(item),
342
342
  children: OptionRender(item)
343
343
  }) : (0, _jsxRuntime.jsx)("span", {
344
- title: "".concat(item[code], "-").concat(item[label]),
344
+ title: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
345
345
  children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
346
346
  })
347
347
  }, item[code])
@@ -72,11 +72,12 @@ export interface PaginationProps {
72
72
  pageNum: number;
73
73
  pageSize: number;
74
74
  }
75
+ type RowSelectionTypeWithPick = Pick<TableProps<any>, 'rowSelection'>['rowSelection'];
75
76
  export interface RequestOptions<T, R> {
76
77
  form?: FormInstance;
77
78
  isResetQuery?: boolean;
78
79
  rowKey?: string | GetRowKey<R>;
79
- rowSelection?: boolean;
80
+ rowSelection?: boolean | RowSelectionTypeWithPick;
80
81
  rowSelectType?: RowSelectionType;
81
82
  rowSelections?: boolean;
82
83
  extraParams?: Partial<T>;
@@ -11,7 +11,7 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
11
11
  selectedRowKeys: Key[];
12
12
  onChange(rowKeys: Key[], rows: any[]): void;
13
13
  onSelectAll: (selected: boolean) => void;
14
- getCheckboxProps: () => {
14
+ getCheckboxProps: (record?: any) => {
15
15
  className: string;
16
16
  };
17
17
  selections: boolean | ({
@@ -57,7 +57,7 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
57
57
  selectedRowKeys: Key[];
58
58
  onChange(rowKeys: Key[], rows: any[]): void;
59
59
  onSelectAll: (selected: boolean) => void;
60
- getCheckboxProps: () => {
60
+ getCheckboxProps: (record?: any) => {
61
61
  className: string;
62
62
  };
63
63
  selections: boolean | ({
@@ -320,7 +320,7 @@ function useAntdTable(service, options, useRequestOptions) {
320
320
  }));
321
321
  }
322
322
  }, [extraParams]);
323
- var rowSelection = {
323
+ var _rowSelection = {
324
324
  fixed: true,
325
325
  type: rowSelectType,
326
326
  columnWidth: rowSelections ? 64 : undefined,
@@ -362,7 +362,7 @@ function useAntdTable(service, options, useRequestOptions) {
362
362
  });
363
363
  }
364
364
  },
365
- getCheckboxProps: function getCheckboxProps() {
365
+ getCheckboxProps: function getCheckboxProps(record) {
366
366
  return {
367
367
  className: allSelected && rowSelections ? 'checkbox-disabled' : ''
368
368
  };
@@ -431,6 +431,20 @@ function useAntdTable(service, options, useRequestOptions) {
431
431
  }()
432
432
  }] : false
433
433
  };
434
+ var rowSelection = (0, _lodash.isObject)(returnRowSelection) ? (0, _lodash.merge)(_rowSelection, returnRowSelection) : _rowSelection;
435
+ if ((0, _lodash.isObject)(returnRowSelection) && !(0, _lodash.isEqual)(rowSelection, _rowSelection)) {
436
+ // getCheckboxProps需要特殊兼容原有的逻辑,特殊处理
437
+ var isHasGetCheckboxProps = Reflect.ownKeys(returnRowSelection).includes('getCheckboxProps');
438
+ if (isHasGetCheckboxProps) {
439
+ (0, _lodash.set)(rowSelection, 'getCheckboxProps', function (record) {
440
+ var _rowSelection$getChec;
441
+ var passReturnObjects = (_rowSelection$getChec = rowSelection.getCheckboxProps(record)) !== null && _rowSelection$getChec !== void 0 ? _rowSelection$getChec : {};
442
+ return (0, _objectSpread2.default)({
443
+ className: allSelected && rowSelections ? 'checkbox-disabled' : ''
444
+ }, passReturnObjects);
445
+ });
446
+ }
447
+ }
434
448
  var selectedTip = allSelected || selectedRowKeys.length ? (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable5 = _locale.default.ProTable) === null || _locale$ProTable5 === void 0 ? void 0 : _locale$ProTable5.selectAll, {
435
449
  selectedNum: allSelected ? total : selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length
436
450
  }) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.6-beta.3",
3
+ "version": "3.6.6-beta.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",