@capillarytech/blaze-ui 0.1.6-alpha.31 → 0.1.6-alpha.33
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 +34 -25
- package/components/CapInput/Number.js +25 -19
- package/components/CapInput/Search.js +19 -13
- package/components/CapInput/TextArea.js +23 -17
- package/components/CapInput/index.js +13 -8
- package/components/CapInput/messages.js +6 -7
- package/components/CapInput/styles.js +8 -3
- package/components/CapSkeleton/CapSkeleton.js +15 -12
- package/components/CapSkeleton/index.js +7 -1
- package/components/CapSpin/CapSpin.js +22 -19
- package/components/CapSpin/index.js +7 -1
- package/components/CapTable/CapTable.js +44 -50
- package/components/CapTable/index.js +7 -2
- package/components/CapTable/loadable.js +18 -8
- package/components/CapTable/styles.js +10 -4
- package/components/CapTestSelect/CapTestSelect.js +24 -22
- package/components/CapTestSelect/index.js +7 -1
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +266 -249
- package/components/CapUnifiedSelect/index.js +7 -1
- package/components/CapUnifiedSelect/messages.js +6 -2
- package/components/CapUnifiedSelect/styles.js +15 -10
- package/components/LocaleHoc/index.js +18 -9
- package/components/assets/Images/Upload.png +0 -0
- package/components/index.js +32 -13
- package/components/styled/index.js +13 -4
- package/components/styled/variables.js +62 -80
- package/components/translations/en.js +5 -1
- package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/CapUnifiedSelect.js +2 -3
- package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/CapUnifiedSelect.js +2 -2
- package/dist/esm/{components/index.js → index.js} +1 -5
- package/dist/{components/index.js → index.js} +0 -27
- package/package.json +1 -1
- package/utils/index.js +7 -1
- package/utils/withStyles.js +7 -15
- package/dist/components/CapTestSelect/CapTestSelect.js +0 -40
- package/dist/components/CapTestSelect/index.js +0 -13
- package/dist/esm/components/CapTestSelect/CapTestSelect.js +0 -34
- package/dist/esm/components/CapTestSelect/index.js +0 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/withStyles.js +0 -23
- package/dist/utils/index.js +0 -13
- package/dist/utils/withStyles.js +0 -29
- /package/dist/{components/CapInput → CapInput}/CapInput.js +0 -0
- /package/dist/{components/CapInput → CapInput}/Number.js +0 -0
- /package/dist/{components/CapInput → CapInput}/Search.js +0 -0
- /package/dist/{components/CapInput → CapInput}/TextArea.js +0 -0
- /package/dist/{components/CapInput → CapInput}/index.js +0 -0
- /package/dist/{components/CapInput → CapInput}/messages.js +0 -0
- /package/dist/{components/CapInput → CapInput}/styles.js +0 -0
- /package/dist/{components/CapSkeleton → CapSkeleton}/CapSkeleton.js +0 -0
- /package/dist/{components/CapSkeleton → CapSkeleton}/index.js +0 -0
- /package/dist/{components/CapSpin → CapSpin}/CapSpin.js +0 -0
- /package/dist/{components/CapSpin → CapSpin}/index.js +0 -0
- /package/dist/{components/CapTable → CapTable}/CapTable.js +0 -0
- /package/dist/{components/CapTable → CapTable}/index.js +0 -0
- /package/dist/{components/CapTable → CapTable}/loadable.js +0 -0
- /package/dist/{components/CapTable → CapTable}/styles.js +0 -0
- /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/index.js +0 -0
- /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/messages.js +0 -0
- /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/styles.js +0 -0
- /package/dist/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/CapInput.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/Number.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/Search.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/TextArea.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/index.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/messages.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/styles.js +0 -0
- /package/dist/esm/{components/CapSkeleton → CapSkeleton}/CapSkeleton.js +0 -0
- /package/dist/esm/{components/CapSkeleton → CapSkeleton}/index.js +0 -0
- /package/dist/esm/{components/CapSpin → CapSpin}/CapSpin.js +0 -0
- /package/dist/esm/{components/CapSpin → CapSpin}/index.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/CapTable.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/index.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/loadable.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/styles.js +0 -0
- /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/index.js +0 -0
- /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/messages.js +0 -0
- /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/styles.js +0 -0
- /package/dist/esm/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
- /package/dist/esm/{components/styled → styled}/index.js +0 -0
- /package/dist/esm/{components/styled → styled}/variables.js +0 -0
- /package/dist/esm/{components/translations → translations}/en.js +0 -0
- /package/dist/{components/styled → styled}/index.js +0 -0
- /package/dist/{components/styled → styled}/variables.js +0 -0
- /package/dist/{components/translations → translations}/en.js +0 -0
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _icons = require("@ant-design/icons");
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var styledVars = _interopRequireWildcard(require("../styled/variables"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
const StyledIcon = _styledComponents.default.span.withConfig({
|
|
9
15
|
displayName: "StyledIcon",
|
|
10
16
|
componentId: "sc-1ghbg8a-0"
|
|
11
17
|
})(["color:", ";color:", ";"], props => props.status === "error" && styledVars.CAP_RED, props => props.status === "success" && styledVars.CAP_PRIMARY.base);
|
|
12
|
-
const CapInput =
|
|
18
|
+
const CapInput = _react.default.forwardRef((props, ref) => {
|
|
13
19
|
const {
|
|
14
20
|
alwaysShowFocus,
|
|
15
21
|
errorMessage,
|
|
@@ -18,34 +24,37 @@ const CapInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
18
24
|
showSuffix = true,
|
|
19
25
|
...rest
|
|
20
26
|
} = props;
|
|
21
|
-
const inputRef = useRef(null);
|
|
22
|
-
useEffect(() => {
|
|
27
|
+
const inputRef = (0, _react.useRef)(null);
|
|
28
|
+
(0, _react.useEffect)(() => {
|
|
23
29
|
if (alwaysShowFocus && inputRef.current) {
|
|
24
30
|
inputRef.current.focus();
|
|
25
31
|
}
|
|
26
32
|
}, [alwaysShowFocus]);
|
|
27
|
-
const inputSuffix = errorMessage &&
|
|
28
|
-
status: "error"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const inputSuffix = errorMessage && (0, _jsxRuntime.jsx)(StyledIcon, {
|
|
34
|
+
status: "error",
|
|
35
|
+
children: (0, _jsxRuntime.jsx)(_icons.WarningOutlined, {})
|
|
36
|
+
}) || isVerified && (0, _jsxRuntime.jsx)(StyledIcon, {
|
|
37
|
+
status: "success",
|
|
38
|
+
children: (0, _jsxRuntime.jsx)(_icons.CheckCircleOutlined, {})
|
|
39
|
+
}) || suffix || null;
|
|
40
|
+
return (0, _jsxRuntime.jsx)(_antd.Input, {
|
|
41
|
+
...rest,
|
|
33
42
|
ref: ref || inputRef,
|
|
34
43
|
suffix: showSuffix === false ? null : inputSuffix,
|
|
35
44
|
status: errorMessage ? 'error' : undefined
|
|
36
|
-
})
|
|
45
|
+
});
|
|
37
46
|
});
|
|
38
47
|
CapInput.displayName = 'CapInput';
|
|
39
48
|
CapInput.propTypes = {
|
|
40
|
-
alwaysShowFocus:
|
|
41
|
-
errorMessage:
|
|
42
|
-
isVerified:
|
|
43
|
-
size:
|
|
44
|
-
suffix:
|
|
45
|
-
showSuffix:
|
|
49
|
+
alwaysShowFocus: _propTypes.default.bool,
|
|
50
|
+
errorMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
51
|
+
isVerified: _propTypes.default.bool,
|
|
52
|
+
size: _propTypes.default.oneOf(['large', 'middle', 'small']),
|
|
53
|
+
suffix: _propTypes.default.node,
|
|
54
|
+
showSuffix: _propTypes.default.bool
|
|
46
55
|
};
|
|
47
56
|
CapInput.defaultProps = {
|
|
48
57
|
size: 'large',
|
|
49
58
|
showSuffix: true
|
|
50
59
|
};
|
|
51
|
-
|
|
60
|
+
var _default = exports.default = CapInput;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const CapInputNumber = _react.default.forwardRef((props, ref) => {
|
|
6
11
|
const {
|
|
7
12
|
size = 'large',
|
|
8
13
|
...rest
|
|
9
14
|
} = props;
|
|
10
|
-
return
|
|
15
|
+
return (0, _jsxRuntime.jsx)(_antd.InputNumber, {
|
|
16
|
+
...rest,
|
|
11
17
|
ref: ref,
|
|
12
18
|
size: size
|
|
13
|
-
})
|
|
19
|
+
});
|
|
14
20
|
});
|
|
15
21
|
CapInputNumber.displayName = 'CapInputNumber';
|
|
16
22
|
CapInputNumber.propTypes = {
|
|
17
|
-
size:
|
|
18
|
-
min:
|
|
19
|
-
max:
|
|
20
|
-
step:
|
|
21
|
-
precision:
|
|
22
|
-
decimalSeparator:
|
|
23
|
-
formatter:
|
|
24
|
-
parser:
|
|
25
|
-
controls:
|
|
26
|
-
keyboard:
|
|
27
|
-
stringMode:
|
|
23
|
+
size: _propTypes.default.oneOf(['large', 'middle', 'small']),
|
|
24
|
+
min: _propTypes.default.number,
|
|
25
|
+
max: _propTypes.default.number,
|
|
26
|
+
step: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
27
|
+
precision: _propTypes.default.number,
|
|
28
|
+
decimalSeparator: _propTypes.default.string,
|
|
29
|
+
formatter: _propTypes.default.func,
|
|
30
|
+
parser: _propTypes.default.func,
|
|
31
|
+
controls: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
32
|
+
keyboard: _propTypes.default.bool,
|
|
33
|
+
stringMode: _propTypes.default.bool
|
|
28
34
|
};
|
|
29
35
|
CapInputNumber.defaultProps = {
|
|
30
36
|
size: 'large',
|
|
31
37
|
keyboard: true
|
|
32
38
|
};
|
|
33
|
-
|
|
39
|
+
var _default = exports.default = CapInputNumber;
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
10
|
const {
|
|
6
11
|
Search
|
|
7
|
-
} = Input;
|
|
8
|
-
const CapInputSearch =
|
|
12
|
+
} = _antd.Input;
|
|
13
|
+
const CapInputSearch = _react.default.forwardRef((props, ref) => {
|
|
9
14
|
const {
|
|
10
15
|
size = 'large',
|
|
11
16
|
...rest
|
|
12
17
|
} = props;
|
|
13
|
-
return
|
|
18
|
+
return (0, _jsxRuntime.jsx)(Search, {
|
|
19
|
+
...rest,
|
|
14
20
|
ref: ref,
|
|
15
21
|
size: size
|
|
16
|
-
})
|
|
22
|
+
});
|
|
17
23
|
});
|
|
18
24
|
CapInputSearch.displayName = 'CapInputSearch';
|
|
19
25
|
CapInputSearch.propTypes = {
|
|
20
|
-
size:
|
|
21
|
-
enterButton:
|
|
22
|
-
loading:
|
|
23
|
-
onSearch:
|
|
26
|
+
size: _propTypes.default.oneOf(['large', 'middle', 'small']),
|
|
27
|
+
enterButton: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.node]),
|
|
28
|
+
loading: _propTypes.default.bool,
|
|
29
|
+
onSearch: _propTypes.default.func
|
|
24
30
|
};
|
|
25
31
|
CapInputSearch.defaultProps = {
|
|
26
32
|
size: 'large'
|
|
27
33
|
};
|
|
28
|
-
|
|
34
|
+
var _default = exports.default = CapInputSearch;
|
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
10
|
const {
|
|
6
11
|
TextArea
|
|
7
|
-
} = Input;
|
|
8
|
-
const CapInputTextArea =
|
|
12
|
+
} = _antd.Input;
|
|
13
|
+
const CapInputTextArea = _react.default.forwardRef((props, ref) => {
|
|
9
14
|
const {
|
|
10
15
|
size = 'large',
|
|
11
16
|
...rest
|
|
12
17
|
} = props;
|
|
13
|
-
return
|
|
18
|
+
return (0, _jsxRuntime.jsx)(TextArea, {
|
|
19
|
+
...rest,
|
|
14
20
|
ref: ref,
|
|
15
21
|
size: size
|
|
16
|
-
})
|
|
22
|
+
});
|
|
17
23
|
});
|
|
18
24
|
CapInputTextArea.displayName = 'CapInputTextArea';
|
|
19
25
|
CapInputTextArea.propTypes = {
|
|
20
|
-
size:
|
|
21
|
-
autoSize:
|
|
22
|
-
minRows:
|
|
23
|
-
maxRows:
|
|
26
|
+
size: _propTypes.default.oneOf(['large', 'middle', 'small']),
|
|
27
|
+
autoSize: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
|
|
28
|
+
minRows: _propTypes.default.number,
|
|
29
|
+
maxRows: _propTypes.default.number
|
|
24
30
|
})]),
|
|
25
|
-
rows:
|
|
26
|
-
maxLength:
|
|
27
|
-
showCount:
|
|
28
|
-
formatter:
|
|
31
|
+
rows: _propTypes.default.number,
|
|
32
|
+
maxLength: _propTypes.default.number,
|
|
33
|
+
showCount: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
|
|
34
|
+
formatter: _propTypes.default.func
|
|
29
35
|
})])
|
|
30
36
|
};
|
|
31
37
|
CapInputTextArea.defaultProps = {
|
|
32
38
|
size: 'large',
|
|
33
39
|
rows: 4
|
|
34
40
|
};
|
|
35
|
-
|
|
41
|
+
var _default = exports.default = CapInputTextArea;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapInput = _interopRequireDefault(require("./CapInput"));
|
|
6
|
+
var _Number = _interopRequireDefault(require("./Number"));
|
|
7
|
+
var _Search = _interopRequireDefault(require("./Search"));
|
|
8
|
+
var _TextArea = _interopRequireDefault(require("./TextArea"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
_CapInput.default.Number = _Number.default;
|
|
11
|
+
_CapInput.default.Search = _Search.default;
|
|
12
|
+
_CapInput.default.TextArea = _TextArea.default;
|
|
13
|
+
var _default = exports.default = _CapInput.default;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _reactIntl = require("react-intl");
|
|
7
6
|
const scope = 'blaze.components.CapInput';
|
|
8
|
-
|
|
7
|
+
var _default = exports.default = (0, _reactIntl.defineMessages)({
|
|
9
8
|
placeholder: {
|
|
10
9
|
id: `${scope}.placeholder`,
|
|
11
10
|
defaultMessage: 'Enter text...'
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.inputStyles = void 0;
|
|
5
|
+
var _styledComponents = require("styled-components");
|
|
6
|
+
var styledVars = _interopRequireWildcard(require("../styled/variables"));
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
|
+
const inputStyles = exports.inputStyles = (0, _styledComponents.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);
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
10
|
const CapSkeleton = _ref => {
|
|
9
11
|
let {
|
|
10
12
|
className,
|
|
11
13
|
...rest
|
|
12
14
|
} = _ref;
|
|
13
15
|
const combinedClassName = `cap-skeleton-v2 ${className || ''}`.trim();
|
|
14
|
-
return
|
|
15
|
-
className: combinedClassName
|
|
16
|
-
|
|
16
|
+
return (0, _jsxRuntime.jsx)(_antd.Skeleton, {
|
|
17
|
+
className: combinedClassName,
|
|
18
|
+
...rest
|
|
19
|
+
});
|
|
17
20
|
};
|
|
18
21
|
CapSkeleton.propTypes = {
|
|
19
|
-
className:
|
|
22
|
+
className: _propTypes.default.string
|
|
20
23
|
};
|
|
21
|
-
|
|
24
|
+
var _default = exports.default = CapSkeleton;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapSkeleton = _interopRequireDefault(require("./CapSkeleton"));
|
|
6
|
+
exports.default = _CapSkeleton.default;
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
10
|
const CapSpin = _ref => {
|
|
9
11
|
let {
|
|
10
12
|
className,
|
|
11
13
|
...rest
|
|
12
14
|
} = _ref;
|
|
13
|
-
return
|
|
14
|
-
className: className
|
|
15
|
-
|
|
15
|
+
return (0, _jsxRuntime.jsx)(_antd.Spin, {
|
|
16
|
+
className: className,
|
|
17
|
+
...rest
|
|
18
|
+
});
|
|
16
19
|
};
|
|
17
20
|
CapSpin.propTypes = {
|
|
18
|
-
className:
|
|
19
|
-
size:
|
|
20
|
-
spinning:
|
|
21
|
-
tip:
|
|
22
|
-
delay:
|
|
23
|
-
indicator:
|
|
24
|
-
fullscreen:
|
|
25
|
-
wrapperClassName:
|
|
21
|
+
className: _propTypes.default.string,
|
|
22
|
+
size: _propTypes.default.oneOf(['small', 'default', 'large']),
|
|
23
|
+
spinning: _propTypes.default.bool,
|
|
24
|
+
tip: _propTypes.default.string,
|
|
25
|
+
delay: _propTypes.default.number,
|
|
26
|
+
indicator: _propTypes.default.node,
|
|
27
|
+
fullscreen: _propTypes.default.bool,
|
|
28
|
+
wrapperClassName: _propTypes.default.string
|
|
26
29
|
};
|
|
27
|
-
|
|
30
|
+
var _default = exports.default = CapSpin;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapSpin = _interopRequireDefault(require("./CapSpin"));
|
|
6
|
+
exports.default = _CapSpin.default;
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _lodash = require("lodash");
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _styles = require("./styles");
|
|
10
|
+
var _LocaleHoc = _interopRequireDefault(require("../LocaleHoc"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
const SCROLL_THRESHOLD = 80;
|
|
15
|
+
const DEBOUNCE_DELAY = 250;
|
|
17
16
|
const DEFAULT_ROW_HEIGHT = 54;
|
|
18
17
|
const DEFAULT_SCROLL_HEIGHT = 400;
|
|
19
18
|
const CapTable = _ref => {
|
|
@@ -30,10 +29,10 @@ const CapTable = _ref => {
|
|
|
30
29
|
showLoader,
|
|
31
30
|
...rest
|
|
32
31
|
} = _ref;
|
|
33
|
-
const scrollRef = useRef(null);
|
|
34
|
-
const [hasMore, setHasMore] = useState(true);
|
|
35
|
-
const currentOffsetRef = useRef(0);
|
|
36
|
-
const loadMore = useCallback(() => {
|
|
32
|
+
const scrollRef = (0, _react.useRef)(null);
|
|
33
|
+
const [hasMore, setHasMore] = (0, _react.useState)(true);
|
|
34
|
+
const currentOffsetRef = (0, _react.useRef)(0);
|
|
35
|
+
const loadMore = (0, _react.useCallback)(() => {
|
|
37
36
|
if (!showLoader && hasMore) {
|
|
38
37
|
const nextOffset = currentOffsetRef.current + 1;
|
|
39
38
|
const newOffsetLimit = {
|
|
@@ -44,7 +43,7 @@ const CapTable = _ref => {
|
|
|
44
43
|
setPagination(newOffsetLimit);
|
|
45
44
|
}
|
|
46
45
|
}, [showLoader, hasMore, setPagination, offset_limit]);
|
|
47
|
-
const handleScroll = useCallback(debounce(event => {
|
|
46
|
+
const handleScroll = (0, _react.useCallback)((0, _lodash.debounce)(event => {
|
|
48
47
|
const target = event.target;
|
|
49
48
|
if (!target || !infiniteScroll || !hasMore || showLoader) return;
|
|
50
49
|
const scrollTop = Math.ceil(target.scrollTop);
|
|
@@ -55,70 +54,65 @@ const CapTable = _ref => {
|
|
|
55
54
|
loadMore();
|
|
56
55
|
}
|
|
57
56
|
}, DEBOUNCE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
|
|
58
|
-
|
|
59
|
-
// Setup scroll listener and handle initial load
|
|
60
|
-
useEffect(() => {
|
|
57
|
+
(0, _react.useEffect)(() => {
|
|
61
58
|
const tableBody = document.querySelector(`#${id} .ant-table-body`);
|
|
62
59
|
if (!tableBody) return;
|
|
63
60
|
scrollRef.current = tableBody;
|
|
64
61
|
tableBody.addEventListener('scroll', handleScroll, {
|
|
65
62
|
passive: true
|
|
66
63
|
});
|
|
67
|
-
|
|
68
|
-
// Check if initial load needed
|
|
69
64
|
const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight && !showLoader && hasMore;
|
|
70
65
|
if (shouldLoadInitially) {
|
|
71
66
|
currentOffsetRef.current = 0;
|
|
72
67
|
loadMore();
|
|
73
68
|
}
|
|
74
|
-
|
|
75
|
-
// Cleanup
|
|
76
69
|
return () => {
|
|
77
|
-
|
|
70
|
+
var _scrollRef$current;
|
|
71
|
+
(_scrollRef$current = scrollRef.current) == null ? void 0 : _scrollRef$current.removeEventListener('scroll', handleScroll);
|
|
78
72
|
handleScroll.cancel();
|
|
79
73
|
};
|
|
80
74
|
}, [id, handleScroll, showLoader, hasMore, loadMore]);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (!dataSource?.length) {
|
|
75
|
+
(0, _react.useEffect)(() => {
|
|
76
|
+
if (!(dataSource != null && dataSource.length)) {
|
|
85
77
|
currentOffsetRef.current = 0;
|
|
86
78
|
setHasMore(true);
|
|
87
79
|
} else {
|
|
88
80
|
setHasMore(true);
|
|
89
81
|
}
|
|
90
82
|
}, [dataSource]);
|
|
91
|
-
const tableClassName =
|
|
83
|
+
const tableClassName = (0, _classnames.default)('cap-table-v2', className, {
|
|
92
84
|
'show-loader': showLoader,
|
|
93
85
|
'infinite-scroll': infiniteScroll,
|
|
94
86
|
'has-more': hasMore
|
|
95
87
|
});
|
|
96
|
-
return
|
|
88
|
+
return (0, _jsxRuntime.jsx)(_styles.StyledTable, {
|
|
97
89
|
id: id,
|
|
98
90
|
className: tableClassName,
|
|
99
91
|
dataSource: dataSource,
|
|
100
92
|
pagination: false,
|
|
101
93
|
scroll: {
|
|
102
|
-
x: scroll
|
|
103
|
-
y: scroll
|
|
94
|
+
x: scroll == null ? void 0 : scroll.x,
|
|
95
|
+
y: (scroll == null ? void 0 : scroll.y) || DEFAULT_SCROLL_HEIGHT,
|
|
104
96
|
scrollToFirstRowOnChange: false
|
|
105
97
|
},
|
|
106
98
|
virtual: infiniteScroll,
|
|
107
|
-
rowHeight: DEFAULT_ROW_HEIGHT
|
|
108
|
-
|
|
99
|
+
rowHeight: DEFAULT_ROW_HEIGHT,
|
|
100
|
+
...rest,
|
|
101
|
+
children: children
|
|
102
|
+
});
|
|
109
103
|
};
|
|
110
104
|
CapTable.propTypes = {
|
|
111
|
-
id:
|
|
112
|
-
className:
|
|
113
|
-
children:
|
|
114
|
-
infiniteScroll:
|
|
115
|
-
pagination:
|
|
116
|
-
dataSource:
|
|
117
|
-
offset_limit:
|
|
118
|
-
setPagination:
|
|
119
|
-
scroll:
|
|
120
|
-
showLoader:
|
|
105
|
+
id: _propTypes.default.string.isRequired,
|
|
106
|
+
className: _propTypes.default.string,
|
|
107
|
+
children: _propTypes.default.node,
|
|
108
|
+
infiniteScroll: _propTypes.default.bool,
|
|
109
|
+
pagination: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.bool]),
|
|
110
|
+
dataSource: _propTypes.default.array,
|
|
111
|
+
offset_limit: _propTypes.default.object,
|
|
112
|
+
setPagination: _propTypes.default.func,
|
|
113
|
+
scroll: _propTypes.default.object,
|
|
114
|
+
showLoader: _propTypes.default.bool
|
|
121
115
|
};
|
|
122
|
-
|
|
116
|
+
var _default = exports.default = (0, _LocaleHoc.default)(CapTable, {
|
|
123
117
|
key: 'CapTable'
|
|
124
118
|
});
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _loadable = _interopRequireDefault(require("./loadable"));
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _default = exports.default = _loadable.default;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapSkeleton = _interopRequireDefault(require("../CapSkeleton"));
|
|
6
|
+
var _capUiUtils = require("@capillarytech/cap-ui-utils");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
const LoadableComponent = (0, _capUiUtils.loadable)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./CapTable'))));
|
|
12
|
+
const CapTableLoadable = props => (0, _jsxRuntime.jsx)(_react.Suspense, {
|
|
13
|
+
fallback: (0, _jsxRuntime.jsx)(_CapSkeleton.default, {}),
|
|
14
|
+
children: (0, _jsxRuntime.jsx)(LoadableComponent, {
|
|
15
|
+
...props
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
var _default = exports.default = CapTableLoadable;
|