@zat-design/sisyphus-react 3.4.5-beta.2 → 3.4.5-beta.4
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 +3 -0
- package/dist/less.esm.css +3 -0
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProEditTable/components/RenderField/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 +259 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- 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 +7 -55
- package/es/ProIcon/utils/index.d.ts +5 -0
- package/es/ProIcon/utils/index.js +60 -0
- package/es/ProTable/utils.js +6 -3
- package/lib/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProEditTable/components/RenderField/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 +259 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- 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 +5 -53
- package/lib/ProIcon/utils/index.d.ts +5 -0
- package/lib/ProIcon/utils/index.js +62 -1
- package/lib/ProTable/utils.js +6 -3
- 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
|
@@ -2485,6 +2485,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2485
2485
|
color: var(--ant-error-color);
|
|
2486
2486
|
border-color: var(--ant-error-color);
|
|
2487
2487
|
}
|
|
2488
|
+
.pro-container.pro-container-empty .ant-collapse-content {
|
|
2489
|
+
display: none;
|
|
2490
|
+
}
|
|
2488
2491
|
.pro-container.pro-container-diy .pro-container-content {
|
|
2489
2492
|
display: -webkit-box;
|
|
2490
2493
|
display: -webkit-flex;
|
package/dist/less.esm.css
CHANGED
|
@@ -2485,6 +2485,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2485
2485
|
color: var(--ant-error-color);
|
|
2486
2486
|
border-color: var(--ant-error-color);
|
|
2487
2487
|
}
|
|
2488
|
+
.pro-container.pro-container-empty .ant-collapse-content {
|
|
2489
|
+
display: none;
|
|
2490
|
+
}
|
|
2488
2491
|
.pro-container.pro-container-diy .pro-container-content {
|
|
2489
2492
|
display: -webkit-box;
|
|
2490
2493
|
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
|
}
|
|
@@ -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,259 @@
|
|
|
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
|
+
// const cascaderValue = hasDetail ? value?.slice(0, level) : value;
|
|
36
|
+
var viewLabel = [];
|
|
37
|
+
// 根据dataSource得到label数组,查看模式展示需要
|
|
38
|
+
value === null || value === void 0 ? void 0 : value.forEach(function (value, index) {
|
|
39
|
+
var _dataSource;
|
|
40
|
+
var temp = (_dataSource = dataSource) === null || _dataSource === void 0 ? void 0 : _dataSource.find(function (item) {
|
|
41
|
+
return (item === null || item === void 0 ? void 0 : item.value) === value;
|
|
42
|
+
});
|
|
43
|
+
dataSource = (temp === null || temp === void 0 ? void 0 : temp.children) || [];
|
|
44
|
+
viewLabel[index] = temp === null || temp === void 0 ? void 0 : temp.label;
|
|
45
|
+
});
|
|
46
|
+
return viewLabel;
|
|
47
|
+
};
|
|
48
|
+
var defaultFieldNames = {
|
|
49
|
+
label: 'name',
|
|
50
|
+
value: 'code',
|
|
51
|
+
children: 'children'
|
|
52
|
+
};
|
|
53
|
+
var ProCascader = function ProCascader(props) {
|
|
54
|
+
var _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
|
|
55
|
+
var _ref2 = useProConfig('ProAddressBar') || {},
|
|
56
|
+
configDetailMaxLength = _ref2.detailMaxLength,
|
|
57
|
+
configEnumCode = _ref2.enumCode,
|
|
58
|
+
configCode = _ref2.code;
|
|
59
|
+
var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address';
|
|
60
|
+
var _props$className = props.className,
|
|
61
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
62
|
+
_props$hasDetail = props.hasDetail,
|
|
63
|
+
hasDetail = _props$hasDetail === void 0 ? isAddressMode ? true : undefined : _props$hasDetail,
|
|
64
|
+
_props$detailMaxLengt = props.detailMaxLength,
|
|
65
|
+
detailMaxLength = _props$detailMaxLengt === void 0 ? isAddressMode ? configDetailMaxLength || 100 : 100 : _props$detailMaxLengt,
|
|
66
|
+
_props$fieldNames = props.fieldNames,
|
|
67
|
+
fieldNames = _props$fieldNames === void 0 ? defaultFieldNames : _props$fieldNames,
|
|
68
|
+
value = props.value,
|
|
69
|
+
disabled = props.disabled,
|
|
70
|
+
dataSource = props.dataSource,
|
|
71
|
+
onChange = props.onChange,
|
|
72
|
+
useRequest = props.useRequest,
|
|
73
|
+
transformResponse = props.transformResponse,
|
|
74
|
+
_props$level = props.level,
|
|
75
|
+
level = _props$level === void 0 ? isAddressMode ? 3 : undefined : _props$level,
|
|
76
|
+
isView = props.isView,
|
|
77
|
+
_props$enumCode = props.enumCode,
|
|
78
|
+
enumCode = _props$enumCode === void 0 ? configEnumCode : _props$enumCode,
|
|
79
|
+
_props$code = props.code,
|
|
80
|
+
code = _props$code === void 0 ? configCode : _props$code,
|
|
81
|
+
tooltip = props.tooltip,
|
|
82
|
+
_props$separator = props.separator,
|
|
83
|
+
separator = _props$separator === void 0 ? '' : _props$separator,
|
|
84
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
85
|
+
var _ref3 = ProForm.useFieldProps() || {},
|
|
86
|
+
isViewCon = _ref3.isView;
|
|
87
|
+
var addressCode = code || enumCode;
|
|
88
|
+
var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
|
|
89
|
+
var realLevel = Math.max(2, level);
|
|
90
|
+
var detail = value === null || value === void 0 ? void 0 : value[realLevel];
|
|
91
|
+
var enumData = useEnum(addressCode);
|
|
92
|
+
var _ref4 = Array.isArray(enumData) ? enumData : [],
|
|
93
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
94
|
+
_ref5$ = _ref5[0],
|
|
95
|
+
enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
|
|
96
|
+
var realDataSource = useMemo(function () {
|
|
97
|
+
console.log(enumDataSource);
|
|
98
|
+
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
99
|
+
return realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
|
|
100
|
+
}, [addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
101
|
+
var _useRequest = _objectSpread({}, useRequest),
|
|
102
|
+
service = _useRequest.service,
|
|
103
|
+
_useRequest$defaultPa = _useRequest.defaultParams,
|
|
104
|
+
defaultParams = _useRequest$defaultPa === void 0 ? {} : _useRequest$defaultPa,
|
|
105
|
+
_useRequest$parentKey = _useRequest.parentKey,
|
|
106
|
+
parentKey = _useRequest$parentKey === void 0 ? 'parentCode' : _useRequest$parentKey;
|
|
107
|
+
var _useState = useState([]),
|
|
108
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
109
|
+
serviceData = _useState2[0],
|
|
110
|
+
setServiceData = _useState2[1];
|
|
111
|
+
var _useState3 = useState([]),
|
|
112
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
113
|
+
defaultLabel = _useState4[0],
|
|
114
|
+
setDefaultLabel = _useState4[1];
|
|
115
|
+
var getFirstLevelOptions = /*#__PURE__*/function () {
|
|
116
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
117
|
+
var _yield$service, data, newData, transFormData, serviceData;
|
|
118
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
119
|
+
while (1) switch (_context.prev = _context.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
_context.next = 2;
|
|
122
|
+
return service(defaultParams);
|
|
123
|
+
case 2:
|
|
124
|
+
_yield$service = _context.sent;
|
|
125
|
+
data = _yield$service.data;
|
|
126
|
+
newData = data;
|
|
127
|
+
if (transformResponse) {
|
|
128
|
+
newData = transformResponse(data);
|
|
129
|
+
}
|
|
130
|
+
transFormData = transformDataName(newData, {
|
|
131
|
+
label: fieldNames.label,
|
|
132
|
+
value: fieldNames.value,
|
|
133
|
+
children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
|
|
134
|
+
});
|
|
135
|
+
serviceData = realLevel === 2 ? filterDataSource(transFormData, level) : transFormData;
|
|
136
|
+
setServiceData(serviceData);
|
|
137
|
+
case 9:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee);
|
|
142
|
+
}));
|
|
143
|
+
return function getFirstLevelOptions() {
|
|
144
|
+
return _ref6.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
useEffect(function () {
|
|
148
|
+
if (service) {
|
|
149
|
+
// 传入useRequest时,初次加载级联第一级数据源
|
|
150
|
+
getFirstLevelOptions();
|
|
151
|
+
}
|
|
152
|
+
}, [service]);
|
|
153
|
+
useEffect(function () {
|
|
154
|
+
if (realIsView && value) {
|
|
155
|
+
// 传入dataSource + 查看时初始化展示
|
|
156
|
+
if (service) {
|
|
157
|
+
setDefaultLabel(getViewLabel({
|
|
158
|
+
dataSource: serviceData,
|
|
159
|
+
value: hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
|
160
|
+
}));
|
|
161
|
+
} else if ((realDataSource === null || realDataSource === void 0 ? void 0 : realDataSource.length) > 0) {
|
|
162
|
+
setDefaultLabel(getViewLabel({
|
|
163
|
+
dataSource: realDataSource,
|
|
164
|
+
value: hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, [realIsView, value, realDataSource, serviceData]);
|
|
169
|
+
var handleChange = function handleChange(changeValue, selectedOptions) {
|
|
170
|
+
if (onChange) {
|
|
171
|
+
if (hasDetail && detail) {
|
|
172
|
+
// 有详情地址
|
|
173
|
+
var realValue = changeValue || [];
|
|
174
|
+
realValue[realLevel] = detail;
|
|
175
|
+
onChange(realValue, selectedOptions);
|
|
176
|
+
} else {
|
|
177
|
+
onChange(changeValue, selectedOptions);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
// showSearch中的筛选函数
|
|
182
|
+
var handlefilter = function handlefilter(inputValue, path) {
|
|
183
|
+
return path.some(function (option) {
|
|
184
|
+
return option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
var handleAddressChange = function handleAddressChange(e) {
|
|
188
|
+
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
|
189
|
+
if (onChange) {
|
|
190
|
+
if (!e.target.value && (cascaderValue === null || cascaderValue === void 0 ? void 0 : cascaderValue.every(function (item) {
|
|
191
|
+
return !item;
|
|
192
|
+
}))) {
|
|
193
|
+
onChange(undefined);
|
|
194
|
+
} else {
|
|
195
|
+
var realValue = value ? _toConsumableArray(value) : [];
|
|
196
|
+
realValue[realLevel] = e.target.value;
|
|
197
|
+
onChange(realValue);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
var displayRender = function displayRender(label) {
|
|
202
|
+
return label === null || label === void 0 ? void 0 : label.filter(function (item) {
|
|
203
|
+
return !!item;
|
|
204
|
+
}).join('/');
|
|
205
|
+
};
|
|
206
|
+
var addressValue = isAddressMode ? value && ((_value$slice = value.slice(0, realLevel)) === null || _value$slice === void 0 ? void 0 : _value$slice.some(function (item) {
|
|
207
|
+
return !!item;
|
|
208
|
+
})) ? value.slice(0, realLevel) : undefined : value;
|
|
209
|
+
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) {
|
|
210
|
+
return !!item;
|
|
211
|
+
})) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
|
212
|
+
return !!item;
|
|
213
|
+
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
|
214
|
+
return realIsView ? tooltip ? _jsx(_Tooltip, {
|
|
215
|
+
className: className,
|
|
216
|
+
title: tooltip === true ? viewValue : tooltip,
|
|
217
|
+
children: _jsx(Text, {
|
|
218
|
+
ellipsis: {
|
|
219
|
+
tooltip: false
|
|
220
|
+
},
|
|
221
|
+
children: viewValue
|
|
222
|
+
})
|
|
223
|
+
}) : _jsx("span", {
|
|
224
|
+
className: className,
|
|
225
|
+
children: viewValue
|
|
226
|
+
}) : _jsxs("div", {
|
|
227
|
+
className: "pro-address ".concat(className),
|
|
228
|
+
children: [_jsx(_Cascader, _objectSpread({
|
|
229
|
+
className: hasDetail ? '' : 'no-detail',
|
|
230
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar = locale.ProAddressBar) === null || _locale$ProAddressBar === void 0 ? void 0 : _locale$ProAddressBar.placeholder,
|
|
231
|
+
value: addressValue,
|
|
232
|
+
options: service ? serviceData : realDataSource,
|
|
233
|
+
disabled: disabled,
|
|
234
|
+
displayRender: displayRender,
|
|
235
|
+
showSearch: {
|
|
236
|
+
filter: handlefilter
|
|
237
|
+
},
|
|
238
|
+
onChange: handleChange
|
|
239
|
+
}, otherProps)), hasDetail && (tooltip && disabled && detail ? _jsx(_Tooltip, {
|
|
240
|
+
title: detail,
|
|
241
|
+
children: _jsx("span", {
|
|
242
|
+
className: "pro-address-detail",
|
|
243
|
+
children: _jsx(_Input, {
|
|
244
|
+
disabled: disabled,
|
|
245
|
+
value: detail
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
}) : _jsx(_Input, {
|
|
249
|
+
allowClear: true,
|
|
250
|
+
autoComplete: "off",
|
|
251
|
+
disabled: disabled,
|
|
252
|
+
value: detail,
|
|
253
|
+
maxLength: detailMaxLength,
|
|
254
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder,
|
|
255
|
+
onChange: handleAddressChange
|
|
256
|
+
}))]
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
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;
|
|
@@ -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 移除前后空格
|
package/es/ProIcon/index.js
CHANGED
|
@@ -12,8 +12,8 @@ import { uniqBy } from 'lodash';
|
|
|
12
12
|
import { ReactSVG } from 'react-svg';
|
|
13
13
|
import { useMemo } from 'react';
|
|
14
14
|
import { useProConfig } from '../ProConfigProvider';
|
|
15
|
-
import { iconMap
|
|
16
|
-
import {
|
|
15
|
+
import { iconMap } from './config';
|
|
16
|
+
import { onBeforeInjection } from './utils';
|
|
17
17
|
import locale from '../locale';
|
|
18
18
|
var ProIcon = function ProIcon(props) {
|
|
19
19
|
var _useProConfig = useProConfig(),
|
|
@@ -129,59 +129,11 @@ var ProIcon = function ProIcon(props) {
|
|
|
129
129
|
"aria-hidden": "true",
|
|
130
130
|
src: src,
|
|
131
131
|
beforeInjection: function beforeInjection(svg) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var mergeFillThemeMap = _objectSpread(_objectSpread({}, themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
|
|
138
|
-
var _gradList = mergeThemeMap[primaryColor];
|
|
139
|
-
var _fillList = mergeFillThemeMap[primaryColor];
|
|
140
|
-
// 渐变操作序列
|
|
141
|
-
var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
|
|
142
|
-
// 填充操作序列
|
|
143
|
-
var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
|
|
144
|
-
// 节点收集
|
|
145
|
-
var nodeMap = {
|
|
146
|
-
// 渐变色节点收集
|
|
147
|
-
gradation: [],
|
|
148
|
-
// 具有fill属性的节点收集
|
|
149
|
-
fill: []
|
|
150
|
-
};
|
|
151
|
-
// 目前只支持处理渐变及fill填充
|
|
152
|
-
var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
|
|
153
|
-
types.forEach(function (typeKey) {
|
|
154
|
-
recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
|
|
155
|
-
});
|
|
156
|
-
if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
|
|
157
|
-
nodeMap.gradation.forEach(function (item, index) {
|
|
158
|
-
// 下一步准备替换的
|
|
159
|
-
var nextStr = gradList[index];
|
|
160
|
-
// 属性原本的值
|
|
161
|
-
var originStr = item.getAttribute('stop-color');
|
|
162
|
-
if (nextStr && originStr !== nextStr) {
|
|
163
|
-
item.setAttribute('stop-color', nextStr);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
|
|
168
|
-
nodeMap.fill.forEach(function (item, index) {
|
|
169
|
-
// 默认接收的
|
|
170
|
-
var receiveStr = fillList[index];
|
|
171
|
-
// 下一步准备替换的
|
|
172
|
-
var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
|
|
173
|
-
// 属性原本的值
|
|
174
|
-
var originFill = item.getAttribute('fill');
|
|
175
|
-
// 如果包含url(则是内链,不作替换处理
|
|
176
|
-
if (!(originFill && originFill.includes('url(')) && nextFillStr) {
|
|
177
|
-
// 不同才替换
|
|
178
|
-
if (originFill !== nextFillStr) {
|
|
179
|
-
item.setAttribute('fill', nextFillStr);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
132
|
+
onBeforeInjection({
|
|
133
|
+
svg: svg,
|
|
134
|
+
actionMap: actionMap,
|
|
135
|
+
primaryColor: primaryColor
|
|
136
|
+
});
|
|
185
137
|
}
|
|
186
138
|
}))
|
|
187
139
|
})
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { themeMap, themeFillMap } from '../config';
|
|
1
3
|
export var recurseGetNodes = function recurseGetNodes(type, node, queue) {
|
|
2
4
|
switch (type) {
|
|
3
5
|
// 渐变
|
|
@@ -20,4 +22,62 @@ export var recurseGetNodes = function recurseGetNodes(type, node, queue) {
|
|
|
20
22
|
recurseGetNodes(type, node.childNodes[i], queue);
|
|
21
23
|
}
|
|
22
24
|
}
|
|
25
|
+
};
|
|
26
|
+
export var onBeforeInjection = function onBeforeInjection(_ref) {
|
|
27
|
+
var svg = _ref.svg,
|
|
28
|
+
actionMap = _ref.actionMap,
|
|
29
|
+
primaryColor = _ref.primaryColor;
|
|
30
|
+
if (actionMap && svg) {
|
|
31
|
+
var _actionMap$themeMap, _actionMap$themeFillM, _actionMap$gradation, _actionMap$fill;
|
|
32
|
+
// 项目内置的四种主题匹配渐变色
|
|
33
|
+
var mergeThemeMap = _objectSpread(_objectSpread({}, themeMap), (_actionMap$themeMap = actionMap.themeMap) !== null && _actionMap$themeMap !== void 0 ? _actionMap$themeMap : {});
|
|
34
|
+
// 项目内置的四种双色匹配fill
|
|
35
|
+
var mergeFillThemeMap = _objectSpread(_objectSpread({}, themeFillMap), (_actionMap$themeFillM = actionMap.themeFillMap) !== null && _actionMap$themeFillM !== void 0 ? _actionMap$themeFillM : {});
|
|
36
|
+
var _gradList = mergeThemeMap[primaryColor];
|
|
37
|
+
var _fillList = mergeFillThemeMap[primaryColor];
|
|
38
|
+
// 渐变操作序列
|
|
39
|
+
var gradList = (_actionMap$gradation = actionMap === null || actionMap === void 0 ? void 0 : actionMap.gradation) !== null && _actionMap$gradation !== void 0 ? _actionMap$gradation : _gradList;
|
|
40
|
+
// 填充操作序列
|
|
41
|
+
var fillList = (_actionMap$fill = actionMap === null || actionMap === void 0 ? void 0 : actionMap.fill) !== null && _actionMap$fill !== void 0 ? _actionMap$fill : _fillList;
|
|
42
|
+
// 节点收集
|
|
43
|
+
var nodeMap = {
|
|
44
|
+
// 渐变色节点收集
|
|
45
|
+
gradation: [],
|
|
46
|
+
// 具有fill属性的节点收集
|
|
47
|
+
fill: []
|
|
48
|
+
};
|
|
49
|
+
// 目前只支持处理渐变及fill填充
|
|
50
|
+
var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
|
|
51
|
+
types.forEach(function (typeKey) {
|
|
52
|
+
recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
|
|
53
|
+
});
|
|
54
|
+
if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
|
|
55
|
+
nodeMap.gradation.forEach(function (item, index) {
|
|
56
|
+
// 下一步准备替换的
|
|
57
|
+
var nextStr = gradList[index];
|
|
58
|
+
// 属性原本的值
|
|
59
|
+
var originStr = item.getAttribute('stop-color');
|
|
60
|
+
if (nextStr && originStr !== nextStr) {
|
|
61
|
+
item.setAttribute('stop-color', nextStr);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if ((fillList === null || fillList === void 0 ? void 0 : fillList.length) > 0) {
|
|
66
|
+
nodeMap.fill.forEach(function (item, index) {
|
|
67
|
+
// 默认接收的
|
|
68
|
+
var receiveStr = fillList[index];
|
|
69
|
+
// 下一步准备替换的
|
|
70
|
+
var nextFillStr = receiveStr === 'theme' ? primaryColor : receiveStr;
|
|
71
|
+
// 属性原本的值
|
|
72
|
+
var originFill = item.getAttribute('fill');
|
|
73
|
+
// 如果包含url(则是内链,不作替换处理
|
|
74
|
+
if (!(originFill && originFill.includes('url(')) && nextFillStr) {
|
|
75
|
+
// 不同才替换
|
|
76
|
+
if (originFill !== nextFillStr) {
|
|
77
|
+
item.setAttribute('fill', nextFillStr);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
23
83
|
};
|