@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.
Files changed (141) hide show
  1. package/cjs/DSQueryBuilder.js +97 -117
  2. package/cjs/components/AndOrController/AndOrController.js +162 -148
  3. package/cjs/components/ConditionController/ConditionController.js +72 -88
  4. package/cjs/components/DisplayOutput/DisplayOutput.js +68 -63
  5. package/cjs/components/DragContainerController/DragContainerController.js +41 -61
  6. package/cjs/components/DragControllerRow/DragControllerRow.js +46 -50
  7. package/cjs/components/FieldControllerRow/FieldControllerRow.js +32 -54
  8. package/cjs/components/Nestable/Nestable.js +209 -143
  9. package/cjs/components/Nestable/NestableItem.js +90 -98
  10. package/cjs/components/Nestable/actions/events.js +95 -72
  11. package/cjs/components/Nestable/actions/getItemOptions.js +15 -36
  12. package/cjs/components/Nestable/actions/getPaths.js +51 -46
  13. package/cjs/components/Nestable/actions/index.js +28 -42
  14. package/cjs/components/Nestable/actions/moveItem.js +42 -44
  15. package/cjs/components/Nestable/actions/paths.js +55 -48
  16. package/cjs/components/Nestable/actions/tryDecreaseDepth.js +23 -39
  17. package/cjs/components/Nestable/actions/tryIncreaseDepth.js +26 -39
  18. package/cjs/components/Nestable/index.js +7 -36
  19. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +13 -36
  20. package/cjs/components/QueryBuilderImpl.js +202 -118
  21. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +78 -80
  22. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +211 -154
  23. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +26 -39
  24. package/cjs/components/format/format.js +22 -48
  25. package/cjs/components/format/sqlFormat.js +48 -69
  26. package/cjs/components/format/sqlSafeFormat.js +55 -72
  27. package/cjs/components/format/xmlFormat.js +50 -71
  28. package/cjs/components/helpers/actions.js +186 -151
  29. package/cjs/components/helpers/constants.js +8 -36
  30. package/cjs/components/helpers/dependencies.js +64 -49
  31. package/cjs/components/helpers/selectors.js +101 -161
  32. package/cjs/components/helpers/store.js +104 -86
  33. package/cjs/components/helpers/types.js +44 -72
  34. package/cjs/index.js +29 -36
  35. package/cjs/propTypes.js +94 -102
  36. package/esm/DSQueryBuilder.js +72 -103
  37. package/esm/components/AndOrController/AndOrController.js +147 -113
  38. package/esm/components/ConditionController/ConditionController.js +62 -57
  39. package/esm/components/DisplayOutput/DisplayOutput.js +59 -31
  40. package/esm/components/DragContainerController/DragContainerController.js +35 -32
  41. package/esm/components/DragControllerRow/DragControllerRow.js +38 -21
  42. package/esm/components/FieldControllerRow/FieldControllerRow.js +26 -25
  43. package/esm/components/Nestable/Nestable.js +186 -115
  44. package/esm/components/Nestable/NestableItem.js +82 -69
  45. package/esm/components/Nestable/actions/events.js +79 -45
  46. package/esm/components/Nestable/actions/getItemOptions.js +11 -7
  47. package/esm/components/Nestable/actions/getPaths.js +43 -17
  48. package/esm/components/Nestable/actions/index.js +6 -13
  49. package/esm/components/Nestable/actions/moveItem.js +31 -13
  50. package/esm/components/Nestable/actions/paths.js +47 -19
  51. package/esm/components/Nestable/actions/tryDecreaseDepth.js +19 -10
  52. package/esm/components/Nestable/actions/tryIncreaseDepth.js +22 -10
  53. package/esm/components/Nestable/index.js +2 -7
  54. package/esm/components/QueryBuilderContext/QueryBuilderContext.js +5 -7
  55. package/esm/components/QueryBuilderImpl.js +187 -82
  56. package/esm/components/QueryBuilderItem/QueryBuilderItem.js +70 -50
  57. package/esm/components/QueryBuilderRow/QueryBuilderRow.js +201 -123
  58. package/esm/components/ToolBarAnimation/ToolBarAnimation.js +17 -10
  59. package/esm/components/format/format.js +17 -16
  60. package/esm/components/format/sqlFormat.js +43 -39
  61. package/esm/components/format/sqlSafeFormat.js +50 -43
  62. package/esm/components/format/xmlFormat.js +45 -41
  63. package/esm/components/helpers/actions.js +160 -123
  64. package/esm/components/helpers/constants.js +2 -7
  65. package/esm/components/helpers/dependencies.js +39 -19
  66. package/esm/components/helpers/selectors.js +93 -132
  67. package/esm/components/helpers/store.js +82 -54
  68. package/esm/components/helpers/types.js +33 -44
  69. package/esm/index.js +4 -7
  70. package/esm/propTypes.js +72 -55
  71. package/package.json +12 -12
  72. package/cjs/DSQueryBuilder.js.map +0 -7
  73. package/cjs/components/AndOrController/AndOrController.js.map +0 -7
  74. package/cjs/components/ConditionController/ConditionController.js.map +0 -7
  75. package/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -7
  76. package/cjs/components/DragContainerController/DragContainerController.js.map +0 -7
  77. package/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -7
  78. package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
  79. package/cjs/components/Nestable/Nestable.js.map +0 -7
  80. package/cjs/components/Nestable/NestableItem.js.map +0 -7
  81. package/cjs/components/Nestable/actions/events.js.map +0 -7
  82. package/cjs/components/Nestable/actions/getItemOptions.js.map +0 -7
  83. package/cjs/components/Nestable/actions/getPaths.js.map +0 -7
  84. package/cjs/components/Nestable/actions/index.js.map +0 -7
  85. package/cjs/components/Nestable/actions/moveItem.js.map +0 -7
  86. package/cjs/components/Nestable/actions/paths.js.map +0 -7
  87. package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
  88. package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
  89. package/cjs/components/Nestable/index.js.map +0 -7
  90. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
  91. package/cjs/components/QueryBuilderImpl.js.map +0 -7
  92. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
  93. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
  94. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
  95. package/cjs/components/format/format.js.map +0 -7
  96. package/cjs/components/format/sqlFormat.js.map +0 -7
  97. package/cjs/components/format/sqlSafeFormat.js.map +0 -7
  98. package/cjs/components/format/xmlFormat.js.map +0 -7
  99. package/cjs/components/helpers/actions.js.map +0 -7
  100. package/cjs/components/helpers/constants.js.map +0 -7
  101. package/cjs/components/helpers/dependencies.js.map +0 -7
  102. package/cjs/components/helpers/selectors.js.map +0 -7
  103. package/cjs/components/helpers/store.js.map +0 -7
  104. package/cjs/components/helpers/types.js.map +0 -7
  105. package/cjs/index.js.map +0 -7
  106. package/cjs/propTypes.js.map +0 -7
  107. package/esm/DSQueryBuilder.js.map +0 -7
  108. package/esm/components/AndOrController/AndOrController.js.map +0 -7
  109. package/esm/components/ConditionController/ConditionController.js.map +0 -7
  110. package/esm/components/DisplayOutput/DisplayOutput.js.map +0 -7
  111. package/esm/components/DragContainerController/DragContainerController.js.map +0 -7
  112. package/esm/components/DragControllerRow/DragControllerRow.js.map +0 -7
  113. package/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
  114. package/esm/components/Nestable/Nestable.js.map +0 -7
  115. package/esm/components/Nestable/NestableItem.js.map +0 -7
  116. package/esm/components/Nestable/actions/events.js.map +0 -7
  117. package/esm/components/Nestable/actions/getItemOptions.js.map +0 -7
  118. package/esm/components/Nestable/actions/getPaths.js.map +0 -7
  119. package/esm/components/Nestable/actions/index.js.map +0 -7
  120. package/esm/components/Nestable/actions/moveItem.js.map +0 -7
  121. package/esm/components/Nestable/actions/paths.js.map +0 -7
  122. package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
  123. package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
  124. package/esm/components/Nestable/index.js.map +0 -7
  125. package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
  126. package/esm/components/QueryBuilderImpl.js.map +0 -7
  127. package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
  128. package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
  129. package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
  130. package/esm/components/format/format.js.map +0 -7
  131. package/esm/components/format/sqlFormat.js.map +0 -7
  132. package/esm/components/format/sqlSafeFormat.js.map +0 -7
  133. package/esm/components/format/xmlFormat.js.map +0 -7
  134. package/esm/components/helpers/actions.js.map +0 -7
  135. package/esm/components/helpers/constants.js.map +0 -7
  136. package/esm/components/helpers/dependencies.js.map +0 -7
  137. package/esm/components/helpers/selectors.js.map +0 -7
  138. package/esm/components/helpers/store.js.map +0 -7
  139. package/esm/components/helpers/types.js.map +0 -7
  140. package/esm/index.js.map +0 -7
  141. package/esm/propTypes.js.map +0 -7
