"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.initialEditionSection = void 0;
exports.isDetailTabEmpty = isDetailTabEmpty;
exports.validateDetailTab = validateDetailTab;
var _get2 = _interopRequireDefault(require("lodash/get"));
var _edition = require("../../entity-editor/validators/edition");
var initialEditionSection = {
authorCreditEditorVisible: false,
format: null,
languages: [],
matchingNameEditionGroups: [],
physicalEnable: true,
publisher: {},
releaseDate: '',
status: null
};
exports.initialEditionSection = initialEditionSection;
var stringifiedInitialState = JSON.stringify(initialEditionSection);
/**
* Validates the Detail Tab state.
*
* @param {object} data - the form state object
* @returns {boolean} - true if detail tab state is valid
*/
function validateDetailTab(data) {
return (0, _edition.validateEditionSection)((0, _get2.default)(data, 'editionSection'), true);
}
/**
* Check whether Detail Tab is modified or not.
*
* @param {object} data - the form state object
* @returns {boolean} - true if detail tab state is empty
*/
function isDetailTabEmpty(data) {
var editionSection = (0, _get2.default)(data, 'editionSection', {});
var annotationContent = (0, _get2.default)(data, ['annotationSection', 'content'], '');
return JSON.stringify(editionSection) === stringifiedInitialState && annotationContent.length === 0;
}
//# sourceMappingURL=detail-tab.js.map