@linkurious/ogma-linkurious-parser 3.1.8 → 3.1.10

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,9 +1,9 @@
1
- import { ICaptionConfig, ItemFieldsCaptions, LkEdgeData, LkNodeData } from '@linkurious/rest-client';
1
+ import { GraphSchemaTypeWithAccess, ICaptionConfig, ItemFieldsCaptions, LkEdgeData, LkNodeData, PropertyType } from '@linkurious/rest-client';
2
2
  export declare class Captions {
3
3
  /**
4
4
  * Return label for each node
5
5
  */
6
- static getText(itemData: LkNodeData | LkEdgeData, schema: ItemFieldsCaptions): string | null;
6
+ static getText(itemData: LkNodeData | LkEdgeData, schema: ItemFieldsCaptions, graphSchema?: GraphSchemaTypeWithAccess[]): string | null;
7
7
  /**
8
8
  * Return a readable string from an LkProperty
9
9
  */
@@ -17,11 +17,12 @@ export declare class Captions {
17
17
  */
18
18
  static generateNodeCaption(itemData: LkNodeData, schema: {
19
19
  [key: string]: ICaptionConfig;
20
- }): string;
20
+ }, graphSchema?: GraphSchemaTypeWithAccess[]): string;
21
+ static getPropertyType(graphSchema: GraphSchemaTypeWithAccess[], propertyKey: string, itemType: string): PropertyType | undefined;
21
22
  /**
22
23
  * Generate text from edge data and captions schema
23
24
  */
24
25
  static generateEdgeCaption(itemData: LkEdgeData, schema: {
25
26
  [key: string]: ICaptionConfig;
26
- }): string;
27
+ }, graphSchema?: GraphSchemaTypeWithAccess[]): string;
27
28
  }
@@ -7,6 +7,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
7
7
  return r;
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ var rest_client_1 = require("@linkurious/rest-client");
10
11
  var tools_1 = require("../tools/tools");
