@visuallyjs/browser-ui-angular 1.2.5 → 1.2.7

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 (40) hide show
  1. package/esm2022/index.mjs +2 -0
  2. package/esm2022/lib/browser-ui-angular.module.mjs +14 -4
  3. package/esm2022/lib/charts/area.chart.component.mjs +12 -9
  4. package/esm2022/lib/charts/bar.chart.component.mjs +12 -9
  5. package/esm2022/lib/charts/bubble.chart.component.mjs +12 -9
  6. package/esm2022/lib/charts/column.chart.component.mjs +12 -9
  7. package/esm2022/lib/charts/line.chart.component.mjs +12 -9
  8. package/esm2022/lib/charts/pie.chart.component.mjs +12 -9
  9. package/esm2022/lib/charts/sankey.chart.component.mjs +36 -10
  10. package/esm2022/lib/charts/scatter.chart.component.mjs +12 -9
  11. package/esm2022/lib/charts/series.based.chart.component.mjs +43 -10
  12. package/esm2022/lib/charts/xy.chart.component.mjs +12 -9
  13. package/esm2022/lib/controls-component.mjs +2 -2
  14. package/esm2022/lib/edge.property.mappings.inspector.component.mjs +69 -0
  15. package/esm2022/lib/edge.type.picker.component.mjs +1 -0
  16. package/esm2022/lib/shape-properties-inspector.component.mjs +214 -0
  17. package/esm2022/lib/shape.component.mjs +6 -2
  18. package/fesm2022/visuallyjs-browser-ui-angular.mjs +465 -93
  19. package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -1
  20. package/index.d.ts +2 -0
  21. package/lib/browser-ui-angular.module.d.ts +4 -2
  22. package/lib/charts/area.chart.component.d.ts +7 -7
  23. package/lib/charts/bar.chart.component.d.ts +7 -7
  24. package/lib/charts/bubble.chart.component.d.ts +7 -7
  25. package/lib/charts/column.chart.component.d.ts +8 -7
  26. package/lib/charts/line.chart.component.d.ts +7 -7
  27. package/lib/charts/pie.chart.component.d.ts +7 -7
  28. package/lib/charts/sankey.chart.component.d.ts +12 -9
  29. package/lib/charts/scatter.chart.component.d.ts +7 -7
  30. package/lib/charts/series.based.chart.component.d.ts +9 -6
  31. package/lib/charts/xy.chart.component.d.ts +7 -7
  32. package/lib/controls-component.d.ts +1 -5
  33. package/lib/diagram-palette-component.d.ts +1 -1
  34. package/lib/edge.property.mappings.inspector.component.d.ts +38 -0
  35. package/lib/palette.component.d.ts +9 -9
  36. package/lib/shape-properties-inspector.component.d.ts +31 -0
  37. package/lib/shape.component.d.ts +6 -2
  38. package/lib/shape.palette.component.d.ts +3 -3
  39. package/package.json +2 -2
  40. package/visuallyjs-browser-ui-angular.tgz +0 -0
