@daoyi/nmtl-ui 2.0.1-beta.52 → 2.0.1-beta.53

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 (81) hide show
  1. package/lib/components/Autocomplete-3dae80ca.js +335 -0
  2. package/lib/components/Autocomplete.js +13 -0
  3. package/lib/components/Avatar.js +49 -0
  4. package/lib/components/BackTop.js +109 -0
  5. package/lib/components/BarChart.js +762 -0
  6. package/lib/components/Breadcrumbs.js +122 -0
  7. package/lib/components/Button-433372aa.js +92 -0
  8. package/lib/components/Button.js +6 -0
  9. package/lib/components/Carousel.js +4654 -0
  10. package/lib/components/Checkbox.js +37 -0
  11. package/lib/components/CollapseContent.js +179 -0
  12. package/lib/components/ContactModal-66bcb5d3.js +10779 -0
  13. package/lib/components/ContactModal.js +22 -0
  14. package/lib/components/Drawer-df3535c2.js +157 -0
  15. package/lib/components/Drawer.js +11 -0
  16. package/lib/components/Dropdown.js +134 -0
  17. package/lib/components/Empty-7318f658.js +45 -0
  18. package/lib/components/Empty.js +5 -0
  19. package/lib/components/ExportButton.js +112 -0
  20. package/lib/components/ExtraTools-b0bb9399.js +3537 -0
  21. package/lib/components/ExtraTools.js +10 -0
  22. package/lib/components/Filter.js +776 -0
  23. package/lib/components/Footer.js +271 -0
  24. package/lib/components/ForwardLink-0571e627.js +105 -0
  25. package/lib/components/ForwardLink.js +9 -0
  26. package/lib/components/Header.js +187 -0
  27. package/lib/components/Image.js +61 -0
  28. package/lib/components/Input.js +77 -0
  29. package/lib/components/InputMethod.js +33963 -0
  30. package/lib/components/KeywordSearch-568a8a44.js +139 -0
  31. package/lib/components/KeywordSearch.js +15 -0
  32. package/lib/components/KeywordTicker.js +190 -0
  33. package/lib/components/Keywords.js +317 -0
  34. package/lib/components/Loading.js +28 -0
  35. package/lib/components/MUITheme.js +2627 -0
  36. package/lib/components/Modal-64c4ab0d.js +108 -0
  37. package/lib/components/Modal.js +9 -0
  38. package/lib/components/MoreButton-6654cc5b.js +110 -0
  39. package/lib/components/MoreButton.js +6 -0
  40. package/lib/components/Radio.js +78 -0
  41. package/lib/components/SNA.js +1691 -0
  42. package/lib/components/Select-113372b2.js +115 -0
  43. package/lib/components/Select.js +8 -0
  44. package/lib/components/Spin-8a5a600d.js +75 -0
  45. package/lib/components/Spin.js +6 -0
  46. package/lib/components/Table.js +51 -0
  47. package/lib/components/Tooltip-abe1205f.js +70 -0
  48. package/lib/components/Tooltip.js +7 -0
  49. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  50. package/lib/components/_rollupPluginBabelHelpers-3d9c8289.js +478 -0
  51. package/lib/components/createSvgIcon-a79ae4b1.js +576 -0
  52. package/lib/components/dataExport-d55d6fa3.js +92 -0
  53. package/lib/components/debounce-127da66c.js +355 -0
  54. package/lib/components/defaultTheme-19a14721.js +1485 -0
  55. package/lib/components/globalConfig.js +172 -0
  56. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  57. package/lib/components/index-66babe67.js +61 -0
  58. package/lib/components/index-fdcc884e.js +481 -0
  59. package/lib/components/isObjectLike-e111475d.js +190 -0
  60. package/lib/components/style-inject.es-1f59c1d0.js +28 -0
  61. package/lib/components/transform-3a04288b.js +5475 -0
  62. package/lib/index.d.ts +36 -0
  63. package/lib/index.js +36 -0
  64. package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.js +121 -0
  65. package/lib/utils/arrayMerge.js +100 -0
  66. package/lib/utils/chunkArray.js +15 -0
  67. package/lib/utils/convert2HtmlEntities.js +42 -0
  68. package/lib/utils/domToImage.js +802 -0
  69. package/lib/utils/downloadGephi.js +106 -0
  70. package/lib/utils/exportXlsx.js +219 -0
  71. package/lib/utils/historyAppendSearch.js +502 -0
  72. package/lib/utils/index.d.ts +13 -0
  73. package/lib/utils/index.js +13 -0
  74. package/lib/utils/isDevelopMode.js +5 -0
  75. package/lib/utils/parseYMD.js +36 -0
  76. package/lib/utils/removeDuplicateItem.js +11 -0
  77. package/lib/utils/sendEmail.js +39 -0
  78. package/lib/utils/snaDefine-6a2bcd94.js +5 -0
  79. package/lib/utils/snaDefine.js +1 -0
  80. package/lib/utils/snaPreProcess.js +84 -0
  81. package/package.json +1 -1
