@zat-design/sisyphus-react 3.13.19-beta.11 → 3.13.19-beta.13

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.
@@ -10,7 +10,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
10
10
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
12
  var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
13
- _excluded2 = ["fieldNames", "clear", "storage", "cacheKey", "showCodeName", "useRequest", "transformResponse"];
13
+ _excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
14
14
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
15
15
  import React, { useState, useEffect, useMemo } from 'react';
16
16
  import { cloneDeep, isFunction, isString, isArray, omit, isNumber } from 'lodash';
@@ -19,7 +19,7 @@ import { useProConfig } from "../ProConfigProvider";
19
19
  import ProEnumTag from "./components/Tag";
20
20
  import ProEnumGroup from "./components/Group";
21
21
  import Container from "../ProForm/components/Container";
22
- import { isObject, getEnumData } from "./utils";
22
+ import { isObject } from "./utils";
23
23
  import getEnumLabel from "./utils/getEnumLabel";
24
24
  import useEnum from "./hooks/useEnum";
25
25
  import locale from "../locale";
@@ -50,19 +50,10 @@ var ProEnum = props => {
50
50
  fieldNames = _ref2.fieldNames,
51
51
  _ref2$clear = _ref2.clear,
52
52
  clear = _ref2$clear === void 0 ? true : _ref2$clear,
53
- _ref2$storage = _ref2.storage,
54
- storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage,
55
53
  _ref2$cacheKey = _ref2.cacheKey,
56
54
  cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
57
55
  showCodeName = _ref2.showCodeName,
58
- configUseRequest = _ref2.useRequest,
59
- configTransformResponse = _ref2.transformResponse,
60
56
  resProps = _objectWithoutProperties(_ref2, _excluded2);
61
-
62
- // 优先使用props中的配置,如果没有则使用全局配置
63
- var finalUseRequest = useRequest || configUseRequest;
64
- var finalTransformResponse = transformResponse || configTransformResponse;
65
- var cacheData = getEnumData(storage, cacheKey);
66
57
  var _isView = isView !== undefined && isView !== null ? isView : (_otherProps$isView = otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView) !== null && _otherProps$isView !== void 0 ? _otherProps$isView : configIsView;
67
58
  enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
68
59
  var label = 'label';
@@ -89,7 +80,7 @@ var ProEnum = props => {
89
80
  }
90
81
 
91
82
  // 这种时候优先级最高、完全走自定义
92
- if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && props.fieldNames) {
83
+ if (useRequest !== null && useRequest !== void 0 && useRequest.service && props.fieldNames) {
93
84
  var _props$fieldNames5, _props$fieldNames6;
94
85
  if ((_props$fieldNames5 = props.fieldNames) !== null && _props$fieldNames5 !== void 0 && _props$fieldNames5.label) label = props.fieldNames.label;
95
86
  if ((_props$fieldNames6 = props.fieldNames) !== null && _props$fieldNames6 !== void 0 && _props$fieldNames6.value) fieldValue = props.fieldNames.value;
@@ -97,13 +88,13 @@ var ProEnum = props => {
97
88
  var _useProConfig = useProConfig('ProEnum'),
98
89
  _useProConfig$dics = _useProConfig.dics,
99
90
  dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
100
- var _useRequestFunc = useRequestFunc(finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.service, _objectSpread(_objectSpread({
91
+ var _useRequestFunc = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
101
92
  manual: true,
102
93
  cacheTime: -1
103
- }, finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options), {}, {
94
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
104
95
  onSuccess: res => {
105
- if (finalTransformResponse && typeof finalTransformResponse === 'function') {
106
- var responseData = finalTransformResponse(res);
96
+ if (transformResponse && typeof transformResponse === 'function') {
97
+ var responseData = transformResponse(res);
107
98
  if (typeof responseData !== 'object') {
108
99
  var _locale$ProEnum;
109
100
  return _message.error((_locale$ProEnum = locale.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorMessage);
@@ -135,14 +126,13 @@ var ProEnum = props => {
135
126
 
136
127
  // 自定义请求
137
128
  useDeepCompareEffect(() => {
138
- var _ref3 = (finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options) || {},
129
+ var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
139
130
  defaultParams = _ref3.defaultParams;
140
131
  var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
141
- // 如果缓存数据存在,则不请求
142
- if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && (!Object.keys(cacheData).length || cacheData !== null && cacheData !== void 0 && cacheData.data && !Object.keys(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data).length)) {
132
+ if (useRequest !== null && useRequest !== void 0 && useRequest.service) {
143
133
  run(params);
144
134
  }
145
- }, [finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options]);
135
+ }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
146
136
  var enumLists = useMemo(() => {
147
137
  var lists = [];
148
138
  if (isString(code)) {
@@ -161,8 +151,8 @@ var ProEnum = props => {
161
151
  // 优先使用组件内部自己传入的数据源或者请求得到的数据
162
152
  list = cloneDeep(dataList && dataList.length ? dataList : enumLists);
163
153
  // 对数据进行一系列的过滤等操作
164
- if (!(finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service) && finalTransformResponse) {
165
- list = finalTransformResponse(list);
154
+ if (!(useRequest !== null && useRequest !== void 0 && useRequest.service) && transformResponse) {
155
+ list = transformResponse(list);
166
156
  if (!Array.isArray(list)) {
167
157
  var _locale$ProEnum3;
168
158
  console.error((_locale$ProEnum3 = locale.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.errorArrayMessage);
@@ -28,7 +28,9 @@ var Group = props => {
28
28
  otherProps = props.otherProps,
29
29
  id = props.id,
30
30
  isParentView = props.isView,
31
- formDisabled = props.disabled;
31
+ formDisabled = props.disabled,
32
+ _props$split = props.split,
33
+ split = _props$split === void 0 ? '/' : _props$split;
32
34
  var _ref = otherProps || {},
33
35
  desensitizationKey = _ref.desensitizationKey;
34
36
  var contextProps = ProForm.useFieldProps() || {};
@@ -39,6 +41,7 @@ var Group = props => {
39
41
  index = contextProps.index,
40
42
  isView = contextProps.isView;
41
43
  var nextOption = React.useRef([]);
44
+ var nextIsView = isParentView || isView || otherProps.isView;
42
45
 
43
46
  // 组合onChange
44
47
  var handleChange = (value, option, index) => {
@@ -70,12 +73,13 @@ var Group = props => {
70
73
  'pro-group-width-auto': columns.some(item => {
71
74
  return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
72
75
  }),
76
+ 'pro-group-view': nextIsView,
73
77
  [`${className}`]: className
74
78
  });
75
79
  return /*#__PURE__*/_jsx("div", {
76
80
  className: nextClassName,
77
81
  id: id,
78
- children: space.compact || space !== null && space !== void 0 && space.separator ? /*#__PURE__*/_jsx(_Space.Compact, {
82
+ children: (space.compact || space !== null && space !== void 0 && space.separator) && !nextIsView ? /*#__PURE__*/_jsx(_Space.Compact, {
79
83
  children: columns.map((column, index) => {
80
84
  column.otherProps = otherProps;
81
85
  // 自定义间隔移除对应参数
@@ -85,12 +89,14 @@ var Group = props => {
85
89
  }
86
90
  return /*#__PURE__*/_jsx(ComRender, _objectSpread({
87
91
  contextProps: contextProps,
88
- isView: isParentView || isView
92
+ isView: nextIsView
89
93
  }, column), column.name || index);
90
94
  })
91
95
  }) : /*#__PURE__*/_jsx(_Space, _objectSpread(_objectSpread({
92
96
  align: "start"
93
97
  }, omit(space, ['separator', 'compact'])), {}, {
98
+ split: nextIsView ? split : null,
99
+ size: nextIsView ? 0 : space.size,
94
100
  children: columns.map((column, index) => {
95
101
  column.otherProps = otherProps;
96
102
  if (column !== null && column !== void 0 && column.separator) {
@@ -99,7 +105,7 @@ var Group = props => {
99
105
  }
100
106
  return /*#__PURE__*/_jsx(ComRender, _objectSpread({
101
107
  contextProps: contextProps,
102
- isView: isParentView || isView
108
+ isView: nextIsView
103
109
  }, column), column.name || index);
104
110
  })
105
111
  }))
@@ -27,6 +27,8 @@ export interface GroupType {
27
27
  value?: any[];
28
28
  onChange?: (value: any[] | null, options?: any[]) => void;
29
29
  otherProps?: any;
30
+ /** 分隔符 */
31
+ split?: string | React.ReactNode;
30
32
  }
31
33
  export type GroupColumnType<Values = any> = {
32
34
  component?: React.ReactNode | ReactiveFunction<Values, React.ReactNode>;
@@ -21,6 +21,13 @@
21
21
  .pro-group {
22
22
  width: unset !important;
23
23
  display: flex;
24
+ &.pro-group-view {
25
+ .@{ant-prefix}-space {
26
+ .@{ant-prefix}-space-item {
27
+ width: auto;
28
+ }
29
+ }
30
+ }
24
31
 
25
32
  &.pro-group-diy-width, &.pro-group-width-auto {
26
33
  .@{ant-prefix}-space .@{ant-prefix}-space-item {
@@ -1,5 +1,3 @@
1
- import "antd/es/space/style";
2
- import _Space from "antd/es/space";
3
1
  import "antd/es/input/style";
4
2
  import _Input from "antd/es/input";
5
3
  import "antd/es/button/style";
@@ -7,6 +5,8 @@ import _Button from "antd/es/button";
7
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
6
  import "antd/es/input-number/style";
9
7
  import _InputNumber from "antd/es/input-number";
8
+ import "antd/es/space/style";
9
+ import _Space from "antd/es/space";
10
10
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
11
  import { useSetState, useDeepCompareEffect } from 'ahooks';
12
12
  import { isEmpty } from 'lodash';
@@ -19,7 +19,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
20
  var formatAmount = tools.formatAmount;
21
21
  var ProNumberRange = props => {
22
- var _document$querySelect, _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
22
+ var _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
23
23
  var _props$value = props.value,
24
24
  value = _props$value === void 0 ? [] : _props$value,
25
25
  _props$onChange = props.onChange,
@@ -35,16 +35,16 @@ var ProNumberRange = props => {
35
35
  childProps = props.childProps,
36
36
  addonBefore = props.addonBefore,
37
37
  addonAfter = props.addonAfter,
38
- _props$separator = props.separator,
39
- separator = _props$separator === void 0 ? '~' : _props$separator,
40
38
  inValueType = props.valueType,
39
+ _props$split = props.split,
40
+ split = _props$split === void 0 ? '~' : _props$split,
41
41
  id = props.id;
42
42
  var _ref = ProForm.useFieldProps() || {},
43
43
  isViewCon = _ref.isView,
44
44
  viewEmpty = _ref.viewEmpty,
45
45
  valueType = _ref.valueType;
46
46
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
47
- var addonAfterDomWidth = (_document$querySelect = document.querySelector('.ant-input-number-group-addon')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientWidth;
47
+
48
48
  var _useSetState = useSetState({
49
49
  range: value || []
50
50
  }),
@@ -101,25 +101,53 @@ var ProNumberRange = props => {
101
101
  case 'percentage':
102
102
  return /*#__PURE__*/_jsx(Container, {
103
103
  viewEmpty: viewEmpty,
104
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
104
+ children: /*#__PURE__*/_jsxs(_Space, {
105
+ split: split,
106
+ children: [/*#__PURE__*/_jsx("span", {
107
+ children: formatAmount(value[0], precision || decimal)
108
+ }), /*#__PURE__*/_jsx("span", {
109
+ children: formatAmount(value[1], precision || decimal)
110
+ })]
111
+ })
105
112
  });
106
113
  // 千分比
107
114
  case 'permillage':
108
115
  return /*#__PURE__*/_jsx(Container, {
109
116
  viewEmpty: viewEmpty,
110
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
117
+ children: /*#__PURE__*/_jsxs(_Space, {
118
+ split: split,
119
+ children: [/*#__PURE__*/_jsx("span", {
120
+ children: formatAmount(value[0], precision || decimal)
121
+ }), /*#__PURE__*/_jsx("span", {
122
+ children: formatAmount(value[1], precision || decimal)
123
+ })]
124
+ })
111
125
  });
112
126
  // 千分位
113
127
  case 'amount':
114
128
  case 'thousandth':
115
129
  return /*#__PURE__*/_jsx(Container, {
116
130
  viewEmpty: viewEmpty,
117
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
131
+ children: /*#__PURE__*/_jsxs(_Space, {
132
+ split: split,
133
+ children: [/*#__PURE__*/_jsx("span", {
134
+ children: formatAmount(value[0], precision || decimal)
135
+ }), /*#__PURE__*/_jsx("span", {
136
+ children: formatAmount(value[1], precision || decimal)
137
+ })]
138
+ })
118
139
  });
119
140
  default:
120
141
  return /*#__PURE__*/_jsx(Container, {
121
142
  viewEmpty: viewEmpty,
122
- children: `${value[0] || '-'} ${separator} ${value[1] || '-'}`
143
+ children: /*#__PURE__*/_jsxs(_Space, {
144
+ split: split,
145
+ children: [/*#__PURE__*/_jsx("span", {
146
+ children: value[0] || '-'
147
+ }), /*#__PURE__*/_jsx("span", {
148
+ children: value[1] || '-'
149
+ })]
150
+ })
123
151
  });
124
152
  }
125
153
  }
@@ -199,7 +227,7 @@ var ProNumberRange = props => {
199
227
  'range-split': true,
200
228
  'range-split-disabled': !!disabled
201
229
  }),
202
- placeholder: "~",
230
+ placeholder: split,
203
231
  disabled: true
204
232
  }), /*#__PURE__*/_jsx(_InputNumber, _objectSpread(_objectSpread({
205
233
  className: "range-right",
@@ -71,9 +71,10 @@ export interface ProNumberRangeType {
71
71
  * @default '-'
72
72
  */
73
73
  /**
74
- * 查看分割符
74
+ * @description 查看分割符
75
+ * @default '-'
75
76
  */
76
- separator?: React.ReactNode | string;
77
+ split?: React.ReactNode | string;
77
78
  childProps?: any[];
78
79
  otherProps?: ProFormOtherType;
79
80
  id?: string;
@@ -4,7 +4,7 @@
4
4
  .pro-number-range {
5
5
  display: block;
6
6
  .@{ant-prefix}-space-compact {
7
- display: block;
7
+ display: flex;
8
8
  }
9
9
 
10
10
  .range-split {
@@ -33,7 +33,7 @@ require("./style/index.less");
33
33
  var _useFieldProps2 = require("../ProForm/utils/useFieldProps");
34
34
  var _jsxRuntime = require("react/jsx-runtime");
35
35
  var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
36
- _excluded2 = ["fieldNames", "clear", "storage", "cacheKey", "showCodeName", "useRequest", "transformResponse"];
36
+ _excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
37
37
  var ProEnum = props => {
38
38
  var _otherProps$isView, _enumProps$showCodeNa;
39
39
  var code = props.code,
@@ -57,19 +57,10 @@ var ProEnum = props => {
57
57
  fieldNames = _ref2.fieldNames,
58
58
  _ref2$clear = _ref2.clear,
59
59
  clear = _ref2$clear === void 0 ? true : _ref2$clear,
60
- _ref2$storage = _ref2.storage,
61
- storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage,
62
60
  _ref2$cacheKey = _ref2.cacheKey,
63
61
  cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
64
62
  showCodeName = _ref2.showCodeName,
65
- configUseRequest = _ref2.useRequest,
66
- configTransformResponse = _ref2.transformResponse,
67
63
  resProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
68
-
69
- // 优先使用props中的配置,如果没有则使用全局配置
70
- var finalUseRequest = useRequest || configUseRequest;
71
- var finalTransformResponse = transformResponse || configTransformResponse;
72
- var cacheData = (0, _utils.getEnumData)(storage, cacheKey);
73
64
  var _isView = isView !== undefined && isView !== null ? isView : (_otherProps$isView = otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView) !== null && _otherProps$isView !== void 0 ? _otherProps$isView : configIsView;
74
65
  enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
75
66
  var label = 'label';
@@ -96,7 +87,7 @@ var ProEnum = props => {
96
87
  }
97
88
 
98
89
  // 这种时候优先级最高、完全走自定义
99
- if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && props.fieldNames) {
90
+ if (useRequest !== null && useRequest !== void 0 && useRequest.service && props.fieldNames) {
100
91
  var _props$fieldNames5, _props$fieldNames6;
101
92
  if ((_props$fieldNames5 = props.fieldNames) !== null && _props$fieldNames5 !== void 0 && _props$fieldNames5.label) label = props.fieldNames.label;
102
93
  if ((_props$fieldNames6 = props.fieldNames) !== null && _props$fieldNames6 !== void 0 && _props$fieldNames6.value) fieldValue = props.fieldNames.value;
@@ -104,13 +95,13 @@ var ProEnum = props => {
104
95
  var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProEnum'),
105
96
  _useProConfig$dics = _useProConfig.dics,
106
97
  dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
107
- var _useRequestFunc = (0, _ahooks.useRequest)(finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
98
+ var _useRequestFunc = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
108
99
  manual: true,
109
100
  cacheTime: -1
110
- }, finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options), {}, {
101
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
111
102
  onSuccess: res => {
112
- if (finalTransformResponse && typeof finalTransformResponse === 'function') {
113
- var responseData = finalTransformResponse(res);
103
+ if (transformResponse && typeof transformResponse === 'function') {
104
+ var responseData = transformResponse(res);
114
105
  if (typeof responseData !== 'object') {
115
106
  var _locale$ProEnum;
116
107
  return _message2.default.error((_locale$ProEnum = _locale.default.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorMessage);
@@ -142,14 +133,13 @@ var ProEnum = props => {
142
133
 
143
134
  // 自定义请求
144
135
  (0, _ahooks.useDeepCompareEffect)(() => {
145
- var _ref3 = (finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options) || {},
136
+ var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
146
137
  defaultParams = _ref3.defaultParams;
147
138
  var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
148
- // 如果缓存数据存在,则不请求
149
- if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && (!Object.keys(cacheData).length || cacheData !== null && cacheData !== void 0 && cacheData.data && !Object.keys(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data).length)) {
139
+ if (useRequest !== null && useRequest !== void 0 && useRequest.service) {
150
140
  run(params);
151
141
  }
152
- }, [finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options]);
142
+ }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
153
143
  var enumLists = (0, _react.useMemo)(() => {
154
144
  var lists = [];
155
145
  if ((0, _lodash.isString)(code)) {
@@ -168,8 +158,8 @@ var ProEnum = props => {
168
158
  // 优先使用组件内部自己传入的数据源或者请求得到的数据
169
159
  list = (0, _lodash.cloneDeep)(dataList && dataList.length ? dataList : enumLists);
170
160
  // 对数据进行一系列的过滤等操作
171
- if (!(finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service) && finalTransformResponse) {
172
- list = finalTransformResponse(list);
161
+ if (!(useRequest !== null && useRequest !== void 0 && useRequest.service) && transformResponse) {
162
+ list = transformResponse(list);
173
163
  if (!Array.isArray(list)) {
174
164
  var _locale$ProEnum3;
175
165
  console.error((_locale$ProEnum3 = _locale.default.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.errorArrayMessage);
@@ -33,7 +33,9 @@ var _jsxRuntime = require("react/jsx-runtime");
33
33
  otherProps = props.otherProps,
34
34
  id = props.id,
35
35
  isParentView = props.isView,
36
- formDisabled = props.disabled;
36
+ formDisabled = props.disabled,
37
+ _props$split = props.split,
38
+ split = _props$split === void 0 ? '/' : _props$split;
37
39
  var _ref = otherProps || {},
38
40
  desensitizationKey = _ref.desensitizationKey;
39
41
  var contextProps = _ProForm.default.useFieldProps() || {};
@@ -44,6 +46,7 @@ var _jsxRuntime = require("react/jsx-runtime");
44
46
  index = contextProps.index,
45
47
  isView = contextProps.isView;
46
48
  var nextOption = _react.default.useRef([]);
49
+ var nextIsView = isParentView || isView || otherProps.isView;
47
50
 
48
51
  // 组合onChange
49
52
  var handleChange = (value, option, index) => {
@@ -75,12 +78,13 @@ var _jsxRuntime = require("react/jsx-runtime");
75
78
  'pro-group-width-auto': columns.some(item => {
76
79
  return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
77
80
  }),
81
+ 'pro-group-view': nextIsView,
78
82
  [`${className}`]: className
79
83
  });
80
84
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
81
85
  className: nextClassName,
82
86
  id: id,
83
- children: space.compact || space !== null && space !== void 0 && space.separator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default.Compact, {
87
+ children: (space.compact || space !== null && space !== void 0 && space.separator) && !nextIsView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default.Compact, {
84
88
  children: columns.map((column, index) => {
85
89
  column.otherProps = otherProps;
86
90
  // 自定义间隔移除对应参数
@@ -90,12 +94,14 @@ var _jsxRuntime = require("react/jsx-runtime");
90
94
  }
91
95
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)({
92
96
  contextProps: contextProps,
93
- isView: isParentView || isView
97
+ isView: nextIsView
94
98
  }, column), column.name || index);
95
99
  })
96
100
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
97
101
  align: "start"
98
102
  }, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
103
+ split: nextIsView ? split : null,
104
+ size: nextIsView ? 0 : space.size,
99
105
  children: columns.map((column, index) => {
100
106
  column.otherProps = otherProps;
101
107
  if (column !== null && column !== void 0 && column.separator) {
@@ -104,7 +110,7 @@ var _jsxRuntime = require("react/jsx-runtime");
104
110
  }
105
111
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)({
106
112
  contextProps: contextProps,
107
- isView: isParentView || isView
113
+ isView: nextIsView
108
114
  }, column), column.name || index);
109
115
  })
110
116
  }))
@@ -27,6 +27,8 @@ export interface GroupType {
27
27
  value?: any[];
28
28
  onChange?: (value: any[] | null, options?: any[]) => void;
29
29
  otherProps?: any;
30
+ /** 分隔符 */
31
+ split?: string | React.ReactNode;
30
32
  }
31
33
  export type GroupColumnType<Values = any> = {
32
34
  component?: React.ReactNode | ReactiveFunction<Values, React.ReactNode>;
@@ -21,6 +21,13 @@
21
21
  .pro-group {
22
22
  width: unset !important;
23
23
  display: flex;
24
+ &.pro-group-view {
25
+ .@{ant-prefix}-space {
26
+ .@{ant-prefix}-space-item {
27
+ width: auto;
28
+ }
29
+ }
30
+ }
24
31
 
25
32
  &.pro-group-diy-width, &.pro-group-width-auto {
26
33
  .@{ant-prefix}-space .@{ant-prefix}-space-item {
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- require("antd/es/space/style");
9
- var _space = _interopRequireDefault(require("antd/es/space"));
10
8
  require("antd/es/input/style");
11
9
  var _input = _interopRequireDefault(require("antd/es/input"));
12
10
  require("antd/es/button/style");
@@ -14,6 +12,8 @@ var _button = _interopRequireDefault(require("antd/es/button"));
14
12
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
13
  require("antd/es/input-number/style");
16
14
  var _inputNumber = _interopRequireDefault(require("antd/es/input-number"));
15
+ require("antd/es/space/style");
16
+ var _space = _interopRequireDefault(require("antd/es/space"));
17
17
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
18
18
  var _ahooks = require("ahooks");
19
19
  var _lodash = require("lodash");
@@ -25,7 +25,7 @@ var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
25
25
  var _jsxRuntime = require("react/jsx-runtime");
26
26
  var formatAmount = _utils.tools.formatAmount;
27
27
  var ProNumberRange = props => {
28
- var _document$querySelect, _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
28
+ var _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
29
29
  var _props$value = props.value,
30
30
  value = _props$value === void 0 ? [] : _props$value,
31
31
  _props$onChange = props.onChange,
@@ -41,16 +41,16 @@ var ProNumberRange = props => {
41
41
  childProps = props.childProps,
42
42
  addonBefore = props.addonBefore,
43
43
  addonAfter = props.addonAfter,
44
- _props$separator = props.separator,
45
- separator = _props$separator === void 0 ? '~' : _props$separator,
46
44
  inValueType = props.valueType,
45
+ _props$split = props.split,
46
+ split = _props$split === void 0 ? '~' : _props$split,
47
47
  id = props.id;
48
48
  var _ref = _ProForm.default.useFieldProps() || {},
49
49
  isViewCon = _ref.isView,
50
50
  viewEmpty = _ref.viewEmpty,
51
51
  valueType = _ref.valueType;
52
52
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
53
- var addonAfterDomWidth = (_document$querySelect = document.querySelector('.ant-input-number-group-addon')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientWidth;
53
+
54
54
  var _useSetState = (0, _ahooks.useSetState)({
55
55
  range: value || []
56
56
  }),
@@ -107,25 +107,53 @@ var ProNumberRange = props => {
107
107
  case 'percentage':
108
108
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
109
109
  viewEmpty: viewEmpty,
110
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
110
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_space.default, {
111
+ split: split,
112
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
113
+ children: formatAmount(value[0], precision || decimal)
114
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
115
+ children: formatAmount(value[1], precision || decimal)
116
+ })]
117
+ })
111
118
  });
112
119
  // 千分比
113
120
  case 'permillage':
114
121
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
115
122
  viewEmpty: viewEmpty,
116
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
123
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_space.default, {
124
+ split: split,
125
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
126
+ children: formatAmount(value[0], precision || decimal)
127
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
128
+ children: formatAmount(value[1], precision || decimal)
129
+ })]
130
+ })
117
131
  });
118
132
  // 千分位
119
133
  case 'amount':
120
134
  case 'thousandth':
121
135
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
122
136
  viewEmpty: viewEmpty,
123
- children: `${formatAmount(value[0], precision || decimal)} ${separator} ${formatAmount(value[1], precision || decimal)}`
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_space.default, {
138
+ split: split,
139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
140
+ children: formatAmount(value[0], precision || decimal)
141
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
142
+ children: formatAmount(value[1], precision || decimal)
143
+ })]
144
+ })
124
145
  });
125
146
  default:
126
147
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
127
148
  viewEmpty: viewEmpty,
128
- children: `${value[0] || '-'} ${separator} ${value[1] || '-'}`
149
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_space.default, {
150
+ split: split,
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
152
+ children: value[0] || '-'
153
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
154
+ children: value[1] || '-'
155
+ })]
156
+ })
129
157
  });
130
158
  }
131
159
  }
@@ -205,7 +233,7 @@ var ProNumberRange = props => {
205
233
  'range-split': true,
206
234
  'range-split-disabled': !!disabled
207
235
  }),
208
- placeholder: "~",
236
+ placeholder: split,
209
237
  disabled: true
210
238
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
211
239
  className: "range-right",
@@ -71,9 +71,10 @@ export interface ProNumberRangeType {
71
71
  * @default '-'
72
72
  */
73
73
  /**
74
- * 查看分割符
74
+ * @description 查看分割符
75
+ * @default '-'
75
76
  */
76
- separator?: React.ReactNode | string;
77
+ split?: React.ReactNode | string;
77
78
  childProps?: any[];
78
79
  otherProps?: ProFormOtherType;
79
80
  id?: string;
@@ -4,7 +4,7 @@
4
4
  .pro-number-range {
5
5
  display: block;
6
6
  .@{ant-prefix}-space-compact {
7
- display: block;
7
+ display: flex;
8
8
  }
9
9
 
10
10
  .range-split {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.19-beta.11",
3
+ "version": "3.13.19-beta.13",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",