@zat-design/sisyphus-react 3.4.3-beta.13 → 3.4.3-beta.15

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.
Files changed (25) hide show
  1. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  2. package/es/ProForm/components/combination/FormList/components/ActionButton.js +3 -2
  3. package/es/ProForm/components/combination/FormList/components/BlockFields.js +2 -1
  4. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -4
  5. package/es/ProForm/components/combination/ProModalSelect/index.js +3 -11
  6. package/es/ProForm/components/old/ProAddress/index.d.ts +1 -0
  7. package/es/ProForm/components/old/ProRangeBox/index.d.ts +1 -0
  8. package/es/ProForm/components/render/ConfirmWrapper.js +8 -2
  9. package/es/ProForm/components/render/propsType.d.ts +3 -3
  10. package/es/ProForm/utils/index.js +1 -1
  11. package/es/ProTree/components/CloseIcon.d.ts +1 -0
  12. package/es/ProTreeModal/components/CloseIcon.d.ts +1 -0
  13. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  14. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +3 -2
  15. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +2 -1
  16. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -4
  17. package/lib/ProForm/components/combination/ProModalSelect/index.js +3 -11
  18. package/lib/ProForm/components/old/ProAddress/index.d.ts +1 -0
  19. package/lib/ProForm/components/old/ProRangeBox/index.d.ts +1 -0
  20. package/lib/ProForm/components/render/ConfirmWrapper.js +8 -2
  21. package/lib/ProForm/components/render/propsType.d.ts +3 -3
  22. package/lib/ProForm/utils/index.js +1 -1
  23. package/lib/ProTree/components/CloseIcon.d.ts +1 -0
  24. package/lib/ProTreeModal/components/CloseIcon.d.ts +1 -0
  25. package/package.json +1 -1
@@ -17,6 +17,7 @@ export interface Props {
17
17
  fields: FormListFieldData[];
18
18
  mode: FormListMode;
19
19
  disabled?: boolean;
20
+ isView?: boolean;
20
21
  }
21
22
  declare const ActionButton: React.FC<Props>;
22
23
  export default ActionButton;
