@visactor/vstory 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +980 -5
- package/dist/index.min.js +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -4382,6 +4382,11 @@
|
|
|
4382
4382
|
var lowerCamelCaseToMiddle = function lowerCamelCaseToMiddle(str) {
|
|
4383
4383
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
4384
4384
|
};
|
|
4385
|
+
function toCamelCase(str) {
|
|
4386
|
+
return str.replace(/-([a-z])/g, function (_, letter) {
|
|
4387
|
+
return letter.toUpperCase();
|
|
4388
|
+
});
|
|
4389
|
+
}
|
|
4385
4390
|
|
|
4386
4391
|
/**
|
|
4387
4392
|
* @module helpers
|
|
@@ -35186,6 +35191,180 @@
|
|
|
35186
35191
|
}), data;
|
|
35187
35192
|
};
|
|
35188
35193
|
|
|
35194
|
+
var tagNameToType = {
|
|
35195
|
+
svg: "group",
|
|
35196
|
+
rect: "rect",
|
|
35197
|
+
line: "rule",
|
|
35198
|
+
polygon: "polygon",
|
|
35199
|
+
path: "path",
|
|
35200
|
+
polyline: "line",
|
|
35201
|
+
g: "group",
|
|
35202
|
+
circle: "arc",
|
|
35203
|
+
ellipse: "arc"
|
|
35204
|
+
},
|
|
35205
|
+
validTagName = Object.keys(tagNameToType),
|
|
35206
|
+
validGroupNode = ["g", "svg", "text", "tspan", "switch"],
|
|
35207
|
+
validTextAttributes = ["font-size", "font-family", "font-weight", "font-style", "text-align", "text-anchor"],
|
|
35208
|
+
validCircleAttributes = ["cx", "cy", "r"],
|
|
35209
|
+
validEllipseAttributes = ["cx", "cy", "rx", "ry"],
|
|
35210
|
+
validLineAttributes = ["x1", "x2", "y1", "y2"],
|
|
35211
|
+
validAttributes = ["visibility", "x", "y", "width", "height", "d", "points", "stroke", "stroke-width", "fill", "fill-opacity", "stroke-opacity"].concat(validTextAttributes, validCircleAttributes, validEllipseAttributes, validLineAttributes),
|
|
35212
|
+
validInheritAttributes = ["visible", "fill", "stroke", "stroke-width", "fill-opacity", "stroke-opacity"].concat(validTextAttributes),
|
|
35213
|
+
numberReg = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;
|
|
35214
|
+
function splitNumberSequence(rawStr) {
|
|
35215
|
+
return rawStr.match(numberReg) || [];
|
|
35216
|
+
}
|
|
35217
|
+
var svgParser = function svgParser(data) {
|
|
35218
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
35219
|
+
var parser = option.customDOMParser;
|
|
35220
|
+
if (parser || (null === window || void 0 === window ? void 0 : window.DOMParser) && (parser = function parser(svg) {
|
|
35221
|
+
return new DOMParser().parseFromString(svg, "text/xml");
|
|
35222
|
+
}), !parser) throw new Error("No Available DOMParser!");
|
|
35223
|
+
var svg = parser(data);
|
|
35224
|
+
var node = 9 === svg.nodeType ? svg.firstChild : svg;
|
|
35225
|
+
for (; node && ("svg" !== node.nodeName.toLowerCase() || 1 !== node.nodeType);) node = node.nextSibling;
|
|
35226
|
+
if (node) {
|
|
35227
|
+
return parseSvgNode(node);
|
|
35228
|
+
}
|
|
35229
|
+
return null;
|
|
35230
|
+
};
|
|
35231
|
+
var idx = 0;
|
|
35232
|
+
function parseSvgNode(svg) {
|
|
35233
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
35234
|
+
var elements = [],
|
|
35235
|
+
root = parseNode(svg, null);
|
|
35236
|
+
var width = parseFloat(svg.getAttribute("width") || opt.width),
|
|
35237
|
+
height = parseFloat(svg.getAttribute("height") || opt.height);
|
|
35238
|
+
!isValidNumber$1(width) && (width = null), !isValidNumber$1(height) && (height = null);
|
|
35239
|
+
var viewBox = svg.getAttribute("viewBox");
|
|
35240
|
+
var viewBoxRect;
|
|
35241
|
+
if (viewBox) {
|
|
35242
|
+
var viewBoxArr = splitNumberSequence(viewBox);
|
|
35243
|
+
if (viewBoxArr.length >= 4 && (viewBoxRect = {
|
|
35244
|
+
x: parseFloat(viewBoxArr[0] || 0),
|
|
35245
|
+
y: parseFloat(viewBoxArr[1] || 0),
|
|
35246
|
+
width: parseFloat(viewBoxArr[2]),
|
|
35247
|
+
height: parseFloat(viewBoxArr[3])
|
|
35248
|
+
}, width || height)) {
|
|
35249
|
+
var boundingRect = {
|
|
35250
|
+
x: 0,
|
|
35251
|
+
y: 0,
|
|
35252
|
+
width: width,
|
|
35253
|
+
height: height
|
|
35254
|
+
},
|
|
35255
|
+
scaleX = boundingRect.width / viewBoxRect.width,
|
|
35256
|
+
scaleY = boundingRect.height / viewBoxRect.height,
|
|
35257
|
+
scale = Math.min(scaleX, scaleY),
|
|
35258
|
+
transLateX = -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),
|
|
35259
|
+
transLateY = -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2),
|
|
35260
|
+
viewBoxTransform = new Matrix().translate(transLateX, transLateY).scale(scale, scale);
|
|
35261
|
+
root.transform = viewBoxTransform;
|
|
35262
|
+
}
|
|
35263
|
+
}
|
|
35264
|
+
return traverse(svg, root, elements), {
|
|
35265
|
+
root: root,
|
|
35266
|
+
width: width,
|
|
35267
|
+
height: height,
|
|
35268
|
+
elements: elements,
|
|
35269
|
+
viewBoxRect: viewBoxRect
|
|
35270
|
+
};
|
|
35271
|
+
}
|
|
35272
|
+
function parseInheritAttributes(parsedElement) {
|
|
35273
|
+
var inheritedAttrs;
|
|
35274
|
+
var parent = parsedElement.parent,
|
|
35275
|
+
attributes = parsedElement.attributes,
|
|
35276
|
+
parse = function parse(parent) {
|
|
35277
|
+
return parent ? validInheritAttributes.reduce(function (acc, attrName) {
|
|
35278
|
+
var camelAttrName = toCamelCase(attrName);
|
|
35279
|
+
return isValid$3(parent[camelAttrName]) && (acc[camelAttrName] = parent[camelAttrName]), acc;
|
|
35280
|
+
}, {}) : {};
|
|
35281
|
+
};
|
|
35282
|
+
return parent ? (parent._inheritStyle || (parent._inheritStyle = parse(parent.attributes)), inheritedAttrs = merge$2({}, parent._inheritStyle, parse(attributes))) : inheritedAttrs = parse(attributes), inheritedAttrs;
|
|
35283
|
+
}
|
|
35284
|
+
function parseAttributes(el) {
|
|
35285
|
+
var _a, _b, _c;
|
|
35286
|
+
var attrs = {},
|
|
35287
|
+
attributes = null !== (_a = el.attributes) && void 0 !== _a ? _a : {},
|
|
35288
|
+
style = null !== (_b = el.style) && void 0 !== _b ? _b : {};
|
|
35289
|
+
for (var i = 0; i < validAttributes.length; i++) {
|
|
35290
|
+
var attrName = validAttributes[i],
|
|
35291
|
+
attrValue = isValid$3(style[attrName]) && "" !== style[attrName] ? style[attrName] : null === (_c = attributes[attrName]) || void 0 === _c ? void 0 : _c.value;
|
|
35292
|
+
isValid$3(attrValue) && (attrs[toCamelCase(attrName)] = isNaN(+attrValue) ? attrValue : parseFloat(attrValue));
|
|
35293
|
+
}
|
|
35294
|
+
return "none" === style.display && (attrs.visible = !1), ["fontSize", "strokeWidth", "width", "height"].forEach(function (attr) {
|
|
35295
|
+
var attrValue = attrs[attr];
|
|
35296
|
+
isString$3(attrs[attr]) && (attrs[attr] = parseFloat(attrValue));
|
|
35297
|
+
}), attrs;
|
|
35298
|
+
}
|
|
35299
|
+
function parseNode(node, parent) {
|
|
35300
|
+
var _a, _b, _c, _d, _e;
|
|
35301
|
+
var tagName = null === (_a = node.tagName) || void 0 === _a ? void 0 : _a.toLowerCase();
|
|
35302
|
+
if (3 === node.nodeType || "text" === tagName || "tspan" === tagName) return parseText(node, parent);
|
|
35303
|
+
if (!validTagName.includes(tagName)) return null;
|
|
35304
|
+
var parsed = {
|
|
35305
|
+
tagName: tagName,
|
|
35306
|
+
graphicType: tagNameToType[tagName],
|
|
35307
|
+
attributes: parseAttributes(node),
|
|
35308
|
+
parent: parent,
|
|
35309
|
+
name: null !== (_b = node.getAttribute("name")) && void 0 !== _b ? _b : null === (_c = null == parent ? void 0 : parent.attributes) || void 0 === _c ? void 0 : _c.name,
|
|
35310
|
+
id: null !== (_d = node.getAttribute("id")) && void 0 !== _d ? _d : "".concat(tagName, "-").concat(idx++),
|
|
35311
|
+
transform: parseTransform$1(node)
|
|
35312
|
+
};
|
|
35313
|
+
return parsed._inheritStyle = parseInheritAttributes(parsed), parent && !isValid$3(parsed.name) && (parsed._nameFromParent = null !== (_e = parent.name) && void 0 !== _e ? _e : parent._nameFromParent), parsed;
|
|
35314
|
+
}
|
|
35315
|
+
function parseText(node, parent) {
|
|
35316
|
+
var _a, _b, _c, _d, _e, _f;
|
|
35317
|
+
if (!parent) return null;
|
|
35318
|
+
var tagName = null === (_a = node.tagName) || void 0 === _a ? void 0 : _a.toLowerCase();
|
|
35319
|
+
if (!tagName && "group" !== parent.graphicType) return null;
|
|
35320
|
+
var nodeAsGroup = "text" === tagName || "tspan" === tagName,
|
|
35321
|
+
elType = nodeAsGroup ? "group" : "text",
|
|
35322
|
+
value = nodeAsGroup || null === (_b = node.textContent) || void 0 === _b ? void 0 : _b.replace(/\n/g, " ").replace(/\s+/g, " ");
|
|
35323
|
+
if (" " === value) return null;
|
|
35324
|
+
var parsed;
|
|
35325
|
+
return parsed = nodeAsGroup ? {
|
|
35326
|
+
tagName: tagName,
|
|
35327
|
+
graphicType: elType,
|
|
35328
|
+
attributes: parseAttributes(node),
|
|
35329
|
+
parent: parent,
|
|
35330
|
+
name: node.getAttribute("name"),
|
|
35331
|
+
id: null !== (_c = node.getAttribute("id")) && void 0 !== _c ? _c : "".concat(tagName, "-").concat(idx++),
|
|
35332
|
+
transform: parseTransform$1(node),
|
|
35333
|
+
value: value
|
|
35334
|
+
} : {
|
|
35335
|
+
tagName: tagName,
|
|
35336
|
+
graphicType: "text",
|
|
35337
|
+
attributes: parseAttributes(node),
|
|
35338
|
+
parent: parent,
|
|
35339
|
+
name: null == parent ? void 0 : parent.name,
|
|
35340
|
+
id: null !== (_e = null === (_d = node.getAttribute) || void 0 === _d ? void 0 : _d.call(node, "id")) && void 0 !== _e ? _e : "".concat(tagName, "-").concat(idx++),
|
|
35341
|
+
value: value
|
|
35342
|
+
}, parsed._inheritStyle = parseInheritAttributes(parsed), isValid$3(parsed.name) || (parsed._nameFromParent = null !== (_f = parent.name) && void 0 !== _f ? _f : parent._nameFromParent), nodeAsGroup ? parent._textGroupStyle ? parsed._textGroupStyle = merge$2({}, parent._textGroupStyle, parseAttributes(node)) : parsed._textGroupStyle = parseAttributes(node) : parsed.attributes = parsed._inheritStyle, parsed;
|
|
35343
|
+
}
|
|
35344
|
+
function parseTransform$1(node) {
|
|
35345
|
+
var _a, _b;
|
|
35346
|
+
var transforms = null === (_a = node.transform) || void 0 === _a ? void 0 : _a.baseVal;
|
|
35347
|
+
if (!transforms) return null;
|
|
35348
|
+
var matrix = null === (_b = transforms.consolidate()) || void 0 === _b ? void 0 : _b.matrix;
|
|
35349
|
+
if (!matrix) return null;
|
|
35350
|
+
var a = matrix.a,
|
|
35351
|
+
b = matrix.b,
|
|
35352
|
+
c = matrix.c,
|
|
35353
|
+
d = matrix.d,
|
|
35354
|
+
e = matrix.e,
|
|
35355
|
+
f = matrix.f;
|
|
35356
|
+
return new Matrix(a, b, c, d, e, f);
|
|
35357
|
+
}
|
|
35358
|
+
function traverse(node, parsedParent) {
|
|
35359
|
+
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
35360
|
+
var _a;
|
|
35361
|
+
if (!node) return;
|
|
35362
|
+
var parseResult;
|
|
35363
|
+
"svg" !== node.nodeName && (parseResult = parseNode(node, parsedParent)), parseResult && result.push(parseResult);
|
|
35364
|
+
var child = validGroupNode.includes(null === (_a = node.tagName) || void 0 === _a ? void 0 : _a.toLocaleLowerCase()) ? node.firstChild : null;
|
|
35365
|
+
for (; child;) traverse(child, null != parseResult ? parseResult : parsedParent, result), child = child.nextSibling;
|
|
35366
|
+
}
|
|
35367
|
+
|
|
35189
35368
|
var idIndex = 0;
|
|
35190
35369
|
var maxId = 1e8;
|
|
35191
35370
|
function getUUID() {
|
|
@@ -55585,7 +55764,7 @@
|
|
|
55585
55764
|
graphicItem && (graphicItem[BridgeElementKey] = null, graphicItem.release(), graphicItem.parent && graphicItem.parent.removeChild(graphicItem));
|
|
55586
55765
|
};
|
|
55587
55766
|
|
|
55588
|
-
var commonAttributes = ["fillOpacity"];
|
|
55767
|
+
var commonAttributes$1 = ["fillOpacity"];
|
|
55589
55768
|
var transformCommonAttribute = function transformCommonAttribute(graphicAttributes, changedKey, nextAttrs) {
|
|
55590
55769
|
var _a;
|
|
55591
55770
|
return "fillOpacity" === changedKey ? (graphicAttributes.fillOpacity = null !== (_a = nextAttrs.fillOpacity) && void 0 !== _a ? _a : 1, ["fillOpacity"]) : [];
|
|
@@ -55666,10 +55845,10 @@
|
|
|
55666
55845
|
} else transform.transform(graphicAttributes, nextAttrs, null);
|
|
55667
55846
|
tags[index] = !0, isTransformed = !0;
|
|
55668
55847
|
}
|
|
55669
|
-
}), isTransformed || (commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key]);
|
|
55848
|
+
}), isTransformed || (commonAttributes$1.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key]);
|
|
55670
55849
|
});
|
|
55671
55850
|
} else changedKeys.forEach(function (key) {
|
|
55672
|
-
commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key];
|
|
55851
|
+
commonAttributes$1.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key];
|
|
55673
55852
|
});
|
|
55674
55853
|
return graphicAttributes;
|
|
55675
55854
|
};
|
|
@@ -56876,6 +57055,84 @@
|
|
|
56876
57055
|
filterType: "groupKey"
|
|
56877
57056
|
};
|
|
56878
57057
|
|
|
57058
|
+
var ElementHighlightByGraphicName = /*#__PURE__*/function (_ElementHighlight) {
|
|
57059
|
+
function ElementHighlightByGraphicName(view, options) {
|
|
57060
|
+
var _this;
|
|
57061
|
+
_classCallCheck(this, ElementHighlightByGraphicName);
|
|
57062
|
+
_this = _callSuper(this, ElementHighlightByGraphicName, [view, options]), _this.type = ElementHighlightByGraphicName.type, _this.handleStart = function (e) {
|
|
57063
|
+
if (e && e.element && _this._marks.includes(e.element.mark)) {
|
|
57064
|
+
if (_this.options.shouldStart ? _this.options.shouldStart(e) : _this._filterByName(e)) {
|
|
57065
|
+
var itemKey = _this._parseTargetKey(e, e.element);
|
|
57066
|
+
_this.start(itemKey);
|
|
57067
|
+
}
|
|
57068
|
+
}
|
|
57069
|
+
}, _this.handleReset = function (e) {
|
|
57070
|
+
e && e.element && _this._marks.includes(e.element.mark) && _this.reset();
|
|
57071
|
+
}, _this.options = Object.assign({}, ElementHighlightByGraphicName.defaultOptions, options), _this._marks = view.getMarksBySelector(_this.options.selector);
|
|
57072
|
+
return _this;
|
|
57073
|
+
}
|
|
57074
|
+
_inherits(ElementHighlightByGraphicName, _ElementHighlight);
|
|
57075
|
+
return _createClass(ElementHighlightByGraphicName, [{
|
|
57076
|
+
key: "_filterByName",
|
|
57077
|
+
value: function _filterByName(e) {
|
|
57078
|
+
var _a;
|
|
57079
|
+
return !!(null === (_a = null == e ? void 0 : e.target) || void 0 === _a ? void 0 : _a.name);
|
|
57080
|
+
}
|
|
57081
|
+
}, {
|
|
57082
|
+
key: "_parseTargetKey",
|
|
57083
|
+
value: function _parseTargetKey(e, element) {
|
|
57084
|
+
return e.target.name;
|
|
57085
|
+
}
|
|
57086
|
+
}, {
|
|
57087
|
+
key: "start",
|
|
57088
|
+
value: function start(itemKey) {
|
|
57089
|
+
var _this2 = this;
|
|
57090
|
+
isNil$1(itemKey) || this._marks.forEach(function (mark) {
|
|
57091
|
+
mark.elements.forEach(function (el) {
|
|
57092
|
+
var _a;
|
|
57093
|
+
(null === (_a = el.getGraphicItem()) || void 0 === _a ? void 0 : _a.name) === itemKey ? el.updateStates(_defineProperty(_defineProperty({}, _this2.options.blurState, !1), _this2.options.highlightState, !0)) : el.updateStates(_defineProperty(_defineProperty({}, _this2.options.blurState, !0), _this2.options.highlightState, !1));
|
|
57094
|
+
});
|
|
57095
|
+
});
|
|
57096
|
+
}
|
|
57097
|
+
}, {
|
|
57098
|
+
key: "reset",
|
|
57099
|
+
value: function reset() {
|
|
57100
|
+
var states = [this.options.blurState, this.options.highlightState];
|
|
57101
|
+
this._marks.forEach(function (mark) {
|
|
57102
|
+
mark.elements.forEach(function (el) {
|
|
57103
|
+
el.removeState(states);
|
|
57104
|
+
});
|
|
57105
|
+
});
|
|
57106
|
+
}
|
|
57107
|
+
}]);
|
|
57108
|
+
}(ElementHighlight);
|
|
57109
|
+
ElementHighlightByGraphicName.type = "element-highlight-by-graphic-name";
|
|
57110
|
+
|
|
57111
|
+
var ElementSelectByGraphicName = /*#__PURE__*/function (_ElementSelect) {
|
|
57112
|
+
function ElementSelectByGraphicName() {
|
|
57113
|
+
var _this;
|
|
57114
|
+
_classCallCheck(this, ElementSelectByGraphicName);
|
|
57115
|
+
_this = _callSuper(this, ElementSelectByGraphicName, arguments), _this.type = ElementSelectByGraphicName.type;
|
|
57116
|
+
return _this;
|
|
57117
|
+
}
|
|
57118
|
+
_inherits(ElementSelectByGraphicName, _ElementSelect);
|
|
57119
|
+
return _createClass(ElementSelectByGraphicName, [{
|
|
57120
|
+
key: "start",
|
|
57121
|
+
value: function start(element) {
|
|
57122
|
+
var _this2 = this;
|
|
57123
|
+
var _a;
|
|
57124
|
+
var name = null === (_a = element.getGraphicItem()) || void 0 === _a ? void 0 : _a.name;
|
|
57125
|
+
name && this._marks.forEach(function (mark) {
|
|
57126
|
+
mark.elements.forEach(function (el) {
|
|
57127
|
+
var _a;
|
|
57128
|
+
(null === (_a = el.getGraphicItem()) || void 0 === _a ? void 0 : _a.name) === name && _superPropGet(ElementSelectByGraphicName, "start", _this2, 3)([el]);
|
|
57129
|
+
});
|
|
57130
|
+
});
|
|
57131
|
+
}
|
|
57132
|
+
}]);
|
|
57133
|
+
}(ElementSelect);
|
|
57134
|
+
ElementSelectByGraphicName.type = "element-select-by-graphic-name";
|
|
57135
|
+
|
|
56879
57136
|
function getBandWidthOfScale(scale) {
|
|
56880
57137
|
if (scale) return scale.type === ScaleEnum.Band ? scale.bandwidth() : scale.type === ScaleEnum.Point ? scale.step() : void 0;
|
|
56881
57138
|
}
|
|
@@ -56973,6 +57230,12 @@
|
|
|
56973
57230
|
var registerElementHighlightByName = function registerElementHighlightByName() {
|
|
56974
57231
|
Factory.registerInteraction(ElementHighlightByName.type, ElementHighlightByName);
|
|
56975
57232
|
};
|
|
57233
|
+
var registerElementHighlightByGraphicName = function registerElementHighlightByGraphicName() {
|
|
57234
|
+
Factory.registerInteraction(ElementHighlightByGraphicName.type, ElementHighlightByGraphicName);
|
|
57235
|
+
};
|
|
57236
|
+
var registerElementSelectByGraphicName = function registerElementSelectByGraphicName() {
|
|
57237
|
+
Factory.registerInteraction(ElementSelectByGraphicName.type, ElementSelectByGraphicName);
|
|
57238
|
+
};
|
|
56976
57239
|
|
|
56977
57240
|
var parseOptionValue = function parseOptionValue(value, params) {
|
|
56978
57241
|
return isGrammar(value) ? value.output() : value && isObject$4(value) ? isFunction$3(value.callback) ? function (datum) {
|
|
@@ -70051,6 +70314,20 @@
|
|
|
70051
70314
|
}(BasePluginService);
|
|
70052
70315
|
|
|
70053
70316
|
var svgSourceMap = new Map();
|
|
70317
|
+
var svgDataSet;
|
|
70318
|
+
function initSVGDataSet() {
|
|
70319
|
+
svgDataSet || (svgDataSet = new DataSet(), registerDataSetInstanceParser(svgDataSet, "svg", svgParser));
|
|
70320
|
+
}
|
|
70321
|
+
function registerSVGSource(key, source) {
|
|
70322
|
+
svgSourceMap.has(key) && warn("svg source key of '".concat(key, "' already exists, will be overwritten.")), initSVGDataSet();
|
|
70323
|
+
var dataView = new DataView(svgDataSet);
|
|
70324
|
+
dataView.parse(source, {
|
|
70325
|
+
type: "svg"
|
|
70326
|
+
}), svgSourceMap.set(key, dataView);
|
|
70327
|
+
}
|
|
70328
|
+
function unregisterSVGSource(key) {
|
|
70329
|
+
svgSourceMap.has(key) ? svgSourceMap["delete"](key) : warn("map type of '".concat(key, "' does not exists."));
|
|
70330
|
+
}
|
|
70054
70331
|
function getSVGSource(type) {
|
|
70055
70332
|
return svgSourceMap.get(type);
|
|
70056
70333
|
}
|
|
@@ -109428,6 +109705,701 @@
|
|
|
109428
109705
|
registerMosaicSeries(), Factory$1.registerChart(MosaicChart.type, MosaicChart);
|
|
109429
109706
|
};
|
|
109430
109707
|
|
|
109708
|
+
var PictogramChartSpecTransformer = /*#__PURE__*/function (_BaseChartSpecTransfo) {
|
|
109709
|
+
function PictogramChartSpecTransformer() {
|
|
109710
|
+
_classCallCheck(this, PictogramChartSpecTransformer);
|
|
109711
|
+
return _callSuper(this, PictogramChartSpecTransformer, arguments);
|
|
109712
|
+
}
|
|
109713
|
+
_inherits(PictogramChartSpecTransformer, _BaseChartSpecTransfo);
|
|
109714
|
+
return _createClass(PictogramChartSpecTransformer, [{
|
|
109715
|
+
key: "_isValidSeries",
|
|
109716
|
+
value: function _isValidSeries(type) {
|
|
109717
|
+
return type === SeriesTypeEnum.pictogram;
|
|
109718
|
+
}
|
|
109719
|
+
}, {
|
|
109720
|
+
key: "_getDefaultSeriesSpec",
|
|
109721
|
+
value: function _getDefaultSeriesSpec(spec) {
|
|
109722
|
+
return Object.assign(Object.assign({}, _superPropGet(PictogramChartSpecTransformer, "_getDefaultSeriesSpec", this, 3)([spec])), {
|
|
109723
|
+
type: spec.type,
|
|
109724
|
+
nameField: spec.nameField,
|
|
109725
|
+
valueField: spec.valueField,
|
|
109726
|
+
seriesField: spec.seriesField,
|
|
109727
|
+
svg: spec.svg,
|
|
109728
|
+
pictogram: spec.pictogram,
|
|
109729
|
+
defaultFillColor: spec.defaultFillColor
|
|
109730
|
+
});
|
|
109731
|
+
}
|
|
109732
|
+
}, {
|
|
109733
|
+
key: "transformSpec",
|
|
109734
|
+
value: function transformSpec(spec) {
|
|
109735
|
+
var _this = this;
|
|
109736
|
+
_superPropGet(PictogramChartSpecTransformer, "transformSpec", this, 3)([spec]), spec.region.forEach(function (r) {
|
|
109737
|
+
r.coordinate = "geo";
|
|
109738
|
+
});
|
|
109739
|
+
var defaultSeriesSpec = this._getDefaultSeriesSpec(spec);
|
|
109740
|
+
spec.series && 0 !== spec.series.length ? spec.series.forEach(function (s) {
|
|
109741
|
+
_this._isValidSeries(s.type) && Object.keys(defaultSeriesSpec).forEach(function (k) {
|
|
109742
|
+
k in s || (s[k] = defaultSeriesSpec[k]);
|
|
109743
|
+
});
|
|
109744
|
+
}) : spec.series = [defaultSeriesSpec];
|
|
109745
|
+
}
|
|
109746
|
+
}]);
|
|
109747
|
+
}(BaseChartSpecTransformer);
|
|
109748
|
+
|
|
109749
|
+
var PictogramSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), {
|
|
109750
|
+
pictogram: {
|
|
109751
|
+
name: "pictogram",
|
|
109752
|
+
type: "group"
|
|
109753
|
+
}
|
|
109754
|
+
});
|
|
109755
|
+
|
|
109756
|
+
var PictogramSeriesSpecTransformer = /*#__PURE__*/function (_BaseSeriesSpecTransf) {
|
|
109757
|
+
function PictogramSeriesSpecTransformer() {
|
|
109758
|
+
_classCallCheck(this, PictogramSeriesSpecTransformer);
|
|
109759
|
+
return _callSuper(this, PictogramSeriesSpecTransformer, arguments);
|
|
109760
|
+
}
|
|
109761
|
+
_inherits(PictogramSeriesSpecTransformer, _BaseSeriesSpecTransf);
|
|
109762
|
+
return _createClass(PictogramSeriesSpecTransformer, [{
|
|
109763
|
+
key: "_getDefaultSpecFromChart",
|
|
109764
|
+
value: function _getDefaultSpecFromChart(chartSpec) {
|
|
109765
|
+
var _a, _b, _c;
|
|
109766
|
+
var spec = null !== (_a = _superPropGet(PictogramSeriesSpecTransformer, "_getDefaultSpecFromChart", this, 3)([chartSpec])) && void 0 !== _a ? _a : {},
|
|
109767
|
+
svg = chartSpec.svg,
|
|
109768
|
+
elements = null === (_c = null === (_b = svgSourceMap.get(svg)) || void 0 === _b ? void 0 : _b.latestData) || void 0 === _c ? void 0 : _c.elements;
|
|
109769
|
+
if (elements && elements.length) {
|
|
109770
|
+
elements.map(function (e) {
|
|
109771
|
+
return e.name;
|
|
109772
|
+
}).filter(function (n) {
|
|
109773
|
+
return isValid$3(n);
|
|
109774
|
+
}).forEach(function (name) {
|
|
109775
|
+
chartSpec[name] && (spec[name] = chartSpec[name]);
|
|
109776
|
+
});
|
|
109777
|
+
}
|
|
109778
|
+
return spec;
|
|
109779
|
+
}
|
|
109780
|
+
}]);
|
|
109781
|
+
}(BaseSeriesSpecTransformer);
|
|
109782
|
+
|
|
109783
|
+
var PictogramSeriesTooltipHelper = /*#__PURE__*/function (_BaseSeriesTooltipHel) {
|
|
109784
|
+
function PictogramSeriesTooltipHelper() {
|
|
109785
|
+
var _this;
|
|
109786
|
+
_classCallCheck(this, PictogramSeriesTooltipHelper);
|
|
109787
|
+
_this = _callSuper(this, PictogramSeriesTooltipHelper, arguments), _this.dimensionTooltipTitleCallback = function (datum) {
|
|
109788
|
+
var _a;
|
|
109789
|
+
var series = _this.series;
|
|
109790
|
+
return null !== (_a = _this._getDimensionData(datum)) && void 0 !== _a ? _a : series.getDatumName(datum);
|
|
109791
|
+
}, _this.markTooltipValueCallback = function (datum, params) {
|
|
109792
|
+
var measureFields = _this._seriesCacheInfo.measureFields;
|
|
109793
|
+
if (measureFields[0] && datum.data) return datum.data[measureFields[0]];
|
|
109794
|
+
}, _this.markTooltipKeyCallback = function (datum) {
|
|
109795
|
+
var _a;
|
|
109796
|
+
return null === (_a = datum.data) || void 0 === _a ? void 0 : _a[_this.series.getDimensionField()[0]];
|
|
109797
|
+
};
|
|
109798
|
+
return _this;
|
|
109799
|
+
}
|
|
109800
|
+
_inherits(PictogramSeriesTooltipHelper, _BaseSeriesTooltipHel);
|
|
109801
|
+
return _createClass(PictogramSeriesTooltipHelper);
|
|
109802
|
+
}(BaseSeriesTooltipHelper);
|
|
109803
|
+
|
|
109804
|
+
function isValidStrokeOrFill(attr) {
|
|
109805
|
+
var _a;
|
|
109806
|
+
return isValid$3(attr) && "none" !== attr && !(null === (_a = attr.includes) || void 0 === _a ? void 0 : _a.call(attr, "url"));
|
|
109807
|
+
}
|
|
109808
|
+
var getLineWidth = function getLineWidth(attributes) {
|
|
109809
|
+
var strokeWidth = parseFloat(attributes.strokeWidth);
|
|
109810
|
+
if (!isNaN(strokeWidth)) return strokeWidth;
|
|
109811
|
+
var stroke = attributes.stroke;
|
|
109812
|
+
return stroke && isValidStrokeOrFill(stroke) ? 1 : 0;
|
|
109813
|
+
},
|
|
109814
|
+
getFill = function getFill(attributes, defaultFill) {
|
|
109815
|
+
var _a;
|
|
109816
|
+
var fill = null !== (_a = attributes.fill) && void 0 !== _a ? _a : defaultFill;
|
|
109817
|
+
return fill && isValidStrokeOrFill(fill) ? fill : void 0;
|
|
109818
|
+
},
|
|
109819
|
+
getStroke = function getStroke(attributes, defaultStroke) {
|
|
109820
|
+
var _a;
|
|
109821
|
+
var stroke = null !== (_a = attributes.stroke) && void 0 !== _a ? _a : defaultStroke;
|
|
109822
|
+
return !(!stroke || !isValidStrokeOrFill(stroke)) && stroke;
|
|
109823
|
+
},
|
|
109824
|
+
commonAttributes = function commonAttributes(attributes) {
|
|
109825
|
+
return Object.assign(Object.assign({}, attributes), {
|
|
109826
|
+
x: parseFloat(attributes.x) || void 0,
|
|
109827
|
+
y: parseFloat(attributes.y) || void 0,
|
|
109828
|
+
fillStrokeOrder: !1,
|
|
109829
|
+
fill: getFill(attributes),
|
|
109830
|
+
lineWidth: getLineWidth(attributes),
|
|
109831
|
+
stroke: getStroke(attributes)
|
|
109832
|
+
});
|
|
109833
|
+
};
|
|
109834
|
+
var graphicAttributeTransform = {
|
|
109835
|
+
group: function group(attributes) {
|
|
109836
|
+
var common = commonAttributes(attributes);
|
|
109837
|
+
return Object.assign(Object.assign({}, common), {
|
|
109838
|
+
visibleAll: !1 !== common.visible
|
|
109839
|
+
});
|
|
109840
|
+
},
|
|
109841
|
+
rule: function rule(attributes) {
|
|
109842
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109843
|
+
x: parseFloat(attributes.x1),
|
|
109844
|
+
y: parseFloat(attributes.y1),
|
|
109845
|
+
x1: parseFloat(attributes.x2),
|
|
109846
|
+
y1: parseFloat(attributes.y2)
|
|
109847
|
+
});
|
|
109848
|
+
},
|
|
109849
|
+
rect: function rect(attributes) {
|
|
109850
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109851
|
+
fill: getFill(attributes, "#000"),
|
|
109852
|
+
width: parseFloat(attributes.width),
|
|
109853
|
+
height: parseFloat(attributes.height)
|
|
109854
|
+
});
|
|
109855
|
+
},
|
|
109856
|
+
polygon: function polygon(attributes) {
|
|
109857
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109858
|
+
fill: getFill(attributes, "#000"),
|
|
109859
|
+
points: attributes.points.trim().split(/\s+/).map(function (pair) {
|
|
109860
|
+
var _pair$split$map = pair.split(",").map(Number),
|
|
109861
|
+
_pair$split$map2 = _slicedToArray(_pair$split$map, 2),
|
|
109862
|
+
x = _pair$split$map2[0],
|
|
109863
|
+
y = _pair$split$map2[1];
|
|
109864
|
+
return {
|
|
109865
|
+
x: x,
|
|
109866
|
+
y: y
|
|
109867
|
+
};
|
|
109868
|
+
})
|
|
109869
|
+
});
|
|
109870
|
+
},
|
|
109871
|
+
line: function line(attributes) {
|
|
109872
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109873
|
+
points: attributes.points.trim().split(/\s+/).map(function (pair) {
|
|
109874
|
+
var _pair$split$map3 = pair.split(",").map(Number),
|
|
109875
|
+
_pair$split$map4 = _slicedToArray(_pair$split$map3, 2),
|
|
109876
|
+
x = _pair$split$map4[0],
|
|
109877
|
+
y = _pair$split$map4[1];
|
|
109878
|
+
return {
|
|
109879
|
+
x: x,
|
|
109880
|
+
y: y
|
|
109881
|
+
};
|
|
109882
|
+
})
|
|
109883
|
+
});
|
|
109884
|
+
},
|
|
109885
|
+
path: function path(attributes) {
|
|
109886
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109887
|
+
path: attributes.d,
|
|
109888
|
+
fillStrokeOrder: !1
|
|
109889
|
+
});
|
|
109890
|
+
},
|
|
109891
|
+
arc: function arc(attributes) {
|
|
109892
|
+
var _a;
|
|
109893
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109894
|
+
outerRadius: null !== (_a = attributes.r) && void 0 !== _a ? _a : attributes.ry,
|
|
109895
|
+
x: parseFloat(attributes.cx),
|
|
109896
|
+
y: parseFloat(attributes.cy),
|
|
109897
|
+
startAngle: 0,
|
|
109898
|
+
endAngle: 2 * Math.PI,
|
|
109899
|
+
scaleX: parseFloat(attributes.rx) / parseFloat(attributes.ry) || 1,
|
|
109900
|
+
fill: getFill(attributes, "#000")
|
|
109901
|
+
});
|
|
109902
|
+
},
|
|
109903
|
+
text: function text(attributes, value) {
|
|
109904
|
+
var _a, _b;
|
|
109905
|
+
return Object.assign(Object.assign({}, commonAttributes(attributes)), {
|
|
109906
|
+
text: value,
|
|
109907
|
+
textAlign: null !== (_a = attributes.textAlign) && void 0 !== _a ? _a : "left",
|
|
109908
|
+
textBaseLine: null !== (_b = attributes.textAnchor) && void 0 !== _b ? _b : "middle",
|
|
109909
|
+
anchor: [0, 0],
|
|
109910
|
+
fill: getFill(attributes, "#000")
|
|
109911
|
+
});
|
|
109912
|
+
}
|
|
109913
|
+
};
|
|
109914
|
+
var pictogram = function pictogram(data) {
|
|
109915
|
+
var _a, _b;
|
|
109916
|
+
if (!data || !data[0]) return {};
|
|
109917
|
+
var elements = data[0].latestData.elements;
|
|
109918
|
+
if (elements && elements.length) {
|
|
109919
|
+
elements.forEach(function (el, index) {
|
|
109920
|
+
var _a;
|
|
109921
|
+
el[DEFAULT_DATA_INDEX] = index, el._uniqueId = "".concat(el.id, "-").concat(index), el.data = void 0;
|
|
109922
|
+
var type = el.graphicType,
|
|
109923
|
+
transform = el.transform;
|
|
109924
|
+
var finalAttributes = {
|
|
109925
|
+
visible: "hidden" !== el.attributes.visibility && "collapse" !== el.attributes.visibility
|
|
109926
|
+
};
|
|
109927
|
+
"text" === el.graphicType ? merge$2(finalAttributes, el._inheritStyle, null === (_a = el.parent) || void 0 === _a ? void 0 : _a._textGroupStyle, el.attributes) : "group" !== el.graphicType && merge$2(finalAttributes, el._inheritStyle, el.attributes), graphicAttributeTransform[type] ? el._finalAttributes = graphicAttributeTransform[type](finalAttributes, el.value) : el._finalAttributes = finalAttributes, transform && (el._finalAttributes.postMatrix = Object.assign({}, transform));
|
|
109928
|
+
});
|
|
109929
|
+
var texts = elements.filter(function (el) {
|
|
109930
|
+
return "text" === el.tagName;
|
|
109931
|
+
});
|
|
109932
|
+
var _loop = function _loop() {
|
|
109933
|
+
var textId = texts[i]._uniqueId,
|
|
109934
|
+
children = elements.filter(function (el) {
|
|
109935
|
+
var result = !1,
|
|
109936
|
+
parent = el.parent;
|
|
109937
|
+
for (; parent;) {
|
|
109938
|
+
if (parent._uniqueId === textId) {
|
|
109939
|
+
result = !0;
|
|
109940
|
+
break;
|
|
109941
|
+
}
|
|
109942
|
+
parent = parent.parent;
|
|
109943
|
+
}
|
|
109944
|
+
return result;
|
|
109945
|
+
});
|
|
109946
|
+
if (children && children.length) {
|
|
109947
|
+
var startX = null !== (_b = null === (_a = texts[i]._textGroupStyle) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0,
|
|
109948
|
+
curX = startX;
|
|
109949
|
+
for (var j = 0; j < children.length; j++) {
|
|
109950
|
+
var currentChild = children[j];
|
|
109951
|
+
if ("group" === currentChild.graphicType) curX = startX;else if (currentChild.value && void 0 === currentChild.parent._textGroupStyle.x) {
|
|
109952
|
+
var lastText = children.slice(0, j).reverse().find(function (c) {
|
|
109953
|
+
return "text" === c.graphicType && c.value;
|
|
109954
|
+
});
|
|
109955
|
+
if (lastText) {
|
|
109956
|
+
curX += measureText(lastText.value, lastText._finalAttributes).width;
|
|
109957
|
+
}
|
|
109958
|
+
currentChild._finalAttributes.x = curX;
|
|
109959
|
+
}
|
|
109960
|
+
}
|
|
109961
|
+
}
|
|
109962
|
+
};
|
|
109963
|
+
for (var i = 0; i < texts.length; i++) {
|
|
109964
|
+
_loop();
|
|
109965
|
+
}
|
|
109966
|
+
}
|
|
109967
|
+
return elements;
|
|
109968
|
+
};
|
|
109969
|
+
|
|
109970
|
+
var PictogramSeries = /*#__PURE__*/function (_GeoSeries) {
|
|
109971
|
+
function PictogramSeries() {
|
|
109972
|
+
var _this;
|
|
109973
|
+
_classCallCheck(this, PictogramSeries);
|
|
109974
|
+
_this = _callSuper(this, PictogramSeries, arguments), _this.type = SeriesTypeEnum.pictogram;
|
|
109975
|
+
return _this;
|
|
109976
|
+
}
|
|
109977
|
+
_inherits(PictogramSeries, _GeoSeries);
|
|
109978
|
+
return _createClass(PictogramSeries, [{
|
|
109979
|
+
key: "setAttrFromSpec",
|
|
109980
|
+
value: function setAttrFromSpec() {
|
|
109981
|
+
var _a, _b, _c;
|
|
109982
|
+
_superPropGet(PictogramSeries, "setAttrFromSpec", this, 3)([]), this.svg = this._spec.svg, this._nameField = this._spec.nameField, this._valueField = this._spec.valueField, this.svg || null === (_a = this._option) || void 0 === _a || _a.onError("svg source is not specified !"), this._parsedSvgResult = null === (_b = getSVGSource(this.svg)) || void 0 === _b ? void 0 : _b.latestData, this._parsedSvgResult || null === (_c = this._option) || void 0 === _c || _c.onError("'".concat(this.svg, "' is not registered !"));
|
|
109983
|
+
}
|
|
109984
|
+
}, {
|
|
109985
|
+
key: "getDatumCenter",
|
|
109986
|
+
value: function getDatumCenter(datum) {
|
|
109987
|
+
return [Number.NaN, Number.NaN];
|
|
109988
|
+
}
|
|
109989
|
+
}, {
|
|
109990
|
+
key: "getDatumName",
|
|
109991
|
+
value: function getDatumName(datum) {
|
|
109992
|
+
return datum.name || datum._nameFromParent;
|
|
109993
|
+
}
|
|
109994
|
+
}, {
|
|
109995
|
+
key: "getMarksWithoutRoot",
|
|
109996
|
+
value: function getMarksWithoutRoot() {
|
|
109997
|
+
var _this2 = this;
|
|
109998
|
+
return this.getMarks().filter(function (m) {
|
|
109999
|
+
return m.name && !m.name.includes("seriesGroup") && !m.name.includes("root") && m !== _this2._pictogramMark;
|
|
110000
|
+
});
|
|
110001
|
+
}
|
|
110002
|
+
}, {
|
|
110003
|
+
key: "_buildMarkAttributeContext",
|
|
110004
|
+
value: function _buildMarkAttributeContext() {
|
|
110005
|
+
_superPropGet(PictogramSeries, "_buildMarkAttributeContext", this, 3)([]), this._markAttributeContext.getTransformMatrix = this.getRootMatrix.bind(this), this._markAttributeContext.coordToPosition = this.coordToPosition.bind(this), this._markAttributeContext.dataToPosition = this.dataToPosition.bind(this);
|
|
110006
|
+
}
|
|
110007
|
+
}, {
|
|
110008
|
+
key: "_defaultHoverConfig",
|
|
110009
|
+
value: function _defaultHoverConfig(selector, finalHoverSpec) {
|
|
110010
|
+
return {
|
|
110011
|
+
seriesId: this.id,
|
|
110012
|
+
regionId: this._region.id,
|
|
110013
|
+
selector: selector,
|
|
110014
|
+
type: "element-highlight-by-graphic-name",
|
|
110015
|
+
trigger: finalHoverSpec.trigger,
|
|
110016
|
+
triggerOff: "pointerout",
|
|
110017
|
+
blurState: STATE_VALUE_ENUM.STATE_HOVER_REVERSE,
|
|
110018
|
+
highlightState: STATE_VALUE_ENUM.STATE_HOVER
|
|
110019
|
+
};
|
|
110020
|
+
}
|
|
110021
|
+
}, {
|
|
110022
|
+
key: "_defaultSelectConfig",
|
|
110023
|
+
value: function _defaultSelectConfig(selector, finalSelectSpec) {
|
|
110024
|
+
var isMultiple = "multiple" === finalSelectSpec.mode,
|
|
110025
|
+
triggerOff = isValid$3(finalSelectSpec.triggerOff) ? finalSelectSpec.triggerOff : isMultiple ? ["empty", "self"] : ["empty", finalSelectSpec.trigger];
|
|
110026
|
+
return {
|
|
110027
|
+
type: "element-select-by-graphic-name",
|
|
110028
|
+
seriesId: this.id,
|
|
110029
|
+
regionId: this._region.id,
|
|
110030
|
+
selector: selector,
|
|
110031
|
+
trigger: finalSelectSpec.trigger,
|
|
110032
|
+
triggerOff: triggerOff,
|
|
110033
|
+
reverseState: STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,
|
|
110034
|
+
state: STATE_VALUE_ENUM.STATE_SELECTED,
|
|
110035
|
+
isMultiple: isMultiple
|
|
110036
|
+
};
|
|
110037
|
+
}
|
|
110038
|
+
}, {
|
|
110039
|
+
key: "initMark",
|
|
110040
|
+
value: function initMark() {
|
|
110041
|
+
var _this3 = this;
|
|
110042
|
+
var _a;
|
|
110043
|
+
if (this._pictogramMark = this._createMark(PictogramSeries.mark.pictogram, {
|
|
110044
|
+
groupKey: this.getDimensionField()[0],
|
|
110045
|
+
isSeriesMark: !0,
|
|
110046
|
+
skipBeforeLayouted: !0,
|
|
110047
|
+
dataView: this._mapViewData.getDataView(),
|
|
110048
|
+
dataProductId: this._mapViewData.getProductId()
|
|
110049
|
+
}, {
|
|
110050
|
+
morph: shouldMarkDoMorph(this._spec, PictogramSeries.mark.pictogram.name)
|
|
110051
|
+
}), this._pictogramMark) {
|
|
110052
|
+
this._pictogramMark.setUserId(PictogramSeries.mark.pictogram.name);
|
|
110053
|
+
var _iterator = _createForOfIteratorHelper(this._mapViewData.getDataView().latestData),
|
|
110054
|
+
_step;
|
|
110055
|
+
try {
|
|
110056
|
+
var _loop = function _loop() {
|
|
110057
|
+
var element = _step.value;
|
|
110058
|
+
var type = element.graphicType,
|
|
110059
|
+
name = element.name,
|
|
110060
|
+
parent = element.parent,
|
|
110061
|
+
id = element.id,
|
|
110062
|
+
_nameFromParent = element._nameFromParent,
|
|
110063
|
+
_uniqueId = element._uniqueId,
|
|
110064
|
+
mark = _this3._createMark({
|
|
110065
|
+
type: type,
|
|
110066
|
+
name: null != name ? name : _nameFromParent
|
|
110067
|
+
}, {
|
|
110068
|
+
groupKey: _uniqueId,
|
|
110069
|
+
isSeriesMark: !1,
|
|
110070
|
+
skipBeforeLayouted: !0,
|
|
110071
|
+
dataView: _this3._mapViewData.getDataView(),
|
|
110072
|
+
dataProductId: _this3._mapViewData.getProductId(),
|
|
110073
|
+
parent: null !== (_a = _this3._pictogramMark.getMarkInUserId(null == parent ? void 0 : parent._uniqueId)) && void 0 !== _a ? _a : _this3._pictogramMark
|
|
110074
|
+
}, {
|
|
110075
|
+
morph: shouldMarkDoMorph(_this3._spec, PictogramSeries.mark.pictogram.name)
|
|
110076
|
+
});
|
|
110077
|
+
mark && (mark.setUserId(_uniqueId), "group" !== mark.type && mark.setMarkConfig({
|
|
110078
|
+
graphicName: mark.name
|
|
110079
|
+
}), mark.setTransform([{
|
|
110080
|
+
type: "filter",
|
|
110081
|
+
callback: function callback(datum) {
|
|
110082
|
+
return datum._uniqueId === _uniqueId;
|
|
110083
|
+
}
|
|
110084
|
+
}]));
|
|
110085
|
+
};
|
|
110086
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
110087
|
+
_loop();
|
|
110088
|
+
}
|
|
110089
|
+
} catch (err) {
|
|
110090
|
+
_iterator.e(err);
|
|
110091
|
+
} finally {
|
|
110092
|
+
_iterator.f();
|
|
110093
|
+
}
|
|
110094
|
+
this._initLabelMark();
|
|
110095
|
+
}
|
|
110096
|
+
}
|
|
110097
|
+
}, {
|
|
110098
|
+
key: "_initLabelMark",
|
|
110099
|
+
value: function _initLabelMark() {
|
|
110100
|
+
if (!0 !== this._spec.label.visible) return;
|
|
110101
|
+
var labelMark = this._createMark(PictogramSeries.mark.label, {
|
|
110102
|
+
isSeriesMark: !1,
|
|
110103
|
+
parent: this._pictogramMark,
|
|
110104
|
+
groupKey: "_uniqueId",
|
|
110105
|
+
skipBeforeLayouted: !0,
|
|
110106
|
+
depend: this.getMarksWithoutRoot()
|
|
110107
|
+
});
|
|
110108
|
+
labelMark && (this._labelMark = labelMark, this._labelMark.setDataView(this._mapViewData.getDataView()));
|
|
110109
|
+
}
|
|
110110
|
+
}, {
|
|
110111
|
+
key: "initLabelMarkStyle",
|
|
110112
|
+
value: function initLabelMarkStyle() {
|
|
110113
|
+
var _this4 = this;
|
|
110114
|
+
this._labelMark && this.setMarkStyle(this._labelMark, {
|
|
110115
|
+
visible: function visible(d) {
|
|
110116
|
+
return !!_this4._validElement(d);
|
|
110117
|
+
},
|
|
110118
|
+
x: function x(d) {
|
|
110119
|
+
var _a;
|
|
110120
|
+
return null === (_a = _this4.dataToPosition(d, !0)) || void 0 === _a ? void 0 : _a.x;
|
|
110121
|
+
},
|
|
110122
|
+
y: function y(d) {
|
|
110123
|
+
var _a;
|
|
110124
|
+
return null === (_a = _this4.dataToPosition(d, !0)) || void 0 === _a ? void 0 : _a.y;
|
|
110125
|
+
},
|
|
110126
|
+
text: function text(d) {
|
|
110127
|
+
return d[_this4.nameField];
|
|
110128
|
+
},
|
|
110129
|
+
textAlign: "center",
|
|
110130
|
+
textBaseline: "middle"
|
|
110131
|
+
}, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
|
|
110132
|
+
}
|
|
110133
|
+
}, {
|
|
110134
|
+
key: "initMarkStyle",
|
|
110135
|
+
value: function initMarkStyle() {
|
|
110136
|
+
var _this5 = this;
|
|
110137
|
+
var _this$_parsedSvgResul = this._parsedSvgResult,
|
|
110138
|
+
root = _this$_parsedSvgResul.root,
|
|
110139
|
+
viewBoxRect = _this$_parsedSvgResul.viewBoxRect,
|
|
110140
|
+
elements = this._mapViewData.getDataView().latestData;
|
|
110141
|
+
root && (this.setMarkStyle(this._pictogramMark, graphicAttributeTransform.group(root.attributes), "normal", AttributeLevel.Built_In), root.transform && this.setMarkStyle(this._pictogramMark, {
|
|
110142
|
+
postMatrix: function postMatrix() {
|
|
110143
|
+
return root.transform;
|
|
110144
|
+
}
|
|
110145
|
+
}, "normal", AttributeLevel.Built_In), viewBoxRect && this._pictogramMark.setMarkConfig({
|
|
110146
|
+
clip: !0,
|
|
110147
|
+
clipPath: [createRect(Object.assign(Object.assign({}, viewBoxRect), {
|
|
110148
|
+
fill: !0
|
|
110149
|
+
}))]
|
|
110150
|
+
}));
|
|
110151
|
+
var _iterator2 = _createForOfIteratorHelper(elements),
|
|
110152
|
+
_step2;
|
|
110153
|
+
try {
|
|
110154
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
110155
|
+
var element = _step2.value;
|
|
110156
|
+
var _uniqueId = element._uniqueId,
|
|
110157
|
+
attributes = element._finalAttributes,
|
|
110158
|
+
mark = this._pictogramMark.getMarkInUserId(_uniqueId),
|
|
110159
|
+
valid = this._validElement(element);
|
|
110160
|
+
mark && (this.setMarkStyle(mark, {
|
|
110161
|
+
keepStrokeScale: !0
|
|
110162
|
+
}, "normal", AttributeLevel.Built_In), valid ? (this.initMarkStyleWithSpec(mark, merge$2({}, this._spec.pictogram, this._spec[mark.name])), this.setMarkStyle(mark, attributes, "normal", AttributeLevel.Series), mark.setPostProcess("fill", function (result, datum) {
|
|
110163
|
+
return isValid$3(result) ? result : _this5._spec.defaultFillColor;
|
|
110164
|
+
})) : (mark.setMarkConfig({
|
|
110165
|
+
interactive: !1
|
|
110166
|
+
}), this.setMarkStyle(mark, attributes, "normal", AttributeLevel.Built_In)));
|
|
110167
|
+
}
|
|
110168
|
+
} catch (err) {
|
|
110169
|
+
_iterator2.e(err);
|
|
110170
|
+
} finally {
|
|
110171
|
+
_iterator2.f();
|
|
110172
|
+
}
|
|
110173
|
+
this.initLabelMarkStyle();
|
|
110174
|
+
}
|
|
110175
|
+
}, {
|
|
110176
|
+
key: "_validElement",
|
|
110177
|
+
value: function _validElement(element) {
|
|
110178
|
+
return element.name || element._nameFromParent;
|
|
110179
|
+
}
|
|
110180
|
+
}, {
|
|
110181
|
+
key: "initTooltip",
|
|
110182
|
+
value: function initTooltip() {
|
|
110183
|
+
var _this6 = this;
|
|
110184
|
+
this._tooltipHelper = new PictogramSeriesTooltipHelper(this), this.getMarksWithoutRoot().forEach(function (mark) {
|
|
110185
|
+
mark && mark.name && _this6._tooltipHelper.activeTriggerSet.mark.add(mark);
|
|
110186
|
+
});
|
|
110187
|
+
}
|
|
110188
|
+
}, {
|
|
110189
|
+
key: "dataToPosition",
|
|
110190
|
+
value: function dataToPosition(datum) {
|
|
110191
|
+
var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
110192
|
+
if (!datum) return null;
|
|
110193
|
+
var name = datum[this.nameField];
|
|
110194
|
+
if (!name) return null;
|
|
110195
|
+
var mark = this.getMarksWithoutRoot().filter(function (mark) {
|
|
110196
|
+
return mark.name === name;
|
|
110197
|
+
});
|
|
110198
|
+
if (!mark || 0 === mark.length) return null;
|
|
110199
|
+
var bounds = new Bounds$1();
|
|
110200
|
+
global ? mark.forEach(function (m) {
|
|
110201
|
+
bounds = bounds.union(m.getProduct().getGroupGraphicItem().globalAABBBounds);
|
|
110202
|
+
}) : mark.forEach(function (m) {
|
|
110203
|
+
bounds = bounds.union(m.getProduct().getBounds());
|
|
110204
|
+
});
|
|
110205
|
+
var point = {
|
|
110206
|
+
x: (bounds.x1 + bounds.x2) / 2,
|
|
110207
|
+
y: (bounds.y1 + bounds.y2) / 2
|
|
110208
|
+
};
|
|
110209
|
+
if (global) {
|
|
110210
|
+
var _this$getLayoutStartP = this.getLayoutStartPoint(),
|
|
110211
|
+
x = _this$getLayoutStartP.x,
|
|
110212
|
+
y = _this$getLayoutStartP.y;
|
|
110213
|
+
point.x -= x, point.y -= y;
|
|
110214
|
+
}
|
|
110215
|
+
return point;
|
|
110216
|
+
}
|
|
110217
|
+
}, {
|
|
110218
|
+
key: "coordToPosition",
|
|
110219
|
+
value: function coordToPosition(point) {
|
|
110220
|
+
if (!point) return null;
|
|
110221
|
+
var x = point.x,
|
|
110222
|
+
y = point.y,
|
|
110223
|
+
matrix = this.getRootMatrix();
|
|
110224
|
+
if (!matrix) return null;
|
|
110225
|
+
var position = {};
|
|
110226
|
+
return matrix.getInverse().transformPoint({
|
|
110227
|
+
x: x,
|
|
110228
|
+
y: y
|
|
110229
|
+
}, position), position;
|
|
110230
|
+
}
|
|
110231
|
+
}, {
|
|
110232
|
+
key: "getRootMatrix",
|
|
110233
|
+
value: function getRootMatrix() {
|
|
110234
|
+
var _a;
|
|
110235
|
+
return null === (_a = this.getPictogramRootGraphic()) || void 0 === _a ? void 0 : _a.transMatrix;
|
|
110236
|
+
}
|
|
110237
|
+
}, {
|
|
110238
|
+
key: "getPictogramRootGraphic",
|
|
110239
|
+
value: function getPictogramRootGraphic() {
|
|
110240
|
+
var _a;
|
|
110241
|
+
return null === (_a = this._pictogramMark.getProduct()) || void 0 === _a ? void 0 : _a.getGroupGraphicItem();
|
|
110242
|
+
}
|
|
110243
|
+
}, {
|
|
110244
|
+
key: "initData",
|
|
110245
|
+
value: function initData() {
|
|
110246
|
+
var _this7 = this;
|
|
110247
|
+
var _a, _b;
|
|
110248
|
+
_superPropGet(PictogramSeries, "initData", this, 3)([]);
|
|
110249
|
+
var parsedSvg = svgSourceMap.get(this.svg);
|
|
110250
|
+
parsedSvg || null === (_a = this._option) || void 0 === _a || _a.onError("no valid svg found!");
|
|
110251
|
+
var svgData = new DataView(this._dataSet, {
|
|
110252
|
+
name: "pictogram_".concat(this.id, "_data")
|
|
110253
|
+
});
|
|
110254
|
+
registerDataSetInstanceTransform(this._dataSet, "pictogram", pictogram), registerDataSetInstanceTransform(this._dataSet, "lookup", lookup), svgData.parse([parsedSvg], {
|
|
110255
|
+
type: "dataview"
|
|
110256
|
+
}).transform({
|
|
110257
|
+
type: "pictogram"
|
|
110258
|
+
}).transform({
|
|
110259
|
+
type: "lookup",
|
|
110260
|
+
options: {
|
|
110261
|
+
from: function from() {
|
|
110262
|
+
return _this7.getViewData().latestData;
|
|
110263
|
+
},
|
|
110264
|
+
key: "name",
|
|
110265
|
+
fields: this._nameField,
|
|
110266
|
+
set: function set(a, b) {
|
|
110267
|
+
b && (a.data = b);
|
|
110268
|
+
}
|
|
110269
|
+
}
|
|
110270
|
+
}).transform({
|
|
110271
|
+
type: "lookup",
|
|
110272
|
+
options: {
|
|
110273
|
+
from: function from() {
|
|
110274
|
+
return _this7.getViewData().latestData;
|
|
110275
|
+
},
|
|
110276
|
+
key: "_nameFromParent",
|
|
110277
|
+
fields: this._nameField,
|
|
110278
|
+
set: function set(a, b) {
|
|
110279
|
+
b && (a.data = b);
|
|
110280
|
+
}
|
|
110281
|
+
}
|
|
110282
|
+
}), null === (_b = this._data) || void 0 === _b || _b.getDataView().target.addListener("change", svgData.reRunAllTransform), this._mapViewData = new SeriesData(this._option, svgData);
|
|
110283
|
+
}
|
|
110284
|
+
}, {
|
|
110285
|
+
key: "mapViewDataUpdate",
|
|
110286
|
+
value: function mapViewDataUpdate() {
|
|
110287
|
+
this._mapViewData.updateData();
|
|
110288
|
+
}
|
|
110289
|
+
}, {
|
|
110290
|
+
key: "onLayoutEnd",
|
|
110291
|
+
value: function onLayoutEnd(ctx) {
|
|
110292
|
+
var _a;
|
|
110293
|
+
_superPropGet(PictogramSeries, "onLayoutEnd", this, 3)([ctx]), null === (_a = this._mapViewData) || void 0 === _a || _a.getDataView().reRunAllTransform();
|
|
110294
|
+
}
|
|
110295
|
+
}, {
|
|
110296
|
+
key: "updateSVGSize",
|
|
110297
|
+
value: function updateSVGSize() {
|
|
110298
|
+
var _this$getLayoutRect = this.getLayoutRect(),
|
|
110299
|
+
regionWidth = _this$getLayoutRect.width,
|
|
110300
|
+
regionHeight = _this$getLayoutRect.height,
|
|
110301
|
+
regionCenterX = regionWidth / 2,
|
|
110302
|
+
regionCenterY = regionHeight / 2,
|
|
110303
|
+
root = this.getPictogramRootGraphic();
|
|
110304
|
+
if (root) {
|
|
110305
|
+
var bounds = root.AABBBounds,
|
|
110306
|
+
_root$AABBBounds = root.AABBBounds,
|
|
110307
|
+
x1 = _root$AABBBounds.x1,
|
|
110308
|
+
x2 = _root$AABBBounds.x2,
|
|
110309
|
+
y1 = _root$AABBBounds.y1,
|
|
110310
|
+
y2 = _root$AABBBounds.y2,
|
|
110311
|
+
rootCenterX = (x1 + x2) / 2,
|
|
110312
|
+
rootCenterY = (y1 + y2) / 2,
|
|
110313
|
+
scaleX = regionWidth / bounds.width(),
|
|
110314
|
+
scaleY = regionHeight / bounds.height(),
|
|
110315
|
+
scale = Math.min(scaleX, scaleY);
|
|
110316
|
+
root.scale(scale, scale, {
|
|
110317
|
+
x: rootCenterX,
|
|
110318
|
+
y: rootCenterY
|
|
110319
|
+
}), root.translate(regionCenterX - rootCenterX, regionCenterY - rootCenterY);
|
|
110320
|
+
}
|
|
110321
|
+
}
|
|
110322
|
+
}, {
|
|
110323
|
+
key: "initEvent",
|
|
110324
|
+
value: function initEvent() {
|
|
110325
|
+
var _a;
|
|
110326
|
+
_superPropGet(PictogramSeries, "initEvent", this, 3)([]), null === (_a = this._mapViewData.getDataView()) || void 0 === _a || _a.target.addListener("change", this.mapViewDataUpdate.bind(this)), this.event.on(HOOK_EVENT.AFTER_MARK_LAYOUT_END, this.updateSVGSize.bind(this));
|
|
110327
|
+
}
|
|
110328
|
+
}, {
|
|
110329
|
+
key: "handleZoom",
|
|
110330
|
+
value: function handleZoom(e) {
|
|
110331
|
+
var scale = e.scale,
|
|
110332
|
+
scaleCenter = e.scaleCenter;
|
|
110333
|
+
if (1 === scale) return;
|
|
110334
|
+
var root = this.getPictogramRootGraphic();
|
|
110335
|
+
root && (root.attribute.postMatrix || root.setAttributes({
|
|
110336
|
+
postMatrix: new Matrix()
|
|
110337
|
+
}), root.scale(scale, scale, scaleCenter));
|
|
110338
|
+
}
|
|
110339
|
+
}, {
|
|
110340
|
+
key: "handlePan",
|
|
110341
|
+
value: function handlePan(e) {
|
|
110342
|
+
var delta = e.delta;
|
|
110343
|
+
if (0 === delta[0] && 0 === delta[1]) return;
|
|
110344
|
+
var root = this.getPictogramRootGraphic();
|
|
110345
|
+
root && (root.attribute.postMatrix || root.setAttributes({
|
|
110346
|
+
postMatrix: new Matrix()
|
|
110347
|
+
}), root.translate(delta[0], delta[1]));
|
|
110348
|
+
}
|
|
110349
|
+
}, {
|
|
110350
|
+
key: "getMarkData",
|
|
110351
|
+
value: function getMarkData(datum) {
|
|
110352
|
+
var _a;
|
|
110353
|
+
return null !== (_a = datum.data) && void 0 !== _a ? _a : {};
|
|
110354
|
+
}
|
|
110355
|
+
}, {
|
|
110356
|
+
key: "getMeasureField",
|
|
110357
|
+
value: function getMeasureField() {
|
|
110358
|
+
return [this.valueField];
|
|
110359
|
+
}
|
|
110360
|
+
}, {
|
|
110361
|
+
key: "getDimensionField",
|
|
110362
|
+
value: function getDimensionField() {
|
|
110363
|
+
return [this.nameField];
|
|
110364
|
+
}
|
|
110365
|
+
}, {
|
|
110366
|
+
key: "_getSeriesInfo",
|
|
110367
|
+
value: function _getSeriesInfo(field, keys) {
|
|
110368
|
+
var _this8 = this;
|
|
110369
|
+
var defaultShapeType = this.getDefaultShapeType();
|
|
110370
|
+
return keys.map(function (key) {
|
|
110371
|
+
return {
|
|
110372
|
+
key: key,
|
|
110373
|
+
originalKey: key,
|
|
110374
|
+
style: _this8.getSeriesStyle({
|
|
110375
|
+
data: _defineProperty({}, field, key)
|
|
110376
|
+
}),
|
|
110377
|
+
shapeType: defaultShapeType
|
|
110378
|
+
};
|
|
110379
|
+
});
|
|
110380
|
+
}
|
|
110381
|
+
}]);
|
|
110382
|
+
}(GeoSeries);
|
|
110383
|
+
PictogramSeries.type = SeriesTypeEnum.pictogram, PictogramSeries.mark = PictogramSeriesMark, PictogramSeries.transformerConstructor = PictogramSeriesSpecTransformer;
|
|
110384
|
+
var registerPictogramSeries = function registerPictogramSeries() {
|
|
110385
|
+
Factory$1.registerSeries(PictogramSeries.type, PictogramSeries), Factory$1.registerImplement("registerSVG", registerSVGSource), Factory$1.registerImplement("unregisterSVG", unregisterSVGSource), registerElementHighlightByGraphicName(), registerElementSelectByGraphicName();
|
|
110386
|
+
};
|
|
110387
|
+
|
|
110388
|
+
var PictogramChart = /*#__PURE__*/function (_BaseChart) {
|
|
110389
|
+
function PictogramChart() {
|
|
110390
|
+
var _this;
|
|
110391
|
+
_classCallCheck(this, PictogramChart);
|
|
110392
|
+
_this = _callSuper(this, PictogramChart, arguments), _this.transformerConstructor = PictogramChartSpecTransformer, _this.type = "pictogram", _this.seriesType = SeriesTypeEnum.pictogram;
|
|
110393
|
+
return _this;
|
|
110394
|
+
}
|
|
110395
|
+
_inherits(PictogramChart, _BaseChart);
|
|
110396
|
+
return _createClass(PictogramChart);
|
|
110397
|
+
}(BaseChart);
|
|
110398
|
+
PictogramChart.type = "pictogram", PictogramChart.seriesType = SeriesTypeEnum.pictogram, PictogramChart.transformerConstructor = PictogramChartSpecTransformer;
|
|
110399
|
+
var registerPictogramChart = function registerPictogramChart() {
|
|
110400
|
+
registerPictogramSeries(), Factory$1.registerChart(PictogramChart.type, PictogramChart);
|
|
110401
|
+
};
|
|
110402
|
+
|
|
109431
110403
|
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
109432
110404
|
var t = {};
|
|
109433
110405
|
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
@@ -110823,7 +111795,7 @@
|
|
|
110823
111795
|
}(CharacterChart);
|
|
110824
111796
|
VChartCharacter.type = "VChart";
|
|
110825
111797
|
var registerAllVChart = function registerAllVChart() {
|
|
110826
|
-
registerVennChart(), registerLiquidChart(), registerMosaicChart();
|
|
111798
|
+
registerVennChart(), registerLiquidChart(), registerMosaicChart(), registerPictogramChart();
|
|
110827
111799
|
};
|
|
110828
111800
|
|
|
110829
111801
|
var WaveAnimate = /*#__PURE__*/function (_ACustomAnimate) {
|
|
@@ -111619,7 +112591,10 @@
|
|
|
111619
112591
|
key: "transformTextAttrsToRichTextConfig",
|
|
111620
112592
|
value: function transformTextAttrsToRichTextConfig(textStyle, align) {
|
|
111621
112593
|
var textConfig = textStyle.textConfig;
|
|
111622
|
-
if (
|
|
112594
|
+
if (textConfig && textConfig.length || !textStyle.text) textConfig && textConfig.length && textConfig.forEach(function (item) {
|
|
112595
|
+
var _a;
|
|
112596
|
+
item.textAlign = align, item.lineHeight = null !== (_a = item.lineHeight) && void 0 !== _a ? _a : textStyle.lineHeight;
|
|
112597
|
+
});else {
|
|
111623
112598
|
var textList = Array.isArray(textStyle.text) ? textStyle.text : [textStyle.text];
|
|
111624
112599
|
textConfig = textList.map(function (item, i) {
|
|
111625
112600
|
return {
|