mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
commit
23d5928c99
@ -35,6 +35,11 @@ const localeValues: Locale = {
|
||||
triggerAsc: 'Sortuj rosnąco',
|
||||
cancelSort: 'Usuń sortowanie',
|
||||
},
|
||||
Tour: {
|
||||
Next: 'Dalej',
|
||||
Previous: 'Wróć',
|
||||
Finish: 'Zakończ',
|
||||
},
|
||||
Modal: {
|
||||
okText: 'OK',
|
||||
cancelText: 'Anuluj',
|
||||
|
@ -19,7 +19,7 @@ export interface CheckableTagProps {
|
||||
onClick?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
|
||||
}
|
||||
|
||||
const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
||||
const CheckableTag = React.forwardRef<HTMLSpanElement, CheckableTagProps>((props, ref) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
style,
|
||||
@ -54,6 +54,7 @@ const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
||||
return wrapSSR(
|
||||
<span
|
||||
{...restProps}
|
||||
ref={ref}
|
||||
style={{
|
||||
...style,
|
||||
...tag?.style,
|
||||
@ -62,6 +63,6 @@ const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
||||
onClick={handleClick}
|
||||
/>,
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default CheckableTag;
|
||||
|
@ -197,6 +197,21 @@ describe('Tag', () => {
|
||||
fireEvent.click(container.querySelectorAll('.ant-tag')[0]);
|
||||
expect(onChange).toHaveBeenCalledWith(true);
|
||||
});
|
||||
|
||||
it('should support ref', () => {
|
||||
const ref = React.createRef<HTMLSpanElement>();
|
||||
const { container } = render(
|
||||
<Tag.CheckableTag checked={false} ref={ref}>
|
||||
Tag Text
|
||||
</Tag.CheckableTag>,
|
||||
);
|
||||
const refElement = ref.current;
|
||||
const queryTarget = container.querySelector('.ant-tag');
|
||||
expect(refElement instanceof HTMLSpanElement).toBe(true);
|
||||
expect(refElement?.textContent).toBe('Tag Text');
|
||||
expect(queryTarget?.textContent).toBe('Tag Text');
|
||||
expect(refElement).toBe(queryTarget);
|
||||
});
|
||||
});
|
||||
it('should onClick is undefined', async () => {
|
||||
const { container } = render(<Tag onClick={undefined} />);
|
||||
|
@ -205,7 +205,7 @@ Same as above. You can adjust antd css priority to override. Related issue: [#38
|
||||
|
||||
## How to let CSS-in-JS work with shadow DOM?
|
||||
|
||||
Please ref document [Shadow Dom Usage](/docs/react/customize-theme#shadow-dom-usage).
|
||||
Please ref document [Shadow Dom Usage](/docs/react/compatible-style#shadow-dom-usage).
|
||||
|
||||
## How to support SSR?
|
||||
|
||||
|
@ -233,7 +233,7 @@ import { ConfigProvider } from 'antd';
|
||||
|
||||
## CSS-in-JS 如何与 Shadow DOM 一同使用?
|
||||
|
||||
请参考文档 [Shadow Dom 场景](/docs/react/customize-theme-cn#shadow-dom-场景) 内容。
|
||||
请参考文档 [Shadow Dom 场景](/docs/react/compatible-style-cn#shadow-dom-场景) 内容。
|
||||
|
||||
## 如何支持 SSR?
|
||||
|
||||
|
16
package.json
16
package.json
@ -110,15 +110,15 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@ant-design/colors": "^7.0.0",
|
||||
"@ant-design/cssinjs": "^1.16.0",
|
||||
"@ant-design/icons": "^5.2.2",
|
||||
"@ant-design/react-slick": "~1.0.0",
|
||||
"@ant-design/cssinjs": "^1.17.0",
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@ant-design/react-slick": "~1.0.2",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@ctrl/tinycolor": "^3.6.0",
|
||||
"@ctrl/tinycolor": "^3.6.1",
|
||||
"@rc-component/color-picker": "~1.4.1",
|
||||
"@rc-component/mutate-observer": "^1.1.0",
|
||||
"@rc-component/tour": "~1.10.0",
|
||||
"@rc-component/trigger": "^1.16.0",
|
||||
"@rc-component/trigger": "^1.17.0",
|
||||
"classnames": "^2.2.6",
|
||||
"copy-to-clipboard": "^3.2.0",
|
||||
"dayjs": "^1.11.1",
|
||||
@ -129,7 +129,7 @@
|
||||
"rc-dialog": "~9.3.3",
|
||||
"rc-drawer": "~6.5.2",
|
||||
"rc-dropdown": "~4.1.0",
|
||||
"rc-field-form": "~1.38.1",
|
||||
"rc-field-form": "~1.38.2",
|
||||
"rc-image": "~7.3.0",
|
||||
"rc-input": "~1.2.1",
|
||||
"rc-input-number": "~8.1.0",
|
||||
@ -138,7 +138,7 @@
|
||||
"rc-motion": "^2.9.0",
|
||||
"rc-notification": "~5.2.0",
|
||||
"rc-pagination": "~3.6.1",
|
||||
"rc-picker": "~3.14.1",
|
||||
"rc-picker": "~3.14.4",
|
||||
"rc-progress": "~3.5.1",
|
||||
"rc-rate": "~2.12.0",
|
||||
"rc-resize-observer": "^1.3.1",
|
||||
@ -153,7 +153,7 @@
|
||||
"rc-tooltip": "~6.1.0",
|
||||
"rc-tree": "~5.7.12",
|
||||
"rc-tree-select": "~5.13.0",
|
||||
"rc-upload": "~4.3.4",
|
||||
"rc-upload": "~4.3.5",
|
||||
"rc-util": "^5.37.0",
|
||||
"scroll-into-view-if-needed": "^3.0.3",
|
||||
"throttle-debounce": "^5.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user