Skip to content

Commit

Permalink
improve(codemod): Add more components and types for @alipay/ob-ui => …
Browse files Browse the repository at this point in the history
…@oceanbase/ui
  • Loading branch information
dengfuping committed Oct 20, 2023
1 parent d430340 commit f5c9f2b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Alert, Button, BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Boundary, ConfigProvider, Login, PageContainer, theme } from '@alipay/ob-ui';
import { Alert, Button, BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Boundary, ConfigProvider, ContentWithQuestion, IconFont, Login, PageContainer, Ranger, theme, TreeSearch } from '@alipay/ob-ui';
import type { BackgroundTaskManagerRef, ITaskMgrPreset, ITaskMgrQueue, TaskMgrID } from '@alipay/ob-ui';
import type { BasicLayoutProps } from '@alipay/ob-ui/es/BasicLayout';
import type { LoginProps } from '@alipay/ob-ui/es/Login';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Alert, Button, ConfigProvider, theme } from '@oceanbase/design';
import { BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Boundary, Login, PageContainer } from '@oceanbase/ui';
import { BackgroundTaskManager, BackgroundTaskManagerConstants, BasicLayout, Boundary, ContentWithQuestion, IconFont, Login, PageContainer, Ranger, TreeSearch } from '@oceanbase/ui';
import type { BackgroundTaskManagerRef, ITaskMgrPreset, ITaskMgrQueue, TaskMgrID } from '@oceanbase/ui';
import type { BasicLayoutProps } from '@oceanbase/ui/es/BasicLayout';
import type { LoginProps } from '@oceanbase/ui/es/Login';
Expand Down
24 changes: 24 additions & 0 deletions packages/codemod/transforms/obui-to-oceanbase-design-and-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ module.exports = (file, api, options) => {
'ContentWithQuestion',
'Dialog',
'DocDialog',
'FullscreenBox',
'Highlight',
'GraphToolbar',
'IconFont',
'Login',
'Lottie',
'NavMenu',
'Password',
'Ranger',
'SideTip',
'TaskGraph',
'TreeSearch',
'Welcome',
],
types: [
'PageContainerProps',
'ActionProps',
// BackgroundTaskManager
'BackgroundTaskManagerProps',
'BackgroundTaskManagerRef',
'ITaskMgrPreset',
Expand All @@ -38,10 +48,24 @@ module.exports = (file, api, options) => {
'ContentWithQuestionProps',
'DialogProps',
'DocDialogProps',
'FullscreenBoxProps',
'GraphToolbarProps',
'HighlightProps',
'IconFontProps',
'LoginProps',
'LottieProps',
'NavMenuProps',
'PasswordProps',
// Ranger
'RangerProps',
'QuickPickerProps',
'SideTipProps',
'TaskGraphProps',
// TreeSearch
'TreeSearchProps',
'TreeSearchRef',
'Node',
'WelcomeProps',
],
paths: ['/locale/', '/locale/'],
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/Ranger/QuickPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface SelectProps {

export type QuickType = 'select' | 'dropdown';

interface IProps extends LocaleWrapperProps {
interface QuickPickerProps extends LocaleWrapperProps {
selects: RangeOption[];
type?: QuickType;
onChange: (range: RangeValue) => void;
Expand Down Expand Up @@ -92,7 +92,7 @@ const RangeSelect = ({ selects, onChange, value, customable, locale = {}, size }
);
};

export default (props: IProps) => {
export default (props: QuickPickerProps) => {
const {
type = 'select',
name,
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/Ranger/Ranger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type RangeDateValue = {
range: RangeValue;
};

interface IProps extends Omit<RangePickerProps, 'mode' | 'picker' | 'value' | 'defaultValue'> {
interface RangerProps extends Omit<RangePickerProps, 'mode' | 'picker' | 'value' | 'defaultValue'> {
// 数据相关
selects?: RangeOption[];
defaultQuickValue?: string;
Expand All @@ -49,7 +49,7 @@ interface IProps extends Omit<RangePickerProps, 'mode' | 'picker' | 'value' | 'd

const prefix = getPrefix('ranger');

const Ranger = (props: IProps) => {
const Ranger = (props: RangerProps) => {
const {
selects = [NEAR_1_MINUTES, NEAR_30_MINUTES, NEAR_1_HOURS],
value,
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/Ranger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import {
import QuickPicker from './QuickPicker';
import InternalRanger from './Ranger';

export * from './QuickPicker';
export * from './Ranger';

const Ranger = InternalRanger;

// 内置 ranges
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/TreeSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface TreeSearchRef {
invertSelect: () => void;
}

interface IProps {
interface TreeSearchProps {
treeData: Node[];
titleRender?: (nodeData: DataNode) => React.ReactNode;
checkable?: boolean;
Expand All @@ -50,7 +50,7 @@ interface IProps {
searchStyle?: {};
}

export default forwardRef<TreeSearchRef, IProps>(
export default forwardRef<TreeSearchRef, TreeSearchProps>(
(
{
treeData = [],
Expand Down

0 comments on commit f5c9f2b

Please sign in to comment.