tntd 1.3.50 → 1.3.54
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/components/Layout/Avatar.js +6 -3
- package/components/Layout/GlobalNavigation/NavigationPopup.js +6 -4
- package/components/Layout/GlobalNavigation/index.js +2 -1
- package/components/Layout/HeaderActions.js +1 -0
- package/components/Layout/README.md +2 -1
- package/components/Layout/createActions.js +10 -2
- package/components/Layout/index.js +10 -1
- package/components/Layout/utils.js +2 -2
- package/components/Page/Box.js +3 -3
- package/components/Page/README.md +17 -5
- package/components/Page/index.js +3 -3
- package/components/Page/index.less +31 -7
- package/components/QueryForm/index.js +12 -8
- package/components/QueryListScene/List.js +2 -1
- package/components/locale.js +60 -0
- package/lib/BlockHeader/README.md +83 -0
- package/lib/BlockHeader/fonts/OswaldLight.ttf +0 -0
- package/lib/BlockHeader/index.js +42 -0
- package/lib/BlockHeader/index.less +141 -0
- package/lib/Layout/Avatar.js +11 -3
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +7 -4
- package/lib/Layout/GlobalNavigation/index.js +2 -1
- package/lib/Layout/README.md +2 -1
- package/lib/Layout/createActions.js +14 -1
- package/lib/Layout/index.js +19 -5
- package/lib/Layout/paaslayout/index.less +75 -0
- package/lib/Layout/utils.js +2 -2
- package/lib/Page/Box.js +4 -3
- package/lib/Page/README.md +17 -5
- package/lib/Page/demo.js +302 -0
- package/lib/Page/index.js +3 -3
- package/lib/Page/index.less +31 -7
- package/lib/QueryForm/index.js +14 -11
- package/lib/QueryListScene/Field/SelectInput.js +107 -0
- package/lib/QueryListScene/Field/fieldsMap.js +37 -0
- package/lib/QueryListScene/Field/index.js +75 -0
- package/lib/QueryListScene/Field/select.js +100 -0
- package/lib/QueryListScene/List.js +3 -1
- package/lib/QueryListScene/QueryForm/index.js +419 -0
- package/lib/QueryListScene/QueryForm/index.less +127 -0
- package/lib/locale.js +75 -0
- package/package.json +1 -1
- package/lib/Layout/EnterpriseLayout/Header.js +0 -113
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
package/lib/Page/demo.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
<<<<<<< HEAD
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { Icon } from "antd";
|
|
6
|
+
=======
|
|
7
|
+
>>>>>>> b0d5e9811a677a0f26474e1b615ccac1683b6dec
|
|
8
|
+
import { computeWidth, addUnitForValue } from './utils';
|
|
9
|
+
import Box from './Box';
|
|
10
|
+
import './index.less';
|
|
11
|
+
|
|
12
|
+
<<<<<<< HEAD
|
|
13
|
+
const PageWrapper = styled.div`
|
|
14
|
+
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
overflow-y: hidden;
|
|
17
|
+
.box-white {
|
|
18
|
+
z-index: 1;
|
|
19
|
+
background: ${(props) => `${props.inLayout ? '#fbfcfe' : '#f3f5f6'}`};
|
|
20
|
+
box-shadow: ${(props) => {
|
|
21
|
+
let boxShadow = '0 0 6px 0 rgba(0, 0, 0, 0.1), 0 10px 12px 2px rgba(170, 182, 206, 0.2)';
|
|
22
|
+
if (props.inLayout) {
|
|
23
|
+
boxShadow = '0 0 4px 0 rgba(0, 0, 0, 0.1), 0 6px 10px 2px rgba(170, 182, 206, 0.2)';
|
|
24
|
+
}
|
|
25
|
+
return boxShadow;
|
|
26
|
+
}};
|
|
27
|
+
}
|
|
28
|
+
.box-gray {
|
|
29
|
+
background: ${(props) => `${props.inLayout ? '#f8f9fa' : '#e8ebed'}`};
|
|
30
|
+
// box-shadow: 0 10px 12px 2px rgba(0, 0, 0, 0.1);
|
|
31
|
+
box-shadow: ${(props) => `${props.inLayout ? '0 5px 5px 2px rgba(0, 0, 0, 0.1)' : '0 10px 12px 2px rgba(0, 0, 0, 0.1)'}`};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const HeaderWrapper = styled.div`
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
height: ${(props) => `${props.headerHeight}`};
|
|
40
|
+
padding: ${(props) => `${props.size === 'small' ? 20 : 24}px`};
|
|
41
|
+
z-index: ${(props) => `${props.zIndex}`};
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
background: ${(props) => `${props.inLayout ? '#ffffff' : '#f0f2f3'}`};
|
|
46
|
+
box-shadow: ${(props) =>
|
|
47
|
+
`${props.inLayout
|
|
48
|
+
? 'none'
|
|
49
|
+
: '0 0 6px 0 rgba(0, 0, 0, 0.1),0 10px 6px 0 rgba(170, 182, 206, 0.2)'
|
|
50
|
+
}`};
|
|
51
|
+
`;
|
|
52
|
+
const ContentWrapper = styled.div`
|
|
53
|
+
display: ${(props) => `${props.boxCount > 0 ? 'flex' : 'block'}`};;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
width: 100%;
|
|
56
|
+
margin-top: ${(props) => `${props.contentMarginTop}`};
|
|
57
|
+
padding: ${(props) => `${props.contentPadding}`};
|
|
58
|
+
position: relative;
|
|
59
|
+
z-index:0;
|
|
60
|
+
`;
|
|
61
|
+
const Section = styled.div`
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
&:nth-child(1) > * {
|
|
65
|
+
margin-right: 10px;
|
|
66
|
+
}
|
|
67
|
+
&:nth-child(2) > * {
|
|
68
|
+
margin: 0 5px;
|
|
69
|
+
}
|
|
70
|
+
&:nth-child(3) > * {
|
|
71
|
+
margin-left: 10px;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const GoBack = styled.div`
|
|
76
|
+
position: relative;
|
|
77
|
+
display: inline-block;
|
|
78
|
+
margin-right: 40px !important;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
&::after {
|
|
81
|
+
content: "";
|
|
82
|
+
position: absolute;
|
|
83
|
+
width: 1px;
|
|
84
|
+
height: 16px;
|
|
85
|
+
right: -20px;
|
|
86
|
+
top: 50%;
|
|
87
|
+
transform: translateY(-50%);
|
|
88
|
+
background-color: #dcdfe6;
|
|
89
|
+
}
|
|
90
|
+
&:hover {
|
|
91
|
+
&,i {
|
|
92
|
+
color: #126BFB;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
i {
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
margin-right: 6px;
|
|
98
|
+
color: #4c4c4c;
|
|
99
|
+
}
|
|
100
|
+
span {
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
font-weight: normal;
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const BoxWrapper = styled.div`
|
|
107
|
+
overflow: auto;
|
|
108
|
+
`;
|
|
109
|
+
=======
|
|
110
|
+
const clsPrefix = 'tnt-page';
|
|
111
|
+
>>>>>>> b0d5e9811a677a0f26474e1b615ccac1683b6dec
|
|
112
|
+
|
|
113
|
+
const PageLayout = ({
|
|
114
|
+
className,
|
|
115
|
+
height = '100vh',
|
|
116
|
+
headerHeight = 50,
|
|
117
|
+
children,
|
|
118
|
+
title,
|
|
119
|
+
goBack,
|
|
120
|
+
goBackText,
|
|
121
|
+
center,
|
|
122
|
+
extra,
|
|
123
|
+
size = 'small',
|
|
124
|
+
inLayout = false,
|
|
125
|
+
className,
|
|
126
|
+
...restProps
|
|
127
|
+
}) => {
|
|
128
|
+
// 如果传入只有数字,需要默认加px
|
|
129
|
+
let computedHeaderHeight = addUnitForValue(headerHeight);
|
|
130
|
+
let computedHeight = addUnitForValue(height);
|
|
131
|
+
|
|
132
|
+
// 判断是否有标题栏
|
|
133
|
+
if (!(title || extra || center)) {
|
|
134
|
+
computedHeaderHeight = '0px';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (inLayout) {
|
|
138
|
+
computedHeaderHeight = '40px';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// 计算中间的zIndex,灰色递减,白色递增
|
|
142
|
+
let whiteCols = 0;
|
|
143
|
+
let childrenToArray = [];
|
|
144
|
+
|
|
145
|
+
// 计算children type是box的数量
|
|
146
|
+
let boxCount = 0;
|
|
147
|
+
|
|
148
|
+
// 如果children是单个节点,统一转为数组处理计算层级
|
|
149
|
+
console.log('children', children);
|
|
150
|
+
|
|
151
|
+
if (typeof children === 'object') {
|
|
152
|
+
childrenToArray = [children];
|
|
153
|
+
} else if (Array.isArray(children)) {
|
|
154
|
+
childrenToArray = [...children];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.log('React.Children', React.Children);
|
|
158
|
+
React.Children.map(children, (child) => {
|
|
159
|
+
if (child.type === Box) {
|
|
160
|
+
boxCount += 1;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
console.log(boxCount);
|
|
165
|
+
|
|
166
|
+
whiteCols = childrenToArray?.filter(({ props }) => props?.mode === 'white')?.length;
|
|
167
|
+
const total = childrenToArray?.length;
|
|
168
|
+
let startIndex = total - whiteCols - 1;
|
|
169
|
+
let endIndex = total - 1;
|
|
170
|
+
const headerStyle = {
|
|
171
|
+
height: computedHeaderHeight,
|
|
172
|
+
padding: `${size === 'small' ? 20 : 24}px`,
|
|
173
|
+
zIndex: total || 2
|
|
174
|
+
};
|
|
175
|
+
const contentStyle = {
|
|
176
|
+
display: boxCount > 0 ? 'flex' : 'block',
|
|
177
|
+
marginTop: computedHeaderHeight,
|
|
178
|
+
padding: inLayout ? '16px 20px' : '0px'
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<<<<<<< HEAD
|
|
183
|
+
<PageWrapper
|
|
184
|
+
className={cn('tntd-page-wrap', className)}
|
|
185
|
+
height={computedHeight}
|
|
186
|
+
inLayout={inLayout}
|
|
187
|
+
{...restProps}
|
|
188
|
+
>
|
|
189
|
+
{
|
|
190
|
+
(title || center || extra) &&
|
|
191
|
+
<HeaderWrapper
|
|
192
|
+
headerHeight={computedHeaderHeight}
|
|
193
|
+
size={size}
|
|
194
|
+
zIndex={total || 2}
|
|
195
|
+
inLayout={inLayout}
|
|
196
|
+
className='page-header-wrap'
|
|
197
|
+
>
|
|
198
|
+
{
|
|
199
|
+
title &&
|
|
200
|
+
<Section className='page-header-title'>
|
|
201
|
+
{
|
|
202
|
+
goBack &&
|
|
203
|
+
<GoBack
|
|
204
|
+
className='page-header-title-back'
|
|
205
|
+
onClick={() => {
|
|
206
|
+
goBack();
|
|
207
|
+
}}
|
|
208
|
+
>
|
|
209
|
+
<Icon type="left" />
|
|
210
|
+
<span>{goBackText ? goBackText : '返回'}</span>
|
|
211
|
+
</GoBack>
|
|
212
|
+
}
|
|
213
|
+
{title}
|
|
214
|
+
</Section>
|
|
215
|
+
}
|
|
216
|
+
{
|
|
217
|
+
center &&
|
|
218
|
+
<Section className='page-header-center'>{center}</Section>
|
|
219
|
+
}
|
|
220
|
+
{
|
|
221
|
+
extra &&
|
|
222
|
+
<Section className='page-header-extra'>{extra}</Section>
|
|
223
|
+
}
|
|
224
|
+
</HeaderWrapper>
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
<ContentWrapper
|
|
228
|
+
contentMarginTop={computedHeaderHeight}
|
|
229
|
+
contentPadding={inLayout ? '16px 20px' : '0px'}
|
|
230
|
+
boxCount={boxCount}
|
|
231
|
+
className='page-body-wrap'
|
|
232
|
+
>
|
|
233
|
+
=======
|
|
234
|
+
<div
|
|
235
|
+
className={
|
|
236
|
+
cn(clsPrefix, {
|
|
237
|
+
[className]: className,
|
|
238
|
+
inLayout
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
{...restProps}
|
|
242
|
+
>
|
|
243
|
+
{
|
|
244
|
+
(title || center || extra) && (
|
|
245
|
+
<div className={`${clsPrefix}-header`} style={headerStyle}>
|
|
246
|
+
{
|
|
247
|
+
[title, center, extra].filter(
|
|
248
|
+
item => !!item
|
|
249
|
+
).map(item => (
|
|
250
|
+
<div className={`${clsPrefix}-header-section`}>
|
|
251
|
+
{item}
|
|
252
|
+
</div>
|
|
253
|
+
))
|
|
254
|
+
}
|
|
255
|
+
</div>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
<div className={`${clsPrefix}-content`} style={contentStyle}>
|
|
259
|
+
>>>>>>> b0d5e9811a677a0f26474e1b615ccac1683b6dec
|
|
260
|
+
{React.Children.map(children, (child) => {
|
|
261
|
+
// 如果children不是Box,就不需要多列布局
|
|
262
|
+
if (!child.type) {
|
|
263
|
+
// console.log("没有type");
|
|
264
|
+
return React.cloneElement(<div>{child}</div>);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const extraProps = {
|
|
268
|
+
headerHeight: computedHeaderHeight,
|
|
269
|
+
size,
|
|
270
|
+
height: computedHeight,
|
|
271
|
+
contentTotalMargin: inLayout ? '32px' : '0px',
|
|
272
|
+
...child.props
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
if (child.type !== Box) {
|
|
276
|
+
return React.cloneElement(child, extraProps);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const { mode = 'gray', width } = child.props;
|
|
280
|
+
|
|
281
|
+
const style = {
|
|
282
|
+
flex: computeWidth(width),
|
|
283
|
+
// 设置cols层级关系
|
|
284
|
+
zIndex: mode === 'gray' ? startIndex-- : endIndex--
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const className = cn(`${clsPrefix}-box ${clsPrefix}-box-${mode}`);
|
|
288
|
+
|
|
289
|
+
return React.createElement(
|
|
290
|
+
'div',
|
|
291
|
+
{ className, style },
|
|
292
|
+
React.cloneElement(child, extraProps)
|
|
293
|
+
);
|
|
294
|
+
})}
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
PageLayout.Box = Box;
|
|
301
|
+
|
|
302
|
+
export default PageLayout;
|
package/lib/Page/index.js
CHANGED
|
@@ -108,9 +108,9 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
108
108
|
var props = _ref2.props;
|
|
109
109
|
return (props == null ? void 0 : props.mode) === 'white';
|
|
110
110
|
})) == null ? void 0 : _childrenToArray$filt.length;
|
|
111
|
-
var total = (_childrenToArray2 = childrenToArray) == null ? void 0 : _childrenToArray2.length;
|
|
111
|
+
var total = ((_childrenToArray2 = childrenToArray) == null ? void 0 : _childrenToArray2.length) + 5;
|
|
112
112
|
var startIndex = total - whiteCols - 1;
|
|
113
|
-
var endIndex = total -
|
|
113
|
+
var endIndex = total - 2;
|
|
114
114
|
var headerStyle = {
|
|
115
115
|
height: computedHeaderHeight,
|
|
116
116
|
padding: "".concat(size === 'small' ? 20 : 24, "px"),
|
|
@@ -168,7 +168,7 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
168
168
|
var style = {
|
|
169
169
|
flex: (0, _utils.computeWidth)(width),
|
|
170
170
|
// 设置cols层级关系
|
|
171
|
-
zIndex: mode === 'gray' ?
|
|
171
|
+
zIndex: mode === 'gray' ? endIndex-- : startIndex++
|
|
172
172
|
};
|
|
173
173
|
var className = (0, _classnames["default"])("".concat(clsPrefix, "-box ").concat(clsPrefix, "-box-").concat(mode));
|
|
174
174
|
return _react["default"].createElement('div', {
|
package/lib/Page/index.less
CHANGED
|
@@ -1,26 +1,46 @@
|
|
|
1
|
+
.large-size > .ant-layout-content {
|
|
2
|
+
.tnt-page.in-layout {
|
|
3
|
+
height: calc(100vh - 60px);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
1
6
|
.tnt-page {
|
|
2
7
|
position: relative;
|
|
3
8
|
width: 100%;
|
|
4
9
|
height: 100%;
|
|
5
10
|
overflow-y: hidden;
|
|
6
11
|
|
|
12
|
+
&.in-layout {
|
|
13
|
+
box-shadow: none;
|
|
14
|
+
height: calc(100vh - 50px);
|
|
15
|
+
.tnt-page-box,
|
|
16
|
+
.tnt-page-box > .ant-card {
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
.tnt-page-content .tnt-page-box .ant-card .ant-card-body {
|
|
20
|
+
overflow-x: hidden;
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
&-box-white {
|
|
8
26
|
z-index: 1;
|
|
9
27
|
background: #f3f5f6;
|
|
10
28
|
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.1), 0 10px 12px 2px rgba(170, 182, 206, 0.2);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
29
|
+
|
|
30
|
+
.in-layout & {
|
|
31
|
+
background: #fafbfc;
|
|
14
32
|
}
|
|
15
33
|
}
|
|
16
34
|
|
|
35
|
+
|
|
17
36
|
&-box-gray {
|
|
18
37
|
background: #e8ebed;
|
|
19
38
|
box-shadow: 0 10px 12px 2px rgba(0, 0, 0, 0.1);
|
|
20
39
|
|
|
21
|
-
.
|
|
40
|
+
.in-layout & {
|
|
22
41
|
background: #f8f9fa;
|
|
23
|
-
box-shadow: 0 5px 5px 2px rgba(0, 0, 0, 0.1);
|
|
42
|
+
// box-shadow: 0 5px 5px 2px rgba(0, 0, 0, 0.1);
|
|
43
|
+
box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.1);
|
|
24
44
|
}
|
|
25
45
|
}
|
|
26
46
|
|
|
@@ -36,7 +56,7 @@
|
|
|
36
56
|
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.1),
|
|
37
57
|
0 10px 6px 0 rgba(170, 182, 206, 0.2);
|
|
38
58
|
|
|
39
|
-
.
|
|
59
|
+
.in-layout & {
|
|
40
60
|
background: #ffffff;
|
|
41
61
|
box-shadow: none;
|
|
42
62
|
}
|
|
@@ -76,9 +96,13 @@
|
|
|
76
96
|
.ant-card-head {
|
|
77
97
|
border-bottom: 1px solid #e0e0e0;
|
|
78
98
|
margin-bottom: 0;
|
|
79
|
-
height: 60px;
|
|
99
|
+
// height: 60px;
|
|
80
100
|
.small & {
|
|
81
101
|
height: 40px;
|
|
102
|
+
line-height: 40px;
|
|
103
|
+
}
|
|
104
|
+
.ant-card-head-title {
|
|
105
|
+
font-weight: normal;
|
|
82
106
|
}
|
|
83
107
|
}
|
|
84
108
|
.ant-card-body {
|
package/lib/QueryForm/index.js
CHANGED
|
@@ -35,6 +35,8 @@ var _Icon = _interopRequireDefault(require("../Icon"));
|
|
|
35
35
|
|
|
36
36
|
var _Field = _interopRequireDefault(require("./Field"));
|
|
37
37
|
|
|
38
|
+
var _locale = require("../locale");
|
|
39
|
+
|
|
38
40
|
require("./index.less");
|
|
39
41
|
|
|
40
42
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -71,10 +73,6 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
71
73
|
|
|
72
74
|
var clsPrefix = 'tnt-queryform';
|
|
73
75
|
|
|
74
|
-
var isInput = function isInput(type) {
|
|
75
|
-
return ['input', 'string', 'search'].includes(type);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
76
|
var QueryForm =
|
|
79
77
|
/*#__PURE__*/
|
|
80
78
|
function (_React$PureComponent) {
|
|
@@ -238,16 +236,16 @@ function (_React$PureComponent) {
|
|
|
238
236
|
onClick: _this2.onShowDrawer
|
|
239
237
|
}, _react["default"].createElement(_Icon["default"], {
|
|
240
238
|
type: "filter"
|
|
241
|
-
}),
|
|
239
|
+
}), _this2.getText('moreFiltering'))), showSearch && _react["default"].createElement(_button["default"], {
|
|
242
240
|
type: "primary",
|
|
243
241
|
onClick: _this2.onSearch
|
|
244
|
-
},
|
|
242
|
+
}, _this2.getText('search')), showReset && _react["default"].createElement(_button["default"], {
|
|
245
243
|
onClick: _this2.onReset
|
|
246
|
-
},
|
|
244
|
+
}, _this2.getText('reset')), showMore && !showFieldCount && _react["default"].createElement(_button["default"], {
|
|
247
245
|
className: "expand-link",
|
|
248
246
|
type: "link",
|
|
249
247
|
onClick: _this2.onToggleExpand
|
|
250
|
-
}, expanded ? '
|
|
248
|
+
}, _this2.getText(expanded ? 'collapse' : 'expand')), _react["default"].Children.map(children, function (child) {
|
|
251
249
|
var _child$props;
|
|
252
250
|
|
|
253
251
|
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && _react["default"].cloneElement(child);
|
|
@@ -276,7 +274,7 @@ function (_React$PureComponent) {
|
|
|
276
274
|
})), _react["default"].createElement("div", {
|
|
277
275
|
className: "".concat(clsPrefix, "-actions")
|
|
278
276
|
}, renderFormActions()), showFieldCount && _react["default"].createElement(_drawer["default"], _extends({
|
|
279
|
-
title:
|
|
277
|
+
title: this.getText('moreFiltering'),
|
|
280
278
|
visible: drawerVisible,
|
|
281
279
|
onClose: function onClose() {
|
|
282
280
|
return _this2.setState({
|
|
@@ -301,12 +299,17 @@ function (_React$PureComponent) {
|
|
|
301
299
|
}), _react["default"].createElement(_button["default"], {
|
|
302
300
|
type: "primary",
|
|
303
301
|
onClick: this.onSearch
|
|
304
|
-
},
|
|
302
|
+
}, this.getText('search')), _react["default"].createElement(_button["default"], {
|
|
305
303
|
onClick: this.onReset
|
|
306
|
-
},
|
|
304
|
+
}, this.getText('reset')))), extraActions && _react["default"].createElement("div", {
|
|
307
305
|
className: "".concat(clsPrefix, "-extra")
|
|
308
306
|
}, extraActions));
|
|
309
307
|
}
|
|
308
|
+
}, {
|
|
309
|
+
key: "getText",
|
|
310
|
+
value: function getText(key) {
|
|
311
|
+
return (0, _locale.getText)(key, this.props.language || (0, _locale.getLanguage)());
|
|
312
|
+
}
|
|
310
313
|
}, {
|
|
311
314
|
key: "isFieldsWidthOverflow",
|
|
312
315
|
value: function isFieldsWidthOverflow() {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
require("antd/lib/input/style");
|
|
11
|
+
|
|
12
|
+
var _input = _interopRequireDefault(require("antd/lib/input"));
|
|
13
|
+
|
|
14
|
+
require("antd/lib/select/style");
|
|
15
|
+
|
|
16
|
+
var _select = _interopRequireDefault(require("antd/lib/select"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _lodash = require("lodash");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
41
|
+
|
|
42
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
43
|
+
|
|
44
|
+
var Option = _select["default"].Option;
|
|
45
|
+
|
|
46
|
+
var _default = function _default(props) {
|
|
47
|
+
var _props$options = props.options,
|
|
48
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
49
|
+
inputProps = _objectWithoutProperties(props, ["options"]);
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(options),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
items = _useState2[0],
|
|
54
|
+
setItems = _useState2[1];
|
|
55
|
+
|
|
56
|
+
var getInitialKey = function getInitialKey() {
|
|
57
|
+
var key = (0, _lodash.get)(options, '0.value');
|
|
58
|
+
|
|
59
|
+
if (inputProps.value) {
|
|
60
|
+
key = (0, _lodash.get)(Object.keys(inputProps.value), '0') || key;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return key;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var _useState3 = (0, _react.useState)(getInitialKey()),
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
key = _useState4[0],
|
|
69
|
+
setKey = _useState4[1];
|
|
70
|
+
|
|
71
|
+
var onKeyChange = function onKeyChange(key) {
|
|
72
|
+
setKey(key);
|
|
73
|
+
props.onChange(_defineProperty({}, key, ''));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var onChange = function onChange(evt) {
|
|
77
|
+
props.onChange(_defineProperty({}, key, evt.target.value));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var addonBefore = _react["default"].createElement(_select["default"], {
|
|
81
|
+
value: key,
|
|
82
|
+
onChange: onKeyChange
|
|
83
|
+
}, items.map(function (_ref) {
|
|
84
|
+
var label = _ref.label,
|
|
85
|
+
value = _ref.value;
|
|
86
|
+
return _react["default"].createElement(Option, {
|
|
87
|
+
key: value,
|
|
88
|
+
value: value
|
|
89
|
+
}, label);
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
var getInputValue = function getInputValue() {
|
|
93
|
+
return (0, _lodash.get)(inputProps.value, key);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
(0, _react.useEffect)(function () {
|
|
97
|
+
setItems(options);
|
|
98
|
+
setKey(getInitialKey());
|
|
99
|
+
}, [options, inputProps.value]);
|
|
100
|
+
return _react["default"].createElement(_input["default"], _extends({}, inputProps, {
|
|
101
|
+
value: getInputValue(),
|
|
102
|
+
addonBefore: addonBefore,
|
|
103
|
+
onChange: onChange
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/lib/date-picker/style");
|
|
9
|
+
|
|
10
|
+
var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
|
|
11
|
+
|
|
12
|
+
require("antd/lib/input-number/style");
|
|
13
|
+
|
|
14
|
+
var _inputNumber = _interopRequireDefault(require("antd/lib/input-number"));
|
|
15
|
+
|
|
16
|
+
require("antd/lib/input/style");
|
|
17
|
+
|
|
18
|
+
var _input = _interopRequireDefault(require("antd/lib/input"));
|
|
19
|
+
|
|
20
|
+
var _select = _interopRequireDefault(require("./select"));
|
|
21
|
+
|
|
22
|
+
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var _default = {
|
|
27
|
+
string: _input["default"],
|
|
28
|
+
input: _input["default"],
|
|
29
|
+
search: _input["default"].Search,
|
|
30
|
+
inputNumber: _inputNumber["default"],
|
|
31
|
+
number: _inputNumber["default"],
|
|
32
|
+
select: _select["default"],
|
|
33
|
+
date: _datePicker["default"],
|
|
34
|
+
dateRange: _datePicker["default"].RangePicker,
|
|
35
|
+
selectInput: _SelectInput["default"]
|
|
36
|
+
};
|
|
37
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/lib/form/style");
|
|
9
|
+
|
|
10
|
+
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
|
|
16
|
+
var _fieldsMap = _interopRequireDefault(require("./fieldsMap"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
var FormItem = _form["default"].Item;
|
|
25
|
+
|
|
26
|
+
var _default = function _default(props) {
|
|
27
|
+
var _props$type = props.type,
|
|
28
|
+
type = _props$type === void 0 ? 'input' : _props$type,
|
|
29
|
+
title = props.title,
|
|
30
|
+
name = props.name,
|
|
31
|
+
initialValue = props.initialValue,
|
|
32
|
+
form = props.form,
|
|
33
|
+
actions = props.actions,
|
|
34
|
+
_props$className = props.className,
|
|
35
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
36
|
+
component = props.component,
|
|
37
|
+
fieldProps = props.props;
|
|
38
|
+
var getFieldDecorator = form.getFieldDecorator;
|
|
39
|
+
var Field = component || _fieldsMap["default"][type];
|
|
40
|
+
var isInput = ['input', 'string'].includes(type);
|
|
41
|
+
|
|
42
|
+
var onFieldChange = function onFieldChange() {
|
|
43
|
+
var _ref = fieldProps || {},
|
|
44
|
+
onChange = _ref.onChange;
|
|
45
|
+
|
|
46
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
+
args[_key] = arguments[_key];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onChange && onChange.apply(void 0, args); // Input onChange第一个参数为Event对象,取值特殊处理
|
|
51
|
+
|
|
52
|
+
if (!component && isInput) {
|
|
53
|
+
args[0] = (0, _lodash.get)(args[0], 'target.value');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
actions.emit.apply(actions, ['fieldChange', name].concat(args));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return _react["default"].createElement(FormItem, {
|
|
60
|
+
label: title,
|
|
61
|
+
className: className
|
|
62
|
+
}, getFieldDecorator(name, {
|
|
63
|
+
initialValue: initialValue
|
|
64
|
+
})(_react["default"].createElement(Field, _extends({}, isInput ? {
|
|
65
|
+
onPressEnter: function onPressEnter(evt) {
|
|
66
|
+
var _actions$search;
|
|
67
|
+
|
|
68
|
+
return actions.search((_actions$search = {}, _defineProperty(_actions$search, name, evt.target.value), _defineProperty(_actions$search, "current", 1), _actions$search));
|
|
69
|
+
}
|
|
70
|
+
} : {}, fieldProps, {
|
|
71
|
+
onChange: onFieldChange
|
|
72
|
+
}))));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports["default"] = _default;
|