@elliemae/ds-query-builder 2.2.0-alpha.4 → 3.0.0-next.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/DSQueryBuilder.js +97 -117
- package/cjs/components/AndOrController/AndOrController.js +162 -148
- package/cjs/components/ConditionController/ConditionController.js +72 -88
- package/cjs/components/DisplayOutput/DisplayOutput.js +68 -63
- package/cjs/components/DragContainerController/DragContainerController.js +41 -61
- package/cjs/components/DragControllerRow/DragControllerRow.js +46 -50
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +32 -54
- package/cjs/components/Nestable/Nestable.js +209 -143
- package/cjs/components/Nestable/NestableItem.js +90 -98
- package/cjs/components/Nestable/actions/events.js +95 -72
- package/cjs/components/Nestable/actions/getItemOptions.js +15 -36
- package/cjs/components/Nestable/actions/getPaths.js +51 -46
- package/cjs/components/Nestable/actions/index.js +28 -42
- package/cjs/components/Nestable/actions/moveItem.js +42 -44
- package/cjs/components/Nestable/actions/paths.js +55 -48
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +23 -39
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +26 -39
- package/cjs/components/Nestable/index.js +7 -36
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +13 -36
- package/cjs/components/QueryBuilderImpl.js +202 -118
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +78 -80
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +211 -154
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +26 -39
- package/cjs/components/format/format.js +22 -48
- package/cjs/components/format/sqlFormat.js +48 -69
- package/cjs/components/format/sqlSafeFormat.js +55 -72
- package/cjs/components/format/xmlFormat.js +50 -71
- package/cjs/components/helpers/actions.js +186 -151
- package/cjs/components/helpers/constants.js +8 -36
- package/cjs/components/helpers/dependencies.js +64 -49
- package/cjs/components/helpers/selectors.js +101 -161
- package/cjs/components/helpers/store.js +104 -86
- package/cjs/components/helpers/types.js +44 -72
- package/cjs/index.js +29 -36
- package/cjs/propTypes.js +94 -102
- package/esm/DSQueryBuilder.js +72 -103
- package/esm/components/AndOrController/AndOrController.js +147 -113
- package/esm/components/ConditionController/ConditionController.js +62 -57
- package/esm/components/DisplayOutput/DisplayOutput.js +59 -31
- package/esm/components/DragContainerController/DragContainerController.js +35 -32
- package/esm/components/DragControllerRow/DragControllerRow.js +38 -21
- package/esm/components/FieldControllerRow/FieldControllerRow.js +26 -25
- package/esm/components/Nestable/Nestable.js +186 -115
- package/esm/components/Nestable/NestableItem.js +82 -69
- package/esm/components/Nestable/actions/events.js +79 -45
- package/esm/components/Nestable/actions/getItemOptions.js +11 -7
- package/esm/components/Nestable/actions/getPaths.js +43 -17
- package/esm/components/Nestable/actions/index.js +6 -13
- package/esm/components/Nestable/actions/moveItem.js +31 -13
- package/esm/components/Nestable/actions/paths.js +47 -19
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +19 -10
- package/esm/components/Nestable/actions/tryIncreaseDepth.js +22 -10
- package/esm/components/Nestable/index.js +2 -7
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +5 -7
- package/esm/components/QueryBuilderImpl.js +187 -82
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +70 -50
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +201 -123
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +17 -10
- package/esm/components/format/format.js +17 -16
- package/esm/components/format/sqlFormat.js +43 -39
- package/esm/components/format/sqlSafeFormat.js +50 -43
- package/esm/components/format/xmlFormat.js +45 -41
- package/esm/components/helpers/actions.js +160 -123
- package/esm/components/helpers/constants.js +2 -7
- package/esm/components/helpers/dependencies.js +39 -19
- package/esm/components/helpers/selectors.js +93 -132
- package/esm/components/helpers/store.js +82 -54
- package/esm/components/helpers/types.js +33 -44
- package/esm/index.js +4 -7
- package/esm/propTypes.js +72 -55
- package/package.json +12 -12
- package/cjs/DSQueryBuilder.js.map +0 -7
- package/cjs/components/AndOrController/AndOrController.js.map +0 -7
- package/cjs/components/ConditionController/ConditionController.js.map +0 -7
- package/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/cjs/components/DragContainerController/DragContainerController.js.map +0 -7
- package/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/cjs/components/Nestable/Nestable.js.map +0 -7
- package/cjs/components/Nestable/NestableItem.js.map +0 -7
- package/cjs/components/Nestable/actions/events.js.map +0 -7
- package/cjs/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/cjs/components/Nestable/actions/getPaths.js.map +0 -7
- package/cjs/components/Nestable/actions/index.js.map +0 -7
- package/cjs/components/Nestable/actions/moveItem.js.map +0 -7
- package/cjs/components/Nestable/actions/paths.js.map +0 -7
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/cjs/components/Nestable/index.js.map +0 -7
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/cjs/components/QueryBuilderImpl.js.map +0 -7
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/cjs/components/format/format.js.map +0 -7
- package/cjs/components/format/sqlFormat.js.map +0 -7
- package/cjs/components/format/sqlSafeFormat.js.map +0 -7
- package/cjs/components/format/xmlFormat.js.map +0 -7
- package/cjs/components/helpers/actions.js.map +0 -7
- package/cjs/components/helpers/constants.js.map +0 -7
- package/cjs/components/helpers/dependencies.js.map +0 -7
- package/cjs/components/helpers/selectors.js.map +0 -7
- package/cjs/components/helpers/store.js.map +0 -7
- package/cjs/components/helpers/types.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/esm/DSQueryBuilder.js.map +0 -7
- package/esm/components/AndOrController/AndOrController.js.map +0 -7
- package/esm/components/ConditionController/ConditionController.js.map +0 -7
- package/esm/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/esm/components/DragContainerController/DragContainerController.js.map +0 -7
- package/esm/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/esm/components/Nestable/Nestable.js.map +0 -7
- package/esm/components/Nestable/NestableItem.js.map +0 -7
- package/esm/components/Nestable/actions/events.js.map +0 -7
- package/esm/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/esm/components/Nestable/actions/getPaths.js.map +0 -7
- package/esm/components/Nestable/actions/index.js.map +0 -7
- package/esm/components/Nestable/actions/moveItem.js.map +0 -7
- package/esm/components/Nestable/actions/paths.js.map +0 -7
- package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/esm/components/Nestable/index.js.map +0 -7
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/esm/components/QueryBuilderImpl.js.map +0 -7
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/esm/components/format/format.js.map +0 -7
- package/esm/components/format/sqlFormat.js.map +0 -7
- package/esm/components/format/sqlSafeFormat.js.map +0 -7
- package/esm/components/format/xmlFormat.js.map +0 -7
- package/esm/components/helpers/actions.js.map +0 -7
- package/esm/components/helpers/constants.js.map +0 -7
- package/esm/components/helpers/dependencies.js.map +0 -7
- package/esm/components/helpers/selectors.js.map +0 -7
- package/esm/components/helpers/store.js.map +0 -7
- package/esm/components/helpers/types.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var Nestable_exports = {};
|
|
29
|
-
__export(Nestable_exports, {
|
|
30
|
-
default: () => Nestable_default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_Nestable = __toESM(require("./Nestable"));
|
|
34
|
-
var Nestable_default = import_Nestable.default;
|
|
35
|
-
module.exports = __toCommonJS(Nestable_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Nestable = require('./Nestable.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module.exports = Nestable;
|
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var QueryBuilderContext_exports = {};
|
|
29
|
-
__export(QueryBuilderContext_exports, {
|
|
30
|
-
QueryBuilderContext: () => QueryBuilderContext
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
const QueryBuilderContext = import_react.default.createContext({});
|
|
35
|
-
module.exports = __toCommonJS(QueryBuilderContext_exports);
|
|
36
|
-
//# sourceMappingURL=QueryBuilderContext.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
|
|
11
|
+
const QueryBuilderContext = /*#__PURE__*/React__default["default"].createContext({});
|
|
12
|
+
|
|
13
|
+
exports.QueryBuilderContext = QueryBuilderContext;
|
|
@@ -1,158 +1,239 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var import_Nestable = __toESM(require("./Nestable"));
|
|
35
|
-
var import_QueryBuilderContext = require("./QueryBuilderContext/QueryBuilderContext");
|
|
36
|
-
var import_types = require("./helpers/types");
|
|
37
|
-
var import_store = __toESM(require("./helpers/store"));
|
|
38
|
-
var import_AndOrController = __toESM(require("./AndOrController/AndOrController"));
|
|
39
|
-
var import_QueryBuilderItem = __toESM(require("./QueryBuilderItem/QueryBuilderItem"));
|
|
40
|
-
var import_DisplayOutput = __toESM(require("./DisplayOutput/DisplayOutput"));
|
|
41
|
-
class QueryBuilderImpl extends import_react.Component {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
9
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var Nestable = require('./Nestable/Nestable.js');
|
|
13
|
+
var QueryBuilderContext = require('./QueryBuilderContext/QueryBuilderContext.js');
|
|
14
|
+
var types = require('./helpers/types.js');
|
|
15
|
+
var store = require('./helpers/store.js');
|
|
16
|
+
var AndOrController = require('./AndOrController/AndOrController.js');
|
|
17
|
+
var QueryBuilderItem = require('./QueryBuilderItem/QueryBuilderItem.js');
|
|
18
|
+
var DisplayOutput = require('./DisplayOutput/DisplayOutput.js');
|
|
19
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
20
|
+
|
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
+
|
|
23
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
24
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
+
|
|
27
|
+
const _excluded = ["format"];
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
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__default["default"](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; }
|
|
32
|
+
|
|
33
|
+
class QueryBuilderImpl extends React.Component {
|
|
42
34
|
constructor(props) {
|
|
43
35
|
super(props);
|
|
44
36
|
this.isDraggableItem = true;
|
|
37
|
+
|
|
45
38
|
this.onOrderDragAndDrop = (items, item) => {
|
|
46
39
|
const newFilters = this.store.onOrderDragAndDrop(items, item);
|
|
47
|
-
this.sendCall(
|
|
40
|
+
this.sendCall('reOrderOnDragAndDrop', {
|
|
41
|
+
items
|
|
42
|
+
});
|
|
48
43
|
this.sendChange(newFilters);
|
|
49
44
|
};
|
|
50
|
-
|
|
45
|
+
|
|
46
|
+
this.onAddFilterToGroup = idGroup => {
|
|
51
47
|
const newFilters = this.store.addFilter(idGroup);
|
|
52
|
-
this.sendCall(
|
|
48
|
+
this.sendCall('onAddFilterToGroup', {
|
|
49
|
+
idGroup
|
|
50
|
+
});
|
|
53
51
|
this.sendChange(newFilters);
|
|
54
52
|
};
|
|
53
|
+
|
|
55
54
|
this.onAddFilter = (idGroup, idFilter) => {
|
|
56
|
-
const {
|
|
57
|
-
|
|
58
|
-
this.
|
|
55
|
+
const {
|
|
56
|
+
addFilterMethod
|
|
57
|
+
} = this.props;
|
|
58
|
+
const newFilters = addFilterMethod === types.QB_ADD_FILTER_METHOD_TYPES.IN_PLACE ? this.store.addFilterNextToFilterId(idGroup, idFilter) : this.onAddFilterToGroup(idGroup);
|
|
59
|
+
this.sendCall('onAddFilter', {
|
|
60
|
+
idGroup,
|
|
61
|
+
idFilter
|
|
62
|
+
});
|
|
59
63
|
this.sendChange(newFilters);
|
|
60
64
|
};
|
|
65
|
+
|
|
61
66
|
this.onAddRuleContainer = (idGroup, idFilter) => {
|
|
62
|
-
const {
|
|
63
|
-
|
|
64
|
-
this.
|
|
67
|
+
const {
|
|
68
|
+
groupFilterMethod
|
|
69
|
+
} = this.props;
|
|
70
|
+
const newFilters = groupFilterMethod === types.QB_GROUP_FILTER_METHOD_TYPES.IN_PLACE ? this.store.addRuleContainerInPlace(idGroup, idFilter) : this.store.addRuleContainer(idGroup, idFilter);
|
|
71
|
+
this.sendCall('onAddRuleContainer', {
|
|
72
|
+
idGroup,
|
|
73
|
+
idFilter
|
|
74
|
+
});
|
|
65
75
|
this.sendChange(newFilters);
|
|
66
76
|
};
|
|
67
|
-
|
|
77
|
+
|
|
78
|
+
this.onRemoveFilter = idFilter => {
|
|
68
79
|
const newFilters = this.store.onRemoveFilter(idFilter);
|
|
69
|
-
this.sendCall(
|
|
80
|
+
this.sendCall('onRemoveFilter', {
|
|
81
|
+
idFilter
|
|
82
|
+
});
|
|
70
83
|
this.sendChange(newFilters);
|
|
71
84
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
...data,
|
|
85
|
+
|
|
86
|
+
this.handleFieldChange = data => {
|
|
87
|
+
const {
|
|
76
88
|
fieldsSharedActions
|
|
89
|
+
} = this.props;
|
|
90
|
+
const newFilters = this.store.changeFilter(_objectSpread(_objectSpread({}, data), {}, {
|
|
91
|
+
fieldsSharedActions
|
|
92
|
+
}));
|
|
93
|
+
this.sendCall('handleFieldChange', {
|
|
94
|
+
data
|
|
77
95
|
});
|
|
78
|
-
this.sendCall("handleFieldChange", { data });
|
|
79
96
|
this.sendChange(newFilters);
|
|
80
97
|
};
|
|
98
|
+
|
|
81
99
|
this.handleRuleContainerOperator = (idGroup, value) => {
|
|
82
100
|
const newFilters = this.store.changeGroupOperator(idGroup, value);
|
|
83
|
-
this.sendCall(
|
|
101
|
+
this.sendCall('handleRuleContainerOperator', {
|
|
102
|
+
idGroup,
|
|
103
|
+
value
|
|
104
|
+
});
|
|
84
105
|
this.sendChange(newFilters);
|
|
85
106
|
};
|
|
86
|
-
|
|
107
|
+
|
|
108
|
+
this.handleRuleContainerUnGroup = idGroup => {
|
|
87
109
|
const newFilters = this.store.unGroup(idGroup);
|
|
88
|
-
this.sendCall(
|
|
110
|
+
this.sendCall('handleRuleContainerUnGroup', {
|
|
111
|
+
idGroup
|
|
112
|
+
});
|
|
89
113
|
this.sendChange(newFilters);
|
|
90
114
|
};
|
|
115
|
+
|
|
91
116
|
this.handleDropFilter = (filter, dragTo) => {
|
|
92
|
-
const {
|
|
93
|
-
|
|
117
|
+
const {
|
|
118
|
+
position: oldPosition,
|
|
119
|
+
idGroup,
|
|
120
|
+
idFilter
|
|
121
|
+
} = filter;
|
|
122
|
+
const {
|
|
123
|
+
position: newPosition,
|
|
124
|
+
targetIdGroup
|
|
125
|
+
} = dragTo;
|
|
94
126
|
const newFilters = this.store.reOrderFilter(idFilter, idGroup, oldPosition, newPosition, targetIdGroup);
|
|
95
|
-
this.sendCall(
|
|
127
|
+
this.sendCall('handleDropFilter', {
|
|
128
|
+
filter,
|
|
129
|
+
dragTo
|
|
130
|
+
});
|
|
96
131
|
this.sendChange(newFilters);
|
|
97
132
|
};
|
|
133
|
+
|
|
98
134
|
this.handleDropGroup = (group, dragTo) => {
|
|
99
|
-
const {
|
|
100
|
-
|
|
135
|
+
const {
|
|
136
|
+
position: oldPosition,
|
|
137
|
+
idFilter,
|
|
138
|
+
idGroup
|
|
139
|
+
} = group;
|
|
140
|
+
const {
|
|
141
|
+
position: newPosition,
|
|
142
|
+
targetIdGroup
|
|
143
|
+
} = dragTo;
|
|
101
144
|
const newFilters = this.store.reOrderFilter(idFilter, idGroup, oldPosition, newPosition, targetIdGroup);
|
|
102
|
-
this.sendCall(
|
|
145
|
+
this.sendCall('handleDropGroup', {
|
|
146
|
+
group,
|
|
147
|
+
dragTo
|
|
148
|
+
});
|
|
103
149
|
this.sendChange(newFilters);
|
|
104
150
|
};
|
|
151
|
+
|
|
105
152
|
this.handleDrop = (dragElement, dragTo) => {
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
153
|
+
const {
|
|
154
|
+
type
|
|
155
|
+
} = dragElement;
|
|
156
|
+
if (type === types.QB_DRAG_TYPES.FILTER) return this.handleDropFilter(dragElement, dragTo);
|
|
109
157
|
return this.handleDropGroup(dragElement, dragTo);
|
|
110
158
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
159
|
+
|
|
160
|
+
this.sendChange = _ref => {
|
|
161
|
+
let {
|
|
162
|
+
format
|
|
163
|
+
} = _ref,
|
|
164
|
+
newFilters = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
165
|
+
|
|
166
|
+
this.setState(_objectSpread({
|
|
167
|
+
format
|
|
168
|
+
}, newFilters));
|
|
169
|
+
const {
|
|
170
|
+
onChange
|
|
171
|
+
} = this.props;
|
|
114
172
|
onChange(format, newFilters);
|
|
115
173
|
};
|
|
174
|
+
|
|
116
175
|
this.sendCall = (action, data) => {
|
|
117
|
-
const {
|
|
118
|
-
|
|
119
|
-
|
|
176
|
+
const {
|
|
177
|
+
[action]: callback
|
|
178
|
+
} = this.props;
|
|
179
|
+
if (callback) callback(data);
|
|
120
180
|
};
|
|
121
|
-
|
|
181
|
+
|
|
182
|
+
this.setDraggableItems = drag => {
|
|
122
183
|
this.isDraggableItem = true;
|
|
184
|
+
|
|
123
185
|
try {
|
|
124
186
|
const ua = window.navigator.userAgent;
|
|
125
|
-
const msie = ua.indexOf(
|
|
187
|
+
const msie = ua.indexOf('MSIE '); // eslint-disable-next-line no-useless-escape
|
|
188
|
+
|
|
126
189
|
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
|
|
127
|
-
const {
|
|
190
|
+
const {
|
|
191
|
+
isDraggableItem
|
|
192
|
+
} = this.state;
|
|
193
|
+
|
|
128
194
|
if (drag !== isDraggableItem) {
|
|
129
|
-
this.setState({
|
|
195
|
+
this.setState({
|
|
196
|
+
isDraggableItem: drag
|
|
197
|
+
});
|
|
130
198
|
}
|
|
199
|
+
|
|
131
200
|
this.isDraggableItem = drag;
|
|
132
201
|
}
|
|
133
202
|
} catch (error) {
|
|
134
203
|
this.isDraggableItem = true;
|
|
135
204
|
}
|
|
136
205
|
};
|
|
137
|
-
|
|
206
|
+
|
|
207
|
+
this.store = new store(props.init, props.format);
|
|
138
208
|
this.state = this.store.getInitialState();
|
|
139
209
|
}
|
|
210
|
+
|
|
140
211
|
static getDerivedStateFromProps(props, state) {
|
|
141
|
-
if (props.init && props.init.step !==
|
|
142
|
-
const store = new
|
|
143
|
-
QueryBuilderImpl.recalculateStore = store;
|
|
144
|
-
return store.getInitialState();
|
|
212
|
+
if (props.init && props.init.step !== undefined && Number.isInteger(props.init.step) && props.init.step !== state.step) {
|
|
213
|
+
const store$1 = new store(props.init, props.format);
|
|
214
|
+
QueryBuilderImpl.recalculateStore = store$1;
|
|
215
|
+
return store$1.getInitialState();
|
|
145
216
|
}
|
|
217
|
+
|
|
146
218
|
return null;
|
|
147
219
|
}
|
|
220
|
+
|
|
148
221
|
componentDidUpdate() {
|
|
149
222
|
if (QueryBuilderImpl.recalculateStore) {
|
|
150
223
|
this.store = QueryBuilderImpl.recalculateStore;
|
|
151
224
|
QueryBuilderImpl.recalculateStore = null;
|
|
152
225
|
}
|
|
153
226
|
}
|
|
227
|
+
|
|
154
228
|
render() {
|
|
155
|
-
const {
|
|
229
|
+
const {
|
|
230
|
+
mapGroups,
|
|
231
|
+
main,
|
|
232
|
+
mapFilters,
|
|
233
|
+
step,
|
|
234
|
+
items,
|
|
235
|
+
format
|
|
236
|
+
} = this.state;
|
|
156
237
|
const {
|
|
157
238
|
containerProps,
|
|
158
239
|
ruleContainerClassName,
|
|
@@ -162,9 +243,12 @@ class QueryBuilderImpl extends import_react.Component {
|
|
|
162
243
|
displayOutputLabel,
|
|
163
244
|
singleRow,
|
|
164
245
|
toolTipZIndex
|
|
165
|
-
} = this.props;
|
|
166
|
-
|
|
167
|
-
|
|
246
|
+
} = this.props; // const { children } = items[0]
|
|
247
|
+
|
|
248
|
+
const {
|
|
249
|
+
condition
|
|
250
|
+
} = mapGroups[main];
|
|
251
|
+
return /*#__PURE__*/_jsx__default["default"](QueryBuilderContext.QueryBuilderContext.Provider, {
|
|
168
252
|
value: {
|
|
169
253
|
toolTipZIndex,
|
|
170
254
|
fields,
|
|
@@ -187,39 +271,39 @@ class QueryBuilderImpl extends import_react.Component {
|
|
|
187
271
|
setDraggableItems: this.setDraggableItems,
|
|
188
272
|
singleRow
|
|
189
273
|
}
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
singleRow
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}))
|
|
216
|
-
displayFixedOutput,
|
|
274
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
275
|
+
className: "nested-main-group ".concat(condition !== true ? 'is-or-group' : 'is-and-groupL', " ").concat(singleRow ? 'query-main-single-row' : 'query-main-multiple-row'),
|
|
276
|
+
children: [/*#__PURE__*/_jsx__default["default"](Nestable, {
|
|
277
|
+
isAndItem: condition === true,
|
|
278
|
+
isDraggableItem: this.isDraggableItem,
|
|
279
|
+
isOrItem: condition !== true,
|
|
280
|
+
items: items,
|
|
281
|
+
onChange: this.onOrderDragAndDrop,
|
|
282
|
+
renderItem: QueryBuilderItem,
|
|
283
|
+
setDraggableItems: this.setDraggableItems,
|
|
284
|
+
step: step,
|
|
285
|
+
singleRow: singleRow
|
|
286
|
+
}), !singleRow && /*#__PURE__*/_jsx__default["default"]("div", {
|
|
287
|
+
className: "rule-container-options"
|
|
288
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](AndOrController, {
|
|
289
|
+
allowUnGroup: false,
|
|
290
|
+
condition: condition,
|
|
291
|
+
handleRuleContainerOperator: value => this.handleRuleContainerOperator(main, value),
|
|
292
|
+
handleRuleContainerUnGroup: () => this.handleRuleContainerUnGroup(main),
|
|
293
|
+
isMain: true,
|
|
294
|
+
onAddFilter: () => this.onAddFilterToGroup(main),
|
|
295
|
+
showDragController: false,
|
|
296
|
+
step: step,
|
|
297
|
+
toolTipZIndex: toolTipZIndex
|
|
298
|
+
}))]
|
|
299
|
+
})), (displayOutput || displayFixedOutput) && /*#__PURE__*/_jsx__default["default"](DisplayOutput, {
|
|
300
|
+
displayFixedOutput: displayFixedOutput,
|
|
217
301
|
hideLabel: displayOutputLabel.hide,
|
|
218
302
|
showLabel: displayOutputLabel.show,
|
|
219
303
|
show: displayOutputLabel.open
|
|
220
304
|
}));
|
|
221
305
|
}
|
|
306
|
+
|
|
222
307
|
}
|
|
223
|
-
|
|
224
|
-
module.exports =
|
|
225
|
-
//# sourceMappingURL=QueryBuilderImpl.js.map
|
|
308
|
+
|
|
309
|
+
module.exports = QueryBuilderImpl;
|