tycho-components 0.2.0-SNAPSHOT-21 → 0.2.0-SNAPSHOT-23

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.
@@ -1,6 +1,6 @@
1
1
  import { Struct, Token } from '../../configs/types/Struct';
2
2
  import { CytoscapeTreeCalculation } from './NodeCalculation';
3
- declare class CytoscapeTreeConverter {
3
+ export default class CytoscapeTreeConverter {
4
4
  private ID_SPLITTER;
5
5
  private extraInfo;
6
6
  execute(struct: Struct, extraInfo: boolean): CytoscapeTreeCalculation | undefined;
@@ -26,4 +26,3 @@ declare class CytoscapeTreeConverter {
26
26
  private sortTokens;
27
27
  private uuid;
28
28
  }
29
- export default CytoscapeTreeConverter;
@@ -1,6 +1,6 @@
1
1
  import CytoscapePositionCalculator from './CytoscapePositionCalculator';
2
2
  import TreeLayout from './TreeLayout';
3
- class CytoscapeTreeConverter {
3
+ export default class CytoscapeTreeConverter {
4
4
  constructor() {
5
5
  this.ID_SPLITTER = '|';
6
6
  this.extraInfo = false;
@@ -89,14 +89,15 @@ class CytoscapeTreeConverter {
89
89
  this.convertChunk(tree, struct, chunk);
90
90
  this.removeTemporaryEdges(tree, struct, chunk);
91
91
  }
92
- struct.tokens
93
- .filter((t) => t.ec)
94
- .forEach((t) => {
95
- const associated = struct.chunks.find((c) => this.isEmptyCategoryInChunk(c, t));
96
- if (associated) {
97
- this.convertEmptyCategory(tree, associated, t);
98
- }
99
- });
92
+ struct.tokens &&
93
+ struct.tokens
94
+ .filter((t) => t.ec)
95
+ .forEach((t) => {
96
+ const associated = struct.chunks.find((c) => this.isEmptyCategoryInChunk(c, t));
97
+ if (associated) {
98
+ this.convertEmptyCategory(tree, associated, t);
99
+ }
100
+ });
100
101
  }
101
102
  isEmptyCategoryInChunk(chunk, token) {
102
103
  if (chunk.l !== token.l)
@@ -137,7 +138,7 @@ class CytoscapeTreeConverter {
137
138
  id: nodeId,
138
139
  data: {
139
140
  id: nodeId,
140
- label: this.getLabelValue(chunk.t, chunk.coidx),
141
+ label: this.getLabelValue(chunk.t, chunk.coidx, chunk.ep),
141
142
  chunk: { ...chunk },
142
143
  },
143
144
  });
@@ -232,7 +233,7 @@ class CytoscapeTreeConverter {
232
233
  id: rootId,
233
234
  data: {
234
235
  id: rootId,
235
- label: this.getLabelValue(chunkRoot.t, chunkRoot.coidx),
236
+ label: this.getLabelValue(chunkRoot.t, chunkRoot.coidx, chunkRoot.ep),
236
237
  chunk: chunkRoot,
237
238
  },
238
239
  };
@@ -307,14 +308,14 @@ class CytoscapeTreeConverter {
307
308
  const tokens = this.sortTokens(struct.tokens);
308
309
  return tokens.slice(ti - 1, tf);
309
310
  }
310
- getLabelValue(value, coidx) {
311
+ getLabelValue(value, coidx, ep) {
311
312
  let idxLabel = '';
312
313
  if (coidx) {
313
314
  for (const idx of coidx) {
314
- idxLabel += `-${idx.toString()}`;
315
+ idxLabel += `${ep ? '=' : '-'}${idx.toString()}`;
315
316
  }
316
317
  }
317
- return value ?? '' + idxLabel;
318
+ return (value || '') + idxLabel;
318
319
  }
319
320
  getChunksByLevel(struct, chunk, level) {
320
321
  return struct.chunks.filter((c) => c.l === chunk.l - level);
@@ -337,4 +338,3 @@ class CytoscapeTreeConverter {
337
338
  });
338
339
  }
339
340
  }
340
- export default CytoscapeTreeConverter;
@@ -114,7 +114,7 @@ export const structExample = {
114
114
  v: '*T*',
115
115
  l: 4,
116
116
  ec: true,
117
- coidx: [1],
117
+ coidx: [1, 2],
118
118
  },
119
119
  {
120
120
  splits: [
@@ -222,7 +222,7 @@ export const structExample = {
222
222
  f: 5,
223
223
  t: 'WNP',
224
224
  l: 3,
225
- coidx: [1],
225
+ coidx: [1, 2],
226
226
  },
227
227
  {
228
228
  i: 6,
package/dist/index.d.ts CHANGED
@@ -56,3 +56,4 @@ export { default as SyntreesCytoscape } from './TreeView/cytoscape/SyntreesCytos
56
56
  export { default as VirtualKeyboard } from './VirtualKeyboard';
57
57
  export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
58
58
  export type { KeyboardLayout } from './VirtualKeyboard/KeyboardCustomLayout';
59
+ export { default as CytoscapeTreeConverter } from './TreeView/cytoscape/CytoscapeTreeConverter';
package/dist/index.js CHANGED
@@ -42,3 +42,4 @@ export { default as TreeView } from './TreeView';
42
42
  export { default as SyntreesCytoscape } from './TreeView/cytoscape/SyntreesCytoscape';
43
43
  export { default as VirtualKeyboard } from './VirtualKeyboard';
44
44
  export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
45
+ export { default as CytoscapeTreeConverter } from './TreeView/cytoscape/CytoscapeTreeConverter';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.2.0-SNAPSHOT-21",
4
+ "version": "0.2.0-SNAPSHOT-23",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {