var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import { useContext } from 'react';
import { pick } from 'ramda';
import { AttributesFactory } from '../AttributesFactory';
import { withTableContext } from '../../../../../HOCs/withTableContext';
import { AttributeValuesSortContext } from '../../../contexts/AttributeValuesSortContext';
export var AttributeValuesRenderer = function (_a) {
    var value = _a.value, onDelete = _a.onDelete, onEdit = _a.onEdit, onPin = _a.onPin, onIgnore = _a.onIgnore, onAdd = _a.onAdd, emptyTempAttributeUris = _a.emptyTempAttributeUris, parentUri = _a.parentUri, readOnly = _a.readOnly;
    var sortAttributeValuesForDisplay = useContext(AttributeValuesSortContext);
    return AttributesFactory.build(value.attributeType.type, __assign(__assign({}, value), { attributeValues: sortAttributeValuesForDisplay(value.attributeValues), parentUri: parentUri, onDelete: onDelete, onEdit: onEdit, onPin: onPin, onIgnore: onIgnore, onAdd: onAdd, emptyTempAttributeUris: emptyTempAttributeUris, disableEdit: readOnly, disableDelete: readOnly }));
};
export default withTableContext(pick(['onDelete', 'onPin', 'onIgnore', 'onEdit', 'onAdd', 'parentUri', 'readOnly', 'emptyTempAttributeUris']))(AttributeValuesRenderer);
