"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

require("./demo3.css");

var _ = _interopRequireDefault(require(".."));

var _react = _interopRequireDefault(require("react"));

var _reactDom = _interopRequireDefault(require("react-dom"));

var _enUs = _interopRequireDefault(require("../../locale/en-us"));

var _jaJp = _interopRequireDefault(require("../../locale/ja-jp"));

var _ptPt = _interopRequireDefault(require("../../locale/pt-pt"));

var _viVn = _interopRequireDefault(require("../../locale/vi-vn"));

var _zhCn = _interopRequireDefault(require("../../locale/zh-cn"));

var _2 = require("../..");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

var localeMap = {
  'zh-cn': _zhCn["default"],
  'en-us': _enUs["default"],
  'ja-jp': _jaJp["default"],
  'vi-vn': _viVn["default"],
  'pt-pt': _ptPt["default"]
}; // If the application directly imports the next-with-locales.js file from cdn
// it need to import locale file in the following way
// import { locales } from '@alifd/next';
// const enUS = locales['en-us'];
// const zhCN = locales['zh-cn'];

var RangePicker = _2.DatePicker.RangePicker;
var RangePicker2 = _2.DatePicker2.RangePicker;
var Panel = _2.Collapse.Panel;
var TreeNode = _2.TreeSelect.Node;

var transferDataSource = function () {
  var dataSource = [];

  for (var i = 0; i < 10; i++) {
    dataSource.push({
      label: "content ".concat(i),
      value: "".concat(i),
      disabled: i % 4 === 0
    });
  }

  return dataSource;
}();

