@zat-design/sisyphus-react 3.7.3-beta.1 → 3.7.3

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,4 @@
1
- import { isEqualWith } from 'lodash';
1
+ import { isEqualWith, isFunction } from 'lodash';
2
2
  import React from 'react';
3
3
  /**
4
4
  * namesPath生产 [['list', 0, 'min'], ['list', 0, 'max']] => list_0_min-list_0_max
@@ -26,9 +26,8 @@ export var memoWith = function memoWith(pre, next) {
26
26
  if ( /*#__PURE__*/React.isValidElement(objValue) && /*#__PURE__*/React.isValidElement(othValue)) {
27
27
  return true;
28
28
  }
29
- // 移除解决formlist函数里不更新问题
30
- // if (isFunction(objValue) && isFunction(othValue)) {
31
- // return true;
32
- // }
29
+ if (isFunction(objValue) && isFunction(othValue)) {
30
+ return true;
31
+ }
33
32
  });
34
33
  };
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
9
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
10
10
  import "antd/es/select/style";
11
11
  import _Select from "antd/es/select";
12
- var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "getValueProps", "isView"];
12
+ var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
15
15
  import React, { useImperativeHandle, useState, forwardRef } from 'react';
@@ -53,11 +53,10 @@ export var ProSelect = function ProSelect(props, ref) {
53
53
  onChange = props.onChange,
54
54
  updateDataSource = props.updateDataSource,
55
55
  transformResponse = props.transformResponse,
56
- getValueProps = props.getValueProps,
57
56
  isViewPro = props.isView,
58
57
  selectProps = _objectWithoutProperties(props, _excluded);
59
58
  selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
60
- var value = getValueProps && props.value ? getValueProps(props.value) : props.value;
59
+ var value = props.value;
61
60
  var _ref2 = ProForm.useFieldProps() || {},
62
61
  isViewCon = _ref2.isView,
63
62
  viewEmpty = _ref2.viewEmpty;
@@ -217,7 +216,6 @@ export var ProSelect = function ProSelect(props, ref) {
217
216
  return props.children;
218
217
  };
219
218
  var handleChange = function handleChange(value, option) {
220
- var getChangeValue = selectProps.getChangeValue;
221
219
  if (selectProps.mode && selectProps.mode === 'multiple') {
222
220
  if (Array.isArray(option)) {
223
221
  option.forEach(function (item) {
@@ -227,14 +225,14 @@ export var ProSelect = function ProSelect(props, ref) {
227
225
  });
228
226
  }
229
227
  if (labelInValue) {
230
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
228
+ onChange === null || onChange === void 0 ? void 0 : onChange(getValueObject(value), option);
231
229
  } else {
232
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value, option);
230
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, option);
233
231
  }
234
232
  } else if (!selectProps.mode && labelInValue) {
235
- onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
233
+ onChange(getValueObject(value), option);
236
234
  } else {
237
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value, option === null || option === void 0 ? void 0 : option.record);
235
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, option === null || option === void 0 ? void 0 : option.record);
238
236
  }
239
237
  };
240
238
  /**
@@ -280,7 +278,7 @@ export var ProSelect = function ProSelect(props, ref) {
280
278
  if ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.listName) && filterInList) {
281
279
  newSelectList = getSelectList({
282
280
  otherProps: otherProps,
283
- value: value,
281
+ value: props.value,
284
282
  dataSource: selectList,
285
283
  labelInValue: labelInValue,
286
284
  fieldNames: fieldNames,
@@ -46,10 +46,6 @@ export interface PropSelectProps extends Omit<SelectProps, 'onSearch'> {
46
46
  onSearch?: (value: string, useRequest: Result<any, any>) => void;
47
47
  /** 自定义展示 */
48
48
  optionRender?: (value: DataOption) => string | ReactNode;
49
- /** 用来转换修改value值 和 getValueProps配合使用 */
50
- getChangeValue?: (value: DataOption) => any;
51
- /** 用来转换传入的value值 getChangeValue配合使用 */
52
- getValueProps?: (value: DataOption) => any;
53
49
  }
