"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _comp = require("../../ui/src/comp");
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _ui = require("../../ui");
var _vn = require("../../ui/src/vn");
var _log = require("../../ui/src/log");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const {
  getConfig,
  getIcon,
  getI18n,
  renderer,
  commands,
  createEvent,
  globalMixins,
  renderEmptyElement
} = _ui.VxeUI;
function createInternalData() {
  return {
    connectTable: null
  };
}
var _default = exports.default = /* define-vxe-component start */(0, _comp.defineVxeComponent)({
  name: 'VxeToolbar',
  mixins: [globalMixins.sizeMixin],
  props: {
    loading: Boolean,
    refresh: [Boolean, Object],
    refreshOptions: Object,
    import: [Boolean, Object],
    importOptions: Object,
    export: [Boolean, Object],
    exportOptions: Object,
    print: [Boolean, Object],
    printOptions: Object,
    zoom: [Boolean, Object],
    zoomOptions: Object,
    custom: [Boolean, Object],
    customOptions: Object,
    buttons: {
      type: Array,
      default: () => getConfig().toolbar.buttons
    },
    tools: {
      type: Array,
      default: () => getConfig().toolbar.tools
    },
    perfect: {
      type: Boolean,
      default: () => getConfig().toolbar.perfect
    },
    size: {
      type: String,
      default: () => getConfig().toolbar.size || getConfig().size
    },
    className: [String, Function]
  },
  inject: {
    $xeGrid: {
      default: null
    },
    $xeGantt: {
      default: null
    }
  },
  data() {
    const xID = _xeUtils.default.uniqueId();
    const reactData = {
      isRefresh: false,
      connectFlag: 0,
      columns: []
    };
    const internalData = createInternalData();
    return {
      xID,
      reactData,
      internalData
    };
  },
  computed: Object.assign(Object.assign({}, {}), {
    computeRefreshOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.refresh, true), props.refreshOptions, props.refresh);
    },
    computeImportOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.import, true), props.importOptions, props.import);
    },
    computeExportOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.export, true), props.exportOptions, props.export);
    },
    computePrintOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.print, true), props.printOptions, props.print);
    },
    computeZoomOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.zoom, true), props.zoomOptions, props.zoom);
    },
    computeCustomOpts() {
      const $xeToolbar = this;
      const props = $xeToolbar;
      return Object.assign({}, _xeUtils.default.clone(getConfig().toolbar.custom, true), props.customOptions, props.custom);
    },
    computeTableCustomOpts() {
      const $xeToolbar = this;
      const reactData = $xeToolbar.reactData;
      const internalData = $xeToolbar.internalData;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      if (reactData.connectFlag || $table) {
        if ($table) {
          return $table.computeCustomOpts;
        }
      }
      return {
        trigger: ''
      };
    },
    computeTrigger() {
      const $xeToolbar = this;
      const tableCustomOpts = $xeToolbar.computeTableCustomOpts;
      return tableCustomOpts.trigger;
    }
  }),
  methods: {
    //
    // Method
    //
    dispatchEvent(type, params, evnt) {
      const $xeToolbar = this;
      $xeToolbar.$emit(type, createEvent(evnt, {
        $toolbar: $xeToolbar
      }, params));
    },
    fintTable() {
      const {
        $children
      } = this.$parent;
      const selfIndex = $children.indexOf(this);
      return _xeUtils.default.find($children, (comp, index) => comp && comp.loadData && index > selfIndex && comp.$vnode.componentOptions.tag === 'vxe-table');
    },
    syncUpdate(params) {
      const $xeToolbar = this;
      const reactData = $xeToolbar.reactData;
      const internalData = $xeToolbar.internalData;
      internalData.connectTable = params.$table;
      reactData.columns = params.collectColumn;
      reactData.connectFlag++;
    },
    checkTable() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      if ($table) {
        return true;
      }
      (0, _log.errLog)('vxe.error.barUnableLink');
    },
    handleClickSettingEvent({
      $event
    }) {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      if ($table) {
        if ($table.triggerCustomEvent) {
          $table.triggerCustomEvent($event);
        }
      }
    },
    handleMouseenterSettingEvent({
      $event
    }) {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      if ($table) {
        $table.customOpenEvent($event);
      }
    },
    handleMouseleaveSettingEvent({
      $event
    }) {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      if ($table) {
        const {
          customStore
        } = $table.reactData;
        customStore.activeBtn = false;
        setTimeout(() => {
          if (!customStore.activeBtn && !customStore.activeWrapper) {
            $table.customCloseEvent($event);
          }
        }, 350);
      }
    },
    refreshEvent({
      $event
    }) {
      const $xeToolbar = this;
      const reactData = $xeToolbar.reactData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      const {
        isRefresh
      } = reactData;
      const refreshOpts = $xeToolbar.computeRefreshOpts;
      if (!isRefresh) {
        const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
        if (queryMethod) {
          reactData.isRefresh = true;
          try {
            Promise.resolve(queryMethod({})).catch(e => e).then(() => {
              reactData.isRefresh = false;
            });
          } catch (e) {
            reactData.isRefresh = false;
          }
        } else if ($xeGGWrapper) {
          reactData.isRefresh = true;
          $xeGGWrapper.triggerToolbarCommitEvent({
            code: refreshOpts.code || 'reload'
          }, $event).catch(() => {}).then(() => {
            reactData.isRefresh = false;
          });
        }
      }
    },
    zoomEvent({
      $event
    }) {
      const $xeToolbar = this;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      if ($xeGGWrapper) {
        $xeGGWrapper.triggerZoomEvent($event);
      } else {
        (0, _log.warnLog)('vxe.error.notProp', ['[toolbar] zoom']);
      }
    },
    importEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.importData();
        }
      }
    },
    openImportEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.openImport();
        }
      }
    },
    exportEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.exportData();
        }
      }
    },
    openExportEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.openExport();
        }
      }
    },
    printEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.print();
        }
      }
    },
    openPrintEvent() {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      if ($xeToolbar.checkTable()) {
        const {
          connectTable
        } = internalData;
        const $table = connectTable;
        if ($table) {
          $table.openPrint();
        }
      }
    },
    handleDefaultCodeEvent(eventParams, item, cb) {
      const $xeToolbar = this;
      switch (item.code) {
        case 'print':
          $xeToolbar.printEvent();
          break;
        case 'open_print':
          $xeToolbar.openPrintEvent();
          break;
        case 'custom':
          $xeToolbar.handleClickSettingEvent(eventParams);
          break;
        case 'export':
          $xeToolbar.exportEvent();
          break;
        case 'open_export':
          $xeToolbar.openExportEvent();
          break;
        case 'import':
          $xeToolbar.importEvent();
          break;
        case 'open_import':
          $xeToolbar.openImportEvent();
          break;
        case 'zoom':
          $xeToolbar.zoomEvent(eventParams);
          break;
        case 'refresh':
          $xeToolbar.refreshEvent(eventParams);
          break;
        default:
          cb();
          break;
      }
    },
    btnEvent(eventParams, item) {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      const {
        $event
      } = eventParams;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      const {
        code
      } = item;
      if (code) {
        $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
          if ($xeGGWrapper) {
            $xeGGWrapper.triggerToolbarBtnEvent(item, $event);
          } else {
            const gCommandOpts = commands.get(code);
            const params = {
              code,
              button: item,
              $table: $table,
              $grid: $xeGrid,
              $gantt: $xeGantt,
              $event
            };
            if (gCommandOpts) {
              const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
              if (tCommandMethod) {
                tCommandMethod(params);
              } else {
                (0, _log.errLog)('vxe.error.notCommands', [`[toolbar] ${code}`]);
              }
            }
            $xeToolbar.dispatchEvent('button-click', params, $event);
          }
        });
      }
    },
    tolEvent(eventParams, item) {
      const $xeToolbar = this;
      const internalData = $xeToolbar.internalData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      const {
        $event
      } = eventParams;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      const {
        code
      } = item;
      if (code) {
        $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
          if ($xeGGWrapper) {
            $xeGGWrapper.triggerToolbarTolEvent(item, $event);
          } else {
            const gCommandOpts = commands.get(code);
            const params = {
              code,
              button: null,
              tool: item,
              $table: $table,
              $grid: $xeGrid,
              $gantt: $xeGantt,
              $event
            };
            if (gCommandOpts) {
              const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
              if (tCommandMethod) {
                tCommandMethod(params);
              } else {
                (0, _log.errLog)('vxe.error.notCommands', [`[toolbar] ${code}`]);
              }
            }
            $xeToolbar.dispatchEvent('tool-click', params, $event);
          }
        });
      }
    },
    //
    // Render
    //
    renderDropdowns(h, item, isBtn) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const {
        dropdowns
      } = item;
      const downVNs = [];
      if (dropdowns) {
        return dropdowns.map((child, index) => {
          if (child.visible === false) {
            return renderEmptyElement($xeToolbar);
          }
          return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
            key: index,
            props: Object.assign({}, child, {
              content: child.content || child.name,
              options: undefined
            }),
            on: {
              click: eventParams => isBtn ? $xeToolbar.btnEvent(eventParams, child) : $xeToolbar.tolEvent(eventParams, child)
            }
          }) : renderEmptyElement($xeToolbar);
        });
      }
      return downVNs;
    },
    /**
     * 渲染按钮
     */
    renderLeftBtns(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const props = $xeToolbar;
      const slots = $xeToolbar.$scopedSlots;
      const internalData = $xeToolbar.internalData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const {
        buttons
      } = props;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      const buttonPrefixSlot = slots.buttonPrefix || slots['button-prefix'];
      const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix'];
      const btnVNs = [];
      if (buttonPrefixSlot) {
        btnVNs.push(...(0, _vn.getSlotVNs)(buttonPrefixSlot.call($xeToolbar, {
          buttons: buttons || [],
          $grid: $xeGrid,
          $gantt: $xeGantt,
          $table: $table
        })));
      }
      if (buttons) {
        buttons.forEach(item => {
          const {
            dropdowns,
            buttonRender
          } = item;
          if (item.visible !== false) {
            const compConf = buttonRender ? renderer.get(buttonRender.name) : null;
            if (buttonRender && compConf && compConf.renderToolbarButton) {
              const toolbarButtonClassName = compConf.toolbarButtonClassName;
              const params = {
                $grid: $xeGrid,
                $gantt: $xeGantt,
                $table: $table,
                button: item
              };
              btnVNs.push(h('span', {
                class: ['vxe-button--item', toolbarButtonClassName ? _xeUtils.default.isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName : '']
              }, (0, _vn.getSlotVNs)(compConf.renderToolbarButton(h, buttonRender, params))));
            } else {
              if (VxeUIButtonComponent) {
                btnVNs.push(h(VxeUIButtonComponent, {
                  props: Object.assign({}, item, {
                    content: item.content || item.name,
                    options: undefined
                  }),
                  on: {
                    click: eventParams => $xeToolbar.btnEvent(eventParams, item)
                  },
                  scopedSlots: dropdowns && dropdowns.length ? {
                    dropdowns: () => $xeToolbar.renderDropdowns(h, item, true)
                  } : {}
                }));
              }
            }
          }
        });
      }
      if (buttonSuffixSlot) {
        btnVNs.push(...(0, _vn.getSlotVNs)(buttonSuffixSlot.call($xeToolbar, {
          buttons: buttons || [],
          $grid: $xeGrid,
          $gantt: $xeGantt,
          $table: $table
        })));
      }
      return btnVNs;
    },
    /**
     * 渲染右侧工具
     */
    renderRightTools(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const props = $xeToolbar;
      const slots = $xeToolbar.$scopedSlots;
      const internalData = $xeToolbar.internalData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const {
        tools
      } = props;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      const toolPrefixSlot = slots.toolPrefix || slots['tool-prefix'];
      const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix'];
      const btnVNs = [];
      if (toolPrefixSlot) {
        btnVNs.push(...(0, _vn.getSlotVNs)(toolPrefixSlot.call($xeToolbar, {
          tools: tools || [],
          $grid: $xeGrid,
          $gantt: $xeGantt,
          $table: $table
        })));
      }
      if (tools) {
        tools.forEach((item, tIndex) => {
          const {
            dropdowns,
            toolRender
          } = item;
          if (item.visible !== false) {
            const rdName = toolRender ? toolRender.name : null;
            const compConf = toolRender ? renderer.get(rdName) : null;
            if (toolRender && compConf && compConf.renderToolbarTool) {
              const toolbarToolClassName = compConf.toolbarToolClassName;
              const params = {
                $grid: $xeGrid,
                $gantt: $xeGantt,
                $table: $table,
                tool: item
              };
              btnVNs.push(h('span', {
                key: rdName,
                class: ['vxe-tool--item', toolbarToolClassName ? _xeUtils.default.isFunction(toolbarToolClassName) ? toolbarToolClassName(params) : toolbarToolClassName : '']
              }, (0, _vn.getSlotVNs)(compConf.renderToolbarTool(h, toolRender, params))));
            } else {
              if (VxeUIButtonComponent) {
                btnVNs.push(h(VxeUIButtonComponent, {
                  key: tIndex,
                  props: Object.assign({}, item, {
                    content: item.content || item.name,
                    options: undefined
                  }),
                  on: {
                    click: eventParams => $xeToolbar.tolEvent(eventParams, item)
                  },
                  scopedSlots: dropdowns && dropdowns.length ? {
                    dropdowns: () => $xeToolbar.renderDropdowns(h, item, false)
                  } : {}
                }));
              }
            }
          }
        });
      }
      if (toolSuffixSlot) {
        btnVNs.push(...(0, _vn.getSlotVNs)(toolSuffixSlot.call($xeToolbar, {
          tools: tools || [],
          $grid: $xeGrid,
          $gantt: $xeGantt,
          $table: $table
        })));
      }
      return btnVNs;
    },
    renderToolImport(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const importOpts = $xeToolbar.computeImportOpts;
      return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'import',
        props: {
          circle: true,
          icon: importOpts.icon || getIcon().TOOLBAR_TOOLS_IMPORT,
          title: getI18n('vxe.toolbar.import')
        },
        on: {
          click: $xeToolbar.openImportEvent
        }
      }) : renderEmptyElement($xeToolbar);
    },
    renderToolExport(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const exportOpts = $xeToolbar.computeExportOpts;
      return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'export',
        props: {
          circle: true,
          icon: exportOpts.icon || getIcon().TOOLBAR_TOOLS_EXPORT,
          title: getI18n('vxe.toolbar.export')
        },
        on: {
          click: $xeToolbar.openExportEvent
        }
      }) : renderEmptyElement($xeToolbar);
    },
    renderToolPrint(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const printOpts = $xeToolbar.computePrintOpts;
      return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'print',
        props: {
          circle: true,
          icon: printOpts.icon || getIcon().TOOLBAR_TOOLS_PRINT,
          title: getI18n('vxe.toolbar.print')
        },
        on: {
          click: $xeToolbar.openPrintEvent
        }
      }) : renderEmptyElement($xeToolbar);
    },
    renderToolRefresh(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const reactData = $xeToolbar.reactData;
      const refreshOpts = $xeToolbar.computeRefreshOpts;
      return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'refresh',
        props: {
          circle: true,
          icon: reactData.isRefresh ? refreshOpts.iconLoading || getIcon().TOOLBAR_TOOLS_REFRESH_LOADING : refreshOpts.icon || getIcon().TOOLBAR_TOOLS_REFRESH,
          title: getI18n('vxe.toolbar.refresh')
        },
        on: {
          click: $xeToolbar.refreshEvent
        }
      }) : renderEmptyElement($xeToolbar);
    },
    renderToolZoom(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      const zoomOpts = $xeToolbar.computeZoomOpts;
      return $xeGGWrapper && VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'zoom',
        props: {
          circle: true,
          icon: $xeGGWrapper.isMaximized() ? zoomOpts.iconOut || getIcon().TOOLBAR_TOOLS_MINIMIZE : zoomOpts.iconIn || getIcon().TOOLBAR_TOOLS_FULLSCREEN,
          title: getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? 'Out' : 'In'}`)
        },
        on: {
          click: $xeToolbar.zoomEvent
        }
      }) : renderEmptyElement($xeToolbar);
    },
    renderToolCustom(h) {
      // 使用已安装的组件，如果未安装则不渲染
      const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
      const $xeToolbar = this;
      const customOpts = $xeToolbar.computeCustomOpts;
      const btnTrigger = $xeToolbar.computeTrigger;
      const customBtnOns = {};
      if (btnTrigger === 'manual') {
        // 手动触发
      } else if (btnTrigger === 'hover') {
        // hover 触发
        customBtnOns.mouseenter = $xeToolbar.handleMouseenterSettingEvent;
        customBtnOns.mouseleave = $xeToolbar.handleMouseleaveSettingEvent;
      } else {
        // 点击触发
        customBtnOns.click = $xeToolbar.handleClickSettingEvent;
      }
      return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
        key: 'custom',
        props: {
          circle: true,
          icon: customOpts.icon || getIcon().TOOLBAR_TOOLS_CUSTOM,
          title: getI18n('vxe.toolbar.custom'),
          className: 'vxe-toolbar-custom-target'
        },
        on: customBtnOns
      }) : renderEmptyElement($xeToolbar);
    },
    renderVN(h) {
      const $xeToolbar = this;
      const props = $xeToolbar;
      const slots = $xeToolbar.$scopedSlots;
      const internalData = $xeToolbar.internalData;
      const $xeGrid = $xeToolbar.$xeGrid;
      const $xeGantt = $xeToolbar.$xeGantt;
      const $xeGGWrapper = $xeGrid || $xeGantt;
      const {
        perfect,
        loading,
        refresh,
        zoom,
        custom,
        className
      } = props;
      const {
        connectTable
      } = internalData;
      const $table = connectTable;
      const toolsSlot = slots.tools;
      const buttonsSlot = slots.buttons;
      const vSize = $xeToolbar.computeSize;
      return h('div', {
        ref: 'refElem',
        class: ['vxe-toolbar', className ? _xeUtils.default.isFunction(className) ? className({
          $toolbar: $xeToolbar
        }) : className : '', {
          [`size--${vSize}`]: vSize,
          'is--perfect': perfect,
          'is--loading': loading
        }]
      }, [h('div', {
        class: 'vxe-buttons--wrapper'
      }, buttonsSlot ? buttonsSlot({
        $grid: $xeGrid,
        $gantt: $xeGantt,
        $table: $table
      }) : $xeToolbar.renderLeftBtns(h)), h('div', {
        class: 'vxe-tools--wrapper'
      }, toolsSlot ? toolsSlot({
        $grid: $xeGrid,
        $gantt: $xeGantt,
        $table: $table
      }) : $xeToolbar.renderRightTools(h)), h('div', {
        class: 'vxe-tools--operate'
      }, [props.import ? $xeToolbar.renderToolImport(h) : renderEmptyElement($xeToolbar), props.export ? $xeToolbar.renderToolExport(h) : renderEmptyElement($xeToolbar), props.print ? $xeToolbar.renderToolPrint(h) : renderEmptyElement($xeToolbar), refresh ? $xeToolbar.renderToolRefresh(h) : renderEmptyElement($xeToolbar), zoom && $xeGGWrapper ? $xeToolbar.renderToolZoom(h) : renderEmptyElement($xeToolbar), custom ? $xeToolbar.renderToolCustom(h) : renderEmptyElement($xeToolbar)])]);
    }
  },
  created() {
    const $xeToolbar = this;
    const props = $xeToolbar;
    const $xeGrid = $xeToolbar.$xeGrid;
    const $xeGantt = $xeToolbar.$xeGantt;
    const $xeGGWrapper = $xeGrid || $xeGantt;
    $xeToolbar.$nextTick(() => {
      const refreshOpts = $xeToolbar.computeRefreshOpts;
      const $xeTable = $xeToolbar.fintTable();
      const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
      if (props.refresh && !$xeGGWrapper && !queryMethod) {
        (0, _log.warnLog)('vxe.error.notFunc', ['[toolbar] queryMethod']);
      }
      if (_xeUtils.default.isPlainObject(props.custom)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] custom={...}', 'custom=boolean & custom-options={...}']);
      }
      if (_xeUtils.default.isPlainObject(props.print)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] print={...}', 'print=boolean & print-options={...}']);
      }
      if (_xeUtils.default.isPlainObject(props.export)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] export={...}', 'export=boolean & export-options={...}']);
      }
      if (_xeUtils.default.isPlainObject(props.import)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] import={...}', 'import=boolean & import-options={...}']);
      }
      if (_xeUtils.default.isPlainObject(props.refresh)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] refresh={...}', 'refresh=boolean & refresh-options={...}']);
      }
      if (_xeUtils.default.isPlainObject(props.refresh)) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] zoom={...}', 'zoom=boolean & zoom-options={...}']);
      }
      if ($xeTable) {
        $xeTable.connect(this);
      }
      const customOpts = $xeToolbar.computeCustomOpts;
      if (customOpts.isFooter) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] toolbar.custom.isFooter', 'table.custom-config.showFooter']);
      }
      if (customOpts.showFooter) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] toolbar.custom.showFooter', 'table.custom-config.showFooter']);
      }
      if (customOpts.immediate) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] toolbar.custom.immediate', 'table.custom-config.immediate']);
      }
      if (customOpts.trigger) {
        (0, _log.warnLog)('vxe.error.delProp', ['[toolbar] toolbar.custom.trigger', 'table.custom-config.trigger']);
      }
    });
    // 使用已安装的组件，如果未安装则不渲染
    const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
    if (props.refresh || props.import || props.export || props.print || props.zoom) {
      if (!VxeUIButtonComponent) {
        (0, _log.errLog)('vxe.error.reqComp', ['vxe-button']);
      }
    }
  },
  destroyed() {
    const $xeToolbar = this;
    const internalData = $xeToolbar.internalData;
    _xeUtils.default.assign(internalData, createInternalData());
  },
  render(h) {
    return this.renderVN(h);
  }
});
/* define-vxe-component end */