@@ -0,0 +1,69 @@
1
+ import { Component, Input, inject } from "@angular/core";
2
+ import { INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "./edge.type.picker.component";
6
+
7
+ export class EdgePropertyMappingsInspectorComponent {
8
+ constructor() {
9
+ this.$vjs = inject(VisuallyJsService);
10
+ this._inspector = this.$vjs.inspector;
11
+ }
12
+ get cls() {
13
+ return this.cssClass || "vjs-inspector-section";
14
+ }
15
+ resolveMappings() {
16
+ if (this.mappings) {
17
+ return this.mappings;
18
+ }
19
+ else {
20
+ const mappings = this._inspector().getFromContext(INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS);
21
+ return mappings || this._inspector().$ui.$getEdgePropertyMappings();
22
+ }
23
+ }
24
+ toList(pm) {
25
+ const p = pm.property;
26
+ return Array.isArray(p) ? p : [p];
27
+ }
28
+ getPropertyKey(pm) {
29
+ return this.toList(pm).join(" ");
30
+ }
31
+ getName(pm) {
32
+ return this.getPropertyName ? this.getPropertyName(pm) : pm.name || this.getPropertyKey(pm);
33
+ }
34
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EdgePropertyMappingsInspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
35
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: EdgePropertyMappingsInspectorComponent, selector: "vjs-edge-properties-inspector", inputs: { getPropertyName: "getPropertyName", showName: "showName", cssClass: "cssClass", mappings: "mappings" }, ngImport: i0, template: `
36
+ @for (pm of resolveMappings(); track getPropertyKey(pm)) {
37
+ <div [class]="cls">
38
+ @if (showName !== false) {
39
+ <div>{{ getName(pm) }}</div>
40
+ }
41
+ <vjs-edge-type [propertyName]="getPropertyKey(pm)"></vjs-edge-type>
42
+ </div>
43
+ }
44
+ `, isInline: true, dependencies: [{ kind: "component", type: i1.EdgeTypePickerComponent, selector: "vjs-edge-type", inputs: ["propertyName", "edgeMappings"], outputs: ["changeEvent"] }] }); }
45
+ }
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EdgePropertyMappingsInspectorComponent, decorators: [{
47
+ type: Component,
48
+ args: [{
49
+ selector: "vjs-edge-properties-inspector",
50
+ template: `
51
+ @for (pm of resolveMappings(); track getPropertyKey(pm)) {
52
+ <div [class]="cls">
53
+ @if (showName !== false) {
54
+ <div>{{ getName(pm) }}</div>
55
+ }
56
+ <vjs-edge-type [propertyName]="getPropertyKey(pm)"></vjs-edge-type>
57
+ </div>
58
+ }
59
+ `
60
+ }]
61
+ }], propDecorators: { getPropertyName: [{
62
+ type: Input
63
+ }], showName: [{
64
+ type: Input
65
+ }], cssClass: [{
66
+ type: Input
67
+ }], mappings: [{
68
+ type: Input
69
+ }] } });
@@ -21,6 +21,7 @@ export class EdgeTypePickerComponent {
21
21
  if (inspector != null) {
22
22
  this.initialised = true;
23
23
  inspector.onChange(() => {
24
+ this.edgeTypePicker.reset();
24
25
  this.edgeTypePicker.select(this.propertyName, inspector.getValue(this.propertyName));
25
26
  });
26
27
  const current = inspector.getValue(this.propertyName) || '';
@@ -0,0 +1,214 @@
1
+ import { Component, Input, inject } from "@angular/core";
2
+ import { isNode, isString } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ const MAX_RADIOS = 7;
6
+ const TRUE_FALSE = ["True", "False"];
7
+
8
+ export class ShapePropertiesInspectorComponent {
9
+ constructor() {
10
+
11
+ this.vertex = null;
12
+ this.$vjs = inject(VisuallyJsService);
13
+ this._inspector = this.$vjs.inspector;
14
+ }
15
+ get currentMaxRadios() {
16
+ return this.maxRadios == null ? MAX_RADIOS : this.maxRadios;
17
+ }
18
+ get shapeDef() {
19
+ if (this._inspector() == null || this.vertex == null || !isNode(this.vertex)) {
20
+ return null;
21
+ }
22
+ const { type, category } = this.vertex.data;
23
+ if (!type || !category) {
24
+ return null;
25
+ }
26
+ const shapeLibrary = this._inspector().$ui.getShapeLibrary();
27
+ const shapeSet = shapeLibrary.getShapeSet(category);
28
+ if (!shapeSet) {
29
+ return null;
30
+ }
31
+ return shapeSet.shapes.find(s => s.type === type);
32
+ }
33
+ getBooleanLabel(prop, value) {
34
+ const labels = prop.booleanLabels || TRUE_FALSE;
35
+ return labels[value ? 0 : 1];
36
+ }
37
+ getShapePropertyValueLabel(v) {
38
+ return isString(v) ? v : v.label;
39
+ }
40
+ getShapePropertyValueValue(v) {
41
+ return isString(v) ? v : v.value;
42
+ }
43
+ isBoolean(prop) {
44
+ return prop.type === 'boolean';
45
+ }
46
+ hasValues(prop) {
47
+ return prop.values && prop.values.length > 0;
48
+ }
49
+ useRadio(prop) {
50
+ return this.hasValues(prop) && prop.editor !== 'select' && prop.values.length <= this.currentMaxRadios;
51
+ }
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ShapePropertiesInspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
53
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ShapePropertiesInspectorComponent, selector: "vjs-shape-properties-inspector", inputs: { vertex: "vertex", maxRadios: "maxRadios" }, ngImport: i0, template: `
54
+ @if (shapeDef && shapeDef.properties) {
55
+ @for (prop of shapeDef.properties; track prop.id) {
56
+
57
+ <div class="vjs-inspector-field">
58
+ @if (!isBoolean(prop) || prop.editor === 'select' || prop.editor === 'radio') {
59
+ <label class="vjs-inspector-property-label">{{ prop.label || prop.id }}</label>
60
+ }
61
+
62
+ @if (prop.type === 'string') {
63
+ @if (hasValues(prop)) {
64
+ @if (useRadio(prop)) {
65
+ <div class="vjs-radio-group">
66
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
67
+ <label>
68
+ <input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" [value]="getShapePropertyValueValue(v)" /> {{ getShapePropertyValueLabel(v) }}
69
+ </label>
70
+ }
71
+ </div>
72
+ } @else {
73
+ <select [attr.vjs-att]="prop.id">
74
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
75
+ <option [value]="getShapePropertyValueValue(v)">{{ getShapePropertyValueLabel(v) }}</option>
76
+ }
77
+ </select>
78
+ }
79
+ } @else {
80
+ <input type="text" [attr.vjs-att]="prop.id" [placeholder]="prop.description" />
81
+ }
82
+ } @else if (prop.type === 'number') {
83
+ @if (hasValues(prop)) {
84
+ @if (useRadio(prop)) {
85
+ <div class="vjs-radio-group">
86
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
87
+ <label>
88
+ <input type="radio" [attr.vjs-att]="prop.id" [value]="getShapePropertyValueValue(v)" /> {{ getShapePropertyValueLabel(v) }}
89
+ </label>
90
+ }
91
+ </div>
92
+ } @else {
93
+ <select [attr.vjs-att]="prop.id">
94
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
95
+ <option [value]="getShapePropertyValueValue(v)">{{ getShapePropertyValueLabel(v) }}</option>
96
+ }
97
+ </select>
98
+ }
99
+ } @else {
100
+ <input type="number" [attr.vjs-att]="prop.id" [placeholder]="prop.description" [attr.min]="prop.min" [attr.max]="prop.max" />
101
+ }
102
+ } @else if (isBoolean(prop)) {
103
+ @if (prop.editor === 'select') {
104
+ <select [attr.vjs-att]="prop.id" vjs-datatype="boolean">
105
+ <option value=""></option>
106
+ <option value="true">{{ getBooleanLabel(prop, true) }}</option>
107
+ <option value="false">{{ getBooleanLabel(prop, false) }}</option>
108
+ </select>
109
+ } @else if (prop.editor === 'radio') {
110
+ <div class="vjs-radio-group">
111
+ <label><input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" vjs-datatype="boolean" value="true" /><span>{{ getBooleanLabel(prop, true) }}</span></label>
112
+ <label><input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" vjs-datatype="boolean" value="false" /><span>{{ getBooleanLabel(prop, false) }}</span></label>
113
+ </div>
114
+ } @else {
115
+ <label>
116
+ <input type="checkbox" vjs-datatype="boolean" [attr.vjs-att]="prop.id" /> {{ prop.label || prop.id }}
117
+ </label>
118
+ }
119
+ } @else {
120
+ <input type="text" [attr.vjs-att]="prop.id" [placeholder]="prop.description" />
121
+ }
122
+
123
+ @if (prop.description) {
124
+ <div class="vjs-field-desc">{{ prop.description }}</div>
125
+ }
126
+ </div>
127
+ }
128
+ }
129
+ `, isInline: true, styles: [":host{display:contents}\n"] }); }
130
+ }
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ShapePropertiesInspectorComponent, decorators: [{
132
+ type: Component,
133
+ args: [{ selector: 'vjs-shape-properties-inspector', template: `
134
+ @if (shapeDef && shapeDef.properties) {
135
+ @for (prop of shapeDef.properties; track prop.id) {
136
+
137
+ <div class="vjs-inspector-field">
138
+ @if (!isBoolean(prop) || prop.editor === 'select' || prop.editor === 'radio') {
139
+ <label class="vjs-inspector-property-label">{{ prop.label || prop.id }}</label>
140
+ }
141
+
142
+ @if (prop.type === 'string') {
143
+ @if (hasValues(prop)) {
144
+ @if (useRadio(prop)) {
145
+ <div class="vjs-radio-group">
146
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
147
+ <label>
148
+ <input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" [value]="getShapePropertyValueValue(v)" /> {{ getShapePropertyValueLabel(v) }}
149
+ </label>
150
+ }
151
+ </div>
152
+ } @else {
153
+ <select [attr.vjs-att]="prop.id">
154
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
155
+ <option [value]="getShapePropertyValueValue(v)">{{ getShapePropertyValueLabel(v) }}</option>
156
+ }
157
+ </select>
158
+ }
159
+ } @else {
160
+ <input type="text" [attr.vjs-att]="prop.id" [placeholder]="prop.description" />
161
+ }
162
+ } @else if (prop.type === 'number') {
163
+ @if (hasValues(prop)) {
164
+ @if (useRadio(prop)) {
165
+ <div class="vjs-radio-group">
166
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
167
+ <label>
168
+ <input type="radio" [attr.vjs-att]="prop.id" [value]="getShapePropertyValueValue(v)" /> {{ getShapePropertyValueLabel(v) }}
169
+ </label>
170
+ }
171
+ </div>
172
+ } @else {
173
+ <select [attr.vjs-att]="prop.id">
174
+ @for (v of prop.values; track getShapePropertyValueLabel(v)) {
175
+ <option [value]="getShapePropertyValueValue(v)">{{ getShapePropertyValueLabel(v) }}</option>
176
+ }
177
+ </select>
178
+ }
179
+ } @else {
180
+ <input type="number" [attr.vjs-att]="prop.id" [placeholder]="prop.description" [attr.min]="prop.min" [attr.max]="prop.max" />
181
+ }
182
+ } @else if (isBoolean(prop)) {
183
+ @if (prop.editor === 'select') {
184
+ <select [attr.vjs-att]="prop.id" vjs-datatype="boolean">
185
+ <option value=""></option>
186
+ <option value="true">{{ getBooleanLabel(prop, true) }}</option>
187
+ <option value="false">{{ getBooleanLabel(prop, false) }}</option>
188
+ </select>
189
+ } @else if (prop.editor === 'radio') {
190
+ <div class="vjs-radio-group">
191
+ <label><input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" vjs-datatype="boolean" value="true" /><span>{{ getBooleanLabel(prop, true) }}</span></label>
192
+ <label><input type="radio" [name]="prop.id" [attr.vjs-att]="prop.id" vjs-datatype="boolean" value="false" /><span>{{ getBooleanLabel(prop, false) }}</span></label>
193
+ </div>
194
+ } @else {
195
+ <label>
196
+ <input type="checkbox" vjs-datatype="boolean" [attr.vjs-att]="prop.id" /> {{ prop.label || prop.id }}
197
+ </label>
198
+ }
199
+ } @else {
200
+ <input type="text" [attr.vjs-att]="prop.id" [placeholder]="prop.description" />
201
+ }
202
+
203
+ @if (prop.description) {
204
+ <div class="vjs-field-desc">{{ prop.description }}</div>
205
+ }
206
+ </div>
207
+ }
208
+ }
209
+ `, styles: [":host{display:contents}\n"] }]
210
+ }], propDecorators: { vertex: [{
211
+ type: Input
212
+ }], maxRadios: [{
213
+ type: Input
214
+ }] } });
@@ -13,7 +13,7 @@ export class ShapeComponent {
13
13
  const lbl = this.shapeLibrary.renderShapeLabel(this.obj, this.labelProperty, this.labelStrokeWidth, this.label, this.obj.color || "#000000", this.obj.color || "#000000", this.font);
14
14
  svg.appendChild(lbl);
15
15
  if (this.multilineLabels !== false) {
16
- convertToMultilineText(lbl, this.label || this.obj[this.labelProperty] || "", this.width * this.labelFillRatio);
16
+ convertToMultilineText(lbl, this.label || this.obj[this.labelProperty] || "", this.width * this.labelFillRatio, this.labelPosition);
17
17
  }
18
18
  }