54
50
  export interface ProSelectAction {
55
51
  /** 实例方法、根据 code | code[] 批量获取数据 */
@@ -33,9 +33,8 @@ var memoWith = exports.memoWith = function memoWith(pre, next) {
33
33
  if ( /*#__PURE__*/_react.default.isValidElement(objValue) && /*#__PURE__*/_react.default.isValidElement(othValue)) {
34
34
  return true;
35
35
  }
36
- // 移除解决formlist函数里不更新问题
37
- // if (isFunction(objValue) && isFunction(othValue)) {
38
- // return true;
39
- // }
36
+ if ((0, _lodash.isFunction)(objValue) && (0, _lodash.isFunction)(othValue)) {
37
+ return true;
38
+ }
40
39
  });
41
40
  };
@@ -21,7 +21,7 @@ var _ = require("..");
21
21
  var _locale = _interopRequireDefault(require("../locale"));
22
22
  var _utils = require("./utils");
23
23
  require("./index.less");
24
- var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "getValueProps", "isView"];
24
+ var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
25
25
  var Option = _antd.Select.Option;
26
26
  var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
27
27
  var _selectProps$showCode, _locale$ProSelect;
@@ -54,11 +54,10 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
54
54
  onChange = props.onChange,
55
55
  updateDataSource = props.updateDataSource,
56
56
  transformResponse = props.transformResponse,
57
- getValueProps = props.getValueProps,
58
57
  isViewPro = props.isView,
59
58
  selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
60
59
  selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
61
- var value = getValueProps && props.value ? getValueProps(props.value) : props.value;
60
+ var value = props.value;
62
61
  var _ref2 = _.ProForm.useFieldProps() || {},
63
62
  isViewCon = _ref2.isView,
64
63
  viewEmpty = _ref2.viewEmpty;
@@ -218,7 +217,6 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
218
217
  return props.children;
219
218
  };
220
219
  var handleChange = function handleChange(value, option) {
221
- var getChangeValue = selectProps.getChangeValue;
222
220
  if (selectProps.mode && selectProps.mode === 'multiple') {
223
221
  if (Array.isArray(option)) {
224
222
  option.forEach(function (item) {
@@ -228,14 +226,14 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
228
226
  });
229
227
  }
230
228
  if (labelInValue) {
231
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
229
+ onChange === null || onChange === void 0 ? void 0 : onChange(getValueObject(value), option);
232
230
  } else {
233
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value, option);
231
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, option);
234
232
  }
235
233
  } else if (!selectProps.mode && labelInValue) {
236
- onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
234
+ onChange(getValueObject(value), option);
237
235
  } else {
238
- onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value, option === null || option === void 0 ? void 0 : option.record);
236
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, option === null || option === void 0 ? void 0 : option.record);
239
237
  }
240
238
  };
241
239
  /**
@@ -281,7 +279,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
281
279
  if ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.listName) && filterInList) {
282
280
  newSelectList = (0, _utils.getSelectList)({
283
281
  otherProps: otherProps,
284
- value: value,
282
+ value: props.value,
285
283
  dataSource: selectList,
286
284
  labelInValue: labelInValue,
287
285
  fieldNames: fieldNames,
@@ -46,10 +46,6 @@ export interface PropSelectProps extends Omit<SelectProps, 'onSearch'> {
46
46
  onSearch?: (value: string, useRequest: Result<any, any>) => void;
47
47
  /** 自定义展示 */
48
48
  optionRender?: (value: DataOption) => string | ReactNode;
49
- /** 用来转换修改value值 和 getValueProps配合使用 */
50
- getChangeValue?: (value: DataOption) => any;
51
- /** 用来转换传入的value值 getChangeValue配合使用 */
52
- getValueProps?: (value: DataOption) => any;
53
49
  }
54
50
  export interface ProSelectAction {
55
51
  /** 实例方法、根据 code | code[] 批量获取数据 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3-beta.1",
3
+ "version": "3.7.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",