2021-07-31 16:43:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 07:46:18 +00:00
|
|
|
SV.registerLayout('Array', {
|
2021-07-31 16:43:01 +00:00
|
|
|
|
|
|
|
sourcesPreprocess(sources) {
|
|
|
|
const firstElement = sources[0];
|
|
|
|
|
2021-12-15 11:51:41 +00:00
|
|
|
if (firstElement.external) {
|
2021-07-31 16:43:01 +00:00
|
|
|
firstElement.headExternal = firstElement.external;
|
|
|
|
delete firstElement.external;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sources;
|
|
|
|
},
|
|
|
|
|
|
|
|
defineOptions() {
|
|
|
|
return {
|
2021-12-15 11:51:41 +00:00
|
|
|
node: {
|
2021-07-31 16:43:01 +00:00
|
|
|
default: {
|
2021-12-15 11:51:41 +00:00
|
|
|
type: 'array-node',
|
2021-08-30 15:57:05 +00:00
|
|
|
label: '[id]',
|
2021-07-31 16:43:01 +00:00
|
|
|
size: [60, 30],
|
2021-12-14 11:07:27 +00:00
|
|
|
labelOptions: {
|
|
|
|
style: { fontSize: 20 }
|
|
|
|
},
|
2021-07-31 16:43:01 +00:00
|
|
|
style: {
|
|
|
|
stroke: '#333',
|
|
|
|
fill: '#95e1d3'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
marker: {
|
|
|
|
headExternal: {
|
|
|
|
type: 'pointer',
|
|
|
|
anchor: 3,
|
|
|
|
style: {
|
|
|
|
fill: '#f08a5d'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: {
|
|
|
|
type: 'pointer',
|
|
|
|
anchor: 0,
|
|
|
|
style: {
|
|
|
|
fill: '#f08a5d'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-12-14 11:07:27 +00:00
|
|
|
indexLabel: {
|
|
|
|
index: { position: 'bottom' },
|
|
|
|
indexRight: { position: 'right' }
|
2021-07-31 16:43:01 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
layout(elements) {
|
|
|
|
let arr = elements;
|
|
|
|
|
2021-12-15 11:51:41 +00:00
|
|
|
for (let i = 0; i < arr.length; i++) {
|
2021-07-31 16:43:01 +00:00
|
|
|
let width = arr[i].get('size')[0];
|
|
|
|
|
2021-12-15 11:51:41 +00:00
|
|
|
if (i > 0) {
|
2021-07-31 16:43:01 +00:00
|
|
|
arr[i].set('x', arr[i - 1].get('x') + width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-15 11:51:41 +00:00
|
|
|
});
|
2021-07-31 16:43:01 +00:00
|
|
|
|