@elliemae/ds-query-builder 2.0.0-alpha.1 → 2.0.0-alpha.13
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/DSQueryBuilder.js +61 -55
- package/cjs/components/AndOrController/AndOrController.js +44 -52
- package/cjs/components/ConditionController/ConditionController.js +35 -41
- package/cjs/components/DisplayOutput/DisplayOutput.js +38 -24
- package/cjs/components/DragContainerController/DragContainerController.js +16 -18
- package/cjs/components/DragControllerRow/DragControllerRow.js +12 -8
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +22 -22
- package/cjs/components/Nestable/Nestable.js +54 -40
- package/cjs/components/Nestable/NestableItem.js +24 -16
- package/cjs/components/Nestable/actions/events.js +7 -2
- package/cjs/components/Nestable/actions/getPaths.js +11 -1
- package/cjs/components/Nestable/actions/moveItem.js +15 -8
- package/cjs/components/Nestable/actions/paths.js +15 -3
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +1 -1
- package/cjs/components/QueryBuilderImpl.js +44 -38
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +30 -22
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +64 -49
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +7 -2
- package/cjs/components/format/format.js +8 -14
- package/cjs/components/format/sqlFormat.js +25 -23
- package/cjs/components/format/sqlSafeFormat.js +27 -25
- package/cjs/components/format/xmlFormat.js +25 -23
- package/cjs/components/helpers/actions.js +62 -37
- package/cjs/components/helpers/dependencies.js +19 -12
- package/cjs/components/helpers/store.js +39 -40
- package/cjs/index.js +2 -1
- package/cjs/propTypes.js +1 -0
- package/esm/DSQueryBuilder.js +60 -55
- package/esm/components/AndOrController/AndOrController.js +21 -24
- package/esm/components/ConditionController/ConditionController.js +21 -23
- package/esm/components/DisplayOutput/DisplayOutput.js +32 -15
- package/esm/components/DragContainerController/DragContainerController.js +11 -11
- package/esm/components/DragControllerRow/DragControllerRow.js +7 -2
- package/esm/components/FieldControllerRow/FieldControllerRow.js +22 -20
- package/esm/components/Nestable/Nestable.js +46 -32
- package/esm/components/Nestable/NestableItem.js +21 -13
- package/esm/components/Nestable/actions/events.js +6 -1
- package/esm/components/Nestable/actions/getPaths.js +11 -1
- package/esm/components/Nestable/actions/moveItem.js +12 -5
- package/esm/components/Nestable/actions/paths.js +15 -3
- package/esm/components/QueryBuilderImpl.js +38 -32
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +28 -20
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +54 -38
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +5 -0
- package/esm/components/format/format.js +8 -10
- package/esm/components/format/sqlFormat.js +25 -23
- package/esm/components/format/sqlSafeFormat.js +27 -25
- package/esm/components/format/xmlFormat.js +25 -23
- package/esm/components/helpers/actions.js +61 -36
- package/esm/components/helpers/dependencies.js +17 -8
- package/esm/components/helpers/store.js +38 -39
- package/esm/index.js +1 -1
- package/esm/propTypes.js +1 -0
- package/package.json +14 -7
- package/types/DSQueryBuilder.d.ts +172 -25
- package/types/components/AndOrController/AndOrController.d.ts +4 -4
- package/types/components/ConditionController/ConditionController.d.ts +2 -2
- package/types/components/DragContainerController/DragContainerController.d.ts +3 -3
- package/types/components/DragControllerRow/DragControllerRow.d.ts +2 -2
- package/types/propTypes.d.ts +133 -22
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
|
-
import DSComboBox from '@elliemae/ds-
|
|
4
|
-
import DSTextBox from '@elliemae/ds-basic/form/TextBox';
|
|
3
|
+
import { DSComboBox, DSTextBox } from '@elliemae/ds-form';
|
|
5
4
|
|
|
6
|
-
const FieldControllerRow =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
const FieldControllerRow = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
className = '',
|
|
8
|
+
onChange = () => null,
|
|
9
|
+
options = [],
|
|
10
|
+
value = '',
|
|
11
|
+
type = 'DSComboBox'
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/_jsx("div", {
|
|
14
|
+
className: className
|
|
15
|
+
}, void 0, type === 'DSComboBox' && /*#__PURE__*/_jsx(DSComboBox, {
|
|
16
|
+
onChange: onChange,
|
|
17
|
+
options: options,
|
|
18
|
+
value: value
|
|
19
|
+
}), type === 'DSTextBox' && /*#__PURE__*/_jsx(DSTextBox, {
|
|
20
|
+
fluidWidth: true,
|
|
21
|
+
onChange: onChange,
|
|
22
|
+
options: options,
|
|
23
|
+
value: value
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
24
26
|
|
|
25
27
|
export { FieldControllerRow as default };
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
5
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
12
|
import { Component } from 'react';
|
|
4
13
|
import cn from 'classnames';
|
|
5
14
|
import { listWithChildren } from '@elliemae/ds-shared/utils';
|
|
6
|
-
import { isEqualWith } from '@elliemae/ds-utilities
|
|
15
|
+
import { isEqualWith } from '@elliemae/ds-utilities';
|
|
7
16
|
import { tryIncreaseDepth } from './actions/tryIncreaseDepth.js';
|
|
8
17
|
import { tryDecreaseDepth } from './actions/tryDecreaseDepth.js';
|
|
9
18
|
import { moveItem } from './actions/moveItem.js';
|
|
@@ -22,43 +31,43 @@ class Nestable extends Component {
|
|
|
22
31
|
constructor(props) {
|
|
23
32
|
super(props);
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
this.onDragStart = (e, item) => {
|
|
26
35
|
onDragStart.call(this, e, item);
|
|
27
|
-
}
|
|
36
|
+
};
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
this.onDragEnd = (e, isCancel) => onDragEnd.call(this, e, isCancel);
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
this.onMouseMove = e => onMouseMove.call(this, e);
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
this.onMouseEnter = (e, item) => onMouseEnter.call(this, e, item);
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
this.onToggleCollapse = (item, isGetter) => onToggleCollapse.call(this, item, isGetter);
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
this.onKeyDown = e => onKeyDown.call(this, e);
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
this.getDefaultItems = () => {
|
|
40
49
|
const {
|
|
41
50
|
items
|
|
42
51
|
} = this.state;
|
|
43
52
|
return items;
|
|
44
|
-
}
|
|
53
|
+
};
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
this.getItemDepth = item => getItemDepth.call(this, item);
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
this.startTrackMouse = () => {
|
|
49
58
|
document.addEventListener('mousemove', this.onMouseMove);
|
|
50
59
|
document.addEventListener('mouseup', this.onDragEnd);
|
|
51
60
|
document.addEventListener('keydown', this.onKeyDown);
|
|
52
|
-
}
|
|
61
|
+
};
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
this.stopTrackMouse = () => {
|
|
55
64
|
document.removeEventListener('mousemove', this.onMouseMove);
|
|
56
65
|
document.removeEventListener('mouseup', this.onDragEnd);
|
|
57
66
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
58
67
|
this.elCopyStyles = null;
|
|
59
|
-
}
|
|
68
|
+
};
|
|
60
69
|
|
|
61
|
-
|
|
70
|
+
this.isCollapsed = item => {
|
|
62
71
|
const {
|
|
63
72
|
collapsed
|
|
64
73
|
} = this.props;
|
|
@@ -66,9 +75,9 @@ class Nestable extends Component {
|
|
|
66
75
|
collapsedGroups
|
|
67
76
|
} = this.state;
|
|
68
77
|
return !!(collapsedGroups.indexOf(item.id) > -1 ^ collapsed);
|
|
69
|
-
}
|
|
78
|
+
};
|
|
70
79
|
|
|
71
|
-
|
|
80
|
+
this.checkFilterChildren = items => items.find(current => {
|
|
72
81
|
const {
|
|
73
82
|
element: {
|
|
74
83
|
type
|
|
@@ -77,9 +86,9 @@ class Nestable extends Component {
|
|
|
77
86
|
} = current;
|
|
78
87
|
if (type === 'filter' && children.length > 0) return true;
|
|
79
88
|
return this.checkFilterChildren(children);
|
|
80
|
-
})
|
|
89
|
+
});
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
this.dragRevert = () => {
|
|
83
92
|
const {
|
|
84
93
|
itemsOld
|
|
85
94
|
} = this.state;
|
|
@@ -89,7 +98,7 @@ class Nestable extends Component {
|
|
|
89
98
|
dragItem: null,
|
|
90
99
|
isDirty: false
|
|
91
100
|
});
|
|
92
|
-
}
|
|
101
|
+
};
|
|
93
102
|
|
|
94
103
|
this.state = {
|
|
95
104
|
items: [],
|
|
@@ -162,15 +171,18 @@ class Nestable extends Component {
|
|
|
162
171
|
return null;
|
|
163
172
|
}
|
|
164
173
|
|
|
165
|
-
getPathById(id
|
|
174
|
+
getPathById(id) {
|
|
175
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
166
176
|
return getPathById.call(this, id, items);
|
|
167
177
|
}
|
|
168
178
|
|
|
169
|
-
getItemByPath(path
|
|
179
|
+
getItemByPath(path) {
|
|
180
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
170
181
|
return getItemByPath.call(this, path, items);
|
|
171
182
|
}
|
|
172
183
|
|
|
173
|
-
getSplicePath(path
|
|
184
|
+
getSplicePath(path) {
|
|
185
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
174
186
|
return getSplicePath.call(this, path, options);
|
|
175
187
|
}
|
|
176
188
|
|
|
@@ -207,11 +219,13 @@ class Nestable extends Component {
|
|
|
207
219
|
tryDecreaseDepth.call(this, dragItem);
|
|
208
220
|
}
|
|
209
221
|
|
|
210
|
-
moveItem({
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
222
|
+
moveItem(_ref) {
|
|
223
|
+
let {
|
|
224
|
+
dragItem,
|
|
225
|
+
pathFrom,
|
|
226
|
+
pathTo
|
|
227
|
+
} = _ref;
|
|
228
|
+
let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
215
229
|
moveItem.call(this, {
|
|
216
230
|
dragItem,
|
|
217
231
|
pathFrom,
|
|
@@ -226,7 +240,7 @@ class Nestable extends Component {
|
|
|
226
240
|
const {
|
|
227
241
|
dragItem
|
|
228
242
|
} = this.state;
|
|
229
|
-
const el = document.querySelector(
|
|
243
|
+
const el = document.querySelector(".nestable-".concat(group, " .nestable-item-").concat(dragItem.id));
|
|
230
244
|
let listStyles = {};
|
|
231
245
|
|
|
232
246
|
if (el) {
|
|
@@ -268,11 +282,11 @@ class Nestable extends Component {
|
|
|
268
282
|
let childClass = 'single';
|
|
269
283
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
270
284
|
return /*#__PURE__*/_jsx("div", {
|
|
271
|
-
className: cn('nestable',
|
|
285
|
+
className: cn('nestable', "nestable-".concat(group), {
|
|
272
286
|
'is-drag-active': dragItem
|
|
273
287
|
})
|
|
274
288
|
}, void 0, /*#__PURE__*/_jsx("ol", {
|
|
275
|
-
className:
|
|
289
|
+
className: "nestable-list nestable-group nestable-child-count-".concat(childClass)
|
|
276
290
|
}, void 0, items.map((item, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
277
291
|
index: i,
|
|
278
292
|
isAndItem: isAndItem,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
10
|
import 'react';
|
|
4
11
|
import cn from 'classnames';
|
|
5
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -8,16 +15,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
15
|
|
|
9
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
17
|
|
|
11
|
-
const NestableItem =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const NestableItem = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
item,
|
|
21
|
+
isCopy,
|
|
22
|
+
options,
|
|
23
|
+
index,
|
|
24
|
+
isAndItem,
|
|
25
|
+
isOrItem,
|
|
26
|
+
isDraggableItem,
|
|
27
|
+
singleRow
|
|
28
|
+
} = _ref;
|
|
21
29
|
const {
|
|
22
30
|
dragItem,
|
|
23
31
|
renderItem,
|
|
@@ -31,7 +39,7 @@ const NestableItem = ({
|
|
|
31
39
|
const isOrGroup = item.element.type === 'group' && (item.element.condition === '' || item.element.condition === false);
|
|
32
40
|
const isAndGroup = item.element.type === 'group' && !(item.element.condition === '' || item.element.condition === false);
|
|
33
41
|
const itemProps = {
|
|
34
|
-
className: cn(
|
|
42
|
+
className: cn("nestable-item".concat(isCopy ? '-copy' : ''), "nestable-item".concat(isCopy ? '-copy' : '', "-").concat(item.id), "nestable-item-type-".concat(item.element.type), {
|
|
35
43
|
'is-or-group': isOrGroup,
|
|
36
44
|
'is-and-group': isAndGroup,
|
|
37
45
|
'is-and-filter': item.element.type === 'filter' && isAndItem,
|
|
@@ -71,7 +79,7 @@ const NestableItem = ({
|
|
|
71
79
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
72
80
|
return /*#__PURE__*/jsxs("li", _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
73
81
|
children: [/*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
74
|
-
className:
|
|
82
|
+
className: "nestable-item-name nestable-item-name--".concat(item.element.type, " ")
|
|
75
83
|
}, rowProps), {}, {
|
|
76
84
|
children: renderItem({
|
|
77
85
|
item,
|
|
@@ -79,7 +87,7 @@ const NestableItem = ({
|
|
|
79
87
|
index
|
|
80
88
|
})
|
|
81
89
|
})), hasChildren && item.element.type === 'group' && !isCollapsed && /*#__PURE__*/_jsx("ol", {
|
|
82
|
-
className:
|
|
90
|
+
className: "nestable-list nestable-child-count-".concat(childClass, " ")
|
|
83
91
|
}, void 0, item[childrenProp].map((currentitem, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
84
92
|
index: i,
|
|
85
93
|
isAndItem: isAndGroup,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
2
7
|
import { closest, getTransformProps, getOffsetRect, getTotalScroll } from '@elliemae/ds-shared/utils';
|
|
3
8
|
|
|
4
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -46,7 +51,7 @@ function onMouseMove(e) {
|
|
|
46
51
|
clientY
|
|
47
52
|
} = e;
|
|
48
53
|
const transformProps = getTransformProps(clientX, clientY);
|
|
49
|
-
const elCopy = document.querySelector(
|
|
54
|
+
const elCopy = document.querySelector(".nestable-".concat(group, " .nestable-drag-layer > .nestable-list"));
|
|
50
55
|
|
|
51
56
|
if (!this.elCopyStyles) {
|
|
52
57
|
const offset = getOffsetRect(this.el);
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.every.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.every.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
|
|
1
10
|
function getRealNextPath(prevPath, nextPath) {
|
|
2
11
|
const {
|
|
3
12
|
childrenProp
|
|
@@ -83,7 +92,8 @@ function getItemDepth(item) {
|
|
|
83
92
|
|
|
84
93
|
return level;
|
|
85
94
|
}
|
|
86
|
-
function getSplicePath(path
|
|
95
|
+
function getSplicePath(path) {
|
|
96
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
87
97
|
const splicePath = {};
|
|
88
98
|
const numToRemove = options.numToRemove || 0;
|
|
89
99
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import update from 'react-addons-update';
|
|
3
8
|
|
|
4
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5
10
|
|
|
6
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
|
-
function moveItem({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
function moveItem(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
dragItem,
|
|
15
|
+
pathFrom,
|
|
16
|
+
pathTo
|
|
17
|
+
} = _ref;
|
|
18
|
+
let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12
19
|
const {
|
|
13
20
|
childrenProp
|
|
14
21
|
} = this.props;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.every.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.every.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
|
|
1
10
|
function getRealNextPath(prevPath, nextPath) {
|
|
2
11
|
const {
|
|
3
12
|
childrenProp
|
|
@@ -39,7 +48,8 @@ function getRealNextPath(prevPath, nextPath) {
|
|
|
39
48
|
|
|
40
49
|
return nextPath;
|
|
41
50
|
}
|
|
42
|
-
function getPathById(id
|
|
51
|
+
function getPathById(id) {
|
|
52
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
43
53
|
const {
|
|
44
54
|
childrenProp
|
|
45
55
|
} = this.props;
|
|
@@ -59,7 +69,8 @@ function getPathById(id, items = this.getDefaultItems()) {
|
|
|
59
69
|
});
|
|
60
70
|
return path;
|
|
61
71
|
}
|
|
62
|
-
function getItemByPath(path
|
|
72
|
+
function getItemByPath(path) {
|
|
73
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
63
74
|
const {
|
|
64
75
|
childrenProp
|
|
65
76
|
} = this.props;
|
|
@@ -83,7 +94,8 @@ function getItemDepth(item) {
|
|
|
83
94
|
|
|
84
95
|
return level;
|
|
85
96
|
}
|
|
86
|
-
function getSplicePath(path
|
|
97
|
+
function getSplicePath(path) {
|
|
98
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
87
99
|
const splicePath = {};
|
|
88
100
|
const numToRemove = options.numToRemove || 0;
|
|
89
101
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
@@ -20,26 +25,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
25
|
class QueryBuilderImpl extends Component {
|
|
21
26
|
constructor(props) {
|
|
22
27
|
super(props);
|
|
28
|
+
this.isDraggableItem = true;
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_defineProperty(this, "onOrderDragAndDrop", (items, item) => {
|
|
30
|
+
this.onOrderDragAndDrop = (items, item) => {
|
|
27
31
|
const newFilters = this.store.onOrderDragAndDrop(items, item);
|
|
28
32
|
this.sendCall('reOrderOnDragAndDrop', {
|
|
29
33
|
items
|
|
30
34
|
});
|
|
31
35
|
this.sendChange(newFilters);
|
|
32
|
-
}
|
|
36
|
+
};
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
this.onAddFilterToGroup = idGroup => {
|
|
35
39
|
const newFilters = this.store.addFilter(idGroup);
|
|
36
40
|
this.sendCall('onAddFilterToGroup', {
|
|
37
41
|
idGroup
|
|
38
42
|
});
|
|
39
43
|
this.sendChange(newFilters);
|
|
40
|
-
}
|
|
44
|
+
};
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
this.onAddFilter = (idGroup, idFilter) => {
|
|
43
47
|
const {
|
|
44
48
|
addFilterMethod
|
|
45
49
|
} = this.props;
|
|
@@ -49,9 +53,9 @@ class QueryBuilderImpl extends Component {
|
|
|
49
53
|
idFilter
|
|
50
54
|
});
|
|
51
55
|
this.sendChange(newFilters);
|
|
52
|
-
}
|
|
56
|
+
};
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
this.onAddRuleContainer = (idGroup, idFilter) => {
|
|
55
59
|
const {
|
|
56
60
|
groupFilterMethod
|
|
57
61
|
} = this.props;
|
|
@@ -61,17 +65,17 @@ class QueryBuilderImpl extends Component {
|
|
|
61
65
|
idFilter
|
|
62
66
|
});
|
|
63
67
|
this.sendChange(newFilters);
|
|
64
|
-
}
|
|
68
|
+
};
|
|
65
69
|
|
|
66
|
-
|
|
70
|
+
this.onRemoveFilter = idFilter => {
|
|
67
71
|
const newFilters = this.store.onRemoveFilter(idFilter);
|
|
68
72
|
this.sendCall('onRemoveFilter', {
|
|
69
73
|
idFilter
|
|
70
74
|
});
|
|
71
75
|
this.sendChange(newFilters);
|
|
72
|
-
}
|
|
76
|
+
};
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
this.handleFieldChange = data => {
|
|
75
79
|
const {
|
|
76
80
|
fieldsSharedActions
|
|
77
81
|
} = this.props;
|
|
@@ -82,26 +86,26 @@ class QueryBuilderImpl extends Component {
|
|
|
82
86
|
data
|
|
83
87
|
});
|
|
84
88
|
this.sendChange(newFilters);
|
|
85
|
-
}
|
|
89
|
+
};
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
this.handleRuleContainerOperator = (idGroup, value) => {
|
|
88
92
|
const newFilters = this.store.changeGroupOperator(idGroup, value);
|
|
89
93
|
this.sendCall('handleRuleContainerOperator', {
|
|
90
94
|
idGroup,
|
|
91
95
|
value
|
|
92
96
|
});
|
|
93
97
|
this.sendChange(newFilters);
|
|
94
|
-
}
|
|
98
|
+
};
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
this.handleRuleContainerUnGroup = idGroup => {
|
|
97
101
|
const newFilters = this.store.unGroup(idGroup);
|
|
98
102
|
this.sendCall('handleRuleContainerUnGroup', {
|
|
99
103
|
idGroup
|
|
100
104
|
});
|
|
101
105
|
this.sendChange(newFilters);
|
|
102
|
-
}
|
|
106
|
+
};
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
this.handleDropFilter = (filter, dragTo) => {
|
|
105
109
|
const {
|
|
106
110
|
position: oldPosition,
|
|
107
111
|
idGroup,
|
|
@@ -117,9 +121,9 @@ class QueryBuilderImpl extends Component {
|
|
|
117
121
|
dragTo
|
|
118
122
|
});
|
|
119
123
|
this.sendChange(newFilters);
|
|
120
|
-
}
|
|
124
|
+
};
|
|
121
125
|
|
|
122
|
-
|
|
126
|
+
this.handleDropGroup = (group, dragTo) => {
|
|
123
127
|
const {
|
|
124
128
|
position: oldPosition,
|
|
125
129
|
idFilter,
|
|
@@ -135,17 +139,17 @@ class QueryBuilderImpl extends Component {
|
|
|
135
139
|
dragTo
|
|
136
140
|
});
|
|
137
141
|
this.sendChange(newFilters);
|
|
138
|
-
}
|
|
142
|
+
};
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
this.handleDrop = (dragElement, dragTo) => {
|
|
141
145
|
const {
|
|
142
146
|
type
|
|
143
147
|
} = dragElement;
|
|
144
148
|
if (type === QB_DRAG_TYPES.FILTER) return this.handleDropFilter(dragElement, dragTo);
|
|
145
149
|
return this.handleDropGroup(dragElement, dragTo);
|
|
146
|
-
}
|
|
150
|
+
};
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
this.sendChange = _ref => {
|
|
149
153
|
let {
|
|
150
154
|
format
|
|
151
155
|
} = _ref,
|
|
@@ -158,16 +162,16 @@ class QueryBuilderImpl extends Component {
|
|
|
158
162
|
onChange
|
|
159
163
|
} = this.props;
|
|
160
164
|
onChange(format, newFilters);
|
|
161
|
-
}
|
|
165
|
+
};
|
|
162
166
|
|
|
163
|
-
|
|
167
|
+
this.sendCall = (action, data) => {
|
|
164
168
|
const {
|
|
165
169
|
[action]: callback
|
|
166
170
|
} = this.props;
|
|
167
171
|
if (callback) callback(data);
|
|
168
|
-
}
|
|
172
|
+
};
|
|
169
173
|
|
|
170
|
-
|
|
174
|
+
this.setDraggableItems = drag => {
|
|
171
175
|
this.isDraggableItem = true;
|
|
172
176
|
|
|
173
177
|
try {
|
|
@@ -190,7 +194,7 @@ class QueryBuilderImpl extends Component {
|
|
|
190
194
|
} catch (error) {
|
|
191
195
|
this.isDraggableItem = true;
|
|
192
196
|
}
|
|
193
|
-
}
|
|
197
|
+
};
|
|
194
198
|
|
|
195
199
|
this.store = new QueryBuilderStore(props.init, props.format);
|
|
196
200
|
this.state = this.store.getInitialState();
|
|
@@ -226,6 +230,7 @@ class QueryBuilderImpl extends Component {
|
|
|
226
230
|
containerProps,
|
|
227
231
|
ruleContainerClassName,
|
|
228
232
|
fields,
|
|
233
|
+
displayFixedOutput,
|
|
229
234
|
displayOutput,
|
|
230
235
|
displayOutputLabel,
|
|
231
236
|
singleRow,
|
|
@@ -259,7 +264,7 @@ class QueryBuilderImpl extends Component {
|
|
|
259
264
|
singleRow
|
|
260
265
|
}
|
|
261
266
|
}, void 0, /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
262
|
-
className:
|
|
267
|
+
className: "nested-main-group ".concat(condition !== true ? 'is-or-group' : 'is-and-groupL', " ").concat(singleRow ? 'query-main-single-row' : 'query-main-multiple-row'),
|
|
263
268
|
children: [/*#__PURE__*/_jsx(Nestable, {
|
|
264
269
|
isAndItem: condition === true,
|
|
265
270
|
isDraggableItem: this.isDraggableItem,
|
|
@@ -283,7 +288,8 @@ class QueryBuilderImpl extends Component {
|
|
|
283
288
|
step: step,
|
|
284
289
|
toolTipZIndex: toolTipZIndex
|
|
285
290
|
}))]
|
|
286
|
-
})), displayOutput && /*#__PURE__*/_jsx(DisplayOutput, {
|
|
291
|
+
})), (displayOutput || displayFixedOutput) && /*#__PURE__*/_jsx(DisplayOutput, {
|
|
292
|
+
displayFixedOutput: displayFixedOutput,
|
|
287
293
|
hideLabel: displayOutputLabel.hide,
|
|
288
294
|
showLabel: displayOutputLabel.show,
|
|
289
295
|
show: displayOutputLabel.open
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import 'react';
|
|
@@ -11,9 +16,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
11
16
|
|
|
12
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
18
|
|
|
14
|
-
const QueryBuilderItem =
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
const QueryBuilderItem = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
item
|
|
22
|
+
} = _ref;
|
|
17
23
|
const {
|
|
18
24
|
element
|
|
19
25
|
} = item;
|
|
@@ -23,23 +29,25 @@ const QueryBuilderItem = ({
|
|
|
23
29
|
idGroup,
|
|
24
30
|
condition
|
|
25
31
|
} = element;
|
|
26
|
-
return /*#__PURE__*/_jsx(QueryBuilderContext.Consumer, {}, void 0,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
return /*#__PURE__*/_jsx(QueryBuilderContext.Consumer, {}, void 0, _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
fields,
|
|
35
|
+
handleFieldChange,
|
|
36
|
+
onAddFilter,
|
|
37
|
+
onAddFilterToGroup,
|
|
38
|
+
onAddRuleContainer,
|
|
39
|
+
onRemoveFilter,
|
|
40
|
+
showDragController,
|
|
41
|
+
handleRuleContainerOperator,
|
|
42
|
+
handleRuleContainerUnGroup,
|
|
43
|
+
step,
|
|
44
|
+
items,
|
|
45
|
+
isDraggableItem,
|
|
46
|
+
setDraggableItems,
|
|
47
|
+
singleRow,
|
|
48
|
+
toolTipZIndex
|
|
49
|
+
} = _ref2;
|
|
50
|
+
|
|
43
51
|
if (type === QB_DRAG_TYPES.FILTER) {
|
|
44
52
|
return /*#__PURE__*/jsx(QueryBuilderRow, _objectSpread(_objectSpread({}, element), {}, {
|
|
45
53
|
fields: fields,
|