@@ -0,0 +1,1691 @@
1
+ import React__default, { useMemo, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { c as classNames } from './index-66babe67.js';
4
+ import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
+ import { E as ExtraTools } from './ExtraTools-b0bb9399.js';
6
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
+ import './_rollupPluginBabelHelpers-3d9c8289.js';
8
+ import './_commonjsHelpers-70de2c37.js';
9
+ import '@material-ui/core';
10
+ import './Tooltip-abe1205f.js';
11
+ import './dataExport-d55d6fa3.js';
12
+
13
+ function sourceEvent() {
14
+ var current = event, source;
15
+ while (source = current.sourceEvent) current = source;
16
+ return current;
17
+ }
18
+
19
+ function point(node, event) {
20
+ var svg = node.ownerSVGElement || node;
21
+
22
+ if (svg.createSVGPoint) {
23
+ var point = svg.createSVGPoint();
24
+ point.x = event.clientX, point.y = event.clientY;
25
+ point = point.matrixTransform(node.getScreenCTM().inverse());
26
+ return [point.x, point.y];
27
+ }
28
+
29
+ var rect = node.getBoundingClientRect();
30
+ return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
31
+ }
32
+
33
+ function mouse(node) {
34
+ var event = sourceEvent();
35
+ if (event.changedTouches) event = event.changedTouches[0];
36
+ return point(node, event);
37
+ }
38
+
39
+ function touch(node, touches, identifier) {
40
+ if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
41
+
42
+ for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
43
+ if ((touch = touches[i]).identifier === identifier) {
44
+ return point(node, touch);
45
+ }
46
+ }
47
+
48
+ return null;
49
+ }
50
+
51
+ function nopropagation$1() {
52
+ event.stopImmediatePropagation();
53
+ }
54
+
55
+ function noevent$1() {
56
+ event.preventDefault();
57
+ event.stopImmediatePropagation();
58
+ }
59
+
60
+ function dragDisable(view) {
61
+ var root = view.document.documentElement,
62
+ selection = d3Select(view).on("dragstart.drag", noevent$1, true);
63
+ if ("onselectstart" in root) {
64
+ selection.on("selectstart.drag", noevent$1, true);
65
+ } else {
66
+ root.__noselect = root.style.MozUserSelect;
67
+ root.style.MozUserSelect = "none";
68
+ }
69
+ }
70
+
71
+ function yesdrag(view, noclick) {
72
+ var root = view.document.documentElement,
73
+ selection = d3Select(view).on("dragstart.drag", null);
74
+ if (noclick) {
75
+ selection.on("click.drag", noevent$1, true);
76
+ setTimeout(function() { selection.on("click.drag", null); }, 0);
77
+ }
78
+ if ("onselectstart" in root) {
79
+ selection.on("selectstart.drag", null);
80
+ } else {
81
+ root.style.MozUserSelect = root.__noselect;
82
+ delete root.__noselect;
83
+ }
84
+ }
85
+
86
+ function constant$2(x) {
87
+ return function() {
88
+ return x;
89
+ };
90
+ }
91
+
92
+ // Ignore right-click, since that should open the context menu.
93
+ function defaultFilter$1() {
94
+ return !event.ctrlKey && !event.button;
95
+ }
96
+
97
+ function defaultContainer() {
98
+ return this.parentNode;
99
+ }
100
+
101
+ function defaultSubject(d) {
102
+ return d == null ? {x: event.x, y: event.y} : d;
103
+ }
104
+
105
+ function defaultTouchable$1() {
106
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
107
+ }
108
+
109
+ function drag() {
110
+ var filter = defaultFilter$1,
111
+ container = defaultContainer,
112
+ subject = defaultSubject,
113
+ touchable = defaultTouchable$1,
114
+ gestures = {},
115
+ listeners = dispatch("start", "drag", "end"),
116
+ active = 0,
117
+ mousedownx,
118
+ mousedowny,
119
+ mousemoving,
120
+ touchending,
121
+ clickDistance2 = 0;
122
+
123
+ function drag(selection) {
124
+ selection
125
+ .on("mousedown.drag", mousedowned)
126
+ .filter(touchable)
127
+ .on("touchstart.drag", touchstarted)
128
+ .on("touchmove.drag", touchmoved)
129
+ .on("touchend.drag touchcancel.drag", touchended)
130
+ .style("touch-action", "none")
131
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
132
+ }
133
+
134
+ function mousedowned() {
135
+ if (touchending || !filter.apply(this, arguments)) return;
136
+ var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
137
+ if (!gesture) return;
138
+ d3Select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
139
+ dragDisable(event.view);
140
+ nopropagation$1();
141
+ mousemoving = false;
142
+ mousedownx = event.clientX;
143
+ mousedowny = event.clientY;
144
+ gesture("start");
145
+ }
146
+
147
+ function mousemoved() {
148
+ noevent$1();
149
+ if (!mousemoving) {
150
+ var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
151
+ mousemoving = dx * dx + dy * dy > clickDistance2;
152
+ }
153
+ gestures.mouse("drag");
154
+ }
155
+
156
+ function mouseupped() {
157
+ d3Select(event.view).on("mousemove.drag mouseup.drag", null);
158
+ yesdrag(event.view, mousemoving);
159
+ noevent$1();
160
+ gestures.mouse("end");
161
+ }
162
+
163
+ function touchstarted() {
164
+ if (!filter.apply(this, arguments)) return;
165
+ var touches = event.changedTouches,
166
+ c = container.apply(this, arguments),
167
+ n = touches.length, i, gesture;
168
+
169
+ for (i = 0; i < n; ++i) {
170
+ if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
171
+ nopropagation$1();
172
+ gesture("start");
173
+ }
174
+ }
175
+ }
176
+
177
+ function touchmoved() {
178
+ var touches = event.changedTouches,
179
+ n = touches.length, i, gesture;
180
+
181
+ for (i = 0; i < n; ++i) {
182
+ if (gesture = gestures[touches[i].identifier]) {
183
+ noevent$1();
184
+ gesture("drag");
185
+ }
186
+ }
187
+ }
188
+
189
+ function touchended() {
190
+ var touches = event.changedTouches,
191
+ n = touches.length, i, gesture;
192
+
193
+ if (touchending) clearTimeout(touchending);
194
+ touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
195
+ for (i = 0; i < n; ++i) {
196
+ if (gesture = gestures[touches[i].identifier]) {
197
+ nopropagation$1();
198
+ gesture("end");
199
+ }
200
+ }
201
+ }
202
+
203
+ function beforestart(id, container, point, that, args) {
204
+ var p = point(container, id), s, dx, dy,
205
+ sublisteners = listeners.copy();
206
+
207
+ if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
208
+ if ((event.subject = s = subject.apply(that, args)) == null) return false;
209
+ dx = s.x - p[0] || 0;
210
+ dy = s.y - p[1] || 0;
211
+ return true;
212
+ })) return;
213
+
214
+ return function gesture(type) {
215
+ var p0 = p, n;
216
+ switch (type) {
217
+ case "start": gestures[id] = gesture, n = active++; break;
218
+ case "end": delete gestures[id], --active; // nobreak
219
+ case "drag": p = point(container, id), n = active; break;
220
+ }
221
+ customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
222
+ };
223
+ }
224
+
225
+ drag.filter = function(_) {
226
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), drag) : filter;
227
+ };
228
+
229
+ drag.container = function(_) {
230
+ return arguments.length ? (container = typeof _ === "function" ? _ : constant$2(_), drag) : container;
231
+ };
232
+
233
+ drag.subject = function(_) {
234
+ return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject;
235
+ };
236
+
237
+ drag.touchable = function(_) {
238
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), drag) : touchable;
239
+ };
240
+
241
+ drag.on = function() {
242
+ var value = listeners.on.apply(listeners, arguments);
243
+ return value === listeners ? drag : value;
244
+ };
245
+
246
+ drag.clickDistance = function(_) {
247
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
248
+ };
249
+
250
+ return drag;
251
+ }
252
+
253
+ var rho = Math.SQRT2,
254
+ rho2 = 2,
255
+ rho4 = 4,
256
+ epsilon2 = 1e-12;
257
+
258
+ function cosh(x) {
259
+ return ((x = Math.exp(x)) + 1 / x) / 2;
260
+ }
261
+
262
+ function sinh(x) {
263
+ return ((x = Math.exp(x)) - 1 / x) / 2;
264
+ }
265
+
266
+ function tanh(x) {
267
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
268
+ }
269
+
270
+ // p0 = [ux0, uy0, w0]
271
+ // p1 = [ux1, uy1, w1]
272
+ function interpolateZoom(p0, p1) {
273
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
274
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
275
+ dx = ux1 - ux0,
276
+ dy = uy1 - uy0,
277
+ d2 = dx * dx + dy * dy,
278
+ i,
279
+ S;
280
+
281
+ // Special case for u0 ≅ u1.
282
+ if (d2 < epsilon2) {
283
+ S = Math.log(w1 / w0) / rho;
284
+ i = function(t) {
285
+ return [
286
+ ux0 + t * dx,
287
+ uy0 + t * dy,
288
+ w0 * Math.exp(rho * t * S)
289
+ ];
290
+ };
291
+ }
292
+
293
+ // General case.
294
+ else {
295
+ var d1 = Math.sqrt(d2),
296
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
297
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
298
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
299
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
300
+ S = (r1 - r0) / rho;
301
+ i = function(t) {
302
+ var s = t * S,
303
+ coshr0 = cosh(r0),
304
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
305
+ return [
306
+ ux0 + u * dx,
307
+ uy0 + u * dy,
308
+ w0 * coshr0 / cosh(rho * s + r0)
309
+ ];
310
+ };
311
+ }
312
+
313
+ i.duration = S * 1000;
314
+
315
+ return i;
316
+ }
317
+
318
+ function center(x, y) {
319
+ var nodes;
320
+
321
+ if (x == null) x = 0;
322
+ if (y == null) y = 0;
323
+
324
+ function force() {
325
+ var i,
326
+ n = nodes.length,
327
+ node,
328
+ sx = 0,
329
+ sy = 0;
330
+
331
+ for (i = 0; i < n; ++i) {
332
+ node = nodes[i], sx += node.x, sy += node.y;
333
+ }
334
+
335
+ for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {
336
+ node = nodes[i], node.x -= sx, node.y -= sy;
337
+ }
338
+ }
339
+
340
+ force.initialize = function(_) {
341
+ nodes = _;
342
+ };
343
+
344
+ force.x = function(_) {
345
+ return arguments.length ? (x = +_, force) : x;
346
+ };
347
+
348
+ force.y = function(_) {
349
+ return arguments.length ? (y = +_, force) : y;
350
+ };
351
+
352
+ return force;
353
+ }
354
+
355
+ function constant$1(x) {
356
+ return function() {
357
+ return x;
358
+ };
359
+ }
360
+
361
+ function jiggle() {
362
+ return (Math.random() - 0.5) * 1e-6;
363
+ }
364
+
365
+ function x$2(d) {
366
+ return d.x + d.vx;
367
+ }
368
+
369
+ function y$2(d) {
370
+ return d.y + d.vy;
371
+ }
372
+
373
+ function collide(radius) {
374
+ var nodes,
375
+ radii,
376
+ strength = 1,
377
+ iterations = 1;
378
+
379
+ if (typeof radius !== "function") radius = constant$1(radius == null ? 1 : +radius);
380
+
381
+ function force() {
382
+ var i, n = nodes.length,
383
+ tree,
384
+ node,
385
+ xi,
386
+ yi,
387
+ ri,
388
+ ri2;
389
+
390
+ for (var k = 0; k < iterations; ++k) {
391
+ tree = quadtree(nodes, x$2, y$2).visitAfter(prepare);
392
+ for (i = 0; i < n; ++i) {
393
+ node = nodes[i];
394
+ ri = radii[node.index], ri2 = ri * ri;
395
+ xi = node.x + node.vx;
396
+ yi = node.y + node.vy;
397
+ tree.visit(apply);
398
+ }
399
+ }
400
+
401
+ function apply(quad, x0, y0, x1, y1) {
402
+ var data = quad.data, rj = quad.r, r = ri + rj;
403
+ if (data) {
404
+ if (data.index > node.index) {
405
+ var x = xi - data.x - data.vx,
406
+ y = yi - data.y - data.vy,
407
+ l = x * x + y * y;
408
+ if (l < r * r) {
409
+ if (x === 0) x = jiggle(), l += x * x;
410
+ if (y === 0) y = jiggle(), l += y * y;
411
+ l = (r - (l = Math.sqrt(l))) / l * strength;
412
+ node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
413
+ node.vy += (y *= l) * r;
414
+ data.vx -= x * (r = 1 - r);
415
+ data.vy -= y * r;
416
+ }
417
+ }
418
+ return;
419
+ }
420
+ return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
421
+ }
422
+ }
423
+
424
+ function prepare(quad) {
425
+ if (quad.data) return quad.r = radii[quad.data.index];
426
+ for (var i = quad.r = 0; i < 4; ++i) {
427
+ if (quad[i] && quad[i].r > quad.r) {
428
+ quad.r = quad[i].r;
429
+ }
430
+ }
431
+ }
432
+
433
+ function initialize() {
434
+ if (!nodes) return;
435
+ var i, n = nodes.length, node;
436
+ radii = new Array(n);
437
+ for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
438
+ }
439
+
440
+ force.initialize = function(_) {
441
+ nodes = _;
442
+ initialize();
443
+ };
444
+
445
+ force.iterations = function(_) {
446
+ return arguments.length ? (iterations = +_, force) : iterations;
447
+ };
448
+
449
+ force.strength = function(_) {
450
+ return arguments.length ? (strength = +_, force) : strength;
451
+ };
452
+
453
+ force.radius = function(_) {
454
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
455
+ };
456
+
457
+ return force;
458
+ }
459
+
460
+ function index(d) {
461
+ return d.index;
462
+ }
463
+
464
+ function find(nodeById, nodeId) {
465
+ var node = nodeById.get(nodeId);
466
+ if (!node) throw new Error("missing: " + nodeId);
467
+ return node;
468
+ }
469
+
470
+ function link(links) {
471
+ var id = index,
472
+ strength = defaultStrength,
473
+ strengths,
474
+ distance = constant$1(30),
475
+ distances,
476
+ nodes,
477
+ count,
478
+ bias,
479
+ iterations = 1;
480
+
481
+ if (links == null) links = [];
482
+
483
+ function defaultStrength(link) {
484
+ return 1 / Math.min(count[link.source.index], count[link.target.index]);
485
+ }
486
+
487
+ function force(alpha) {
488
+ for (var k = 0, n = links.length; k < iterations; ++k) {
489
+ for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
490
+ link = links[i], source = link.source, target = link.target;
491
+ x = target.x + target.vx - source.x - source.vx || jiggle();
492
+ y = target.y + target.vy - source.y - source.vy || jiggle();
493
+ l = Math.sqrt(x * x + y * y);
494
+ l = (l - distances[i]) / l * alpha * strengths[i];
495
+ x *= l, y *= l;
496
+ target.vx -= x * (b = bias[i]);
497
+ target.vy -= y * b;
498
+ source.vx += x * (b = 1 - b);
499
+ source.vy += y * b;
500
+ }
501
+ }
502
+ }
503
+
504
+ function initialize() {
505
+ if (!nodes) return;
506
+
507
+ var i,
508
+ n = nodes.length,
509
+ m = links.length,
510
+ nodeById = map(nodes, id),
511
+ link;
512
+
513
+ for (i = 0, count = new Array(n); i < m; ++i) {
514
+ link = links[i], link.index = i;
515
+ if (typeof link.source !== "object") link.source = find(nodeById, link.source);
516
+ if (typeof link.target !== "object") link.target = find(nodeById, link.target);
517
+ count[link.source.index] = (count[link.source.index] || 0) + 1;
518
+ count[link.target.index] = (count[link.target.index] || 0) + 1;
519
+ }
520
+
521
+ for (i = 0, bias = new Array(m); i < m; ++i) {
522
+ link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
523
+ }
524
+
525
+ strengths = new Array(m), initializeStrength();
526
+ distances = new Array(m), initializeDistance();
527
+ }
528
+
529
+ function initializeStrength() {
530
+ if (!nodes) return;
531
+
532
+ for (var i = 0, n = links.length; i < n; ++i) {
533
+ strengths[i] = +strength(links[i], i, links);
534
+ }
535
+ }
536
+
537
+ function initializeDistance() {
538
+ if (!nodes) return;
539
+
540
+ for (var i = 0, n = links.length; i < n; ++i) {
541
+ distances[i] = +distance(links[i], i, links);
542
+ }
543
+ }
544
+
545
+ force.initialize = function(_) {
546
+ nodes = _;
547
+ initialize();
548
+ };
549
+
550
+ force.links = function(_) {
551
+ return arguments.length ? (links = _, initialize(), force) : links;
552
+ };
553
+
554
+ force.id = function(_) {
555
+ return arguments.length ? (id = _, force) : id;
556
+ };
557
+
558
+ force.iterations = function(_) {
559
+ return arguments.length ? (iterations = +_, force) : iterations;
560
+ };
561
+
562
+ force.strength = function(_) {
563
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force) : strength;
564
+ };
565
+
566
+ force.distance = function(_) {
567
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force) : distance;
568
+ };
569
+
570
+ return force;
571
+ }
572
+
573
+ function x$1(d) {
574
+ return d.x;
575
+ }
576
+
577
+ function y$1(d) {
578
+ return d.y;
579
+ }
580
+
581
+ var initialRadius = 10,
582
+ initialAngle = Math.PI * (3 - Math.sqrt(5));
583
+
584
+ function simulation(nodes) {
585
+ var simulation,
586
+ alpha = 1,
587
+ alphaMin = 0.001,
588
+ alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
589
+ alphaTarget = 0,
590
+ velocityDecay = 0.6,
591
+ forces = map(),
592
+ stepper = timer(step),
593
+ event = dispatch("tick", "end");
594
+
595
+ if (nodes == null) nodes = [];
596
+
597
+ function step() {
598
+ tick();
599
+ event.call("tick", simulation);
600
+ if (alpha < alphaMin) {
601
+ stepper.stop();
602
+ event.call("end", simulation);
603
+ }
604
+ }
605
+
606
+ function tick(iterations) {
607
+ var i, n = nodes.length, node;
608
+
609
+ if (iterations === undefined) iterations = 1;
610
+
611
+ for (var k = 0; k < iterations; ++k) {
612
+ alpha += (alphaTarget - alpha) * alphaDecay;
613
+
614
+ forces.each(function (force) {
615
+ force(alpha);
616
+ });
617
+
618
+ for (i = 0; i < n; ++i) {
619
+ node = nodes[i];
620
+ if (node.fx == null) node.x += node.vx *= velocityDecay;
621
+ else node.x = node.fx, node.vx = 0;
622
+ if (node.fy == null) node.y += node.vy *= velocityDecay;
623
+ else node.y = node.fy, node.vy = 0;
624
+ }
625
+ }
626
+
627
+ return simulation;
628
+ }
629
+
630
+ function initializeNodes() {
631
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
632
+ node = nodes[i], node.index = i;
633
+ if (node.fx != null) node.x = node.fx;
634
+ if (node.fy != null) node.y = node.fy;
635
+ if (isNaN(node.x) || isNaN(node.y)) {
636
+ var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
637
+ node.x = radius * Math.cos(angle);
638
+ node.y = radius * Math.sin(angle);
639
+ }
640
+ if (isNaN(node.vx) || isNaN(node.vy)) {
641
+ node.vx = node.vy = 0;
642
+ }
643
+ }
644
+ }
645
+
646
+ function initializeForce(force) {
647
+ if (force.initialize) force.initialize(nodes);
648
+ return force;
649
+ }
650
+
651
+ initializeNodes();
652
+
653
+ return simulation = {
654
+ tick: tick,
655
+
656
+ restart: function() {
657
+ return stepper.restart(step), simulation;
658
+ },
659
+
660
+ stop: function() {
661
+ return stepper.stop(), simulation;
662
+ },
663
+
664
+ nodes: function(_) {
665
+ return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;
666
+ },
667
+
668
+ alpha: function(_) {
669
+ return arguments.length ? (alpha = +_, simulation) : alpha;
670
+ },
671
+
672
+ alphaMin: function(_) {
673
+ return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
674
+ },
675
+
676
+ alphaDecay: function(_) {
677
+ return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
678
+ },
679
+
680
+ alphaTarget: function(_) {
681
+ return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
682
+ },
683
+
684
+ velocityDecay: function(_) {
685
+ return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
686
+ },
687
+
688
+ force: function(name, _) {
689
+ return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
690
+ },
691
+
692
+ find: function(x, y, radius) {
693
+ var i = 0,
694
+ n = nodes.length,
695
+ dx,
696
+ dy,
697
+ d2,
698
+ node,
699
+ closest;
700
+
701
+ if (radius == null) radius = Infinity;
702
+ else radius *= radius;
703
+
704
+ for (i = 0; i < n; ++i) {
705
+ node = nodes[i];
706
+ dx = x - node.x;
707
+ dy = y - node.y;
708
+ d2 = dx * dx + dy * dy;
709
+ if (d2 < radius) closest = node, radius = d2;
710
+ }
711
+
712
+ return closest;
713
+ },
714
+
715
+ on: function(name, _) {
716
+ return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
717
+ }
718
+ };
719
+ }
720
+
721
+ function manyBody() {
722
+ var nodes,
723
+ node,
724
+ alpha,
725
+ strength = constant$1(-30),
726
+ strengths,
727
+ distanceMin2 = 1,
728
+ distanceMax2 = Infinity,
729
+ theta2 = 0.81;
730
+
731
+ function force(_) {
732
+ var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);
733
+ for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
734
+ }
735
+
736
+ function initialize() {
737
+ if (!nodes) return;
738
+ var i, n = nodes.length, node;
739
+ strengths = new Array(n);
740
+ for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
741
+ }
742
+
743
+ function accumulate(quad) {
744
+ var strength = 0, q, c, weight = 0, x, y, i;
745
+
746
+ // For internal nodes, accumulate forces from child quadrants.
747
+ if (quad.length) {
748
+ for (x = y = i = 0; i < 4; ++i) {
749
+ if ((q = quad[i]) && (c = Math.abs(q.value))) {
750
+ strength += q.value, weight += c, x += c * q.x, y += c * q.y;
751
+ }
752
+ }
753
+ quad.x = x / weight;
754
+ quad.y = y / weight;
755
+ }
756
+
757
+ // For leaf nodes, accumulate forces from coincident quadrants.
758
+ else {
759
+ q = quad;
760
+ q.x = q.data.x;
761
+ q.y = q.data.y;
762
+ do strength += strengths[q.data.index];
763
+ while (q = q.next);
764
+ }
765
+
766
+ quad.value = strength;
767
+ }
768
+
769
+ function apply(quad, x1, _, x2) {
770
+ if (!quad.value) return true;
771
+
772
+ var x = quad.x - node.x,
773
+ y = quad.y - node.y,
774
+ w = x2 - x1,
775
+ l = x * x + y * y;
776
+
777
+ // Apply the Barnes-Hut approximation if possible.
778
+ // Limit forces for very close nodes; randomize direction if coincident.
779
+ if (w * w / theta2 < l) {
780
+ if (l < distanceMax2) {
781
+ if (x === 0) x = jiggle(), l += x * x;
782
+ if (y === 0) y = jiggle(), l += y * y;
783
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
784
+ node.vx += x * quad.value * alpha / l;
785
+ node.vy += y * quad.value * alpha / l;
786
+ }
787
+ return true;
788
+ }
789
+
790
+ // Otherwise, process points directly.
791
+ else if (quad.length || l >= distanceMax2) return;
792
+
793
+ // Limit forces for very close nodes; randomize direction if coincident.
794
+ if (quad.data !== node || quad.next) {
795
+ if (x === 0) x = jiggle(), l += x * x;
796
+ if (y === 0) y = jiggle(), l += y * y;
797
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
798
+ }
799
+
800
+ do if (quad.data !== node) {
801
+ w = strengths[quad.data.index] * alpha / l;
802
+ node.vx += x * w;
803
+ node.vy += y * w;
804
+ } while (quad = quad.next);
805
+ }
806
+
807
+ force.initialize = function(_) {
808
+ nodes = _;
809
+ initialize();
810
+ };
811
+
812
+ force.strength = function(_) {
813
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
814
+ };
815
+
816
+ force.distanceMin = function(_) {
817
+ return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
818
+ };
819
+
820
+ force.distanceMax = function(_) {
821
+ return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
822
+ };
823
+
824
+ force.theta = function(_) {
825
+ return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
826
+ };
827
+
828
+ return force;
829
+ }
830
+
831
+ function radial(radius, x, y) {
832
+ var nodes,
833
+ strength = constant$1(0.1),
834
+ strengths,
835
+ radiuses;
836
+
837
+ if (typeof radius !== "function") radius = constant$1(+radius);
838
+ if (x == null) x = 0;
839
+ if (y == null) y = 0;
840
+
841
+ function force(alpha) {
842
+ for (var i = 0, n = nodes.length; i < n; ++i) {
843
+ var node = nodes[i],
844
+ dx = node.x - x || 1e-6,
845
+ dy = node.y - y || 1e-6,
846
+ r = Math.sqrt(dx * dx + dy * dy),
847
+ k = (radiuses[i] - r) * strengths[i] * alpha / r;
848
+ node.vx += dx * k;
849
+ node.vy += dy * k;
850
+ }
851
+ }
852
+
853
+ function initialize() {
854
+ if (!nodes) return;
855
+ var i, n = nodes.length;
856
+ strengths = new Array(n);
857
+ radiuses = new Array(n);
858
+ for (i = 0; i < n; ++i) {
859
+ radiuses[i] = +radius(nodes[i], i, nodes);
860
+ strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
861
+ }
862
+ }
863
+
864
+ force.initialize = function(_) {
865
+ nodes = _, initialize();
866
+ };
867
+
868
+ force.strength = function(_) {
869
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
870
+ };
871
+
872
+ force.radius = function(_) {
873
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
874
+ };
875
+
876
+ force.x = function(_) {
877
+ return arguments.length ? (x = +_, force) : x;
878
+ };
879
+
880
+ force.y = function(_) {
881
+ return arguments.length ? (y = +_, force) : y;
882
+ };
883
+
884
+ return force;
885
+ }
886
+
887
+ function x(x) {
888
+ var strength = constant$1(0.1),
889
+ nodes,
890
+ strengths,
891
+ xz;
892
+
893
+ if (typeof x !== "function") x = constant$1(x == null ? 0 : +x);
894
+
895
+ function force(alpha) {
896
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
897
+ node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
898
+ }
899
+ }
900
+
901
+ function initialize() {
902
+ if (!nodes) return;
903
+ var i, n = nodes.length;
904
+ strengths = new Array(n);
905
+ xz = new Array(n);
906
+ for (i = 0; i < n; ++i) {
907
+ strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
908
+ }
909
+ }
910
+
911
+ force.initialize = function(_) {
912
+ nodes = _;
913
+ initialize();
914
+ };
915
+
916
+ force.strength = function(_) {
917
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
918
+ };
919
+
920
+ force.x = function(_) {
921
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : x;
922
+ };
923
+
924
+ return force;
925
+ }
926
+
927
+ function y(y) {
928
+ var strength = constant$1(0.1),
929
+ nodes,
930
+ strengths,
931
+ yz;
932
+
933
+ if (typeof y !== "function") y = constant$1(y == null ? 0 : +y);
934
+
935
+ function force(alpha) {
936
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
937
+ node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
938
+ }
939
+ }
940
+
941
+ function initialize() {
942
+ if (!nodes) return;
943
+ var i, n = nodes.length;
944
+ strengths = new Array(n);
945
+ yz = new Array(n);
946
+ for (i = 0; i < n; ++i) {
947
+ strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
948
+ }
949
+ }
950
+
951
+ force.initialize = function(_) {
952
+ nodes = _;
953
+ initialize();
954
+ };
955
+
956
+ force.strength = function(_) {
957
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
958
+ };
959
+
960
+ force.y = function(_) {
961
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : y;
962
+ };
963
+
964
+ return force;
965
+ }
966
+
967
+ function constant(x) {
968
+ return function() {
969
+ return x;
970
+ };
971
+ }
972
+
973
+ function ZoomEvent(target, type, transform) {
974
+ this.target = target;
975
+ this.type = type;
976
+ this.transform = transform;
977
+ }
978
+
979
+ function nopropagation() {
980
+ event.stopImmediatePropagation();
981
+ }
982
+
983
+ function noevent() {
984
+ event.preventDefault();
985
+ event.stopImmediatePropagation();
986
+ }
987
+
988
+ // Ignore right-click, since that should open the context menu.
989
+ function defaultFilter() {
990
+ return !event.ctrlKey && !event.button;
991
+ }
992
+
993
+ function defaultExtent() {
994
+ var e = this;
995
+ if (e instanceof SVGElement) {
996
+ e = e.ownerSVGElement || e;
997
+ if (e.hasAttribute("viewBox")) {
998
+ e = e.viewBox.baseVal;
999
+ return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
1000
+ }
1001
+ return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
1002
+ }
1003
+ return [[0, 0], [e.clientWidth, e.clientHeight]];
1004
+ }
1005
+
1006
+ function defaultTransform() {
1007
+ return this.__zoom || identity;
1008
+ }
1009
+
1010
+ function defaultWheelDelta() {
1011
+ return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002);
1012
+ }
1013
+
1014
+ function defaultTouchable() {
1015
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
1016
+ }
1017
+
1018
+ function defaultConstrain(transform, extent, translateExtent) {
1019
+ var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
1020
+ dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
1021
+ dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
1022
+ dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
1023
+ return transform.translate(
1024
+ dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
1025
+ dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
1026
+ );
1027
+ }
1028
+
1029
+ function zoom() {
1030
+ var filter = defaultFilter,
1031
+ extent = defaultExtent,
1032
+ constrain = defaultConstrain,
1033
+ wheelDelta = defaultWheelDelta,
1034
+ touchable = defaultTouchable,
1035
+ scaleExtent = [0, Infinity],
1036
+ translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
1037
+ duration = 250,
1038
+ interpolate = interpolateZoom,
1039
+ listeners = dispatch("start", "zoom", "end"),
1040
+ touchstarting,
1041
+ touchending,
1042
+ touchDelay = 500,
1043
+ wheelDelay = 150,
1044
+ clickDistance2 = 0;
1045
+
1046
+ function zoom(selection) {
1047
+ selection
1048
+ .property("__zoom", defaultTransform)
1049
+ .on("wheel.zoom", wheeled)
1050
+ .on("mousedown.zoom", mousedowned)
1051
+ .on("dblclick.zoom", dblclicked)
1052
+ .filter(touchable)
1053
+ .on("touchstart.zoom", touchstarted)
1054
+ .on("touchmove.zoom", touchmoved)
1055
+ .on("touchend.zoom touchcancel.zoom", touchended)
1056
+ .style("touch-action", "none")
1057
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1058
+ }
1059
+
1060
+ zoom.transform = function(collection, transform, point) {
1061
+ var selection = collection.selection ? collection.selection() : collection;
1062
+ selection.property("__zoom", defaultTransform);
1063
+ if (collection !== selection) {
1064
+ schedule(collection, transform, point);
1065
+ } else {
1066
+ selection.interrupt().each(function() {
1067
+ gesture(this, arguments)
1068
+ .start()
1069
+ .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
1070
+ .end();
1071
+ });
1072
+ }
1073
+ };
1074
+
1075
+ zoom.scaleBy = function(selection, k, p) {
1076
+ zoom.scaleTo(selection, function() {
1077
+ var k0 = this.__zoom.k,
1078
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1079
+ return k0 * k1;
1080
+ }, p);
1081
+ };
1082
+
1083
+ zoom.scaleTo = function(selection, k, p) {
1084
+ zoom.transform(selection, function() {
1085
+ var e = extent.apply(this, arguments),
1086
+ t0 = this.__zoom,
1087
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p,
1088
+ p1 = t0.invert(p0),
1089
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1090
+ return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
1091
+ }, p);
1092
+ };
1093
+
1094
+ zoom.translateBy = function(selection, x, y) {
1095
+ zoom.transform(selection, function() {
1096
+ return constrain(this.__zoom.translate(
1097
+ typeof x === "function" ? x.apply(this, arguments) : x,
1098
+ typeof y === "function" ? y.apply(this, arguments) : y
1099
+ ), extent.apply(this, arguments), translateExtent);
1100
+ });
1101
+ };
1102
+
1103
+ zoom.translateTo = function(selection, x, y, p) {
1104
+ zoom.transform(selection, function() {
1105
+ var e = extent.apply(this, arguments),
1106
+ t = this.__zoom,
1107
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
1108
+ return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(
1109
+ typeof x === "function" ? -x.apply(this, arguments) : -x,
1110
+ typeof y === "function" ? -y.apply(this, arguments) : -y
1111
+ ), e, translateExtent);
1112
+ }, p);
1113
+ };
1114
+
1115
+ function scale(transform, k) {
1116
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
1117
+ return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
1118
+ }
1119
+
1120
+ function translate(transform, p0, p1) {
1121
+ var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
1122
+ return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
1123
+ }
1124
+
1125
+ function centroid(extent) {
1126
+ return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
1127
+ }
1128
+
1129
+ function schedule(transition, transform, point) {
1130
+ transition
1131
+ .on("start.zoom", function() { gesture(this, arguments).start(); })
1132
+ .on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); })
1133
+ .tween("zoom", function() {
1134
+ var that = this,
1135
+ args = arguments,
1136
+ g = gesture(that, args),
1137
+ e = extent.apply(that, args),
1138
+ p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point,
1139
+ w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
1140
+ a = that.__zoom,
1141
+ b = typeof transform === "function" ? transform.apply(that, args) : transform,
1142
+ i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
1143
+ return function(t) {
1144
+ if (t === 1) t = b; // Avoid rounding error on end.
1145
+ else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }
1146
+ g.zoom(null, t);
1147
+ };
1148
+ });
1149
+ }
1150
+
1151
+ function gesture(that, args, clean) {
1152
+ return (!clean && that.__zooming) || new Gesture(that, args);
1153
+ }
1154
+
1155
+ function Gesture(that, args) {
1156
+ this.that = that;
1157
+ this.args = args;
1158
+ this.active = 0;
1159
+ this.extent = extent.apply(that, args);
1160
+ this.taps = 0;
1161
+ }
1162
+
1163
+ Gesture.prototype = {
1164
+ start: function() {
1165
+ if (++this.active === 1) {
1166
+ this.that.__zooming = this;
1167
+ this.emit("start");
1168
+ }
1169
+ return this;
1170
+ },
1171
+ zoom: function(key, transform) {
1172
+ if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
1173
+ if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
1174
+ if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
1175
+ this.that.__zoom = transform;
1176
+ this.emit("zoom");
1177
+ return this;
1178
+ },
1179
+ end: function() {
1180
+ if (--this.active === 0) {
1181
+ delete this.that.__zooming;
1182
+ this.emit("end");
1183
+ }
1184
+ return this;
1185
+ },
1186
+ emit: function(type) {
1187
+ customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
1188
+ }
1189
+ };
1190
+
1191
+ function wheeled() {
1192
+ if (!filter.apply(this, arguments)) return;
1193
+ var g = gesture(this, arguments),
1194
+ t = this.__zoom,
1195
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
1196
+ p = mouse(this);
1197
+
1198
+ // If the mouse is in the same location as before, reuse it.
1199
+ // If there were recent wheel events, reset the wheel idle timeout.
1200
+ if (g.wheel) {
1201
+ if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
1202
+ g.mouse[1] = t.invert(g.mouse[0] = p);
1203
+ }
1204
+ clearTimeout(g.wheel);
1205
+ }
1206
+
1207
+ // If this wheel event won’t trigger a transform change, ignore it.
1208
+ else if (t.k === k) return;
1209
+
1210
+ // Otherwise, capture the mouse point and location at the start.
1211
+ else {
1212
+ g.mouse = [p, t.invert(p)];
1213
+ interrupt(this);
1214
+ g.start();
1215
+ }
1216
+
1217
+ noevent();
1218
+ g.wheel = setTimeout(wheelidled, wheelDelay);
1219
+ g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
1220
+
1221
+ function wheelidled() {
1222
+ g.wheel = null;
1223
+ g.end();
1224
+ }
1225
+ }
1226
+
1227
+ function mousedowned() {
1228
+ if (touchending || !filter.apply(this, arguments)) return;
1229
+ var g = gesture(this, arguments, true),
1230
+ v = d3Select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
1231
+ p = mouse(this),
1232
+ x0 = event.clientX,
1233
+ y0 = event.clientY;
1234
+
1235
+ dragDisable(event.view);
1236
+ nopropagation();
1237
+ g.mouse = [p, this.__zoom.invert(p)];
1238
+ interrupt(this);
1239
+ g.start();
1240
+
1241
+ function mousemoved() {
1242
+ noevent();
1243
+ if (!g.moved) {
1244
+ var dx = event.clientX - x0, dy = event.clientY - y0;
1245
+ g.moved = dx * dx + dy * dy > clickDistance2;
1246
+ }
1247
+ g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
1248
+ }
1249
+
1250
+ function mouseupped() {
1251
+ v.on("mousemove.zoom mouseup.zoom", null);
1252
+ yesdrag(event.view, g.moved);
1253
+ noevent();
1254
+ g.end();
1255
+ }
1256
+ }
1257
+
1258
+ function dblclicked() {
1259
+ if (!filter.apply(this, arguments)) return;
1260
+ var t0 = this.__zoom,
1261
+ p0 = mouse(this),
1262
+ p1 = t0.invert(p0),
1263
+ k1 = t0.k * (event.shiftKey ? 0.5 : 2),
1264
+ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
1265
+
1266
+ noevent();
1267
+ if (duration > 0) d3Select(this).transition().duration(duration).call(schedule, t1, p0);
1268
+ else d3Select(this).call(zoom.transform, t1);
1269
+ }
1270
+
1271
+ function touchstarted() {
1272
+ if (!filter.apply(this, arguments)) return;
1273
+ var touches = event.touches,
1274
+ n = touches.length,
1275
+ g = gesture(this, arguments, event.changedTouches.length === n),
1276
+ started, i, t, p;
1277
+
1278
+ nopropagation();
1279
+ for (i = 0; i < n; ++i) {
1280
+ t = touches[i], p = touch(this, touches, t.identifier);
1281
+ p = [p, this.__zoom.invert(p), t.identifier];
1282
+ if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
1283
+ else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;
1284
+ }
1285
+
1286
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1287
+
1288
+ if (started) {
1289
+ if (g.taps < 2) touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);
1290
+ interrupt(this);
1291
+ g.start();
1292
+ }
1293
+ }
1294
+
1295
+ function touchmoved() {
1296
+ if (!this.__zooming) return;
1297
+ var g = gesture(this, arguments),
1298
+ touches = event.changedTouches,
1299
+ n = touches.length, i, t, p, l;
1300
+
1301
+ noevent();
1302
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1303
+ g.taps = 0;
1304
+ for (i = 0; i < n; ++i) {
1305
+ t = touches[i], p = touch(this, touches, t.identifier);
1306
+ if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
1307
+ else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
1308
+ }
1309
+ t = g.that.__zoom;
1310
+ if (g.touch1) {
1311
+ var p0 = g.touch0[0], l0 = g.touch0[1],
1312
+ p1 = g.touch1[0], l1 = g.touch1[1],
1313
+ dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,
1314
+ dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
1315
+ t = scale(t, Math.sqrt(dp / dl));
1316
+ p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
1317
+ l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
1318
+ }
1319
+ else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
1320
+ else return;
1321
+ g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
1322
+ }
1323
+
1324
+ function touchended() {
1325
+ if (!this.__zooming) return;
1326
+ var g = gesture(this, arguments),
1327
+ touches = event.changedTouches,
1328
+ n = touches.length, i, t;
1329
+
1330
+ nopropagation();
1331
+ if (touchending) clearTimeout(touchending);
1332
+ touchending = setTimeout(function() { touchending = null; }, touchDelay);
1333
+ for (i = 0; i < n; ++i) {
1334
+ t = touches[i];
1335
+ if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
1336
+ else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
1337
+ }
1338
+ if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;
1339
+ if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
1340
+ else {
1341
+ g.end();
1342
+ // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
1343
+ if (g.taps === 2) {
1344
+ var p = d3Select(this).on("dblclick.zoom");
1345
+ if (p) p.apply(this, arguments);
1346
+ }
1347
+ }
1348
+ }
1349
+
1350
+ zoom.wheelDelta = function(_) {
1351
+ return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
1352
+ };
1353
+
1354
+ zoom.filter = function(_) {
1355
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
1356
+ };
1357
+
1358
+ zoom.touchable = function(_) {
1359
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
1360
+ };
1361
+
1362
+ zoom.extent = function(_) {
1363
+ return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
1364
+ };
1365
+
1366
+ zoom.scaleExtent = function(_) {
1367
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
1368
+ };
1369
+
1370
+ zoom.translateExtent = function(_) {
1371
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
1372
+ };
1373
+
1374
+ zoom.constrain = function(_) {
1375
+ return arguments.length ? (constrain = _, zoom) : constrain;
1376
+ };
1377
+
1378
+ zoom.duration = function(_) {
1379
+ return arguments.length ? (duration = +_, zoom) : duration;
1380
+ };
1381
+
1382
+ zoom.interpolate = function(_) {
1383
+ return arguments.length ? (interpolate = _, zoom) : interpolate;
1384
+ };
1385
+
1386
+ zoom.on = function() {
1387
+ var value = listeners.on.apply(listeners, arguments);
1388
+ return value === listeners ? zoom : value;
1389
+ };
1390
+
1391
+ zoom.clickDistance = function(_) {
1392
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
1393
+ };
1394
+
1395
+ return zoom;
1396
+ }
1397
+
1398
+ var css_248z = ".SNA {\n overflow: hidden;\n object-fit: contain;\n position: relative;\n font-size: 0.75rem;\n width: 100%; }\n .SNA--smallSize .node {\n padding-top: 8px;\n font-size: 0.75rem;\n width: 3rem;\n height: 3rem;\n overflow: hidden;\n white-space: pre-wrap;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical; }\n .SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 20px;\n font-weight: 500;\n height: 54px;\n width: 54px;\n padding-top: 15px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab; }\n .SNA .links line {\n stroke: #c7bfb4;\n stroke-width: 2; }\n .SNA .mainNode {\n fill: #4e3a16; }\n .SNA .person {\n fill: #867b3a; }\n .SNA .publication {\n fill: #825c0d; }\n .SNA .article {\n fill: #afafaf; }\n .SNA .keyword {\n fill: #fcfae8; }\n .SNA .org {\n fill: #000000; }\n .SNA #network-graph svg {\n width: 100%;\n height: 100%; }\n\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px; }\n .SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 1px;\n font-weight: 500;\n height: 44px;\n width: 44px;\n padding-top: 12px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab; } }\n\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px; } }\n";
1399
+ styleInject(css_248z);
1400
+
1401
+ /* eslint-disable indent */
1402
+ var SNA = function SNA(props) {
1403
+ // common
1404
+ var className = props.className,
1405
+ intl = props.intl,
1406
+ exclude = props.exclude,
1407
+ distance = props.distance,
1408
+ SNAData = props.SNAData,
1409
+ handleClickNodeGoto = props.handleClickNodeGoto,
1410
+ DownloadExcel = props.DownloadExcel;
1411
+ // styles
1412
+ var width = props.width,
1413
+ height = props.height,
1414
+ fontColor = props.fontColor,
1415
+ backgroundColor = props.backgroundColor,
1416
+ iconColor = props.iconColor;
1417
+ var g;
1418
+ if (!SNAData || SNAData.nodes.length === 0) {
1419
+ return /*#__PURE__*/React__default.createElement("div", {
1420
+ className: "noData"
1421
+ }, intl ? intl.formatMessage({
1422
+ id: 'common.noData'
1423
+ }) : '暫無資料');
1424
+ }
1425
+ var contentWidth = useMemo(function () {
1426
+ return screen.width > 1050 ? width : screen.width - 80;
1427
+ }, [screen.width]);
1428
+ var contentHeight = useMemo(function () {
1429
+ return screen.width > 1050 ? height : screen.height - 300;
1430
+ }, [screen.width]);
1431
+ var translateType = function translateType(type) {
1432
+ switch (type) {
1433
+ case 'mainNode':
1434
+ // 主要搜尋中心
1435
+ return intl ? intl.formatMessage({
1436
+ id: 'SNA.search.center'
1437
+ }) : '主要搜尋中心';
1438
+ case 'organization':
1439
+ // 組織
1440
+ return intl ? intl.formatMessage({
1441
+ id: 'SNA.organization'
1442
+ }) : '組織';
1443
+ case 'person':
1444
+ // 作家
1445
+ return intl ? intl.formatMessage({
1446
+ id: 'SNA.author'
1447
+ }) : '作家';
1448
+ case 'publication':
1449
+ // 著作
1450
+ return intl ? intl.formatMessage({
1451
+ id: 'SNA.publication'
1452
+ }) : '作家';
1453
+ case 'article':
1454
+ // 單篇作品
1455
+ return intl ? intl.formatMessage({
1456
+ id: 'SNA.article'
1457
+ }) : '單篇作品';
1458
+ case 'keyword':
1459
+ // 關鍵字
1460
+ return intl ? intl.formatMessage({
1461
+ id: 'SNA.keyword'
1462
+ }) : '關鍵字';
1463
+ case 'event':
1464
+ // 事件
1465
+ return intl ? intl.formatMessage({
1466
+ id: 'SNA.event'
1467
+ }) : '事件';
1468
+ default:
1469
+ return '';
1470
+ }
1471
+ };
1472
+ var drag$1 = function drag$1(simulation) {
1473
+ function dragstarted(d) {
1474
+ if (!event.active) simulation.alphaTarget(0.3).restart();
1475
+ d.fx = d.x;
1476
+ d.fy = d.y;
1477
+ }
1478
+ function dragged(d) {
1479
+ d.fx = event.x > contentWidth - 10 || event.x < 20 ? d.x : event.x;
1480
+ d.fy = event.y > contentHeight - 10 || event.y < 20 ? d.y : event.y;
1481
+ }
1482
+ return drag().on('start', dragstarted).on('drag', dragged);
1483
+ };
1484
+ var calculateCurve = function calculateCurve(source, target, curveLen) {
1485
+ var mx = (target.x + source.x) * 0.5;
1486
+ var my = (target.y + source.y) * 0.5;
1487
+ var tsx = target.x - source.x;
1488
+ var tsy = target.y - source.y;
1489
+ var L = Math.pow(Math.pow(tsx, 2) + Math.pow(tsy, 2), 0.5);
1490
+ var qx = mx - tsy * curveLen / L;
1491
+ var qy = my + tsx * curveLen / L;
1492
+ return {
1493
+ qx: qx,
1494
+ qy: qy
1495
+ };
1496
+ };
1497
+ var getLineCurve = function getLineCurve(source, target, curveLen) {
1498
+ var _calculateCurve = calculateCurve(source, target, curveLen),
1499
+ qx = _calculateCurve.qx,
1500
+ qy = _calculateCurve.qy;
1501
+ if (isNaN(qx)) {
1502
+ return "M".concat(source.x, ", ").concat(source.y, " Q0 0 ").concat(target.x, " ").concat(target.y);
1503
+ }
1504
+ return "M".concat(source.x, ", ").concat(source.y, " Q").concat(qx, " ").concat(qy, " ").concat(target.x, " ").concat(target.y);
1505
+ };
1506
+ var init = function init(networkData) {
1507
+ var edgeLabelSize = '10px';
1508
+ var lineRaduis = 30;
1509
+ var nodeStroke = 1.5;
1510
+ var nodeRadius = 10 - nodeStroke;
1511
+ var mainNodeRadius = 15 - nodeStroke;
1512
+ var arrowPercent = 0.8;
1513
+ var arrowViewBox = "-0 -".concat(nodeRadius, " ").concat(nodeRadius * 2, " ").concat(nodeRadius * 2);
1514
+ var arrowPath = "M 0,-".concat(nodeRadius * arrowPercent, " L ").concat(nodeRadius * arrowPercent * 2, " ,0 L 0,").concat(nodeRadius * arrowPercent);
1515
+ var color = ordinal(category10);
1516
+ var links = networkData.links.map(function (d) {
1517
+ return Object.create(d);
1518
+ });
1519
+ var nodes = networkData.nodes.map(function (d) {
1520
+ return Object.create(d);
1521
+ });
1522
+ var simulation$1 = simulation(nodes).force('link', link(links).id(function (d) {
1523
+ return d.index;
1524
+ }).distance(50)).force('charge', manyBody().strength(-200).distanceMax(1000)).force('center', center(contentWidth / 2, contentHeight / 2)).force('collide', collide().radius(function () {
1525
+ return nodeRadius + 5;
1526
+ }).strength(1).iterations(10)).force('x', x(contentWidth / 2)).force('y', y(contentHeight / 2)).force('radial', radial(100, contentWidth / 1.5, contentHeight / 1.5));
1527
+ var svg = d3Select('#sna-graph').append('svg').attr('viewBox', [0, 0, contentWidth, contentHeight]).style('background-color', backgroundColor);
1528
+ svg.append('defs').append('marker').attr('id', 'arrowhead').attr('viewBox', arrowViewBox).attr('refX', nodeRadius * 2 + nodeRadius * arrowPercent).attr('refY', 0).attr('orient', 'auto').attr('markerWidth', nodeRadius * (1 + arrowPercent)).attr('markerHeight', nodeRadius * (1 + arrowPercent)).attr('xoverflow', 'visible').append('svg:path').attr('d', arrowPath).attr('fill', '#999').style('stroke', 'none');
1529
+ // 增加一層g用來包住所有的物件,並對此g加入縮放功能
1530
+ g = svg.append('g');
1531
+ var zoomActions = function zoomActions() {
1532
+ g.attr('transform', event.transform);
1533
+ };
1534
+ var zoomHandler = zoom().scaleExtent([0.5, 20]).extent([[0, 0], [contentWidth, contentHeight]]).on('zoom', zoomActions);
1535
+ zoomHandler(svg);
1536
+ var link$1 = g.append('g').attr('stroke', '#999').attr('stroke-opacity', 0.6).selectAll('line').data(links).join('path').attr('fill', 'none').attr('stroke-dasharray', function (d) {
1537
+ return d.ontology === 'protege' ? '2,5,3' : '';
1538
+ }).attr('key', function (d) {
1539
+ return d.type;
1540
+ });
1541
+ var node = g.append('g').attr('stroke', '#fff').attr('stroke-width', nodeStroke).selectAll('circle').data(nodes).join('circle').attr('r', function (d) {
1542
+ return d.type === 'mainNode' ? mainNodeRadius : nodeRadius;
1543
+ }).attr('fill', function (d) {
1544
+ return color(d.type);
1545
+ }).attr('key', function (d) {
1546
+ return d.type;
1547
+ }).attr('class', function (d) {
1548
+ return "node node-".concat(d.id, " ").concat(d.type && d.type === 'organization' ? 'org' : d.type === 'person' ? 'person' : d.type === 'publication' ? 'publication' : d.type === 'mainNode' ? 'mainNode' : d.type === 'article' ? 'article' : d.type === 'keyword' ? 'keyword' : d.type === 'event' ? 'event' : '');
1549
+ }).on('click', function (d) {
1550
+ return d.hasClick ? handleClickNodeGoto({
1551
+ name: d.name,
1552
+ id: d.id,
1553
+ type: d.type
1554
+ }) : null;
1555
+ }).call(drag$1(simulation$1));
1556
+ node.append('title').text(function (d) {
1557
+ return "".concat(d.name, "-").concat(translateType(d.type));
1558
+ });
1559
+ var nodeLabel = g.append('g').selectAll('text').data(nodes).join('text').attr('fill', fontColor).attr('text-anchor', 'middle').attr('key', function (d) {
1560
+ return d.type;
1561
+ }).style('color', '#fff').style('font-size', '14px').text(function (d) {
1562
+ return d.name;
1563
+ });
1564
+ var edgepaths = g.selectAll('.edgepath').data(links).enter().append('path').attr('class', 'edgepath').attr('fill-opacity', 0).attr('stroke-opacity', 0).attr('id', function (d, i) {
1565
+ return "edgepath".concat(i);
1566
+ }).style('pointer-events', 'none');
1567
+ var edgelabels = g.selectAll('.edgelabel').data(links).enter().append('text').style('pointer-events', 'none').attr('class', 'edgelabel').attr('font-size', edgeLabelSize).attr('fill', '#aaa').attr('visibility', 'visible').attr('key', function (d) {
1568
+ return d.type;
1569
+ }).attr('id', function (d, i) {
1570
+ return "edgelabel".concat(i);
1571
+ });
1572
+ edgelabels.append('textPath').attr('xlink:href', function (d, i) {
1573
+ return "#edgepath".concat(i);
1574
+ }).style('text-anchor', 'middle').style('pointer-events', 'none').attr('startOffset', '50%').text(function (d) {
1575
+ return d.property;
1576
+ });
1577
+ simulation$1.on('tick', function () {
1578
+ nodes.forEach(function (d) {
1579
+ // x軸 超過寬度380,回彈到380座標軸區域位置。 ——作用爲:超出範圍的回彈到視圖寬度範圍內
1580
+ if (d.x >= contentWidth - 20) {
1581
+ d.x = contentWidth - 20;
1582
+ }
1583
+ // y軸 超過高度280,回彈到280座標軸區域位置。 ——作用爲:超出範圍的回彈到視圖高度範圍內
1584
+ if (d.y >= contentHeight - 20) {
1585
+ d.y = contentHeight - 20;
1586
+ }
1587
+ if (d.x <= 20) {
1588
+ d.x = 20;
1589
+ }
1590
+ if (d.y <= 20) {
1591
+ d.y = 20;
1592
+ }
1593
+ });
1594
+ link$1.attr('d', function (d) {
1595
+ return getLineCurve(d.source, d.target, lineRaduis);
1596
+ });
1597
+ node.attr('cx', function (d) {
1598
+ return d.x;
1599
+ }).attr('cy', function (d) {
1600
+ return d.y;
1601
+ });
1602
+ nodeLabel.attr('x', function (d) {
1603
+ return d.x;
1604
+ }).attr('y', function (d) {
1605
+ return d.y - nodeRadius;
1606
+ });
1607
+ edgepaths.attr('d', function (d) {
1608
+ return getLineCurve(d.source, d.target, lineRaduis);
1609
+ });
1610
+ });
1611
+ };
1612
+ var renderSNA = function renderSNA() {
1613
+ if (SNAData && SNAData.nodes && SNAData.nodes.length > 0) {
1614
+ var div = document.getElementById('sna-graph');
1615
+ if (div && div.childNodes[0]) {
1616
+ div.removeChild(div.childNodes[0]);
1617
+ }
1618
+ init(SNAData);
1619
+ }
1620
+ };
1621
+
1622
+ // 資料異動或全螢幕切換,重新渲染網絡圖
1623
+ useEffect(function () {
1624
+ renderSNA();
1625
+ }, [SNAData]);
1626
+ return /*#__PURE__*/React__default.createElement("div", {
1627
+ className: classNames('SNA', {
1628
+ 'SNA--smallSize': distance < 200
1629
+ }, className),
1630
+ style: {
1631
+ contentWidth: contentWidth,
1632
+ contentHeight: contentHeight,
1633
+ backgroundColor: backgroundColor
1634
+ }
1635
+ }, /*#__PURE__*/React__default.createElement(ExtraTools, {
1636
+ data: SNAData,
1637
+ iconColor: iconColor,
1638
+ domToImageId: "sna-graph",
1639
+ FontSizeTargets: ['#sna-graph svg g text'],
1640
+ exclude: exclude,
1641
+ DownloadExcel: DownloadExcel,
1642
+ fullscreenDomId: "sna-graph",
1643
+ renderSNA: renderSNA
1644
+ }), /*#__PURE__*/React__default.createElement("div", {
1645
+ id: "sna-graph"
1646
+ }));
1647
+ };
1648
+ SNA.defaultProps = {
1649
+ className: undefined,
1650
+ intl: undefined,
1651
+ width: 1050,
1652
+ height: 600,
1653
+ distance: 400,
1654
+ SNAData: null,
1655
+ fontColor: '#000000',
1656
+ backgroundColor: '#FFFFFF',
1657
+ iconColor: '#825c0d',
1658
+ exclude: ['downloadXls', 'downloadTsv'],
1659
+ handleClickNodeGoto: null,
1660
+ DownloadExcel: undefined
1661
+ };
1662
+
1663
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
1664
+ SNA.propTypes = {
1665
+ /** Css Name */
1666
+ className: PropTypes.string,
1667
+ /** 語言 */
1668
+ intl: PropTypes.objectOf(PropTypes.any),
1669
+ /** 寬度 */
1670
+ width: PropTypes.number,
1671
+ /** 高度 */
1672
+ height: PropTypes.number,
1673
+ /** 點跟點之間的距離 */
1674
+ distance: PropTypes.number,
1675
+ /** 資料 */
1676
+ SNAData: PropTypes.objectOf(PropTypes.any),
1677
+ /** 網絡圖文字顏色 */
1678
+ fontColor: PropTypes.string,
1679
+ /** 網絡圖背景顏色 */
1680
+ backgroundColor: PropTypes.string,
1681
+ /** icon顏色 */
1682
+ iconColor: PropTypes.string,
1683
+ /** 不顯示的按鈕 ['share', 'downloadImage', 'downloadTsv', 'downloadXls', 'fullscreen', 'fontSizeChanger'] */
1684
+ exclude: PropTypes.arrayOf(PropTypes.string),
1685
+ /** 按下點後要轉址的功能 */
1686
+ handleClickNodeGoto: PropTypes.func,
1687
+ /** Download元件, 由外部傳入的原因是需要環境設定 */
1688
+ DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
1689
+ };
1690
+
1691
+ export { SNA as default };