diff --git a/src/components/BrowserCell/BrowserCell.react.js b/src/components/BrowserCell/BrowserCell.react.js index a88af181ba..a0f35e0172 100644 --- a/src/components/BrowserCell/BrowserCell.react.js +++ b/src/components/BrowserCell/BrowserCell.react.js @@ -243,12 +243,14 @@ export default class BrowserCell extends Component { value = object; } content = onPointerClick ? ( - - - + ) : ( - value.id - ); + value.id + ); this.copyableValue = value.id; } else if (type === 'Array') { @@ -289,7 +291,7 @@ export default class BrowserCell extends Component { this.copyableValue = content = JSON.stringify(value); } else if (type === 'File') { const fileName = value.url() ? getFileName(value) : 'Uploading\u2026'; - content = ; + content = ; this.copyableValue = fileName; } else if (type === 'ACL') { let pieces = []; @@ -318,8 +320,8 @@ export default class BrowserCell extends Component { this.copyableValue = content = value.coordinates.map(coord => `(${coord})`) } else if (type === 'Relation') { content = setRelation ? ( -
- setRelation(value)} value='View relation' /> +
+ setRelation(value)} value='View relation' followClick={true} />
) : ( 'Relation' diff --git a/src/components/Field/Field.scss b/src/components/Field/Field.scss index 1153c1770c..116a490828 100644 --- a/src/components/Field/Field.scss +++ b/src/components/Field/Field.scss @@ -42,11 +42,12 @@ min-height: 80px; text-align: right; padding: 0; + background: #f6fafb; + display: flex; + justify-content: center; + align-items: center; } -.input { - margin: 25px 20px 0 0; -} .header { min-height: 56px; @@ -56,10 +57,6 @@ min-height: 56px; } - .input { - margin: 13px 20px 0 0; - } - & ~ .field { background: #f5f5f7; } diff --git a/src/components/FileEditor/FileEditor.react.js b/src/components/FileEditor/FileEditor.react.js index dbd839ceb6..7e438a995a 100644 --- a/src/components/FileEditor/FileEditor.react.js +++ b/src/components/FileEditor/FileEditor.react.js @@ -26,8 +26,12 @@ export default class FileEditor extends React.Component { componentDidMount() { document.body.addEventListener('click', this.checkExternalClick); document.body.addEventListener('keypress', this.handleKey); + let fileInputElement = document.getElementById('fileInput'); + if (fileInputElement) { + fileInputElement.click(); + } } - + componentWillUnmount() { document.body.removeEventListener('click', this.checkExternalClick); document.body.removeEventListener('keypress', this.handleKey); @@ -72,13 +76,11 @@ export default class FileEditor extends React.Component { render() { const file = this.props.value; return ( -
- {file && file.url() ? Download : null} + ); } diff --git a/src/components/Pill/Pill.react.js b/src/components/Pill/Pill.react.js index d186bb4772..32b7cb1b43 100644 --- a/src/components/Pill/Pill.react.js +++ b/src/components/Pill/Pill.react.js @@ -7,9 +7,29 @@ */ import React from 'react'; import styles from 'components/Pill/Pill.scss'; +import Icon from "components/Icon/Icon.react"; + //TODO: refactor, may want to move onClick outside or need to make onClick able to handle link/button a11y -let Pill = ({ value, onClick }) => ( - {value} +let Pill = ({ value, onClick, fileDownloadLink, followClick = false }) => ( + + {value} + {followClick && ( + + + + )} + {!followClick && fileDownloadLink && ( + + + + )} + ); export default Pill; diff --git a/src/components/Pill/Pill.scss b/src/components/Pill/Pill.scss index 156a633dc5..c24ca6240e 100644 --- a/src/components/Pill/Pill.scss +++ b/src/components/Pill/Pill.scss @@ -9,20 +9,44 @@ .pill { @include MonospaceFont; - display: inline-block; - background: #D5E5F2; + display: flex; + justify-content: space-between; + align-items: center; color: #0E69A1; height: 20px; line-height: 20px; border-radius: 10px; font-size: 11px; - padding: 0 8px; width: 100%; - text-align: center; overflow: hidden; text-overflow: ellipsis; - - &:hover { - background: #BFD4E5; + white-space: nowrap; + margin-bottom: 4px; + & a { + height: 20px; + width: 20px; + background: #d6e5f2; + border-radius: 50%; + margin-left: 5px; + & svg { + transform: rotate(316deg); + } } } + +.content { + width: 80%; + text-overflow: ellipsis; + overflow: hidden; + text-align: left; + height: 100%; + white-space: nowrap; +} + +.iconAction { + cursor: pointer; +} + +.disableIconAction { + cursor: initial; +} \ No newline at end of file diff --git a/src/dashboard/Data/Browser/EditRowDialog.react.js b/src/dashboard/Data/Browser/EditRowDialog.react.js index e5dbcbd348..6e31031b83 100644 --- a/src/dashboard/Data/Browser/EditRowDialog.react.js +++ b/src/dashboard/Data/Browser/EditRowDialog.react.js @@ -14,6 +14,7 @@ import GeoPointEditor from 'components/GeoPointEditor/GeoPointEditor.react'; import FileEditor from 'components/FileEditor/FileEditor.react'; import ObjectPickerDialog from 'dashboard/Data/Browser/ObjectPickerDialog.react'; import styles from 'dashboard/Data/Browser/Browser.scss'; +import getFileName from 'lib/getFileName'; export default class EditRowDialog extends React.Component { constructor(props) { @@ -23,7 +24,7 @@ export default class EditRowDialog extends React.Component { const { currentObject, openObjectPickers, expandedTextAreas } = this.initializeState( selectedObject ); - this.state = { currentObject, openObjectPickers, expandedTextAreas }; + this.state = { currentObject, openObjectPickers, expandedTextAreas, showFileEditor: false }; this.updateCurrentObject = this.updateCurrentObject.bind(this); this.handleChange = this.handleChange.bind(this); @@ -31,6 +32,8 @@ export default class EditRowDialog extends React.Component { this.openPointer = this.openPointer.bind(this); this.toggleObjectPicker = this.toggleObjectPicker.bind(this); this.openRelation = this.openRelation.bind(this); + this.openFileEditor = this.openFileEditor.bind(this); + this.hideFileEditor = this.hideFileEditor.bind(this); } componentWillReceiveProps(props) { @@ -216,6 +219,18 @@ export default class EditRowDialog extends React.Component { this.setState({ expandedTextAreas }); } + openFileEditor() { + this.setState({ + showFileEditor: true + }); + } + + hideFileEditor() { + this.setState({ + showFileEditor: false + }); + } + render() { const { selectedObject, className, columns, onClose, schema } = this.props; const { currentObject, openObjectPickers, expandedTextAreas } = this.state; @@ -247,6 +262,7 @@ export default class EditRowDialog extends React.Component { 'restricted' ].indexOf(name) >= 0); + let val = currentObject[name]; switch (type) { case 'String': inputComponent = ( @@ -257,7 +273,7 @@ export default class EditRowDialog extends React.Component { : false } disabled={isDisabled} - placeholder={name === 'password' ? '(hidden)' : ''} + placeholder={name === 'password' ? '(hidden)' : val === undefined ? '(undefined)' : ''} value={currentObject[name]} onChange={newValue => this.updateCurrentObject(newValue, name)} onBlur={newValue => this.handleChange(newValue, name)} @@ -269,6 +285,7 @@ export default class EditRowDialog extends React.Component { this.updateCurrentObject(newValue, name)} onBlur={newValue => this.handleChange(parseFloat(newValue), name)} /> @@ -286,6 +303,7 @@ export default class EditRowDialog extends React.Component { expandedTextAreas[name].rows } disabled={isDisabled} + placeholder={val === undefined && '(undefined)'} value={currentObject[name]} onChange={newValue => this.updateCurrentObject(newValue, name)} onBlur={newValue => @@ -296,7 +314,7 @@ export default class EditRowDialog extends React.Component { break; case 'Boolean': inputComponent = isDisabled ? ( - + ) : ( - this.handleChange(newValue, name)} - /> + {file && } +
+ this.openFileEditor()} + /> + {this.state.showFileEditor && ( + this.handleChange(newValue, name)} + /> + )} +
); break; @@ -362,6 +391,7 @@ export default class EditRowDialog extends React.Component { this.openPointer(targetClass, pointerId)} value={pointerId} + followClick={true} /> )} this.openRelation(relation)} value={`View ${type}`} + followClick={true} /> this.toggleObjectPicker(name, true)} diff --git a/src/icons/right-outline.svg b/src/icons/right-outline.svg index 28d82c5965..aad9e17e84 100644 --- a/src/icons/right-outline.svg +++ b/src/icons/right-outline.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file