@elliemae/ds-query-builder 2.1.1-rc.1 → 2.2.0-alpha.4

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 +117 -97
  2. package/cjs/DSQueryBuilder.js.map +7 -0
  3. package/cjs/components/AndOrController/AndOrController.js +148 -162
  4. package/cjs/components/AndOrController/AndOrController.js.map +7 -0
  5. package/cjs/components/ConditionController/ConditionController.js +88 -72
  6. package/cjs/components/ConditionController/ConditionController.js.map +7 -0
  7. package/cjs/components/DisplayOutput/DisplayOutput.js +61 -62
  8. package/cjs/components/DisplayOutput/DisplayOutput.js.map +7 -0
  9. package/cjs/components/DragContainerController/DragContainerController.js +61 -41
  10. package/cjs/components/DragContainerController/DragContainerController.js.map +7 -0
  11. package/cjs/components/DragControllerRow/DragControllerRow.js +50 -46
  12. package/cjs/components/DragControllerRow/DragControllerRow.js.map +7 -0
  13. package/cjs/components/FieldControllerRow/FieldControllerRow.js +54 -32
  14. package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
  15. package/cjs/components/Nestable/Nestable.js +143 -209
  16. package/cjs/components/Nestable/Nestable.js.map +7 -0
  17. package/cjs/components/Nestable/NestableItem.js +98 -90
  18. package/cjs/components/Nestable/NestableItem.js.map +7 -0
  19. package/cjs/components/Nestable/actions/events.js +72 -95
  20. package/cjs/components/Nestable/actions/events.js.map +7 -0
  21. package/cjs/components/Nestable/actions/getItemOptions.js +36 -15
  22. package/cjs/components/Nestable/actions/getItemOptions.js.map +7 -0
  23. package/cjs/components/Nestable/actions/getPaths.js +46 -51
  24. package/cjs/components/Nestable/actions/getPaths.js.map +7 -0
  25. package/cjs/components/Nestable/actions/index.js +42 -28
  26. package/cjs/components/Nestable/actions/index.js.map +7 -0
  27. package/cjs/components/Nestable/actions/moveItem.js +44 -42
  28. package/cjs/components/Nestable/actions/moveItem.js.map +7 -0
  29. package/cjs/components/Nestable/actions/paths.js +48 -55
  30. package/cjs/components/Nestable/actions/paths.js.map +7 -0
  31. package/cjs/components/Nestable/actions/tryDecreaseDepth.js +39 -23
  32. package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
  33. package/cjs/components/Nestable/actions/tryIncreaseDepth.js +39 -26
  34. package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
  35. package/cjs/components/Nestable/index.js +36 -7
  36. package/cjs/components/Nestable/index.js.map +7 -0
  37. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +36 -13
  38. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
  39. package/cjs/components/QueryBuilderImpl.js +118 -202
  40. package/cjs/components/QueryBuilderImpl.js.map +7 -0
  41. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +80 -78
  42. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
  43. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +154 -211
  44. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
  45. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +39 -26
  46. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
  47. package/cjs/components/format/format.js +48 -22
  48. package/cjs/components/format/format.js.map +7 -0
  49. package/cjs/components/format/sqlFormat.js +69 -48
  50. package/cjs/components/format/sqlFormat.js.map +7 -0
  51. package/cjs/components/format/sqlSafeFormat.js +72 -55
  52. package/cjs/components/format/sqlSafeFormat.js.map +7 -0
  53. package/cjs/components/format/xmlFormat.js +71 -50
  54. package/cjs/components/format/xmlFormat.js.map +7 -0
  55. package/cjs/components/helpers/actions.js +151 -186
  56. package/cjs/components/helpers/actions.js.map +7 -0
  57. package/cjs/components/helpers/constants.js +36 -8
  58. package/cjs/components/helpers/constants.js.map +7 -0
  59. package/cjs/components/helpers/dependencies.js +49 -64
  60. package/cjs/components/helpers/dependencies.js.map +7 -0
  61. package/cjs/components/helpers/selectors.js +161 -101
  62. package/cjs/components/helpers/selectors.js.map +7 -0
  63. package/cjs/components/helpers/store.js +86 -104
  64. package/cjs/components/helpers/store.js.map +7 -0
  65. package/cjs/components/helpers/types.js +72 -44
  66. package/cjs/components/helpers/types.js.map +7 -0
  67. package/cjs/index.js +36 -29
  68. package/cjs/index.js.map +7 -0
  69. package/cjs/propTypes.js +102 -94
  70. package/cjs/propTypes.js.map +7 -0
  71. package/esm/DSQueryBuilder.js +103 -72
  72. package/esm/DSQueryBuilder.js.map +7 -0
  73. package/esm/components/AndOrController/AndOrController.js +113 -147
  74. package/esm/components/AndOrController/AndOrController.js.map +7 -0
  75. package/esm/components/ConditionController/ConditionController.js +57 -62
  76. package/esm/components/ConditionController/ConditionController.js.map +7 -0
  77. package/esm/components/DisplayOutput/DisplayOutput.js +29 -53
  78. package/esm/components/DisplayOutput/DisplayOutput.js.map +7 -0
  79. package/esm/components/DragContainerController/DragContainerController.js +32 -35
  80. package/esm/components/DragContainerController/DragContainerController.js.map +7 -0
  81. package/esm/components/DragControllerRow/DragControllerRow.js +21 -38
  82. package/esm/components/DragControllerRow/DragControllerRow.js.map +7 -0
  83. package/esm/components/FieldControllerRow/FieldControllerRow.js +25 -26
  84. package/esm/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
  85. package/esm/components/Nestable/Nestable.js +115 -186
  86. package/esm/components/Nestable/Nestable.js.map +7 -0
  87. package/esm/components/Nestable/NestableItem.js +69 -82
  88. package/esm/components/Nestable/NestableItem.js.map +7 -0
  89. package/esm/components/Nestable/actions/events.js +45 -79
  90. package/esm/components/Nestable/actions/events.js.map +7 -0
  91. package/esm/components/Nestable/actions/getItemOptions.js +7 -11
  92. package/esm/components/Nestable/actions/getItemOptions.js.map +7 -0
  93. package/esm/components/Nestable/actions/getPaths.js +17 -43
  94. package/esm/components/Nestable/actions/getPaths.js.map +7 -0
  95. package/esm/components/Nestable/actions/index.js +13 -6
  96. package/esm/components/Nestable/actions/index.js.map +7 -0
  97. package/esm/components/Nestable/actions/moveItem.js +13 -31
  98. package/esm/components/Nestable/actions/moveItem.js.map +7 -0
  99. package/esm/components/Nestable/actions/paths.js +19 -47
  100. package/esm/components/Nestable/actions/paths.js.map +7 -0
  101. package/esm/components/Nestable/actions/tryDecreaseDepth.js +10 -19
  102. package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
  103. package/esm/components/Nestable/actions/tryIncreaseDepth.js +10 -22
  104. package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
  105. package/esm/components/Nestable/index.js +7 -2
  106. package/esm/components/Nestable/index.js.map +7 -0
  107. package/esm/components/QueryBuilderContext/QueryBuilderContext.js +7 -5
  108. package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
  109. package/esm/components/QueryBuilderImpl.js +82 -187
  110. package/esm/components/QueryBuilderImpl.js.map +7 -0
  111. package/esm/components/QueryBuilderItem/QueryBuilderItem.js +50 -70
  112. package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
  113. package/esm/components/QueryBuilderRow/QueryBuilderRow.js +123 -201
  114. package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
  115. package/esm/components/ToolBarAnimation/ToolBarAnimation.js +10 -17
  116. package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
  117. package/esm/components/format/format.js +16 -17
  118. package/esm/components/format/format.js.map +7 -0
  119. package/esm/components/format/sqlFormat.js +39 -43
  120. package/esm/components/format/sqlFormat.js.map +7 -0
  121. package/esm/components/format/sqlSafeFormat.js +43 -50
  122. package/esm/components/format/sqlSafeFormat.js.map +7 -0
  123. package/esm/components/format/xmlFormat.js +41 -45
  124. package/esm/components/format/xmlFormat.js.map +7 -0
  125. package/esm/components/helpers/actions.js +123 -160
  126. package/esm/components/helpers/actions.js.map +7 -0
  127. package/esm/components/helpers/constants.js +7 -2
  128. package/esm/components/helpers/constants.js.map +7 -0
  129. package/esm/components/helpers/dependencies.js +19 -39
  130. package/esm/components/helpers/dependencies.js.map +7 -0
  131. package/esm/components/helpers/selectors.js +132 -93
  132. package/esm/components/helpers/selectors.js.map +7 -0
  133. package/esm/components/helpers/store.js +54 -82
  134. package/esm/components/helpers/store.js.map +7 -0
  135. package/esm/components/helpers/types.js +44 -33
  136. package/esm/components/helpers/types.js.map +7 -0
  137. package/esm/index.js +7 -4
  138. package/esm/index.js.map +7 -0
  139. package/esm/propTypes.js +55 -72
  140. package/esm/propTypes.js.map +7 -0
  141. package/package.json +12 -12
