修改哈希数值disable的样式
This commit is contained in:
parent
b3060b0e27
commit
391ccff882
@ -1,17 +1,14 @@
|
||||
|
||||
|
||||
|
||||
SV.registerLayout('HashTable', {
|
||||
|
||||
sourcesPreprocess(sources) {
|
||||
const firstElement = sources[0];
|
||||
|
||||
if(firstElement.external) {
|
||||
if (firstElement.external) {
|
||||
firstElement.headExternal = firstElement.external;
|
||||
delete firstElement.external;
|
||||
}
|
||||
|
||||
if(firstElement.cursor) {
|
||||
if (firstElement.cursor) {
|
||||
firstElement.headCursor = firstElement.cursor;
|
||||
delete firstElement.cursor;
|
||||
}
|
||||
@ -21,9 +18,9 @@ SV.registerLayout('HashTable', {
|
||||
|
||||
defineOptions() {
|
||||
return {
|
||||
element: {
|
||||
element: {
|
||||
default: {
|
||||
type: 'indexed-node',
|
||||
type: 'array-node',
|
||||
label: '[data]',
|
||||
size: [60, 30],
|
||||
style: {
|
||||
@ -71,25 +68,29 @@ SV.registerLayout('HashTable', {
|
||||
layout(elements) {
|
||||
let arr = elements;
|
||||
|
||||
for(let i = 0; i < arr.length; i++) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let width = arr[i].get('size')[0];
|
||||
|
||||
if(i > 0) {
|
||||
if (i > 0) {
|
||||
arr[i].set('x', arr[i - 1].get('x') + width);
|
||||
}
|
||||
|
||||
if(arr[i].empty) {
|
||||
if (arr[i].empty) {
|
||||
arr[i].set('style', {
|
||||
fill: null
|
||||
});
|
||||
}
|
||||
|
||||
if(arr[i].disable) {
|
||||
if (arr[i].disable) {
|
||||
arr[i].set('style', {
|
||||
fill: '#ccc'
|
||||
fill: null
|
||||
});
|
||||
arr[i].set('labelCfg', {
|
||||
style: {
|
||||
opacity: 0.4
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
165
demo/data.js
165
demo/data.js
@ -1,120 +1,45 @@
|
||||
const SOURCES_DATA = [
|
||||
{
|
||||
LinkList0: {
|
||||
data: [
|
||||
{
|
||||
id: '0x617eb0',
|
||||
data: 'Z',
|
||||
next: '0x617ef0',
|
||||
rootExternal: ['L'],
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617ef0',
|
||||
data: 'A',
|
||||
next: '0x617f10',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f10',
|
||||
data: 'B',
|
||||
next: '0x617f30',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f30',
|
||||
data: 'C',
|
||||
external: ['r', 't'],
|
||||
next: null,
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
layouter: 'LinkList',
|
||||
},
|
||||
LinkList1: {
|
||||
data: [
|
||||
{
|
||||
id: '0x617ed0',
|
||||
data: 'Y',
|
||||
next: '0x617f50',
|
||||
rootExternal: ['L2'],
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f50',
|
||||
data: 'a',
|
||||
next: '0x617f70',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f70',
|
||||
data: 'b',
|
||||
external: ['r2', 't2'],
|
||||
loopNext: 'LinkList0#0x617f30',
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
layouter: 'LinkList',
|
||||
},
|
||||
isEnterFunction: false,
|
||||
},
|
||||
{
|
||||
LinkList0: {
|
||||
data: [
|
||||
{
|
||||
id: '0x617eb0',
|
||||
data: 'Z',
|
||||
next: '0x617ef0',
|
||||
rootExternal: ['L'],
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617ef0',
|
||||
data: 'A',
|
||||
next: '0x617f10',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f10',
|
||||
data: 'B',
|
||||
next: '0x617f30',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f30',
|
||||
data: 'C',
|
||||
external: ['r', 't'],
|
||||
next: null,
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
layouter: 'LinkList',
|
||||
},
|
||||
LinkList1: {
|
||||
data: [
|
||||
{
|
||||
id: '0x617ed0',
|
||||
data: 'Y',
|
||||
next: '0x617f50',
|
||||
rootExternal: ['L2'],
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f50',
|
||||
data: 'a',
|
||||
next: '0x617f70',
|
||||
type: 'default',
|
||||
},
|
||||
{
|
||||
id: '0x617f70',
|
||||
data: 'b',
|
||||
external: ['r2', 't2'],
|
||||
next: null,
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
layouter: 'LinkList',
|
||||
},
|
||||
isEnterFunction: false,
|
||||
},
|
||||
];
|
||||
const SOURCES_DATA = [{
|
||||
"HashTable": {
|
||||
"data": [{
|
||||
"id": "0x616eb0",
|
||||
"index": 0,
|
||||
"external": "H",
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
},
|
||||
{
|
||||
"id": "0x616ec0",
|
||||
"index": 1,
|
||||
"data": "UV",
|
||||
"disable": true,
|
||||
},
|
||||
{
|
||||
"id": "0x616ed0",
|
||||
"index": 2,
|
||||
"data": "FI"
|
||||
},
|
||||
{
|
||||
"id": "0x616ee0",
|
||||
"index": 3,
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
},
|
||||
{
|
||||
"id": "0x616ef0",
|
||||
"index": 4,
|
||||
"data": "SO"
|
||||
},
|
||||
{
|
||||
"id": "0x616f00",
|
||||
"index": 5,
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
}
|
||||
],
|
||||
"layouter": "HashTable"
|
||||
},
|
||||
"isEnterFunction": false
|
||||
}];
|
||||
@ -41,7 +41,7 @@ export class SVNode extends SVModel {
|
||||
|
||||
this.sourceNode = sourceNode;
|
||||
this.sourceId = sourceNode.id.toString();
|
||||
|
||||
|
||||
this.links = { inDegree: [], outDegree: [] };
|
||||
this.appendages = {};
|
||||
this.sourceNode = sourceNode;
|
||||
@ -64,7 +64,6 @@ export class SVNode extends SVModel {
|
||||
label: this.label as string,
|
||||
style: {
|
||||
...style,
|
||||
fill: this.disable ? '#ccc' : style.fill,
|
||||
},
|
||||
labelCfg: Util.objectClone<NodeLabelOption>(options.labelOptions),
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"target": "ES2015",
|
||||
"module": "commonJS",
|
||||
"removeComments": true,
|
||||
"lib": ["DOM", "ES2015", "ES2016"]
|
||||
"lib": ["DOM", "ES2015", "ES2016", "ES2017"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user