"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:jsx-no-multiline-js
var react_1 = __importDefault(require("react"));
var core_1 = require("@jsonforms/core");
var ObjectListItem_1 = __importDefault(require("./ObjectListItem"));
/**
 * Expands the given root data array by expanding every element.
 * If the parent data containing the array is provided,
 * a suitable delete function for the expanded elements is created.
 *
 * As a difference to the ExpandArray component this component does not use containment
 * properties because it is only used for the root nodes of a tree.
 *
 */
exports.ExpandRootArray = function (_a) {
    var rootData = _a.rootData, schema = _a.schema, path = _a.path, selection = _a.selection, handlers = _a.handlers, filterPredicate = _a.filterPredicate, labelProvider = _a.labelProvider, imageProvider = _a.imageProvider;
    var data = core_1.resolveData(rootData, path);
    if (data === undefined || data === null) {
        return 'No data';
    }
    return data.map(function (_element, index) {
        var composedPath = core_1.Paths.compose(path, index.toString());
        return (react_1.default.createElement(ObjectListItem_1.default, { key: composedPath, path: composedPath, schema: schema, selection: selection, handlers: handlers, isRoot: true, filterPredicate: filterPredicate, labelProvider: labelProvider, imageProvider: imageProvider }));
    });
};
// TODO: update selected element once selection has been changed
exports.ExpandRootArrayContainer = function (_a) {
    var path = _a.path, schema = _a.schema, rootData = _a.rootData, selection = _a.selection, handlers = _a.handlers, filterPredicate = _a.filterPredicate, labelProvider = _a.labelProvider, imageProvider = _a.imageProvider;
    return (react_1.default.createElement(exports.ExpandRootArray, { schema: schema, path: path, rootData: rootData, selection: selection, handlers: handlers, filterPredicate: filterPredicate, labelProvider: labelProvider, imageProvider: imageProvider }));
};
//# sourceMappingURL=ExpandRootArray.js.map