From 71eddd2c2069896160118c862b09b3657c453ccc Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sat, 31 Dec 2022 22:12:30 +0800 Subject: [PATCH] chore: remove useless tsx support (#39934) * chore: remove useless tsx support * add * revert * add * fix * fix * add test case * fix --- .gitignore | 2 +- components/{index.tsx => index.ts} | 0 ...-vertical.tsx => compact-item-vertical.ts} | 0 .../{compact-item.tsx => compact-item.ts} | 0 components/style/{index.tsx => index.ts} | 0 .../motion/{collapse.tsx => collapse.ts} | 0 components/style/motion/{fade.tsx => fade.ts} | 0 .../style/motion/{motion.tsx => motion.ts} | 0 components/style/motion/{move.tsx => move.ts} | 0 .../style/motion/{slide.tsx => slide.ts} | 0 components/style/motion/{zoom.tsx => zoom.ts} | 0 .../{operationUnit.tsx => operationUnit.ts} | 0 .../{placementArrow.tsx => placementArrow.ts} | 0 .../{roundedArrow.tsx => roundedArrow.ts} | 0 .../switch/style/{index.tsx => index.ts} | 0 components/table/{Column.tsx => Column.ts} | 0 .../table/{ColumnGroup.tsx => ColumnGroup.ts} | 0 components/table/__tests__/Table.test.tsx | 11 ++ .../__snapshots__/Table.test.tsx.snap | 101 ++++++++++++++++++ ...useTitleColumns.tsx => useTitleColumns.ts} | 0 components/table/{index.tsx => index.ts} | 0 .../table/{interface.tsx => interface.ts} | 0 .../table/style/{bordered.tsx => bordered.ts} | 0 .../table/style/{ellipsis.tsx => ellipsis.ts} | 0 .../table/style/{empty.tsx => empty.ts} | 0 .../table/style/{expand.tsx => expand.ts} | 0 .../table/style/{filter.tsx => filter.ts} | 0 .../table/style/{fixed.tsx => fixed.ts} | 0 .../table/style/{index.tsx => index.ts} | 0 .../style/{pagination.tsx => pagination.ts} | 0 .../table/style/{radius.tsx => radius.ts} | 0 components/table/style/{rtl.tsx => rtl.ts} | 0 .../style/{selection.tsx => selection.ts} | 0 components/table/style/{size.tsx => size.ts} | 0 .../table/style/{sorter.tsx => sorter.ts} | 0 .../table/style/{sticky.tsx => sticky.ts} | 0 .../table/style/{summary.tsx => summary.ts} | 0 components/tabs/{TabPane.tsx => TabPane.ts} | 0 components/tabs/style/{index.tsx => index.ts} | 0 .../tabs/style/{motion.tsx => motion.ts} | 0 components/tag/style/{index.tsx => index.ts} | 0 .../theme/{internal.tsx => internal.ts} | 0 .../locale/{ar_EG.tsx => ar_EG.ts} | 0 .../locale/{az_AZ.tsx => az_AZ.ts} | 0 .../locale/{bg_BG.tsx => bg_BG.ts} | 0 .../locale/{bn_BD.tsx => bn_BD.ts} | 0 .../locale/{by_BY.tsx => by_BY.ts} | 0 .../locale/{ca_ES.tsx => ca_ES.ts} | 0 .../locale/{cs_CZ.tsx => cs_CZ.ts} | 0 .../locale/{da_DK.tsx => da_DK.ts} | 0 .../locale/{de_DE.tsx => de_DE.ts} | 0 .../locale/{el_GR.tsx => el_GR.ts} | 0 .../locale/{en_GB.tsx => en_GB.ts} | 0 .../locale/{en_US.tsx => en_US.ts} | 0 .../locale/{es_ES.tsx => es_ES.ts} | 0 .../locale/{et_EE.tsx => et_EE.ts} | 0 .../locale/{eu_ES.tsx => eu_ES.ts} | 0 .../locale/{fa_IR.tsx => fa_IR.ts} | 0 .../locale/{fi_FI.tsx => fi_FI.ts} | 0 .../locale/{fr_BE.tsx => fr_BE.ts} | 0 .../locale/{fr_CA.tsx => fr_CA.ts} | 0 .../locale/{fr_FR.tsx => fr_FR.ts} | 0 .../locale/{ga_IE.tsx => ga_IE.ts} | 0 .../locale/{gl_ES.tsx => gl_ES.ts} | 0 .../locale/{he_IL.tsx => he_IL.ts} | 0 .../locale/{hi_IN.tsx => hi_IN.ts} | 0 .../locale/{hr_HR.tsx => hr_HR.ts} | 0 .../locale/{hu_HU.tsx => hu_HU.ts} | 0 .../locale/{id_ID.tsx => id_ID.ts} | 0 .../locale/{is_IS.tsx => is_IS.ts} | 0 .../locale/{it_IT.tsx => it_IT.ts} | 0 .../locale/{ja_JP.tsx => ja_JP.ts} | 0 .../locale/{ka_GE.tsx => ka_GE.ts} | 0 .../locale/{kk_KZ.tsx => kk_KZ.ts} | 0 .../locale/{km_KH.tsx => km_KH.ts} | 0 .../locale/{kmr_IQ.tsx => kmr_IQ.ts} | 0 .../locale/{kn_IN.tsx => kn_IN.ts} | 0 .../locale/{ko_KR.tsx => ko_KR.ts} | 0 .../locale/{lt_LT.tsx => lt_LT.ts} | 0 .../locale/{lv_LV.tsx => lv_LV.ts} | 0 .../locale/{mk_MK.tsx => mk_MK.ts} | 0 .../locale/{ml_IN.tsx => ml_IN.ts} | 0 .../locale/{mn_MN.tsx => mn_MN.ts} | 0 .../locale/{ms_MY.tsx => ms_MY.ts} | 0 .../locale/{nb_NO.tsx => nb_NO.ts} | 0 .../locale/{nl_BE.tsx => nl_BE.ts} | 0 .../locale/{nl_NL.tsx => nl_NL.ts} | 0 .../locale/{pl_PL.tsx => pl_PL.ts} | 0 .../locale/{pt_BR.tsx => pt_BR.ts} | 0 .../locale/{pt_PT.tsx => pt_PT.ts} | 0 .../locale/{ro_RO.tsx => ro_RO.ts} | 0 .../locale/{ru_RU.tsx => ru_RU.ts} | 0 .../locale/{si_LK.tsx => si_LK.ts} | 0 .../locale/{sk_SK.tsx => sk_SK.ts} | 0 .../locale/{sl_SI.tsx => sl_SI.ts} | 0 .../locale/{sr_RS.tsx => sr_RS.ts} | 0 .../locale/{sv_SE.tsx => sv_SE.ts} | 0 .../locale/{ta_IN.tsx => ta_IN.ts} | 0 .../locale/{th_TH.tsx => th_TH.ts} | 0 .../locale/{tk_TK.tsx => tk_TK.ts} | 0 .../locale/{tr_TR.tsx => tr_TR.ts} | 0 .../locale/{uk_UA.tsx => uk_UA.ts} | 0 .../locale/{ur_PK.tsx => ur_PK.ts} | 0 .../locale/{vi_VN.tsx => vi_VN.ts} | 0 .../locale/{zh_CN.tsx => zh_CN.ts} | 0 .../locale/{zh_TW.tsx => zh_TW.ts} | 0 components/timeline/{index.tsx => index.ts} | 0 .../timeline/style/{index.tsx => index.ts} | 0 .../tooltip/style/{index.tsx => index.ts} | 5 +- components/tour/style/{index.tsx => index.ts} | 5 +- .../transfer/style/{index.tsx => index.ts} | 0 .../tree-select/style/{index.tsx => index.ts} | 0 components/tree/{index.tsx => index.ts} | 0 components/tree/style/{index.tsx => index.ts} | 0 components/typography/{index.tsx => index.ts} | 0 .../typography/style/{index.tsx => index.ts} | 0 .../style/{mixins.tsx => mixins.ts} | 0 scripts/generate-version.js | 4 +- tsconfig.json | 2 +- 119 files changed, 118 insertions(+), 12 deletions(-) rename components/{index.tsx => index.ts} (100%) rename components/style/{compact-item-vertical.tsx => compact-item-vertical.ts} (100%) rename components/style/{compact-item.tsx => compact-item.ts} (100%) rename components/style/{index.tsx => index.ts} (100%) rename components/style/motion/{collapse.tsx => collapse.ts} (100%) rename components/style/motion/{fade.tsx => fade.ts} (100%) rename components/style/motion/{motion.tsx => motion.ts} (100%) rename components/style/motion/{move.tsx => move.ts} (100%) rename components/style/motion/{slide.tsx => slide.ts} (100%) rename components/style/motion/{zoom.tsx => zoom.ts} (100%) rename components/style/{operationUnit.tsx => operationUnit.ts} (100%) rename components/style/{placementArrow.tsx => placementArrow.ts} (100%) rename components/style/{roundedArrow.tsx => roundedArrow.ts} (100%) rename components/switch/style/{index.tsx => index.ts} (100%) rename components/table/{Column.tsx => Column.ts} (100%) rename components/table/{ColumnGroup.tsx => ColumnGroup.ts} (100%) rename components/table/hooks/{useTitleColumns.tsx => useTitleColumns.ts} (100%) rename components/table/{index.tsx => index.ts} (100%) rename components/table/{interface.tsx => interface.ts} (100%) rename components/table/style/{bordered.tsx => bordered.ts} (100%) rename components/table/style/{ellipsis.tsx => ellipsis.ts} (100%) rename components/table/style/{empty.tsx => empty.ts} (100%) rename components/table/style/{expand.tsx => expand.ts} (100%) rename components/table/style/{filter.tsx => filter.ts} (100%) rename components/table/style/{fixed.tsx => fixed.ts} (100%) rename components/table/style/{index.tsx => index.ts} (100%) rename components/table/style/{pagination.tsx => pagination.ts} (100%) rename components/table/style/{radius.tsx => radius.ts} (100%) rename components/table/style/{rtl.tsx => rtl.ts} (100%) rename components/table/style/{selection.tsx => selection.ts} (100%) rename components/table/style/{size.tsx => size.ts} (100%) rename components/table/style/{sorter.tsx => sorter.ts} (100%) rename components/table/style/{sticky.tsx => sticky.ts} (100%) rename components/table/style/{summary.tsx => summary.ts} (100%) rename components/tabs/{TabPane.tsx => TabPane.ts} (100%) rename components/tabs/style/{index.tsx => index.ts} (100%) rename components/tabs/style/{motion.tsx => motion.ts} (100%) rename components/tag/style/{index.tsx => index.ts} (100%) rename components/theme/{internal.tsx => internal.ts} (100%) rename components/time-picker/locale/{ar_EG.tsx => ar_EG.ts} (100%) rename components/time-picker/locale/{az_AZ.tsx => az_AZ.ts} (100%) rename components/time-picker/locale/{bg_BG.tsx => bg_BG.ts} (100%) rename components/time-picker/locale/{bn_BD.tsx => bn_BD.ts} (100%) rename components/time-picker/locale/{by_BY.tsx => by_BY.ts} (100%) rename components/time-picker/locale/{ca_ES.tsx => ca_ES.ts} (100%) rename components/time-picker/locale/{cs_CZ.tsx => cs_CZ.ts} (100%) rename components/time-picker/locale/{da_DK.tsx => da_DK.ts} (100%) rename components/time-picker/locale/{de_DE.tsx => de_DE.ts} (100%) rename components/time-picker/locale/{el_GR.tsx => el_GR.ts} (100%) rename components/time-picker/locale/{en_GB.tsx => en_GB.ts} (100%) rename components/time-picker/locale/{en_US.tsx => en_US.ts} (100%) rename components/time-picker/locale/{es_ES.tsx => es_ES.ts} (100%) rename components/time-picker/locale/{et_EE.tsx => et_EE.ts} (100%) rename components/time-picker/locale/{eu_ES.tsx => eu_ES.ts} (100%) rename components/time-picker/locale/{fa_IR.tsx => fa_IR.ts} (100%) rename components/time-picker/locale/{fi_FI.tsx => fi_FI.ts} (100%) rename components/time-picker/locale/{fr_BE.tsx => fr_BE.ts} (100%) rename components/time-picker/locale/{fr_CA.tsx => fr_CA.ts} (100%) rename components/time-picker/locale/{fr_FR.tsx => fr_FR.ts} (100%) rename components/time-picker/locale/{ga_IE.tsx => ga_IE.ts} (100%) rename components/time-picker/locale/{gl_ES.tsx => gl_ES.ts} (100%) rename components/time-picker/locale/{he_IL.tsx => he_IL.ts} (100%) rename components/time-picker/locale/{hi_IN.tsx => hi_IN.ts} (100%) rename components/time-picker/locale/{hr_HR.tsx => hr_HR.ts} (100%) rename components/time-picker/locale/{hu_HU.tsx => hu_HU.ts} (100%) rename components/time-picker/locale/{id_ID.tsx => id_ID.ts} (100%) rename components/time-picker/locale/{is_IS.tsx => is_IS.ts} (100%) rename components/time-picker/locale/{it_IT.tsx => it_IT.ts} (100%) rename components/time-picker/locale/{ja_JP.tsx => ja_JP.ts} (100%) rename components/time-picker/locale/{ka_GE.tsx => ka_GE.ts} (100%) rename components/time-picker/locale/{kk_KZ.tsx => kk_KZ.ts} (100%) rename components/time-picker/locale/{km_KH.tsx => km_KH.ts} (100%) rename components/time-picker/locale/{kmr_IQ.tsx => kmr_IQ.ts} (100%) mode change 100755 => 100644 rename components/time-picker/locale/{kn_IN.tsx => kn_IN.ts} (100%) rename components/time-picker/locale/{ko_KR.tsx => ko_KR.ts} (100%) rename components/time-picker/locale/{lt_LT.tsx => lt_LT.ts} (100%) rename components/time-picker/locale/{lv_LV.tsx => lv_LV.ts} (100%) rename components/time-picker/locale/{mk_MK.tsx => mk_MK.ts} (100%) rename components/time-picker/locale/{ml_IN.tsx => ml_IN.ts} (100%) rename components/time-picker/locale/{mn_MN.tsx => mn_MN.ts} (100%) rename components/time-picker/locale/{ms_MY.tsx => ms_MY.ts} (100%) rename components/time-picker/locale/{nb_NO.tsx => nb_NO.ts} (100%) rename components/time-picker/locale/{nl_BE.tsx => nl_BE.ts} (100%) rename components/time-picker/locale/{nl_NL.tsx => nl_NL.ts} (100%) rename components/time-picker/locale/{pl_PL.tsx => pl_PL.ts} (100%) rename components/time-picker/locale/{pt_BR.tsx => pt_BR.ts} (100%) rename components/time-picker/locale/{pt_PT.tsx => pt_PT.ts} (100%) rename components/time-picker/locale/{ro_RO.tsx => ro_RO.ts} (100%) rename components/time-picker/locale/{ru_RU.tsx => ru_RU.ts} (100%) rename components/time-picker/locale/{si_LK.tsx => si_LK.ts} (100%) rename components/time-picker/locale/{sk_SK.tsx => sk_SK.ts} (100%) rename components/time-picker/locale/{sl_SI.tsx => sl_SI.ts} (100%) rename components/time-picker/locale/{sr_RS.tsx => sr_RS.ts} (100%) rename components/time-picker/locale/{sv_SE.tsx => sv_SE.ts} (100%) rename components/time-picker/locale/{ta_IN.tsx => ta_IN.ts} (100%) rename components/time-picker/locale/{th_TH.tsx => th_TH.ts} (100%) rename components/time-picker/locale/{tk_TK.tsx => tk_TK.ts} (100%) rename components/time-picker/locale/{tr_TR.tsx => tr_TR.ts} (100%) rename components/time-picker/locale/{uk_UA.tsx => uk_UA.ts} (100%) rename components/time-picker/locale/{ur_PK.tsx => ur_PK.ts} (100%) rename components/time-picker/locale/{vi_VN.tsx => vi_VN.ts} (100%) rename components/time-picker/locale/{zh_CN.tsx => zh_CN.ts} (100%) rename components/time-picker/locale/{zh_TW.tsx => zh_TW.ts} (100%) rename components/timeline/{index.tsx => index.ts} (100%) rename components/timeline/style/{index.tsx => index.ts} (100%) rename components/tooltip/style/{index.tsx => index.ts} (96%) rename components/tour/style/{index.tsx => index.ts} (97%) rename components/transfer/style/{index.tsx => index.ts} (100%) rename components/tree-select/style/{index.tsx => index.ts} (100%) rename components/tree/{index.tsx => index.ts} (100%) rename components/tree/style/{index.tsx => index.ts} (100%) rename components/typography/{index.tsx => index.ts} (100%) rename components/typography/style/{index.tsx => index.ts} (100%) rename components/typography/style/{mixins.tsx => mixins.ts} (100%) diff --git a/.gitignore b/.gitignore index 1cbe6e171f..16c86a873c 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,7 @@ server/ # Docs templates scripts/previewEditor/index.html -components/version/version.tsx +components/version/version.ts components/version/token.json components/version/token-meta.json .dumi/tmp diff --git a/components/index.tsx b/components/index.ts similarity index 100% rename from components/index.tsx rename to components/index.ts diff --git a/components/style/compact-item-vertical.tsx b/components/style/compact-item-vertical.ts similarity index 100% rename from components/style/compact-item-vertical.tsx rename to components/style/compact-item-vertical.ts diff --git a/components/style/compact-item.tsx b/components/style/compact-item.ts similarity index 100% rename from components/style/compact-item.tsx rename to components/style/compact-item.ts diff --git a/components/style/index.tsx b/components/style/index.ts similarity index 100% rename from components/style/index.tsx rename to components/style/index.ts diff --git a/components/style/motion/collapse.tsx b/components/style/motion/collapse.ts similarity index 100% rename from components/style/motion/collapse.tsx rename to components/style/motion/collapse.ts diff --git a/components/style/motion/fade.tsx b/components/style/motion/fade.ts similarity index 100% rename from components/style/motion/fade.tsx rename to components/style/motion/fade.ts diff --git a/components/style/motion/motion.tsx b/components/style/motion/motion.ts similarity index 100% rename from components/style/motion/motion.tsx rename to components/style/motion/motion.ts diff --git a/components/style/motion/move.tsx b/components/style/motion/move.ts similarity index 100% rename from components/style/motion/move.tsx rename to components/style/motion/move.ts diff --git a/components/style/motion/slide.tsx b/components/style/motion/slide.ts similarity index 100% rename from components/style/motion/slide.tsx rename to components/style/motion/slide.ts diff --git a/components/style/motion/zoom.tsx b/components/style/motion/zoom.ts similarity index 100% rename from components/style/motion/zoom.tsx rename to components/style/motion/zoom.ts diff --git a/components/style/operationUnit.tsx b/components/style/operationUnit.ts similarity index 100% rename from components/style/operationUnit.tsx rename to components/style/operationUnit.ts diff --git a/components/style/placementArrow.tsx b/components/style/placementArrow.ts similarity index 100% rename from components/style/placementArrow.tsx rename to components/style/placementArrow.ts diff --git a/components/style/roundedArrow.tsx b/components/style/roundedArrow.ts similarity index 100% rename from components/style/roundedArrow.tsx rename to components/style/roundedArrow.ts diff --git a/components/switch/style/index.tsx b/components/switch/style/index.ts similarity index 100% rename from components/switch/style/index.tsx rename to components/switch/style/index.ts diff --git a/components/table/Column.tsx b/components/table/Column.ts similarity index 100% rename from components/table/Column.tsx rename to components/table/Column.ts diff --git a/components/table/ColumnGroup.tsx b/components/table/ColumnGroup.ts similarity index 100% rename from components/table/ColumnGroup.tsx rename to components/table/ColumnGroup.ts diff --git a/components/table/__tests__/Table.test.tsx b/components/table/__tests__/Table.test.tsx index fdaf21d394..8227e67532 100644 --- a/components/table/__tests__/Table.test.tsx +++ b/components/table/__tests__/Table.test.tsx @@ -1,3 +1,4 @@ +import { ConfigProvider } from 'antd'; import React from 'react'; import type { TableProps } from '..'; import Table from '..'; @@ -360,4 +361,14 @@ describe('Table', () => { expect(container.querySelector('table')?.getAttribute('aria-label')).toBe('label'); expect(container.querySelector('.ant-table')?.getAttribute('data-number')).toBe('123'); }); + + it('support wireframe', () => { + const columns = [{ title: 'Name', key: 'name', dataIndex: 'name' }]; + const { container } = render( + + + , + ); + expect(container.firstChild).toMatchSnapshot(); + }); }); diff --git a/components/table/__tests__/__snapshots__/Table.test.tsx.snap b/components/table/__tests__/__snapshots__/Table.test.tsx.snap index f2857d7792..93c6920242 100644 --- a/components/table/__tests__/__snapshots__/Table.test.tsx.snap +++ b/components/table/__tests__/__snapshots__/Table.test.tsx.snap @@ -632,6 +632,107 @@ exports[`Table should render title 1`] = ` `; +exports[`Table support wireframe 1`] = ` +
+
+
+
+
+
+
+ + + + + + + + + + + +
+ Name +
+
+
+ + + + + + + + + +
+
+ No data +
+
+
+ + + + + + +`; + exports[`Table title should support ReactNode 1`] = ` = (token) => { `&-placement-rightBottom`, ].join(',')]: { [`${componentCls}-inner`]: { - borderRadius: - tooltipBorderRadius > MAX_VERTICAL_CONTENT_RADIUS - ? MAX_VERTICAL_CONTENT_RADIUS - : tooltipBorderRadius, + borderRadius: Math.min(tooltipBorderRadius, MAX_VERTICAL_CONTENT_RADIUS), }, }, diff --git a/components/tour/style/index.tsx b/components/tour/style/index.ts similarity index 97% rename from components/tour/style/index.tsx rename to components/tour/style/index.ts index a1d585f262..29eadff0cb 100644 --- a/components/tour/style/index.tsx +++ b/components/tour/style/index.ts @@ -222,10 +222,7 @@ const genBaseStyle: GenerateStyle = (token) => { '&-placement-rightBottom', ].join(',')]: { [`${componentCls}-inner`]: { - borderRadius: - tourBorderRadius > MAX_VERTICAL_CONTENT_RADIUS - ? MAX_VERTICAL_CONTENT_RADIUS - : tourBorderRadius, + borderRadius: Math.min(tourBorderRadius, MAX_VERTICAL_CONTENT_RADIUS), }, }, }, diff --git a/components/transfer/style/index.tsx b/components/transfer/style/index.ts similarity index 100% rename from components/transfer/style/index.tsx rename to components/transfer/style/index.ts diff --git a/components/tree-select/style/index.tsx b/components/tree-select/style/index.ts similarity index 100% rename from components/tree-select/style/index.tsx rename to components/tree-select/style/index.ts diff --git a/components/tree/index.tsx b/components/tree/index.ts similarity index 100% rename from components/tree/index.tsx rename to components/tree/index.ts diff --git a/components/tree/style/index.tsx b/components/tree/style/index.ts similarity index 100% rename from components/tree/style/index.tsx rename to components/tree/style/index.ts diff --git a/components/typography/index.tsx b/components/typography/index.ts similarity index 100% rename from components/typography/index.tsx rename to components/typography/index.ts diff --git a/components/typography/style/index.tsx b/components/typography/style/index.ts similarity index 100% rename from components/typography/style/index.tsx rename to components/typography/style/index.ts diff --git a/components/typography/style/mixins.tsx b/components/typography/style/mixins.ts similarity index 100% rename from components/typography/style/mixins.tsx rename to components/typography/style/mixins.ts diff --git a/scripts/generate-version.js b/scripts/generate-version.js index 0370a17df8..42e79cb3f9 100644 --- a/scripts/generate-version.js +++ b/scripts/generate-version.js @@ -4,7 +4,7 @@ const path = require('path'); const { version } = require('../package.json'); fs.writeFileSync( - path.join(__dirname, '..', 'components', 'version', 'version.tsx'), - `export default '${version}'`, + path.join(__dirname, '..', 'components', 'version', 'version.ts'), + `export default '${version}';`, 'utf8', ); diff --git a/tsconfig.json b/tsconfig.json index 98908c88a3..aadc26e8e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "baseUrl": "./", "paths": { - "antd": ["components/index.tsx"], + "antd": ["components/index.ts"], "antd/es/*": ["components/*"], "antd/lib/*": ["components/*"], "antd/locale/*": ["components/locale/*"]