@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/steedos-plugin-schema-builder",
3
- "version": "2.2.51-beta.1",
3
+ "version": "2.2.51-beta.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "",
@@ -10,5 +10,5 @@
10
10
  "access": "public"
11
11
  },
12
12
  "homepage": "https://www.steedos.com",
13
- "gitHead": "edeb1c70d34159e3caac697f9e207c2ca98d8d00"
13
+ "gitHead": "c324c40fa8facd3bf73a51e8c417293a9349f9fb"
14
14
  }
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- schemaBuilder: function (object_name, record_id, fields) {
3
- Steedos.openWindow(Steedos.absoluteUrl('/schema-builder'))
4
- }
5
- }
@@ -1,6 +0,0 @@
1
- extend: objects
2
- actions:
3
- schemaBuilder:
4
- label: 对象关系图
5
- visible: true
6
- on: list
@@ -1,33 +0,0 @@
1
- declare module '*.scss' {
2
- const content: any
3
- export = content
4
- }
5
-
6
- declare module '*.xsd' {
7
- const content: any
8
- export = content
9
- }
10
-
11
- declare module '*.hbs' {
12
- const content: any
13
- export = content
14
- }
15
-
16
- declare module '*.json' {
17
- const content: any
18
- export = content
19
- }
20
-
21
- declare module '@terminus/nusi'
22
- declare module '@terminus/react-monaco-async'
23
- declare module 'react-splitter-layout'
24
- // declare module 'require'
25
-
26
- interface Window {
27
- require: any
28
- define: any
29
- }
30
-
31
- interface IDictionary {
32
- [index: string]: any
33
- }
@@ -1,160 +0,0 @@
1
-
2
- export default {
3
- getDefaultCfg() {
4
- return {
5
- trigger: 'mouseenter',
6
- // 可选 mouseenter || click
7
- activeState: 'active',
8
- inactiveState: 'inactive',
9
-
10
- shouldUpdate() {
11
- return true
12
- },
13
-
14
- }
15
- },
16
-
17
- getEvents() {
18
- if (this.get('trigger') === 'mouseenter') {
19
- return {
20
- 'node:mouseenter': 'setAllItemStates',
21
- 'node:mouseleave': 'clearAllItemStates',
22
- }
23
- }
24
-
25
- return {
26
- 'node:click': 'setAllItemStates',
27
- 'canvas:click': 'clearAllItemStates',
28
- }
29
- },
30
-
31
- setAllItemStates(e) {
32
- // return
33
- const graph = this.get('graph')
34
- const item = e.item
35
- this.item = item
36
-
37
- if (!this.shouldUpdate(e.item, {
38
- event: e,
39
- action: 'activate',
40
- })) {
41
- return
42
- }
43
-
44
- const activeState = this.get('activeState')
45
- const inactiveState = this.get('inactiveState')
46
- const autoPaint = graph.get('autoPaint')
47
- graph.setAutoPaint(false)
48
- graph.getNodes().filter((a) => !a.isSys).forEach((node) => {
49
- // graph.setItemState(node, activeState, false)
50
- // inactiveState && graph.setItemState(node, inactiveState, true)
51
- graph.updateItem(node, {
52
- active: false,
53
- inactive: true,
54
- })
55
- })
56
- graph.getEdges().filter((a) => !a.isSys).forEach((edge) => {
57
- graph.setItemState(edge, 'init', false)
58
- // graph.updateItem(edge, { active: false, into : false })
59
- graph.setItemState(edge, inactiveState, true)
60
- graph.setItemState(edge, activeState, false) // inactiveState && graph.setItemState(edge, inactiveState, true)
61
- }) // inactiveState && graph.setItemState(item, inactiveState, false)
62
- // graph.setItemState(item, activeState, true)
63
-
64
- graph.updateItem(item, {
65
- active: true,
66
- }) // const { target } = e
67
- // // alert(target.attr('text'))
68
- // if (target.attr('text')) {
69
- // target.attr('fill_old', target.attr('fill'))
70
- // target.attr('fill', 'red')
71
- // }
72
-
73
- graph.getEdges().forEach((edge) => {
74
- if (edge.getSource() === item) {
75
- // inactiveState && graph.setItemState(edge.getTarget(), inactiveState, false)
76
- // graph.updateItem(edge.getTarget(), { active: true })
77
- graph.setItemState(edge.getTarget(), activeState, true)
78
- graph.setItemState(edge, activeState, true)
79
- graph.setItemState(edge, inactiveState, false) // graph.updateItem(edge, { active: true, into : true })
80
-
81
- graph.updateItem(edge.getTarget(), {
82
- out: false,
83
- into: true,
84
- })
85
- edge.toFront()
86
- } else if (edge.getTarget() === item) {
87
- graph.updateItem(edge.getSource(), {
88
- into: false,
89
- out: true,
90
- })
91
- // inactiveState && graph.setItemState(edge.getSource(), inactiveState, false)
92
-
93
- graph.setItemState(edge.getSource(), activeState, true)
94
- graph.setItemState(edge, activeState, true)
95
- graph.setItemState(edge, inactiveState, true) // graph.updateItem(edge, { active: true, out : true })
96
-
97
- edge.toFront()
98
- }
99
- })
100
- graph.paint()
101
- graph.setAutoPaint(autoPaint)
102
- graph.emit('afteractivaterelations', {
103
- item: e.item,
104
- action: 'activate',
105
- })
106
- },
107
-
108
- clearAllItemStates(e) {
109
- // return
110
- // const { target } = e
111
- // // alert(target.attr('text'))
112
- // if (target.attr('text')) {
113
- // // target.attr('fill_old', target.attr('fill'))
114
- // if (target.attr('fill_old'))
115
- // target.attr('fill', target.attr('fill_old'))
116
- // }
117
- const graph = this.get('graph')
118
-
119
- if (!this.shouldUpdate(e.item, {
120
- event: e,
121
- action: 'deactivate',
122
- })) {
123
- return
124
- }
125
-
126
- const autoPaint = graph.get('autoPaint')
127
- graph.setAutoPaint(false)
128
- const activeState = this.get('activeState')
129
- const inactiveState = this.get('inactiveState')
130
- graph.getNodes().filter((a) => !a.isSys).forEach((n) => {
131
- // graph.clearItemStates(node, [activeState , inactiveState ])
132
- // graph.setItemState(n, activeState, false)
133
- // graph.setItemState(n, inactiveState, false)
134
- graph.updateItem(n, {
135
- active: false,
136
- into: false,
137
- out: false,
138
- inactive: false,
139
- })
140
-
141
- })
142
- // alert(graph.getEdges().length)
143
- graph.getEdges().forEach((n) => {
144
- // graph.updateItem(n, { active: false, into : false , out : false })
145
- // graph.clearItemStates(edge, [activeState , inactiveState ])
146
- graph.clearItemStates(n, [activeState, inactiveState])
147
- graph.setItemState(n, 'init', true)
148
- // graph.setItemState(n, activeState, false)
149
- // graph.setItemState(n, inactiveState, false)
150
- })
151
- graph.paint()
152
- graph.setAutoPaint(autoPaint) // alert(activeState)
153
-
154
- graph.emit('afteractivaterelations', {
155
- item: e.item || this.item,
156
- action: 'deactivate',
157
- })
158
- },
159
-
160
- }
@@ -1,146 +0,0 @@
1
-
2
- import { Util } from '@antv/g6';
3
- import _ from 'lodash';
4
- const abs = Math.abs;
5
- const DRAG_OFFSET = 10;
6
- const body = document.body;
7
- export default {
8
- getDefaultCfg() {
9
- return {
10
- direction: 'both'
11
- };
12
- },
13
-
14
- getEvents() {
15
- return {
16
- 'canvas:mousedown': 'onMouseDown',
17
- 'canvas:mousemove': 'onMouseMove',
18
- 'canvas:mouseup': 'onMouseUp',
19
- 'canvas:click': 'onMouseUp',
20
- 'canvas:mouseleave': 'onOutOfRange'
21
- };
22
- },
23
-
24
- updateViewport(e) {
25
- const origin = this.origin;
26
- const clientX = +e.clientX;
27
- const clientY = +e.clientY;
28
-
29
- if (isNaN(clientX) || isNaN(clientY)) {
30
- return;
31
- }
32
-
33
- let dx = clientX - origin.x;
34
- let dy = clientY - origin.y;
35
-
36
- if (this.get('direction') === 'x') {
37
- dy = 0;
38
- } else if (this.get('direction') === 'y') {
39
- dx = 0;
40
- }
41
-
42
- this.origin = {
43
- x: clientX,
44
- y: clientY
45
- };
46
- this.graph.translate(dx, dy);
47
- this.graph.paint();
48
- },
49
-
50
- onMouseDown(e) {
51
- this.origin = {
52
- x: e.clientX,
53
- y: e.clientY
54
- };
55
- this.dragging = false;
56
- },
57
-
58
- onMouseMove(e) {
59
- e = Util.cloneEvent(e);
60
- const graph = this.graph;
61
-
62
- if (!this.origin) {
63
- return;
64
- }
65
-
66
- if (this.origin && !this.dragging) {
67
- if (abs(this.origin.x - e.clientX) + abs(this.origin.y - e.clientY) < DRAG_OFFSET) {
68
- return;
69
- }
70
-
71
- if (this.shouldBegin.call(this, e)) {
72
- e.type = 'dragstart';
73
- graph.emit('canvas:dragstart', e);
74
- this.dragging = true;
75
- }
76
- }
77
-
78
- if (this.dragging) {
79
- e.type = 'drag';
80
- const self = this;
81
- const canvasElement = self.graph.get('canvas').get('el');
82
- canvasElement.style.cursor = 'grabbing';
83
- graph.emit('canvas:drag', e);
84
- }
85
-
86
- if (this.shouldUpdate.call(this, e)) {
87
- this.updateViewport(e); // console.log(e)
88
- // _.throttle(() => {
89
- // this.updateViewport(e)
90
- // }, 0)
91
- }
92
- },
93
-
94
- onMouseUp(e) {
95
- if (!this.dragging) {
96
- this.origin = null;
97
- return;
98
- }
99
-
100
- e = Util.cloneEvent(e);
101
- const graph = this.graph;
102
-
103
- if (this.shouldEnd.call(this, e)) {
104
- this.updateViewport(e);
105
- }
106
-
107
- e.type = 'dragend';
108
- graph.emit('canvas:dragend', e);
109
- this.endDrag();
110
- },
111
-
112
- endDrag() {
113
- if (this.dragging) {
114
- const self = this;
115
- const canvasElement = self.graph.get('canvas').get('el');
116
- canvasElement.style.cursor = 'grab';
117
- this.origin = null;
118
- this.dragging = false; // 终止时需要判断此时是否在监听画布外的 mouseup 事件,若有则解绑
119
-
120
- const fn = this.fn;
121
-
122
- if (fn) {
123
- body.removeEventListener('mouseup', fn, false);
124
- this.fn = null;
125
- }
126
- }
127
- },
128
-
129
- // 若在拖拽时,鼠标移出画布区域,此时放开鼠标无法终止 drag 行为。在画布外监听 mouseup 事件,放开则终止
130
- onOutOfRange(e) {
131
- if (this.dragging) {
132
- const self = this;
133
- const canvasElement = self.graph.get('canvas').get('el');
134
-
135
- const fn = ev => {
136
- if (ev.target !== canvasElement) {
137
- self.onMouseUp(e);
138
- }
139
- };
140
-
141
- this.fn = fn;
142
- body.addEventListener('mouseup', fn, false);
143
- }
144
- }
145
-
146
- };
@@ -1,5 +0,0 @@
1
- import G6 from '@antv/g6';
2
- import ActivateRelations from './activate-relations';
3
- import Darg from './darg';
4
- G6.registerBehavior('console-activate-relations', ActivateRelations);
5
- G6.registerBehavior('console-darg', Darg);