@steedos/steedos-plugin-schema-builder 2.2.51-beta.1 → 2.2.51-beta.2

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 (54) hide show
  1. package/package.json +2 -2
  2. package/src/objects.action.js +0 -5
  3. package/src/objects.object.yml +0 -6
  4. package/webapp/src/custom.d.ts +0 -33
  5. package/webapp/src/g6/behavior/activate-relations/index.tsx +0 -160
  6. package/webapp/src/g6/behavior/darg/index.tsx +0 -146
  7. package/webapp/src/g6/behavior/index.tsx +0 -5
  8. package/webapp/src/g6/model/editor-background.png +0 -0
  9. package/webapp/src/g6/model/index.tsx +0 -574
  10. package/webapp/src/g6/model/model-node.tsx +0 -1080
  11. package/webapp/src/g6/model/model.scss +0 -163
  12. package/webapp/src/g6/model/toolbar.tsx +0 -360
  13. package/webapp/src/g6/shape/base-sharp/index.tsx +0 -19
  14. package/webapp/src/g6/shape/index.tsx +0 -0
  15. package/webapp/src/g6/util/graph.tsx +0 -60
  16. package/webapp/src/g6/util/hooks.tsx +0 -26
  17. package/webapp/src/g6/util/index.tsx +0 -20
  18. package/webapp/src/g6/util/intel.ts +0 -7
  19. package/webapp/src/hook/index.tsx +0 -47
  20. package/webapp/src/index.tsx +0 -25
  21. package/webapp/src/page/dva-model/index.tsx +0 -70
  22. package/webapp/src/page/dva-model/reducer/arrange.tsx +0 -16
  23. package/webapp/src/page/dva-model/reducer/index.tsx +0 -7
  24. package/webapp/src/page/dva-model/reducer/init.tsx +0 -61
  25. package/webapp/src/page/dva-model/reducer/model.tsx +0 -126
  26. package/webapp/src/page/dva-model/reducer/on-expand.tsx +0 -27
  27. package/webapp/src/page/dva-model/style.tsx +0 -88
  28. package/webapp/src/page/hooks/callback.tsx +0 -54
  29. package/webapp/src/page/hooks/fullscreen.tsx +0 -34
  30. package/webapp/src/page/hooks/pagehooks.tsx +0 -127
  31. package/webapp/src/page/hooks/resize.tsx +0 -20
  32. package/webapp/src/page/index.tsx +0 -393
  33. package/webapp/src/page/model-navi/index.tsx +0 -329
  34. package/webapp/src/page/model-navi/style.scss +0 -111
  35. package/webapp/src/page/util/index.tsx +0 -234
  36. package/webapp/src/page/util/layout-nodes/index.tsx +0 -185
  37. package/webapp/src/pdm/index.tsx +0 -50
  38. package/webapp/src/pdm/pdm-json/index.js +0 -224
  39. package/webapp/src/pdm/pdm-json/removeDiacritics.js +0 -96
  40. package/webapp/src/pdm/util.ts +0 -60
  41. package/webapp/src/style.less +0 -14
  42. package/webapp/src/tree/index.tsx +0 -46
  43. package/webapp/src/tree/style.scss +0 -26
  44. package/webapp/src/type/field.tsx +0 -10
  45. package/webapp/src/type/index.tsx +0 -3
  46. package/webapp/src/type/model.tsx +0 -12
  47. package/webapp/src/type/module.tsx +0 -4
  48. package/webapp/test/g6-test/mock/model-test.ts +0 -3620
  49. package/webapp/test/g6-test/mock/module-test.ts +0 -14
  50. package/webapp/test/g6-test/mock/steedos-test.ts +0 -86
  51. package/webapp/test/index.tsx +0 -66
  52. package/webapp/test/testg6.tsx +0 -126
  53. package/webapp/test/unstated/index.tsx +0 -19
  54. package/webapp/tsconfig.json +0 -27
