"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.DefaultStory = void 0;

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

var _utils = require("../../../.storybook/utils");

var _index = require("../../index");

var _datagrid = require("../../static/data/datagrid");

var handleRowSelectionChange = function handleRowSelectionChange(selectedRows) {
  console.log("onSelectionChange - selected row indexes: ".concat(selectedRows));
};

var _default = {
  component: _index.DataGrid,
  title: (0, _utils.addStoryInGroup)(_utils.COMPOSITIONS, 'DataGrid'),
  parameters: {
    design: {
      type: 'figma',
      url: 'https://www.figma.com/file/LHH25GN90ljQaBEUNMsdJn/Desktop-components?node-id=503%3A4737'
    }
  }
};
exports.default = _default;

var DefaultStory = function DefaultStory(args) {
  return /*#__PURE__*/_react.default.createElement(_index.DataGrid, args, /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderRowOverlay, {
    numSelectedRowsLabel: function numSelectedRowsLabel(numSelectedRows) {
      return numSelectedRows === 1 ? 'sélectionné' : 'sélectionnés';
    }
  }, /*#__PURE__*/_react.default.createElement(_index.Button, {
    size: "small",
    level: "primary",
    label: "Marks as paid"
  }), /*#__PURE__*/_react.default.createElement(_index.ButtonGroup, {
    segmented: true,
    marginHorizontal: 3
  }, /*#__PURE__*/_react.default.createElement(_index.Button, {
    size: "small",
    label: "Book"
  }), /*#__PURE__*/_react.default.createElement(_index.Button, {
    size: "small",
    label: "Merge"
  })), /*#__PURE__*/_react.default.createElement(_index.Button, {
    size: "small",
    level: "destructive",
    label: "Delete"
  })), /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderRow, null, /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderCell, {
    onClick: function onClick() {
      return console.log('onClick: column sort');
    },
    sorted: "asc"
  }, "Invoice"), /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderCell, {
    onClick: function onClick() {
      return console.log('onClick: column sort');
    },
    align: "right"
  }, "Amount"), /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderCell, {
    flex: 5,
    onClick: function onClick() {
      return console.log('onClick: column sort');
    }
  }, "Customer"), /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderCell, {
    onClick: function onClick() {
      return console.log('onClick: column sort');
    }
  }, "Due date"), /*#__PURE__*/_react.default.createElement(_index.DataGrid.HeaderCell, {
    flex: "min-width"
  })), _datagrid.rows1.map(function (row, index) {
    return /*#__PURE__*/_react.default.createElement(_index.DataGrid.BodyRow, {
      key: index,
      onClick: function onClick(event) {
        return console.log('onClick:', row.column5, event);
      }
    }, /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, null, /*#__PURE__*/_react.default.createElement(_index.Link, {
      href: "#",
      onClick: function onClick(event) {
        return event.stopPropagation();
      },
      inherit: false
    }, row.column5), ' '), /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, {
      align: "right",
      strong: true
    }, ' ', "\u20AC ".concat(row.column3)), /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, {
      flex: 5
    }, row.column2), /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, {
      soft: true
    }, row.column4), /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, {
      align: "right",
      flex: "min-width",
      preventOverflow: false
    }, /*#__PURE__*/_react.default.createElement(_index.IconMenu, {
      position: "top-right",
      onClick: function onClick(event) {
        event.stopPropagation();
      }
    }, /*#__PURE__*/_react.default.createElement(_index.MenuItem, {
      label: "Duplicate row",
      onClick: function onClick(event) {
        console.log('onClick: duplicate row');
        event.stopPropagation();
      }
    }), /*#__PURE__*/_react.default.createElement(_index.MenuItem, {
      label: "Inactive row",
      onClick: function onClick(event) {
        console.log('onClick: inactivate row');
        event.stopPropagation();
      }
    }), /*#__PURE__*/_react.default.createElement(_index.MenuItem, {
      label: "Remove row",
      onClick: function onClick(event) {
        console.log('onClick: remove row');
        event.stopPropagation();
      }
    }))));
  }), /*#__PURE__*/_react.default.createElement(_index.DataGrid.FooterRow, {
    backgroundColor: "neutral"
  }, /*#__PURE__*/_react.default.createElement(_index.DataGrid.Cell, {
    align: "right"
  }, "".concat(_datagrid.rows1.length, " rows in total"))));
};

exports.DefaultStory = DefaultStory;
DefaultStory.args = {
  comparableId: 1,
  onSelectionChange: handleRowSelectionChange,
  selectable: true
};