Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(codemod): Add more components and types for @alipay/ob-ui => @oceanbase/ui #200

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
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';
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
@@ -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',
@@ -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/'],
},
4 changes: 2 additions & 2 deletions packages/ui/src/Ranger/QuickPicker.tsx
Original file line number Diff line number Diff line change
@@ -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;
@@ -92,7 +92,7 @@ const RangeSelect = ({ selects, onChange, value, customable, locale = {}, size }
);
};

export default (props: IProps) => {
export default (props: QuickPickerProps) => {
const {
type = 'select',
name,
4 changes: 2 additions & 2 deletions packages/ui/src/Ranger/Ranger.tsx
Original file line number Diff line number Diff line change
@@ -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;
@@ -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,
3 changes: 3 additions & 0 deletions packages/ui/src/Ranger/index.ts
Original file line number Diff line number Diff line change
@@ -27,6 +27,9 @@ import {
import QuickPicker from './QuickPicker';
import InternalRanger from './Ranger';

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

const Ranger = InternalRanger;

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

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

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