11
12
  var Captions = /** @class */ (function () {
12
13
  function Captions() {
@@ -14,12 +15,12 @@ var Captions = /** @class */ (function () {
14
15
  /**
15
16
  * Return label for each node
16
17
  */
17
- Captions.getText = function (itemData, schema) {
18
+ Captions.getText = function (itemData, schema, graphSchema) {
18
19
  var types = 'categories' in itemData ? itemData.categories : [itemData.type];
19
20
  if (Captions.captionExist(types, schema)) {
20
21
  return 'categories' in itemData
21
- ? Captions.generateNodeCaption(itemData, schema) || null
22
- : Captions.generateEdgeCaption(itemData, schema) || null;
22
+ ? Captions.generateNodeCaption(itemData, schema, graphSchema) || null
23
+ : Captions.generateEdgeCaption(itemData, schema, graphSchema) || null;
23
24
  }
24
25
  if (itemData.properties !== undefined) {
25
26
  var heuristicCaptionElement = tools_1.CAPTION_HEURISTIC.find(function (value) {
@@ -35,7 +36,8 @@ var Captions = /** @class */ (function () {
35
36
  /**
36
37
  * Return a readable string from an LkProperty
37
38
  */
38
- Captions.getLabel = function (propertyValue) {
39
+ Captions.getLabel = function (propertyValue, propertyType) {
40
+ var _a;
39
41
  if (typeof propertyValue === 'object' && 'type' in propertyValue) {
40
42
  if (!('original' in propertyValue) && !('value' in propertyValue)) {
41
43
  return null;
@@ -48,6 +50,10 @@ var Captions = /** @class */ (function () {
48
50
  tools_1.Tools.timezoneToMilliseconds(propertyValue.timezone)).toISOString());
49
51
  }
50
52
  }
53
+ else if (((_a = propertyType) === null || _a === void 0 ? void 0 : _a.name) === rest_client_1.PropertyTypeName.NUMBER &&
54
+ propertyType.options !== undefined) {
55
+ return tools_1.Tools.formatCurrencyValue(propertyValue, propertyType.options);
56
+ }
51
57
  return ("" + propertyValue).trim();
52
58
  };
53
59
  /**
@@ -59,7 +65,7 @@ var Captions = /** @class */ (function () {
59
65
  /**
60
66
  * Generate text from node data and captions schema
61
67
  */
62
- Captions.generateNodeCaption = function (itemData, schema) {
68
+ Captions.generateNodeCaption = function (itemData, schema, graphSchema) {
63
69
  var _this = this;
64
70
  var categories = itemData.categories;
65
71
  var caption = [];
@@ -74,7 +80,10 @@ var Captions = /** @class */ (function () {
74
80
  });
75
81
  tools_1.Tools.uniqBy(captionProps).forEach(function (propertyKey) {
76
82
  if (itemData.properties[propertyKey] !== undefined) {
77
- caption.push(_this.getLabel(itemData.properties[propertyKey]));
83
+ var propertyType = graphSchema
84
+ ? Captions.getPropertyType(graphSchema, propertyKey, categories[0])
85
+ : undefined;
86
+ caption.push(_this.getLabel(itemData.properties[propertyKey], propertyType));
78
87
  }
79
88
  });
80
89
  return caption
@@ -82,10 +91,16 @@ var Captions = /** @class */ (function () {
82
91
  .join(' - ')
83
92
  .trim();
84
93
  };
94
+ Captions.getPropertyType = function (graphSchema, propertyKey, itemType) {
95
+ var _a, _b;
96
+ var typeGraphSchema = graphSchema.find(function (schemaType) { return schemaType.itemType === itemType; });
97
+ var property = (_a = typeGraphSchema) === null || _a === void 0 ? void 0 : _a.properties.find(function (property) { return property.propertyKey === propertyKey; });
98
+ return (_b = property) === null || _b === void 0 ? void 0 : _b.propertyType;
99
+ };
85
100
  /**
86
101
  * Generate text from edge data and captions schema
87
102
  */
88
- Captions.generateEdgeCaption = function (itemData, schema) {
103
+ Captions.generateEdgeCaption = function (itemData, schema, graphSchema) {
89
104
  var type = itemData.type;
90
105
  var caption = [];
91
106
  var captionProps = [];
@@ -96,7 +111,10 @@ var Captions = /** @class */ (function () {
96
111
  captionProps = __spreadArrays(captionProps, schema[type].properties);
97
112
  tools_1.Tools.uniqBy(captionProps).forEach(function (propertyKey) {
98
113
  if (tools_1.Tools.isDefined(itemData.properties[propertyKey])) {
99
- caption.push(Captions.getLabel(itemData.properties[propertyKey]));
114
+ var propertyType = graphSchema
115
+ ? Captions.getPropertyType(graphSchema, propertyKey, type)
116
+ : undefined;
117
+ caption.push(Captions.getLabel(itemData.properties[propertyKey], propertyType));
100
118
  }
101
119
  });
102
120
  return caption.join(' - ').trim();
@@ -1 +1 @@
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,MAA0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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"]}
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../src/captions/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;AAEb,uDAUiC;AAEjC,wCAAwD;AAExD;IAAA;IA8IA,CAAC;IA7IC;;OAEG;IACW,gBAAO,GAArB,UACE,QAAiC,EACjC,MAA0B,EAC1B,WAAyC;QAEzC,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,EAAE,WAAW,CAAC,IAAI,IAAI;gBACrE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,E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,CAAC,CAAC,OAAO,CAAC,UAAC,WAAW;gBAC7C,IAAI,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE;oBACrD,IAAM,YAAY,GAAG,WAAW;wBAC9B,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC;wBAC1D,CAAC,CAAC,SAAS,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;iBACjF;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,AA9ID,IA8IC;AA9IY,4BAAQ","sourcesContent":["'use strict';\n\nimport {\n GraphSchemaTypeWithAccess,\n ICaptionConfig,\n ItemFieldsCaptions,\n LkEdgeData,\n LkNodeData,\n LkProperty,\n PropertyType,\n PropertyTypeName,\n GraphSchemaPropertyWithAccess\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 graphSchema?: GraphSchemaTypeWithAccess[]\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, graphSchema) || null\n : Captions.generateEdgeCaption(itemData, schema, graphSchema) || 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(\n propertyValue: LkProperty,\n propertyType?: PropertyType | undefined\n ): 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 } else if (\n propertyType?.name === PropertyTypeName.NUMBER &&\n propertyType.options !== undefined\n ) {\n return Tools.formatCurrencyValue(propertyValue as number, propertyType.options);\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 graphSchema?: GraphSchemaTypeWithAccess[]\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 const propertyType = graphSchema\n ? Captions.getPropertyType(graphSchema, propertyKey, categories[0])\n : undefined;\n caption.push(this.getLabel(itemData.properties[propertyKey], propertyType));\n }\n });\n return caption\n .filter((c) => c !== null)\n .join(' - ')\n .trim();\n }\n\n public static getPropertyType(\n graphSchema: GraphSchemaTypeWithAccess[],\n propertyKey: string,\n itemType: string\n ): PropertyType | undefined {\n const typeGraphSchema = graphSchema.find((schemaType) => schemaType.itemType === itemType);\n const property = typeGraphSchema?.properties.find(\n (property) => property.propertyKey === propertyKey\n );\n return ((property as unknown) as GraphSchemaPropertyWithAccess)?.propertyType;\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 graphSchema?: GraphSchemaTypeWithAccess[]\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 const propertyType = graphSchema\n ? Captions.getPropertyType(graphSchema, propertyKey, type)\n : undefined;\n caption.push(Captions.getLabel(itemData.properties[propertyKey], propertyType));\n }\n });\n return caption.join(' - ').trim();\n }\n return '';\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { Edge, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, ItemId, EdgeStyle, PixelSize, EdgeExtremity, EdgeType, GeoModeOptions, EdgesDataEvent, NodesDataEvent, NodesDragEndEvent, NodesEvent } from '@linkurious/ogma';
2
2
  export { Captions } from './captions/captions';
3
- export { ItemAttributes, BASE_GREY } from './styles/itemAttributes';
3
+ export { ItemAttributes, BASE_GREY, PALETTE } from './styles/itemAttributes';
4
4
  export { EdgeAttributes } from './styles/edgeAttributes';
5
5
  export { NodeAttributes } from './styles/nodeAttributes';
6
6
  export { StyleRule, StyleRuleType } from './styles/styleRule';
@@ -12,5 +12,7 @@ export { OgmaState } from './ogma/features/reactive';
12
12
  export { OgmaTools } from './tools/ogmaTool';
13
13
  export { HTML_COLORS } from './tools/colorPalette';
14
14
  export { Filters } from './filters/filters';
15
+ export { OgmaStore } from './ogma/features/OgmaStore';
15
16
  export { getSelectionSize, getSelectionState, getSelectionEntity, getUniqSelection, getUniqSelectionTypes, getUniqSelectionEntity, getSelectionProperties, hasSelectionProperties } from './ogma/features/selectors';
16
17
  export { LKOgma, ANIMATION_DURATION } from './ogma';
18
+ export { Tools } from './tools/tools';
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ exports.Captions = captions_1.Captions;
10
10
  var itemAttributes_1 = require("./styles/itemAttributes");
11
11
  exports.ItemAttributes = itemAttributes_1.ItemAttributes;
12
12
  exports.BASE_GREY = itemAttributes_1.BASE_GREY;
13
+ exports.PALETTE = itemAttributes_1.PALETTE;
13
14
  var edgeAttributes_1 = require("./styles/edgeAttributes");
14
15
  exports.EdgeAttributes = edgeAttributes_1.EdgeAttributes;
15
16
  var nodeAttributes_1 = require("./styles/nodeAttributes");
@@ -33,6 +34,8 @@ var colorPalette_1 = require("./tools/colorPalette");
33
34
  exports.HTML_COLORS = colorPalette_1.HTML_COLORS;
34
35
  var filters_1 = require("./filters/filters");
35
36
  exports.Filters = filters_1.Filters;
37
+ var OgmaStore_1 = require("./ogma/features/OgmaStore");
38
+ exports.OgmaStore = OgmaStore_1.OgmaStore;
36
39
  var selectors_1 = require("./ogma/features/selectors");
37
40
  exports.getSelectionSize = selectors_1.getSelectionSize;
38
41
  exports.getSelectionState = selectors_1.getSelectionState;
@@ -45,4 +48,6 @@ exports.hasSelectionProperties = selectors_1.hasSelectionProperties;
45
48
  var ogma_2 = require("./ogma");
46
49
  exports.LKOgma = ogma_2.LKOgma;
47
50
  exports.ANIMATION_DURATION = ogma_2.ANIMATION_DURATION;
51
+ var tools_1 = require("./tools/tools");
52
+ exports.Tools = tools_1.Tools;
48
53
  //# sourceMappingURL=index.js.map
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,yCAsB0B;AArBxB,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AACR,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AAoBV,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 EdgesDataEvent,\n NodesDataEvent,\n NodesDragEndEvent,\n NodesEvent\n} from '@linkurious/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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yCAsB0B;AArBxB,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AACR,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AAoBV,gDAA6C;AAArC,8BAAA,QAAQ,CAAA;AAChB,0DAA2E;AAAnE,0CAAA,cAAc,CAAA;AAAE,qCAAA,SAAS,CAAA;AAAE,mCAAA,OAAO,CAAA;AAC1C,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,uDAAoD;AAA5C,gCAAA,SAAS,CAAA;AACjB,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;AAClC,uCAAoC;AAA5B,wBAAA,KAAK,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 EdgesDataEvent,\n NodesDataEvent,\n NodesDragEndEvent,\n NodesEvent\n} from '@linkurious/ogma';\n\nexport {Captions} from './captions/captions';\nexport {ItemAttributes, BASE_GREY, PALETTE} 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 {OgmaStore} from './ogma/features/OgmaStore';\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';\nexport {Tools} from './tools/tools';\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as Ogma from '@linkurious/ogma';
2
- import { ItemFieldsCaptions } from '@linkurious/rest-client';
2
+ import { GraphSchemaTypeWithAccess, ItemFieldsCaptions } from '@linkurious/rest-client';
3
3
  import { LKOgma } from '../..';
4
4
  export interface CaptionState {
5
5
  node: ItemFieldsCaptions;
@@ -11,8 +11,13 @@ export declare class CaptionsViz {
11
11
  nodesCaptionsRule: Ogma.StyleRule;
12
12
  edgesCaptionsRule: Ogma.StyleRule;
13
13
  private _ogma;
14
- private _schema;
14
+ private _captionSchema;
15
+ private _graphSchema;
15
16
  constructor(ogma: LKOgma, _nodeMaxTextLength: number | undefined, _edgeMaxTextLength: number | undefined);
17
+ set graphSchema(graphSchema: {
18
+ node: Array<GraphSchemaTypeWithAccess>;
19
+ edge: Array<GraphSchemaTypeWithAccess>;
20
+ });
16
21
  /**
17
22
  * Refresh the schema
18
23
  */
@@ -42,14 +42,22 @@ var CaptionsViz = /** @class */ (function () {
42
42
  function CaptionsViz(ogma, _nodeMaxTextLength, _edgeMaxTextLength) {
43
43
  this._nodeMaxTextLength = _nodeMaxTextLength;
44
44
  this._edgeMaxTextLength = _edgeMaxTextLength;
45
- this._schema = { node: {}, edge: {} };
45
+ this._captionSchema = { node: {}, edge: {} };
46
+ this._graphSchema = { node: [], edge: [] };
46
47
  this._ogma = ogma;
47
48
  }
49
+ Object.defineProperty(CaptionsViz.prototype, "graphSchema", {
50
+ set: function (graphSchema) {
51
+ this._graphSchema = graphSchema;
52
+ },
53
+ enumerable: true,
54
+ configurable: true
55
+ });
48
56
  /**
49
57
  * Refresh the schema
50
58
  */
51
59
  CaptionsViz.prototype.refreshSchema = function (schema) {
52
- this._schema = schema;
60
+ this._captionSchema = schema;
53
61
  };
54
62
  /**
55
63
  * Refresh visualization captions rules
@@ -89,7 +97,7 @@ var CaptionsViz = /** @class */ (function () {
89
97
  CaptionsViz.prototype.updateNodeCaptions = function (schema) {
90
98
  var _this = this;
91
99
  if (schema) {
92
- this._schema.node = schema;
100
+ this._captionSchema.node = schema;
93
101
  }
94
102
  if (!tools_1.Tools.isDefined(this.nodesCaptionsRule)) {
95
103
  this.nodesCaptionsRule = this._ogma.styles.addRule({
@@ -99,7 +107,7 @@ var CaptionsViz = /** @class */ (function () {
99
107
  if (node === undefined) {
100
108
  return "";
101
109
  }
102
- var value = __1.Captions.getText(node.getData(), _this._schema.node);
110
+ var value = __1.Captions.getText(node.getData(), _this._captionSchema.node, _this._graphSchema.node);
103
111
  return tools_1.Tools.isDefined(_this._nodeMaxTextLength)
104
112
  ? tools_1.Tools.truncate(value, 'middle', _this._nodeMaxTextLength)
105
113
  : value;
@@ -119,7 +127,7 @@ var CaptionsViz = /** @class */ (function () {
119
127
  CaptionsViz.prototype.updateEdgeCaptions = function (schema) {
120
128
  var _this = this;
121
129
  if (schema) {
122
- this._schema.edge = schema;
130
+ this._captionSchema.edge = schema;
123
131
  }
124
132
  if (!tools_1.Tools.isDefined(this.edgesCaptionsRule)) {
125
133
  this.edgesCaptionsRule = this._ogma.styles.addRule({
@@ -129,7 +137,7 @@ var CaptionsViz = /** @class */ (function () {
129
137
  if (edge === undefined || edge.getData() === undefined) {
130
138
  return "";
131
139
  }
132
- var value = __1.Captions.getText(edge.getData(), _this._schema.edge);
140
+ var value = __1.Captions.getText(edge.getData(), _this._captionSchema.edge, _this._graphSchema.edge);
133
141
  return tools_1.Tools.isDefined(_this._edgeMaxTextLength)
134
142
  ? tools_1.Tools.truncate(value, 'middle', _this._edgeMaxTextLength)
135
143
  : value;
@@ -1 +1 @@
1
- {"version":3,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K,CAAC,MAAM,CAAC,OAAO,CAAC;gBACjD,cAAc,EAAE;oBACd,IAAI,EAAE;wBACJ,OAAO,EAAE,UAAC,IAA2B;4BACnC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS,EAAE;gCACtD,OAAO,EAAE,CAAC;6BACX;4BACD,IAAM,KAAK,GAAG,YAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;4BAClE,OAAO,aAAK,CAAC,SAAS,CAAC,KAAI,CAAC,kBAAkB,CAAC;gCAC7C,CAAC,CAAC,aAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAI,CAAC,kBAAkB,CAAC;gCAC1D,CAAC,CAAC,KAAK,CAAC;wBACZ,CAAC;qBACF;iBACF;gBACD,YAAY,EAAE,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,EAArC,CAAqC;gBAC7D,uHAAuH;gBACvH,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,aAAa,CAAC,EAAC,EAAC;aACpE,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;SACzC;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAlGD,IAkGC;AAlGY,kCAAW","sourcesContent":["'use strict';\n\nimport * as Ogma from '@linkurious/ogma';\nimport {ItemFieldsCaptions} from '@linkurious/rest-client';\n\nimport {Captions, LKOgma} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface CaptionState {\n node: ItemFieldsCaptions;\n edge: ItemFieldsCaptions;\n}\n\nexport class CaptionsViz {\n public nodesCaptionsRule!: Ogma.StyleRule;\n public edgesCaptionsRule!: Ogma.StyleRule;\n private _ogma: LKOgma;\n private _schema: CaptionState = {node: {}, edge: {}};\n\n constructor(\n ogma: LKOgma,\n private _nodeMaxTextLength: number | undefined,\n private _edgeMaxTextLength: number | undefined\n ) {\n this._ogma = ogma;\n }\n\n /**\n * Refresh the schema\n */\n public refreshSchema(schema: CaptionState): void {\n this._schema = schema;\n }\n\n /**\n * Refresh visualization captions rules\n */\n public async initVizCaptions(schema: CaptionState): Promise<void> {\n if (this._ogma.LKCaptions.nodesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateNodeCaptions();\n } else {\n this._ogma.LKCaptions.updateNodeCaptions(schema.node);\n }\n if (this._ogma.LKCaptions.edgesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateEdgeCaptions();\n } else {\n this._ogma.LKCaptions.updateEdgeCaptions(schema.edge);\n }\n }\n\n /**\n * Create or update nodeCaptionRule\n */\n public updateNodeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.node = schema;\n }\n if (!Tools.isDefined(this.nodesCaptionsRule)) {\n this.nodesCaptionsRule = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n content: (node: Ogma.Node | undefined) => {\n if (node === undefined) {\n return ``;\n }\n const value = Captions.getText(node.getData(), this._schema.node);\n return Tools.isDefined(this._nodeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._nodeMaxTextLength)\n : value;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n return this.nodesCaptionsRule.refresh();\n }\n }\n\n /**\n * Create or update edgeCaptionRule\n */\n public updateEdgeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.edge = schema;\n }\n if (!Tools.isDefined(this.edgesCaptionsRule)) {\n this.edgesCaptionsRule = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n content: (edge: Ogma.Edge | undefined) => {\n if (edge === undefined || edge.getData() === undefined) {\n return ``;\n }\n const value = Captions.getText(edge.getData(), this._schema.edge);\n return Tools.isDefined(this._edgeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._edgeMaxTextLength)\n : value;\n }\n }\n },\n edgeSelector: (edge) => !edge.isVirtual() && edge.isVisible(),\n // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)\n edgeDependencies: {self: {data: true, attributes: ['shape.style']}}\n });\n } else {\n return this.edgesCaptionsRule.refresh();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../../src/ogma/features/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKb,2BAAuC;AACvC,2CAAwC;AAOxC;IAUE,qBACE,IAAY,EACJ,kBAAsC,EACtC,kBAAsC;QADtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QATxC,mBAAc,GAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC;QACpD,iBAAY,GAGhB,EAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC;QAOvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,sBAAW,oCAAW;aAAtB,UAAuB,WAGtB;YACC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAClC,CAAC;;;OAAA;IAED;;OAEG;IACI,mCAAa,GAApB,UAAqB,MAAoB;QACvC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;IAC/B,CAAC;IAED;;OAEG;IACU,qCAAe,GAA5B,UAA6B,MAAoB;;;;;6BAC3C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAvC,wBAAuC;wBACzC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;wBAC5C,qBAAM,IAAI,CAAC,KAAK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AC7D,uHAAuH;gBACvH,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,aAAa,CAAC,EAAC,EAAC;aACpE,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;SACzC;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AArHD,IAqHC;AArHY,kCAAW","sourcesContent":["'use strict';\n\nimport * as Ogma from '@linkurious/ogma';\nimport {GraphSchemaTypeWithAccess, ItemFieldsCaptions} from '@linkurious/rest-client';\n\nimport {Captions, LKOgma} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface CaptionState {\n node: ItemFieldsCaptions;\n edge: ItemFieldsCaptions;\n}\n\nexport class CaptionsViz {\n public nodesCaptionsRule!: Ogma.StyleRule;\n public edgesCaptionsRule!: Ogma.StyleRule;\n private _ogma: LKOgma;\n private _captionSchema: CaptionState = {node: {}, edge: {}};\n private _graphSchema: {\n node: Array<GraphSchemaTypeWithAccess>;\n edge: Array<GraphSchemaTypeWithAccess>;\n } = {node: [], edge: []};\n\n constructor(\n ogma: LKOgma,\n private _nodeMaxTextLength: number | undefined,\n private _edgeMaxTextLength: number | undefined\n ) {\n this._ogma = ogma;\n }\n\n public set graphSchema(graphSchema: {\n node: Array<GraphSchemaTypeWithAccess>;\n edge: Array<GraphSchemaTypeWithAccess>;\n }) {\n this._graphSchema = graphSchema;\n }\n\n /**\n * Refresh the schema\n */\n public refreshSchema(schema: CaptionState): void {\n this._captionSchema = schema;\n }\n\n /**\n * Refresh visualization captions rules\n */\n public async initVizCaptions(schema: CaptionState): Promise<void> {\n if (this._ogma.LKCaptions.nodesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateNodeCaptions();\n } else {\n this._ogma.LKCaptions.updateNodeCaptions(schema.node);\n }\n if (this._ogma.LKCaptions.edgesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateEdgeCaptions();\n } else {\n this._ogma.LKCaptions.updateEdgeCaptions(schema.edge);\n }\n }\n\n /**\n * Create or update nodeCaptionRule\n */\n public updateNodeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._captionSchema.node = schema;\n }\n if (!Tools.isDefined(this.nodesCaptionsRule)) {\n this.nodesCaptionsRule = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n content: (node: Ogma.Node | undefined) => {\n if (node === undefined) {\n return ``;\n }\n const value = Captions.getText(\n node.getData(),\n this._captionSchema.node,\n this._graphSchema.node\n );\n return Tools.isDefined(this._nodeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._nodeMaxTextLength)\n : value;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n return this.nodesCaptionsRule.refresh();\n }\n }\n\n /**\n * Create or update edgeCaptionRule\n */\n public updateEdgeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._captionSchema.edge = schema;\n }\n if (!Tools.isDefined(this.edgesCaptionsRule)) {\n this.edgesCaptionsRule = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n content: (edge: Ogma.Edge | undefined) => {\n if (edge === undefined || edge.getData() === undefined) {\n return ``;\n }\n const value = Captions.getText(\n edge.getData(),\n this._captionSchema.edge,\n this._graphSchema.edge\n );\n return Tools.isDefined(this._edgeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._edgeMaxTextLength)\n : value;\n }\n }\n },\n edgeSelector: (edge) => !edge.isVirtual() && edge.isVisible(),\n // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)\n edgeDependencies: {self: {data: true, attributes: ['shape.style']}}\n });\n } else {\n return this.edgesCaptionsRule.refresh();\n }\n }\n}\n"]}
@@ -166,6 +166,7 @@ var StylesViz = /** @class */ (function () {
166
166
  nodeAttributes: {
167
167
  halo: function (node) {
168
168
  if (node !== undefined &&
169
+ !node.hasClass('filtered') &&
169
170
  (node.isSelected() ||
170
171
  node.getAdjacentNodes({}).isSelected().includes(true) ||
171
172
  node.getAdjacentEdges().isSelected().includes(true))) {
@@ -202,6 +203,7 @@ var StylesViz = /** @class */ (function () {
202
203
  edgeAttributes: {
203
204
  halo: function (edge) {
204
205
  if (edge &&
206
+ !edge.hasClass('filtered') &&
205
207
  (edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())) {
206
208
  return __assign(__assign({}, EDGE_HALO_CONFIGURATION), { scalingMethod: _this._ogma.geo.enabled() ? 'fixed' : 'scaled' });
207
209
  }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/ogma/features/styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAsBb,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,M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;AAAD,CAAC,AAzqBD,IAyqBC;AAzqBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from '@linkurious/ogma';\nimport {\n Edge,\n EdgeAttributesValue,\n NodeAttributesValue,\n StyleClass,\n StyleRule\n} from '@linkurious/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 size: 12,\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n minVisibleSize: 0,\n size: 12\n },\n halo: null\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.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('degreeIndicator'));\n this._ogma.events.on('addNodes', (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;;;;;;;;;;;;;AAsBb,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,EAA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AC,IAAI,CAAC,cAAc,CAAC,EAAE;YACzC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,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,AA3qBD,IA2qBC;AA3qBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from '@linkurious/ogma';\nimport {\n Edge,\n EdgeAttributesValue,\n NodeAttributesValue,\n StyleClass,\n StyleRule\n} from '@linkurious/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.hasClass('filtered') &&\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.hasClass('filtered') &&\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 size: 12,\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n minVisibleSize: 0,\n size: 12\n },\n halo: null\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.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('degreeIndicator'));\n this._ogma.events.on('addNodes', (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,6 +1,6 @@
1
1
  import sortBy from 'lodash/sortBy';
2
2
  import { Node, NodeList } from '@linkurious/ogma';
3
- import { LkNodeData, LkProperty } from '@linkurious/rest-client';
3
+ import { ICurrencyOptions, LkNodeData, LkProperty } from '@linkurious/rest-client';
4
4
  export { sortBy };
5
5
  export declare const CAPTION_HEURISTIC: string[];
6
6
  export declare class Tools {
@@ -114,4 +114,11 @@ export declare class Tools {
114
114
  * @return {number}
115
115
  */
116
116
  static parseFloat(n: unknown): number;
117
+ /**
118
+ * Format a currency value to string.
119
+ *
120
+ * eg: 4123 -> 4.123,00 $
121
+ */
122
+ static formatCurrencyValue(value: number, options: ICurrencyOptions): string;
123
+ private static formatNumberToCurrency;
117
124
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var isEqual_1 = __importDefault(require("lodash/isEqual"));
7
7
  var sortBy_1 = __importDefault(require("lodash/sortBy"));
8
8
  exports.sortBy = sortBy_1.default;
9
+ var rest_client_1 = require("@linkurious/rest-client");
9
10
  var URL_PATTERN = /([a-zA-Z][a-zA-Z0-9\+\-\.]*:\/\/[^\s]+)/i;
10
11
  var IMAGE_PATTERN = /\S+\.(gif|jpe?g|tiff|png|bmp|svg)$/i;
11
12
  exports.CAPTION_HEURISTIC = [
@@ -342,6 +343,41 @@ var Tools = /** @class */ (function () {
342
343
  Tools.parseFloat = function (n) {
343
344
  return Tools.parseNumber(n);
344
345
  };
346
+ /**
347
+ * Format a currency value to string.
348
+ *
349
+ * eg: 4123 -> 4.123,00 $
350
+ */
351
+ Tools.formatCurrencyValue = function (value, options) {
352
+ var sign = value < 0 ? '- ' : '';
353
+ switch (options.format) {
354
+ case rest_client_1.CurrencyFormat.SYMBOL_COMMAS_DOT:
355
+ return "" + sign + options.symbol + " " + Tools.formatNumberToCurrency(value, ',', '.');
356
+ case rest_client_1.CurrencyFormat.DOTS_COMMA_SYMBOL:
357
+ return "" + sign + Tools.formatNumberToCurrency(value, '.', ',') + " " + options.symbol;
358
+ case rest_client_1.CurrencyFormat.SPACES_COMMA_DOT:
359
+ return "" + sign + Tools.formatNumberToCurrency(value, ' ', ',') + " " + options.symbol;
360
+ default:
361
+ throw Error("Cannot format property value " + value + ", unknown format " + options.format + ".");
362
+ }
363
+ };
364
+ Tools.formatNumberToCurrency = function (value, thousandSeparator, decimalSeparator) {
365
+ if (!Number.isFinite(value)) {
366
+ return value.toString();
367
+ }
368
+ var _a = Math.abs(value).toFixed(2).split('.'), integerPart = _a[0], fractionalPart = _a[1];
369
+ var i = -1;
370
+ var thousands = integerPart
371
+ .split('')
372
+ .reverse()
373
+ .map(function (digit) {
374
+ i++;
375
+ return i > 0 && i % 3 === 0 ? digit + thousandSeparator : digit;
376
+ })
377
+ .reverse()
378
+ .join('');
379
+ return thousands + decimalSeparator + fractionalPart;
380
+ };
345
381
  return Tools;
346
382
  }());
347
383
  exports.Tools = Tools;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,2DAAqC;AACrC,yDAAmC;AAI3B,iBAJD,gBAAM,CAIC;AACd,IAAM,WAAW,GAAG,0CAA0C,CAAC;AAC/D,IAAM,aAAa,GAAG,qCAAqC,CAAC;AAC/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IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE;oBACnE,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;iBAC3C;aACF;iBAAM,IAAI,eAAe,EAAE;gBAC1B,OAAO,UAAU,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;aAC/D;iBAAM;gBACL,OAAO,SAAS,CAAC;aAClB;SACF;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACW,gBAAU,GAAxB,UAAyB,CAAU;QACjC,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IACH,YAAC;AAAD,CAAC,AA9WD,IA8WC;AA9WY,sBAAK","sourcesContent":["'use strict';\n\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport {Node, NodeList} from '@linkurious/ogma';\nimport {LkNodeData, LkProperty} from '@linkurious/rest-client';\n\nexport {sortBy};\nconst URL_PATTERN = /([a-zA-Z][a-zA-Z0-9\\+\\-\\.]*:\\/\\/[^\\s]+)/i;\nconst IMAGE_PATTERN = /\\S+\\.(gif|jpe?g|tiff|png|bmp|svg)$/i;\nexport const CAPTION_HEURISTIC: string[] = [\n 'label',\n 'Label',\n 'name',\n 'Name',\n 'title',\n 'Title',\n 'rdfs:label'\n];\n\nexport class Tools {\n public static isEqual(v1: unknown, v2: unknown): boolean {\n return isEqual(v1, v2);\n }\n\n /**\n * Check that a value is defined : not null and not undefined\n *\n * @param {any} value\n * @return {boolean}\n */\n public static isDefined<T>(value: T): value is NonNullable<T> {\n return value !== undefined && value !== null;\n }\n\n /**\n * Truncate a text\n */\n public static truncate(value: unknown, position: 'middle' | 'end', limit = 0): string {\n const suffix = '\\u2026';\n if (!Tools.isDefined(value)) {\n return ``;\n }\n const valueToTruncate = `${value}`;\n if (valueToTruncate.length <= limit + 1) {\n return valueToTruncate;\n }\n const fixedLimit = limit - 1;\n switch (position) {\n case 'middle':\n return (\n valueToTruncate.substring(0, Math.ceil(fixedLimit / 2)) +\n suffix +\n valueToTruncate.substring(valueToTruncate.length - Math.floor(fixedLimit / 2))\n );\n\n case 'end':\n return valueToTruncate.substring(0, fixedLimit) + suffix;\n }\n }\n\n /**\n * Return a value from a nested object depending on a keyPath\n */\n public static getIn(ref: any, path: Array<string | number>): any {\n return path.reduce((p, c) => (p && p[c] !== undefined ? p[c] : undefined), ref);\n }\n\n /**\n * Return a clone of an object\n */\n public static clone(o: any) {\n return typeof o === 'object'\n ? JSON.parse(\n JSON.stringify(o, (k, v) => {\n return v instanceof Set ? {} : v;\n })\n )\n : o;\n }\n\n /**\n * Get the amount of hidden neighbors from a list of nodes\n *\n * @param nodes\n */\n public static getHiddenNeighbors(nodes: NodeList<LkNodeData>): number {\n return nodes.reduce((result: number, node: Node<LkNodeData>) => {\n const statistics = node.getData('statistics');\n if (statistics !== undefined) {\n const hiddenNeighbors =\n statistics.degree !== undefined && !statistics.supernode\n ? statistics.degree - Tools.getDegreeWithoutSelfConnection(node)\n : statistics.supernodeDegree;\n if (hiddenNeighbors !== undefined && hiddenNeighbors > 0) {\n return (result += hiddenNeighbors);\n }\n }\n return result;\n }, 0);\n }\n\n /**\n * Return the visible degree of a node without self connection (self edge)\n *\n * @param {Node} node\n * @return {number}\n */\n public static getDegreeWithoutSelfConnection(node: Node<LkNodeData>): number {\n return node.getAdjacentNodes({policy: 'exclude-sources', filter: 'raw'}).size;\n }\n\n /**\n * Return a formatted version of a number\n */\n public static formatNumber(number: number): string {\n let div = 1;\n let suffix = '';\n const sign = number < 0 ? '-' : '';\n number = Math.abs(number);\n\n if (number >= 1000000) {\n div = 1000000;\n suffix = 'M';\n } else if (number >= 1000) {\n div = 1000;\n suffix = 'k';\n }\n const nn = number / div;\n // if there is a decimal value and nn < 10\n if (nn < 10 && nn % 1 !== 0) {\n return sign + nn.toFixed(1) + suffix;\n } else {\n return sign + Math.floor(nn) + suffix;\n }\n }\n\n /**\n * Return true if a string is not composed only by invisible char\n *\n * @param {string} value\n * @return {boolean}\n */\n public static isStringFilled(value: string): boolean {\n return value.trim() !== '';\n }\n\n public static getValueFromLkProperty(property: LkProperty): null | string | number | boolean {\n if (typeof property === 'object' && 'type' in property) {\n if (!('original' in property) && !('value' in property)) {\n return null;\n }\n if ('original' in property) {\n return `${property.original}`;\n }\n if ('value' in property) {\n return Tools.formatDate(\n new Date(\n new Date(property.value).getTime() + Tools.timezoneToMilliseconds(property.timezone)\n ).toISOString()\n );\n }\n }\n return property;\n }\n\n /**\n * Return a formatted date as a string\n */\n public static formatDate(\n isoString: string,\n isDatetime?: boolean,\n timezone?: number\n ): string | null {\n // The date received from the server will be always in seconds\n let offsetDate: string | number = isoString;\n if (timezone !== undefined) {\n offsetDate = new Date(isoString).getTime() + timezone * 1000;\n }\n const dateObject = new Date(offsetDate);\n\n if (isNaN(dateObject.getUTCFullYear())) {\n return null;\n }\n let formattedDate =\n dateObject.getFullYear() +\n '-' +\n ((dateObject.getUTCMonth() + 1).toString().length === 1\n ? '0' + (dateObject.getUTCMonth() + 1)\n : dateObject.getUTCMonth() + 1) +\n '-' +\n (dateObject.getUTCDate().toString().length === 1\n ? '0' + dateObject.getUTCDate()\n : dateObject.getUTCDate());\n\n if (isDatetime) {\n formattedDate +=\n ' ' +\n (dateObject.getUTCHours().toString().length === 1\n ? '0' + dateObject.getUTCHours()\n : dateObject.getUTCHours()) +\n ':' +\n (dateObject.getUTCMinutes().toString().length === 1\n ? '0' + dateObject.getUTCMinutes()\n : dateObject.getUTCMinutes()) +\n ':' +\n (dateObject.getUTCSeconds().toString().length === 1\n ? '0' + dateObject.getUTCSeconds()\n : dateObject.getUTCSeconds());\n }\n return formattedDate;\n }\n\n /**\n * From \"+03:00\" return the offset in milliseconds\n * @param timezone\n */\n public static timezoneToMilliseconds(timezone: string | undefined): number {\n if (timezone === undefined) {\n return 0;\n }\n if (timezone === 'Z') {\n return 0;\n }\n const sign = timezone[0];\n const [hours, minutes] = timezone.slice(1).split(':');\n return sign === '+'\n ? this.sanitizeFormattedNumber(hours) * 3.6e6 + this.sanitizeFormattedNumber(minutes) * 60000\n : (this.sanitizeFormattedNumber(hours) * 3.6e6 +\n this.sanitizeFormattedNumber(minutes) * 60000) *\n -1;\n }\n\n public static sanitizeFormattedNumber(str: string): number {\n if (str.length === 2 && str.startsWith('0')) {\n return Tools.parseNumber(str[1]);\n }\n return Tools.parseNumber(str);\n }\n\n /**\n * Return true if `n` is (or can be parsed as) a float, but is NOT an integer\n *\n * @param {any} n\n * @return {number} a number (NaN is `n` cannot be parsed as a number)\n */\n public static parseNumber(n: unknown): number {\n // string: try to parse as number (allow ',' as decimal separator)\n if (typeof n === 'string') {\n // prevent the empty string to be parsed as 0\n if (n.trim() === '') {\n return Number.NaN;\n }\n\n n = +n.replace(',', '.').replace(' ', '');\n }\n\n // (the string could not be parsed) OR (it was neither string nor number)\n if (typeof n !== 'number') {\n return Number.NaN;\n }\n\n // false for NaN, +Infinity, -Infinity\n if (!isFinite(n)) {\n return Number.NaN;\n }\n\n return n;\n }\n\n /**\n * Return an Array without duplicated keys\n *\n * @param {Array<any>} arr\n * @param {string} key\n * @return {Array<any>}\n */\n public static uniqBy(arr: Array<any>, key?: string): Array<any> {\n const seen = new Set();\n if (key) {\n const result = [];\n for (let i = 0; i < arr.length; ++i) {\n if (arr[i] && arr[i][key] && !seen.has(arr[i][key])) {\n seen.add(arr[i][key]);\n result.push(arr[i]);\n } else if (!arr[i][key]) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n return typeof arr[0] === 'object'\n ? Array.from(new Set(arr.map((v) => JSON.stringify(v)))).map((v) => JSON.parse(v))\n : Array.from(new Set(arr));\n }\n\n /**\n * Return 'image' or 'url' depending on the given string\n *\n * @param {string} value\n * @return {\"image\" | \"url\"}\n */\n public static getType(value: string): 'image' | 'url' | 'imageUrl' | undefined {\n if (Tools.isImage(value) && Tools.isUrl(value)) {\n return 'imageUrl';\n }\n\n if (Tools.isImage(value)) {\n return 'image';\n }\n\n if (Tools.isUrl(value)) {\n return 'url';\n }\n\n return undefined;\n }\n\n /**\n * Return true if the given string is an url that match the schema handled by LKE\n *\n * @param {string} value\n * @return {boolean}\n */\n private static isUrl(value: string): boolean {\n return URL_PATTERN.test(value);\n }\n\n /**\n * Return true if the given string is an url with an image extension\n *\n * @param {string} value\n * @return {boolean}\n */\n private static isImage(value: string): boolean {\n return IMAGE_PATTERN.test(value);\n }\n\n /**\n * Return true if a value is not undefined, not null and not an empty string\n */\n public static valueExists(value: LkProperty): boolean {\n return Tools.isDefined(value) && (typeof value !== 'string' || Tools.isStringFilled(value));\n }\n\n /**\n * Return true if `n` is (or can be parsed as) a number\n */\n public static isNumber(n: unknown): boolean {\n n = Tools.parseNumber(n);\n return Tools.isDefined(n) && n === n;\n }\n\n /**\n * return the correct property value\n */\n public static getPropertyValue(\n property: LkProperty,\n invalidAsString?: boolean,\n formattedDates?: boolean\n ): undefined | null | string | number | boolean | Array<string> {\n if (typeof property === 'object' && !Array.isArray(property)) {\n if (!('status' in property)) {\n if ((property.type === 'date' || property.type === 'datetime') && formattedDates) {\n return Tools.formatDate(property.value, property.type === 'datetime');\n } else if (property.type === 'date' || property.type === 'datetime') {\n return new Date(property.value).getTime();\n }\n } else if (invalidAsString) {\n return 'original' in property ? property.original : undefined;\n } else {\n return undefined;\n }\n }\n return property;\n }\n\n /**\n * Parse the given value and return a float number or NaN\n *\n * @param {any} n\n * @return {number}\n */\n public static parseFloat(n: unknown): number {\n return Tools.parseNumber(n);\n }\n}\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,2DAAqC;AACrC,yDAAmC;AAI3B,iBAJD,gBAAM,CAIC;AAFd,uDAAiG;AAGjG,IAAM,WAAW,GAAG,0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C;YAErF;gBACE,MAAM,KAAK,CAAC,kCAAgC,KAAK,yBAAoB,OAAO,CAAC,MAAM,MAAG,CAAC,CAAC;SAC3F;IACH,CAAC;IAEc,4BAAsB,GAArC,UACE,KAAa,EACb,iBAAyB,EACzB,gBAAwB;QAExB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzB;QAEK,IAAA,0CAAqE,EAApE,mBAAW,EAAE,sBAAuD,CAAC;QAE5E,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACX,IAAM,SAAS,GAAG,WAAW;aAC1B,KAAK,CAAC,EAAE,CAAC;aACT,OAAO,EAAE;aACT,GAAG,CAAC,UAAC,KAAK;YACT,CAAC,EAAE,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,CAAC,CAAC;aACD,OAAO,EAAE;aACT,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO,SAAS,GAAG,gBAAgB,GAAG,cAAc,CAAC;IACvD,CAAC;IACH,YAAC;AAAD,CAAC,AA7ZD,IA6ZC;AA7ZY,sBAAK","sourcesContent":["'use strict';\n\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport {Node, NodeList} from '@linkurious/ogma';\nimport {CurrencyFormat, ICurrencyOptions, LkNodeData, LkProperty} from '@linkurious/rest-client';\n\nexport {sortBy};\nconst URL_PATTERN = /([a-zA-Z][a-zA-Z0-9\\+\\-\\.]*:\\/\\/[^\\s]+)/i;\nconst IMAGE_PATTERN = /\\S+\\.(gif|jpe?g|tiff|png|bmp|svg)$/i;\nexport const CAPTION_HEURISTIC: string[] = [\n 'label',\n 'Label',\n 'name',\n 'Name',\n 'title',\n 'Title',\n 'rdfs:label'\n];\n\nexport class Tools {\n public static isEqual(v1: unknown, v2: unknown): boolean {\n return isEqual(v1, v2);\n }\n\n /**\n * Check that a value is defined : not null and not undefined\n *\n * @param {any} value\n * @return {boolean}\n */\n public static isDefined<T>(value: T): value is NonNullable<T> {\n return value !== undefined && value !== null;\n }\n\n /**\n * Truncate a text\n */\n public static truncate(value: unknown, position: 'middle' | 'end', limit = 0): string {\n const suffix = '\\u2026';\n if (!Tools.isDefined(value)) {\n return ``;\n }\n const valueToTruncate = `${value}`;\n if (valueToTruncate.length <= limit + 1) {\n return valueToTruncate;\n }\n const fixedLimit = limit - 1;\n switch (position) {\n case 'middle':\n return (\n valueToTruncate.substring(0, Math.ceil(fixedLimit / 2)) +\n suffix +\n valueToTruncate.substring(valueToTruncate.length - Math.floor(fixedLimit / 2))\n );\n\n case 'end':\n return valueToTruncate.substring(0, fixedLimit) + suffix;\n }\n }\n\n /**\n * Return a value from a nested object depending on a keyPath\n */\n public static getIn(ref: any, path: Array<string | number>): any {\n return path.reduce((p, c) => (p && p[c] !== undefined ? p[c] : undefined), ref);\n }\n\n /**\n * Return a clone of an object\n */\n public static clone(o: any) {\n return typeof o === 'object'\n ? JSON.parse(\n JSON.stringify(o, (k, v) => {\n return v instanceof Set ? {} : v;\n })\n )\n : o;\n }\n\n /**\n * Get the amount of hidden neighbors from a list of nodes\n *\n * @param nodes\n */\n public static getHiddenNeighbors(nodes: NodeList<LkNodeData>): number {\n return nodes.reduce((result: number, node: Node<LkNodeData>) => {\n const statistics = node.getData('statistics');\n if (statistics !== undefined) {\n const hiddenNeighbors =\n statistics.degree !== undefined && !statistics.supernode\n ? statistics.degree - Tools.getDegreeWithoutSelfConnection(node)\n : statistics.supernodeDegree;\n if (hiddenNeighbors !== undefined && hiddenNeighbors > 0) {\n return (result += hiddenNeighbors);\n }\n }\n return result;\n }, 0);\n }\n\n /**\n * Return the visible degree of a node without self connection (self edge)\n *\n * @param {Node} node\n * @return {number}\n */\n public static getDegreeWithoutSelfConnection(node: Node<LkNodeData>): number {\n return node.getAdjacentNodes({policy: 'exclude-sources', filter: 'raw'}).size;\n }\n\n /**\n * Return a formatted version of a number\n */\n public static formatNumber(number: number): string {\n let div = 1;\n let suffix = '';\n const sign = number < 0 ? '-' : '';\n number = Math.abs(number);\n\n if (number >= 1000000) {\n div = 1000000;\n suffix = 'M';\n } else if (number >= 1000) {\n div = 1000;\n suffix = 'k';\n }\n const nn = number / div;\n // if there is a decimal value and nn < 10\n if (nn < 10 && nn % 1 !== 0) {\n return sign + nn.toFixed(1) + suffix;\n } else {\n return sign + Math.floor(nn) + suffix;\n }\n }\n\n /**\n * Return true if a string is not composed only by invisible char\n *\n * @param {string} value\n * @return {boolean}\n */\n public static isStringFilled(value: string): boolean {\n return value.trim() !== '';\n }\n\n public static getValueFromLkProperty(property: LkProperty): null | string | number | boolean {\n if (typeof property === 'object' && 'type' in property) {\n if (!('original' in property) && !('value' in property)) {\n return null;\n }\n if ('original' in property) {\n return `${property.original}`;\n }\n if ('value' in property) {\n return Tools.formatDate(\n new Date(\n new Date(property.value).getTime() + Tools.timezoneToMilliseconds(property.timezone)\n ).toISOString()\n );\n }\n }\n return property;\n }\n\n /**\n * Return a formatted date as a string\n */\n public static formatDate(\n isoString: string,\n isDatetime?: boolean,\n timezone?: number\n ): string | null {\n // The date received from the server will be always in seconds\n let offsetDate: string | number = isoString;\n if (timezone !== undefined) {\n offsetDate = new Date(isoString).getTime() + timezone * 1000;\n }\n const dateObject = new Date(offsetDate);\n\n if (isNaN(dateObject.getUTCFullYear())) {\n return null;\n }\n let formattedDate =\n dateObject.getFullYear() +\n '-' +\n ((dateObject.getUTCMonth() + 1).toString().length === 1\n ? '0' + (dateObject.getUTCMonth() + 1)\n : dateObject.getUTCMonth() + 1) +\n '-' +\n (dateObject.getUTCDate().toString().length === 1\n ? '0' + dateObject.getUTCDate()\n : dateObject.getUTCDate());\n\n if (isDatetime) {\n formattedDate +=\n ' ' +\n (dateObject.getUTCHours().toString().length === 1\n ? '0' + dateObject.getUTCHours()\n : dateObject.getUTCHours()) +\n ':' +\n (dateObject.getUTCMinutes().toString().length === 1\n ? '0' + dateObject.getUTCMinutes()\n : dateObject.getUTCMinutes()) +\n ':' +\n (dateObject.getUTCSeconds().toString().length === 1\n ? '0' + dateObject.getUTCSeconds()\n : dateObject.getUTCSeconds());\n }\n return formattedDate;\n }\n\n /**\n * From \"+03:00\" return the offset in milliseconds\n * @param timezone\n */\n public static timezoneToMilliseconds(timezone: string | undefined): number {\n if (timezone === undefined) {\n return 0;\n }\n if (timezone === 'Z') {\n return 0;\n }\n const sign = timezone[0];\n const [hours, minutes] = timezone.slice(1).split(':');\n return sign === '+'\n ? this.sanitizeFormattedNumber(hours) * 3.6e6 + this.sanitizeFormattedNumber(minutes) * 60000\n : (this.sanitizeFormattedNumber(hours) * 3.6e6 +\n this.sanitizeFormattedNumber(minutes) * 60000) *\n -1;\n }\n\n public static sanitizeFormattedNumber(str: string): number {\n if (str.length === 2 && str.startsWith('0')) {\n return Tools.parseNumber(str[1]);\n }\n return Tools.parseNumber(str);\n }\n\n /**\n * Return true if `n` is (or can be parsed as) a float, but is NOT an integer\n *\n * @param {any} n\n * @return {number} a number (NaN is `n` cannot be parsed as a number)\n */\n public static parseNumber(n: unknown): number {\n // string: try to parse as number (allow ',' as decimal separator)\n if (typeof n === 'string') {\n // prevent the empty string to be parsed as 0\n if (n.trim() === '') {\n return Number.NaN;\n }\n\n n = +n.replace(',', '.').replace(' ', '');\n }\n\n // (the string could not be parsed) OR (it was neither string nor number)\n if (typeof n !== 'number') {\n return Number.NaN;\n }\n\n // false for NaN, +Infinity, -Infinity\n if (!isFinite(n)) {\n return Number.NaN;\n }\n\n return n;\n }\n\n /**\n * Return an Array without duplicated keys\n *\n * @param {Array<any>} arr\n * @param {string} key\n * @return {Array<any>}\n */\n public static uniqBy(arr: Array<any>, key?: string): Array<any> {\n const seen = new Set();\n if (key) {\n const result = [];\n for (let i = 0; i < arr.length; ++i) {\n if (arr[i] && arr[i][key] && !seen.has(arr[i][key])) {\n seen.add(arr[i][key]);\n result.push(arr[i]);\n } else if (!arr[i][key]) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n return typeof arr[0] === 'object'\n ? Array.from(new Set(arr.map((v) => JSON.stringify(v)))).map((v) => JSON.parse(v))\n : Array.from(new Set(arr));\n }\n\n /**\n * Return 'image' or 'url' depending on the given string\n *\n * @param {string} value\n * @return {\"image\" | \"url\"}\n */\n public static getType(value: string): 'image' | 'url' | 'imageUrl' | undefined {\n if (Tools.isImage(value) && Tools.isUrl(value)) {\n return 'imageUrl';\n }\n\n if (Tools.isImage(value)) {\n return 'image';\n }\n\n if (Tools.isUrl(value)) {\n return 'url';\n }\n\n return undefined;\n }\n\n /**\n * Return true if the given string is an url that match the schema handled by LKE\n *\n * @param {string} value\n * @return {boolean}\n */\n private static isUrl(value: string): boolean {\n return URL_PATTERN.test(value);\n }\n\n /**\n * Return true if the given string is an url with an image extension\n *\n * @param {string} value\n * @return {boolean}\n */\n private static isImage(value: string): boolean {\n return IMAGE_PATTERN.test(value);\n }\n\n /**\n * Return true if a value is not undefined, not null and not an empty string\n */\n public static valueExists(value: LkProperty): boolean {\n return Tools.isDefined(value) && (typeof value !== 'string' || Tools.isStringFilled(value));\n }\n\n /**\n * Return true if `n` is (or can be parsed as) a number\n */\n public static isNumber(n: unknown): boolean {\n n = Tools.parseNumber(n);\n return Tools.isDefined(n) && n === n;\n }\n\n /**\n * return the correct property value\n */\n public static getPropertyValue(\n property: LkProperty,\n invalidAsString?: boolean,\n formattedDates?: boolean\n ): undefined | null | string | number | boolean | Array<string> {\n if (typeof property === 'object' && !Array.isArray(property)) {\n if (!('status' in property)) {\n if ((property.type === 'date' || property.type === 'datetime') && formattedDates) {\n return Tools.formatDate(property.value, property.type === 'datetime');\n } else if (property.type === 'date' || property.type === 'datetime') {\n return new Date(property.value).getTime();\n }\n } else if (invalidAsString) {\n return 'original' in property ? property.original : undefined;\n } else {\n return undefined;\n }\n }\n return property;\n }\n\n /**\n * Parse the given value and return a float number or NaN\n *\n * @param {any} n\n * @return {number}\n */\n public static parseFloat(n: unknown): number {\n return Tools.parseNumber(n);\n }\n\n /**\n * Format a currency value to string.\n *\n * eg: 4123 -> 4.123,00 $\n */\n public static formatCurrencyValue(value: number, options: ICurrencyOptions): string {\n const sign = value < 0 ? '- ' : '';\n switch (options.format) {\n case CurrencyFormat.SYMBOL_COMMAS_DOT:\n return `${sign}${options.symbol} ${Tools.formatNumberToCurrency(value, ',', '.')}`;\n\n case CurrencyFormat.DOTS_COMMA_SYMBOL:\n return `${sign}${Tools.formatNumberToCurrency(value, '.', ',')} ${options.symbol}`;\n\n case CurrencyFormat.SPACES_COMMA_DOT:\n return `${sign}${Tools.formatNumberToCurrency(value, ' ', ',')} ${options.symbol}`;\n\n default:\n throw Error(`Cannot format property value ${value}, unknown format ${options.format}.`);\n }\n }\n\n private static formatNumberToCurrency(\n value: number,\n thousandSeparator: string,\n decimalSeparator: string\n ): string {\n if (!Number.isFinite(value)) {\n return value.toString();\n }\n\n const [integerPart, fractionalPart] = Math.abs(value).toFixed(2).split('.');\n\n let i = -1;\n const thousands = integerPart\n .split('')\n .reverse()\n .map((digit) => {\n i++;\n return i > 0 && i % 3 === 0 ? digit + thousandSeparator : digit;\n })\n .reverse()\n .join('');\n\n return thousands + decimalSeparator + fractionalPart;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linkurious/ogma-linkurious-parser",
3
- "version": "3.1.8",
3
+ "version": "3.1.10",
4
4
  "author": "Linkurious SAS",
5
5
  "description": "Parse and load a Linkurious visualization in Ogma with one line of code ",
6
6
  "files": [
@@ -13,7 +13,7 @@
13
13
  "main": "./dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
15
  "engines": {
16
- "node": "16.16.0"
16
+ "node": "16.17.1"
17
17
  },
18
18
  "scripts": {
19
19
  "prepare": "tsc -b",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@linkurious/ogma": "4.1.4",
56
- "@linkurious/rest-client": "3.1.8",
56
+ "@linkurious/rest-client": "3.1.10",
57
57
  "@rollup/plugin-buble": "0.21.3",
58
58
  "@rollup/plugin-commonjs": "17.0.0",
59
59
  "@rollup/plugin-json": "4.1.0",