1 | (function (factory) {
|
2 | if (typeof module === "object" && typeof module.exports === "object") {
|
3 | var v = factory(require, exports);
|
4 | if (v !== undefined) module.exports = v;
|
5 | }
|
6 | else if (typeof define === "function" && define.amd) {
|
7 | define(["require", "exports", "../release/go.js"], factory);
|
8 | }
|
9 | })(function (require, exports) {
|
10 | 'use strict';
|
11 | Object.defineProperty(exports, "__esModule", { value: true });
|
12 | exports.init = void 0;
|
13 | |
14 |
|
15 |
|
16 | var go = require("../release/go.js");
|
17 | function init() {
|
18 | if (window.goSamples)
|
19 | window.goSamples();
|
20 | var $ = go.GraphObject.make;
|
21 | var myDiagram = $(go.Diagram, 'myDiagramDiv',
|
22 | {
|
23 | 'undoManager.isEnabled': true
|
24 | });
|
25 |
|
26 | myDiagram.nodeTemplate =
|
27 | $(go.Node, 'Auto',
|
28 | $(go.Shape, 'RoundedRectangle', { strokeWidth: 0 },
|
29 |
|
30 | new go.Binding('fill', 'color')), $(go.TextBlock, { margin: 8 },
|
31 |
|
32 | new go.Binding('text', 'key')));
|
33 |
|
34 |
|
35 | myDiagram.model = new go.GraphLinksModel([
|
36 | { key: 'Alpha', color: 'lightblue' },
|
37 | { key: 'Beta', color: 'orange' },
|
38 | { key: 'Gamma', color: 'lightgreen' },
|
39 | { key: 'Delta', color: 'pink' }
|
40 | ], [
|
41 | { from: 'Alpha', to: 'Beta' },
|
42 | { from: 'Alpha', to: 'Gamma' },
|
43 | { from: 'Beta', to: 'Beta' },
|
44 | { from: 'Gamma', to: 'Delta' },
|
45 | { from: 'Delta', to: 'Alpha' }
|
46 | ]);
|
47 |
|
48 | window.myDiagram = myDiagram;
|
49 | }
|
50 | exports.init = init;
|
51 | });
|