@@ -11,21 +11,15 @@ import { DivaServices } from "divaservices-utils";
11
11
import { initWebservices } from "./constants/globals" ;
12
12
import { CATEGORY_SERVICE , CATEGORY_DATATEST } from "./constants/constants" ;
13
13
import { addElementFromName , addLinkFromLink } from "./elements/addElement" ;
14
- import { deleteElementByBoxId , deleteLink } from "./elements/deleteElement" ;
15
- import { resizeElements } from "./elements/resizeElement" ;
16
- import {
17
- equalObjects ,
18
- findDifferenceBy ,
19
- getDeletedElements
20
- } from "./utils/utils" ;
14
+ import { deleteElementByBoxId } from "./elements/deleteElement" ;
15
+ import { findDifferenceBy } from "./utils/utils" ;
21
16
import {
22
17
selectedElements ,
23
18
copiedElements ,
24
19
deletedElements ,
25
20
currentElements ,
26
21
currentDataElements
27
22
} from "./store/modules/utils" ;
28
- import { moveElements } from "./elements/moveElement" ;
29
23
import { addDataBox } from "./elements/addDataElement" ;
30
24
import { initSplit } from "./layout/split" ;
31
25
import { initKeyboardEvents } from "./events/keyboardEvents" ;
@@ -39,7 +33,6 @@ import {
39
33
MESSAGE_COPY_ERROR
40
34
} from "./constants/messages" ;
41
35
import { saveWorkflow } from "./workflows/saveWorkflow" ;
42
- import { setInputValueInElement , setSelectValueInElement } from "./layout/inputs"
43
36
44
37
export let app ;
45
38
@@ -88,16 +81,6 @@ export let app;
88
81
return { boxId, position } ;
89
82
} ) ;
90
83
} ,
91
- resizedElements ( ) {
92
- return this . elements . map ( ( { boxId, size } ) => {
93
- return { boxId, size } ;
94
- } ) ;
95
- } ,
96
- defaultParamsElements ( ) {
97
- return this . elements . map ( ( { boxId, defaultParams } ) => {
98
- return { boxId, defaultParams } ;
99
- } ) ;
100
- } ,
101
84
dataElements ( ) {
102
85
return this . dataTest ;
103
86
} ,
@@ -146,14 +129,10 @@ export let app;
146
129
undo ( ) {
147
130
UndoRedoHistory . undo ( ) ;
148
131
} ,
149
-
150
- addElementToSelection ( cellView ) {
151
- this . $addElementToSelection ( cellView ) ;
152
- } ,
153
- addLinkFromApp ( payload ) {
132
+ addLink ( payload ) {
154
133
this . $addLink ( { ...payload } ) ;
155
134
} ,
156
- deleteLinkFromApp ( payload ) {
135
+ deleteLink ( payload ) {
157
136
this . $deleteLink ( { ...payload } ) ;
158
137
} ,
159
138
deleteElementByCellView ( cellView ) {
@@ -162,7 +141,6 @@ export let app;
162
141
elements : [ this . elements . find ( el => el . boxId === boxId ) ]
163
142
} ) ;
164
143
} ,
165
-
166
144
resizeElementByBoxId ( boxId , size ) {
167
145
const element = this . elements . find ( el => el . boxId === boxId ) ;
168
146
this . $resizeElement ( { element, size } ) ;
@@ -194,7 +172,7 @@ export let app;
194
172
* add new elements, remove deleted elements
195
173
*/
196
174
currentElements : {
197
- handler ( newValue , oldValue ) {
175
+ handler ( newValue ) {
198
176
// if boxId element does not exist in the graph, we add it
199
177
for ( const el of Graph . getNewElements ( newValue ) ) {
200
178
const { type, category } = el ;
@@ -209,12 +187,6 @@ export let app;
209
187
console . log ( "ERROR ADDING EL" ) ;
210
188
}
211
189
}
212
-
213
- // remove element removed from arr
214
- // cannot use arr.includes because states are deep cloned
215
- for ( const el of getDeletedElements ( oldValue , newValue ) ) {
216
- deleteElementByBoxId ( el . boxId ) ;
217
- }
218
190
}
219
191
} ,
220
192
@@ -235,70 +207,17 @@ export let app;
235
207
}
236
208
}
237
209
} ,
238
-
239
- /**
240
- * watch parameters of elements
241
- * on direct changes, nothing changes (mechanic operation)
242
- * only apply changes on undo-redo
243
- */
244
- defaultParamsElements : {
245
- deep : true ,
246
- handler ( newValue , oldValue ) {
247
- const difference = findDifferenceBy (
248
- newValue ,
249
- oldValue ,
250
- "defaultParams"
251
- ) ;
252
- for ( const box of difference ) {
253
- setSelectValueInElement ( box ) ;
254
- setInputValueInElement ( box ) ;
255
- }
256
- }
257
- } ,
258
210
259
- /**
260
- * watch moved elements
261
- * on direct move operation, nothing changes (mechanic operation)
262
- * only apply changes on undo-redo
263
- */
264
- movedElements : {
265
- deep : true ,
266
- handler ( newValue , oldValue ) {
267
- const difference = findDifferenceBy ( newValue , oldValue , "position" ) ;
268
- moveElements ( difference ) ;
269
- }
270
- } ,
271
- /**
272
- * watch moved elements
273
- * on direct resize operation, nothing changes (mechanic operation)
274
- * only apply changes on undo-redo
275
- */
276
- resizedElements : {
277
- deep : true ,
278
- handler ( newValue , oldValue ) {
279
- const difference = findDifferenceBy ( newValue , oldValue , "size" ) ;
280
- resizeElements ( difference ) ;
281
- }
282
- } ,
283
211
/**
284
212
* watch links
285
213
* on direct operation, nothing changes (mechanic operation)
286
214
* on start, add parsed links
287
215
* apply changes on undo-redo
288
216
*/
289
- links ( newValue , oldValue ) {
217
+ links ( newValue ) {
290
218
for ( const l of Graph . getNewLinks ( newValue ) ) {
291
219
addLinkFromLink ( l ) ;
292
220
}
293
-
294
- // remove links removed from arr
295
- // cannot use arr.includes because states are deep cloned
296
- for ( const el of oldValue . filter (
297
- el => newValue . filter ( v => equalObjects ( v , el ) ) . length === 0
298
- ) ) {
299
- const link = Graph . getLinkBySourceTarget ( el . source , el . target ) ;
300
- deleteLink ( link ) ;
301
- }
302
221
} ,
303
222
/**
304
223
* watches deleted elements
0 commit comments