Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
work in progress #600
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed May 16, 2017
1 parent 04f981d commit 48ec906
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
11 changes: 11 additions & 0 deletions src/assets/css/inputs.css
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,23 @@ input:checked + .input-slider:before {
padding: .3rem .50rem;
}

.raw-lookup-disabled .input-dropdown-container {
cursor: not-allowed;
}

.raw-lookup-disabled .input-dropdown {
cursor: not-allowed;
}

.raw-lookup-wrapper-bcg:hover {
background-color: $brand-border-color;
}

.input-error .raw-lookup-wrapper-bcg:hover {
background-color: $brand-danger-color !important;
}

.input-error .raw-lookup-wrapper-bcg:hover .input-dropdown-container .input-dropdown {
color: $brand-super-light-color;
}

Expand Down
6 changes: 5 additions & 1 deletion src/components/widget/List/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ class List extends Component {
}

handleSelect = (option) => {
const {onChange, lookupList, properties, setNextProperty, mainProperty} = this.props;
const {onChange, lookupList, properties, setNextProperty, mainProperty, children} = this.props;

console.log(properties);
console.log(children);

if(lookupList){
onChange(children, null);
onChange(properties[0].field, option);
this.setState({
selectedItem: option
Expand Down
3 changes: 3 additions & 0 deletions src/components/widget/List/RawList.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class RawList extends Component {
}

getRow = (index, option, label) => {
const {defaultValue} = this.props;
const {selected} = this.state;

return (
Expand All @@ -273,6 +274,8 @@ class RawList extends Component {
(
this.areOptionsEqual(selected, option) ?
' input-dropdown-list-option-key-on' :
defaultValue === option[Object.keys(option)[0]] ?
' input-dropdown-list-option-key-on' :
''
)
}
Expand Down
11 changes: 10 additions & 1 deletion src/components/widget/Lookup/Lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ class Lookup extends Component {

{
properties && properties.map((item, index) => {
const disabled = isInputEmpty && index != 0;
const children = properties.slice(index+1, properties.length);
console.log('properties');
if(item.source === 'lookup'){
return <RawLookup
key={index}
Expand Down Expand Up @@ -157,6 +160,8 @@ class Lookup extends Component {
item={item}
handleInputEmptyStatus={this.handleInputEmptyStatus}
setNextProperty={this.setNextProperty}
disabled={disabled}
children={children}
/>

} else if (item.source === 'list') {
Expand All @@ -165,7 +170,9 @@ class Lookup extends Component {
defaultValue, 'field', item.field
)[0].value;

return <div className="raw-lookup-wrapper raw-lookup-wrapper-bcg" key={index}>
return <div className={
'raw-lookup-wrapper raw-lookup-wrapper-bcg ' +
(disabled ? 'raw-lookup-disabled':'')} key={index}>
<List
dataId={dataId}
entity={entity}
Expand All @@ -184,6 +191,8 @@ class Lookup extends Component {
setNextProperty={this.setNextProperty}
mainProperty={[item]}
blur={!property?true:false}
readonly={disabled}
children={children}
/>
</div>
}
Expand Down
15 changes: 10 additions & 5 deletions src/components/widget/Lookup/RawLookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class RawLookup extends Component {
getNextDropdown, setNextProperty
} = this.props;



this.setState({
selected: null
}, () => {
Expand All @@ -75,7 +77,6 @@ class RawLookup extends Component {
this.handleBlur();
} else {
// handling selection when main is not set or set.

onChange(
mainProperty[0].field, select, this.getAllDropdowns
);
Expand Down Expand Up @@ -264,15 +265,19 @@ class RawLookup extends Component {

render() {
const { handleAddNew, onClickOutside, disableOnClickOutside, isModal, rank, updated, filterWidget, mandatory, validStatus, align,
creatingNewDisabled, newRecordCaption, placeholder, readonly, tabIndex, item, mainProperty} = this.props;
creatingNewDisabled, newRecordCaption, placeholder, readonly, disabled, tabIndex, item, mainProperty} = this.props;

const {
propertiesCopy, isInputEmpty, list, query, loading, selected,
isOpen, validLocal
} = this.state;

return (
<div className="raw-lookup-wrapper raw-lookup-wrapper-bcg">
<div className={"raw-lookup-wrapper raw-lookup-wrapper-bcg "+
(disabled ? 'raw-lookup-disabled':'')
}

>
<div className={
'input-dropdown input-block'

Expand All @@ -289,9 +294,9 @@ class RawLookup extends Component {
onFocus={this.handleFocus}
ref={(c) => this.inputSearch = c}
placeholder={placeholder}
disabled={readonly}
disabled={readonly && !disabled}
tabIndex={tabIndex}

/>

</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/widget/MasterWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class MasterWidget extends Component {
}

handlePatch = (property, value) => {
console.log('property');
console.log(property);
const {
isModal, widgetType, dataId, windowType, dispatch, rowId, tabId,
onChange, relativeDocId, isAdvanced = false, entity
Expand Down

0 comments on commit 48ec906

Please sign in to comment.