@linkurious/ogma-linkurious-parser 2.10.16 → 3.0.5

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.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Ogma-Linkurious Parser is an official library maintained by the Linkurious team
10
10
 
11
11
  # Installation
12
12
 
13
- `npm install @linkurious/ogma-linkurious-parser`
13
+ ````npm install @linkurious/ogma-linkurious-parser````
14
14
 
15
15
  # Usage
16
16
 
@@ -22,12 +22,12 @@ var Captions = /** @class */ (function () {
22
22
  : Captions.generateEdgeCaption(itemData, schema) || null;
23
23
  }
24
24
  if (itemData.properties !== undefined) {
25
- var heuristicCaption = Object.keys(itemData.properties).find(function (k) {
26
- return tools_1.CAPTION_HEURISTIC.includes(k);
25
+ var heuristicCaptionElement = tools_1.CAPTION_HEURISTIC.find(function (value) {
26
+ return itemData.properties[value] !== undefined;
27
27
  });
28
- if (heuristicCaption !== undefined &&
29
- tools_1.Tools.isDefined(itemData.properties[heuristicCaption])) {
30
- return ("" + tools_1.Tools.getValueFromLkProperty(itemData.properties[heuristicCaption])).trim();
28
+ if (heuristicCaptionElement !== undefined &&
29
+ tools_1.Tools.isDefined(itemData.properties[heuristicCaptionElement])) {
30
+ return ("" + tools_1.Tools.getValueFromLkProperty(itemData.properties[heuristicCaptionElement])).trim();
31
31
  }
32
32
  }
33
33
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../src/captions/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;AAUb,wCAAwD;AAExD;IAAA;IA+GA,CAAC;IA9GC;;OAEG;IACW,gBAAO,GAArB,UACE,QAAiC,EACjC,MAA0B;QAE1B,IAAM,KAAK,GAAG,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/E,IAAI,QAAQ,C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TIC, Tools} from '../tools/tools';\n\nexport class Captions {\n /**\n * Return label for each node\n */\n public static getText(\n itemData: LkNodeData | LkEdgeData,\n schema: ItemFieldsCaptions\n ): string | null {\n const types = 'categories' in itemData ? itemData.categories : [itemData.type];\n if (Captions.captionExist(types, schema)) {\n return 'categories' in itemData\n ? Captions.generateNodeCaption(itemData, schema) || null\n : Captions.generateEdgeCaption(itemData, schema) || null;\n }\n if (itemData.properties !== undefined) {\n const heuristicCaption = Object.keys(itemData.properties).find((k) =>\n CAPTION_HEURISTIC.includes(k)\n );\n if (\n heuristicCaption !== undefined &&\n Tools.isDefined(itemData.properties[heuristicCaption])\n ) {\n return `${Tools.getValueFromLkProperty(itemData.properties[heuristicCaption])}`.trim();\n }\n }\n return null;\n }\n\n /**\n * Return a readable string from an LkProperty\n */\n private static getLabel(propertyValue: LkProperty): string | null {\n if (typeof propertyValue === 'object' && 'type' in propertyValue) {\n if (!('original' in propertyValue) && !('value' in propertyValue)) {\n return null;\n }\n if ('original' in propertyValue) {\n return `${propertyValue.original}`;\n }\n if ('value' in propertyValue) {\n return Tools.formatDate(\n new Date(\n new Date(propertyValue.value).getTime() +\n Tools.timezoneToMilliseconds(propertyValue.timezone)\n ).toISOString()\n );\n }\n }\n return `${propertyValue}`.trim();\n }\n\n /**\n * Return true if caption configuration exists in schema\n */\n public static captionExist(itemTypes: Array<string>, schema: ItemFieldsCaptions): boolean {\n return itemTypes.some((type) => Tools.isDefined(schema[type]));\n }\n\n /**\n * Generate text from node data and captions schema\n */\n public static generateNodeCaption(\n itemData: LkNodeData,\n schema: {[key: string]: ICaptionConfig}\n ): string {\n const categories = itemData.categories;\n const caption: Array<string | null> = [];\n let captionProps: Array<string | null> = [];\n categories.forEach((category) => {\n if (schema[category] && schema[category].active) {\n if (schema[category].displayName) {\n caption.push(category);\n }\n captionProps = [...captionProps, ...schema[category].properties];\n }\n });\n Tools.uniqBy(captionProps).forEach((propertyKey) => {\n if (itemData.properties[propertyKey] !== undefined) {\n caption.push(this.getLabel(itemData.properties[propertyKey]));\n }\n });\n return caption\n .filter((c) => c !== null)\n .join(' - ')\n .trim();\n }\n\n /**\n * Generate text from edge data and captions schema\n */\n public static generateEdgeCaption(\n itemData: LkEdgeData,\n schema: {[key: string]: ICaptionConfig}\n ): string {\n const type = itemData.type;\n const caption: Array<string | null> = [];\n let captionProps: Array<string | null> = [];\n if (schema[type] && schema[type].active) {\n if (schema[type].displayName) {\n caption.push(type);\n }\n captionProps = [...captionProps, ...schema[type].properties];\n Tools.uniqBy(captionProps).forEach((propertyKey) => {\n if (Tools.isDefined(itemData.properties[propertyKey])) {\n caption.push(Captions.getLabel(itemData.properties[propertyKey]));\n }\n });\n return caption.join(' - ').trim();\n }\n return '';\n }\n}\n"]}
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../src/captions/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;AAUb,wCAAwD;AAExD;IAAA;IAiHA,CAAC;IAhHC;;OAEG;IACW,gBAAO,GAArB,UACE,QAAiC,EACjC,MAA0B;QAE1B,IAAM,KAAK,GAAG,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/E,IAAI,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACxC,OAAO,YAAY,IAAI,QAAQ;gBAC7B,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,IAAI;gBACxD,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC;SAC5D;QACD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE;YACrC,IAAM,uBAAuB,GAAG,yBAAiB,CAAC,IAAI,CAAC,UAAC,KAAK;gBAC3D,OAAO,QAAQ,CAAC,UAAU,CAAC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M,EAAE;YACvC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;gBAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACpB;YACD,YAAY,kBAAO,YAAY,EAAK,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;YAC7D,aAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAC,WAAW;gBAC7C,IAAI,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE;oBACrD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;iBACnE;YACH,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;SACnC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,eAAC;AAAD,CAAC,AAjHD,IAiHC;AAjHY,4BAAQ","sourcesContent":["'use strict';\n\nimport {\n ICaptionConfig,\n ItemFieldsCaptions,\n LkEdgeData,\n LkNodeData,\n LkProperty\n} from '@linkurious/rest-client';\n\nimport {CAPTION_HEURISTIC, Tools} from '../tools/tools';\n\nexport class Captions {\n /**\n * Return label for each node\n */\n public static getText(\n itemData: LkNodeData | LkEdgeData,\n schema: ItemFieldsCaptions\n ): string | null {\n const types = 'categories' in itemData ? itemData.categories : [itemData.type];\n if (Captions.captionExist(types, schema)) {\n return 'categories' in itemData\n ? Captions.generateNodeCaption(itemData, schema) || null\n : Captions.generateEdgeCaption(itemData, schema) || null;\n }\n if (itemData.properties !== undefined) {\n const heuristicCaptionElement = CAPTION_HEURISTIC.find((value) => {\n return itemData.properties[value] !== undefined;\n });\n if (\n heuristicCaptionElement !== undefined &&\n Tools.isDefined(itemData.properties[heuristicCaptionElement])\n ) {\n return `${Tools.getValueFromLkProperty(\n itemData.properties[heuristicCaptionElement]\n )}`.trim();\n }\n }\n return null;\n }\n\n /**\n * Return a readable string from an LkProperty\n */\n private static getLabel(propertyValue: LkProperty): string | null {\n if (typeof propertyValue === 'object' && 'type' in propertyValue) {\n if (!('original' in propertyValue) && !('value' in propertyValue)) {\n return null;\n }\n if ('original' in propertyValue) {\n return `${propertyValue.original}`;\n }\n if ('value' in propertyValue) {\n return Tools.formatDate(\n new Date(\n new Date(propertyValue.value).getTime() +\n Tools.timezoneToMilliseconds(propertyValue.timezone)\n ).toISOString()\n );\n }\n }\n return `${propertyValue}`.trim();\n }\n\n /**\n * Return true if caption configuration exists in schema\n */\n public static captionExist(itemTypes: Array<string>, schema: ItemFieldsCaptions): boolean {\n return itemTypes.some((type) => Tools.isDefined(schema[type]));\n }\n\n /**\n * Generate text from node data and captions schema\n */\n public static generateNodeCaption(\n itemData: LkNodeData,\n schema: {[key: string]: ICaptionConfig}\n ): string {\n const categories = itemData.categories;\n const caption: Array<string | null> = [];\n let captionProps: Array<string | null> = [];\n categories.forEach((category) => {\n if (schema[category] && schema[category].active) {\n if (schema[category].displayName) {\n caption.push(category);\n }\n captionProps = [...captionProps, ...schema[category].properties];\n }\n });\n Tools.uniqBy(captionProps).forEach((propertyKey) => {\n if (itemData.properties[propertyKey] !== undefined) {\n caption.push(this.getLabel(itemData.properties[propertyKey]));\n }\n });\n return caption\n .filter((c) => c !== null)\n .join(' - ')\n .trim();\n }\n\n /**\n * Generate text from edge data and captions schema\n */\n public static generateEdgeCaption(\n itemData: LkEdgeData,\n schema: {[key: string]: ICaptionConfig}\n ): string {\n const type = itemData.type;\n const caption: Array<string | null> = [];\n let captionProps: Array<string | null> = [];\n if (schema[type] && schema[type].active) {\n if (schema[type].displayName) {\n caption.push(type);\n }\n captionProps = [...captionProps, ...schema[type].properties];\n Tools.uniqBy(captionProps).forEach((propertyKey) => {\n if (Tools.isDefined(itemData.properties[propertyKey])) {\n caption.push(Captions.getLabel(itemData.properties[propertyKey]));\n }\n });\n return caption.join(' - ').trim();\n }\n return '';\n }\n}\n"]}
@@ -21,20 +21,20 @@ var Filters = /** @class */ (function () {
21
21
  return false;
22
22
  }
23
23
  if ('categories' in itemData) {
24
- return this.getFilterFunction(filterRules, true)(itemData);
24
+ return Filters.getFilterFunction(filterRules, true)(itemData);
25
25
  }
26
26
  else {
27
- return this.getFilterFunction(filterRules, false)(itemData);
27
+ return Filters.getFilterFunction(filterRules, false)(itemData);
28
28
  }
29
29
  };
30
30
  Filters.getFilterFunction = function (filterRules, isNode) {
31
31
  var filterKey = JSON.stringify(filterRules, null, '');
32
32
  // This cast is needed to tell the TypeScript compiler to trust us that "isNode" and "T" are dependent.
33
- var filterCache = (isNode ? this.nodeCache : this.edgeCache);
33
+ var filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache);
34
34
  var filterFunc = filterCache.get(filterKey);
35
35
  if (!filterFunc) {
36
- filterFunc = this.createFilterFunction(filterRules, isNode);
37
- if (filterCache.size > this.FILTER_CACHE_SIZE) {
36
+ filterFunc = Filters.createFilterFunction(filterRules, isNode);
37
+ if (filterCache.size > Filters.FILTER_CACHE_SIZE) {
38
38
  filterCache.clear();
39
39
  }
40
40
  filterCache.set(filterKey, filterFunc);
@@ -42,9 +42,8 @@ var Filters = /** @class */ (function () {
42
42
  return filterFunc;
43
43
  };
44
44
  Filters.createFilterFunction = function (filterRules, isNode) {
45
- var _this = this;
46
45
  var filterFunctions = filterRules.map(function (filter) {
47
- return _this.filterToFilterFunction(filter, isNode);
46
+ return Filters.filterToFilterFunction(filter, isNode);
48
47
  });
49
48
  /**
50
49
  * For each filterFunction, as soon as we find a filterFunction that says that a given
@@ -63,15 +62,15 @@ var Filters = /** @class */ (function () {
63
62
  Filters.filterToFilterFunction = function (filter, isNode) {
64
63
  switch (filter.type) {
65
64
  case rest_client_1.SelectorType.ANY:
66
- return this.createAnyFilterFunction(filter, isNode);
65
+ return Filters.createAnyFilterFunction(filter, isNode);
67
66
  case rest_client_1.SelectorType.IS:
68
- return this.createIsFilterFunction(filter, isNode);
67
+ return Filters.createIsFilterFunction(filter, isNode);
69
68
  case rest_client_1.SelectorType.NO_VALUE:
70
- return this.createNoValueFilterFunction(filter, isNode);
69
+ return Filters.createNoValueFilterFunction(filter, isNode);
71
70
  case rest_client_1.SelectorType.RANGE:
72
- return this.createRangeFilterFunction(filter, isNode);
71
+ return Filters.createRangeFilterFunction(filter, isNode);
73
72
  case rest_client_1.SelectorType.NAN:
74
- return this.createNaNFilterFunction(filter, isNode);
73
+ return Filters.createNaNFilterFunction(filter, isNode);
75
74
  }
76
75
  };
77
76
  Filters.createAnyFilterFunction = function (filter, isNode) {
@@ -119,18 +118,17 @@ var Filters = /** @class */ (function () {
119
118
  }
120
119
  };
121
120
  Filters.createNaNFilterFunction = function (filter, isNode) {
122
- var _this = this;
123
121
  if (isNode) {
124
122
  return function (itemData) {
125
123
  return itemData.categories.includes(filter.itemType) &&
126
- _this.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
124
+ Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
127
125
  };
128
126
  }
129
127
  else {
130
128
  // isEdge
131
129
  return function (itemData) {
132
130
  return itemData.type === filter.itemType &&
133
- _this.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
131
+ Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
134
132
  };
135
133
  }
136
134
  };
@@ -138,18 +136,17 @@ var Filters = /** @class */ (function () {
138
136
  return tools_1.Tools.isDefined(value) && !tools_1.Tools.isNumber(value);
139
137
  };
140
138
  Filters.createRangeFilterFunction = function (filter, isNode) {
141
- var _this = this;
142
139
  if (isNode) {
143
140
  return function (itemData) {
144
141
  return itemData.categories.includes(filter.itemType) &&
145
- _this.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true), filter.value);
142
+ Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true), filter.value);
146
143
  };
147
144
  }
148
145
  else {
149
146
  // isEdge
150
147
  return function (itemData) {
151
148
  return itemData.type === filter.itemType &&
152
- _this.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true), filter.value);
149
+ Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true), filter.value);
153
150
  };
154
151
  }
155
152
  };
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/filters/filters.ts"],"names":[],"mappings":";;AAAA,uDAYiC;AAEjC,wCAAqC;AAIrC;IAAA;IAyNA,CAAC;IApNC;;;;;;;;;;OAUG;IACW,kBAAU,GAAxB,UACE,WAAgC,EAChC,QAAiC;QAEjC,IAAI,CAAC,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,IAAI,YAAY,IAAI,QAAQ,EAAE;YAC5B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC5D;aAAM;YACL,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC7D;IACH,CAAC;IAEc,yBAAiB,GAAhC,UACE,WAAgC,EAChC,MAAe;QAEf,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAExD,uGAAuG;QACvG,IAAM,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAG5D,CAAC;QAEF,IAAI,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5C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AC/C,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAChD,CAAC;IACJ,CAAC;IAvNc,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;IAC/D,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;IAC/D,yBAAiB,GAAG,CAAC,CAAC;IAsNvC,cAAC;CAAA,AAzND,IAyNC;AAzNY,0BAAO","sourcesContent":["import {\n ItemSelector,\n LkEdgeData,\n LkNodeData,\n IRangeValues,\n SelectorType,\n ISelectorAny,\n ISelectorIs,\n ISelectorNoValue,\n ISelectorNaN,\n ISelectorRange,\n LkItemData\n} from '@linkurious/rest-client';\n\nimport {Tools} from '../tools/tools';\n\ntype FilterFunction<T extends LkItemData> = (itemData: T) => boolean;\n\nexport class Filters {\n private static nodeCache: Map<string, FilterFunction<LkNodeData>> = new Map();\n private static edgeCache: Map<string, FilterFunction<LkEdgeData>> = new Map();\n private static FILTER_CACHE_SIZE = 5;\n\n /**\n * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).\n *\n * Notes:\n * 1. `filterRules` are rules that match what should be filtered/hidden.\n * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for\n * an item, the item can be hidden/filtered.\n *\n * @param filterRules\n * @param itemData\n */\n public static isFiltered(\n filterRules: Array<ItemSelector>,\n itemData: LkNodeData | LkEdgeData\n ): boolean {\n if (!Tools.isDefined(itemData)) {\n return false;\n }\n\n if ('categories' in itemData) {\n return this.getFilterFunction(filterRules, true)(itemData);\n } else {\n return this.getFilterFunction(filterRules, false)(itemData);\n }\n }\n\n private static getFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterKey = JSON.stringify(filterRules, null, '');\n\n // This cast is needed to tell the TypeScript compiler to trust us that \"isNode\" and \"T\" are dependent.\n const filterCache = (isNode ? this.nodeCache : this.edgeCache) as Map<\n string,\n FilterFunction<T>\n >;\n\n let filterFunc = filterCache.get(filterKey);\n if (!filterFunc) {\n filterFunc = this.createFilterFunction(filterRules, isNode);\n if (filterCache.size > this.FILTER_CACHE_SIZE) {\n filterCache.clear();\n }\n filterCache.set(filterKey, filterFunc);\n }\n return filterFunc;\n }\n\n private static createFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterFunctions = filterRules.map((filter: ItemSelector) =>\n this.filterToFilterFunction(filter, isNode)\n );\n\n /**\n * For each filterFunction, as soon as we find a filterFunction that says that a given\n * node/edge should be filtered/hidden, we return `true` for the node/edge.\n */\n return (itemData: T): boolean => {\n for (const filterFunction of filterFunctions) {\n if (filterFunction(itemData)) {\n return true;\n }\n }\n return false;\n };\n }\n\n private static filterToFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ItemSelector,\n isNode: boolean\n ): FilterFunction<T> {\n switch (filter.type) {\n case SelectorType.ANY:\n return this.createAnyFilterFunction(filter, isNode);\n case SelectorType.IS:\n return this.createIsFilterFunction(filter, isNode);\n case SelectorType.NO_VALUE:\n return this.createNoValueFilterFunction(filter, isNode);\n case SelectorType.RANGE:\n return this.createRangeFilterFunction(filter, isNode);\n case SelectorType.NAN:\n return this.createNaNFilterFunction(filter, isNode);\n }\n }\n\n private static createAnyFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorAny,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) => {\n if (filter.itemType === undefined) {\n return true;\n }\n return (itemData as LkNodeData).categories.includes(filter.itemType);\n };\n } else {\n // isEdge\n return (itemData: T) => (itemData as LkEdgeData).type === filter.itemType;\n }\n }\n\n private static createIsFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorIs,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n }\n }\n\n private static createNoValueFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNoValue,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static createNaNFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNaN,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n this.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n this.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static isNotANumber(value: any) {\n return Tools.isDefined(value) && !Tools.isNumber(value);\n }\n\n public static createRangeFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorRange,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n this.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true),\n filter.value\n );\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n this.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true),\n filter.value\n );\n }\n }\n\n /**\n * Returns true if `value` should be filtered/hidden.\n *\n * `range` describes what should be filtered/hidden:\n * - e.g. {\"<\":10, \">=\":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[\n * - e.g. {\"<=\":10} => hide any value in ]-inf, 10]\n * - e.g. {\">=\":20} => hide any value in [20, +inf[\n *\n * Returns false (i.e. will not filter/hide) if `value` is not a number.\n */\n public static valueShouldBeHidden(value: unknown, range: IRangeValues): boolean {\n const n = Tools.parseFloat(value);\n if (Number.isNaN(n)) {\n return false;\n }\n\n /**\n * As soon as we find a condition that says that `value` should be filtered/hidden,\n * we return `true`.\n *\n * If `range` contains multiple conditions, all are checked and if any condition causes\n * `value` to be in the filtered/hidden range, we return `true`.\n *\n * If no condition causes `value` to be filtered/hidden, we return `false`.\n */\n return (\n (range['<'] !== undefined && n < range['<']) ||\n (range['<='] !== undefined && n <= range['<=']) ||\n (range['>'] !== undefined && n > range['>']) ||\n (range['>='] !== undefined && n >= range['>='])\n );\n }\n}\n"]}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/filters/filters.ts"],"names":[],"mappings":";;AAAA,uDAYiC;AAEjC,wCAAqC;AAIrC;IAAA;IAyNA,CAAC;IApNC;;;;;;;;;;OAUG;IACW,kBAAU,GAAxB,UACE,WAAgC,EAChC,QAAiC;QAEjC,IAAI,CAAC,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,IAAI,YAAY,IAAI,QAAQ,EAAE;YAC5B,OAAO,OAAO,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC/D;aAAM;YACL,OAAO,OAAO,CAAC,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;SAChE;IACH,CAAC;IAEc,yBAAiB,GAAhC,UACE,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C,CAAC,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC;SACd;QAED;;;;;;;;WAQG;QACH,OAAO,CACL,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAChD,CAAC;IACJ,CAAC;IAvNc,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;IAC/D,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;IAC/D,yBAAiB,GAAG,CAAC,CAAC;IAsNvC,cAAC;CAAA,AAzND,IAyNC;AAzNY,0BAAO","sourcesContent":["import {\n ItemSelector,\n LkEdgeData,\n LkNodeData,\n IRangeValues,\n SelectorType,\n ISelectorAny,\n ISelectorIs,\n ISelectorNoValue,\n ISelectorNaN,\n ISelectorRange,\n LkItemData\n} from '@linkurious/rest-client';\n\nimport {Tools} from '../tools/tools';\n\ntype FilterFunction<T extends LkItemData> = (itemData: T) => boolean;\n\nexport class Filters {\n private static nodeCache: Map<string, FilterFunction<LkNodeData>> = new Map();\n private static edgeCache: Map<string, FilterFunction<LkEdgeData>> = new Map();\n private static FILTER_CACHE_SIZE = 5;\n\n /**\n * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).\n *\n * Notes:\n * 1. `filterRules` are rules that match what should be filtered/hidden.\n * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for\n * an item, the item can be hidden/filtered.\n *\n * @param filterRules\n * @param itemData\n */\n public static isFiltered(\n filterRules: Array<ItemSelector>,\n itemData: LkNodeData | LkEdgeData\n ): boolean {\n if (!Tools.isDefined(itemData)) {\n return false;\n }\n\n if ('categories' in itemData) {\n return Filters.getFilterFunction(filterRules, true)(itemData);\n } else {\n return Filters.getFilterFunction(filterRules, false)(itemData);\n }\n }\n\n private static getFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterKey = JSON.stringify(filterRules, null, '');\n\n // This cast is needed to tell the TypeScript compiler to trust us that \"isNode\" and \"T\" are dependent.\n const filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache) as Map<\n string,\n FilterFunction<T>\n >;\n\n let filterFunc = filterCache.get(filterKey);\n if (!filterFunc) {\n filterFunc = Filters.createFilterFunction(filterRules, isNode);\n if (filterCache.size > Filters.FILTER_CACHE_SIZE) {\n filterCache.clear();\n }\n filterCache.set(filterKey, filterFunc);\n }\n return filterFunc;\n }\n\n private static createFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterFunctions = filterRules.map((filter: ItemSelector) =>\n Filters.filterToFilterFunction(filter, isNode)\n );\n\n /**\n * For each filterFunction, as soon as we find a filterFunction that says that a given\n * node/edge should be filtered/hidden, we return `true` for the node/edge.\n */\n return (itemData: T): boolean => {\n for (const filterFunction of filterFunctions) {\n if (filterFunction(itemData)) {\n return true;\n }\n }\n return false;\n };\n }\n\n private static filterToFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ItemSelector,\n isNode: boolean\n ): FilterFunction<T> {\n switch (filter.type) {\n case SelectorType.ANY:\n return Filters.createAnyFilterFunction(filter, isNode);\n case SelectorType.IS:\n return Filters.createIsFilterFunction(filter, isNode);\n case SelectorType.NO_VALUE:\n return Filters.createNoValueFilterFunction(filter, isNode);\n case SelectorType.RANGE:\n return Filters.createRangeFilterFunction(filter, isNode);\n case SelectorType.NAN:\n return Filters.createNaNFilterFunction(filter, isNode);\n }\n }\n\n private static createAnyFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorAny,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) => {\n if (filter.itemType === undefined) {\n return true;\n }\n return (itemData as LkNodeData).categories.includes(filter.itemType);\n };\n } else {\n // isEdge\n return (itemData: T) => (itemData as LkEdgeData).type === filter.itemType;\n }\n }\n\n private static createIsFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorIs,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n }\n }\n\n private static createNoValueFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNoValue,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static createNaNFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNaN,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static isNotANumber(value: any) {\n return Tools.isDefined(value) && !Tools.isNumber(value);\n }\n\n public static createRangeFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorRange,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true),\n filter.value\n );\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true),\n filter.value\n );\n }\n }\n\n /**\n * Returns true if `value` should be filtered/hidden.\n *\n * `range` describes what should be filtered/hidden:\n * - e.g. {\"<\":10, \">=\":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[\n * - e.g. {\"<=\":10} => hide any value in ]-inf, 10]\n * - e.g. {\">=\":20} => hide any value in [20, +inf[\n *\n * Returns false (i.e. will not filter/hide) if `value` is not a number.\n */\n public static valueShouldBeHidden(value: unknown, range: IRangeValues): boolean {\n const n = Tools.parseFloat(value);\n if (Number.isNaN(n)) {\n return false;\n }\n\n /**\n * As soon as we find a condition that says that `value` should be filtered/hidden,\n * we return `true`.\n *\n * If `range` contains multiple conditions, all are checked and if any condition causes\n * `value` to be in the filtered/hidden range, we return `true`.\n *\n * If no condition causes `value` to be filtered/hidden, we return `false`.\n */\n return (\n (range['<'] !== undefined && n < range['<']) ||\n (range['<='] !== undefined && n <= range['<=']) ||\n (range['>'] !== undefined && n > range['>']) ||\n (range['>='] !== undefined && n >= range['>='])\n );\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { Edge, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, ItemId, EdgeStyle, PixelSize, EdgeExtremity, EdgeType, GeoModeOptions } from 'ogma';
2
- import { Captions } from './captions/captions';
3
- import { ItemAttributes, BASE_GREY } from './styles/itemAttributes';
4
- import { EdgeAttributes } from './styles/edgeAttributes';
5
- import { NodeAttributes } from './styles/nodeAttributes';
6
- import { StyleRule, StyleRuleType } from './styles/styleRule';
7
- import { StyleRules, StyleType, Legend } from './styles/styleRules';
8
- import { StylesViz, StylesConfig, FILTER_OPACITY } from './ogma/features/styles';
9
- import { TransformationsViz } from './ogma/features/transformations';
10
- import { CaptionsViz, CaptionState } from './ogma/features/captions';
11
- import { OgmaState } from './ogma/features/reactive';
12
- import { OgmaTools, HTML_COLORS } from './tools/ogmaTool';
13
- import { Filters } from './filters/filters';
14
- import { getSelectionSize, getSelectionState, getSelectionEntity, getUniqSelection, getUniqSelectionTypes, getUniqSelectionEntity, getSelectionProperties, hasSelectionProperties } from './ogma/features/selectors';
15
- import { LKOgma, ANIMATION_DURATION } from './ogma';
16
- export { GeoModeOptions, EdgeType, EdgeExtremity, PixelSize, EdgeStyle, ItemId, StyleRuleType, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, Edge, Captions, EdgeAttributes, NodeAttributes, StyleRule, StyleRules, LKOgma, ANIMATION_DURATION, StylesViz, TransformationsViz, StylesConfig, FILTER_OPACITY, CaptionsViz, CaptionState, getSelectionSize, getSelectionState, getSelectionEntity, getUniqSelection, getUniqSelectionTypes, getUniqSelectionEntity, getSelectionProperties, hasSelectionProperties, BASE_GREY, StyleType, ItemAttributes, Legend, OgmaTools, HTML_COLORS, Filters, OgmaState };
1
+ export { Edge, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, ItemId, EdgeStyle, PixelSize, EdgeExtremity, EdgeType, GeoModeOptions } from 'ogma';
2
+ export { Captions } from './captions/captions';
3
+ export { ItemAttributes, BASE_GREY } from './styles/itemAttributes';
4
+ export { EdgeAttributes } from './styles/edgeAttributes';
5
+ export { NodeAttributes } from './styles/nodeAttributes';
6
+ export { StyleRule, StyleRuleType } from './styles/styleRule';
7
+ export { StyleRules, StyleType, Legend } from './styles/styleRules';
8
+ export { StylesViz, StylesConfig, FILTER_OPACITY } from './ogma/features/styles';
9
+ export { TransformationsViz } from './ogma/features/transformations';
10
+ export { CaptionsViz, CaptionState } from './ogma/features/captions';
11
+ export { OgmaState } from './ogma/features/reactive';
12
+ export { OgmaTools } from './tools/ogmaTool';
13
+ export { HTML_COLORS } from './tools/colorPalette';
14
+ export { Filters } from './filters/filters';
15
+ export { getSelectionSize, getSelectionState, getSelectionEntity, getUniqSelection, getUniqSelectionTypes, getUniqSelectionEntity, getSelectionProperties, hasSelectionProperties } from './ogma/features/selectors';
16
+ export { LKOgma, ANIMATION_DURATION } from './ogma';
package/dist/index.js CHANGED
@@ -29,7 +29,8 @@ var captions_2 = require("./ogma/features/captions");
29
29
  exports.CaptionsViz = captions_2.CaptionsViz;
30
30
  var ogmaTool_1 = require("./tools/ogmaTool");
31
31
  exports.OgmaTools = ogmaTool_1.OgmaTools;
32
- exports.HTML_COLORS = ogmaTool_1.HTML_COLORS;
32
+ var colorPalette_1 = require("./tools/colorPalette");
33
+ exports.HTML_COLORS = colorPalette_1.HTML_COLORS;
33
34
  var filters_1 = require("./filters/filters");
34
35
  exports.Filters = filters_1.Filters;
35
36
  var selectors_1 = require("./ogma/features/selectors");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,6BAkBc;AA4CZ,eA7DA,WAAI,CA6DA;AAVJ,mBAlDA,eAAQ,CAkDA;AACR,eAlDA,WAAI,CAkDA;AACJ,mBAlDA,eAAQ,CAkDA;AAlCV,gDAA6C;AA2C3C,mBA3CM,mBAAQ,CA2CN;AA1CV,0DAAkE;AAiEhE,yBAjEM,+BAAc,CAiEN;AAFd,oBA/DsB,0BAAS,CA+DtB;AA9DX,0DAAuD;AA0CrD,yBA1CM,+BAAc,CA0CN;AAzChB,0DAAuD;AA0CrD,yBA1CM,+BAAc,CA0CN;AAzChB,gDAA4D;AA0C1D,oBA1CM,qBAAS,CA0CN;AAfT,wBA3BiB,yBAAa,CA2BjB;AA1Bf,kDAAkE;AA0ChE,qBA1CM,uBAAU,CA0CN;AAkBV,oBA5DkB,sBAAS,CA4DlB;AA3DX,iDAA+E;AA4C7E,oBA5CM,kBAAS,CA4CN;AAGT,yBA/C+B,uBAAc,CA+C/B;AA9ChB,mEAAmE;AA4CjE,6BA5CM,oCAAkB,CA4CN;AA3CpB,qDAAmE;AA8CjE,sBA9CM,sBAAW,CA8CN;AA5Cb,6CAAwD;AA0DtD,oBA1DM,oBAAS,CA0DN;AACT,sBA3DiB,sBAAW,CA2DjB;AA1Db,6CAA0C;AA2DxC,kBA3DM,iBAAO,CA2DN;AA1DT,uDASmC;AAmCjC,2BA3CA,4BAAgB,CA2CA;AAChB,4BA3CA,6BAAiB,CA2CA;AACjB,6BA3CA,8BAAkB,CA2CA;AAClB,2BA3CA,4BAAgB,CA2CA;AAChB,gCA3CA,iCAAqB,CA2CA;AACrB,iCA3CA,kCAAsB,CA2CA;AACtB,iCA3CA,kCAAsB,CA2CA;AACtB,iCA3CA,kCAAsB,CA2CA;AAzCxB,+BAAkD;AA0BhD,iBA1BM,aAAM,CA0BN;AACN,6BA3Bc,yBAAkB,CA2Bd","sourcesContent":["'use strict';\n\nimport {\n Edge,\n EdgeList,\n Node,\n NodeList,\n EdgeId,\n NodeId,\n RawEdge,\n RawItem,\n RawNode,\n PropertyPath,\n Item,\n ItemId,\n EdgeStyle,\n PixelSize,\n EdgeExtremity,\n EdgeType,\n GeoModeOptions\n} from 'ogma';\n\nimport {Captions} from './captions/captions';\nimport {ItemAttributes, BASE_GREY} from './styles/itemAttributes';\nimport {EdgeAttributes} from './styles/edgeAttributes';\nimport {NodeAttributes} from './styles/nodeAttributes';\nimport {StyleRule, StyleRuleType} from './styles/styleRule';\nimport {StyleRules, StyleType, Legend} from './styles/styleRules';\nimport {StylesViz, StylesConfig, FILTER_OPACITY} from './ogma/features/styles';\nimport {TransformationsViz} from './ogma/features/transformations';\nimport {CaptionsViz, CaptionState} from './ogma/features/captions';\nimport {OgmaState} from './ogma/features/reactive';\nimport {OgmaTools, HTML_COLORS} from './tools/ogmaTool';\nimport {Filters} from './filters/filters';\nimport {\n getSelectionSize,\n getSelectionState,\n getSelectionEntity,\n getUniqSelection,\n getUniqSelectionTypes,\n getUniqSelectionEntity,\n getSelectionProperties,\n hasSelectionProperties\n} from './ogma/features/selectors';\nimport {LKOgma, ANIMATION_DURATION} from './ogma';\n\nexport {\n GeoModeOptions,\n EdgeType,\n EdgeExtremity,\n PixelSize,\n EdgeStyle,\n ItemId,\n StyleRuleType,\n EdgeList,\n Node,\n NodeList,\n EdgeId,\n NodeId,\n RawEdge,\n RawItem,\n RawNode,\n PropertyPath,\n Item,\n Edge,\n Captions,\n EdgeAttributes,\n NodeAttributes,\n StyleRule,\n StyleRules,\n LKOgma,\n ANIMATION_DURATION,\n StylesViz,\n TransformationsViz,\n StylesConfig,\n FILTER_OPACITY,\n CaptionsViz,\n CaptionState,\n getSelectionSize,\n getSelectionState,\n getSelectionEntity,\n getUniqSelection,\n getUniqSelectionTypes,\n getUniqSelectionEntity,\n getSelectionProperties,\n hasSelectionProperties,\n BASE_GREY,\n StyleType,\n ItemAttributes,\n Legend,\n OgmaTools,\n HTML_COLORS,\n Filters,\n OgmaState\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,6BAkBc;AAjBZ,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AACR,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AAgBV,gDAA6C;AAArC,8BAAA,QAAQ,CAAA;AAChB,0DAAkE;AAA1D,0CAAA,cAAc,CAAA;AAAE,qCAAA,SAAS,CAAA;AACjC,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,gDAA4D;AAApD,gCAAA,SAAS,CAAA;AAAE,oCAAA,aAAa,CAAA;AAChC,kDAAkE;AAA1D,kCAAA,UAAU,CAAA;AAAE,iCAAA,SAAS,CAAA;AAC7B,iDAA+E;AAAvE,6BAAA,SAAS,CAAA;AAAgB,kCAAA,cAAc,CAAA;AAC/C,mEAAmE;AAA3D,+CAAA,kBAAkB,CAAA;AAC1B,qDAAmE;AAA3D,iCAAA,WAAW,CAAA;AAEnB,6CAA2C;AAAnC,+BAAA,SAAS,CAAA;AACjB,qDAAiD;AAAzC,qCAAA,WAAW,CAAA;AACnB,6CAA0C;AAAlC,4BAAA,OAAO,CAAA;AACf,uDASmC;AARjC,uCAAA,gBAAgB,CAAA;AAChB,wCAAA,iBAAiB,CAAA;AACjB,yCAAA,kBAAkB,CAAA;AAClB,uCAAA,gBAAgB,CAAA;AAChB,4CAAA,qBAAqB,CAAA;AACrB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AAExB,+BAAkD;AAA1C,wBAAA,MAAM,CAAA;AAAE,oCAAA,kBAAkB,CAAA","sourcesContent":["'use strict';\n\nexport {\n Edge,\n EdgeList,\n Node,\n NodeList,\n EdgeId,\n NodeId,\n RawEdge,\n RawItem,\n RawNode,\n PropertyPath,\n Item,\n ItemId,\n EdgeStyle,\n PixelSize,\n EdgeExtremity,\n EdgeType,\n GeoModeOptions\n} from 'ogma';\n\nexport {Captions} from './captions/captions';\nexport {ItemAttributes, BASE_GREY} from './styles/itemAttributes';\nexport {EdgeAttributes} from './styles/edgeAttributes';\nexport {NodeAttributes} from './styles/nodeAttributes';\nexport {StyleRule, StyleRuleType} from './styles/styleRule';\nexport {StyleRules, StyleType, Legend} from './styles/styleRules';\nexport {StylesViz, StylesConfig, FILTER_OPACITY} from './ogma/features/styles';\nexport {TransformationsViz} from './ogma/features/transformations';\nexport {CaptionsViz, CaptionState} from './ogma/features/captions';\nexport {OgmaState} from './ogma/features/reactive';\nexport {OgmaTools} from './tools/ogmaTool';\nexport {HTML_COLORS} from './tools/colorPalette';\nexport {Filters} from './filters/filters';\nexport {\n getSelectionSize,\n getSelectionState,\n getSelectionEntity,\n getUniqSelection,\n getUniqSelectionTypes,\n getUniqSelectionEntity,\n getSelectionProperties,\n hasSelectionProperties\n} from './ogma/features/selectors';\nexport {LKOgma, ANIMATION_DURATION} from './ogma';\n"]}
@@ -42,6 +42,10 @@ var EDGE_HALO_CONFIGURATION = {
42
42
  scalingMethod: 'scaled',
43
43
  width: 4
44
44
  };
45
+ var DEFAULT_OGMA_FONT = "'roboto', sans-serif";
46
+ var DARK_FONT_COLOR = '#000';
47
+ var CLEAR_FONT_COLOR = '#FFF';
48
+ var ITEM_DEFAULT_COLOR = '#7f7f7f';
45
49
  exports.FILTER_OPACITY = 0.2;
46
50
  var StylesViz = /** @class */ (function () {
47
51
  function StylesViz(ogma, configuration) {
@@ -95,7 +99,7 @@ var StylesViz = /** @class */ (function () {
95
99
  icon: {
96
100
  minVisibleSize: 15
97
101
  },
98
- color: '#7f7f7f',
102
+ color: ITEM_DEFAULT_COLOR,
99
103
  shape: this._defaultConfiguration.node.shape !== undefined
100
104
  ? this._defaultConfiguration.node.shape
101
105
  : 'circle',
@@ -147,7 +151,7 @@ var StylesViz = /** @class */ (function () {
147
151
  shape: this._defaultConfiguration.edge.shape !== undefined
148
152
  ? this._defaultConfiguration.edge.shape
149
153
  : 'arrow',
150
- color: '#7f7f7f'
154
+ color: ITEM_DEFAULT_COLOR
151
155
  }
152
156
  });
153
157
  };
@@ -340,12 +344,14 @@ var StylesViz = /** @class */ (function () {
340
344
  topRight: function (node) {
341
345
  if (node !== undefined) {
342
346
  var degree = tools_1.Tools.getHiddenNeighbors(node.toList());
343
- var badgeContent = tools_1.Tools.shortenNumber(degree);
347
+ var badgeContent = tools_1.Tools.formatNumber(degree);
344
348
  if (degree > 0) {
345
349
  var nodeColor = Array.isArray(node.getAttribute('color'))
346
350
  ? node.getAttribute('color')[0]
347
351
  : node.getAttribute('color');
348
- var textColor = __1.OgmaTools.isBright(nodeColor) ? '#000' : '#FFF';
352
+ var textColor = __1.OgmaTools.isBright(nodeColor)
353
+ ? DARK_FONT_COLOR
354
+ : CLEAR_FONT_COLOR;
349
355
  var isSupernode = node.getData(['statistics', 'supernode']);
350
356
  var content = null;
351
357
  if (+badgeContent !== 0) {
@@ -362,7 +368,7 @@ var StylesViz = /** @class */ (function () {
362
368
  font: _this._defaultConfiguration.node.text !== undefined &&
363
369
  _this._defaultConfiguration.node.text.font !== undefined
364
370
  ? _this._defaultConfiguration.node.text.font
365
- : "'roboto', sans-serif",
371
+ : DEFAULT_OGMA_FONT,
366
372
  scale: 0.4,
367
373
  color: textColor,
368
374
  content: content
@@ -383,7 +389,9 @@ var StylesViz = /** @class */ (function () {
383
389
  var nodeColor = Array.isArray(node.getAttribute('color'))
384
390
  ? node.getAttribute('color')[0]
385
391
  : node.getAttribute('color');
386
- var textColor = __1.OgmaTools.isBright(nodeColor) ? '#000' : '#FFF';
392
+ var textColor = __1.OgmaTools.isBright(nodeColor)
393
+ ? DARK_FONT_COLOR
394
+ : CLEAR_FONT_COLOR;
387
395
  return {
388
396
  color: 'inherit',
389
397
  minVisibleSize: 20,
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/ogma/features/styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAgBb,2BASe;AACf,2CAAwC;AAYxC,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;IACvB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACv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AK,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC9C,cAAc,EAAE;oBACd,KAAK,EAAE,UAAC,IAAwB;wBAC9B,IAAI,IAAI,KAAK,SAAS,EAAE;4BACtB,OAAO,KAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;yBACnD;oBACH,CAAC;iBACF;gBACD,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAC;aACvC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC/B;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AAvrBD,IAurBC;AAvrBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from 'ogma';\nimport {Edge, EdgeAttributesValue, NodeAttributesValue, StyleClass, StyleRule} from 'ogma';\nimport {\n GenericObject,\n IEdgeStyle,\n INodeStyle,\n IStyleRule,\n LkEdgeData,\n LkNodeData,\n OgmaEdgeShape,\n OgmaNodeShape,\n TextOptions\n} from '@linkurious/rest-client';\n\nimport {\n BASE_GREY,\n EdgeAttributes,\n LKOgma,\n NodeAttributes,\n OgmaTools,\n StyleRule as LKStyleRule,\n StyleRules,\n StyleType\n} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface StylesConfig {\n nodeColorStyleRules: Array<LKStyleRule>;\n nodeIconStyleRules: Array<LKStyleRule>;\n nodeSizeStyleRules: Array<LKStyleRule>;\n nodeShapeStyleRules?: Array<LKStyleRule>;\n edgeColorStyleRules: Array<LKStyleRule>;\n edgeWidthStyleRules: Array<LKStyleRule>;\n edgeShapeStyleRules?: Array<LKStyleRule>;\n}\n\nconst HOVERED_SELECTED_NODE_STYLE: NodeAttributesValue<LkNodeData, LkEdgeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outerStroke: {width: 2},\n outline: false\n};\n\nconst HOVERED_SELECTED_EDGE_STYLE: EdgeAttributesValue<LkEdgeData, LkNodeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outline: false\n};\n\nconst NODE_HALO_CONFIGURATION = {\n color: '#FFF',\n width: 7,\n scalingMethod: 'scaled',\n strokeWidth: 0,\n hideNonAdjacentEdges: false\n} as {\n color: '#FFF';\n width: 7;\n strokeWidth: 0;\n};\n\nconst EDGE_HALO_CONFIGURATION = {\n color: '#FFF',\n scalingMethod: 'scaled',\n width: 4\n} as {\n color: '#FFF';\n width: 4;\n};\n\nexport const FILTER_OPACITY = 0.2;\n\nexport class StylesViz {\n private _ogma: LKOgma;\n private _exportClass!: StyleClass;\n private _nodeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _nodeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n private _edgeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _edgeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n\n private _nodeAttributes: NodeAttributes = new NodeAttributes({});\n private _edgeAttributes: EdgeAttributes = new EdgeAttributes({});\n\n private _ogmaNodeColor!: StyleRule;\n private _ogmaNodeIcon!: StyleRule;\n private _ogmaNodeSize!: StyleRule;\n private _ogmaNodeShape!: StyleRule;\n private _ogmaEdgeColor!: StyleRule;\n private _ogmaEdgeWidth!: StyleRule;\n private _ogmaEdgeShape!: StyleRule;\n private _defaultConfiguration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n };\n\n constructor(\n ogma: LKOgma,\n configuration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n }\n ) {\n this._ogma = ogma;\n this._defaultConfiguration = configuration;\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n // setting default styles\n this._nodeDefaultStylesRules = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.minVisibleSize\n ? this._defaultConfiguration.node.text.minVisibleSize\n : 12,\n maxLineLength:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.maxLineLength !== undefined\n ? this._defaultConfiguration.node.text.maxLineLength\n : 30,\n position:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.nodePosition !== undefined\n ? this._defaultConfiguration.node.text.nodePosition\n : 'bottom',\n backgroundColor:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.backgroundColor !== undefined\n ? this._defaultConfiguration.node.text.backgroundColor\n : 'null',\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.color !== undefined\n ? this._defaultConfiguration.node.text.color\n : 'black',\n size:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.size !== undefined\n ? this._defaultConfiguration.node.text.size\n : 14,\n margin: 5\n },\n radius: this.defaultNodeRadius(this._defaultConfiguration.node),\n icon: {\n minVisibleSize: 15\n },\n color: '#7f7f7f',\n shape:\n this._defaultConfiguration.node.shape !== undefined\n ? this._defaultConfiguration.node.shape\n : ('circle' as OgmaNodeShape),\n innerStroke: {\n width: 3\n },\n outline: false\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n // setting default styles\n this._edgeDefaultStylesRules = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.minVisibleSize\n ? this._defaultConfiguration.edge.text.minVisibleSize\n : 3,\n maxLineLength:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.maxLineLength !== undefined\n ? this._defaultConfiguration.edge.text.maxLineLength\n : 30,\n backgroundColor:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.backgroundColor !== undefined\n ? this._defaultConfiguration.edge.text.backgroundColor\n : null,\n font:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.font !== undefined\n ? this._defaultConfiguration.edge.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.edge !== undefined &&\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.color !== undefined\n ? this._defaultConfiguration.edge.text.color\n : 'black',\n size:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.size !== undefined\n ? this._defaultConfiguration.edge.text.size\n : 14\n },\n width: this.defaultEdgeWidth(this._defaultConfiguration.edge),\n shape:\n this._defaultConfiguration.edge.shape !== undefined\n ? this._defaultConfiguration.edge.shape\n : 'arrow',\n color: '#7f7f7f'\n }\n });\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultHalo(): void {\n // setting default halo style\n this._nodeDefaultHaloRules = this._ogma.styles.addRule({\n nodeSelector: (node) => node && !node.hasClass('filtered'),\n nodeAttributes: {\n halo: (node) => {\n if (\n node !== undefined &&\n (node.isSelected() ||\n node.getAdjacentNodes({}).isSelected().includes(true) ||\n node.getAdjacentEdges().isSelected().includes(true))\n ) {\n return {\n ...NODE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n } as {\n color: '#FFF';\n width: 7;\n strokeWidth: 0;\n };\n }\n return null;\n }\n },\n // recalculate the rule *only* when itself or adjacent\n // elements change their selection status\n nodeDependencies: {\n self: {\n selection: true\n },\n adjacentNodes: {\n selection: true\n },\n adjacentEdges: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultHalo(): void {\n // setting default halo styles\n this._edgeDefaultHaloRules = this._ogma.styles.addRule({\n edgeSelector: (edge: Edge) =>\n edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),\n edgeAttributes: {\n halo: (edge) => {\n if (\n edge &&\n (edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())\n ) {\n return {\n ...EDGE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n } as {\n color: '#FFF';\n width: 4;\n };\n }\n return null;\n }\n },\n // this rule will only be invoked when the selection status\n // of the edge or it's extremities is changed\n edgeDependencies: {\n self: {\n selection: true\n },\n extremities: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Return the default node radius set in configuration or 5\n *\n * @returns {number}\n */\n private defaultNodeRadius(styles: any): number {\n return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;\n }\n\n /**\n * Return the default edge width set in configuration or 1\n *\n * @returns {number}\n */\n private defaultEdgeWidth(styles: any): number {\n return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;\n }\n\n /**\n * Check if a style property exists in the default styles object\n */\n private defaultStylesHas(styles: GenericObject<unknown>, propertyPath: Array<string>): boolean {\n if (!Tools.isDefined(styles)) {\n return false;\n }\n return Tools.getIn(styles, propertyPath) !== undefined;\n }\n\n /**\n * Set styles for the class \"filtered\"\n */\n public setFilterClass(): void {\n this._ogma.styles.createClass({\n name: 'filtered',\n nodeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n badges: {\n topRight: {\n text: null\n },\n bottomRight: {\n text: null\n }\n },\n text: null,\n color: 'rgb(240, 240, 240)',\n innerStroke: {\n width: 1,\n color: BASE_GREY,\n minVisibleSize: 1\n },\n shape: 'circle',\n image: null,\n icon: null,\n radius: '100%'\n },\n edgeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n text: null,\n color: BASE_GREY,\n shape: 'line',\n width: 0.2\n }\n });\n }\n\n /**\n * Set the class for exported nodes and edges\n */\n public setExportClass(textWrappingLength?: boolean): void {\n if (!this._exportClass) {\n this._exportClass = this._ogma.styles.createClass({\n name: 'exported',\n nodeAttributes: {\n text: {\n minVisibleSize: 0,\n font: 'arial',\n backgroundColor: null,\n maxLineLength: textWrappingLength ? 30 : 0,\n scale: 0.3,\n margin: 0,\n scaling: true,\n tip: false\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n scale: 3.0,\n scaling: true,\n font: 'arial',\n backgroundColor: null,\n minVisibleSize: 0,\n size: 3,\n margin: 0\n },\n halo: null,\n shape: 'tapered'\n }\n });\n } else {\n this._exportClass.update({\n nodeAttributes: {\n text: {\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n }\n });\n }\n }\n\n /**\n * Set the rule to display badges\n */\n public setBadgeRule() {\n this._ogma.styles.createClass({\n name: 'degreeIndicator',\n nodeAttributes: {\n badges: {\n topRight: (node) => {\n if (node !== undefined) {\n const degree = Tools.getHiddenNeighbors(node.toList());\n const badgeContent = Tools.shortenNumber(degree);\n if (degree > 0) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color) ? '#000' : '#FFF';\n const isSupernode = node.getData(['statistics', 'supernode']);\n let content = null;\n if (+badgeContent !== 0) {\n content = isSupernode ? badgeContent + '+' : badgeContent;\n }\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : \"'roboto', sans-serif\",\n scale: 0.4,\n color: textColor,\n content: content\n }\n };\n }\n }\n }\n }\n }\n });\n this._ogma.styles.createClass({\n name: 'pinnedIndicator',\n nodeAttributes: {\n badges: {\n bottomRight: (node) => {\n if (node !== undefined && !node.getAttribute('layoutable')) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color) ? '#000' : '#FFF';\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font: 'FontAwesome',\n scale: 0.4,\n color: textColor,\n content: node.getAttribute('layoutable') ? null : '\\uf08d'\n }\n };\n }\n }\n }\n },\n nodeDependencies: {\n self: {attributes: ['layoutable']}\n }\n });\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('degreeIndicator'));\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('pinnedIndicator'));\n }\n\n /**\n * Delete the rule to display badges\n */\n public deleteBadgeRule() {\n this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);\n }\n\n /**\n * set text overlap to true or false\n *\n * @param {boolean} overlap\n */\n public toggleTextOverlap(overlap?: boolean): void {\n this._ogma.setOptions({texts: {preventOverlap: overlap}});\n }\n\n /**\n * refresh nodes and edge rules\n *\n */\n public refreshRules(): void {\n this._nodeDefaultStylesRules.refresh();\n this._edgeDefaultStylesRules.refresh();\n }\n\n /**\n * Create / refresh an ogma rule for node colors\n */\n public refreshNodeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeColor)) {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor = this._ogma.styles.addRule({\n nodeAttributes: {\n color: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.color(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor.refresh();\n // TODO refresh node icons when moving the code from LKE\n // this.refreshIconsColor();\n }\n }\n\n /**\n * Return an array of StyleRules with only the style that need to be applied\n */\n public getStyleRule(\n state: Array<IStyleRule<INodeStyle | IEdgeStyle>>,\n styleType: StyleType\n ): LKStyleRule[] {\n return new StyleRules(state)[styleType];\n }\n\n public initNodeColors(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeColorRules = this.getStyleRule(nodeRules, StyleType.COLOR);\n this.refreshNodeColors(nodeColorRules);\n }\n\n public initNodesIcons(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeIconsRules = this.getStyleRule(nodeRules, StyleType.ICON);\n this.refreshNodeIcons(nodeIconsRules);\n }\n\n public initNodesSizes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeSizeRules = this.getStyleRule(nodeRules, StyleType.SIZE);\n this.refreshNodeSize(nodeSizeRules);\n }\n\n public initNodesShapes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeShapesRules = this.getStyleRule(nodeRules, StyleType.SHAPE);\n this.refreshNodeShape(nodeShapesRules);\n }\n\n public initEdgesWidth(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesWidthRules = this.getStyleRule(edgeRules, StyleType.WIDTH);\n this.refreshEdgeWidth(edgesWidthRules);\n }\n\n public initEdgesShape(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesShapeRules = this.getStyleRule(edgeRules, StyleType.SHAPE);\n this.refreshEdgeShape(edgesShapeRules);\n }\n\n public initEdgesColor(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesColorRules = this.getStyleRule(edgeRules, StyleType.COLOR);\n this.refreshEdgeColors(edgesColorRules);\n }\n\n /**\n * Create / refresh an ogma rule for node icons\n *\n * @param {Array<any>} iconStyleRules\n */\n public refreshNodeIcons(iconStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeIcon)) {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon = this._ogma.styles.addRule({\n nodeAttributes: {\n icon: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).icon;\n }\n },\n image: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).image;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node sizes\n *\n * @param {Array<any>} sizeStyleRules\n */\n public refreshNodeSize(sizeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeSize)) {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize = this._ogma.styles.addRule({\n nodeAttributes: {\n radius: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.size(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node images\n *\n * @param {Array<any>} shapeStyleRules\n */\n public refreshNodeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeShape)) {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape = this._ogma.styles.addRule({\n nodeAttributes: {\n shape: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.shape(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge colors\n */\n public refreshEdgeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeColor)) {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor = this._ogma.styles.addRule({\n edgeAttributes: {\n color: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.color(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} widthStyleRules\n */\n public refreshEdgeWidth(widthStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeWidth)) {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth = this._ogma.styles.addRule({\n edgeAttributes: {\n width: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.width(edge.getData());\n }\n }\n },\n edgeDependencies: {\n self: {data: true}\n }\n });\n } else {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} shapeStyleRules\n */\n public refreshEdgeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeShape)) {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape = this._ogma.styles.addRule({\n edgeAttributes: {\n shape: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.shape(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape.refresh();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/ogma/features/styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAgBb,2BASe;AACf,2CAAwC;AAYxC,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;IACvB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,CAAC;IACd,oBAAoB,EAAE,KAAK;CAK5B,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,CAAC;CAIT,CAAC;AAEF,IAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,IAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,IAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,IAAM,kBAAkB,GAAG,SAAS,CAAC;AACxB,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC;IAmCE,mBACE,IAAY,EACZ,aAaC;QAxCK,oBAAe,GAAmB,IAAI,kBAAc,CAAC,EAAE,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CAAC;SAC/B;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AAprBD,IAorBC;AAprBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from 'ogma';\nimport {Edge, EdgeAttributesValue, NodeAttributesValue, StyleClass, StyleRule} from 'ogma';\nimport {\n GenericObject,\n IEdgeStyle,\n INodeStyle,\n IStyleRule,\n LkEdgeData,\n LkNodeData,\n OgmaEdgeShape,\n OgmaNodeShape,\n TextOptions\n} from '@linkurious/rest-client';\n\nimport {\n BASE_GREY,\n EdgeAttributes,\n LKOgma,\n NodeAttributes,\n OgmaTools,\n StyleRule as LKStyleRule,\n StyleRules,\n StyleType\n} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface StylesConfig {\n nodeColorStyleRules: Array<LKStyleRule>;\n nodeIconStyleRules: Array<LKStyleRule>;\n nodeSizeStyleRules: Array<LKStyleRule>;\n nodeShapeStyleRules?: Array<LKStyleRule>;\n edgeColorStyleRules: Array<LKStyleRule>;\n edgeWidthStyleRules: Array<LKStyleRule>;\n edgeShapeStyleRules?: Array<LKStyleRule>;\n}\n\nconst HOVERED_SELECTED_NODE_STYLE: NodeAttributesValue<LkNodeData, LkEdgeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outerStroke: {width: 2},\n outline: false\n};\n\nconst HOVERED_SELECTED_EDGE_STYLE: EdgeAttributesValue<LkEdgeData, LkNodeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outline: false\n};\n\nconst NODE_HALO_CONFIGURATION = {\n color: '#FFF',\n width: 7,\n scalingMethod: 'scaled',\n strokeWidth: 0,\n hideNonAdjacentEdges: false\n} as {\n color: '#FFF';\n width: 7;\n strokeWidth: 0;\n};\n\nconst EDGE_HALO_CONFIGURATION = {\n color: '#FFF',\n scalingMethod: 'scaled',\n width: 4\n} as {\n color: '#FFF';\n width: 4;\n};\n\nconst DEFAULT_OGMA_FONT = \"'roboto', sans-serif\";\nconst DARK_FONT_COLOR = '#000';\nconst CLEAR_FONT_COLOR = '#FFF';\nconst ITEM_DEFAULT_COLOR = '#7f7f7f';\nexport const FILTER_OPACITY = 0.2;\n\nexport class StylesViz {\n private _ogma: LKOgma;\n private _exportClass!: StyleClass;\n private _nodeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _nodeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n private _edgeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _edgeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n\n private _nodeAttributes: NodeAttributes = new NodeAttributes({});\n private _edgeAttributes: EdgeAttributes = new EdgeAttributes({});\n\n private _ogmaNodeColor!: StyleRule;\n private _ogmaNodeIcon!: StyleRule;\n private _ogmaNodeSize!: StyleRule;\n private _ogmaNodeShape!: StyleRule;\n private _ogmaEdgeColor!: StyleRule;\n private _ogmaEdgeWidth!: StyleRule;\n private _ogmaEdgeShape!: StyleRule;\n private _defaultConfiguration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n };\n\n constructor(\n ogma: LKOgma,\n configuration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n }\n ) {\n this._ogma = ogma;\n this._defaultConfiguration = configuration;\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n // setting default styles\n this._nodeDefaultStylesRules = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.minVisibleSize\n ? this._defaultConfiguration.node.text.minVisibleSize\n : 12,\n maxLineLength:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.maxLineLength !== undefined\n ? this._defaultConfiguration.node.text.maxLineLength\n : 30,\n position:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.nodePosition !== undefined\n ? this._defaultConfiguration.node.text.nodePosition\n : 'bottom',\n backgroundColor:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.backgroundColor !== undefined\n ? this._defaultConfiguration.node.text.backgroundColor\n : 'null',\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.color !== undefined\n ? this._defaultConfiguration.node.text.color\n : 'black',\n size:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.size !== undefined\n ? this._defaultConfiguration.node.text.size\n : 14,\n margin: 5\n },\n radius: this.defaultNodeRadius(this._defaultConfiguration.node),\n icon: {\n minVisibleSize: 15\n },\n color: ITEM_DEFAULT_COLOR,\n shape:\n this._defaultConfiguration.node.shape !== undefined\n ? this._defaultConfiguration.node.shape\n : ('circle' as OgmaNodeShape),\n innerStroke: {\n width: 3\n },\n outline: false\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n // setting default styles\n this._edgeDefaultStylesRules = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.minVisibleSize\n ? this._defaultConfiguration.edge.text.minVisibleSize\n : 3,\n maxLineLength:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.maxLineLength !== undefined\n ? this._defaultConfiguration.edge.text.maxLineLength\n : 30,\n backgroundColor:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.backgroundColor !== undefined\n ? this._defaultConfiguration.edge.text.backgroundColor\n : null,\n font:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.font !== undefined\n ? this._defaultConfiguration.edge.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.edge !== undefined &&\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.color !== undefined\n ? this._defaultConfiguration.edge.text.color\n : 'black',\n size:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.size !== undefined\n ? this._defaultConfiguration.edge.text.size\n : 14\n },\n width: this.defaultEdgeWidth(this._defaultConfiguration.edge),\n shape:\n this._defaultConfiguration.edge.shape !== undefined\n ? this._defaultConfiguration.edge.shape\n : 'arrow',\n color: ITEM_DEFAULT_COLOR\n }\n });\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultHalo(): void {\n // setting default halo style\n this._nodeDefaultHaloRules = this._ogma.styles.addRule({\n nodeSelector: (node) => node && !node.hasClass('filtered'),\n nodeAttributes: {\n halo: (node) => {\n if (\n node !== undefined &&\n (node.isSelected() ||\n node.getAdjacentNodes({}).isSelected().includes(true) ||\n node.getAdjacentEdges().isSelected().includes(true))\n ) {\n return {\n ...NODE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // recalculate the rule *only* when itself or adjacent\n // elements change their selection status\n nodeDependencies: {\n self: {\n selection: true\n },\n adjacentNodes: {\n selection: true\n },\n adjacentEdges: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultHalo(): void {\n // setting default halo styles\n this._edgeDefaultHaloRules = this._ogma.styles.addRule({\n edgeSelector: (edge: Edge) =>\n edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),\n edgeAttributes: {\n halo: (edge) => {\n if (\n edge &&\n (edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())\n ) {\n return {\n ...EDGE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // this rule will only be invoked when the selection status\n // of the edge or it's extremities is changed\n edgeDependencies: {\n self: {\n selection: true\n },\n extremities: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Return the default node radius set in configuration or 5\n *\n * @returns {number}\n */\n private defaultNodeRadius(styles: any): number {\n return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;\n }\n\n /**\n * Return the default edge width set in configuration or 1\n *\n * @returns {number}\n */\n private defaultEdgeWidth(styles: any): number {\n return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;\n }\n\n /**\n * Check if a style property exists in the default styles object\n */\n private defaultStylesHas(styles: GenericObject<unknown>, propertyPath: Array<string>): boolean {\n if (!Tools.isDefined(styles)) {\n return false;\n }\n return Tools.getIn(styles, propertyPath) !== undefined;\n }\n\n /**\n * Set styles for the class \"filtered\"\n */\n public setFilterClass(): void {\n this._ogma.styles.createClass({\n name: 'filtered',\n nodeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n badges: {\n topRight: {\n text: null\n },\n bottomRight: {\n text: null\n }\n },\n text: null,\n color: 'rgb(240, 240, 240)',\n innerStroke: {\n width: 1,\n color: BASE_GREY,\n minVisibleSize: 1\n },\n shape: 'circle',\n image: null,\n icon: null,\n radius: '100%'\n },\n edgeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n text: null,\n color: BASE_GREY,\n shape: 'line',\n width: 0.2\n }\n });\n }\n\n /**\n * Set the class for exported nodes and edges\n */\n public setExportClass(textWrappingLength?: boolean): void {\n if (!this._exportClass) {\n this._exportClass = this._ogma.styles.createClass({\n name: 'exported',\n nodeAttributes: {\n text: {\n minVisibleSize: 0,\n font: 'arial',\n backgroundColor: null,\n maxLineLength: textWrappingLength ? 30 : 0,\n scale: 0.3,\n margin: 0,\n scaling: true,\n tip: false\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n scale: 3.0,\n scaling: true,\n font: 'arial',\n backgroundColor: null,\n minVisibleSize: 0,\n size: 3,\n margin: 0\n },\n halo: null,\n shape: 'tapered'\n }\n });\n } else {\n this._exportClass.update({\n nodeAttributes: {\n text: {\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n }\n });\n }\n }\n\n /**\n * Set the rule to display badges\n */\n public setBadgeRule() {\n this._ogma.styles.createClass({\n name: 'degreeIndicator',\n nodeAttributes: {\n badges: {\n topRight: (node) => {\n if (node !== undefined) {\n const degree = Tools.getHiddenNeighbors(node.toList());\n const badgeContent = Tools.formatNumber(degree);\n if (degree > 0) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n const isSupernode = node.getData(['statistics', 'supernode']);\n let content = null;\n if (+badgeContent !== 0) {\n content = isSupernode ? badgeContent + '+' : badgeContent;\n }\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : DEFAULT_OGMA_FONT,\n scale: 0.4,\n color: textColor,\n content: content\n }\n };\n }\n }\n }\n }\n }\n });\n this._ogma.styles.createClass({\n name: 'pinnedIndicator',\n nodeAttributes: {\n badges: {\n bottomRight: (node) => {\n if (node !== undefined && !node.getAttribute('layoutable')) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font: 'FontAwesome',\n scale: 0.4,\n color: textColor,\n content: node.getAttribute('layoutable') ? null : '\\uf08d'\n }\n };\n }\n }\n }\n },\n nodeDependencies: {\n self: {attributes: ['layoutable']}\n }\n });\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('degreeIndicator'));\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('pinnedIndicator'));\n }\n\n /**\n * Delete the rule to display badges\n */\n public deleteBadgeRule() {\n this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);\n }\n\n /**\n * set text overlap to true or false\n *\n * @param {boolean} overlap\n */\n public toggleTextOverlap(overlap?: boolean): void {\n this._ogma.setOptions({texts: {preventOverlap: overlap}});\n }\n\n /**\n * refresh nodes and edge rules\n *\n */\n public refreshRules(): void {\n this._nodeDefaultStylesRules.refresh();\n this._edgeDefaultStylesRules.refresh();\n }\n\n /**\n * Create / refresh an ogma rule for node colors\n */\n public refreshNodeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeColor)) {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor = this._ogma.styles.addRule({\n nodeAttributes: {\n color: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.color(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor.refresh();\n // TODO refresh node icons when moving the code from LKE\n // this.refreshIconsColor();\n }\n }\n\n /**\n * Return an array of StyleRules with only the style that need to be applied\n */\n public getStyleRule(\n state: Array<IStyleRule<INodeStyle | IEdgeStyle>>,\n styleType: StyleType\n ): LKStyleRule[] {\n return new StyleRules(state)[styleType];\n }\n\n public initNodeColors(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeColorRules = this.getStyleRule(nodeRules, StyleType.COLOR);\n this.refreshNodeColors(nodeColorRules);\n }\n\n public initNodesIcons(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeIconsRules = this.getStyleRule(nodeRules, StyleType.ICON);\n this.refreshNodeIcons(nodeIconsRules);\n }\n\n public initNodesSizes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeSizeRules = this.getStyleRule(nodeRules, StyleType.SIZE);\n this.refreshNodeSize(nodeSizeRules);\n }\n\n public initNodesShapes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeShapesRules = this.getStyleRule(nodeRules, StyleType.SHAPE);\n this.refreshNodeShape(nodeShapesRules);\n }\n\n public initEdgesWidth(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesWidthRules = this.getStyleRule(edgeRules, StyleType.WIDTH);\n this.refreshEdgeWidth(edgesWidthRules);\n }\n\n public initEdgesShape(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesShapeRules = this.getStyleRule(edgeRules, StyleType.SHAPE);\n this.refreshEdgeShape(edgesShapeRules);\n }\n\n public initEdgesColor(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesColorRules = this.getStyleRule(edgeRules, StyleType.COLOR);\n this.refreshEdgeColors(edgesColorRules);\n }\n\n /**\n * Create / refresh an ogma rule for node icons\n *\n * @param {Array<any>} iconStyleRules\n */\n public refreshNodeIcons(iconStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeIcon)) {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon = this._ogma.styles.addRule({\n nodeAttributes: {\n icon: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).icon;\n }\n },\n image: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).image;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node sizes\n *\n * @param {Array<any>} sizeStyleRules\n */\n public refreshNodeSize(sizeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeSize)) {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize = this._ogma.styles.addRule({\n nodeAttributes: {\n radius: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.size(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node images\n *\n * @param {Array<any>} shapeStyleRules\n */\n public refreshNodeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeShape)) {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape = this._ogma.styles.addRule({\n nodeAttributes: {\n shape: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.shape(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge colors\n */\n public refreshEdgeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeColor)) {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor = this._ogma.styles.addRule({\n edgeAttributes: {\n color: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.color(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} widthStyleRules\n */\n public refreshEdgeWidth(widthStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeWidth)) {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth = this._ogma.styles.addRule({\n edgeAttributes: {\n width: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.width(edge.getData());\n }\n }\n },\n edgeDependencies: {\n self: {data: true}\n }\n });\n } else {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} shapeStyleRules\n */\n public refreshEdgeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeShape)) {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape = this._ogma.styles.addRule({\n edgeAttributes: {\n shape: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.shape(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape.refresh();\n }\n }\n}\n"]}