@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.
- package/babel.config.js +3 -0
- package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/dist/index.esm.css +70 -19
- package/dist/less.esm.css +70 -19
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProConfigProvider/index.js +0 -3
- package/es/ProEditTable/components/RenderField/index.js +10 -9
- package/es/ProEditTable/index.js +14 -3
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/utils/index.js +7 -1
- package/es/ProEnum/components/Group.js +7 -1
- package/es/ProEnum/style/index.less +3 -2
- 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/FormList/index.js +5 -5
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.js +36 -0
- package/es/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/es/ProForm/components/combination/GroupCopy/index.js +84 -0
- package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/es/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/es/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/es/ProForm/components/combination/GroupCopy/utils.js +180 -0
- 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/ProCascader/propsType.js +1 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +25 -22
- package/es/ProForm/components/index.d.ts +1 -2
- package/es/ProForm/components/index.js +1 -3
- package/es/ProForm/components/render/Render.js +3 -3
- package/es/ProForm/components/render/propsType.d.ts +4 -8
- 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/config/index.d.ts +14 -0
- package/es/ProIcon/config/index.js +17 -1
- package/es/ProIcon/index.js +134 -26
- package/es/ProIcon/propsTypes.d.ts +24 -0
- package/es/ProIcon/utils/index.d.ts +6 -0
- package/es/ProIcon/utils/index.js +83 -0
- package/es/ProLayout/components/ProCollapse/index.js +6 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProSelect/index.js +1 -1
- package/es/ProStep/components/Step/index.js +5 -4
- package/es/ProStep/style/index.less +20 -0
- package/es/ProTable/utils.js +6 -3
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +30 -4
- package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/es/ProTreeModal/index.js +11 -15
- package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/es/global.less +38 -2
- package/jest.config.js +8 -0
- package/lib/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProConfigProvider/index.js +0 -3
- package/lib/ProEditTable/components/RenderField/index.js +9 -8
- package/lib/ProEditTable/index.js +14 -3
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/utils/index.js +7 -1
- package/lib/ProEnum/components/Group.js +6 -0
- package/lib/ProEnum/style/index.less +3 -2
- 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/FormList/index.js +5 -5
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.js +44 -0
- package/lib/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/lib/ProForm/components/combination/GroupCopy/index.js +91 -0
- package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/lib/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.js +187 -0
- 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/ProCascader/propsType.js +5 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -23
- package/lib/ProForm/components/index.d.ts +1 -2
- package/lib/ProForm/components/index.js +1 -8
- package/lib/ProForm/components/render/Render.js +3 -3
- package/lib/ProForm/components/render/propsType.d.ts +4 -8
- 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/config/index.d.ts +14 -0
- package/lib/ProIcon/config/index.js +18 -2
- package/lib/ProIcon/index.js +132 -26
- package/lib/ProIcon/propsTypes.d.ts +24 -0
- package/lib/ProIcon/utils/index.d.ts +6 -0
- package/lib/ProIcon/utils/index.js +90 -0
- package/lib/ProLayout/components/ProCollapse/index.js +6 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProStep/components/Step/index.js +5 -4
- package/lib/ProStep/style/index.less +20 -0
- package/lib/ProTable/utils.js +6 -3
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +30 -4
- package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/lib/ProTreeModal/index.js +11 -15
- package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/lib/global.less +38 -2
- package/package.json +6 -2
- package/test/__mocks__/fileMock.js +0 -0
- package/test/__mocks__/styleMock.js +0 -0
- 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 → GroupCopy}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → GroupCopy}/propsType.js +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
p {
|
|
19
|
-
|
|
20
|
-
position : relative;
|
|
19
|
+
position: relative;
|
|
21
20
|
margin-bottom: var(--zaui-space-size-md, 16px);
|
|
22
|
-
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
font-size: var(--zaui-font-size, 14px);
|
|
23
23
|
|
|
24
24
|
&:before {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
left
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
background : var(--zaui-brand, #006aff);
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 4px;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 4px;
|
|
29
|
+
height: 14px;
|
|
30
|
+
background: var(--zaui-brand, #006aff);
|
|
32
31
|
border-radius: var(zaui-border-radius-card, 4px);
|
|
32
|
+
content: '';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
display: flex;
|
|
38
38
|
|
|
39
39
|
li {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
border-radius : 50%;
|
|
43
|
-
background : #fff;
|
|
44
|
-
display : flex;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
45
42
|
justify-content: center;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
width: 38px;
|
|
44
|
+
height: 38px;
|
|
45
|
+
margin-right: 34px;
|
|
46
|
+
color: #fff;
|
|
47
|
+
background: #fff;
|
|
48
|
+
border: 6px solid #fff;
|
|
49
|
+
border-radius: 50%;
|
|
50
50
|
|
|
51
51
|
span {
|
|
52
|
-
font-size
|
|
52
|
+
font-size: var(--zaui-font-size, 14px);
|
|
53
53
|
vertical-align: -7px;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -81,8 +81,16 @@
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
&:nth-child(4) {
|
|
84
|
+
background: #a00f20;
|
|
85
|
+
|
|
86
|
+
&.active,
|
|
87
|
+
&:hover {
|
|
88
|
+
border-color: #f2dbdb;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
&:nth-child(5) {
|
|
84
92
|
margin-right: 0;
|
|
85
|
-
background
|
|
93
|
+
background: #31af96;
|
|
86
94
|
|
|
87
95
|
&.active,
|
|
88
96
|
&:hover {
|
|
@@ -98,16 +106,16 @@
|
|
|
98
106
|
|
|
99
107
|
.copy-btn {
|
|
100
108
|
position: absolute;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
bottom: 20px;
|
|
110
|
+
left: 32px;
|
|
111
|
+
z-index: 10;
|
|
112
|
+
width: calc(100% - 64px);
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
.pro-theme-tools-box {
|
|
108
|
-
display
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-wrap: wrap;
|
|
109
118
|
justify-content: space-between;
|
|
110
|
-
flex-wrap : wrap;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
.pro-theme-tools-space {
|
|
@@ -129,22 +137,22 @@
|
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
.pro-drawer-close {
|
|
132
|
-
position
|
|
133
|
-
top
|
|
134
|
-
left
|
|
135
|
-
display
|
|
136
|
-
align-items
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 6px;
|
|
142
|
+
left: -37px;
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
137
145
|
justify-content: center;
|
|
138
|
-
width
|
|
139
|
-
height
|
|
140
|
-
color
|
|
141
|
-
cursor
|
|
146
|
+
width: 32px;
|
|
147
|
+
height: 38px;
|
|
148
|
+
color: #fff;
|
|
149
|
+
cursor: pointer;
|
|
142
150
|
|
|
143
151
|
.close-icon {
|
|
144
|
-
position
|
|
145
|
-
left
|
|
146
|
-
z-index
|
|
147
|
-
color
|
|
152
|
+
position: relative;
|
|
153
|
+
left: 4px;
|
|
154
|
+
z-index: 1;
|
|
155
|
+
color: var(--zaui-text, #343434);
|
|
148
156
|
font-size: var(--zaui-font-size-lg, 16px);
|
|
149
157
|
transform: translateZ(100px);
|
|
150
158
|
|
|
@@ -155,14 +163,14 @@
|
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
.pro-drawer-close::after {
|
|
158
|
-
position
|
|
159
|
-
top
|
|
160
|
-
right
|
|
161
|
-
bottom
|
|
162
|
-
left
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: 0;
|
|
168
|
+
right: 0;
|
|
169
|
+
bottom: 0;
|
|
170
|
+
left: 0;
|
|
163
171
|
background-color: #fff;
|
|
164
|
-
border-radius
|
|
165
|
-
transform
|
|
166
|
-
content
|
|
172
|
+
border-radius: 4px 0px 0px 4px;
|
|
173
|
+
transform: perspective(0.15em) rotateY(-2deg);
|
|
174
|
+
content: '';
|
|
167
175
|
}
|
|
168
176
|
}
|
|
@@ -207,10 +207,11 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
207
207
|
setState({
|
|
208
208
|
checkedValues: checkedValues,
|
|
209
209
|
checkAll: checkedValues.length === allKeys.length,
|
|
210
|
-
treeViewData: treeViewData
|
|
210
|
+
treeViewData: treeViewData,
|
|
211
|
+
beforeClearAllValues: checkedValues
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
|
-
}, [value, state.allKeys]);
|
|
214
|
+
}, [value, state.allKeys, state.open]);
|
|
214
215
|
var handleClick = function handleClick() {
|
|
215
216
|
setState({
|
|
216
217
|
open: true
|
|
@@ -277,24 +278,19 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
277
278
|
treeViewData: [],
|
|
278
279
|
checkAll: false
|
|
279
280
|
});
|
|
280
|
-
|
|
281
|
+
/* ******** fix:3.4.4-beta.4 点击清空全部不应该回调、所有的都是应该走统一的确定 ********* */
|
|
282
|
+
// onChange?.(_checkedValues);
|
|
281
283
|
};
|
|
282
284
|
/**
|
|
283
285
|
* Drawer close
|
|
284
286
|
*/
|
|
285
287
|
var handleClose = function handleClose() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
293
|
-
} else {
|
|
294
|
-
setState({
|
|
295
|
-
open: false
|
|
296
|
-
});
|
|
297
|
-
}
|
|
288
|
+
setState({
|
|
289
|
+
open: false,
|
|
290
|
+
checkedValues: state.beforeClearAllValues,
|
|
291
|
+
beforeClearAllValues: []
|
|
292
|
+
});
|
|
293
|
+
// onChange?.(state.beforeClearAllValues);
|
|
298
294
|
openChange === null || openChange === void 0 ? void 0 : openChange(false);
|
|
299
295
|
};
|
|
300
296
|
/**
|
package/lib/global.less
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './style/index.less';
|
|
2
2
|
|
|
3
|
-
pre
|
|
3
|
+
pre {
|
|
4
4
|
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
// 火狐浏览器
|
|
9
|
+
scrollbar-width: thin;
|
|
10
|
+
scrollbar-color: #d2d3d7 transparent;
|
|
11
|
+
// ie浏览器
|
|
12
|
+
scrollbar-face-color: #d2d3d7;
|
|
13
|
+
scrollbar-highlight-color: #979797;
|
|
14
|
+
scrollbar-3dlight-color: #979797;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
::-webkit-scrollbar {
|
|
18
|
+
width: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// // 滑块
|
|
22
|
+
::-webkit-scrollbar-thumb {
|
|
23
|
+
background-color: #d2d3d7;
|
|
24
|
+
background-clip: padding-box;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
border-style: dashed;
|
|
27
|
+
border-width: 4px;
|
|
28
|
+
border-radius: 10px;
|
|
29
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 轨道
|
|
33
|
+
::-webkit-scrollbar-track {
|
|
34
|
+
background-color: transparent;
|
|
35
|
+
border-radius: 10px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 悬浮轨道
|
|
39
|
+
::-webkit-scrollbar-thumb:hover {
|
|
40
|
+
background-color: #979797;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5-beta.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@dnd-kit/sortable": "^7.0.2",
|
|
59
59
|
"@dnd-kit/utilities": "^3.2.1",
|
|
60
60
|
"@pansy/react-watermark": "^3.1.13",
|
|
61
|
-
"@zat-design/utils": "1.1.16",
|
|
61
|
+
"@zat-design/utils": "^1.1.16",
|
|
62
62
|
"ahooks": "3.7.4",
|
|
63
63
|
"antd": "4.24.8",
|
|
64
64
|
"big.js": "^6.2.1",
|
|
@@ -77,7 +77,10 @@
|
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@commitlint/cli": "^12.1.1",
|
|
79
79
|
"@commitlint/config-conventional": "^12.1.1",
|
|
80
|
+
"@testing-library/jest-dom": "6.2.0",
|
|
81
|
+
"@testing-library/react": "12.1.5",
|
|
80
82
|
"@types/classnames": "^2.3.1",
|
|
83
|
+
"@types/jest": "^29.5.11",
|
|
81
84
|
"@types/lodash": "^4.14.171",
|
|
82
85
|
"@types/mockjs": "^1.0.6",
|
|
83
86
|
"@types/react": "^17.0.53",
|
|
@@ -104,6 +107,7 @@
|
|
|
104
107
|
"father-build": "^1.18.1",
|
|
105
108
|
"gh-pages": "^3.0.0",
|
|
106
109
|
"husky": "^4.0.7",
|
|
110
|
+
"jest-canvas-mock": "^2.5.2",
|
|
107
111
|
"lint-staged": "^10.0.0",
|
|
108
112
|
"mockjs": "^1.1.0",
|
|
109
113
|
"prettier": "^2.5.0",
|
|
File without changes
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Service, Options } from 'ahooks/lib/useRequest/src/types';
|
|
2
|
-
import { CascaderProps } from 'antd';
|
|
3
|
-
interface RequestProps<T, P extends any[]> {
|
|
4
|
-
service: Service<T, P>;
|
|
5
|
-
options?: Options<T, P>;
|
|
6
|
-
}
|
|
7
|
-
export type Props<T, RT extends T[], RP> = CascaderProps<T> & {
|
|
8
|
-
useRequest?: RequestProps<RT, [RP]>;
|
|
9
|
-
otherProps?: any;
|
|
10
|
-
isView?: boolean;
|
|
11
|
-
dataSource?: T[];
|
|
12
|
-
};
|
|
13
|
-
declare const ProCascader: <T, RT extends T[], RP>(props: Props<T, RT, RP>) => JSX.Element;
|
|
14
|
-
export default ProCascader;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import "antd/es/cascader/style";
|
|
3
|
-
import _Cascader from "antd/es/cascader";
|
|
4
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
7
|
-
var _excluded = ["useRequest", "otherProps", "dataSource", "options"];
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { useRequest } from 'ahooks';
|
|
10
|
-
import Container from '../../Container';
|
|
11
|
-
import ProForm from '../../../../ProForm';
|
|
12
|
-
var defaultFieldNames = {
|
|
13
|
-
value: 'value',
|
|
14
|
-
label: 'label',
|
|
15
|
-
children: 'children'
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* 获取值对应的选项对象
|
|
19
|
-
*/
|
|
20
|
-
var findTreeTarget = function findTreeTarget(dataSource, value, fieldNames) {
|
|
21
|
-
var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
22
|
-
var stack = _toConsumableArray(dataSource);
|
|
23
|
-
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) && (value === null || value === void 0 ? void 0 : value.length)) {
|
|
24
|
-
var valueName = fieldNames.value,
|
|
25
|
-
label = fieldNames.label,
|
|
26
|
-
children = fieldNames.children;
|
|
27
|
-
return value === null || value === void 0 ? void 0 : value.map(function (valueItem) {
|
|
28
|
-
var index = 0;
|
|
29
|
-
while (stack.length) {
|
|
30
|
-
var target = stack.shift();
|
|
31
|
-
if (target[valueName] === valueItem) {
|
|
32
|
-
stack = target[children] ? _toConsumableArray(target[children]) : [];
|
|
33
|
-
return target;
|
|
34
|
-
}
|
|
35
|
-
index += 1;
|
|
36
|
-
}
|
|
37
|
-
return _defineProperty({}, valueName, valueItem);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return [];
|
|
41
|
-
};
|
|
42
|
-
var ProCascader = function ProCascader(props) {
|
|
43
|
-
var _restProps$fieldNames;
|
|
44
|
-
var requestProps = props.useRequest,
|
|
45
|
-
otherProps = props.otherProps,
|
|
46
|
-
dataSource = props.dataSource,
|
|
47
|
-
options = props.options,
|
|
48
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
49
|
-
var _ref2 = ProForm.useFieldProps() || {},
|
|
50
|
-
isViewCon = _ref2.isView;
|
|
51
|
-
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
|
|
52
|
-
var _useRequest = useRequest(requestProps === null || requestProps === void 0 ? void 0 : requestProps.service, requestProps === null || requestProps === void 0 ? void 0 : requestProps.options),
|
|
53
|
-
data = _useRequest.data;
|
|
54
|
-
var _dataSource = data || dataSource || options;
|
|
55
|
-
var _fieldNames = (_restProps$fieldNames = restProps.fieldNames) !== null && _restProps$fieldNames !== void 0 ? _restProps$fieldNames : defaultFieldNames;
|
|
56
|
-
if (isView) {
|
|
57
|
-
var valueTarget = findTreeTarget(_dataSource, restProps.value, _fieldNames);
|
|
58
|
-
var valueName = _fieldNames.value,
|
|
59
|
-
label = _fieldNames.label;
|
|
60
|
-
var nameList = valueTarget.map(function (item) {
|
|
61
|
-
var _item$label;
|
|
62
|
-
return (_item$label = item[label]) !== null && _item$label !== void 0 ? _item$label : item[valueName];
|
|
63
|
-
});
|
|
64
|
-
return _jsx(Container, {
|
|
65
|
-
children: nameList.join('/')
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return _jsx(_Cascader, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
69
|
-
options: _dataSource
|
|
70
|
-
}));
|
|
71
|
-
};
|
|
72
|
-
export default ProCascader;
|