@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,18 +1,20 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
1
3
|
import { QB_OPERATOR_TYPES } from '../helpers/types.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
const conditionSql = (condition, value) => {
|
|
6
|
+
const {
|
|
7
|
+
EQUAL,
|
|
8
|
+
NOT_EQUAL,
|
|
9
|
+
GREATER_THAN,
|
|
10
|
+
LESS_THAN,
|
|
11
|
+
CONTAINS,
|
|
12
|
+
NOT_CONTAINS,
|
|
13
|
+
BETWEEN,
|
|
14
|
+
GREATER_THAN_OR_EQUAL,
|
|
15
|
+
LESS_THAN_OR_EQUAL,
|
|
16
|
+
START_WITH
|
|
17
|
+
} = QB_OPERATOR_TYPES;
|
|
16
18
|
if (condition === EQUAL) return " = '".concat(value, "'");
|
|
17
19
|
if (condition === NOT_EQUAL) return " <> '".concat(value, "'");
|
|
18
20
|
if (condition === GREATER_THAN) return " > ".concat(value);
|
|
@@ -26,41 +28,42 @@ var conditionSql = function conditionSql(condition, value) {
|
|
|
26
28
|
return condition;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const renderFilterSQl = filter => {
|
|
32
|
+
const {
|
|
33
|
+
field,
|
|
34
|
+
operator,
|
|
35
|
+
value
|
|
36
|
+
} = filter.element;
|
|
34
37
|
return "".concat(field, " ").concat(conditionSql(operator, value) || '');
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const sqlFormat = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
main,
|
|
43
|
+
mapGroups,
|
|
44
|
+
items
|
|
45
|
+
} = _ref;
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
const groupSql = (item, idGroup) => {
|
|
43
48
|
if (idGroup === main) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return " ( ".concat(filterSql(item, _groupCondition), " ) "); // eslint-disable-line
|
|
49
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
50
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
50
54
|
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
51
55
|
};
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
const filterSql = (filters, groupCondition) => {
|
|
58
|
+
const filterGroup = filters.map(filter => {
|
|
55
59
|
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
56
60
|
return " ".concat(groupSql(filter) || '', " ");
|
|
57
61
|
});
|
|
58
62
|
return filterGroup.join(groupCondition);
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
62
66
|
return sql;
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
export { sqlFormat };
|
|
66
|
-
//# sourceMappingURL=sqlFormat.js.map
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
1
3
|
import { QB_OPERATOR_TYPES } from '../helpers/types.js';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
const specialChar = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
const conditionSql = (condition, value) => {
|
|
8
|
+
const {
|
|
9
|
+
EQUAL,
|
|
10
|
+
NOT_EQUAL,
|
|
11
|
+
GREATER_THAN,
|
|
12
|
+
LESS_THAN,
|
|
13
|
+
CONTAINS,
|
|
14
|
+
NOT_CONTAINS,
|
|
15
|
+
BETWEEN,
|
|
16
|
+
GREATER_THAN_OR_EQUAL,
|
|
17
|
+
LESS_THAN_OR_EQUAL,
|
|
18
|
+
START_WITH
|
|
19
|
+
} = QB_OPERATOR_TYPES; // eslint-disable-next-line no-restricted-globals
|
|
6
20
|
|
|
7
|
-
|
|
8
|
-
var EQUAL = QB_OPERATOR_TYPES.EQUAL,
|
|
9
|
-
NOT_EQUAL = QB_OPERATOR_TYPES.NOT_EQUAL,
|
|
10
|
-
GREATER_THAN = QB_OPERATOR_TYPES.GREATER_THAN,
|
|
11
|
-
LESS_THAN = QB_OPERATOR_TYPES.LESS_THAN,
|
|
12
|
-
CONTAINS = QB_OPERATOR_TYPES.CONTAINS,
|
|
13
|
-
NOT_CONTAINS = QB_OPERATOR_TYPES.NOT_CONTAINS,
|
|
14
|
-
BETWEEN = QB_OPERATOR_TYPES.BETWEEN,
|
|
15
|
-
GREATER_THAN_OR_EQUAL = QB_OPERATOR_TYPES.GREATER_THAN_OR_EQUAL,
|
|
16
|
-
LESS_THAN_OR_EQUAL = QB_OPERATOR_TYPES.LESS_THAN_OR_EQUAL,
|
|
17
|
-
START_WITH = QB_OPERATOR_TYPES.START_WITH; // eslint-disable-next-line no-restricted-globals
|
|
18
|
-
|
|
19
|
-
var valueDisplay = isNaN(value) ? "'".concat(value, "'") : value;
|
|
21
|
+
const valueDisplay = isNaN(value) ? "'".concat(value, "'") : value;
|
|
20
22
|
if (condition === EQUAL) return " = ".concat(valueDisplay);
|
|
21
23
|
if (condition === NOT_EQUAL) return " <> ".concat(valueDisplay);
|
|
22
24
|
if (condition === GREATER_THAN) return " > ".concat(valueDisplay);
|
|
@@ -30,44 +32,45 @@ var conditionSql = function conditionSql(condition, value) {
|
|
|
30
32
|
return condition;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const renderFilterSQl = filter => {
|
|
36
|
+
const {
|
|
37
|
+
field,
|
|
38
|
+
operator,
|
|
39
|
+
value
|
|
40
|
+
} = filter.element; // eslint-disable-next-line no-restricted-globals
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
const fieldDisplay = // eslint-disable-next-line no-restricted-globals
|
|
40
43
|
/[.]/.test(field) || !isNaN(field) ? "\\\"".concat(field, "\\\"") : field;
|
|
41
44
|
return "".concat(fieldDisplay, " ").concat(conditionSql(operator, value) || '');
|
|
42
45
|
};
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const sqlSafeFormat = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
main,
|
|
50
|
+
mapGroups,
|
|
51
|
+
items
|
|
52
|
+
} = _ref;
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
const groupSql = (item, idGroup) => {
|
|
50
55
|
if (idGroup === main) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return " ( ".concat(filterSql(item, _groupCondition), " ) "); // eslint-disable-line
|
|
56
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
57
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
57
61
|
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
58
62
|
};
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
const filterSql = (filters, groupCondition) => {
|
|
65
|
+
const filterGroup = filters.map(filter => {
|
|
62
66
|
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
63
67
|
return " ".concat(groupSql(filter) || '', " ");
|
|
64
68
|
});
|
|
65
69
|
return filterGroup.join(groupCondition);
|
|
66
70
|
};
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
69
73
|
return sql;
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
export { specialChar, sqlSafeFormat };
|
|
73
|
-
//# sourceMappingURL=sqlSafeFormat.js.map
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
1
3
|
import { QB_OPERATOR_TYPES } from '../helpers/types.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
const conditionSql = (condition, value) => {
|
|
6
|
+
const {
|
|
7
|
+
EQUAL,
|
|
8
|
+
NOT_EQUAL,
|
|
9
|
+
GREATER_THAN,
|
|
10
|
+
LESS_THAN,
|
|
11
|
+
CONTAINS,
|
|
12
|
+
NOT_CONTAINS,
|
|
13
|
+
BETWEEN,
|
|
14
|
+
GREATER_THAN_OR_EQUAL,
|
|
15
|
+
LESS_THAN_OR_EQUAL,
|
|
16
|
+
START_WITH
|
|
17
|
+
} = QB_OPERATOR_TYPES;
|
|
16
18
|
if (condition === EQUAL) return "<condition>EQUAL</condition><value>".concat(value, "</value>");
|
|
17
19
|
if (condition === NOT_EQUAL) return "<condition>NOT_EQUAL</condition><value>".concat(value, "</value>");
|
|
18
20
|
if (condition === GREATER_THAN) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
|
|
@@ -26,41 +28,42 @@ var conditionSql = function conditionSql(condition, value) {
|
|
|
26
28
|
return condition;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const renderFilterSQl = filter => {
|
|
32
|
+
const {
|
|
33
|
+
field,
|
|
34
|
+
operator,
|
|
35
|
+
value
|
|
36
|
+
} = filter.element;
|
|
34
37
|
return "<filter><field>".concat(field, "</field>").concat(conditionSql(operator, value) || '', "</filter>");
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const xmlFormat = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
main,
|
|
43
|
+
mapGroups,
|
|
44
|
+
items
|
|
45
|
+
} = _ref;
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
const groupXML = (item, idGroup) => {
|
|
43
48
|
if (idGroup === main) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return "<group value=\"".concat(_groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
|
|
49
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
50
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
50
54
|
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item.children), "</group>"); // eslint-disable-line
|
|
51
55
|
};
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
const filterXML = filters => {
|
|
58
|
+
const filterGroup = filters.map(filter => {
|
|
55
59
|
if (filter.element.type === 'filter') return "".concat(renderFilterSQl(filter) || '', " ");
|
|
56
60
|
return " ".concat(groupXML(filter), " ");
|
|
57
61
|
});
|
|
58
62
|
return filterGroup.join('');
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
|
|
62
66
|
return xml;
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
export { xmlFormat };
|
|
66
|
-
//# sourceMappingURL=xmlFormat.js.map
|
|
@@ -1,4 +1,13 @@
|
|
|
1
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';
|
|
2
11
|
import { QB_DRAG_TYPES, QB_GROUP_CONDITION_TYPES, QB_FIELD_SHARED_ACTIONS } from './types.js';
|
|
3
12
|
|
|
4
13
|
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; }
|
|
@@ -11,14 +20,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
11
20
|
* @param idGroup
|
|
12
21
|
*/
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
const createNewFilter = function (idGroup) {
|
|
24
|
+
const idFilter = "filter_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
16
25
|
return {
|
|
17
|
-
idGroup
|
|
26
|
+
idGroup,
|
|
18
27
|
field: '',
|
|
19
28
|
condition: '',
|
|
20
29
|
value: '',
|
|
21
|
-
idFilter
|
|
30
|
+
idFilter,
|
|
22
31
|
type: QB_DRAG_TYPES.FILTER
|
|
23
32
|
};
|
|
24
33
|
};
|
|
@@ -29,11 +38,11 @@ var createNewFilter = function createNewFilter(idGroup) {
|
|
|
29
38
|
* @param parentIdGroup
|
|
30
39
|
*/
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
const createNewGroup = function (parentIdGroup) {
|
|
42
|
+
const idGroup = "group_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
34
43
|
return {
|
|
35
|
-
parentIdGroup
|
|
36
|
-
idGroup
|
|
44
|
+
parentIdGroup,
|
|
45
|
+
idGroup,
|
|
37
46
|
condition: QB_GROUP_CONDITION_TYPES.AND,
|
|
38
47
|
type: QB_DRAG_TYPES.GROUP
|
|
39
48
|
};
|
|
@@ -44,8 +53,10 @@ var createNewGroup = function createNewGroup(parentIdGroup) {
|
|
|
44
53
|
* @param {*} newFilter
|
|
45
54
|
*/
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
this.mapFilters = _objectSpread(_objectSpread({}, this.mapFilters), {},
|
|
56
|
+
const addFilterToMap = function (newFilter) {
|
|
57
|
+
this.mapFilters = _objectSpread(_objectSpread({}, this.mapFilters), {}, {
|
|
58
|
+
[newFilter.idFilter]: newFilter
|
|
59
|
+
});
|
|
49
60
|
};
|
|
50
61
|
/**
|
|
51
62
|
* this is injected. instance of QBStore
|
|
@@ -54,32 +65,36 @@ var addFilterToMap = function addFilterToMap(newFilter) {
|
|
|
54
65
|
* @param newGroup
|
|
55
66
|
*/
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
this.mapGroups = _objectSpread(_objectSpread({}, this.mapGroups), {},
|
|
68
|
+
const addGroupToMap = function (newGroup) {
|
|
69
|
+
this.mapGroups = _objectSpread(_objectSpread({}, this.mapGroups), {}, {
|
|
70
|
+
[newGroup.idGroup]: _objectSpread({}, newGroup)
|
|
71
|
+
});
|
|
59
72
|
};
|
|
60
|
-
|
|
73
|
+
const addFilterToItem = function (item, newFilter) {
|
|
61
74
|
item.children.push({
|
|
62
75
|
id: newFilter.idFilter,
|
|
63
76
|
element: newFilter,
|
|
64
77
|
children: []
|
|
65
78
|
});
|
|
66
79
|
};
|
|
67
|
-
|
|
80
|
+
const addFilterToMainItem = function (items, newFilter) {
|
|
68
81
|
items.push({
|
|
69
82
|
id: newFilter.idFilter,
|
|
70
83
|
element: newFilter,
|
|
71
84
|
children: []
|
|
72
85
|
});
|
|
73
86
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
const findInChilds = function (childs, filterId) {
|
|
88
|
+
const found = childs.find(_ref => {
|
|
89
|
+
let {
|
|
90
|
+
id
|
|
91
|
+
} = _ref;
|
|
77
92
|
return id === filterId;
|
|
78
93
|
});
|
|
79
94
|
|
|
80
95
|
if (!found) {
|
|
81
|
-
|
|
82
|
-
childs.forEach(
|
|
96
|
+
let findInChild;
|
|
97
|
+
childs.forEach(item => {
|
|
83
98
|
if (!findInChild) findInChild = findInChilds(item.children, filterId);
|
|
84
99
|
});
|
|
85
100
|
if (findInChild) return findInChild;
|
|
@@ -87,18 +102,20 @@ var findInChilds = function findInChilds(childs, filterId) {
|
|
|
87
102
|
|
|
88
103
|
return found;
|
|
89
104
|
};
|
|
90
|
-
|
|
105
|
+
const findItemFilterById = function (filterId) {
|
|
91
106
|
return findInChilds(this.items, filterId);
|
|
92
107
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
const findParentWithFilterId = function (childs, filterId) {
|
|
109
|
+
const found = childs.find(_ref2 => {
|
|
110
|
+
let {
|
|
111
|
+
id
|
|
112
|
+
} = _ref2;
|
|
96
113
|
return id === filterId;
|
|
97
114
|
});
|
|
98
115
|
|
|
99
116
|
if (!found) {
|
|
100
|
-
|
|
101
|
-
childs.forEach(
|
|
117
|
+
let findInChild;
|
|
118
|
+
childs.forEach(item => {
|
|
102
119
|
if (!findInChild) findInChild = findParentWithFilterId(item.children, filterId);
|
|
103
120
|
});
|
|
104
121
|
if (findInChild) return findInChild;
|
|
@@ -106,44 +123,44 @@ var findParentWithFilterId = function findParentWithFilterId(childs, filterId) {
|
|
|
106
123
|
|
|
107
124
|
return childs;
|
|
108
125
|
};
|
|
109
|
-
|
|
126
|
+
const findParentFilterById = function (filterId) {
|
|
110
127
|
return findParentWithFilterId(this.items, filterId);
|
|
111
128
|
};
|
|
112
|
-
|
|
129
|
+
const filterInChildren = function (childs, filterId, mainId) {
|
|
113
130
|
if (childs.children) {
|
|
114
|
-
childs.children = childs.children.filter(
|
|
115
|
-
|
|
131
|
+
childs.children = childs.children.filter(_ref3 => {
|
|
132
|
+
let {
|
|
133
|
+
id
|
|
134
|
+
} = _ref3;
|
|
116
135
|
return id !== filterId;
|
|
117
136
|
});
|
|
118
|
-
childs.children = childs.children.forEach(
|
|
119
|
-
return filterInChildren(item.children, filterId);
|
|
120
|
-
});
|
|
137
|
+
childs.children = childs.children.forEach(item => filterInChildren(item.children, filterId));
|
|
121
138
|
return childs;
|
|
122
139
|
} // main
|
|
123
140
|
|
|
124
141
|
|
|
125
|
-
if (childs.length > 1) childs = childs.filter(
|
|
126
|
-
|
|
142
|
+
if (childs.length > 1) childs = childs.filter(_ref4 => {
|
|
143
|
+
let {
|
|
144
|
+
id
|
|
145
|
+
} = _ref4;
|
|
127
146
|
return id !== filterId;
|
|
128
147
|
}); // https://jira.elliemae.io/browse/PUI-1252
|
|
129
148
|
|
|
130
149
|
if (childs.length === 0 && mainId) {
|
|
131
|
-
|
|
150
|
+
const emptyFilter = createNewFilter.call(this, mainId);
|
|
132
151
|
addFilterToMainItem.call(this, childs, emptyFilter);
|
|
133
152
|
}
|
|
134
153
|
|
|
135
|
-
childs.forEach(
|
|
136
|
-
return item.children = filterInChildren(item.children, filterId);
|
|
137
|
-
});
|
|
154
|
+
childs.forEach(item => item.children = filterInChildren(item.children, filterId));
|
|
138
155
|
return childs;
|
|
139
156
|
};
|
|
140
|
-
|
|
157
|
+
const removeFilterItem = function (filterId) {
|
|
141
158
|
this.items = filterInChildren(this.items, filterId, this.main);
|
|
142
159
|
};
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
const addGroupFilterToItem = function (idGroup, idFilter, newGroup) {
|
|
161
|
+
const child = findItemFilterById.call(this, idFilter);
|
|
145
162
|
|
|
146
|
-
|
|
163
|
+
const copy = _objectSpread({}, child);
|
|
147
164
|
|
|
148
165
|
if (copy.element.type === 'group') {
|
|
149
166
|
copy.element.parentIdGroup = newGroup.idGroup;
|
|
@@ -155,36 +172,26 @@ var addGroupFilterToItem = function addGroupFilterToItem(idGroup, idFilter, newG
|
|
|
155
172
|
child.element = newGroup;
|
|
156
173
|
child.children = [copy];
|
|
157
174
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
var group = findItemFilterById.call(this, idGroup);
|
|
175
|
+
const unGroupFilterToItem = function (idGroup) {
|
|
176
|
+
const group = findItemFilterById.call(this, idGroup);
|
|
162
177
|
|
|
163
178
|
if (group.element.parentIdGroup === this.main) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}).indexOf(idGroup);
|
|
167
|
-
var tmp = [];
|
|
179
|
+
const index = this.items.map(item => item.id).indexOf(idGroup);
|
|
180
|
+
const tmp = [];
|
|
168
181
|
tmp.splice.apply(this.items, [index, 1].concat(group.children));
|
|
169
|
-
this.items.forEach(
|
|
182
|
+
this.items.forEach(item => {
|
|
170
183
|
if (item.element.type === 'group') {
|
|
171
|
-
item.element.parentIdGroup =
|
|
184
|
+
item.element.parentIdGroup = this.main;
|
|
172
185
|
} else {
|
|
173
|
-
item.element.idGroup =
|
|
186
|
+
item.element.idGroup = this.main;
|
|
174
187
|
}
|
|
175
188
|
});
|
|
176
189
|
} else {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var _tmp = [];
|
|
184
|
-
|
|
185
|
-
_tmp.splice.apply(parent.children, [_index, 1].concat(group.children));
|
|
186
|
-
|
|
187
|
-
parent.children.forEach(function (item) {
|
|
190
|
+
const parent = findItemFilterById.call(this, group.element.parentIdGroup);
|
|
191
|
+
const index = parent.children.map(item => item.id).indexOf(idGroup);
|
|
192
|
+
const tmp = [];
|
|
193
|
+
tmp.splice.apply(parent.children, [index, 1].concat(group.children));
|
|
194
|
+
parent.children.forEach(item => {
|
|
188
195
|
if (item.element.type === 'group') {
|
|
189
196
|
item.element.parentIdGroup = parent.id;
|
|
190
197
|
} else {
|
|
@@ -193,47 +200,55 @@ var unGroupFilterToItem = function unGroupFilterToItem(idGroup) {
|
|
|
193
200
|
});
|
|
194
201
|
}
|
|
195
202
|
};
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
const changeGroupOperator = function (idGroup, value) {
|
|
204
|
+
const group = findItemFilterById.call(this, idGroup);
|
|
198
205
|
|
|
199
206
|
if (idGroup !== this.main) {
|
|
200
207
|
group.element.condition = value;
|
|
201
208
|
}
|
|
202
209
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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;
|
|
224
|
+
const child = findItemFilterById.call(this, idFilter);
|
|
215
225
|
if (field || field === '' || typeof field === 'boolean') child.element.field = field;
|
|
216
226
|
if (operator) child.element.operator = operator;
|
|
217
227
|
if (value || value === '' || typeof value === 'boolean') child.element.value = value;
|
|
218
228
|
if (additionalInfo) child.element.additionalInfo = additionalInfo; // shared fields actions
|
|
219
229
|
|
|
220
230
|
if (target === 'field') {
|
|
221
|
-
onFieldChange.forEach(
|
|
222
|
-
|
|
231
|
+
onFieldChange.forEach(_ref6 => {
|
|
232
|
+
let {
|
|
233
|
+
action
|
|
234
|
+
} = _ref6;
|
|
223
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;
|
|
224
236
|
});
|
|
225
237
|
} else if (target === 'operator') {
|
|
226
|
-
onOperatorChange.forEach(
|
|
227
|
-
|
|
238
|
+
onOperatorChange.forEach(_ref7 => {
|
|
239
|
+
let {
|
|
240
|
+
action
|
|
241
|
+
} = _ref7;
|
|
228
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;
|
|
229
243
|
});
|
|
230
244
|
} else if (target === 'value') {
|
|
231
|
-
onValueChange.forEach(
|
|
232
|
-
|
|
245
|
+
onValueChange.forEach(_ref8 => {
|
|
246
|
+
let {
|
|
247
|
+
action
|
|
248
|
+
} = _ref8;
|
|
233
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;
|
|
234
250
|
});
|
|
235
251
|
}
|
|
236
252
|
};
|
|
237
253
|
|
|
238
254
|
export { addFilterToItem, addFilterToMainItem, addFilterToMap, addGroupFilterToItem, addGroupToMap, changeFilterItem, changeGroupOperator, createNewFilter, createNewGroup, filterInChildren, findInChilds, findItemFilterById, findParentFilterById, findParentWithFilterId, removeFilterItem, unGroupFilterToItem };
|
|
239
|
-
//# sourceMappingURL=actions.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const DELAY_CLOSE = 0.1;
|
|
2
|
+
const DELAY_OPEN = 0.1;
|
|
3
|
+
const TOOLBAR_ANIMATION_DURATION = 50;
|
|
4
4
|
|
|
5
5
|
export { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION };
|
|
6
|
-
//# sourceMappingURL=constants.js.map
|