var Demo = /*#__PURE__*/function (_React$Component) {
  _inherits(Demo, _React$Component);

  var _super = _createSuper(Demo);

  function Demo(props) {
    var _this;

    _classCallCheck(this, Demo);

    _this = _super.call(this, props);
    _this.state = {
      label: '',
      lang: 'en-us',
      theme: 'white',
      data: [],
      value1: 'apple'
    };
    _this.changeLang = _this.changeLang.bind(_assertThisInitialized(_this));
    _this.showDialog = _this.showDialog.bind(_assertThisInitialized(_this));
    _this.changeTheme = _this.changeTheme.bind(_assertThisInitialized(_this));
    _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
    _this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
    _this.onSmallChange = _this.onSmallChange.bind(_assertThisInitialized(_this));
    return _this;
  }

  _createClass(Demo, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this2 = this;

      fetch('https://os.alipayobjects.com/rmsportal/ODDwqcDFTLAguOvWEolX.json').then(function (response) {
        return response.json();
      }).then(function (data) {
        data[1].disabled = true;

        _this2.setState({
          data: data
        });
      })["catch"](function (e) {
        return console.log(e);
      });
    }
  }, {
    key: "handleChange",
    value: function handleChange(value, data, extra) {
      console.log(value, data, extra);
      this.setState({
        label: extra.selectedPath.map(function (d) {
          return d.label;
        }).join(' / ')
      });
    }
  }, {
    key: "onChange",
    value: function onChange(value, e) {
      console.log(value, e.type, e.triggerType);
    }
  }, {
    key: "onSmallChange",
    value: function onSmallChange(value) {
      this.setState({
        value1: value
      });
    }
  }, {
    key: "changeLang",
    value: function changeLang(lang) {
      this.setState({
        lang: lang
      });
    }
  }, {
    key: "changeTheme",
    value: function changeTheme(theme) {
      this.setState({
        theme: theme
      });
    }
  }, {
    key: "showDialog",
    value: function showDialog() {
      _2.Dialog.confirm({
        title: 'Confirm',
        content: 'Are you sure you want to delete all alert e-mails waiting in queue?'
      });
    }
  }, {
    key: "render",
    value: function render() {
      var locale = localeMap[this.state.lang];
      var theme = this.state.theme;
      return /*#__PURE__*/_react["default"].createElement("div", {
        className: theme
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: "change-locale"
      }, /*#__PURE__*/_react["default"].createElement("span", {
        style: {
          marginRight: 16
        }
      }, "Change locale of components: "), /*#__PURE__*/_react["default"].createElement(_2.Radio.Group, {
        shape: "button",
        size: "large",
        defaultValue: "en-us",
        onChange: this.changeLang
      }, /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "en-us"
      }, "English"), /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "zh-cn"
      }, "\u4E2D\u6587"), /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "ja-jp"
      }, "\u65E5\u672C\u8A9E"), /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "vi-vn"
      }, "Vi\u1EC7tName"), /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "pt-pt"
      }, "Portugu\xEAs"))), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("div", {
        className: "change-theme"
      }, /*#__PURE__*/_react["default"].createElement("span", {
        style: {
          marginRight: 16,
          marginTop: 16
        }
      }, "Change theme of components: "), /*#__PURE__*/_react["default"].createElement(_2.Radio.Group, {
        shape: "button",
        size: "large",
        defaultValue: "white",
        onChange: this.changeTheme
      }, /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "white"
      }, "White"), /*#__PURE__*/_react["default"].createElement(_2.Radio, {
        value: "grey"
      }, "Grey"))), /*#__PURE__*/_react["default"].createElement(_["default"], {
        locale: locale,
        theme: theme
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: "locale-components"
      }, /*#__PURE__*/_react["default"].createElement(_2.Button, {
        type: "primary",
        onClick: this.showDialog
      }, "Show Dialog"), /*#__PURE__*/_react["default"].createElement(_2.Search, null), /*#__PURE__*/_react["default"].createElement(_2.Input, null), /*#__PURE__*/_react["default"].createElement(_2.Select, {
        style: {
          width: '150px'
        },
        dataSource: ['hello', 'bye']
      }), /*#__PURE__*/_react["default"].createElement(_2.Calendar2, {
        style: {
          width: '500px',
          padding: '12px',
          border: '1px solid #C4C6CF',
          borderRadius: '3px'
        },
        shape: "card"
      }), /*#__PURE__*/_react["default"].createElement(_2.Cascader, {
        dataSource: this.state.data,
        onChange: this.handleChange
      }), /*#__PURE__*/_react["default"].createElement(_2.CascaderSelect, {
        dataSource: this.state.data,
        onChange: this.handleChange
      }), /*#__PURE__*/_react["default"].createElement(_2.Collapse, null, /*#__PURE__*/_react["default"].createElement(Panel, {
        title: "simple tile"
      }, "Promotions are marketing campaigns ran by Marketplace. Participate to sale your products during that promotion and make a profit"), /*#__PURE__*/_react["default"].createElement(Panel, {
        title: "What are Promotion Products?"
      }, "Promotion Products is a service that helps you to promote products you list on Marketplace during a certain time range. You can choose which products should be available for the promotion. Not all Products of you will be available, because Promotions will only attract certain Product areas."), /*#__PURE__*/_react["default"].createElement(Panel, {
        title: "Why can i not submit a higher price?"
      }, "The Promotion requires a certain price to make sure that our customers are attracted."), /*#__PURE__*/_react["default"].createElement(Panel, {
        title: "What is Promo Stock?",
        disabled: true
      }, "Promo Stock is the criteria needed to be followed to be able to join Promotion. With setting particular Promo Stock value you commit to have this amount of stock available while Promotion is active.")), /*#__PURE__*/_react["default"].createElement(_2.DatePicker, null), /*#__PURE__*/_react["default"].createElement(RangePicker, null), /*#__PURE__*/_react["default"].createElement(_2.DatePicker2, null), /*#__PURE__*/_react["default"].createElement(_2.TimePicker2, null), /*#__PURE__*/_react["default"].createElement(RangePicker2, null), /*#__PURE__*/_react["default"].createElement(_2.NumberPicker, {
        defaultValue: 0,
        type: "inline",
        onChange: this.onChange
      }), /*#__PURE__*/_react["default"].createElement(_2.Pagination, {
        defaultCurrent: 2
      }), /*#__PURE__*/_react["default"].createElement(_2.Radio.Group, {
        dataSource: [{
          value: 'apple',
          label: 'Apple',
          disabled: false
        }, {
          value: 'pear',
          label: 'Pear'
        }, {
          value: 'orange',
          label: 'Orange',
          disabled: true
        }],
        shape: "button",
        size: "small",
        value: this.state.value1,
        onChange: this.onSmallChange,
        type: "outline"
      }), /*#__PURE__*/_react["default"].createElement(_2.Tab, {
        shape: "wrapped"
      }, /*#__PURE__*/_react["default"].createElement(_2.Tab.Item, {
        title: "Tab 1",
        key: "1"
      }, "Tab 1 Content"), /*#__PURE__*/_react["default"].createElement(_2.Tab.Item, {
        title: "Tab 2",
        key: "2"
      }, "Tab 2 Content"), /*#__PURE__*/_react["default"].createElement(_2.Tab.Item, {
        title: "Tab 3",
        key: "3",
        disabled: true
      }, "Tab 3 Content")), /*#__PURE__*/_react["default"].createElement(_2.Box, {
        direction: "row",
        className: "tag-list",
        spacing: 20
      }, /*#__PURE__*/_react["default"].createElement(_2.Tag, {
        type: "normal"
      }, "Normal Tag"), /*#__PURE__*/_react["default"].createElement(_2.Tag, {
        type: "primary"
      }, "Primary Tag")), /*#__PURE__*/_react["default"].createElement(_2.TreeSelect, {
        treeDefaultExpandAll: true,
        style: {
          width: 200
        }
      }, /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "1" // @ts-ignore
        ,
        value: "1",
        label: "Component"
      }, /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "2" // @ts-ignore
        ,
        value: "2",
        label: "Form"
      }, /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "4" // @ts-ignore
        ,
        value: "4",
        label: "Input"
      }), /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "5" // @ts-ignore
        ,
        value: "5",
        label: "Select",
        disabled: true
      })), /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "3" // @ts-ignore
        ,
        value: "3",
        label: "Display"
      }, /*#__PURE__*/_react["default"].createElement(TreeNode, {
        key: "6" // @ts-ignore
        ,
        value: "6",
        label: "Table"
      })))), /*#__PURE__*/_react["default"].createElement(_2.Transfer, {
        dataSource: transferDataSource,
        defaultValue: ['3'],
        defaultLeftChecked: ['1'],
        titles: ['Source', 'Target']
      }), /*#__PURE__*/_react["default"].createElement(_2.Upload.Dragger, {
        listType: "image",
        action: "https://www.easy-mock.com/mock/5b713974309d0d7d107a74a3/alifd/upload",
        accept: "image/png, image/jpg, image/jpeg, image/gif, image/bmp"
      }), /*#__PURE__*/_react["default"].createElement(_2.Table, {
        style: {
          width: '500px'
        },
        dataSource: []
      }, /*#__PURE__*/_react["default"].createElement(_2.Table.Column, {
        title: "Name",
        dataIndex: "name",
        filters: [{
          label: 'Filter 1',
          value: '1'
        }, {
          label: 'Filter 2',
          value: '2'
        }]
      }), /*#__PURE__*/_react["default"].createElement(_2.Table.Column, {
        title: "Age",
        dataIndex: "age"
      })), /*#__PURE__*/_react["default"].createElement(_2.Card, {
        style: {
          width: '300px'
        },
        title: "Title"
      }, /*#__PURE__*/_react["default"].createElement("div", {
        style: {
          height: '250px',
          background: '#F7F8FA'
        }
      })), /*#__PURE__*/_react["default"].createElement(_2.Timeline, {
        fold: [{
          foldArea: [1, 2],
          foldShow: true
        }]
      }, /*#__PURE__*/_react["default"].createElement(_2.Timeline.Item, {
        title: "Signed",
        content: "Signed, sign Alibaba is a small post office, thanks to the use of STO, look forward to once again at your service",
        time: '2016-06-10 10:30:00',
        state: "process"
      }), /*#__PURE__*/_react["default"].createElement(_2.Timeline.Item, {
        title: "Ship",
        content: "Express has arrived in Hangzhou, Zhejiang Binjiang company",
        time: '2016-06-10 09:30:00'
      }), /*#__PURE__*/_react["default"].createElement(_2.Timeline.Item, {
        title: "Ship",
        content: "Zhejiang Hangzhou Riverside company sent a member for you to send pieces",
        time: '2016-06-10 09:03:00'
      }), /*#__PURE__*/_react["default"].createElement(_2.Timeline.Item, {
        title: "Ship",
        content: "Zhejiang Hangzhou Transshipment Center has been issued",
        time: '2016-06-10 06:10:00'
      })))));
    }
  }]);

  return Demo;
}(_react["default"].Component);

_reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(Demo, null), document.getElementById('config-provider-demo-3'));