Skip to content

Commit 9845e1d

Browse files
committed
Merge branch 'antd-3'
2 parents 742a9b3 + 4496d89 commit 9845e1d

File tree

14 files changed

+55
-38
lines changed

14 files changed

+55
-38
lines changed

css/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
.query-builder, .query-preview {
4747
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
48-
font-size: 12px;
48+
font-size: 14px;
4949
line-height: 1.25;
5050
margin: 1rem;
5151
}

examples/demo/demo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import config from './config';
55
var stringify = require('json-stringify-safe');
66
import '../../css/reset.scss';
77
import '../../css/styles.scss';
8-
import '../../css/compact_styles.scss';
8+
//import '../../css/compact_styles.scss';
99
import '../../css/denormalize.scss';
1010
const Immutable = require('immutable');
1111
const transit = require('transit-immutable-js');

examples/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import React, {Component} from 'react';
22
import ReactDOM from 'react-dom';
33
import Demo from './demo/demo.js';
4+
import { hot } from 'react-hot-loader'
45

56
window.React = React;
67

8+
9+
710
class App extends Component {
811
render() {
912
return (
@@ -12,10 +15,13 @@ class App extends Component {
1215
}
1316
}
1417

18+
19+
const AppContainer = hot(module)(App);
20+
1521
ReactDOM.render((
16-
<App>
22+
<AppContainer>
1723
<Demo />
18-
</App>
24+
</AppContainer>
1925
), document.body);
2026

2127

examples/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
loaders: [
1919
{
2020
test: /\.js$/,
21-
loaders: ['react-hot-loader', 'babel-loader'],
21+
loaders: ['babel-loader'],
2222
exclude: /node_modules/
2323
},
2424
{

modules/components/Field.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,24 @@ export default class Field extends Component {
5555
}
5656

5757
filterOption = (input, option) => {
58-
const isInChildren = option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
59-
const isInValue = option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
60-
let isInGroupLabel = false
58+
const { value, groupLabel, children } = option.props;
6159

62-
if (option.props.groupLabel) {
63-
isInGroupLabel = option.props.groupLabel.toLowerCase().indexOf(input.toLowerCase()) >= 0
60+
let isInChildren = false;
61+
if (typeof children === 'string') {
62+
isInChildren = children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
6463
}
6564

66-
return(isInChildren || isInValue || isInGroupLabel)
65+
let isInValue = false;
66+
if (typeof value === 'string') {
67+
isInValue = value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
68+
}
69+
70+
let isInGroupLabel = false;
71+
if (typeof groupLabel === 'string') {
72+
isInGroupLabel = groupLabel.toLowerCase().indexOf(input.toLowerCase()) >= 0;
73+
}
74+
75+
return isInChildren || isInValue || isInGroupLabel;
6776
}
6877

6978
getFieldDisplayLabel(field, fieldKey) {
@@ -118,7 +127,7 @@ export default class Field extends Component {
118127
return <Option
119128
key={prefix+fieldKey}
120129
value={prefix+fieldKey}
121-
groupLabel={optGroupLabel}
130+
grouplabel={optGroupLabel}
122131
>
123132
{label}
124133
</Option>;
@@ -167,7 +176,7 @@ export default class Field extends Component {
167176
let fieldDisplayLabel = isFieldSelected ? this.getFieldDisplayLabel(this.curField(), this.props.selectedField) : null;
168177
let selectText = isFieldSelected ? fieldDisplayLabel : placeholder;
169178
selectText = truncateString(selectText, maxLabelsLength);
170-
let selectWidth = calcTextWidth(selectText, '12px');
179+
let selectWidth = calcTextWidth(selectText, '14px');
171180
//let tooltip = this.curFieldOpts().label2 || selectedFieldFullLabel || this.curFieldOpts().label;
172181
let fieldSelectItems = this.buildSelectItems(fieldOptions);
173182
let customProps = this.props.customProps || {};
@@ -176,7 +185,7 @@ export default class Field extends Component {
176185
<Select
177186
dropdownAlign={dropdownPlacement ? BUILT_IN_PLACEMENTS[dropdownPlacement] : undefined}
178187
dropdownMatchSelectWidth={false}
179-
style={{ width: isFieldSelected && !customProps.showSearch ? null : selectWidth + 36 }}
188+
style={{ width: isFieldSelected && !customProps.showSearch ? null : selectWidth + 48 }}
180189
ref="field"
181190
placeholder={placeholder}
182191
size={this.props.config.settings.renderSize || "small"}

modules/components/Operator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ export default class Operator extends Component {
102102
let selectedOpKey = this.props.selectedOperator;
103103
let opMenuItems = this.buildMenuItems(this.operatorOptions);
104104
let placeholder = this.curOpOpts().label || this.props.config.settings.operatorPlaceholder;
105-
let placeholderWidth = calcTextWidth(placeholder, '12px');
105+
let placeholderWidth = calcTextWidth(placeholder, '14px');
106106
let fieldSelectItems = this.buildSelectItems(this.operatorOptions);
107107
let opSelect = (
108108
<Select
109109
dropdownAlign={dropdownPlacement ? BUILT_IN_PLACEMENTS[dropdownPlacement] : undefined}
110110
dropdownMatchSelectWidth={false}
111-
style={{ width: this.props.selectedOperator ? null : placeholderWidth + 36 }}
111+
style={{ width: this.props.selectedOperator ? null : placeholderWidth + 48 }}
112112
ref="field"
113113
placeholder={placeholder}
114114
size={this.props.config.settings.renderSize || "small"}

modules/components/Query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ConnectedQuery extends Component {
5353
const newConfig = nextProps.config;
5454
const oldValidatedTree = this.validatedTree;
5555

56-
if (oldConfig != newConfig) {
56+
if (oldConfig !== newConfig) {
5757
this._updateActions(nextProps);
5858
}
5959

modules/components/widgets/MultiSelect.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export default class MultiSelectWidget extends Component {
3535

3636
onPropsChanged (props) {
3737
let placeholder = this.props.placeholder || "Select option";
38-
let placeholderWidth = calcTextWidth(placeholder, '12px');
38+
let placeholderWidth = calcTextWidth(placeholder, '14px');
3939
const fieldDefinition = getFieldConfig(this.props.field, this.props.config);
4040
let optionsMaxWidth = 0;
4141
map(fieldDefinition.listValues, (label, value) => {
42-
optionsMaxWidth = Math.max(optionsMaxWidth, calcTextWidth(label, '12px'));
42+
optionsMaxWidth = Math.max(optionsMaxWidth, calcTextWidth(label, '14px'));
4343
});
4444

4545
this.placeholder = placeholder;
@@ -58,10 +58,10 @@ export default class MultiSelectWidget extends Component {
5858

5959
return (
6060
<Select
61-
multiple
61+
mode={"multiple"}
6262
style={{
63-
minWidth: value ? null : this.placeholderWidth + 30,
64-
width: this.props.value ? null : this.placeholderWidth + 30,
63+
minWidth: value ? null : this.placeholderWidth + 40,
64+
width: this.props.value ? null : this.placeholderWidth + 40,
6565
}}
6666
dropdownStyle={{
6767
width: this.optionsMaxWidth + 40,

modules/components/widgets/Range.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default class RangeWidget extends Component {
114114
<Slider
115115
ref="slider"
116116
value={value}
117+
tipFormatter={(val) => (val != undefined ? val.toString() : '')}
117118
min={min}
118119
max={max}
119120
step={step}

modules/components/widgets/Select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export default class SelectWidget extends Component {
3434
const options = map(fieldDefinition.listValues, (label, value) => {
3535
return (<Option key={value} value={value}>{label}</Option>);
3636
});
37-
let placeholderWidth = calcTextWidth(placeholder, '12px');
37+
let placeholderWidth = calcTextWidth(placeholder, '14px');
3838
let customProps = this.props.customProps || {};
3939

4040
return (
4141
<Select
42-
style={{ width: this.props.value ? null : placeholderWidth + 36 }}
42+
style={{ width: this.props.value ? null : placeholderWidth + 48 }}
4343
key={"widget-select"}
4444
dropdownMatchSelectWidth={false}
4545
ref="val"

0 commit comments

Comments
 (0)