mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Fix build
This commit is contained in:
parent
a861ee2fb5
commit
2b4396151c
File diff suppressed because one or more lines are too long
@ -4,9 +4,6 @@
|
||||
list-style: none;
|
||||
font-size: 1.3rem;
|
||||
line-height: 5.3rem;
|
||||
// white-space: nowrap;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
|
||||
&:last-child .flex {
|
||||
border-bottom: none;
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* InputCheckboxWithNestedInputs
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { isEmpty, map, findIndex } from 'lodash';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Input from 'components/InputsIndex';
|
||||
import styles from './styles.scss';
|
||||
|
||||
class InputCheckboxWithNestedInputs extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
handleChange = () => {
|
||||
const target = {
|
||||
type: 'checkbox',
|
||||
value: !this.props.value[this.props.data.name.split('.')[1]],
|
||||
name: this.props.data.name,
|
||||
};
|
||||
|
||||
this.props.onChange({ target });
|
||||
|
||||
if (!target.value) {
|
||||
const valueToRemove = {
|
||||
target: {
|
||||
name: `${this.props.data.name}Value`,
|
||||
type: 'number',
|
||||
value: '',
|
||||
},
|
||||
};
|
||||
this.props.onChange(valueToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
renderNestedInput = () => {
|
||||
if (this.props.value[this.props.data.name.split('.')[1]]) {
|
||||
return (
|
||||
<div className={styles.nestedInputContainer} style={{ marginBottom: '-19px' }}>
|
||||
{map(this.props.data.items, (item, key) => {
|
||||
const errorIndex = findIndex(this.props.errors, ['name', item.name]);
|
||||
const errors = errorIndex !== -1 ? this.props.errors[errorIndex].errors : [];
|
||||
return (
|
||||
<Input
|
||||
key={key}
|
||||
type={item.type}
|
||||
onChange={this.props.onChange}
|
||||
name={item.name}
|
||||
value={this.props.value[item.name.split('.')[1]]}
|
||||
validations={item.validations}
|
||||
label={item.label}
|
||||
errors={errors}
|
||||
didCheckErrors={this.props.didCheckErrors}
|
||||
pluginId="content-type-builder"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return <div />;
|
||||
}
|
||||
|
||||
render() {
|
||||
const spacer = !this.props.data.inputDescription ? <div /> : <div style={{ marginBottom: '.5rem'}}></div>;
|
||||
const title = !isEmpty(this.props.data.title) ? <div className={styles.inputTitle}><FormattedMessage id={this.props.data.title} /></div> : '';
|
||||
|
||||
return (
|
||||
<div className={`${styles.inputCheckboxWithNestedInputs} col-md-12`}>
|
||||
<div className="form-check" style={{ zIndex: '9999' }}>
|
||||
{title}
|
||||
<FormattedMessage id={this.props.data.label.id}>
|
||||
{(message) => (
|
||||
<label className={`${styles.checkboxLabel} form-check-label`} htmlFor={this.props.data.name} style={{ cursor: 'pointer' }}>
|
||||
<input
|
||||
className="form-check-input"
|
||||
defaultChecked={this.props.value[this.props.data.name.split('.')[1]]}
|
||||
id={this.props.data.name}
|
||||
name={this.props.data.name}
|
||||
onChange={this.handleChange}
|
||||
type="checkbox"
|
||||
/>
|
||||
{message}
|
||||
</label>
|
||||
)}
|
||||
</FormattedMessage>
|
||||
<div className={styles.descriptionContainer}>
|
||||
<small>{this.props.data.inputDescription}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{spacer}
|
||||
{this.renderNestedInput()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
InputCheckboxWithNestedInputs.propTypes = {
|
||||
data: PropTypes.object.isRequired,
|
||||
didCheckErrors: PropTypes.bool,
|
||||
errors: PropTypes.array,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
value: PropTypes.object,
|
||||
};
|
||||
|
||||
InputCheckboxWithNestedInputs.defaultProps = {
|
||||
didCheckErrors: false,
|
||||
errors: [],
|
||||
value: {},
|
||||
};
|
||||
|
||||
export default InputCheckboxWithNestedInputs;
|
||||
@ -1,45 +0,0 @@
|
||||
.inputCheckboxWithNestedInputs { /* stylelint-disable */
|
||||
font-size: 1.3rem;
|
||||
font-family: Lato;
|
||||
margin-bottom: 1.5rem;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
> div {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.inputTitle {
|
||||
margin-bottom: 1.7rem;
|
||||
font-weight: 500;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.checkboxLabel {
|
||||
// padding-top: .1rem;
|
||||
cursor: inherit;
|
||||
font-weight: 500;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
> input {
|
||||
cursor: pointer;
|
||||
margin-right: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.descriptionContainer {
|
||||
width: 150%;
|
||||
padding-top: .2rem;
|
||||
padding-left: 2.5rem;
|
||||
line-height: 1.2rem;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
> small {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
color: #9EA7B8;
|
||||
font-family: Lato;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.nestedInputContainer {
|
||||
margin-top: -2.2rem;
|
||||
margin-bottom: -19px;
|
||||
}
|
||||
@ -4,7 +4,6 @@
|
||||
> ul {
|
||||
margin: 1rem 0 0 -1.5rem;
|
||||
padding: 0;
|
||||
// list-style: none;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,10 +40,6 @@ export function* deleteModel({ modelName }) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: SUBMIT PUT action.context.emitEvent('didEditNameOfContentType');
|
||||
// yield put(emitEvent('willSaveContentType'));
|
||||
// emitEvent('didSaveContentType')
|
||||
|
||||
export function* submitCT({
|
||||
oldContentTypeName,
|
||||
body,
|
||||
|
||||
@ -509,7 +509,6 @@ export class ModelPage extends React.Component {
|
||||
const attributeType = this.getAttributeType();
|
||||
const actionType = this.getActionType();
|
||||
const icon = this.getSource() ? null : 'fa fa-pencil';
|
||||
// console.log(this.getModelAttributes());
|
||||
|
||||
return (
|
||||
<div className={styles.modelpage}>
|
||||
|
||||
@ -1,42 +1,47 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
const ModelPicker = ({ models, onClick, plugin, selectedModel }) => {
|
||||
const [isOpen, toggleIsOpen] = useState(false);
|
||||
/* istanbul ignore next */
|
||||
const handleToggle = () => toggleIsOpen(!isOpen);
|
||||
class ModelPicker extends React.Component {
|
||||
state = { isOpen: false };
|
||||
|
||||
return (
|
||||
<div className={styles.dropDown}>
|
||||
<Dropdown isOpen={isOpen} toggle={handleToggle} style={{ backgroundColor: 'transparent' }}>
|
||||
<DropdownToggle caret>
|
||||
<p>
|
||||
<i className="fa fa-caret-square-o-right" />
|
||||
{selectedModel}
|
||||
{!!plugin && <span style={{ fontStyle: 'italic', fontWeight: '500' }}> ({plugin})</span>}
|
||||
</p>
|
||||
</DropdownToggle>
|
||||
<DropdownMenu>
|
||||
{models.map(model => {
|
||||
return (
|
||||
<DropdownItem key={model.name} onClick={() => onClick(model)} className={styles.dropdownItem}>
|
||||
<p>
|
||||
<i className="fa fa-caret-square-o-right" />
|
||||
{model.name}
|
||||
{!!model.source && <span style={{ fontStyle: 'italic' }}> ({model.source})</span>}
|
||||
</p>
|
||||
</DropdownItem>
|
||||
);
|
||||
})}
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
toggle = () => this.setState(prevState => ({ isOpen: !prevState.isOpen }));
|
||||
|
||||
render() {
|
||||
const { models, onClick, plugin, selectedModel } = this.props;
|
||||
const { isOpen } = this.state;
|
||||
|
||||
return (
|
||||
<div className={styles.dropDown}>
|
||||
<Dropdown isOpen={isOpen} toggle={this.toggle} style={{ backgroundColor: 'transparent' }}>
|
||||
<DropdownToggle caret>
|
||||
<p>
|
||||
<i className="fa fa-caret-square-o-right" />
|
||||
{selectedModel}
|
||||
{!!plugin && <span style={{ fontStyle: 'italic', fontWeight: '500' }}> ({plugin})</span>}
|
||||
</p>
|
||||
</DropdownToggle>
|
||||
<DropdownMenu>
|
||||
{models.map(model => {
|
||||
return (
|
||||
<DropdownItem key={model.name} onClick={() => onClick(model)} className={styles.dropdownItem}>
|
||||
<p>
|
||||
<i className="fa fa-caret-square-o-right" />
|
||||
{model.name}
|
||||
{!!model.source && <span style={{ fontStyle: 'italic' }}> ({model.source})</span>}
|
||||
</p>
|
||||
</DropdownItem>
|
||||
);
|
||||
})}
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ModelPicker.defaultProps = {
|
||||
models: [],
|
||||
|
||||
@ -9,6 +9,7 @@ import ModelPicker from './ModelPicker';
|
||||
import styles from './styles.scss';
|
||||
|
||||
const RelationBox = ({
|
||||
autoFocus,
|
||||
didCheckErrors,
|
||||
errors,
|
||||
main,
|
||||
@ -38,6 +39,7 @@ const RelationBox = ({
|
||||
</div>
|
||||
<div className={styles.relationBoxBody}>
|
||||
<InputText
|
||||
autoFocus={autoFocus}
|
||||
didCheckErrors={didCheckErrors}
|
||||
errors={errors}
|
||||
label="Field Name"
|
||||
@ -54,6 +56,7 @@ const RelationBox = ({
|
||||
};
|
||||
|
||||
RelationBox.defaultProps = {
|
||||
autoFocus: false,
|
||||
didCheckErrors: false,
|
||||
errors: [],
|
||||
main: false,
|
||||
@ -67,6 +70,7 @@ RelationBox.defaultProps = {
|
||||
};
|
||||
|
||||
RelationBox.propTypes = {
|
||||
autoFocus: PropTypes.bool,
|
||||
didCheckErrors: PropTypes.bool,
|
||||
errors: PropTypes.array,
|
||||
main: PropTypes.bool,
|
||||
|
||||
@ -213,6 +213,7 @@ class RelationForm extends React.Component {
|
||||
return (
|
||||
<RelationWrapper>
|
||||
<RelationBox
|
||||
autoFocus
|
||||
errors={get(formErrors, 'name', [])}
|
||||
didCheckErrors={didCheckErrors}
|
||||
main
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
.relationWrapper {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
// margin-bottom: 10px;
|
||||
padding: 2.7rem 15px;
|
||||
.relationNatureWrapper {
|
||||
position: relative;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user