@zat-design/sisyphus-react 3.4.4 → 3.4.5-beta.10

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 (154) hide show
  1. package/babel.config.js +3 -0
  2. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
  3. package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
  4. package/coverage/lcov-report/src/.umi/core/index.html +206 -0
  5. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
  6. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
  7. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
  8. package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
  9. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
  10. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
  11. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
  12. package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
  13. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
  14. package/coverage/lcov-report/src/.umi/index.html +116 -0
  15. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
  16. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
  17. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
  18. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
  19. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
  20. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
  21. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
  22. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
  23. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
  24. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
  25. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
  26. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
  27. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
  28. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
  29. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
  30. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
  31. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
  32. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
  33. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
  34. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
  35. package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
  36. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
  37. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
  38. package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
  39. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
  40. package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
  41. package/dist/index.esm.css +70 -19
  42. package/dist/less.esm.css +70 -19
  43. package/es/ProConfigProvider/index.d.ts +2 -2
  44. package/es/ProConfigProvider/index.js +0 -3
  45. package/es/ProEditTable/components/RenderField/index.js +10 -9
  46. package/es/ProEditTable/index.js +14 -3
  47. package/es/ProEditTable/propsType.d.ts +1 -0
  48. package/es/ProEditTable/utils/index.js +7 -1
  49. package/es/ProEnum/components/Group.js +7 -1
  50. package/es/ProEnum/style/index.less +3 -2
  51. package/es/ProForm/components/combination/Container/index.js +3 -2
  52. package/es/ProForm/components/combination/Container/style/index.less +5 -1
  53. package/es/ProForm/components/combination/FormList/index.js +5 -5
  54. package/es/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
  55. package/es/ProForm/components/combination/GroupCopy/component/ComRender.js +36 -0
  56. package/es/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
  57. package/es/ProForm/components/combination/GroupCopy/index.js +84 -0
  58. package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
  59. package/es/ProForm/components/combination/GroupCopy/style/index.less +131 -0
  60. package/es/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
  61. package/es/ProForm/components/combination/GroupCopy/utils.js +180 -0
  62. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  63. package/es/ProForm/components/combination/ProCascader/index.js +255 -0
  64. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
  65. package/es/ProForm/components/combination/ProCascader/propsType.js +1 -0
  66. package/es/ProForm/components/combination/ProModalSelect/index.js +25 -22
  67. package/es/ProForm/components/index.d.ts +1 -2
  68. package/es/ProForm/components/index.js +1 -3
  69. package/es/ProForm/components/render/Render.js +3 -3
  70. package/es/ProForm/components/render/propsType.d.ts +4 -8
  71. package/es/ProForm/index.js +2 -2
  72. package/es/ProForm/style/index.less +1 -1
  73. package/es/ProForm/utils/index.js +1 -1
  74. package/es/ProIcon/config/index.d.ts +14 -0
  75. package/es/ProIcon/config/index.js +17 -1
  76. package/es/ProIcon/index.js +134 -26
  77. package/es/ProIcon/propsTypes.d.ts +24 -0
  78. package/es/ProIcon/utils/index.d.ts +6 -0
  79. package/es/ProIcon/utils/index.js +83 -0
  80. package/es/ProLayout/components/ProCollapse/index.js +6 -3
  81. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  82. package/es/ProSelect/index.js +1 -1
  83. package/es/ProStep/components/Step/index.js +5 -4
  84. package/es/ProStep/style/index.less +20 -0
  85. package/es/ProTable/utils.js +6 -3
  86. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  87. package/es/ProThemeTools/component/PrdTools/index.js +30 -4
  88. package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
  89. package/es/ProTreeModal/index.js +11 -15
  90. package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
  91. package/es/global.less +38 -2
  92. package/jest.config.js +8 -0
  93. package/lib/ProConfigProvider/index.d.ts +2 -2
  94. package/lib/ProConfigProvider/index.js +0 -3
  95. package/lib/ProEditTable/components/RenderField/index.js +9 -8
  96. package/lib/ProEditTable/index.js +14 -3
  97. package/lib/ProEditTable/propsType.d.ts +1 -0
  98. package/lib/ProEditTable/utils/index.js +7 -1
  99. package/lib/ProEnum/components/Group.js +6 -0
  100. package/lib/ProEnum/style/index.less +3 -2
  101. package/lib/ProForm/components/combination/Container/index.js +3 -2
  102. package/lib/ProForm/components/combination/Container/style/index.less +5 -1
  103. package/lib/ProForm/components/combination/FormList/index.js +5 -5
  104. package/lib/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
  105. package/lib/ProForm/components/combination/GroupCopy/component/ComRender.js +44 -0
  106. package/lib/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
  107. package/lib/ProForm/components/combination/GroupCopy/index.js +91 -0
  108. package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
  109. package/lib/ProForm/components/combination/GroupCopy/style/index.less +131 -0
  110. package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
  111. package/lib/ProForm/components/combination/GroupCopy/utils.js +187 -0
  112. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  113. package/lib/ProForm/components/combination/ProCascader/index.js +255 -0
  114. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
  115. package/lib/ProForm/components/combination/ProCascader/propsType.js +5 -0
  116. package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -23
  117. package/lib/ProForm/components/index.d.ts +1 -2
  118. package/lib/ProForm/components/index.js +1 -8
  119. package/lib/ProForm/components/render/Render.js +3 -3
  120. package/lib/ProForm/components/render/propsType.d.ts +4 -8
  121. package/lib/ProForm/index.js +1 -1
  122. package/lib/ProForm/style/index.less +1 -1
  123. package/lib/ProForm/utils/index.js +1 -1
  124. package/lib/ProIcon/config/index.d.ts +14 -0
  125. package/lib/ProIcon/config/index.js +18 -2
  126. package/lib/ProIcon/index.js +132 -26
  127. package/lib/ProIcon/propsTypes.d.ts +24 -0
  128. package/lib/ProIcon/utils/index.d.ts +6 -0
  129. package/lib/ProIcon/utils/index.js +90 -0
  130. package/lib/ProLayout/components/ProCollapse/index.js +6 -3
  131. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  132. package/lib/ProSelect/index.js +1 -1
  133. package/lib/ProStep/components/Step/index.js +5 -4
  134. package/lib/ProStep/style/index.less +20 -0
  135. package/lib/ProTable/utils.js +6 -3
  136. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  137. package/lib/ProThemeTools/component/PrdTools/index.js +30 -4
  138. package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
  139. package/lib/ProTreeModal/index.js +11 -15
  140. package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
  141. package/lib/global.less +38 -2
  142. package/package.json +6 -2
  143. package/test/__mocks__/fileMock.js +0 -0
  144. package/test/__mocks__/styleMock.js +0 -0
  145. package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
  146. package/es/ProForm/components/base/ProCascader/index.js +0 -72
  147. package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
  148. package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
  149. package/lib/ProForm/components/base/ProCascader/index.js +0 -78
  150. package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
  151. /package/es/ProForm/components/combination/{ProAddressBar → GroupCopy}/propsType.js +0 -0
  152. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
  153. /package/lib/ProForm/components/combination/{ProAddressBar → GroupCopy}/propsType.js +0 -0
  154. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
