extension.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /**
  20. * AUTO-GENERATED FILE. DO NOT MODIFY.
  21. */
  22. /*
  23. * Licensed to the Apache Software Foundation (ASF) under one
  24. * or more contributor license agreements. See the NOTICE file
  25. * distributed with this work for additional information
  26. * regarding copyright ownership. The ASF licenses this file
  27. * to you under the Apache License, Version 2.0 (the
  28. * "License"); you may not use this file except in compliance
  29. * with the License. You may obtain a copy of the License at
  30. *
  31. * http://www.apache.org/licenses/LICENSE-2.0
  32. *
  33. * Unless required by applicable law or agreed to in writing,
  34. * software distributed under the License is distributed on an
  35. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  36. * KIND, either express or implied. See the License for the
  37. * specific language governing permissions and limitations
  38. * under the License.
  39. */
  40. import { registerPreprocessor, registerProcessor, registerPostInit, registerPostUpdate, registerAction, registerCoordinateSystem, registerLayout, registerVisual, registerTransform, registerLoading, registerMap, registerUpdateLifecycle, PRIORITY } from './core/echarts.js';
  41. import ComponentView from './view/Component.js';
  42. import ChartView from './view/Chart.js';
  43. import ComponentModel from './model/Component.js';
  44. import SeriesModel from './model/Series.js';
  45. import { isFunction, indexOf, isArray, each } from 'zrender/lib/core/util.js';
  46. import { registerImpl } from './core/impl.js';
  47. import { registerPainter } from 'zrender/lib/zrender.js';
  48. import { registerCustomSeries } from './chart/custom/customSeriesRegister.js';
  49. var extensions = [];
  50. var extensionRegisters = {
  51. registerPreprocessor: registerPreprocessor,
  52. registerProcessor: registerProcessor,
  53. registerPostInit: registerPostInit,
  54. registerPostUpdate: registerPostUpdate,
  55. registerUpdateLifecycle: registerUpdateLifecycle,
  56. registerAction: registerAction,
  57. registerCoordinateSystem: registerCoordinateSystem,
  58. registerLayout: registerLayout,
  59. registerVisual: registerVisual,
  60. registerTransform: registerTransform,
  61. registerLoading: registerLoading,
  62. registerMap: registerMap,
  63. registerImpl: registerImpl,
  64. PRIORITY: PRIORITY,
  65. ComponentModel: ComponentModel,
  66. ComponentView: ComponentView,
  67. SeriesModel: SeriesModel,
  68. ChartView: ChartView,
  69. // TODO Use ComponentModel and SeriesModel instead of Constructor
  70. registerComponentModel: function (ComponentModelClass) {
  71. ComponentModel.registerClass(ComponentModelClass);
  72. },
  73. registerComponentView: function (ComponentViewClass) {
  74. ComponentView.registerClass(ComponentViewClass);
  75. },
  76. registerSeriesModel: function (SeriesModelClass) {
  77. SeriesModel.registerClass(SeriesModelClass);
  78. },
  79. registerChartView: function (ChartViewClass) {
  80. ChartView.registerClass(ChartViewClass);
  81. },
  82. registerCustomSeries: function (seriesType, renderItem) {
  83. registerCustomSeries(seriesType, renderItem);
  84. },
  85. registerSubTypeDefaulter: function (componentType, defaulter) {
  86. ComponentModel.registerSubTypeDefaulter(componentType, defaulter);
  87. },
  88. registerPainter: function (painterType, PainterCtor) {
  89. registerPainter(painterType, PainterCtor);
  90. }
  91. };
  92. export function use(ext) {
  93. if (isArray(ext)) {
  94. // use([ChartLine, ChartBar]);
  95. each(ext, function (singleExt) {
  96. use(singleExt);
  97. });
  98. return;
  99. }
  100. if (indexOf(extensions, ext) >= 0) {
  101. return;
  102. }
  103. extensions.push(ext);
  104. if (isFunction(ext)) {
  105. ext = {
  106. install: ext
  107. };
  108. }
  109. ext.install(extensionRegisters);
  110. }