// 显示工具栏按钮
export default (store) => (dataElements) => {
  const headerItems = [
    ...store.getActiveHeaderItems,
    ...store.getTools,
    ...store.getActiveRightHeaderItems,
    ...store.getToolItems.annotation,
    ...store.getToolItems.form,
    ...store.getPopupItems('textPopup'),
    ...store.getPopupItems('cropPagePopup')
  ];

  if (Array.isArray(dataElements)) {
    for (let i = 0; i < headerItems.length; i++) {
      dataElements.forEach(element => {
        if (store.getDisabledElementsObj[dataElements]) {
          store.setEnabledElements(dataElements)
        } else if (headerItems[i].dataElement === element) {
          headerItems[i].hidden = false;
        }
      });
    }
  } else if (typeof dataElements === 'string') {
    if (store.getDisabledElementsObj[dataElements]) {
      store.setEnabledElements(dataElements)
      return
    }
    const obj = headerItems.find(obj => obj.dataElement === dataElements);
    if (obj) {
      obj.hidden = false;
    } else {
      console.warn('DataElement not found.');
    }
  } else {
    console.error('Wrong dataElements type.');
  }
};