@capillarytech/blaze-ui 0.1.6-alpha.3 → 0.1.6-alpha.32
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/CapInput/CapInput.js +60 -0
- package/components/CapInput/Number.js +39 -0
- package/components/CapInput/Search.js +34 -0
- package/components/CapInput/TextArea.js +41 -0
- package/components/CapInput/index.js +13 -0
- package/components/CapInput/messages.js +24 -0
- package/components/CapInput/styles.js +8 -0
- package/components/CapSkeleton/CapSkeleton.js +24 -0
- package/components/CapSkeleton/index.js +7 -0
- package/components/CapSpin/CapSpin.js +30 -0
- package/components/CapSpin/index.js +7 -0
- package/components/CapTable/CapTable.js +118 -0
- package/components/CapTable/index.js +7 -0
- package/components/CapTable/loadable.js +18 -0
- package/components/CapTable/styles.js +23 -0
- package/components/CapTestSelect/CapTestSelect.js +36 -0
- package/components/CapTestSelect/index.js +7 -0
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +359 -0
- package/components/CapUnifiedSelect/index.js +7 -0
- package/components/CapUnifiedSelect/messages.js +27 -0
- package/components/CapUnifiedSelect/styles.js +36 -0
- package/components/LocaleHoc/index.js +42 -0
- package/components/index.js +33 -0
- package/components/styled/index.js +14 -0
- package/components/styled/variables.js +70 -0
- package/{translations → components/translations}/en.js +37 -35
- package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
- package/dist/components/CapSkeleton/index.js +13 -0
- package/dist/components/CapSpin/CapSpin.js +35 -0
- package/dist/components/CapSpin/index.js +13 -0
- package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
- package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
- package/dist/components/CapTestSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
- package/dist/components/CapUnifiedSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/messages.js +29 -0
- package/dist/components/CapUnifiedSelect/styles.js +39 -0
- package/dist/{index.js → components/index.js} +27 -0
- package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
- package/dist/esm/components/CapSkeleton/index.js +1 -0
- package/dist/esm/components/CapSpin/CapSpin.js +28 -0
- package/dist/esm/components/CapSpin/index.js +1 -0
- package/dist/esm/components/CapTable/loadable.js +12 -0
- package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
- package/dist/esm/components/CapTestSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
- package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
- package/dist/esm/{index.js → components/index.js} +5 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/withStyles.js +23 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/withStyles.js +29 -0
- package/package.json +6 -10
- package/utils/index.js +7 -0
- package/utils/withStyles.js +15 -0
- package/CapHeading/CapHeading.js +0 -71
- package/CapHeading/index.js +0 -1
- package/CapHeading/styles.js +0 -125
- package/CapInfoNote/CapInfoNote.js +0 -54
- package/CapInfoNote/index.js +0 -1
- package/CapInfoNote/styles.js +0 -63
- package/CapInput/CapInput.js +0 -67
- package/CapInput/Number.js +0 -38
- package/CapInput/Search.js +0 -32
- package/CapInput/TextArea.js +0 -45
- package/CapInput/index.js +0 -10
- package/CapInput/loadable.js +0 -9
- package/CapInput/messages.js +0 -27
- package/CapInput/styles.js +0 -81
- package/CapLabel/CapLabel.js +0 -106
- package/CapLabel/index.js +0 -1
- package/CapLabel/styles.js +0 -221
- package/CapRow/CapRow.js +0 -22
- package/CapRow/index.js +0 -1
- package/CapRow/styles.js +0 -9
- package/CapTable/CapTable.js +0 -146
- package/CapTable/index.js +0 -3
- package/CapTable/loadable.js +0 -13
- package/CapTable/styles.js +0 -134
- package/CapTooltip/CapTooltip.js +0 -36
- package/CapTooltip/index.js +0 -1
- package/CapTooltip/styles.js +0 -42
- package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
- package/CapUnifiedSelect/index.js +0 -4
- package/CapUnifiedSelect/loadable.js +0 -3
- package/CapUnifiedSelect/messages.js +0 -24
- package/CapUnifiedSelect/styles.js +0 -223
- package/LocaleHoc/index.js +0 -38
- package/dist/235.index.js +0 -2
- package/dist/235.index.js.LICENSE.txt +0 -29
- package/dist/603.index.js +0 -1
- package/dist/esm/CapHeading/CapHeading.js +0 -41
- package/dist/esm/CapHeading/index.js +0 -1
- package/dist/esm/CapHeading/styles.js +0 -123
- package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
- package/dist/esm/CapInfoNote/index.js +0 -1
- package/dist/esm/CapInfoNote/styles.js +0 -6
- package/dist/esm/CapInput/loadable.js +0 -9
- package/dist/esm/CapLabel/CapLabel.js +0 -50
- package/dist/esm/CapLabel/index.js +0 -1
- package/dist/esm/CapLabel/styles.js +0 -219
- package/dist/esm/CapRow/index.js +0 -1
- package/dist/esm/CapRow/styles.js +0 -5
- package/dist/esm/CapTable/loadable.js +0 -12
- package/dist/esm/CapTooltip/CapTooltip.js +0 -34
- package/dist/esm/CapTooltip/index.js +0 -1
- package/dist/esm/CapTooltip/styles.js +0 -6
- package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
- package/dist/esm/CapUnifiedSelect/index.js +0 -3
- package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
- package/dist/esm/CapUnifiedSelect/styles.js +0 -15
- package/dist/index.js.LICENSE.txt +0 -7
- package/index.js +0 -10
- package/styled/index.js +0 -6
- package/styled/variables.js +0 -89
- /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/{styled → components/styled}/index.js +0 -0
- /package/dist/{styled → components/styled}/variables.js +0 -0
- /package/dist/{translations → components/translations}/en.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/esm/{CapUnifiedSelect → components/CapUnifiedSelect}/messages.js +0 -0
- /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/variables.js +0 -0
- /package/dist/esm/{translations → components/translations}/en.js +0 -0
package/CapLabel/styles.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import * as styledVars from '../styled/variables';
|
|
3
|
-
|
|
4
|
-
const labels = {
|
|
5
|
-
label1: {
|
|
6
|
-
color: styledVars.CAP_G04,
|
|
7
|
-
fontSize: '12px',
|
|
8
|
-
fontWeight: 'normal',
|
|
9
|
-
lineHeight: 'normal',
|
|
10
|
-
},
|
|
11
|
-
label2: {
|
|
12
|
-
color: styledVars.CAP_G01,
|
|
13
|
-
fontSize: '12px',
|
|
14
|
-
fontWeight: 'normal',
|
|
15
|
-
lineHeight: 'normal',
|
|
16
|
-
},
|
|
17
|
-
label3: {
|
|
18
|
-
color: styledVars.CAP_G05,
|
|
19
|
-
fontSize: '12px',
|
|
20
|
-
fontWeight: 'normal',
|
|
21
|
-
lineHeight: 'normal',
|
|
22
|
-
},
|
|
23
|
-
label4: {
|
|
24
|
-
color: styledVars.CAP_G01,
|
|
25
|
-
fontSize: '12px',
|
|
26
|
-
fontWeight: '500',
|
|
27
|
-
lineHeight: 'normal',
|
|
28
|
-
},
|
|
29
|
-
label5: {
|
|
30
|
-
color: styledVars.CAP_G01,
|
|
31
|
-
fontSize: '10px',
|
|
32
|
-
fontWeight: 'normal',
|
|
33
|
-
lineHeight: 'normal',
|
|
34
|
-
},
|
|
35
|
-
label6: {
|
|
36
|
-
color: styledVars.CAP_G06,
|
|
37
|
-
fontSize: '12px',
|
|
38
|
-
fontWeight: 'normal',
|
|
39
|
-
lineHeight: 'normal',
|
|
40
|
-
},
|
|
41
|
-
label7: {
|
|
42
|
-
color: styledVars.CAP_G04,
|
|
43
|
-
fontSize: '14px',
|
|
44
|
-
fontWeight: '500',
|
|
45
|
-
lineHeight: 'normal',
|
|
46
|
-
},
|
|
47
|
-
label8: {
|
|
48
|
-
color: styledVars.CAP_G01,
|
|
49
|
-
fontSize: '12px',
|
|
50
|
-
fontWeight: '500',
|
|
51
|
-
lineHeight: 'normal',
|
|
52
|
-
},
|
|
53
|
-
label9: {
|
|
54
|
-
color: styledVars.CAP_G01,
|
|
55
|
-
fontSize: '12px',
|
|
56
|
-
fontWeight: 'normal',
|
|
57
|
-
lineHeight: '16px',
|
|
58
|
-
},
|
|
59
|
-
label10: {
|
|
60
|
-
color: styledVars.CAP_WHITE,
|
|
61
|
-
fontSize: '12px',
|
|
62
|
-
fontWeight: 'normal',
|
|
63
|
-
lineHeight: '16px',
|
|
64
|
-
},
|
|
65
|
-
label11: {
|
|
66
|
-
color: styledVars.CAP_G04,
|
|
67
|
-
fontSize: '10px',
|
|
68
|
-
fontWeight: 'normal',
|
|
69
|
-
lineHeight: 'normal',
|
|
70
|
-
},
|
|
71
|
-
label12: {
|
|
72
|
-
color: styledVars.CAP_WHITE,
|
|
73
|
-
fontSize: '12px',
|
|
74
|
-
fontWeight: 'normal',
|
|
75
|
-
lineHeight: 'normal',
|
|
76
|
-
},
|
|
77
|
-
label13: {
|
|
78
|
-
color: styledVars.CAP_G05,
|
|
79
|
-
fontSize: '10px',
|
|
80
|
-
fontWeight: 'normal',
|
|
81
|
-
lineHeight: 'normal',
|
|
82
|
-
},
|
|
83
|
-
label14: {
|
|
84
|
-
color: styledVars.CAP_G03,
|
|
85
|
-
fontSize: '14px',
|
|
86
|
-
fontWeight: 'normal',
|
|
87
|
-
lineHeight: 'normal',
|
|
88
|
-
},
|
|
89
|
-
label15: {
|
|
90
|
-
color: styledVars.CAP_G01,
|
|
91
|
-
fontSize: '14px',
|
|
92
|
-
fontWeight: 'normal',
|
|
93
|
-
lineHeight: 'normal',
|
|
94
|
-
},
|
|
95
|
-
label16: {
|
|
96
|
-
color: styledVars.CAP_G01,
|
|
97
|
-
fontSize: '14px',
|
|
98
|
-
fontWeight: '500',
|
|
99
|
-
lineHeight: 'normal',
|
|
100
|
-
},
|
|
101
|
-
label17: {
|
|
102
|
-
color: styledVars.CAP_G01,
|
|
103
|
-
fontSize: '16px',
|
|
104
|
-
fontWeight: '500',
|
|
105
|
-
lineHeight: 'normal',
|
|
106
|
-
},
|
|
107
|
-
label18: {
|
|
108
|
-
color: styledVars.CAP_G04,
|
|
109
|
-
fontSize: '14px',
|
|
110
|
-
fontWeight: 'normal',
|
|
111
|
-
lineHeight: 'normal',
|
|
112
|
-
},
|
|
113
|
-
label19: {
|
|
114
|
-
color: 'rgba(0, 0, 0, 0.87)',
|
|
115
|
-
fontSize: '12px',
|
|
116
|
-
fontWeight: 'normal',
|
|
117
|
-
lineHeight: '16px',
|
|
118
|
-
},
|
|
119
|
-
label20: {
|
|
120
|
-
color: styledVars.CAP_SECONDARY.base,
|
|
121
|
-
fontSize: '14px',
|
|
122
|
-
fontWeight: '500',
|
|
123
|
-
lineHeight: 'normal',
|
|
124
|
-
},
|
|
125
|
-
label21: {
|
|
126
|
-
color: styledVars.CAP_SECONDARY.base,
|
|
127
|
-
fontSize: '12px',
|
|
128
|
-
fontWeight: 'normal',
|
|
129
|
-
lineHeight: 'normal',
|
|
130
|
-
},
|
|
131
|
-
label22: {
|
|
132
|
-
color: styledVars.CAP_G04,
|
|
133
|
-
fontSize: '24px',
|
|
134
|
-
fontWeight: 'normal',
|
|
135
|
-
lineHeight: '28px',
|
|
136
|
-
},
|
|
137
|
-
label23: {
|
|
138
|
-
color: styledVars.CAP_WHITE,
|
|
139
|
-
fontSize: '14px',
|
|
140
|
-
fontWeight: 'normal',
|
|
141
|
-
lineHeight: 'normal',
|
|
142
|
-
},
|
|
143
|
-
label24: {
|
|
144
|
-
fontSize: '14px',
|
|
145
|
-
fontWeight: '400',
|
|
146
|
-
color: styledVars.CAP_G04,
|
|
147
|
-
lineHeight: '20px',
|
|
148
|
-
},
|
|
149
|
-
label25: {
|
|
150
|
-
fontSize: '14px',
|
|
151
|
-
fontWeight: '500',
|
|
152
|
-
color: styledVars.CAP_G04,
|
|
153
|
-
lineHeight: '20px',
|
|
154
|
-
},
|
|
155
|
-
label26: {
|
|
156
|
-
fontSize: '10px',
|
|
157
|
-
fontWeight: '400',
|
|
158
|
-
color: styledVars.CAP_G01,
|
|
159
|
-
lineHeight: '12px',
|
|
160
|
-
},
|
|
161
|
-
label27: {
|
|
162
|
-
fontSize: '12px',
|
|
163
|
-
fontWeight: '500',
|
|
164
|
-
color: styledVars.CAP_SECONDARY.base,
|
|
165
|
-
lineHeight: '16px',
|
|
166
|
-
},
|
|
167
|
-
label28: {
|
|
168
|
-
fontSize: '12px',
|
|
169
|
-
fontWeight: '500',
|
|
170
|
-
color: styledVars.CAP_WHITE,
|
|
171
|
-
lineHeight: '16px',
|
|
172
|
-
},
|
|
173
|
-
label29: {
|
|
174
|
-
fontSize: '10px',
|
|
175
|
-
fontWeight: '400',
|
|
176
|
-
color: styledVars.CAP_WHITE,
|
|
177
|
-
lineHeight: '12px',
|
|
178
|
-
},
|
|
179
|
-
label30: {
|
|
180
|
-
fontSize: '10px',
|
|
181
|
-
fontWeight: '400',
|
|
182
|
-
color: styledVars.CAP_WHITE,
|
|
183
|
-
lineHeight: '12px',
|
|
184
|
-
},
|
|
185
|
-
label31: {
|
|
186
|
-
color: styledVars.CAP_G01,
|
|
187
|
-
fontSize: '12px',
|
|
188
|
-
fontWeight: '400',
|
|
189
|
-
lineHeight: '16px',
|
|
190
|
-
},
|
|
191
|
-
label32: {
|
|
192
|
-
color: styledVars.CAP_WHITE,
|
|
193
|
-
fontSize: '14px',
|
|
194
|
-
fontWeight: '500',
|
|
195
|
-
lineHeight: '20px',
|
|
196
|
-
},
|
|
197
|
-
label33: {
|
|
198
|
-
color: styledVars.CAP_SECONDARY.base,
|
|
199
|
-
fontSize: '14px',
|
|
200
|
-
fontWeight: '500',
|
|
201
|
-
lineHeight: '20px',
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const labelStyles = css`
|
|
206
|
-
font-size: ${props => labels[props.type].fontSize};
|
|
207
|
-
font-weight: ${props => props.fontWeight || labels[props.type].fontWeight};
|
|
208
|
-
color: ${props => labels[props.type].color};
|
|
209
|
-
line-height: ${props => props.lineHeight || labels[props.type].lineHeight || 'initial'};
|
|
210
|
-
margin: 0;
|
|
211
|
-
padding: 0;
|
|
212
|
-
`;
|
|
213
|
-
|
|
214
|
-
export const LabelWrapper = styled.div`
|
|
215
|
-
${labelStyles}
|
|
216
|
-
`;
|
|
217
|
-
|
|
218
|
-
export const LabelInline = styled.span`
|
|
219
|
-
${labelStyles}
|
|
220
|
-
display: inline-block;
|
|
221
|
-
`;
|
package/CapRow/CapRow.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Row } from 'antd';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { RowWrapper } from './styles';
|
|
6
|
-
|
|
7
|
-
const CapRow = ({ className, children, ...rest }) => {
|
|
8
|
-
return (
|
|
9
|
-
<RowWrapper>
|
|
10
|
-
<Row {...rest} className={classNames('cap-row', className)}>
|
|
11
|
-
{React.Children.toArray(children)}
|
|
12
|
-
</Row>
|
|
13
|
-
</RowWrapper>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
CapRow.propTypes = {
|
|
18
|
-
children: PropTypes.node,
|
|
19
|
-
className: PropTypes.string,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default CapRow;
|
package/CapRow/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapRow';
|
package/CapRow/styles.js
DELETED
package/CapTable/CapTable.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapTable - Migrated to Ant Design v5
|
|
3
|
-
* A table component that supports:
|
|
4
|
-
* - Infinite scrolling with virtualization
|
|
5
|
-
* - Sequential data loading
|
|
6
|
-
* - Optimized scroll performance
|
|
7
|
-
*/
|
|
8
|
-
import React, { useEffect, useCallback, useState, useRef } from 'react';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import { debounce } from 'lodash';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
|
-
import { StyledTable } from './styles';
|
|
13
|
-
import LocaleHoc from '../LocaleHoc';
|
|
14
|
-
|
|
15
|
-
const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
|
|
16
|
-
const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
|
|
17
|
-
const DEFAULT_ROW_HEIGHT = 54;
|
|
18
|
-
const DEFAULT_SCROLL_HEIGHT = 400;
|
|
19
|
-
|
|
20
|
-
const CapTable = ({
|
|
21
|
-
id,
|
|
22
|
-
className,
|
|
23
|
-
children,
|
|
24
|
-
infiniteScroll,
|
|
25
|
-
pagination,
|
|
26
|
-
dataSource,
|
|
27
|
-
offset_limit,
|
|
28
|
-
setPagination,
|
|
29
|
-
scroll,
|
|
30
|
-
showLoader,
|
|
31
|
-
...rest
|
|
32
|
-
}) => {
|
|
33
|
-
const scrollRef = useRef(null);
|
|
34
|
-
const [hasMore, setHasMore] = useState(true);
|
|
35
|
-
const currentOffsetRef = useRef(0);
|
|
36
|
-
|
|
37
|
-
const loadMore = useCallback(() => {
|
|
38
|
-
if (!showLoader && hasMore) {
|
|
39
|
-
const nextOffset = currentOffsetRef.current + 1;
|
|
40
|
-
const newOffsetLimit = {
|
|
41
|
-
...offset_limit,
|
|
42
|
-
offset: nextOffset
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
currentOffsetRef.current = nextOffset;
|
|
46
|
-
setPagination(newOffsetLimit);
|
|
47
|
-
}
|
|
48
|
-
}, [showLoader, hasMore, setPagination, offset_limit]);
|
|
49
|
-
|
|
50
|
-
const handleScroll = useCallback(
|
|
51
|
-
debounce((event) => {
|
|
52
|
-
const target = event.target;
|
|
53
|
-
if (!target || !infiniteScroll || !hasMore || showLoader) return;
|
|
54
|
-
|
|
55
|
-
const scrollTop = Math.ceil(target.scrollTop);
|
|
56
|
-
const visibleHeight = target.clientHeight;
|
|
57
|
-
const totalHeight = target.scrollHeight;
|
|
58
|
-
|
|
59
|
-
const scrolledPercentage = (scrollTop + visibleHeight) / totalHeight * 100;
|
|
60
|
-
|
|
61
|
-
if (scrolledPercentage >= SCROLL_THRESHOLD) {
|
|
62
|
-
loadMore();
|
|
63
|
-
}
|
|
64
|
-
}, DEBOUNCE_DELAY),
|
|
65
|
-
[infiniteScroll, showLoader, hasMore, loadMore]
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
// Setup scroll listener and handle initial load
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const tableBody = document.querySelector(`#${id} .ant-table-body`);
|
|
71
|
-
if (!tableBody) return;
|
|
72
|
-
|
|
73
|
-
scrollRef.current = tableBody;
|
|
74
|
-
tableBody.addEventListener('scroll', handleScroll, { passive: true });
|
|
75
|
-
|
|
76
|
-
// Check if initial load needed
|
|
77
|
-
const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight
|
|
78
|
-
&& !showLoader
|
|
79
|
-
&& hasMore;
|
|
80
|
-
|
|
81
|
-
if (shouldLoadInitially) {
|
|
82
|
-
currentOffsetRef.current = 0;
|
|
83
|
-
loadMore();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Cleanup
|
|
87
|
-
return () => {
|
|
88
|
-
scrollRef.current?.removeEventListener('scroll', handleScroll);
|
|
89
|
-
handleScroll.cancel();
|
|
90
|
-
};
|
|
91
|
-
}, [id, handleScroll, showLoader, hasMore, loadMore]);
|
|
92
|
-
|
|
93
|
-
// Handle data changes
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (!dataSource?.length) {
|
|
96
|
-
currentOffsetRef.current = 0;
|
|
97
|
-
setHasMore(true);
|
|
98
|
-
} else {
|
|
99
|
-
setHasMore(true);
|
|
100
|
-
}
|
|
101
|
-
}, [dataSource]);
|
|
102
|
-
|
|
103
|
-
const tableClassName = classNames(
|
|
104
|
-
'cap-table-v2',
|
|
105
|
-
className,
|
|
106
|
-
{
|
|
107
|
-
'show-loader': showLoader,
|
|
108
|
-
'infinite-scroll': infiniteScroll,
|
|
109
|
-
'has-more': hasMore
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<StyledTable
|
|
115
|
-
id={id}
|
|
116
|
-
className={tableClassName}
|
|
117
|
-
dataSource={dataSource}
|
|
118
|
-
pagination={false}
|
|
119
|
-
scroll={{
|
|
120
|
-
x: scroll?.x,
|
|
121
|
-
y: scroll?.y || DEFAULT_SCROLL_HEIGHT,
|
|
122
|
-
scrollToFirstRowOnChange: false
|
|
123
|
-
}}
|
|
124
|
-
virtual={infiniteScroll}
|
|
125
|
-
rowHeight={DEFAULT_ROW_HEIGHT}
|
|
126
|
-
{...rest}
|
|
127
|
-
>
|
|
128
|
-
{children}
|
|
129
|
-
</StyledTable>
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
CapTable.propTypes = {
|
|
134
|
-
id: PropTypes.string.isRequired,
|
|
135
|
-
className: PropTypes.string,
|
|
136
|
-
children: PropTypes.node,
|
|
137
|
-
infiniteScroll: PropTypes.bool,
|
|
138
|
-
pagination: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
|
139
|
-
dataSource: PropTypes.array,
|
|
140
|
-
offset_limit: PropTypes.object,
|
|
141
|
-
setPagination: PropTypes.func,
|
|
142
|
-
scroll: PropTypes.object,
|
|
143
|
-
showLoader: PropTypes.bool,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export default LocaleHoc(CapTable, { key: 'CapTable' });
|
package/CapTable/index.js
DELETED
package/CapTable/loadable.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
2
|
-
import { loadable } from '@capillarytech/cap-ui-utils';
|
|
3
|
-
import React, { Suspense } from 'react';
|
|
4
|
-
|
|
5
|
-
const LoadableComponent = loadable(() => import('./CapTable'));
|
|
6
|
-
|
|
7
|
-
const CapTableLoadable = () => (
|
|
8
|
-
<Suspense fallback={<CapSpin />}>
|
|
9
|
-
<LoadableComponent />
|
|
10
|
-
</Suspense>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export default CapTableLoadable;
|
package/CapTable/styles.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { Table } from 'antd';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import * as styledVars from '../styled/variables';
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
CAP_G09,
|
|
7
|
-
CAP_G01,
|
|
8
|
-
CAP_G06,
|
|
9
|
-
CAP_G07,
|
|
10
|
-
CAP_G10,
|
|
11
|
-
SPACING_16,
|
|
12
|
-
SPACING_24,
|
|
13
|
-
FONT_SIZE_S,
|
|
14
|
-
} = styledVars;
|
|
15
|
-
|
|
16
|
-
export const StyledTable = styled(Table)`
|
|
17
|
-
&.cap-table-v2 {
|
|
18
|
-
.ant-table {
|
|
19
|
-
border: 1px solid ${CAP_G07};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.show-loader {
|
|
24
|
-
.ant-table-body > table > tbody::after {
|
|
25
|
-
content: '${(props) => props.loadMoreData}';
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
position: absolute;
|
|
29
|
-
width: 100%;
|
|
30
|
-
align-items: center;
|
|
31
|
-
height: 60px;
|
|
32
|
-
text-align: center;
|
|
33
|
-
font-size: 16px;
|
|
34
|
-
color: gray;
|
|
35
|
-
border-top: 1px solid ${CAP_G07};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.ant-table {
|
|
40
|
-
border: 1px solid ${CAP_G07};
|
|
41
|
-
|
|
42
|
-
.ant-table-thead > tr > th {
|
|
43
|
-
color: ${CAP_G01};
|
|
44
|
-
font-size: ${FONT_SIZE_S};
|
|
45
|
-
line-height: ${SPACING_16};
|
|
46
|
-
background-color: ${CAP_G10};
|
|
47
|
-
text-align: left;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.ant-table-thead > tr > th,
|
|
51
|
-
.ant-table-tbody > tr > td {
|
|
52
|
-
padding: ${SPACING_16} ${SPACING_24};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.ant-table-tbody > tr > td {
|
|
56
|
-
border-bottom: 1px solid ${CAP_G07};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ant-table-tbody > tr:last-child > td {
|
|
60
|
-
border-bottom: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,
|
|
64
|
-
.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,
|
|
65
|
-
.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,
|
|
66
|
-
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td {
|
|
67
|
-
background-color: ${CAP_G09};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.ant-table-thead > tr > th .ant-table-column-sorter-up,
|
|
71
|
-
.ant-table-thead > tr > th .ant-table-column-sorter-down {
|
|
72
|
-
&.active {
|
|
73
|
-
color: ${CAP_G01};
|
|
74
|
-
}
|
|
75
|
-
&:not(.active) {
|
|
76
|
-
color: ${CAP_G06};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.ant-table-thead {
|
|
81
|
-
.table-children {
|
|
82
|
-
padding: 6px ${SPACING_24} 16px;
|
|
83
|
-
position: relative;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.table-parent {
|
|
87
|
-
padding-bottom: 0;
|
|
88
|
-
padding-left: ${SPACING_24};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.table-children.show-separator:not(:last-child)::after {
|
|
92
|
-
content: '';
|
|
93
|
-
height: 8px;
|
|
94
|
-
width: 1px;
|
|
95
|
-
right: 0;
|
|
96
|
-
top: 30%;
|
|
97
|
-
background-color: ${CAP_G07};
|
|
98
|
-
position: absolute;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.ant-table-thead > tr > th .ant-table-column-sorter {
|
|
103
|
-
vertical-align: unset;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.ant-table-body table {
|
|
107
|
-
table-layout: fixed;
|
|
108
|
-
width: 100%;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&.no-pagination-loader {
|
|
113
|
-
.ant-table-body > table > tbody::after {
|
|
114
|
-
content: '';
|
|
115
|
-
height: unset;
|
|
116
|
-
display: none;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&.hide-hover {
|
|
121
|
-
.ant-table {
|
|
122
|
-
.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,
|
|
123
|
-
.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,
|
|
124
|
-
.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,
|
|
125
|
-
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td {
|
|
126
|
-
background: none;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
a {
|
|
132
|
-
color: ${CAP_G01};
|
|
133
|
-
}
|
|
134
|
-
`;
|
package/CapTooltip/CapTooltip.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Tooltip } from 'antd';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { TooltipWrapper } from './styles';
|
|
6
|
-
|
|
7
|
-
const CapTooltip = ({ overlayClassName, children, ...rest }) => {
|
|
8
|
-
return (
|
|
9
|
-
<TooltipWrapper>
|
|
10
|
-
<Tooltip
|
|
11
|
-
overlayClassName={classNames('cap-tooltip', overlayClassName)}
|
|
12
|
-
{...rest}
|
|
13
|
-
>
|
|
14
|
-
{children}
|
|
15
|
-
</Tooltip>
|
|
16
|
-
</TooltipWrapper>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/*
|
|
21
|
-
NOTE:
|
|
22
|
-
While using a disabled button with tooltip, wrap the button with an element with className "button-disabled-tooltip-wrapper".
|
|
23
|
-
|
|
24
|
-
<CapTooltip title="disabled button with tooltip">
|
|
25
|
-
<span className="button-disabled-tooltip-wrapper">
|
|
26
|
-
<CapButton disabled>Button</CapButton>
|
|
27
|
-
</span>
|
|
28
|
-
</CapTooltip>
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
CapTooltip.propTypes = {
|
|
32
|
-
overlayClassName: PropTypes.string,
|
|
33
|
-
children: PropTypes.node,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default CapTooltip;
|
package/CapTooltip/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapTooltip';
|
package/CapTooltip/styles.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import * as styledVars from '../styled/variables';
|
|
3
|
-
|
|
4
|
-
export const TooltipWrapper = styled.span`
|
|
5
|
-
.cap-tooltip {
|
|
6
|
-
max-width: 324px;
|
|
7
|
-
|
|
8
|
-
.ant-tooltip-inner {
|
|
9
|
-
background-color: ${styledVars.FONT_COLOR_01};
|
|
10
|
-
font-size: ${styledVars.FONT_SIZE_M};
|
|
11
|
-
font-weight: ${styledVars.FONT_WEIGHT_MEDIUM};
|
|
12
|
-
padding: 6px 8px;
|
|
13
|
-
min-height: 32px;
|
|
14
|
-
border-radius: ${styledVars.RADIUS_04};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&.cap-bgcolor-tooltip {
|
|
18
|
-
.ant-tooltip-inner {
|
|
19
|
-
background-color: ${styledVars.FONT_COLOR_05};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.hide-tooltip-pointer {
|
|
24
|
-
.ant-tooltip-arrow {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.button-disabled-tooltip-wrapper {
|
|
31
|
-
display: inline-flex;
|
|
32
|
-
cursor: not-allowed;
|
|
33
|
-
|
|
34
|
-
.cap-button.ant-btn[disabled] {
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
& > * {
|
|
37
|
-
pointer-events: auto;
|
|
38
|
-
cursor: not-allowed;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;
|