From 82c4c8f0d3b194c1597e70e3b5991c6c3177cca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=9C=E5=86=BB=E6=A9=99?= Date: Sun, 12 Feb 2023 09:56:57 +0800 Subject: [PATCH] refactor:typography (#6244) * refactor:typography * fix return * fix import type --- components/style.ts | 2 +- components/theme/interface/components.ts | 4 +- components/typography/Editable.tsx | 77 +++--- components/typography/Typography.tsx | 12 +- components/typography/style/index.less | 314 ----------------------- components/typography/style/index.tsx | 132 +++++++++- components/typography/style/mixins.tsx | 263 +++++++++++++++++++ components/typography/style/rtl.less | 54 ---- 8 files changed, 450 insertions(+), 408 deletions(-) delete mode 100644 components/typography/style/index.less create mode 100644 components/typography/style/mixins.tsx delete mode 100644 components/typography/style/rtl.less diff --git a/components/style.ts b/components/style.ts index 73a4299e6..f71c8cfbc 100644 --- a/components/style.ts +++ b/components/style.ts @@ -60,5 +60,5 @@ import './result/style'; import './form/style'; // import './space/style'; import './image/style'; -import './typography/style'; +// import './typography/style'; // import './color-picker/style'; diff --git a/components/theme/interface/components.ts b/components/theme/interface/components.ts index 842013e7f..42c617e84 100644 --- a/components/theme/interface/components.ts +++ b/components/theme/interface/components.ts @@ -43,7 +43,7 @@ import type { ComponentToken as TagComponentToken } from '../../tag/style'; // import type { ComponentToken as TimelineComponentToken } from '../../timeline/style'; import type { ComponentToken as TooltipComponentToken } from '../../tooltip/style'; // import type { ComponentToken as TransferComponentToken } from '../../transfer/style'; -// import type { ComponentToken as TypographyComponentToken } from '../../typography/style'; +import type { ComponentToken as TypographyComponentToken } from '../../typography/style'; // import type { ComponentToken as UploadComponentToken } from '../../upload/style'; // import type { ComponentToken as TourComponentToken } from '../../tour/style'; // import type { ComponentToken as QRCodeComponentToken } from '../../qrcode/style'; @@ -98,7 +98,7 @@ export interface ComponentTokenMap { Tag?: TagComponentToken; Tree?: {}; TreeSelect?: {}; - // Typography?: TypographyComponentToken; + Typography?: TypographyComponentToken; // Timeline?: TimelineComponentToken; // Transfer?: TransferComponentToken; // Tabs?: TabsComponentToken; diff --git a/components/typography/Editable.tsx b/components/typography/Editable.tsx index 9edf878ee..e6b86d7f4 100644 --- a/components/typography/Editable.tsx +++ b/components/typography/Editable.tsx @@ -2,10 +2,14 @@ import KeyCode from '../_util/KeyCode'; import TextArea from '../input/TextArea'; import EnterOutlined from '@ant-design/icons-vue/EnterOutlined'; import type { ExtractPropTypes, PropType } from 'vue'; -import { defineComponent, ref, reactive, watch, onMounted, computed } from 'vue'; +import { defineComponent, ref, reactive, watch, onMounted, toRefs } from 'vue'; import type { Direction } from '../config-provider'; import type { ChangeEventHandler } from '../_util/EventInterface'; import type { AutoSizeType } from '../input/inputProps'; +import classNames from '../_util/classNames'; + +// CSSINJS +import useStyle from './style'; const editableProps = () => ({ prefixCls: String, @@ -24,9 +28,11 @@ export type EditableProps = Partial ({ - [`${props.prefixCls}`]: true, - [`${props.prefixCls}-edit-content`]: true, - [`${props.prefixCls}-rtl`]: props.direction === 'rtl', - [props.component ? `${props.prefixCls}-${props.component}` : '']: true, - })); - return () => ( -
-