2021-07-31 16:43:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SV.registerLayouter('Array', {
|
|
|
|
|
|
|
|
sourcesPreprocess(sources) {
|
|
|
|
const firstElement = sources[0];
|
|
|
|
|
|
|
|
if(firstElement.external) {
|
|
|
|
firstElement.headExternal = firstElement.external;
|
|
|
|
delete firstElement.external;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sources;
|
|
|
|
},
|
|
|
|
|
|
|
|
defineOptions() {
|
|
|
|
return {
|
|
|
|
element: {
|
|
|
|
default: {
|
|
|
|
type: 'indexed-node',
|
2021-08-30 15:57:05 +00:00
|
|
|
label: '[id]',
|
2021-07-31 16:43:01 +00:00
|
|
|
size: [60, 30],
|
|
|
|
style: {
|
|
|
|
stroke: '#333',
|
|
|
|
fill: '#95e1d3'
|
2021-08-30 15:57:05 +00:00
|
|
|
},
|
|
|
|
indexOptions: {
|
|
|
|
index: { position: 'bottom' },
|
|
|
|
indexTop: { position: 'top' }
|
2021-07-31 16:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
marker: {
|
|
|
|
headExternal: {
|
|
|
|
type: 'pointer',
|
|
|
|
anchor: 3,
|
|
|
|
style: {
|
|
|
|
fill: '#f08a5d'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: {
|
|
|
|
type: 'pointer',
|
|
|
|
anchor: 0,
|
|
|
|
style: {
|
|
|
|
fill: '#f08a5d'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
behavior: {
|
|
|
|
dragNode: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
layout(elements) {
|
|
|
|
let arr = elements;
|
|
|
|
|
|
|
|
for(let i = 0; i < arr.length; i++) {
|
|
|
|
let width = arr[i].get('size')[0];
|
|
|
|
|
|
|
|
if(i > 0) {
|
|
|
|
arr[i].set('x', arr[i - 1].get('x') + width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|