@linkurious/ogma-linkurious-parser 3.1.13 → 4.0.1

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.
Files changed (39) hide show
  1. package/dist/captions/captions.js +42 -54
  2. package/dist/captions/captions.js.map +1 -1
  3. package/dist/filters/filters.d.ts +1 -1
  4. package/dist/filters/filters.js +55 -76
  5. package/dist/filters/filters.js.map +1 -1
  6. package/dist/index.js +34 -33
  7. package/dist/index.js.map +1 -1
  8. package/dist/ogma/features/OgmaStore.js +16 -30
  9. package/dist/ogma/features/OgmaStore.js.map +1 -1
  10. package/dist/ogma/features/captions.js +43 -87
  11. package/dist/ogma/features/captions.js.map +1 -1
  12. package/dist/ogma/features/reactive.js +58 -75
  13. package/dist/ogma/features/reactive.js.map +1 -1
  14. package/dist/ogma/features/selectors.d.ts +5 -5
  15. package/dist/ogma/features/selectors.js +25 -16
  16. package/dist/ogma/features/selectors.js.map +1 -1
  17. package/dist/ogma/features/styles.js +115 -137
  18. package/dist/ogma/features/styles.js.map +1 -1
  19. package/dist/ogma/features/transformations.js +39 -87
  20. package/dist/ogma/features/transformations.js.map +1 -1
  21. package/dist/ogma/index.js +140 -230
  22. package/dist/ogma/index.js.map +1 -1
  23. package/dist/styles/edgeAttributes.js +31 -47
  24. package/dist/styles/edgeAttributes.js.map +1 -1
  25. package/dist/styles/itemAttributes.js +33 -42
  26. package/dist/styles/itemAttributes.js.map +1 -1
  27. package/dist/styles/nodeAttributes.js +49 -71
  28. package/dist/styles/nodeAttributes.js.map +1 -1
  29. package/dist/styles/styleRule.js +57 -68
  30. package/dist/styles/styleRule.js.map +1 -1
  31. package/dist/styles/styleRules.js +150 -192
  32. package/dist/styles/styleRules.js.map +1 -1
  33. package/dist/tools/colorPalette.js +1 -0
  34. package/dist/tools/colorPalette.js.map +1 -1
  35. package/dist/tools/ogmaTool.js +28 -30
  36. package/dist/tools/ogmaTool.js.map +1 -1
  37. package/dist/tools/tools.js +88 -91
  38. package/dist/tools/tools.js.map +1 -1
  39. package/package.json +7 -7
