@gmfe/table-x 2.14.15 → 2.14.19-beta.0
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/README.md +13 -13
- package/package.json +4 -4
- package/src/base/index.js +142 -142
- package/src/base/td.js +56 -56
- package/src/base/th.js +48 -48
- package/src/base/thead.js +26 -26
- package/src/base/tr.js +53 -53
- package/src/base/virtualized.js +219 -219
- package/src/hoc/diy_table_x/components/diy_table_x_modal.js +135 -135
- package/src/hoc/diy_table_x/components/modal_list.js +78 -78
- package/src/hoc/diy_table_x/components/modal_selector.js +56 -56
- package/src/hoc/diy_table_x/index.js +196 -196
- package/src/hoc/edit_table_x.js +20 -20
- package/src/hoc/expand_table_x/index.js +140 -140
- package/src/hoc/expand_table_x/util.js +27 -27
- package/src/hoc/fixed_columns_table_x.js +29 -29
- package/src/hoc/select_table_x/cell.js +51 -51
- package/src/hoc/select_table_x/header.js +28 -28
- package/src/hoc/select_table_x/index.js +139 -139
- package/src/hoc/select_table_x/util.js +10 -10
- package/src/hoc/sortable_table_x.js +52 -52
- package/src/hoc/sub_table_x.js +44 -44
- package/src/index.js +53 -53
- package/src/index.less +515 -515
- package/src/stories/table_x.stories.js +324 -324
- package/src/stories/table_x_hoc.stories.js +427 -427
- package/src/stories/table_x_hoc_select_expand.stories.js +256 -256
- package/src/util/batch_action_bar.js +124 -124
- package/src/util/edit.js +83 -83
- package/src/util/index.js +191 -191
- package/src/util/operation.js +249 -249
- package/src/util/sort_header.js +49 -49
- package/src/variables.less +28 -28
- package/svg/business.svg +20 -20
- package/svg/check-detail.svg +18 -18
- package/svg/closeup.svg +20 -20
- package/svg/delete.svg +10 -10
- package/svg/edit-pen.svg +17 -17
- package/svg/empty.svg +27 -27
- package/svg/expand.svg +21 -21
- package/svg/pen.svg +12 -12
- package/svg/recover.svg +33 -33
- package/svg/remove.svg +1 -1
- package/svg/setting.svg +17 -17
package/src/util/operation.js
CHANGED
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
import classNames from 'classnames'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import SVGCheckDetail from '../../svg/check-detail.svg'
|
|
4
|
-
import React, { cloneElement, useRef } from 'react'
|
|
5
|
-
import { PopupContentConfirm, Popover, Button, ToolTip } from '@gmfe/react'
|
|
6
|
-
import styled from 'styled-components'
|
|
7
|
-
import SVGDelete from '../../svg/delete.svg'
|
|
8
|
-
import SVGPen from '../../svg/pen.svg'
|
|
9
|
-
import SVGRecover from '../../svg/recover.svg'
|
|
10
|
-
import { getLocale } from '@gmfe/locales'
|
|
11
|
-
|
|
12
|
-
const IconTip = styled.div`
|
|
13
|
-
padding: 8px;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const OperationHeader = () => <div className='text-center'>操作</div>
|
|
17
|
-
|
|
18
|
-
const OperationIconTip = ({ tip, children }) => {
|
|
19
|
-
const tipRef = useRef()
|
|
20
|
-
|
|
21
|
-
const handleClick = (fc, event) => {
|
|
22
|
-
tipRef.current.apiDoSetActive()
|
|
23
|
-
fc && fc(event)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<ToolTip popup={<IconTip>{tip}</IconTip>} showArrow ref={tipRef}>
|
|
28
|
-
{cloneElement(children, {
|
|
29
|
-
onClick: event => handleClick(children.props.onClick, event)
|
|
30
|
-
})}
|
|
31
|
-
</ToolTip>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
OperationIconTip.propTypes = {
|
|
36
|
-
tip: PropTypes.string.isRequired,
|
|
37
|
-
children: PropTypes.object.isRequired
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const OperationCell = props => (
|
|
41
|
-
<div {...props} className={classNames('text-center', props.className)} />
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
OperationCell.propTypes = {
|
|
45
|
-
className: PropTypes.string,
|
|
46
|
-
style: PropTypes.object
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const OperationDetail = ({ href, open, onClick, className, ...rest }) => {
|
|
50
|
-
const handleClick = e => {
|
|
51
|
-
onClick && onClick(e)
|
|
52
|
-
|
|
53
|
-
if (href) {
|
|
54
|
-
if (open) {
|
|
55
|
-
window.open(href)
|
|
56
|
-
} else {
|
|
57
|
-
window.location.href = href
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
{...rest}
|
|
65
|
-
onClick={handleClick}
|
|
66
|
-
className={classNames(
|
|
67
|
-
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
68
|
-
className
|
|
69
|
-
)}
|
|
70
|
-
>
|
|
71
|
-
<OperationIconTip tip={getLocale('详情')}>
|
|
72
|
-
<div>
|
|
73
|
-
<SVGCheckDetail />
|
|
74
|
-
</div>
|
|
75
|
-
</OperationIconTip>
|
|
76
|
-
</div>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
OperationDetail.propTypes = {
|
|
81
|
-
/** 如果提供了 href */
|
|
82
|
-
href: PropTypes.string,
|
|
83
|
-
/** true就新开tab页面 */
|
|
84
|
-
open: PropTypes.bool,
|
|
85
|
-
onClick: PropTypes.func,
|
|
86
|
-
className: PropTypes.string,
|
|
87
|
-
style: PropTypes.object
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const OperationDelete = props => {
|
|
91
|
-
const { title, onClick, className, children, ...rest } = props
|
|
92
|
-
const refPopover = useRef()
|
|
93
|
-
|
|
94
|
-
const handleDelete = () => {
|
|
95
|
-
refPopover.current.apiDoSetActive(false)
|
|
96
|
-
return onClick()
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const handleCancel = () => {
|
|
100
|
-
refPopover.current.apiDoSetActive(false)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const popup = (
|
|
104
|
-
<PopupContentConfirm
|
|
105
|
-
type='delete'
|
|
106
|
-
title={title}
|
|
107
|
-
onDelete={handleDelete}
|
|
108
|
-
onCancel={handleCancel}
|
|
109
|
-
>
|
|
110
|
-
{children || '确定删除?'}
|
|
111
|
-
</PopupContentConfirm>
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Popover ref={refPopover} right popup={popup} showArrow>
|
|
116
|
-
<div
|
|
117
|
-
{...rest}
|
|
118
|
-
className={classNames(
|
|
119
|
-
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
120
|
-
className
|
|
121
|
-
)}
|
|
122
|
-
>
|
|
123
|
-
<OperationIconTip tip={getLocale('删除')}>
|
|
124
|
-
<div>
|
|
125
|
-
<SVGDelete />
|
|
126
|
-
</div>
|
|
127
|
-
</OperationIconTip>
|
|
128
|
-
</div>
|
|
129
|
-
</Popover>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
OperationDelete.propTypes = {
|
|
134
|
-
title: PropTypes.string,
|
|
135
|
-
onClick: PropTypes.func.isRequired,
|
|
136
|
-
className: PropTypes.string,
|
|
137
|
-
style: PropTypes.object
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const OperationRowEdit = ({
|
|
141
|
-
children,
|
|
142
|
-
isEditing,
|
|
143
|
-
onClick,
|
|
144
|
-
onSave,
|
|
145
|
-
onCancel
|
|
146
|
-
}) => {
|
|
147
|
-
const handleClick = () => {
|
|
148
|
-
onClick && onClick()
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const handleSave = () => {
|
|
152
|
-
onSave && onSave()
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const handleCancel = () => {
|
|
156
|
-
onCancel && onCancel()
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return !isEditing ? (
|
|
160
|
-
<OperationCell>
|
|
161
|
-
<OperationIconTip tip={getLocale('编辑')}>
|
|
162
|
-
<span className='gm-padding-5'>
|
|
163
|
-
<SVGPen
|
|
164
|
-
className='gm-inline-block gm-cursor gm-text-14 gm-text gm-text-hover-primary'
|
|
165
|
-
onClick={handleClick}
|
|
166
|
-
/>
|
|
167
|
-
</span>
|
|
168
|
-
</OperationIconTip>
|
|
169
|
-
{children}
|
|
170
|
-
</OperationCell>
|
|
171
|
-
) : (
|
|
172
|
-
<OperationCell>
|
|
173
|
-
<Button type='link' onClick={handleSave}>
|
|
174
|
-
保存
|
|
175
|
-
</Button>
|
|
176
|
-
<span className='gm-padding-lr-5'>|</span>
|
|
177
|
-
<Button type='link' onClick={handleCancel}>
|
|
178
|
-
取消
|
|
179
|
-
</Button>
|
|
180
|
-
</OperationCell>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
OperationRowEdit.propTypes = {
|
|
185
|
-
isEditing: PropTypes.bool.isRequired,
|
|
186
|
-
onClick: PropTypes.func,
|
|
187
|
-
onSave: PropTypes.func,
|
|
188
|
-
onCancel: PropTypes.func
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const OperationRecover = props => {
|
|
192
|
-
const { title, onClick, className, children, ...rest } = props
|
|
193
|
-
const refPopover = useRef()
|
|
194
|
-
|
|
195
|
-
const handleRevover = () => {
|
|
196
|
-
refPopover.current.apiDoSetActive(false)
|
|
197
|
-
return onClick()
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const handleCancel = () => {
|
|
201
|
-
refPopover.current.apiDoSetActive(false)
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const popup = (
|
|
205
|
-
<PopupContentConfirm
|
|
206
|
-
type='save'
|
|
207
|
-
title={title}
|
|
208
|
-
onSave={handleRevover}
|
|
209
|
-
onCancel={handleCancel}
|
|
210
|
-
>
|
|
211
|
-
{children || '确定恢复?'}
|
|
212
|
-
</PopupContentConfirm>
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
<Popover ref={refPopover} right popup={popup} showArrow>
|
|
217
|
-
<div
|
|
218
|
-
{...rest}
|
|
219
|
-
className={classNames(
|
|
220
|
-
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
221
|
-
className
|
|
222
|
-
)}
|
|
223
|
-
>
|
|
224
|
-
<OperationIconTip tip={getLocale('恢复')}>
|
|
225
|
-
<div>
|
|
226
|
-
<SVGRecover />
|
|
227
|
-
</div>
|
|
228
|
-
</OperationIconTip>
|
|
229
|
-
</div>
|
|
230
|
-
</Popover>
|
|
231
|
-
)
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
OperationRecover.propTypes = {
|
|
235
|
-
title: PropTypes.string,
|
|
236
|
-
onClick: PropTypes.func.isRequired,
|
|
237
|
-
className: PropTypes.string,
|
|
238
|
-
style: PropTypes.object
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export {
|
|
242
|
-
OperationHeader,
|
|
243
|
-
OperationDelete,
|
|
244
|
-
OperationRecover,
|
|
245
|
-
OperationDetail,
|
|
246
|
-
OperationCell,
|
|
247
|
-
OperationRowEdit,
|
|
248
|
-
OperationIconTip
|
|
249
|
-
}
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import SVGCheckDetail from '../../svg/check-detail.svg'
|
|
4
|
+
import React, { cloneElement, useRef } from 'react'
|
|
5
|
+
import { PopupContentConfirm, Popover, Button, ToolTip } from '@gmfe/react'
|
|
6
|
+
import styled from 'styled-components'
|
|
7
|
+
import SVGDelete from '../../svg/delete.svg'
|
|
8
|
+
import SVGPen from '../../svg/pen.svg'
|
|
9
|
+
import SVGRecover from '../../svg/recover.svg'
|
|
10
|
+
import { getLocale } from '@gmfe/locales'
|
|
11
|
+
|
|
12
|
+
const IconTip = styled.div`
|
|
13
|
+
padding: 8px;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const OperationHeader = () => <div className='text-center'>操作</div>
|
|
17
|
+
|
|
18
|
+
const OperationIconTip = ({ tip, children }) => {
|
|
19
|
+
const tipRef = useRef()
|
|
20
|
+
|
|
21
|
+
const handleClick = (fc, event) => {
|
|
22
|
+
tipRef.current.apiDoSetActive()
|
|
23
|
+
fc && fc(event)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ToolTip popup={<IconTip>{tip}</IconTip>} showArrow ref={tipRef}>
|
|
28
|
+
{cloneElement(children, {
|
|
29
|
+
onClick: event => handleClick(children.props.onClick, event)
|
|
30
|
+
})}
|
|
31
|
+
</ToolTip>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
OperationIconTip.propTypes = {
|
|
36
|
+
tip: PropTypes.string.isRequired,
|
|
37
|
+
children: PropTypes.object.isRequired
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const OperationCell = props => (
|
|
41
|
+
<div {...props} className={classNames('text-center', props.className)} />
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
OperationCell.propTypes = {
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
style: PropTypes.object
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const OperationDetail = ({ href, open, onClick, className, ...rest }) => {
|
|
50
|
+
const handleClick = e => {
|
|
51
|
+
onClick && onClick(e)
|
|
52
|
+
|
|
53
|
+
if (href) {
|
|
54
|
+
if (open) {
|
|
55
|
+
window.open(href)
|
|
56
|
+
} else {
|
|
57
|
+
window.location.href = href
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
{...rest}
|
|
65
|
+
onClick={handleClick}
|
|
66
|
+
className={classNames(
|
|
67
|
+
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
68
|
+
className
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
<OperationIconTip tip={getLocale('详情')}>
|
|
72
|
+
<div>
|
|
73
|
+
<SVGCheckDetail />
|
|
74
|
+
</div>
|
|
75
|
+
</OperationIconTip>
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
OperationDetail.propTypes = {
|
|
81
|
+
/** 如果提供了 href */
|
|
82
|
+
href: PropTypes.string,
|
|
83
|
+
/** true就新开tab页面 */
|
|
84
|
+
open: PropTypes.bool,
|
|
85
|
+
onClick: PropTypes.func,
|
|
86
|
+
className: PropTypes.string,
|
|
87
|
+
style: PropTypes.object
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const OperationDelete = props => {
|
|
91
|
+
const { title, onClick, className, children, ...rest } = props
|
|
92
|
+
const refPopover = useRef()
|
|
93
|
+
|
|
94
|
+
const handleDelete = () => {
|
|
95
|
+
refPopover.current.apiDoSetActive(false)
|
|
96
|
+
return onClick()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const handleCancel = () => {
|
|
100
|
+
refPopover.current.apiDoSetActive(false)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const popup = (
|
|
104
|
+
<PopupContentConfirm
|
|
105
|
+
type='delete'
|
|
106
|
+
title={title}
|
|
107
|
+
onDelete={handleDelete}
|
|
108
|
+
onCancel={handleCancel}
|
|
109
|
+
>
|
|
110
|
+
{children || '确定删除?'}
|
|
111
|
+
</PopupContentConfirm>
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Popover ref={refPopover} right popup={popup} showArrow>
|
|
116
|
+
<div
|
|
117
|
+
{...rest}
|
|
118
|
+
className={classNames(
|
|
119
|
+
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
120
|
+
className
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
<OperationIconTip tip={getLocale('删除')}>
|
|
124
|
+
<div>
|
|
125
|
+
<SVGDelete />
|
|
126
|
+
</div>
|
|
127
|
+
</OperationIconTip>
|
|
128
|
+
</div>
|
|
129
|
+
</Popover>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
OperationDelete.propTypes = {
|
|
134
|
+
title: PropTypes.string,
|
|
135
|
+
onClick: PropTypes.func.isRequired,
|
|
136
|
+
className: PropTypes.string,
|
|
137
|
+
style: PropTypes.object
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const OperationRowEdit = ({
|
|
141
|
+
children,
|
|
142
|
+
isEditing,
|
|
143
|
+
onClick,
|
|
144
|
+
onSave,
|
|
145
|
+
onCancel
|
|
146
|
+
}) => {
|
|
147
|
+
const handleClick = () => {
|
|
148
|
+
onClick && onClick()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const handleSave = () => {
|
|
152
|
+
onSave && onSave()
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const handleCancel = () => {
|
|
156
|
+
onCancel && onCancel()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return !isEditing ? (
|
|
160
|
+
<OperationCell>
|
|
161
|
+
<OperationIconTip tip={getLocale('编辑')}>
|
|
162
|
+
<span className='gm-padding-5'>
|
|
163
|
+
<SVGPen
|
|
164
|
+
className='gm-inline-block gm-cursor gm-text-14 gm-text gm-text-hover-primary'
|
|
165
|
+
onClick={handleClick}
|
|
166
|
+
/>
|
|
167
|
+
</span>
|
|
168
|
+
</OperationIconTip>
|
|
169
|
+
{children}
|
|
170
|
+
</OperationCell>
|
|
171
|
+
) : (
|
|
172
|
+
<OperationCell>
|
|
173
|
+
<Button type='link' onClick={handleSave}>
|
|
174
|
+
保存
|
|
175
|
+
</Button>
|
|
176
|
+
<span className='gm-padding-lr-5'>|</span>
|
|
177
|
+
<Button type='link' onClick={handleCancel}>
|
|
178
|
+
取消
|
|
179
|
+
</Button>
|
|
180
|
+
</OperationCell>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
OperationRowEdit.propTypes = {
|
|
185
|
+
isEditing: PropTypes.bool.isRequired,
|
|
186
|
+
onClick: PropTypes.func,
|
|
187
|
+
onSave: PropTypes.func,
|
|
188
|
+
onCancel: PropTypes.func
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const OperationRecover = props => {
|
|
192
|
+
const { title, onClick, className, children, ...rest } = props
|
|
193
|
+
const refPopover = useRef()
|
|
194
|
+
|
|
195
|
+
const handleRevover = () => {
|
|
196
|
+
refPopover.current.apiDoSetActive(false)
|
|
197
|
+
return onClick()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const handleCancel = () => {
|
|
201
|
+
refPopover.current.apiDoSetActive(false)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const popup = (
|
|
205
|
+
<PopupContentConfirm
|
|
206
|
+
type='save'
|
|
207
|
+
title={title}
|
|
208
|
+
onSave={handleRevover}
|
|
209
|
+
onCancel={handleCancel}
|
|
210
|
+
>
|
|
211
|
+
{children || '确定恢复?'}
|
|
212
|
+
</PopupContentConfirm>
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<Popover ref={refPopover} right popup={popup} showArrow>
|
|
217
|
+
<div
|
|
218
|
+
{...rest}
|
|
219
|
+
className={classNames(
|
|
220
|
+
'gm-inline-block gm-cursor gm-padding-5 gm-text-14 gm-text gm-text-hover-primary',
|
|
221
|
+
className
|
|
222
|
+
)}
|
|
223
|
+
>
|
|
224
|
+
<OperationIconTip tip={getLocale('恢复')}>
|
|
225
|
+
<div>
|
|
226
|
+
<SVGRecover />
|
|
227
|
+
</div>
|
|
228
|
+
</OperationIconTip>
|
|
229
|
+
</div>
|
|
230
|
+
</Popover>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
OperationRecover.propTypes = {
|
|
235
|
+
title: PropTypes.string,
|
|
236
|
+
onClick: PropTypes.func.isRequired,
|
|
237
|
+
className: PropTypes.string,
|
|
238
|
+
style: PropTypes.object
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export {
|
|
242
|
+
OperationHeader,
|
|
243
|
+
OperationDelete,
|
|
244
|
+
OperationRecover,
|
|
245
|
+
OperationDetail,
|
|
246
|
+
OperationCell,
|
|
247
|
+
OperationRowEdit,
|
|
248
|
+
OperationIconTip
|
|
249
|
+
}
|
package/src/util/sort_header.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import classNames from 'classnames'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
const SortHeader = ({ type, className, onClick, onChange, ...rest }) => {
|
|
7
|
-
const handleClick = e => {
|
|
8
|
-
onClick(e)
|
|
9
|
-
|
|
10
|
-
if (!type) {
|
|
11
|
-
onChange('asc')
|
|
12
|
-
} else if (type === 'asc') {
|
|
13
|
-
onChange('desc')
|
|
14
|
-
} else if (type === 'desc') {
|
|
15
|
-
onChange(null)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<span
|
|
21
|
-
{...rest}
|
|
22
|
-
onClick={handleClick}
|
|
23
|
-
className={classNames(
|
|
24
|
-
'gm-table-x-sort-header gm-cursor',
|
|
25
|
-
{
|
|
26
|
-
'gm-table-x-sort-header-asc': type === 'asc',
|
|
27
|
-
'gm-table-x-sort-header-desc': type === 'desc'
|
|
28
|
-
},
|
|
29
|
-
className
|
|
30
|
-
)}
|
|
31
|
-
/>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
SortHeader.propTypes = {
|
|
36
|
-
type: PropTypes.oneOf(['asc', 'desc']),
|
|
37
|
-
/** 之前很多用了 onClick */
|
|
38
|
-
onClick: PropTypes.func,
|
|
39
|
-
/** 建议用onChange,这样不用管理状态 */
|
|
40
|
-
onChange: PropTypes.func,
|
|
41
|
-
className: PropTypes.string
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
SortHeader.defaultProps = {
|
|
45
|
-
onClick: _.noop,
|
|
46
|
-
onChange: _.noop
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default SortHeader
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import _ from 'lodash'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
const SortHeader = ({ type, className, onClick, onChange, ...rest }) => {
|
|
7
|
+
const handleClick = e => {
|
|
8
|
+
onClick(e)
|
|
9
|
+
|
|
10
|
+
if (!type) {
|
|
11
|
+
onChange('asc')
|
|
12
|
+
} else if (type === 'asc') {
|
|
13
|
+
onChange('desc')
|
|
14
|
+
} else if (type === 'desc') {
|
|
15
|
+
onChange(null)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<span
|
|
21
|
+
{...rest}
|
|
22
|
+
onClick={handleClick}
|
|
23
|
+
className={classNames(
|
|
24
|
+
'gm-table-x-sort-header gm-cursor',
|
|
25
|
+
{
|
|
26
|
+
'gm-table-x-sort-header-asc': type === 'asc',
|
|
27
|
+
'gm-table-x-sort-header-desc': type === 'desc'
|
|
28
|
+
},
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
SortHeader.propTypes = {
|
|
36
|
+
type: PropTypes.oneOf(['asc', 'desc']),
|
|
37
|
+
/** 之前很多用了 onClick */
|
|
38
|
+
onClick: PropTypes.func,
|
|
39
|
+
/** 建议用onChange,这样不用管理状态 */
|
|
40
|
+
onChange: PropTypes.func,
|
|
41
|
+
className: PropTypes.string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
SortHeader.defaultProps = {
|
|
45
|
+
onClick: _.noop,
|
|
46
|
+
onChange: _.noop
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default SortHeader
|
package/src/variables.less
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
.gm-table-x-edit-table-common-input {
|
|
2
|
-
width: 100%;
|
|
3
|
-
outline: none;
|
|
4
|
-
border-width: 1px;
|
|
5
|
-
border-style: solid;
|
|
6
|
-
padding-left: 8px;
|
|
7
|
-
padding-right: 8px;
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
height: 32px;
|
|
10
|
-
line-height: 32px;
|
|
11
|
-
border-color: #d4d7e9;
|
|
12
|
-
border-radius: 2px;
|
|
13
|
-
|
|
14
|
-
&:hover {
|
|
15
|
-
border-color: @brand-primary;
|
|
16
|
-
box-shadow: 0 0 0 1px @brand-primary;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&:focus {
|
|
20
|
-
border-color: @brand-primary;
|
|
21
|
-
box-shadow: 0 0 0 1px @brand-primary;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&.gm-popover-active {
|
|
25
|
-
border-color: @brand-primary;
|
|
26
|
-
box-shadow: 0 0 0 1px @brand-primary;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
.gm-table-x-edit-table-common-input {
|
|
2
|
+
width: 100%;
|
|
3
|
+
outline: none;
|
|
4
|
+
border-width: 1px;
|
|
5
|
+
border-style: solid;
|
|
6
|
+
padding-left: 8px;
|
|
7
|
+
padding-right: 8px;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
height: 32px;
|
|
10
|
+
line-height: 32px;
|
|
11
|
+
border-color: #d4d7e9;
|
|
12
|
+
border-radius: 2px;
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
border-color: @brand-primary;
|
|
16
|
+
box-shadow: 0 0 0 1px @brand-primary;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:focus {
|
|
20
|
+
border-color: @brand-primary;
|
|
21
|
+
box-shadow: 0 0 0 1px @brand-primary;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.gm-popover-active {
|
|
25
|
+
border-color: @brand-primary;
|
|
26
|
+
box-shadow: 0 0 0 1px @brand-primary;
|
|
27
|
+
}
|
|
28
|
+
}
|