@steedos/steedos-plugin-schema-builder 2.6.1-beta.6 → 2.6.2-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +3 -34
  2. package/package.json +4 -4
  3. package/package.service.js +7 -5
  4. package/package.service.yml +3 -0
  5. package/public/schema-builder/index.html +1 -1
  6. package/src/objects.object.yml +1 -1
  7. package/.scripts/npm-postinstall.js +0 -35
  8. package/.vscode/extensions.json +0 -5
  9. package/.vscode/settings.json +0 -10
  10. package/nodemon.json +0 -13
  11. package/plugin.config.yml +0 -4
  12. package/steedos-config.yml +0 -31
  13. package/webapp/index.html +0 -0
  14. package/webapp/package.json +0 -53
  15. package/webapp/src/g6/behavior/activate-relations/index.tsx +0 -160
  16. package/webapp/src/g6/behavior/darg/index.tsx +0 -146
  17. package/webapp/src/g6/behavior/index.tsx +0 -5
  18. package/webapp/src/g6/model/editor-background.png +0 -0
  19. package/webapp/src/g6/model/index.tsx +0 -574
  20. package/webapp/src/g6/model/model-node.tsx +0 -1080
  21. package/webapp/src/g6/model/model.scss +0 -163
  22. package/webapp/src/g6/model/toolbar.tsx +0 -360
  23. package/webapp/src/g6/shape/base-sharp/index.tsx +0 -19
  24. package/webapp/src/g6/shape/index.tsx +0 -0
  25. package/webapp/src/g6/util/graph.tsx +0 -60
  26. package/webapp/src/g6/util/hooks.tsx +0 -26
  27. package/webapp/src/g6/util/index.tsx +0 -20
  28. package/webapp/src/hook/index.tsx +0 -47
  29. package/webapp/src/index.tsx +0 -25
  30. package/webapp/src/page/dva-model/index.tsx +0 -70
  31. package/webapp/src/page/dva-model/reducer/arrange.tsx +0 -16
  32. package/webapp/src/page/dva-model/reducer/index.tsx +0 -7
  33. package/webapp/src/page/dva-model/reducer/init.tsx +0 -61
  34. package/webapp/src/page/dva-model/reducer/model.tsx +0 -126
  35. package/webapp/src/page/dva-model/reducer/on-expand.tsx +0 -27
  36. package/webapp/src/page/dva-model/style.tsx +0 -88
  37. package/webapp/src/page/hooks/callback.tsx +0 -54
  38. package/webapp/src/page/hooks/fullscreen.tsx +0 -34
  39. package/webapp/src/page/hooks/pagehooks.tsx +0 -127
  40. package/webapp/src/page/hooks/resize.tsx +0 -20
  41. package/webapp/src/page/index.tsx +0 -393
  42. package/webapp/src/page/model-navi/index.tsx +0 -329
  43. package/webapp/src/page/model-navi/style.scss +0 -111
  44. package/webapp/src/page/util/index.tsx +0 -234
  45. package/webapp/src/page/util/layout-nodes/index.tsx +0 -185
  46. package/webapp/src/pdm/index.tsx +0 -50
  47. package/webapp/src/pdm/pdm-json/index.js +0 -224
  48. package/webapp/src/pdm/pdm-json/removeDiacritics.js +0 -96
  49. package/webapp/src/style.less +0 -14
  50. package/webapp/src/tree/index.tsx +0 -46
  51. package/webapp/src/tree/style.scss +0 -26
  52. package/webapp/src/type/field.tsx +0 -10
  53. package/webapp/src/type/index.tsx +0 -3
  54. package/webapp/src/type/model.tsx +0 -12
  55. package/webapp/src/type/module.tsx +0 -4
  56. package/webapp/webconfig.config.js +0 -57
