
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
import ComponentModel from '../../model/Component.js';
import ComponentView from '../../view/Component.js';
import env from 'tvrender/lib/core/env.js';
var LimitTipModel = /** @class */function (_super) {
  __extends(LimitTipModel, _super);
  function LimitTipModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LimitTipModel.type;
    _this.layoutMode = {
      type: 'box',
      ignoreSize: true
    };
    return _this;
  }
  LimitTipModel.type = 'limitTip';
  LimitTipModel.defaultOption = {
    show: true,
    elId: 'limitTip'
  };
  return LimitTipModel;
}(ComponentModel);
// View
var LimitTipView = /** @class */function (_super) {
  __extends(LimitTipView, _super);
  function LimitTipView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LimitTipView.type;
    return _this;
  }
  LimitTipView.prototype.init = function (ecModel, api) {
    if (env.node || !api.getDom()) {
      return;
    }
    var el = document.createElement('div');
    el.style.position = 'absolute';
    el.style.top = '50%';
    el.style.transform = 'translateY(-50%)';
    // el.style.pointerEvents = 'none';
    this.warpEl = el;
    api.getDom().parentNode.appendChild(el);
  };
  LimitTipView.prototype.render = function (limitTipModel, ecModel, api) {
    if (!limitTipModel.get('show')) {
      return;
    }
    var grid = ecModel.getComponent('grid', 0);
    var coordSys = grid.coordinateSystem;
    if (!coordSys) {
      return;
    }
    var warpEl = this.warpEl;
    warpEl.id = limitTipModel.get('elId');
    var xAxisModel = coordSys.getAxis('x');
    var startX = xAxisModel.dataToCoord(0);
    warpEl.style.left = startX - 580 - 50 + 'px';
  };
  LimitTipView.prototype.dispose = function (ecModel, api) {
    if (env.node || !api.getDom()) {
      return;
    }
    var parentNode = this.warpEl.parentNode;
    parentNode && parentNode.removeChild(this.warpEl);
    this.warpEl = null;
  };
  LimitTipView.type = 'limitTip';
  return LimitTipView;
}(ComponentView);
export function install(registers) {
  registers.registerComponentModel(LimitTipModel);
  registers.registerComponentView(LimitTipView);
}