@elliemae/ds-query-builder 1.60.0 → 2.0.0-alpha.12
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 +58 -151
- package/cjs/components/AndOrController/AndOrController.js +126 -162
- package/cjs/components/ConditionController/ConditionController.js +40 -60
- package/cjs/components/DisplayOutput/DisplayOutput.js +62 -83
- package/cjs/components/DragContainerController/DragContainerController.js +20 -21
- package/cjs/components/DragControllerRow/DragControllerRow.js +33 -23
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +14 -19
- package/cjs/components/Nestable/Nestable.js +243 -283
- package/cjs/components/Nestable/NestableItem.js +61 -52
- package/cjs/components/Nestable/actions/events.js +53 -35
- package/cjs/components/Nestable/actions/getItemOptions.js +14 -12
- package/cjs/components/Nestable/actions/getPaths.js +46 -38
- package/cjs/components/Nestable/actions/index.js +21 -26
- package/cjs/components/Nestable/actions/moveItem.js +26 -16
- package/cjs/components/Nestable/actions/paths.js +48 -40
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +12 -12
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +14 -14
- package/cjs/components/Nestable/index.js +2 -25
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +1 -2
- package/cjs/components/QueryBuilderImpl.js +216 -283
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +59 -77
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +154 -174
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +16 -11
- package/cjs/components/format/format.js +27 -39
- package/cjs/components/format/sqlFormat.js +35 -32
- package/cjs/components/format/sqlSafeFormat.js +38 -35
- package/cjs/components/format/xmlFormat.js +35 -32
- package/cjs/components/helpers/actions.js +108 -93
- package/cjs/components/helpers/constants.js +3 -4
- package/cjs/components/helpers/dependencies.js +36 -26
- package/cjs/components/helpers/selectors.js +18 -19
- package/cjs/components/helpers/store.js +87 -109
- package/cjs/components/helpers/types.js +9 -10
- package/cjs/index.js +19 -76
- package/cjs/propTypes.js +4 -5
- package/esm/DSQueryBuilder.js +37 -130
- package/esm/components/AndOrController/AndOrController.js +120 -152
- package/esm/components/ConditionController/ConditionController.js +37 -57
- package/esm/components/DisplayOutput/DisplayOutput.js +61 -76
- package/esm/components/DragContainerController/DragContainerController.js +20 -21
- package/esm/components/DragControllerRow/DragControllerRow.js +27 -17
- package/esm/components/FieldControllerRow/FieldControllerRow.js +13 -18
- package/esm/components/Nestable/Nestable.js +235 -268
- package/esm/components/Nestable/NestableItem.js +58 -48
- package/esm/components/Nestable/actions/events.js +52 -34
- package/esm/components/Nestable/actions/getItemOptions.js +14 -12
- package/esm/components/Nestable/actions/getPaths.js +46 -33
- package/esm/components/Nestable/actions/index.js +0 -5
- package/esm/components/Nestable/actions/moveItem.js +23 -13
- package/esm/components/Nestable/actions/paths.js +48 -35
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +12 -12
- package/esm/components/Nestable/actions/tryIncreaseDepth.js +14 -14
- package/esm/components/Nestable/index.js +0 -23
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +1 -2
- package/esm/components/QueryBuilderImpl.js +204 -265
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +52 -70
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +149 -164
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +16 -10
- package/esm/components/format/format.js +19 -27
- package/esm/components/format/sqlFormat.js +34 -31
- package/esm/components/format/sqlSafeFormat.js +37 -34
- package/esm/components/format/xmlFormat.js +34 -31
- package/esm/components/helpers/actions.js +100 -85
- package/esm/components/helpers/constants.js +3 -4
- package/esm/components/helpers/dependencies.js +33 -21
- package/esm/components/helpers/selectors.js +5 -6
- package/esm/components/helpers/store.js +84 -104
- package/esm/components/helpers/types.js +9 -10
- package/esm/index.js +0 -57
- package/esm/propTypes.js +1 -2
- package/package.json +173 -15
- package/types/DSQueryBuilder.d.ts +211 -0
- package/types/components/AndOrController/AndOrController.d.ts +38 -0
- package/types/components/ConditionController/ConditionController.d.ts +16 -0
- package/types/components/DisplayOutput/DisplayOutput.d.ts +7 -0
- package/types/components/DragContainerController/DragContainerController.d.ts +9 -0
- package/types/components/DragControllerRow/DragControllerRow.d.ts +9 -0
- package/types/components/FieldControllerRow/FieldControllerRow.d.ts +9 -0
- package/types/components/Nestable/Nestable.d.ts +51 -0
- package/types/components/Nestable/NestableItem.d.ts +12 -0
- package/types/components/Nestable/actions/events.d.ts +6 -0
- package/types/components/Nestable/actions/getItemOptions.d.ts +11 -0
- package/types/components/Nestable/actions/getPaths.d.ts +5 -0
- package/types/components/Nestable/actions/index.d.ts +6 -0
- package/types/components/Nestable/actions/moveItem.d.ts +5 -0
- package/types/components/Nestable/actions/paths.d.ts +5 -0
- package/types/components/Nestable/actions/tryDecreaseDepth.d.ts +1 -0
- package/types/components/Nestable/actions/tryIncreaseDepth.d.ts +1 -0
- package/types/components/Nestable/index.d.ts +2 -0
- package/types/components/QueryBuilderContext/QueryBuilderContext.d.ts +2 -0
- package/types/components/QueryBuilderImpl.d.ts +49 -0
- package/types/components/QueryBuilderItem/QueryBuilderItem.d.ts +5 -0
- package/types/components/QueryBuilderRow/QueryBuilderRow.d.ts +12 -0
- package/types/components/ToolBarAnimation/ToolBarAnimation.d.ts +3 -0
- package/types/components/format/format.d.ts +26 -0
- package/types/components/format/sqlFormat.d.ts +5 -0
- package/types/components/format/sqlSafeFormat.d.ts +6 -0
- package/types/components/format/xmlFormat.d.ts +5 -0
- package/types/components/helpers/actions.d.ts +63 -0
- package/types/components/helpers/constants.d.ts +3 -0
- package/types/components/helpers/dependencies.d.ts +1 -0
- package/types/components/helpers/selectors.d.ts +20 -0
- package/types/components/helpers/store.d.ts +144 -0
- package/types/components/helpers/types.d.ts +50 -0
- package/types/index.d.ts +2 -0
- package/types/propTypes.d.ts +156 -0
- package/DSQueryBuilder/package.json +0 -10
- package/cjs/DSQueryBuilder.js.map +0 -1
- package/cjs/components/AndOrController/AndOrController.js.map +0 -1
- package/cjs/components/ConditionController/ConditionController.js.map +0 -1
- package/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -1
- package/cjs/components/DragContainerController/DragContainerController.js.map +0 -1
- package/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -1
- package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -1
- package/cjs/components/Nestable/Nestable.js.map +0 -1
- package/cjs/components/Nestable/NestableItem.js.map +0 -1
- package/cjs/components/Nestable/actions/events.js.map +0 -1
- package/cjs/components/Nestable/actions/getItemOptions.js.map +0 -1
- package/cjs/components/Nestable/actions/getPaths.js.map +0 -1
- package/cjs/components/Nestable/actions/index.js.map +0 -1
- package/cjs/components/Nestable/actions/moveItem.js.map +0 -1
- package/cjs/components/Nestable/actions/paths.js.map +0 -1
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -1
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -1
- package/cjs/components/Nestable/index.js.map +0 -1
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -1
- package/cjs/components/QueryBuilderImpl.js.map +0 -1
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -1
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -1
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -1
- package/cjs/components/format/format.js.map +0 -1
- package/cjs/components/format/sqlFormat.js.map +0 -1
- package/cjs/components/format/sqlSafeFormat.js.map +0 -1
- package/cjs/components/format/xmlFormat.js.map +0 -1
- package/cjs/components/helpers/actions.js.map +0 -1
- package/cjs/components/helpers/constants.js.map +0 -1
- package/cjs/components/helpers/dependencies.js.map +0 -1
- package/cjs/components/helpers/selectors.js.map +0 -1
- package/cjs/components/helpers/store.js.map +0 -1
- package/cjs/components/helpers/types.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/propTypes.js.map +0 -1
- package/components/AndOrController/AndOrController/package.json +0 -10
- package/components/ConditionController/ConditionController/package.json +0 -10
- package/components/DisplayOutput/DisplayOutput/package.json +0 -10
- package/components/DragContainerController/DragContainerController/package.json +0 -10
- package/components/DragControllerRow/DragControllerRow/package.json +0 -10
- package/components/FieldControllerRow/FieldControllerRow/package.json +0 -10
- package/components/Nestable/Nestable/package.json +0 -10
- package/components/Nestable/NestableItem/package.json +0 -10
- package/components/Nestable/actions/events/package.json +0 -10
- package/components/Nestable/actions/getItemOptions/package.json +0 -10
- package/components/Nestable/actions/getPaths/package.json +0 -10
- package/components/Nestable/actions/moveItem/package.json +0 -10
- package/components/Nestable/actions/package.json +0 -10
- package/components/Nestable/actions/paths/package.json +0 -10
- package/components/Nestable/actions/tryDecreaseDepth/package.json +0 -10
- package/components/Nestable/actions/tryIncreaseDepth/package.json +0 -10
- package/components/Nestable/package.json +0 -10
- package/components/QueryBuilderContext/QueryBuilderContext/package.json +0 -10
- package/components/QueryBuilderImpl/package.json +0 -10
- package/components/QueryBuilderItem/QueryBuilderItem/package.json +0 -10
- package/components/QueryBuilderRow/QueryBuilderRow/package.json +0 -10
- package/components/ToolBarAnimation/ToolBarAnimation/package.json +0 -10
- package/components/format/format/package.json +0 -10
- package/components/format/sqlFormat/package.json +0 -10
- package/components/format/sqlSafeFormat/package.json +0 -10
- package/components/format/xmlFormat/package.json +0 -10
- package/components/helpers/actions/package.json +0 -10
- package/components/helpers/constants/package.json +0 -10
- package/components/helpers/dependencies/package.json +0 -10
- package/components/helpers/selectors/package.json +0 -10
- package/components/helpers/store/package.json +0 -10
- package/components/helpers/types/package.json +0 -10
- package/esm/DSQueryBuilder.js.map +0 -1
- package/esm/components/AndOrController/AndOrController.js.map +0 -1
- package/esm/components/ConditionController/ConditionController.js.map +0 -1
- package/esm/components/DisplayOutput/DisplayOutput.js.map +0 -1
- package/esm/components/DragContainerController/DragContainerController.js.map +0 -1
- package/esm/components/DragControllerRow/DragControllerRow.js.map +0 -1
- package/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -1
- package/esm/components/Nestable/Nestable.js.map +0 -1
- package/esm/components/Nestable/NestableItem.js.map +0 -1
- package/esm/components/Nestable/actions/events.js.map +0 -1
- package/esm/components/Nestable/actions/getItemOptions.js.map +0 -1
- package/esm/components/Nestable/actions/getPaths.js.map +0 -1
- package/esm/components/Nestable/actions/index.js.map +0 -1
- package/esm/components/Nestable/actions/moveItem.js.map +0 -1
- package/esm/components/Nestable/actions/paths.js.map +0 -1
- package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -1
- package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -1
- package/esm/components/Nestable/index.js.map +0 -1
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -1
- package/esm/components/QueryBuilderImpl.js.map +0 -1
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -1
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -1
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -1
- package/esm/components/format/format.js.map +0 -1
- package/esm/components/format/sqlFormat.js.map +0 -1
- package/esm/components/format/sqlSafeFormat.js.map +0 -1
- package/esm/components/format/xmlFormat.js.map +0 -1
- package/esm/components/helpers/actions.js.map +0 -1
- package/esm/components/helpers/constants.js.map +0 -1
- package/esm/components/helpers/dependencies.js.map +0 -1
- package/esm/components/helpers/selectors.js.map +0 -1
- package/esm/components/helpers/store.js.map +0 -1
- package/esm/components/helpers/types.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/propTypes.js.map +0 -1
- package/propTypes/package.json +0 -10
|
@@ -1,41 +1,54 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.every.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.every.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.some.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
1
8
|
import { get } from 'lodash';
|
|
2
9
|
import * as operators from '@elliemae/ds-utilities/operators';
|
|
3
10
|
import { QB_GROUP_CONDITION_TYPES } from './types.js';
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
const resolveCondition = function (condition, state) {
|
|
13
|
+
let resolveBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QB_GROUP_CONDITION_TYPES.AND;
|
|
7
14
|
if (condition.length === 0 || !condition) return true; // resolve by AND: all the conditions must be true
|
|
8
15
|
|
|
9
16
|
if (resolveBy) {
|
|
10
|
-
return condition.every(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
return condition.every(rule => {
|
|
18
|
+
const {
|
|
19
|
+
source: sourceRule,
|
|
20
|
+
operator: operatorRule,
|
|
21
|
+
value: valueRule
|
|
22
|
+
} = rule;
|
|
14
23
|
if (typeof operatorRule === "function") return operatorRule(get(state, sourceRule), valueRule);
|
|
15
24
|
return operators[operatorRule](get(state, sourceRule), valueRule);
|
|
16
25
|
});
|
|
17
26
|
} // resolve by OR: at least one condition must be true
|
|
18
27
|
|
|
19
28
|
|
|
20
|
-
return condition.some(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
return condition.some(rule => {
|
|
30
|
+
const {
|
|
31
|
+
source: sourceRule,
|
|
32
|
+
operator: operatorRule,
|
|
33
|
+
value: valueRule
|
|
34
|
+
} = rule;
|
|
24
35
|
return operators[operatorRule](state[sourceRule], valueRule);
|
|
25
36
|
});
|
|
26
37
|
};
|
|
27
38
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
const resolveDependencies = (state, fields) => {
|
|
40
|
+
const fieldsToRender = fields.reduce((result, _ref) => {
|
|
41
|
+
let {
|
|
42
|
+
target,
|
|
43
|
+
component,
|
|
44
|
+
condition,
|
|
45
|
+
resolveBy,
|
|
46
|
+
validation
|
|
47
|
+
} = _ref;
|
|
35
48
|
if (resolveCondition(condition, state, resolveBy)) result.push({
|
|
36
|
-
target
|
|
37
|
-
component
|
|
38
|
-
validation
|
|
49
|
+
target,
|
|
50
|
+
component,
|
|
51
|
+
validation
|
|
39
52
|
});
|
|
40
53
|
return result;
|
|
41
54
|
}, []);
|
|
@@ -43,4 +56,3 @@ var resolveDependencies = function resolveDependencies(state, fields) {
|
|
|
43
56
|
};
|
|
44
57
|
|
|
45
58
|
export { resolveDependencies };
|
|
46
|
-
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { QB_FIELD_TYPES, QB_OPERATOR_TYPES } from './types.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const QB_DEFAULT_VALUES_OPTIONS = [{
|
|
4
4
|
label: 'Choose a Field',
|
|
5
5
|
value: ''
|
|
6
6
|
}];
|
|
7
|
-
|
|
7
|
+
const QB_SUBJECT_VALUES_OPTIONS = [{
|
|
8
8
|
label: 'Condominium',
|
|
9
9
|
value: 'Condominium'
|
|
10
10
|
}, {
|
|
@@ -26,7 +26,7 @@ var QB_SUBJECT_VALUES_OPTIONS = [{
|
|
|
26
26
|
label: 'Other',
|
|
27
27
|
value: 'Other'
|
|
28
28
|
}];
|
|
29
|
-
|
|
29
|
+
const QB_LOAN_VALUES_OPTIONS = [{
|
|
30
30
|
label: 'Conventional',
|
|
31
31
|
value: 'Conventional'
|
|
32
32
|
}, {
|
|
@@ -45,7 +45,7 @@ var QB_LOAN_VALUES_OPTIONS = [{
|
|
|
45
45
|
label: 'Other',
|
|
46
46
|
value: 'Other'
|
|
47
47
|
}];
|
|
48
|
-
|
|
48
|
+
const QB_FIELD_OPTIONS = [{
|
|
49
49
|
label: 'Select',
|
|
50
50
|
value: ''
|
|
51
51
|
}, {
|
|
@@ -64,7 +64,7 @@ var QB_FIELD_OPTIONS = [{
|
|
|
64
64
|
label: 'Credit Score',
|
|
65
65
|
value: QB_FIELD_TYPES.CREDIT_VALUES
|
|
66
66
|
}];
|
|
67
|
-
|
|
67
|
+
const QB_OPERATOR_OPTIONS = [{
|
|
68
68
|
label: 'Select',
|
|
69
69
|
value: ''
|
|
70
70
|
}, {
|
|
@@ -91,4 +91,3 @@ var QB_OPERATOR_OPTIONS = [{
|
|
|
91
91
|
}];
|
|
92
92
|
|
|
93
93
|
export { QB_DEFAULT_VALUES_OPTIONS, QB_FIELD_OPTIONS, QB_LOAN_VALUES_OPTIONS, QB_OPERATOR_OPTIONS, QB_SUBJECT_VALUES_OPTIONS };
|
|
94
|
-
//# sourceMappingURL=selectors.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
7
|
import { createNewFilter, createNewGroup, addFilterToMap, addFilterToMainItem, findItemFilterById, addFilterToItem, removeFilterItem, addGroupFilterToItem, addGroupToMap, unGroupFilterToItem, changeGroupOperator, changeFilterItem } from './actions.js';
|
|
5
8
|
import QueryBuilderFormat from '../format/format.js';
|
|
6
|
-
import './types.js';
|
|
7
|
-
import '../format/sqlFormat.js';
|
|
8
|
-
import '../format/xmlFormat.js';
|
|
9
|
-
import '../format/sqlSafeFormat.js';
|
|
10
9
|
|
|
11
10
|
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; }
|
|
12
11
|
|
|
@@ -23,12 +22,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
23
22
|
* @class QueryBuilderStore
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _this = this;
|
|
29
|
-
|
|
30
|
-
_classCallCheck(this, QueryBuilderStore);
|
|
31
|
-
|
|
25
|
+
class QueryBuilderStore {
|
|
26
|
+
constructor(init, _format) {
|
|
32
27
|
this.items = [];
|
|
33
28
|
this.step = 0;
|
|
34
29
|
this.steps = {};
|
|
@@ -37,155 +32,140 @@ var QueryBuilderStore = /*#__PURE__*/function () {
|
|
|
37
32
|
this.main = null;
|
|
38
33
|
this.format = null;
|
|
39
34
|
|
|
40
|
-
this.createNewFilter =
|
|
41
|
-
return createNewFilter.call(_this, idGroup);
|
|
42
|
-
};
|
|
35
|
+
this.createNewFilter = idGroup => createNewFilter.call(this, idGroup);
|
|
43
36
|
|
|
44
|
-
this.createNewGroup =
|
|
45
|
-
return createNewGroup.call(_this, parentIdGroup);
|
|
46
|
-
};
|
|
37
|
+
this.createNewGroup = parentIdGroup => createNewGroup.call(this, parentIdGroup);
|
|
47
38
|
|
|
48
|
-
this.onOrderDragAndDrop =
|
|
49
|
-
|
|
50
|
-
return
|
|
39
|
+
this.onOrderDragAndDrop = items => {
|
|
40
|
+
this.items = items;
|
|
41
|
+
return this.getState();
|
|
51
42
|
};
|
|
52
43
|
|
|
53
|
-
this.addFilterNextToFilterId =
|
|
44
|
+
this.addFilterNextToFilterId = (idGroup, idFilter) => {
|
|
54
45
|
// eslint-disable-line
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return _this.getState();
|
|
46
|
+
this.addFilter(idGroup);
|
|
47
|
+
return this.getState();
|
|
58
48
|
};
|
|
59
49
|
|
|
60
|
-
this.addFilter =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
addFilterToMap.call(_this, newFilter); // new API
|
|
50
|
+
this.addFilter = idGroup => {
|
|
51
|
+
const newFilter = this.createNewFilter(idGroup);
|
|
52
|
+
addFilterToMap.call(this, newFilter); // new API
|
|
64
53
|
|
|
65
|
-
if (
|
|
66
|
-
addFilterToMainItem.call(
|
|
54
|
+
if (this.main === idGroup) {
|
|
55
|
+
addFilterToMainItem.call(this, this.items, newFilter);
|
|
67
56
|
} else {
|
|
68
|
-
|
|
57
|
+
const foundInItems = findItemFilterById.call(this, idGroup);
|
|
69
58
|
|
|
70
59
|
if (foundInItems) {
|
|
71
|
-
addFilterToItem.call(
|
|
60
|
+
addFilterToItem.call(this, foundInItems, newFilter);
|
|
72
61
|
}
|
|
73
62
|
}
|
|
74
63
|
|
|
75
|
-
return
|
|
64
|
+
return this.getState();
|
|
76
65
|
};
|
|
77
66
|
|
|
78
|
-
this.onRemoveFilter =
|
|
67
|
+
this.onRemoveFilter = idFilter => {
|
|
79
68
|
// new API
|
|
80
|
-
removeFilterItem.call(
|
|
81
|
-
return
|
|
69
|
+
removeFilterItem.call(this, idFilter);
|
|
70
|
+
return this.getState();
|
|
82
71
|
};
|
|
83
72
|
|
|
84
|
-
this.addRuleContainerInPlace =
|
|
73
|
+
this.addRuleContainerInPlace = (idGroup, idFilter) => {
|
|
85
74
|
// Create a new group
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return _this.getState();
|
|
75
|
+
const newGroup = this.createNewGroup(idGroup);
|
|
76
|
+
addGroupFilterToItem.call(this, idGroup, idFilter, newGroup);
|
|
77
|
+
return this.getState();
|
|
90
78
|
};
|
|
91
79
|
|
|
92
|
-
this.addRuleContainer =
|
|
80
|
+
this.addRuleContainer = (idGroup, idFilter) => {
|
|
93
81
|
// eslint-disable-line
|
|
94
|
-
|
|
82
|
+
const newGroup = this.createNewGroup(idGroup);
|
|
83
|
+
addGroupToMap.call(this, newGroup);
|
|
95
84
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (_this.main === idGroup) {
|
|
99
|
-
addFilterToMainItem.call(_this, _this.items, newGroup);
|
|
85
|
+
if (this.main === idGroup) {
|
|
86
|
+
addFilterToMainItem.call(this, this.items, newGroup);
|
|
100
87
|
} else {
|
|
101
|
-
|
|
88
|
+
const foundInItems = findItemFilterById.call(this, idGroup);
|
|
102
89
|
|
|
103
90
|
if (foundInItems) {
|
|
104
|
-
addFilterToItem.call(
|
|
91
|
+
addFilterToItem.call(this, foundInItems, newGroup);
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
94
|
|
|
108
|
-
return
|
|
95
|
+
return this.getState();
|
|
109
96
|
};
|
|
110
97
|
|
|
111
|
-
this.unGroup =
|
|
112
|
-
unGroupFilterToItem.call(
|
|
113
|
-
return
|
|
98
|
+
this.unGroup = idGroup => {
|
|
99
|
+
unGroupFilterToItem.call(this, idGroup);
|
|
100
|
+
return this.getState();
|
|
114
101
|
};
|
|
115
102
|
|
|
116
|
-
this.changeGroupOperator =
|
|
117
|
-
|
|
118
|
-
changeGroupOperator.call(
|
|
119
|
-
return
|
|
103
|
+
this.changeGroupOperator = (idGroup, value) => {
|
|
104
|
+
this.getGroupById(idGroup).condition = value;
|
|
105
|
+
changeGroupOperator.call(this, idGroup, value);
|
|
106
|
+
return this.getState();
|
|
120
107
|
};
|
|
121
108
|
|
|
122
|
-
this.changeFilter =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
this.changeFilter = data => {
|
|
110
|
+
const {
|
|
111
|
+
idFilter
|
|
112
|
+
} = data;
|
|
113
|
+
this.mapFilters[idFilter] = _objectSpread(_objectSpread({}, this.mapFilters[idFilter]), data);
|
|
114
|
+
changeFilterItem.call(this, data);
|
|
115
|
+
return this.getState();
|
|
127
116
|
};
|
|
128
117
|
|
|
129
|
-
this.getGroupById =
|
|
130
|
-
return _this.mapGroups[idGroup] || {};
|
|
131
|
-
};
|
|
118
|
+
this.getGroupById = idGroup => this.mapGroups[idGroup] || {};
|
|
132
119
|
|
|
133
|
-
this.getFilterById =
|
|
134
|
-
return _this.mapFilters[idFilter];
|
|
135
|
-
};
|
|
120
|
+
this.getFilterById = idFilter => this.mapFilters[idFilter];
|
|
136
121
|
|
|
137
|
-
this.getInitialState =
|
|
138
|
-
|
|
139
|
-
step:
|
|
140
|
-
mapFilters: _objectSpread({},
|
|
141
|
-
mapGroups: _objectSpread({},
|
|
142
|
-
main:
|
|
143
|
-
items:
|
|
122
|
+
this.getInitialState = () => {
|
|
123
|
+
const newFilters = {
|
|
124
|
+
step: this.step,
|
|
125
|
+
mapFilters: _objectSpread({}, this.mapFilters),
|
|
126
|
+
mapGroups: _objectSpread({}, this.mapGroups),
|
|
127
|
+
main: this.main,
|
|
128
|
+
items: this.items
|
|
144
129
|
};
|
|
145
|
-
|
|
130
|
+
const format = QueryBuilderFormat.run(newFilters, this.format);
|
|
146
131
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
147
|
-
format
|
|
132
|
+
format
|
|
148
133
|
});
|
|
149
134
|
};
|
|
150
135
|
|
|
151
|
-
this.getState =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
step:
|
|
155
|
-
mapFilters: _objectSpread({},
|
|
156
|
-
mapGroups: _objectSpread({},
|
|
157
|
-
main:
|
|
158
|
-
items:
|
|
136
|
+
this.getState = () => {
|
|
137
|
+
this.step += 1;
|
|
138
|
+
const newFilters = {
|
|
139
|
+
step: this.step,
|
|
140
|
+
mapFilters: _objectSpread({}, this.mapFilters),
|
|
141
|
+
mapGroups: _objectSpread({}, this.mapGroups),
|
|
142
|
+
main: this.main,
|
|
143
|
+
items: this.items
|
|
159
144
|
};
|
|
160
|
-
|
|
145
|
+
const format = QueryBuilderFormat.run(newFilters, this.format);
|
|
161
146
|
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
162
|
-
format
|
|
147
|
+
format
|
|
163
148
|
});
|
|
164
149
|
};
|
|
165
150
|
|
|
166
151
|
this.firstLoad = true;
|
|
167
152
|
this.format = _format;
|
|
168
153
|
if (init) return this.initSetupUp(init);
|
|
169
|
-
|
|
170
|
-
this.mapGroups =
|
|
154
|
+
const mainGroup = this.createNewGroup('main');
|
|
155
|
+
this.mapGroups = {
|
|
156
|
+
[mainGroup.idGroup]: mainGroup
|
|
157
|
+
};
|
|
171
158
|
this.main = mainGroup.idGroup;
|
|
172
159
|
this.addFilter(mainGroup.idGroup);
|
|
173
160
|
}
|
|
174
161
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Object.keys(init).forEach(function (key) {
|
|
182
|
-
if (init[key] && _this2[key] !== undefined) _this2[key] = init[key];
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}]);
|
|
162
|
+
initSetupUp(init) {
|
|
163
|
+
this.step = init.step || 1;
|
|
164
|
+
Object.keys(init).forEach(key => {
|
|
165
|
+
if (init[key] && this[key] !== undefined) this[key] = init[key];
|
|
166
|
+
});
|
|
167
|
+
}
|
|
186
168
|
|
|
187
|
-
|
|
188
|
-
}();
|
|
169
|
+
}
|
|
189
170
|
|
|
190
171
|
export { QueryBuilderStore as default };
|
|
191
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
const QB_FIELD_TYPES = {
|
|
2
2
|
LOAN_VALUES: 'loanValues',
|
|
3
3
|
LTV_VALUES: 'ltvValues',
|
|
4
4
|
SUBJECT_VALUES: 'subjectValues',
|
|
5
5
|
LAST_VALUES: 'lastValues',
|
|
6
6
|
CREDIT_VALUES: 'creditValues'
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const QB_OPERATOR_TYPES = {
|
|
9
9
|
EQUAL: 'equal',
|
|
10
10
|
NOT_EQUAL: 'notEqual',
|
|
11
11
|
GREATER_THAN: 'greaterThan',
|
|
@@ -17,37 +17,36 @@ var QB_OPERATOR_TYPES = {
|
|
|
17
17
|
LESS_THAN_OR_EQUAL: 'lessThanOrEquals',
|
|
18
18
|
START_WITH: 'startsWith'
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
const QB_GROUP_CONDITION_TYPES = {
|
|
21
21
|
AND: true,
|
|
22
22
|
OR: false
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const QB_DRAG_TYPES = {
|
|
25
25
|
FILTER: 'filter',
|
|
26
26
|
GROUP: 'group'
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
const QB_DRAG_LOCATIONS = {
|
|
29
29
|
ABOVE: 'above',
|
|
30
30
|
BELOW: 'below'
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
const QB_EXPORT_FORMAT_TYPES = {
|
|
33
33
|
DEFAULT: 'defaultFormat',
|
|
34
34
|
XML: 'xmlFormat',
|
|
35
35
|
SQL: 'sqlFormat',
|
|
36
36
|
SAFESQL: 'sqlSafeFormat'
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
const QB_ADD_FILTER_METHOD_TYPES = {
|
|
39
39
|
IN_PLACE: 'inplace',
|
|
40
40
|
APPEND: 'append'
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
const QB_GROUP_FILTER_METHOD_TYPES = {
|
|
43
43
|
IN_PLACE: 'inplace',
|
|
44
44
|
APPEND: 'append'
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const QB_FIELD_SHARED_ACTIONS = {
|
|
47
47
|
RESET_FIELD: 'resetField',
|
|
48
48
|
RESET_OPERATOR: 'resetOperator',
|
|
49
49
|
RESET_VALUE: 'resetValue'
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
export { QB_ADD_FILTER_METHOD_TYPES, QB_DRAG_LOCATIONS, QB_DRAG_TYPES, QB_EXPORT_FORMAT_TYPES, QB_FIELD_SHARED_ACTIONS, QB_FIELD_TYPES, QB_GROUP_CONDITION_TYPES, QB_GROUP_FILTER_METHOD_TYPES, QB_OPERATOR_TYPES };
|
|
53
|
-
//# sourceMappingURL=types.js.map
|
package/esm/index.js
CHANGED
|
@@ -2,60 +2,3 @@ export { DSQueryBuilder, DSQueryBuilderWithSchema, DSQueryBuilder as default } f
|
|
|
2
2
|
export { QB_ADD_FILTER_METHOD_TYPES, QB_DRAG_LOCATIONS, QB_DRAG_TYPES, QB_EXPORT_FORMAT_TYPES, QB_FIELD_SHARED_ACTIONS, QB_FIELD_TYPES, QB_GROUP_CONDITION_TYPES, QB_GROUP_FILTER_METHOD_TYPES, QB_OPERATOR_TYPES } from './components/helpers/types.js';
|
|
3
3
|
export { QB_DEFAULT_VALUES_OPTIONS, QB_FIELD_OPTIONS, QB_LOAN_VALUES_OPTIONS, QB_OPERATOR_OPTIONS, QB_SUBJECT_VALUES_OPTIONS } from './components/helpers/selectors.js';
|
|
4
4
|
export { default as QueryBuilderFormat } from './components/format/format.js';
|
|
5
|
-
import 'react';
|
|
6
|
-
import 'react-desc';
|
|
7
|
-
import './components/QueryBuilderImpl.js';
|
|
8
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
9
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
10
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
11
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
12
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
13
|
-
import '@babel/runtime/helpers/esm/inherits';
|
|
14
|
-
import '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
15
|
-
import '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
16
|
-
import './components/Nestable/Nestable.js';
|
|
17
|
-
import '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
18
|
-
import 'prop-types';
|
|
19
|
-
import 'classnames';
|
|
20
|
-
import '@elliemae/ds-shared/utils';
|
|
21
|
-
import '@elliemae/ds-utilities';
|
|
22
|
-
import './components/Nestable/actions/tryIncreaseDepth.js';
|
|
23
|
-
import './components/Nestable/actions/tryDecreaseDepth.js';
|
|
24
|
-
import './components/Nestable/actions/moveItem.js';
|
|
25
|
-
import 'react-addons-update';
|
|
26
|
-
import './components/Nestable/actions/paths.js';
|
|
27
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
28
|
-
import './components/Nestable/actions/events.js';
|
|
29
|
-
import './components/Nestable/actions/getItemOptions.js';
|
|
30
|
-
import './components/Nestable/NestableItem.js';
|
|
31
|
-
import './components/QueryBuilderContext/QueryBuilderContext.js';
|
|
32
|
-
import './components/helpers/store.js';
|
|
33
|
-
import './components/helpers/actions.js';
|
|
34
|
-
import './components/AndOrController/AndOrController.js';
|
|
35
|
-
import '@elliemae/ds-classnames';
|
|
36
|
-
import '@elliemae/ds-tooltip';
|
|
37
|
-
import '@elliemae/ds-popper';
|
|
38
|
-
import '@elliemae/ds-form';
|
|
39
|
-
import '@elliemae/ds-button';
|
|
40
|
-
import '@elliemae/ds-icons';
|
|
41
|
-
import '@elliemae/ds-icon';
|
|
42
|
-
import './components/helpers/constants.js';
|
|
43
|
-
import './components/ToolBarAnimation/ToolBarAnimation.js';
|
|
44
|
-
import '@elliemae/ds-shared/Animations/GrowRight';
|
|
45
|
-
import './components/DragContainerController/DragContainerController.js';
|
|
46
|
-
import './components/QueryBuilderItem/QueryBuilderItem.js';
|
|
47
|
-
import './components/QueryBuilderRow/QueryBuilderRow.js';
|
|
48
|
-
import './components/helpers/dependencies.js';
|
|
49
|
-
import 'lodash';
|
|
50
|
-
import '@elliemae/ds-utilities/operators';
|
|
51
|
-
import './components/ConditionController/ConditionController.js';
|
|
52
|
-
import './components/DragControllerRow/DragControllerRow.js';
|
|
53
|
-
import './components/DisplayOutput/DisplayOutput.js';
|
|
54
|
-
import '@babel/runtime/helpers/esm/typeof';
|
|
55
|
-
import '@elliemae/ds-grid';
|
|
56
|
-
import '@elliemae/ds-accordion';
|
|
57
|
-
import './propTypes.js';
|
|
58
|
-
import './components/format/sqlFormat.js';
|
|
59
|
-
import './components/format/xmlFormat.js';
|
|
60
|
-
import './components/format/sqlSafeFormat.js';
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
package/esm/propTypes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
import { QB_ADD_FILTER_METHOD_TYPES } from './components/helpers/types.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const props = {
|
|
5
5
|
/** inpect props to component wrapper */
|
|
6
6
|
containerProps: PropTypes.object.description('inject props to component wrapper'),
|
|
7
7
|
|
|
@@ -91,4 +91,3 @@ var props = {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export { props };
|
|
94
|
-
//# sourceMappingURL=propTypes.js.map
|