@steedos/steedos-plugin-schema-builder 2.6.1-beta.7 → 2.6.2-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 (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,393 +0,0 @@
1
-
2
- import { Empty, Spin } from 'antd'
3
- import { useDispatch } from '../hook'
4
- import React, {
5
- useCallback,
6
- useEffect,
7
- useRef,
8
- useState,
9
- } from 'react'
10
- // import Pdm from '../../test/g6-test/pdm'
11
- import { toCenter } from './../g6/util/graph'
12
- // import { modelConfig , styleConfigLazy } from './config'
13
- import { useFpsHook } from './hooks/callback'
14
- import { useLocalHooks } from './hooks/pagehooks'
15
- import { useResizeUpdate } from './hooks/resize'
16
- import ModelNavi from './model-navi'
17
- // import { updateLayout } from './util'
18
-
19
- import intl from './../g6/util/intel'
20
-
21
- export default (
22
- {
23
- namespace = 'erd' , primaryColor, toolBarCommands,
24
- saveFun, delFun, modelEditFun, fieldEditFun, changeData,
25
- modelInsertFun, useAppContext, getModels,
26
- getModules, ModelEdit, ModelInsert,
27
- ErdPage, isFullScreen, ...props}) => {
28
- const {
29
- graph,
30
- models,
31
- checkedKeys,
32
- graphRef,
33
- showModel,
34
- currentModel,
35
- layouted,
36
- showInsertModel,
37
- search,
38
- layouting,
39
- style,
40
- colors,
41
- } = useLocalHooks({ namespace, useAppContext, ...props})
42
- const dispatch = useDispatch()
43
-
44
- useResizeUpdate()
45
-
46
- const onCancle = () => {
47
- dispatch({
48
- type: `${namespace}/closeModel`,
49
- })
50
- }
51
-
52
- const onInsertCancle = () => {
53
- dispatch({
54
- type: `${namespace}/closeInsertModel`,
55
- })
56
- }
57
-
58
- const [width, setWidth] = useState(0)
59
-
60
- const G6GraphDomRef = useRef({
61
- offsetWidth: 0,
62
- offsetHeight: 0,
63
- })
64
- const isKeySharp = useRef(true)
65
- const [once, setOnce] = useState(true)
66
- const [updateId, setUpdateId] = useState(0)
67
- const { tabsRouteContext } = useAppContext()
68
-
69
- useEffect(() => {
70
- if (isFullScreen) {
71
- setWidth(G6GraphDomRef.current.offsetWidth)
72
- setOnce(false)
73
- } else if (
74
- G6GraphDomRef.current.offsetWidth &&
75
- tabsRouteContext.current === '/'
76
- ) {
77
- if (layouted) {
78
- setImmediate(() => {
79
- G6GraphDomRef.current && setWidth(G6GraphDomRef.current.offsetWidth)
80
- setOnce(false)
81
- }, 100)
82
- } else {
83
- setWidth(G6GraphDomRef.current.offsetWidth)
84
- }
85
- }
86
- }, [G6GraphDomRef.current.offsetWidth])
87
-
88
- const styleConfig = style
89
-
90
- const erdLoading = models.length > 0 && !!width && !once
91
- const toolBarCommand = useCallback(
92
- (name, action) => {
93
- const _graph = graphRef.current
94
-
95
- if (name === 'keySharp') {
96
- const { isKeysharp = !isKeySharp.current, isCardSharp } = action
97
- isKeySharp.current = isKeysharp
98
-
99
- _graph
100
- .findAll('node', (node) => true)
101
- .map((node) => {
102
- _graph.updateItem(node, {
103
- isKeySharp: isKeySharp.current,
104
- isCardSharp,
105
- })
106
- })
107
-
108
- _graph.paint()
109
- }
110
- // }
111
-
112
- if(name === 'export-image') {
113
- const newZoom = 100
114
- _graph.isExporting = true
115
- _graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
116
- node.getContainer().show()
117
- _graph.updateItem(node, {
118
- isKeySharp: false,
119
- isCardSharp: false ,
120
- })
121
- })
122
- const gwidth = _graph.get('width')
123
- const gheight = _graph.get('height')
124
- const point = _graph.getCanvasByPoint(gwidth / 2, gheight / 2)
125
- // graph.moveTo({x: point.x , y : point.y})
126
- _graph.zoomTo(newZoom / 100, {x: point.x , y : point.y})
127
- _graph.paint()
128
- _graph.downloadFullImage('模型图', undefined, {
129
- backgroundColor: 'rgb(245, 247, 255)',
130
- })
131
- _graph.isExporting = undefined
132
- }
133
-
134
- if (name === 'min-zoom') {
135
- const gwidth = _graph.get('width')
136
- const gheight = _graph.get('height')
137
- const point = _graph.getCanvasByPoint(gwidth / 2, gheight / 2)
138
-
139
- const zoom = _graph.getZoom()
140
- if (zoom > 0.2) {
141
- _graph.zoomTo(zoom - 0.2, point)
142
- } else {
143
- _graph.zoomTo(zoom - 0.02, point)
144
- }
145
- _graph.paint()
146
- setUpdateId(+new Date())
147
- }
148
-
149
- if (name === 'nodeClick') {
150
- dispatch({
151
- type: `${namespace}/currentModel`,
152
- model: action.node,
153
- })
154
-
155
- const currentNode = _graph
156
- .getNodes().filter((a) => !a.isSys)
157
- .find((node) => node.getModel().id === action.node)
158
-
159
- if (currentNode) {
160
- _graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
161
- _graph.updateItem(node, {
162
- selected: node === currentNode,
163
- noSelected: node === currentNode,
164
- })
165
- })
166
-
167
- _graph.paint()
168
- }
169
- }
170
-
171
- if (name === 'click') {
172
-
173
- if (action.click === 'modelEdit') {
174
- const [_, ...actions] = action.node.split('-')
175
- const actionStrings = actions.join('-')
176
- if (modelEditFun)
177
- modelEditFun({
178
- model: actionStrings,
179
- })
180
- }
181
-
182
- if (action.click === 'arrangeShow') {
183
- dispatch({
184
- type: `${namespace}/` + action.click,
185
- model: action.arg,
186
- })
187
- }
188
-
189
- if (action.click === 'delModel') {
190
- dispatch({
191
- type: `${namespace}/` + action.click,
192
- model: action.node,
193
- })
194
- }
195
-
196
- if (action.click === 'delModule') {
197
- dispatch({
198
- type: `${namespace}/` + action.click,
199
- model: action.node,
200
- })
201
- }
202
-
203
- if (action.click === 'fieldSelect') {
204
- //
205
- if(action.arg.relationModelKey){
206
- dispatch({
207
- type: `${namespace}/currentModel`,
208
- model: 'model-' + action.arg.relationModelKey,
209
- })
210
-
211
- const item = _graph.findById('model-' + action.arg.relationModelKey)
212
-
213
- toCenter(item, _graph)
214
- }
215
-
216
- }
217
-
218
- if (action.click === 'fieldEdit') {
219
- const [_, ...actions] = action.node.split('-')
220
- const actionStrings = actions.join('-')
221
- if (fieldEditFun)
222
- fieldEditFun({
223
- model: actionStrings,
224
- field: action.arg,
225
- })
226
- }
227
- }
228
-
229
- if (name === 'upload') {
230
- const data = _graph.save()
231
-
232
- const nodes = data.nodes.reduce((pre, { x, y, id }) => {
233
- return {
234
- ...pre,
235
- [id]: {
236
- x,
237
- y,
238
- },
239
- }
240
- }, {})
241
- sessionStorage.setItem('console-erd-graph', JSON.stringify(nodes))
242
- alert(JSON.stringify(nodes))
243
- }
244
-
245
- if (name === 'max-zoom') {
246
-
247
- if (_graph.getZoom() >= 2.1) return
248
-
249
- const gwidth = _graph.get('width')
250
- const gheight = _graph.get('height')
251
- const point = _graph.getCanvasByPoint(gwidth / 2, gheight / 2)
252
- const zoom = _graph.getZoom()
253
- console.log(zoom / 2)
254
- if (zoom > 0.2) {
255
- _graph.zoomTo(zoom + 0.2, point)
256
- } else {
257
- _graph.zoomTo(zoom + 0.02, point)
258
- }
259
- setUpdateId(+new Date())
260
- }
261
-
262
- if (name === 'editModel') {
263
- dispatch({
264
- type: `${namespace}/openModel`,
265
- })
266
- const [_, ...actions] = currentModel.split('-')
267
- const actionStrings = actions.join('-')
268
- if (modelEditFun)
269
- modelEditFun({
270
- model: actionStrings,
271
- })
272
- }
273
-
274
- if (name === 'insertModel') {
275
- dispatch({
276
- type: `${namespace}/openInsertModel`,
277
- })
278
- if (modelInsertFun) modelInsertFun()
279
- }
280
-
281
- if (name === 'resetLayout') {
282
- _graph.refresh()
283
- }
284
-
285
- if (name === 'centerModel') {
286
- if (action && action.node) {
287
- dispatch({
288
- type: `${namespace}/currentModel`,
289
- model: action.node,
290
- })
291
-
292
- _graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
293
- const current = node.getModel().id === action.node
294
- // current && toCenter(node, _graph)
295
-
296
- _graph.updateItem(node, {
297
- selected: current,
298
- isKeySharp: false,
299
- })
300
- })
301
- }
302
-
303
- const item = _graph.findById((action && action.node) || currentModel)
304
-
305
- toCenter(item, _graph)
306
- }
307
-
308
- if (name === 'save') {
309
- if (saveFun) saveFun()
310
- }
311
-
312
- if (name === 'delModel') {
313
- alert()
314
- dispatch({
315
- type: `${namespace}/delModel`,
316
- })
317
- delFun && delFun()
318
- }
319
- },
320
- [graphRef.current, currentModel],
321
- )
322
- const { fpsRef } = useFpsHook()
323
- const Pdm = props.Pdm
324
- return (
325
- <div
326
- className='console-g6-page'
327
- >
328
- {/* {Pdm && erdLoading && <Pdm />} */}
329
- <div
330
- className='console-erd-fps'
331
- ref={(ref) => {
332
- fpsRef.current = ref
333
- }}
334
- />
335
- <div
336
- className='g6-modelnavi'
337
- >
338
- <ModelNavi
339
- namespace={namespace}
340
- Tree={props.Tree}
341
- bottomHeight={props.bottomHeight || 78}
342
- Input={props.Input}
343
- Pdm={Pdm}
344
- toolBarCommand={toolBarCommand}
345
- clickModelNode={(key) => {
346
- toolBarCommand('nodeClick', {
347
- node: key,
348
- })
349
- }}
350
- primaryColor={primaryColor}
351
- getModels={getModels}
352
- getModules={getModules}
353
- />
354
- </div>
355
- <div className='g6-graph' ref={(ref) => { G6GraphDomRef.current = ref }}>
356
- {' '}
357
- <Spin tip='layout...' spinning={erdLoading && layouting}>
358
- {erdLoading ? (
359
- <ErdPage
360
- toolBarCommands={toolBarCommands}
361
- saveFun={saveFun}
362
- styleConfig={styleConfig}
363
- toolBarCommand={toolBarCommand}
364
- currentModel={currentModel}
365
- width={width}
366
- config={styleConfig}
367
- setGraph={(g) => (graphRef.current = g)}
368
- changeNodes={checkedKeys}
369
- checkedKeys={checkedKeys}
370
- height={G6GraphDomRef.current.offsetHeight - 54}
371
- graph={graph}
372
- update={updateId}
373
- colors={colors}
374
- setUpdateId={setUpdateId}
375
- namespace={namespace}
376
- />
377
- ) : (
378
- search ? <Empty
379
- description='no found model'
380
- /> :
381
- <div>
382
- {
383
- Pdm ? <Empty style={{textAlign: 'center'}} description={<Pdm />} /> : <Spin >
384
- <Empty style={{textAlign: 'center'}} description={intl.get('正在绘制模型图...').d('正在绘制模型图...')}
385
- /></Spin>
386
- }
387
- </div>
388
- )}
389
- </Spin>
390
- </div>
391
- </div>
392
- )
393
- }
@@ -1,329 +0,0 @@
1
-
2
- import { Input, Tree, Select, Button, Divider } from 'antd'
3
- import { useDispatch, useSelector } from '../../hook'
4
- import _ from 'lodash'
5
- import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react'
6
- import Scroll from 'react-custom-scrollbars'
7
-
8
- import { useLoadData } from '../hooks/callback'
9
- import './style.scss'
10
- import intl from './../../g6/util/intel'
11
- const { Option } = Select;
12
-
13
- const renderLabel = (isSpec, beforeStr, afterStr, searchValue) => {
14
-
15
- const greenStyle = isSpec ? { color: 'green'} : {}
16
- const searchStyle = {
17
- color: '#f50',
18
- }
19
- return (
20
- <span>
21
- <span style={greenStyle}>{beforeStr}</span>
22
- <span style={searchStyle}>{searchValue}</span>
23
- <span style={greenStyle}>{afterStr}</span>
24
- </span>)
25
- }
26
-
27
- const renderTitleGreen = (isSpec, title) => {
28
- const greenStyle = isSpec ? { color: 'green'} : {}
29
- return (
30
- <span style={greenStyle}>{title}</span>
31
- )
32
- }
33
-
34
- const renderModelTitle = (title, searchValue , showNameOrLabel, originalKey) => {
35
-
36
- if(showNameOrLabel) {
37
- return renderTitle(originalKey, searchValue)
38
- } else {
39
- return renderTitle(title, searchValue)
40
- }
41
-
42
- }
43
-
44
- const renderTitle = (title, searchValue = '', isSpec = false) => {
45
-
46
- if (!searchValue) return title
47
- const index = title.indexOf(searchValue)
48
- const beforeStr = title.substr(0, index)
49
- const afterStr = title.substr(index + searchValue.length)
50
- const titleFilter = index > -1 ? renderLabel(isSpec, beforeStr, afterStr, searchValue) : renderTitleGreen(isSpec, title)
51
- return titleFilter
52
- }
53
-
54
- export interface IProps {
55
- namespace: any
56
- moduleKey: any
57
- getModels: any
58
- getModules: any
59
- clickModelNode: any
60
- toolBarCommand: any
61
- }
62
-
63
- const createItem = (conditionFun , createItemFun) => {
64
- if (conditionFun && conditionFun()) {
65
- const item = createItemFun()
66
- return [item]
67
- } else {
68
- return[]
69
- }
70
- }
71
-
72
- export default forwardRef((props: any, ref) => {
73
- const {
74
- namespace,
75
- getModels,
76
- getModules,
77
- clickModelNode,
78
- toolBarCommand,
79
- primaryColor,
80
- Pdm,
81
- } = props
82
- const {
83
- store,
84
- consoleModelsRef,
85
- dispatch,
86
- } = useLocal({
87
- namespace,
88
- getModels,
89
- getModules,
90
- clickModelNode,
91
- primaryColor,
92
- })
93
-
94
- const searchDispatch = useCallback(_.debounce((value) => {
95
- dispatch({
96
- type: `${namespace}/search`,
97
- text: value,
98
- })
99
-
100
- }, 500), [dispatch])
101
-
102
- const fun = (value) => {
103
- // console.log(e)
104
- setSearchText(value)
105
- // searchDispatch(value)
106
-
107
- }
108
-
109
- const [searchText, setSearchText] = useState(store.search)
110
-
111
- const searchOnChange = useCallback(fun , [dispatch])
112
-
113
- const NaviTree = (props.Tree || Tree)
114
- const NaviInput = (props.Input || Input)
115
- const {
116
- TreeNode,
117
- OptionBuilder,
118
- } = NaviTree
119
-
120
- const [moduleValue, setModuleValue] = useState('')
121
- const changeModuleValue = useCallback((val)=>{setModuleValue(val)},[])
122
-
123
- const selectAfter = (
124
- <Select defaultValue={moduleValue} value={moduleValue} className="select-after" onChange={changeModuleValue}>
125
- {
126
- [
127
- <Option value={''}>所有</Option>,
128
- ...store.modules.map((module) => {
129
- return <Option value={module.key}>{module.name}</Option>
130
- })]
131
- }
132
- </Select>
133
- );
134
-
135
- const checkAllFun = () => {
136
- // alert(models.length)
137
- dispatch({
138
- type: `${namespace}/onCheckByModuleAll`,
139
- moduleKey: moduleValue,
140
- })
141
- }
142
-
143
- const checkAllCancleFun = () => {
144
- // alert(models.length)
145
- dispatch({
146
- type: `${namespace}/onCheckByModuleAllCancle`,
147
- moduleKey: moduleValue,
148
- })
149
- }
150
-
151
- const toggleShowNameOrLabel = useCallback(() => {
152
- dispatch({
153
- type: `${namespace}/showNameOrLabel`,
154
- showNameOrLabel: !store.showNameOrLabel,
155
- })
156
- },[store.showNameOrLabel])
157
-
158
-
159
- return useMemo(() => (
160
- <div className='console-models-tree' style={{paddingBottom: props.bottomHeight}} ref={(refDiv) => {
161
- consoleModelsRef.current = refDiv
162
- }}>
163
- <div className='header'>
164
-
165
- <div className='console-erd-search'>
166
-
167
- <NaviInput allowClear size="small" onChange={(e) => {searchOnChange(e.target.value) }} placeholder={intl.get('模型筛选').d('模型筛选')} addonAfter={selectAfter} />
168
- {/* <Button className='console-erd-add' type='text' icon='plus' onClick={() => { toolBarCommand('insertModel') }} /> */}
169
- </div>
170
- <div className='console-erd-search btns'>
171
- <Button size="small" type="link" onClick={checkAllFun} >选择所有</Button>
172
- <Button size="small" type="link" onClick={checkAllCancleFun}>清除所有</Button>
173
- <Button size="small" type="link" onClick={toggleShowNameOrLabel}>显示{!store.showNameOrLabel?'名称':'标签'}</Button>
174
- </div>
175
- </div>
176
- <div className='navitree-warp'>
177
- <Scroll
178
- autoHide
179
- autoHeight
180
- autoHideTimeout={1000}
181
- autoHideDuration={200}
182
- autoHeightMin={'100%'}
183
- autoHeightMax={'100%'}
184
- >
185
- <NaviTree className='console-models-tree-tree' ref={ref} expandedKeys={store.expandedKeys} onCheck={(checkKeys) => {
186
- dispatch({
187
- type: `${namespace}/onCheckByModule`,
188
- checkKeys,
189
- moduleKey: moduleValue
190
- })
191
- }} onExpand={(_, {
192
- expanded,
193
- node,
194
- }) => {
195
- dispatch({
196
- type: `${namespace}/onExpand`,
197
- expanded,
198
- node,
199
- })
200
- }} checkable multiple selectedKeys={[store.currentModel]} onSelect={(keys , e) => {
201
- // clickModelNodeFun(keys[0])
202
- // alert()
203
- // alert(JSON.stringify(keys))
204
- dispatch({
205
- type: `${namespace}/currentModel`,
206
- model: e.node.props['data-key'],
207
- })
208
-
209
- }} checkedKeys={store.checkedKeys}>
210
- {/* <TreeNode key='allmodels' title={<OptionBuilder data={{
211
- title: intl.get('所有模型').d('所有模型'),
212
- }} />}> */}
213
- {/* {store.modules.map((module) => {
214
- return <TreeNode key={'module-' + module.key} title={
215
- <OptionBuilder data={{
216
- title: renderTitle(module.name, store.search),
217
- options: [
218
- {
219
- title: <span> {intl.get('移除').d('移除')}</span>,
220
- click: () => {
221
- toolBarCommand('click', {
222
- node: 'module-' + module.key,
223
- // arg: '',
224
- click: 'delModule',
225
- })
226
- },
227
- },
228
- ],
229
- }} />
230
-
231
- }> */}
232
- {store.models.filter((m) => !m.delete && (!moduleValue || m.moduleKey === moduleValue)).filter((m) => !searchText || m.name.indexOf(searchText) >= 0).map((m) => {
233
- return <TreeNode title={<OptionBuilder data={{
234
- title: renderModelTitle(m.name, searchText, store.showNameOrLabel, m.originalKey),
235
- options: [{
236
- title: <span> {intl.get('定位模型').d('定位模型')}</span>,
237
- click: () => {
238
- toolBarCommand('centerModel', {
239
- node: 'model-' + m.key,
240
- })
241
- },
242
- },
243
- {
244
- title: <span> {intl.get('查看').d('查看')}</span>,
245
- click: () => {
246
- toolBarCommand('click', {
247
- node: 'model-' + m.key,
248
- // arg: '',
249
- click: 'modelEdit',
250
- })
251
- },
252
- },
253
- ...createItem(() => (!!m.aggregateModelKey), () => {
254
- return {
255
- title: <span> {intl.get('查看聚合关系').d('查看聚合关系')}</span>,
256
- click: () => {
257
- toolBarCommand('click', {
258
- node: 'model-' + m.key,
259
- // arg: '',
260
- click: 'arrangeShow',
261
- arg: m.aggregateModelKey,
262
- })
263
- },
264
- }
265
- }),
266
- {
267
- title: <span> {intl.get('移除').d('移除')}</span>,
268
- click: () => {
269
- toolBarCommand('click', {
270
- node: 'model-' + m.key,
271
- // arg: '',
272
- click: 'delModel',
273
- })
274
- },
275
- },
276
- ],
277
- }} />} data-key={'model-' + m.key} key={'model-' + m.key} isLeaf />
278
- })}
279
- {/* </TreeNode> */}
280
- })}
281
- {/* </TreeNode> */}
282
- </NaviTree>
283
- </Scroll>
284
- </div>
285
- </div>), [store.checkedKeys, store.currentModel, store.expandedKeys, store.modules, store.models, searchText, moduleValue, store.showNameOrLabel])
286
- })
287
-
288
- const useLocal = ({
289
- namespace,
290
- getModels,
291
- getModules,
292
- clickModelNode,
293
- primaryColor,
294
- }) => {
295
- const store = useSelector((s) => s[namespace])
296
- const consoleModelsRef = useRef(null)
297
- const dispatch = useDispatch()
298
- const {
299
- loadData,
300
- } = useLoadData({
301
- dispatch,
302
- namespace,
303
- getModels,
304
- getModules,
305
- primaryColor,
306
- })
307
- useEffect(() => {
308
- loadData()
309
- }, [])
310
- useEffect(() => {
311
- const modelsDiv = consoleModelsRef.current
312
-
313
- if (modelsDiv && store.currentModel) {
314
- const lis: any = document.querySelector(`li[data-key=\'${store.currentModel}\']`)
315
- if (lis && lis.offsetTop) modelsDiv.scrollTop = lis.offsetTop
316
- }
317
- }, [store.currentModel])
318
- const clickModelNodeFun = useCallback((key) => {
319
- if (clickModelNode) {
320
- clickModelNode(key)
321
- }
322
- }, [clickModelNode])
323
- return {
324
- store,
325
- consoleModelsRef,
326
- dispatch,
327
- clickModelNodeFun,
328
- }
329
- }