@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,132 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const QB_DEFAULT_VALUES_OPTIONS = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
value: ""
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: "Is",
|
|
98
|
-
value: QB_OPERATOR_TYPES.EQUAL
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: "Is not",
|
|
102
|
-
value: QB_OPERATOR_TYPES.NOT_EQUAL
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: "Greater than",
|
|
106
|
-
value: QB_OPERATOR_TYPES.GREATER_THAN
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: "Less than",
|
|
110
|
-
value: QB_OPERATOR_TYPES.LESS_THAN
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
label: "Contains",
|
|
114
|
-
value: QB_OPERATOR_TYPES.CONTAINS
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
label: "Doesn't Contain",
|
|
118
|
-
value: QB_OPERATOR_TYPES.NOT_CONTAINS
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
label: "Between",
|
|
122
|
-
value: QB_OPERATOR_TYPES.BETWEEN
|
|
123
|
-
}
|
|
124
|
-
];
|
|
125
|
-
export {
|
|
126
|
-
QB_DEFAULT_VALUES_OPTIONS,
|
|
127
|
-
QB_FIELD_OPTIONS,
|
|
128
|
-
QB_LOAN_VALUES_OPTIONS,
|
|
129
|
-
QB_OPERATOR_OPTIONS,
|
|
130
|
-
QB_SUBJECT_VALUES_OPTIONS
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=selectors.js.map
|
|
1
|
+
import { QB_FIELD_TYPES, QB_OPERATOR_TYPES } from './types.js';
|
|
2
|
+
|
|
3
|
+
const QB_DEFAULT_VALUES_OPTIONS = [{
|
|
4
|
+
label: 'Choose a Field',
|
|
5
|
+
value: ''
|
|
6
|
+
}];
|
|
7
|
+
const QB_SUBJECT_VALUES_OPTIONS = [{
|
|
8
|
+
label: 'Condominium',
|
|
9
|
+
value: 'Condominium'
|
|
10
|
+
}, {
|
|
11
|
+
label: 'Single Family Home',
|
|
12
|
+
value: 'Single Family Home'
|
|
13
|
+
}, {
|
|
14
|
+
label: 'Co-Operative',
|
|
15
|
+
value: 'Co-Operative'
|
|
16
|
+
}, {
|
|
17
|
+
label: 'Detached',
|
|
18
|
+
value: 'Detached'
|
|
19
|
+
}, {
|
|
20
|
+
label: 'High Rise Condominium',
|
|
21
|
+
value: 'High Rise Condominium'
|
|
22
|
+
}, {
|
|
23
|
+
label: 'Manufactured Housing',
|
|
24
|
+
value: 'Manufactured Housing'
|
|
25
|
+
}, {
|
|
26
|
+
label: 'Other',
|
|
27
|
+
value: 'Other'
|
|
28
|
+
}];
|
|
29
|
+
const QB_LOAN_VALUES_OPTIONS = [{
|
|
30
|
+
label: 'Conventional',
|
|
31
|
+
value: 'Conventional'
|
|
32
|
+
}, {
|
|
33
|
+
label: 'VA',
|
|
34
|
+
value: 'VA'
|
|
35
|
+
}, {
|
|
36
|
+
label: 'FHA',
|
|
37
|
+
value: 'FHA'
|
|
38
|
+
}, {
|
|
39
|
+
label: 'USAD-RHS',
|
|
40
|
+
value: 'USAD-RHS'
|
|
41
|
+
}, {
|
|
42
|
+
label: 'HELOC',
|
|
43
|
+
value: 'HELOC'
|
|
44
|
+
}, {
|
|
45
|
+
label: 'Other',
|
|
46
|
+
value: 'Other'
|
|
47
|
+
}];
|
|
48
|
+
const QB_FIELD_OPTIONS = [{
|
|
49
|
+
label: 'Select',
|
|
50
|
+
value: ''
|
|
51
|
+
}, {
|
|
52
|
+
label: 'Loan Type',
|
|
53
|
+
value: QB_FIELD_TYPES.LOAN_VALUES
|
|
54
|
+
}, {
|
|
55
|
+
label: 'Loan To Value (LTV)',
|
|
56
|
+
value: QB_FIELD_TYPES.LTV_VALUES
|
|
57
|
+
}, {
|
|
58
|
+
label: 'Subject Property Type',
|
|
59
|
+
value: QB_FIELD_TYPES.SUBJECT_VALUES
|
|
60
|
+
}, {
|
|
61
|
+
label: 'Last Finished Milestone',
|
|
62
|
+
value: QB_FIELD_TYPES.LAST_VALUES
|
|
63
|
+
}, {
|
|
64
|
+
label: 'Credit Score',
|
|
65
|
+
value: QB_FIELD_TYPES.CREDIT_VALUES
|
|
66
|
+
}];
|
|
67
|
+
const QB_OPERATOR_OPTIONS = [{
|
|
68
|
+
label: 'Select',
|
|
69
|
+
value: ''
|
|
70
|
+
}, {
|
|
71
|
+
label: 'Is',
|
|
72
|
+
value: QB_OPERATOR_TYPES.EQUAL
|
|
73
|
+
}, {
|
|
74
|
+
label: 'Is not',
|
|
75
|
+
value: QB_OPERATOR_TYPES.NOT_EQUAL
|
|
76
|
+
}, {
|
|
77
|
+
label: 'Greater than',
|
|
78
|
+
value: QB_OPERATOR_TYPES.GREATER_THAN
|
|
79
|
+
}, {
|
|
80
|
+
label: 'Less than',
|
|
81
|
+
value: QB_OPERATOR_TYPES.LESS_THAN
|
|
82
|
+
}, {
|
|
83
|
+
label: 'Contains',
|
|
84
|
+
value: QB_OPERATOR_TYPES.CONTAINS
|
|
85
|
+
}, {
|
|
86
|
+
label: "Doesn't Contain",
|
|
87
|
+
value: QB_OPERATOR_TYPES.NOT_CONTAINS
|
|
88
|
+
}, {
|
|
89
|
+
label: 'Between',
|
|
90
|
+
value: QB_OPERATOR_TYPES.BETWEEN
|
|
91
|
+
}];
|
|
92
|
+
|
|
93
|
+
export { QB_DEFAULT_VALUES_OPTIONS, QB_FIELD_OPTIONS, QB_LOAN_VALUES_OPTIONS, QB_OPERATOR_OPTIONS, QB_SUBJECT_VALUES_OPTIONS };
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
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';
|
|
7
|
+
import { createNewFilter, createNewGroup, addFilterToMap, addFilterToMainItem, findItemFilterById, addFilterToItem, removeFilterItem, addGroupFilterToItem, addGroupToMap, unGroupFilterToItem, changeGroupOperator, changeFilterItem } from './actions.js';
|
|
8
|
+
import QueryBuilderFormat from '../format/format.js';
|
|
9
|
+
|
|
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
|
+
|
|
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
|
+
/**
|
|
14
|
+
* Fluent interface: https://en.wikipedia.org/wiki/Fluent_interface
|
|
15
|
+
*
|
|
16
|
+
* @param idGroup
|
|
17
|
+
* @param parentIdGroup
|
|
18
|
+
* @param items
|
|
19
|
+
* @param idFilter
|
|
20
|
+
* @param value
|
|
21
|
+
* @param data
|
|
22
|
+
* @class QueryBuilderStore
|
|
23
|
+
*/
|
|
24
|
+
|
|
17
25
|
class QueryBuilderStore {
|
|
18
|
-
constructor(init,
|
|
26
|
+
constructor(init, _format) {
|
|
19
27
|
this.items = [];
|
|
20
28
|
this.step = 0;
|
|
21
29
|
this.steps = {};
|
|
@@ -23,121 +31,141 @@ class QueryBuilderStore {
|
|
|
23
31
|
this.mapGroups = {};
|
|
24
32
|
this.main = null;
|
|
25
33
|
this.format = null;
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
34
|
+
|
|
35
|
+
this.createNewFilter = idGroup => createNewFilter.call(this, idGroup);
|
|
36
|
+
|
|
37
|
+
this.createNewGroup = parentIdGroup => createNewGroup.call(this, parentIdGroup);
|
|
38
|
+
|
|
39
|
+
this.onOrderDragAndDrop = items => {
|
|
29
40
|
this.items = items;
|
|
30
41
|
return this.getState();
|
|
31
42
|
};
|
|
43
|
+
|
|
32
44
|
this.addFilterNextToFilterId = (idGroup, idFilter) => {
|
|
45
|
+
// eslint-disable-line
|
|
33
46
|
this.addFilter(idGroup);
|
|
34
47
|
return this.getState();
|
|
35
48
|
};
|
|
36
|
-
|
|
49
|
+
|
|
50
|
+
this.addFilter = idGroup => {
|
|
37
51
|
const newFilter = this.createNewFilter(idGroup);
|
|
38
|
-
addFilterToMap.call(this, newFilter);
|
|
52
|
+
addFilterToMap.call(this, newFilter); // new API
|
|
53
|
+
|
|
39
54
|
if (this.main === idGroup) {
|
|
40
55
|
addFilterToMainItem.call(this, this.items, newFilter);
|
|
41
56
|
} else {
|
|
42
57
|
const foundInItems = findItemFilterById.call(this, idGroup);
|
|
58
|
+
|
|
43
59
|
if (foundInItems) {
|
|
44
60
|
addFilterToItem.call(this, foundInItems, newFilter);
|
|
45
61
|
}
|
|
46
62
|
}
|
|
63
|
+
|
|
47
64
|
return this.getState();
|
|
48
65
|
};
|
|
49
|
-
|
|
66
|
+
|
|
67
|
+
this.onRemoveFilter = idFilter => {
|
|
68
|
+
// new API
|
|
50
69
|
removeFilterItem.call(this, idFilter);
|
|
51
70
|
return this.getState();
|
|
52
71
|
};
|
|
72
|
+
|
|
53
73
|
this.addRuleContainerInPlace = (idGroup, idFilter) => {
|
|
74
|
+
// Create a new group
|
|
54
75
|
const newGroup = this.createNewGroup(idGroup);
|
|
55
76
|
addGroupFilterToItem.call(this, idGroup, idFilter, newGroup);
|
|
56
77
|
return this.getState();
|
|
57
78
|
};
|
|
79
|
+
|
|
58
80
|
this.addRuleContainer = (idGroup, idFilter) => {
|
|
81
|
+
// eslint-disable-line
|
|
59
82
|
const newGroup = this.createNewGroup(idGroup);
|
|
60
83
|
addGroupToMap.call(this, newGroup);
|
|
84
|
+
|
|
61
85
|
if (this.main === idGroup) {
|
|
62
86
|
addFilterToMainItem.call(this, this.items, newGroup);
|
|
63
87
|
} else {
|
|
64
88
|
const foundInItems = findItemFilterById.call(this, idGroup);
|
|
89
|
+
|
|
65
90
|
if (foundInItems) {
|
|
66
91
|
addFilterToItem.call(this, foundInItems, newGroup);
|
|
67
92
|
}
|
|
68
93
|
}
|
|
94
|
+
|
|
69
95
|
return this.getState();
|
|
70
96
|
};
|
|
71
|
-
|
|
97
|
+
|
|
98
|
+
this.unGroup = idGroup => {
|
|
72
99
|
unGroupFilterToItem.call(this, idGroup);
|
|
73
100
|
return this.getState();
|
|
74
101
|
};
|
|
102
|
+
|
|
75
103
|
this.changeGroupOperator = (idGroup, value) => {
|
|
76
104
|
this.getGroupById(idGroup).condition = value;
|
|
77
105
|
changeGroupOperator.call(this, idGroup, value);
|
|
78
106
|
return this.getState();
|
|
79
107
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
108
|
+
|
|
109
|
+
this.changeFilter = data => {
|
|
110
|
+
const {
|
|
111
|
+
idFilter
|
|
112
|
+
} = data;
|
|
113
|
+
this.mapFilters[idFilter] = _objectSpread(_objectSpread({}, this.mapFilters[idFilter]), data);
|
|
86
114
|
changeFilterItem.call(this, data);
|
|
87
115
|
return this.getState();
|
|
88
116
|
};
|
|
89
|
-
|
|
90
|
-
this.
|
|
117
|
+
|
|
118
|
+
this.getGroupById = idGroup => this.mapGroups[idGroup] || {};
|
|
119
|
+
|
|
120
|
+
this.getFilterById = idFilter => this.mapFilters[idFilter];
|
|
121
|
+
|
|
91
122
|
this.getInitialState = () => {
|
|
92
123
|
const newFilters = {
|
|
93
124
|
step: this.step,
|
|
94
|
-
mapFilters: {
|
|
95
|
-
mapGroups: {
|
|
125
|
+
mapFilters: _objectSpread({}, this.mapFilters),
|
|
126
|
+
mapGroups: _objectSpread({}, this.mapGroups),
|
|
96
127
|
main: this.main,
|
|
97
128
|
items: this.items
|
|
98
129
|
};
|
|
99
130
|
const format = QueryBuilderFormat.run(newFilters, this.format);
|
|
100
|
-
return {
|
|
101
|
-
...newFilters,
|
|
131
|
+
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
102
132
|
format
|
|
103
|
-
};
|
|
133
|
+
});
|
|
104
134
|
};
|
|
135
|
+
|
|
105
136
|
this.getState = () => {
|
|
106
137
|
this.step += 1;
|
|
107
138
|
const newFilters = {
|
|
108
139
|
step: this.step,
|
|
109
|
-
mapFilters: {
|
|
110
|
-
mapGroups: {
|
|
140
|
+
mapFilters: _objectSpread({}, this.mapFilters),
|
|
141
|
+
mapGroups: _objectSpread({}, this.mapGroups),
|
|
111
142
|
main: this.main,
|
|
112
143
|
items: this.items
|
|
113
144
|
};
|
|
114
145
|
const format = QueryBuilderFormat.run(newFilters, this.format);
|
|
115
|
-
return {
|
|
116
|
-
...newFilters,
|
|
146
|
+
return _objectSpread(_objectSpread({}, newFilters), {}, {
|
|
117
147
|
format
|
|
118
|
-
};
|
|
148
|
+
});
|
|
119
149
|
};
|
|
150
|
+
|
|
120
151
|
this.firstLoad = true;
|
|
121
|
-
this.format =
|
|
122
|
-
if (init)
|
|
123
|
-
|
|
124
|
-
const mainGroup = this.createNewGroup("main");
|
|
152
|
+
this.format = _format;
|
|
153
|
+
if (init) return this.initSetupUp(init);
|
|
154
|
+
const mainGroup = this.createNewGroup('main');
|
|
125
155
|
this.mapGroups = {
|
|
126
156
|
[mainGroup.idGroup]: mainGroup
|
|
127
157
|
};
|
|
128
158
|
this.main = mainGroup.idGroup;
|
|
129
159
|
this.addFilter(mainGroup.idGroup);
|
|
130
160
|
}
|
|
161
|
+
|
|
131
162
|
initSetupUp(init) {
|
|
132
163
|
this.step = init.step || 1;
|
|
133
|
-
Object.keys(init).forEach(
|
|
134
|
-
if (init[key] && this[key] !==
|
|
135
|
-
this[key] = init[key];
|
|
164
|
+
Object.keys(init).forEach(key => {
|
|
165
|
+
if (init[key] && this[key] !== undefined) this[key] = init[key];
|
|
136
166
|
});
|
|
137
167
|
}
|
|
168
|
+
|
|
138
169
|
}
|
|
139
|
-
|
|
140
|
-
export {
|
|
141
|
-
store_default as default
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=store.js.map
|
|
170
|
+
|
|
171
|
+
export { QueryBuilderStore as default };
|
|
@@ -1,63 +1,52 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const QB_FIELD_TYPES = {
|
|
3
|
-
LOAN_VALUES:
|
|
4
|
-
LTV_VALUES:
|
|
5
|
-
SUBJECT_VALUES:
|
|
6
|
-
LAST_VALUES:
|
|
7
|
-
CREDIT_VALUES:
|
|
2
|
+
LOAN_VALUES: 'loanValues',
|
|
3
|
+
LTV_VALUES: 'ltvValues',
|
|
4
|
+
SUBJECT_VALUES: 'subjectValues',
|
|
5
|
+
LAST_VALUES: 'lastValues',
|
|
6
|
+
CREDIT_VALUES: 'creditValues'
|
|
8
7
|
};
|
|
9
8
|
const QB_OPERATOR_TYPES = {
|
|
10
|
-
EQUAL:
|
|
11
|
-
NOT_EQUAL:
|
|
12
|
-
GREATER_THAN:
|
|
13
|
-
LESS_THAN:
|
|
14
|
-
CONTAINS:
|
|
15
|
-
NOT_CONTAINS:
|
|
16
|
-
BETWEEN:
|
|
17
|
-
GREATER_THAN_OR_EQUAL:
|
|
18
|
-
LESS_THAN_OR_EQUAL:
|
|
19
|
-
START_WITH:
|
|
9
|
+
EQUAL: 'equal',
|
|
10
|
+
NOT_EQUAL: 'notEqual',
|
|
11
|
+
GREATER_THAN: 'greaterThan',
|
|
12
|
+
LESS_THAN: 'lessThan',
|
|
13
|
+
CONTAINS: 'contains',
|
|
14
|
+
NOT_CONTAINS: 'notNontains',
|
|
15
|
+
BETWEEN: 'between',
|
|
16
|
+
GREATER_THAN_OR_EQUAL: 'greaterThanOrEquals',
|
|
17
|
+
LESS_THAN_OR_EQUAL: 'lessThanOrEquals',
|
|
18
|
+
START_WITH: 'startsWith'
|
|
20
19
|
};
|
|
21
20
|
const QB_GROUP_CONDITION_TYPES = {
|
|
22
21
|
AND: true,
|
|
23
22
|
OR: false
|
|
24
23
|
};
|
|
25
24
|
const QB_DRAG_TYPES = {
|
|
26
|
-
FILTER:
|
|
27
|
-
GROUP:
|
|
25
|
+
FILTER: 'filter',
|
|
26
|
+
GROUP: 'group'
|
|
28
27
|
};
|
|
29
28
|
const QB_DRAG_LOCATIONS = {
|
|
30
|
-
ABOVE:
|
|
31
|
-
BELOW:
|
|
29
|
+
ABOVE: 'above',
|
|
30
|
+
BELOW: 'below'
|
|
32
31
|
};
|
|
33
32
|
const QB_EXPORT_FORMAT_TYPES = {
|
|
34
|
-
DEFAULT:
|
|
35
|
-
XML:
|
|
36
|
-
SQL:
|
|
37
|
-
SAFESQL:
|
|
33
|
+
DEFAULT: 'defaultFormat',
|
|
34
|
+
XML: 'xmlFormat',
|
|
35
|
+
SQL: 'sqlFormat',
|
|
36
|
+
SAFESQL: 'sqlSafeFormat'
|
|
38
37
|
};
|
|
39
38
|
const QB_ADD_FILTER_METHOD_TYPES = {
|
|
40
|
-
IN_PLACE:
|
|
41
|
-
APPEND:
|
|
39
|
+
IN_PLACE: 'inplace',
|
|
40
|
+
APPEND: 'append'
|
|
42
41
|
};
|
|
43
42
|
const QB_GROUP_FILTER_METHOD_TYPES = {
|
|
44
|
-
IN_PLACE:
|
|
45
|
-
APPEND:
|
|
43
|
+
IN_PLACE: 'inplace',
|
|
44
|
+
APPEND: 'append'
|
|
46
45
|
};
|
|
47
46
|
const QB_FIELD_SHARED_ACTIONS = {
|
|
48
|
-
RESET_FIELD:
|
|
49
|
-
RESET_OPERATOR:
|
|
50
|
-
RESET_VALUE:
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
QB_DRAG_LOCATIONS,
|
|
55
|
-
QB_DRAG_TYPES,
|
|
56
|
-
QB_EXPORT_FORMAT_TYPES,
|
|
57
|
-
QB_FIELD_SHARED_ACTIONS,
|
|
58
|
-
QB_FIELD_TYPES,
|
|
59
|
-
QB_GROUP_CONDITION_TYPES,
|
|
60
|
-
QB_GROUP_FILTER_METHOD_TYPES,
|
|
61
|
-
QB_OPERATOR_TYPES
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=types.js.map
|
|
47
|
+
RESET_FIELD: 'resetField',
|
|
48
|
+
RESET_OPERATOR: 'resetOperator',
|
|
49
|
+
RESET_VALUE: 'resetValue'
|
|
50
|
+
};
|
|
51
|
+
|
|
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 };
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export {
|
|
5
|
-
default2 as default
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DSQueryBuilder, DSQueryBuilderWithSchema, DSQueryBuilder as default } from './DSQueryBuilder.js';
|
|
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
|
+
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
|
+
export { default as QueryBuilderFormat } from './components/format/format.js';
|