@@ -1,31 +1,30 @@
1
- import { sqlFormat } from './sqlFormat.js';
2
- import { xmlFormat } from './xmlFormat.js';
3
- import { sqlSafeFormat } from './sqlSafeFormat.js';
4
-
1
+ import * as React from "react";
2
+ import { sqlFormat } from "./sqlFormat";
3
+ import { xmlFormat } from "./xmlFormat";
4
+ import { sqlSafeFormat } from "./sqlSafeFormat";
5
5
  class QueryBuilderFormat {
6
6
  constructor() {
7
7
  this.format = {
8
- defaultFormat: query => query,
8
+ defaultFormat: (query) => query,
9
9
  sqlFormat,
10
10
  xmlFormat,
11
11
  sqlSafeFormat
12
12
  };
13
- this.currentFormat = 'sqlFormat';
14
-
15
- this.setDefaultFormat = formatName => {
16
- if (this.format[formatName]) this.currentFormat = formatName;
13
+ this.currentFormat = "sqlFormat";
14
+ this.setDefaultFormat = (formatName) => {
15
+ if (this.format[formatName])
16
+ this.currentFormat = formatName;
17
17
  };
18
-
19
18
  this.addFormat = (formatName, format) => this.format[formatName] = format;
20
-
21
19
  this.run = (query, formatName) => {
22
- if (this.format[formatName]) return this.format[formatName](query);
20
+ if (this.format[formatName])
21
+ return this.format[formatName](query);
23
22
  return this.format[this.currentFormat](query);
24
23
  };
25
24
  }
26
-
27
25
  }
28
-
29
- var QueryBuilderFormat$1 = new QueryBuilderFormat();
30
-
31
- export { QueryBuilderFormat$1 as default };
26
+ var format_default = new QueryBuilderFormat();
27
+ export {
28
+ format_default as default
29
+ };
30
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/format/format.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { sqlFormat } from './sqlFormat';\nimport { xmlFormat } from './xmlFormat';\nimport { sqlSafeFormat } from './sqlSafeFormat';\n\nclass QueryBuilderFormat {\n format = {\n defaultFormat: query => query,\n sqlFormat,\n xmlFormat,\n sqlSafeFormat,\n };\n\n currentFormat = 'sqlFormat';\n\n setDefaultFormat = formatName => {\n if (this.format[formatName]) this.currentFormat = formatName;\n };\n\n addFormat = (formatName, format) => (this.format[formatName] = format);\n\n run = (query, formatName) => {\n if (this.format[formatName]) return this.format[formatName](query);\n return this.format[this.currentFormat](query);\n };\n}\n\nexport default new QueryBuilderFormat();\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAEA,yBAAyB;AAAA,EAAzB,cAJA;AAKE,kBAAS;AAAA,MACP,eAAe,WAAS;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA;AAGF,yBAAgB;AAEhB,4BAAmB,gBAAc;AAC/B,UAAI,KAAK,OAAO;AAAa,aAAK,gBAAgB;AAAA;AAGpD,qBAAY,CAAC,YAAY,WAAY,KAAK,OAAO,cAAc;AAE/D,eAAM,CAAC,OAAO,eAAe;AAC3B,UAAI,KAAK,OAAO;AAAa,eAAO,KAAK,OAAO,YAAY;AAC5D,aAAO,KAAK,OAAO,KAAK,eAAe;AAAA;AAAA;AAAA;AAI3C,IAAO,iBAAQ,IAAI;",
6
+ "names": []
7
+ }
@@ -1,7 +1,5 @@
1
- import 'core-js/modules/esnext.async-iterator.map.js';
2
- import 'core-js/modules/esnext.iterator.map.js';
3
- import { QB_OPERATOR_TYPES } from '../helpers/types.js';
4
-
1
+ import * as React from "react";
2
+ import { QB_OPERATOR_TYPES } from "../helpers/types";
5
3
  const conditionSql = (condition, value) => {
6
4
  const {
7
5
  EQUAL,
@@ -15,55 +13,53 @@ const conditionSql = (condition, value) => {
15
13
  LESS_THAN_OR_EQUAL,
16
14
  START_WITH
17
15
  } = QB_OPERATOR_TYPES;
18
- if (condition === EQUAL) return " = '".concat(value, "'");
19
- if (condition === NOT_EQUAL) return " <> '".concat(value, "'");
20
- if (condition === GREATER_THAN) return " > ".concat(value);
21
- if (condition === LESS_THAN) return " < ".concat(value);
22
- if (condition === CONTAINS) return " LIKE '%".concat(value, "%'");
23
- if (condition === NOT_CONTAINS) return " NOT LIKE '%".concat(value, "%'");
24
- if (condition === BETWEEN) return " BETWEEN ".concat(value[0], " AND ").concat(value[1], " ");
25
- if (condition === GREATER_THAN_OR_EQUAL) return " >= ".concat(value);
26
- if (condition === LESS_THAN_OR_EQUAL) return " <= ".concat(value);
27
- if (condition === START_WITH) return " LIKE '".concat(value, "%'");
16
+ if (condition === EQUAL)
17
+ return ` = '${value}'`;
18
+ if (condition === NOT_EQUAL)
19
+ return ` <> '${value}'`;
20
+ if (condition === GREATER_THAN)
21
+ return ` > ${value}`;
22
+ if (condition === LESS_THAN)
23
+ return ` < ${value}`;
24
+ if (condition === CONTAINS)
25
+ return ` LIKE '%${value}%'`;
26
+ if (condition === NOT_CONTAINS)
27
+ return ` NOT LIKE '%${value}%'`;
28
+ if (condition === BETWEEN)
29
+ return ` BETWEEN ${value[0]} AND ${value[1]} `;
30
+ if (condition === GREATER_THAN_OR_EQUAL)
31
+ return ` >= ${value}`;
32
+ if (condition === LESS_THAN_OR_EQUAL)
33
+ return ` <= ${value}`;
34
+ if (condition === START_WITH)
35
+ return ` LIKE '${value}%'`;
28
36
  return condition;
29
37
  };
30
-
31
- const renderFilterSQl = filter => {
32
- const {
33
- field,
34
- operator,
35
- value
36
- } = filter.element;
37
- return "".concat(field, " ").concat(conditionSql(operator, value) || '');
38
+ const renderFilterSQl = (filter) => {
39
+ const { field, operator, value } = filter.element;
40
+ return `${field} ${conditionSql(operator, value) || ""}`;
38
41
  };
39
-
40
- const sqlFormat = _ref => {
41
- let {
42
- main,
43
- mapGroups,
44
- items
45
- } = _ref;
46
-
42
+ const sqlFormat = ({ main, mapGroups, items }) => {
47
43
  const groupSql = (item, idGroup) => {
48
44
  if (idGroup === main) {
49
- const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
50
- return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
45
+ const groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
46
+ return ` ( ${filterSql(item, groupCondition2)} ) `;
51
47
  }
52
-
53
- const groupCondition = item.element.condition === true ? 'AND' : 'OR';
54
- return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
48
+ const groupCondition = item.element.condition === true ? "AND" : "OR";
49
+ return ` ( ${filterSql(item.children, groupCondition)} ) `;
55
50
  };
56
-
57
51
  const filterSql = (filters, groupCondition) => {
58
- const filterGroup = filters.map(filter => {
59
- if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
60
- return " ".concat(groupSql(filter) || '', " ");
52
+ const filterGroup = filters.map((filter) => {
53
+ if (filter.element.type === "filter")
54
+ return ` ${renderFilterSQl(filter)} `;
55
+ return ` ${groupSql(filter) || ""} `;
61
56
  });
62
57
  return filterGroup.join(groupCondition);
63
58
  };
64
-
65
- const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
59
+ const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
66
60
  return sql;
67
61
  };
68
-
69
- export { sqlFormat };
62
+ export {
63
+ sqlFormat
64
+ };
65
+ //# sourceMappingURL=sqlFormat.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/format/sqlFormat.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { QB_OPERATOR_TYPES } from '../helpers/types';\n\nconst conditionSql = (condition, value) => {\n const {\n EQUAL,\n NOT_EQUAL,\n GREATER_THAN,\n LESS_THAN,\n CONTAINS,\n NOT_CONTAINS,\n BETWEEN,\n GREATER_THAN_OR_EQUAL,\n LESS_THAN_OR_EQUAL,\n START_WITH,\n } = QB_OPERATOR_TYPES;\n\n if (condition === EQUAL) return ` = '${value}'`;\n if (condition === NOT_EQUAL) return ` <> '${value}'`;\n if (condition === GREATER_THAN) return ` > ${value}`;\n if (condition === LESS_THAN) return ` < ${value}`;\n if (condition === CONTAINS) return ` LIKE '%${value}%'`;\n if (condition === NOT_CONTAINS) return ` NOT LIKE '%${value}%'`;\n if (condition === BETWEEN) return ` BETWEEN ${value[0]} AND ${value[1]} `;\n if (condition === GREATER_THAN_OR_EQUAL) return ` >= ${value}`;\n if (condition === LESS_THAN_OR_EQUAL) return ` <= ${value}`;\n if (condition === START_WITH) return ` LIKE '${value}%'`;\n return condition;\n};\n\nconst renderFilterSQl = (filter) => {\n const { field, operator, value } = filter.element;\n\n return `${field} ${conditionSql(operator, value) || ''}`;\n};\nexport const sqlFormat = ({ main, mapGroups, items }) => {\n const groupSql = (item, idGroup) => {\n if (idGroup === main) {\n const groupCondition =\n mapGroups[idGroup].condition === true ? 'AND' : 'OR';\n return ` ( ${filterSql(item, groupCondition)} ) `; // eslint-disable-line\n }\n const groupCondition = item.element.condition === true ? 'AND' : 'OR';\n return ` ( ${filterSql(item.children, groupCondition)} ) `; // eslint-disable-line\n };\n\n const filterSql = (filters, groupCondition) => {\n const filterGroup = filters.map((filter) => {\n if (filter.element.type === 'filter')\n return ` ${renderFilterSQl(filter)} `;\n return ` ${groupSql(filter) || ''} `;\n });\n return filterGroup.join(groupCondition);\n };\n\n const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ''} `;\n\n return sql;\n};\n"],
5
+ "mappings": "AAAA;ACCA;AAEA,MAAM,eAAe,CAAC,WAAW,UAAU;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,MAAI,cAAc;AAAO,WAAO,OAAO;AACvC,MAAI,cAAc;AAAW,WAAO,QAAQ;AAC5C,MAAI,cAAc;AAAc,WAAO,MAAM;AAC7C,MAAI,cAAc;AAAW,WAAO,MAAM;AAC1C,MAAI,cAAc;AAAU,WAAO,WAAW;AAC9C,MAAI,cAAc;AAAc,WAAO,eAAe;AACtD,MAAI,cAAc;AAAS,WAAO,YAAY,MAAM,UAAU,MAAM;AACpE,MAAI,cAAc;AAAuB,WAAO,OAAO;AACvD,MAAI,cAAc;AAAoB,WAAO,OAAO;AACpD,MAAI,cAAc;AAAY,WAAO,UAAU;AAC/C,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,WAAW;AAClC,QAAM,EAAE,OAAO,UAAU,UAAU,OAAO;AAE1C,SAAO,GAAG,SAAS,aAAa,UAAU,UAAU;AAAA;AAE/C,MAAM,YAAY,CAAC,EAAE,MAAM,WAAW,YAAY;AACvD,QAAM,WAAW,CAAC,MAAM,YAAY;AAClC,QAAI,YAAY,MAAM;AACpB,YAAM,kBACJ,UAAU,SAAS,cAAc,OAAO,QAAQ;AAClD,aAAO,MAAM,UAAU,MAAM;AAAA;AAE/B,UAAM,iBAAiB,KAAK,QAAQ,cAAc,OAAO,QAAQ;AACjE,WAAO,MAAM,UAAU,KAAK,UAAU;AAAA;AAGxC,QAAM,YAAY,CAAC,SAAS,mBAAmB;AAC7C,UAAM,cAAc,QAAQ,IAAI,CAAC,WAAW;AAC1C,UAAI,OAAO,QAAQ,SAAS;AAC1B,eAAO,IAAI,gBAAgB;AAC7B,aAAO,IAAI,SAAS,WAAW;AAAA;AAEjC,WAAO,YAAY,KAAK;AAAA;AAG1B,QAAM,MAAM,4BAA4B,SAAS,OAAO,SAAS;AAEjE,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,9 +1,6 @@
1
- import 'core-js/modules/esnext.async-iterator.map.js';
2
- import 'core-js/modules/esnext.iterator.map.js';
3
- import { QB_OPERATOR_TYPES } from '../helpers/types.js';
4
-
1
+ import * as React from "react";
2
+ import { QB_OPERATOR_TYPES } from "../helpers/types";
5
3
  const specialChar = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
6
-
7
4
  const conditionSql = (condition, value) => {
8
5
  const {
9
6
  EQUAL,
@@ -16,61 +13,57 @@ const conditionSql = (condition, value) => {
16
13
  GREATER_THAN_OR_EQUAL,
17
14
  LESS_THAN_OR_EQUAL,
18
15
  START_WITH
19
- } = QB_OPERATOR_TYPES; // eslint-disable-next-line no-restricted-globals
20
-
21
- const valueDisplay = isNaN(value) ? "'".concat(value, "'") : value;
22
- if (condition === EQUAL) return " = ".concat(valueDisplay);
23
- if (condition === NOT_EQUAL) return " <> ".concat(valueDisplay);
24
- if (condition === GREATER_THAN) return " > ".concat(valueDisplay);
25
- if (condition === LESS_THAN) return " < ".concat(valueDisplay);
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, "%'");
16
+ } = QB_OPERATOR_TYPES;
17
+ const valueDisplay = isNaN(value) ? `'${value}'` : value;
18
+ if (condition === EQUAL)
19
+ return ` = ${valueDisplay}`;
20
+ if (condition === NOT_EQUAL)
21
+ return ` <> ${valueDisplay}`;
22
+ if (condition === GREATER_THAN)
23
+ return ` > ${valueDisplay}`;
24
+ if (condition === LESS_THAN)
25
+ return ` < ${valueDisplay}`;
26
+ if (condition === CONTAINS)
27
+ return ` LIKE '%${value}%'`;
28
+ if (condition === NOT_CONTAINS)
29
+ return ` NOT LIKE '%${value}%'`;
30
+ if (condition === BETWEEN)
31
+ return ` BETWEEN ${value[0]} AND ${value[1]} `;
32
+ if (condition === GREATER_THAN_OR_EQUAL)
33
+ return ` >= ${value}`;
34
+ if (condition === LESS_THAN_OR_EQUAL)
35
+ return ` <= ${value}`;
36
+ if (condition === START_WITH)
37
+ return ` LIKE '${value}%'`;
32
38
  return condition;
33
39
  };
34
-
35
- const renderFilterSQl = filter => {
36
- const {
37
- field,
38
- operator,
39
- value
40
- } = filter.element; // eslint-disable-next-line no-restricted-globals
41
-
42
- const fieldDisplay = // eslint-disable-next-line no-restricted-globals
43
- /[.]/.test(field) || !isNaN(field) ? "\\\"".concat(field, "\\\"") : field;
44
- return "".concat(fieldDisplay, " ").concat(conditionSql(operator, value) || '');
40
+ const renderFilterSQl = (filter) => {
41
+ const { field, operator, value } = filter.element;
42
+ const fieldDisplay = /[.]/.test(field) || !isNaN(field) ? `\\"${field}\\"` : field;
43
+ return `${fieldDisplay} ${conditionSql(operator, value) || ""}`;
45
44
  };
46
-
47
- const sqlSafeFormat = _ref => {
48
- let {
49
- main,
50
- mapGroups,
51
- items
52
- } = _ref;
53
-
45
+ const sqlSafeFormat = ({ main, mapGroups, items }) => {
54
46
  const groupSql = (item, idGroup) => {
55
47
  if (idGroup === main) {
56
- const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
57
- return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
48
+ const groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
49
+ return ` ( ${filterSql(item, groupCondition2)} ) `;
58
50
  }
59
-
60
- const groupCondition = item.element.condition === true ? 'AND' : 'OR';
61
- return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
51
+ const groupCondition = item.element.condition === true ? "AND" : "OR";
52
+ return ` ( ${filterSql(item.children, groupCondition)} ) `;
62
53
  };
63
-
64
54
  const filterSql = (filters, groupCondition) => {
65
- const filterGroup = filters.map(filter => {
66
- if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
67
- return " ".concat(groupSql(filter) || '', " ");
55
+ const filterGroup = filters.map((filter) => {
56
+ if (filter.element.type === "filter")
57
+ return ` ${renderFilterSQl(filter)} `;
58
+ return ` ${groupSql(filter) || ""} `;
68
59
  });
69
60
  return filterGroup.join(groupCondition);
70
61
  };
71
-
72
- const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
62
+ const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
73
63
  return sql;
74
64
  };
75
-
76
- export { specialChar, sqlSafeFormat };
65
+ export {
66
+ specialChar,
67
+ sqlSafeFormat
68
+ };
69
+ //# sourceMappingURL=sqlSafeFormat.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/format/sqlSafeFormat.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { QB_OPERATOR_TYPES } from '../helpers/types';\n\n// eslint-disable-next-line no-useless-escape\nexport const specialChar = /[ !@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?]/;\n\nconst conditionSql = (condition, value) => {\n const {\n EQUAL,\n NOT_EQUAL,\n GREATER_THAN,\n LESS_THAN,\n CONTAINS,\n NOT_CONTAINS,\n BETWEEN,\n GREATER_THAN_OR_EQUAL,\n LESS_THAN_OR_EQUAL,\n START_WITH,\n } = QB_OPERATOR_TYPES;\n // eslint-disable-next-line no-restricted-globals\n const valueDisplay = isNaN(value) ? `'${value}'` : value;\n\n if (condition === EQUAL) return ` = ${valueDisplay}`;\n if (condition === NOT_EQUAL) return ` <> ${valueDisplay}`;\n if (condition === GREATER_THAN) return ` > ${valueDisplay}`;\n if (condition === LESS_THAN) return ` < ${valueDisplay}`;\n if (condition === CONTAINS) return ` LIKE '%${value}%'`;\n if (condition === NOT_CONTAINS) return ` NOT LIKE '%${value}%'`;\n if (condition === BETWEEN) return ` BETWEEN ${value[0]} AND ${value[1]} `;\n if (condition === GREATER_THAN_OR_EQUAL) return ` >= ${value}`;\n if (condition === LESS_THAN_OR_EQUAL) return ` <= ${value}`;\n if (condition === START_WITH) return ` LIKE '${value}%'`;\n return condition;\n};\n\nconst renderFilterSQl = (filter) => {\n const { field, operator, value } = filter.element;\n // eslint-disable-next-line no-restricted-globals\n const fieldDisplay =\n // eslint-disable-next-line no-restricted-globals\n /[.]/.test(field) || !isNaN(field) ? `\\\\\"${field}\\\\\"` : field;\n return `${fieldDisplay} ${conditionSql(operator, value) || ''}`;\n};\nexport const sqlSafeFormat = ({ main, mapGroups, items }) => {\n const groupSql = (item, idGroup) => {\n if (idGroup === main) {\n const groupCondition =\n mapGroups[idGroup].condition === true ? 'AND' : 'OR';\n return ` ( ${filterSql(item, groupCondition)} ) `; // eslint-disable-line\n }\n const groupCondition = item.element.condition === true ? 'AND' : 'OR';\n return ` ( ${filterSql(item.children, groupCondition)} ) `; // eslint-disable-line\n };\n\n const filterSql = (filters, groupCondition) => {\n const filterGroup = filters.map((filter) => {\n if (filter.element.type === 'filter')\n return ` ${renderFilterSQl(filter)} `;\n return ` ${groupSql(filter) || ''} `;\n });\n return filterGroup.join(groupCondition);\n };\n\n const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ''} `;\n\n return sql;\n};\n"],
5
+ "mappings": "AAAA;ACCA;AAGO,MAAM,cAAc;AAE3B,MAAM,eAAe,CAAC,WAAW,UAAU;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,eAAe,MAAM,SAAS,IAAI,WAAW;AAEnD,MAAI,cAAc;AAAO,WAAO,MAAM;AACtC,MAAI,cAAc;AAAW,WAAO,OAAO;AAC3C,MAAI,cAAc;AAAc,WAAO,MAAM;AAC7C,MAAI,cAAc;AAAW,WAAO,MAAM;AAC1C,MAAI,cAAc;AAAU,WAAO,WAAW;AAC9C,MAAI,cAAc;AAAc,WAAO,eAAe;AACtD,MAAI,cAAc;AAAS,WAAO,YAAY,MAAM,UAAU,MAAM;AACpE,MAAI,cAAc;AAAuB,WAAO,OAAO;AACvD,MAAI,cAAc;AAAoB,WAAO,OAAO;AACpD,MAAI,cAAc;AAAY,WAAO,UAAU;AAC/C,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,WAAW;AAClC,QAAM,EAAE,OAAO,UAAU,UAAU,OAAO;AAE1C,QAAM,eAEJ,MAAM,KAAK,UAAU,CAAC,MAAM,SAAS,MAAM,aAAa;AAC1D,SAAO,GAAG,gBAAgB,aAAa,UAAU,UAAU;AAAA;AAEtD,MAAM,gBAAgB,CAAC,EAAE,MAAM,WAAW,YAAY;AAC3D,QAAM,WAAW,CAAC,MAAM,YAAY;AAClC,QAAI,YAAY,MAAM;AACpB,YAAM,kBACJ,UAAU,SAAS,cAAc,OAAO,QAAQ;AAClD,aAAO,MAAM,UAAU,MAAM;AAAA;AAE/B,UAAM,iBAAiB,KAAK,QAAQ,cAAc,OAAO,QAAQ;AACjE,WAAO,MAAM,UAAU,KAAK,UAAU;AAAA;AAGxC,QAAM,YAAY,CAAC,SAAS,mBAAmB;AAC7C,UAAM,cAAc,QAAQ,IAAI,CAAC,WAAW;AAC1C,UAAI,OAAO,QAAQ,SAAS;AAC1B,eAAO,IAAI,gBAAgB;AAC7B,aAAO,IAAI,SAAS,WAAW;AAAA;AAEjC,WAAO,YAAY,KAAK;AAAA;AAG1B,QAAM,MAAM,4BAA4B,SAAS,OAAO,SAAS;AAEjE,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,7 +1,5 @@
1
- import 'core-js/modules/esnext.async-iterator.map.js';
2
- import 'core-js/modules/esnext.iterator.map.js';
3
- import { QB_OPERATOR_TYPES } from '../helpers/types.js';
4
-
1
+ import * as React from "react";
2
+ import { QB_OPERATOR_TYPES } from "../helpers/types";
5
3
  const conditionSql = (condition, value) => {
6
4
  const {
7
5
  EQUAL,
@@ -15,55 +13,53 @@ const conditionSql = (condition, value) => {
15
13
  LESS_THAN_OR_EQUAL,
16
14
  START_WITH
17
15
  } = QB_OPERATOR_TYPES;
18
- if (condition === EQUAL) return "<condition>EQUAL</condition><value>".concat(value, "</value>");
19
- if (condition === NOT_EQUAL) return "<condition>NOT_EQUAL</condition><value>".concat(value, "</value>");
20
- if (condition === GREATER_THAN) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
21
- if (condition === LESS_THAN) return "<condition>LESS_THAN</condition><value>".concat(value, "</value>");
22
- if (condition === CONTAINS) return "<condition>LIKE</condition><value>".concat(value, "</value>");
23
- if (condition === NOT_CONTAINS) return "<condition>NOT_LIKE</condition><value>".concat(value, "</value>");
24
- if (condition === BETWEEN) return "<condition>NOT_LIKE</condition><value><from>".concat(value[0], "</from><to>").concat(value[1], "</to></value>");
25
- if (condition === GREATER_THAN_OR_EQUAL) return "<condition>GREATER_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
26
- if (condition === LESS_THAN_OR_EQUAL) return "<condition>LESS_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
27
- if (condition === START_WITH) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
16
+ if (condition === EQUAL)
17
+ return `<condition>EQUAL</condition><value>${value}</value>`;
18
+ if (condition === NOT_EQUAL)
19
+ return `<condition>NOT_EQUAL</condition><value>${value}</value>`;
20
+ if (condition === GREATER_THAN)
21
+ return `<condition>GREATER_THAN</condition><value>${value}</value>`;
22
+ if (condition === LESS_THAN)
23
+ return `<condition>LESS_THAN</condition><value>${value}</value>`;
24
+ if (condition === CONTAINS)
25
+ return `<condition>LIKE</condition><value>${value}</value>`;
26
+ if (condition === NOT_CONTAINS)
27
+ return `<condition>NOT_LIKE</condition><value>${value}</value>`;
28
+ if (condition === BETWEEN)
29
+ return `<condition>NOT_LIKE</condition><value><from>${value[0]}</from><to>${value[1]}</to></value>`;
30
+ if (condition === GREATER_THAN_OR_EQUAL)
31
+ return `<condition>GREATER_THAN_OR_EQUAL</condition><value>${value}</value>`;
32
+ if (condition === LESS_THAN_OR_EQUAL)
33
+ return `<condition>LESS_THAN_OR_EQUAL</condition><value>${value}</value>`;
34
+ if (condition === START_WITH)
35
+ return `<condition>GREATER_THAN</condition><value>${value}</value>`;
28
36
  return condition;
29
37
  };
30
-
31
- const renderFilterSQl = filter => {
32
- const {
33
- field,
34
- operator,
35
- value
36
- } = filter.element;
37
- return "<filter><field>".concat(field, "</field>").concat(conditionSql(operator, value) || '', "</filter>");
38
+ const renderFilterSQl = (filter) => {
39
+ const { field, operator, value } = filter.element;
40
+ return `<filter><field>${field}</field>${conditionSql(operator, value) || ""}</filter>`;
38
41
  };
39
-
40
- const xmlFormat = _ref => {
41
- let {
42
- main,
43
- mapGroups,
44
- items
45
- } = _ref;
46
-
42
+ const xmlFormat = ({ main, mapGroups, items }) => {
47
43
  const groupXML = (item, idGroup) => {
48
44
  if (idGroup === main) {
49
- const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
50
- return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
45
+ const groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
46
+ return `<group value="${groupCondition2}">${filterXML(item, groupCondition2)}</group>`;
51
47
  }
52
-
53
- const groupCondition = item.element.condition === true ? 'AND' : 'OR';
54
- return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item.children), "</group>"); // eslint-disable-line
48
+ const groupCondition = item.element.condition === true ? "AND" : "OR";
49
+ return `<group value="${groupCondition}">${filterXML(item.children, groupCondition)}</group>`;
55
50
  };
56
-
57
- const filterXML = filters => {
58
- const filterGroup = filters.map(filter => {
59
- if (filter.element.type === 'filter') return "".concat(renderFilterSQl(filter) || '', " ");
60
- return " ".concat(groupXML(filter), " ");
51
+ const filterXML = (filters) => {
52
+ const filterGroup = filters.map((filter) => {
53
+ if (filter.element.type === "filter")
54
+ return `${renderFilterSQl(filter) || ""} `;
55
+ return ` ${groupXML(filter)} `;
61
56
  });
62
- return filterGroup.join('');
57
+ return filterGroup.join("");
63
58
  };
64
-
65
- const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
59
+ const xml = `<xml><query>${groupXML(items, main) || ""}</query></xml>`;
66
60
  return xml;
67
61
  };
68
-
69
- export { xmlFormat };
62
+ export {
63
+ xmlFormat
64
+ };
65
+ //# sourceMappingURL=xmlFormat.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/format/xmlFormat.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { QB_OPERATOR_TYPES } from '../helpers/types';\n\nconst conditionSql = (condition, value) => {\n const {\n EQUAL,\n NOT_EQUAL,\n GREATER_THAN,\n LESS_THAN,\n CONTAINS,\n NOT_CONTAINS,\n BETWEEN,\n GREATER_THAN_OR_EQUAL,\n LESS_THAN_OR_EQUAL,\n START_WITH,\n } = QB_OPERATOR_TYPES;\n\n if (condition === EQUAL)\n return `<condition>EQUAL</condition><value>${value}</value>`;\n if (condition === NOT_EQUAL)\n return `<condition>NOT_EQUAL</condition><value>${value}</value>`;\n if (condition === GREATER_THAN)\n return `<condition>GREATER_THAN</condition><value>${value}</value>`;\n if (condition === LESS_THAN)\n return `<condition>LESS_THAN</condition><value>${value}</value>`;\n if (condition === CONTAINS)\n return `<condition>LIKE</condition><value>${value}</value>`;\n if (condition === NOT_CONTAINS)\n return `<condition>NOT_LIKE</condition><value>${value}</value>`;\n if (condition === BETWEEN)\n return `<condition>NOT_LIKE</condition><value><from>${value[0]}</from><to>${value[1]}</to></value>`;\n if (condition === GREATER_THAN_OR_EQUAL)\n return `<condition>GREATER_THAN_OR_EQUAL</condition><value>${value}</value>`;\n if (condition === LESS_THAN_OR_EQUAL)\n return `<condition>LESS_THAN_OR_EQUAL</condition><value>${value}</value>`;\n if (condition === START_WITH)\n return `<condition>GREATER_THAN</condition><value>${value}</value>`;\n\n return condition;\n};\n\nconst renderFilterSQl = (filter) => {\n const { field, operator, value } = filter.element;\n\n return `<filter><field>${field}</field>${\n conditionSql(operator, value) || ''\n }</filter>`;\n};\nexport const xmlFormat = ({ main, mapGroups, items }) => {\n const groupXML = (item, idGroup) => {\n if (idGroup === main) {\n const groupCondition =\n mapGroups[idGroup].condition === true ? 'AND' : 'OR';\n return `<group value=\"${groupCondition}\">${filterXML(\n item,\n groupCondition,\n )}</group>`; // eslint-disable-line\n }\n const groupCondition = item.element.condition === true ? 'AND' : 'OR';\n return `<group value=\"${groupCondition}\">${filterXML(\n item.children,\n groupCondition,\n )}</group>`; // eslint-disable-line\n };\n const filterXML = (filters) => {\n const filterGroup = filters.map((filter) => {\n if (filter.element.type === 'filter')\n return `${renderFilterSQl(filter) || ''} `;\n return ` ${groupXML(filter)} `;\n });\n return filterGroup.join('');\n };\n\n const xml = `<xml><query>${groupXML(items, main) || ''}</query></xml>`;\n\n return xml;\n};\n"],
5
+ "mappings": "AAAA;ACCA;AAEA,MAAM,eAAe,CAAC,WAAW,UAAU;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,MAAI,cAAc;AAChB,WAAO,sCAAsC;AAC/C,MAAI,cAAc;AAChB,WAAO,0CAA0C;AACnD,MAAI,cAAc;AAChB,WAAO,6CAA6C;AACtD,MAAI,cAAc;AAChB,WAAO,0CAA0C;AACnD,MAAI,cAAc;AAChB,WAAO,qCAAqC;AAC9C,MAAI,cAAc;AAChB,WAAO,yCAAyC;AAClD,MAAI,cAAc;AAChB,WAAO,+CAA+C,MAAM,gBAAgB,MAAM;AACpF,MAAI,cAAc;AAChB,WAAO,sDAAsD;AAC/D,MAAI,cAAc;AAChB,WAAO,mDAAmD;AAC5D,MAAI,cAAc;AAChB,WAAO,6CAA6C;AAEtD,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,WAAW;AAClC,QAAM,EAAE,OAAO,UAAU,UAAU,OAAO;AAE1C,SAAO,kBAAkB,gBACvB,aAAa,UAAU,UAAU;AAAA;AAG9B,MAAM,YAAY,CAAC,EAAE,MAAM,WAAW,YAAY;AACvD,QAAM,WAAW,CAAC,MAAM,YAAY;AAClC,QAAI,YAAY,MAAM;AACpB,YAAM,kBACJ,UAAU,SAAS,cAAc,OAAO,QAAQ;AAClD,aAAO,iBAAiB,oBAAmB,UACzC,MACA;AAAA;AAGJ,UAAM,iBAAiB,KAAK,QAAQ,cAAc,OAAO,QAAQ;AACjE,WAAO,iBAAiB,mBAAmB,UACzC,KAAK,UACL;AAAA;AAGJ,QAAM,YAAY,CAAC,YAAY;AAC7B,UAAM,cAAc,QAAQ,IAAI,CAAC,WAAW;AAC1C,UAAI,OAAO,QAAQ,SAAS;AAC1B,eAAO,GAAG,gBAAgB,WAAW;AACvC,aAAO,IAAI,SAAS;AAAA;AAEtB,WAAO,YAAY,KAAK;AAAA;AAG1B,QAAM,MAAM,eAAe,SAAS,OAAO,SAAS;AAEpD,SAAO;AAAA;",
6
+ "names": []
7
+ }