qauMaWeb/node_modules/.cache/babel-loader/73a4c5f004e67ed8d29b4df8ed2...

1 line
43 KiB
JSON

{"ast":null,"code":"import \"core-js/modules/es.error.cause.js\";\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { setAsPrimitive, map, isTypedArray, assert, each, retrieve2 } from 'zrender/lib/core/util.js';\nimport { createSource, cloneSourceShallow } from '../Source.js';\nimport { SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ORIGINAL } from '../../util/types.js';\nimport { querySeriesUpstreamDatasetModel, queryDatasetUpstreamDatasetModels } from './sourceHelper.js';\nimport { applyDataTransform } from './transform.js';\nimport DataStore from '../DataStore.js';\nimport { DefaultDataProvider } from './dataProvider.js';\n/**\n * [REQUIREMENT_MEMO]:\n * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option.\n * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and\n * `root-dataset`. Them on `series` has higher priority.\n * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might\n * confuse users: whether those props indicate how to visit the upstream source or visit\n * the transform result source, and some transforms has nothing to do with these props,\n * and some transforms might have multiple upstream.\n * (3) Transforms should specify `metaRawOption` in each output, just like they can be\n * declared in `root-dataset`.\n * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms.\n * That is for reducing complexity in transforms.\n * PENDING: Whether to provide transposition transform?\n *\n * [IMPLEMENTAION_MEMO]:\n * \"sourceVisitConfig\" are calculated from `metaRawOption` and `data`.\n * They will not be calculated until `source` is about to be visited (to prevent from\n * duplicate calcuation). `source` is visited only in series and input to transforms.\n *\n * [DIMENSION_INHERIT_RULE]:\n * By default the dimensions are inherited from ancestors, unless a transform return\n * a new dimensions definition.\n * Consider the case:\n * ```js\n * dataset: [{\n * source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * dataset: [{\n * dimension: ['Product', 'Sales', 'Prise'],\n * source: [ ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * ```\n * The two types of option should have the same behavior after transform.\n *\n *\n * [SCENARIO]:\n * (1) Provide source data directly:\n * ```js\n * series: {\n * encode: {...},\n * dimensions: [...]\n * seriesLayoutBy: 'row',\n * data: [[...]]\n * }\n * ```\n * (2) Series refer to dataset.\n * ```js\n * series: [{\n * encode: {...}\n * // Ignore datasetIndex means `datasetIndex: 0`\n * // and the dimensions defination in dataset is used\n * }, {\n * encode: {...},\n * seriesLayoutBy: 'column',\n * datasetIndex: 1\n * }]\n * ```\n * (3) dataset transform\n * ```js\n * dataset: [{\n * source: [...]\n * }, {\n * source: [...]\n * }, {\n * // By default from 0.\n * transform: { type: 'filter', config: {...} }\n * }, {\n * // Piped.\n * transform: [\n * { type: 'filter', config: {...} },\n * { type: 'sort', config: {...} }\n * ]\n * }, {\n * id: 'regressionData',\n * fromDatasetIndex: 1,\n * // Third-party transform\n * transform: { type: 'ecStat:regression', config: {...} }\n * }, {\n * // retrieve the extra result.\n * id: 'regressionFormula',\n * fromDatasetId: 'regressionData',\n * fromTransformResult: 1\n * }]\n * ```\n */\n\nvar SourceManager =\n/** @class */\nfunction () {\n function SourceManager(sourceHost) {\n // Cached source. Do not repeat calculating if not dirty.\n this._sourceList = [];\n this._storeList = []; // version sign of each upstream source manager.\n\n this._upstreamSignList = [];\n this._versionSignBase = 0;\n this._dirty = true;\n this._sourceHost = sourceHost;\n }\n /**\n * Mark dirty.\n */\n\n\n SourceManager.prototype.dirty = function () {\n this._setLocalSource([], []);\n\n this._storeList = [];\n this._dirty = true;\n };\n\n SourceManager.prototype._setLocalSource = function (sourceList, upstreamSignList) {\n this._sourceList = sourceList;\n this._upstreamSignList = upstreamSignList;\n this._versionSignBase++;\n\n if (this._versionSignBase > 9e10) {\n this._versionSignBase = 0;\n }\n };\n /**\n * For detecting whether the upstream source is dirty, so that\n * the local cached source (in `_sourceList`) should be discarded.\n */\n\n\n SourceManager.prototype._getVersionSign = function () {\n return this._sourceHost.uid + '_' + this._versionSignBase;\n };\n /**\n * Always return a source instance. Otherwise throw error.\n */\n\n\n SourceManager.prototype.prepareSource = function () {\n // For the case that call `setOption` multiple time but no data changed,\n // cache the result source to prevent from repeating transform.\n if (this._isDirty()) {\n this._createSource();\n\n this._dirty = false;\n }\n };\n\n SourceManager.prototype._createSource = function () {\n this._setLocalSource([], []);\n\n var sourceHost = this._sourceHost;\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n var hasUpstream = !!upSourceMgrList.length;\n var resultSourceList;\n var upstreamSignList;\n\n if (isSeries(sourceHost)) {\n var seriesModel = sourceHost;\n var data = void 0;\n var sourceFormat = void 0;\n var upSource = void 0; // Has upstream dataset\n\n if (hasUpstream) {\n var upSourceMgr = upSourceMgrList[0];\n upSourceMgr.prepareSource();\n upSource = upSourceMgr.getSource();\n data = upSource.data;\n sourceFormat = upSource.sourceFormat;\n upstreamSignList = [upSourceMgr._getVersionSign()];\n } // Series data is from own.\n else {\n data = seriesModel.get('data', true);\n sourceFormat = isTypedArray(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL;\n upstreamSignList = [];\n } // See [REQUIREMENT_MEMO], merge settings on series and parent dataset if it is root.\n\n\n var newMetaRawOption = this._getSourceMetaRawOption() || {};\n var upMetaRawOption = upSource && upSource.metaRawOption || {};\n var seriesLayoutBy = retrieve2(newMetaRawOption.seriesLayoutBy, upMetaRawOption.seriesLayoutBy) || null;\n var sourceHeader = retrieve2(newMetaRawOption.sourceHeader, upMetaRawOption.sourceHeader); // Note here we should not use `upSource.dimensionsDefine`. Consider the case:\n // `upSource.dimensionsDefine` is detected by `seriesLayoutBy: 'column'`,\n // but series need `seriesLayoutBy: 'row'`.\n\n var dimensions = retrieve2(newMetaRawOption.dimensions, upMetaRawOption.dimensions); // We share source with dataset as much as possible\n // to avoid extra memory cost of high dimensional data.\n\n var needsCreateSource = seriesLayoutBy !== upMetaRawOption.seriesLayoutBy || !!sourceHeader !== !!upMetaRawOption.sourceHeader || dimensions;\n resultSourceList = needsCreateSource ? [createSource(data, {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n }, sourceFormat)] : [];\n } else {\n var datasetModel = sourceHost; // Has upstream dataset.\n\n if (hasUpstream) {\n var result = this._applyTransform(upSourceMgrList);\n\n resultSourceList = result.sourceList;\n upstreamSignList = result.upstreamSignList;\n } // Is root dataset.\n else {\n var sourceData = datasetModel.get('source', true);\n resultSourceList = [createSource(sourceData, this._getSourceMetaRawOption(), null)];\n upstreamSignList = [];\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assert(resultSourceList && upstreamSignList);\n }\n\n this._setLocalSource(resultSourceList, upstreamSignList);\n };\n\n SourceManager.prototype._applyTransform = function (upMgrList) {\n var datasetModel = this._sourceHost;\n var transformOption = datasetModel.get('transform', true);\n var fromTransformResult = datasetModel.get('fromTransformResult', true);\n\n if (process.env.NODE_ENV !== 'production') {\n assert(fromTransformResult != null || transformOption != null);\n }\n\n if (fromTransformResult != null) {\n var errMsg = '';\n\n if (upMgrList.length !== 1) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'When using `fromTransformResult`, there should be only one upstream dataset';\n }\n\n doThrow(errMsg);\n }\n }\n\n var sourceList;\n var upSourceList = [];\n var upstreamSignList = [];\n each(upMgrList, function (upMgr) {\n upMgr.prepareSource();\n var upSource = upMgr.getSource(fromTransformResult || 0);\n var errMsg = '';\n\n if (fromTransformResult != null && !upSource) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Can not retrieve result by `fromTransformResult`: ' + fromTransformResult;\n }\n\n doThrow(errMsg);\n }\n\n upSourceList.push(upSource);\n upstreamSignList.push(upMgr._getVersionSign());\n });\n\n if (transformOption) {\n sourceList = applyDataTransform(transformOption, upSourceList, {\n datasetIndex: datasetModel.componentIndex\n });\n } else if (fromTransformResult != null) {\n sourceList = [cloneSourceShallow(upSourceList[0])];\n }\n\n return {\n sourceList: sourceList,\n upstreamSignList: upstreamSignList\n };\n };\n\n SourceManager.prototype._isDirty = function () {\n if (this._dirty) {\n return true;\n } // All sourceList is from the some upstream.\n\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n for (var i = 0; i < upSourceMgrList.length; i++) {\n var upSrcMgr = upSourceMgrList[i];\n\n if ( // Consider the case that there is ancestor diry, call it recursively.\n // The performance is probably not an issue because usually the chain is not long.\n upSrcMgr._isDirty() || this._upstreamSignList[i] !== upSrcMgr._getVersionSign()) {\n return true;\n }\n }\n };\n /**\n * @param sourceIndex By default 0, means \"main source\".\n * In most cases there is only one source.\n */\n\n\n SourceManager.prototype.getSource = function (sourceIndex) {\n sourceIndex = sourceIndex || 0;\n var source = this._sourceList[sourceIndex];\n\n if (!source) {\n // Series may share source instance with dataset.\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n return upSourceMgrList[0] && upSourceMgrList[0].getSource(sourceIndex);\n }\n\n return source;\n };\n /**\n *\n * Get a data store which can be shared across series.\n * Only available for series.\n *\n * @param seriesDimRequest Dimensions that are generated in series.\n * Should have been sorted by `storeDimIndex` asc.\n */\n\n\n SourceManager.prototype.getSharedDataStore = function (seriesDimRequest) {\n if (process.env.NODE_ENV !== 'production') {\n assert(isSeries(this._sourceHost), 'Can only call getDataStore on series source manager.');\n }\n\n var schema = seriesDimRequest.makeStoreSchema();\n return this._innerGetDataStore(schema.dimensions, seriesDimRequest.source, schema.hash);\n };\n\n SourceManager.prototype._innerGetDataStore = function (storeDims, seriesSource, sourceReadKey) {\n // TODO Can use other sourceIndex?\n var sourceIndex = 0;\n var storeList = this._storeList;\n var cachedStoreMap = storeList[sourceIndex];\n\n if (!cachedStoreMap) {\n cachedStoreMap = storeList[sourceIndex] = {};\n }\n\n var cachedStore = cachedStoreMap[sourceReadKey];\n\n if (!cachedStore) {\n var upSourceMgr = this._getUpstreamSourceManagers()[0];\n\n if (isSeries(this._sourceHost) && upSourceMgr) {\n cachedStore = upSourceMgr._innerGetDataStore(storeDims, seriesSource, sourceReadKey);\n } else {\n cachedStore = new DataStore(); // Always create store from source of series.\n\n cachedStore.initData(new DefaultDataProvider(seriesSource, storeDims.length), storeDims);\n }\n\n cachedStoreMap[sourceReadKey] = cachedStore;\n }\n\n return cachedStore;\n };\n /**\n * PENDING: Is it fast enough?\n * If no upstream, return empty array.\n */\n\n\n SourceManager.prototype._getUpstreamSourceManagers = function () {\n // Always get the relationship from the raw option.\n // Do not cache the link of the dependency graph, so that\n // there is no need to update them when change happens.\n var sourceHost = this._sourceHost;\n\n if (isSeries(sourceHost)) {\n var datasetModel = querySeriesUpstreamDatasetModel(sourceHost);\n return !datasetModel ? [] : [datasetModel.getSourceManager()];\n } else {\n return map(queryDatasetUpstreamDatasetModels(sourceHost), function (datasetModel) {\n return datasetModel.getSourceManager();\n });\n }\n };\n\n SourceManager.prototype._getSourceMetaRawOption = function () {\n var sourceHost = this._sourceHost;\n var seriesLayoutBy;\n var sourceHeader;\n var dimensions;\n\n if (isSeries(sourceHost)) {\n seriesLayoutBy = sourceHost.get('seriesLayoutBy', true);\n sourceHeader = sourceHost.get('sourceHeader', true);\n dimensions = sourceHost.get('dimensions', true);\n } // See [REQUIREMENT_MEMO], `non-root-dataset` do not support them.\n else if (!this._getUpstreamSourceManagers().length) {\n var model = sourceHost;\n seriesLayoutBy = model.get('seriesLayoutBy', true);\n sourceHeader = model.get('sourceHeader', true);\n dimensions = model.get('dimensions', true);\n }\n\n return {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n };\n };\n\n return SourceManager;\n}();\n\nexport { SourceManager }; // Call this method after `super.init` and `super.mergeOption` to\n// disable the transform merge, but do not disable transform clone from rawOption.\n\nexport function disableTransformOptionMerge(datasetModel) {\n var transformOption = datasetModel.option.transform;\n transformOption && setAsPrimitive(datasetModel.option.transform);\n}\n\nfunction isSeries(sourceHost) {\n // Avoid circular dependency with Series.ts\n return sourceHost.mainType === 'series';\n}\n\nfunction doThrow(errMsg) {\n throw new Error(errMsg);\n}","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src啊/ElectronicMallVue/node_modules/echarts/lib/data/helper/sourceManager.js"],"names":["setAsPrimitive","map","isTypedArray","assert","each","retrieve2","createSource","cloneSourceShallow","SOURCE_FORMAT_TYPED_ARRAY","SOURCE_FORMAT_ORIGINAL","querySeriesUpstreamDatasetModel","queryDatasetUpstreamDatasetModels","applyDataTransform","DataStore","DefaultDataProvider","SourceManager","sourceHost","_sourceList","_storeList","_upstreamSignList","_versionSignBase","_dirty","_sourceHost","prototype","dirty","_setLocalSource","sourceList","upstreamSignList","_getVersionSign","uid","prepareSource","_isDirty","_createSource","upSourceMgrList","_getUpstreamSourceManagers","hasUpstream","length","resultSourceList","isSeries","seriesModel","data","sourceFormat","upSource","upSourceMgr","getSource","get","newMetaRawOption","_getSourceMetaRawOption","upMetaRawOption","metaRawOption","seriesLayoutBy","sourceHeader","dimensions","needsCreateSource","datasetModel","result","_applyTransform","sourceData","process","env","NODE_ENV","upMgrList","transformOption","fromTransformResult","errMsg","doThrow","upSourceList","upMgr","push","datasetIndex","componentIndex","i","upSrcMgr","sourceIndex","source","getSharedDataStore","seriesDimRequest","schema","makeStoreSchema","_innerGetDataStore","hash","storeDims","seriesSource","sourceReadKey","storeList","cachedStoreMap","cachedStore","initData","getSourceManager","model","disableTransformOptionMerge","option","transform","mainType","Error"],"mappings":";;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAT,EAAyBC,GAAzB,EAA8BC,YAA9B,EAA4CC,MAA5C,EAAoDC,IAApD,EAA0DC,SAA1D,QAA2E,0BAA3E;AACA,SAASC,YAAT,EAAuBC,kBAAvB,QAAiD,cAAjD;AACA,SAASC,yBAAT,EAAoCC,sBAApC,QAAkE,qBAAlE;AACA,SAASC,+BAAT,EAA0CC,iCAA1C,QAAmF,mBAAnF;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,OAAOC,SAAP,MAAsB,iBAAtB;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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YAAY,CAACqC,MAAb,CAAoBC,SAA1C;AACA9B,EAAAA,eAAe,IAAI9D,cAAc,CAACsD,YAAY,CAACqC,MAAb,CAAoBC,SAArB,CAAjC;AACD;;AAED,SAAStD,QAAT,CAAkBtB,UAAlB,EAA8B;AAC5B;AACA,SAAOA,UAAU,CAAC6E,QAAX,KAAwB,QAA/B;AACD;;AAED,SAAS5B,OAAT,CAAiBD,MAAjB,EAAyB;AACvB,QAAM,IAAI8B,KAAJ,CAAU9B,MAAV,CAAN;AACD","sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { setAsPrimitive, map, isTypedArray, assert, each, retrieve2 } from 'zrender/lib/core/util.js';\nimport { createSource, cloneSourceShallow } from '../Source.js';\nimport { SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ORIGINAL } from '../../util/types.js';\nimport { querySeriesUpstreamDatasetModel, queryDatasetUpstreamDatasetModels } from './sourceHelper.js';\nimport { applyDataTransform } from './transform.js';\nimport DataStore from '../DataStore.js';\nimport { DefaultDataProvider } from './dataProvider.js';\n/**\n * [REQUIREMENT_MEMO]:\n * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option.\n * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and\n * `root-dataset`. Them on `series` has higher priority.\n * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might\n * confuse users: whether those props indicate how to visit the upstream source or visit\n * the transform result source, and some transforms has nothing to do with these props,\n * and some transforms might have multiple upstream.\n * (3) Transforms should specify `metaRawOption` in each output, just like they can be\n * declared in `root-dataset`.\n * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms.\n * That is for reducing complexity in transforms.\n * PENDING: Whether to provide transposition transform?\n *\n * [IMPLEMENTAION_MEMO]:\n * \"sourceVisitConfig\" are calculated from `metaRawOption` and `data`.\n * They will not be calculated until `source` is about to be visited (to prevent from\n * duplicate calcuation). `source` is visited only in series and input to transforms.\n *\n * [DIMENSION_INHERIT_RULE]:\n * By default the dimensions are inherited from ancestors, unless a transform return\n * a new dimensions definition.\n * Consider the case:\n * ```js\n * dataset: [{\n * source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * dataset: [{\n * dimension: ['Product', 'Sales', 'Prise'],\n * source: [ ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * ```\n * The two types of option should have the same behavior after transform.\n *\n *\n * [SCENARIO]:\n * (1) Provide source data directly:\n * ```js\n * series: {\n * encode: {...},\n * dimensions: [...]\n * seriesLayoutBy: 'row',\n * data: [[...]]\n * }\n * ```\n * (2) Series refer to dataset.\n * ```js\n * series: [{\n * encode: {...}\n * // Ignore datasetIndex means `datasetIndex: 0`\n * // and the dimensions defination in dataset is used\n * }, {\n * encode: {...},\n * seriesLayoutBy: 'column',\n * datasetIndex: 1\n * }]\n * ```\n * (3) dataset transform\n * ```js\n * dataset: [{\n * source: [...]\n * }, {\n * source: [...]\n * }, {\n * // By default from 0.\n * transform: { type: 'filter', config: {...} }\n * }, {\n * // Piped.\n * transform: [\n * { type: 'filter', config: {...} },\n * { type: 'sort', config: {...} }\n * ]\n * }, {\n * id: 'regressionData',\n * fromDatasetIndex: 1,\n * // Third-party transform\n * transform: { type: 'ecStat:regression', config: {...} }\n * }, {\n * // retrieve the extra result.\n * id: 'regressionFormula',\n * fromDatasetId: 'regressionData',\n * fromTransformResult: 1\n * }]\n * ```\n */\n\nvar SourceManager =\n/** @class */\nfunction () {\n function SourceManager(sourceHost) {\n // Cached source. Do not repeat calculating if not dirty.\n this._sourceList = [];\n this._storeList = []; // version sign of each upstream source manager.\n\n this._upstreamSignList = [];\n this._versionSignBase = 0;\n this._dirty = true;\n this._sourceHost = sourceHost;\n }\n /**\n * Mark dirty.\n */\n\n\n SourceManager.prototype.dirty = function () {\n this._setLocalSource([], []);\n\n this._storeList = [];\n this._dirty = true;\n };\n\n SourceManager.prototype._setLocalSource = function (sourceList, upstreamSignList) {\n this._sourceList = sourceList;\n this._upstreamSignList = upstreamSignList;\n this._versionSignBase++;\n\n if (this._versionSignBase > 9e10) {\n this._versionSignBase = 0;\n }\n };\n /**\n * For detecting whether the upstream source is dirty, so that\n * the local cached source (in `_sourceList`) should be discarded.\n */\n\n\n SourceManager.prototype._getVersionSign = function () {\n return this._sourceHost.uid + '_' + this._versionSignBase;\n };\n /**\n * Always return a source instance. Otherwise throw error.\n */\n\n\n SourceManager.prototype.prepareSource = function () {\n // For the case that call `setOption` multiple time but no data changed,\n // cache the result source to prevent from repeating transform.\n if (this._isDirty()) {\n this._createSource();\n\n this._dirty = false;\n }\n };\n\n SourceManager.prototype._createSource = function () {\n this._setLocalSource([], []);\n\n var sourceHost = this._sourceHost;\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n var hasUpstream = !!upSourceMgrList.length;\n var resultSourceList;\n var upstreamSignList;\n\n if (isSeries(sourceHost)) {\n var seriesModel = sourceHost;\n var data = void 0;\n var sourceFormat = void 0;\n var upSource = void 0; // Has upstream dataset\n\n if (hasUpstream) {\n var upSourceMgr = upSourceMgrList[0];\n upSourceMgr.prepareSource();\n upSource = upSourceMgr.getSource();\n data = upSource.data;\n sourceFormat = upSource.sourceFormat;\n upstreamSignList = [upSourceMgr._getVersionSign()];\n } // Series data is from own.\n else {\n data = seriesModel.get('data', true);\n sourceFormat = isTypedArray(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL;\n upstreamSignList = [];\n } // See [REQUIREMENT_MEMO], merge settings on series and parent dataset if it is root.\n\n\n var newMetaRawOption = this._getSourceMetaRawOption() || {};\n var upMetaRawOption = upSource && upSource.metaRawOption || {};\n var seriesLayoutBy = retrieve2(newMetaRawOption.seriesLayoutBy, upMetaRawOption.seriesLayoutBy) || null;\n var sourceHeader = retrieve2(newMetaRawOption.sourceHeader, upMetaRawOption.sourceHeader); // Note here we should not use `upSource.dimensionsDefine`. Consider the case:\n // `upSource.dimensionsDefine` is detected by `seriesLayoutBy: 'column'`,\n // but series need `seriesLayoutBy: 'row'`.\n\n var dimensions = retrieve2(newMetaRawOption.dimensions, upMetaRawOption.dimensions); // We share source with dataset as much as possible\n // to avoid extra memory cost of high dimensional data.\n\n var needsCreateSource = seriesLayoutBy !== upMetaRawOption.seriesLayoutBy || !!sourceHeader !== !!upMetaRawOption.sourceHeader || dimensions;\n resultSourceList = needsCreateSource ? [createSource(data, {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n }, sourceFormat)] : [];\n } else {\n var datasetModel = sourceHost; // Has upstream dataset.\n\n if (hasUpstream) {\n var result = this._applyTransform(upSourceMgrList);\n\n resultSourceList = result.sourceList;\n upstreamSignList = result.upstreamSignList;\n } // Is root dataset.\n else {\n var sourceData = datasetModel.get('source', true);\n resultSourceList = [createSource(sourceData, this._getSourceMetaRawOption(), null)];\n upstreamSignList = [];\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assert(resultSourceList && upstreamSignList);\n }\n\n this._setLocalSource(resultSourceList, upstreamSignList);\n };\n\n SourceManager.prototype._applyTransform = function (upMgrList) {\n var datasetModel = this._sourceHost;\n var transformOption = datasetModel.get('transform', true);\n var fromTransformResult = datasetModel.get('fromTransformResult', true);\n\n if (process.env.NODE_ENV !== 'production') {\n assert(fromTransformResult != null || transformOption != null);\n }\n\n if (fromTransformResult != null) {\n var errMsg = '';\n\n if (upMgrList.length !== 1) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'When using `fromTransformResult`, there should be only one upstream dataset';\n }\n\n doThrow(errMsg);\n }\n }\n\n var sourceList;\n var upSourceList = [];\n var upstreamSignList = [];\n each(upMgrList, function (upMgr) {\n upMgr.prepareSource();\n var upSource = upMgr.getSource(fromTransformResult || 0);\n var errMsg = '';\n\n if (fromTransformResult != null && !upSource) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Can not retrieve result by `fromTransformResult`: ' + fromTransformResult;\n }\n\n doThrow(errMsg);\n }\n\n upSourceList.push(upSource);\n upstreamSignList.push(upMgr._getVersionSign());\n });\n\n if (transformOption) {\n sourceList = applyDataTransform(transformOption, upSourceList, {\n datasetIndex: datasetModel.componentIndex\n });\n } else if (fromTransformResult != null) {\n sourceList = [cloneSourceShallow(upSourceList[0])];\n }\n\n return {\n sourceList: sourceList,\n upstreamSignList: upstreamSignList\n };\n };\n\n SourceManager.prototype._isDirty = function () {\n if (this._dirty) {\n return true;\n } // All sourceList is from the some upstream.\n\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n for (var i = 0; i < upSourceMgrList.length; i++) {\n var upSrcMgr = upSourceMgrList[i];\n\n if ( // Consider the case that there is ancestor diry, call it recursively.\n // The performance is probably not an issue because usually the chain is not long.\n upSrcMgr._isDirty() || this._upstreamSignList[i] !== upSrcMgr._getVersionSign()) {\n return true;\n }\n }\n };\n /**\n * @param sourceIndex By default 0, means \"main source\".\n * In most cases there is only one source.\n */\n\n\n SourceManager.prototype.getSource = function (sourceIndex) {\n sourceIndex = sourceIndex || 0;\n var source = this._sourceList[sourceIndex];\n\n if (!source) {\n // Series may share source instance with dataset.\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n return upSourceMgrList[0] && upSourceMgrList[0].getSource(sourceIndex);\n }\n\n return source;\n };\n /**\n *\n * Get a data store which can be shared across series.\n * Only available for series.\n *\n * @param seriesDimRequest Dimensions that are generated in series.\n * Should have been sorted by `storeDimIndex` asc.\n */\n\n\n SourceManager.prototype.getSharedDataStore = function (seriesDimRequest) {\n if (process.env.NODE_ENV !== 'production') {\n assert(isSeries(this._sourceHost), 'Can only call getDataStore on series source manager.');\n }\n\n var schema = seriesDimRequest.makeStoreSchema();\n return this._innerGetDataStore(schema.dimensions, seriesDimRequest.source, schema.hash);\n };\n\n SourceManager.prototype._innerGetDataStore = function (storeDims, seriesSource, sourceReadKey) {\n // TODO Can use other sourceIndex?\n var sourceIndex = 0;\n var storeList = this._storeList;\n var cachedStoreMap = storeList[sourceIndex];\n\n if (!cachedStoreMap) {\n cachedStoreMap = storeList[sourceIndex] = {};\n }\n\n var cachedStore = cachedStoreMap[sourceReadKey];\n\n if (!cachedStore) {\n var upSourceMgr = this._getUpstreamSourceManagers()[0];\n\n if (isSeries(this._sourceHost) && upSourceMgr) {\n cachedStore = upSourceMgr._innerGetDataStore(storeDims, seriesSource, sourceReadKey);\n } else {\n cachedStore = new DataStore(); // Always create store from source of series.\n\n cachedStore.initData(new DefaultDataProvider(seriesSource, storeDims.length), storeDims);\n }\n\n cachedStoreMap[sourceReadKey] = cachedStore;\n }\n\n return cachedStore;\n };\n /**\n * PENDING: Is it fast enough?\n * If no upstream, return empty array.\n */\n\n\n SourceManager.prototype._getUpstreamSourceManagers = function () {\n // Always get the relationship from the raw option.\n // Do not cache the link of the dependency graph, so that\n // there is no need to update them when change happens.\n var sourceHost = this._sourceHost;\n\n if (isSeries(sourceHost)) {\n var datasetModel = querySeriesUpstreamDatasetModel(sourceHost);\n return !datasetModel ? [] : [datasetModel.getSourceManager()];\n } else {\n return map(queryDatasetUpstreamDatasetModels(sourceHost), function (datasetModel) {\n return datasetModel.getSourceManager();\n });\n }\n };\n\n SourceManager.prototype._getSourceMetaRawOption = function () {\n var sourceHost = this._sourceHost;\n var seriesLayoutBy;\n var sourceHeader;\n var dimensions;\n\n if (isSeries(sourceHost)) {\n seriesLayoutBy = sourceHost.get('seriesLayoutBy', true);\n sourceHeader = sourceHost.get('sourceHeader', true);\n dimensions = sourceHost.get('dimensions', true);\n } // See [REQUIREMENT_MEMO], `non-root-dataset` do not support them.\n else if (!this._getUpstreamSourceManagers().length) {\n var model = sourceHost;\n seriesLayoutBy = model.get('seriesLayoutBy', true);\n sourceHeader = model.get('sourceHeader', true);\n dimensions = model.get('dimensions', true);\n }\n\n return {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n };\n };\n\n return SourceManager;\n}();\n\nexport { SourceManager }; // Call this method after `super.init` and `super.mergeOption` to\n// disable the transform merge, but do not disable transform clone from rawOption.\n\nexport function disableTransformOptionMerge(datasetModel) {\n var transformOption = datasetModel.option.transform;\n transformOption && setAsPrimitive(datasetModel.option.transform);\n}\n\nfunction isSeries(sourceHost) {\n // Avoid circular dependency with Series.ts\n return sourceHost.mainType === 'series';\n}\n\nfunction doThrow(errMsg) {\n throw new Error(errMsg);\n}"]},"metadata":{},"sourceType":"module"}