extension.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. var extensions = [];
  49. var extensionRegisters = {
  50. registerPreprocessor: registerPreprocessor,
  51. registerProcessor: registerProcessor,
  52. registerPostInit: registerPostInit,
  53. registerPostUpdate: registerPostUpdate,
  54. registerUpdateLifecycle: registerUpdateLifecycle,
  55. registerAction: registerAction,
  56. registerCoordinateSystem: registerCoordinateSystem,
  57. registerLayout: registerLayout,
  58. registerVisual: registerVisual,
  59. registerTransform: registerTransform,
  60. registerLoading: registerLoading,
  61. registerMap: registerMap,
  62. registerImpl: registerImpl,
  63. PRIORITY: PRIORITY,
  64. ComponentModel: ComponentModel,
  65. ComponentView: ComponentView,
  66. SeriesModel: SeriesModel,
  67. ChartView: ChartView,
  68. // TODO Use ComponentModel and SeriesModel instead of Constructor
  69. registerComponentModel: function (ComponentModelClass) {
  70. ComponentModel.registerClass(ComponentModelClass);
  71. },
  72. registerComponentView: function (ComponentViewClass) {
  73. ComponentView.registerClass(ComponentViewClass);
  74. },
  75. registerSeriesModel: function (SeriesModelClass) {
  76. SeriesModel.registerClass(SeriesModelClass);
  77. },
  78. registerChartView: function (ChartViewClass) {
  79. ChartView.registerClass(ChartViewClass);
  80. },
  81. registerSubTypeDefaulter: function (componentType, defaulter) {
  82. ComponentModel.registerSubTypeDefaulter(componentType, defaulter);
  83. },
  84. registerPainter: function (painterType, PainterCtor) {
  85. registerPainter(painterType, PainterCtor);
  86. }
  87. };
  88. export function use(ext) {
  89. if (isArray(ext)) {
  90. // use([ChartLine, ChartBar]);
  91. each(ext, function (singleExt) {
  92. use(singleExt);
  93. });
  94. return;
  95. }
  96. if (indexOf(extensions, ext) >= 0) {
  97. return;
  98. }
  99. extensions.push(ext);
  100. if (isFunction(ext)) {
  101. ext = {
  102. install: ext
  103. };
  104. }
  105. ext.install(extensionRegisters);
  106. }