push the uni-demo project
This commit is contained in:
84
uni-demo/node_modules/echarts/lib/core/CoordinateSystem.js
generated
vendored
Normal file
84
uni-demo/node_modules/echarts/lib/core/CoordinateSystem.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
var coordinateSystemCreators = {};
|
||||
|
||||
var CoordinateSystemManager =
|
||||
/** @class */
|
||||
function () {
|
||||
function CoordinateSystemManager() {
|
||||
this._coordinateSystems = [];
|
||||
}
|
||||
|
||||
CoordinateSystemManager.prototype.create = function (ecModel, api) {
|
||||
var coordinateSystems = [];
|
||||
zrUtil.each(coordinateSystemCreators, function (creater, type) {
|
||||
var list = creater.create(ecModel, api);
|
||||
coordinateSystems = coordinateSystems.concat(list || []);
|
||||
});
|
||||
this._coordinateSystems = coordinateSystems;
|
||||
};
|
||||
|
||||
CoordinateSystemManager.prototype.update = function (ecModel, api) {
|
||||
zrUtil.each(this._coordinateSystems, function (coordSys) {
|
||||
coordSys.update && coordSys.update(ecModel, api);
|
||||
});
|
||||
};
|
||||
|
||||
CoordinateSystemManager.prototype.getCoordinateSystems = function () {
|
||||
return this._coordinateSystems.slice();
|
||||
};
|
||||
|
||||
CoordinateSystemManager.register = function (type, creator) {
|
||||
coordinateSystemCreators[type] = creator;
|
||||
};
|
||||
|
||||
CoordinateSystemManager.get = function (type) {
|
||||
return coordinateSystemCreators[type];
|
||||
};
|
||||
|
||||
return CoordinateSystemManager;
|
||||
}();
|
||||
|
||||
export default CoordinateSystemManager;
|
||||
62
uni-demo/node_modules/echarts/lib/core/ExtensionAPI.js
generated
vendored
Normal file
62
uni-demo/node_modules/echarts/lib/core/ExtensionAPI.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
var availableMethods = ['getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isSSR', 'isDisposed', 'on', 'off', 'getDataURL', 'getConnectedDataURL', // 'getModel',
|
||||
'getOption', // 'getViewOfComponentModel',
|
||||
// 'getViewOfSeriesModel',
|
||||
'getId', 'updateLabelLayout'];
|
||||
|
||||
var ExtensionAPI =
|
||||
/** @class */
|
||||
function () {
|
||||
function ExtensionAPI(ecInstance) {
|
||||
zrUtil.each(availableMethods, function (methodName) {
|
||||
this[methodName] = zrUtil.bind(ecInstance[methodName], ecInstance);
|
||||
}, this);
|
||||
}
|
||||
|
||||
return ExtensionAPI;
|
||||
}();
|
||||
|
||||
export default ExtensionAPI;
|
||||
557
uni-demo/node_modules/echarts/lib/core/Scheduler.js
generated
vendored
Normal file
557
uni-demo/node_modules/echarts/lib/core/Scheduler.js
generated
vendored
Normal file
@@ -0,0 +1,557 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { each, map, isFunction, createHashMap, noop, assert } from 'zrender/lib/core/util.js';
|
||||
import { createTask } from './task.js';
|
||||
import { getUID } from '../util/component.js';
|
||||
import GlobalModel from '../model/Global.js';
|
||||
import ExtensionAPI from './ExtensionAPI.js';
|
||||
import { normalizeToArray } from '../util/model.js';
|
||||
;
|
||||
|
||||
var Scheduler =
|
||||
/** @class */
|
||||
function () {
|
||||
function Scheduler(ecInstance, api, dataProcessorHandlers, visualHandlers) {
|
||||
// key: handlerUID
|
||||
this._stageTaskMap = createHashMap();
|
||||
this.ecInstance = ecInstance;
|
||||
this.api = api; // Fix current processors in case that in some rear cases that
|
||||
// processors might be registered after echarts instance created.
|
||||
// Register processors incrementally for a echarts instance is
|
||||
// not supported by this stream architecture.
|
||||
|
||||
dataProcessorHandlers = this._dataProcessorHandlers = dataProcessorHandlers.slice();
|
||||
visualHandlers = this._visualHandlers = visualHandlers.slice();
|
||||
this._allHandlers = dataProcessorHandlers.concat(visualHandlers);
|
||||
}
|
||||
|
||||
Scheduler.prototype.restoreData = function (ecModel, payload) {
|
||||
// TODO: Only restore needed series and components, but not all components.
|
||||
// Currently `restoreData` of all of the series and component will be called.
|
||||
// But some independent components like `title`, `legend`, `graphic`, `toolbox`,
|
||||
// `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,
|
||||
// and some components like coordinate system, axes, dataZoom, visualMap only
|
||||
// need their target series refresh.
|
||||
// (1) If we are implementing this feature some day, we should consider these cases:
|
||||
// if a data processor depends on a component (e.g., dataZoomProcessor depends
|
||||
// on the settings of `dataZoom`), it should be re-performed if the component
|
||||
// is modified by `setOption`.
|
||||
// (2) If a processor depends on sevral series, speicified by its `getTargetSeries`,
|
||||
// it should be re-performed when the result array of `getTargetSeries` changed.
|
||||
// We use `dependencies` to cover these issues.
|
||||
// (3) How to update target series when coordinate system related components modified.
|
||||
// TODO: simply the dirty mechanism? Check whether only the case here can set tasks dirty,
|
||||
// and this case all of the tasks will be set as dirty.
|
||||
ecModel.restoreData(payload); // Theoretically an overall task not only depends on each of its target series, but also
|
||||
// depends on all of the series.
|
||||
// The overall task is not in pipeline, and `ecModel.restoreData` only set pipeline tasks
|
||||
// dirty. If `getTargetSeries` of an overall task returns nothing, we should also ensure
|
||||
// that the overall task is set as dirty and to be performed, otherwise it probably cause
|
||||
// state chaos. So we have to set dirty of all of the overall tasks manually, otherwise it
|
||||
// probably cause state chaos (consider `dataZoomProcessor`).
|
||||
|
||||
this._stageTaskMap.each(function (taskRecord) {
|
||||
var overallTask = taskRecord.overallTask;
|
||||
overallTask && overallTask.dirty();
|
||||
});
|
||||
}; // If seriesModel provided, incremental threshold is check by series data.
|
||||
|
||||
|
||||
Scheduler.prototype.getPerformArgs = function (task, isBlock) {
|
||||
// For overall task
|
||||
if (!task.__pipeline) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pipeline = this._pipelineMap.get(task.__pipeline.id);
|
||||
|
||||
var pCtx = pipeline.context;
|
||||
var incremental = !isBlock && pipeline.progressiveEnabled && (!pCtx || pCtx.progressiveRender) && task.__idxInPipeline > pipeline.blockIndex;
|
||||
var step = incremental ? pipeline.step : null;
|
||||
var modDataCount = pCtx && pCtx.modDataCount;
|
||||
var modBy = modDataCount != null ? Math.ceil(modDataCount / step) : null;
|
||||
return {
|
||||
step: step,
|
||||
modBy: modBy,
|
||||
modDataCount: modDataCount
|
||||
};
|
||||
};
|
||||
|
||||
Scheduler.prototype.getPipeline = function (pipelineId) {
|
||||
return this._pipelineMap.get(pipelineId);
|
||||
};
|
||||
/**
|
||||
* Current, progressive rendering starts from visual and layout.
|
||||
* Always detect render mode in the same stage, avoiding that incorrect
|
||||
* detection caused by data filtering.
|
||||
* Caution:
|
||||
* `updateStreamModes` use `seriesModel.getData()`.
|
||||
*/
|
||||
|
||||
|
||||
Scheduler.prototype.updateStreamModes = function (seriesModel, view) {
|
||||
var pipeline = this._pipelineMap.get(seriesModel.uid);
|
||||
|
||||
var data = seriesModel.getData();
|
||||
var dataLen = data.count(); // `progressiveRender` means that can render progressively in each
|
||||
// animation frame. Note that some types of series do not provide
|
||||
// `view.incrementalPrepareRender` but support `chart.appendData`. We
|
||||
// use the term `incremental` but not `progressive` to describe the
|
||||
// case that `chart.appendData`.
|
||||
|
||||
var progressiveRender = pipeline.progressiveEnabled && view.incrementalPrepareRender && dataLen >= pipeline.threshold;
|
||||
var large = seriesModel.get('large') && dataLen >= seriesModel.get('largeThreshold'); // TODO: modDataCount should not updated if `appendData`, otherwise cause whole repaint.
|
||||
// see `test/candlestick-large3.html`
|
||||
|
||||
var modDataCount = seriesModel.get('progressiveChunkMode') === 'mod' ? dataLen : null;
|
||||
seriesModel.pipelineContext = pipeline.context = {
|
||||
progressiveRender: progressiveRender,
|
||||
modDataCount: modDataCount,
|
||||
large: large
|
||||
};
|
||||
};
|
||||
|
||||
Scheduler.prototype.restorePipelines = function (ecModel) {
|
||||
var scheduler = this;
|
||||
var pipelineMap = scheduler._pipelineMap = createHashMap();
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
var progressive = seriesModel.getProgressive();
|
||||
var pipelineId = seriesModel.uid;
|
||||
pipelineMap.set(pipelineId, {
|
||||
id: pipelineId,
|
||||
head: null,
|
||||
tail: null,
|
||||
threshold: seriesModel.getProgressiveThreshold(),
|
||||
progressiveEnabled: progressive && !(seriesModel.preventIncremental && seriesModel.preventIncremental()),
|
||||
blockIndex: -1,
|
||||
step: Math.round(progressive || 700),
|
||||
count: 0
|
||||
});
|
||||
|
||||
scheduler._pipe(seriesModel, seriesModel.dataTask);
|
||||
});
|
||||
};
|
||||
|
||||
Scheduler.prototype.prepareStageTasks = function () {
|
||||
var stageTaskMap = this._stageTaskMap;
|
||||
var ecModel = this.api.getModel();
|
||||
var api = this.api;
|
||||
each(this._allHandlers, function (handler) {
|
||||
var record = stageTaskMap.get(handler.uid) || stageTaskMap.set(handler.uid, {});
|
||||
var errMsg = '';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// Currently do not need to support to sepecify them both.
|
||||
errMsg = '"reset" and "overallReset" must not be both specified.';
|
||||
}
|
||||
|
||||
assert(!(handler.reset && handler.overallReset), errMsg);
|
||||
handler.reset && this._createSeriesStageTask(handler, record, ecModel, api);
|
||||
handler.overallReset && this._createOverallStageTask(handler, record, ecModel, api);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Scheduler.prototype.prepareView = function (view, model, ecModel, api) {
|
||||
var renderTask = view.renderTask;
|
||||
var context = renderTask.context;
|
||||
context.model = model;
|
||||
context.ecModel = ecModel;
|
||||
context.api = api;
|
||||
renderTask.__block = !view.incrementalPrepareRender;
|
||||
|
||||
this._pipe(model, renderTask);
|
||||
};
|
||||
|
||||
Scheduler.prototype.performDataProcessorTasks = function (ecModel, payload) {
|
||||
// If we do not use `block` here, it should be considered when to update modes.
|
||||
this._performStageTasks(this._dataProcessorHandlers, ecModel, payload, {
|
||||
block: true
|
||||
});
|
||||
};
|
||||
|
||||
Scheduler.prototype.performVisualTasks = function (ecModel, payload, opt) {
|
||||
this._performStageTasks(this._visualHandlers, ecModel, payload, opt);
|
||||
};
|
||||
|
||||
Scheduler.prototype._performStageTasks = function (stageHandlers, ecModel, payload, opt) {
|
||||
opt = opt || {};
|
||||
var unfinished = false;
|
||||
var scheduler = this;
|
||||
each(stageHandlers, function (stageHandler, idx) {
|
||||
if (opt.visualType && opt.visualType !== stageHandler.visualType) {
|
||||
return;
|
||||
}
|
||||
|
||||
var stageHandlerRecord = scheduler._stageTaskMap.get(stageHandler.uid);
|
||||
|
||||
var seriesTaskMap = stageHandlerRecord.seriesTaskMap;
|
||||
var overallTask = stageHandlerRecord.overallTask;
|
||||
|
||||
if (overallTask) {
|
||||
var overallNeedDirty_1;
|
||||
var agentStubMap = overallTask.agentStubMap;
|
||||
agentStubMap.each(function (stub) {
|
||||
if (needSetDirty(opt, stub)) {
|
||||
stub.dirty();
|
||||
overallNeedDirty_1 = true;
|
||||
}
|
||||
});
|
||||
overallNeedDirty_1 && overallTask.dirty();
|
||||
scheduler.updatePayload(overallTask, payload);
|
||||
var performArgs_1 = scheduler.getPerformArgs(overallTask, opt.block); // Execute stubs firstly, which may set the overall task dirty,
|
||||
// then execute the overall task. And stub will call seriesModel.setData,
|
||||
// which ensures that in the overallTask seriesModel.getData() will not
|
||||
// return incorrect data.
|
||||
|
||||
agentStubMap.each(function (stub) {
|
||||
stub.perform(performArgs_1);
|
||||
});
|
||||
|
||||
if (overallTask.perform(performArgs_1)) {
|
||||
unfinished = true;
|
||||
}
|
||||
} else if (seriesTaskMap) {
|
||||
seriesTaskMap.each(function (task, pipelineId) {
|
||||
if (needSetDirty(opt, task)) {
|
||||
task.dirty();
|
||||
}
|
||||
|
||||
var performArgs = scheduler.getPerformArgs(task, opt.block); // FIXME
|
||||
// if intending to decalare `performRawSeries` in handlers, only
|
||||
// stream-independent (specifically, data item independent) operations can be
|
||||
// performed. Because is a series is filtered, most of the tasks will not
|
||||
// be performed. A stream-dependent operation probably cause wrong biz logic.
|
||||
// Perhaps we should not provide a separate callback for this case instead
|
||||
// of providing the config `performRawSeries`. The stream-dependent operaions
|
||||
// and stream-independent operations should better not be mixed.
|
||||
|
||||
performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);
|
||||
scheduler.updatePayload(task, payload);
|
||||
|
||||
if (task.perform(performArgs)) {
|
||||
unfinished = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function needSetDirty(opt, task) {
|
||||
return opt.setDirty && (!opt.dirtyMap || opt.dirtyMap.get(task.__pipeline.id));
|
||||
}
|
||||
|
||||
this.unfinished = unfinished || this.unfinished;
|
||||
};
|
||||
|
||||
Scheduler.prototype.performSeriesTasks = function (ecModel) {
|
||||
var unfinished;
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
// Progress to the end for dataInit and dataRestore.
|
||||
unfinished = seriesModel.dataTask.perform() || unfinished;
|
||||
});
|
||||
this.unfinished = unfinished || this.unfinished;
|
||||
};
|
||||
|
||||
Scheduler.prototype.plan = function () {
|
||||
// Travel pipelines, check block.
|
||||
this._pipelineMap.each(function (pipeline) {
|
||||
var task = pipeline.tail;
|
||||
|
||||
do {
|
||||
if (task.__block) {
|
||||
pipeline.blockIndex = task.__idxInPipeline;
|
||||
break;
|
||||
}
|
||||
|
||||
task = task.getUpstream();
|
||||
} while (task);
|
||||
});
|
||||
};
|
||||
|
||||
Scheduler.prototype.updatePayload = function (task, payload) {
|
||||
payload !== 'remain' && (task.context.payload = payload);
|
||||
};
|
||||
|
||||
Scheduler.prototype._createSeriesStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {
|
||||
var scheduler = this;
|
||||
var oldSeriesTaskMap = stageHandlerRecord.seriesTaskMap; // The count of stages are totally about only several dozen, so
|
||||
// do not need to reuse the map.
|
||||
|
||||
var newSeriesTaskMap = stageHandlerRecord.seriesTaskMap = createHashMap();
|
||||
var seriesType = stageHandler.seriesType;
|
||||
var getTargetSeries = stageHandler.getTargetSeries; // If a stageHandler should cover all series, `createOnAllSeries` should be declared mandatorily,
|
||||
// to avoid some typo or abuse. Otherwise if an extension do not specify a `seriesType`,
|
||||
// it works but it may cause other irrelevant charts blocked.
|
||||
|
||||
if (stageHandler.createOnAllSeries) {
|
||||
ecModel.eachRawSeries(create);
|
||||
} else if (seriesType) {
|
||||
ecModel.eachRawSeriesByType(seriesType, create);
|
||||
} else if (getTargetSeries) {
|
||||
getTargetSeries(ecModel, api).each(create);
|
||||
}
|
||||
|
||||
function create(seriesModel) {
|
||||
var pipelineId = seriesModel.uid; // Init tasks for each seriesModel only once.
|
||||
// Reuse original task instance.
|
||||
|
||||
var task = newSeriesTaskMap.set(pipelineId, oldSeriesTaskMap && oldSeriesTaskMap.get(pipelineId) || createTask({
|
||||
plan: seriesTaskPlan,
|
||||
reset: seriesTaskReset,
|
||||
count: seriesTaskCount
|
||||
}));
|
||||
task.context = {
|
||||
model: seriesModel,
|
||||
ecModel: ecModel,
|
||||
api: api,
|
||||
// PENDING: `useClearVisual` not used?
|
||||
useClearVisual: stageHandler.isVisual && !stageHandler.isLayout,
|
||||
plan: stageHandler.plan,
|
||||
reset: stageHandler.reset,
|
||||
scheduler: scheduler
|
||||
};
|
||||
|
||||
scheduler._pipe(seriesModel, task);
|
||||
}
|
||||
};
|
||||
|
||||
Scheduler.prototype._createOverallStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {
|
||||
var scheduler = this;
|
||||
var overallTask = stageHandlerRecord.overallTask = stageHandlerRecord.overallTask // For overall task, the function only be called on reset stage.
|
||||
|| createTask({
|
||||
reset: overallTaskReset
|
||||
});
|
||||
overallTask.context = {
|
||||
ecModel: ecModel,
|
||||
api: api,
|
||||
overallReset: stageHandler.overallReset,
|
||||
scheduler: scheduler
|
||||
};
|
||||
var oldAgentStubMap = overallTask.agentStubMap; // The count of stages are totally about only several dozen, so
|
||||
// do not need to reuse the map.
|
||||
|
||||
var newAgentStubMap = overallTask.agentStubMap = createHashMap();
|
||||
var seriesType = stageHandler.seriesType;
|
||||
var getTargetSeries = stageHandler.getTargetSeries;
|
||||
var overallProgress = true;
|
||||
var shouldOverallTaskDirty = false; // FIXME:TS never used, so comment it
|
||||
// let modifyOutputEnd = stageHandler.modifyOutputEnd;
|
||||
// An overall task with seriesType detected or has `getTargetSeries`, we add
|
||||
// stub in each pipelines, it will set the overall task dirty when the pipeline
|
||||
// progress. Moreover, to avoid call the overall task each frame (too frequent),
|
||||
// we set the pipeline block.
|
||||
|
||||
var errMsg = '';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = '"createOnAllSeries" do not supported for "overallReset", ' + 'becuase it will block all streams.';
|
||||
}
|
||||
|
||||
assert(!stageHandler.createOnAllSeries, errMsg);
|
||||
|
||||
if (seriesType) {
|
||||
ecModel.eachRawSeriesByType(seriesType, createStub);
|
||||
} else if (getTargetSeries) {
|
||||
getTargetSeries(ecModel, api).each(createStub);
|
||||
} // Otherwise, (usually it is legancy case), the overall task will only be
|
||||
// executed when upstream dirty. Otherwise the progressive rendering of all
|
||||
// pipelines will be disabled unexpectedly. But it still needs stubs to receive
|
||||
// dirty info from upsteam.
|
||||
else {
|
||||
overallProgress = false;
|
||||
each(ecModel.getSeries(), createStub);
|
||||
}
|
||||
|
||||
function createStub(seriesModel) {
|
||||
var pipelineId = seriesModel.uid;
|
||||
var stub = newAgentStubMap.set(pipelineId, oldAgentStubMap && oldAgentStubMap.get(pipelineId) || ( // When the result of `getTargetSeries` changed, the overallTask
|
||||
// should be set as dirty and re-performed.
|
||||
shouldOverallTaskDirty = true, createTask({
|
||||
reset: stubReset,
|
||||
onDirty: stubOnDirty
|
||||
})));
|
||||
stub.context = {
|
||||
model: seriesModel,
|
||||
overallProgress: overallProgress // FIXME:TS never used, so comment it
|
||||
// modifyOutputEnd: modifyOutputEnd
|
||||
|
||||
};
|
||||
stub.agent = overallTask;
|
||||
stub.__block = overallProgress;
|
||||
|
||||
scheduler._pipe(seriesModel, stub);
|
||||
}
|
||||
|
||||
if (shouldOverallTaskDirty) {
|
||||
overallTask.dirty();
|
||||
}
|
||||
};
|
||||
|
||||
Scheduler.prototype._pipe = function (seriesModel, task) {
|
||||
var pipelineId = seriesModel.uid;
|
||||
|
||||
var pipeline = this._pipelineMap.get(pipelineId);
|
||||
|
||||
!pipeline.head && (pipeline.head = task);
|
||||
pipeline.tail && pipeline.tail.pipe(task);
|
||||
pipeline.tail = task;
|
||||
task.__idxInPipeline = pipeline.count++;
|
||||
task.__pipeline = pipeline;
|
||||
};
|
||||
|
||||
Scheduler.wrapStageHandler = function (stageHandler, visualType) {
|
||||
if (isFunction(stageHandler)) {
|
||||
stageHandler = {
|
||||
overallReset: stageHandler,
|
||||
seriesType: detectSeriseType(stageHandler)
|
||||
};
|
||||
}
|
||||
|
||||
stageHandler.uid = getUID('stageHandler');
|
||||
visualType && (stageHandler.visualType = visualType);
|
||||
return stageHandler;
|
||||
};
|
||||
|
||||
;
|
||||
return Scheduler;
|
||||
}();
|
||||
|
||||
function overallTaskReset(context) {
|
||||
context.overallReset(context.ecModel, context.api, context.payload);
|
||||
}
|
||||
|
||||
function stubReset(context) {
|
||||
return context.overallProgress && stubProgress;
|
||||
}
|
||||
|
||||
function stubProgress() {
|
||||
this.agent.dirty();
|
||||
this.getDownstream().dirty();
|
||||
}
|
||||
|
||||
function stubOnDirty() {
|
||||
this.agent && this.agent.dirty();
|
||||
}
|
||||
|
||||
function seriesTaskPlan(context) {
|
||||
return context.plan ? context.plan(context.model, context.ecModel, context.api, context.payload) : null;
|
||||
}
|
||||
|
||||
function seriesTaskReset(context) {
|
||||
if (context.useClearVisual) {
|
||||
context.data.clearAllVisual();
|
||||
}
|
||||
|
||||
var resetDefines = context.resetDefines = normalizeToArray(context.reset(context.model, context.ecModel, context.api, context.payload));
|
||||
return resetDefines.length > 1 ? map(resetDefines, function (v, idx) {
|
||||
return makeSeriesTaskProgress(idx);
|
||||
}) : singleSeriesTaskProgress;
|
||||
}
|
||||
|
||||
var singleSeriesTaskProgress = makeSeriesTaskProgress(0);
|
||||
|
||||
function makeSeriesTaskProgress(resetDefineIdx) {
|
||||
return function (params, context) {
|
||||
var data = context.data;
|
||||
var resetDefine = context.resetDefines[resetDefineIdx];
|
||||
|
||||
if (resetDefine && resetDefine.dataEach) {
|
||||
for (var i = params.start; i < params.end; i++) {
|
||||
resetDefine.dataEach(data, i);
|
||||
}
|
||||
} else if (resetDefine && resetDefine.progress) {
|
||||
resetDefine.progress(params, data);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function seriesTaskCount(context) {
|
||||
return context.data.count();
|
||||
}
|
||||
/**
|
||||
* Only some legacy stage handlers (usually in echarts extensions) are pure function.
|
||||
* To ensure that they can work normally, they should work in block mode, that is,
|
||||
* they should not be started util the previous tasks finished. So they cause the
|
||||
* progressive rendering disabled. We try to detect the series type, to narrow down
|
||||
* the block range to only the series type they concern, but not all series.
|
||||
*/
|
||||
|
||||
|
||||
function detectSeriseType(legacyFunc) {
|
||||
seriesType = null;
|
||||
|
||||
try {
|
||||
// Assume there is no async when calling `eachSeriesByType`.
|
||||
legacyFunc(ecModelMock, apiMock);
|
||||
} catch (e) {}
|
||||
|
||||
return seriesType;
|
||||
}
|
||||
|
||||
var ecModelMock = {};
|
||||
var apiMock = {};
|
||||
var seriesType;
|
||||
mockMethods(ecModelMock, GlobalModel);
|
||||
mockMethods(apiMock, ExtensionAPI);
|
||||
|
||||
ecModelMock.eachSeriesByType = ecModelMock.eachRawSeriesByType = function (type) {
|
||||
seriesType = type;
|
||||
};
|
||||
|
||||
ecModelMock.eachComponent = function (cond) {
|
||||
if (cond.mainType === 'series' && cond.subType) {
|
||||
seriesType = cond.subType;
|
||||
}
|
||||
};
|
||||
|
||||
function mockMethods(target, Clz) {
|
||||
/* eslint-disable */
|
||||
for (var name_1 in Clz.prototype) {
|
||||
// Do not use hasOwnProperty
|
||||
target[name_1] = noop;
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
}
|
||||
|
||||
export default Scheduler;
|
||||
2595
uni-demo/node_modules/echarts/lib/core/echarts.js
generated
vendored
Normal file
2595
uni-demo/node_modules/echarts/lib/core/echarts.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
67
uni-demo/node_modules/echarts/lib/core/impl.js
generated
vendored
Normal file
67
uni-demo/node_modules/echarts/lib/core/impl.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { error } from '../util/log.js'; // Implementation of exported APIs. For example registerMap, getMap.
|
||||
// The implentations will be registered when installing the component.
|
||||
// Avoid these code being bundled to the core module.
|
||||
|
||||
var implsStore = {}; // TODO Type
|
||||
|
||||
export function registerImpl(name, impl) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (implsStore[name]) {
|
||||
error("Already has an implementation of " + name + ".");
|
||||
}
|
||||
}
|
||||
|
||||
implsStore[name] = impl;
|
||||
}
|
||||
export function getImpl(name) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!implsStore[name]) {
|
||||
error("Implementation of " + name + " doesn't exists.");
|
||||
}
|
||||
}
|
||||
|
||||
return implsStore[name];
|
||||
}
|
||||
47
uni-demo/node_modules/echarts/lib/core/lifecycle.js
generated
vendored
Normal file
47
uni-demo/node_modules/echarts/lib/core/lifecycle.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import Eventful from 'zrender/lib/core/Eventful.js';
|
||||
;
|
||||
var lifecycle = new Eventful();
|
||||
export default lifecycle;
|
||||
90
uni-demo/node_modules/echarts/lib/core/locale.js
generated
vendored
Normal file
90
uni-demo/node_modules/echarts/lib/core/locale.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import Model from '../model/Model.js';
|
||||
import env from 'zrender/lib/core/env.js'; // default import ZH and EN lang
|
||||
|
||||
import langEN from '../i18n/langEN.js';
|
||||
import langZH from '../i18n/langZH.js';
|
||||
import { isString, clone, merge } from 'zrender/lib/core/util.js';
|
||||
var LOCALE_ZH = 'ZH';
|
||||
var LOCALE_EN = 'EN';
|
||||
var DEFAULT_LOCALE = LOCALE_EN;
|
||||
var localeStorage = {};
|
||||
var localeModels = {};
|
||||
export var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE : function () {
|
||||
var langStr = (
|
||||
/* eslint-disable-next-line */
|
||||
document.documentElement.lang || navigator.language || navigator.browserLanguage).toUpperCase();
|
||||
return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;
|
||||
}();
|
||||
export function registerLocale(locale, localeObj) {
|
||||
locale = locale.toUpperCase();
|
||||
localeModels[locale] = new Model(localeObj);
|
||||
localeStorage[locale] = localeObj;
|
||||
} // export function getLocale(locale: string) {
|
||||
// return localeStorage[locale];
|
||||
// }
|
||||
|
||||
export function createLocaleObject(locale) {
|
||||
if (isString(locale)) {
|
||||
var localeObj = localeStorage[locale.toUpperCase()] || {};
|
||||
|
||||
if (locale === LOCALE_ZH || locale === LOCALE_EN) {
|
||||
return clone(localeObj);
|
||||
} else {
|
||||
return merge(clone(localeObj), clone(localeStorage[DEFAULT_LOCALE]), false);
|
||||
}
|
||||
} else {
|
||||
return merge(clone(locale), clone(localeStorage[DEFAULT_LOCALE]), false);
|
||||
}
|
||||
}
|
||||
export function getLocaleModel(lang) {
|
||||
return localeModels[lang];
|
||||
}
|
||||
export function getDefaultLocaleModel() {
|
||||
return localeModels[DEFAULT_LOCALE];
|
||||
} // Default locale
|
||||
|
||||
registerLocale(LOCALE_EN, langEN);
|
||||
registerLocale(LOCALE_ZH, langZH);
|
||||
390
uni-demo/node_modules/echarts/lib/core/task.js
generated
vendored
Normal file
390
uni-demo/node_modules/echarts/lib/core/task.js
generated
vendored
Normal file
@@ -0,0 +1,390 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { assert, isArray } from 'zrender/lib/core/util.js';
|
||||
;
|
||||
/**
|
||||
* @param {Object} define
|
||||
* @return See the return of `createTask`.
|
||||
*/
|
||||
|
||||
export function createTask(define) {
|
||||
return new Task(define);
|
||||
}
|
||||
|
||||
var Task =
|
||||
/** @class */
|
||||
function () {
|
||||
function Task(define) {
|
||||
define = define || {};
|
||||
this._reset = define.reset;
|
||||
this._plan = define.plan;
|
||||
this._count = define.count;
|
||||
this._onDirty = define.onDirty;
|
||||
this._dirty = true;
|
||||
}
|
||||
/**
|
||||
* @param step Specified step.
|
||||
* @param skip Skip customer perform call.
|
||||
* @param modBy Sampling window size.
|
||||
* @param modDataCount Sampling count.
|
||||
* @return whether unfinished.
|
||||
*/
|
||||
|
||||
|
||||
Task.prototype.perform = function (performArgs) {
|
||||
var upTask = this._upstream;
|
||||
var skip = performArgs && performArgs.skip; // TODO some refactor.
|
||||
// Pull data. Must pull data each time, because context.data
|
||||
// may be updated by Series.setData.
|
||||
|
||||
if (this._dirty && upTask) {
|
||||
var context = this.context;
|
||||
context.data = context.outputData = upTask.context.outputData;
|
||||
}
|
||||
|
||||
if (this.__pipeline) {
|
||||
this.__pipeline.currentTask = this;
|
||||
}
|
||||
|
||||
var planResult;
|
||||
|
||||
if (this._plan && !skip) {
|
||||
planResult = this._plan(this.context);
|
||||
} // Support sharding by mod, which changes the render sequence and makes the rendered graphic
|
||||
// elements uniformed distributed when progress, especially when moving or zooming.
|
||||
|
||||
|
||||
var lastModBy = normalizeModBy(this._modBy);
|
||||
var lastModDataCount = this._modDataCount || 0;
|
||||
var modBy = normalizeModBy(performArgs && performArgs.modBy);
|
||||
var modDataCount = performArgs && performArgs.modDataCount || 0;
|
||||
|
||||
if (lastModBy !== modBy || lastModDataCount !== modDataCount) {
|
||||
planResult = 'reset';
|
||||
}
|
||||
|
||||
function normalizeModBy(val) {
|
||||
!(val >= 1) && (val = 1); // jshint ignore:line
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
var forceFirstProgress;
|
||||
|
||||
if (this._dirty || planResult === 'reset') {
|
||||
this._dirty = false;
|
||||
forceFirstProgress = this._doReset(skip);
|
||||
}
|
||||
|
||||
this._modBy = modBy;
|
||||
this._modDataCount = modDataCount;
|
||||
var step = performArgs && performArgs.step;
|
||||
|
||||
if (upTask) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
assert(upTask._outputDueEnd != null);
|
||||
}
|
||||
|
||||
this._dueEnd = upTask._outputDueEnd;
|
||||
} // DataTask or overallTask
|
||||
else {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
assert(!this._progress || this._count);
|
||||
}
|
||||
|
||||
this._dueEnd = this._count ? this._count(this.context) : Infinity;
|
||||
} // Note: Stubs, that its host overall task let it has progress, has progress.
|
||||
// If no progress, pass index from upstream to downstream each time plan called.
|
||||
|
||||
|
||||
if (this._progress) {
|
||||
var start = this._dueIndex;
|
||||
var end = Math.min(step != null ? this._dueIndex + step : Infinity, this._dueEnd);
|
||||
|
||||
if (!skip && (forceFirstProgress || start < end)) {
|
||||
var progress = this._progress;
|
||||
|
||||
if (isArray(progress)) {
|
||||
for (var i = 0; i < progress.length; i++) {
|
||||
this._doProgress(progress[i], start, end, modBy, modDataCount);
|
||||
}
|
||||
} else {
|
||||
this._doProgress(progress, start, end, modBy, modDataCount);
|
||||
}
|
||||
}
|
||||
|
||||
this._dueIndex = end; // If no `outputDueEnd`, assume that output data and
|
||||
// input data is the same, so use `dueIndex` as `outputDueEnd`.
|
||||
|
||||
var outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : end;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// ??? Can not rollback.
|
||||
assert(outputDueEnd >= this._outputDueEnd);
|
||||
}
|
||||
|
||||
this._outputDueEnd = outputDueEnd;
|
||||
} else {
|
||||
// (1) Some overall task has no progress.
|
||||
// (2) Stubs, that its host overall task do not let it has progress, has no progress.
|
||||
// This should always be performed so it can be passed to downstream.
|
||||
this._dueIndex = this._outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : this._dueEnd;
|
||||
}
|
||||
|
||||
return this.unfinished();
|
||||
};
|
||||
|
||||
Task.prototype.dirty = function () {
|
||||
this._dirty = true;
|
||||
this._onDirty && this._onDirty(this.context);
|
||||
};
|
||||
|
||||
Task.prototype._doProgress = function (progress, start, end, modBy, modDataCount) {
|
||||
iterator.reset(start, end, modBy, modDataCount);
|
||||
this._callingProgress = progress;
|
||||
|
||||
this._callingProgress({
|
||||
start: start,
|
||||
end: end,
|
||||
count: end - start,
|
||||
next: iterator.next
|
||||
}, this.context);
|
||||
};
|
||||
|
||||
Task.prototype._doReset = function (skip) {
|
||||
this._dueIndex = this._outputDueEnd = this._dueEnd = 0;
|
||||
this._settedOutputEnd = null;
|
||||
var progress;
|
||||
var forceFirstProgress;
|
||||
|
||||
if (!skip && this._reset) {
|
||||
progress = this._reset(this.context);
|
||||
|
||||
if (progress && progress.progress) {
|
||||
forceFirstProgress = progress.forceFirstProgress;
|
||||
progress = progress.progress;
|
||||
} // To simplify no progress checking, array must has item.
|
||||
|
||||
|
||||
if (isArray(progress) && !progress.length) {
|
||||
progress = null;
|
||||
}
|
||||
}
|
||||
|
||||
this._progress = progress;
|
||||
this._modBy = this._modDataCount = null;
|
||||
var downstream = this._downstream;
|
||||
downstream && downstream.dirty();
|
||||
return forceFirstProgress;
|
||||
};
|
||||
|
||||
Task.prototype.unfinished = function () {
|
||||
return this._progress && this._dueIndex < this._dueEnd;
|
||||
};
|
||||
/**
|
||||
* @param downTask The downstream task.
|
||||
* @return The downstream task.
|
||||
*/
|
||||
|
||||
|
||||
Task.prototype.pipe = function (downTask) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
assert(downTask && !downTask._disposed && downTask !== this);
|
||||
} // If already downstream, do not dirty downTask.
|
||||
|
||||
|
||||
if (this._downstream !== downTask || this._dirty) {
|
||||
this._downstream = downTask;
|
||||
downTask._upstream = this;
|
||||
downTask.dirty();
|
||||
}
|
||||
};
|
||||
|
||||
Task.prototype.dispose = function () {
|
||||
if (this._disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._upstream && (this._upstream._downstream = null);
|
||||
this._downstream && (this._downstream._upstream = null);
|
||||
this._dirty = false;
|
||||
this._disposed = true;
|
||||
};
|
||||
|
||||
Task.prototype.getUpstream = function () {
|
||||
return this._upstream;
|
||||
};
|
||||
|
||||
Task.prototype.getDownstream = function () {
|
||||
return this._downstream;
|
||||
};
|
||||
|
||||
Task.prototype.setOutputEnd = function (end) {
|
||||
// This only happend in dataTask, dataZoom, map, currently.
|
||||
// where dataZoom do not set end each time, but only set
|
||||
// when reset. So we should record the setted end, in case
|
||||
// that the stub of dataZoom perform again and earse the
|
||||
// setted end by upstream.
|
||||
this._outputDueEnd = this._settedOutputEnd = end;
|
||||
};
|
||||
|
||||
return Task;
|
||||
}();
|
||||
|
||||
export { Task };
|
||||
|
||||
var iterator = function () {
|
||||
var end;
|
||||
var current;
|
||||
var modBy;
|
||||
var modDataCount;
|
||||
var winCount;
|
||||
var it = {
|
||||
reset: function (s, e, sStep, sCount) {
|
||||
current = s;
|
||||
end = e;
|
||||
modBy = sStep;
|
||||
modDataCount = sCount;
|
||||
winCount = Math.ceil(modDataCount / modBy);
|
||||
it.next = modBy > 1 && modDataCount > 0 ? modNext : sequentialNext;
|
||||
}
|
||||
};
|
||||
return it;
|
||||
|
||||
function sequentialNext() {
|
||||
return current < end ? current++ : null;
|
||||
}
|
||||
|
||||
function modNext() {
|
||||
var dataIndex = current % winCount * modBy + Math.ceil(current / winCount);
|
||||
var result = current >= end ? null : dataIndex < modDataCount ? dataIndex // If modDataCount is smaller than data.count() (consider `appendData` case),
|
||||
// Use normal linear rendering mode.
|
||||
: current;
|
||||
current++;
|
||||
return result;
|
||||
}
|
||||
}(); ///////////////////////////////////////////////////////////
|
||||
// For stream debug (Should be commented out after used!)
|
||||
// @usage: printTask(this, 'begin');
|
||||
// @usage: printTask(this, null, {someExtraProp});
|
||||
// @usage: Use `__idxInPipeline` as conditional breakpiont.
|
||||
//
|
||||
// window.printTask = function (task: any, prefix: string, extra: { [key: string]: unknown }): void {
|
||||
// window.ecTaskUID == null && (window.ecTaskUID = 0);
|
||||
// task.uidDebug == null && (task.uidDebug = `task_${window.ecTaskUID++}`);
|
||||
// task.agent && task.agent.uidDebug == null && (task.agent.uidDebug = `task_${window.ecTaskUID++}`);
|
||||
// let props = [];
|
||||
// if (task.__pipeline) {
|
||||
// let val = `${task.__idxInPipeline}/${task.__pipeline.tail.__idxInPipeline} ${task.agent ? '(stub)' : ''}`;
|
||||
// props.push({text: '__idxInPipeline/total', value: val});
|
||||
// } else {
|
||||
// let stubCount = 0;
|
||||
// task.agentStubMap.each(() => stubCount++);
|
||||
// props.push({text: 'idx', value: `overall (stubs: ${stubCount})`});
|
||||
// }
|
||||
// props.push({text: 'uid', value: task.uidDebug});
|
||||
// if (task.__pipeline) {
|
||||
// props.push({text: 'pipelineId', value: task.__pipeline.id});
|
||||
// task.agent && props.push(
|
||||
// {text: 'stubFor', value: task.agent.uidDebug}
|
||||
// );
|
||||
// }
|
||||
// props.push(
|
||||
// {text: 'dirty', value: task._dirty},
|
||||
// {text: 'dueIndex', value: task._dueIndex},
|
||||
// {text: 'dueEnd', value: task._dueEnd},
|
||||
// {text: 'outputDueEnd', value: task._outputDueEnd}
|
||||
// );
|
||||
// if (extra) {
|
||||
// Object.keys(extra).forEach(key => {
|
||||
// props.push({text: key, value: extra[key]});
|
||||
// });
|
||||
// }
|
||||
// let args = ['color: blue'];
|
||||
// let msg = `%c[${prefix || 'T'}] %c` + props.map(item => (
|
||||
// args.push('color: green', 'color: red'),
|
||||
// `${item.text}: %c${item.value}`
|
||||
// )).join('%c, ');
|
||||
// console.log.apply(console, [msg].concat(args));
|
||||
// // console.log(this);
|
||||
// };
|
||||
// window.printPipeline = function (task: any, prefix: string) {
|
||||
// const pipeline = task.__pipeline;
|
||||
// let currTask = pipeline.head;
|
||||
// while (currTask) {
|
||||
// window.printTask(currTask, prefix);
|
||||
// currTask = currTask._downstream;
|
||||
// }
|
||||
// };
|
||||
// window.showChain = function (chainHeadTask) {
|
||||
// var chain = [];
|
||||
// var task = chainHeadTask;
|
||||
// while (task) {
|
||||
// chain.push({
|
||||
// task: task,
|
||||
// up: task._upstream,
|
||||
// down: task._downstream,
|
||||
// idxInPipeline: task.__idxInPipeline
|
||||
// });
|
||||
// task = task._downstream;
|
||||
// }
|
||||
// return chain;
|
||||
// };
|
||||
// window.findTaskInChain = function (task, chainHeadTask) {
|
||||
// let chain = window.showChain(chainHeadTask);
|
||||
// let result = [];
|
||||
// for (let i = 0; i < chain.length; i++) {
|
||||
// let chainItem = chain[i];
|
||||
// if (chainItem.task === task) {
|
||||
// result.push(i);
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// };
|
||||
// window.printChainAEachInChainB = function (chainHeadTaskA, chainHeadTaskB) {
|
||||
// let chainA = window.showChain(chainHeadTaskA);
|
||||
// for (let i = 0; i < chainA.length; i++) {
|
||||
// console.log('chainAIdx:', i, 'inChainB:', window.findTaskInChain(chainA[i].task, chainHeadTaskB));
|
||||
// }
|
||||
// };
|
||||
Reference in New Issue
Block a user