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

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.
@@ -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,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.12",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",