Skip to content

Commit

Permalink
🎨 format code
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Apr 21, 2020
1 parent 5e5ec40 commit 509a3ef
Show file tree
Hide file tree
Showing 57 changed files with 1,236 additions and 1,202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface FunUseFullscreen {
(el?: HTMLElement): [boolean, () => void];
}

const useFullscreen: FunUseFullscreen = (el) => {
const useFullscreen: FunUseFullscreen = el => {
const [fullscreen, setFullscreen] = useState(false);
const handleFullScreenChange = () => {
// if exit fullscreen
Expand All @@ -18,7 +18,7 @@ const useFullscreen: FunUseFullscreen = (el) => {
.then(() => {
setFullscreen(true);
})
.catch((err) => {
.catch(err => {
console.error('requestFullscreen error: ', err);
});
}
Expand All @@ -30,7 +30,7 @@ const useFullscreen: FunUseFullscreen = (el) => {
.then(() => {
setFullscreen(false);
})
.catch((err) => {
.catch(err => {
console.error('exitFullscreen error: ', err);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface FunUseZoom {

const useZoom: FunUseZoom = (initZoom = 1) => {
const [zoom, setZoom] = useState(initZoom);
const handleZoom: FunHandleZoom = (isZoomIn) => {
const handleZoom: FunHandleZoom = isZoomIn => {
const newZoom = getNextZoom(zoom, isZoomIn, MIN_ZOOM, MAX_ZOOM);
setZoom(newZoom);
return newZoom;
Expand Down
4 changes: 2 additions & 2 deletions packages/graphin-studio/src/Components/Layout/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface LayoutProps {
children?: any;
className?: any;
children?: any;
className?: any;
}
8 changes: 4 additions & 4 deletions packages/graphin-studio/src/Components/SearchBar/interface.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export interface SearchValue {
[propName: string]: any; // eslint-disable-line
[propName: string]: any; // eslint-disable-line
}

export interface ContentProps {
searchWords: string;
item: SearchValue;
highlight: (searchWords: string, str: string) => string;
searchWords: string;
item: SearchValue;
highlight: (searchWords: string, str: string) => string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@ import { chain } from 'lodash';
import { CheckboxDataProps, CheckboxValueType } from '../interface';

interface GroupedItemsProps {
groups: Array<CheckboxDataProps>;
key: string;
groups: Array<CheckboxDataProps>;
key: string;
}

// 树节点的勾选状态
const getCheckedKeys = (data: Array<CheckboxDataProps>, checkedList: Array<CheckboxValueType>) => {
const checked: Array<string> = [];
const halfChecked: Array<string> = [];
const groupedItems = chain(data)
.groupBy((item: CheckboxDataProps) => item.key)
.map((groups: Array<CheckboxDataProps>, key: string) => {
return {
key,
groups,
};
})
.value();
const checked: Array<string> = [];
const halfChecked: Array<string> = [];
const groupedItems = chain(data)
.groupBy((item: CheckboxDataProps) => item.key)
.map((groups: Array<CheckboxDataProps>, key: string) => {
return {
key,
groups,
};
})
.value();

groupedItems.forEach((item: GroupedItemsProps) => {
const { groups } = item;
const filterItems = groups.filter((e) => checkedList.includes(e.value));
groupedItems.forEach((item: GroupedItemsProps) => {
const { groups } = item;
const filterItems = groups.filter(e => checkedList.includes(e.value));

if (groups.length === filterItems.length) {
checked.push(item.key);
}
if (groups.length === filterItems.length) {
checked.push(item.key);
}

if (filterItems.length && groups.length > filterItems.length) {
halfChecked.push(item.key);
}
});
if (filterItems.length && groups.length > filterItems.length) {
halfChecked.push(item.key);
}
});

return {
checked,
halfChecked,
};
return {
checked,
halfChecked,
};
};
export default getCheckedKeys;
12 changes: 6 additions & 6 deletions packages/graphin-studio/src/Components/TreeSelector/interface.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export type CheckboxValueType = string | number | boolean;

export interface CheckboxDataProps {
key: string;
label: string;
value: string;
key: string;
label: string;
value: string;
}

export interface TreeDataProps {
title: string;
key: string;
children?: Array<TreeDataProps>;
title: string;
key: string;
children?: Array<TreeDataProps>;
}
24 changes: 12 additions & 12 deletions packages/graphin-studio/src/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import ToolBar from './ToolBar';
import TreeSelector from './TreeSelector';

export {
EnhancedCheckbox,
FoldingPanel,
Item,
Layout,
Side,
Header,
Main,
Footer,
Property,
SearchBar,
ToolBar,
TreeSelector,
EnhancedCheckbox,
FoldingPanel,
Item,
Layout,
Side,
Header,
Main,
Footer,
Property,
SearchBar,
ToolBar,
TreeSelector,
};
26 changes: 13 additions & 13 deletions packages/graphin-studio/src/Core/AddNodes/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ import { Graph } from '@antv/graphin';
import { GrapheneState, Dispatch } from '../../types';

export interface AddNodesProps {
state: GrapheneState;
dispatch?: Dispatch;
graph?: Graph;
[key: string]: any; // eslint-disable-line
state: GrapheneState;
dispatch?: Dispatch;
graph?: Graph;
[key: string]: any; // eslint-disable-line
}

export interface NormalState {
type?: string;
params?: string;
errormsg?: string;
type?: string;
params?: string;
errormsg?: string;
}

export interface NormalProps {
dispatch?: Dispatch;
graph?: Graph;
dispatch?: Dispatch;
graph?: Graph;
}

export interface RandomState {
mockType: string;
nodeCount: number;
options: string;
mockType: string;
nodeCount: number;
options: string;
}

export interface RandomProps {
dispatch?: Dispatch;
dispatch?: Dispatch;
}
16 changes: 8 additions & 8 deletions packages/graphin-studio/src/Core/DiffusePanel/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { GrapheneState } from '../../types';
export type CheckboxValueType = string | number | boolean;

export interface DiffusePanelProps {
apis?: object;
dispatch?: (props: { type: string; payload: object }) => any; // eslint-disable-line
state: GrapheneState;
graphVars?: { [propName: string]: any }; // eslint-disable-line
apis?: object;
dispatch?: (props: { type: string; payload: object }) => any; // eslint-disable-line
state: GrapheneState;
graphVars?: { [propName: string]: any }; // eslint-disable-line
}

export interface DiffusePanelState {
selectedNodeTypes: CheckboxValueType[];
selectedEdgeTypes: CheckboxValueType[];
selectedNodeTypes: CheckboxValueType[];
selectedEdgeTypes: CheckboxValueType[];
}

export interface TypeProps {
value: CheckboxValueType[];
onChange: (value: CheckboxValueType[]) => void;
value: CheckboxValueType[];
onChange: (value: CheckboxValueType[]) => void;
}
6 changes: 3 additions & 3 deletions packages/graphin-studio/src/Core/GraphDrawer/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Graph } from '@antv/graphin';
import { GrapheneState, Dispatch } from '../../types';

export interface GraphDrawerProps {
dispatch: Dispatch;
state: GrapheneState;
graph?: Graph;
dispatch: Dispatch;
state: GrapheneState;
graph?: Graph;
}
14 changes: 7 additions & 7 deletions packages/graphin-studio/src/Core/Setting/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { Graph } from '@antv/graphin';
import { GrapheneState, Dispatch } from '../../types';

export interface SettingProps {
state: GrapheneState;
dispatch: Dispatch;
graph?: Graph;
state: GrapheneState;
dispatch: Dispatch;
graph?: Graph;
}

export interface ThemeProps {
dispatch: Dispatch;
state: GrapheneState;
dispatch: Dispatch;
state: GrapheneState;
}

export interface ToolbarConfigProps {
dispatch: Dispatch;
state: GrapheneState;
dispatch: Dispatch;
state: GrapheneState;
}
22 changes: 11 additions & 11 deletions packages/graphin-studio/src/Core/Styling/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { Graph } from '@antv/graphin';
import { GrapheneState, Dispatch } from '../../types';

export interface StylingProps {
dispatch?: Dispatch;
state?: GrapheneState;
graph?: Graph;
dispatch?: Dispatch;
state?: GrapheneState;
graph?: Graph;
}

export interface ColorProps {
hex: string;
hex: string;
}

export interface ColorSpanProps {
color: string;
isOpen?: boolean;
onClick: () => void;
color: string;
isOpen?: boolean;
onClick: () => void;
}

export interface ColorPickerProps {
type: string;
name: string;
defaultColor: string;
onChange: (type: string, color: string) => void;
type: string;
name: string;
defaultColor: string;
onChange: (type: string, color: string) => void;
}
Loading

0 comments on commit 509a3ef

Please sign in to comment.