import _extends from "@babel/runtime/helpers/extends";
import _Collapse from "@alifd/next/es/collapse";
import * as React from 'react';
import Row from '../../components/row';
import LayoutBox from './layoutBox';
import Number from '../../components/number';
import { intlLocal } from './locale';
var Panel = _Collapse.Panel;
var layoutConfig = intlLocal();
var defaultLayoutPropsConfig = {
  // display 展示列表
  showDisPlayList: ['inline', 'flex', 'block', 'inline-block', 'none'],
  isShowPadding: true,
  isShowMargin: true,
  isShowWidthHeight: true
};
export default (function (props) {
  var onStyleChange = props.onStyleChange,
    styleData = props.styleData,
    layoutPropsConfig = props.layoutPropsConfig,
    unit = props.unit;

  // 配置合并
  var propsConfig = _extends({}, defaultLayoutPropsConfig, layoutPropsConfig);

  // 传入配置
  var showDisPlayList = propsConfig.showDisPlayList,
    isShowWidthHeight = propsConfig.isShowWidthHeight;
  // 静态配置
  var display = layoutConfig.display,
    flexDirection = layoutConfig.flexDirection,
    justifyContent = layoutConfig.justifyContent,
    alignItems = layoutConfig.alignItems,
    flexWrap = layoutConfig.flexWrap;
  var displayDataList = display.dataList.filter(function (item) {
    return showDisPlayList.indexOf(item.value) >= 0;
  });
  return /*#__PURE__*/React.createElement(_Collapse, {
    defaultExpandedKeys: ['0']
  }, /*#__PURE__*/React.createElement(Panel, {
    title: layoutConfig.title,
    className: "layout-style-container"
  }, /*#__PURE__*/React.createElement(Row, _extends({
    title: display.title,
    dataList: displayDataList,
    styleKey: "display"
  }, props, {
    longTitle: true
  })), styleData['display'] === 'flex' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Row, _extends({
    title: flexDirection.title,
    dataList: flexDirection.dataList,
    styleKey: "flexDirection",
    longTitle: true
  }, props)), /*#__PURE__*/React.createElement(Row, _extends({
    title: justifyContent.title,
    dataList: justifyContent.dataList,
    styleKey: "justifyContent",
    longTitle: true
  }, props)), /*#__PURE__*/React.createElement(Row, _extends({
    title: alignItems.title,
    dataList: alignItems.dataList,
    styleKey: "alignItems",
    longTitle: true
  }, props)), /*#__PURE__*/React.createElement(Row, _extends({
    title: flexWrap.title,
    dataList: flexWrap.dataList,
    styleKey: "flexWrap",
    longTitle: true
  }, props))), /*#__PURE__*/React.createElement(LayoutBox, {
    styleData: styleData,
    onStyleChange: onStyleChange,
    layoutPropsConfig: propsConfig,
    unit: unit
  }), isShowWidthHeight && /*#__PURE__*/React.createElement("div", {
    className: "inner-row-contaienr"
  }, /*#__PURE__*/React.createElement("div", {
    className: "row-item"
  }, /*#__PURE__*/React.createElement("span", {
    className: "row-item-title"
  }, layoutConfig.width), /*#__PURE__*/React.createElement(Number, _extends({
    style: {
      marginRight: '10px',
      width: '100%'
    },
    min: 0,
    styleKey: "width"
  }, props, {
    unit: ['px', '%'],
    useComputedStyle: true
  }))), /*#__PURE__*/React.createElement("div", {
    className: "row-item"
  }, /*#__PURE__*/React.createElement("span", {
    className: "row-item-title"
  }, layoutConfig.height), /*#__PURE__*/React.createElement(Number, _extends({
    styleKey: "height",
    min: 0
  }, props, {
    style: {
      width: '100%'
    },
    unit: ['px', '%'],
    useComputedStyle: true
  }))))));
});