@@ -1,42 +1,29 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 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
- module.exports = __toCommonJS(ToolBarAnimation_exports);
42
- //# sourceMappingURL=ToolBarAnimation.js.map
27
+ }));
28
+
29
+ exports.ToolBarAnimation = ToolBarAnimation;
@@ -1,59 +1,33 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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: (query) => query,
40
- sqlFormat: import_sqlFormat.sqlFormat,
41
- xmlFormat: import_xmlFormat.xmlFormat,
42
- sqlSafeFormat: import_sqlSafeFormat.sqlSafeFormat
10
+ defaultFormat: query => query,
11
+ sqlFormat: sqlFormat.sqlFormat,
12
+ xmlFormat: xmlFormat.xmlFormat,
13
+ sqlSafeFormat: sqlSafeFormat.sqlSafeFormat
43
14
  };
44
- this.currentFormat = "sqlFormat";
45
- this.setDefaultFormat = (formatName) => {
46
- if (this.format[formatName])
47
- this.currentFormat = formatName;
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
- var format_default = new QueryBuilderFormat();
58
- module.exports = __toCommonJS(format_exports);
59
- //# sourceMappingURL=format.js.map
30
+
31
+ var QueryBuilderFormat$1 = new QueryBuilderFormat();
32
+
33
+ module.exports = QueryBuilderFormat$1;
@@ -1,36 +1,11 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 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
- } = import_types.QB_OPERATOR_TYPES;
47
- if (condition === EQUAL)
48
- return ` = '${value}'`;
49
- if (condition === NOT_EQUAL)
50
- return ` <> '${value}'`;
51
- if (condition === GREATER_THAN)
52
- return ` > ${value}`;
53
- if (condition === LESS_THAN)
54
- return ` < ${value}`;
55
- if (condition === CONTAINS)
56
- return ` LIKE '%${value}%'`;
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
- const renderFilterSQl = (filter) => {
70
- const { field, operator, value } = filter.element;
71
- return `${field} ${conditionSql(operator, value) || ""}`;
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
- const sqlFormat = ({ main, mapGroups, items }) => {
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 groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
77
- return ` ( ${filterSql(item, groupCondition2)} ) `;
53
+ const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
54
+ return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
78
55
  }
79
- const groupCondition = item.element.condition === true ? "AND" : "OR";
80
- return ` ( ${filterSql(item.children, groupCondition)} ) `;
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((filter) => {
84
- if (filter.element.type === "filter")
85
- return ` ${renderFilterSQl(filter)} `;
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
- const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
68
+
69
+ const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
91
70
  return sql;
92
71
  };
93
- module.exports = __toCommonJS(sqlFormat_exports);
94
- //# sourceMappingURL=sqlFormat.js.map
72
+
73
+ exports.sqlFormat = sqlFormat;
@@ -1,38 +1,13 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 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
- } = import_types.QB_OPERATOR_TYPES;
49
- const valueDisplay = isNaN(value) ? `'${value}'` : value;
50
- if (condition === EQUAL)
51
- return ` = ${valueDisplay}`;
52
- if (condition === NOT_EQUAL)
53
- return ` <> ${valueDisplay}`;
54
- if (condition === GREATER_THAN)
55
- return ` > ${valueDisplay}`;
56
- if (condition === LESS_THAN)
57
- return ` < ${valueDisplay}`;
58
- if (condition === CONTAINS)
59
- return ` LIKE '%${value}%'`;
60
- if (condition === NOT_CONTAINS)
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
- const renderFilterSQl = (filter) => {
73
- const { field, operator, value } = filter.element;
74
- const fieldDisplay = /[.]/.test(field) || !isNaN(field) ? `\\"${field}\\"` : field;
75
- return `${fieldDisplay} ${conditionSql(operator, value) || ""}`;
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
- const sqlSafeFormat = ({ main, mapGroups, items }) => {
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 groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
81
- return ` ( ${filterSql(item, groupCondition2)} ) `;
60
+ const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
61
+ return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
82
62
  }
83
- const groupCondition = item.element.condition === true ? "AND" : "OR";
84
- return ` ( ${filterSql(item.children, groupCondition)} ) `;
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((filter) => {
88
- if (filter.element.type === "filter")
89
- return ` ${renderFilterSQl(filter)} `;
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
- const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
75
+
76
+ const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
95
77
  return sql;
96
78
  };
97
- module.exports = __toCommonJS(sqlSafeFormat_exports);
98
- //# sourceMappingURL=sqlSafeFormat.js.map
79
+
80
+ exports.specialChar = specialChar;
81
+ exports.sqlSafeFormat = sqlSafeFormat;
@@ -1,36 +1,11 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 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
- } = import_types.QB_OPERATOR_TYPES;
47
- if (condition === EQUAL)
48
- return `<condition>EQUAL</condition><value>${value}</value>`;
49
- if (condition === NOT_EQUAL)
50
- return `<condition>NOT_EQUAL</condition><value>${value}</value>`;
51
- if (condition === GREATER_THAN)
52
- return `<condition>GREATER_THAN</condition><value>${value}</value>`;
53
- if (condition === LESS_THAN)
54
- return `<condition>LESS_THAN</condition><value>${value}</value>`;
55
- if (condition === CONTAINS)
56
- return `<condition>LIKE</condition><value>${value}</value>`;
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
- const renderFilterSQl = (filter) => {
70
- const { field, operator, value } = filter.element;
71
- return `<filter><field>${field}</field>${conditionSql(operator, value) || ""}</filter>`;
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
- const xmlFormat = ({ main, mapGroups, items }) => {
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 groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
77
- return `<group value="${groupCondition2}">${filterXML(item, groupCondition2)}</group>`;
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
- const groupCondition = item.element.condition === true ? "AND" : "OR";
80
- return `<group value="${groupCondition}">${filterXML(item.children, groupCondition)}</group>`;
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
- const filterXML = (filters) => {
83
- const filterGroup = filters.map((filter) => {
84
- if (filter.element.type === "filter")
85
- return `${renderFilterSQl(filter) || ""} `;
86
- return ` ${groupXML(filter)} `;
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
- const xml = `<xml><query>${groupXML(items, main) || ""}</query></xml>`;
68
+
69
+ const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
91
70
  return xml;
92
71
  };
93
- module.exports = __toCommonJS(xmlFormat_exports);
94
- //# sourceMappingURL=xmlFormat.js.map
72
+
73
+ exports.xmlFormat = xmlFormat;