@visuallyjs/browser-ui 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visuallyjs/browser-ui",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "license": "Commercial",
5
5
  "main": "js/visuallyjs.browser-ui.cjs.js",
6
6
  "module": "js/visuallyjs.browser-ui.esm.js",
@@ -175,7 +175,7 @@ export declare class SankeyChart extends BaseChart {
175
175
  csvData?: string;
176
176
  dataType?: string;
177
177
  jsonData?: VisuallyJsDefaultJSON;
178
- }): void;
178
+ }, onload?: () => any): void;
179
179
  hasData(): boolean;
180
180
  destroy(): void;
181
181
  private _clearVertex;
@@ -11,14 +11,19 @@ export interface CircularLayoutParameters extends LayoutParameters {
11
11
  * If true, the first node in the data set will be placed in the center of the circle. Defaults to false.
12
12
  */
13
13
  centerRoot?: boolean;
14
+ /**
15
+ * Whether or not to shift the layout so that the origin is [width/2, height/2] and not [0,0]. This is useful in situations such as groups, where elements cannot be placed in a negative position in either axis (due to there being no facility to pan the group canvas)
16
+ */
17
+ centerContent?: boolean;
14
18
  }
15
19
  /**
16
- * A layout that places vertices in a circle, optionally with one at the center.
20
+ * A layout that places vertices in a circle, optionally with one at the center, and optionally centered around [width/2, height/2] (the default origin is 0,0).
17
21
  * @group Layouts
18
22
  * @category Circular
19
23
  */
20
24
  export declare class CircularLayout extends AbstractLayout<CircularLayoutParameters> {
21
25
  private readonly _centerRoot;
26
+ private readonly _centerContent;
22
27
  static type: string;
23
28
  readonly type: string;
24
29
  padding: PointXY;
@@ -66,7 +66,7 @@ export interface SelectionOptions {
66
66
  /**
67
67
  * Optional function that can be called to fill the selection. You'd use this when you are rendering individual selections and you need to be able to refresh the whole view based on some change in the data model.
68
68
  */
69
- generator?: Function;
69
+ generator?: SelectionGenerator;
70
70
  /**
71
71
  * If true, the selection will not populate itself as soon as it is constructed. Otherwise, and this is the default behaviour, it will.
72
72
  */
@@ -82,6 +82,10 @@ export interface SelectionOptions {
82
82
  * @category Selection
83
83
  */
84
84
  export type SELECTION_EVENTS = typeof EVENT_EDGE_UPDATED | typeof EVENT_DATA_LOAD_END | typeof EVENT_DATA_LOAD_START | typeof EVENT_NODE_UPDATED | typeof EVENT_GRAPH_CLEAR_START | typeof EVENT_GROUP_UPDATED | typeof EVENT_PORT_UPDATED | typeof EVENT_EDGE_TARGET_CHANGED | typeof EVENT_EDGE_SOURCE_CHANGED | typeof EVENT_EDGE_REMOVED | typeof EVENT_EDGE_ADDED | typeof EVENT_GROUP_REMOVED | typeof EVENT_NODE_REMOVED | typeof EVENT_GROUP_ADDED | typeof EVENT_NODE_ADDED;
85
+ /**
86
+ * Defines a function that can be used as the generator for a selection.
87
+ */
88
+ export type SelectionGenerator = (s: VisuallyJsSelection, m: VisuallyJsModel) => any;
85
89
  /**
86
90
  * A selection is a group of vertices and edges, upon which you can perform bulk operations.
87
91
  * @group Model
@@ -97,7 +101,7 @@ export declare class VisuallyJsSelection extends OptimisticEventGenerator implem
97
101
  _groups: Array<Group>;
98
102
  _edges: Array<Edge>;
99
103
  capacityPolicy: string;
100
- generator: Function;
104
+ generator: SelectionGenerator;
101
105
  onReload: Function;
102
106
  onBeforeReload: Function;
103
107
  onClear: Function;
@@ -248,6 +248,11 @@ export interface ModelOptions {
248
248
  * Optional map of group templates to register on the model.
249
249
  */
250
250
  groupTemplates?: Record<string, GroupTemplate>;
251
+ /**
252
+ * The name of the property inside nodes/groups that identifies their parent group. This defaults to "group" but
253
+ * can be changed if it clashes with your data model.
254
+ */
255
+ groupProperty?: string;
251
256
  }
252
257
  /**
253
258
  * Definition of a model event callback.
@@ -395,6 +400,7 @@ export declare abstract class VisuallyJsModel extends OptimisticEventGenerator i
395
400
  typeProperty: string;
396
401
  edgeTypeProperty: string;
397
402
  portTypeProperty: string;
403
+ groupProperty: string;
398
404
  typeFunction: TypeFunction;
399
405
  edgeIdFunction: IdFunction;
400
406
  edgeTypeFunction: TypeFunction;
@@ -1 +1 @@
1
- export declare const VERSION = "1.1.4";
1
+ export declare const VERSION = "1.2.0";