@elliemae/ds-query-builder 2.0.0-rc.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/AndOrController/AndOrController.js +10 -12
- package/cjs/components/DisplayOutput/DisplayOutput.js +2 -4
- package/cjs/components/Nestable/Nestable.js +20 -20
- package/cjs/components/QueryBuilderImpl.js +29 -30
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +9 -9
- package/cjs/components/format/format.js +8 -14
- package/cjs/components/helpers/store.js +33 -39
- package/esm/components/AndOrController/AndOrController.js +10 -11
- package/esm/components/DisplayOutput/DisplayOutput.js +2 -3
- package/esm/components/Nestable/Nestable.js +20 -20
- package/esm/components/QueryBuilderImpl.js +29 -30
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +9 -9
- package/esm/components/format/format.js +8 -10
- package/esm/components/helpers/store.js +33 -39
- package/package.json +12 -12
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
7
6
|
var DSTooltip = require('@elliemae/ds-tooltip');
|
|
@@ -18,7 +17,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
18
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
18
|
|
|
20
19
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
21
|
var DSTooltip__default = /*#__PURE__*/_interopDefaultLegacy(DSTooltip);
|
|
24
22
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
@@ -42,11 +40,11 @@ class AndOrController extends React.Component {
|
|
|
42
40
|
constructor(props) {
|
|
43
41
|
super(props);
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
this.handleMouseEnterRow = e => {
|
|
46
44
|
this.handleTooltipRow(true); // this.handleMouseMove(e)
|
|
47
|
-
}
|
|
45
|
+
};
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
this.handleMouseMove = e => {
|
|
50
48
|
if (!this.contenerRef.current) return;
|
|
51
49
|
const mouse = e.clientY;
|
|
52
50
|
const {
|
|
@@ -58,13 +56,13 @@ class AndOrController extends React.Component {
|
|
|
58
56
|
this.setState({
|
|
59
57
|
top: mouse - topDiff - refHeight / 2 - delta
|
|
60
58
|
});
|
|
61
|
-
}
|
|
59
|
+
};
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
this.handleMouseLeaveRow = () => {
|
|
64
62
|
this.handleTooltipRow(false);
|
|
65
|
-
}
|
|
63
|
+
};
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
this.handleTooltipRow = isOpen => {
|
|
68
66
|
this.setState({
|
|
69
67
|
isOpen
|
|
70
68
|
});
|
|
@@ -72,7 +70,7 @@ class AndOrController extends React.Component {
|
|
|
72
70
|
handleTooltipGroup
|
|
73
71
|
} = this.props;
|
|
74
72
|
handleTooltipGroup(isOpen);
|
|
75
|
-
}
|
|
73
|
+
};
|
|
76
74
|
|
|
77
75
|
this.contenerRef = /*#__PURE__*/React__default["default"].createRef();
|
|
78
76
|
this.myRef = /*#__PURE__*/React__default["default"].createRef();
|
|
@@ -198,7 +196,7 @@ class AndOrController extends React.Component {
|
|
|
198
196
|
|
|
199
197
|
}
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
AndOrController.defaultProps = {
|
|
202
200
|
isMain: false,
|
|
203
201
|
handleRuleContainerOperator: () => null,
|
|
204
202
|
handleRuleContainerUnGroup: () => null,
|
|
@@ -219,6 +217,6 @@ _defineProperty__default["default"](AndOrController, "defaultProps", {
|
|
|
219
217
|
toolBarAnimationDuration: constants.TOOLBAR_ANIMATION_DURATION,
|
|
220
218
|
toolBarInteractionType: dsPopper.PopperInteractions.CLICK,
|
|
221
219
|
toolBarPosition: dsPopper.PopperPositions.LEFT
|
|
222
|
-
}
|
|
220
|
+
};
|
|
223
221
|
|
|
224
222
|
module.exports = AndOrController;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var dsGrid = require('@elliemae/ds-grid');
|
|
7
6
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
@@ -12,7 +11,6 @@ var QueryBuilderContext = require('../QueryBuilderContext/QueryBuilderContext.js
|
|
|
12
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
12
|
|
|
14
13
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
14
|
|
|
17
15
|
const {
|
|
18
16
|
cssClassName
|
|
@@ -22,7 +20,7 @@ class DisplayOutput extends React.Component {
|
|
|
22
20
|
constructor(props) {
|
|
23
21
|
super(props);
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
this.handleChange = () => {
|
|
26
24
|
this.setState(_ref => {
|
|
27
25
|
let {
|
|
28
26
|
show
|
|
@@ -31,7 +29,7 @@ class DisplayOutput extends React.Component {
|
|
|
31
29
|
show: !show
|
|
32
30
|
};
|
|
33
31
|
});
|
|
34
|
-
}
|
|
32
|
+
};
|
|
35
33
|
|
|
36
34
|
this.state = {
|
|
37
35
|
show: props.show
|
|
@@ -39,43 +39,43 @@ class Nestable extends React.Component {
|
|
|
39
39
|
constructor(props) {
|
|
40
40
|
super(props);
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
this.onDragStart = (e, item) => {
|
|
43
43
|
events.onDragStart.call(this, e, item);
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
this.onDragEnd = (e, isCancel) => events.onDragEnd.call(this, e, isCancel);
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
this.onMouseMove = e => events.onMouseMove.call(this, e);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
this.onMouseEnter = (e, item) => events.onMouseEnter.call(this, e, item);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
this.onToggleCollapse = (item, isGetter) => events.onToggleCollapse.call(this, item, isGetter);
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
this.onKeyDown = e => events.onKeyDown.call(this, e);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
this.getDefaultItems = () => {
|
|
57
57
|
const {
|
|
58
58
|
items
|
|
59
59
|
} = this.state;
|
|
60
60
|
return items;
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
this.getItemDepth = item => paths.getItemDepth.call(this, item);
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
this.startTrackMouse = () => {
|
|
66
66
|
document.addEventListener('mousemove', this.onMouseMove);
|
|
67
67
|
document.addEventListener('mouseup', this.onDragEnd);
|
|
68
68
|
document.addEventListener('keydown', this.onKeyDown);
|
|
69
|
-
}
|
|
69
|
+
};
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
this.stopTrackMouse = () => {
|
|
72
72
|
document.removeEventListener('mousemove', this.onMouseMove);
|
|
73
73
|
document.removeEventListener('mouseup', this.onDragEnd);
|
|
74
74
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
75
75
|
this.elCopyStyles = null;
|
|
76
|
-
}
|
|
76
|
+
};
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
this.isCollapsed = item => {
|
|
79
79
|
const {
|
|
80
80
|
collapsed
|
|
81
81
|
} = this.props;
|
|
@@ -83,9 +83,9 @@ class Nestable extends React.Component {
|
|
|
83
83
|
collapsedGroups
|
|
84
84
|
} = this.state;
|
|
85
85
|
return !!(collapsedGroups.indexOf(item.id) > -1 ^ collapsed);
|
|
86
|
-
}
|
|
86
|
+
};
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
this.checkFilterChildren = items => items.find(current => {
|
|
89
89
|
const {
|
|
90
90
|
element: {
|
|
91
91
|
type
|
|
@@ -94,9 +94,9 @@ class Nestable extends React.Component {
|
|
|
94
94
|
} = current;
|
|
95
95
|
if (type === 'filter' && children.length > 0) return true;
|
|
96
96
|
return this.checkFilterChildren(children);
|
|
97
|
-
})
|
|
97
|
+
});
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
this.dragRevert = () => {
|
|
100
100
|
const {
|
|
101
101
|
itemsOld
|
|
102
102
|
} = this.state;
|
|
@@ -106,7 +106,7 @@ class Nestable extends React.Component {
|
|
|
106
106
|
dragItem: null,
|
|
107
107
|
isDirty: false
|
|
108
108
|
});
|
|
109
|
-
}
|
|
109
|
+
};
|
|
110
110
|
|
|
111
111
|
this.state = {
|
|
112
112
|
items: [],
|
|
@@ -33,26 +33,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
33
33
|
class QueryBuilderImpl extends React.Component {
|
|
34
34
|
constructor(props) {
|
|
35
35
|
super(props);
|
|
36
|
+
this.isDraggableItem = true;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
_defineProperty__default["default"](this, "onOrderDragAndDrop", (items, item) => {
|
|
38
|
+
this.onOrderDragAndDrop = (items, item) => {
|
|
40
39
|
const newFilters = this.store.onOrderDragAndDrop(items, item);
|
|
41
40
|
this.sendCall('reOrderOnDragAndDrop', {
|
|
42
41
|
items
|
|
43
42
|
});
|
|
44
43
|
this.sendChange(newFilters);
|
|
45
|
-
}
|
|
44
|
+
};
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
this.onAddFilterToGroup = idGroup => {
|
|
48
47
|
const newFilters = this.store.addFilter(idGroup);
|
|
49
48
|
this.sendCall('onAddFilterToGroup', {
|
|
50
49
|
idGroup
|
|
51
50
|
});
|
|
52
51
|
this.sendChange(newFilters);
|
|
53
|
-
}
|
|
52
|
+
};
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
this.onAddFilter = (idGroup, idFilter) => {
|
|
56
55
|
const {
|
|
57
56
|
addFilterMethod
|
|
58
57
|
} = this.props;
|
|
@@ -62,9 +61,9 @@ class QueryBuilderImpl extends React.Component {
|
|
|
62
61
|
idFilter
|
|
63
62
|
});
|
|
64
63
|
this.sendChange(newFilters);
|
|
65
|
-
}
|
|
64
|
+
};
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
this.onAddRuleContainer = (idGroup, idFilter) => {
|
|
68
67
|
const {
|
|
69
68
|
groupFilterMethod
|
|
70
69
|
} = this.props;
|
|
@@ -74,17 +73,17 @@ class QueryBuilderImpl extends React.Component {
|
|
|
74
73
|
idFilter
|
|
75
74
|
});
|
|
76
75
|
this.sendChange(newFilters);
|
|
77
|
-
}
|
|
76
|
+
};
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
this.onRemoveFilter = idFilter => {
|
|
80
79
|
const newFilters = this.store.onRemoveFilter(idFilter);
|
|
81
80
|
this.sendCall('onRemoveFilter', {
|
|
82
81
|
idFilter
|
|
83
82
|
});
|
|
84
83
|
this.sendChange(newFilters);
|
|
85
|
-
}
|
|
84
|
+
};
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
this.handleFieldChange = data => {
|
|
88
87
|
const {
|
|
89
88
|
fieldsSharedActions
|
|
90
89
|
} = this.props;
|
|
@@ -95,26 +94,26 @@ class QueryBuilderImpl extends React.Component {
|
|
|
95
94
|
data
|
|
96
95
|
});
|
|
97
96
|
this.sendChange(newFilters);
|
|
98
|
-
}
|
|
97
|
+
};
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
this.handleRuleContainerOperator = (idGroup, value) => {
|
|
101
100
|
const newFilters = this.store.changeGroupOperator(idGroup, value);
|
|
102
101
|
this.sendCall('handleRuleContainerOperator', {
|
|
103
102
|
idGroup,
|
|
104
103
|
value
|
|
105
104
|
});
|
|
106
105
|
this.sendChange(newFilters);
|
|
107
|
-
}
|
|
106
|
+
};
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
this.handleRuleContainerUnGroup = idGroup => {
|
|
110
109
|
const newFilters = this.store.unGroup(idGroup);
|
|
111
110
|
this.sendCall('handleRuleContainerUnGroup', {
|
|
112
111
|
idGroup
|
|
113
112
|
});
|
|
114
113
|
this.sendChange(newFilters);
|
|
115
|
-
}
|
|
114
|
+
};
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
this.handleDropFilter = (filter, dragTo) => {
|
|
118
117
|
const {
|
|
119
118
|
position: oldPosition,
|
|
120
119
|
idGroup,
|
|
@@ -130,9 +129,9 @@ class QueryBuilderImpl extends React.Component {
|
|
|
130
129
|
dragTo
|
|
131
130
|
});
|
|
132
131
|
this.sendChange(newFilters);
|
|
133
|
-
}
|
|
132
|
+
};
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
this.handleDropGroup = (group, dragTo) => {
|
|
136
135
|
const {
|
|
137
136
|
position: oldPosition,
|
|
138
137
|
idFilter,
|
|
@@ -148,17 +147,17 @@ class QueryBuilderImpl extends React.Component {
|
|
|
148
147
|
dragTo
|
|
149
148
|
});
|
|
150
149
|
this.sendChange(newFilters);
|
|
151
|
-
}
|
|
150
|
+
};
|
|
152
151
|
|
|
153
|
-
|
|
152
|
+
this.handleDrop = (dragElement, dragTo) => {
|
|
154
153
|
const {
|
|
155
154
|
type
|
|
156
155
|
} = dragElement;
|
|
157
156
|
if (type === types.QB_DRAG_TYPES.FILTER) return this.handleDropFilter(dragElement, dragTo);
|
|
158
157
|
return this.handleDropGroup(dragElement, dragTo);
|
|
159
|
-
}
|
|
158
|
+
};
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
this.sendChange = _ref => {
|
|
162
161
|
let {
|
|
163
162
|
format
|
|
164
163
|
} = _ref,
|
|
@@ -171,16 +170,16 @@ class QueryBuilderImpl extends React.Component {
|
|
|
171
170
|
onChange
|
|
172
171
|
} = this.props;
|
|
173
172
|
onChange(format, newFilters);
|
|
174
|
-
}
|
|
173
|
+
};
|
|
175
174
|
|
|
176
|
-
|
|
175
|
+
this.sendCall = (action, data) => {
|
|
177
176
|
const {
|
|
178
177
|
[action]: callback
|
|
179
178
|
} = this.props;
|
|
180
179
|
if (callback) callback(data);
|
|
181
|
-
}
|
|
180
|
+
};
|
|
182
181
|
|
|
183
|
-
|
|
182
|
+
this.setDraggableItems = drag => {
|
|
184
183
|
this.isDraggableItem = true;
|
|
185
184
|
|
|
186
185
|
try {
|
|
@@ -203,7 +202,7 @@ class QueryBuilderImpl extends React.Component {
|
|
|
203
202
|
} catch (error) {
|
|
204
203
|
this.isDraggableItem = true;
|
|
205
204
|
}
|
|
206
|
-
}
|
|
205
|
+
};
|
|
207
206
|
|
|
208
207
|
this.store = new store(props.init, props.format);
|
|
209
208
|
this.state = this.store.getInitialState();
|
|
@@ -114,31 +114,31 @@ class QueryBuilderRow extends React.Component {
|
|
|
114
114
|
constructor(props) {
|
|
115
115
|
super(props);
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
this.handleMouseEnterRow = () => {};
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
this.handleMouseLeaveRow = () => {
|
|
120
120
|
this.handleTooltipRow(false);
|
|
121
|
-
}
|
|
121
|
+
};
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
this.handleMouseEnterInput = () => {
|
|
124
124
|
const {
|
|
125
125
|
setDraggableItems
|
|
126
126
|
} = this.props;
|
|
127
127
|
setDraggableItems(false);
|
|
128
|
-
}
|
|
128
|
+
};
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
this.handleMouseLeaveInput = () => {
|
|
131
131
|
const {
|
|
132
132
|
setDraggableItems
|
|
133
133
|
} = this.props;
|
|
134
134
|
setDraggableItems(true);
|
|
135
|
-
}
|
|
135
|
+
};
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
this.handleTooltipRow = isOpen => {
|
|
138
138
|
this.setState({
|
|
139
139
|
isOpen
|
|
140
140
|
});
|
|
141
|
-
}
|
|
141
|
+
};
|
|
142
142
|
|
|
143
143
|
this.state = {
|
|
144
144
|
isOpen: false
|
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
3
|
var sqlFormat = require('./sqlFormat.js');
|
|
5
4
|
var xmlFormat = require('./xmlFormat.js');
|
|
6
5
|
var sqlSafeFormat = require('./sqlSafeFormat.js');
|
|
7
6
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
11
|
-
|
|
12
7
|
class QueryBuilderFormat {
|
|
13
8
|
constructor() {
|
|
14
|
-
|
|
9
|
+
this.format = {
|
|
15
10
|
defaultFormat: query => query,
|
|
16
11
|
sqlFormat: sqlFormat.sqlFormat,
|
|
17
12
|
xmlFormat: xmlFormat.xmlFormat,
|
|
18
13
|
sqlSafeFormat: sqlSafeFormat.sqlSafeFormat
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
_defineProperty__default["default"](this, "currentFormat", 'sqlFormat');
|
|
14
|
+
};
|
|
15
|
+
this.currentFormat = 'sqlFormat';
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
this.setDefaultFormat = formatName => {
|
|
24
18
|
if (this.format[formatName]) this.currentFormat = formatName;
|
|
25
|
-
}
|
|
19
|
+
};
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
this.addFormat = (formatName, format) => this.format[formatName] = format;
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
this.run = (query, formatName) => {
|
|
30
24
|
if (this.format[formatName]) return this.format[formatName](query);
|
|
31
25
|
return this.format[this.currentFormat](query);
|
|
32
|
-
}
|
|
26
|
+
};
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
}
|
|
@@ -30,36 +30,30 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
30
30
|
|
|
31
31
|
class QueryBuilderStore {
|
|
32
32
|
constructor(init, _format) {
|
|
33
|
-
|
|
33
|
+
this.items = [];
|
|
34
|
+
this.step = 0;
|
|
35
|
+
this.steps = {};
|
|
36
|
+
this.mapFilters = {};
|
|
37
|
+
this.mapGroups = {};
|
|
38
|
+
this.main = null;
|
|
39
|
+
this.format = null;
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
this.createNewFilter = idGroup => actions.createNewFilter.call(this, idGroup);
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
this.createNewGroup = parentIdGroup => actions.createNewGroup.call(this, parentIdGroup);
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_defineProperty__default["default"](this, "mapGroups", {});
|
|
42
|
-
|
|
43
|
-
_defineProperty__default["default"](this, "main", null);
|
|
44
|
-
|
|
45
|
-
_defineProperty__default["default"](this, "format", null);
|
|
46
|
-
|
|
47
|
-
_defineProperty__default["default"](this, "createNewFilter", idGroup => actions.createNewFilter.call(this, idGroup));
|
|
48
|
-
|
|
49
|
-
_defineProperty__default["default"](this, "createNewGroup", parentIdGroup => actions.createNewGroup.call(this, parentIdGroup));
|
|
50
|
-
|
|
51
|
-
_defineProperty__default["default"](this, "onOrderDragAndDrop", items => {
|
|
45
|
+
this.onOrderDragAndDrop = items => {
|
|
52
46
|
this.items = items;
|
|
53
47
|
return this.getState();
|
|
54
|
-
}
|
|
48
|
+
};
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
this.addFilterNextToFilterId = (idGroup, idFilter) => {
|
|
57
51
|
// eslint-disable-line
|
|
58
52
|
this.addFilter(idGroup);
|
|
59
53
|
return this.getState();
|
|
60
|
-
}
|
|
54
|
+
};
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
this.addFilter = idGroup => {
|
|
63
57
|
const newFilter = this.createNewFilter(idGroup);
|
|
64
58
|
actions.addFilterToMap.call(this, newFilter); // new API
|
|
65
59
|
|
|
@@ -74,22 +68,22 @@ class QueryBuilderStore {
|
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
return this.getState();
|
|
77
|
-
}
|
|
71
|
+
};
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
this.onRemoveFilter = idFilter => {
|
|
80
74
|
// new API
|
|
81
75
|
actions.removeFilterItem.call(this, idFilter);
|
|
82
76
|
return this.getState();
|
|
83
|
-
}
|
|
77
|
+
};
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
this.addRuleContainerInPlace = (idGroup, idFilter) => {
|
|
86
80
|
// Create a new group
|
|
87
81
|
const newGroup = this.createNewGroup(idGroup);
|
|
88
82
|
actions.addGroupFilterToItem.call(this, idGroup, idFilter, newGroup);
|
|
89
83
|
return this.getState();
|
|
90
|
-
}
|
|
84
|
+
};
|
|
91
85
|
|
|
92
|
-
|
|
86
|
+
this.addRuleContainer = (idGroup, idFilter) => {
|
|
93
87
|
// eslint-disable-line
|
|
94
88
|
const newGroup = this.createNewGroup(idGroup);
|
|
95
89
|
actions.addGroupToMap.call(this, newGroup);
|
|
@@ -105,33 +99,33 @@ class QueryBuilderStore {
|
|
|
105
99
|
}
|
|
106
100
|
|
|
107
101
|
return this.getState();
|
|
108
|
-
}
|
|
102
|
+
};
|
|
109
103
|
|
|
110
|
-
|
|
104
|
+
this.unGroup = idGroup => {
|
|
111
105
|
actions.unGroupFilterToItem.call(this, idGroup);
|
|
112
106
|
return this.getState();
|
|
113
|
-
}
|
|
107
|
+
};
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
this.changeGroupOperator = (idGroup, value) => {
|
|
116
110
|
this.getGroupById(idGroup).condition = value;
|
|
117
111
|
actions.changeGroupOperator.call(this, idGroup, value);
|
|
118
112
|
return this.getState();
|
|
119
|
-
}
|
|
113
|
+
};
|
|
120
114
|
|
|
121
|
-
|
|
115
|
+
this.changeFilter = data => {
|
|
122
116
|
const {
|
|
123
117
|
idFilter
|
|
124
118
|
} = data;
|
|
125
119
|
this.mapFilters[idFilter] = _objectSpread(_objectSpread({}, this.mapFilters[idFilter]), data);
|
|
126
120
|
actions.changeFilterItem.call(this, data);
|
|
127
121
|
return this.getState();
|
|
128
|
-
}
|
|
122
|
+
};
|
|
129
123
|
|
|
130
|
-
|
|
124
|
+
this.getGroupById = idGroup => this.mapGroups[idGroup] || {};
|
|
131
125
|
|
|
132
|
-
|
|
126
|
+
this.getFilterById = idFilter => this.mapFilters[idFilter];
|
|
133
127
|
|
|
134
|
-
|
|
128
|
+
this.getInitialState = () => {
|
|
135
129
|
const newFilters = {
|
|
136
130
|
step: this.step,
|
|
137
131
|
mapFilters: _objectSpread({}, this.mapFilters),
|
|
@@ -143,9 +137,9 @@ class QueryBuilderStore {
|
|
|
143
137
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
144
138
|
format: format$1
|
|
145
139
|
});
|
|
146
|
-
}
|
|
140
|
+
};
|
|
147
141
|
|
|
148
|
-
|
|
142
|
+
this.getState = () => {
|
|
149
143
|
this.step += 1;
|
|
150
144
|
const newFilters = {
|
|
151
145
|
step: this.step,
|
|
@@ -158,7 +152,7 @@ class QueryBuilderStore {
|
|
|
158
152
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
159
153
|
format: format$1
|
|
160
154
|
});
|
|
161
|
-
}
|
|
155
|
+
};
|
|
162
156
|
|
|
163
157
|
this.firstLoad = true;
|
|
164
158
|
this.format = _format;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import React, { Component } from 'react';
|
|
4
3
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
5
4
|
import DSTooltip, { TooltipType } from '@elliemae/ds-tooltip';
|
|
@@ -32,11 +31,11 @@ class AndOrController extends Component {
|
|
|
32
31
|
constructor(props) {
|
|
33
32
|
super(props);
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
this.handleMouseEnterRow = e => {
|
|
36
35
|
this.handleTooltipRow(true); // this.handleMouseMove(e)
|
|
37
|
-
}
|
|
36
|
+
};
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
this.handleMouseMove = e => {
|
|
40
39
|
if (!this.contenerRef.current) return;
|
|
41
40
|
const mouse = e.clientY;
|
|
42
41
|
const {
|
|
@@ -48,13 +47,13 @@ class AndOrController extends Component {
|
|
|
48
47
|
this.setState({
|
|
49
48
|
top: mouse - topDiff - refHeight / 2 - delta
|
|
50
49
|
});
|
|
51
|
-
}
|
|
50
|
+
};
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
this.handleMouseLeaveRow = () => {
|
|
54
53
|
this.handleTooltipRow(false);
|
|
55
|
-
}
|
|
54
|
+
};
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
this.handleTooltipRow = isOpen => {
|
|
58
57
|
this.setState({
|
|
59
58
|
isOpen
|
|
60
59
|
});
|
|
@@ -62,7 +61,7 @@ class AndOrController extends Component {
|
|
|
62
61
|
handleTooltipGroup
|
|
63
62
|
} = this.props;
|
|
64
63
|
handleTooltipGroup(isOpen);
|
|
65
|
-
}
|
|
64
|
+
};
|
|
66
65
|
|
|
67
66
|
this.contenerRef = /*#__PURE__*/React.createRef();
|
|
68
67
|
this.myRef = /*#__PURE__*/React.createRef();
|
|
@@ -188,7 +187,7 @@ class AndOrController extends Component {
|
|
|
188
187
|
|
|
189
188
|
}
|
|
190
189
|
|
|
191
|
-
|
|
190
|
+
AndOrController.defaultProps = {
|
|
192
191
|
isMain: false,
|
|
193
192
|
handleRuleContainerOperator: () => null,
|
|
194
193
|
handleRuleContainerUnGroup: () => null,
|
|
@@ -209,6 +208,6 @@ _defineProperty(AndOrController, "defaultProps", {
|
|
|
209
208
|
toolBarAnimationDuration: TOOLBAR_ANIMATION_DURATION,
|
|
210
209
|
toolBarInteractionType: PopperInteractions.CLICK,
|
|
211
210
|
toolBarPosition: PopperPositions.LEFT
|
|
212
|
-
}
|
|
211
|
+
};
|
|
213
212
|
|
|
214
213
|
export { AndOrController as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import { Component } from 'react';
|
|
4
3
|
import { Grid } from '@elliemae/ds-grid';
|
|
5
4
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
@@ -15,7 +14,7 @@ class DisplayOutput extends Component {
|
|
|
15
14
|
constructor(props) {
|
|
16
15
|
super(props);
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
this.handleChange = () => {
|
|
19
18
|
this.setState(_ref => {
|
|
20
19
|
let {
|
|
21
20
|
show
|
|
@@ -24,7 +23,7 @@ class DisplayOutput extends Component {
|
|
|
24
23
|
show: !show
|
|
25
24
|
};
|
|
26
25
|
});
|
|
27
|
-
}
|
|
26
|
+
};
|
|
28
27
|
|
|
29
28
|
this.state = {
|
|
30
29
|
show: props.show
|
|
@@ -31,43 +31,43 @@ class Nestable extends Component {
|
|
|
31
31
|
constructor(props) {
|
|
32
32
|
super(props);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
this.onDragStart = (e, item) => {
|
|
35
35
|
onDragStart.call(this, e, item);
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
this.onDragEnd = (e, isCancel) => onDragEnd.call(this, e, isCancel);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
this.onMouseMove = e => onMouseMove.call(this, e);
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
this.onMouseEnter = (e, item) => onMouseEnter.call(this, e, item);
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
this.onToggleCollapse = (item, isGetter) => onToggleCollapse.call(this, item, isGetter);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
this.onKeyDown = e => onKeyDown.call(this, e);
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
this.getDefaultItems = () => {
|
|
49
49
|
const {
|
|
50
50
|
items
|
|
51
51
|
} = this.state;
|
|
52
52
|
return items;
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
this.getItemDepth = item => getItemDepth.call(this, item);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
this.startTrackMouse = () => {
|
|
58
58
|
document.addEventListener('mousemove', this.onMouseMove);
|
|
59
59
|
document.addEventListener('mouseup', this.onDragEnd);
|
|
60
60
|
document.addEventListener('keydown', this.onKeyDown);
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
this.stopTrackMouse = () => {
|
|
64
64
|
document.removeEventListener('mousemove', this.onMouseMove);
|
|
65
65
|
document.removeEventListener('mouseup', this.onDragEnd);
|
|
66
66
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
67
67
|
this.elCopyStyles = null;
|
|
68
|
-
}
|
|
68
|
+
};
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
this.isCollapsed = item => {
|
|
71
71
|
const {
|
|
72
72
|
collapsed
|
|
73
73
|
} = this.props;
|
|
@@ -75,9 +75,9 @@ class Nestable extends Component {
|
|
|
75
75
|
collapsedGroups
|
|
76
76
|
} = this.state;
|
|
77
77
|
return !!(collapsedGroups.indexOf(item.id) > -1 ^ collapsed);
|
|
78
|
-
}
|
|
78
|
+
};
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
this.checkFilterChildren = items => items.find(current => {
|
|
81
81
|
const {
|
|
82
82
|
element: {
|
|
83
83
|
type
|
|
@@ -86,9 +86,9 @@ class Nestable extends Component {
|
|
|
86
86
|
} = current;
|
|
87
87
|
if (type === 'filter' && children.length > 0) return true;
|
|
88
88
|
return this.checkFilterChildren(children);
|
|
89
|
-
})
|
|
89
|
+
});
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
this.dragRevert = () => {
|
|
92
92
|
const {
|
|
93
93
|
itemsOld
|
|
94
94
|
} = this.state;
|
|
@@ -98,7 +98,7 @@ class Nestable extends Component {
|
|
|
98
98
|
dragItem: null,
|
|
99
99
|
isDirty: false
|
|
100
100
|
});
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
|
|
103
103
|
this.state = {
|
|
104
104
|
items: [],
|
|
@@ -25,26 +25,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
25
25
|
class QueryBuilderImpl extends Component {
|
|
26
26
|
constructor(props) {
|
|
27
27
|
super(props);
|
|
28
|
+
this.isDraggableItem = true;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "onOrderDragAndDrop", (items, item) => {
|
|
30
|
+
this.onOrderDragAndDrop = (items, item) => {
|
|
32
31
|
const newFilters = this.store.onOrderDragAndDrop(items, item);
|
|
33
32
|
this.sendCall('reOrderOnDragAndDrop', {
|
|
34
33
|
items
|
|
35
34
|
});
|
|
36
35
|
this.sendChange(newFilters);
|
|
37
|
-
}
|
|
36
|
+
};
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
this.onAddFilterToGroup = idGroup => {
|
|
40
39
|
const newFilters = this.store.addFilter(idGroup);
|
|
41
40
|
this.sendCall('onAddFilterToGroup', {
|
|
42
41
|
idGroup
|
|
43
42
|
});
|
|
44
43
|
this.sendChange(newFilters);
|
|
45
|
-
}
|
|
44
|
+
};
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
this.onAddFilter = (idGroup, idFilter) => {
|
|
48
47
|
const {
|
|
49
48
|
addFilterMethod
|
|
50
49
|
} = this.props;
|
|
@@ -54,9 +53,9 @@ class QueryBuilderImpl extends Component {
|
|
|
54
53
|
idFilter
|
|
55
54
|
});
|
|
56
55
|
this.sendChange(newFilters);
|
|
57
|
-
}
|
|
56
|
+
};
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
this.onAddRuleContainer = (idGroup, idFilter) => {
|
|
60
59
|
const {
|
|
61
60
|
groupFilterMethod
|
|
62
61
|
} = this.props;
|
|
@@ -66,17 +65,17 @@ class QueryBuilderImpl extends Component {
|
|
|
66
65
|
idFilter
|
|
67
66
|
});
|
|
68
67
|
this.sendChange(newFilters);
|
|
69
|
-
}
|
|
68
|
+
};
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
this.onRemoveFilter = idFilter => {
|
|
72
71
|
const newFilters = this.store.onRemoveFilter(idFilter);
|
|
73
72
|
this.sendCall('onRemoveFilter', {
|
|
74
73
|
idFilter
|
|
75
74
|
});
|
|
76
75
|
this.sendChange(newFilters);
|
|
77
|
-
}
|
|
76
|
+
};
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
this.handleFieldChange = data => {
|
|
80
79
|
const {
|
|
81
80
|
fieldsSharedActions
|
|
82
81
|
} = this.props;
|
|
@@ -87,26 +86,26 @@ class QueryBuilderImpl extends Component {
|
|
|
87
86
|
data
|
|
88
87
|
});
|
|
89
88
|
this.sendChange(newFilters);
|
|
90
|
-
}
|
|
89
|
+
};
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
this.handleRuleContainerOperator = (idGroup, value) => {
|
|
93
92
|
const newFilters = this.store.changeGroupOperator(idGroup, value);
|
|
94
93
|
this.sendCall('handleRuleContainerOperator', {
|
|
95
94
|
idGroup,
|
|
96
95
|
value
|
|
97
96
|
});
|
|
98
97
|
this.sendChange(newFilters);
|
|
99
|
-
}
|
|
98
|
+
};
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
this.handleRuleContainerUnGroup = idGroup => {
|
|
102
101
|
const newFilters = this.store.unGroup(idGroup);
|
|
103
102
|
this.sendCall('handleRuleContainerUnGroup', {
|
|
104
103
|
idGroup
|
|
105
104
|
});
|
|
106
105
|
this.sendChange(newFilters);
|
|
107
|
-
}
|
|
106
|
+
};
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
this.handleDropFilter = (filter, dragTo) => {
|
|
110
109
|
const {
|
|
111
110
|
position: oldPosition,
|
|
112
111
|
idGroup,
|
|
@@ -122,9 +121,9 @@ class QueryBuilderImpl extends Component {
|
|
|
122
121
|
dragTo
|
|
123
122
|
});
|
|
124
123
|
this.sendChange(newFilters);
|
|
125
|
-
}
|
|
124
|
+
};
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
this.handleDropGroup = (group, dragTo) => {
|
|
128
127
|
const {
|
|
129
128
|
position: oldPosition,
|
|
130
129
|
idFilter,
|
|
@@ -140,17 +139,17 @@ class QueryBuilderImpl extends Component {
|
|
|
140
139
|
dragTo
|
|
141
140
|
});
|
|
142
141
|
this.sendChange(newFilters);
|
|
143
|
-
}
|
|
142
|
+
};
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
this.handleDrop = (dragElement, dragTo) => {
|
|
146
145
|
const {
|
|
147
146
|
type
|
|
148
147
|
} = dragElement;
|
|
149
148
|
if (type === QB_DRAG_TYPES.FILTER) return this.handleDropFilter(dragElement, dragTo);
|
|
150
149
|
return this.handleDropGroup(dragElement, dragTo);
|
|
151
|
-
}
|
|
150
|
+
};
|
|
152
151
|
|
|
153
|
-
|
|
152
|
+
this.sendChange = _ref => {
|
|
154
153
|
let {
|
|
155
154
|
format
|
|
156
155
|
} = _ref,
|
|
@@ -163,16 +162,16 @@ class QueryBuilderImpl extends Component {
|
|
|
163
162
|
onChange
|
|
164
163
|
} = this.props;
|
|
165
164
|
onChange(format, newFilters);
|
|
166
|
-
}
|
|
165
|
+
};
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
this.sendCall = (action, data) => {
|
|
169
168
|
const {
|
|
170
169
|
[action]: callback
|
|
171
170
|
} = this.props;
|
|
172
171
|
if (callback) callback(data);
|
|
173
|
-
}
|
|
172
|
+
};
|
|
174
173
|
|
|
175
|
-
|
|
174
|
+
this.setDraggableItems = drag => {
|
|
176
175
|
this.isDraggableItem = true;
|
|
177
176
|
|
|
178
177
|
try {
|
|
@@ -195,7 +194,7 @@ class QueryBuilderImpl extends Component {
|
|
|
195
194
|
} catch (error) {
|
|
196
195
|
this.isDraggableItem = true;
|
|
197
196
|
}
|
|
198
|
-
}
|
|
197
|
+
};
|
|
199
198
|
|
|
200
199
|
this.store = new QueryBuilderStore(props.init, props.format);
|
|
201
200
|
this.state = this.store.getInitialState();
|
|
@@ -106,31 +106,31 @@ class QueryBuilderRow extends Component {
|
|
|
106
106
|
constructor(props) {
|
|
107
107
|
super(props);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
this.handleMouseEnterRow = () => {};
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
this.handleMouseLeaveRow = () => {
|
|
112
112
|
this.handleTooltipRow(false);
|
|
113
|
-
}
|
|
113
|
+
};
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
this.handleMouseEnterInput = () => {
|
|
116
116
|
const {
|
|
117
117
|
setDraggableItems
|
|
118
118
|
} = this.props;
|
|
119
119
|
setDraggableItems(false);
|
|
120
|
-
}
|
|
120
|
+
};
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
this.handleMouseLeaveInput = () => {
|
|
123
123
|
const {
|
|
124
124
|
setDraggableItems
|
|
125
125
|
} = this.props;
|
|
126
126
|
setDraggableItems(true);
|
|
127
|
-
}
|
|
127
|
+
};
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
this.handleTooltipRow = isOpen => {
|
|
130
130
|
this.setState({
|
|
131
131
|
isOpen
|
|
132
132
|
});
|
|
133
|
-
}
|
|
133
|
+
};
|
|
134
134
|
|
|
135
135
|
this.state = {
|
|
136
136
|
isOpen: false
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
1
|
import { sqlFormat } from './sqlFormat.js';
|
|
3
2
|
import { xmlFormat } from './xmlFormat.js';
|
|
4
3
|
import { sqlSafeFormat } from './sqlSafeFormat.js';
|
|
5
4
|
|
|
6
5
|
class QueryBuilderFormat {
|
|
7
6
|
constructor() {
|
|
8
|
-
|
|
7
|
+
this.format = {
|
|
9
8
|
defaultFormat: query => query,
|
|
10
9
|
sqlFormat,
|
|
11
10
|
xmlFormat,
|
|
12
11
|
sqlSafeFormat
|
|
13
|
-
}
|
|
12
|
+
};
|
|
13
|
+
this.currentFormat = 'sqlFormat';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "setDefaultFormat", formatName => {
|
|
15
|
+
this.setDefaultFormat = formatName => {
|
|
18
16
|
if (this.format[formatName]) this.currentFormat = formatName;
|
|
19
|
-
}
|
|
17
|
+
};
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
this.addFormat = (formatName, format) => this.format[formatName] = format;
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
this.run = (query, formatName) => {
|
|
24
22
|
if (this.format[formatName]) return this.format[formatName](query);
|
|
25
23
|
return this.format[this.currentFormat](query);
|
|
26
|
-
}
|
|
24
|
+
};
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
}
|
|
@@ -24,36 +24,30 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
24
24
|
|
|
25
25
|
class QueryBuilderStore {
|
|
26
26
|
constructor(init, _format) {
|
|
27
|
-
|
|
27
|
+
this.items = [];
|
|
28
|
+
this.step = 0;
|
|
29
|
+
this.steps = {};
|
|
30
|
+
this.mapFilters = {};
|
|
31
|
+
this.mapGroups = {};
|
|
32
|
+
this.main = null;
|
|
33
|
+
this.format = null;
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
this.createNewFilter = idGroup => createNewFilter.call(this, idGroup);
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
this.createNewGroup = parentIdGroup => createNewGroup.call(this, parentIdGroup);
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_defineProperty(this, "mapGroups", {});
|
|
36
|
-
|
|
37
|
-
_defineProperty(this, "main", null);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "format", null);
|
|
40
|
-
|
|
41
|
-
_defineProperty(this, "createNewFilter", idGroup => createNewFilter.call(this, idGroup));
|
|
42
|
-
|
|
43
|
-
_defineProperty(this, "createNewGroup", parentIdGroup => createNewGroup.call(this, parentIdGroup));
|
|
44
|
-
|
|
45
|
-
_defineProperty(this, "onOrderDragAndDrop", items => {
|
|
39
|
+
this.onOrderDragAndDrop = items => {
|
|
46
40
|
this.items = items;
|
|
47
41
|
return this.getState();
|
|
48
|
-
}
|
|
42
|
+
};
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
this.addFilterNextToFilterId = (idGroup, idFilter) => {
|
|
51
45
|
// eslint-disable-line
|
|
52
46
|
this.addFilter(idGroup);
|
|
53
47
|
return this.getState();
|
|
54
|
-
}
|
|
48
|
+
};
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
this.addFilter = idGroup => {
|
|
57
51
|
const newFilter = this.createNewFilter(idGroup);
|
|
58
52
|
addFilterToMap.call(this, newFilter); // new API
|
|
59
53
|
|
|
@@ -68,22 +62,22 @@ class QueryBuilderStore {
|
|
|
68
62
|
}
|
|
69
63
|
|
|
70
64
|
return this.getState();
|
|
71
|
-
}
|
|
65
|
+
};
|
|
72
66
|
|
|
73
|
-
|
|
67
|
+
this.onRemoveFilter = idFilter => {
|
|
74
68
|
// new API
|
|
75
69
|
removeFilterItem.call(this, idFilter);
|
|
76
70
|
return this.getState();
|
|
77
|
-
}
|
|
71
|
+
};
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
this.addRuleContainerInPlace = (idGroup, idFilter) => {
|
|
80
74
|
// Create a new group
|
|
81
75
|
const newGroup = this.createNewGroup(idGroup);
|
|
82
76
|
addGroupFilterToItem.call(this, idGroup, idFilter, newGroup);
|
|
83
77
|
return this.getState();
|
|
84
|
-
}
|
|
78
|
+
};
|
|
85
79
|
|
|
86
|
-
|
|
80
|
+
this.addRuleContainer = (idGroup, idFilter) => {
|
|
87
81
|
// eslint-disable-line
|
|
88
82
|
const newGroup = this.createNewGroup(idGroup);
|
|
89
83
|
addGroupToMap.call(this, newGroup);
|
|
@@ -99,33 +93,33 @@ class QueryBuilderStore {
|
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
return this.getState();
|
|
102
|
-
}
|
|
96
|
+
};
|
|
103
97
|
|
|
104
|
-
|
|
98
|
+
this.unGroup = idGroup => {
|
|
105
99
|
unGroupFilterToItem.call(this, idGroup);
|
|
106
100
|
return this.getState();
|
|
107
|
-
}
|
|
101
|
+
};
|
|
108
102
|
|
|
109
|
-
|
|
103
|
+
this.changeGroupOperator = (idGroup, value) => {
|
|
110
104
|
this.getGroupById(idGroup).condition = value;
|
|
111
105
|
changeGroupOperator.call(this, idGroup, value);
|
|
112
106
|
return this.getState();
|
|
113
|
-
}
|
|
107
|
+
};
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
this.changeFilter = data => {
|
|
116
110
|
const {
|
|
117
111
|
idFilter
|
|
118
112
|
} = data;
|
|
119
113
|
this.mapFilters[idFilter] = _objectSpread(_objectSpread({}, this.mapFilters[idFilter]), data);
|
|
120
114
|
changeFilterItem.call(this, data);
|
|
121
115
|
return this.getState();
|
|
122
|
-
}
|
|
116
|
+
};
|
|
123
117
|
|
|
124
|
-
|
|
118
|
+
this.getGroupById = idGroup => this.mapGroups[idGroup] || {};
|
|
125
119
|
|
|
126
|
-
|
|
120
|
+
this.getFilterById = idFilter => this.mapFilters[idFilter];
|
|
127
121
|
|
|
128
|
-
|
|
122
|
+
this.getInitialState = () => {
|
|
129
123
|
const newFilters = {
|
|
130
124
|
step: this.step,
|
|
131
125
|
mapFilters: _objectSpread({}, this.mapFilters),
|
|
@@ -137,9 +131,9 @@ class QueryBuilderStore {
|
|
|
137
131
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
138
132
|
format
|
|
139
133
|
});
|
|
140
|
-
}
|
|
134
|
+
};
|
|
141
135
|
|
|
142
|
-
|
|
136
|
+
this.getState = () => {
|
|
143
137
|
this.step += 1;
|
|
144
138
|
const newFilters = {
|
|
145
139
|
step: this.step,
|
|
@@ -152,7 +146,7 @@ class QueryBuilderStore {
|
|
|
152
146
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
153
147
|
format
|
|
154
148
|
});
|
|
155
|
-
}
|
|
149
|
+
};
|
|
156
150
|
|
|
157
151
|
this.firstLoad = true;
|
|
158
152
|
this.format = _format;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-query-builder",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Query Builder",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -168,17 +168,17 @@
|
|
|
168
168
|
"build": "node ../../scripts/build/build.js"
|
|
169
169
|
},
|
|
170
170
|
"dependencies": {
|
|
171
|
-
"@elliemae/ds-accordion": "2.0.0
|
|
172
|
-
"@elliemae/ds-button": "2.0.0
|
|
173
|
-
"@elliemae/ds-classnames": "2.0.0
|
|
174
|
-
"@elliemae/ds-form": "2.0.0
|
|
175
|
-
"@elliemae/ds-grid": "2.0.0
|
|
176
|
-
"@elliemae/ds-icon": "2.0.0
|
|
177
|
-
"@elliemae/ds-icons": "2.0.0
|
|
178
|
-
"@elliemae/ds-popper": "2.0.0
|
|
179
|
-
"@elliemae/ds-shared": "2.0.0
|
|
180
|
-
"@elliemae/ds-tooltip": "2.0.0
|
|
181
|
-
"@elliemae/ds-utilities": "2.0.0
|
|
171
|
+
"@elliemae/ds-accordion": "2.0.0",
|
|
172
|
+
"@elliemae/ds-button": "2.0.0",
|
|
173
|
+
"@elliemae/ds-classnames": "2.0.0",
|
|
174
|
+
"@elliemae/ds-form": "2.0.0",
|
|
175
|
+
"@elliemae/ds-grid": "2.0.0",
|
|
176
|
+
"@elliemae/ds-icon": "2.0.0",
|
|
177
|
+
"@elliemae/ds-icons": "2.0.0",
|
|
178
|
+
"@elliemae/ds-popper": "2.0.0",
|
|
179
|
+
"@elliemae/ds-shared": "2.0.0",
|
|
180
|
+
"@elliemae/ds-tooltip": "2.0.0",
|
|
181
|
+
"@elliemae/ds-utilities": "2.0.0",
|
|
182
182
|
"classnames": "~2.2.6",
|
|
183
183
|
"prop-types": "~15.7.2",
|
|
184
184
|
"react-addons-update": "~15.6.3",
|