@@ -0,0 +1,180 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
3
+ import "antd/es/button/style";
4
+ import _Button from "antd/es/button";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { isFunction } from 'lodash';
7
+ import valueTypeMap from '../../../utils/valueType';
8
+ /**
9
+ * 插入间隔符
10
+ * @param columns 表单配置数组
11
+ * @returns
12
+ */
13
+ export var insertSeparator = function insertSeparator(columns, space) {
14
+ if (!(space === null || space === void 0 ? void 0 : space.separator)) {
15
+ return columns;
16
+ }
17
+ return columns.reduce(function (result, current, index, array) {
18
+ // 将当前元素添加到结果数组中
19
+ result.push(current);
20
+ // 如果当前元素不是最后一个元素,则添加间隔符
21
+ if (index < array.length - 1) {
22
+ result.push({
23
+ component: _jsx(_Button, {
24
+ className: "group-separator",
25
+ children: space.separator
26
+ }),
27
+ fieldProps: {
28
+ disabled: true
29
+ }
30
+ });
31
+ }
32
+ return result;
33
+ }, []);
34
+ };
35
+ /** 带出event的组件默认取值方法 */
36
+ export function defaultGetValueFromEvent(valuePropName) {
37
+ var event = arguments.length <= 1 ? undefined : arguments[1];
38
+ if (event && event.target && _typeof(event.target) === 'object' && valuePropName in event.target) {
39
+ return event.target[valuePropName];
40
+ }
41
+ return event;
42
+ }
43
+ /** 转换names */
44
+ export var transformNamesString = function transformNamesString(arr) {
45
+ var result = arr.map(function (subArr) {
46
+ if (Array.isArray(subArr)) {
47
+ return subArr.join('_');
48
+ }
49
+ return subArr;
50
+ });
51
+ return result;
52
+ };
53
+ /** 计算响应式参数的值 */
54
+ export var getReactiveProps = function getReactiveProps(params) {
55
+ var form = params.form,
56
+ index = params.index,
57
+ namePath = params.namePath,
58
+ disabled = params.disabled,
59
+ show = params.show,
60
+ component = params.component,
61
+ fieldProps = params.fieldProps,
62
+ name = params.name;
63
+ var values = form.getFieldsValue(namePath || undefined);
64
+ var _disabled = isFunction(disabled) ? disabled(values, {
65
+ form: form,
66
+ index: index,
67
+ namePath: namePath
68
+ }) : disabled;
69
+ var _show = isFunction(show) ? show(values, {
70
+ form: form,
71
+ index: index,
72
+ namePath: namePath
73
+ }) : show;
74
+ var _component = isFunction(component) ? component(values, {
75
+ form: form,
76
+ index: index,
77
+ namePath: namePath
78
+ }) : component;
79
+ var _fieldProps = isFunction(fieldProps) ? fieldProps(values, {
80
+ form: form,
81
+ index: index,
82
+ namePath: namePath
83
+ }) : fieldProps;
84
+ return {
85
+ disabled: _disabled,
86
+ show: _show,
87
+ component: _component,
88
+ fieldProps: _fieldProps
89
+ };
90
+ };
91
+ /** 获取当前字段的转换函数 */
92
+ export var getValueTypeTrans = function getValueTypeTrans(params) {
93
+ var _valueTypeMap$valueTy;
94
+ var valueType = params.valueType;
95
+ var transform = (_valueTypeMap$valueTy = valueTypeMap[valueType]) === null || _valueTypeMap$valueTy === void 0 ? void 0 : _valueTypeMap$valueTy.call(valueTypeMap, params);
96
+ return transform;
97
+ };
98
+ /** 转换columns */
99
+ export var transformColumns = function transformColumns(params) {
100
+ var form = params.form,
101
+ columns = params.columns,
102
+ name = params.name,
103
+ names = params.names,
104
+ outerIndex = params.index,
105
+ namePath = params.namePath,
106
+ value = params.value,
107
+ internalChange = params.onChange;
108
+ return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
109
+ var type = column.type,
110
+ valueType = column.valueType,
111
+ switchValue = column.switchValue,
112
+ toISOString = column.toISOString,
113
+ fieldProps = column.fieldProps,
114
+ getValueFromEvent = column.getValueFromEvent,
115
+ _column$valuePropName = column.valuePropName,
116
+ valuePropName = _column$valuePropName === void 0 ? 'value' : _column$valuePropName,
117
+ normalize = column.normalize,
118
+ disabled = column.disabled,
119
+ show = column.show,
120
+ component = column.component;
121
+ var _ref = fieldProps || {},
122
+ mode = _ref.mode,
123
+ onChange = _ref.onChange,
124
+ onFieldChange = _ref.onFieldChange,
125
+ comDisabled = _ref.disabled;
126
+ var _disabled = disabled !== null && disabled !== void 0 ? disabled : comDisabled;
127
+ var columnName = names ? names[index] : [].concat(name, index);
128
+ // 响应式字段
129
+ var reactiveProps = getReactiveProps({
130
+ form: form,
131
+ index: index,
132
+ type: type,
133
+ namePath: namePath,
134
+ disabled: _disabled,
135
+ show: show,
136
+ component: component,
137
+ fieldProps: fieldProps,
138
+ name: columnName
139
+ });
140
+ if (reactiveProps.show === false) return [];
141
+ var transform = getValueTypeTrans({
142
+ type: type,
143
+ valueType: valueType,
144
+ switchValue: switchValue,
145
+ toISOString: toISOString,
146
+ mode: mode
147
+ });
148
+ var newValue;
149
+ var handleChange = function handleChange() {
150
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
151
+ args[_key] = arguments[_key];
152
+ }
153
+ if (getValueFromEvent) {
154
+ newValue = getValueFromEvent.apply(void 0, args);
155
+ } else {
156
+ newValue = defaultGetValueFromEvent.apply(void 0, [valuePropName].concat(args));
157
+ }
158
+ if ((transform === null || transform === void 0 ? void 0 : transform.normalize) || normalize) {
159
+ var _transform$normalize;
160
+ // @ts-ignore
161
+ newValue = ((_transform$normalize = transform.normalize) === null || _transform$normalize === void 0 ? void 0 : _transform$normalize.call(transform, newValue)) || (normalize === null || normalize === void 0 ? void 0 : normalize(newValue));
162
+ }
163
+ internalChange === null || internalChange === void 0 ? void 0 : internalChange(newValue, args[1], index);
164
+ onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, args);
165
+ onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
166
+ index: outerIndex,
167
+ namePath: namePath,
168
+ form: form
169
+ });
170
+ };
171
+ return _objectSpread(_objectSpread(_objectSpread({}, column), {}, {
172
+ name: columnName
173
+ }, reactiveProps), {}, {
174
+ fieldProps: _objectSpread(_objectSpread({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
175
+ onChange: handleChange,
176
+ value: value === null || value === void 0 ? void 0 : value[index]
177
+ })
178
+ });
179
+ });
180
+ };
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { AddressProps } from './propsType';
3
- declare const _default: import("react").MemoExoticComponent<(props: AddressProps) => JSX.Element>;
2
+ import { ProCascaderProps } from './propsType';
3
+ declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
4
4
  export default _default;
