META-INF.resources.js.import.ImportMappingItem.js Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
import ClayForm, {ClaySelect} from '@clayui/form';
import ClayTable from '@clayui/table';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
const ImportMappingItem = ({
dbField,
fileFields,
formEvaluated,
isAnyOfValid,
portletNamespace,
previewValue,
required,
selectedFileField,
updateFieldMapping,
}) => {
const inputId = `input-field-${dbField.name}`;
const hasError =
formEvaluated && !isAnyOfValid && required && !selectedFileField;
const hasSuccess = formEvaluated && !hasError;
return (
{dbField.description && (
{dbField.description}
)}
{selectedFileField && (
)}
updateFieldMapping(event.target.value)
}
value={selectedFileField}
>
{fileFields &&
fileFields.map((fileField) => {
const columnHasNoName =
typeof fileField === 'number';
const label = columnHasNoName
? `${Liferay.Language.get('column')} ${
fileField + 1
}`
: fileField;
return (
);
})}
{JSON.stringify(previewValue)}
);
};
ImportMappingItem.propTypes = {
dbField: PropTypes.shape({
description: PropTypes.string,
name: PropTypes.string.isRequired,
}),
fileFields: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
),
formEvaluated: PropTypes.bool.isRequired,
portletNamespace: PropTypes.string.isRequired,
previewValue: PropTypes.any,
required: PropTypes.bool.isRequired,
selectedFileField: PropTypes.string.isRequired,
updateFieldMapping: PropTypes.func.isRequired,
};
export default ImportMappingItem;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy