@nebula.js/sn-org-chart 0.15.0 → 0.16.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/assets/sn-org-chart.qext +1 -1
- package/dist/sn-org-chart.esm.js +1020 -1438
- package/dist/sn-org-chart.js +3 -3
- package/dist/sn-org-chart.qext +1 -1
- package/package.json +25 -22
package/dist/sn-org-chart.esm.js
CHANGED
|
@@ -1,185 +1,36 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/sn-org-chart v0.
|
|
3
|
-
* Copyright (c)
|
|
2
|
+
* @nebula.js/sn-org-chart v0.16.0
|
|
3
|
+
* Copyright (c) 2022 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useElement, onTakeSnapshot, useImperativeHandle, useState, useSelections, useLayout, useEffect, useAction, useStaleLayout, useModel, useTheme, useOptions, useRect, useConstraints, useTranslator, usePromise } from '@nebula.js/stardust';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (info.done) {
|
|
35
|
-
resolve(value);
|
|
36
|
-
} else {
|
|
37
|
-
Promise.resolve(value).then(_next, _throw);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _asyncToGenerator(fn) {
|
|
42
|
-
return function () {
|
|
43
|
-
var self = this,
|
|
44
|
-
args = arguments;
|
|
45
|
-
return new Promise(function (resolve, reject) {
|
|
46
|
-
var gen = fn.apply(self, args);
|
|
47
|
-
|
|
48
|
-
function _next(value) {
|
|
49
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _throw(err) {
|
|
53
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
_next(undefined);
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _defineProperty(obj, key, value) {
|
|
62
|
-
if (key in obj) {
|
|
63
|
-
Object.defineProperty(obj, key, {
|
|
64
|
-
value: value,
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true
|
|
68
|
-
});
|
|
69
|
-
} else {
|
|
70
|
-
obj[key] = value;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return obj;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function ownKeys(object, enumerableOnly) {
|
|
77
|
-
var keys = Object.keys(object);
|
|
78
|
-
|
|
79
|
-
if (Object.getOwnPropertySymbols) {
|
|
80
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
81
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
82
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
83
|
-
});
|
|
84
|
-
keys.push.apply(keys, symbols);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return keys;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function _objectSpread2(target) {
|
|
91
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
92
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
93
|
-
|
|
94
|
-
if (i % 2) {
|
|
95
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
96
|
-
_defineProperty(target, key, source[key]);
|
|
97
|
-
});
|
|
98
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
99
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
100
|
-
} else {
|
|
101
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
102
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return target;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function _slicedToArray(arr, i) {
|
|
111
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function _toConsumableArray(arr) {
|
|
115
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _arrayWithoutHoles(arr) {
|
|
119
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function _arrayWithHoles(arr) {
|
|
123
|
-
if (Array.isArray(arr)) return arr;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function _iterableToArray(iter) {
|
|
127
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function _iterableToArrayLimit(arr, i) {
|
|
131
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
132
|
-
var _arr = [];
|
|
133
|
-
var _n = true;
|
|
134
|
-
var _d = false;
|
|
135
|
-
var _e = undefined;
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
139
|
-
_arr.push(_s.value);
|
|
140
|
-
|
|
141
|
-
if (i && _arr.length === i) break;
|
|
142
|
-
}
|
|
143
|
-
} catch (err) {
|
|
144
|
-
_d = true;
|
|
145
|
-
_e = err;
|
|
146
|
-
} finally {
|
|
147
|
-
try {
|
|
148
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
149
|
-
} finally {
|
|
150
|
-
if (_d) throw _e;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return _arr;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
158
|
-
if (!o) return;
|
|
159
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
160
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
161
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
162
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
163
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function _arrayLikeToArray(arr, len) {
|
|
167
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
168
|
-
|
|
169
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
170
|
-
|
|
171
|
-
return arr2;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function _nonIterableSpread() {
|
|
175
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function _nonIterableRest() {
|
|
179
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
180
|
-
}
|
|
9
|
+
var DEFAULTS = {
|
|
10
|
+
FONT_COLOR_TYPE: 'auto',
|
|
11
|
+
FONT_COLOR_DARK: {
|
|
12
|
+
index: -1,
|
|
13
|
+
color: '#484848'
|
|
14
|
+
},
|
|
15
|
+
FONT_COLOR_LIGHT: {
|
|
16
|
+
index: -1,
|
|
17
|
+
color: '#e6e6e6'
|
|
18
|
+
},
|
|
19
|
+
BACKGROUND_COLOR_TYPE: 'colorPicker',
|
|
20
|
+
BACKGROUND_COLOR: {
|
|
21
|
+
index: -1,
|
|
22
|
+
color: '#ffffff'
|
|
23
|
+
},
|
|
24
|
+
BORDER_COLOR_TYPE: 'auto',
|
|
25
|
+
BORDER_COLOR: {
|
|
26
|
+
index: -1,
|
|
27
|
+
color: '#737373'
|
|
28
|
+
},
|
|
29
|
+
BORDER_FULL: true,
|
|
30
|
+
BORDER_TOP: true
|
|
31
|
+
};
|
|
181
32
|
|
|
182
|
-
|
|
33
|
+
const properties = {
|
|
183
34
|
qHyperCubeDef: {
|
|
184
35
|
qDimensions: [],
|
|
185
36
|
qMeasures: [],
|
|
@@ -225,82 +76,21 @@ var properties = {
|
|
|
225
76
|
* @type {object}
|
|
226
77
|
*/
|
|
227
78
|
style: {
|
|
228
|
-
/**
|
|
229
|
-
* @type {object}
|
|
230
|
-
*/
|
|
231
79
|
fontColor: {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*/
|
|
235
|
-
colorType: 'auto',
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* @type {object}
|
|
239
|
-
*/
|
|
240
|
-
color: {
|
|
241
|
-
index: -1,
|
|
242
|
-
color: '#484848'
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* @type {string}
|
|
247
|
-
*/
|
|
80
|
+
colorType: DEFAULTS.FONT_COLOR_TYPE,
|
|
81
|
+
color: DEFAULTS.FONT_COLOR_DARK,
|
|
248
82
|
colorExpression: ''
|
|
249
83
|
},
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* @type {object}
|
|
253
|
-
*/
|
|
254
84
|
backgroundColor: {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*/
|
|
258
|
-
colorType: 'colorPicker',
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @type {object}
|
|
262
|
-
*/
|
|
263
|
-
color: {
|
|
264
|
-
index: -1,
|
|
265
|
-
color: '#ffffff'
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @type {string}
|
|
270
|
-
*/
|
|
85
|
+
colorType: DEFAULTS.BACKGROUND_COLOR_TYPE,
|
|
86
|
+
color: DEFAULTS.BACKGROUND_COLOR,
|
|
271
87
|
colorExpression: ''
|
|
272
88
|
},
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* @type {object}
|
|
276
|
-
*/
|
|
277
89
|
border: {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* @type {boolean}
|
|
285
|
-
*/
|
|
286
|
-
fullBorder: true,
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* @type {string}
|
|
290
|
-
*/
|
|
291
|
-
colorType: 'auto',
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* @type {object}
|
|
295
|
-
*/
|
|
296
|
-
color: {
|
|
297
|
-
index: -1,
|
|
298
|
-
color: '#737373'
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* @type {string}
|
|
303
|
-
*/
|
|
90
|
+
top: DEFAULTS.BORDER_TOP,
|
|
91
|
+
fullBorder: DEFAULTS.BORDER_FULL,
|
|
92
|
+
colorType: DEFAULTS.BORDER_COLOR_TYPE,
|
|
93
|
+
color: DEFAULTS.BORDER_COLOR,
|
|
304
94
|
colorExpression: ''
|
|
305
95
|
}
|
|
306
96
|
}
|
|
@@ -321,14 +111,14 @@ var data = {
|
|
|
321
111
|
};
|
|
322
112
|
|
|
323
113
|
function getValue(dataContainer, reference, defaultValue) {
|
|
324
|
-
|
|
325
|
-
|
|
114
|
+
const steps = reference.split('.');
|
|
115
|
+
let i;
|
|
326
116
|
|
|
327
117
|
if (dataContainer === undefined) {
|
|
328
118
|
return defaultValue;
|
|
329
119
|
}
|
|
330
120
|
|
|
331
|
-
|
|
121
|
+
let currentValue = dataContainer;
|
|
332
122
|
|
|
333
123
|
for (i = 0; i < steps.length; ++i) {
|
|
334
124
|
if (typeof currentValue[steps[i]] === 'undefined') {
|
|
@@ -342,10 +132,10 @@ function getValue(dataContainer, reference, defaultValue) {
|
|
|
342
132
|
}
|
|
343
133
|
|
|
344
134
|
var propertyResolver = {
|
|
345
|
-
getValue
|
|
135
|
+
getValue
|
|
346
136
|
};
|
|
347
137
|
|
|
348
|
-
|
|
138
|
+
const colorOptions = [{
|
|
349
139
|
value: 'auto',
|
|
350
140
|
translation: 'Common.Auto'
|
|
351
141
|
}, {
|
|
@@ -355,7 +145,7 @@ var colorOptions = [{
|
|
|
355
145
|
value: 'byExpression',
|
|
356
146
|
translation: 'properties.colorMode.byExpression'
|
|
357
147
|
}];
|
|
358
|
-
|
|
148
|
+
const navigationOptions = [{
|
|
359
149
|
value: 'free',
|
|
360
150
|
translation: 'Object.OrgChart.FreeMode'
|
|
361
151
|
}, {
|
|
@@ -363,9 +153,7 @@ var navigationOptions = [{
|
|
|
363
153
|
translation: 'Object.OrgChart.ExpandAll'
|
|
364
154
|
}];
|
|
365
155
|
|
|
366
|
-
|
|
367
|
-
return propertyResolver.getValue(data, 'style.border.top') || propertyResolver.getValue(data, 'style.border.fullBorder');
|
|
368
|
-
};
|
|
156
|
+
const bordersActive = data => propertyResolver.getValue(data, 'style.border.top') || propertyResolver.getValue(data, 'style.border.fullBorder');
|
|
369
157
|
|
|
370
158
|
var extDef = {
|
|
371
159
|
definition: {
|
|
@@ -387,8 +175,8 @@ var extDef = {
|
|
|
387
175
|
attributes: {
|
|
388
176
|
component: 'attribute-expression-reference',
|
|
389
177
|
defaultValue: [],
|
|
390
|
-
show:
|
|
391
|
-
|
|
178
|
+
show: (dim, handler) => {
|
|
179
|
+
const dims = handler.getDimensions();
|
|
392
180
|
return dims[0] === dim;
|
|
393
181
|
},
|
|
394
182
|
ref: 'qAttributeExpressions',
|
|
@@ -423,8 +211,8 @@ var extDef = {
|
|
|
423
211
|
}]
|
|
424
212
|
},
|
|
425
213
|
desc: {
|
|
426
|
-
show:
|
|
427
|
-
|
|
214
|
+
show: (dim, handler) => {
|
|
215
|
+
const dims = handler.getDimensions();
|
|
428
216
|
return dims[0] === dim;
|
|
429
217
|
},
|
|
430
218
|
component: 'text',
|
|
@@ -478,15 +266,15 @@ var extDef = {
|
|
|
478
266
|
type: 'string',
|
|
479
267
|
translation: 'Object.OrgChart.NavigationMode',
|
|
480
268
|
component: 'dropdown',
|
|
269
|
+
defaultValue: 'free',
|
|
481
270
|
options: navigationOptions
|
|
482
271
|
},
|
|
483
272
|
resizeOnExpand: {
|
|
484
273
|
ref: 'resizeOnExpand',
|
|
485
274
|
type: 'boolean',
|
|
275
|
+
defaultValue: false,
|
|
486
276
|
translation: 'Object.OrgChart.resizeOnExpand',
|
|
487
|
-
show:
|
|
488
|
-
return propertyResolver.getValue(data, 'navigationMode') !== 'expandAll';
|
|
489
|
-
}
|
|
277
|
+
show: data => propertyResolver.getValue(data, 'navigationMode') !== 'expandAll'
|
|
490
278
|
}
|
|
491
279
|
}
|
|
492
280
|
},
|
|
@@ -498,6 +286,7 @@ var extDef = {
|
|
|
498
286
|
type: 'string',
|
|
499
287
|
translation: 'Object.OrgChart.BackgroundColor',
|
|
500
288
|
component: 'dropdown',
|
|
289
|
+
defaultValue: DEFAULTS.BACKGROUND_COLOR_TYPE,
|
|
501
290
|
options: colorOptions
|
|
502
291
|
},
|
|
503
292
|
colorPicker: {
|
|
@@ -506,9 +295,8 @@ var extDef = {
|
|
|
506
295
|
ref: 'style.backgroundColor.color',
|
|
507
296
|
translation: 'properties.color',
|
|
508
297
|
dualOutput: true,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
298
|
+
defaultValue: DEFAULTS.BACKGROUND_COLOR,
|
|
299
|
+
show: data => propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'colorPicker'
|
|
512
300
|
},
|
|
513
301
|
colorExpression: {
|
|
514
302
|
component: 'string',
|
|
@@ -516,9 +304,8 @@ var extDef = {
|
|
|
516
304
|
ref: 'style.backgroundColor.colorExpression',
|
|
517
305
|
translation: 'Common.Expression',
|
|
518
306
|
expression: 'optional',
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
307
|
+
defaultValue: '',
|
|
308
|
+
show: data => propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'byExpression'
|
|
522
309
|
}
|
|
523
310
|
}
|
|
524
311
|
},
|
|
@@ -530,6 +317,7 @@ var extDef = {
|
|
|
530
317
|
type: 'string',
|
|
531
318
|
translation: 'Object.OrgChart.FontColor',
|
|
532
319
|
component: 'dropdown',
|
|
320
|
+
defaultValue: DEFAULTS.FONT_COLOR_TYPE,
|
|
533
321
|
options: colorOptions
|
|
534
322
|
},
|
|
535
323
|
colorPicker: {
|
|
@@ -538,9 +326,8 @@ var extDef = {
|
|
|
538
326
|
ref: 'style.fontColor.color',
|
|
539
327
|
translation: 'properties.color',
|
|
540
328
|
dualOutput: true,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
329
|
+
defaultValue: DEFAULTS.FONT_COLOR_DARK,
|
|
330
|
+
show: data => propertyResolver.getValue(data, 'style.fontColor.colorType') === 'colorPicker'
|
|
544
331
|
},
|
|
545
332
|
colorExpression: {
|
|
546
333
|
component: 'string',
|
|
@@ -548,9 +335,8 @@ var extDef = {
|
|
|
548
335
|
ref: 'style.fontColor.colorExpression',
|
|
549
336
|
translation: 'Common.Expression',
|
|
550
337
|
expression: 'optional',
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
338
|
+
defaultValue: '',
|
|
339
|
+
show: data => propertyResolver.getValue(data, 'style.fontColor.colorType') === 'byExpression'
|
|
554
340
|
}
|
|
555
341
|
}
|
|
556
342
|
},
|
|
@@ -566,24 +352,22 @@ var extDef = {
|
|
|
566
352
|
type: 'boolean',
|
|
567
353
|
ref: 'style.border.top',
|
|
568
354
|
translation: 'Object.OrgChart.TopBar',
|
|
569
|
-
defaultValue:
|
|
355
|
+
defaultValue: DEFAULTS.BORDER_TOP
|
|
570
356
|
},
|
|
571
357
|
fullBorder: {
|
|
572
358
|
type: 'boolean',
|
|
573
359
|
ref: 'style.border.fullBorder',
|
|
574
360
|
translation: 'properties.border',
|
|
575
|
-
defaultValue:
|
|
361
|
+
defaultValue: DEFAULTS.BORDER_FULL
|
|
576
362
|
},
|
|
577
363
|
colorType: {
|
|
578
364
|
component: 'dropdown',
|
|
579
365
|
type: 'string',
|
|
580
366
|
ref: 'style.border.colorType',
|
|
581
367
|
translation: 'properties.border.color',
|
|
582
|
-
defaultValue:
|
|
368
|
+
defaultValue: DEFAULTS.BORDER_COLOR_TYPE,
|
|
583
369
|
options: colorOptions,
|
|
584
|
-
show:
|
|
585
|
-
return bordersActive(data);
|
|
586
|
-
}
|
|
370
|
+
show: data => bordersActive(data)
|
|
587
371
|
},
|
|
588
372
|
colorPicker: {
|
|
589
373
|
component: 'color-picker',
|
|
@@ -591,9 +375,8 @@ var extDef = {
|
|
|
591
375
|
ref: 'style.border.color',
|
|
592
376
|
translation: 'properties.color',
|
|
593
377
|
dualOutput: true,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
378
|
+
defaultValue: DEFAULTS.BORDER_COLOR,
|
|
379
|
+
show: data => bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'colorPicker'
|
|
597
380
|
},
|
|
598
381
|
colorExpression: {
|
|
599
382
|
component: 'string',
|
|
@@ -601,9 +384,8 @@ var extDef = {
|
|
|
601
384
|
ref: 'style.border.colorExpression',
|
|
602
385
|
translation: 'Common.Expression',
|
|
603
386
|
expression: 'optional',
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
387
|
+
defaultValue: '',
|
|
388
|
+
show: data => bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'byExpression'
|
|
607
389
|
}
|
|
608
390
|
}
|
|
609
391
|
}
|
|
@@ -621,20 +403,20 @@ var extDef = {
|
|
|
621
403
|
}
|
|
622
404
|
};
|
|
623
405
|
|
|
624
|
-
function
|
|
625
|
-
/* env */
|
|
626
|
-
{
|
|
406
|
+
function
|
|
407
|
+
/* env */
|
|
408
|
+
ext() {
|
|
627
409
|
return extDef;
|
|
628
410
|
}
|
|
629
411
|
|
|
630
|
-
function ascending (a, b) {
|
|
412
|
+
function ascending$1 (a, b) {
|
|
631
413
|
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
632
414
|
}
|
|
633
415
|
|
|
634
416
|
function bisector (compare) {
|
|
635
417
|
if (compare.length === 1) compare = ascendingComparator(compare);
|
|
636
418
|
return {
|
|
637
|
-
left: function
|
|
419
|
+
left: function (a, x, lo, hi) {
|
|
638
420
|
if (lo == null) lo = 0;
|
|
639
421
|
if (hi == null) hi = a.length;
|
|
640
422
|
|
|
@@ -645,7 +427,7 @@ function bisector (compare) {
|
|
|
645
427
|
|
|
646
428
|
return lo;
|
|
647
429
|
},
|
|
648
|
-
right: function
|
|
430
|
+
right: function (a, x, lo, hi) {
|
|
649
431
|
if (lo == null) lo = 0;
|
|
650
432
|
if (hi == null) hi = a.length;
|
|
651
433
|
|
|
@@ -661,14 +443,14 @@ function bisector (compare) {
|
|
|
661
443
|
|
|
662
444
|
function ascendingComparator(f) {
|
|
663
445
|
return function (d, x) {
|
|
664
|
-
return ascending(f(d), x);
|
|
446
|
+
return ascending$1(f(d), x);
|
|
665
447
|
};
|
|
666
448
|
}
|
|
667
449
|
|
|
668
|
-
|
|
450
|
+
bisector(ascending$1);
|
|
669
451
|
|
|
670
452
|
var noop = {
|
|
671
|
-
value: function
|
|
453
|
+
value: function () {}
|
|
672
454
|
};
|
|
673
455
|
|
|
674
456
|
function dispatch() {
|
|
@@ -684,7 +466,7 @@ function Dispatch(_) {
|
|
|
684
466
|
this._ = _;
|
|
685
467
|
}
|
|
686
468
|
|
|
687
|
-
function parseTypenames(typenames, types) {
|
|
469
|
+
function parseTypenames$1(typenames, types) {
|
|
688
470
|
return typenames.trim().split(/^|\s+/).map(function (t) {
|
|
689
471
|
var name = "",
|
|
690
472
|
i = t.indexOf(".");
|
|
@@ -699,17 +481,15 @@ function parseTypenames(typenames, types) {
|
|
|
699
481
|
|
|
700
482
|
Dispatch.prototype = dispatch.prototype = {
|
|
701
483
|
constructor: Dispatch,
|
|
702
|
-
on: function
|
|
484
|
+
on: function (typename, callback) {
|
|
703
485
|
var _ = this._,
|
|
704
|
-
T = parseTypenames(typename + "", _),
|
|
486
|
+
T = parseTypenames$1(typename + "", _),
|
|
705
487
|
t,
|
|
706
488
|
i = -1,
|
|
707
489
|
n = T.length; // If no callback was specified, return the callback of the given type and name.
|
|
708
490
|
|
|
709
491
|
if (arguments.length < 2) {
|
|
710
|
-
while (++i < n)
|
|
711
|
-
if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
|
|
712
|
-
}
|
|
492
|
+
while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
|
|
713
493
|
|
|
714
494
|
return;
|
|
715
495
|
} // If a type was specified, set the callback for the given type and name.
|
|
@@ -719,43 +499,33 @@ Dispatch.prototype = dispatch.prototype = {
|
|
|
719
499
|
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
|
720
500
|
|
|
721
501
|
while (++i < n) {
|
|
722
|
-
if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);else if (callback == null) for (t in _)
|
|
723
|
-
_[t] = set(_[t], typename.name, null);
|
|
724
|
-
}
|
|
502
|
+
if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
|
|
725
503
|
}
|
|
726
504
|
|
|
727
505
|
return this;
|
|
728
506
|
},
|
|
729
|
-
copy: function
|
|
507
|
+
copy: function () {
|
|
730
508
|
var copy = {},
|
|
731
509
|
_ = this._;
|
|
732
510
|
|
|
733
|
-
for (var t in _)
|
|
734
|
-
copy[t] = _[t].slice();
|
|
735
|
-
}
|
|
511
|
+
for (var t in _) copy[t] = _[t].slice();
|
|
736
512
|
|
|
737
513
|
return new Dispatch(copy);
|
|
738
514
|
},
|
|
739
|
-
call: function
|
|
740
|
-
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i)
|
|
741
|
-
args[i] = arguments[i + 2];
|
|
742
|
-
}
|
|
515
|
+
call: function (type, that) {
|
|
516
|
+
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
|
743
517
|
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
744
518
|
|
|
745
|
-
for (t = this._[type], i = 0, n = t.length; i < n; ++i)
|
|
746
|
-
t[i].value.apply(that, args);
|
|
747
|
-
}
|
|
519
|
+
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
748
520
|
},
|
|
749
|
-
apply: function
|
|
521
|
+
apply: function (type, that, args) {
|
|
750
522
|
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
|
751
523
|
|
|
752
|
-
for (var t = this._[type], i = 0, n = t.length; i < n; ++i)
|
|
753
|
-
t[i].value.apply(that, args);
|
|
754
|
-
}
|
|
524
|
+
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
|
755
525
|
}
|
|
756
526
|
};
|
|
757
527
|
|
|
758
|
-
function get(type, name) {
|
|
528
|
+
function get$1(type, name) {
|
|
759
529
|
for (var i = 0, n = type.length, c; i < n; ++i) {
|
|
760
530
|
if ((c = type[i]).name === name) {
|
|
761
531
|
return c.value;
|
|
@@ -763,7 +533,7 @@ function get(type, name) {
|
|
|
763
533
|
}
|
|
764
534
|
}
|
|
765
535
|
|
|
766
|
-
function set(type, name, callback) {
|
|
536
|
+
function set$1(type, name, callback) {
|
|
767
537
|
for (var i = 0, n = type.length; i < n; ++i) {
|
|
768
538
|
if (type[i].name === name) {
|
|
769
539
|
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
|
@@ -836,7 +606,7 @@ function selection_select (select) {
|
|
|
836
606
|
}
|
|
837
607
|
}
|
|
838
608
|
|
|
839
|
-
return new Selection(subgroups, this._parents);
|
|
609
|
+
return new Selection$1(subgroups, this._parents);
|
|
840
610
|
}
|
|
841
611
|
|
|
842
612
|
function empty() {
|
|
@@ -861,7 +631,7 @@ function selection_selectAll (select) {
|
|
|
861
631
|
}
|
|
862
632
|
}
|
|
863
633
|
|
|
864
|
-
return new Selection(subgroups, parents);
|
|
634
|
+
return new Selection$1(subgroups, parents);
|
|
865
635
|
}
|
|
866
636
|
|
|
867
637
|
function matcher (selector) {
|
|
@@ -881,7 +651,7 @@ function selection_filter (match) {
|
|
|
881
651
|
}
|
|
882
652
|
}
|
|
883
653
|
|
|
884
|
-
return new Selection(subgroups, this._parents);
|
|
654
|
+
return new Selection$1(subgroups, this._parents);
|
|
885
655
|
}
|
|
886
656
|
|
|
887
657
|
function sparse (update) {
|
|
@@ -889,7 +659,7 @@ function sparse (update) {
|
|
|
889
659
|
}
|
|
890
660
|
|
|
891
661
|
function selection_enter () {
|
|
892
|
-
return new Selection(this._enter || this._groups.map(sparse), this._parents);
|
|
662
|
+
return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
|
|
893
663
|
}
|
|
894
664
|
function EnterNode(parent, datum) {
|
|
895
665
|
this.ownerDocument = parent.ownerDocument;
|
|
@@ -900,21 +670,21 @@ function EnterNode(parent, datum) {
|
|
|
900
670
|
}
|
|
901
671
|
EnterNode.prototype = {
|
|
902
672
|
constructor: EnterNode,
|
|
903
|
-
appendChild: function
|
|
673
|
+
appendChild: function (child) {
|
|
904
674
|
return this._parent.insertBefore(child, this._next);
|
|
905
675
|
},
|
|
906
|
-
insertBefore: function
|
|
676
|
+
insertBefore: function (child, next) {
|
|
907
677
|
return this._parent.insertBefore(child, next);
|
|
908
678
|
},
|
|
909
|
-
querySelector: function
|
|
679
|
+
querySelector: function (selector) {
|
|
910
680
|
return this._parent.querySelector(selector);
|
|
911
681
|
},
|
|
912
|
-
querySelectorAll: function
|
|
682
|
+
querySelectorAll: function (selector) {
|
|
913
683
|
return this._parent.querySelectorAll(selector);
|
|
914
684
|
}
|
|
915
685
|
};
|
|
916
686
|
|
|
917
|
-
function constant (x) {
|
|
687
|
+
function constant$2 (x) {
|
|
918
688
|
return function () {
|
|
919
689
|
return x;
|
|
920
690
|
};
|
|
@@ -1004,7 +774,7 @@ function selection_data (value, key) {
|
|
|
1004
774
|
var bind = key ? bindKey : bindIndex,
|
|
1005
775
|
parents = this._parents,
|
|
1006
776
|
groups = this._groups;
|
|
1007
|
-
if (typeof value !== "function") value = constant(value);
|
|
777
|
+
if (typeof value !== "function") value = constant$2(value);
|
|
1008
778
|
|
|
1009
779
|
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
|
1010
780
|
var parent = parents[j],
|
|
@@ -1023,22 +793,21 @@ function selection_data (value, key) {
|
|
|
1023
793
|
if (previous = enterGroup[i0]) {
|
|
1024
794
|
if (i0 >= i1) i1 = i0 + 1;
|
|
1025
795
|
|
|
1026
|
-
while (!(next = updateGroup[i1]) && ++i1 < dataLength)
|
|
1027
|
-
}
|
|
796
|
+
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
|
1028
797
|
|
|
1029
798
|
previous._next = next || null;
|
|
1030
799
|
}
|
|
1031
800
|
}
|
|
1032
801
|
}
|
|
1033
802
|
|
|
1034
|
-
update = new Selection(update, parents);
|
|
803
|
+
update = new Selection$1(update, parents);
|
|
1035
804
|
update._enter = enter;
|
|
1036
805
|
update._exit = exit;
|
|
1037
806
|
return update;
|
|
1038
807
|
}
|
|
1039
808
|
|
|
1040
809
|
function selection_exit () {
|
|
1041
|
-
return new Selection(this._exit || this._groups.map(sparse), this._parents);
|
|
810
|
+
return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
|
|
1042
811
|
}
|
|
1043
812
|
|
|
1044
813
|
function selection_join (onenter, onupdate, onexit) {
|
|
@@ -1064,7 +833,7 @@ function selection_merge (selection) {
|
|
|
1064
833
|
merges[j] = groups0[j];
|
|
1065
834
|
}
|
|
1066
835
|
|
|
1067
|
-
return new Selection(merges, this._parents);
|
|
836
|
+
return new Selection$1(merges, this._parents);
|
|
1068
837
|
}
|
|
1069
838
|
|
|
1070
839
|
function selection_order () {
|
|
@@ -1081,7 +850,7 @@ function selection_order () {
|
|
|
1081
850
|
}
|
|
1082
851
|
|
|
1083
852
|
function selection_sort (compare) {
|
|
1084
|
-
if (!compare) compare = ascending
|
|
853
|
+
if (!compare) compare = ascending;
|
|
1085
854
|
|
|
1086
855
|
function compareNode(a, b) {
|
|
1087
856
|
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
|
@@ -1097,10 +866,10 @@ function selection_sort (compare) {
|
|
|
1097
866
|
sortgroup.sort(compareNode);
|
|
1098
867
|
}
|
|
1099
868
|
|
|
1100
|
-
return new Selection(sortgroups, this._parents).order();
|
|
869
|
+
return new Selection$1(sortgroups, this._parents).order();
|
|
1101
870
|
}
|
|
1102
871
|
|
|
1103
|
-
function ascending
|
|
872
|
+
function ascending(a, b) {
|
|
1104
873
|
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
1105
874
|
}
|
|
1106
875
|
|
|
@@ -1153,38 +922,38 @@ function selection_each (callback) {
|
|
|
1153
922
|
return this;
|
|
1154
923
|
}
|
|
1155
924
|
|
|
1156
|
-
function attrRemove(name) {
|
|
925
|
+
function attrRemove$1(name) {
|
|
1157
926
|
return function () {
|
|
1158
927
|
this.removeAttribute(name);
|
|
1159
928
|
};
|
|
1160
929
|
}
|
|
1161
930
|
|
|
1162
|
-
function attrRemoveNS(fullname) {
|
|
931
|
+
function attrRemoveNS$1(fullname) {
|
|
1163
932
|
return function () {
|
|
1164
933
|
this.removeAttributeNS(fullname.space, fullname.local);
|
|
1165
934
|
};
|
|
1166
935
|
}
|
|
1167
936
|
|
|
1168
|
-
function attrConstant(name, value) {
|
|
937
|
+
function attrConstant$1(name, value) {
|
|
1169
938
|
return function () {
|
|
1170
939
|
this.setAttribute(name, value);
|
|
1171
940
|
};
|
|
1172
941
|
}
|
|
1173
942
|
|
|
1174
|
-
function attrConstantNS(fullname, value) {
|
|
943
|
+
function attrConstantNS$1(fullname, value) {
|
|
1175
944
|
return function () {
|
|
1176
945
|
this.setAttributeNS(fullname.space, fullname.local, value);
|
|
1177
946
|
};
|
|
1178
947
|
}
|
|
1179
948
|
|
|
1180
|
-
function attrFunction(name, value) {
|
|
949
|
+
function attrFunction$1(name, value) {
|
|
1181
950
|
return function () {
|
|
1182
951
|
var v = value.apply(this, arguments);
|
|
1183
952
|
if (v == null) this.removeAttribute(name);else this.setAttribute(name, v);
|
|
1184
953
|
};
|
|
1185
954
|
}
|
|
1186
955
|
|
|
1187
|
-
function attrFunctionNS(fullname, value) {
|
|
956
|
+
function attrFunctionNS$1(fullname, value) {
|
|
1188
957
|
return function () {
|
|
1189
958
|
var v = value.apply(this, arguments);
|
|
1190
959
|
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);else this.setAttributeNS(fullname.space, fullname.local, v);
|
|
@@ -1199,28 +968,28 @@ function selection_attr (name, value) {
|
|
|
1199
968
|
return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
|
|
1200
969
|
}
|
|
1201
970
|
|
|
1202
|
-
return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
|
|
971
|
+
return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value));
|
|
1203
972
|
}
|
|
1204
973
|
|
|
1205
974
|
function defaultView (node) {
|
|
1206
|
-
return node.ownerDocument && node.ownerDocument.defaultView
|
|
1207
|
-
node.document && node // node is a Window
|
|
975
|
+
return node.ownerDocument && node.ownerDocument.defaultView // node is a Node
|
|
976
|
+
|| node.document && node // node is a Window
|
|
1208
977
|
|| node.defaultView; // node is a Document
|
|
1209
978
|
}
|
|
1210
979
|
|
|
1211
|
-
function styleRemove(name) {
|
|
980
|
+
function styleRemove$1(name) {
|
|
1212
981
|
return function () {
|
|
1213
982
|
this.style.removeProperty(name);
|
|
1214
983
|
};
|
|
1215
984
|
}
|
|
1216
985
|
|
|
1217
|
-
function styleConstant(name, value, priority) {
|
|
986
|
+
function styleConstant$1(name, value, priority) {
|
|
1218
987
|
return function () {
|
|
1219
988
|
this.style.setProperty(name, value, priority);
|
|
1220
989
|
};
|
|
1221
990
|
}
|
|
1222
991
|
|
|
1223
|
-
function styleFunction(name, value, priority) {
|
|
992
|
+
function styleFunction$1(name, value, priority) {
|
|
1224
993
|
return function () {
|
|
1225
994
|
var v = value.apply(this, arguments);
|
|
1226
995
|
if (v == null) this.style.removeProperty(name);else this.style.setProperty(name, v, priority);
|
|
@@ -1228,7 +997,7 @@ function styleFunction(name, value, priority) {
|
|
|
1228
997
|
}
|
|
1229
998
|
|
|
1230
999
|
function selection_style (name, value, priority) {
|
|
1231
|
-
return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
|
|
1000
|
+
return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
|
|
1232
1001
|
}
|
|
1233
1002
|
function styleValue(node, name) {
|
|
1234
1003
|
return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
|
|
@@ -1271,7 +1040,7 @@ function ClassList(node) {
|
|
|
1271
1040
|
}
|
|
1272
1041
|
|
|
1273
1042
|
ClassList.prototype = {
|
|
1274
|
-
add: function
|
|
1043
|
+
add: function (name) {
|
|
1275
1044
|
var i = this._names.indexOf(name);
|
|
1276
1045
|
|
|
1277
1046
|
if (i < 0) {
|
|
@@ -1280,7 +1049,7 @@ ClassList.prototype = {
|
|
|
1280
1049
|
this._node.setAttribute("class", this._names.join(" "));
|
|
1281
1050
|
}
|
|
1282
1051
|
},
|
|
1283
|
-
remove: function
|
|
1052
|
+
remove: function (name) {
|
|
1284
1053
|
var i = this._names.indexOf(name);
|
|
1285
1054
|
|
|
1286
1055
|
if (i >= 0) {
|
|
@@ -1289,7 +1058,7 @@ ClassList.prototype = {
|
|
|
1289
1058
|
this._node.setAttribute("class", this._names.join(" "));
|
|
1290
1059
|
}
|
|
1291
1060
|
},
|
|
1292
|
-
contains: function
|
|
1061
|
+
contains: function (name) {
|
|
1293
1062
|
return this._names.indexOf(name) >= 0;
|
|
1294
1063
|
}
|
|
1295
1064
|
};
|
|
@@ -1299,9 +1068,7 @@ function classedAdd(node, names) {
|
|
|
1299
1068
|
i = -1,
|
|
1300
1069
|
n = names.length;
|
|
1301
1070
|
|
|
1302
|
-
while (++i < n)
|
|
1303
|
-
list.add(names[i]);
|
|
1304
|
-
}
|
|
1071
|
+
while (++i < n) list.add(names[i]);
|
|
1305
1072
|
}
|
|
1306
1073
|
|
|
1307
1074
|
function classedRemove(node, names) {
|
|
@@ -1309,9 +1076,7 @@ function classedRemove(node, names) {
|
|
|
1309
1076
|
i = -1,
|
|
1310
1077
|
n = names.length;
|
|
1311
1078
|
|
|
1312
|
-
while (++i < n)
|
|
1313
|
-
list.remove(names[i]);
|
|
1314
|
-
}
|
|
1079
|
+
while (++i < n) list.remove(names[i]);
|
|
1315
1080
|
}
|
|
1316
1081
|
|
|
1317
1082
|
function classedTrue(names) {
|
|
@@ -1340,9 +1105,7 @@ function selection_classed (name, value) {
|
|
|
1340
1105
|
i = -1,
|
|
1341
1106
|
n = names.length;
|
|
1342
1107
|
|
|
1343
|
-
while (++i < n)
|
|
1344
|
-
if (!list.contains(names[i])) return false;
|
|
1345
|
-
}
|
|
1108
|
+
while (++i < n) if (!list.contains(names[i])) return false;
|
|
1346
1109
|
|
|
1347
1110
|
return true;
|
|
1348
1111
|
}
|
|
@@ -1354,13 +1117,13 @@ function textRemove() {
|
|
|
1354
1117
|
this.textContent = "";
|
|
1355
1118
|
}
|
|
1356
1119
|
|
|
1357
|
-
function textConstant(value) {
|
|
1120
|
+
function textConstant$1(value) {
|
|
1358
1121
|
return function () {
|
|
1359
1122
|
this.textContent = value;
|
|
1360
1123
|
};
|
|
1361
1124
|
}
|
|
1362
1125
|
|
|
1363
|
-
function textFunction(value) {
|
|
1126
|
+
function textFunction$1(value) {
|
|
1364
1127
|
return function () {
|
|
1365
1128
|
var v = value.apply(this, arguments);
|
|
1366
1129
|
this.textContent = v == null ? "" : v;
|
|
@@ -1368,7 +1131,7 @@ function textFunction(value) {
|
|
|
1368
1131
|
}
|
|
1369
1132
|
|
|
1370
1133
|
function selection_text (value) {
|
|
1371
|
-
return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
|
|
1134
|
+
return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent;
|
|
1372
1135
|
}
|
|
1373
1136
|
|
|
1374
1137
|
function htmlRemove() {
|
|
@@ -1495,7 +1258,7 @@ function contextListener(listener, index, group) {
|
|
|
1495
1258
|
};
|
|
1496
1259
|
}
|
|
1497
1260
|
|
|
1498
|
-
function parseTypenames
|
|
1261
|
+
function parseTypenames(typenames) {
|
|
1499
1262
|
return typenames.trim().split(/^|\s+/).map(function (t) {
|
|
1500
1263
|
var name = "",
|
|
1501
1264
|
i = t.indexOf(".");
|
|
@@ -1551,7 +1314,7 @@ function onAdd(typename, value, capture) {
|
|
|
1551
1314
|
}
|
|
1552
1315
|
|
|
1553
1316
|
function selection_on (typename, value, capture) {
|
|
1554
|
-
var typenames = parseTypenames
|
|
1317
|
+
var typenames = parseTypenames(typename + ""),
|
|
1555
1318
|
i,
|
|
1556
1319
|
n = typenames.length,
|
|
1557
1320
|
t;
|
|
@@ -1572,9 +1335,7 @@ function selection_on (typename, value, capture) {
|
|
|
1572
1335
|
on = value ? onAdd : onRemove;
|
|
1573
1336
|
if (capture == null) capture = false;
|
|
1574
1337
|
|
|
1575
|
-
for (i = 0; i < n; ++i)
|
|
1576
|
-
this.each(on(typenames[i], value, capture));
|
|
1577
|
-
}
|
|
1338
|
+
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
|
|
1578
1339
|
|
|
1579
1340
|
return this;
|
|
1580
1341
|
}
|
|
@@ -1621,17 +1382,17 @@ function selection_dispatch (type, params) {
|
|
|
1621
1382
|
}
|
|
1622
1383
|
|
|
1623
1384
|
var root = [null];
|
|
1624
|
-
function Selection(groups, parents) {
|
|
1385
|
+
function Selection$1(groups, parents) {
|
|
1625
1386
|
this._groups = groups;
|
|
1626
1387
|
this._parents = parents;
|
|
1627
1388
|
}
|
|
1628
1389
|
|
|
1629
1390
|
function selection() {
|
|
1630
|
-
return new Selection([[document.documentElement]], root);
|
|
1391
|
+
return new Selection$1([[document.documentElement]], root);
|
|
1631
1392
|
}
|
|
1632
1393
|
|
|
1633
|
-
Selection.prototype = selection.prototype = {
|
|
1634
|
-
constructor: Selection,
|
|
1394
|
+
Selection$1.prototype = selection.prototype = {
|
|
1395
|
+
constructor: Selection$1,
|
|
1635
1396
|
select: selection_select,
|
|
1636
1397
|
selectAll: selection_selectAll,
|
|
1637
1398
|
filter: selection_filter,
|
|
@@ -1666,16 +1427,14 @@ Selection.prototype = selection.prototype = {
|
|
|
1666
1427
|
};
|
|
1667
1428
|
|
|
1668
1429
|
function select (selector) {
|
|
1669
|
-
return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
|
|
1430
|
+
return typeof selector === "string" ? new Selection$1([[document.querySelector(selector)]], [document.documentElement]) : new Selection$1([[selector]], root);
|
|
1670
1431
|
}
|
|
1671
1432
|
|
|
1672
1433
|
function sourceEvent () {
|
|
1673
1434
|
var current = event$1,
|
|
1674
1435
|
source;
|
|
1675
1436
|
|
|
1676
|
-
while (source = current.sourceEvent)
|
|
1677
|
-
current = source;
|
|
1678
|
-
}
|
|
1437
|
+
while (source = current.sourceEvent) current = source;
|
|
1679
1438
|
|
|
1680
1439
|
return current;
|
|
1681
1440
|
}
|
|
@@ -1712,17 +1471,17 @@ function touch (node, touches, identifier) {
|
|
|
1712
1471
|
return null;
|
|
1713
1472
|
}
|
|
1714
1473
|
|
|
1715
|
-
function noevent () {
|
|
1474
|
+
function noevent$1 () {
|
|
1716
1475
|
event$1.preventDefault();
|
|
1717
1476
|
event$1.stopImmediatePropagation();
|
|
1718
1477
|
}
|
|
1719
1478
|
|
|
1720
1479
|
function dragDisable (view) {
|
|
1721
1480
|
var root = view.document.documentElement,
|
|
1722
|
-
selection = select(view).on("dragstart.drag", noevent, true);
|
|
1481
|
+
selection = select(view).on("dragstart.drag", noevent$1, true);
|
|
1723
1482
|
|
|
1724
1483
|
if ("onselectstart" in root) {
|
|
1725
|
-
selection.on("selectstart.drag", noevent, true);
|
|
1484
|
+
selection.on("selectstart.drag", noevent$1, true);
|
|
1726
1485
|
} else {
|
|
1727
1486
|
root.__noselect = root.style.MozUserSelect;
|
|
1728
1487
|
root.style.MozUserSelect = "none";
|
|
@@ -1733,7 +1492,7 @@ function yesdrag(view, noclick) {
|
|
|
1733
1492
|
selection = select(view).on("dragstart.drag", null);
|
|
1734
1493
|
|
|
1735
1494
|
if (noclick) {
|
|
1736
|
-
selection.on("click.drag", noevent, true);
|
|
1495
|
+
selection.on("click.drag", noevent$1, true);
|
|
1737
1496
|
setTimeout(function () {
|
|
1738
1497
|
selection.on("click.drag", null);
|
|
1739
1498
|
}, 0);
|
|
@@ -1754,17 +1513,14 @@ function define (constructor, factory, prototype) {
|
|
|
1754
1513
|
function extend(parent, definition) {
|
|
1755
1514
|
var prototype = Object.create(parent.prototype);
|
|
1756
1515
|
|
|
1757
|
-
for (var key in definition)
|
|
1758
|
-
prototype[key] = definition[key];
|
|
1759
|
-
}
|
|
1516
|
+
for (var key in definition) prototype[key] = definition[key];
|
|
1760
1517
|
|
|
1761
1518
|
return prototype;
|
|
1762
1519
|
}
|
|
1763
1520
|
|
|
1764
1521
|
function Color() {}
|
|
1765
|
-
var
|
|
1766
|
-
|
|
1767
|
-
var _brighter = 1 / _darker;
|
|
1522
|
+
var darker = 0.7;
|
|
1523
|
+
var brighter = 1 / darker;
|
|
1768
1524
|
var reI = "\\s*([+-]?\\d+)\\s*",
|
|
1769
1525
|
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
|
1770
1526
|
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
|
@@ -1926,10 +1682,10 @@ var named = {
|
|
|
1926
1682
|
yellowgreen: 0x9acd32
|
|
1927
1683
|
};
|
|
1928
1684
|
define(Color, color, {
|
|
1929
|
-
copy: function
|
|
1685
|
+
copy: function (channels) {
|
|
1930
1686
|
return Object.assign(new this.constructor(), this, channels);
|
|
1931
1687
|
},
|
|
1932
|
-
displayable: function
|
|
1688
|
+
displayable: function () {
|
|
1933
1689
|
return this.rgb().displayable();
|
|
1934
1690
|
},
|
|
1935
1691
|
hex: color_formatHex,
|
|
@@ -1995,18 +1751,18 @@ function Rgb(r, g, b, opacity) {
|
|
|
1995
1751
|
this.opacity = +opacity;
|
|
1996
1752
|
}
|
|
1997
1753
|
define(Rgb, rgb, extend(Color, {
|
|
1998
|
-
brighter: function
|
|
1999
|
-
k = k == null ?
|
|
1754
|
+
brighter: function (k) {
|
|
1755
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
2000
1756
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
2001
1757
|
},
|
|
2002
|
-
darker: function
|
|
2003
|
-
k = k == null ?
|
|
1758
|
+
darker: function (k) {
|
|
1759
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
2004
1760
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
2005
1761
|
},
|
|
2006
|
-
rgb: function
|
|
1762
|
+
rgb: function () {
|
|
2007
1763
|
return this;
|
|
2008
1764
|
},
|
|
2009
|
-
displayable: function
|
|
1765
|
+
displayable: function () {
|
|
2010
1766
|
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
|
|
2011
1767
|
},
|
|
2012
1768
|
hex: rgb_formatHex,
|
|
@@ -2073,15 +1829,15 @@ function Hsl(h, s, l, opacity) {
|
|
|
2073
1829
|
}
|
|
2074
1830
|
|
|
2075
1831
|
define(Hsl, hsl, extend(Color, {
|
|
2076
|
-
brighter: function
|
|
2077
|
-
k = k == null ?
|
|
1832
|
+
brighter: function (k) {
|
|
1833
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
2078
1834
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
2079
1835
|
},
|
|
2080
|
-
darker: function
|
|
2081
|
-
k = k == null ?
|
|
1836
|
+
darker: function (k) {
|
|
1837
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
2082
1838
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
2083
1839
|
},
|
|
2084
|
-
rgb: function
|
|
1840
|
+
rgb: function () {
|
|
2085
1841
|
var h = this.h % 360 + (this.h < 0) * 360,
|
|
2086
1842
|
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
2087
1843
|
l = this.l,
|
|
@@ -2089,10 +1845,10 @@ define(Hsl, hsl, extend(Color, {
|
|
|
2089
1845
|
m1 = 2 * l - m2;
|
|
2090
1846
|
return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
|
|
2091
1847
|
},
|
|
2092
|
-
displayable: function
|
|
1848
|
+
displayable: function () {
|
|
2093
1849
|
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
|
|
2094
1850
|
},
|
|
2095
|
-
formatHsl: function
|
|
1851
|
+
formatHsl: function () {
|
|
2096
1852
|
var a = this.opacity;
|
|
2097
1853
|
a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
|
2098
1854
|
return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
|
|
@@ -2225,16 +1981,14 @@ function interpolateString (a, b) {
|
|
|
2225
1981
|
|
|
2226
1982
|
|
|
2227
1983
|
return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) {
|
|
2228
|
-
for (var i = 0, o; i < b; ++i)
|
|
2229
|
-
s[(o = q[i]).i] = o.x(t);
|
|
2230
|
-
}
|
|
1984
|
+
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
|
|
2231
1985
|
|
|
2232
1986
|
return s.join("");
|
|
2233
1987
|
});
|
|
2234
1988
|
}
|
|
2235
1989
|
|
|
2236
1990
|
var degrees = 180 / Math.PI;
|
|
2237
|
-
var identity = {
|
|
1991
|
+
var identity$1 = {
|
|
2238
1992
|
translateX: 0,
|
|
2239
1993
|
translateY: 0,
|
|
2240
1994
|
rotate: 0,
|
|
@@ -2260,7 +2014,7 @@ function decompose (a, b, c, d, e, f) {
|
|
|
2260
2014
|
|
|
2261
2015
|
var cssNode, cssRoot, cssView, svgNode;
|
|
2262
2016
|
function parseCss(value) {
|
|
2263
|
-
if (value === "none") return identity;
|
|
2017
|
+
if (value === "none") return identity$1;
|
|
2264
2018
|
if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
|
|
2265
2019
|
cssNode.style.transform = value;
|
|
2266
2020
|
value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
|
|
@@ -2269,10 +2023,10 @@ function parseCss(value) {
|
|
|
2269
2023
|
return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
|
|
2270
2024
|
}
|
|
2271
2025
|
function parseSvg(value) {
|
|
2272
|
-
if (value == null) return identity;
|
|
2026
|
+
if (value == null) return identity$1;
|
|
2273
2027
|
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2274
2028
|
svgNode.setAttribute("transform", value);
|
|
2275
|
-
if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
|
|
2029
|
+
if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
|
|
2276
2030
|
value = value.matrix;
|
|
2277
2031
|
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
|
2278
2032
|
}
|
|
@@ -2353,9 +2107,7 @@ function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
|
|
2353
2107
|
n = q.length,
|
|
2354
2108
|
o;
|
|
2355
2109
|
|
|
2356
|
-
while (++i < n)
|
|
2357
|
-
s[(o = q[i]).i] = o.x(t);
|
|
2358
|
-
}
|
|
2110
|
+
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
|
2359
2111
|
|
|
2360
2112
|
return s.join("");
|
|
2361
2113
|
};
|
|
@@ -2400,25 +2152,25 @@ function interpolateZoom (p0, p1) {
|
|
|
2400
2152
|
if (d2 < epsilon2) {
|
|
2401
2153
|
S = Math.log(w1 / w0) / rho;
|
|
2402
2154
|
|
|
2403
|
-
i = function
|
|
2155
|
+
i = function (t) {
|
|
2404
2156
|
return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
|
|
2405
2157
|
};
|
|
2406
2158
|
} // General case.
|
|
2407
2159
|
else {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2160
|
+
var d1 = Math.sqrt(d2),
|
|
2161
|
+
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
|
|
2162
|
+
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
|
|
2163
|
+
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
|
|
2164
|
+
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
2165
|
+
S = (r1 - r0) / rho;
|
|
2166
|
+
|
|
2167
|
+
i = function (t) {
|
|
2168
|
+
var s = t * S,
|
|
2169
|
+
coshr0 = cosh(r0),
|
|
2170
|
+
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
|
2171
|
+
return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2422
2174
|
|
|
2423
2175
|
i.duration = S * 1000;
|
|
2424
2176
|
return i;
|
|
@@ -2426,7 +2178,7 @@ function interpolateZoom (p0, p1) {
|
|
|
2426
2178
|
|
|
2427
2179
|
var frame = 0,
|
|
2428
2180
|
// is an animation frame pending?
|
|
2429
|
-
timeout = 0,
|
|
2181
|
+
timeout$1 = 0,
|
|
2430
2182
|
// is a timeout pending?
|
|
2431
2183
|
interval = 0,
|
|
2432
2184
|
// are any timers active?
|
|
@@ -2437,8 +2189,8 @@ taskHead,
|
|
|
2437
2189
|
clockLast = 0,
|
|
2438
2190
|
clockNow = 0,
|
|
2439
2191
|
clockSkew = 0,
|
|
2440
|
-
clock =
|
|
2441
|
-
setFrame =
|
|
2192
|
+
clock = typeof performance === "object" && performance.now ? performance : Date,
|
|
2193
|
+
setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) {
|
|
2442
2194
|
setTimeout(f, 17);
|
|
2443
2195
|
};
|
|
2444
2196
|
function now() {
|
|
@@ -2454,7 +2206,7 @@ function Timer() {
|
|
|
2454
2206
|
}
|
|
2455
2207
|
Timer.prototype = timer.prototype = {
|
|
2456
2208
|
constructor: Timer,
|
|
2457
|
-
restart: function
|
|
2209
|
+
restart: function (callback, delay, time) {
|
|
2458
2210
|
if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
|
2459
2211
|
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
|
2460
2212
|
|
|
@@ -2467,7 +2219,7 @@ Timer.prototype = timer.prototype = {
|
|
|
2467
2219
|
this._time = time;
|
|
2468
2220
|
sleep();
|
|
2469
2221
|
},
|
|
2470
|
-
stop: function
|
|
2222
|
+
stop: function () {
|
|
2471
2223
|
if (this._call) {
|
|
2472
2224
|
this._call = null;
|
|
2473
2225
|
this._time = Infinity;
|
|
@@ -2498,7 +2250,7 @@ function timerFlush() {
|
|
|
2498
2250
|
|
|
2499
2251
|
function wake() {
|
|
2500
2252
|
clockNow = (clockLast = clock.now()) + clockSkew;
|
|
2501
|
-
frame = timeout = 0;
|
|
2253
|
+
frame = timeout$1 = 0;
|
|
2502
2254
|
|
|
2503
2255
|
try {
|
|
2504
2256
|
timerFlush();
|
|
@@ -2538,11 +2290,11 @@ function nap() {
|
|
|
2538
2290
|
function sleep(time) {
|
|
2539
2291
|
if (frame) return; // Soonest alarm already set, or will be.
|
|
2540
2292
|
|
|
2541
|
-
if (timeout) timeout = clearTimeout(timeout);
|
|
2293
|
+
if (timeout$1) timeout$1 = clearTimeout(timeout$1);
|
|
2542
2294
|
var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
|
|
2543
2295
|
|
|
2544
2296
|
if (delay > 24) {
|
|
2545
|
-
if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
|
|
2297
|
+
if (time < Infinity) timeout$1 = setTimeout(wake, time - clock.now() - clockSkew);
|
|
2546
2298
|
if (interval) interval = clearInterval(interval);
|
|
2547
2299
|
} else {
|
|
2548
2300
|
if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
|
@@ -2550,7 +2302,7 @@ function sleep(time) {
|
|
|
2550
2302
|
}
|
|
2551
2303
|
}
|
|
2552
2304
|
|
|
2553
|
-
function timeout
|
|
2305
|
+
function timeout (callback, delay, time) {
|
|
2554
2306
|
var t = new Timer();
|
|
2555
2307
|
delay = delay == null ? 0 : +delay;
|
|
2556
2308
|
t.restart(function (elapsed) {
|
|
@@ -2589,16 +2341,16 @@ function schedule (node, name, id, index, group, timing) {
|
|
|
2589
2341
|
});
|
|
2590
2342
|
}
|
|
2591
2343
|
function init(node, id) {
|
|
2592
|
-
var schedule = get
|
|
2344
|
+
var schedule = get(node, id);
|
|
2593
2345
|
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
|
2594
2346
|
return schedule;
|
|
2595
2347
|
}
|
|
2596
|
-
function set
|
|
2597
|
-
var schedule = get
|
|
2348
|
+
function set(node, id) {
|
|
2349
|
+
var schedule = get(node, id);
|
|
2598
2350
|
if (schedule.state > STARTED) throw new Error("too late; already running");
|
|
2599
2351
|
return schedule;
|
|
2600
2352
|
}
|
|
2601
|
-
function get
|
|
2353
|
+
function get(node, id) {
|
|
2602
2354
|
var schedule = node.__transition;
|
|
2603
2355
|
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
|
2604
2356
|
return schedule;
|
|
@@ -2630,7 +2382,7 @@ function create(node, id, self) {
|
|
|
2630
2382
|
// defer starting an interrupting transition until that transition has a
|
|
2631
2383
|
// chance to tick (and possibly end); see d3/d3-transition#54!
|
|
2632
2384
|
|
|
2633
|
-
if (o.state === STARTED) return timeout
|
|
2385
|
+
if (o.state === STARTED) return timeout(start); // Interrupt the active transition, if any.
|
|
2634
2386
|
|
|
2635
2387
|
if (o.state === RUNNING) {
|
|
2636
2388
|
o.state = ENDED;
|
|
@@ -2639,18 +2391,18 @@ function create(node, id, self) {
|
|
|
2639
2391
|
delete schedules[i];
|
|
2640
2392
|
} // Cancel any pre-empted transitions.
|
|
2641
2393
|
else if (+i < id) {
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2394
|
+
o.state = ENDED;
|
|
2395
|
+
o.timer.stop();
|
|
2396
|
+
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
|
2397
|
+
delete schedules[i];
|
|
2398
|
+
}
|
|
2647
2399
|
} // Defer the first tick to end of the current frame; see d3/d3#1576.
|
|
2648
2400
|
// Note the transition may be canceled after start and before the first tick!
|
|
2649
2401
|
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
|
2650
2402
|
// Assuming this is successful, subsequent callbacks go straight to tick.
|
|
2651
2403
|
|
|
2652
2404
|
|
|
2653
|
-
timeout
|
|
2405
|
+
timeout(function () {
|
|
2654
2406
|
if (self.state === STARTED) {
|
|
2655
2407
|
self.state = RUNNING;
|
|
2656
2408
|
self.timer.restart(tick, self.delay, self.time);
|
|
@@ -2697,9 +2449,7 @@ function create(node, id, self) {
|
|
|
2697
2449
|
self.timer.stop();
|
|
2698
2450
|
delete schedules[id];
|
|
2699
2451
|
|
|
2700
|
-
for (var i in schedules)
|
|
2701
|
-
return;
|
|
2702
|
-
} // eslint-disable-line no-unused-vars
|
|
2452
|
+
for (var i in schedules) return; // eslint-disable-line no-unused-vars
|
|
2703
2453
|
|
|
2704
2454
|
|
|
2705
2455
|
delete node.__transition;
|
|
@@ -2740,7 +2490,7 @@ function selection_interrupt (name) {
|
|
|
2740
2490
|
function tweenRemove(id, name) {
|
|
2741
2491
|
var tween0, tween1;
|
|
2742
2492
|
return function () {
|
|
2743
|
-
var schedule = set
|
|
2493
|
+
var schedule = set(this, id),
|
|
2744
2494
|
tween = schedule.tween; // If this node shared tween with the previous node,
|
|
2745
2495
|
// just assign the updated shared tween and we’re done!
|
|
2746
2496
|
// Otherwise, copy-on-write.
|
|
@@ -2765,7 +2515,7 @@ function tweenFunction(id, name, value) {
|
|
|
2765
2515
|
var tween0, tween1;
|
|
2766
2516
|
if (typeof value !== "function") throw new Error();
|
|
2767
2517
|
return function () {
|
|
2768
|
-
var schedule = set
|
|
2518
|
+
var schedule = set(this, id),
|
|
2769
2519
|
tween = schedule.tween; // If this node shared tween with the previous node,
|
|
2770
2520
|
// just assign the updated shared tween and we’re done!
|
|
2771
2521
|
// Otherwise, copy-on-write.
|
|
@@ -2795,7 +2545,7 @@ function transition_tween (name, value) {
|
|
|
2795
2545
|
name += "";
|
|
2796
2546
|
|
|
2797
2547
|
if (arguments.length < 2) {
|
|
2798
|
-
var tween = get
|
|
2548
|
+
var tween = get(this.node(), id).tween;
|
|
2799
2549
|
|
|
2800
2550
|
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
|
2801
2551
|
if ((t = tween[i]).name === name) {
|
|
@@ -2811,11 +2561,11 @@ function transition_tween (name, value) {
|
|
|
2811
2561
|
function tweenValue(transition, name, value) {
|
|
2812
2562
|
var id = transition._id;
|
|
2813
2563
|
transition.each(function () {
|
|
2814
|
-
var schedule = set
|
|
2564
|
+
var schedule = set(this, id);
|
|
2815
2565
|
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
|
2816
2566
|
});
|
|
2817
2567
|
return function (node) {
|
|
2818
|
-
return get
|
|
2568
|
+
return get(node, id).value[name];
|
|
2819
2569
|
};
|
|
2820
2570
|
}
|
|
2821
2571
|
|
|
@@ -2824,19 +2574,19 @@ function interpolate (a, b) {
|
|
|
2824
2574
|
return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b);
|
|
2825
2575
|
}
|
|
2826
2576
|
|
|
2827
|
-
function attrRemove
|
|
2577
|
+
function attrRemove(name) {
|
|
2828
2578
|
return function () {
|
|
2829
2579
|
this.removeAttribute(name);
|
|
2830
2580
|
};
|
|
2831
2581
|
}
|
|
2832
2582
|
|
|
2833
|
-
function attrRemoveNS
|
|
2583
|
+
function attrRemoveNS(fullname) {
|
|
2834
2584
|
return function () {
|
|
2835
2585
|
this.removeAttributeNS(fullname.space, fullname.local);
|
|
2836
2586
|
};
|
|
2837
2587
|
}
|
|
2838
2588
|
|
|
2839
|
-
function attrConstant
|
|
2589
|
+
function attrConstant(name, interpolate, value1) {
|
|
2840
2590
|
var string00,
|
|
2841
2591
|
string1 = value1 + "",
|
|
2842
2592
|
interpolate0;
|
|
@@ -2846,7 +2596,7 @@ function attrConstant$1(name, interpolate, value1) {
|
|
|
2846
2596
|
};
|
|
2847
2597
|
}
|
|
2848
2598
|
|
|
2849
|
-
function attrConstantNS
|
|
2599
|
+
function attrConstantNS(fullname, interpolate, value1) {
|
|
2850
2600
|
var string00,
|
|
2851
2601
|
string1 = value1 + "",
|
|
2852
2602
|
interpolate0;
|
|
@@ -2856,7 +2606,7 @@ function attrConstantNS$1(fullname, interpolate, value1) {
|
|
|
2856
2606
|
};
|
|
2857
2607
|
}
|
|
2858
2608
|
|
|
2859
|
-
function attrFunction
|
|
2609
|
+
function attrFunction(name, interpolate, value) {
|
|
2860
2610
|
var string00, string10, interpolate0;
|
|
2861
2611
|
return function () {
|
|
2862
2612
|
var string0,
|
|
@@ -2869,7 +2619,7 @@ function attrFunction$1(name, interpolate, value) {
|
|
|
2869
2619
|
};
|
|
2870
2620
|
}
|
|
2871
2621
|
|
|
2872
|
-
function attrFunctionNS
|
|
2622
|
+
function attrFunctionNS(fullname, interpolate, value) {
|
|
2873
2623
|
var string00, string10, interpolate0;
|
|
2874
2624
|
return function () {
|
|
2875
2625
|
var string0,
|
|
@@ -2885,7 +2635,7 @@ function attrFunctionNS$1(fullname, interpolate, value) {
|
|
|
2885
2635
|
function transition_attr (name, value) {
|
|
2886
2636
|
var fullname = namespace(name),
|
|
2887
2637
|
i = fullname === "transform" ? interpolateTransformSvg : interpolate;
|
|
2888
|
-
return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS
|
|
2638
|
+
return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
|
2889
2639
|
}
|
|
2890
2640
|
|
|
2891
2641
|
function attrInterpolate(name, i) {
|
|
@@ -2949,36 +2699,36 @@ function delayConstant(id, value) {
|
|
|
2949
2699
|
|
|
2950
2700
|
function transition_delay (value) {
|
|
2951
2701
|
var id = this._id;
|
|
2952
|
-
return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get
|
|
2702
|
+
return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get(this.node(), id).delay;
|
|
2953
2703
|
}
|
|
2954
2704
|
|
|
2955
2705
|
function durationFunction(id, value) {
|
|
2956
2706
|
return function () {
|
|
2957
|
-
set
|
|
2707
|
+
set(this, id).duration = +value.apply(this, arguments);
|
|
2958
2708
|
};
|
|
2959
2709
|
}
|
|
2960
2710
|
|
|
2961
2711
|
function durationConstant(id, value) {
|
|
2962
2712
|
return value = +value, function () {
|
|
2963
|
-
set
|
|
2713
|
+
set(this, id).duration = value;
|
|
2964
2714
|
};
|
|
2965
2715
|
}
|
|
2966
2716
|
|
|
2967
2717
|
function transition_duration (value) {
|
|
2968
2718
|
var id = this._id;
|
|
2969
|
-
return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get
|
|
2719
|
+
return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get(this.node(), id).duration;
|
|
2970
2720
|
}
|
|
2971
2721
|
|
|
2972
2722
|
function easeConstant(id, value) {
|
|
2973
2723
|
if (typeof value !== "function") throw new Error();
|
|
2974
2724
|
return function () {
|
|
2975
|
-
set
|
|
2725
|
+
set(this, id).ease = value;
|
|
2976
2726
|
};
|
|
2977
2727
|
}
|
|
2978
2728
|
|
|
2979
2729
|
function transition_ease (value) {
|
|
2980
2730
|
var id = this._id;
|
|
2981
|
-
return arguments.length ? this.each(easeConstant(id, value)) : get
|
|
2731
|
+
return arguments.length ? this.each(easeConstant(id, value)) : get(this.node(), id).ease;
|
|
2982
2732
|
}
|
|
2983
2733
|
|
|
2984
2734
|
function transition_filter (match) {
|
|
@@ -3024,7 +2774,7 @@ function start(name) {
|
|
|
3024
2774
|
function onFunction(id, name, listener) {
|
|
3025
2775
|
var on0,
|
|
3026
2776
|
on1,
|
|
3027
|
-
sit = start(name) ? init : set
|
|
2777
|
+
sit = start(name) ? init : set;
|
|
3028
2778
|
return function () {
|
|
3029
2779
|
var schedule = sit(this, id),
|
|
3030
2780
|
on = schedule.on; // If this node shared a dispatch with the previous node,
|
|
@@ -3038,16 +2788,14 @@ function onFunction(id, name, listener) {
|
|
|
3038
2788
|
|
|
3039
2789
|
function transition_on (name, listener) {
|
|
3040
2790
|
var id = this._id;
|
|
3041
|
-
return arguments.length < 2 ? get
|
|
2791
|
+
return arguments.length < 2 ? get(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
|
|
3042
2792
|
}
|
|
3043
2793
|
|
|
3044
2794
|
function removeFunction(id) {
|
|
3045
2795
|
return function () {
|
|
3046
2796
|
var parent = this.parentNode;
|
|
3047
2797
|
|
|
3048
|
-
for (var i in this.__transition)
|
|
3049
|
-
if (+i !== id) return;
|
|
3050
|
-
}
|
|
2798
|
+
for (var i in this.__transition) if (+i !== id) return;
|
|
3051
2799
|
|
|
3052
2800
|
if (parent) parent.removeChild(this);
|
|
3053
2801
|
};
|
|
@@ -3067,7 +2815,7 @@ function transition_select (select) {
|
|
|
3067
2815
|
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
3068
2816
|
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
3069
2817
|
subgroup[i] = subnode;
|
|
3070
|
-
schedule(subgroup[i], name, id, i, subgroup, get
|
|
2818
|
+
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
|
3071
2819
|
}
|
|
3072
2820
|
}
|
|
3073
2821
|
}
|
|
@@ -3083,7 +2831,7 @@ function transition_selectAll (select) {
|
|
|
3083
2831
|
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
3084
2832
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
3085
2833
|
if (node = group[i]) {
|
|
3086
|
-
for (var children = select.call(node, node.__data__, i, group), child, inherit = get
|
|
2834
|
+
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
|
3087
2835
|
if (child = children[k]) {
|
|
3088
2836
|
schedule(child, name, id, k, children, inherit);
|
|
3089
2837
|
}
|
|
@@ -3098,9 +2846,9 @@ function transition_selectAll (select) {
|
|
|
3098
2846
|
return new Transition(subgroups, parents, name, id);
|
|
3099
2847
|
}
|
|
3100
2848
|
|
|
3101
|
-
var Selection
|
|
2849
|
+
var Selection = selection.prototype.constructor;
|
|
3102
2850
|
function transition_selection () {
|
|
3103
|
-
return new Selection
|
|
2851
|
+
return new Selection(this._groups, this._parents);
|
|
3104
2852
|
}
|
|
3105
2853
|
|
|
3106
2854
|
function styleNull(name, interpolate) {
|
|
@@ -3112,13 +2860,13 @@ function styleNull(name, interpolate) {
|
|
|
3112
2860
|
};
|
|
3113
2861
|
}
|
|
3114
2862
|
|
|
3115
|
-
function styleRemove
|
|
2863
|
+
function styleRemove(name) {
|
|
3116
2864
|
return function () {
|
|
3117
2865
|
this.style.removeProperty(name);
|
|
3118
2866
|
};
|
|
3119
2867
|
}
|
|
3120
2868
|
|
|
3121
|
-
function styleConstant
|
|
2869
|
+
function styleConstant(name, interpolate, value1) {
|
|
3122
2870
|
var string00,
|
|
3123
2871
|
string1 = value1 + "",
|
|
3124
2872
|
interpolate0;
|
|
@@ -3128,7 +2876,7 @@ function styleConstant$1(name, interpolate, value1) {
|
|
|
3128
2876
|
};
|
|
3129
2877
|
}
|
|
3130
2878
|
|
|
3131
|
-
function styleFunction
|
|
2879
|
+
function styleFunction(name, interpolate, value) {
|
|
3132
2880
|
var string00, string10, interpolate0;
|
|
3133
2881
|
return function () {
|
|
3134
2882
|
var string0 = styleValue(this, name),
|
|
@@ -3147,9 +2895,9 @@ function styleMaybeRemove(id, name) {
|
|
|
3147
2895
|
event = "end." + key,
|
|
3148
2896
|
remove;
|
|
3149
2897
|
return function () {
|
|
3150
|
-
var schedule = set
|
|
2898
|
+
var schedule = set(this, id),
|
|
3151
2899
|
on = schedule.on,
|
|
3152
|
-
listener = schedule.value[key] == null ? remove || (remove = styleRemove
|
|
2900
|
+
listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined; // If this node shared a dispatch with the previous node,
|
|
3153
2901
|
// just assign the updated shared dispatch and we’re done!
|
|
3154
2902
|
// Otherwise, copy-on-write.
|
|
3155
2903
|
|
|
@@ -3160,7 +2908,7 @@ function styleMaybeRemove(id, name) {
|
|
|
3160
2908
|
|
|
3161
2909
|
function transition_style (name, value, priority) {
|
|
3162
2910
|
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
|
|
3163
|
-
return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove
|
|
2911
|
+
return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove(name)) : typeof value === "function" ? this.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant(name, i, value), priority).on("end.style." + name, null);
|
|
3164
2912
|
}
|
|
3165
2913
|
|
|
3166
2914
|
function styleInterpolate(name, i, priority) {
|
|
@@ -3190,13 +2938,13 @@ function transition_styleTween (name, value, priority) {
|
|
|
3190
2938
|
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|
3191
2939
|
}
|
|
3192
2940
|
|
|
3193
|
-
function textConstant
|
|
2941
|
+
function textConstant(value) {
|
|
3194
2942
|
return function () {
|
|
3195
2943
|
this.textContent = value;
|
|
3196
2944
|
};
|
|
3197
2945
|
}
|
|
3198
2946
|
|
|
3199
|
-
function textFunction
|
|
2947
|
+
function textFunction(value) {
|
|
3200
2948
|
return function () {
|
|
3201
2949
|
var value1 = value(this);
|
|
3202
2950
|
this.textContent = value1 == null ? "" : value1;
|
|
@@ -3204,7 +2952,7 @@ function textFunction$1(value) {
|
|
|
3204
2952
|
}
|
|
3205
2953
|
|
|
3206
2954
|
function transition_text (value) {
|
|
3207
|
-
return this.tween("text", typeof value === "function" ? textFunction
|
|
2955
|
+
return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + ""));
|
|
3208
2956
|
}
|
|
3209
2957
|
|
|
3210
2958
|
function textInterpolate(i) {
|
|
@@ -3242,7 +2990,7 @@ function transition_transition () {
|
|
|
3242
2990
|
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
|
3243
2991
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
3244
2992
|
if (node = group[i]) {
|
|
3245
|
-
var inherit = get
|
|
2993
|
+
var inherit = get(node, id0);
|
|
3246
2994
|
schedule(node, name, id1, i, group, {
|
|
3247
2995
|
time: inherit.time + inherit.delay + inherit.duration,
|
|
3248
2996
|
delay: 0,
|
|
@@ -3267,12 +3015,12 @@ function transition_end () {
|
|
|
3267
3015
|
value: reject
|
|
3268
3016
|
},
|
|
3269
3017
|
end = {
|
|
3270
|
-
value: function
|
|
3018
|
+
value: function () {
|
|
3271
3019
|
if (--size === 0) resolve();
|
|
3272
3020
|
}
|
|
3273
3021
|
};
|
|
3274
3022
|
that.each(function () {
|
|
3275
|
-
var schedule = set
|
|
3023
|
+
var schedule = set(this, id),
|
|
3276
3024
|
on = schedule.on; // If this node shared a dispatch with the previous node,
|
|
3277
3025
|
// just assign the updated shared dispatch and we’re done!
|
|
3278
3026
|
// Otherwise, copy-on-write.
|
|
@@ -3299,14 +3047,11 @@ function Transition(groups, parents, name, id) {
|
|
|
3299
3047
|
this._name = name;
|
|
3300
3048
|
this._id = id;
|
|
3301
3049
|
}
|
|
3302
|
-
function transition(name) {
|
|
3303
|
-
return selection().transition(name);
|
|
3304
|
-
}
|
|
3305
3050
|
function newId() {
|
|
3306
3051
|
return ++id;
|
|
3307
3052
|
}
|
|
3308
3053
|
var selection_prototype = selection.prototype;
|
|
3309
|
-
Transition.prototype =
|
|
3054
|
+
Transition.prototype = {
|
|
3310
3055
|
constructor: Transition,
|
|
3311
3056
|
select: transition_select,
|
|
3312
3057
|
selectAll: transition_selectAll,
|
|
@@ -3388,75 +3133,61 @@ function Map() {}
|
|
|
3388
3133
|
|
|
3389
3134
|
Map.prototype = map.prototype = {
|
|
3390
3135
|
constructor: Map,
|
|
3391
|
-
has: function
|
|
3136
|
+
has: function (key) {
|
|
3392
3137
|
return prefix + key in this;
|
|
3393
3138
|
},
|
|
3394
|
-
get: function
|
|
3139
|
+
get: function (key) {
|
|
3395
3140
|
return this[prefix + key];
|
|
3396
3141
|
},
|
|
3397
|
-
set: function
|
|
3142
|
+
set: function (key, value) {
|
|
3398
3143
|
this[prefix + key] = value;
|
|
3399
3144
|
return this;
|
|
3400
3145
|
},
|
|
3401
|
-
remove: function
|
|
3146
|
+
remove: function (key) {
|
|
3402
3147
|
var property = prefix + key;
|
|
3403
3148
|
return property in this && delete this[property];
|
|
3404
3149
|
},
|
|
3405
|
-
clear: function
|
|
3406
|
-
for (var property in this)
|
|
3407
|
-
if (property[0] === prefix) delete this[property];
|
|
3408
|
-
}
|
|
3150
|
+
clear: function () {
|
|
3151
|
+
for (var property in this) if (property[0] === prefix) delete this[property];
|
|
3409
3152
|
},
|
|
3410
|
-
keys: function
|
|
3153
|
+
keys: function () {
|
|
3411
3154
|
var keys = [];
|
|
3412
3155
|
|
|
3413
|
-
for (var property in this)
|
|
3414
|
-
if (property[0] === prefix) keys.push(property.slice(1));
|
|
3415
|
-
}
|
|
3156
|
+
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
|
|
3416
3157
|
|
|
3417
3158
|
return keys;
|
|
3418
3159
|
},
|
|
3419
|
-
values: function
|
|
3160
|
+
values: function () {
|
|
3420
3161
|
var values = [];
|
|
3421
3162
|
|
|
3422
|
-
for (var property in this)
|
|
3423
|
-
if (property[0] === prefix) values.push(this[property]);
|
|
3424
|
-
}
|
|
3163
|
+
for (var property in this) if (property[0] === prefix) values.push(this[property]);
|
|
3425
3164
|
|
|
3426
3165
|
return values;
|
|
3427
3166
|
},
|
|
3428
|
-
entries: function
|
|
3167
|
+
entries: function () {
|
|
3429
3168
|
var entries = [];
|
|
3430
3169
|
|
|
3431
|
-
for (var property in this) {
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
});
|
|
3436
|
-
}
|
|
3170
|
+
for (var property in this) if (property[0] === prefix) entries.push({
|
|
3171
|
+
key: property.slice(1),
|
|
3172
|
+
value: this[property]
|
|
3173
|
+
});
|
|
3437
3174
|
|
|
3438
3175
|
return entries;
|
|
3439
3176
|
},
|
|
3440
|
-
size: function
|
|
3177
|
+
size: function () {
|
|
3441
3178
|
var size = 0;
|
|
3442
3179
|
|
|
3443
|
-
for (var property in this)
|
|
3444
|
-
if (property[0] === prefix) ++size;
|
|
3445
|
-
}
|
|
3180
|
+
for (var property in this) if (property[0] === prefix) ++size;
|
|
3446
3181
|
|
|
3447
3182
|
return size;
|
|
3448
3183
|
},
|
|
3449
|
-
empty: function
|
|
3450
|
-
for (var property in this)
|
|
3451
|
-
if (property[0] === prefix) return false;
|
|
3452
|
-
}
|
|
3184
|
+
empty: function () {
|
|
3185
|
+
for (var property in this) if (property[0] === prefix) return false;
|
|
3453
3186
|
|
|
3454
3187
|
return true;
|
|
3455
3188
|
},
|
|
3456
|
-
each: function
|
|
3457
|
-
for (var property in this)
|
|
3458
|
-
if (property[0] === prefix) f(this[property], property.slice(1), this);
|
|
3459
|
-
}
|
|
3189
|
+
each: function (f) {
|
|
3190
|
+
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
|
|
3460
3191
|
}
|
|
3461
3192
|
};
|
|
3462
3193
|
|
|
@@ -3467,28 +3198,22 @@ function map(object, f) {
|
|
|
3467
3198
|
map.set(key, value);
|
|
3468
3199
|
}); // Index array by numeric index or specified key function.
|
|
3469
3200
|
else if (Array.isArray(object)) {
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
map.set(f(o = object[i], i, object), o);
|
|
3477
|
-
}
|
|
3478
|
-
} // Convert object to map.
|
|
3479
|
-
else if (object) for (var key in object) {
|
|
3480
|
-
map.set(key, object[key]);
|
|
3481
|
-
}
|
|
3201
|
+
var i = -1,
|
|
3202
|
+
n = object.length,
|
|
3203
|
+
o;
|
|
3204
|
+
if (f == null) while (++i < n) map.set(i, object[i]);else while (++i < n) map.set(f(o = object[i], i, object), o);
|
|
3205
|
+
} // Convert object to map.
|
|
3206
|
+
else if (object) for (var key in object) map.set(key, object[key]);
|
|
3482
3207
|
return map;
|
|
3483
3208
|
}
|
|
3484
3209
|
|
|
3485
3210
|
function Set() {}
|
|
3486
3211
|
|
|
3487
3212
|
var proto = map.prototype;
|
|
3488
|
-
Set.prototype =
|
|
3213
|
+
Set.prototype = {
|
|
3489
3214
|
constructor: Set,
|
|
3490
3215
|
has: proto.has,
|
|
3491
|
-
add: function
|
|
3216
|
+
add: function (value) {
|
|
3492
3217
|
value += "";
|
|
3493
3218
|
this[prefix + value] = value;
|
|
3494
3219
|
return this;
|
|
@@ -3501,31 +3226,11 @@ Set.prototype = set$2.prototype = {
|
|
|
3501
3226
|
each: proto.each
|
|
3502
3227
|
};
|
|
3503
3228
|
|
|
3504
|
-
function set$2(object, f) {
|
|
3505
|
-
var set = new Set(); // Copy constructor.
|
|
3506
|
-
|
|
3507
|
-
if (object instanceof Set) object.each(function (value) {
|
|
3508
|
-
set.add(value);
|
|
3509
|
-
}); // Otherwise, assume it’s an array.
|
|
3510
|
-
else if (object) {
|
|
3511
|
-
var i = -1,
|
|
3512
|
-
n = object.length;
|
|
3513
|
-
if (f == null) while (++i < n) {
|
|
3514
|
-
set.add(object[i]);
|
|
3515
|
-
} else while (++i < n) {
|
|
3516
|
-
set.add(f(object[i], i, object));
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
return set;
|
|
3520
|
-
}
|
|
3521
|
-
|
|
3522
3229
|
function count(node) {
|
|
3523
3230
|
var sum = 0,
|
|
3524
3231
|
children = node.children,
|
|
3525
3232
|
i = children && children.length;
|
|
3526
|
-
if (!i) sum = 1;else while (--i >= 0)
|
|
3527
|
-
sum += children[i].value;
|
|
3528
|
-
}
|
|
3233
|
+
if (!i) sum = 1;else while (--i >= 0) sum += children[i].value;
|
|
3529
3234
|
node.value = sum;
|
|
3530
3235
|
}
|
|
3531
3236
|
|
|
@@ -3599,9 +3304,7 @@ function node_sum (value) {
|
|
|
3599
3304
|
children = node.children,
|
|
3600
3305
|
i = children && children.length;
|
|
3601
3306
|
|
|
3602
|
-
while (--i >= 0)
|
|
3603
|
-
sum += children[i].value;
|
|
3604
|
-
}
|
|
3307
|
+
while (--i >= 0) sum += children[i].value;
|
|
3605
3308
|
|
|
3606
3309
|
node.value = sum;
|
|
3607
3310
|
});
|
|
@@ -3739,9 +3442,7 @@ function copyData(node) {
|
|
|
3739
3442
|
function computeHeight(node) {
|
|
3740
3443
|
var height = 0;
|
|
3741
3444
|
|
|
3742
|
-
do
|
|
3743
|
-
node.height = height;
|
|
3744
|
-
} while ((node = node.parent) && node.height < ++height);
|
|
3445
|
+
do node.height = height; while ((node = node.parent) && node.height < ++height);
|
|
3745
3446
|
}
|
|
3746
3447
|
function Node(data) {
|
|
3747
3448
|
this.data = data;
|
|
@@ -3884,23 +3585,23 @@ function tree () {
|
|
|
3884
3585
|
if (nodeSize) root.eachBefore(sizeNode); // If a fixed tree size is specified, scale x and y based on the extent.
|
|
3885
3586
|
// Compute the left-most, right-most, and depth-most nodes for extents.
|
|
3886
3587
|
else {
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3588
|
+
var left = root,
|
|
3589
|
+
right = root,
|
|
3590
|
+
bottom = root;
|
|
3591
|
+
root.eachBefore(function (node) {
|
|
3592
|
+
if (node.x < left.x) left = node;
|
|
3593
|
+
if (node.x > right.x) right = node;
|
|
3594
|
+
if (node.depth > bottom.depth) bottom = node;
|
|
3595
|
+
});
|
|
3596
|
+
var s = left === right ? 1 : separation(left, right) / 2,
|
|
3597
|
+
tx = s - left.x,
|
|
3598
|
+
kx = dx / (right.x + s + tx),
|
|
3599
|
+
ky = dy / (bottom.depth || 1);
|
|
3600
|
+
root.eachBefore(function (node) {
|
|
3601
|
+
node.x = (node.x + tx) * kx;
|
|
3602
|
+
node.y = node.depth * ky;
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3904
3605
|
return root;
|
|
3905
3606
|
} // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is
|
|
3906
3607
|
// applied recursively to the children of v, as well as the function
|
|
@@ -4012,7 +3713,7 @@ function tree () {
|
|
|
4012
3713
|
return tree;
|
|
4013
3714
|
}
|
|
4014
3715
|
|
|
4015
|
-
function constant
|
|
3716
|
+
function constant (x) {
|
|
4016
3717
|
return function () {
|
|
4017
3718
|
return x;
|
|
4018
3719
|
};
|
|
@@ -4031,46 +3732,46 @@ function Transform(k, x, y) {
|
|
|
4031
3732
|
}
|
|
4032
3733
|
Transform.prototype = {
|
|
4033
3734
|
constructor: Transform,
|
|
4034
|
-
scale: function
|
|
3735
|
+
scale: function (k) {
|
|
4035
3736
|
return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
|
4036
3737
|
},
|
|
4037
|
-
translate: function
|
|
3738
|
+
translate: function (x, y) {
|
|
4038
3739
|
return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
|
|
4039
3740
|
},
|
|
4040
|
-
apply: function
|
|
3741
|
+
apply: function (point) {
|
|
4041
3742
|
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
4042
3743
|
},
|
|
4043
|
-
applyX: function
|
|
3744
|
+
applyX: function (x) {
|
|
4044
3745
|
return x * this.k + this.x;
|
|
4045
3746
|
},
|
|
4046
|
-
applyY: function
|
|
3747
|
+
applyY: function (y) {
|
|
4047
3748
|
return y * this.k + this.y;
|
|
4048
3749
|
},
|
|
4049
|
-
invert: function
|
|
3750
|
+
invert: function (location) {
|
|
4050
3751
|
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
|
4051
3752
|
},
|
|
4052
|
-
invertX: function
|
|
3753
|
+
invertX: function (x) {
|
|
4053
3754
|
return (x - this.x) / this.k;
|
|
4054
3755
|
},
|
|
4055
|
-
invertY: function
|
|
3756
|
+
invertY: function (y) {
|
|
4056
3757
|
return (y - this.y) / this.k;
|
|
4057
3758
|
},
|
|
4058
|
-
rescaleX: function
|
|
3759
|
+
rescaleX: function (x) {
|
|
4059
3760
|
return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
|
|
4060
3761
|
},
|
|
4061
|
-
rescaleY: function
|
|
3762
|
+
rescaleY: function (y) {
|
|
4062
3763
|
return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
|
4063
3764
|
},
|
|
4064
|
-
toString: function
|
|
3765
|
+
toString: function () {
|
|
4065
3766
|
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
|
4066
3767
|
}
|
|
4067
3768
|
};
|
|
4068
|
-
var identity
|
|
3769
|
+
var identity = new Transform(1, 0, 0);
|
|
4069
3770
|
|
|
4070
3771
|
function nopropagation() {
|
|
4071
3772
|
event$1.stopImmediatePropagation();
|
|
4072
3773
|
}
|
|
4073
|
-
function noevent
|
|
3774
|
+
function noevent () {
|
|
4074
3775
|
event$1.preventDefault();
|
|
4075
3776
|
event$1.stopImmediatePropagation();
|
|
4076
3777
|
}
|
|
@@ -4097,7 +3798,7 @@ function defaultExtent() {
|
|
|
4097
3798
|
}
|
|
4098
3799
|
|
|
4099
3800
|
function defaultTransform() {
|
|
4100
|
-
return this.__zoom || identity
|
|
3801
|
+
return this.__zoom || identity;
|
|
4101
3802
|
}
|
|
4102
3803
|
|
|
4103
3804
|
function defaultWheelDelta() {
|
|
@@ -4180,7 +3881,7 @@ function zoom () {
|
|
|
4180
3881
|
var e = extent.apply(this, arguments),
|
|
4181
3882
|
t = this.__zoom,
|
|
4182
3883
|
p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
|
|
4183
|
-
return constrain(identity
|
|
3884
|
+
return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
|
|
4184
3885
|
}, p);
|
|
4185
3886
|
};
|
|
4186
3887
|
|
|
@@ -4217,10 +3918,10 @@ function zoom () {
|
|
|
4217
3918
|
return function (t) {
|
|
4218
3919
|
if (t === 1) t = b; // Avoid rounding error on end.
|
|
4219
3920
|
else {
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
3921
|
+
var l = i(t),
|
|
3922
|
+
k = w / l[2];
|
|
3923
|
+
t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
|
|
3924
|
+
}
|
|
4224
3925
|
g.zoom(null, t);
|
|
4225
3926
|
};
|
|
4226
3927
|
});
|
|
@@ -4239,7 +3940,7 @@ function zoom () {
|
|
|
4239
3940
|
}
|
|
4240
3941
|
|
|
4241
3942
|
Gesture.prototype = {
|
|
4242
|
-
start: function
|
|
3943
|
+
start: function () {
|
|
4243
3944
|
if (++this.active === 1) {
|
|
4244
3945
|
this.that.__zooming = this;
|
|
4245
3946
|
this.emit("start");
|
|
@@ -4247,7 +3948,7 @@ function zoom () {
|
|
|
4247
3948
|
|
|
4248
3949
|
return this;
|
|
4249
3950
|
},
|
|
4250
|
-
zoom: function
|
|
3951
|
+
zoom: function (key, transform) {
|
|
4251
3952
|
if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
|
|
4252
3953
|
if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
|
|
4253
3954
|
if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
|
|
@@ -4255,7 +3956,7 @@ function zoom () {
|
|
|
4255
3956
|
this.emit("zoom");
|
|
4256
3957
|
return this;
|
|
4257
3958
|
},
|
|
4258
|
-
end: function
|
|
3959
|
+
end: function () {
|
|
4259
3960
|
if (--this.active === 0) {
|
|
4260
3961
|
delete this.that.__zooming;
|
|
4261
3962
|
this.emit("end");
|
|
@@ -4263,7 +3964,7 @@ function zoom () {
|
|
|
4263
3964
|
|
|
4264
3965
|
return this;
|
|
4265
3966
|
},
|
|
4266
|
-
emit: function
|
|
3967
|
+
emit: function (type) {
|
|
4267
3968
|
customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
|
|
4268
3969
|
}
|
|
4269
3970
|
};
|
|
@@ -4284,13 +3985,13 @@ function zoom () {
|
|
|
4284
3985
|
clearTimeout(g.wheel);
|
|
4285
3986
|
} // If this wheel event won’t trigger a transform change, ignore it.
|
|
4286
3987
|
else if (t.k === k) return; // Otherwise, capture the mouse point and location at the start.
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
3988
|
+
else {
|
|
3989
|
+
g.mouse = [p, t.invert(p)];
|
|
3990
|
+
interrupt(this);
|
|
3991
|
+
g.start();
|
|
3992
|
+
}
|
|
4292
3993
|
|
|
4293
|
-
noevent
|
|
3994
|
+
noevent();
|
|
4294
3995
|
g.wheel = setTimeout(wheelidled, wheelDelay);
|
|
4295
3996
|
g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
|
|
4296
3997
|
|
|
@@ -4314,7 +4015,7 @@ function zoom () {
|
|
|
4314
4015
|
g.start();
|
|
4315
4016
|
|
|
4316
4017
|
function mousemoved() {
|
|
4317
|
-
noevent
|
|
4018
|
+
noevent();
|
|
4318
4019
|
|
|
4319
4020
|
if (!g.moved) {
|
|
4320
4021
|
var dx = event$1.clientX - x0,
|
|
@@ -4328,7 +4029,7 @@ function zoom () {
|
|
|
4328
4029
|
function mouseupped() {
|
|
4329
4030
|
v.on("mousemove.zoom mouseup.zoom", null);
|
|
4330
4031
|
yesdrag(event$1.view, g.moved);
|
|
4331
|
-
noevent
|
|
4032
|
+
noevent();
|
|
4332
4033
|
g.end();
|
|
4333
4034
|
}
|
|
4334
4035
|
}
|
|
@@ -4340,7 +4041,7 @@ function zoom () {
|
|
|
4340
4041
|
p1 = t0.invert(p0),
|
|
4341
4042
|
k1 = t0.k * (event$1.shiftKey ? 0.5 : 2),
|
|
4342
4043
|
t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
|
|
4343
|
-
noevent
|
|
4044
|
+
noevent();
|
|
4344
4045
|
if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);else select(this).call(zoom.transform, t1);
|
|
4345
4046
|
}
|
|
4346
4047
|
|
|
@@ -4381,7 +4082,7 @@ function zoom () {
|
|
|
4381
4082
|
t,
|
|
4382
4083
|
p,
|
|
4383
4084
|
l;
|
|
4384
|
-
noevent
|
|
4085
|
+
noevent();
|
|
4385
4086
|
if (touchstarting) touchstarting = clearTimeout(touchstarting);
|
|
4386
4087
|
g.taps = 0;
|
|
4387
4088
|
|
|
@@ -4437,19 +4138,19 @@ function zoom () {
|
|
|
4437
4138
|
}
|
|
4438
4139
|
|
|
4439
4140
|
zoom.wheelDelta = function (_) {
|
|
4440
|
-
return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant
|
|
4141
|
+
return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
|
|
4441
4142
|
};
|
|
4442
4143
|
|
|
4443
4144
|
zoom.filter = function (_) {
|
|
4444
|
-
return arguments.length ? (filter = typeof _ === "function" ? _ : constant
|
|
4145
|
+
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
|
|
4445
4146
|
};
|
|
4446
4147
|
|
|
4447
4148
|
zoom.touchable = function (_) {
|
|
4448
|
-
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant
|
|
4149
|
+
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
|
|
4449
4150
|
};
|
|
4450
4151
|
|
|
4451
4152
|
zoom.extent = function (_) {
|
|
4452
|
-
return arguments.length ? (extent = typeof _ === "function" ? _ : constant
|
|
4153
|
+
return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
|
|
4453
4154
|
};
|
|
4454
4155
|
|
|
4455
4156
|
zoom.scaleExtent = function (_) {
|
|
@@ -4484,7 +4185,7 @@ function zoom () {
|
|
|
4484
4185
|
return zoom;
|
|
4485
4186
|
}
|
|
4486
4187
|
|
|
4487
|
-
|
|
4188
|
+
const colorStruct = {
|
|
4488
4189
|
aliceblue: {
|
|
4489
4190
|
r: 240,
|
|
4490
4191
|
g: 248,
|
|
@@ -5234,28 +4935,28 @@ var colorStruct = {
|
|
|
5234
4935
|
};
|
|
5235
4936
|
|
|
5236
4937
|
/* eslint-disable no-cond-assign */
|
|
5237
|
-
|
|
5238
|
-
resolveExpression:
|
|
4938
|
+
const colorUtils = {
|
|
4939
|
+
resolveExpression: input => {
|
|
5239
4940
|
// rgb
|
|
5240
|
-
|
|
4941
|
+
let matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
|
|
5241
4942
|
|
|
5242
4943
|
if (matches) {
|
|
5243
|
-
return
|
|
4944
|
+
return `rgb(${matches[1]},${matches[2]},${matches[3]})`;
|
|
5244
4945
|
} // rgba
|
|
5245
4946
|
|
|
5246
4947
|
|
|
5247
4948
|
matches = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(input);
|
|
5248
4949
|
|
|
5249
4950
|
if (matches) {
|
|
5250
|
-
return
|
|
4951
|
+
return `rgba(${matches[1]},${matches[2]},${matches[3]},${matches[4]})`;
|
|
5251
4952
|
} // argb
|
|
5252
4953
|
|
|
5253
4954
|
|
|
5254
4955
|
matches = /^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
|
|
5255
4956
|
|
|
5256
4957
|
if (matches) {
|
|
5257
|
-
|
|
5258
|
-
return
|
|
4958
|
+
const a = Math.round(matches[1] / 2.55) / 100;
|
|
4959
|
+
return `rgba(${matches[2]},${matches[3]},${matches[4]},${a})`;
|
|
5259
4960
|
} // hex
|
|
5260
4961
|
|
|
5261
4962
|
|
|
@@ -5266,44 +4967,45 @@ var colorUtils = {
|
|
|
5266
4967
|
} // css color
|
|
5267
4968
|
|
|
5268
4969
|
|
|
5269
|
-
|
|
4970
|
+
const color = input && colorStruct[input.toLowerCase()];
|
|
5270
4971
|
|
|
5271
4972
|
if (color) {
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
return "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(_a, ")");
|
|
4973
|
+
const a = color.a !== undefined ? color.a : 1;
|
|
4974
|
+
return `rgba(${color.r},${color.g},${color.b},${a})`;
|
|
5275
4975
|
} // invalid
|
|
5276
4976
|
|
|
5277
4977
|
|
|
5278
4978
|
return 'none';
|
|
5279
4979
|
},
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
4980
|
+
|
|
4981
|
+
getDarkColor(color) {
|
|
4982
|
+
const percent = 0.5;
|
|
4983
|
+
let f;
|
|
4984
|
+
let R;
|
|
4985
|
+
let B;
|
|
4986
|
+
let G;
|
|
5286
4987
|
|
|
5287
4988
|
if (color.length > 7) {
|
|
5288
4989
|
f = color.split(',');
|
|
5289
|
-
|
|
4990
|
+
const rgba = f[0].indexOf('a') !== -1;
|
|
5290
4991
|
R = rgba ? parseInt(f[0].slice(5), 10) : parseInt(f[0].slice(4), 10);
|
|
5291
4992
|
G = parseInt(f[1], 10);
|
|
5292
4993
|
B = parseInt(f[2], 10);
|
|
5293
|
-
return
|
|
4994
|
+
return `${(rgba ? 'rgba(' : 'rgb(') + (Math.round((0 - R) * percent) + R)},${Math.round((0 - G) * percent) + G},${Math.round((0 - B) * percent) + B}${rgba ? `,${f[3]}` : ')'}`;
|
|
5294
4995
|
}
|
|
5295
4996
|
|
|
5296
4997
|
f = parseInt(color.slice(1), 16);
|
|
5297
4998
|
R = f >> 16;
|
|
5298
4999
|
G = f >> 8 & 0x00ff;
|
|
5299
5000
|
B = f & 0x0000ff;
|
|
5300
|
-
return
|
|
5001
|
+
return `#${(0x1000000 + (Math.round((0 - R) * percent) + R) * 0x10000 + (Math.round((0 - G) * percent) + G) * 0x100 + (Math.round((0 - B) * percent) + B)).toString(16).slice(1)}`;
|
|
5301
5002
|
},
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5003
|
+
|
|
5004
|
+
isDarkColor(color) {
|
|
5005
|
+
let r;
|
|
5006
|
+
let g;
|
|
5007
|
+
let b;
|
|
5008
|
+
let matches;
|
|
5307
5009
|
|
|
5308
5010
|
if (matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(color)) {
|
|
5309
5011
|
r = parseInt(matches[1], 10);
|
|
@@ -5323,17 +5025,18 @@ var colorUtils = {
|
|
|
5323
5025
|
|
|
5324
5026
|
return 0.299 * r + 0.587 * g + 0.114 * b < 125;
|
|
5325
5027
|
}
|
|
5028
|
+
|
|
5326
5029
|
};
|
|
5327
5030
|
|
|
5328
|
-
|
|
5329
|
-
|
|
5031
|
+
const pageSize = 3300;
|
|
5032
|
+
const attributeIDs = {
|
|
5330
5033
|
colorByExpression: 'color',
|
|
5331
5034
|
labelExpression: 'label',
|
|
5332
5035
|
subLabelExpression: 'subLabel',
|
|
5333
5036
|
extraLabelExpression: 'extraLabel'
|
|
5334
5037
|
};
|
|
5335
|
-
|
|
5336
|
-
|
|
5038
|
+
const MAX_DATA = 'max-data-limit';
|
|
5039
|
+
const NO_ROOT = 'no_root';
|
|
5337
5040
|
|
|
5338
5041
|
function getId(row) {
|
|
5339
5042
|
return row[0].qText;
|
|
@@ -5344,14 +5047,14 @@ function getParentId(row) {
|
|
|
5344
5047
|
}
|
|
5345
5048
|
|
|
5346
5049
|
function anyCycle(nodes) {
|
|
5347
|
-
|
|
5348
|
-
|
|
5050
|
+
const visited = {};
|
|
5051
|
+
const marked = {};
|
|
5349
5052
|
|
|
5350
5053
|
function isCycleUtil(node) {
|
|
5351
5054
|
visited[node.id] = true;
|
|
5352
5055
|
marked[node.id] = true;
|
|
5353
5056
|
|
|
5354
|
-
for (
|
|
5057
|
+
for (let i = 0; i < node.children.length; ++i) {
|
|
5355
5058
|
if (!visited[node.children[i].id] && isCycleUtil(node.children[i])) {
|
|
5356
5059
|
return true;
|
|
5357
5060
|
}
|
|
@@ -5365,8 +5068,8 @@ function anyCycle(nodes) {
|
|
|
5365
5068
|
return false;
|
|
5366
5069
|
}
|
|
5367
5070
|
|
|
5368
|
-
for (
|
|
5369
|
-
|
|
5071
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
5072
|
+
const node = nodes[i];
|
|
5370
5073
|
|
|
5371
5074
|
if (!visited[node.id] && isCycleUtil(node)) {
|
|
5372
5075
|
return true;
|
|
@@ -5375,122 +5078,61 @@ function anyCycle(nodes) {
|
|
|
5375
5078
|
|
|
5376
5079
|
return false;
|
|
5377
5080
|
}
|
|
5378
|
-
function fetchPage(
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
qTop: currentRow,
|
|
5391
|
-
qLeft: 0,
|
|
5392
|
-
qWidth: 3,
|
|
5393
|
-
qHeight: pageSize
|
|
5394
|
-
}]).then(function (data) {
|
|
5395
|
-
dataPages.push(data[0]);
|
|
5396
|
-
dataMatrix.push.apply(dataMatrix, _toConsumableArray(data[0].qMatrix)); // eslint-disable-next-line no-param-reassign
|
|
5397
|
-
|
|
5398
|
-
currentRow += data[0].qArea.qHeight;
|
|
5399
|
-
});
|
|
5400
|
-
|
|
5401
|
-
case 2:
|
|
5402
|
-
if (!(callNum >= maxCalls)) {
|
|
5403
|
-
_context2.next = 4;
|
|
5404
|
-
break;
|
|
5405
|
-
}
|
|
5406
|
-
|
|
5407
|
-
return _context2.abrupt("return", MAX_DATA);
|
|
5408
|
-
|
|
5409
|
-
case 4:
|
|
5410
|
-
if (!(fullHeight > currentRow)) {
|
|
5411
|
-
_context2.next = 6;
|
|
5412
|
-
break;
|
|
5413
|
-
}
|
|
5414
|
-
|
|
5415
|
-
return _context2.abrupt("return", fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum + 1, maxCalls));
|
|
5416
|
-
|
|
5417
|
-
case 6:
|
|
5418
|
-
return _context2.abrupt("return", '');
|
|
5419
|
-
|
|
5420
|
-
case 7:
|
|
5421
|
-
case "end":
|
|
5422
|
-
return _context2.stop();
|
|
5423
|
-
}
|
|
5424
|
-
}
|
|
5425
|
-
}, _callee2);
|
|
5426
|
-
}));
|
|
5427
|
-
return _fetchPage.apply(this, arguments);
|
|
5428
|
-
}
|
|
5429
|
-
|
|
5430
|
-
var getDataMatrix = /*#__PURE__*/function () {
|
|
5431
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(layout, model) {
|
|
5432
|
-
var dataPages, fullHeight, loadedHeight, dataMatrix, status;
|
|
5433
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5434
|
-
while (1) {
|
|
5435
|
-
switch (_context.prev = _context.next) {
|
|
5436
|
-
case 0:
|
|
5437
|
-
if (!layout.snapshotData) {
|
|
5438
|
-
_context.next = 2;
|
|
5439
|
-
break;
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
|
-
return _context.abrupt("return", {
|
|
5443
|
-
status: '',
|
|
5444
|
-
dataMatrix: layout.snapshotData.dataMatrix
|
|
5445
|
-
});
|
|
5446
|
-
|
|
5447
|
-
case 2:
|
|
5448
|
-
dataPages = layout.qHyperCube && layout.qHyperCube.qDataPages;
|
|
5449
|
-
fullHeight = layout.qHyperCube.qSize.qcy;
|
|
5450
|
-
loadedHeight = dataPages[0].qArea.qHeight;
|
|
5451
|
-
dataMatrix = _toConsumableArray(dataPages[0].qMatrix);
|
|
5452
|
-
status = ''; // If there seems to be more data, check if it is already loadad or load it
|
|
5453
|
-
|
|
5454
|
-
if (!(fullHeight > loadedHeight && dataPages.length === 1 && model)) {
|
|
5455
|
-
_context.next = 13;
|
|
5456
|
-
break;
|
|
5457
|
-
}
|
|
5081
|
+
async function fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum, maxCalls) {
|
|
5082
|
+
await model.getHyperCubeData('/qHyperCubeDef', [{
|
|
5083
|
+
qTop: currentRow,
|
|
5084
|
+
qLeft: 0,
|
|
5085
|
+
qWidth: 3,
|
|
5086
|
+
qHeight: pageSize
|
|
5087
|
+
}]).then(data => {
|
|
5088
|
+
dataPages.push(data[0]);
|
|
5089
|
+
dataMatrix.push(...data[0].qMatrix); // eslint-disable-next-line no-param-reassign
|
|
5090
|
+
|
|
5091
|
+
currentRow += data[0].qArea.qHeight;
|
|
5092
|
+
});
|
|
5458
5093
|
|
|
5459
|
-
|
|
5460
|
-
|
|
5094
|
+
if (callNum >= maxCalls) {
|
|
5095
|
+
return MAX_DATA;
|
|
5096
|
+
}
|
|
5461
5097
|
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5098
|
+
if (fullHeight > currentRow) {
|
|
5099
|
+
// eslint-disable-next-line no-param-reassign
|
|
5100
|
+
return fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum + 1, maxCalls);
|
|
5101
|
+
}
|
|
5466
5102
|
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5103
|
+
return '';
|
|
5104
|
+
}
|
|
5105
|
+
const getDataMatrix = async (layout, model) => {
|
|
5106
|
+
if (layout.snapshotData) {
|
|
5107
|
+
return {
|
|
5108
|
+
status: '',
|
|
5109
|
+
dataMatrix: layout.snapshotData.dataMatrix
|
|
5110
|
+
};
|
|
5111
|
+
}
|
|
5471
5112
|
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5113
|
+
const dataPages = layout.qHyperCube && layout.qHyperCube.qDataPages;
|
|
5114
|
+
const fullHeight = layout.qHyperCube.qSize.qcy;
|
|
5115
|
+
const loadedHeight = dataPages[0].qArea.qHeight;
|
|
5116
|
+
const dataMatrix = [...dataPages[0].qMatrix];
|
|
5117
|
+
let status = ''; // If there seems to be more data, check if it is already loadad or load it
|
|
5477
5118
|
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
}
|
|
5484
|
-
}
|
|
5119
|
+
if (fullHeight > loadedHeight && dataPages.length === 1 && model) {
|
|
5120
|
+
status = await fetchPage(layout.qHyperCube.qDataPages, dataMatrix, model, fullHeight, loadedHeight, 0, layout.rowLimit / pageSize || 10);
|
|
5121
|
+
} else {
|
|
5122
|
+
dataPages.forEach((page, i) => {
|
|
5123
|
+
i > 0 ? dataMatrix.push(...page.qMatrix) : '';
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5485
5126
|
|
|
5486
|
-
return
|
|
5487
|
-
|
|
5127
|
+
return {
|
|
5128
|
+
status,
|
|
5129
|
+
dataMatrix
|
|
5488
5130
|
};
|
|
5489
|
-
}
|
|
5131
|
+
};
|
|
5490
5132
|
function getAttributeIndecies(attrsInfo) {
|
|
5491
5133
|
if (attrsInfo && attrsInfo.length) {
|
|
5492
|
-
|
|
5493
|
-
attrsInfo.forEach(
|
|
5134
|
+
const indecies = [];
|
|
5135
|
+
attrsInfo.forEach((attr, i) => {
|
|
5494
5136
|
if (attributeIDs[attr.id]) {
|
|
5495
5137
|
indecies.push({
|
|
5496
5138
|
prop: attributeIDs[attr.id],
|
|
@@ -5504,8 +5146,8 @@ function getAttributeIndecies(attrsInfo) {
|
|
|
5504
5146
|
return [];
|
|
5505
5147
|
}
|
|
5506
5148
|
function getAttributes(indecies, qAttrExps) {
|
|
5507
|
-
|
|
5508
|
-
indecies.forEach(
|
|
5149
|
+
const attributes = {};
|
|
5150
|
+
indecies.forEach(attr => {
|
|
5509
5151
|
if (attr.prop === 'color') {
|
|
5510
5152
|
attributes[attr.prop] = colorUtils.resolveExpression(qAttrExps.qValues[attr.index].qText);
|
|
5511
5153
|
} else {
|
|
@@ -5515,10 +5157,10 @@ function getAttributes(indecies, qAttrExps) {
|
|
|
5515
5157
|
return attributes;
|
|
5516
5158
|
}
|
|
5517
5159
|
function getAllTreeElemNo(node, activate) {
|
|
5518
|
-
|
|
5160
|
+
const idList = [];
|
|
5519
5161
|
|
|
5520
|
-
|
|
5521
|
-
currentNode.children.forEach(
|
|
5162
|
+
const pushChildrenIds = currentNode => {
|
|
5163
|
+
currentNode.children.forEach(child => {
|
|
5522
5164
|
child.data.selected = activate;
|
|
5523
5165
|
idList.push(child.data.elemNo);
|
|
5524
5166
|
|
|
@@ -5536,7 +5178,7 @@ function haveNoChildren(nodes) {
|
|
|
5536
5178
|
return true;
|
|
5537
5179
|
}
|
|
5538
5180
|
|
|
5539
|
-
for (
|
|
5181
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
5540
5182
|
if (nodes[i].children !== undefined) {
|
|
5541
5183
|
return false;
|
|
5542
5184
|
}
|
|
@@ -5545,16 +5187,16 @@ function haveNoChildren(nodes) {
|
|
|
5545
5187
|
return true;
|
|
5546
5188
|
}
|
|
5547
5189
|
function createNodes(matrix, attributeIndecies, status, navigationMode, translator) {
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
for (
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
id
|
|
5557
|
-
parentId
|
|
5190
|
+
const nodeMap = {};
|
|
5191
|
+
const allNodes = [];
|
|
5192
|
+
|
|
5193
|
+
for (let i = 0; i < matrix.length; ++i) {
|
|
5194
|
+
const row = matrix[i];
|
|
5195
|
+
const id = getId(row);
|
|
5196
|
+
const parentId = getParentId(row);
|
|
5197
|
+
const node = {
|
|
5198
|
+
id,
|
|
5199
|
+
parentId,
|
|
5558
5200
|
children: [],
|
|
5559
5201
|
elemNo: row[0].qElemNumber,
|
|
5560
5202
|
attributes: getAttributes(attributeIndecies, row[0].qAttrExps),
|
|
@@ -5565,20 +5207,21 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
|
|
|
5565
5207
|
allNodes.push(node);
|
|
5566
5208
|
}
|
|
5567
5209
|
|
|
5568
|
-
|
|
5569
|
-
|
|
5210
|
+
const rootNodes = [];
|
|
5211
|
+
let maxNodeWarning = false;
|
|
5570
5212
|
|
|
5571
|
-
for (
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5213
|
+
for (let i = 0; i < allNodes.length; ++i) {
|
|
5214
|
+
const node = allNodes[i];
|
|
5215
|
+
const parentNode = nodeMap[node.parentId];
|
|
5216
|
+
node.parent = parentNode;
|
|
5575
5217
|
|
|
5576
5218
|
if (parentNode) {
|
|
5577
|
-
parentNode.children.length > 98 ? maxNodeWarning = true : parentNode.children.push(
|
|
5578
|
-
childNumber: parentNode.children.length
|
|
5579
|
-
|
|
5219
|
+
parentNode.children.length > 98 ? maxNodeWarning = true : parentNode.children.push({
|
|
5220
|
+
childNumber: parentNode.children.length,
|
|
5221
|
+
...node
|
|
5222
|
+
});
|
|
5580
5223
|
} else {
|
|
5581
|
-
rootNodes.length > 98 ? maxNodeWarning = true : rootNodes.push(
|
|
5224
|
+
rootNodes.length > 98 ? maxNodeWarning = true : rootNodes.push(node);
|
|
5582
5225
|
}
|
|
5583
5226
|
} // We might be able to use the rootnodes lenght as well
|
|
5584
5227
|
|
|
@@ -5591,7 +5234,7 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
|
|
|
5591
5234
|
};
|
|
5592
5235
|
}
|
|
5593
5236
|
|
|
5594
|
-
|
|
5237
|
+
const warn = [];
|
|
5595
5238
|
|
|
5596
5239
|
if (status === MAX_DATA) {
|
|
5597
5240
|
warn.push(translator.get('Object.OrgChart.MaxData'));
|
|
@@ -5615,16 +5258,16 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
|
|
|
5615
5258
|
|
|
5616
5259
|
|
|
5617
5260
|
warn.push(translator.get('Object.OrgChart.DummyWarn'));
|
|
5618
|
-
|
|
5261
|
+
const rootNode = {
|
|
5619
5262
|
id: 'Root',
|
|
5620
5263
|
name: translator.get('Object.OrgChart.DummyRoot'),
|
|
5621
5264
|
isDummy: true,
|
|
5622
5265
|
// Should be rendered in a specific way?
|
|
5623
|
-
warn
|
|
5266
|
+
warn,
|
|
5624
5267
|
children: rootNodes,
|
|
5625
|
-
navigationMode
|
|
5268
|
+
navigationMode
|
|
5626
5269
|
};
|
|
5627
|
-
rootNodes.forEach(
|
|
5270
|
+
rootNodes.forEach((node, i) => {
|
|
5628
5271
|
// eslint-disable-next-line no-param-reassign
|
|
5629
5272
|
node.parentId = 'Root'; // eslint-disable-next-line no-param-reassign
|
|
5630
5273
|
|
|
@@ -5634,87 +5277,50 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
|
|
|
5634
5277
|
});
|
|
5635
5278
|
return rootNode;
|
|
5636
5279
|
}
|
|
5637
|
-
function transform(
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
5646
|
-
while (1) {
|
|
5647
|
-
switch (_context3.prev = _context3.next) {
|
|
5648
|
-
case 0:
|
|
5649
|
-
layout = _ref2.layout, model = _ref2.model, translator = _ref2.translator;
|
|
5650
|
-
|
|
5651
|
-
if (layout.qHyperCube) {
|
|
5652
|
-
_context3.next = 3;
|
|
5653
|
-
break;
|
|
5654
|
-
}
|
|
5655
|
-
|
|
5656
|
-
throw new Error('Require a hypercube');
|
|
5657
|
-
|
|
5658
|
-
case 3:
|
|
5659
|
-
if (!(layout.qHyperCube.qDimensionInfo.length < 2)) {
|
|
5660
|
-
_context3.next = 5;
|
|
5661
|
-
break;
|
|
5662
|
-
}
|
|
5663
|
-
|
|
5664
|
-
return _context3.abrupt("return", false);
|
|
5665
|
-
|
|
5666
|
-
case 5:
|
|
5667
|
-
_context3.next = 7;
|
|
5668
|
-
return getDataMatrix(layout, model);
|
|
5669
|
-
|
|
5670
|
-
case 7:
|
|
5671
|
-
_yield$getDataMatrix = _context3.sent;
|
|
5672
|
-
status = _yield$getDataMatrix.status;
|
|
5673
|
-
dataMatrix = _yield$getDataMatrix.dataMatrix;
|
|
5674
|
-
attributeIndecies = getAttributeIndecies(layout.qHyperCube.qDimensionInfo[0].qAttrExprInfo);
|
|
5675
|
-
|
|
5676
|
-
if (dataMatrix) {
|
|
5677
|
-
_context3.next = 13;
|
|
5678
|
-
break;
|
|
5679
|
-
}
|
|
5280
|
+
async function transform({
|
|
5281
|
+
layout,
|
|
5282
|
+
model,
|
|
5283
|
+
translator
|
|
5284
|
+
}) {
|
|
5285
|
+
if (!layout.qHyperCube) {
|
|
5286
|
+
throw new Error('Require a hypercube');
|
|
5287
|
+
}
|
|
5680
5288
|
|
|
5681
|
-
|
|
5289
|
+
if (layout.qHyperCube.qDimensionInfo.length < 2) {
|
|
5290
|
+
return false; // throw new Error('Require at least two dimensions');
|
|
5291
|
+
}
|
|
5682
5292
|
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5293
|
+
const {
|
|
5294
|
+
status,
|
|
5295
|
+
dataMatrix
|
|
5296
|
+
} = await getDataMatrix(layout, model);
|
|
5297
|
+
const attributeIndecies = getAttributeIndecies(layout.qHyperCube.qDimensionInfo[0].qAttrExprInfo);
|
|
5688
5298
|
|
|
5689
|
-
|
|
5299
|
+
if (!dataMatrix) {
|
|
5300
|
+
return null;
|
|
5301
|
+
}
|
|
5690
5302
|
|
|
5691
|
-
|
|
5692
|
-
|
|
5303
|
+
if (dataMatrix.length < 1) {
|
|
5304
|
+
return null;
|
|
5305
|
+
}
|
|
5693
5306
|
|
|
5694
|
-
|
|
5695
|
-
case "end":
|
|
5696
|
-
return _context3.stop();
|
|
5697
|
-
}
|
|
5698
|
-
}
|
|
5699
|
-
}, _callee3);
|
|
5700
|
-
}));
|
|
5701
|
-
return _transform.apply(this, arguments);
|
|
5307
|
+
return createNodes(dataMatrix, attributeIndecies, status, layout.navigationMode, translator);
|
|
5702
5308
|
}
|
|
5703
5309
|
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5310
|
+
const cardPadding = 8;
|
|
5311
|
+
const buttonMargin = 16;
|
|
5312
|
+
const buttonHeight = 24;
|
|
5313
|
+
const constants = {
|
|
5708
5314
|
cardWidth: 152,
|
|
5709
5315
|
cardHeight: 64,
|
|
5710
5316
|
widthMargin: 32,
|
|
5711
5317
|
heightMargin: buttonHeight + cardPadding * 2 + buttonMargin,
|
|
5712
|
-
buttonMargin
|
|
5318
|
+
buttonMargin,
|
|
5713
5319
|
leafMargin: 16,
|
|
5714
|
-
cardPadding
|
|
5320
|
+
cardPadding,
|
|
5715
5321
|
buttonWidth: 48,
|
|
5716
5322
|
// TODO: might need to be dynamic
|
|
5717
|
-
buttonHeight
|
|
5323
|
+
buttonHeight,
|
|
5718
5324
|
rootDiameter: 20,
|
|
5719
5325
|
r: 4,
|
|
5720
5326
|
tooltipWidth: 240,
|
|
@@ -5723,9 +5329,11 @@ var constants = {
|
|
|
5723
5329
|
minZoom: 0.2
|
|
5724
5330
|
};
|
|
5725
5331
|
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5332
|
+
const widthTranslation = (d, widthSpacing, element, axis, initialZoomState, navigationMode) => {
|
|
5333
|
+
const {
|
|
5334
|
+
buttonMargin
|
|
5335
|
+
} = constants;
|
|
5336
|
+
const initialX = initialZoomState && initialZoomState.initialX || 0;
|
|
5729
5337
|
|
|
5730
5338
|
if (navigationMode === 'expandAll') {
|
|
5731
5339
|
d[axis] = d.x + initialX;
|
|
@@ -5749,10 +5357,12 @@ var widthTranslation = function widthTranslation(d, widthSpacing, element, axis,
|
|
|
5749
5357
|
|
|
5750
5358
|
return d[axis];
|
|
5751
5359
|
};
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5360
|
+
const depthTranslation = (d, depthSpacing, axis, initialZoomState, navigationMode) => {
|
|
5361
|
+
const {
|
|
5362
|
+
cardHeight,
|
|
5363
|
+
leafMargin
|
|
5364
|
+
} = constants;
|
|
5365
|
+
const initialY = initialZoomState && initialZoomState.initialY || 0;
|
|
5756
5366
|
|
|
5757
5367
|
if (d.parent && d.parent.data.id !== 'Root' && navigationMode !== 'expandAll' && haveNoChildren(d.parent.children)) {
|
|
5758
5368
|
d[axis] = d.parent.y + depthSpacing + d.data.childNumber * (cardHeight + leafMargin) + initialY;
|
|
@@ -5763,28 +5373,26 @@ var depthTranslation = function depthTranslation(d, depthSpacing, axis, initialZ
|
|
|
5763
5373
|
return d[axis];
|
|
5764
5374
|
};
|
|
5765
5375
|
function position(orientation, element, initialZoomState, navigationMode) {
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5376
|
+
const {
|
|
5377
|
+
widthMargin,
|
|
5378
|
+
heightMargin,
|
|
5379
|
+
cardWidth,
|
|
5380
|
+
cardHeight,
|
|
5381
|
+
cardPadding
|
|
5382
|
+
} = constants;
|
|
5383
|
+
let widthSpacing;
|
|
5384
|
+
let depthSpacing;
|
|
5385
|
+
let orientations;
|
|
5774
5386
|
|
|
5775
5387
|
switch (orientation) {
|
|
5776
5388
|
case 'ttb':
|
|
5777
5389
|
widthSpacing = cardWidth + widthMargin;
|
|
5778
5390
|
depthSpacing = navigationMode === 'expandAll' ? cardHeight + 2 * cardPadding : cardHeight + heightMargin;
|
|
5779
5391
|
orientations = {
|
|
5780
|
-
depthSpacing
|
|
5392
|
+
depthSpacing,
|
|
5781
5393
|
isVertical: true,
|
|
5782
|
-
x:
|
|
5783
|
-
|
|
5784
|
-
},
|
|
5785
|
-
y: function y(d) {
|
|
5786
|
-
return depthTranslation(d, depthSpacing, 'yActual', initialZoomState, navigationMode);
|
|
5787
|
-
}
|
|
5394
|
+
x: d => widthTranslation(d, widthSpacing, element, 'xActual', initialZoomState, navigationMode),
|
|
5395
|
+
y: d => depthTranslation(d, depthSpacing, 'yActual', initialZoomState, navigationMode)
|
|
5788
5396
|
};
|
|
5789
5397
|
break;
|
|
5790
5398
|
}
|
|
@@ -5792,25 +5400,25 @@ function position(orientation, element, initialZoomState, navigationMode) {
|
|
|
5792
5400
|
return orientations;
|
|
5793
5401
|
}
|
|
5794
5402
|
|
|
5795
|
-
|
|
5796
|
-
encodeTitle:
|
|
5797
|
-
|
|
5798
|
-
|
|
5403
|
+
const encodeUtils = {
|
|
5404
|
+
encodeTitle: input => {
|
|
5405
|
+
const encodingDiv = document.createElement('div');
|
|
5406
|
+
const textNode = document.createTextNode(input);
|
|
5799
5407
|
encodingDiv.appendChild(textNode);
|
|
5800
5408
|
return encodingDiv.innerHTML;
|
|
5801
5409
|
},
|
|
5802
|
-
encodeCssColor:
|
|
5803
|
-
|
|
5804
|
-
|
|
5410
|
+
encodeCssColor: input => {
|
|
5411
|
+
const immune = ['#', ' ', '(', ')'];
|
|
5412
|
+
let encoded = '';
|
|
5805
5413
|
|
|
5806
|
-
for (
|
|
5807
|
-
|
|
5808
|
-
|
|
5414
|
+
for (let i = 0; i < input.length; i++) {
|
|
5415
|
+
const ch = input.charAt(i);
|
|
5416
|
+
const cc = input.charCodeAt(i);
|
|
5809
5417
|
|
|
5810
5418
|
if (!ch.match(/[a-zA-Z0-9]/) && immune.indexOf(ch) < 0) {
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
encoded +=
|
|
5419
|
+
const hex = cc.toString(16);
|
|
5420
|
+
const pad = '000000'.substr(hex.length);
|
|
5421
|
+
encoded += `\\${pad}${hex}`;
|
|
5814
5422
|
} else {
|
|
5815
5423
|
encoded += ch;
|
|
5816
5424
|
}
|
|
@@ -5821,12 +5429,12 @@ var encodeUtils = {
|
|
|
5821
5429
|
};
|
|
5822
5430
|
|
|
5823
5431
|
function resolveColor(color) {
|
|
5824
|
-
|
|
5432
|
+
const resolvedColor = colorUtils.resolveExpression(color);
|
|
5825
5433
|
return resolvedColor !== 'none' ? resolvedColor : encodeUtils.encodeCssColor(color);
|
|
5826
5434
|
}
|
|
5827
5435
|
function getBackgroundColor(data, cardStyling) {
|
|
5828
5436
|
if (data.attributes && data.attributes.color) {
|
|
5829
|
-
|
|
5437
|
+
const resolvedColor = colorUtils.resolveExpression(data.attributes.color);
|
|
5830
5438
|
|
|
5831
5439
|
if (resolvedColor !== 'none') {
|
|
5832
5440
|
return resolvedColor;
|
|
@@ -5837,42 +5445,43 @@ function getBackgroundColor(data, cardStyling) {
|
|
|
5837
5445
|
}
|
|
5838
5446
|
function getFontColor(cardStyling, backgroundColor) {
|
|
5839
5447
|
if (cardStyling.fontColor === 'default') {
|
|
5840
|
-
return colorUtils.isDarkColor(backgroundColor) ?
|
|
5448
|
+
return colorUtils.isDarkColor(backgroundColor) ? DEFAULTS.FONT_COLOR_LIGHT.color : DEFAULTS.FONT_COLOR_DARK.color;
|
|
5841
5449
|
}
|
|
5842
5450
|
|
|
5843
5451
|
return cardStyling.fontColor;
|
|
5844
5452
|
}
|
|
5845
|
-
var card = (
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5453
|
+
var card = ((data, cardStyling, selectionObj) => {
|
|
5454
|
+
const {
|
|
5455
|
+
api,
|
|
5456
|
+
state
|
|
5457
|
+
} = selectionObj;
|
|
5458
|
+
const isSelected = api && api.isActive() && state.indexOf(data.elemNo) !== -1;
|
|
5459
|
+
const backgroundColor = getBackgroundColor(data, cardStyling);
|
|
5460
|
+
const fontColor = resolveColor(getFontColor(cardStyling, backgroundColor));
|
|
5461
|
+
const attributes = data.attributes || {};
|
|
5462
|
+
let html = `<div class="sn-org-card-title">${encodeUtils.encodeTitle(attributes.label || data.id)}</div>`;
|
|
5853
5463
|
|
|
5854
5464
|
if (attributes.subLabel) {
|
|
5855
|
-
html +=
|
|
5465
|
+
html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(attributes.subLabel)}</div>`;
|
|
5856
5466
|
}
|
|
5857
5467
|
|
|
5858
5468
|
if (data.measure) {
|
|
5859
|
-
|
|
5860
|
-
html +=
|
|
5469
|
+
const measureLabel = cardStyling.measureLabel ? `${cardStyling.measureLabel}: ` : '';
|
|
5470
|
+
html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(measureLabel + data.measure)}</div>`;
|
|
5861
5471
|
} else if (attributes.extraLabel) {
|
|
5862
|
-
html +=
|
|
5472
|
+
html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(attributes.extraLabel)}</div>`;
|
|
5863
5473
|
}
|
|
5864
5474
|
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
var newCardHeight = constants.cardHeight;
|
|
5475
|
+
const selectedClass = api && api.isActive() ? isSelected ? ' selected' : ' not-selected' : '';
|
|
5476
|
+
const {
|
|
5477
|
+
top = DEFAULTS.BORDER_TOP,
|
|
5478
|
+
fullBorder = DEFAULTS.BORDER_FULL,
|
|
5479
|
+
colorType = DEFAULTS.BORDER_COLOR_TYPE
|
|
5480
|
+
} = cardStyling.border;
|
|
5481
|
+
const borderColor = colorType === 'auto' ? colorUtils.getDarkColor(backgroundColor) : resolveColor(cardStyling.borderColor);
|
|
5482
|
+
const topBorder = top && !isSelected ? `3px solid ${borderColor}` : '';
|
|
5483
|
+
const borderStyle = fullBorder && !isSelected ? `1px solid ${borderColor}` : '';
|
|
5484
|
+
let newCardHeight = constants.cardHeight;
|
|
5876
5485
|
|
|
5877
5486
|
if (isSelected) {
|
|
5878
5487
|
newCardHeight -= 8;
|
|
@@ -5882,18 +5491,20 @@ var card = (function (data, cardStyling, selectionObj) {
|
|
|
5882
5491
|
newCardHeight -= 3;
|
|
5883
5492
|
}
|
|
5884
5493
|
|
|
5885
|
-
return
|
|
5494
|
+
return `<div class="sn-org-card-text${selectedClass}" style="background-color:${backgroundColor};color:${fontColor}; border:${borderStyle}; border-top:${topBorder}; height:${newCardHeight}px;">${html}</div>`;
|
|
5886
5495
|
});
|
|
5887
5496
|
|
|
5888
5497
|
var selections = {
|
|
5889
|
-
select:
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5498
|
+
select: (node, selectionObj) => {
|
|
5499
|
+
const {
|
|
5500
|
+
api,
|
|
5501
|
+
state,
|
|
5502
|
+
singleSelect,
|
|
5503
|
+
setState
|
|
5504
|
+
} = selectionObj;
|
|
5894
5505
|
|
|
5895
5506
|
if (node && api) {
|
|
5896
|
-
|
|
5507
|
+
let newState;
|
|
5897
5508
|
|
|
5898
5509
|
if (node.data.elemNo < 0 && node.data.elemNo !== -3) {
|
|
5899
5510
|
return;
|
|
@@ -5910,9 +5521,9 @@ var selections = {
|
|
|
5910
5521
|
newState = state.concat();
|
|
5911
5522
|
}
|
|
5912
5523
|
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5524
|
+
const ind = newState.indexOf(node.data.elemNo);
|
|
5525
|
+
const activate = ind === -1;
|
|
5526
|
+
let linkedIds = [];
|
|
5916
5527
|
|
|
5917
5528
|
if (!singleSelect) {
|
|
5918
5529
|
linkedIds = getAllTreeElemNo(node, activate);
|
|
@@ -5920,13 +5531,13 @@ var selections = {
|
|
|
5920
5531
|
|
|
5921
5532
|
if (!activate) {
|
|
5922
5533
|
newState.splice(ind, 1);
|
|
5923
|
-
linkedIds.forEach(
|
|
5924
|
-
|
|
5534
|
+
linkedIds.forEach(id => {
|
|
5535
|
+
const idInd = newState.indexOf(id);
|
|
5925
5536
|
idInd !== -1 && newState.splice(idInd, 1);
|
|
5926
5537
|
});
|
|
5927
5538
|
} else {
|
|
5928
5539
|
newState.push(node.data.elemNo);
|
|
5929
|
-
linkedIds.forEach(
|
|
5540
|
+
linkedIds.forEach(id => {
|
|
5930
5541
|
if (newState.indexOf(id) === -1) {
|
|
5931
5542
|
newState.push(id);
|
|
5932
5543
|
}
|
|
@@ -5948,34 +5559,33 @@ var selections = {
|
|
|
5948
5559
|
};
|
|
5949
5560
|
|
|
5950
5561
|
function createTooltip(element) {
|
|
5951
|
-
|
|
5562
|
+
const tooltip = select(element).append('div').attr('class', 'sn-org-tooltip').on('mousedown', () => {
|
|
5952
5563
|
tooltip.classed('sn-org-tooltip-visible', false);
|
|
5953
5564
|
});
|
|
5954
5565
|
return tooltip;
|
|
5955
5566
|
}
|
|
5956
5567
|
function getTooltipStyle(d, containerHeight, x, y, transform) {
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5568
|
+
const {
|
|
5569
|
+
cardWidth,
|
|
5570
|
+
tooltipPadding
|
|
5571
|
+
} = constants;
|
|
5572
|
+
const halfCardWidth = cardWidth / 2;
|
|
5573
|
+
const yLocation = containerHeight - (y(d) * transform.zoom + transform.y - tooltipPadding);
|
|
5574
|
+
const xLocation = x(d) * transform.zoom + transform.x + halfCardWidth * transform.zoom;
|
|
5575
|
+
return `bottom:${yLocation}px;left:${xLocation}px;`;
|
|
5963
5576
|
}
|
|
5964
5577
|
function getTooltipContent(d, styling) {
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
return
|
|
5970
|
-
}
|
|
5971
|
-
function openTooltip(tooltip, d, containerHeight, styling, x, y, transform) {
|
|
5972
|
-
var delay = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 250;
|
|
5578
|
+
const label = encodeUtils.encodeTitle(d.data.attributes.label || d.data.id);
|
|
5579
|
+
const subLabel = d.data.attributes.subLabel ? `${encodeUtils.encodeTitle(d.data.attributes.subLabel)}<br />` : '';
|
|
5580
|
+
const extraLabel = d.data.attributes.extraLabel ? `${encodeUtils.encodeTitle(d.data.attributes.extraLabel)}<br />` : '';
|
|
5581
|
+
const measure = encodeUtils.encodeTitle(d.data.measure ? `${styling.measureLabel ? `${styling.measureLabel}: ` : ''}${d.data.measure}` : '');
|
|
5582
|
+
return `<div class="sn-org-tooltip-inner"><div class="sn-org-tooltip-header">${label}</div>${subLabel}${extraLabel}${measure}</div>`;
|
|
5583
|
+
}
|
|
5584
|
+
function openTooltip(tooltip, d, containerHeight, styling, x, y, transform, delay = 250) {
|
|
5973
5585
|
tooltip.active = true;
|
|
5974
|
-
tooltip.timeout = setTimeout(
|
|
5586
|
+
tooltip.timeout = setTimeout(() => {
|
|
5975
5587
|
if (tooltip.active) {
|
|
5976
|
-
tooltip.html(getTooltipContent(d, styling)).classed('sn-org-tooltip-visible', true).attr('style',
|
|
5977
|
-
return getTooltipStyle(d, containerHeight, x, y, transform);
|
|
5978
|
-
});
|
|
5588
|
+
tooltip.html(getTooltipContent(d, styling)).classed('sn-org-tooltip-visible', true).attr('style', () => getTooltipStyle(d, containerHeight, x, y, transform));
|
|
5979
5589
|
}
|
|
5980
5590
|
}, delay);
|
|
5981
5591
|
}
|
|
@@ -5985,22 +5595,22 @@ function closeTooltip(tooltip) {
|
|
|
5985
5595
|
tooltip.classed('sn-org-tooltip-visible', false);
|
|
5986
5596
|
}
|
|
5987
5597
|
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5598
|
+
const getSign = (d, {
|
|
5599
|
+
topId,
|
|
5600
|
+
isExpanded,
|
|
5601
|
+
expandedChildren
|
|
5602
|
+
}, ancestorIds) => {
|
|
5993
5603
|
if (d.data.id === topId && isExpanded || d.parent && d.parent.data.id === topId && expandedChildren.includes(d.data.id) || ancestorIds.includes(d.data.id)) {
|
|
5994
5604
|
return '-';
|
|
5995
5605
|
}
|
|
5996
5606
|
|
|
5997
5607
|
return '+';
|
|
5998
5608
|
};
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
5609
|
+
const getNewState = (d, {
|
|
5610
|
+
topId,
|
|
5611
|
+
isExpanded,
|
|
5612
|
+
expandedChildren
|
|
5613
|
+
}, ancestorIds) => {
|
|
6004
5614
|
if (d.data.id === topId) {
|
|
6005
5615
|
// top
|
|
6006
5616
|
isExpanded = !isExpanded;
|
|
@@ -6012,11 +5622,7 @@ var getNewState = function getNewState(d, _ref2, ancestorIds) {
|
|
|
6012
5622
|
expandedChildren = [];
|
|
6013
5623
|
} else if (d.parent.data.id === topId) {
|
|
6014
5624
|
// children
|
|
6015
|
-
|
|
6016
|
-
return expandedChildren.includes(sibling.data.id);
|
|
6017
|
-
}).every(function (n) {
|
|
6018
|
-
return haveNoChildren(n.children);
|
|
6019
|
-
});
|
|
5625
|
+
const expandedHaveNoChildren = d.parent.children.filter(sibling => expandedChildren.includes(sibling.data.id)).every(n => haveNoChildren(n.children));
|
|
6020
5626
|
|
|
6021
5627
|
if (expandedChildren.includes(d.data.id)) {
|
|
6022
5628
|
// Collapse if already exists in expandedChildren
|
|
@@ -6036,91 +5642,72 @@ var getNewState = function getNewState(d, _ref2, ancestorIds) {
|
|
|
6036
5642
|
}
|
|
6037
5643
|
|
|
6038
5644
|
return {
|
|
6039
|
-
topId
|
|
6040
|
-
isExpanded
|
|
6041
|
-
expandedChildren
|
|
5645
|
+
topId,
|
|
5646
|
+
isExpanded,
|
|
5647
|
+
expandedChildren
|
|
6042
5648
|
};
|
|
6043
5649
|
};
|
|
6044
|
-
function box(
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
}); // cards
|
|
6079
|
-
|
|
6080
|
-
divBox.selectAll('.sn-org-nodes').data(nodes.filter(function (node) {
|
|
6081
|
-
return node.data.id !== 'Root';
|
|
6082
|
-
})).enter().append('div').attr('class', 'sn-org-card').attr('style', function (d) {
|
|
6083
|
-
return "width:".concat(cardWidth, "px;height:").concat(cardHeight, "px; top:").concat(y(d), "px;left:").concat(x(d), "px;");
|
|
6084
|
-
}).attr('id', function (d) {
|
|
6085
|
-
return d.data.id;
|
|
6086
|
-
}).on('click', function (node) {
|
|
5650
|
+
function box({
|
|
5651
|
+
positioning,
|
|
5652
|
+
divBox,
|
|
5653
|
+
nodes,
|
|
5654
|
+
styling,
|
|
5655
|
+
setExpandedCallback,
|
|
5656
|
+
wrapperState,
|
|
5657
|
+
selectionObj,
|
|
5658
|
+
navigationMode,
|
|
5659
|
+
element,
|
|
5660
|
+
tooltip
|
|
5661
|
+
}) {
|
|
5662
|
+
const {
|
|
5663
|
+
x,
|
|
5664
|
+
y
|
|
5665
|
+
} = positioning;
|
|
5666
|
+
const {
|
|
5667
|
+
cardWidth,
|
|
5668
|
+
cardHeight,
|
|
5669
|
+
buttonWidth,
|
|
5670
|
+
buttonHeight,
|
|
5671
|
+
cardPadding,
|
|
5672
|
+
rootDiameter
|
|
5673
|
+
} = constants;
|
|
5674
|
+
const {
|
|
5675
|
+
topId
|
|
5676
|
+
} = wrapperState.expandedState;
|
|
5677
|
+
const topNode = nodes.find(node => node.data.id === topId);
|
|
5678
|
+
const ancestorIds = topNode && topNode.parent ? topNode.parent.ancestors().map(anc => anc.data.id) : [];
|
|
5679
|
+
const touchmode = document.getElementsByTagName('html')[0].classList.contains('touch-on'); // dummy root
|
|
5680
|
+
|
|
5681
|
+
divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => node.parent && node.parent.data.id === 'Root')).enter().append('div').attr('class', 'sn-org-root').attr('style', d => `top:${y(d) - rootDiameter - cardPadding}px;left:${x(d) + (cardWidth - rootDiameter) / 2}px`).attr('id', d => d.data.id); // cards
|
|
5682
|
+
|
|
5683
|
+
divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => node.data.id !== 'Root')).enter().append('div').attr('class', 'sn-org-card').attr('style', d => `width:${cardWidth}px;height:${cardHeight}px; top:${y(d)}px;left:${x(d)}px;`).attr('id', d => d.data.id).on('click', node => {
|
|
6087
5684
|
if (!wrapperState.constraints.active && node.data.id !== 'Root') {
|
|
6088
5685
|
touchmode && openTooltip(tooltip, node, element.clientHeight, styling, x, y, wrapperState.transform, 0);
|
|
6089
5686
|
selections.select(node, selectionObj);
|
|
6090
5687
|
}
|
|
6091
|
-
}).html(
|
|
6092
|
-
return card(d.data, styling, selectionObj);
|
|
6093
|
-
}).on('mouseenter', function (d) {
|
|
5688
|
+
}).html(d => card(d.data, styling, selectionObj)).on('mouseenter', d => {
|
|
6094
5689
|
if (!touchmode && !wrapperState.constraints.active && event.buttons === 0) {
|
|
6095
5690
|
openTooltip(tooltip, d, element.clientHeight, styling, x, y, wrapperState.transform);
|
|
6096
5691
|
}
|
|
6097
|
-
}).on('mouseleave',
|
|
5692
|
+
}).on('mouseleave', () => {
|
|
6098
5693
|
!touchmode && closeTooltip(tooltip);
|
|
6099
|
-
}).on('mousedown',
|
|
5694
|
+
}).on('mousedown', () => {
|
|
6100
5695
|
closeTooltip(tooltip);
|
|
6101
|
-
}).on('touchmove',
|
|
5696
|
+
}).on('touchmove', () => {
|
|
6102
5697
|
closeTooltip(tooltip);
|
|
6103
|
-
}).on('wheel',
|
|
5698
|
+
}).on('wheel', () => {
|
|
6104
5699
|
closeTooltip(tooltip);
|
|
6105
5700
|
}); // expand/collapse
|
|
6106
5701
|
|
|
6107
5702
|
if (navigationMode !== 'expandAll') {
|
|
6108
|
-
divBox.selectAll('.sn-org-nodes').data(nodes.filter(
|
|
6109
|
-
return !!node.children && node.data.id !== 'Root';
|
|
6110
|
-
})).enter().append('div').attr('class', 'sn-org-traverse').attr('style', function (d) {
|
|
6111
|
-
return "width:".concat(buttonWidth, "px;height:").concat(buttonHeight, "px;top:").concat(y(d) + cardHeight + cardPadding, "px;left:").concat(x(d) + (cardWidth - buttonWidth) / 2, "px;");
|
|
6112
|
-
}).attr('id', function (d) {
|
|
6113
|
-
return "".concat(d.data.id, "-expand");
|
|
6114
|
-
}).on('mouseenter', function () {
|
|
5703
|
+
divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => !!node.children && node.data.id !== 'Root')).enter().append('div').attr('class', 'sn-org-traverse').attr('style', d => `width:${buttonWidth}px;height:${buttonHeight}px;top:${y(d) + cardHeight + cardPadding}px;left:${x(d) + (cardWidth - buttonWidth) / 2}px;`).attr('id', d => `${d.data.id}-expand`).on('mouseenter', () => {
|
|
6115
5704
|
if (!wrapperState.constraints.active) event.target.style.cursor = 'pointer';
|
|
6116
|
-
}).on('click',
|
|
5705
|
+
}).on('click', d => {
|
|
6117
5706
|
if (!wrapperState.constraints.active) {
|
|
6118
5707
|
setExpandedCallback(getNewState(d, wrapperState.expandedState, ancestorIds));
|
|
6119
5708
|
event.stopPropagation();
|
|
6120
5709
|
}
|
|
6121
|
-
}).html(
|
|
6122
|
-
return "".concat(getSign(d, wrapperState.expandedState, ancestorIds), " ").concat(d.data.children.length);
|
|
6123
|
-
});
|
|
5710
|
+
}).html(d => `${getSign(d, wrapperState.expandedState, ancestorIds)} ${d.data.children.length}`);
|
|
6124
5711
|
} // go up only necessary in page navigation mode
|
|
6125
5712
|
// if (navigationMode !== 'free') {
|
|
6126
5713
|
// divBox
|
|
@@ -6146,31 +5733,34 @@ function box(_ref3) {
|
|
|
6146
5733
|
|
|
6147
5734
|
}
|
|
6148
5735
|
|
|
6149
|
-
function getPoints(d, topId,
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
5736
|
+
function getPoints(d, topId, {
|
|
5737
|
+
depthSpacing,
|
|
5738
|
+
isVertical,
|
|
5739
|
+
x,
|
|
5740
|
+
y
|
|
5741
|
+
}, navigationMode) {
|
|
6154
5742
|
// TODO: Generalize to make all directions work, currently on only ttb working
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
5743
|
+
const {
|
|
5744
|
+
cardWidth,
|
|
5745
|
+
cardHeight,
|
|
5746
|
+
buttonHeight,
|
|
5747
|
+
cardPadding,
|
|
5748
|
+
buttonMargin
|
|
5749
|
+
} = constants;
|
|
5750
|
+
const points = [];
|
|
5751
|
+
const halfCard = {
|
|
6162
5752
|
x: cardWidth / 2,
|
|
6163
5753
|
y: cardHeight / 2
|
|
6164
5754
|
};
|
|
6165
|
-
|
|
5755
|
+
const start = {
|
|
6166
5756
|
x: d.xActual,
|
|
6167
5757
|
y: d.yActual
|
|
6168
5758
|
}; // TODO: fix so auto mode does not get a path to parent not showing
|
|
6169
5759
|
|
|
6170
5760
|
if (d.parent && d.parent.data.id !== 'Root') {
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
5761
|
+
const halfDepth = depthSpacing / 2;
|
|
5762
|
+
const yOffset = navigationMode === 'expandAll' ? cardHeight : cardHeight + cardPadding + buttonHeight;
|
|
5763
|
+
const end = {
|
|
6174
5764
|
x: x(d.parent) + halfCard.x,
|
|
6175
5765
|
y: y(d.parent) + yOffset
|
|
6176
5766
|
};
|
|
@@ -6271,12 +5861,14 @@ function getPoints(d, topId, _ref, navigationMode) {
|
|
|
6271
5861
|
}
|
|
6272
5862
|
function getPath(points) {
|
|
6273
5863
|
// gets the path from first to last points, making turns with radius r at intermediate points
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
5864
|
+
const {
|
|
5865
|
+
r
|
|
5866
|
+
} = constants;
|
|
5867
|
+
let pathString = `M ${points[0].x} ${points[0].y} `;
|
|
5868
|
+
let dir;
|
|
5869
|
+
|
|
5870
|
+
const setDir = i => {
|
|
5871
|
+
const delta = {
|
|
6280
5872
|
x: points[i].x - points[i - 1].x,
|
|
6281
5873
|
y: points[i].y - points[i - 1].y
|
|
6282
5874
|
};
|
|
@@ -6288,46 +5880,46 @@ function getPath(points) {
|
|
|
6288
5880
|
|
|
6289
5881
|
setDir(1);
|
|
6290
5882
|
|
|
6291
|
-
for (
|
|
6292
|
-
|
|
5883
|
+
for (let i = 1; i < points.length; ++i) {
|
|
5884
|
+
const point = points[i];
|
|
6293
5885
|
|
|
6294
5886
|
if (i < points.length - 1) {
|
|
6295
|
-
pathString +=
|
|
5887
|
+
pathString += `L ${point.x - dir.x * r} ${point.y - dir.y * r} `;
|
|
6296
5888
|
setDir(i + 1);
|
|
6297
|
-
pathString +=
|
|
5889
|
+
pathString += `Q ${point.x} ${point.y} ${point.x + dir.x * r} ${point.y + dir.y * r} `;
|
|
6298
5890
|
} else {
|
|
6299
5891
|
// Don't add curve for last point
|
|
6300
|
-
pathString +=
|
|
5892
|
+
pathString += `L ${point.x} ${point.y} `;
|
|
6301
5893
|
}
|
|
6302
5894
|
}
|
|
6303
5895
|
|
|
6304
5896
|
return pathString;
|
|
6305
5897
|
}
|
|
6306
5898
|
function createPaths(node, positioning, topId, navigationMode) {
|
|
6307
|
-
node.append('path').attr('class', 'sn-org-path').attr('id',
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
var pointSets = getPoints(d, topId, positioning, navigationMode);
|
|
6312
|
-
pointSets.forEach(function (points) {
|
|
5899
|
+
node.append('path').attr('class', 'sn-org-path').attr('id', d => d.data.id).attr('d', d => {
|
|
5900
|
+
let path = '';
|
|
5901
|
+
const pointSets = getPoints(d, topId, positioning, navigationMode);
|
|
5902
|
+
pointSets.forEach(points => {
|
|
6313
5903
|
path += getPath(points).slice(0, -1);
|
|
6314
5904
|
});
|
|
6315
5905
|
return path;
|
|
6316
5906
|
});
|
|
6317
5907
|
}
|
|
6318
5908
|
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
5909
|
+
const getBBoxOfNodes = nodes => {
|
|
5910
|
+
const {
|
|
5911
|
+
cardWidth,
|
|
5912
|
+
cardHeight,
|
|
5913
|
+
buttonHeight,
|
|
5914
|
+
buttonMargin
|
|
5915
|
+
} = constants;
|
|
5916
|
+
const bbox = {
|
|
6325
5917
|
left: Infinity,
|
|
6326
5918
|
top: Infinity,
|
|
6327
5919
|
right: -Infinity,
|
|
6328
5920
|
bottom: -Infinity
|
|
6329
5921
|
};
|
|
6330
|
-
nodes.forEach(
|
|
5922
|
+
nodes.forEach(node => {
|
|
6331
5923
|
bbox.left = Math.min(node.xActual, bbox.left);
|
|
6332
5924
|
bbox.top = Math.min(node.yActual, bbox.top);
|
|
6333
5925
|
bbox.right = Math.max(node.xActual, bbox.right);
|
|
@@ -6340,19 +5932,25 @@ var getBBoxOfNodes = function getBBoxOfNodes(nodes) {
|
|
|
6340
5932
|
height: bbox.bottom - bbox.top + cardHeight + (buttonHeight + buttonMargin) * 2
|
|
6341
5933
|
};
|
|
6342
5934
|
};
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
5935
|
+
const getInitialZoomState = (bBox, element, navigationMode) => {
|
|
5936
|
+
const {
|
|
5937
|
+
widthMargin,
|
|
5938
|
+
cardHeight,
|
|
5939
|
+
minZoom
|
|
5940
|
+
} = constants;
|
|
5941
|
+
const maxZoom = navigationMode === 'expandAll' ? Infinity : constants.maxZoom;
|
|
5942
|
+
const {
|
|
5943
|
+
width,
|
|
5944
|
+
height
|
|
5945
|
+
} = bBox;
|
|
5946
|
+
const {
|
|
5947
|
+
clientHeight,
|
|
5948
|
+
clientWidth
|
|
5949
|
+
} = element;
|
|
5950
|
+
const calcWidth = width + 2 * widthMargin;
|
|
5951
|
+
const calcHeight = height + cardHeight;
|
|
5952
|
+
const xZoom = Math.max(Math.min(calcWidth / clientWidth, maxZoom), minZoom);
|
|
5953
|
+
const yZoom = Math.max(Math.min(calcHeight / clientHeight, maxZoom), minZoom);
|
|
6356
5954
|
|
|
6357
5955
|
if (xZoom > yZoom) {
|
|
6358
5956
|
// Zooming for x direction
|
|
@@ -6370,45 +5968,50 @@ var getInitialZoomState = function getInitialZoomState(bBox, element, navigation
|
|
|
6370
5968
|
initialZoom: yZoom
|
|
6371
5969
|
};
|
|
6372
5970
|
};
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
5971
|
+
const applyTransform = (eventTransform, svg, divBox, width, height) => {
|
|
5972
|
+
const scaleFactor = eventTransform.k;
|
|
5973
|
+
const translation = `${eventTransform.x}px, ${eventTransform.y}px`;
|
|
6376
5974
|
svg.attr('transform', eventTransform);
|
|
6377
5975
|
divBox.classed('org-disable-transition', true);
|
|
6378
5976
|
svg.classed('org-disable-transition', true);
|
|
6379
|
-
divBox.attr('style',
|
|
5977
|
+
divBox.attr('style', `width:${width}px;height:${height}px; transform: translate(${translation}) scale(${scaleFactor})`);
|
|
6380
5978
|
};
|
|
6381
|
-
function setZooming(
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
5979
|
+
function setZooming({
|
|
5980
|
+
containerData,
|
|
5981
|
+
setTransform,
|
|
5982
|
+
transformState,
|
|
5983
|
+
wrapperState,
|
|
5984
|
+
initialZoomState,
|
|
5985
|
+
navigationMode
|
|
5986
|
+
}) {
|
|
5987
|
+
const {
|
|
5988
|
+
svg,
|
|
5989
|
+
divBox,
|
|
5990
|
+
width,
|
|
5991
|
+
height,
|
|
5992
|
+
zoomWrapper,
|
|
5993
|
+
element,
|
|
5994
|
+
tooltip,
|
|
5995
|
+
homeButton
|
|
5996
|
+
} = containerData;
|
|
5997
|
+
const {
|
|
5998
|
+
x = 0,
|
|
5999
|
+
y = 0
|
|
6000
|
+
} = transformState;
|
|
6001
|
+
const {
|
|
6002
|
+
minZoom,
|
|
6003
|
+
maxZoom
|
|
6004
|
+
} = constants;
|
|
6005
|
+
const zoomFactor = transformState && 1 / transformState.zoom || initialZoomState.initialZoom;
|
|
6006
|
+
const scaleFactor = navigationMode === 'expandAll' ? zoomFactor : Math.max(Math.min(maxZoom, zoomFactor), minZoom); // sends otherwise captured mouse event to handle context menu correctly in sense
|
|
6007
|
+
|
|
6008
|
+
const bubbleEvent = () => {
|
|
6009
|
+
const newEvent = document.createEvent('MouseEvents');
|
|
6407
6010
|
newEvent.initEvent('mousedown', true, false);
|
|
6408
6011
|
element.dispatchEvent(newEvent);
|
|
6409
6012
|
};
|
|
6410
6013
|
|
|
6411
|
-
|
|
6014
|
+
const zoomed = () => {
|
|
6412
6015
|
select(homeButton).attr('class', 'sn-org-homebutton lui-fade-button lui-fade-button--large');
|
|
6413
6016
|
setTransform({
|
|
6414
6017
|
zoom: event$1.transform.k / scaleFactor,
|
|
@@ -6417,61 +6020,66 @@ function setZooming(_ref) {
|
|
|
6417
6020
|
});
|
|
6418
6021
|
bubbleEvent();
|
|
6419
6022
|
closeTooltip(tooltip);
|
|
6420
|
-
applyTransform(identity
|
|
6023
|
+
applyTransform(identity.translate(event$1.transform.x, event$1.transform.y).scale(event$1.transform.k / scaleFactor), svg, divBox, width, height);
|
|
6421
6024
|
};
|
|
6422
6025
|
|
|
6423
|
-
select(zoomWrapper).call(zoom().extent([[0, 0], [width, height]]).filter(
|
|
6424
|
-
return !wrapperState.constraints.active && event$1.type !== 'dblclick' && !(event$1.type === 'mousedown' && event$1.which === 3);
|
|
6425
|
-
}).scaleExtent([navigationMode === 'expandAll' ? 0.8 : minZoom * scaleFactor, maxZoom * scaleFactor]).on('start', bubbleEvent).on('zoom', zoomed));
|
|
6026
|
+
select(zoomWrapper).call(zoom().extent([[0, 0], [width, height]]).filter(() => !wrapperState.constraints.active && event$1.type !== 'dblclick' && !(event$1.type === 'mousedown' && event$1.which === 3)).scaleExtent([navigationMode === 'expandAll' ? 0.8 : minZoom * scaleFactor, maxZoom * scaleFactor]).on('start', bubbleEvent).on('zoom', zoomed));
|
|
6426
6027
|
setTransform({
|
|
6427
6028
|
zoom: 1 / scaleFactor,
|
|
6428
|
-
x
|
|
6429
|
-
y
|
|
6029
|
+
x,
|
|
6030
|
+
y
|
|
6430
6031
|
});
|
|
6431
|
-
applyTransform(identity
|
|
6032
|
+
applyTransform(identity.translate(x, y).scale(1 / scaleFactor), svg, divBox, width, height);
|
|
6432
6033
|
}
|
|
6433
|
-
|
|
6034
|
+
const getSnapshotZoom = (rect, viewState, initialTransform) => {
|
|
6434
6035
|
if (!viewState) {
|
|
6435
|
-
return identity
|
|
6036
|
+
return identity.translate(initialTransform.x, initialTransform.y).scale(initialTransform.zoom);
|
|
6436
6037
|
}
|
|
6437
6038
|
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6039
|
+
const {
|
|
6040
|
+
size
|
|
6041
|
+
} = viewState;
|
|
6042
|
+
const snapZoom = rect.width / size.w > rect.height / size.h ? rect.height / size.h : rect.width / size.w;
|
|
6043
|
+
const newX = viewState.transform.x * snapZoom;
|
|
6044
|
+
const newY = viewState.transform.y * snapZoom;
|
|
6045
|
+
const newZoom = viewState.transform.zoom * snapZoom;
|
|
6046
|
+
return identity.translate(newX, newY).scale(newZoom);
|
|
6444
6047
|
};
|
|
6445
6048
|
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6049
|
+
const singleSelectionIcon = 'M9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 Z M15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.4,15 C14.7313708,15 15,14.7313708 15,14.4 L15,13.5 C15,13.2238576 15.2238576,13 15.5,13 Z M0.5,13 C0.776142375,13 1,13.2238576 1,13.5 L1,14.4 C1,14.7313708 1.26862915,15 1.6,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,13.5 C0,13.2238576 0.223857625,13 0.5,13 Z M6.8,9 C6.91045695,9 7,9.08954305 7,9.2 L7,12.8 C7,12.9104569 6.91045695,13 6.8,13 L3.2,13 C3.08954305,13 3,12.9104569 3,12.8 L3,9.2 C3,9.08954305 3.08954305,9 3.2,9 L6.8,9 Z M12.8,9 C12.9104569,9 13,9.08954305 13,9.2 L13,12.8 C13,12.9104569 12.9104569,13 12.8,13 L9.2,13 C9.08954305,13 9,12.9104569 9,12.8 L9,9.2 C9,9.08954305 9.08954305,9 9.2,9 L12.8,9 Z M6,10 L4,10 L4,12 L6,12 L6,10 Z M12,10 L10,10 L10,12 L12,12 L12,10 Z M15.5,6 C15.7761424,6 16,6.22385763 16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 Z M0.5,6 C0.776142375,6 1,6.22385763 1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 0,9.77614237 0,9.5 L0,6.5 C0,6.22385763 0.223857625,6 0.5,6 Z M6.8,3 C6.91045695,3 7,3.08954305 7,3.2 L7,6.8 C7,6.91045695 6.91045695,7 6.8,7 L3.2,7 C3.08954305,7 3,6.91045695 3,6.8 L3,3.2 C3,3.08954305 3.08954305,3 3.2,3 L6.8,3 Z M12.8,3 C12.9104569,3 13,3.08954305 13,3.2 L13,6.8 C13,6.91045695 12.9104569,7 12.8,7 L9.2,7 C9.08954305,7 9,6.91045695 9,6.8 L9,3.2 C9,3.08954305 9.08954305,3 9.2,3 L12.8,3 Z M12,4 L10,4 L10,6 L12,6 L12,4 Z M2.5,5.70654635e-14 C2.77614237,5.70654635e-14 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.6,1 C1.26862915,1 1,1.26862915 1,1.6 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 0,2.77614237 0,2.5 L0,1 C0,0.44771525 0.44771525,5.70654635e-14 1,5.70654635e-14 L2.5,5.70654635e-14 Z M15,0 C15.5522847,0 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 L15,1.6 C15,1.26862915 14.7313708,1 14.4,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,0 13.5,0 L15,0 Z M9.5,5.67323966e-14 C9.77614237,5.67323966e-14 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 C6,0.223857625 6.22385763,5.67323966e-14 6.5,5.67323966e-14 L9.5,5.67323966e-14 Z';
|
|
6050
|
+
const homeIcon = `<span class="lui-fade-button__icon sn-org-home-icon">
|
|
6051
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 16 16">
|
|
6052
|
+
<defs>
|
|
6053
|
+
<path id="home-a" d="M2,7.9 L8,3.4 L14,7.9 L14,16 L12,16 L12,11.2 C12,11.0895431 11.9104569,11 11.8,11 L9.2,11 C9.08954305,11 9,11.0895431 9,11.2 L9,16 L2,16 L2,7.9 Z M7,13.8 L7,11.2 C7,11.0895431 6.91045695,11 6.8,11 L4.2,11 C4.08954305,11 4,11.0895431 4,11.2 L4,13.8 C4,13.9104569 4.08954305,14 4.2,14 L6.8,14 C6.91045695,14 7,13.9104569 7,13.8 Z M13,4.1 L16,6.5 L15,7.5 L8,2 L1,7.5 L0,6.5 L8,0 L11,2.4 L11,1 L13,1 L13,4.1 Z"/>
|
|
6054
|
+
</defs>
|
|
6055
|
+
<use xlink:href="#home-a"/>
|
|
6056
|
+
</svg>
|
|
6057
|
+
</span>`;
|
|
6058
|
+
|
|
6059
|
+
const filterTree = ({
|
|
6060
|
+
topId,
|
|
6061
|
+
isExpanded,
|
|
6062
|
+
expandedChildren
|
|
6063
|
+
}, nodeTree, extended, navigationMode) => {
|
|
6454
6064
|
if (navigationMode === 'expandAll') {
|
|
6455
6065
|
return nodeTree.descendants();
|
|
6456
6066
|
}
|
|
6457
6067
|
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
}) || nodeTree;
|
|
6461
|
-
var subTree = [];
|
|
6068
|
+
const topNode = nodeTree.descendants().find(node => node.data.id === topId) || nodeTree;
|
|
6069
|
+
const subTree = [];
|
|
6462
6070
|
|
|
6463
6071
|
if (isExpanded && topNode.children) {
|
|
6464
6072
|
// children
|
|
6465
|
-
topNode.children.forEach(
|
|
6073
|
+
topNode.children.forEach(child => {
|
|
6466
6074
|
subTree.push(child);
|
|
6467
6075
|
|
|
6468
6076
|
if (child.children) {
|
|
6469
6077
|
if (expandedChildren.indexOf(child.data.id) !== -1 || extended) {
|
|
6470
|
-
child.children.forEach(
|
|
6078
|
+
child.children.forEach(grandChild => {
|
|
6471
6079
|
subTree.push(grandChild);
|
|
6472
6080
|
|
|
6473
6081
|
if (expandedChildren.indexOf(child.data.id) !== -1 && extended && grandChild.children) {
|
|
6474
|
-
grandChild.children.forEach(
|
|
6082
|
+
grandChild.children.forEach(extendedChild => {
|
|
6475
6083
|
subTree.push(extendedChild);
|
|
6476
6084
|
});
|
|
6477
6085
|
}
|
|
@@ -6482,18 +6090,16 @@ var filterTree = function filterTree(_ref, nodeTree, extended, navigationMode) {
|
|
|
6482
6090
|
}
|
|
6483
6091
|
|
|
6484
6092
|
if (nodeTree.data.navigationMode === 'free' && topNode.parent) {
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
});
|
|
6489
|
-
ancestors.forEach(function (ancestor) {
|
|
6093
|
+
const ancestors = topNode.parent.ancestors();
|
|
6094
|
+
const ancestorIds = ancestors.map(anc => anc.data.id);
|
|
6095
|
+
ancestors.forEach(ancestor => {
|
|
6490
6096
|
if (extended) {
|
|
6491
|
-
ancestor.children.forEach(
|
|
6492
|
-
child.children && ancestorIds.indexOf(child.data.id) === -1 && child.data.id !== topNode.data.id && subTree.unshift
|
|
6097
|
+
ancestor.children.forEach(child => {
|
|
6098
|
+
child.children && ancestorIds.indexOf(child.data.id) === -1 && child.data.id !== topNode.data.id && subTree.unshift(...child.children);
|
|
6493
6099
|
});
|
|
6494
6100
|
}
|
|
6495
6101
|
|
|
6496
|
-
subTree.unshift
|
|
6102
|
+
subTree.unshift(...ancestor.children);
|
|
6497
6103
|
|
|
6498
6104
|
if (!ancestor.parent) {
|
|
6499
6105
|
subTree.unshift(ancestor);
|
|
@@ -6505,86 +6111,93 @@ var filterTree = function filterTree(_ref, nodeTree, extended, navigationMode) {
|
|
|
6505
6111
|
|
|
6506
6112
|
return subTree;
|
|
6507
6113
|
};
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6114
|
+
const paintTree = ({
|
|
6115
|
+
containerData,
|
|
6116
|
+
styling,
|
|
6117
|
+
setExpandedCallback,
|
|
6118
|
+
wrapperState,
|
|
6119
|
+
selectionObj,
|
|
6120
|
+
element
|
|
6121
|
+
}) => {
|
|
6122
|
+
const {
|
|
6123
|
+
svg,
|
|
6124
|
+
divBox,
|
|
6125
|
+
allNodes,
|
|
6126
|
+
positioning,
|
|
6127
|
+
tooltip
|
|
6128
|
+
} = containerData;
|
|
6129
|
+
const {
|
|
6130
|
+
navigationMode
|
|
6131
|
+
} = allNodes.data;
|
|
6521
6132
|
divBox.selectAll('*').remove();
|
|
6522
6133
|
svg.selectAll('*').remove(); // filter the nodes the nodes
|
|
6523
6134
|
|
|
6524
|
-
|
|
6135
|
+
const nodes = filterTree(wrapperState.expandedState, allNodes, false, navigationMode); // Create cards and naviagation buttons
|
|
6525
6136
|
|
|
6526
6137
|
box({
|
|
6527
|
-
positioning
|
|
6528
|
-
divBox
|
|
6529
|
-
nodes
|
|
6530
|
-
styling
|
|
6531
|
-
setExpandedCallback
|
|
6532
|
-
wrapperState
|
|
6533
|
-
selectionObj
|
|
6534
|
-
navigationMode
|
|
6535
|
-
element
|
|
6536
|
-
tooltip
|
|
6138
|
+
positioning,
|
|
6139
|
+
divBox,
|
|
6140
|
+
nodes,
|
|
6141
|
+
styling,
|
|
6142
|
+
setExpandedCallback,
|
|
6143
|
+
wrapperState,
|
|
6144
|
+
selectionObj,
|
|
6145
|
+
navigationMode,
|
|
6146
|
+
element,
|
|
6147
|
+
tooltip
|
|
6537
6148
|
}); // Create the lines (links) between the nodes
|
|
6538
6149
|
|
|
6539
|
-
|
|
6150
|
+
const node = svg.selectAll('.sn-org-paths').data(nodes).enter();
|
|
6540
6151
|
createPaths(node, positioning, wrapperState.expandedState.topId, navigationMode); // Scale and translate only needed when user cannot zoom
|
|
6541
6152
|
// if (navigationMode !== 'free') {
|
|
6542
6153
|
// transform(nodes, width, height, svg, divBox, useTransitions);
|
|
6543
6154
|
// }
|
|
6544
6155
|
};
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6156
|
+
const createContainer = ({
|
|
6157
|
+
element,
|
|
6158
|
+
dataTree,
|
|
6159
|
+
selectionObj,
|
|
6160
|
+
wrapperState,
|
|
6161
|
+
setInitialZoom,
|
|
6162
|
+
setTransform,
|
|
6163
|
+
setExpandedState,
|
|
6164
|
+
viewState,
|
|
6165
|
+
setContainerData,
|
|
6166
|
+
layout
|
|
6167
|
+
}) => {
|
|
6556
6168
|
element.innerHTML = '';
|
|
6557
6169
|
element.className = 'sn-org-chart';
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6170
|
+
const {
|
|
6171
|
+
navigationMode
|
|
6172
|
+
} = layout;
|
|
6173
|
+
let positioning = position('ttb', element, {}, navigationMode);
|
|
6174
|
+
const {
|
|
6175
|
+
width,
|
|
6176
|
+
height
|
|
6177
|
+
} = element.getBoundingClientRect();
|
|
6178
|
+
const zoomWrapper = select(element).append('span').attr('class', 'sn-org-zoomwrapper').on('click', () => {
|
|
6566
6179
|
if (!wrapperState.constraints.active && (!selectionObj.api.isActive() || !selectionObj.state)) {
|
|
6567
6180
|
selectionObj.api.begin('/qHyperCubeDef');
|
|
6568
6181
|
selectionObj.setState([]);
|
|
6569
6182
|
}
|
|
6570
6183
|
}).node();
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6184
|
+
const svgBox = select(zoomWrapper).selectAll('svg').data([{}]).enter().append('svg').attr('class', 'sn-org-svg').attr('width', '100%').attr('height', '100%');
|
|
6185
|
+
const divBox = select(zoomWrapper).selectAll('div').data([{}]).enter().append('div').attr('class', 'sn-org-nodes');
|
|
6186
|
+
const homeButton = select(element).append('button').attr('class', 'sn-org-homebutton disabled').on('click', () => {
|
|
6574
6187
|
createContainer({
|
|
6575
|
-
element
|
|
6576
|
-
dataTree
|
|
6577
|
-
selectionObj
|
|
6578
|
-
wrapperState
|
|
6579
|
-
setInitialZoom
|
|
6580
|
-
setTransform
|
|
6581
|
-
setExpandedState
|
|
6582
|
-
viewState
|
|
6583
|
-
setContainerData
|
|
6584
|
-
layout
|
|
6188
|
+
element,
|
|
6189
|
+
dataTree,
|
|
6190
|
+
selectionObj,
|
|
6191
|
+
wrapperState,
|
|
6192
|
+
setInitialZoom,
|
|
6193
|
+
setTransform,
|
|
6194
|
+
setExpandedState,
|
|
6195
|
+
viewState,
|
|
6196
|
+
setContainerData,
|
|
6197
|
+
layout
|
|
6585
6198
|
});
|
|
6586
6199
|
}).html(homeIcon).node();
|
|
6587
|
-
|
|
6200
|
+
const tooltip = createTooltip(element);
|
|
6588
6201
|
|
|
6589
6202
|
if (dataTree.error) {
|
|
6590
6203
|
select(zoomWrapper).append('div').attr('class', 'sn-org-error').html(dataTree.message);
|
|
@@ -6592,49 +6205,47 @@ var createContainer = function createContainer(_ref3) {
|
|
|
6592
6205
|
}
|
|
6593
6206
|
|
|
6594
6207
|
if (dataTree.warn && dataTree.warn.length) {
|
|
6595
|
-
select(zoomWrapper).append('span').attr('class', 'sn-org-warning').html(
|
|
6208
|
+
select(zoomWrapper).append('span').attr('class', 'sn-org-warning').html(`*${dataTree.warn.join(' ')}`);
|
|
6596
6209
|
}
|
|
6597
6210
|
|
|
6598
|
-
|
|
6211
|
+
const svg = svgBox.append('g').attr('class', 'sn-org-paths'); // Here are the settings for the tree. For instance nodesize can be adjusted
|
|
6599
6212
|
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
});
|
|
6605
|
-
var newExpandedState = resetExpandedState ? {
|
|
6213
|
+
const treemap = tree().size([width, height]).nodeSize([constants.cardWidth + constants.cardPadding, positioning.depthSpacing]);
|
|
6214
|
+
const allNodes = treemap(hierarchy(dataTree));
|
|
6215
|
+
const resetExpandedState = !wrapperState.expandedState || !allNodes.descendants().find(node => node.data.id === wrapperState.expandedState.topId);
|
|
6216
|
+
const newExpandedState = resetExpandedState ? {
|
|
6606
6217
|
topId: allNodes.data.id,
|
|
6607
6218
|
isExpanded: true,
|
|
6608
6219
|
expandedChildren: [],
|
|
6609
6220
|
useTransitions: false
|
|
6610
6221
|
} : wrapperState.expandedState;
|
|
6611
|
-
|
|
6612
|
-
renderNodes.forEach(
|
|
6222
|
+
const renderNodes = filterTree(newExpandedState, allNodes, false, navigationMode);
|
|
6223
|
+
renderNodes.forEach(node => {
|
|
6613
6224
|
if (!node.xActual || !node.yActual) {
|
|
6614
6225
|
positioning.x(node);
|
|
6615
6226
|
positioning.y(node);
|
|
6616
6227
|
}
|
|
6617
6228
|
});
|
|
6618
|
-
|
|
6619
|
-
|
|
6229
|
+
const bBox = getBBoxOfNodes(renderNodes);
|
|
6230
|
+
const initialZoomState = viewState && viewState.initialZoom ? viewState.initialZoom : getInitialZoomState(bBox, element, navigationMode);
|
|
6620
6231
|
setInitialZoom(initialZoomState);
|
|
6621
6232
|
positioning = position('ttb', element, initialZoomState, navigationMode);
|
|
6622
6233
|
setZooming({
|
|
6623
6234
|
containerData: {
|
|
6624
|
-
svg
|
|
6625
|
-
divBox
|
|
6626
|
-
width
|
|
6627
|
-
height
|
|
6628
|
-
zoomWrapper
|
|
6629
|
-
element
|
|
6630
|
-
tooltip
|
|
6631
|
-
homeButton
|
|
6235
|
+
svg,
|
|
6236
|
+
divBox,
|
|
6237
|
+
width,
|
|
6238
|
+
height,
|
|
6239
|
+
zoomWrapper,
|
|
6240
|
+
element,
|
|
6241
|
+
tooltip,
|
|
6242
|
+
homeButton
|
|
6632
6243
|
},
|
|
6633
|
-
setTransform
|
|
6244
|
+
setTransform,
|
|
6634
6245
|
transformState: viewState && viewState.transform || {},
|
|
6635
|
-
wrapperState
|
|
6636
|
-
initialZoomState
|
|
6637
|
-
navigationMode
|
|
6246
|
+
wrapperState,
|
|
6247
|
+
initialZoomState,
|
|
6248
|
+
navigationMode
|
|
6638
6249
|
});
|
|
6639
6250
|
|
|
6640
6251
|
if (resetExpandedState) {
|
|
@@ -6642,58 +6253,62 @@ var createContainer = function createContainer(_ref3) {
|
|
|
6642
6253
|
}
|
|
6643
6254
|
|
|
6644
6255
|
return setContainerData({
|
|
6645
|
-
svg
|
|
6646
|
-
divBox
|
|
6647
|
-
allNodes
|
|
6648
|
-
positioning
|
|
6649
|
-
width
|
|
6650
|
-
height
|
|
6651
|
-
element
|
|
6652
|
-
zoomWrapper
|
|
6653
|
-
tooltip
|
|
6654
|
-
homeButton
|
|
6256
|
+
svg,
|
|
6257
|
+
divBox,
|
|
6258
|
+
allNodes,
|
|
6259
|
+
positioning,
|
|
6260
|
+
width,
|
|
6261
|
+
height,
|
|
6262
|
+
element,
|
|
6263
|
+
zoomWrapper,
|
|
6264
|
+
tooltip,
|
|
6265
|
+
homeButton
|
|
6655
6266
|
});
|
|
6656
6267
|
};
|
|
6657
6268
|
|
|
6658
|
-
|
|
6269
|
+
const createSnapshotData = (expandedState, allNodes, layout) => {
|
|
6659
6270
|
if (layout.snapshotData && layout.snapshotData.dataMatrix) {
|
|
6660
6271
|
// Need a check here becuase of free resize in storytelling
|
|
6661
6272
|
return layout.snapshotData.dataMatrix;
|
|
6662
6273
|
} // filter down to the visible nodes
|
|
6663
6274
|
|
|
6664
6275
|
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6276
|
+
const {
|
|
6277
|
+
navigationMode
|
|
6278
|
+
} = layout;
|
|
6279
|
+
const nodes = filterTree(expandedState, allNodes, true, navigationMode);
|
|
6280
|
+
const usedMatrix = [];
|
|
6281
|
+
const {
|
|
6282
|
+
qDataPages
|
|
6283
|
+
} = layout.qHyperCube;
|
|
6284
|
+
const dataMatrix = [];
|
|
6285
|
+
qDataPages.forEach(page => {
|
|
6286
|
+
dataMatrix.push(...page.qMatrix);
|
|
6672
6287
|
});
|
|
6673
|
-
nodes.forEach(
|
|
6288
|
+
nodes.forEach(n => {
|
|
6674
6289
|
if (n.data.rowNo !== undefined) {
|
|
6675
6290
|
usedMatrix.push(dataMatrix[n.data.rowNo]);
|
|
6676
6291
|
}
|
|
6677
6292
|
});
|
|
6678
6293
|
return usedMatrix;
|
|
6679
6294
|
};
|
|
6680
|
-
|
|
6681
|
-
|
|
6295
|
+
const createViewState = (expandedState, transform, initialZoom, element) => {
|
|
6296
|
+
const size = {
|
|
6682
6297
|
w: element.clientWidth,
|
|
6683
6298
|
h: element.clientHeight
|
|
6684
6299
|
};
|
|
6685
|
-
|
|
6686
|
-
expandedState
|
|
6687
|
-
transform
|
|
6688
|
-
size
|
|
6689
|
-
initialZoom
|
|
6300
|
+
const vs = {
|
|
6301
|
+
expandedState,
|
|
6302
|
+
transform,
|
|
6303
|
+
size,
|
|
6304
|
+
initialZoom
|
|
6690
6305
|
};
|
|
6691
6306
|
vs.expandedState.useTransitions = false;
|
|
6692
6307
|
return vs;
|
|
6693
6308
|
};
|
|
6694
6309
|
function snapshot(expandedState, containerData, layout, transform, initialZoom) {
|
|
6695
|
-
|
|
6696
|
-
onTakeSnapshot(
|
|
6310
|
+
const element = useElement();
|
|
6311
|
+
onTakeSnapshot(snapshotLayout => {
|
|
6697
6312
|
if (!snapshotLayout.snapshotData) {
|
|
6698
6313
|
snapshotLayout.snapshotData = {};
|
|
6699
6314
|
}
|
|
@@ -6704,13 +6319,12 @@ function snapshot(expandedState, containerData, layout, transform, initialZoom)
|
|
|
6704
6319
|
|
|
6705
6320
|
snapshotLayout.snapshotData.dataMatrix = createSnapshotData(expandedState, containerData.allNodes, layout);
|
|
6706
6321
|
});
|
|
6707
|
-
useImperativeHandle(
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
});
|
|
6322
|
+
useImperativeHandle(() => ({
|
|
6323
|
+
getViewState() {
|
|
6324
|
+
return createViewState(expandedState, transform, initialZoom, element);
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6327
|
+
}));
|
|
6714
6328
|
}
|
|
6715
6329
|
|
|
6716
6330
|
// Local translations when used outside of sense
|
|
@@ -6736,15 +6350,15 @@ var en = {
|
|
|
6736
6350
|
|
|
6737
6351
|
function autoRegister(translator) {
|
|
6738
6352
|
if (translator && translator.get && translator.add) {
|
|
6739
|
-
|
|
6740
|
-
|
|
6353
|
+
const t = 'Object.OrgChart.MaxData';
|
|
6354
|
+
const g = translator.get(t); // if translated string is different from its id
|
|
6741
6355
|
// assume translations already exists for current locale
|
|
6742
6356
|
|
|
6743
6357
|
if (g !== t) {
|
|
6744
6358
|
return;
|
|
6745
6359
|
}
|
|
6746
6360
|
|
|
6747
|
-
Object.keys(en).forEach(
|
|
6361
|
+
Object.keys(en).forEach(key => {
|
|
6748
6362
|
translator.add({
|
|
6749
6363
|
id: key,
|
|
6750
6364
|
locale: {
|
|
@@ -6756,41 +6370,33 @@ function autoRegister(translator) {
|
|
|
6756
6370
|
}
|
|
6757
6371
|
|
|
6758
6372
|
function selectionHandler(translator) {
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
var selectionsAPI = useSelections();
|
|
6765
|
-
var isInSelections = !!useLayout().qSelectionInfo.qInSelections;
|
|
6766
|
-
|
|
6767
|
-
var _useState3 = useState({
|
|
6373
|
+
const [singleSelect, setSingleSelect] = useState(false);
|
|
6374
|
+
const selectionsAPI = useSelections();
|
|
6375
|
+
const isInSelections = !!useLayout().qSelectionInfo.qInSelections;
|
|
6376
|
+
const [selectionObj] = useState({
|
|
6768
6377
|
api: selectionsAPI,
|
|
6769
|
-
setState:
|
|
6378
|
+
setState: state => {
|
|
6770
6379
|
selectionObj.state = state;
|
|
6771
6380
|
},
|
|
6772
6381
|
state: [],
|
|
6773
6382
|
singleSelect: false
|
|
6774
|
-
})
|
|
6775
|
-
|
|
6776
|
-
selectionObj = _useState4[0];
|
|
6777
|
-
|
|
6778
|
-
useEffect(function () {
|
|
6383
|
+
});
|
|
6384
|
+
useEffect(() => {
|
|
6779
6385
|
autoRegister(translator);
|
|
6780
6386
|
}, [translator]);
|
|
6781
6387
|
|
|
6782
|
-
|
|
6388
|
+
const resetSelections = () => {
|
|
6783
6389
|
selectionObj.state = [];
|
|
6784
6390
|
};
|
|
6785
6391
|
|
|
6786
|
-
|
|
6392
|
+
const resetSelectionsAndSingleSelect = () => {
|
|
6787
6393
|
selectionObj.state = [];
|
|
6788
6394
|
setSingleSelect(false);
|
|
6789
6395
|
};
|
|
6790
6396
|
|
|
6791
|
-
useEffect(
|
|
6397
|
+
useEffect(() => {
|
|
6792
6398
|
if (!selectionObj.api) {
|
|
6793
|
-
return
|
|
6399
|
+
return () => {};
|
|
6794
6400
|
}
|
|
6795
6401
|
|
|
6796
6402
|
selectionObj.api = selectionsAPI;
|
|
@@ -6799,42 +6405,41 @@ function selectionHandler(translator) {
|
|
|
6799
6405
|
selectionObj.api.on('confirmed', resetSelectionsAndSingleSelect);
|
|
6800
6406
|
selectionObj.api.on('cleared', resetSelections); // Return function called on unmount
|
|
6801
6407
|
|
|
6802
|
-
return
|
|
6408
|
+
return () => {
|
|
6803
6409
|
selectionObj.api.removeListener('deactivated', resetSelections);
|
|
6804
6410
|
selectionObj.api.removeListener('canceled', resetSelectionsAndSingleSelect);
|
|
6805
6411
|
selectionObj.api.removeListener('confirmed', resetSelectionsAndSingleSelect);
|
|
6806
6412
|
selectionObj.api.removeListener('cleared', resetSelections);
|
|
6807
6413
|
};
|
|
6808
6414
|
}, [selectionsAPI]);
|
|
6809
|
-
useEffect(
|
|
6415
|
+
useEffect(() => {
|
|
6810
6416
|
selectionObj.singleSelect = singleSelect;
|
|
6811
6417
|
}, [singleSelect]);
|
|
6812
|
-
useAction(
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
var addKeyPress = function addKeyPress(event) {
|
|
6418
|
+
useAction(() => ({
|
|
6419
|
+
action() {
|
|
6420
|
+
setSingleSelect(!singleSelect);
|
|
6421
|
+
},
|
|
6422
|
+
|
|
6423
|
+
icon: {
|
|
6424
|
+
shapes: [{
|
|
6425
|
+
type: 'path',
|
|
6426
|
+
attrs: {
|
|
6427
|
+
d: singleSelectionIcon
|
|
6428
|
+
}
|
|
6429
|
+
}]
|
|
6430
|
+
},
|
|
6431
|
+
active: singleSelect,
|
|
6432
|
+
hidden: !isInSelections,
|
|
6433
|
+
label: translator.get('Object.OrgChart.SingleSelect')
|
|
6434
|
+
}), [singleSelect, isInSelections]);
|
|
6435
|
+
useEffect(() => {
|
|
6436
|
+
const addKeyPress = event => {
|
|
6832
6437
|
if (event.key === 'Shift') {
|
|
6833
6438
|
setSingleSelect(true);
|
|
6834
6439
|
}
|
|
6835
6440
|
};
|
|
6836
6441
|
|
|
6837
|
-
|
|
6442
|
+
const removeKeyPress = event => {
|
|
6838
6443
|
if (event.key === 'Shift') {
|
|
6839
6444
|
setSingleSelect(false);
|
|
6840
6445
|
}
|
|
@@ -6842,7 +6447,7 @@ function selectionHandler(translator) {
|
|
|
6842
6447
|
|
|
6843
6448
|
document.addEventListener('keydown', addKeyPress);
|
|
6844
6449
|
document.addEventListener('keyup', removeKeyPress);
|
|
6845
|
-
return
|
|
6450
|
+
return () => {
|
|
6846
6451
|
document.removeEventListener('keydown', addKeyPress);
|
|
6847
6452
|
document.removeEventListener('keyup', removeKeyPress);
|
|
6848
6453
|
};
|
|
@@ -6851,7 +6456,7 @@ function selectionHandler(translator) {
|
|
|
6851
6456
|
}
|
|
6852
6457
|
|
|
6853
6458
|
function getColor(reference, Theme, defaultColor) {
|
|
6854
|
-
|
|
6459
|
+
let color;
|
|
6855
6460
|
|
|
6856
6461
|
switch (reference.colorType) {
|
|
6857
6462
|
case 'byExpression':
|
|
@@ -6868,32 +6473,36 @@ function getColor(reference, Theme, defaultColor) {
|
|
|
6868
6473
|
|
|
6869
6474
|
return color === 'none' ? defaultColor : color;
|
|
6870
6475
|
}
|
|
6871
|
-
|
|
6872
|
-
cardStyling:
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6476
|
+
const stylingUtils = {
|
|
6477
|
+
cardStyling: ({
|
|
6478
|
+
Theme,
|
|
6479
|
+
layout
|
|
6480
|
+
}) => {
|
|
6481
|
+
const backgroundColor = getColor(layout.style.backgroundColor, Theme, DEFAULTS.BACKGROUND_COLOR.color);
|
|
6482
|
+
const fontColor = getColor(layout.style.fontColor, Theme, 'default');
|
|
6483
|
+
const measureLabel = layout.qHyperCube.qMeasureInfo.length ? layout.qHyperCube.qMeasureInfo[0].qFallbackTitle : null;
|
|
6484
|
+
const {
|
|
6485
|
+
border = {
|
|
6486
|
+
colorType: DEFAULTS.BORDER_COLOR_TYPE
|
|
6487
|
+
}
|
|
6488
|
+
} = layout.style;
|
|
6489
|
+
const borderColor = border.colorType !== 'auto' ? getColor(border, Theme, colorUtils.getDarkColor(backgroundColor)) : colorUtils.getDarkColor(backgroundColor);
|
|
6883
6490
|
return {
|
|
6884
|
-
backgroundColor
|
|
6885
|
-
fontColor
|
|
6886
|
-
measureLabel
|
|
6887
|
-
border
|
|
6888
|
-
borderColor
|
|
6491
|
+
backgroundColor,
|
|
6492
|
+
fontColor,
|
|
6493
|
+
measureLabel,
|
|
6494
|
+
border,
|
|
6495
|
+
borderColor
|
|
6889
6496
|
};
|
|
6890
6497
|
}
|
|
6891
6498
|
};
|
|
6892
6499
|
|
|
6893
|
-
|
|
6894
|
-
getViewState:
|
|
6500
|
+
const viewStateUtil = {
|
|
6501
|
+
getViewState: (opts, layout) => {
|
|
6895
6502
|
// Get from options passed to object (used in live printing)
|
|
6896
|
-
|
|
6503
|
+
let {
|
|
6504
|
+
viewState
|
|
6505
|
+
} = opts;
|
|
6897
6506
|
|
|
6898
6507
|
if (!viewState && layout.snapshotData && layout.snapshotData.viewState) {
|
|
6899
6508
|
// Get from layout (used in snapshot mode)
|
|
@@ -6933,156 +6542,129 @@ function styleInject(css, ref) {
|
|
|
6933
6542
|
}
|
|
6934
6543
|
}
|
|
6935
6544
|
|
|
6936
|
-
var css_248z = ".sn-org-chart {\n /* Tooltip arrow */\n}\n.sn-org-chart .sn-org-tooltip {\n visibility: hidden;\n opacity: 0;\n /* Unsupported in IE, so there we set width explicitly */\n width: 230px;\n width: -moz-max-content;\n width: fit-content;\n /* Position the tooltip text */\n position: absolute;\n z-index: 1;\n}\n.sn-org-chart .sn-org-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 0%;\n margin-left: -10px;\n border-width: 10px;\n border-style: solid;\n border-color: #404040 transparent transparent transparent;\n}\n.sn-org-chart .sn-org-tooltip-visible {\n opacity: 0.9;\n visibility: visible;\n}\n.sn-org-chart .sn-org-tooltip-inner {\n max-width: 240px;\n right: 50%;\n font-family: 'QlikView Sans', sans-serif;\n position: relative;\n max-height: 150px;\n background-color: #404040;\n color: #e6e6e6;\n text-align: left;\n font-size: 13px;\n line-height: 15px;\n padding: 10px 10px 10px 10px;\n border-radius: 6px;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n overflow: hidden;\n}\n.sn-org-chart .sn-org-tooltip-inner .sn-org-tooltip-header {\n font-weight: bold;\n padding-bottom: 5px;\n}\n";
|
|
6937
|
-
styleInject(css_248z);
|
|
6545
|
+
var css_248z$4 = ".sn-org-chart {\n /* Tooltip arrow */\n}\n.sn-org-chart .sn-org-tooltip {\n visibility: hidden;\n opacity: 0;\n /* Unsupported in IE, so there we set width explicitly */\n width: 230px;\n width: -moz-max-content;\n width: fit-content;\n /* Position the tooltip text */\n position: absolute;\n z-index: 1;\n}\n.sn-org-chart .sn-org-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 0%;\n margin-left: -10px;\n border-width: 10px;\n border-style: solid;\n border-color: #404040 transparent transparent transparent;\n}\n.sn-org-chart .sn-org-tooltip-visible {\n opacity: 0.9;\n visibility: visible;\n}\n.sn-org-chart .sn-org-tooltip-inner {\n max-width: 240px;\n right: 50%;\n font-family: 'QlikView Sans', sans-serif;\n position: relative;\n max-height: 150px;\n background-color: #404040;\n color: #e6e6e6;\n text-align: left;\n font-size: 13px;\n line-height: 15px;\n padding: 10px 10px 10px 10px;\n border-radius: 6px;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n overflow: hidden;\n}\n.sn-org-chart .sn-org-tooltip-inner .sn-org-tooltip-header {\n font-weight: bold;\n padding-bottom: 5px;\n}\n";
|
|
6546
|
+
styleInject(css_248z$4);
|
|
6938
6547
|
|
|
6939
|
-
var css_248z$
|
|
6940
|
-
styleInject(css_248z$
|
|
6548
|
+
var css_248z$3 = ".sn-org-chart .sn-org-svg {\n position: absolute;\n /* For css only transitions, does not work in IE11 */\n}\n.sn-org-chart .sn-org-svg .sn-org-path {\n fill: none;\n stroke: #4c4c4c;\n stroke-width: 1;\n}\n.sn-org-chart .sn-org-svg .sn-org-paths:not(.org-disable-transition) {\n transform-origin: 0% 0%;\n transition-property: all;\n transition-duration: 0.5s;\n}\n";
|
|
6549
|
+
styleInject(css_248z$3);
|
|
6941
6550
|
|
|
6942
6551
|
var css_248z$2 = ".sn-org-chart .sn-org-warning {\n position: absolute;\n bottom: 0px;\n left: 0px;\n font-style: italic;\n font-size: 13px;\n color: #7b7a78;\n}\n.sn-org-chart .sn-org-error {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n font-size: 1.2em;\n transform: translate(-50%, -50%);\n}\n";
|
|
6943
6552
|
styleInject(css_248z$2);
|
|
6944
6553
|
|
|
6945
|
-
var css_248z$
|
|
6946
|
-
styleInject(css_248z$
|
|
6554
|
+
var css_248z$1 = ".sn-org-chart {\n overflow: hidden;\n}\n.sn-org-chart .sn-org-nodes {\n position: absolute;\n transform-origin: 0% 0%;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n backface-visibility: hidden;\n}\n.sn-org-chart .sn-org-nodes:not(.org-disable-transition) {\n transition-property: all;\n transition-duration: 0.5s;\n}\n.sn-org-chart .sn-org-nodes .sn-org-traverse {\n position: absolute;\n background-color: white;\n font-size: 20px;\n font-weight: bold;\n border-radius: 3px;\n border: 1px solid #8c8c8c;\n text-align: center;\n line-height: 24px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-root {\n position: absolute;\n background-color: #8c8c8c;\n width: 20px;\n height: 20px;\n border-radius: 20px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card {\n position: absolute;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text {\n padding-left: 5px;\n padding-right: 5px;\n border-radius: 3px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.selected {\n border: 4px solid black;\n border-radius: 4px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.not-selected {\n opacity: 0.5;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-title {\n font-size: 14px;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-label {\n font-size: 11px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
|
|
6555
|
+
styleInject(css_248z$1);
|
|
6947
6556
|
|
|
6948
|
-
var css_248z
|
|
6949
|
-
styleInject(css_248z
|
|
6557
|
+
var css_248z = ".sn-org-chart .sn-org-homebutton {\n position: absolute;\n top: 20px;\n right: 20px;\n height: 20px;\n width: 20px;\n border-color: transparent;\n background-color: transparent;\n fill: rgba(89, 89, 89, 0.8);\n transition: fill 200ms ease-out;\n}\n.sn-org-chart .sn-org-homebutton:hover {\n fill: #595959;\n}\n.sn-org-chart .sn-org-homebutton.disabled {\n display: none;\n}\n";
|
|
6558
|
+
styleInject(css_248z);
|
|
6950
6559
|
|
|
6951
6560
|
function supernova(env) {
|
|
6952
6561
|
return {
|
|
6953
6562
|
qae: {
|
|
6954
|
-
properties
|
|
6955
|
-
data
|
|
6563
|
+
properties,
|
|
6564
|
+
data
|
|
6956
6565
|
},
|
|
6957
|
-
component:
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
var _useState3 = useState(null),
|
|
6973
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
6974
|
-
styling = _useState4[0],
|
|
6975
|
-
setStyling = _useState4[1];
|
|
6976
|
-
|
|
6977
|
-
var _useState5 = useState(null),
|
|
6978
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
6979
|
-
expandedState = _useState6[0],
|
|
6980
|
-
setExpandedState = _useState6[1];
|
|
6981
|
-
|
|
6982
|
-
var _useState7 = useState(null),
|
|
6983
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
6984
|
-
transform$1 = _useState8[0],
|
|
6985
|
-
setTransform = _useState8[1];
|
|
6986
|
-
|
|
6987
|
-
var _useState9 = useState(null),
|
|
6988
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
6989
|
-
initialZoom = _useState10[0],
|
|
6990
|
-
setInitialZoom = _useState10[1];
|
|
6991
|
-
|
|
6992
|
-
var _useState11 = useState({
|
|
6566
|
+
component: () => {
|
|
6567
|
+
const layout = useStaleLayout();
|
|
6568
|
+
const model = useModel();
|
|
6569
|
+
const element = useElement();
|
|
6570
|
+
const Theme = useTheme();
|
|
6571
|
+
const options = useOptions();
|
|
6572
|
+
const rect = useRect();
|
|
6573
|
+
const constraints = useConstraints();
|
|
6574
|
+
const translator = useTranslator();
|
|
6575
|
+
const [containerData, setContainerData] = useState(null);
|
|
6576
|
+
const [styling, setStyling] = useState(null);
|
|
6577
|
+
const [expandedState, setExpandedState] = useState(null);
|
|
6578
|
+
const [transform$1, setTransform] = useState(null);
|
|
6579
|
+
const [initialZoom, setInitialZoom] = useState(null);
|
|
6580
|
+
const [wrapperState] = useState({
|
|
6993
6581
|
transform: {},
|
|
6994
|
-
constraints
|
|
6995
|
-
expandedState
|
|
6996
|
-
})
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
var selectionObj = selectionHandler(translator);
|
|
7001
|
-
useEffect(function () {
|
|
6582
|
+
constraints,
|
|
6583
|
+
expandedState
|
|
6584
|
+
});
|
|
6585
|
+
const selectionObj = selectionHandler(translator);
|
|
6586
|
+
useEffect(() => {
|
|
7002
6587
|
autoRegister(translator);
|
|
7003
6588
|
}, [translator.language()]);
|
|
7004
|
-
useEffect(
|
|
6589
|
+
useEffect(() => {
|
|
7005
6590
|
wrapperState.constraints = constraints;
|
|
7006
6591
|
}, [constraints]);
|
|
7007
|
-
useEffect(
|
|
6592
|
+
useEffect(() => {
|
|
7008
6593
|
wrapperState.transform = transform$1;
|
|
7009
6594
|
}, [transform$1]);
|
|
7010
|
-
useEffect(
|
|
6595
|
+
useEffect(() => {
|
|
7011
6596
|
wrapperState.expandedState = expandedState;
|
|
7012
6597
|
}, [expandedState]);
|
|
7013
6598
|
|
|
7014
|
-
|
|
6599
|
+
const setExpandedCallback = newExpandedState => {
|
|
7015
6600
|
newExpandedState.useTransitions = true;
|
|
7016
6601
|
setExpandedState(newExpandedState);
|
|
7017
6602
|
}; // Get and transform the data into a tree structure, get styling, reset active selections
|
|
7018
6603
|
|
|
7019
6604
|
|
|
7020
|
-
|
|
6605
|
+
const [dataTree] = usePromise(() => {
|
|
7021
6606
|
if (!layout) {
|
|
7022
6607
|
return Promise.resolve();
|
|
7023
6608
|
}
|
|
7024
6609
|
|
|
7025
|
-
|
|
6610
|
+
const viewState = viewStateUtil.getViewState(options, layout);
|
|
7026
6611
|
viewState && viewState.expandedState && setExpandedState(viewState.expandedState);
|
|
7027
6612
|
viewState && viewState.transform && setTransform(viewState.transform);
|
|
7028
6613
|
return transform({
|
|
7029
|
-
layout
|
|
7030
|
-
model
|
|
7031
|
-
translator
|
|
7032
|
-
}).then(
|
|
6614
|
+
layout,
|
|
6615
|
+
model,
|
|
6616
|
+
translator
|
|
6617
|
+
}).then(transformed => {
|
|
7033
6618
|
setStyling(stylingUtils.cardStyling({
|
|
7034
|
-
Theme
|
|
7035
|
-
layout
|
|
6619
|
+
Theme,
|
|
6620
|
+
layout
|
|
7036
6621
|
}));
|
|
7037
6622
|
selectionObj.setState([]); // Resolving the promise to indicate readiness for printing
|
|
7038
6623
|
|
|
7039
6624
|
return transformed;
|
|
7040
6625
|
});
|
|
7041
|
-
}, [layout, model, translator.language(), Theme.name()]),
|
|
7042
|
-
_usePromise2 = _slicedToArray(_usePromise, 1),
|
|
7043
|
-
dataTree = _usePromise2[0]; // Create d3 elements, calculate initial zoom and sets expandedState
|
|
7044
|
-
|
|
6626
|
+
}, [layout, model, translator.language(), Theme.name()]); // Create d3 elements, calculate initial zoom and sets expandedState
|
|
7045
6627
|
|
|
7046
|
-
|
|
6628
|
+
const fullReload = () => {
|
|
7047
6629
|
if (element && dataTree) {
|
|
7048
|
-
|
|
6630
|
+
const viewState = viewStateUtil.getViewState(options, layout);
|
|
7049
6631
|
createContainer({
|
|
7050
|
-
element
|
|
7051
|
-
dataTree
|
|
7052
|
-
viewState
|
|
7053
|
-
wrapperState
|
|
7054
|
-
selectionObj
|
|
7055
|
-
setInitialZoom
|
|
7056
|
-
setTransform
|
|
7057
|
-
setExpandedState
|
|
7058
|
-
setContainerData
|
|
7059
|
-
layout
|
|
6632
|
+
element,
|
|
6633
|
+
dataTree,
|
|
6634
|
+
viewState,
|
|
6635
|
+
wrapperState,
|
|
6636
|
+
selectionObj,
|
|
6637
|
+
setInitialZoom,
|
|
6638
|
+
setTransform,
|
|
6639
|
+
setExpandedState,
|
|
6640
|
+
setContainerData,
|
|
6641
|
+
layout
|
|
7060
6642
|
});
|
|
7061
6643
|
}
|
|
7062
6644
|
}; // Call paintTree, currenly repaints all current nodes
|
|
7063
6645
|
|
|
7064
6646
|
|
|
7065
|
-
|
|
6647
|
+
const rePaint = () => {
|
|
7066
6648
|
if (containerData && expandedState && styling) {
|
|
7067
6649
|
paintTree({
|
|
7068
|
-
containerData
|
|
7069
|
-
styling
|
|
7070
|
-
setExpandedCallback
|
|
7071
|
-
wrapperState
|
|
7072
|
-
selectionObj
|
|
6650
|
+
containerData,
|
|
6651
|
+
styling,
|
|
6652
|
+
setExpandedCallback,
|
|
6653
|
+
wrapperState,
|
|
6654
|
+
selectionObj,
|
|
7073
6655
|
useTransitions: expandedState.useTransitions,
|
|
7074
|
-
element
|
|
6656
|
+
element
|
|
7075
6657
|
});
|
|
7076
6658
|
}
|
|
7077
6659
|
};
|
|
7078
6660
|
|
|
7079
|
-
useEffect(
|
|
6661
|
+
useEffect(() => {
|
|
7080
6662
|
rePaint();
|
|
7081
6663
|
}, [containerData, selectionObj.state]);
|
|
7082
|
-
useEffect(
|
|
6664
|
+
useEffect(() => {
|
|
7083
6665
|
fullReload();
|
|
7084
6666
|
}, [element, dataTree, constraints]);
|
|
7085
|
-
useEffect(
|
|
6667
|
+
useEffect(() => {
|
|
7086
6668
|
if (layout.resizeOnExpand) {
|
|
7087
6669
|
fullReload();
|
|
7088
6670
|
} else {
|
|
@@ -7090,9 +6672,9 @@ function supernova(env) {
|
|
|
7090
6672
|
}
|
|
7091
6673
|
}, [expandedState]); // Updates snapshot when resizing
|
|
7092
6674
|
|
|
7093
|
-
useEffect(
|
|
6675
|
+
useEffect(() => {
|
|
7094
6676
|
if (containerData && layout && layout.snapshotData) {
|
|
7095
|
-
|
|
6677
|
+
const snapshotZoom = getSnapshotZoom(rect, layout.snapshotData.viewState, transform$1);
|
|
7096
6678
|
applyTransform(snapshotZoom, containerData.svg, containerData.divBox, rect.width, rect.height);
|
|
7097
6679
|
}
|
|
7098
6680
|
}, [rect, containerData]);
|
|
@@ -7102,4 +6684,4 @@ function supernova(env) {
|
|
|
7102
6684
|
};
|
|
7103
6685
|
}
|
|
7104
6686
|
|
|
7105
|
-
export default
|
|
6687
|
+
export { supernova as default };
|