src/model/Global.js
function (condition) {
        var query = condition.query;
        var mainType = condition.mainType;

        var queryCond = getQueryCond(query);
        var result = queryCond
            ? this.queryComponents(queryCond)
            : this._componentsMap.get(mainType);

        return doFilter(filterBySubType(result, condition));

        function getQueryCond(q) {
            var indexAttr = mainType + 'Index';
            var idAttr = mainType + 'Id';
            var nameAttr = mainType + 'Name';
            return q && (
                    q[indexAttr] != null
                    || q[idAttr] != null
                    || q[nameAttr] != null
                )
                ? {
                    mainType: mainType,
                    // subType will be filtered finally.
                    index: q[indexAttr],
                    id: q[idAttr],
                    name: q[nameAttr]
                }
                : null;
        }

        function doFilter(res) {
            return condition.filter
                    ? filter(res, condition.filter)
                    : res;
        }
    }
function (condition) {
        var query = condition.query;
        var mainType = condition.mainType;

        var queryCond = getQueryCond(query);
        var result = queryCond
            ? this.queryComponents(queryCond)
            : this._componentsMap.get(mainType);

        return doFilter(filterBySubType(result, condition));

        function getQueryCond(q) {
            var indexAttr = mainType + 'Index';
            var idAttr = mainType + 'Id';
            var nameAttr = mainType + 'Name';
            return q && (
                    q[indexAttr] != null
                    || q[idAttr] != null
                    || q[nameAttr] != null
                )
                ? {
                    mainType: mainType,
                    // subType will be filtered finally.
                    index: q[indexAttr],
                    id: q[idAttr],
                    name: q[nameAttr]
                }
                : null;
        }

        function doFilter(res) {
            return condition.filter
                    ? filter(res, condition.filter)
                    : res;
        }
    }
function ( condition ) { var query = condition . query ; var mainType = condition . mainType ; var queryCond = getQueryCond ( query ) ; var result = queryCond ? this . queryComponents ( queryCond ) : this . _componentsMap . get ( mainType ) ; return doFilter ( filterBySubType ( result , condition ) ) ; function getQueryCond ( q ) { var indexAttr = mainType + 'Index' ; var idAttr = mainType + 'Id' ; var nameAttr = mainType + 'Name' ; return q && ( q [ indexAttr ] != null || q [ idAttr ] != null || q [ nameAttr ] != null ) ? { mainType : mainType , // subType will be filtered finally. index : q [ indexAttr ] , id : q [ idAttr ] , name : q [ nameAttr ] } : null ; } function doFilter ( res ) { return condition . filter ? filter ( res , condition . filter ) : res ; } }
The interface is different from queryComponents,
which is convenient for inner usage.

@usage
var result = findComponents(
{mainType: 'dataZoom', query: {dataZoomId: 'abc'}}
);
var result = findComponents(
{mainType: 'series', subType: 'pie', query: {seriesName: 'uio'}}
);
var result = findComponents(
{mainType: 'series'},
function (model, index) {...}
);
// result like [component0, componnet1, ...]

@param {Object} condition
@param {string} condition.mainType Mandatory.
@param {string} [condition.subType] Optional.
@param {Object} [condition.query] like {xxxIndex, xxxId, xxxName},
where xxx is mainType.
If query attribute is null/undefined or has no index/id/name,
do not filtering by query conditions, which is convenient for
no-payload situations or when target of action is global.
@param {Function} [condition.filter] parameter: component, return boolean.
@return {Array.<module:echarts/model/Component>}
The interface is different from queryComponents which is convenient for inner usage .