@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,22 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
11
|
+
import { QB_DRAG_TYPES, QB_GROUP_CONDITION_TYPES, QB_FIELD_SHARED_ACTIONS } from './types.js';
|
|
12
|
+
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
/**
|
|
17
|
+
* this is injected. instance of QBStore
|
|
18
|
+
*
|
|
19
|
+
* @param {*} idGroup: UUID
|
|
20
|
+
* @param idGroup
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const createNewFilter = function (idGroup) {
|
|
24
|
+
const idFilter = "filter_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
9
25
|
return {
|
|
10
26
|
idGroup,
|
|
11
|
-
field:
|
|
12
|
-
condition:
|
|
13
|
-
value:
|
|
27
|
+
field: '',
|
|
28
|
+
condition: '',
|
|
29
|
+
value: '',
|
|
14
30
|
idFilter,
|
|
15
31
|
type: QB_DRAG_TYPES.FILTER
|
|
16
32
|
};
|
|
17
33
|
};
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
/**
|
|
35
|
+
* this is injected. instance of QBStore
|
|
36
|
+
*
|
|
37
|
+
* @param {*} parentIdGroup: UUID
|
|
38
|
+
* @param parentIdGroup
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const createNewGroup = function (parentIdGroup) {
|
|
42
|
+
const idGroup = "group_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
20
43
|
return {
|
|
21
44
|
parentIdGroup,
|
|
22
45
|
idGroup,
|
|
@@ -24,106 +47,140 @@ const createNewGroup = function(parentIdGroup) {
|
|
|
24
47
|
type: QB_DRAG_TYPES.GROUP
|
|
25
48
|
};
|
|
26
49
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
/**
|
|
51
|
+
* this is injected. instance of QBStore
|
|
52
|
+
*
|
|
53
|
+
* @param {*} newFilter
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
const addFilterToMap = function (newFilter) {
|
|
57
|
+
this.mapFilters = _objectSpread(_objectSpread({}, this.mapFilters), {}, {
|
|
30
58
|
[newFilter.idFilter]: newFilter
|
|
31
|
-
};
|
|
59
|
+
});
|
|
32
60
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
61
|
+
/**
|
|
62
|
+
* this is injected. instance of QBStore
|
|
63
|
+
*
|
|
64
|
+
* @param {*} newFilter
|
|
65
|
+
* @param newGroup
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
const addGroupToMap = function (newGroup) {
|
|
69
|
+
this.mapGroups = _objectSpread(_objectSpread({}, this.mapGroups), {}, {
|
|
70
|
+
[newGroup.idGroup]: _objectSpread({}, newGroup)
|
|
71
|
+
});
|
|
40
72
|
};
|
|
41
|
-
const addFilterToItem = function(item, newFilter) {
|
|
73
|
+
const addFilterToItem = function (item, newFilter) {
|
|
42
74
|
item.children.push({
|
|
43
75
|
id: newFilter.idFilter,
|
|
44
76
|
element: newFilter,
|
|
45
77
|
children: []
|
|
46
78
|
});
|
|
47
79
|
};
|
|
48
|
-
const addFilterToMainItem = function(items, newFilter) {
|
|
80
|
+
const addFilterToMainItem = function (items, newFilter) {
|
|
49
81
|
items.push({
|
|
50
82
|
id: newFilter.idFilter,
|
|
51
83
|
element: newFilter,
|
|
52
84
|
children: []
|
|
53
85
|
});
|
|
54
86
|
};
|
|
55
|
-
const findInChilds = function(childs, filterId) {
|
|
56
|
-
const found = childs.find(
|
|
87
|
+
const findInChilds = function (childs, filterId) {
|
|
88
|
+
const found = childs.find(_ref => {
|
|
89
|
+
let {
|
|
90
|
+
id
|
|
91
|
+
} = _ref;
|
|
92
|
+
return id === filterId;
|
|
93
|
+
});
|
|
94
|
+
|
|
57
95
|
if (!found) {
|
|
58
96
|
let findInChild;
|
|
59
|
-
childs.forEach(
|
|
60
|
-
if (!findInChild)
|
|
61
|
-
findInChild = findInChilds(item.children, filterId);
|
|
97
|
+
childs.forEach(item => {
|
|
98
|
+
if (!findInChild) findInChild = findInChilds(item.children, filterId);
|
|
62
99
|
});
|
|
63
|
-
if (findInChild)
|
|
64
|
-
return findInChild;
|
|
100
|
+
if (findInChild) return findInChild;
|
|
65
101
|
}
|
|
102
|
+
|
|
66
103
|
return found;
|
|
67
104
|
};
|
|
68
|
-
const findItemFilterById = function(filterId) {
|
|
105
|
+
const findItemFilterById = function (filterId) {
|
|
69
106
|
return findInChilds(this.items, filterId);
|
|
70
107
|
};
|
|
71
|
-
const findParentWithFilterId = function(childs, filterId) {
|
|
72
|
-
const found = childs.find(
|
|
108
|
+
const findParentWithFilterId = function (childs, filterId) {
|
|
109
|
+
const found = childs.find(_ref2 => {
|
|
110
|
+
let {
|
|
111
|
+
id
|
|
112
|
+
} = _ref2;
|
|
113
|
+
return id === filterId;
|
|
114
|
+
});
|
|
115
|
+
|
|
73
116
|
if (!found) {
|
|
74
117
|
let findInChild;
|
|
75
|
-
childs.forEach(
|
|
76
|
-
if (!findInChild)
|
|
77
|
-
findInChild = findParentWithFilterId(item.children, filterId);
|
|
118
|
+
childs.forEach(item => {
|
|
119
|
+
if (!findInChild) findInChild = findParentWithFilterId(item.children, filterId);
|
|
78
120
|
});
|
|
79
|
-
if (findInChild)
|
|
80
|
-
return findInChild;
|
|
121
|
+
if (findInChild) return findInChild;
|
|
81
122
|
}
|
|
123
|
+
|
|
82
124
|
return childs;
|
|
83
125
|
};
|
|
84
|
-
const findParentFilterById = function(filterId) {
|
|
126
|
+
const findParentFilterById = function (filterId) {
|
|
85
127
|
return findParentWithFilterId(this.items, filterId);
|
|
86
128
|
};
|
|
87
|
-
const filterInChildren = function(childs, filterId, mainId) {
|
|
129
|
+
const filterInChildren = function (childs, filterId, mainId) {
|
|
88
130
|
if (childs.children) {
|
|
89
|
-
childs.children = childs.children.filter(
|
|
90
|
-
|
|
131
|
+
childs.children = childs.children.filter(_ref3 => {
|
|
132
|
+
let {
|
|
133
|
+
id
|
|
134
|
+
} = _ref3;
|
|
135
|
+
return id !== filterId;
|
|
136
|
+
});
|
|
137
|
+
childs.children = childs.children.forEach(item => filterInChildren(item.children, filterId));
|
|
91
138
|
return childs;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
139
|
+
} // main
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if (childs.length > 1) childs = childs.filter(_ref4 => {
|
|
143
|
+
let {
|
|
144
|
+
id
|
|
145
|
+
} = _ref4;
|
|
146
|
+
return id !== filterId;
|
|
147
|
+
}); // https://jira.elliemae.io/browse/PUI-1252
|
|
148
|
+
|
|
95
149
|
if (childs.length === 0 && mainId) {
|
|
96
150
|
const emptyFilter = createNewFilter.call(this, mainId);
|
|
97
151
|
addFilterToMainItem.call(this, childs, emptyFilter);
|
|
98
152
|
}
|
|
99
|
-
|
|
153
|
+
|
|
154
|
+
childs.forEach(item => item.children = filterInChildren(item.children, filterId));
|
|
100
155
|
return childs;
|
|
101
156
|
};
|
|
102
|
-
const removeFilterItem = function(filterId) {
|
|
157
|
+
const removeFilterItem = function (filterId) {
|
|
103
158
|
this.items = filterInChildren(this.items, filterId, this.main);
|
|
104
159
|
};
|
|
105
|
-
const addGroupFilterToItem = function(idGroup, idFilter, newGroup) {
|
|
160
|
+
const addGroupFilterToItem = function (idGroup, idFilter, newGroup) {
|
|
106
161
|
const child = findItemFilterById.call(this, idFilter);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (copy.element.type ===
|
|
162
|
+
|
|
163
|
+
const copy = _objectSpread({}, child);
|
|
164
|
+
|
|
165
|
+
if (copy.element.type === 'group') {
|
|
111
166
|
copy.element.parentIdGroup = newGroup.idGroup;
|
|
112
167
|
} else {
|
|
113
168
|
copy.element.idGroup = newGroup.idGroup;
|
|
114
169
|
}
|
|
170
|
+
|
|
115
171
|
child.id = newGroup.idGroup;
|
|
116
172
|
child.element = newGroup;
|
|
117
173
|
child.children = [copy];
|
|
118
174
|
};
|
|
119
|
-
const unGroupFilterToItem = function(idGroup) {
|
|
175
|
+
const unGroupFilterToItem = function (idGroup) {
|
|
120
176
|
const group = findItemFilterById.call(this, idGroup);
|
|
177
|
+
|
|
121
178
|
if (group.element.parentIdGroup === this.main) {
|
|
122
|
-
const index = this.items.map(
|
|
179
|
+
const index = this.items.map(item => item.id).indexOf(idGroup);
|
|
123
180
|
const tmp = [];
|
|
124
181
|
tmp.splice.apply(this.items, [index, 1].concat(group.children));
|
|
125
|
-
this.items.forEach(
|
|
126
|
-
if (item.element.type ===
|
|
182
|
+
this.items.forEach(item => {
|
|
183
|
+
if (item.element.type === 'group') {
|
|
127
184
|
item.element.parentIdGroup = this.main;
|
|
128
185
|
} else {
|
|
129
186
|
item.element.idGroup = this.main;
|
|
@@ -131,11 +188,11 @@ const unGroupFilterToItem = function(idGroup) {
|
|
|
131
188
|
});
|
|
132
189
|
} else {
|
|
133
190
|
const parent = findItemFilterById.call(this, group.element.parentIdGroup);
|
|
134
|
-
const index = parent.children.map(
|
|
191
|
+
const index = parent.children.map(item => item.id).indexOf(idGroup);
|
|
135
192
|
const tmp = [];
|
|
136
193
|
tmp.splice.apply(parent.children, [index, 1].concat(group.children));
|
|
137
|
-
parent.children.forEach(
|
|
138
|
-
if (item.element.type ===
|
|
194
|
+
parent.children.forEach(item => {
|
|
195
|
+
if (item.element.type === 'group') {
|
|
139
196
|
item.element.parentIdGroup = parent.id;
|
|
140
197
|
} else {
|
|
141
198
|
item.element.idGroup = parent.id;
|
|
@@ -143,75 +200,55 @@ const unGroupFilterToItem = function(idGroup) {
|
|
|
143
200
|
});
|
|
144
201
|
}
|
|
145
202
|
};
|
|
146
|
-
const changeGroupOperator = function(idGroup, value) {
|
|
203
|
+
const changeGroupOperator = function (idGroup, value) {
|
|
147
204
|
const group = findItemFilterById.call(this, idGroup);
|
|
205
|
+
|
|
148
206
|
if (idGroup !== this.main) {
|
|
149
207
|
group.element.condition = value;
|
|
150
208
|
}
|
|
151
209
|
};
|
|
152
|
-
const changeFilterItem = function({
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
210
|
+
const changeFilterItem = function (_ref5) {
|
|
211
|
+
let {
|
|
212
|
+
idFilter,
|
|
213
|
+
field,
|
|
214
|
+
value,
|
|
215
|
+
operator,
|
|
216
|
+
additionalInfo,
|
|
217
|
+
target,
|
|
218
|
+
fieldsSharedActions: {
|
|
219
|
+
onFieldChange,
|
|
220
|
+
onOperatorChange,
|
|
221
|
+
onValueChange
|
|
222
|
+
}
|
|
223
|
+
} = _ref5;
|
|
161
224
|
const child = findItemFilterById.call(this, idFilter);
|
|
162
|
-
if (field || field ===
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (action === QB_FIELD_SHARED_ACTIONS.RESET_FIELD)
|
|
173
|
-
child.element.field = null;
|
|
174
|
-
else if (action === QB_FIELD_SHARED_ACTIONS.RESET_OPERATOR)
|
|
175
|
-
child.element.operator = null;
|
|
176
|
-
else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE)
|
|
177
|
-
child.element.value = null;
|
|
225
|
+
if (field || field === '' || typeof field === 'boolean') child.element.field = field;
|
|
226
|
+
if (operator) child.element.operator = operator;
|
|
227
|
+
if (value || value === '' || typeof value === 'boolean') child.element.value = value;
|
|
228
|
+
if (additionalInfo) child.element.additionalInfo = additionalInfo; // shared fields actions
|
|
229
|
+
|
|
230
|
+
if (target === 'field') {
|
|
231
|
+
onFieldChange.forEach(_ref6 => {
|
|
232
|
+
let {
|
|
233
|
+
action
|
|
234
|
+
} = _ref6;
|
|
235
|
+
if (action === QB_FIELD_SHARED_ACTIONS.RESET_FIELD) child.element.field = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_OPERATOR) child.element.operator = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE) child.element.value = null;
|
|
178
236
|
});
|
|
179
|
-
} else if (target ===
|
|
180
|
-
onOperatorChange.forEach(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE)
|
|
186
|
-
child.element.value = null;
|
|
237
|
+
} else if (target === 'operator') {
|
|
238
|
+
onOperatorChange.forEach(_ref7 => {
|
|
239
|
+
let {
|
|
240
|
+
action
|
|
241
|
+
} = _ref7;
|
|
242
|
+
if (action === QB_FIELD_SHARED_ACTIONS.RESET_FIELD) child.element.field = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_OPERATOR) child.element.operator = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE) child.element.value = null;
|
|
187
243
|
});
|
|
188
|
-
} else if (target ===
|
|
189
|
-
onValueChange.forEach(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE)
|
|
195
|
-
child.element.value = null;
|
|
244
|
+
} else if (target === 'value') {
|
|
245
|
+
onValueChange.forEach(_ref8 => {
|
|
246
|
+
let {
|
|
247
|
+
action
|
|
248
|
+
} = _ref8;
|
|
249
|
+
if (action === QB_FIELD_SHARED_ACTIONS.RESET_FIELD) child.element.field = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_OPERATOR) child.element.operator = null;else if (action === QB_FIELD_SHARED_ACTIONS.RESET_VALUE) child.element.value = null;
|
|
196
250
|
});
|
|
197
251
|
}
|
|
198
252
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
addFilterToMainItem,
|
|
202
|
-
addFilterToMap,
|
|
203
|
-
addGroupFilterToItem,
|
|
204
|
-
addGroupToMap,
|
|
205
|
-
changeFilterItem,
|
|
206
|
-
changeGroupOperator,
|
|
207
|
-
createNewFilter,
|
|
208
|
-
createNewGroup,
|
|
209
|
-
filterInChildren,
|
|
210
|
-
findInChilds,
|
|
211
|
-
findItemFilterById,
|
|
212
|
-
findParentFilterById,
|
|
213
|
-
findParentWithFilterId,
|
|
214
|
-
removeFilterItem,
|
|
215
|
-
unGroupFilterToItem
|
|
216
|
-
};
|
|
217
|
-
//# sourceMappingURL=actions.js.map
|
|
253
|
+
|
|
254
|
+
export { addFilterToItem, addFilterToMainItem, addFilterToMap, addGroupFilterToItem, addGroupToMap, changeFilterItem, changeGroupOperator, createNewFilter, createNewGroup, filterInChildren, findInChilds, findItemFilterById, findParentFilterById, findParentWithFilterId, removeFilterItem, unGroupFilterToItem };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const DELAY_CLOSE = 0.1;
|
|
3
2
|
const DELAY_OPEN = 0.1;
|
|
4
3
|
const TOOLBAR_ANIMATION_DURATION = 50;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DELAY_OPEN,
|
|
8
|
-
TOOLBAR_ANIMATION_DURATION
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=constants.js.map
|
|
4
|
+
|
|
5
|
+
export { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION };
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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';
|
|
8
|
+
import { get } from 'lodash';
|
|
9
|
+
import * as operators from '@elliemae/ds-utilities/operators';
|
|
10
|
+
import { QB_GROUP_CONDITION_TYPES } from './types.js';
|
|
11
|
+
|
|
12
|
+
const resolveCondition = function (condition, state) {
|
|
13
|
+
let resolveBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QB_GROUP_CONDITION_TYPES.AND;
|
|
14
|
+
if (condition.length === 0 || !condition) return true; // resolve by AND: all the conditions must be true
|
|
15
|
+
|
|
8
16
|
if (resolveBy) {
|
|
9
|
-
return condition.every(
|
|
17
|
+
return condition.every(rule => {
|
|
10
18
|
const {
|
|
11
19
|
source: sourceRule,
|
|
12
20
|
operator: operatorRule,
|
|
13
21
|
value: valueRule
|
|
14
22
|
} = rule;
|
|
15
|
-
if (typeof operatorRule === "function")
|
|
16
|
-
return operatorRule(get(state, sourceRule), valueRule);
|
|
23
|
+
if (typeof operatorRule === "function") return operatorRule(get(state, sourceRule), valueRule);
|
|
17
24
|
return operators[operatorRule](get(state, sourceRule), valueRule);
|
|
18
25
|
});
|
|
19
|
-
}
|
|
20
|
-
|
|
26
|
+
} // resolve by OR: at least one condition must be true
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return condition.some(rule => {
|
|
21
30
|
const {
|
|
22
31
|
source: sourceRule,
|
|
23
32
|
operator: operatorRule,
|
|
@@ -26,15 +35,26 @@ const resolveCondition = (condition, state, resolveBy = QB_GROUP_CONDITION_TYPES
|
|
|
26
35
|
return operators[operatorRule](state[sourceRule], valueRule);
|
|
27
36
|
});
|
|
28
37
|
};
|
|
38
|
+
|
|
29
39
|
const resolveDependencies = (state, fields) => {
|
|
30
|
-
const fieldsToRender = fields.reduce((result,
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
const fieldsToRender = fields.reduce((result, _ref) => {
|
|
41
|
+
let {
|
|
42
|
+
target,
|
|
43
|
+
component,
|
|
44
|
+
condition,
|
|
45
|
+
resolveBy,
|
|
46
|
+
validation,
|
|
47
|
+
handleWidth
|
|
48
|
+
} = _ref;
|
|
49
|
+
if (resolveCondition(condition, state, resolveBy)) result.push({
|
|
50
|
+
target,
|
|
51
|
+
component,
|
|
52
|
+
validation,
|
|
53
|
+
handleWidth
|
|
54
|
+
});
|
|
33
55
|
return result;
|
|
34
56
|
}, []);
|
|
35
57
|
return fieldsToRender;
|
|
36
58
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=dependencies.js.map
|
|
59
|
+
|
|
60
|
+
export { resolveDependencies };
|