"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/*
  The MIT License

  Copyright (c) 2017-2019 EclipseSource Munich
  https://github.com/eclipsesource/jsonforms

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/
var react_1 = __importDefault(require("react"));
var core_1 = require("@jsonforms/core");
var IconButton_1 = __importDefault(require("@material-ui/core/IconButton"));
var core_2 = require("@material-ui/core");
var TableRow_1 = __importDefault(require("@material-ui/core/TableRow"));
var Tooltip_1 = __importDefault(require("@material-ui/core/Tooltip"));
var Add_1 = __importDefault(require("@material-ui/icons/Add"));
var ValidationIcon_1 = __importDefault(require("./ValidationIcon"));
var NoBorderTableCell_1 = __importDefault(require("./NoBorderTableCell"));
var TableToolbar = react_1.default.memo(function (_a) {
    var numColumns = _a.numColumns, errors = _a.errors, label = _a.label, path = _a.path, addItem = _a.addItem, schema = _a.schema;
    return (react_1.default.createElement(TableRow_1.default, null,
        react_1.default.createElement(NoBorderTableCell_1.default, { colSpan: numColumns },
            react_1.default.createElement(core_2.Grid, { container: true, justify: 'flex-start', alignItems: 'center', spacing: 16 },
                react_1.default.createElement(core_2.Grid, { item: true },
                    react_1.default.createElement(core_2.Typography, { variant: 'h6' }, label)),
                react_1.default.createElement(core_2.Grid, { item: true },
                    react_1.default.createElement(core_2.Hidden, { smUp: errors.length === 0 },
                        react_1.default.createElement(core_2.Grid, { item: true },
                            react_1.default.createElement(ValidationIcon_1.default, { id: 'tooltip-validation', errorMessages: errors })))))),
        react_1.default.createElement(NoBorderTableCell_1.default, null,
            react_1.default.createElement(Tooltip_1.default, { id: 'tooltip-add', title: "Add to " + label, placement: 'bottom' },
                react_1.default.createElement(IconButton_1.default, { "aria-label": "Add to " + label, onClick: addItem(path, core_1.createDefaultValue(schema)) },
                    react_1.default.createElement(Add_1.default, null))))));
});
exports.default = TableToolbar;
//# sourceMappingURL=TableToolbar.js.map