@wcardinal/wcardinal-ui 0.224.0 → 0.226.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/dist/types/wcardinal/ui/d-diagram-canvas.d.ts +8 -3
- package/dist/types/wcardinal/ui/d-table-data-list-selection.d.ts +4 -1
- package/dist/types/wcardinal/ui/d-table-data-selection.d.ts +30 -1
- package/dist/types/wcardinal/ui/d-table-data-tree-selection-impl.d.ts +4 -1
- package/dist/types/wcardinal/ui/shape/e-shape-data-value-type.d.ts +2 -0
- package/dist/wcardinal/ui/d-diagram-canvas.js +187 -117
- package/dist/wcardinal/ui/d-diagram-canvas.js.map +1 -1
- package/dist/wcardinal/ui/d-table-data-list-selection.js +27 -0
- package/dist/wcardinal/ui/d-table-data-list-selection.js.map +1 -1
- package/dist/wcardinal/ui/d-table-data-selection.js.map +1 -1
- package/dist/wcardinal/ui/d-table-data-tree-selection-impl.js +28 -0
- package/dist/wcardinal/ui/d-table-data-tree-selection-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-data-value-type.js +2 -0
- package/dist/wcardinal/ui/shape/e-shape-data-value-type.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +245 -118
- package/dist/wcardinal-ui.js +245 -118
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { EShapeActionRuntime } from "./shape/action/e-shape-action-runtime";
|
|
|
6
6
|
import { DDiagramDataMapper } from "./d-diagram-data-mapper";
|
|
7
7
|
import { EShapeRuntime } from "./shape/e-shape-runtime";
|
|
8
8
|
import { EShapeDataValue } from "./shape/e-shape-data-value";
|
|
9
|
+
import { EShapeDataValueType } from "./shape/e-shape-data-value-type";
|
|
9
10
|
import { EShapeContainer } from "./shape/e-shape-container";
|
|
10
11
|
import { DDiagramCanvasData } from "./d-diagram-canvas-data";
|
|
11
12
|
import { DDiagramCanvasShape } from "./d-diagram-canvas-shape";
|
|
@@ -29,12 +30,16 @@ export declare class DDiagramCanvas<THEME extends DThemeDiagramCanvas = DThemeDi
|
|
|
29
30
|
get shape(): DDiagramCanvasShape;
|
|
30
31
|
get ticker(): DDiagramCanvasTicker;
|
|
31
32
|
initialize(shapes: EShape[], mapper?: DDiagramDataMapper | null): void;
|
|
32
|
-
protected initialize_(shapes: EShape[], dataShape: EShape | null, containerShape: EShape | null, mapper: DDiagramDataMapper | null | undefined,
|
|
33
|
-
protected initData(shape: EShape, dataShape: EShape | null, containerShape: EShape | null, mapper: DDiagramDataMapper | null | undefined,
|
|
33
|
+
protected initialize_(shapes: EShape[], dataShape: EShape | null, containerShape: EShape | null, mapper: DDiagramDataMapper | null | undefined, formatters: Map<EShapeDataValueType, Map<string, (value: unknown) => unknown>>, initializers: Map<EShapeDataValueType, Map<string, () => unknown>>, actionValueToRuntime: Map<EShapeActionValue, EShapeActionRuntime>, canvasTicker: DDiagramCanvasTicker, canvasShape: DDiagramCanvasShape, canvasData: DDiagramCanvasData, actionables: EShape[]): void;
|
|
34
|
+
protected initData(shape: EShape, dataShape: EShape | null, containerShape: EShape | null, mapper: DDiagramDataMapper | null | undefined, formatters: Map<EShapeDataValueType, Map<string, (value: unknown) => unknown>>, initializers: Map<EShapeDataValueType, Map<string, () => unknown>>, canvasTicker: DDiagramCanvasTicker, canvasData: DDiagramCanvasData): void;
|
|
35
|
+
protected initDataValue(value: EShapeDataValue, shape: EShape, dataShape: EShape | null, containerShape: EShape | null, mapper: DDiagramDataMapper | null | undefined, formatters: Map<EShapeDataValueType, Map<string, (value: unknown) => unknown>>, initializers: Map<EShapeDataValueType, Map<string, () => unknown>>, canvasData: DDiagramCanvasData): void;
|
|
36
|
+
protected initDataTicker(value: EShapeDataValue, initializers: Map<EShapeDataValueType, Map<string, () => unknown>>, canvasTicker: DDiagramCanvasTicker): void;
|
|
37
|
+
protected initDataExtension(value: EShapeDataValue, canvasData: DDiagramCanvasData): void;
|
|
34
38
|
protected initActions(shape: EShape, shapeRuntime: EShapeRuntime, valueToRuntime: Map<EShapeActionValue, EShapeActionRuntime>): void;
|
|
35
39
|
protected calcFormatter(value: EShapeDataValue, format: string, initial: string): (value: unknown) => unknown;
|
|
36
|
-
protected calcInitial(value: EShapeDataValue, initial: string): unknown;
|
|
40
|
+
protected calcInitial(value: EShapeDataValue, initial: string): () => unknown;
|
|
37
41
|
protected toInitial(value: EShapeDataValue): string;
|
|
42
|
+
protected toInitializer(value: EShapeDataValue): () => unknown;
|
|
38
43
|
protected onDestroy(): void;
|
|
39
44
|
hitTestInteractives(global: IPoint): EShape | null;
|
|
40
45
|
onShapeMove(e: interaction.InteractionEvent): boolean;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { utils } from "pixi.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DTableData } from "./d-table-data";
|
|
3
|
+
import { DTableDataSelection, DTableDataSelectionEachIteratee, DTableDataSelectionOptions, DTableDataSelectionParent, DTableDataSelectionType } from "./d-table-data-selection";
|
|
3
4
|
export declare class DTableDataListSelection<ROW> extends utils.EventEmitter implements DTableDataSelection<ROW> {
|
|
4
5
|
protected _parent: DTableDataSelectionParent<ROW>;
|
|
5
6
|
protected _type: DTableDataSelectionType;
|
|
6
7
|
protected _indices: Set<number>;
|
|
7
8
|
constructor(parent: DTableDataSelectionParent<ROW>, options?: DTableDataSelectionOptions);
|
|
9
|
+
get parent(): DTableData<ROW>;
|
|
8
10
|
get type(): DTableDataSelectionType;
|
|
9
11
|
protected onChange(): void;
|
|
10
12
|
toggle(rowIndex: number): void;
|
|
@@ -22,6 +24,7 @@ export declare class DTableDataListSelection<ROW> extends utils.EventEmitter imp
|
|
|
22
24
|
shift(rowIndex: number, amount: number): void;
|
|
23
25
|
size(): number;
|
|
24
26
|
isEmpty(): boolean;
|
|
27
|
+
each(iteratee: DTableDataSelectionEachIteratee): void;
|
|
25
28
|
/**
|
|
26
29
|
* Returns a copy of an index array of selected rows.
|
|
27
30
|
* The order of indices is an insertion order.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { utils } from "pixi.js";
|
|
2
|
+
import { DOnOptions } from "./d-on-options";
|
|
2
3
|
import { DTableData } from "./d-table-data";
|
|
3
4
|
export declare const DTableDataSelectionType: {
|
|
4
5
|
readonly NONE: 0;
|
|
@@ -6,10 +7,31 @@ export declare const DTableDataSelectionType: {
|
|
|
6
7
|
readonly MULTIPLE: 2;
|
|
7
8
|
};
|
|
8
9
|
export declare type DTableDataSelectionType = typeof DTableDataSelectionType[keyof typeof DTableDataSelectionType];
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* {@link DTableDataSelection} events.
|
|
12
|
+
*/
|
|
13
|
+
export interface DTableDataSelectionEvents<EMITTER> {
|
|
14
|
+
/**
|
|
15
|
+
* Triggered when s selection is changed.
|
|
16
|
+
*
|
|
17
|
+
* on( "change", ( emitter ) => {} )
|
|
18
|
+
*
|
|
19
|
+
* @param emitter an emitter
|
|
20
|
+
*/
|
|
21
|
+
change(emitter: EMITTER): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* {@link DTableDataSelection} "on" options.
|
|
25
|
+
*/
|
|
26
|
+
export interface DTableDataSelectionOnOptions<EMITTER> extends Partial<DTableDataSelectionEvents<EMITTER>>, DOnOptions {
|
|
27
|
+
}
|
|
28
|
+
export interface DTableDataSelectionOptions<EMITTER = any> {
|
|
10
29
|
type?: keyof typeof DTableDataSelectionType | DTableDataSelectionType;
|
|
30
|
+
on?: DTableDataSelectionOnOptions<EMITTER>;
|
|
11
31
|
}
|
|
32
|
+
export declare type DTableDataSelectionEachIteratee = (index: number) => void | boolean;
|
|
12
33
|
export interface DTableDataSelection<ROW> extends utils.EventEmitter {
|
|
34
|
+
readonly parent: DTableData<ROW>;
|
|
13
35
|
/**
|
|
14
36
|
* Returns a copy of an index array of selected rows.
|
|
15
37
|
* The order of indices is an insertion order.
|
|
@@ -36,6 +58,13 @@ export interface DTableDataSelection<ROW> extends utils.EventEmitter {
|
|
|
36
58
|
shift(rowIndex: number, amount: number): void;
|
|
37
59
|
size(): number;
|
|
38
60
|
isEmpty(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Calls the specified iteratee on each indices.
|
|
63
|
+
* If called iteratee explicitly returns false, stops an iteration.
|
|
64
|
+
*
|
|
65
|
+
* @param iteratee an function called on each indices
|
|
66
|
+
*/
|
|
67
|
+
each(iteratee: DTableDataSelectionEachIteratee): void;
|
|
39
68
|
/**
|
|
40
69
|
* Returns an array of the (index, row value) pairs of selected rows.
|
|
41
70
|
* The order of pairs is an insertion order.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { utils } from "pixi.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DTableData } from "./d-table-data";
|
|
3
|
+
import { DTableDataSelectionEachIteratee, DTableDataSelectionOptions, DTableDataSelectionType } from "./d-table-data-selection";
|
|
3
4
|
import { DTableDataTreeSelection, DTableDataTreeSelectionParent } from "./d-table-data-tree-selection";
|
|
4
5
|
export declare class DTableDataTreeSelectionImpl<NODE> extends utils.EventEmitter implements DTableDataTreeSelection<NODE> {
|
|
5
6
|
protected _parent: DTableDataTreeSelectionParent<NODE>;
|
|
6
7
|
protected _type: DTableDataSelectionType;
|
|
7
8
|
protected _rows: Set<NODE>;
|
|
8
9
|
constructor(parent: DTableDataTreeSelectionParent<NODE>, options?: DTableDataSelectionOptions);
|
|
10
|
+
get parent(): DTableData<NODE>;
|
|
9
11
|
onNodeChange(nodes?: NODE[]): void;
|
|
10
12
|
protected newRows(nodes: NODE[], toChildren: (node: NODE) => NODE[] | null | undefined, rows: Set<NODE>, result: Set<NODE>): Set<NODE>;
|
|
11
13
|
get indices(): number[];
|
|
@@ -30,6 +32,7 @@ export declare class DTableDataTreeSelectionImpl<NODE> extends utils.EventEmitte
|
|
|
30
32
|
shift(rowIndex: number, amount: number): void;
|
|
31
33
|
size(): number;
|
|
32
34
|
isEmpty(): boolean;
|
|
35
|
+
each(iteratee: DTableDataSelectionEachIteratee): void;
|
|
33
36
|
toArray(): Array<[number, NODE]>;
|
|
34
37
|
toSortedArray(): Array<[number, NODE]>;
|
|
35
38
|
toObject(): Record<number, NODE>;
|
|
@@ -19,6 +19,26 @@ import { EShapeDataValueScope } from "./shape/e-shape-data-value-scope";
|
|
|
19
19
|
import { EShapeEmbedded } from "./shape/variant/e-shape-embedded";
|
|
20
20
|
import { EShapeDataValueExtensions } from "./shape/e-shape-data-value-extensions";
|
|
21
21
|
import { EShapeActionEnvironment } from "./shape/action/e-shape-action-environment";
|
|
22
|
+
var INITIAL_ZERO = "0";
|
|
23
|
+
var INITIAL_ARRAY = "[]";
|
|
24
|
+
var INITIAL_STRING = '""';
|
|
25
|
+
var INITIAL_OBJECT = "{}";
|
|
26
|
+
var INITIAL_FALSE = "false";
|
|
27
|
+
var INITIALIZER_ZERO = function () {
|
|
28
|
+
return 0;
|
|
29
|
+
};
|
|
30
|
+
var INITIALIZER_ARRAY = function () {
|
|
31
|
+
return [];
|
|
32
|
+
};
|
|
33
|
+
var INITIALIZER_STRING = function () {
|
|
34
|
+
return "";
|
|
35
|
+
};
|
|
36
|
+
var INITIALIZER_OBJECT = function () {
|
|
37
|
+
return {};
|
|
38
|
+
};
|
|
39
|
+
var INITIALIZER_FALSE = function () {
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
22
42
|
var DDiagramCanvas = /** @class */ (function (_super) {
|
|
23
43
|
__extends(DDiagramCanvas, _super);
|
|
24
44
|
function DDiagramCanvas(options) {
|
|
@@ -81,7 +101,7 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
81
101
|
});
|
|
82
102
|
this._ticker.start();
|
|
83
103
|
};
|
|
84
|
-
DDiagramCanvas.prototype.initialize_ = function (shapes, dataShape, containerShape, mapper,
|
|
104
|
+
DDiagramCanvas.prototype.initialize_ = function (shapes, dataShape, containerShape, mapper, formatters, initializers, actionValueToRuntime, canvasTicker, canvasShape, canvasData, actionables) {
|
|
85
105
|
var _loop_1 = function (i, imax) {
|
|
86
106
|
var shape = shapes[i];
|
|
87
107
|
// ID
|
|
@@ -90,7 +110,7 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
90
110
|
canvasShape.add(id, shape);
|
|
91
111
|
}
|
|
92
112
|
// Data
|
|
93
|
-
this_1.initData(shape, dataShape, containerShape, mapper,
|
|
113
|
+
this_1.initData(shape, dataShape, containerShape, mapper, formatters, initializers, canvasTicker, canvasData);
|
|
94
114
|
// Runtime
|
|
95
115
|
var runtime = new (EShapeRuntimes[shape.type] || EShapeRuntime)(shape);
|
|
96
116
|
shape.runtime = runtime;
|
|
@@ -120,7 +140,7 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
120
140
|
}
|
|
121
141
|
newContainerShape = shape;
|
|
122
142
|
}
|
|
123
|
-
this_1.initialize_(children, newDataShape, newContainerShape, mapper,
|
|
143
|
+
this_1.initialize_(children, newDataShape, newContainerShape, mapper, formatters, initializers, actionValueToRuntime, canvasTicker, canvasShape, canvasData, actionables);
|
|
124
144
|
}
|
|
125
145
|
};
|
|
126
146
|
var this_1 = this;
|
|
@@ -128,14 +148,13 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
128
148
|
_loop_1(i, imax);
|
|
129
149
|
}
|
|
130
150
|
};
|
|
131
|
-
DDiagramCanvas.prototype.initData = function (shape, dataShape, containerShape, mapper,
|
|
151
|
+
DDiagramCanvas.prototype.initData = function (shape, dataShape, containerShape, mapper, formatters, initializers, canvasTicker, canvasData) {
|
|
132
152
|
var data = shape.data;
|
|
133
|
-
var format = "";
|
|
134
|
-
var initial = "";
|
|
135
153
|
for (var i = 0, imax = data.size(); i < imax; ++i) {
|
|
136
154
|
var value = data.get(i);
|
|
137
|
-
if (value == null)
|
|
155
|
+
if (value == null) {
|
|
138
156
|
continue;
|
|
157
|
+
}
|
|
139
158
|
switch (value.type) {
|
|
140
159
|
case EShapeDataValueType.NUMBER:
|
|
141
160
|
case EShapeDataValueType.NUMBER_ARRAY:
|
|
@@ -143,95 +162,104 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
143
162
|
case EShapeDataValueType.STRING_ARRAY:
|
|
144
163
|
case EShapeDataValueType.OBJECT:
|
|
145
164
|
case EShapeDataValueType.OBJECT_ARRAY:
|
|
146
|
-
|
|
147
|
-
if (value.scope === EShapeDataValueScope.PRIVATE) {
|
|
148
|
-
var id = value.id;
|
|
149
|
-
if (0 < id.length) {
|
|
150
|
-
if (containerShape) {
|
|
151
|
-
containerShape.data.private.add(id, value);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
canvasData.private.add(id, value);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else if (value.scope === EShapeDataValueScope.PROTECTED) {
|
|
159
|
-
var id = value.id;
|
|
160
|
-
if (0 < id.length) {
|
|
161
|
-
canvasData.protected.add(id, value);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
if (mapper) {
|
|
166
|
-
mapper(value, dataShape || shape);
|
|
167
|
-
}
|
|
168
|
-
var id = value.id;
|
|
169
|
-
if (0 < id.length) {
|
|
170
|
-
canvasData.add(id, value);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Format
|
|
174
|
-
format = value.format;
|
|
175
|
-
initial = value.initial;
|
|
176
|
-
if (formatToFormatter.has(format)) {
|
|
177
|
-
value.formatter = formatToFormatter.get(format);
|
|
178
|
-
}
|
|
179
|
-
else if (0 < format.length) {
|
|
180
|
-
try {
|
|
181
|
-
var formatter = this.calcFormatter(value, format, initial);
|
|
182
|
-
formatToFormatter.set(format, formatter);
|
|
183
|
-
value.formatter = formatter;
|
|
184
|
-
}
|
|
185
|
-
catch (e) {
|
|
186
|
-
// DO NOTHING
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
// Initial
|
|
190
|
-
if (initialToInitialValue.has(initial)) {
|
|
191
|
-
value.value = initialToInitialValue.get(initial);
|
|
192
|
-
}
|
|
193
|
-
else if (0 < initial.length) {
|
|
194
|
-
try {
|
|
195
|
-
var initialValue = this.calcInitial(value, initial);
|
|
196
|
-
initialToInitialValue.set(initial, initialValue);
|
|
197
|
-
value.value = initialValue;
|
|
198
|
-
}
|
|
199
|
-
catch (e) {
|
|
200
|
-
// DO NOTHING
|
|
201
|
-
}
|
|
202
|
-
}
|
|
165
|
+
this.initDataValue(value, shape, dataShape, containerShape, mapper, formatters, initializers, canvasData);
|
|
203
166
|
break;
|
|
204
167
|
case EShapeDataValueType.TICKER:
|
|
205
|
-
|
|
206
|
-
initial = value.initial;
|
|
207
|
-
if (initialToInitialValue.has(initial)) {
|
|
208
|
-
value.value = 0;
|
|
209
|
-
canvasTicker.add(initialToInitialValue.get(initial)).add(value);
|
|
210
|
-
}
|
|
211
|
-
else if (0 < initial.length) {
|
|
212
|
-
try {
|
|
213
|
-
var initialValue = this.calcInitial(value, initial);
|
|
214
|
-
initialToInitialValue.set(initial, initialValue);
|
|
215
|
-
value.value = 0;
|
|
216
|
-
canvasTicker.add(initialValue).add(value);
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
// DO NOTHING
|
|
220
|
-
}
|
|
221
|
-
}
|
|
168
|
+
this.initDataTicker(value, initializers, canvasTicker);
|
|
222
169
|
break;
|
|
223
170
|
default:
|
|
224
|
-
|
|
225
|
-
if (extension) {
|
|
226
|
-
// Mapping
|
|
227
|
-
canvasData.extended.add(extension.id, value);
|
|
228
|
-
// Initial
|
|
229
|
-
value.value = extension.initial;
|
|
230
|
-
}
|
|
171
|
+
this.initDataExtension(value, canvasData);
|
|
231
172
|
break;
|
|
232
173
|
}
|
|
233
174
|
}
|
|
234
175
|
};
|
|
176
|
+
DDiagramCanvas.prototype.initDataValue = function (value, shape, dataShape, containerShape, mapper, formatters, initializers, canvasData) {
|
|
177
|
+
// Mapping
|
|
178
|
+
if (value.scope === EShapeDataValueScope.PRIVATE) {
|
|
179
|
+
var id = value.id;
|
|
180
|
+
if (0 < id.length) {
|
|
181
|
+
if (containerShape) {
|
|
182
|
+
containerShape.data.private.add(id, value);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
canvasData.private.add(id, value);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (value.scope === EShapeDataValueScope.PROTECTED) {
|
|
190
|
+
var id = value.id;
|
|
191
|
+
if (0 < id.length) {
|
|
192
|
+
canvasData.protected.add(id, value);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
if (mapper) {
|
|
197
|
+
mapper(value, dataShape || shape);
|
|
198
|
+
}
|
|
199
|
+
var id = value.id;
|
|
200
|
+
if (0 < id.length) {
|
|
201
|
+
canvasData.add(id, value);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Format
|
|
205
|
+
var format = value.format;
|
|
206
|
+
var initial = value.initial;
|
|
207
|
+
var formatToFormatter = formatters.get(value.type);
|
|
208
|
+
if (formatToFormatter == null) {
|
|
209
|
+
formatToFormatter = new Map();
|
|
210
|
+
formatters.set(value.type, formatToFormatter);
|
|
211
|
+
}
|
|
212
|
+
var oldFormatter = formatToFormatter.get(format);
|
|
213
|
+
if (oldFormatter != null) {
|
|
214
|
+
value.formatter = oldFormatter;
|
|
215
|
+
}
|
|
216
|
+
else if (0 < format.length) {
|
|
217
|
+
var newFormatter = this.calcFormatter(value, format, initial);
|
|
218
|
+
formatToFormatter.set(format, newFormatter);
|
|
219
|
+
value.formatter = newFormatter;
|
|
220
|
+
}
|
|
221
|
+
// Initial
|
|
222
|
+
var initialToInitializer = initializers.get(value.type);
|
|
223
|
+
if (initialToInitializer == null) {
|
|
224
|
+
initialToInitializer = new Map();
|
|
225
|
+
initializers.set(value.type, initialToInitializer);
|
|
226
|
+
}
|
|
227
|
+
var oldInitializer = initialToInitializer.get(initial);
|
|
228
|
+
if (oldInitializer != null) {
|
|
229
|
+
value.value = oldInitializer();
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
var newInitializer = this.calcInitial(value, initial);
|
|
233
|
+
initialToInitializer.set(initial, newInitializer);
|
|
234
|
+
value.value = newInitializer();
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
DDiagramCanvas.prototype.initDataTicker = function (value, initializers, canvasTicker) {
|
|
238
|
+
var initial = value.initial;
|
|
239
|
+
var initialToInitializer = initializers.get(value.type);
|
|
240
|
+
if (initialToInitializer == null) {
|
|
241
|
+
initialToInitializer = new Map();
|
|
242
|
+
initializers.set(value.type, initialToInitializer);
|
|
243
|
+
}
|
|
244
|
+
var oldInitializer = initialToInitializer.get(initial);
|
|
245
|
+
if (oldInitializer !== undefined) {
|
|
246
|
+
value.value = 0;
|
|
247
|
+
canvasTicker.add(oldInitializer()).add(value);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
var newInitializer = this.calcInitial(value, initial);
|
|
251
|
+
initialToInitializer.set(initial, newInitializer);
|
|
252
|
+
value.value = 0;
|
|
253
|
+
canvasTicker.add(newInitializer()).add(value);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
DDiagramCanvas.prototype.initDataExtension = function (value, canvasData) {
|
|
257
|
+
var extension = EShapeDataValueExtensions.get(value.type);
|
|
258
|
+
if (extension) {
|
|
259
|
+
canvasData.extended.add(extension.id, value);
|
|
260
|
+
value.value = extension.initial;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
235
263
|
DDiagramCanvas.prototype.initActions = function (shape, shapeRuntime, valueToRuntime) {
|
|
236
264
|
var values = shape.action.values;
|
|
237
265
|
var runtimes = shapeRuntime.actions;
|
|
@@ -254,50 +282,92 @@ var DDiagramCanvas = /** @class */ (function (_super) {
|
|
|
254
282
|
};
|
|
255
283
|
DDiagramCanvas.prototype.calcFormatter = function (value, format, initial) {
|
|
256
284
|
var def = this.toInitial(value);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"return (".concat(format, ");") +
|
|
261
|
-
"} catch( e1 ) {" +
|
|
285
|
+
try {
|
|
286
|
+
return Function("value",
|
|
287
|
+
/* eslint-disable prettier/prettier */
|
|
262
288
|
"try {" +
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
289
|
+
"return (".concat(format, ");") +
|
|
290
|
+
"} catch( e1 ) {" +
|
|
291
|
+
"try {" +
|
|
292
|
+
"return (".concat(0 < initial.length ? initial : def, ");") +
|
|
293
|
+
"} catch( e2 ) {" +
|
|
294
|
+
"return ".concat(def, ";") +
|
|
295
|
+
"}" +
|
|
296
|
+
"}"
|
|
297
|
+
/* eslint-enable prettier/prettier */
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
catch (e) {
|
|
301
|
+
return this.toInitializer(value);
|
|
302
|
+
}
|
|
270
303
|
};
|
|
271
304
|
DDiagramCanvas.prototype.calcInitial = function (value, initial) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
|
|
305
|
+
if (initial.length <= 0) {
|
|
306
|
+
return this.toInitializer(value);
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
return Function(
|
|
310
|
+
/* eslint-disable prettier/prettier */
|
|
311
|
+
"try {" +
|
|
312
|
+
"return (".concat(initial, ");") +
|
|
313
|
+
"} catch( e ) {" +
|
|
314
|
+
"return ".concat(this.toInitial(value), ";") +
|
|
315
|
+
"}"
|
|
316
|
+
/* eslint-enable prettier/prettier */
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
catch (e) {
|
|
320
|
+
return this.toInitializer(value);
|
|
321
|
+
}
|
|
281
322
|
};
|
|
282
323
|
DDiagramCanvas.prototype.toInitial = function (value) {
|
|
283
324
|
var valueType = value.type;
|
|
284
325
|
switch (valueType) {
|
|
285
326
|
case EShapeDataValueType.NUMBER:
|
|
286
|
-
return
|
|
327
|
+
return INITIAL_ZERO;
|
|
328
|
+
case EShapeDataValueType.NUMBER_ARRAY:
|
|
329
|
+
return INITIAL_ARRAY;
|
|
330
|
+
case EShapeDataValueType.STRING:
|
|
331
|
+
return INITIAL_STRING;
|
|
332
|
+
case EShapeDataValueType.STRING_ARRAY:
|
|
333
|
+
return INITIAL_ARRAY;
|
|
334
|
+
case EShapeDataValueType.OBJECT:
|
|
335
|
+
return INITIAL_OBJECT;
|
|
336
|
+
case EShapeDataValueType.OBJECT_ARRAY:
|
|
337
|
+
return INITIAL_ARRAY;
|
|
338
|
+
case EShapeDataValueType.TICKER:
|
|
339
|
+
return INITIAL_ZERO;
|
|
340
|
+
case EShapeDataValueType.BOOLEAN:
|
|
341
|
+
return INITIAL_FALSE;
|
|
342
|
+
case EShapeDataValueType.BOOLEAN_ARRAY:
|
|
343
|
+
return INITIAL_ARRAY;
|
|
344
|
+
default:
|
|
345
|
+
return INITIAL_ZERO;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
DDiagramCanvas.prototype.toInitializer = function (value) {
|
|
349
|
+
var valueType = value.type;
|
|
350
|
+
switch (valueType) {
|
|
351
|
+
case EShapeDataValueType.NUMBER:
|
|
352
|
+
return INITIALIZER_ZERO;
|
|
287
353
|
case EShapeDataValueType.NUMBER_ARRAY:
|
|
288
|
-
return
|
|
354
|
+
return INITIALIZER_ARRAY;
|
|
289
355
|
case EShapeDataValueType.STRING:
|
|
290
|
-
return
|
|
356
|
+
return INITIALIZER_STRING;
|
|
291
357
|
case EShapeDataValueType.STRING_ARRAY:
|
|
292
|
-
return
|
|
358
|
+
return INITIALIZER_ARRAY;
|
|
293
359
|
case EShapeDataValueType.OBJECT:
|
|
294
|
-
return
|
|
360
|
+
return INITIALIZER_OBJECT;
|
|
295
361
|
case EShapeDataValueType.OBJECT_ARRAY:
|
|
296
|
-
return
|
|
362
|
+
return INITIALIZER_ARRAY;
|
|
297
363
|
case EShapeDataValueType.TICKER:
|
|
298
|
-
return
|
|
364
|
+
return INITIALIZER_ZERO;
|
|
365
|
+
case EShapeDataValueType.BOOLEAN:
|
|
366
|
+
return INITIALIZER_FALSE;
|
|
367
|
+
case EShapeDataValueType.BOOLEAN_ARRAY:
|
|
368
|
+
return INITIALIZER_ARRAY;
|
|
299
369
|
default:
|
|
300
|
-
return
|
|
370
|
+
return INITIALIZER_ZERO;
|
|
301
371
|
}
|
|
302
372
|
};
|
|
303
373
|
DDiagramCanvas.prototype.onDestroy = function () {
|