@@ -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
-
@@ -1,25 +0,0 @@
1
- import React from 'react'
2
- import WebPdmPage from './page'
3
- import Pdm from './pdm'
4
- import { Tree } from './tree'
5
- export * from './type'
6
- import DvaModel from './page/dva-model'
7
- import { ErdPage } from './g6/model'
8
- import './style.less'
9
-
10
- export {
11
- DvaModel,
12
- ErdPage
13
- }
14
-
15
- const useAppContext = () => ({
16
- tabsRouteContext: {
17
- current: '/',
18
- },
19
- shellContext: {
20
- setState: () => ({}),
21
- },
22
- })
23
- export default (props) => {
24
- return <WebPdmPage ErdPage={ErdPage} Pdm={Pdm} Tree={Tree} useAppContext={useAppContext} {...props} />
25
- }
@@ -1,70 +0,0 @@
1
-
2
- import { arrangeShow, init, load , modelEdit, modelReducers, onExpand } from './reducer'
3
- import { initStyle } from './style'
4
- export interface IDict<T> {
5
- [name: string]: T
6
- }
7
-
8
- const fieldMap = (m) => ({
9
- key: m.key,
10
- name: m.name,
11
- moduleKey: m.moduleKey,
12
- fields: Object.entries(m.fields).map(([k, v]: [string, any]) => ({
13
- type: v.type,
14
- key: v.key,
15
- name: v.name,
16
- originalKey: v.originalKey,
17
- required: v.required,
18
-
19
- typeMeta: v.typeMeta && {
20
- type: v.typeMeta.type,
21
- relationModel: v.typeMeta.relationModel,
22
- },
23
- })),
24
- originalKey: m.originalKey,
25
- aggregateRoot: m.aggregateRoot,
26
- belongAggregate: m.belongAggregate,
27
- // aggregateRoot: m.aggregateRoot,
28
- aggregateModelKey: m.aggregateModelKey,
29
- type: m.type,
30
- })
31
-
32
- export default (({
33
- namespace,
34
- }) => {
35
- const { style, colors } = initStyle({primaryColor: 'black'})
36
- const state = {
37
- modules: [],
38
- models: [],
39
- showModel: null,
40
- lockMinZoom: false,
41
- showInsertModel: null,
42
- currentModel: null,
43
- expandedKeys: [],
44
- checkedKeys: [],
45
- centerModel: null,
46
- search: null,
47
- layouting : false,
48
- isArrangeLayout: false,
49
- fieldMap,
50
- showNameOrLabel: false,
51
- config : {
52
- style,
53
- namespace: 'erd',
54
- topHeight: 48,
55
- colors,
56
- },
57
- }
58
- return {
59
- namespace,
60
- state,
61
- reducers: {
62
- onExpand,
63
- modelEdit,
64
- ...modelReducers,
65
- arrangeShow,
66
- init,
67
- load,
68
- },
69
- }
70
- })
@@ -1,16 +0,0 @@
1
- const getLayerRootModel = (models, rootKey, roots = []) => {
2
- const rootModel = models.find((a) => a.key === rootKey)
3
- const rootsRes = rootModel ? [...roots, rootKey] : roots
4
- const isRoot = (rootModel.aggregateModelKey && rootModel.aggregateModelKey !== rootKey)
5
- const rootsResList = isRoot ? getLayerRootModel(models, rootModel.aggregateModelKey, rootsRes) : rootsRes
6
- return rootsResList
7
- }
8
-
9
- export const arrangeShow = (ss, {model}) => {
10
- // alert(model)
11
- const roots = getLayerRootModel(ss.models, model, [])
12
- // alert(JSON.stringify(roots))
13
- const list = ss.models.filter((a) => (a.key === model || roots.indexOf(a.aggregateModelKey) >= 0)).map((a) => 'model-' + a.key)
14
- return {...ss , checkedKeys: list, currentModel: model, isArrangeLayout: true}
15
-
16
- }
@@ -1,7 +0,0 @@
1
- export * from './on-expand'
2
- export * from './arrange'
3
- import * as modelReducers from './model'
4
- export * from './init'
5
- export {
6
- modelReducers,
7
- }
@@ -1,61 +0,0 @@
1
- import Immer from 'immer'
2
- import { initStyle } from '../style'
3
-
4
- // const modules_name = 'modules'
5
- // const models_name = 'models'
6
- // const model_key = 'key'
7
- // const module_key = 'key'
8
-
9
- export const init = (ss, {
10
- models,
11
- modules,
12
- currentModel,
13
- primaryColor,
14
- }) => {
15
- // tslint:disable-next-line: ban-comma-operator
16
- return Immer(ss, (s) => {
17
- s.currentModel = currentModel
18
-
19
- if (models) {
20
- s.models = models
21
- s.checkedKeys = models.map((m) => 'model-' + m.key)
22
- }
23
-
24
- if (modules) {
25
- s.modules = modules
26
- s.expandedKeys = ['allmodels', ...modules.map((module) => 'module-' + module.key)]
27
- }
28
- if (primaryColor) {
29
- const { style , colors } = initStyle({primaryColor})
30
- s.config.style = style
31
- s.config.colors = colors
32
- }
33
- })
34
- }
35
-
36
- export const load = (ss, {
37
- models,
38
- modules,
39
- currentModel,
40
- primaryColor,
41
- }) => {
42
- // tslint:disable-next-line: ban-comma-operator
43
- return Immer(ss, (s) => {
44
- s.currentModel = currentModel
45
-
46
- if (models) {
47
- s.models = [...s.models, ...models]
48
- s.checkedKeys = [...models.map((m) => 'model-' + m.key), ...s.checkedKeys]
49
- }
50
-
51
- if (modules) {
52
- s.modules = [...s.modules, ...modules]
53
- s.expandedKeys = [...s.expandedKeys, 'allmodels', ...modules.map((module) => 'module-' + module.key)]
54
- }
55
- if (primaryColor) {
56
- const { style , colors } = initStyle({primaryColor})
57
- s.config.style = style
58
- s.config.colors = colors
59
- }
60
- })
61
- }
@@ -1,126 +0,0 @@
1
- import _ from 'lodash'
2
- export const layouting = (sss, arg) => {
3
- return { ...sss, layouting: arg.layouting }
4
- }
5
-
6
- export const setArrangeLayout = (sss, { isArrangeLayout }) => {
7
- return { ...sss, isArrangeLayout }
8
- }
9
-
10
- export const openInsertModel = (ss) => {
11
- return { ...ss, showInsertModel: 'new' }
12
- }
13
- export const centerModel = (ss, { model }) => {
14
-
15
- if (!ss.checkedKeys.find((a) => a === model)) {
16
- return { ...ss, currentModel: model, checkedKeys : [...ss.checkedKeys, model ], centerModel: model }
17
- } else {
18
- // alert(model)
19
- return { ...ss, currentModel: model , centerModel: model }
20
- }
21
- }
22
- export const currentModel = (ss, { model }) => {
23
- // return ss
24
- // alert(JSON.stringify(ss.checkedKeys))
25
- if (!ss.checkedKeys.find((a) => a === model)) {
26
- return { ...ss, currentModel: model, checkedKeys : [...ss.checkedKeys, model ] }
27
- } else {
28
- // alert(model)
29
- return { ...ss, currentModel: model }
30
- }
31
- }
32
- export const closeModel = (ss) => {
33
- return { ...ss, showModel: null }
34
- }
35
-
36
- export const delModel = (ss, { model }) => {
37
- // alert(model)
38
- // if( model === ss.currentModel) {
39
- // return { ...ss }
40
- // }
41
- // return { ...ss, showModel: null }
42
-
43
- const models = ss.models.filter((a) => (('model-' + a.key) !== model))
44
- return { ...ss , models , checkedKeys : ss.checkedKeys.filter((a) => a !== model), currentModel : undefined}
45
-
46
- }
47
-
48
- export const delModule = (ss, { model }) => {
49
- // alert(model)
50
- // if( model === ss.currentModel) {
51
- // return { ...ss }
52
- // }
53
- // return { ...ss, showModel: null }
54
- const modules = ss.modules.filter((a) => ('module-' + a.key) !== model)
55
- const models = ss.models.filter((a) => (('module-' + a.moduleKey) !== model))
56
- return { ...ss , models , modules, checkedKeys : ss.checkedKeys.filter((a) => a !== model), currentModel : undefined}
57
-
58
- }
59
-
60
- export const closeInsertModel = (ss) => {
61
- return { ...ss, showInsertModel: null }
62
- }
63
-
64
- export const onCheck = (ss, { checkKeys }) => {
65
- if (checkKeys && checkKeys.find && checkKeys.find((ck) => ck === ss.currentModel)) {
66
- return { ...ss,
67
- checkedKeys: checkKeys,
68
- currentModel: null,
69
- }
70
- } else return { ...ss,
71
- checkedKeys: checkKeys,
72
- }
73
- }
74
- export const search = (ss, { text }) => {
75
- return { ...ss,
76
- search: text,
77
- currentModel: null,
78
- }
79
- }
80
-
81
- export const onCheckByModule = (ss, { checkKeys, moduleKey}) => {
82
- const modelsElse = ss.models.filter((a) => !!moduleKey && ((a.moduleKey) !== moduleKey)).map(a=>'model-'+a.key)
83
- const modelFIlterElse = _.intersection(ss.checkedKeys, modelsElse)
84
- const checkedKeys = [...modelFIlterElse, ...checkKeys]
85
- return { ...ss,
86
- checkedKeys,
87
- currentModel: checkedKeys.find(k => k === ss.currentModel) ? ss.currentModel : null,
88
- }
89
- }
90
-
91
- export const onCheckByModuleAll = (ss, { moduleKey }) => {
92
- const modelsElse = ss.models.filter((a) => !!moduleKey && ((a.moduleKey) !== moduleKey)).map(a=>'model-'+a.key)
93
- const modelFIlterElse = _.intersection(ss.checkedKeys, modelsElse)
94
- const modelsKeys = ss.models.filter((a) => !moduleKey || ((a.moduleKey) === moduleKey)).map(a=>'model-'+a.key)
95
- const checkedKeys = [...modelFIlterElse, ...modelsKeys]
96
- return { ...ss,
97
- checkedKeys,
98
- currentModel: checkedKeys.find(k => k === ss.currentModel) ? ss.currentModel : null,
99
- }
100
- }
101
-
102
- export const onCheckByModuleAllCancle = (ss, { moduleKey }) => {
103
- const modelsElse = ss.models.filter((a) => !!moduleKey && ((a.moduleKey) !== moduleKey)).map(a=>'model-'+a.key)
104
- const modelFIlterElse = _.intersection(ss.checkedKeys, modelsElse)
105
- // const modelsKeys = ss.models.filter((a) => !moduleKey || ((a.moduleKey) === moduleKey)).map(a=>'model-'+a.key)
106
- const checkedKeys = [...modelFIlterElse]
107
- return { ...ss,
108
- checkedKeys,
109
- currentModel: checkedKeys.find(k => k === ss.currentModel) ? ss.currentModel : null,
110
- }
111
- }
112
-
113
- export const lockMinZoom = (ss, { lockMinZoom }) => {
114
- // alert(lockMinZoom)
115
- return {
116
- ...ss,
117
- lockMinZoom
118
- }
119
- }
120
-
121
- export const showNameOrLabel = (ss, {showNameOrLabel}) => {
122
- return {
123
- ...ss,
124
- showNameOrLabel
125
- }
126
- }
@@ -1,27 +0,0 @@
1
- import Immer from 'immer'
2
-
3
- export const onExpand = (ss, { expanded, node }) => {
4
- const resData = Immer(ss, (s) => {
5
- // tslint:disable-next-line: prefer-conditional-expression
6
- if (expanded) {
7
- s.expandedKeys = [...s.expandedKeys, node.props.eventKey]
8
- } else {
9
- s.expandedKeys = s.expandedKeys.filter((a) => a !== node.props.eventKey)
10
- }
11
- })
12
- return resData
13
- }
14
-
15
- export const openModel = (ss) => {
16
- return { ...ss,
17
- showModel: ss.currentModel,
18
- }
19
- }
20
-
21
- export const modelEdit = (ss, {
22
- model,
23
- }) => {
24
- return { ...ss,
25
- showModel: model,
26
- }
27
- }
@@ -1,88 +0,0 @@
1
-
2
- export const initStyle = ({primaryColor}) => {
3
- const colors = {
4
- // blue : '#495D9E',
5
-
6
- // get blue() {
7
- // const res = (window.SYS_backEndConfig && window.SYS_backEndConfig.STYLE_PRIMARY_COLOR) || '#495D9E'
8
- // if (_styleConfigLazy) {
9
- // _styleConfigLazy.selected.node.stroke = res
10
- // _styleConfigLazy.default.edge.stroke = res
11
- // }
12
- // return res
13
- // // #0083EE
14
- // },
15
- // blue : window.SYS_backEndConfig && window.SYS_backEndConfig.PRESET_CSS_URL ? '#0083EE' : '#495D9E',
16
- // #0083EE
17
- blue: primaryColor,
18
- white: '#FFFFFF',
19
- head: 'rgba(7,10,26,0.06)',
20
- black: 'black',
21
- }
22
-
23
- const style = {
24
- naviWidth: 370,
25
- default: {
26
- node: {
27
- fill: '#FFFFFF',
28
- // shadowColor: 'rgba(0,0,0,0.06)',
29
- shadowBlur: 15,
30
- shadowOffsetX: 8,
31
- shadowOffsetY: 8,
32
- radius: 10,
33
- // stroke: undefined,
34
- lineWidth: 4 ,
35
- opacity: 0.8,
36
- stroke: 'black',
37
- },
38
- edge: {
39
- lineWidth: 2,
40
- size: 2,
41
- lineAppendWidth: 4,
42
- endArrow: {
43
- path: 'M 6,0 L -6,-6 L -3,0 L -6,6 Z',
44
- d: 4,
45
- },
46
- opacity: 0.2,
47
- radius: 5,
48
- labelCfg: {
49
- autoRotate: true, // 使文本随边旋转
50
- style: {
51
- fontSize: 34,
52
- },
53
- },
54
- stroke: 'rgba(11,108,149)',
55
- },
56
- },
57
- inactive: {
58
- edge: {
59
- stroke: 'red',
60
- }
61
- },
62
- selected: {
63
- node: {
64
- stroke: 'rgba(11,108,149)',
65
- },
66
- },
67
- active: {
68
- edge: {
69
- stroke: 'red',
70
- }
71
- },
72
- noSelected: {
73
- node: {
74
- stroke: 'red',
75
- },
76
- },
77
- isNoModule : {
78
- node: {
79
- opacity: 0.2,
80
- },
81
- },
82
- }
83
-
84
- return {
85
- colors,
86
- style,
87
- }
88
- }
@@ -1,54 +0,0 @@
1
- import { useCallback, useEffect, useRef } from 'react'
2
- import Stats from 'stats.js'
3
- export const useLoadData = ({
4
- dispatch,
5
- namespace,
6
- getModels,
7
- getModules,
8
- primaryColor,
9
- }) => {
10
- const loadData = useCallback(() => {
11
- if (getModels && getModules) {
12
- const fun = async () => {
13
- const data = await getModels({})
14
- const modules = await getModules({})
15
- dispatch({
16
- type: `${namespace}/init`,
17
- modules: modules.res,
18
- models: data.res,
19
- primaryColor,
20
- })
21
- }
22
-
23
- fun()
24
- }
25
- }, [dispatch, getModels, getModules])
26
- return {
27
- loadData,
28
- }
29
- }
30
- export const useFpsHook = () => {
31
- const fpsRef = useRef(null)
32
- useEffect(() => {
33
- if (fpsRef.current && window.SYS_backEndConfig && window.SYS_backEndConfig.ERD_FPS) {
34
- const stats = new Stats() // alert(stats.dom)
35
-
36
- stats.showPanel(0) // 0: fps, 1: ms, 2: mb, 3+: custom
37
-
38
- fpsRef.current.appendChild(stats.dom)
39
- stats.dom.style.position = 'relative'
40
-
41
- function animate() {
42
- stats.begin() // monitored code goes here
43
-
44
- stats.end()
45
- requestAnimationFrame(animate)
46
- }
47
-
48
- requestAnimationFrame(animate)
49
- }
50
- }, [])
51
- return {
52
- fpsRef,
53
- }
54
- }
@@ -1,34 +0,0 @@
1
-
2
- import React, {
3
- useCallback,
4
- useEffect,
5
- useMemo,
6
- useRef,
7
- useState,
8
- } from 'react'
9
-
10
- export const usefullScreen = (useAppContext) => {
11
- const { shellContext, tabsRouteContext } = useAppContext()
12
- const [layouted, setLayouted] = useState(false)
13
- const [change, setChange] = useState(false)
14
- useEffect(() => {
15
- shellContext.setState({
16
- fullScreen: true,
17
- })
18
- setLayouted(true)
19
- }, [])
20
- useEffect(() => {
21
- shellContext.setState({
22
- fullScreen: tabsRouteContext.current === '/model-map',
23
- })
24
- return () => {
25
- shellContext.setState({
26
- fullScreen: false,
27
- })
28
- }
29
- }, [tabsRouteContext.current === '/model-map'])
30
- return {
31
- layouted,
32
- change,
33
- }
34
- }
@@ -1,127 +0,0 @@
1
- import { useDispatch, useSelector } from '../../hook'
2
- import React, {
3
- useCallback,
4
- useEffect,
5
- useMemo,
6
- useRef,
7
- useState,
8
- } from 'react'
9
- // import { modelConfig } from '../config'
10
- import { createLinks, getNodes, layOutNodesByG6 } from '../util'
11
- import { usefullScreen } from './fullscreen'
12
-
13
- export const useLocalHooks = ({namespace, useAppContext}) => {
14
- const graphRef = useRef(null)
15
- // const { shellContext } = useAppContext()
16
- // const { loadData } = useLoadData({dispatch , getTrantorMetaAllModels, getTrantorMetaModules})
17
-
18
- const { layouted, change } = usefullScreen(useAppContext)
19
- const {
20
- models,
21
- modules,
22
- checkedKeys,
23
- showModel,
24
- currentModel,
25
- showInsertModel,
26
- search,
27
- layouting,
28
- isArrangeLayout,
29
- fieldMap,
30
- config: { topHeight, style, colors },
31
- } = useSelector((s) => s[namespace])
32
- const newModels = useMemo(() => models.map(fieldMap).map((a) => ({...a, isShow: (!search || a.name.indexOf(search) >= 0)})), [
33
- models, search, checkedKeys,
34
- ])
35
-
36
- const [height] = useState(
37
- document.documentElement.clientHeight ||
38
- document.body.clientHeight - topHeight,
39
- )
40
- const [nodeState, setNodeState] = useState([])
41
- const [edgeState, setEdgeState] = useState([])
42
- const nodes = getNodes(newModels, checkedKeys, style)
43
-
44
- const edgesRes = createLinks(
45
- newModels,
46
- nodes,
47
- checkedKeys,
48
- style,
49
- )
50
-
51
- const edges =
52
- nodes.length >= 0 ? edgesRes.concat(nodes.filter((a) => !a.isSys).map((a) => ({
53
- key:
54
- // 'model-' +
55
- a.id +
56
- '~' +
57
- +'~' +
58
- 'model-SYS-CENTER-POINT',
59
-
60
- source : a.id,
61
- visible: false,
62
- isSys : true,
63
- style: {
64
- visible: false,
65
- },
66
- target: 'model-SYS-CENTER-POINT',
67
- type: 'console-line',
68
-
69
- }))) :
70
- edgesRes
71
- const dispatch = useDispatch()
72
- const setLayouting = useCallback((layoutingSet) => {
73
- dispatch({
74
- type: `${namespace}/layouting`,
75
- layouting: layoutingSet,
76
- })
77
- }, [])
78
- useEffect(() => {
79
- // alert(1)
80
- setLayouting(true)
81
- setImmediate(() => {
82
- // layOutNodesByG6(nodes, edges, modules, setNodeState, setEdgeState, setLayouting, isArrangeLayout)
83
- setEdgeState(edges)
84
- setNodeState(nodes)
85
-
86
- setLayouting(false)
87
- }, 10)
88
- }, [newModels, checkedKeys, isArrangeLayout, search])
89
-
90
- const graph = useMemo(() => ({
91
- edges : edgeState,
92
- nodes : nodeState,
93
- }), [nodeState])
94
-
95
- return {
96
- height,
97
- graph,
98
- models: newModels,
99
- checkedKeys,
100
- graphRef,
101
- showModel,
102
- currentModel,
103
- layouted,
104
- change,
105
- showInsertModel,
106
- search,
107
- modules,
108
- layouting,
109
- style,
110
- colors,
111
- }
112
- }
113
-
114
- // const createGroups = (modules) => {
115
- // return modules.map((m) => {
116
- // return {
117
- // id: `module-${m.key}`,
118
- // title: {
119
- // text: m.name,
120
- // fontSize: 35,
121
- // stroke: '#444',
122
- // offsetX: 0,
123
- // offsetY: 0,
124
- // },
125
- // }
126
- // })
127
- // }