@visuallyjs/browser-ui-angular 1.2.6 → 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 (38) 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/fesm2022/visuallyjs-browser-ui-angular.mjs +459 -91
  18. package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -1
  19. package/index.d.ts +2 -0
  20. package/lib/browser-ui-angular.module.d.ts +4 -2
  21. package/lib/charts/area.chart.component.d.ts +7 -7
  22. package/lib/charts/bar.chart.component.d.ts +7 -7
  23. package/lib/charts/bubble.chart.component.d.ts +7 -7
  24. package/lib/charts/column.chart.component.d.ts +8 -7
  25. package/lib/charts/line.chart.component.d.ts +7 -7
  26. package/lib/charts/pie.chart.component.d.ts +7 -7
  27. package/lib/charts/sankey.chart.component.d.ts +12 -9
  28. package/lib/charts/scatter.chart.component.d.ts +7 -7
  29. package/lib/charts/series.based.chart.component.d.ts +9 -6
  30. package/lib/charts/xy.chart.component.d.ts +7 -7
  31. package/lib/controls-component.d.ts +1 -5
  32. package/lib/diagram-palette-component.d.ts +1 -1
  33. package/lib/edge.property.mappings.inspector.component.d.ts +38 -0
  34. package/lib/palette.component.d.ts +9 -9
  35. package/lib/shape-properties-inspector.component.d.ts +31 -0
  36. package/lib/shape.palette.component.d.ts +3 -3
  37. package/package.json +2 -2
  38. 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
+ }] } });