@elliemae/ds-query-builder 2.0.0-rc.9 → 2.0.2
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/DragControllerRow/DragControllerRow.js +2 -2
- package/cjs/components/Nestable/Nestable.js +22 -22
- package/cjs/components/Nestable/NestableItem.js +2 -2
- package/cjs/components/Nestable/actions/events.js +2 -2
- package/cjs/components/Nestable/actions/moveItem.js +2 -2
- package/cjs/components/QueryBuilderImpl.js +31 -32
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +2 -2
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +11 -11
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +2 -2
- package/cjs/components/format/format.js +8 -14
- package/cjs/components/helpers/actions.js +2 -2
- package/cjs/components/helpers/store.js +35 -41
- package/esm/components/AndOrController/AndOrController.js +10 -11
- package/esm/components/DisplayOutput/DisplayOutput.js +2 -3
- package/esm/components/DragControllerRow/DragControllerRow.js +2 -2
- package/esm/components/Nestable/Nestable.js +22 -22
- package/esm/components/Nestable/NestableItem.js +2 -2
- package/esm/components/Nestable/actions/events.js +2 -2
- package/esm/components/Nestable/actions/moveItem.js +2 -2
- package/esm/components/QueryBuilderImpl.js +31 -32
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +2 -2
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +11 -11
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +2 -2
- package/esm/components/format/format.js +8 -10
- package/esm/components/helpers/actions.js +2 -2
- package/esm/components/helpers/store.js +35 -41
- package/package.json +12 -12
|
@@ -17,9 +17,9 @@ import ConditionController from '../ConditionController/ConditionController.js';
|
|
|
17
17
|
import DragControllerRow from '../DragControllerRow/DragControllerRow.js';
|
|
18
18
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
19
19
|
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
23
|
|
|
24
24
|
const RenderField = _ref => {
|
|
25
25
|
let {
|
|
@@ -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
|
|
@@ -7,9 +7,9 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
|
7
7
|
import { createElement } from 'react';
|
|
8
8
|
import GrowRight from '@elliemae/ds-shared/Animations/GrowRight';
|
|
9
9
|
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
|
|
14
14
|
const ToolBarAnimation = props => /*#__PURE__*/createElement(GrowRight, _objectSpread(_objectSpread({}, props), {}, {
|
|
15
15
|
key: "popper-animation-key",
|
|
@@ -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
|
}
|
|
@@ -10,9 +10,9 @@ import 'core-js/modules/esnext.async-iterator.map.js';
|
|
|
10
10
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
11
11
|
import { QB_DRAG_TYPES, QB_GROUP_CONDITION_TYPES, QB_FIELD_SHARED_ACTIONS } from './types.js';
|
|
12
12
|
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
14
|
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
16
|
/**
|
|
17
17
|
* this is injected. instance of QBStore
|
|
18
18
|
*
|
|
@@ -7,9 +7,9 @@ import 'core-js/modules/esnext.iterator.for-each.js';
|
|
|
7
7
|
import { createNewFilter, createNewGroup, addFilterToMap, addFilterToMainItem, findItemFilterById, addFilterToItem, removeFilterItem, addGroupFilterToItem, addGroupToMap, unGroupFilterToItem, changeGroupOperator, changeFilterItem } from './actions.js';
|
|
8
8
|
import QueryBuilderFormat from '../format/format.js';
|
|
9
9
|
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
/**
|
|
14
14
|
* Fluent interface: https://en.wikipedia.org/wiki/Fluent_interface
|
|
15
15
|
*
|
|
@@ -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.
|
|
3
|
+
"version": "2.0.2",
|
|
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.
|
|
172
|
-
"@elliemae/ds-button": "2.0.
|
|
173
|
-
"@elliemae/ds-classnames": "2.0.
|
|
174
|
-
"@elliemae/ds-form": "2.0.
|
|
175
|
-
"@elliemae/ds-grid": "2.0.
|
|
176
|
-
"@elliemae/ds-icon": "2.0.
|
|
177
|
-
"@elliemae/ds-icons": "2.0.
|
|
178
|
-
"@elliemae/ds-popper": "2.0.
|
|
179
|
-
"@elliemae/ds-shared": "2.0.
|
|
180
|
-
"@elliemae/ds-tooltip": "2.0.
|
|
181
|
-
"@elliemae/ds-utilities": "2.0.
|
|
171
|
+
"@elliemae/ds-accordion": "2.0.2",
|
|
172
|
+
"@elliemae/ds-button": "2.0.2",
|
|
173
|
+
"@elliemae/ds-classnames": "2.0.2",
|
|
174
|
+
"@elliemae/ds-form": "2.0.2",
|
|
175
|
+
"@elliemae/ds-grid": "2.0.2",
|
|
176
|
+
"@elliemae/ds-icon": "2.0.2",
|
|
177
|
+
"@elliemae/ds-icons": "2.0.2",
|
|
178
|
+
"@elliemae/ds-popper": "2.0.2",
|
|
179
|
+
"@elliemae/ds-shared": "2.0.2",
|
|
180
|
+
"@elliemae/ds-tooltip": "2.0.2",
|
|
181
|
+
"@elliemae/ds-utilities": "2.0.2",
|
|
182
182
|
"classnames": "~2.2.6",
|
|
183
183
|
"prop-types": "~15.7.2",
|
|
184
184
|
"react-addons-update": "~15.6.3",
|