19
19
  }
@@ -27,6 +27,8 @@ export class ShapeComponent {
27
27
  this.multilineLabels = true;
28
28
 
29
29
  this.labelFillRatio = DEFAULT_LABEL_FILL_RATIO;
30
+
31
+ this.labelPosition = "center";
30
32
  this.$el = inject(ElementRef);
31
33
  this.$vjs = inject(VisuallyJsService);
32
34
  this.ui = this.$vjs.ui;
@@ -42,7 +44,7 @@ export class ShapeComponent {
42
44
  this._render();
43
45
  }
44
46
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ShapeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
45
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ShapeComponent, selector: "vjs-shape", inputs: { obj: "obj", width: "width", height: "height", showLabels: "showLabels", labelProperty: "labelProperty", labelStrokeWidth: "labelStrokeWidth", label: "label", multilineLabels: "multilineLabels", labelFillRatio: "labelFillRatio", font: "font" }, usesOnChanges: true, ngImport: i0, template: `<svg:svg
47
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ShapeComponent, selector: "vjs-shape", inputs: { obj: "obj", width: "width", height: "height", showLabels: "showLabels", labelProperty: "labelProperty", labelStrokeWidth: "labelStrokeWidth", label: "label", multilineLabels: "multilineLabels", labelFillRatio: "labelFillRatio", labelPosition: "labelPosition", font: "font" }, usesOnChanges: true, ngImport: i0, template: `<svg:svg
46
48
  [attr.stroke-width]="obj.outlineWidth || 2"
47
49
  attr.fill="{{ obj.fill }}"
48
50
  attr.stroke="{{ obj.outline }}"
@@ -82,6 +84,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
82
84
  type: Input
83
85
  }], labelFillRatio: [{
84
86
  type: Input
87
+ }], labelPosition: [{
88
+ type: Input
85
89
  }], font: [{
86
90
  type: Input
87
91
  }] } });