extension.js 3.9 KB

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