@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,42 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ToolBarAnimation_exports = {};
|
|
29
|
-
__export(ToolBarAnimation_exports, {
|
|
30
|
-
ToolBarAnimation: () => ToolBarAnimation
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_GrowRight = __toESM(require("@elliemae/ds-shared/Animations/GrowRight"));
|
|
35
|
-
const ToolBarAnimation = (props) => /* @__PURE__ */ import_react.default.createElement(import_GrowRight.default, {
|
|
36
|
-
...props,
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var GrowRight = require('@elliemae/ds-shared/Animations/GrowRight');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
|
+
var GrowRight__default = /*#__PURE__*/_interopDefaultLegacy(GrowRight);
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
|
|
23
|
+
const ToolBarAnimation = props => /*#__PURE__*/React.createElement(GrowRight__default["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
37
24
|
key: "popper-animation-key",
|
|
38
25
|
from: 0.5,
|
|
39
26
|
to: 1
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
exports.ToolBarAnimation = ToolBarAnimation;
|
|
@@ -1,59 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var format_exports = {};
|
|
29
|
-
__export(format_exports, {
|
|
30
|
-
default: () => format_default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_sqlFormat = require("./sqlFormat");
|
|
34
|
-
var import_xmlFormat = require("./xmlFormat");
|
|
35
|
-
var import_sqlSafeFormat = require("./sqlSafeFormat");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var sqlFormat = require('./sqlFormat.js');
|
|
4
|
+
var xmlFormat = require('./xmlFormat.js');
|
|
5
|
+
var sqlSafeFormat = require('./sqlSafeFormat.js');
|
|
6
|
+
|
|
36
7
|
class QueryBuilderFormat {
|
|
37
8
|
constructor() {
|
|
38
9
|
this.format = {
|
|
39
|
-
defaultFormat:
|
|
40
|
-
sqlFormat:
|
|
41
|
-
xmlFormat:
|
|
42
|
-
sqlSafeFormat:
|
|
10
|
+
defaultFormat: query => query,
|
|
11
|
+
sqlFormat: sqlFormat.sqlFormat,
|
|
12
|
+
xmlFormat: xmlFormat.xmlFormat,
|
|
13
|
+
sqlSafeFormat: sqlSafeFormat.sqlSafeFormat
|
|
43
14
|
};
|
|
44
|
-
this.currentFormat =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
this.currentFormat = 'sqlFormat';
|
|
16
|
+
|
|
17
|
+
this.setDefaultFormat = formatName => {
|
|
18
|
+
if (this.format[formatName]) this.currentFormat = formatName;
|
|
48
19
|
};
|
|
20
|
+
|
|
49
21
|
this.addFormat = (formatName, format) => this.format[formatName] = format;
|
|
22
|
+
|
|
50
23
|
this.run = (query, formatName) => {
|
|
51
|
-
if (this.format[formatName])
|
|
52
|
-
return this.format[formatName](query);
|
|
24
|
+
if (this.format[formatName]) return this.format[formatName](query);
|
|
53
25
|
return this.format[this.currentFormat](query);
|
|
54
26
|
};
|
|
55
27
|
}
|
|
28
|
+
|
|
56
29
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
30
|
+
|
|
31
|
+
var QueryBuilderFormat$1 = new QueryBuilderFormat();
|
|
32
|
+
|
|
33
|
+
module.exports = QueryBuilderFormat$1;
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var sqlFormat_exports = {};
|
|
29
|
-
__export(sqlFormat_exports, {
|
|
30
|
-
sqlFormat: () => sqlFormat
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_types = require("../helpers/types");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var types = require('../helpers/types.js');
|
|
8
|
+
|
|
34
9
|
const conditionSql = (condition, value) => {
|
|
35
10
|
const {
|
|
36
11
|
EQUAL,
|
|
@@ -43,52 +18,56 @@ const conditionSql = (condition, value) => {
|
|
|
43
18
|
GREATER_THAN_OR_EQUAL,
|
|
44
19
|
LESS_THAN_OR_EQUAL,
|
|
45
20
|
START_WITH
|
|
46
|
-
} =
|
|
47
|
-
if (condition === EQUAL)
|
|
48
|
-
|
|
49
|
-
if (condition ===
|
|
50
|
-
|
|
51
|
-
if (condition ===
|
|
52
|
-
|
|
53
|
-
if (condition ===
|
|
54
|
-
|
|
55
|
-
if (condition ===
|
|
56
|
-
|
|
57
|
-
if (condition === NOT_CONTAINS)
|
|
58
|
-
return ` NOT LIKE '%${value}%'`;
|
|
59
|
-
if (condition === BETWEEN)
|
|
60
|
-
return ` BETWEEN ${value[0]} AND ${value[1]} `;
|
|
61
|
-
if (condition === GREATER_THAN_OR_EQUAL)
|
|
62
|
-
return ` >= ${value}`;
|
|
63
|
-
if (condition === LESS_THAN_OR_EQUAL)
|
|
64
|
-
return ` <= ${value}`;
|
|
65
|
-
if (condition === START_WITH)
|
|
66
|
-
return ` LIKE '${value}%'`;
|
|
21
|
+
} = types.QB_OPERATOR_TYPES;
|
|
22
|
+
if (condition === EQUAL) return " = '".concat(value, "'");
|
|
23
|
+
if (condition === NOT_EQUAL) return " <> '".concat(value, "'");
|
|
24
|
+
if (condition === GREATER_THAN) return " > ".concat(value);
|
|
25
|
+
if (condition === LESS_THAN) return " < ".concat(value);
|
|
26
|
+
if (condition === CONTAINS) return " LIKE '%".concat(value, "%'");
|
|
27
|
+
if (condition === NOT_CONTAINS) return " NOT LIKE '%".concat(value, "%'");
|
|
28
|
+
if (condition === BETWEEN) return " BETWEEN ".concat(value[0], " AND ").concat(value[1], " ");
|
|
29
|
+
if (condition === GREATER_THAN_OR_EQUAL) return " >= ".concat(value);
|
|
30
|
+
if (condition === LESS_THAN_OR_EQUAL) return " <= ".concat(value);
|
|
31
|
+
if (condition === START_WITH) return " LIKE '".concat(value, "%'");
|
|
67
32
|
return condition;
|
|
68
33
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
|
|
35
|
+
const renderFilterSQl = filter => {
|
|
36
|
+
const {
|
|
37
|
+
field,
|
|
38
|
+
operator,
|
|
39
|
+
value
|
|
40
|
+
} = filter.element;
|
|
41
|
+
return "".concat(field, " ").concat(conditionSql(operator, value) || '');
|
|
72
42
|
};
|
|
73
|
-
|
|
43
|
+
|
|
44
|
+
const sqlFormat = _ref => {
|
|
45
|
+
let {
|
|
46
|
+
main,
|
|
47
|
+
mapGroups,
|
|
48
|
+
items
|
|
49
|
+
} = _ref;
|
|
50
|
+
|
|
74
51
|
const groupSql = (item, idGroup) => {
|
|
75
52
|
if (idGroup === main) {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
53
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
54
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
78
55
|
}
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
|
|
57
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
58
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
81
59
|
};
|
|
60
|
+
|
|
82
61
|
const filterSql = (filters, groupCondition) => {
|
|
83
|
-
const filterGroup = filters.map(
|
|
84
|
-
if (filter.element.type === "filter")
|
|
85
|
-
|
|
86
|
-
return ` ${groupSql(filter) || ""} `;
|
|
62
|
+
const filterGroup = filters.map(filter => {
|
|
63
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
64
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
87
65
|
});
|
|
88
66
|
return filterGroup.join(groupCondition);
|
|
89
67
|
};
|
|
90
|
-
|
|
68
|
+
|
|
69
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
91
70
|
return sql;
|
|
92
71
|
};
|
|
93
|
-
|
|
94
|
-
|
|
72
|
+
|
|
73
|
+
exports.sqlFormat = sqlFormat;
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var sqlSafeFormat_exports = {};
|
|
29
|
-
__export(sqlSafeFormat_exports, {
|
|
30
|
-
specialChar: () => specialChar,
|
|
31
|
-
sqlSafeFormat: () => sqlSafeFormat
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_types = require("../helpers/types");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var types = require('../helpers/types.js');
|
|
8
|
+
|
|
35
9
|
const specialChar = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
|
|
10
|
+
|
|
36
11
|
const conditionSql = (condition, value) => {
|
|
37
12
|
const {
|
|
38
13
|
EQUAL,
|
|
@@ -45,54 +20,62 @@ const conditionSql = (condition, value) => {
|
|
|
45
20
|
GREATER_THAN_OR_EQUAL,
|
|
46
21
|
LESS_THAN_OR_EQUAL,
|
|
47
22
|
START_WITH
|
|
48
|
-
} =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (condition === NOT_EQUAL)
|
|
53
|
-
|
|
54
|
-
if (condition ===
|
|
55
|
-
|
|
56
|
-
if (condition ===
|
|
57
|
-
|
|
58
|
-
if (condition ===
|
|
59
|
-
|
|
60
|
-
if (condition ===
|
|
61
|
-
return ` NOT LIKE '%${value}%'`;
|
|
62
|
-
if (condition === BETWEEN)
|
|
63
|
-
return ` BETWEEN ${value[0]} AND ${value[1]} `;
|
|
64
|
-
if (condition === GREATER_THAN_OR_EQUAL)
|
|
65
|
-
return ` >= ${value}`;
|
|
66
|
-
if (condition === LESS_THAN_OR_EQUAL)
|
|
67
|
-
return ` <= ${value}`;
|
|
68
|
-
if (condition === START_WITH)
|
|
69
|
-
return ` LIKE '${value}%'`;
|
|
23
|
+
} = types.QB_OPERATOR_TYPES; // eslint-disable-next-line no-restricted-globals
|
|
24
|
+
|
|
25
|
+
const valueDisplay = isNaN(value) ? "'".concat(value, "'") : value;
|
|
26
|
+
if (condition === EQUAL) return " = ".concat(valueDisplay);
|
|
27
|
+
if (condition === NOT_EQUAL) return " <> ".concat(valueDisplay);
|
|
28
|
+
if (condition === GREATER_THAN) return " > ".concat(valueDisplay);
|
|
29
|
+
if (condition === LESS_THAN) return " < ".concat(valueDisplay);
|
|
30
|
+
if (condition === CONTAINS) return " LIKE '%".concat(value, "%'");
|
|
31
|
+
if (condition === NOT_CONTAINS) return " NOT LIKE '%".concat(value, "%'");
|
|
32
|
+
if (condition === BETWEEN) return " BETWEEN ".concat(value[0], " AND ").concat(value[1], " ");
|
|
33
|
+
if (condition === GREATER_THAN_OR_EQUAL) return " >= ".concat(value);
|
|
34
|
+
if (condition === LESS_THAN_OR_EQUAL) return " <= ".concat(value);
|
|
35
|
+
if (condition === START_WITH) return " LIKE '".concat(value, "%'");
|
|
70
36
|
return condition;
|
|
71
37
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
38
|
+
|
|
39
|
+
const renderFilterSQl = filter => {
|
|
40
|
+
const {
|
|
41
|
+
field,
|
|
42
|
+
operator,
|
|
43
|
+
value
|
|
44
|
+
} = filter.element; // eslint-disable-next-line no-restricted-globals
|
|
45
|
+
|
|
46
|
+
const fieldDisplay = // eslint-disable-next-line no-restricted-globals
|
|
47
|
+
/[.]/.test(field) || !isNaN(field) ? "\\\"".concat(field, "\\\"") : field;
|
|
48
|
+
return "".concat(fieldDisplay, " ").concat(conditionSql(operator, value) || '');
|
|
76
49
|
};
|
|
77
|
-
|
|
50
|
+
|
|
51
|
+
const sqlSafeFormat = _ref => {
|
|
52
|
+
let {
|
|
53
|
+
main,
|
|
54
|
+
mapGroups,
|
|
55
|
+
items
|
|
56
|
+
} = _ref;
|
|
57
|
+
|
|
78
58
|
const groupSql = (item, idGroup) => {
|
|
79
59
|
if (idGroup === main) {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
60
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
61
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
82
62
|
}
|
|
83
|
-
|
|
84
|
-
|
|
63
|
+
|
|
64
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
65
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
85
66
|
};
|
|
67
|
+
|
|
86
68
|
const filterSql = (filters, groupCondition) => {
|
|
87
|
-
const filterGroup = filters.map(
|
|
88
|
-
if (filter.element.type === "filter")
|
|
89
|
-
|
|
90
|
-
return ` ${groupSql(filter) || ""} `;
|
|
69
|
+
const filterGroup = filters.map(filter => {
|
|
70
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
71
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
91
72
|
});
|
|
92
73
|
return filterGroup.join(groupCondition);
|
|
93
74
|
};
|
|
94
|
-
|
|
75
|
+
|
|
76
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
95
77
|
return sql;
|
|
96
78
|
};
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
|
|
80
|
+
exports.specialChar = specialChar;
|
|
81
|
+
exports.sqlSafeFormat = sqlSafeFormat;
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var xmlFormat_exports = {};
|
|
29
|
-
__export(xmlFormat_exports, {
|
|
30
|
-
xmlFormat: () => xmlFormat
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_types = require("../helpers/types");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var types = require('../helpers/types.js');
|
|
8
|
+
|
|
34
9
|
const conditionSql = (condition, value) => {
|
|
35
10
|
const {
|
|
36
11
|
EQUAL,
|
|
@@ -43,52 +18,56 @@ const conditionSql = (condition, value) => {
|
|
|
43
18
|
GREATER_THAN_OR_EQUAL,
|
|
44
19
|
LESS_THAN_OR_EQUAL,
|
|
45
20
|
START_WITH
|
|
46
|
-
} =
|
|
47
|
-
if (condition === EQUAL)
|
|
48
|
-
|
|
49
|
-
if (condition ===
|
|
50
|
-
|
|
51
|
-
if (condition ===
|
|
52
|
-
|
|
53
|
-
if (condition ===
|
|
54
|
-
|
|
55
|
-
if (condition ===
|
|
56
|
-
|
|
57
|
-
if (condition === NOT_CONTAINS)
|
|
58
|
-
return `<condition>NOT_LIKE</condition><value>${value}</value>`;
|
|
59
|
-
if (condition === BETWEEN)
|
|
60
|
-
return `<condition>NOT_LIKE</condition><value><from>${value[0]}</from><to>${value[1]}</to></value>`;
|
|
61
|
-
if (condition === GREATER_THAN_OR_EQUAL)
|
|
62
|
-
return `<condition>GREATER_THAN_OR_EQUAL</condition><value>${value}</value>`;
|
|
63
|
-
if (condition === LESS_THAN_OR_EQUAL)
|
|
64
|
-
return `<condition>LESS_THAN_OR_EQUAL</condition><value>${value}</value>`;
|
|
65
|
-
if (condition === START_WITH)
|
|
66
|
-
return `<condition>GREATER_THAN</condition><value>${value}</value>`;
|
|
21
|
+
} = types.QB_OPERATOR_TYPES;
|
|
22
|
+
if (condition === EQUAL) return "<condition>EQUAL</condition><value>".concat(value, "</value>");
|
|
23
|
+
if (condition === NOT_EQUAL) return "<condition>NOT_EQUAL</condition><value>".concat(value, "</value>");
|
|
24
|
+
if (condition === GREATER_THAN) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
|
|
25
|
+
if (condition === LESS_THAN) return "<condition>LESS_THAN</condition><value>".concat(value, "</value>");
|
|
26
|
+
if (condition === CONTAINS) return "<condition>LIKE</condition><value>".concat(value, "</value>");
|
|
27
|
+
if (condition === NOT_CONTAINS) return "<condition>NOT_LIKE</condition><value>".concat(value, "</value>");
|
|
28
|
+
if (condition === BETWEEN) return "<condition>NOT_LIKE</condition><value><from>".concat(value[0], "</from><to>").concat(value[1], "</to></value>");
|
|
29
|
+
if (condition === GREATER_THAN_OR_EQUAL) return "<condition>GREATER_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
|
|
30
|
+
if (condition === LESS_THAN_OR_EQUAL) return "<condition>LESS_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
|
|
31
|
+
if (condition === START_WITH) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
|
|
67
32
|
return condition;
|
|
68
33
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
|
|
35
|
+
const renderFilterSQl = filter => {
|
|
36
|
+
const {
|
|
37
|
+
field,
|
|
38
|
+
operator,
|
|
39
|
+
value
|
|
40
|
+
} = filter.element;
|
|
41
|
+
return "<filter><field>".concat(field, "</field>").concat(conditionSql(operator, value) || '', "</filter>");
|
|
72
42
|
};
|
|
73
|
-
|
|
43
|
+
|
|
44
|
+
const xmlFormat = _ref => {
|
|
45
|
+
let {
|
|
46
|
+
main,
|
|
47
|
+
mapGroups,
|
|
48
|
+
items
|
|
49
|
+
} = _ref;
|
|
50
|
+
|
|
74
51
|
const groupXML = (item, idGroup) => {
|
|
75
52
|
if (idGroup === main) {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
53
|
+
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
54
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
|
|
78
55
|
}
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
|
|
57
|
+
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
58
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item.children), "</group>"); // eslint-disable-line
|
|
81
59
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
60
|
+
|
|
61
|
+
const filterXML = filters => {
|
|
62
|
+
const filterGroup = filters.map(filter => {
|
|
63
|
+
if (filter.element.type === 'filter') return "".concat(renderFilterSQl(filter) || '', " ");
|
|
64
|
+
return " ".concat(groupXML(filter), " ");
|
|
87
65
|
});
|
|
88
|
-
return filterGroup.join(
|
|
66
|
+
return filterGroup.join('');
|
|
89
67
|
};
|
|
90
|
-
|
|
68
|
+
|
|
69
|
+
const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
|
|
91
70
|
return xml;
|
|
92
71
|
};
|
|
93
|
-
|
|
94
|
-
|
|
72
|
+
|
|
73
|
+
exports.xmlFormat = xmlFormat;
|