3838 else if (typeof document === 'undefined' && typeof self !== 'undefined') {
3939 env.worker = true;
4040 }
41- else if (typeof navigator === 'undefined'
42- || navigator.userAgent.indexOf('Node.js') === 0) {
41+ else if (!env.hasGlobalWindow || 'Deno' in window) {
4342 env.node = true;
4443 env.svgSupported = true;
4544 }
293292 }
294293 function defaults(target, source, overlay) {
295294 var keysArr = keys(source);
296- for (var i = 0; i < keysArr.length; i++) {
295+ for (var i = 0, len = keysArr.length; i < len ; i++) {
297296 var key = keysArr[i];
298297 if ((overlay ? source[key] != null : target[key] == null)) {
299298 target[key] = source[key];
369368 }
370369 else {
371370 for (var key in arr) {
372- if (arr.hasOwnProperty(key)) {
371+ if (arr.hasOwnProperty(key) && key !== protoKey ) {
373372 cb.call(context, arr[key], key, arr);
374373 }
375374 }
437436 return [];
438437 }
439438 if (Object.keys) {
440- return Object.keys(obj);
439+ return filter( Object.keys(obj), function (key) { return key !== protoKey; } );
441440 }
442441 var keyList = [];
443442 for (var key in obj) {
444- if (obj.hasOwnProperty(key)) {
443+ if (obj.hasOwnProperty(key) && key !== protoKey ) {
445444 keyList.push(key);
446445 }
447446 }
73387337 function registerSSRDataGetter(getter) {
73397338 ssrDataGetter = getter;
73407339 }
7341- var version = '5.6.0 ';
7340+ var version = '5.6.1 ';
73427341
73437342 var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
73447343 var DEFAULT_COMMON_STYLE = {
@@ -12552,16 +12551,23 @@
1255212551 }
1255312552
1255412553 var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
12555- function truncateText( text, containerWidth, font, ellipsis, options) {
12554+ function truncateText2(out, text, containerWidth, font, ellipsis, options) {
1255612555 if (!containerWidth) {
12557- return '';
12556+ out.text = '';
12557+ out.isTruncated = false;
12558+ return;
1255812559 }
1255912560 var textLines = (text + '').split('\n');
1256012561 options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
12562+ var isTruncated = false;
12563+ var truncateOut = {};
1256112564 for (var i = 0, len = textLines.length; i < len; i++) {
12562- textLines[i] = truncateSingleLine(textLines[i], options);
12565+ truncateSingleLine(truncateOut, textLines[i], options);
12566+ textLines[i] = truncateOut.textLine;
12567+ isTruncated = isTruncated || truncateOut.isTruncated;
1256312568 }
12564- return textLines.join('\n');
12569+ out.text = textLines.join('\n');
12570+ out.isTruncated = isTruncated;
1256512571 }
1256612572 function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
1256712573 options = options || {};
@@ -12589,16 +12595,20 @@
1258912595 preparedOpts.containerWidth = containerWidth;
1259012596 return preparedOpts;
1259112597 }
12592- function truncateSingleLine(textLine, options) {
12598+ function truncateSingleLine(out, textLine, options) {
1259312599 var containerWidth = options.containerWidth;
1259412600 var font = options.font;
1259512601 var contentWidth = options.contentWidth;
1259612602 if (!containerWidth) {
12597- return '';
12603+ out.textLine = '';
12604+ out.isTruncated = false;
12605+ return;
1259812606 }
1259912607 var lineWidth = getWidth(textLine, font);
1260012608 if (lineWidth <= containerWidth) {
12601- return textLine;
12609+ out.textLine = textLine;
12610+ out.isTruncated = false;
12611+ return;
1260212612 }
1260312613 for (var j = 0;; j++) {
1260412614 if (lineWidth <= contentWidth || j >= options.maxIterations) {
1261612626 if (textLine === '') {
1261712627 textLine = options.placeholder;
1261812628 }
12619- return textLine;
12629+ out.textLine = textLine;
12630+ out.isTruncated = true;
1262012631 }
1262112632 function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {
1262212633 var width = 0;
1263712648 var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
1263812649 var bgColorDrawn = !!(style.backgroundColor);
1263912650 var truncateLineOverflow = style.lineOverflow === 'truncate';
12651+ var isTruncated = false;
1264012652 var width = style.width;
1264112653 var lines;
1264212654 if (width != null && (overflow === 'break' || overflow === 'breakAll')) {
@@ -12649,15 +12661,19 @@
1264912661 var height = retrieve2(style.height, contentHeight);
1265012662 if (contentHeight > height && truncateLineOverflow) {
1265112663 var lineCount = Math.floor(height / lineHeight);
12664+ isTruncated = isTruncated || (lines.length > lineCount);
1265212665 lines = lines.slice(0, lineCount);
1265312666 }
1265412667 if (text && truncate && width != null) {
1265512668 var options = prepareTruncateOptions(width, font, style.ellipsis, {
1265612669 minChar: style.truncateMinChar,
1265712670 placeholder: style.placeholder
1265812671 });
12672+ var singleOut = {};
1265912673 for (var i = 0; i < lines.length; i++) {
12660- lines[i] = truncateSingleLine(lines[i], options);
12674+ truncateSingleLine(singleOut, lines[i], options);
12675+ lines[i] = singleOut.textLine;
12676+ isTruncated = isTruncated || singleOut.isTruncated;
1266112677 }
1266212678 }
1266312679 var outerHeight = height;
1268612702 calculatedLineHeight: calculatedLineHeight,
1268712703 contentWidth: contentWidth,
1268812704 contentHeight: contentHeight,
12689- width: width
12705+ width: width,
12706+ isTruncated: isTruncated
1269012707 };
1269112708 }
1269212709 var RichTextToken = (function () {
1271212729 this.outerWidth = 0;
1271312730 this.outerHeight = 0;
1271412731 this.lines = [];
12732+ this.isTruncated = false;
1271512733 }
1271612734 return RichTextContentBlock;
1271712735 }());
1274612764 var stlPadding = style.padding;
1274712765 var truncate = overflow === 'truncate';
1274812766 var truncateLine = style.lineOverflow === 'truncate';
12767+ var tmpTruncateOut = {};
1274912768 function finishLine(line, lineWidth, lineHeight) {
1275012769 line.width = lineWidth;
1275112770 line.lineHeight = lineHeight;
1277112790 token.align = tokenStyle && tokenStyle.align || style.align;
1277212791 token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';
1277312792 if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
12793+ var originalLength = contentBlock.lines.length;
1277412794 if (j > 0) {
1277512795 line.tokens = line.tokens.slice(0, j);
1277612796 finishLine(line, lineWidth, lineHeight);
1277912799 else {
1278012800 contentBlock.lines = contentBlock.lines.slice(0, i);
1278112801 }
12802+ contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);
1278212803 break outer;
1278312804 }
1278412805 var styleTokenWidth = tokenStyle.width;
1280712828 token.width = token.contentWidth = 0;
1280812829 }
1280912830 else {
12810- token.text = truncateText(token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
12831+ truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
12832+ token.text = tmpTruncateOut.text;
12833+ contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
1281112834 token.width = token.contentWidth = getWidth(token.text, font);
1281212835 }
1281312836 }
1320413227 var textLines = contentBlock.lines;
1320513228 var lineHeight = contentBlock.lineHeight;
1320613229 var defaultStyle = this._defaultStyle;
13230+ this.isTruncated = !!contentBlock.isTruncated;
1320713231 var baseX = style.x || 0;
1320813232 var baseY = style.y || 0;
1320913233 var textAlign = style.align || defaultStyle.align || 'left';
1327013294 setSeparateFont(subElStyle, style);
1327113295 textY += lineHeight;
1327213296 if (fixedBoundingRect) {
13273- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, style.width , subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
13297+ el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth , subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
1327413298 }
1327513299 }
1327613300 };
1328713311 var defaultStyle = this._defaultStyle;
1328813312 var textAlign = style.align || defaultStyle.align;
1328913313 var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
13314+ this.isTruncated = !!contentBlock.isTruncated;
1329013315 var boxX = adjustTextX(baseX, outerWidth, textAlign);
1329113316 var boxY = adjustTextY$1(baseY, outerHeight, verticalAlign);
1329213317 var xLeft = boxX;
@@ -16416,12 +16441,12 @@
1641616441 else if (isFillStroke && isPattern(val)) {
1641716442 setPattern(el, attrs, key, scope);
1641816443 }
16419- else if (isFillStroke && val === 'none') {
16420- attrs[key] = 'transparent';
16421- }
1642216444 else {
1642316445 attrs[key] = val;
1642416446 }
16447+ if (isFillStroke && scope.ssr && val === 'none') {
16448+ attrs['pointer-events'] = 'visible';
16449+ }
1642516450 }, style, el, false);
1642616451 setShadow(el, attrs, scope);
1642716452 }
1720017225 scope.willUpdate = opts.willUpdate;
1720117226 scope.compress = opts.compress;
1720217227 scope.emphasis = opts.emphasis;
17228+ scope.ssr = this._opts.ssr;
1720317229 var children = [];
1720417230 var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
1720517231 bgVNode && children.push(bgVNode);
0 commit comments