@@ -116,7 +116,8 @@ var ActionButton = function ActionButton(props) {
116
116
  fields = props.fields,
117
117
  min = props.min,
118
118
  max = props.max,
119
- mode = props.mode;
119
+ mode = props.mode,
120
+ isView = props.isView;
120
121
  // 默认显示一个delete
121
122
  var actionProps = useMemo(function () {
122
123
  var _props$actionProps;
@@ -167,7 +168,7 @@ var ActionButton = function ActionButton(props) {
167
168
  var _onClick = onClick || onHandle;
168
169
  if (['add', 'delete', 'copy', 'moveUp', 'moveDown'].includes(actionType)) {
169
170
  // 禁用状态默认隐藏内置操作按钮
170
- if (disabled) return _jsx(_Fragment, {});
171
+ if (disabled || isView) return _jsx(_Fragment, {});
171
172
  var _defaultActions$actio = defaultActions[actionType],
172
173
  internalOnClick = _defaultActions$actio.onClick,
173
174
  defaultLabel = _defaultActions$actio.label,
@@ -59,7 +59,8 @@ var BlockFields = function BlockFields(props) {
59
59
  fields: fields,
60
60
  actionProps: actionProps,
61
61
  mode: mode,
62
- disabled: disabled
62
+ disabled: disabled,
63
+ isView: isView
63
64
  }),
64
65
  children: _jsx(_Row, {
65
66
  gutter: 24,
@@ -59,9 +59,6 @@ var ToolbarButton = function ToolbarButton(props) {
59
59
  operation.add(data);
60
60
  }
61
61
  };
62
- if (disabled || isView) {
63
- return null;
64
- }
65
62
  return _jsx(_Space, {
66
63
  align: "start",
67
64
  className: "pro-form-list-toolbar",
@@ -80,7 +77,7 @@ var ToolbarButton = function ToolbarButton(props) {
80
77
  rest = _objectWithoutProperties(item, _excluded);
81
78
  var _onClick = _onClick2 || onHandle;
82
79
  if (['add'].includes(actionType)) {
83
- if (disabled) return _jsx(_Fragment, {});
80
+ if (disabled || isView) return _jsx(_Fragment, {});
84
81
  var _actions$actionType = actions[actionType],
85
82
  internalOnClick = _actions$actionType.onClick,
86
83
  defaultLabel = _actions$actionType.label,
@@ -227,15 +227,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
227
227
  var handleSelectValue = function handleSelectValue(val, option) {
228
228
  onChange(val, option);
229
229
  };
230
- // 清空表单项
231
- var handleClearValue = function handleClearValue() {
232
- onChange(undefined, {});
233
- setState({
234
- _value: undefined,
235
- selectedRowKeys: [],
236
- selectedRows: []
237
- });
238
- };
239
230
  var handleClick = /*#__PURE__*/function () {
240
231
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
241
232
  var _yield$beforeOpen, res;
@@ -625,7 +616,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
625
616
  setState({
626
617
  isInit: false
627
618
  });
628
- }, 0);
619
+ }, 300);
629
620
  } else {
630
621
  getInitValues();
631
622
  }
@@ -674,9 +665,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
674
665
  showCodeName: showCodeName,
675
666
  labelInValue: labelInValue,
676
667
  dataSource: options,
668
+ scrollFollowParent: false,
677
669
  onClick: function onClick() {
678
670
  // 没有值的时候,初始化点击默认查询前五十条
679
- if (!value && isInit) {
671
+ if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
680
672
  var _useRequest$options9;
681
673
  var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
682
674
  var params = withPagination ? {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProAddressPropsType } from './propsTypes';
2
3
  export declare const transferAddressInfoToRegion: () => {
3
4
  normalize: (value: any) => {
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { ProRangeBoxPropsType } from './propsType';
2
3
  export default function ProRangeBox({ configOption }: ProRangeBoxPropsType): JSX.Element;
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "antd/es/modal/style";
3
3
  import _Modal from "antd/es/modal";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["onChange", "children", "confirm"];
5
+ var _excluded = ["onChange", "children", "confirm", "otherProps"];
6
6
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
7
7
  import { isFunction, isObject } from 'lodash';
8
8
  import React from 'react';
@@ -15,6 +15,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
15
15
  var onChange = props.onChange,
16
16
  children = props.children,
17
17
  confirm = props.confirm,
18
+ otherProps = props.otherProps,
18
19
  rest = _objectWithoutProperties(props, _excluded);
19
20
  var _ProForm$useFieldProp = ProForm.useFieldProps(),
20
21
  form = _ProForm$useFieldProp.form;
@@ -23,7 +24,12 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
23
24
  other[_key - 1] = arguments[_key];
24
25
  }
25
26
  var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
26
- var confirmProps = isFunction(confirm) ? confirm(form.getFieldsValue()) : confirm;
27
+ var confirmProps = isFunction(confirm) ? confirm(value, form.getFieldsValue(), {
28
+ option: other[0],
29
+ form: form,
30
+ namePath: otherProps.namePath,
31
+ index: otherProps.index
32
+ }) : confirm;
27
33
  if (confirmProps === true) {
28
34
  _Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
29
35
  onOk: function onOk() {
@@ -52,12 +52,12 @@ interface ControlProps {
52
52
  /**
53
53
  * 扩展函数的参数
54
54
  */
55
- type FunctionArgs<Values> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
55
+ type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
56
56
  form: FormInstance<Values>;
57
57
  index?: number;
58
58
  namePath?: NamePath;
59
59
  [key: string]: any;
60
- }) => any;
60
+ }) => R;
61
61
  type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
62
62
  value?: T['value'];
63
63
  onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
@@ -220,7 +220,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
220
220
  extra?: string | React.ReactNode;
221
221
  /** 是否固定字段, 不隐藏 */
222
222
  fixed?: boolean;
223
- confirm?: boolean | ModalFuncProps | ((values: Values) => boolean | ModalFuncProps);
223
+ confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
224
224
  }
225
225
  export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
226
226
  /**
@@ -135,7 +135,7 @@ export var filterInternalFields = function filterInternalFields(values) {
135
135
  if (isObject(nextValues)) {
136
136
  var result = {};
137
137
  Object.keys(nextValues).forEach(function (key) {
138
- // if (key.includes('-')) return;
138
+ if (key.includes('-')) return;
139
139
  result[key] = filterInternalFields(nextValues[key]);
140
140
  });
141
141
  return result;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare function CloseIcon(props: any): JSX.Element;
2
3
  export default CloseIcon;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare function CloseIcon(props: any): JSX.Element;
2
3
  export default CloseIcon;
@@ -17,6 +17,7 @@ export interface Props {
17
17
  fields: FormListFieldData[];
18
18
  mode: FormListMode;
19
19
  disabled?: boolean;
20
+ isView?: boolean;
20
21
  }
21
22
  declare const ActionButton: React.FC<Props>;
22
23
  export default ActionButton;
@@ -117,7 +117,8 @@ var ActionButton = function ActionButton(props) {
117
117
  fields = props.fields,
118
118
  min = props.min,
119
119
  max = props.max,
120
- mode = props.mode;
120
+ mode = props.mode,
121
+ isView = props.isView;
121
122
  // 默认显示一个delete
122
123
  var actionProps = (0, _react.useMemo)(function () {
123
124
  var _props$actionProps;
@@ -168,7 +169,7 @@ var ActionButton = function ActionButton(props) {
168
169
  var _onClick = onClick || onHandle;
169
170
  if (['add', 'delete', 'copy', 'moveUp', 'moveDown'].includes(actionType)) {
170
171
  // 禁用状态默认隐藏内置操作按钮
171
- if (disabled) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
172
+ if (disabled || isView) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
172
173
  var _defaultActions$actio = defaultActions[actionType],
173
174
  internalOnClick = _defaultActions$actio.onClick,
174
175
  defaultLabel = _defaultActions$actio.label,
@@ -63,7 +63,8 @@ var BlockFields = function BlockFields(props) {
63
63
  fields: fields,
64
64
  actionProps: actionProps,
65
65
  mode: mode,
66
- disabled: disabled
66
+ disabled: disabled,
67
+ isView: isView
67
68
  }),
68
69
  children: (0, _jsxRuntime.jsx)(_antd.Row, {
69
70
  gutter: 24,
@@ -63,9 +63,6 @@ var ToolbarButton = function ToolbarButton(props) {
63
63
  operation.add(data);
64
64
  }
65
65
  };
66
- if (disabled || isView) {
67
- return null;
68
- }
69
66
  return (0, _jsxRuntime.jsx)(_antd.Space, {
70
67
  align: "start",
71
68
  className: "pro-form-list-toolbar",
@@ -84,7 +81,7 @@ var ToolbarButton = function ToolbarButton(props) {
84
81
  rest = (0, _objectWithoutProperties2.default)(item, _excluded);
85
82
  var _onClick = _onClick2 || onHandle;
86
83
  if (['add'].includes(actionType)) {
87
- if (disabled) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
84
+ if (disabled || isView) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
88
85
  var _actions$actionType = actions[actionType],
89
86
  internalOnClick = _actions$actionType.onClick,
90
87
  defaultLabel = _actions$actionType.label,
@@ -224,15 +224,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
224
224
  var handleSelectValue = function handleSelectValue(val, option) {
225
225
  onChange(val, option);
226
226
  };
227
- // 清空表单项
228
- var handleClearValue = function handleClearValue() {
229
- onChange(undefined, {});
230
- setState({
231
- _value: undefined,
232
- selectedRowKeys: [],
233
- selectedRows: []
234
- });
235
- };
236
227
  var handleClick = /*#__PURE__*/function () {
237
228
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
238
229
  var _yield$beforeOpen, res;
@@ -622,7 +613,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
622
613
  setState({
623
614
  isInit: false
624
615
  });
625
- }, 0);
616
+ }, 300);
626
617
  } else {
627
618
  getInitValues();
628
619
  }
@@ -671,9 +662,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
671
662
  showCodeName: showCodeName,
672
663
  labelInValue: labelInValue,
673
664
  dataSource: options,
665
+ scrollFollowParent: false,
674
666
  onClick: function onClick() {
675
667
  // 没有值的时候,初始化点击默认查询前五十条
676
- if (!value && isInit) {
668
+ if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
677
669
  var _useRequest$options9;
678
670
  var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
679
671
  var params = withPagination ? {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProAddressPropsType } from './propsTypes';
2
3
  export declare const transferAddressInfoToRegion: () => {
3
4
  normalize: (value: any) => {
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { ProRangeBoxPropsType } from './propsType';
2
3
  export default function ProRangeBox({ configOption }: ProRangeBoxPropsType): JSX.Element;
@@ -12,7 +12,7 @@ var _lodash = require("lodash");
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
  var _antd = require("antd");
14
14
  var _index = _interopRequireDefault(require("../../index"));
15
- var _excluded = ["onChange", "children", "confirm"];
15
+ var _excluded = ["onChange", "children", "confirm", "otherProps"];
16
16
  var defaultConfirmProps = {
17
17
  title: '操作提示',
18
18
  content: '确定要修改该字段吗?'
@@ -21,6 +21,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
21
21
  var onChange = props.onChange,
22
22
  children = props.children,
23
23
  confirm = props.confirm,
24
+ otherProps = props.otherProps,
24
25
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
25
26
  var _ProForm$useFieldProp = _index.default.useFieldProps(),
26
27
  form = _ProForm$useFieldProp.form;
@@ -29,7 +30,12 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
29
30
  other[_key - 1] = arguments[_key];
30
31
  }
31
32
  var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
32
- var confirmProps = (0, _lodash.isFunction)(confirm) ? confirm(form.getFieldsValue()) : confirm;
33
+ var confirmProps = (0, _lodash.isFunction)(confirm) ? confirm(value, form.getFieldsValue(), {
34
+ option: other[0],
35
+ form: form,
36
+ namePath: otherProps.namePath,
37
+ index: otherProps.index
38
+ }) : confirm;
33
39
  if (confirmProps === true) {
34
40
  _antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), {}, {
35
41
  onOk: function onOk() {
@@ -52,12 +52,12 @@ interface ControlProps {
52
52
  /**
53
53
  * 扩展函数的参数
54
54
  */
55
- type FunctionArgs<Values> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
55
+ type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
56
56
  form: FormInstance<Values>;
57
57
  index?: number;
58
58
  namePath?: NamePath;
59
59
  [key: string]: any;
60
- }) => any;
60
+ }) => R;
61
61
  type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
62
62
  value?: T['value'];
63
63
  onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
@@ -220,7 +220,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
220
220
  extra?: string | React.ReactNode;
221
221
  /** 是否固定字段, 不隐藏 */
222
222
  fixed?: boolean;
223
- confirm?: boolean | ModalFuncProps | ((values: Values) => boolean | ModalFuncProps);
223
+ confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
224
224
  }
225
225
  export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
226
226
  /**
@@ -151,7 +151,7 @@ var filterInternalFields = exports.filterInternalFields = function filterInterna
151
151
  if ((0, _lodash.isObject)(nextValues)) {
152
152
  var result = {};
153
153
  Object.keys(nextValues).forEach(function (key) {
154
- // if (key.includes('-')) return;
154
+ if (key.includes('-')) return;
155
155
  result[key] = filterInternalFields(nextValues[key]);
156
156
  });
157
157
  return result;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare function CloseIcon(props: any): JSX.Element;
2
3
  export default CloseIcon;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare function CloseIcon(props: any): JSX.Element;
2
3
  export default CloseIcon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.3-beta.13",
3
+ "version": "3.4.3-beta.15",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",