|
176 | 176 | else {
|
177 | 177 | text = text || '';
|
178 | 178 | font = font || DEFAULT_FONT;
|
179 |
| - var res = /(\d+)px/.exec(font); |
| 179 | + var res = /((?:\d+)?\.?\d*)px/.exec(font); |
180 | 180 | var fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
|
181 | 181 | var width = 0;
|
182 | 182 | if (font.indexOf('mono') >= 0) {
|
|
7370 | 7370 | function registerSSRDataGetter(getter) {
|
7371 | 7371 | ssrDataGetter = getter;
|
7372 | 7372 | }
|
7373 |
| - var version = '5.5.0'; |
| 7373 | + var version = '5.6.0'; |
7374 | 7374 |
|
7375 | 7375 | var zrender = /*#__PURE__*/Object.freeze({
|
7376 | 7376 | __proto__: null,
|
|
14837 | 14837 | name: itemName,
|
14838 | 14838 | option: defaults({
|
14839 | 14839 | content: itemName,
|
| 14840 | + encodeHTMLContent: true, |
14840 | 14841 | formatterParams: formatterParams
|
14841 | 14842 | }, itemTooltipOptionObj)
|
14842 | 14843 | };
|
@@ -16102,13 +16103,15 @@
|
16102 | 16103 | var m = date[minutesGetterName(isUTC)]();
|
16103 | 16104 | var s = date[secondsGetterName(isUTC)]();
|
16104 | 16105 | var S = date[millisecondsGetterName(isUTC)]();
|
| 16106 | + var a = H >= 12 ? 'pm' : 'am'; |
| 16107 | + var A = a.toUpperCase(); |
16105 | 16108 | var localeModel = lang instanceof Model ? lang : getLocaleModel(lang || SYSTEM_LANG) || getDefaultLocaleModel();
|
16106 | 16109 | var timeModel = localeModel.getModel('time');
|
16107 | 16110 | var month = timeModel.get('month');
|
16108 | 16111 | var monthAbbr = timeModel.get('monthAbbr');
|
16109 | 16112 | var dayOfWeek = timeModel.get('dayOfWeek');
|
16110 | 16113 | var dayOfWeekAbbr = timeModel.get('dayOfWeekAbbr');
|
16111 |
| - return (template || '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, pad(y % 100 + '', 2)).replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + ''); |
| 16114 | + return (template || '').replace(/{a}/g, a + '').replace(/{A}/g, A + '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, pad(y % 100 + '', 2)).replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + ''); |
16112 | 16115 | }
|
16113 | 16116 | function leveledFormat(tick, idx, formatter, lang, isUTC) {
|
16114 | 16117 | var template = null;
|
|
17443 | 17446 | function detectValue(val) {
|
17444 | 17447 | var beStr = isString(val);
|
17445 | 17448 | // Consider usage convenience, '1', '2' will be treated as "number".
|
17446 |
| - // `isFinit('')` get `true`. |
17447 |
| - if (val != null && isFinite(val) && val !== '') { |
| 17449 | + // `Number('')` (or any whitespace) is `0`. |
| 17450 | + if (val != null && Number.isFinite(Number(val)) && val !== '') { |
17448 | 17451 | return beStr ? BE_ORDINAL.Might : BE_ORDINAL.Not;
|
17449 | 17452 | } else if (beStr && val !== '-') {
|
17450 | 17453 | return BE_ORDINAL.Must;
|
|
20203 | 20206 | return value == null || value === '' ? NaN
|
20204 | 20207 | // If string (like '-'), using '+' parse to NaN
|
20205 | 20208 | // If object, also parse to NaN
|
20206 |
| - : +value; |
| 20209 | + : Number(value); |
20207 | 20210 | }
|
20208 | 20211 | var valueParserMap = createHashMap({
|
20209 | 20212 | 'number': function (val) {
|
|
22463 | 22466 | var task = getCurrentTask(this);
|
22464 | 22467 | if (task) {
|
22465 | 22468 | var data = task.context.data;
|
22466 |
| - return dataType == null ? data : data.getLinkedData(dataType); |
| 22469 | + return dataType == null || !data.getLinkedData ? data : data.getLinkedData(dataType); |
22467 | 22470 | } else {
|
22468 | 22471 | // When series is not alive (that may happen when click toolbox
|
22469 | 22472 | // restore or setOption with not merge mode), series data may
|
|
25937 | 25940 | return implsStore[name];
|
25938 | 25941 | }
|
25939 | 25942 |
|
25940 |
| - var version$1 = '5.5.0'; |
| 25943 | + var version$1 = '5.5.1'; |
25941 | 25944 | var dependencies = {
|
25942 |
| - zrender: '5.5.0' |
| 25945 | + zrender: '5.6.0' |
25943 | 25946 | };
|
25944 | 25947 | var TEST_FRAME_REMAIN_TIME = 1;
|
25945 | 25948 | var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
|
@@ -31280,11 +31283,11 @@
|
31280 | 31283 | var value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);
|
31281 | 31284 | var baseValue = store.get(baseDimIdx, dataIndex);
|
31282 | 31285 | var baseCoord = valueAxisStart;
|
31283 |
| - var startValue = void 0; |
| 31286 | + var stackStartValue = void 0; |
31284 | 31287 | // Because of the barMinHeight, we can not use the value in
|
31285 | 31288 | // stackResultDimension directly.
|
31286 | 31289 | if (stacked) {
|
31287 |
| - startValue = +value - store.get(valueDimIdx, dataIndex); |
| 31290 | + stackStartValue = +value - store.get(valueDimIdx, dataIndex); |
31288 | 31291 | }
|
31289 | 31292 | var x = void 0;
|
31290 | 31293 | var y = void 0;
|
|
31293 | 31296 | if (isValueAxisH) {
|
31294 | 31297 | var coord = cartesian.dataToPoint([value, baseValue]);
|
31295 | 31298 | if (stacked) {
|
31296 |
| - var startCoord = cartesian.dataToPoint([startValue, baseValue]); |
| 31299 | + var startCoord = cartesian.dataToPoint([stackStartValue, baseValue]); |
31297 | 31300 | baseCoord = startCoord[0];
|
31298 | 31301 | }
|
31299 | 31302 | x = baseCoord;
|
|
31306 | 31309 | } else {
|
31307 | 31310 | var coord = cartesian.dataToPoint([baseValue, value]);
|
31308 | 31311 | if (stacked) {
|
31309 |
| - var startCoord = cartesian.dataToPoint([baseValue, startValue]); |
| 31312 | + var startCoord = cartesian.dataToPoint([baseValue, stackStartValue]); |
31310 | 31313 | baseCoord = startCoord[1];
|
31311 | 31314 | }
|
31312 | 31315 | x = coord[0] + columnOffset;
|
|
31359 | 31362 | }
|
31360 | 31363 | // See cases in `test/bar-start.html` and `#7412`, `#8747`.
|
31361 | 31364 | function getValueAxisStart(baseAxis, valueAxis) {
|
31362 |
| - return valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.type === 'log' ? 1 : 0)); |
| 31365 | + var startValue = valueAxis.model.get('startValue'); |
| 31366 | + if (!startValue) { |
| 31367 | + startValue = 0; |
| 31368 | + } |
| 31369 | + return valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.type === 'log' ? startValue > 0 ? startValue : 1 : startValue)); |
31363 | 31370 | }
|
31364 | 31371 |
|
31365 | 31372 | // FIXME 公用?
|
|
31951 | 31958 | this._dataMax = dataExtent[1];
|
31952 | 31959 | var isOrdinal = this._isOrdinal = scale.type === 'ordinal';
|
31953 | 31960 | this._needCrossZero = scale.type === 'interval' && model.getNeedCrossZero && model.getNeedCrossZero();
|
31954 |
| - var modelMinRaw = this._modelMinRaw = model.get('min', true); |
| 31961 | + var axisMinValue = model.get('min', true); |
| 31962 | + if (axisMinValue == null) { |
| 31963 | + axisMinValue = model.get('startValue', true); |
| 31964 | + } |
| 31965 | + var modelMinRaw = this._modelMinRaw = axisMinValue; |
31955 | 31966 | if (isFunction(modelMinRaw)) {
|
31956 | 31967 | // This callback always provides users the full data extent (before data is filtered).
|
31957 | 31968 | this._modelMinNum = parseAxisModelMinMax(scale, modelMinRaw({
|
|
33002 | 33013 | });
|
33003 | 33014 |
|
33004 | 33015 | var inner$5 = makeInner();
|
| 33016 | + function tickValuesToNumbers(axis, values) { |
| 33017 | + var nums = map(values, function (val) { |
| 33018 | + return axis.scale.parse(val); |
| 33019 | + }); |
| 33020 | + if (axis.type === 'time' && nums.length > 0) { |
| 33021 | + // Time axis needs duplicate first/last tick (see TimeScale.getTicks()) |
| 33022 | + // The first and last tick/label don't get drawn |
| 33023 | + nums.sort(); |
| 33024 | + nums.unshift(nums[0]); |
| 33025 | + nums.push(nums[nums.length - 1]); |
| 33026 | + } |
| 33027 | + return nums; |
| 33028 | + } |
33005 | 33029 | function createAxisLabels(axis) {
|
| 33030 | + var custom = axis.getLabelModel().get('customValues'); |
| 33031 | + if (custom) { |
| 33032 | + var labelFormatter_1 = makeLabelFormatter(axis); |
| 33033 | + return { |
| 33034 | + labels: tickValuesToNumbers(axis, custom).map(function (numval) { |
| 33035 | + var tick = { |
| 33036 | + value: numval |
| 33037 | + }; |
| 33038 | + return { |
| 33039 | + formattedLabel: labelFormatter_1(tick), |
| 33040 | + rawLabel: axis.scale.getLabel(tick), |
| 33041 | + tickValue: numval |
| 33042 | + }; |
| 33043 | + }) |
| 33044 | + }; |
| 33045 | + } |
33006 | 33046 | // Only ordinal scale support tick interval
|
33007 | 33047 | return axis.type === 'category' ? makeCategoryLabels(axis) : makeRealNumberLabels(axis);
|
33008 | 33048 | }
|
|
33015 | 33055 | * }
|
33016 | 33056 | */
|
33017 | 33057 | function createAxisTicks(axis, tickModel) {
|
| 33058 | + var custom = axis.getTickModel().get('customValues'); |
| 33059 | + if (custom) { |
| 33060 | + return { |
| 33061 | + ticks: tickValuesToNumbers(axis, custom) |
| 33062 | + }; |
| 33063 | + } |
33018 | 33064 | // Only ordinal scale support tick interval
|
33019 | 33065 | return axis.type === 'category' ? makeCategoryTicks(axis, tickModel) : {
|
33020 | 33066 | ticks: map(axis.scale.getTicks(), function (tick) {
|
|
40359 | 40405 | var halfPadAngle = dir * padAngle / 2;
|
40360 | 40406 | normalizeArcAngles(angles, !clockwise);
|
40361 | 40407 | startAngle = angles[0], endAngle = angles[1];
|
| 40408 | + var layoutData = getSeriesLayoutData(seriesModel); |
| 40409 | + layoutData.startAngle = startAngle; |
| 40410 | + layoutData.endAngle = endAngle; |
| 40411 | + layoutData.clockwise = clockwise; |
40362 | 40412 | var angleRange = Math.abs(endAngle - startAngle);
|
40363 | 40413 | // In the case some sector angle is smaller than minAngle
|
40364 | 40414 | var restAngle = angleRange;
|
|
40467 | 40517 | }
|
40468 | 40518 | });
|
40469 | 40519 | }
|
| 40520 | + var getSeriesLayoutData = makeInner(); |
40470 | 40521 |
|
40471 | 40522 | /*
|
40472 | 40523 | * Licensed to the Apache Software Foundation (ASF) under one
|
|
41147 | 41198 | }
|
41148 | 41199 | // when all data are filtered, show lightgray empty circle
|
41149 | 41200 | if (data.count() === 0 && seriesModel.get('showEmptyCircle')) {
|
| 41201 | + var layoutData = getSeriesLayoutData(seriesModel); |
41150 | 41202 | var sector = new Sector({
|
41151 |
| - shape: getBasicPieLayout(seriesModel, api) |
| 41203 | + shape: extend(getBasicPieLayout(seriesModel, api), layoutData) |
41152 | 41204 | });
|
41153 | 41205 | sector.useStyle(seriesModel.getModel('emptyCircleStyle').getItemStyle());
|
41154 | 41206 | this._emptyCircleSector = sector;
|
|
47990 | 48042 | return featureName.indexOf('my') === 0;
|
47991 | 48043 | }
|
47992 | 48044 |
|
47993 |
| - /* global window, document */ |
47994 | 48045 | var SaveAsImage = /** @class */function (_super) {
|
47995 | 48046 | __extends(SaveAsImage, _super);
|
47996 | 48047 | function SaveAsImage() {
|
|
48010 | 48061 | });
|
48011 | 48062 | var browser = env.browser;
|
48012 | 48063 | // Chrome, Firefox, New Edge
|
48013 |
| - if (isFunction(MouseEvent) && (browser.newEdge || !browser.ie && !browser.edge)) { |
| 48064 | + if (typeof MouseEvent === 'function' && (browser.newEdge || !browser.ie && !browser.edge)) { |
48014 | 48065 | var $a = document.createElement('a');
|
48015 | 48066 | $a.download = title + '.' + type;
|
48016 | 48067 | $a.target = '_blank';
|
@@ -51105,16 +51156,27 @@
|
51105 | 51156 | });
|
51106 | 51157 | };
|
51107 | 51158 | TooltipView.prototype._showComponentItemTooltip = function (e, el, dispatchAction) {
|
| 51159 | + var isHTMLRenderMode = this._renderMode === 'html'; |
51108 | 51160 | var ecData = getECData(el);
|
51109 | 51161 | var tooltipConfig = ecData.tooltipConfig;
|
51110 | 51162 | var tooltipOpt = tooltipConfig.option || {};
|
| 51163 | + var encodeHTMLContent = tooltipOpt.encodeHTMLContent; |
51111 | 51164 | if (isString(tooltipOpt)) {
|
51112 | 51165 | var content = tooltipOpt;
|
51113 | 51166 | tooltipOpt = {
|
51114 | 51167 | content: content,
|
51115 | 51168 | // Fixed formatter
|
51116 | 51169 | formatter: content
|
51117 | 51170 | };
|
| 51171 | + // when `tooltipConfig.option` is a string rather than an object, |
| 51172 | + // we can't know if the content needs to be encoded |
| 51173 | + // for the sake of security, encode it by default. |
| 51174 | + encodeHTMLContent = true; |
| 51175 | + } |
| 51176 | + if (encodeHTMLContent && isHTMLRenderMode && tooltipOpt.content) { |
| 51177 | + // clone might be unnecessary? |
| 51178 | + tooltipOpt = clone(tooltipOpt); |
| 51179 | + tooltipOpt.content = encodeHTML(tooltipOpt.content); |
51118 | 51180 | }
|
51119 | 51181 | var tooltipModelCascade = [tooltipOpt];
|
51120 | 51182 | var cmpt = this._ecModel.getComponent(ecData.componentMainType, ecData.componentIndex);
|
|
51787 | 51849 | MarkerModel.prototype.setData = function (data) {
|
51788 | 51850 | this._data = data;
|
51789 | 51851 | };
|
| 51852 | + MarkerModel.prototype.getDataParams = function (dataIndex, dataType) { |
| 51853 | + var params = DataFormatMixin.prototype.getDataParams.call(this, dataIndex, dataType); |
| 51854 | + var hostSeries = this.__hostSeries; |
| 51855 | + if (hostSeries) { |
| 51856 | + params.seriesId = hostSeries.id; |
| 51857 | + params.seriesName = hostSeries.name; |
| 51858 | + params.seriesType = hostSeries.subType; |
| 51859 | + } |
| 51860 | + return params; |
| 51861 | + }; |
51790 | 51862 | MarkerModel.getMarkerModelFromSeries = function (seriesModel,
|
51791 | 51863 | // Support three types of markers. Strict check.
|
51792 | 51864 | componentType) {
|
@@ -56267,13 +56339,17 @@
|
56267 | 56339 | }
|
56268 | 56340 | }
|
56269 | 56341 | function setLabel() {
|
| 56342 | + var dom = api.getZr().dom; |
| 56343 | + // TODO: support for SSR |
| 56344 | + if (!dom) { |
| 56345 | + return; |
| 56346 | + } |
56270 | 56347 | var labelLocale = ecModel.getLocaleModel().get('aria');
|
56271 | 56348 | var labelModel = ariaModel.getModel('label');
|
56272 | 56349 | labelModel.option = defaults(labelModel.option, labelLocale);
|
56273 | 56350 | if (!labelModel.get('enabled')) {
|
56274 | 56351 | return;
|
56275 | 56352 | }
|
56276 |
| - var dom = api.getZr().dom; |
56277 | 56353 | if (labelModel.get('description')) {
|
56278 | 56354 | dom.setAttribute('aria-label', labelModel.get('description'));
|
56279 | 56355 | return;
|
|
0 commit comments