@@ -1,117 +1,106 @@
1
1
  'use strict';
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
8
- };
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
- var rest_client_1 = require("@linkurious/rest-client");
11
- var tools_1 = require("../tools/tools");
12
- var Captions = /** @class */ (function () {
13
- function Captions() {
14
- }
3
+ exports.Captions = void 0;
4
+ const rest_client_1 = require("@linkurious/rest-client");
5
+ const tools_1 = require("../tools/tools");
6
+ class Captions {
15
7
  /**
16
8
  * Return label for each node
17
9
  */
18
- Captions.getText = function (itemData, schema, graphSchema) {
19
- var types = 'categories' in itemData ? itemData.categories : [itemData.type];
10
+ static getText(itemData, schema, graphSchema) {
11
+ const types = 'categories' in itemData ? itemData.categories : [itemData.type];
20
12
  if (Captions.captionExist(types, schema)) {
21
13
  return 'categories' in itemData
22
14
  ? Captions.generateNodeCaption(itemData, schema, graphSchema) || null
23
15
  : Captions.generateEdgeCaption(itemData, schema, graphSchema) || null;
24
16
  }
25
17
  if (itemData.properties !== undefined) {
26
- var heuristicCaptionElement = tools_1.CAPTION_HEURISTIC.find(function (value) {
18
+ const heuristicCaptionElement = tools_1.CAPTION_HEURISTIC.find((value) => {
27
19
  return itemData.properties[value] !== undefined;
28
20
  });
29
21
  if (heuristicCaptionElement !== undefined &&
30
22
  tools_1.Tools.isDefined(itemData.properties[heuristicCaptionElement])) {
31
- return ("" + tools_1.Tools.getValueFromLkProperty(itemData.properties[heuristicCaptionElement])).trim();
23
+ return `${tools_1.Tools.getValueFromLkProperty(itemData.properties[heuristicCaptionElement])}`.trim();
32
24
  }
33
25
  }
34
26
  return null;
35
- };
27
+ }
36
28
  /**
37
29
  * Return a readable string from an LkProperty
38
30
  */
39
- Captions.getLabel = function (propertyValue, propertyType) {
40
- var _a;
31
+ static getLabel(propertyValue, propertyType) {
41
32
  if (typeof propertyValue === 'object' && 'type' in propertyValue) {
42
33
  if (!('original' in propertyValue) && !('value' in propertyValue)) {
43
34
  return null;
44
35
  }
45
36
  if ('original' in propertyValue) {
46
- return "" + propertyValue.original;
37
+ return `${propertyValue.original}`;
47
38
  }
48
39
  if ('value' in propertyValue) {
49
40
  return tools_1.Tools.formatDate(new Date(new Date(propertyValue.value).getTime() +
50
41
  tools_1.Tools.timezoneToMilliseconds(propertyValue.timezone)).toISOString());
51
42
  }
52
43
  }
53
- else if (((_a = propertyType) === null || _a === void 0 ? void 0 : _a.name) === rest_client_1.PropertyTypeName.NUMBER &&
44
+ else if ((propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === rest_client_1.PropertyTypeName.NUMBER &&
54
45
  propertyType.options !== undefined) {
55
46
  return tools_1.Tools.formatCurrencyValue(propertyValue, propertyType.options);
56
47
  }
57
- return ("" + propertyValue).trim();
58
- };
48
+ return `${propertyValue}`.trim();
49
+ }
59
50
  /**
60
51
  * Return true if caption configuration exists in schema
61
52
  */
62
- Captions.captionExist = function (itemTypes, schema) {
63
- return itemTypes.some(function (type) { return tools_1.Tools.isDefined(schema[type]); });
64
- };
53
+ static captionExist(itemTypes, schema) {
54
+ return itemTypes.some((type) => tools_1.Tools.isDefined(schema[type]));
55
+ }
65
56
  /**
66
57
  * Generate text from node data and captions schema
67
58
  */
68
- Captions.generateNodeCaption = function (itemData, schema, graphSchema) {
69
- var _this = this;
70
- var categories = itemData.categories;
71
- var caption = [];
72
- var captionProps = [];
73
- categories.forEach(function (category) {
59
+ static generateNodeCaption(itemData, schema, graphSchema) {
60
+ const categories = itemData.categories;
61
+ const caption = [];
62
+ let captionProps = [];
63
+ categories.forEach((category) => {
74
64
  if (schema[category] && schema[category].active) {
75
65
  if (schema[category].displayName) {
76
66
  caption.push(category);
77
67
  }
78
- captionProps = __spreadArrays(captionProps, schema[category].properties);
68
+ captionProps = [...captionProps, ...schema[category].properties];
79
69
  }
80
70
  });
81
- tools_1.Tools.uniqBy(captionProps).forEach(function (propertyKey) {
71
+ tools_1.Tools.uniqBy(captionProps).forEach((propertyKey) => {
82
72
  if (itemData.properties[propertyKey] !== undefined) {
83
- var propertyType = graphSchema
73
+ const propertyType = graphSchema
84
74
  ? Captions.getPropertyType(graphSchema, propertyKey, categories[0])
85
75
  : undefined;
86
- caption.push(_this.getLabel(itemData.properties[propertyKey], propertyType));
76
+ caption.push(this.getLabel(itemData.properties[propertyKey], propertyType));
87
77
  }
88
78
  });
89
79
  return caption
90
- .filter(function (c) { return c !== null; })
80
+ .filter((c) => c !== null)
91
81
  .join(' - ')
92
82
  .trim();
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
- };
83
+ }
84
+ static getPropertyType(graphSchema, propertyKey, itemType) {
85
+ const typeGraphSchema = graphSchema.find((schemaType) => schemaType.itemType === itemType);
86
+ const property = typeGraphSchema === null || typeGraphSchema === void 0 ? void 0 : typeGraphSchema.properties.find((property) => property.propertyKey === propertyKey);
87
+ return property === null || property === void 0 ? void 0 : property.propertyType;
88
+ }
100
89
  /**
101
90
  * Generate text from edge data and captions schema
102
91
  */
103
- Captions.generateEdgeCaption = function (itemData, schema, graphSchema) {
104
- var type = itemData.type;
105
- var caption = [];
106
- var captionProps = [];
92
+ static generateEdgeCaption(itemData, schema, graphSchema) {
93
+ const type = itemData.type;
94
+ const caption = [];
95
+ let captionProps = [];
107
96
  if (schema[type] && schema[type].active) {
108
97
  if (schema[type].displayName) {
109
98
  caption.push(type);
110
99
  }
111
- captionProps = __spreadArrays(captionProps, schema[type].properties);
112
- tools_1.Tools.uniqBy(captionProps).forEach(function (propertyKey) {
100
+ captionProps = [...captionProps, ...schema[type].properties];
101
+ tools_1.Tools.uniqBy(captionProps).forEach((propertyKey) => {
113
102
  if (tools_1.Tools.isDefined(itemData.properties[propertyKey])) {
114
- var propertyType = graphSchema
103
+ const propertyType = graphSchema
115
104
  ? Captions.getPropertyType(graphSchema, propertyKey, type)
116
105
  : undefined;
117
106
  caption.push(Captions.getLabel(itemData.properties[propertyKey], propertyType));
@@ -120,8 +109,7 @@ var Captions = /** @class */ (function () {
120
109
  return caption.join(' - ').trim();
121
110
  }
122
111
  return '';
123
- };
124
- return Captions;
125
- }());
112
+ }
113
+ }
126
114
  exports.Captions = Captions;
127
115
  //# sourceMappingURL=captions.js.map
@@ -1 +1 @@
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,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,IAAI,CAAC;SACzE;QACD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE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,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"]}
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../src/captions/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yDAUiC;AAEjC,0CAAwD;AAExD,MAAa,QAAQ;IACnB;;OAEG;IACI,MAAM,CAAC,OAAO,CACnB,QAAiC,EACjC,MAA0B,EAC1B,WAAyC;QAEzC,MAAM,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,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,IAAI,CAAC;SACzE;QACD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EA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K,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;gBACjD,IAAI,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE;oBACrD,MAAM,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;CACF;AA9ID,4BA8IC","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"]}
@@ -1,5 +1,5 @@
1
1
  import { ItemSelector, LkEdgeData, LkNodeData, IRangeValues, ISelectorRange, LkItemData } from '@linkurious/rest-client';
2
- declare type FilterFunction<T extends LkItemData> = (itemData: T) => boolean;
2
+ type FilterFunction<T extends LkItemData> = (itemData: T) => boolean;
3
3
  export declare class Filters {
4
4
  private static nodeCache;
5
5
  private static edgeCache;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var rest_client_1 = require("@linkurious/rest-client");
4
- var tools_1 = require("../tools/tools");
5
- var Filters = /** @class */ (function () {
6
- function Filters() {
7
- }
3
+ exports.Filters = void 0;
4
+ const rest_client_1 = require("@linkurious/rest-client");
5
+ const tools_1 = require("../tools/tools");
6
+ class Filters {
8
7
  /**
9
8
  * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).
10
9
  *
@@ -16,7 +15,7 @@ var Filters = /** @class */ (function () {
16
15
  * @param filterRules
17
16
  * @param itemData
18
17
  */
19
- Filters.isFiltered = function (filterRules, itemData) {
18
+ static isFiltered(filterRules, itemData) {
20
19
  if (!tools_1.Tools.isDefined(itemData)) {
21
20
  return false;
22
21
  }
@@ -26,12 +25,12 @@ var Filters = /** @class */ (function () {
26
25
  else {
27
26
  return Filters.getFilterFunction(filterRules, false)(itemData);
28
27
  }
29
- };
30
- Filters.getFilterFunction = function (filterRules, isNode) {
31
- var filterKey = JSON.stringify(filterRules, null, '');
28
+ }
29
+ static getFilterFunction(filterRules, isNode) {
30
+ const filterKey = JSON.stringify(filterRules, null, '');
32
31
  // This cast is needed to tell the TypeScript compiler to trust us that "isNode" and "T" are dependent.
33
- var filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache);
34
- var filterFunc = filterCache.get(filterKey);
32
+ const filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache);
33
+ let filterFunc = filterCache.get(filterKey);
35
34
  if (!filterFunc) {
36
35
  filterFunc = Filters.createFilterFunction(filterRules, isNode);
37
36
  if (filterCache.size > Filters.FILTER_CACHE_SIZE) {
@@ -40,26 +39,23 @@ var Filters = /** @class */ (function () {
40
39
  filterCache.set(filterKey, filterFunc);
41
40
  }
42
41
  return filterFunc;
43
- };
44
- Filters.createFilterFunction = function (filterRules, isNode) {
45
- var filterFunctions = filterRules.map(function (filter) {
46
- return Filters.filterToFilterFunction(filter, isNode);
47
- });
42
+ }
43
+ static createFilterFunction(filterRules, isNode) {
44
+ const filterFunctions = filterRules.map((filter) => Filters.filterToFilterFunction(filter, isNode));
48
45
  /**
49
46
  * For each filterFunction, as soon as we find a filterFunction that says that a given
50
47
  * node/edge should be filtered/hidden, we return `true` for the node/edge.
51
48
  */
52
- return function (itemData) {
53
- for (var _i = 0, filterFunctions_1 = filterFunctions; _i < filterFunctions_1.length; _i++) {
54
- var filterFunction = filterFunctions_1[_i];
49
+ return (itemData) => {
50
+ for (const filterFunction of filterFunctions) {
55
51
  if (filterFunction(itemData)) {
56
52
  return true;
57
53
  }
58
54
  }
59
55
  return false;
60
56
  };
61
- };
62
- Filters.filterToFilterFunction = function (filter, isNode) {
57
+ }
58
+ static filterToFilterFunction(filter, isNode) {
63
59
  switch (filter.type) {
64
60
  case rest_client_1.SelectorType.ANY:
65
61
  return Filters.createAnyFilterFunction(filter, isNode);
@@ -72,10 +68,10 @@ var Filters = /** @class */ (function () {
72
68
  case rest_client_1.SelectorType.NAN:
73
69
  return Filters.createNaNFilterFunction(filter, isNode);
74
70
  }
75
- };
76
- Filters.createAnyFilterFunction = function (filter, isNode) {
71
+ }
72
+ static createAnyFilterFunction(filter, isNode) {
77
73
  if (isNode) {
78
- return function (itemData) {
74
+ return (itemData) => {
79
75
  if (filter.itemType === undefined) {
80
76
  return true;
81
77
  }
@@ -84,72 +80,56 @@ var Filters = /** @class */ (function () {
84
80
  }
85
81
  else {
86
82
  // isEdge
87
- return function (itemData) { return itemData.type === filter.itemType; };
83
+ return (itemData) => itemData.type === filter.itemType;
88
84
  }
89
- };
90
- Filters.createIsFilterFunction = function (filter, isNode) {
85
+ }
86
+ static createIsFilterFunction(filter, isNode) {
91
87
  if (isNode) {
92
- return function (itemData) {
93
- return itemData.categories.includes(filter.itemType) &&
94
- tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true) === filter.value;
95
- };
88
+ return (itemData) => itemData.categories.includes(filter.itemType) &&
89
+ tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true) === filter.value;
96
90
  }
97
91
  else {
98
92
  // isEdge
99
- return function (itemData) {
100
- return itemData.type === filter.itemType &&
101
- tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true) === filter.value;
102
- };
93
+ return (itemData) => itemData.type === filter.itemType &&
94
+ tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true) === filter.value;
103
95
  }
104
- };
105
- Filters.createNoValueFilterFunction = function (filter, isNode) {
96
+ }
97
+ static createNoValueFilterFunction(filter, isNode) {
106
98
  if (isNode) {
107
- return function (itemData) {
108
- return itemData.categories.includes(filter.itemType) &&
109
- !tools_1.Tools.isDefined(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
110
- };
99
+ return (itemData) => itemData.categories.includes(filter.itemType) &&
100
+ !tools_1.Tools.isDefined(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
111
101
  }
112
102
  else {
113
103
  // isEdge
114
- return function (itemData) {
115
- return itemData.type === filter.itemType &&
116
- !tools_1.Tools.isDefined(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
117
- };
104
+ return (itemData) => itemData.type === filter.itemType &&
105
+ !tools_1.Tools.isDefined(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
118
106
  }
119
- };
120
- Filters.createNaNFilterFunction = function (filter, isNode) {
107
+ }
108
+ static createNaNFilterFunction(filter, isNode) {
121
109
  if (isNode) {
122
- return function (itemData) {
123
- return itemData.categories.includes(filter.itemType) &&
124
- Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
125
- };
110
+ return (itemData) => itemData.categories.includes(filter.itemType) &&
111
+ Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
126
112
  }
127
113
  else {
128
114
  // isEdge
129
- return function (itemData) {
130
- return itemData.type === filter.itemType &&
131
- Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
132
- };
115
+ return (itemData) => itemData.type === filter.itemType &&
116
+ Filters.isNotANumber(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), true));
133
117
  }
134
- };
135
- Filters.isNotANumber = function (value) {
118
+ }
119
+ static isNotANumber(value) {
136
120
  return tools_1.Tools.isDefined(value) && !tools_1.Tools.isNumber(value);
137
- };
138
- Filters.createRangeFilterFunction = function (filter, isNode) {
121
+ }
122
+ static createRangeFilterFunction(filter, isNode) {
139
123
  if (isNode) {
140
- return function (itemData) {
141
- return itemData.categories.includes(filter.itemType) &&
142
- Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), false), filter.value);
143
- };
124
+ return (itemData) => itemData.categories.includes(filter.itemType) &&
125
+ Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), false), filter.value);
144
126
  }
145
127
  else {
146
128
  // isEdge
147
- return function (itemData) {
148
- return itemData.type === filter.itemType &&
149
- Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), false), filter.value);
150
- };
129
+ return (itemData) => itemData.type === filter.itemType &&
130
+ Filters.valueShouldBeHidden(tools_1.Tools.getPropertyValue(tools_1.Tools.getIn(itemData, filter.input), false), filter.value);
151
131
  }
152
- };
132
+ }
153
133
  /**
154
134
  * Returns true if `value` should be filtered/hidden.
155
135
  *
@@ -160,8 +140,8 @@ var Filters = /** @class */ (function () {
160
140
  *
161
141
  * Returns false (i.e. will not filter/hide) if `value` is not a number.
162
142
  */
163
- Filters.valueShouldBeHidden = function (value, range) {
164
- var n = tools_1.Tools.parseFloat(value);
143
+ static valueShouldBeHidden(value, range) {
144
+ const n = tools_1.Tools.parseFloat(value);
165
145
  if (Number.isNaN(n)) {
166
146
  return false;
167
147
  }
@@ -178,11 +158,10 @@ var Filters = /** @class */ (function () {
178
158
  (range['<='] !== undefined && n <= range['<=']) ||
179
159
  (range['>'] !== undefined && n > range['>']) ||
180
160
  (range['>='] !== undefined && n >= range['>=']));
181
- };
182
- Filters.nodeCache = new Map();
183
- Filters.edgeCache = new Map();
184
- Filters.FILTER_CACHE_SIZE = 5;
185
- return Filters;
186
- }());
161
+ }
162
+ }
187
163
  exports.Filters = Filters;
164
+ Filters.nodeCache = new Map();
165
+ Filters.edgeCache = new Map();
166
+ Filters.FILTER_CACHE_SIZE = 5;
188
167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ND,IAyNC;AAzNY,0BAAO","sourcesContent":["import {\n ItemSelector,\n LkEdgeData,\n LkNodeData,\n IRangeValues,\n SelectorType,\n ISelectorAny,\n ISelectorIs,\n ISelectorNoValue,\n ISelectorNaN,\n ISelectorRange,\n LkItemData\n} from '@linkurious/rest-client';\n\nimport {Tools} from '../tools/tools';\n\ntype FilterFunction<T extends LkItemData> = (itemData: T) => boolean;\n\nexport class Filters {\n private static nodeCache: Map<string, FilterFunction<LkNodeData>> = new Map();\n private static edgeCache: Map<string, FilterFunction<LkEdgeData>> = new Map();\n private static FILTER_CACHE_SIZE = 5;\n\n /**\n * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).\n *\n * Notes:\n * 1. `filterRules` are rules that match what should be filtered/hidden.\n * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for\n * an item, the item can be hidden/filtered.\n *\n * @param filterRules\n * @param itemData\n */\n public static isFiltered(\n filterRules: Array<ItemSelector>,\n itemData: LkNodeData | LkEdgeData\n ): boolean {\n if (!Tools.isDefined(itemData)) {\n return false;\n }\n\n if ('categories' in itemData) {\n return Filters.getFilterFunction(filterRules, true)(itemData);\n } else {\n return Filters.getFilterFunction(filterRules, false)(itemData);\n }\n }\n\n private static getFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterKey = JSON.stringify(filterRules, null, '');\n\n // This cast is needed to tell the TypeScript compiler to trust us that \"isNode\" and \"T\" are dependent.\n const filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache) as Map<\n string,\n FilterFunction<T>\n >;\n\n let filterFunc = filterCache.get(filterKey);\n if (!filterFunc) {\n filterFunc = Filters.createFilterFunction(filterRules, isNode);\n if (filterCache.size > Filters.FILTER_CACHE_SIZE) {\n filterCache.clear();\n }\n filterCache.set(filterKey, filterFunc);\n }\n return filterFunc;\n }\n\n private static createFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterFunctions = filterRules.map((filter: ItemSelector) =>\n Filters.filterToFilterFunction(filter, isNode)\n );\n\n /**\n * For each filterFunction, as soon as we find a filterFunction that says that a given\n * node/edge should be filtered/hidden, we return `true` for the node/edge.\n */\n return (itemData: T): boolean => {\n for (const filterFunction of filterFunctions) {\n if (filterFunction(itemData)) {\n return true;\n }\n }\n return false;\n };\n }\n\n private static filterToFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ItemSelector,\n isNode: boolean\n ): FilterFunction<T> {\n switch (filter.type) {\n case SelectorType.ANY:\n return Filters.createAnyFilterFunction(filter, isNode);\n case SelectorType.IS:\n return Filters.createIsFilterFunction(filter, isNode);\n case SelectorType.NO_VALUE:\n return Filters.createNoValueFilterFunction(filter, isNode);\n case SelectorType.RANGE:\n return Filters.createRangeFilterFunction(filter, isNode);\n case SelectorType.NAN:\n return Filters.createNaNFilterFunction(filter, isNode);\n }\n }\n\n private static createAnyFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorAny,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) => {\n if (filter.itemType === undefined) {\n return true;\n }\n return (itemData as LkNodeData).categories.includes(filter.itemType);\n };\n } else {\n // isEdge\n return (itemData: T) => (itemData as LkEdgeData).type === filter.itemType;\n }\n }\n\n private static createIsFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorIs,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n }\n }\n\n private static createNoValueFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNoValue,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static createNaNFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNaN,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static isNotANumber(value: any) {\n return Tools.isDefined(value) && !Tools.isNumber(value);\n }\n\n public static createRangeFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorRange,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), false),\n filter.value\n );\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), false),\n filter.value\n );\n }\n }\n\n /**\n * Returns true if `value` should be filtered/hidden.\n *\n * `range` describes what should be filtered/hidden:\n * - e.g. {\"<\":10, \">=\":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[\n * - e.g. {\"<=\":10} => hide any value in ]-inf, 10]\n * - e.g. {\">=\":20} => hide any value in [20, +inf[\n *\n * Returns false (i.e. will not filter/hide) if `value` is not a number.\n */\n public static valueShouldBeHidden(value: unknown, range: IRangeValues): boolean {\n const n = Tools.parseFloat(value);\n if (Number.isNaN(n)) {\n return false;\n }\n\n /**\n * As soon as we find a condition that says that `value` should be filtered/hidden,\n * we return `true`.\n *\n * If `range` contains multiple conditions, all are checked and if any condition causes\n * `value` to be in the filtered/hidden range, we return `true`.\n *\n * If no condition causes `value` to be filtered/hidden, we return `false`.\n */\n return (\n (range['<'] !== undefined && n < range['<']) ||\n (range['<='] !== undefined && n <= range['<=']) ||\n (range['>'] !== undefined && n > range['>']) ||\n (range['>='] !== undefined && n >= range['>='])\n );\n }\n}\n"]}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/filters/filters.ts"],"names":[],"mappings":";;;AAAA,yDAYiC;AAEjC,0CAAqC;AAIrC,MAAa,OAAO;IAKlB;;;;;;;;;;OAUG;IACI,MAAM,CAAC,UAAU,CACtB,WAAgC,EAChC,QAAiC;QAEjC,IAAI,CAAC,aAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,IAAI,YAAY,IAAI,QAAQ,EAAE;YAC5B,OAAO,OAAO,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC/D;aAAM;YACL,OAAO,OAAO,CAAC,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;SAChE;IACH,CAAC;IAEO,MAAM,CAAC,iBAAiB,CAC9B,WAAgC,EAChC,MAAe;QAEf,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAExD,uGAAuG;QACvG,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAGlE,CAAC;QAEF,IAAI,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5C,IA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;YAC5C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAChD,CAAC;IACJ,CAAC;;AAxNH,0BAyNC;AAxNgB,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;AAC/D,iBAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;AAC/D,yBAAiB,GAAG,CAAC,CAAC","sourcesContent":["import {\n ItemSelector,\n LkEdgeData,\n LkNodeData,\n IRangeValues,\n SelectorType,\n ISelectorAny,\n ISelectorIs,\n ISelectorNoValue,\n ISelectorNaN,\n ISelectorRange,\n LkItemData\n} from '@linkurious/rest-client';\n\nimport {Tools} from '../tools/tools';\n\ntype FilterFunction<T extends LkItemData> = (itemData: T) => boolean;\n\nexport class Filters {\n private static nodeCache: Map<string, FilterFunction<LkNodeData>> = new Map();\n private static edgeCache: Map<string, FilterFunction<LkEdgeData>> = new Map();\n private static FILTER_CACHE_SIZE = 5;\n\n /**\n * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).\n *\n * Notes:\n * 1. `filterRules` are rules that match what should be filtered/hidden.\n * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for\n * an item, the item can be hidden/filtered.\n *\n * @param filterRules\n * @param itemData\n */\n public static isFiltered(\n filterRules: Array<ItemSelector>,\n itemData: LkNodeData | LkEdgeData\n ): boolean {\n if (!Tools.isDefined(itemData)) {\n return false;\n }\n\n if ('categories' in itemData) {\n return Filters.getFilterFunction(filterRules, true)(itemData);\n } else {\n return Filters.getFilterFunction(filterRules, false)(itemData);\n }\n }\n\n private static getFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterKey = JSON.stringify(filterRules, null, '');\n\n // This cast is needed to tell the TypeScript compiler to trust us that \"isNode\" and \"T\" are dependent.\n const filterCache = (isNode ? Filters.nodeCache : Filters.edgeCache) as Map<\n string,\n FilterFunction<T>\n >;\n\n let filterFunc = filterCache.get(filterKey);\n if (!filterFunc) {\n filterFunc = Filters.createFilterFunction(filterRules, isNode);\n if (filterCache.size > Filters.FILTER_CACHE_SIZE) {\n filterCache.clear();\n }\n filterCache.set(filterKey, filterFunc);\n }\n return filterFunc;\n }\n\n private static createFilterFunction<T extends LkNodeData | LkEdgeData>(\n filterRules: Array<ItemSelector>,\n isNode: boolean\n ): FilterFunction<T> {\n const filterFunctions = filterRules.map((filter: ItemSelector) =>\n Filters.filterToFilterFunction(filter, isNode)\n );\n\n /**\n * For each filterFunction, as soon as we find a filterFunction that says that a given\n * node/edge should be filtered/hidden, we return `true` for the node/edge.\n */\n return (itemData: T): boolean => {\n for (const filterFunction of filterFunctions) {\n if (filterFunction(itemData)) {\n return true;\n }\n }\n return false;\n };\n }\n\n private static filterToFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ItemSelector,\n isNode: boolean\n ): FilterFunction<T> {\n switch (filter.type) {\n case SelectorType.ANY:\n return Filters.createAnyFilterFunction(filter, isNode);\n case SelectorType.IS:\n return Filters.createIsFilterFunction(filter, isNode);\n case SelectorType.NO_VALUE:\n return Filters.createNoValueFilterFunction(filter, isNode);\n case SelectorType.RANGE:\n return Filters.createRangeFilterFunction(filter, isNode);\n case SelectorType.NAN:\n return Filters.createNaNFilterFunction(filter, isNode);\n }\n }\n\n private static createAnyFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorAny,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) => {\n if (filter.itemType === undefined) {\n return true;\n }\n return (itemData as LkNodeData).categories.includes(filter.itemType);\n };\n } else {\n // isEdge\n return (itemData: T) => (itemData as LkEdgeData).type === filter.itemType;\n }\n }\n\n private static createIsFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorIs,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true) === filter.value;\n }\n }\n\n private static createNoValueFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNoValue,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n !Tools.isDefined(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static createNaNFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorNaN,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.isNotANumber(Tools.getPropertyValue(Tools.getIn(itemData, filter.input), true));\n }\n }\n\n private static isNotANumber(value: any) {\n return Tools.isDefined(value) && !Tools.isNumber(value);\n }\n\n public static createRangeFilterFunction<T extends LkNodeData | LkEdgeData>(\n filter: ISelectorRange,\n isNode: boolean\n ): FilterFunction<T> {\n if (isNode) {\n return (itemData: T) =>\n (itemData as LkNodeData).categories.includes(filter.itemType) &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), false),\n filter.value\n );\n } else {\n // isEdge\n return (itemData: T) =>\n (itemData as LkEdgeData).type === filter.itemType &&\n Filters.valueShouldBeHidden(\n Tools.getPropertyValue(Tools.getIn(itemData, filter.input), false),\n filter.value\n );\n }\n }\n\n /**\n * Returns true if `value` should be filtered/hidden.\n *\n * `range` describes what should be filtered/hidden:\n * - e.g. {\"<\":10, \">=\":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[\n * - e.g. {\"<=\":10} => hide any value in ]-inf, 10]\n * - e.g. {\">=\":20} => hide any value in [20, +inf[\n *\n * Returns false (i.e. will not filter/hide) if `value` is not a number.\n */\n public static valueShouldBeHidden(value: unknown, range: IRangeValues): boolean {\n const n = Tools.parseFloat(value);\n if (Number.isNaN(n)) {\n return false;\n }\n\n /**\n * As soon as we find a condition that says that `value` should be filtered/hidden,\n * we return `true`.\n *\n * If `range` contains multiple conditions, all are checked and if any condition causes\n * `value` to be in the filtered/hidden range, we return `true`.\n *\n * If no condition causes `value` to be filtered/hidden, we return `false`.\n */\n return (\n (range['<'] !== undefined && n < range['<']) ||\n (range['<='] !== undefined && n <= range['<=']) ||\n (range['>'] !== undefined && n > range['>']) ||\n (range['>='] !== undefined && n >= range['>='])\n );\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -1,53 +1,54 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tools = exports.ANIMATION_DURATION = exports.LKOgma = exports.hasSelectionProperties = exports.getSelectionProperties = exports.getUniqSelectionEntity = exports.getUniqSelectionTypes = exports.getUniqSelection = exports.getSelectionEntity = exports.getSelectionState = exports.getSelectionSize = exports.OgmaStore = exports.Filters = exports.HTML_COLORS = exports.OgmaTools = exports.CaptionsViz = exports.TransformationsViz = exports.FILTER_OPACITY = exports.StylesViz = exports.StyleType = exports.StyleRules = exports.StyleRuleType = exports.StyleRule = exports.NodeAttributes = exports.EdgeAttributes = exports.PALETTE = exports.BASE_GREY = exports.ItemAttributes = exports.Captions = exports.NodeList = exports.Node = exports.EdgeList = exports.Edge = void 0;
3
4
  var ogma_1 = require("@linkurious/ogma");
4
- exports.Edge = ogma_1.Edge;
5
- exports.EdgeList = ogma_1.EdgeList;
6
- exports.Node = ogma_1.Node;
7
- exports.NodeList = ogma_1.NodeList;
5
+ Object.defineProperty(exports, "Edge", { enumerable: true, get: function () { return ogma_1.Edge; } });
6
+ Object.defineProperty(exports, "EdgeList", { enumerable: true, get: function () { return ogma_1.EdgeList; } });
7
+ Object.defineProperty(exports, "Node", { enumerable: true, get: function () { return ogma_1.Node; } });
8
+ Object.defineProperty(exports, "NodeList", { enumerable: true, get: function () { return ogma_1.NodeList; } });
8
9
  var captions_1 = require("./captions/captions");
9
- exports.Captions = captions_1.Captions;
10
+ Object.defineProperty(exports, "Captions", { enumerable: true, get: function () { return captions_1.Captions; } });
10
11
  var itemAttributes_1 = require("./styles/itemAttributes");
11
- exports.ItemAttributes = itemAttributes_1.ItemAttributes;
12
- exports.BASE_GREY = itemAttributes_1.BASE_GREY;
13
- exports.PALETTE = itemAttributes_1.PALETTE;
12
+ Object.defineProperty(exports, "ItemAttributes", { enumerable: true, get: function () { return itemAttributes_1.ItemAttributes; } });
13
+ Object.defineProperty(exports, "BASE_GREY", { enumerable: true, get: function () { return itemAttributes_1.BASE_GREY; } });
14
+ Object.defineProperty(exports, "PALETTE", { enumerable: true, get: function () { return itemAttributes_1.PALETTE; } });
14
15
  var edgeAttributes_1 = require("./styles/edgeAttributes");
15
- exports.EdgeAttributes = edgeAttributes_1.EdgeAttributes;
16
+ Object.defineProperty(exports, "EdgeAttributes", { enumerable: true, get: function () { return edgeAttributes_1.EdgeAttributes; } });
16
17
  var nodeAttributes_1 = require("./styles/nodeAttributes");
17
- exports.NodeAttributes = nodeAttributes_1.NodeAttributes;
18
+ Object.defineProperty(exports, "NodeAttributes", { enumerable: true, get: function () { return nodeAttributes_1.NodeAttributes; } });
18
19
  var styleRule_1 = require("./styles/styleRule");
19
- exports.StyleRule = styleRule_1.StyleRule;
20
- exports.StyleRuleType = styleRule_1.StyleRuleType;
20
+ Object.defineProperty(exports, "StyleRule", { enumerable: true, get: function () { return styleRule_1.StyleRule; } });
21
+ Object.defineProperty(exports, "StyleRuleType", { enumerable: true, get: function () { return styleRule_1.StyleRuleType; } });
21
22
  var styleRules_1 = require("./styles/styleRules");
22
- exports.StyleRules = styleRules_1.StyleRules;
23
- exports.StyleType = styleRules_1.StyleType;
23
+ Object.defineProperty(exports, "StyleRules", { enumerable: true, get: function () { return styleRules_1.StyleRules; } });
24
+ Object.defineProperty(exports, "StyleType", { enumerable: true, get: function () { return styleRules_1.StyleType; } });
24
25
  var styles_1 = require("./ogma/features/styles");
25
- exports.StylesViz = styles_1.StylesViz;
26
- exports.FILTER_OPACITY = styles_1.FILTER_OPACITY;
26
+ Object.defineProperty(exports, "StylesViz", { enumerable: true, get: function () { return styles_1.StylesViz; } });
27
+ Object.defineProperty(exports, "FILTER_OPACITY", { enumerable: true, get: function () { return styles_1.FILTER_OPACITY; } });
27
28
  var transformations_1 = require("./ogma/features/transformations");
28
- exports.TransformationsViz = transformations_1.TransformationsViz;
29
+ Object.defineProperty(exports, "TransformationsViz", { enumerable: true, get: function () { return transformations_1.TransformationsViz; } });
29
30
  var captions_2 = require("./ogma/features/captions");
30
- exports.CaptionsViz = captions_2.CaptionsViz;
31
+ Object.defineProperty(exports, "CaptionsViz", { enumerable: true, get: function () { return captions_2.CaptionsViz; } });
31
32
  var ogmaTool_1 = require("./tools/ogmaTool");
32
- exports.OgmaTools = ogmaTool_1.OgmaTools;
33
+ Object.defineProperty(exports, "OgmaTools", { enumerable: true, get: function () { return ogmaTool_1.OgmaTools; } });
33
34
  var colorPalette_1 = require("./tools/colorPalette");
34
- exports.HTML_COLORS = colorPalette_1.HTML_COLORS;
35
+ Object.defineProperty(exports, "HTML_COLORS", { enumerable: true, get: function () { return colorPalette_1.HTML_COLORS; } });
35
36
  var filters_1 = require("./filters/filters");
36
- exports.Filters = filters_1.Filters;
37
+ Object.defineProperty(exports, "Filters", { enumerable: true, get: function () { return filters_1.Filters; } });
37
38
  var OgmaStore_1 = require("./ogma/features/OgmaStore");
38
- exports.OgmaStore = OgmaStore_1.OgmaStore;
39
+ Object.defineProperty(exports, "OgmaStore", { enumerable: true, get: function () { return OgmaStore_1.OgmaStore; } });
39
40
  var selectors_1 = require("./ogma/features/selectors");
40
- exports.getSelectionSize = selectors_1.getSelectionSize;
41
- exports.getSelectionState = selectors_1.getSelectionState;
42
- exports.getSelectionEntity = selectors_1.getSelectionEntity;
43
- exports.getUniqSelection = selectors_1.getUniqSelection;
44
- exports.getUniqSelectionTypes = selectors_1.getUniqSelectionTypes;
45
- exports.getUniqSelectionEntity = selectors_1.getUniqSelectionEntity;
46
- exports.getSelectionProperties = selectors_1.getSelectionProperties;
47
- exports.hasSelectionProperties = selectors_1.hasSelectionProperties;
41
+ Object.defineProperty(exports, "getSelectionSize", { enumerable: true, get: function () { return selectors_1.getSelectionSize; } });
42
+ Object.defineProperty(exports, "getSelectionState", { enumerable: true, get: function () { return selectors_1.getSelectionState; } });
43
+ Object.defineProperty(exports, "getSelectionEntity", { enumerable: true, get: function () { return selectors_1.getSelectionEntity; } });
44
+ Object.defineProperty(exports, "getUniqSelection", { enumerable: true, get: function () { return selectors_1.getUniqSelection; } });
45
+ Object.defineProperty(exports, "getUniqSelectionTypes", { enumerable: true, get: function () { return selectors_1.getUniqSelectionTypes; } });
46
+ Object.defineProperty(exports, "getUniqSelectionEntity", { enumerable: true, get: function () { return selectors_1.getUniqSelectionEntity; } });
47
+ Object.defineProperty(exports, "getSelectionProperties", { enumerable: true, get: function () { return selectors_1.getSelectionProperties; } });
48
+ Object.defineProperty(exports, "hasSelectionProperties", { enumerable: true, get: function () { return selectors_1.hasSelectionProperties; } });
48
49
  var ogma_2 = require("./ogma");
49
- exports.LKOgma = ogma_2.LKOgma;
50
- exports.ANIMATION_DURATION = ogma_2.ANIMATION_DURATION;
50
+ Object.defineProperty(exports, "LKOgma", { enumerable: true, get: function () { return ogma_2.LKOgma; } });
51
+ Object.defineProperty(exports, "ANIMATION_DURATION", { enumerable: true, get: function () { return ogma_2.ANIMATION_DURATION; } });
51
52
  var tools_1 = require("./tools/tools");
52
- exports.Tools = tools_1.Tools;
53
+ Object.defineProperty(exports, "Tools", { enumerable: true, get: function () { return tools_1.Tools; } });
53
54
  //# sourceMappingURL=index.js.map