Skip to content

Commit 236d341

Browse files
committed
chore: update the demo
1 parent 5257806 commit 236d341

File tree

12 files changed

+19076
-14
lines changed

12 files changed

+19076
-14
lines changed

.eslintignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
dist
2-
lib
3-
es
1+
/dist
2+
/lib
3+
/es
4+
5+
/examples/**/dist
6+
/node_modules

.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
dist
2-
lib
3-
es
1+
/dist
2+
/lib
3+
/es
44

5-
node_modules
5+
/node_modules
66
.eslintcache

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/examples/**/dist

examples/flow/dist/bundle.js

+9,481
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/flow/src/index.less

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:global {
2+
#root {
3+
display: flex;
4+
width: 100%;
5+
height: 100%;
6+
overflow: hidden;
7+
}
8+
}
9+
10+
.editor {
11+
display: flex;
12+
flex: 1;
13+
14+
&-bd {
15+
flex: 1;
16+
}
17+
}

examples/flow/src/index.tsx

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3+
import GGEditor, { Flow } from '../../../lib';
4+
import styles from './index.less';
35

4-
ReactDOM.render(<div />, document.getElementById('root'));
6+
const data = {
7+
nodes: [
8+
{
9+
id: '0',
10+
label: '起止节点',
11+
x: 55,
12+
y: 55,
13+
},
14+
{
15+
id: '1',
16+
label: '结束节点',
17+
x: 55,
18+
y: 255,
19+
},
20+
],
21+
edges: [
22+
{
23+
source: '0',
24+
target: '1',
25+
startPoint: {
26+
x: 1,
27+
y: 1,
28+
},
29+
endPoint: {
30+
x: 2,
31+
y: 3,
32+
},
33+
},
34+
],
35+
};
36+
37+
class Index extends React.Component {
38+
render() {
39+
return (
40+
<GGEditor className={styles.editor}>
41+
<Flow className={styles.editorBd} data={data} />
42+
</GGEditor>
43+
);
44+
}
45+
}
46+
47+
ReactDOM.render(<Index />, document.getElementById('root'));

examples/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module '*.less';

examples/mind/dist/bundle.js

+9,465
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/mind/src/index.less

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:global {
2+
#root {
3+
display: flex;
4+
width: 100%;
5+
height: 100%;
6+
overflow: hidden;
7+
}
8+
}
9+
10+
.editor {
11+
display: flex;
12+
flex: 1;
13+
14+
&-bd {
15+
flex: 1;
16+
}
17+
}

examples/mind/src/index.tsx

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3+
import GGEditor, { Mind } from '../../../lib';
4+
import styles from './index.less';
35

4-
ReactDOM.render(<div />, document.getElementById('root'));
6+
const data = {
7+
label: '中心主题',
8+
children: [
9+
{
10+
label: '分支主题 1',
11+
},
12+
{
13+
label: '分支主题 2',
14+
},
15+
{
16+
label: '分支主题 3',
17+
},
18+
],
19+
};
20+
21+
class Index extends React.Component {
22+
render() {
23+
return (
24+
<GGEditor className={styles.editor}>
25+
<Mind className={styles.editorBd} data={data} />
26+
</GGEditor>
27+
);
28+
}
29+
}
30+
31+
ReactDOM.render(<Index />, document.getElementById('root'));

examples/tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"allowSyntheticDefaultImports": true,
4+
"module": "esnext",
5+
"moduleResolution": "node",
6+
"target": "esnext",
7+
"jsx": "react",
8+
"noImplicitThis": true
9+
}
10+
}

scripts/rollup/start.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function start(example) {
2929
format: 'umd',
3030
globals: {
3131
react: 'React',
32+
'react-dom': 'ReactDOM',
3233
},
3334
},
3435
plugins: [
@@ -41,11 +42,7 @@ function start(example) {
4142
resolve(),
4243
commonjs(),
4344
typescript({
44-
tsconfigOverride: {
45-
compilerOptions: {
46-
declaration: false,
47-
},
48-
},
45+
tsconfig: 'examples/tsconfig.json',
4946
}),
5047
babel(),
5148
serve({

0 commit comments

Comments
 (0)