@zat-design/sisyphus-react 3.4.5-beta.1 → 3.4.5-beta.11
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.
- package/dist/index.esm.css +7 -1
- package/dist/less.esm.css +7 -1
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProConfigProvider/index.js +0 -3
- package/es/ProEditTable/components/RenderField/index.js +7 -7
- package/es/ProEditTable/index.js +1 -1
- package/es/ProForm/components/combination/Container/index.js +3 -2
- package/es/ProForm/components/combination/Container/style/index.less +5 -1
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProCascader/index.js +255 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- package/es/ProForm/components/combination/ProModalSelect/index.js +3 -4
- package/es/ProForm/components/index.d.ts +1 -2
- package/es/ProForm/components/index.js +1 -4
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProForm/components/render/propsType.d.ts +3 -7
- package/es/ProForm/index.js +2 -2
- package/es/ProForm/style/index.less +1 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProIcon/index.js +115 -71
- package/es/ProIcon/propsTypes.d.ts +5 -0
- package/es/ProIcon/utils/index.d.ts +5 -0
- package/es/ProIcon/utils/index.js +60 -0
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProSelect/index.js +1 -1
- package/es/ProTable/utils.js +6 -3
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +13 -7
- package/lib/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProConfigProvider/index.js +0 -3
- package/lib/ProEditTable/components/RenderField/index.js +6 -6
- package/lib/ProEditTable/index.js +1 -1
- package/lib/ProForm/components/combination/Container/index.js +3 -2
- package/lib/ProForm/components/combination/Container/style/index.less +5 -1
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProCascader/index.js +255 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- package/lib/ProForm/components/combination/ProModalSelect/index.js +3 -4
- package/lib/ProForm/components/index.d.ts +1 -2
- package/lib/ProForm/components/index.js +1 -8
- package/lib/ProForm/components/render/Render.js +1 -1
- package/lib/ProForm/components/render/propsType.d.ts +3 -7
- package/lib/ProForm/index.js +1 -1
- package/lib/ProForm/style/index.less +1 -1
- package/lib/ProForm/utils/index.js +1 -1
- package/lib/ProIcon/index.js +111 -67
- package/lib/ProIcon/propsTypes.d.ts +5 -0
- package/lib/ProIcon/utils/index.d.ts +5 -0
- package/lib/ProIcon/utils/index.js +62 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProTable/utils.js +6 -3
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +13 -7
- package/package.json +1 -1
- package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/es/ProForm/components/base/ProCascader/index.js +0 -72
- package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
- package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/lib/ProForm/components/base/ProCascader/index.js +0 -78
- package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
package/dist/index.esm.css
CHANGED
|
@@ -686,7 +686,10 @@
|
|
|
686
686
|
display: none !important;
|
|
687
687
|
}
|
|
688
688
|
.pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
|
|
689
|
-
display:
|
|
689
|
+
display: -webkit-box !important;
|
|
690
|
+
display: -webkit-flex !important;
|
|
691
|
+
display: -ms-flexbox !important;
|
|
692
|
+
display: flex !important;
|
|
690
693
|
}
|
|
691
694
|
.pro-collapse.ant-collapse .pro-collapse-panel {
|
|
692
695
|
margin-bottom: 16px;
|
|
@@ -2485,6 +2488,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2485
2488
|
color: var(--ant-error-color);
|
|
2486
2489
|
border-color: var(--ant-error-color);
|
|
2487
2490
|
}
|
|
2491
|
+
.pro-container.pro-container-empty .ant-collapse-content {
|
|
2492
|
+
display: none;
|
|
2493
|
+
}
|
|
2488
2494
|
.pro-container.pro-container-diy .pro-container-content {
|
|
2489
2495
|
display: -webkit-box;
|
|
2490
2496
|
display: -webkit-flex;
|
package/dist/less.esm.css
CHANGED
|
@@ -686,7 +686,10 @@
|
|
|
686
686
|
display: none !important;
|
|
687
687
|
}
|
|
688
688
|
.pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
|
|
689
|
-
display:
|
|
689
|
+
display: -webkit-box !important;
|
|
690
|
+
display: -webkit-flex !important;
|
|
691
|
+
display: -ms-flexbox !important;
|
|
692
|
+
display: flex !important;
|
|
690
693
|
}
|
|
691
694
|
.pro-collapse.ant-collapse .pro-collapse-panel {
|
|
692
695
|
margin-bottom: 16px;
|
|
@@ -2485,6 +2488,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2485
2488
|
color: var(--ant-error-color);
|
|
2486
2489
|
border-color: var(--ant-error-color);
|
|
2487
2490
|
}
|
|
2491
|
+
.pro-container.pro-container-empty .ant-collapse-content {
|
|
2492
|
+
display: none;
|
|
2493
|
+
}
|
|
2488
2494
|
.pro-container.pro-container-diy .pro-container-content {
|
|
2489
2495
|
display: -webkit-box;
|
|
2490
2496
|
display: -webkit-flex;
|
|
@@ -2,14 +2,14 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
3
|
import { PropSelectProps } from '../ProSelect/propsType';
|
|
4
4
|
import { ProModalSelectPropsType } from '../ProForm/components/combination/ProModalSelect/propsType';
|
|
5
|
-
import {
|
|
5
|
+
import { ProCascaderProps } from '../ProForm/components/combination/ProCascader/propsType';
|
|
6
6
|
import { ProEnumConfig } from '../ProEnum/propsType';
|
|
7
7
|
export interface ProConfigState {
|
|
8
8
|
locale?: string;
|
|
9
9
|
ProEnum?: Partial<ProEnumConfig>;
|
|
10
10
|
ProSelect?: Partial<PropSelectProps> & Record<string, any>;
|
|
11
11
|
ProModalSelect?: Partial<ProModalSelectPropsType> & Record<string, any>;
|
|
12
|
-
ProAddressBar?: Partial<
|
|
12
|
+
ProAddressBar?: Partial<ProCascaderProps> & Record<string, any>;
|
|
13
13
|
forms: Record<string, FormInstance | undefined>;
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
}
|
|
@@ -53,9 +53,6 @@ var reducer = function reducer(state, action) {
|
|
|
53
53
|
case 'setWithLocal':
|
|
54
54
|
{
|
|
55
55
|
var _state = merge({}, state, action.payload);
|
|
56
|
-
var localConfigStr = localStorage.getItem('localConfig');
|
|
57
|
-
var localConfig = JSON.parse(localConfigStr || '{}');
|
|
58
|
-
localStorage.setItem('localConfig', JSON.stringify(merge(localConfig, action.payload)));
|
|
59
56
|
return _state;
|
|
60
57
|
}
|
|
61
58
|
case 'setProEnum':
|
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
|
|
20
|
+
import { cloneDeep, isEqual, debounce, omit, isFunction, isBoolean } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference } from '../../utils/tools';
|
|
@@ -112,17 +112,17 @@ var RenderField = function RenderField(_ref) {
|
|
|
112
112
|
}
|
|
113
113
|
if (typeof ((_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.disabled) === 'function') {
|
|
114
114
|
_disabled = _fieldProps.disabled(currentValue, rowData, options);
|
|
115
|
-
} else if (((_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.disabled)
|
|
115
|
+
} else if (isBoolean((_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.disabled)) {
|
|
116
116
|
_disabled = _fieldProps.disabled;
|
|
117
117
|
}
|
|
118
|
+
if ((config === null || config === void 0 ? void 0 : config.disabled) === true) {
|
|
119
|
+
_disabled = column.disabled || (config === null || config === void 0 ? void 0 : config.disabled);
|
|
120
|
+
}
|
|
118
121
|
if (typeof column.disabled === 'function') {
|
|
119
122
|
_disabled = column.disabled(currentValue, rowData, options);
|
|
120
|
-
} else if (column.disabled
|
|
123
|
+
} else if (isBoolean(column.disabled)) {
|
|
121
124
|
_disabled = column.disabled;
|
|
122
125
|
}
|
|
123
|
-
if ((config === null || config === void 0 ? void 0 : config.disabled) === true) {
|
|
124
|
-
_disabled = config === null || config === void 0 ? void 0 : config.disabled;
|
|
125
|
-
}
|
|
126
126
|
if (typeof rules === 'function') {
|
|
127
127
|
_rules = rules(currentValue, rowData, options);
|
|
128
128
|
}
|
|
@@ -266,7 +266,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
266
266
|
case 'ProEnum':
|
|
267
267
|
nextArgs[2].option = _args[1];
|
|
268
268
|
break;
|
|
269
|
-
case '
|
|
269
|
+
case 'ProCascader':
|
|
270
270
|
nextArgs[2].selectedOptions = _args[1];
|
|
271
271
|
break;
|
|
272
272
|
case 'DatePicker':
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -66,12 +66,12 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
66
66
|
// 判断是否在formList内
|
|
67
67
|
if (namePath === null || namePath === void 0 ? void 0 : namePath.length) {
|
|
68
68
|
name = [].concat(_toConsumableArray(namePath), _toConsumableArray(name.slice(1)));
|
|
69
|
+
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
|
|
69
70
|
}
|
|
70
71
|
var tableRef = useRef(null);
|
|
71
72
|
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
72
73
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
73
74
|
var prefixCls = getPrefixCls();
|
|
74
|
-
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled;
|
|
75
75
|
var _useLocalStorageState = useLocalStorageState('themeConfig'),
|
|
76
76
|
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
|
|
77
77
|
themeConfig = _useLocalStorageState2[0];
|
|
@@ -21,10 +21,11 @@ var Container = function Container(props) {
|
|
|
21
21
|
disabled = _ref.disabled;
|
|
22
22
|
var _className = classnames(_defineProperty({
|
|
23
23
|
'pro-container': true,
|
|
24
|
-
'pro-container-diy': type === 'Container'
|
|
24
|
+
'pro-container-diy': type === 'Container',
|
|
25
|
+
'pro-container-empty': !(children === null || children === void 0 ? void 0 : children.length)
|
|
25
26
|
}, "".concat(className), className));
|
|
26
27
|
var _children = useMemo(function () {
|
|
27
|
-
var result = children.map(function (item) {
|
|
28
|
+
var result = children === null || children === void 0 ? void 0 : children.map(function (item) {
|
|
28
29
|
return _objectSpread({
|
|
29
30
|
clearNotShow: clearNotShow,
|
|
30
31
|
show: show,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props:
|
|
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
|
|
5
|
-
|
|
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;
|
|
@@ -341,7 +341,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
341
341
|
case 16:
|
|
342
342
|
_context2.prev = 16;
|
|
343
343
|
_context2.t0 = _context2["catch"](0);
|
|
344
|
-
console.
|
|
344
|
+
console.warn('error', _context2.t0);
|
|
345
345
|
case 19:
|
|
346
346
|
case "end":
|
|
347
347
|
return _context2.stop();
|
|
@@ -670,9 +670,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
670
670
|
labelInValue: labelInValue,
|
|
671
671
|
dataSource: options,
|
|
672
672
|
scrollFollowParent: false,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
|
|
673
|
+
onFocus: function onFocus() {
|
|
674
|
+
if (useRequest) {
|
|
676
675
|
var _useRequest$options9;
|
|
677
676
|
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams) || {};
|
|
678
677
|
var params = withPagination ? {
|
|
@@ -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 './
|
|
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,22 +12,19 @@ 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
|
|
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';
|
|
21
20
|
export { default as ProTimeLimit } from './combination/ProTimeLimit';
|
|
22
21
|
export { default as ProRangeLimit } from './combination/ProRangeLimit';
|
|
23
22
|
export { default as Group } from './combination/Group';
|
|
24
|
-
// export { default as GroupCopy } from './combination/GroupCopy';
|
|
25
23
|
export { default as ProCollapse } from './combination/Container';
|
|
26
24
|
export { default as Container } from './combination/Container';
|
|
27
25
|
export { default as ProEnum } from '../../ProEnum';
|
|
28
26
|
export { default as ProSelect } from '../../ProSelect';
|
|
29
27
|
export { default as ProUpload } from '../../ProUpload';
|
|
30
|
-
// export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
31
28
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
32
29
|
export { default as ProTree } from '../../ProTree';
|
|
33
30
|
// footer组件
|
|
@@ -16,8 +16,7 @@ import { Props as TimePickerProps } from '../base/TimePicker';
|
|
|
16
16
|
import { Props as SwitchProps } from '../base/Switch';
|
|
17
17
|
import { Props as SwitchCheckboxProps } from '../base/SwitchCheckbox';
|
|
18
18
|
import { Props as TextAreaProps } from '../base/TextArea';
|
|
19
|
-
import {
|
|
20
|
-
import { AddressProps } from '../combination/ProAddressBar/propsType';
|
|
19
|
+
import { ProCascaderProps } from '../combination/ProCascader/propsType';
|
|
21
20
|
import { ProCombinationProps } from '../combination/ProCombination/propsType';
|
|
22
21
|
import { ProModalSelectPropsType as ProModalSelectProps } from '../combination/ProModalSelect/propsType';
|
|
23
22
|
import { ProNumberRangeProps } from '../combination/ProNumberRange/propsType';
|
|
@@ -123,8 +122,8 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
123
122
|
type?: 'TextArea';
|
|
124
123
|
fieldProps?: FieldProps<TextAreaProps, Values, T>;
|
|
125
124
|
} | {
|
|
126
|
-
type?: '
|
|
127
|
-
fieldProps?: FieldProps<
|
|
125
|
+
type?: 'ProCascader';
|
|
126
|
+
fieldProps?: FieldProps<ProCascaderProps, Values, T>;
|
|
128
127
|
} | {
|
|
129
128
|
type?: 'ProCombination';
|
|
130
129
|
fieldProps?: FieldProps<ProCombinationProps, Values, T>;
|
|
@@ -155,9 +154,6 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
155
154
|
} | {
|
|
156
155
|
type?: 'ProUpload';
|
|
157
156
|
fieldProps?: FieldProps<ProUploadProps, Values, T>;
|
|
158
|
-
} | {
|
|
159
|
-
type?: 'ProCascader';
|
|
160
|
-
fieldProps?: FieldProps<ProCascaderProps<any, any[], any>, Values, T>;
|
|
161
157
|
} | {
|
|
162
158
|
type?: 'ProTree';
|
|
163
159
|
fieldProps?: FieldProps<ProTreeProps, Values, T>;
|
package/es/ProForm/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
20
20
|
import { isObject, isString, merge } from 'lodash';
|
|
21
|
-
import { FormFooter, InputRange, ProAddress,
|
|
21
|
+
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
22
22
|
import RenderFields from './components/render/RenderFields';
|
|
23
23
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
24
24
|
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
@@ -313,7 +313,7 @@ ProFormForward.Provider = ProFormProvider; // 包装Provider
|
|
|
313
313
|
ProFormForward.useFieldProps = useFieldProps; // 获取每个字段的其他参数 -otherProps
|
|
314
314
|
ProFormForward.useContextForms = useContextForms; // 获取 ProConfigProvider中的表单实例map
|
|
315
315
|
// 内置组合
|
|
316
|
-
ProFormForward.
|
|
316
|
+
ProFormForward.ProCascader = ProCascader;
|
|
317
317
|
ProFormForward.ProCombination = ProCombination;
|
|
318
318
|
ProFormForward.ProNumberRange = ProNumberRange;
|
|
319
319
|
ProFormForward.ProModalSelect = ProModalSelect;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@import '../components/base/TextArea/index.less';
|
|
5
5
|
@import '../components/combination/FormList/style/index.less';
|
|
6
6
|
@import '../components/combination/ProTimeLimit/style/index.less';
|
|
7
|
-
@import '../components/combination/
|
|
7
|
+
@import '../components/combination/ProCascader/style/index.less';
|
|
8
8
|
@import '../components/combination/ProNumberRange/style/index.less';
|
|
9
9
|
@import '../components/combination/ProModalSelect/style/index.less';
|
|
10
10
|
@import '../components/combination/Group/style/index.less';
|
|
@@ -43,7 +43,7 @@ export var useControlled = function useControlled(props) {
|
|
|
43
43
|
export var isSelect = function isSelect(props) {
|
|
44
44
|
var dataSource = props.dataSource,
|
|
45
45
|
type = props.type;
|
|
46
|
-
return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', '
|
|
46
|
+
return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || ['Select', 'ProSelect', 'ProEnum', 'DatePicker', 'RangePicker', 'ProCascader', 'ProTimeLimit', 'ProModalSelect', 'ProTreeModal', 'ProUpload', 'TimePicker'].includes(type);
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
49
|
* Input TextArea 移除前后空格
|