@@ -0,0 +1,255 @@
1
+ import "antd/es/input/style";
2
+ import _Input from "antd/es/input";
3
+ import "antd/es/cascader/style";
4
+ import _Cascader from "antd/es/cascader";
5
+ import "antd/es/tooltip/style";
6
+ import _Tooltip from "antd/es/tooltip";
7
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
9
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
10
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
13
+ import "antd/es/typography/style";
14
+ import _Typography from "antd/es/typography";
15
+ var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { useEffect, useState, memo, useMemo } from 'react';
18
+ import { tools } from '@zat-design/utils';
19
+ import { useProConfig } from '../../../../ProConfigProvider';
20
+ import useEnum from '../../../../ProEnum/hooks/useEnum';
21
+ import locale from '../../../../locale';
22
+ import ProForm from '../../..';
23
+ var transformDataName = tools.transformDataName;
24
+ var Text = _Typography.Text;
25
+ var filterDataSource = function filterDataSource(dataSource, level) {
26
+ return dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
27
+ return _objectSpread(_objectSpread({}, item), {}, {
28
+ children: level === 1 ? [] : filterDataSource(item === null || item === void 0 ? void 0 : item.children, level - 1)
29
+ });
30
+ });
31
+ };
32
+ var getViewLabel = function getViewLabel(_ref) {
33
+ var dataSource = _ref.dataSource,
34
+ value = _ref.value;
35
+ var viewLabel = [];
36
+ // 根据dataSource得到label数组,查看模式展示需要
37
+ value === null || value === void 0 ? void 0 : value.forEach(function (value, index) {
38
+ var _dataSource;
39
+ var temp = (_dataSource = dataSource) === null || _dataSource === void 0 ? void 0 : _dataSource.find(function (item) {
40
+ return (item === null || item === void 0 ? void 0 : item.value) === value;
41
+ });
42
+ dataSource = (temp === null || temp === void 0 ? void 0 : temp.children) || [];
43
+ viewLabel[index] = temp === null || temp === void 0 ? void 0 : temp.label;
44
+ });
45
+ return viewLabel;
46
+ };
47
+ var defaultFieldNames = {
48
+ label: 'name',
49
+ value: 'code',
50
+ children: 'children'
51
+ };
52
+ var ProCascader = function ProCascader(props) {
53
+ var _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
54
+ var _ref2 = useProConfig('ProAddressBar') || {},
55
+ configDetailMaxLength = _ref2.detailMaxLength,
56
+ configEnumCode = _ref2.enumCode,
57
+ configCode = _ref2.code;
58
+ var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address';
59
+ var _props$className = props.className,
60
+ className = _props$className === void 0 ? '' : _props$className,
61
+ _props$hasDetail = props.hasDetail,
62
+ hasDetail = _props$hasDetail === void 0 ? isAddressMode ? true : undefined : _props$hasDetail,
63
+ _props$detailMaxLengt = props.detailMaxLength,
64
+ detailMaxLength = _props$detailMaxLengt === void 0 ? isAddressMode ? configDetailMaxLength || 100 : 100 : _props$detailMaxLengt,
65
+ _props$fieldNames = props.fieldNames,
66
+ fieldNames = _props$fieldNames === void 0 ? defaultFieldNames : _props$fieldNames,
67
+ value = props.value,
68
+ disabled = props.disabled,
69
+ dataSource = props.dataSource,
70
+ onChange = props.onChange,
71
+ useRequest = props.useRequest,
72
+ transformResponse = props.transformResponse,
73
+ _props$level = props.level,
74
+ level = _props$level === void 0 ? isAddressMode ? 3 : undefined : _props$level,
75
+ isView = props.isView,
76
+ _props$enumCode = props.enumCode,
77
+ enumCode = _props$enumCode === void 0 ? configEnumCode : _props$enumCode,
78
+ _props$code = props.code,
79
+ code = _props$code === void 0 ? configCode : _props$code,
80
+ tooltip = props.tooltip,
81
+ _props$separator = props.separator,
82
+ separator = _props$separator === void 0 ? '' : _props$separator,
83
+ otherProps = _objectWithoutProperties(props, _excluded);
84
+ var _ref3 = ProForm.useFieldProps() || {},
85
+ isViewCon = _ref3.isView;
86
+ var addressCode = code || enumCode;
87
+ var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
88
+ var realLevel = Math.max(2, level);
89
+ var detail = value === null || value === void 0 ? void 0 : value[realLevel];
90
+ var enumData = useEnum(addressCode);
91
+ var _ref4 = Array.isArray(enumData) ? enumData : [],
92
+ _ref5 = _slicedToArray(_ref4, 1),
93
+ _ref5$ = _ref5[0],
94
+ enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
95
+ var realDataSource = useMemo(function () {
96
+ var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
97
+ return isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
98
+ }, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
99
+ var _useRequest = _objectSpread({}, useRequest),
100
+ service = _useRequest.service,
101
+ _useRequest$defaultPa = _useRequest.defaultParams,
102
+ defaultParams = _useRequest$defaultPa === void 0 ? {} : _useRequest$defaultPa;
103
+ var _useState = useState([]),
104
+ _useState2 = _slicedToArray(_useState, 2),
105
+ serviceData = _useState2[0],
106
+ setServiceData = _useState2[1];
107
+ var _useState3 = useState([]),
108
+ _useState4 = _slicedToArray(_useState3, 2),
109
+ defaultLabel = _useState4[0],
110
+ setDefaultLabel = _useState4[1];
111
+ var getFirstLevelOptions = /*#__PURE__*/function () {
112
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
113
+ var _yield$service, data, newData, transFormData, serviceData;
114
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
115
+ while (1) switch (_context.prev = _context.next) {
116
+ case 0:
117
+ _context.next = 2;
118
+ return service(defaultParams);
119
+ case 2:
120
+ _yield$service = _context.sent;
121
+ data = _yield$service.data;
122
+ newData = data;
123
+ if (transformResponse) {
124
+ newData = transformResponse(data);
125
+ }
126
+ transFormData = transformDataName(newData, {
127
+ label: fieldNames.label,
128
+ value: fieldNames.value,
129
+ children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
130
+ });
131
+ serviceData = isAddressMode && realLevel === 2 ? filterDataSource(transFormData, level) : transFormData;
132
+ setServiceData(serviceData);
133
+ case 9:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }, _callee);
138
+ }));
139
+ return function getFirstLevelOptions() {
140
+ return _ref6.apply(this, arguments);
141
+ };
142
+ }();
143
+ useEffect(function () {
144
+ if (service) {
145
+ // 传入useRequest时,初次加载级联第一级数据源
146
+ getFirstLevelOptions();
147
+ }
148
+ }, [service]);
149
+ useEffect(function () {
150
+ if (realIsView && value) {
151
+ // 传入dataSource + 查看时初始化展示
152
+ if (service) {
153
+ setDefaultLabel(getViewLabel({
154
+ dataSource: serviceData,
155
+ value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
156
+ }));
157
+ } else if ((realDataSource === null || realDataSource === void 0 ? void 0 : realDataSource.length) > 0) {
158
+ setDefaultLabel(getViewLabel({
159
+ dataSource: realDataSource,
160
+ value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
161
+ }));
162
+ }
163
+ }
164
+ }, [realIsView, value, realDataSource, serviceData]);
165
+ var handleChange = function handleChange(changeValue, selectedOptions) {
166
+ if (onChange) {
167
+ if (isAddressMode && hasDetail && detail) {
168
+ // 有详情地址
169
+ var realValue = changeValue || [];
170
+ realValue[realLevel] = detail;
171
+ onChange(realValue, selectedOptions);
172
+ } else {
173
+ onChange(changeValue, selectedOptions);
174
+ }
175
+ }
176
+ };
177
+ // showSearch中的筛选函数
178
+ var handlefilter = function handlefilter(inputValue, path) {
179
+ return path.some(function (option) {
180
+ return option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
181
+ });
182
+ };
183
+ var handleAddressChange = function handleAddressChange(e) {
184
+ var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
185
+ if (onChange) {
186
+ if (!e.target.value && (cascaderValue === null || cascaderValue === void 0 ? void 0 : cascaderValue.every(function (item) {
187
+ return !item;
188
+ }))) {
189
+ onChange(undefined);
190
+ } else {
191
+ var realValue = value ? _toConsumableArray(value) : [];
192
+ realValue[realLevel] = e.target.value;
193
+ onChange(realValue);
194
+ }
195
+ }
196
+ };
197
+ var displayRender = function displayRender(label) {
198
+ return label === null || label === void 0 ? void 0 : label.filter(function (item) {
199
+ return !!item;
200
+ }).join('/');
201
+ };
202
+ var addressValue = isAddressMode ? value && ((_value$slice = value.slice(0, realLevel)) === null || _value$slice === void 0 ? void 0 : _value$slice.some(function (item) {
203
+ return !!item;
204
+ })) ? value.slice(0, realLevel) : undefined : value;
205
+ var viewValue = isAddressMode ? ((_ref7 = [].concat(_toConsumableArray(defaultLabel), [value === null || value === void 0 ? void 0 : value[realLevel]])) === null || _ref7 === void 0 ? void 0 : (_ref7$filter = _ref7.filter(function (item) {
206
+ return !!item;
207
+ })) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
208
+ return !!item;
209
+ })) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
210
+ return realIsView ? tooltip ? _jsx(_Tooltip, {
211
+ className: className,
212
+ title: tooltip === true ? viewValue : tooltip,
213
+ children: _jsx(Text, {
214
+ ellipsis: {
215
+ tooltip: false
216
+ },
217
+ children: viewValue
218
+ })
219
+ }) : _jsx("span", {
220
+ className: className,
221
+ children: viewValue
222
+ }) : _jsxs("div", {
223
+ className: "pro-address ".concat(className),
224
+ children: [_jsx(_Cascader, _objectSpread({
225
+ className: hasDetail ? '' : 'no-detail',
226
+ placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar = locale.ProAddressBar) === null || _locale$ProAddressBar === void 0 ? void 0 : _locale$ProAddressBar.placeholder,
227
+ value: addressValue,
228
+ options: service ? serviceData : realDataSource,
229
+ disabled: disabled,
230
+ displayRender: displayRender,
231
+ showSearch: {
232
+ filter: handlefilter
233
+ },
234
+ onChange: handleChange
235
+ }, otherProps)), hasDetail && (tooltip && disabled && detail ? _jsx(_Tooltip, {
236
+ title: detail,
237
+ children: _jsx("span", {
238
+ className: "pro-address-detail",
239
+ children: _jsx(_Input, {
240
+ disabled: disabled,
241
+ value: detail
242
+ })
243
+ })
244
+ }) : _jsx(_Input, {
245
+ allowClear: true,
246
+ autoComplete: "off",
247
+ disabled: disabled,
248
+ value: detail,
249
+ maxLength: detailMaxLength,
250
+ placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder,
251
+ onChange: handleAddressChange
252
+ }))]
253
+ });
254
+ };
255
+ export default /*#__PURE__*/memo(ProCascader);
@@ -1,19 +1,21 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DefaultOptionType } from 'rc-select/lib/Select';
3
3
  import { Service } from 'ahooks/lib/useRequest/src/types';
