@capillarytech/blaze-ui 0.1.6-alpha.59 → 0.1.6-alpha.60
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/CapIcon/CapIcon.js +1 -1
- package/CapInput/CapInput.js +1 -1
- package/CapUnifiedSelect/CapUnifiedSelect.js +2 -1
- package/package.json +2 -2
- package/utils/withMemo.js +33 -0
- package/.DS_Store +0 -0
package/CapIcon/CapIcon.js
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
import * as AntdIcons from '@ant-design/icons';
|
|
5
|
+
import * as AntdIcons from '@ant-design-v5/icons';
|
|
6
6
|
import { IconWrapper, BackgroundWrapper, iconStyles } from './styles';
|
|
7
7
|
import withStyles from '../utils/withStyles';
|
|
8
8
|
|
package/CapInput/CapInput.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Input } from 'antd-v5';
|
|
4
|
-
import { WarningOutlined, CheckCircleOutlined } from '@ant-design/icons';
|
|
4
|
+
import { WarningOutlined, CheckCircleOutlined } from '@ant-design-v5/icons';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import * as styledVars from '../styled/variables';
|
|
7
7
|
|
|
@@ -7,6 +7,7 @@ import styled from 'styled-components';
|
|
|
7
7
|
import * as styledVars from '../styled/variables';
|
|
8
8
|
import { CapLabel, CapTooltipWithInfo, CapRow, CapIcon } from '../';
|
|
9
9
|
import withStyles from '../utils/withStyles';
|
|
10
|
+
import withMemo from '../utils/withMemo';
|
|
10
11
|
import { HeaderWrapper, selectStyles } from './styles';
|
|
11
12
|
|
|
12
13
|
const StyledTreeSelect = styled(TreeSelect)`
|
|
@@ -597,4 +598,4 @@ CapUnifiedSelect.defaultProps = {
|
|
|
597
598
|
onCancel: () => {},
|
|
598
599
|
};
|
|
599
600
|
|
|
600
|
-
export default withStyles(CapUnifiedSelect, selectStyles);
|
|
601
|
+
export default withMemo(withStyles(CapUnifiedSelect, selectStyles));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/blaze-ui",
|
|
3
3
|
"author": "Capillary Technologies",
|
|
4
|
-
"version": "0.1.6-alpha.
|
|
4
|
+
"version": "0.1.6-alpha.60",
|
|
5
5
|
"description": "Capillary UI component library with Ant Design v5",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"sideEffects": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"homepage": "https://github.com/Capillary/blaze-ui",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ant-design/icons": "
|
|
28
|
+
"@ant-design-v5/icons": "npm:@ant-design/icons@^5.2.6",
|
|
29
29
|
"@capillarytech/cap-ui-utils": "^3.0.4",
|
|
30
30
|
"antd-v5": "npm:antd@^5.26.7",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const withMemo = (Component, isEqual, log = false) => {
|
|
4
|
+
const defaultIsEqual = (prevProps, nextProps) => {
|
|
5
|
+
const prevKeys = Object.keys(prevProps).filter((key) => key !== 'intl');
|
|
6
|
+
const changedProps = [];
|
|
7
|
+
const isEqual = prevKeys.every((key) => {
|
|
8
|
+
const areEqual = prevProps[key] === nextProps[key];
|
|
9
|
+
if (!areEqual) {
|
|
10
|
+
changedProps.push({
|
|
11
|
+
key,
|
|
12
|
+
prevValue: prevProps[key],
|
|
13
|
+
nextValue: nextProps[key],
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return areEqual;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (log && changedProps.length > 0) {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.log('Props changed:', changedProps);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return isEqual;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (typeof isEqual !== 'function') {
|
|
28
|
+
return React.memo(Component, defaultIsEqual);
|
|
29
|
+
}
|
|
30
|
+
return React.memo(Component, isEqual);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default withMemo;
|
package/.DS_Store
DELETED
|
Binary file
|