@capillarytech/blaze-ui 0.1.6-alpha.3 → 0.1.6-alpha.31
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 +51 -0
- package/{CapInput → components/CapInput}/Number.js +13 -18
- package/components/CapInput/Search.js +28 -0
- package/components/CapInput/TextArea.js +35 -0
- package/{CapInput → components/CapInput}/messages.js +6 -8
- package/components/CapInput/styles.js +3 -0
- package/components/CapSkeleton/CapSkeleton.js +21 -0
- package/components/CapSkeleton/index.js +1 -0
- package/components/CapSpin/CapSpin.js +27 -0
- package/components/CapSpin/index.js +1 -0
- package/{CapTable → components/CapTable}/CapTable.js +53 -75
- package/components/CapTable/loadable.js +8 -0
- package/components/CapTable/styles.js +17 -0
- package/components/CapTestSelect/CapTestSelect.js +34 -0
- package/components/CapTestSelect/index.js +1 -0
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +344 -0
- package/components/CapUnifiedSelect/index.js +1 -0
- package/components/CapUnifiedSelect/styles.js +31 -0
- package/components/LocaleHoc/index.js +33 -0
- package/{index.js → components/index.js} +5 -1
- package/{styled → components/styled}/variables.js +3 -4
- 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/{CapInput → dist/esm/components/CapInput}/index.js +1 -3
- 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/{CapTable → dist/esm/components/CapTable}/index.js +1 -2
- 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/{CapUnifiedSelect → dist/esm/components/CapUnifiedSelect}/messages.js +7 -8
- package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
- package/dist/esm/{index.js → components/index.js} +5 -1
- package/{styled → dist/esm/components/styled}/index.js +1 -2
- package/{translations → dist/esm/components/translations}/en.js +32 -34
- 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 +1 -0
- package/utils/withStyles.js +23 -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/Search.js +0 -32
- package/CapInput/TextArea.js +0 -45
- package/CapInput/loadable.js +0 -9
- 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/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/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/{dist/esm → components}/CapInput/index.js +0 -0
- /package/{dist/esm → components}/CapTable/index.js +0 -0
- /package/{dist/esm → components}/CapUnifiedSelect/messages.js +0 -0
- /package/{dist/esm → components}/styled/index.js +0 -0
- /package/{dist/esm → components}/translations/en.js +0 -0
- /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}/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}/styles.js +0 -0
- /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/variables.js +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Input } from 'antd';
|
|
5
|
+
import { WarningOutlined, CheckCircleOutlined } from '@ant-design/icons';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import * as styledVars from '../styled/variables';
|
|
8
|
+
const StyledIcon = styled.span.withConfig({
|
|
9
|
+
displayName: "StyledIcon",
|
|
10
|
+
componentId: "sc-1ghbg8a-0"
|
|
11
|
+
})(["color:", ";color:", ";"], props => props.status === "error" && styledVars.CAP_RED, props => props.status === "success" && styledVars.CAP_PRIMARY.base);
|
|
12
|
+
const CapInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
alwaysShowFocus,
|
|
15
|
+
errorMessage,
|
|
16
|
+
isVerified,
|
|
17
|
+
suffix,
|
|
18
|
+
showSuffix = true,
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
21
|
+
const inputRef = useRef(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (alwaysShowFocus && inputRef.current) {
|
|
24
|
+
inputRef.current.focus();
|
|
25
|
+
}
|
|
26
|
+
}, [alwaysShowFocus]);
|
|
27
|
+
const inputSuffix = errorMessage && /*#__PURE__*/React.createElement(StyledIcon, {
|
|
28
|
+
status: "error"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(WarningOutlined, null)) || isVerified && /*#__PURE__*/React.createElement(StyledIcon, {
|
|
30
|
+
status: "success"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(CheckCircleOutlined, null)) || suffix || null;
|
|
32
|
+
return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
|
|
33
|
+
ref: ref || inputRef,
|
|
34
|
+
suffix: showSuffix === false ? null : inputSuffix,
|
|
35
|
+
status: errorMessage ? 'error' : undefined
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
CapInput.displayName = 'CapInput';
|
|
39
|
+
CapInput.propTypes = {
|
|
40
|
+
alwaysShowFocus: PropTypes.bool,
|
|
41
|
+
errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
42
|
+
isVerified: PropTypes.bool,
|
|
43
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
44
|
+
suffix: PropTypes.node,
|
|
45
|
+
showSuffix: PropTypes.bool
|
|
46
|
+
};
|
|
47
|
+
CapInput.defaultProps = {
|
|
48
|
+
size: 'large',
|
|
49
|
+
showSuffix: true
|
|
50
|
+
};
|
|
51
|
+
export default CapInput;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { InputNumber } from 'antd';
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
5
|
+
const CapInputNumber = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const {
|
|
7
|
+
size = 'large',
|
|
8
|
+
...rest
|
|
9
|
+
} = props;
|
|
10
|
+
return /*#__PURE__*/React.createElement(InputNumber, _extends({}, rest, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
size: size
|
|
13
|
+
}));
|
|
15
14
|
});
|
|
16
|
-
|
|
17
15
|
CapInputNumber.displayName = 'CapInputNumber';
|
|
18
|
-
|
|
19
16
|
CapInputNumber.propTypes = {
|
|
20
17
|
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
21
18
|
min: PropTypes.number,
|
|
@@ -27,12 +24,10 @@ CapInputNumber.propTypes = {
|
|
|
27
24
|
parser: PropTypes.func,
|
|
28
25
|
controls: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
29
26
|
keyboard: PropTypes.bool,
|
|
30
|
-
stringMode: PropTypes.bool
|
|
27
|
+
stringMode: PropTypes.bool
|
|
31
28
|
};
|
|
32
|
-
|
|
33
29
|
CapInputNumber.defaultProps = {
|
|
34
30
|
size: 'large',
|
|
35
|
-
keyboard: true
|
|
31
|
+
keyboard: true
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
export default CapInputNumber;
|
|
33
|
+
export default CapInputNumber;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Input } from 'antd';
|
|
5
|
+
const {
|
|
6
|
+
Search
|
|
7
|
+
} = Input;
|
|
8
|
+
const CapInputSearch = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
9
|
+
const {
|
|
10
|
+
size = 'large',
|
|
11
|
+
...rest
|
|
12
|
+
} = props;
|
|
13
|
+
return /*#__PURE__*/React.createElement(Search, _extends({}, rest, {
|
|
14
|
+
ref: ref,
|
|
15
|
+
size: size
|
|
16
|
+
}));
|
|
17
|
+
});
|
|
18
|
+
CapInputSearch.displayName = 'CapInputSearch';
|
|
19
|
+
CapInputSearch.propTypes = {
|
|
20
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
21
|
+
enterButton: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
|
|
22
|
+
loading: PropTypes.bool,
|
|
23
|
+
onSearch: PropTypes.func
|
|
24
|
+
};
|
|
25
|
+
CapInputSearch.defaultProps = {
|
|
26
|
+
size: 'large'
|
|
27
|
+
};
|
|
28
|
+
export default CapInputSearch;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Input } from 'antd';
|
|
5
|
+
const {
|
|
6
|
+
TextArea
|
|
7
|
+
} = Input;
|
|
8
|
+
const CapInputTextArea = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
9
|
+
const {
|
|
10
|
+
size = 'large',
|
|
11
|
+
...rest
|
|
12
|
+
} = props;
|
|
13
|
+
return /*#__PURE__*/React.createElement(TextArea, _extends({}, rest, {
|
|
14
|
+
ref: ref,
|
|
15
|
+
size: size
|
|
16
|
+
}));
|
|
17
|
+
});
|
|
18
|
+
CapInputTextArea.displayName = 'CapInputTextArea';
|
|
19
|
+
CapInputTextArea.propTypes = {
|
|
20
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
21
|
+
autoSize: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
|
22
|
+
minRows: PropTypes.number,
|
|
23
|
+
maxRows: PropTypes.number
|
|
24
|
+
})]),
|
|
25
|
+
rows: PropTypes.number,
|
|
26
|
+
maxLength: PropTypes.number,
|
|
27
|
+
showCount: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
|
28
|
+
formatter: PropTypes.func
|
|
29
|
+
})])
|
|
30
|
+
};
|
|
31
|
+
CapInputTextArea.defaultProps = {
|
|
32
|
+
size: 'large',
|
|
33
|
+
rows: 4
|
|
34
|
+
};
|
|
35
|
+
export default CapInputTextArea;
|
|
@@ -4,24 +4,22 @@
|
|
|
4
4
|
* This contains all the text for the CapInput component.
|
|
5
5
|
*/
|
|
6
6
|
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
7
|
const scope = 'blaze.components.CapInput';
|
|
9
|
-
|
|
10
8
|
export default defineMessages({
|
|
11
9
|
placeholder: {
|
|
12
10
|
id: `${scope}.placeholder`,
|
|
13
|
-
defaultMessage: 'Enter text...'
|
|
11
|
+
defaultMessage: 'Enter text...'
|
|
14
12
|
},
|
|
15
13
|
searchPlaceholder: {
|
|
16
14
|
id: `${scope}.searchPlaceholder`,
|
|
17
|
-
defaultMessage: 'Search...'
|
|
15
|
+
defaultMessage: 'Search...'
|
|
18
16
|
},
|
|
19
17
|
textAreaPlaceholder: {
|
|
20
18
|
id: `${scope}.textAreaPlaceholder`,
|
|
21
|
-
defaultMessage: 'Enter your text here...'
|
|
19
|
+
defaultMessage: 'Enter your text here...'
|
|
22
20
|
},
|
|
23
21
|
numberPlaceholder: {
|
|
24
22
|
id: `${scope}.numberPlaceholder`,
|
|
25
|
-
defaultMessage: 'Enter number...'
|
|
26
|
-
}
|
|
27
|
-
});
|
|
23
|
+
defaultMessage: 'Enter number...'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import * as styledVars from '../styled/variables';
|
|
3
|
+
export const inputStyles = css(["&.ant-input,&.ant-input-affix-wrapper,&.ant-input-number,&.ant-input-textarea{font-family:", ";border-radius:", ";transition:", ";&:hover{border-color:", ";}&:focus,&.ant-input-affix-wrapper-focused{border-color:", ";box-shadow:none;}&.ant-input-status-error,&.ant-input-affix-wrapper-status-error,&.ant-input-number-status-error{border-color:", ";&:hover{border-color:", ";}&:focus,&.ant-input-affix-wrapper-focused{border-color:", ";box-shadow:none;}}&.ant-input-disabled,&.ant-input-affix-wrapper-disabled{background-color:", ";cursor:not-allowed;}}&.ant-input-lg,&.ant-input-affix-wrapper-lg{font-size:14px;padding:10px 12px;}&.ant-input-textarea{.ant-input{font-family:", ";}}&.ant-input-number{width:100%;.ant-input-number-handler-wrap{opacity:1;}}&.ant-input-search{.ant-input-search-button{background-color:", ";border-color:", ";&:hover{background-color:", ";border-color:", ";}}}"], styledVars.FONT_FAMILY, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G11, styledVars.CAP_G01, styledVars.CAP_RED, styledVars.CAP_RED, styledVars.CAP_RED, styledVars.CAP_G08, styledVars.FONT_FAMILY, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.hover, styledVars.CAP_PRIMARY.hover);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
/**
|
|
3
|
+
* CapSkeleton - Migrated to Ant Design v5
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { Skeleton } from 'antd';
|
|
8
|
+
const CapSkeleton = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
className,
|
|
11
|
+
...rest
|
|
12
|
+
} = _ref;
|
|
13
|
+
const combinedClassName = `cap-skeleton-v2 ${className || ''}`.trim();
|
|
14
|
+
return /*#__PURE__*/React.createElement(Skeleton, _extends({
|
|
15
|
+
className: combinedClassName
|
|
16
|
+
}, rest));
|
|
17
|
+
};
|
|
18
|
+
CapSkeleton.propTypes = {
|
|
19
|
+
className: PropTypes.string
|
|
20
|
+
};
|
|
21
|
+
export default CapSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapSkeleton';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
/**
|
|
3
|
+
* CapSpin - Migrated to Ant Design v5
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { Spin } from 'antd';
|
|
8
|
+
const CapSpin = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
className,
|
|
11
|
+
...rest
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/React.createElement(Spin, _extends({
|
|
14
|
+
className: className
|
|
15
|
+
}, rest));
|
|
16
|
+
};
|
|
17
|
+
CapSpin.propTypes = {
|
|
18
|
+
className: PropTypes.string,
|
|
19
|
+
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
20
|
+
spinning: PropTypes.bool,
|
|
21
|
+
tip: PropTypes.string,
|
|
22
|
+
delay: PropTypes.number,
|
|
23
|
+
indicator: PropTypes.node,
|
|
24
|
+
fullscreen: PropTypes.bool,
|
|
25
|
+
wrapperClassName: PropTypes.string
|
|
26
|
+
};
|
|
27
|
+
export default CapSpin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapSpin';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
2
|
/**
|
|
2
3
|
* CapTable - Migrated to Ant Design v5
|
|
3
4
|
* A table component that supports:
|
|
@@ -11,29 +12,27 @@ import { debounce } from 'lodash';
|
|
|
11
12
|
import classNames from 'classnames';
|
|
12
13
|
import { StyledTable } from './styles';
|
|
13
14
|
import LocaleHoc from '../LocaleHoc';
|
|
14
|
-
|
|
15
15
|
const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
|
|
16
16
|
const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
|
|
17
17
|
const DEFAULT_ROW_HEIGHT = 54;
|
|
18
18
|
const DEFAULT_SCROLL_HEIGHT = 400;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
19
|
+
const CapTable = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
infiniteScroll,
|
|
25
|
+
pagination,
|
|
26
|
+
dataSource,
|
|
27
|
+
offset_limit,
|
|
28
|
+
setPagination,
|
|
29
|
+
scroll,
|
|
30
|
+
showLoader,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref;
|
|
33
33
|
const scrollRef = useRef(null);
|
|
34
34
|
const [hasMore, setHasMore] = useState(true);
|
|
35
35
|
const currentOffsetRef = useRef(0);
|
|
36
|
-
|
|
37
36
|
const loadMore = useCallback(() => {
|
|
38
37
|
if (!showLoader && hasMore) {
|
|
39
38
|
const nextOffset = currentOffsetRef.current + 1;
|
|
@@ -41,43 +40,33 @@ const CapTable = ({
|
|
|
41
40
|
...offset_limit,
|
|
42
41
|
offset: nextOffset
|
|
43
42
|
};
|
|
44
|
-
|
|
45
43
|
currentOffsetRef.current = nextOffset;
|
|
46
44
|
setPagination(newOffsetLimit);
|
|
47
45
|
}
|
|
48
46
|
}, [showLoader, hasMore, setPagination, offset_limit]);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (scrolledPercentage >= SCROLL_THRESHOLD) {
|
|
62
|
-
loadMore();
|
|
63
|
-
}
|
|
64
|
-
}, DEBOUNCE_DELAY),
|
|
65
|
-
[infiniteScroll, showLoader, hasMore, loadMore]
|
|
66
|
-
);
|
|
47
|
+
const handleScroll = useCallback(debounce(event => {
|
|
48
|
+
const target = event.target;
|
|
49
|
+
if (!target || !infiniteScroll || !hasMore || showLoader) return;
|
|
50
|
+
const scrollTop = Math.ceil(target.scrollTop);
|
|
51
|
+
const visibleHeight = target.clientHeight;
|
|
52
|
+
const totalHeight = target.scrollHeight;
|
|
53
|
+
const scrolledPercentage = (scrollTop + visibleHeight) / totalHeight * 100;
|
|
54
|
+
if (scrolledPercentage >= SCROLL_THRESHOLD) {
|
|
55
|
+
loadMore();
|
|
56
|
+
}
|
|
57
|
+
}, DEBOUNCE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
|
|
67
58
|
|
|
68
59
|
// Setup scroll listener and handle initial load
|
|
69
60
|
useEffect(() => {
|
|
70
61
|
const tableBody = document.querySelector(`#${id} .ant-table-body`);
|
|
71
62
|
if (!tableBody) return;
|
|
72
|
-
|
|
73
63
|
scrollRef.current = tableBody;
|
|
74
|
-
tableBody.addEventListener('scroll', handleScroll, {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight
|
|
78
|
-
&& !showLoader
|
|
79
|
-
&& hasMore;
|
|
64
|
+
tableBody.addEventListener('scroll', handleScroll, {
|
|
65
|
+
passive: true
|
|
66
|
+
});
|
|
80
67
|
|
|
68
|
+
// Check if initial load needed
|
|
69
|
+
const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight && !showLoader && hasMore;
|
|
81
70
|
if (shouldLoadInitially) {
|
|
82
71
|
currentOffsetRef.current = 0;
|
|
83
72
|
loadMore();
|
|
@@ -99,37 +88,25 @@ const CapTable = ({
|
|
|
99
88
|
setHasMore(true);
|
|
100
89
|
}
|
|
101
90
|
}, [dataSource]);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
'
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
);
|
|
91
|
+
const tableClassName = classNames('cap-table-v2', className, {
|
|
92
|
+
'show-loader': showLoader,
|
|
93
|
+
'infinite-scroll': infiniteScroll,
|
|
94
|
+
'has-more': hasMore
|
|
95
|
+
});
|
|
96
|
+
return /*#__PURE__*/React.createElement(StyledTable, _extends({
|
|
97
|
+
id: id,
|
|
98
|
+
className: tableClassName,
|
|
99
|
+
dataSource: dataSource,
|
|
100
|
+
pagination: false,
|
|
101
|
+
scroll: {
|
|
102
|
+
x: scroll?.x,
|
|
103
|
+
y: scroll?.y || DEFAULT_SCROLL_HEIGHT,
|
|
104
|
+
scrollToFirstRowOnChange: false
|
|
105
|
+
},
|
|
106
|
+
virtual: infiniteScroll,
|
|
107
|
+
rowHeight: DEFAULT_ROW_HEIGHT
|
|
108
|
+
}, rest), children);
|
|
131
109
|
};
|
|
132
|
-
|
|
133
110
|
CapTable.propTypes = {
|
|
134
111
|
id: PropTypes.string.isRequired,
|
|
135
112
|
className: PropTypes.string,
|
|
@@ -140,7 +117,8 @@ CapTable.propTypes = {
|
|
|
140
117
|
offset_limit: PropTypes.object,
|
|
141
118
|
setPagination: PropTypes.func,
|
|
142
119
|
scroll: PropTypes.object,
|
|
143
|
-
showLoader: PropTypes.bool
|
|
120
|
+
showLoader: PropTypes.bool
|
|
144
121
|
};
|
|
145
|
-
|
|
146
|
-
|
|
122
|
+
export default LocaleHoc(CapTable, {
|
|
123
|
+
key: 'CapTable'
|
|
124
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import CapSkeleton from '../CapSkeleton';
|
|
2
|
+
import { loadable } from '@capillarytech/cap-ui-utils';
|
|
3
|
+
import React, { Suspense } from 'react';
|
|
4
|
+
const LoadableComponent = loadable(() => import('./CapTable'));
|
|
5
|
+
const CapTableLoadable = props => /*#__PURE__*/React.createElement(Suspense, {
|
|
6
|
+
fallback: /*#__PURE__*/React.createElement(CapSkeleton, null)
|
|
7
|
+
}, /*#__PURE__*/React.createElement(LoadableComponent, props));
|
|
8
|
+
export default CapTableLoadable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Table } from 'antd';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import * as styledVars from '../styled/variables';
|
|
4
|
+
const {
|
|
5
|
+
CAP_G09,
|
|
6
|
+
CAP_G01,
|
|
7
|
+
CAP_G06,
|
|
8
|
+
CAP_G07,
|
|
9
|
+
CAP_G10,
|
|
10
|
+
SPACING_16,
|
|
11
|
+
SPACING_24,
|
|
12
|
+
FONT_SIZE_S
|
|
13
|
+
} = styledVars;
|
|
14
|
+
export const StyledTable = styled(Table).withConfig({
|
|
15
|
+
displayName: "StyledTable",
|
|
16
|
+
componentId: "sc-1ldu1k4-0"
|
|
17
|
+
})(["&.cap-table-v2{.ant-table{border:1px solid ", ";}}&.show-loader{.ant-table-body > table > tbody::after{content:'", "';display:flex;justify-content:center;position:absolute;width:100%;align-items:center;height:60px;text-align:center;font-size:16px;color:gray;border-top:1px solid ", ";}}.ant-table{border:1px solid ", ";.ant-table-thead > tr > th{color:", ";font-size:", ";line-height:", ";background-color:", ";text-align:left;}.ant-table-thead > tr > th,.ant-table-tbody > tr > td{padding:", " ", ";}.ant-table-tbody > tr > td{border-bottom:1px solid ", ";}.ant-table-tbody > tr:last-child > td{border-bottom:none;}.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background-color:", ";}.ant-table-thead > tr > th .ant-table-column-sorter-up,.ant-table-thead > tr > th .ant-table-column-sorter-down{&.active{color:", ";}&:not(.active){color:", ";}}.ant-table-thead{.table-children{padding:6px ", " 16px;position:relative;}.table-parent{padding-bottom:0;padding-left:", ";}.table-children.show-separator:not(:last-child)::after{content:'';height:8px;width:1px;right:0;top:30%;background-color:", ";position:absolute;}}.ant-table-thead > tr > th .ant-table-column-sorter{vertical-align:unset;}.ant-table-body table{table-layout:fixed;width:100%;}}&.no-pagination-loader{.ant-table-body > table > tbody::after{content:'';height:unset;display:none;}}&.hide-hover{.ant-table{.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background:none;}}}a{color:", ";}"], CAP_G07, props => props.loadMoreData, CAP_G07, CAP_G07, CAP_G01, FONT_SIZE_S, SPACING_16, CAP_G10, SPACING_16, SPACING_24, CAP_G07, CAP_G09, CAP_G01, CAP_G06, SPACING_24, SPACING_24, CAP_G07, CAP_G01);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Select } from 'antd';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test component to verify Ant Design v5 Select integration
|
|
7
|
+
* This is a simple wrapper for testing purposes only
|
|
8
|
+
*/
|
|
9
|
+
const CapTestSelect = props => {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Select, props);
|
|
11
|
+
};
|
|
12
|
+
CapTestSelect.propTypes = {
|
|
13
|
+
// Common Select props from antd
|
|
14
|
+
allowClear: PropTypes.bool,
|
|
15
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
16
|
+
disabled: PropTypes.bool,
|
|
17
|
+
loading: PropTypes.bool,
|
|
18
|
+
mode: PropTypes.oneOf(['multiple', 'tags']),
|
|
19
|
+
placeholder: PropTypes.string,
|
|
20
|
+
showSearch: PropTypes.bool,
|
|
21
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
22
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
23
|
+
label: PropTypes.node,
|
|
24
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
25
|
+
disabled: PropTypes.bool
|
|
26
|
+
}))
|
|
27
|
+
};
|
|
28
|
+
CapTestSelect.defaultProps = {
|
|
29
|
+
allowClear: false,
|
|
30
|
+
disabled: false,
|
|
31
|
+
loading: false,
|
|
32
|
+
showSearch: false
|
|
33
|
+
};
|
|
34
|
+
export default CapTestSelect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapTestSelect';
|