4
- export interface AddressProps {
5
- getPopupContainer?: () => ReactNode;
4
+ export interface fieldNamesProps {
5
+ label: string;
6
+ value: string;
7
+ children?: string;
8
+ }
9
+ export interface ProCascaderProps {
6
10
  className?: string;
11
+ mode?: 'address' | 'default';
7
12
  isView?: boolean;
8
13
  value?: string[];
9
14
  disabled?: boolean;
10
15
  hasDetail?: boolean;
11
16
  tooltip?: boolean | ReactNode;
12
17
  detailMaxLength?: number;
13
- fieldNames?: {
14
- label: string;
15
- value: string;
16
- };
18
+ fieldNames?: fieldNamesProps;
17
19
  dataSource?: DefaultOptionType[];
18
20
  useRequest?: {
19
21
  loadData?: boolean;
@@ -22,7 +22,6 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
22
22
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
23
  import { SearchOutlined } from '@ant-design/icons';
24
24
  import { useMount, useSetState } from 'ahooks';
25
- import { useRequest as useUmiRequest } from 'umi';
26
25
  import { cloneDeep, debounce, isArray, isEqual, isFunction, omit } from 'lodash';
27
26
  import { ReactSVG } from 'react-svg';
28
27
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
@@ -127,17 +126,22 @@ var ProModalSelect = function ProModalSelect(props, ref) {
127
126
  form = _Form$useForm2[0];
128
127
  var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
129
128
  var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
130
- var _useUmiRequest = useUmiRequest(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
129
+ var _useRequestList = useRequestList(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
130
+ withPagination: withPagination,
131
+ transformParams: transformParams,
132
+ transformResponse: transformResponse
133
+ }, _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
131
134
  manual: true,
132
- onSuccess: function onSuccess(data) {
133
- var list = withPagination ? data === null || data === void 0 ? void 0 : data.list : data;
135
+ onSuccess: function onSuccess(res) {
136
+ var _res$data;
137
+ var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
134
138
  setState({
135
139
  options: list
136
140
  });
137
141
  }
138
142
  })),
139
- run = _useUmiRequest.run;
140
- var _useRequestList = useRequestList(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
143
+ run = _useRequestList.run;
144
+ var _useRequestList2 = useRequestList(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
141
145
  withPagination: withPagination,
142
146
  transformParams: transformParams,
143
147
  transformResponse: transformResponse
@@ -145,13 +149,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
145
149
  manual: true,
146
150
  ready: ((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne) && !readOnly || visible
147
151
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
148
- data = _useRequestList.data,
149
- loading = _useRequestList.loading,
150
- pagination = _useRequestList.pagination,
151
- onSearch = _useRequestList.onSearch,
152
- onReset = _useRequestList.onReset,
153
- runAsync = _useRequestList.runAsync,
154
- mutate = _useRequestList.mutate;
152
+ data = _useRequestList2.data,
153
+ loading = _useRequestList2.loading,
154
+ pagination = _useRequestList2.pagination,
155
+ onSearch = _useRequestList2.onSearch,
156
+ onReset = _useRequestList2.onReset,
157
+ runAsync = _useRequestList2.runAsync,
158
+ mutate = _useRequestList2.mutate;
155
159
  var defaultOptionRender = function defaultOptionRender(rowData) {
156
160
  return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
157
161
  };
@@ -337,7 +341,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
337
341
  case 16:
338
342
  _context2.prev = 16;
339
343
  _context2.t0 = _context2["catch"](0);
340
- console.log('error', _context2.t0);
344
+ console.warn('error', _context2.t0);
341
345
  case 19:
342
346
  case "end":
343
347
  return _context2.stop();
@@ -423,7 +427,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
423
427
  // 初始化回显,当传入initParams时,前端用来回险
424
428
  var getInitValues = /*#__PURE__*/function () {
425
429
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
426
- var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data, _data2, nextSelectRowKeys;
430
+ var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2, _data2, nextSelectRowKeys;
427
431
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
428
432
  while (1) switch (_context4.prev = _context4.next) {
429
433
  case 0:
@@ -452,7 +456,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
452
456
  if (transformResponse) {
453
457
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
454
458
  } else {
455
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
459
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
456
460
  }
457
461
  _data2 = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
458
462
  if (_data2) {
@@ -489,7 +493,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
489
493
  var getDefaultOneValues = /*#__PURE__*/function () {
490
494
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
491
495
  var _useRequest$options4, _useRequest$options5;
492
- var queryBean, page, params, res, _list2, list, _res$data2, _data3, nextSelectRowKeys;
496
+ var queryBean, page, params, res, _list2, list, _res$data3, _data3, nextSelectRowKeys;
493
497
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
494
498
  while (1) switch (_context5.prev = _context5.next) {
495
499
  case 0:
@@ -511,7 +515,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
511
515
  if (transformResponse) {
512
516
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
513
517
  } else {
514
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
518
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
515
519
  }
516
520
  _data3 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
517
521
  nextSelectRowKeys = isMultiple ? value : [value];
@@ -666,11 +670,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
666
670
  labelInValue: labelInValue,
667
671
  dataSource: options,
668
672
  scrollFollowParent: false,
669
- onClick: function onClick() {
670
- // 没有值的时候,初始化点击默认查询前五十条
671
- if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
673
+ onFocus: function onFocus() {
674
+ if (useRequest) {
672
675
  var _useRequest$options9;
673
- var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
676
+ var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams) || {};
674
677
  var params = withPagination ? {
675
678
  pageNum: 1,
676
679
  pageSize: 50,
@@ -11,8 +11,7 @@ export { default as SwitchCheckbox } from './base/SwitchCheckbox';
11
11
  export { default as TimePicker } from './base/TimePicker';
12
12
  export { default as FormList } from './combination/FormList';
13
13
  export { default as ProEditTable } from '../../ProEditTable';
14
- export { default as ProCascader } from './base/ProCascader';
15
- export { default as ProAddressBar } from './combination/ProAddressBar';
14
+ export { default as ProCascader } from './combination/ProCascader';
16
15
  export { default as ProCombination } from './combination/ProCombination';
17
16
  export { default as ProNumberRange } from './combination/ProNumberRange';
18
17
  export { default as ProModalSelect } from './combination/ProModalSelect';
@@ -12,9 +12,8 @@ export { default as SwitchCheckbox } from './base/SwitchCheckbox';
12
12
  export { default as TimePicker } from './base/TimePicker';
13
13
  export { default as FormList } from './combination/FormList';
14
14
  export { default as ProEditTable } from '../../ProEditTable';
15
- export { default as ProCascader } from './base/ProCascader';
16
15
  // combination 组合组件
17
- export { default as ProAddressBar } from './combination/ProAddressBar';
16
+ export { default as ProCascader } from './combination/ProCascader';
18
17
  export { default as ProCombination } from './combination/ProCombination';
19
18
  export { default as ProNumberRange } from './combination/ProNumberRange';
20
19
  export { default as ProModalSelect } from './combination/ProModalSelect';
@@ -26,7 +25,6 @@ export { default as Container } from './combination/Container';
26
25
  export { default as ProEnum } from '../../ProEnum';
27
26
  export { default as ProSelect } from '../../ProSelect';
28
27
  export { default as ProUpload } from '../../ProUpload';
29
- // export { default as ProTreeSelect } from '../../ProTreeSelect';
30
28
  export { default as ProTreeModal } from '../../ProTreeModal';
31
29
  export { default as ProTree } from '../../ProTree';
32
30
  // footer组件
@@ -155,9 +155,9 @@ var Render = function Render(props) {
155
155
  Object.assign(otherFormItemProps, transforms, {
156
156
  names: otherProps.names
157
157
  }, internalRule, {
158
- required: typeof labelRequired === 'boolean' ? labelRequired : _required || (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
158
+ required: typeof labelRequired === 'boolean' ? labelRequired : _required || Array.isArray(rules) && (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
159
159
  return item === null || item === void 0 ? void 0 : item.required;
160
- }))
160
+ })) || false
161
161
  }, otherProps.isView && !requiredOnView ? {
162
162
  required: false
163
163
  } : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
@@ -226,7 +226,7 @@ var Render = function Render(props) {
226
226
  }
227
227
  _args[2].option = args[1];
228
228
  switch (type) {
229
- case 'ProAddressBar':
229
+ case 'ProCascader':
230
230
  _args[2].selectedOptions = args[1];
231
231
  break;
232
232
  case 'DatePicker':