@@ -1,163 +0,0 @@
1
- .noselect {
2
-
3
- -webkit-touch-callout: none; /* iOS Safari */
4
-
5
- -webkit-user-select: none; /* Chrome/Safari/Opera */
6
-
7
- -khtml-user-select: none; /* Konqueror */
8
-
9
- -moz-user-select: none; /* Firefox */
10
-
11
- -ms-user-select: none; /* Internet Explorer/Edge */
12
-
13
- user-select: none; /* Non-prefixed version, currently
14
-
15
- not supported by any browser */
16
-
17
- }
18
-
19
- .console-g6-page {
20
- // background: #fff;
21
- height: 100%;
22
- .model-page {
23
- height: 100%;
24
- display: flex;
25
- flex-direction: column;
26
- }
27
- .g6-tooltip {
28
- padding: 10px 6px;
29
- // color: black;
30
- background-color: white;
31
- box-shadow: 10px 10px 5px #888888;
32
- // background-color: rgba(255, 255, 255, 0.9);
33
- border: 1px solid rgb(11,108,149);
34
- opacity: 1;
35
- border-radius: 4px;
36
- .text {
37
- color: rgb(11,108,149);
38
- }
39
- }
40
- }
41
-
42
-
43
-
44
- .g6-minimap {
45
- position: absolute;
46
- right: 25px;
47
- bottom: 40px;
48
- padding: 5px;
49
- overflow: visible !important;
50
- // margin-top: 10px;
51
- // margin-right: 10px;
52
- background: #FFFFFF;
53
- border: 0px solid rgba(0,0,0,0.10);
54
-
55
- // border-radius: 3px 0 0 3px;
56
- // border-radius: 3px 0px 0px 3px;
57
- }
58
-
59
- .graph {
60
- width: 100%;
61
- cursor: grab;
62
- margin-right: 20px;
63
- margin-bottom: 23px;
64
- flex: 1;
65
- // overflow: auto;
66
- background-image: url(./editor-background.png);
67
- background-repeat: repeat;
68
- background-size: contain;
69
- // border: 1px solid rgba(0,0,0,.1);
70
- // border-radius: 3px;
71
- border: 1px solid rgba(0, 0, 0, 0.1);
72
-
73
- // background-image: linear-gradient(#DEE0E4 1px, transparent 0), linear-gradient(90deg, #DEE0E4 1px, transparent 0), linear-gradient(rgba(222, 224, 228, 0.6) 1px, transparent 0), linear-gradient(90deg, rgba(222, 224, 228, 0.6) 1px, transparent 0);
74
- // background-size: 75px 75px, 75px 75px, 15px 15px, 15px 15px;
75
- }
76
-
77
- .g6-minimap-viewport-erd {
78
- border: 1px solid rgba(0,0,0,0.06);
79
- margin-top: 2px;
80
- margin-right: 2px;
81
- }
82
-
83
- .console-erd-toolbar {
84
- z-index:1;
85
- width: 100%;
86
- // border-bottom: 1px solid rgba(0, 0, 0, 0.1);
87
- // border-left: 1px solid rgba(0, 0, 0, 0.1);
88
- height: 28px;
89
-
90
- .split-span {
91
- margin-right: 30px;
92
- }
93
-
94
- .left {
95
- float: left ;
96
- margin-left: 30px;
97
- }
98
-
99
- .ant-upload-list {
100
- display: none;
101
- }
102
-
103
-
104
- .zoomNum {
105
- font-size: 17px;
106
- text-align: center;
107
- margin-right: 10px;
108
- width: 50px;
109
- color: rgba(0,0,0,0.40);
110
- display: inline-block;
111
-
112
- }
113
-
114
- .right {
115
- float: right ;
116
- margin-right: 30px;
117
- }
118
-
119
-
120
- .command-btn {
121
-
122
- margin: 8px;
123
- font-size: 18px;
124
- // margin-right: 25px;
125
- color: rgba(0,0,0,0.40);
126
- cursor: pointer;
127
- }
128
- .zoomleft {
129
- margin-right: 10px;
130
- }
131
-
132
- .command-btn-data {
133
- }
134
- }
135
- .console-erd-fps {
136
- position:absolute;
137
- bottom: 50px;
138
- right: 0px;
139
- // bottom: 150px;
140
- }
141
-
142
- // .g6-tooltip {
143
- // padding: 10px 6px;
144
- // opacity: 0.5;
145
- // color: #444;
146
- // background-color: rgba(255,255,255,0.9);
147
- // border: 1px solid #e2e2e2;
148
- // border-radius: 4px;
149
- // }
150
-
151
- :-webkit-full-screen {
152
- background-color: white !important;
153
- }
154
- :-moz-full-screen {
155
- background-color: white !important;
156
- }
157
-
158
- :-ms-fullscreen {
159
- background-color: white !important;
160
- }
161
- :fullscreen {
162
- background-color: white !important;
163
- }
@@ -1,360 +0,0 @@
1
-
2
- import { Button, Icon, Modal, Popover, Radio, Select, Switch, Tooltip } from 'antd'
3
- const RadioGroup = Radio.Group
4
- import { FileMarkdownOutlined, FileImageOutlined, UnlockOutlined, LockOutlined, ZoomOutOutlined, ZoomInOutlined, BorderOutlined, ArrowUpOutlined, ArrowDownOutlined, ArrowLeftOutlined, ArrowRightOutlined, RetweetOutlined } from '@ant-design/icons'
5
- import classNames from 'classnames'
6
- import { useDispatch, useSelector } from '../../hook'
7
- import React, { useCallback, useEffect, useRef, useState } from 'react' // import { exitFullscreen, launchIntoFullscreen } from './../util'
8
- import intl from './../util/intel'
9
- import Pdm from '../../pdm'
10
-
11
-
12
- const confirm = Modal.confirm
13
- const { Option } = Select
14
- const zoomInClick = ({ toolBarCommand, update}) => { toolBarCommand && toolBarCommand('max-zoom'); update(+new Date())}
15
- const zoomOutClick = ({toolBarCommand, update}) => { toolBarCommand && toolBarCommand('min-zoom'); update(+new Date()) }
16
-
17
-
18
- const IconRenders = {
19
- 'container' : <BorderOutlined />,
20
- 'arrow-up': <ArrowUpOutlined />,
21
- 'arrow-down': <ArrowDownOutlined />,
22
- 'arrow-left': <ArrowLeftOutlined />,
23
- 'arrow-right': <ArrowRightOutlined />,
24
- 'retweet': <RetweetOutlined />,
25
- 'pdm' : <FileMarkdownOutlined />,
26
- 'lock': <LockOutlined />,
27
- 'unlock': <UnlockOutlined />,
28
- 'image':<FileImageOutlined />,
29
- 'upload':<FileImageOutlined />
30
-
31
- }
32
-
33
-
34
- const changeTwoDecimal_f = (x) => {
35
-   let f_x = parseFloat(x)
36
-   if (isNaN(f_x)) {
37
-     return 0
38
-   }
39
- f_x = Math.round(x * 100) / 100
40
-   let s_x = f_x.toString()
41
-   let pos_decimal = s_x.indexOf('.')
42
-   if (pos_decimal < 0) {
43
-     pos_decimal = s_x.length
44
-    s_x += '.'
45
-   }
46
-   while (s_x.length <= pos_decimal + 2) {
47
-     s_x += '0'
48
-   }
49
- if(s_x >= 100) return 100
50
-   return s_x
51
- }
52
- const BaseCommandList: any[] = [
53
- // {/ / title: '1:1',
54
- // k e y: '1to1',,
55
- // icon: 'column',
56
- // click: (toolBarCommand, graph, update) => {
57
- // const width = graph.get('width')
58
- // const height = graph.get('height')
59
- // graph.zoomTo(1, {
60
- // x: width / 2,
61
- // y: height / 2,
62
- // })
63
- // graph.paint()
64
- // const zoom = graph.getZoom()
65
- // graph.findAll('node', (node) => true).map((node) => {
66
- // graph.updateItem(node, {
67
- // isKeySharp: zoom < 0.4,
68
- // })
69
- // })
70
- // update(+new Date())
71
- // },
72
- // },
73
- // {
74
- // title: intl.get('锁定最小比例').d('锁定最小比例'),
75
- // key: 'lock-min',
76
- // icon: 'lock',
77
- // render: () => {
78
- // return <LockOutlined />
79
- // },
80
- // click: ()=>{}
81
- // },
82
-
83
- // {
84
- // title: intl.get('导入pdm文件').d('导入pdm文件'),
85
- // key: 'pdm',
86
- // icon: 'pdm',
87
- // render: () => {
88
- // return <Pdm><FileMarkdownOutlined /></Pdm>
89
- // },
90
- // click: ()=>{}
91
- // },
92
-
93
- {
94
- title: intl.get('全景').d('全景'),
95
- key: 'full',
96
- icon: 'container',
97
- click: (toolBarCommand, graph, update) => {
98
-
99
- graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
100
- node.getContainer().show()
101
- })
102
- graph.fitView(0)
103
- // setImmediate(() => {
104
- // alert()
105
- // graph.fitView(0)
106
- // graph.paint()
107
- // }, 2000)
108
- // graph.paint()
109
- const zoom = graph.getZoom()
110
- graph.findAll('node', (node) => true).map((node) => {
111
- graph.updateItem(node, {
112
- isKeySharp: zoom < 0.4,
113
- isCardSharp: zoom <= 0.1,
114
- })
115
- })
116
-
117
- // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: true})
118
- update(+new Date())
119
- },
120
- },
121
- // {
122
- // title: intl.get('上').d('上'),
123
- // key: 'up',
124
- // icon: 'arrow-up',
125
- // click: (_, graph) => {
126
- // graph.translate(0, -100)
127
- // graph.paint()
128
- // },
129
- // }, {
130
- // title: intl.get('下').d('下'),
131
- // key: 'down',
132
- // icon: 'arrow-down',
133
- // click: (_, graph) => {
134
- // graph.translate(0, 100)
135
- // graph.paint()
136
- // },
137
- // }, {
138
- // title: intl.get('左').d('左'),
139
- // key: 'left',
140
- // icon: 'arrow-left',
141
- // click: (_, graph) => {
142
- // graph.translate(-100, 0)
143
- // graph.paint()
144
- // },
145
- // }, {
146
- // title: intl.get('右').d('右'),
147
- // key: 'right',
148
- // icon: 'arrow-right',
149
- // click: (_, graph) => {
150
- // graph.translate(100, 0)
151
- // graph.paint()
152
- // },
153
- // },
154
- {
155
- title: intl.get('导出图片').d('导出图片'),
156
- key: 'export-image',
157
- icon: 'image',
158
- click: (toolBarCommand) => {
159
- toolBarCommand && toolBarCommand('export-image')
160
- },
161
- },
162
-
163
-
164
- // {
165
- // title: intl.get('保存位置').d('保存位置'),
166
- // key: 'save-position',
167
- // icon: 'upload',
168
- // click: (toolBarCommand) => {
169
- // toolBarCommand && toolBarCommand('upload')
170
- // },
171
- // },
172
-
173
- // {
174
- // title: intl.get('重新排列').d('重新排列'),
175
- // key: 'resetLayout',
176
- // icon: 'retweet',
177
- // click: (toolBarCommand) => {
178
- // confirm({
179
- // title: '重新排列',
180
- // content: '重新排列后,模型的位置重新排列 ?',
181
- // onOk() {
182
- // toolBarCommand && toolBarCommand('resetLayout') // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: false})
183
- // },
184
- // onCancel() {
185
- // console.log('Cancel')
186
- // },
187
- // })
188
-
189
- // },
190
-
191
- // },
192
-
193
- // {
194
- // title: intl.get('上一步').d('上一步'),
195
- // key: 'last',
196
- // icon: 'back',
197
- // click: (toolBarCommand) => {
198
- // alert('目前不可用')
199
- // // toolBarCommand && toolBarCommand('resetLayout')
200
- // // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: false})
201
- // },
202
-
203
- // },
204
- // {
205
- // title: intl.get('下一步').d('下一步'),
206
- // key: 'next',
207
- // icon: 'forward',
208
- // click: (toolBarCommand) => {
209
- // alert('目前不可用')
210
- // // toolBarCommand && toolBarCommand('resetLayout')
211
- // // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: false})
212
- // },
213
-
214
- // },
215
- // {
216
- // title: intl.get('新增模型').d('新增模型'),
217
- // icon: 'plus',
218
- // click: (toolBarCommand) => {
219
- // toolBarCommand && toolBarCommand('insertModel')
220
- // },
221
- // }
222
- ]
223
- const DataCommandList = [
224
- {
225
- title: intl.get('保存').d('保存'),
226
- icon: 'sort',
227
- click: (toolBarCommand) => {
228
- toolBarCommand && toolBarCommand('save') // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: false})
229
- },
230
- },
231
- {
232
- title: intl.get('编辑模型').d('编辑模型'),
233
- icon: 'edit',
234
- data: true,
235
- click: (toolBarCommand) => {
236
- toolBarCommand && toolBarCommand('editModel')
237
- },
238
- }, {
239
- title: intl.get('模型中心').d('模型中心'),
240
- icon: 'monitor',
241
- data: true,
242
- click: (toolBarCommand) => {
243
- toolBarCommand && toolBarCommand('centerModel') // toolBarCommand && toolBarCommand('keySharp', { isKeysharp: false})
244
- },
245
- }]
246
- export default (({
247
- graph,
248
- zoom,
249
- toolBarCommand,
250
- currentModel,
251
- saveFun,
252
- toolBarCommands,
253
- namespace,
254
- setUpdateId,
255
- }) => {
256
- const [_, update] = useState(null)
257
- // tslint:disable-next-line: radix
258
- const zoomNum = graph && changeTwoDecimal_f(parseFloat(graph.getZoom() * 100 / 2) + '') || 0
259
- const dispatch = useDispatch()
260
-
261
- const { isArrangeLayout, lockMinZoom } = useSelector((s) => s[namespace])
262
- const arrangeLayout = useCallback(() => {
263
- dispatch({
264
- type: `${namespace}/setArrangeLayout`,
265
- isArrangeLayout: !isArrangeLayout,
266
- })
267
- }, [isArrangeLayout])
268
-
269
- const zoomChange = useCallback((e) => {
270
- const newZoom = e.target.value
271
- graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
272
- node.getContainer().show()
273
- })
274
- const gwidth = graph.get('width')
275
- const gheight = graph.get('height')
276
- const point = graph.getCanvasByPoint(gwidth / 2, gheight / 2)
277
- // graph.moveTo({x: point.x , y : point.y})
278
- graph.zoomTo(newZoom / 100, {x: point.x , y : point.y})
279
- graph.paint()
280
- setUpdateId(+new Date())
281
- update(+new Date())
282
- // graph.zoomTo(newZoom / 100)
283
- // alert(newZoom)
284
-
285
- } , [graph])
286
-
287
- const lockMinZoomSwitch = useCallback(()=>{
288
-
289
- dispatch({
290
- type: `${namespace}/lockMinZoom`,
291
- lockMinZoom: !lockMinZoom,
292
- })
293
-
294
- }, [lockMinZoom])
295
-
296
- // alert(graph && graph.getZoom())
297
- return (
298
- <div className='console-erd-toolbar'>
299
- <div className='right'>
300
- {/* <Tooltip title={!isArrangeLayout ? intl.get('模型字段关联').d('模型字段关联') : intl.get('聚合关联').d('聚合关联') } >
301
- <span className='command-btn zoomleft' >
302
- <Switch checkedChildren='聚合' unCheckedChildren='字段' size='small' onChange={arrangeLayout} checked={isArrangeLayout} />
303
- </span>
304
- </Tooltip> */}
305
- <Tooltip title={!lockMinZoom ? intl.get('锁定最小比例').d('锁定最小比例') : intl.get('放开最小比例').d('放开最小比例') } >
306
- <span className='command-btn zoomleft' onClick={lockMinZoomSwitch} >
307
- { !!lockMinZoom ? <LockOutlined /> : <UnlockOutlined /> }
308
- </span>
309
- </Tooltip>
310
- <Tooltip title={intl.get('放大').d('放大')} ><span className='command-btn zoomleft' onClick={zoomInClick.bind(this, { toolBarCommand, graph, update })} ><ZoomInOutlined /></span></Tooltip>
311
- <span className='zoomNum noselect'>
312
- {/* <Popover footer={false} content={<RadioGroup value={zoomNum * 2} onChange={zoomChange} >
313
- <Radio value={200}>100%</Radio>
314
- <Radio value={100}>50%</Radio>
315
- <Radio value={20}>10%</Radio>
316
- </RadioGroup>} placement='bottom' > */}
317
- {graph && `${(zoomNum * 2) >= 100 ? 100 :(zoomNum * 2) }%` }
318
- {/* </Popover> */}
319
- </span>
320
- <Tooltip title={intl.get('缩小').d('缩小')} ><span className='command-btn' onClick={zoomOutClick.bind(this, { toolBarCommand, graph, update })}><ZoomOutOutlined /></span></Tooltip>
321
-
322
- {
323
- BaseCommandList.filter((c) => !c.data || currentModel).filter((c) => c.title !== intl.get('保存').d('保存') || saveFun).map((command) => {
324
- return (
325
- <RenderPopConfirm title={command.title} isConfirm={command.isConfirm} key={command.key} btnRender={<Tooltip title={command.title} ><span className={classNames(['command-btn', {
326
- 'command-btn-data': !!command.data,
327
- }])} onClick={command.click.bind(this, toolBarCommand, graph, update)}>{command.render ? command.render() : IconRenders[command.icon]}</span></Tooltip>} />)
328
- })
329
- }
330
-
331
- </div>
332
- <div className='right'>
333
- {/* {
334
- DataCommandList.concat(toolBarCommands ? toolBarCommands : []).filter((c) => !c.data || currentModel).filter((c) => c.title !== intl.get('保存').d('保存') || saveFun).map((command) => {
335
- return (
336
- <RenderPopConfirm click={command.click.bind(this, toolBarCommand, graph, update)} title={command.title} isConfirm={command.isConfirm} key={command.key} btnRender={<Tooltip title={command.title} ><Button type='text' icon={command.icon} className={classNames(['command-btn', {
337
- 'command-btn-data': !!command.data,
338
- }])} onClick={!command.isConfirm && command.click.bind(this, toolBarCommand, graph, update)}/></Tooltip>} />)
339
- })
340
- } */}
341
- </div>
342
- </div>)
343
- })
344
-
345
- const toNumString = (str) => {
346
-
347
- }
348
-
349
- const RenderPopConfirm = ({isConfirm = false , btnRender, title, click}) => {
350
- if (isConfirm) {
351
- return (<Popover title={$$(`确定是否${title}?`)} okText={$$('是')} cancelText={$$('否')} onOk={click}>
352
- {btnRender}
353
- </Popover>
354
- )
355
- } else {
356
- return btnRender
357
- }
358
- }
359
-
360
- const $$ = (txt) => intl.get(txt).d(txt)
@@ -1,19 +0,0 @@
1
- export class BaseDrawer {
2
- public constructor(protected vm: BaseSharp) {}
3
-
4
- public render(group) {
5
- group.addShape('rect', {
6
- attrs: {
7
- vm: this.vm
8
- }
9
- });
10
- }
11
-
12
- } // tslint:disable-next-line: max-classes-per-file
13
-
14
- export class BaseSharp {
15
- public for;
16
-
17
- public constructor(protected attrs: any) {}
18
-
19
- }
File without changes
@@ -1,60 +0,0 @@
1
-
2
- export const toCenter = (item, graph) => {
3
- if (!item) return
4
-
5
- graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
6
- node.getContainer().show()
7
- })
8
-
9
- graph.zoomTo(1)
10
- graph.focusItem(item)
11
- // 聚焦当前点击的节点(把节点放到视口中心)
12
- let matrix = item.get('group').getMatrix()
13
- let point = {
14
- x: matrix[6],
15
- y: matrix[7],
16
- }
17
- let width = graph.get('width')
18
- let height = graph.get('height') // 找到视口中心
19
- // const itemHeight = item.getKeyShape().height
20
- // // if(height < itemHeight) {
21
-
22
- // // }
23
- // let viewCenter = {
24
- // x: width / 2,
25
- // y: height / 2,
26
- // }
27
- // let modelCenter = graph.getPointByCanvas(viewCenter.x, viewCenter.y)
28
- // let viewportMatrix = graph.get('group').getMatrix() // 画布平移的目标位置,最终目标是graph.translate(dx, dy);
29
- // // const pointY = height < itemHeight ? (point.y - (height - itemHeight) / 2) : point.y
30
- // // const pointY = (point.y - (itemHeight - height) / 2)
31
- // const pointY = point.y
32
- // let dx = (modelCenter.x - point.x) * viewportMatrix[0]
33
- // let dy = (modelCenter.y - pointY) * viewportMatrix[4]
34
- // // let lastX = 0
35
- // // let lastY = 0
36
- // // let newX = void 0
37
- // // let newY = void 0 // 动画每次平移一点,直到目标位置
38
- // // graph.get('canvas').animate({
39
- // // onFrame: function onFrame(ratio) {
40
- // // newX = dx * ratio
41
- // // newY = dy * ratio
42
- // // graph.translate(newX - lastX, newY - lastY)
43
- // // lastX = newX
44
- // // lastY = newY
45
- // // },
46
- // // }, 300, 'easeCubic')
47
- const itemHight = item.getKeyShape().attr('height')
48
- // alert(itemHight)
49
- const graphHeight = height / 2
50
-
51
- graph.translate(0, (- graphHeight + itemHight / 2 + 120))
52
-
53
- // graph.translate(0, (- height / 2) + (item.getKeyShape().height / 2))
54
-
55
- // graph.paint()
56
-
57
- // graph.paint()
58
- // // graph.layout()
59
- // setTimeout(() => { graph.zoomTo(1) ; graph.paint() }, 2000)
60
- }
@@ -1,26 +0,0 @@
1
- import Immer from 'immer';
2
- import { useCallback, useReducer } from 'react';
3
-
4
- const _createReducer = command => {
5
- return (state, {
6
- type,
7
- ...data
8
- }) => {
9
- const immer = Immer(state, s => {
10
- if (command[type]) {
11
- command[type](state, {
12
- type,
13
- ...data
14
- });
15
- }
16
- });
17
- return immer;
18
- };
19
- };
20
-
21
- export const useImmerReducer = (commands, stateInit) => {
22
- const createReducerCallback = useCallback(() => {
23
- return _createReducer(commands);
24
- }, [commands]);
25
- return useReducer(createReducerCallback, stateInit);
26
- };
@@ -1,20 +0,0 @@
1
- export function launchIntoFullscreen(element) {
2
- if (element.requestFullscreen) {
3
- element.requestFullscreen();
4
- } else if (element.mozRequestFullScreen) {
5
- element.mozRequestFullScreen();
6
- } else if (element.webkitRequestFullscreen) {
7
- element.webkitRequestFullscreen();
8
- } else if (element.msRequestFullscreen) {
9
- element.msRequestFullscreen();
10
- }
11
- }
12
- export function exitFullscreen() {
13
- if (document.exitFullscreen) {
14
- document.exitFullscreen();
15
- } else if (document.mozCancelFullScreen) {
16
- document.mozCancelFullScreen();
17
- } else if (document.webkitExitFullscreen) {
18
- document.webkitExitFullscreen();
19
- }
20
- }
@@ -1,47 +0,0 @@
1
- import React, { useReducer, useMemo } from 'react'
2
- import ReactDom from 'react-dom'
3
- import { createContainer } from "unstated-next"
4
- import DvaModel from '../page/dva-model'
5
-
6
-
7
- const dvaModel = DvaModel({namespace: 'erd'})
8
-
9
- const reduce = (state, action) => {
10
- const actiontype = action.type.substring(action.type.indexOf('/') + 1, action.type.length)
11
- const reduce = dvaModel.reducers[actiontype]
12
- if(reduce) {
13
- return { erd : reduce(state.erd, action ) }
14
- }
15
- return state
16
- }
17
-
18
- const dvaState = { 'erd' : dvaModel.state }
19
-
20
- const usePageModel = () => {
21
-
22
- const [state, dispath] = useReducer(reduce, dvaState)
23
- return {
24
- state , dispath
25
- }
26
-
27
- }
28
-
29
- export const PageModel = createContainer(usePageModel)
30
-
31
- export const useDispatch = () => {
32
- const { dispath } = PageModel.useContainer()
33
- return dispath
34
- }
35
-
36
- export const useSelector = (selector) => {
37
- const { state } = PageModel.useContainer()
38
- const resultState = useMemo(()=> (selector ? selector(state) : state) , [selector , state])
39
- return resultState
40
- }
41
-
42
-
43
- //useDispatch, useSelector
44
-
45
-
46
-
47
-