@elliemae/ds-query-builder 3.0.0-next.2 → 3.0.0-next.6
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/dist/cjs/DSQueryBuilder.js +118 -0
- package/dist/cjs/DSQueryBuilder.js.map +7 -0
- package/dist/cjs/components/AndOrController/AndOrController.js +208 -0
- package/dist/cjs/components/AndOrController/AndOrController.js.map +7 -0
- package/dist/cjs/components/ConditionController/ConditionController.js +116 -0
- package/dist/cjs/components/ConditionController/ConditionController.js.map +7 -0
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js +92 -0
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/dist/cjs/components/DragContainerController/DragContainerController.js +65 -0
- package/dist/cjs/components/DragContainerController/DragContainerController.js.map +7 -0
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js +83 -0
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js +55 -0
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/dist/cjs/components/Nestable/Nestable.js +264 -0
- package/dist/cjs/components/Nestable/Nestable.js.map +7 -0
- package/dist/cjs/components/Nestable/NestableItem.js +127 -0
- package/dist/cjs/components/Nestable/NestableItem.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/events.js +153 -0
- package/dist/cjs/components/Nestable/actions/events.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/getItemOptions.js +49 -0
- package/dist/cjs/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/getPaths.js +119 -0
- package/dist/cjs/components/Nestable/actions/getPaths.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/index.js +42 -0
- package/dist/cjs/components/Nestable/actions/index.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/moveItem.js +69 -0
- package/dist/cjs/components/Nestable/actions/moveItem.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/paths.js +119 -0
- package/dist/cjs/components/Nestable/actions/paths.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js +51 -0
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js +51 -0
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/dist/cjs/components/Nestable/index.js +36 -0
- package/dist/cjs/components/Nestable/index.js.map +7 -0
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js +36 -0
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/dist/cjs/components/QueryBuilderImpl.js +253 -0
- package/dist/cjs/components/QueryBuilderImpl.js.map +7 -0
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js +108 -0
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js +235 -0
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js +58 -0
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/dist/cjs/components/format/format.js +59 -0
- package/dist/cjs/components/format/format.js.map +7 -0
- package/dist/cjs/components/format/sqlFormat.js +94 -0
- package/dist/cjs/components/format/sqlFormat.js.map +7 -0
- package/dist/cjs/components/format/sqlSafeFormat.js +98 -0
- package/dist/cjs/components/format/sqlSafeFormat.js.map +7 -0
- package/dist/cjs/components/format/xmlFormat.js +94 -0
- package/dist/cjs/components/format/xmlFormat.js.map +7 -0
- package/dist/cjs/components/helpers/actions.js +253 -0
- package/dist/cjs/components/helpers/actions.js.map +7 -0
- package/dist/cjs/components/helpers/constants.js +39 -0
- package/dist/cjs/components/helpers/constants.js.map +7 -0
- package/dist/cjs/components/helpers/dependencies.js +69 -0
- package/dist/cjs/components/helpers/dependencies.js.map +7 -0
- package/dist/cjs/components/helpers/selectors.js +161 -0
- package/dist/cjs/components/helpers/selectors.js.map +7 -0
- package/dist/cjs/components/helpers/store.js +171 -0
- package/dist/cjs/components/helpers/store.js.map +7 -0
- package/dist/cjs/components/helpers/types.js +92 -0
- package/dist/cjs/components/helpers/types.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +105 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/esm/DSQueryBuilder.js +105 -0
- package/dist/esm/DSQueryBuilder.js.map +7 -0
- package/dist/esm/components/AndOrController/AndOrController.js +179 -0
- package/dist/esm/components/AndOrController/AndOrController.js.map +7 -0
- package/dist/esm/components/ConditionController/ConditionController.js +87 -0
- package/dist/esm/components/ConditionController/ConditionController.js.map +7 -0
- package/dist/esm/components/DisplayOutput/DisplayOutput.js +63 -0
- package/dist/esm/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/dist/esm/components/DragContainerController/DragContainerController.js +36 -0
- package/dist/esm/components/DragContainerController/DragContainerController.js.map +7 -0
- package/dist/esm/components/DragControllerRow/DragControllerRow.js +56 -0
- package/dist/esm/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js +26 -0
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/dist/esm/components/Nestable/Nestable.js +253 -0
- package/dist/esm/components/Nestable/Nestable.js.map +7 -0
- package/dist/esm/components/Nestable/NestableItem.js +100 -0
- package/dist/esm/components/Nestable/NestableItem.js.map +7 -0
- package/dist/esm/components/Nestable/actions/events.js +131 -0
- package/dist/esm/components/Nestable/actions/events.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/getItemOptions.js +7 -11
- package/dist/esm/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/getPaths.js +17 -43
- package/dist/esm/components/Nestable/actions/getPaths.js.map +7 -0
- package/dist/esm/components/Nestable/actions/index.js +13 -0
- package/dist/esm/components/Nestable/actions/index.js.map +7 -0
- package/dist/esm/components/Nestable/actions/moveItem.js +42 -0
- package/dist/esm/components/Nestable/actions/moveItem.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/paths.js +19 -47
- package/dist/esm/components/Nestable/actions/paths.js.map +7 -0
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js +22 -0
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/tryIncreaseDepth.js +10 -22
- package/dist/esm/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/dist/esm/components/Nestable/index.js +7 -0
- package/dist/esm/components/Nestable/index.js.map +7 -0
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js +7 -0
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/dist/esm/components/QueryBuilderImpl.js +226 -0
- package/dist/esm/components/QueryBuilderImpl.js.map +7 -0
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js +81 -0
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js +208 -0
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js +31 -0
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/dist/esm/components/format/format.js +30 -0
- package/dist/esm/components/format/format.js.map +7 -0
- package/dist/esm/components/format/sqlFormat.js +65 -0
- package/dist/esm/components/format/sqlFormat.js.map +7 -0
- package/dist/esm/components/format/sqlSafeFormat.js +69 -0
- package/dist/esm/components/format/sqlSafeFormat.js.map +7 -0
- package/dist/esm/components/format/xmlFormat.js +65 -0
- package/dist/esm/components/format/xmlFormat.js.map +7 -0
- package/dist/esm/components/helpers/actions.js +230 -0
- package/dist/esm/components/helpers/actions.js.map +7 -0
- package/dist/esm/components/helpers/constants.js +10 -0
- package/dist/esm/components/helpers/constants.js.map +7 -0
- package/dist/esm/components/helpers/dependencies.js +40 -0
- package/dist/esm/components/helpers/dependencies.js.map +7 -0
- package/dist/esm/components/helpers/selectors.js +132 -0
- package/dist/esm/components/helpers/selectors.js.map +7 -0
- package/dist/esm/components/helpers/store.js +157 -0
- package/dist/esm/components/helpers/store.js.map +7 -0
- package/dist/esm/components/helpers/types.js +63 -0
- package/dist/esm/components/helpers/types.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +76 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/package.json +103 -94
- package/cjs/DSQueryBuilder.js +0 -98
- package/cjs/components/AndOrController/AndOrController.js +0 -222
- package/cjs/components/ConditionController/ConditionController.js +0 -100
- package/cjs/components/DisplayOutput/DisplayOutput.js +0 -93
- package/cjs/components/DragContainerController/DragContainerController.js +0 -45
- package/cjs/components/DragControllerRow/DragControllerRow.js +0 -47
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +0 -33
- package/cjs/components/Nestable/Nestable.js +0 -320
- package/cjs/components/Nestable/NestableItem.js +0 -111
- package/cjs/components/Nestable/actions/events.js +0 -166
- package/cjs/components/Nestable/actions/getItemOptions.js +0 -28
- package/cjs/components/Nestable/actions/getPaths.js +0 -124
- package/cjs/components/Nestable/actions/index.js +0 -28
- package/cjs/components/Nestable/actions/moveItem.js +0 -54
- package/cjs/components/Nestable/actions/paths.js +0 -126
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +0 -35
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +0 -38
- package/cjs/components/Nestable/index.js +0 -7
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +0 -13
- package/cjs/components/QueryBuilderImpl.js +0 -309
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +0 -90
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +0 -276
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +0 -29
- package/cjs/components/format/format.js +0 -33
- package/cjs/components/format/sqlFormat.js +0 -73
- package/cjs/components/format/sqlSafeFormat.js +0 -81
- package/cjs/components/format/xmlFormat.js +0 -73
- package/cjs/components/helpers/actions.js +0 -277
- package/cjs/components/helpers/constants.js +0 -11
- package/cjs/components/helpers/dependencies.js +0 -84
- package/cjs/components/helpers/selectors.js +0 -101
- package/cjs/components/helpers/store.js +0 -177
- package/cjs/components/helpers/types.js +0 -64
- package/cjs/index.js +0 -29
- package/cjs/propTypes.js +0 -97
- package/esm/DSQueryBuilder.js +0 -74
- package/esm/components/AndOrController/AndOrController.js +0 -213
- package/esm/components/ConditionController/ConditionController.js +0 -92
- package/esm/components/DisplayOutput/DisplayOutput.js +0 -87
- package/esm/components/DragContainerController/DragContainerController.js +0 -39
- package/esm/components/DragControllerRow/DragControllerRow.js +0 -39
- package/esm/components/FieldControllerRow/FieldControllerRow.js +0 -27
- package/esm/components/Nestable/Nestable.js +0 -312
- package/esm/components/Nestable/NestableItem.js +0 -103
- package/esm/components/Nestable/actions/events.js +0 -153
- package/esm/components/Nestable/actions/index.js +0 -6
- package/esm/components/Nestable/actions/moveItem.js +0 -45
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +0 -31
- package/esm/components/Nestable/index.js +0 -2
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +0 -5
- package/esm/components/QueryBuilderImpl.js +0 -301
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +0 -83
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +0 -268
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +0 -20
- package/esm/components/format/format.js +0 -31
- package/esm/components/format/sqlFormat.js +0 -69
- package/esm/components/format/sqlSafeFormat.js +0 -76
- package/esm/components/format/xmlFormat.js +0 -69
- package/esm/components/helpers/actions.js +0 -254
- package/esm/components/helpers/constants.js +0 -5
- package/esm/components/helpers/dependencies.js +0 -60
- package/esm/components/helpers/selectors.js +0 -93
- package/esm/components/helpers/store.js +0 -171
- package/esm/components/helpers/types.js +0 -52
- package/esm/index.js +0 -4
- package/esm/propTypes.js +0 -93
- package/types/DSQueryBuilder.d.ts +0 -211
- package/types/components/AndOrController/AndOrController.d.ts +0 -38
- package/types/components/ConditionController/ConditionController.d.ts +0 -16
- package/types/components/DisplayOutput/DisplayOutput.d.ts +0 -7
- package/types/components/DragContainerController/DragContainerController.d.ts +0 -9
- package/types/components/DragControllerRow/DragControllerRow.d.ts +0 -9
- package/types/components/FieldControllerRow/FieldControllerRow.d.ts +0 -9
- package/types/components/Nestable/Nestable.d.ts +0 -51
- package/types/components/Nestable/NestableItem.d.ts +0 -12
- package/types/components/Nestable/actions/events.d.ts +0 -6
- package/types/components/Nestable/actions/getItemOptions.d.ts +0 -11
- package/types/components/Nestable/actions/getPaths.d.ts +0 -5
- package/types/components/Nestable/actions/index.d.ts +0 -6
- package/types/components/Nestable/actions/moveItem.d.ts +0 -5
- package/types/components/Nestable/actions/paths.d.ts +0 -5
- package/types/components/Nestable/actions/tryDecreaseDepth.d.ts +0 -1
- package/types/components/Nestable/actions/tryIncreaseDepth.d.ts +0 -1
- package/types/components/Nestable/index.d.ts +0 -2
- package/types/components/QueryBuilderContext/QueryBuilderContext.d.ts +0 -2
- package/types/components/QueryBuilderImpl.d.ts +0 -49
- package/types/components/QueryBuilderItem/QueryBuilderItem.d.ts +0 -5
- package/types/components/QueryBuilderRow/QueryBuilderRow.d.ts +0 -12
- package/types/components/ToolBarAnimation/ToolBarAnimation.d.ts +0 -3
- package/types/components/format/format.d.ts +0 -26
- package/types/components/format/sqlFormat.d.ts +0 -5
- package/types/components/format/sqlSafeFormat.d.ts +0 -6
- package/types/components/format/xmlFormat.d.ts +0 -5
- package/types/components/helpers/actions.d.ts +0 -63
- package/types/components/helpers/constants.d.ts +0 -3
- package/types/components/helpers/dependencies.d.ts +0 -1
- package/types/components/helpers/selectors.d.ts +0 -20
- package/types/components/helpers/store.d.ts +0 -144
- package/types/components/helpers/types.d.ts +0 -50
- package/types/index.d.ts +0 -2
- package/types/propTypes.d.ts +0 -156
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
30
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(module2))
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
33
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
|
+
var QueryBuilderRow_exports = {};
|
|
46
|
+
__export(QueryBuilderRow_exports, {
|
|
47
|
+
default: () => QueryBuilderRow_default
|
|
48
|
+
});
|
|
49
|
+
var React = __toESM(require("react"));
|
|
50
|
+
var import_react = __toESM(require("react"));
|
|
51
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
52
|
+
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
|
53
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
54
|
+
var import_dependencies = require("../helpers/dependencies");
|
|
55
|
+
var import_ConditionController = __toESM(require("../ConditionController/ConditionController"));
|
|
56
|
+
var import_DragControllerRow = __toESM(require("../DragControllerRow/DragControllerRow"));
|
|
57
|
+
const RenderField = ({
|
|
58
|
+
target,
|
|
59
|
+
component,
|
|
60
|
+
valueProp,
|
|
61
|
+
additionalInfo,
|
|
62
|
+
handleMouseEnterInput,
|
|
63
|
+
handleMouseLeaveInput,
|
|
64
|
+
onChangeHandler,
|
|
65
|
+
hasError
|
|
66
|
+
}) => {
|
|
67
|
+
const ref = import_react.default.useRef();
|
|
68
|
+
const id = import_react.default.useMemo(() => `el_${String.fromCharCode(65 + Math.floor(Math.random() * 26))}`, []);
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
70
|
+
className: `em-ds-query-builder-row-input child-type-${target} ${hasError && hasError.error ? "row-input-error" : ""}`,
|
|
71
|
+
onMouseDownCapture: () => {
|
|
72
|
+
const _refInput = ref.current?.querySelector(`#${id}`);
|
|
73
|
+
if (_refInput && _refInput.focus)
|
|
74
|
+
setTimeout(_refInput.focus());
|
|
75
|
+
handleMouseEnterInput();
|
|
76
|
+
},
|
|
77
|
+
onMouseEnter: () => handleMouseEnterInput(),
|
|
78
|
+
onMouseLeave: () => handleMouseLeaveInput()
|
|
79
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
80
|
+
ref,
|
|
81
|
+
className: "em-ds-query-builder-row__input-controller"
|
|
82
|
+
}, import_react.default.cloneElement(component, {
|
|
83
|
+
id,
|
|
84
|
+
onChange: (e, extraData) => onChangeHandler(e, target, extraData),
|
|
85
|
+
value: valueProp != null ? valueProp : "",
|
|
86
|
+
checked: valueProp === true,
|
|
87
|
+
additionalInfo: additionalInfo ? additionalInfo[target] : additionalInfo || {},
|
|
88
|
+
"aria-invalid": Boolean(hasError)
|
|
89
|
+
})), hasError && hasError.errorMessage ? /* @__PURE__ */ import_react.default.createElement("div", {
|
|
90
|
+
style: { width: "40px" }
|
|
91
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, {
|
|
92
|
+
text: hasError.errorMessage
|
|
93
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
94
|
+
tabIndex: 0,
|
|
95
|
+
className: "row-icon-alert",
|
|
96
|
+
"data-testid": "qb-error-state-icon",
|
|
97
|
+
role: "alert"
|
|
98
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_icons.AlertsDetail, {
|
|
99
|
+
width: 20,
|
|
100
|
+
height: 20,
|
|
101
|
+
color: ["danger", 900],
|
|
102
|
+
title: hasError.errorMessage
|
|
103
|
+
})))) : null);
|
|
104
|
+
};
|
|
105
|
+
class QueryBuilderRow extends import_react.Component {
|
|
106
|
+
constructor(props) {
|
|
107
|
+
super(props);
|
|
108
|
+
this.handleMouseEnterRow = () => {
|
|
109
|
+
};
|
|
110
|
+
this.handleMouseLeaveRow = () => {
|
|
111
|
+
this.handleTooltipRow(false);
|
|
112
|
+
};
|
|
113
|
+
this.handleMouseEnterInput = () => {
|
|
114
|
+
const { setDraggableItems } = this.props;
|
|
115
|
+
setDraggableItems(false);
|
|
116
|
+
};
|
|
117
|
+
this.handleMouseLeaveInput = () => {
|
|
118
|
+
const { setDraggableItems } = this.props;
|
|
119
|
+
setDraggableItems(true);
|
|
120
|
+
};
|
|
121
|
+
this.handleTooltipRow = (isOpen) => {
|
|
122
|
+
this.setState({ isOpen });
|
|
123
|
+
};
|
|
124
|
+
this.state = {
|
|
125
|
+
isOpen: false
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
onChangeHandler(e, target, extraData, hasError) {
|
|
129
|
+
const { handleFieldChange, idFilter, idGroup, additionalInfo, field, operator, value } = this.props;
|
|
130
|
+
let eventValue = e;
|
|
131
|
+
if (e && e.target) {
|
|
132
|
+
const { value: value2, checked } = e.target;
|
|
133
|
+
if (value2 || value2 === "" || typeof value2 === "boolean")
|
|
134
|
+
eventValue = value2;
|
|
135
|
+
else
|
|
136
|
+
eventValue = checked || e;
|
|
137
|
+
}
|
|
138
|
+
handleFieldChange({
|
|
139
|
+
[target]: eventValue,
|
|
140
|
+
idFilter,
|
|
141
|
+
idGroup,
|
|
142
|
+
additionalInfo: __spreadProps(__spreadValues({}, additionalInfo), {
|
|
143
|
+
[target]: extraData,
|
|
144
|
+
[`${target}_error`]: hasError,
|
|
145
|
+
[`${target}_touched`]: true
|
|
146
|
+
}),
|
|
147
|
+
target
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
const { isOpen } = this.state;
|
|
152
|
+
const {
|
|
153
|
+
fields,
|
|
154
|
+
onAddFilter,
|
|
155
|
+
onRemoveFilter,
|
|
156
|
+
onAddRuleContainer,
|
|
157
|
+
field,
|
|
158
|
+
operator,
|
|
159
|
+
value,
|
|
160
|
+
additionalInfo,
|
|
161
|
+
items,
|
|
162
|
+
singleRow,
|
|
163
|
+
toolTipZIndex,
|
|
164
|
+
error
|
|
165
|
+
} = this.props;
|
|
166
|
+
const { cssClassName, classNameBlock, classNameElement } = (0, import_ds_classnames.convertPropToCssClassName)("query-builder-row", isOpen ? "has-open-tooltip" : "has-close-tooltip", singleRow ? "is-single-row" : "is-multiple-row");
|
|
167
|
+
const test = (0, import_dependencies.resolveDependencies)({
|
|
168
|
+
field,
|
|
169
|
+
operator,
|
|
170
|
+
value,
|
|
171
|
+
additionalInfo
|
|
172
|
+
}, fields);
|
|
173
|
+
const gridTemplateColumns = [
|
|
174
|
+
"24px",
|
|
175
|
+
...test.map((r) => {
|
|
176
|
+
if (r.handleWidth) {
|
|
177
|
+
return r.handleWidth(this.props[r.target], {
|
|
178
|
+
field,
|
|
179
|
+
operator,
|
|
180
|
+
value,
|
|
181
|
+
additionalInfo
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return "minmax(0, 1fr)";
|
|
185
|
+
}),
|
|
186
|
+
"30px"
|
|
187
|
+
].join(" ");
|
|
188
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
189
|
+
className: cssClassName,
|
|
190
|
+
onMouseEnter: this.handleMouseEnterRow,
|
|
191
|
+
onMouseLeave: this.handleMouseLeaveRow,
|
|
192
|
+
style: {
|
|
193
|
+
gridTemplateColumns
|
|
194
|
+
}
|
|
195
|
+
}, !singleRow && /* @__PURE__ */ import_react.default.createElement(import_DragControllerRow.default, {
|
|
196
|
+
className: classNameElement("drag-controller"),
|
|
197
|
+
onMouseDownCapture: () => this.handleMouseLeaveInput()
|
|
198
|
+
}), test.map((renderField) => {
|
|
199
|
+
const { target, component } = renderField;
|
|
200
|
+
const { [target]: valueProp } = this.props;
|
|
201
|
+
const isTouched = additionalInfo && additionalInfo[`${target}_touched`];
|
|
202
|
+
const hasError = renderField && renderField.validation ? renderField.validation(valueProp, {
|
|
203
|
+
field,
|
|
204
|
+
operator,
|
|
205
|
+
value,
|
|
206
|
+
additionalInfo
|
|
207
|
+
}) : false;
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement(RenderField, {
|
|
209
|
+
component,
|
|
210
|
+
target,
|
|
211
|
+
valueProp,
|
|
212
|
+
onChangeHandler: (e, target2, extraData) => {
|
|
213
|
+
this.onChangeHandler(e, target2, extraData, hasError);
|
|
214
|
+
},
|
|
215
|
+
handleMouseEnterInput: this.handleMouseEnterInput,
|
|
216
|
+
handleMouseLeaveInput: this.handleMouseLeaveInput,
|
|
217
|
+
additionalInfo,
|
|
218
|
+
hasError: isTouched && hasError
|
|
219
|
+
});
|
|
220
|
+
}), !singleRow && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
221
|
+
className: classNameBlock("controller")
|
|
222
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ConditionController.default, {
|
|
223
|
+
handleTooltipRow: this.handleTooltipRow,
|
|
224
|
+
isOpen,
|
|
225
|
+
items,
|
|
226
|
+
onAddFilter,
|
|
227
|
+
onAddRuleContainer,
|
|
228
|
+
onRemoveFilter,
|
|
229
|
+
toolTipZIndex
|
|
230
|
+
}))));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
var QueryBuilderRow_default = QueryBuilderRow;
|
|
234
|
+
module.exports = __toCommonJS(QueryBuilderRow_exports);
|
|
235
|
+
//# sourceMappingURL=QueryBuilderRow.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/QueryBuilderRow/QueryBuilderRow.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { Component } from 'react';\nimport { AlertsDetail } from '@elliemae/ds-icons';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { resolveDependencies } from '../helpers/dependencies';\nimport ConditionController from '../ConditionController/ConditionController';\nimport DragControllerRow from '../DragControllerRow/DragControllerRow';\n\nconst RenderField = ({\n target,\n component,\n valueProp,\n additionalInfo,\n handleMouseEnterInput,\n handleMouseLeaveInput,\n onChangeHandler,\n hasError,\n}) => {\n const ref = React.useRef<HTMLElement>();\n const id = React.useMemo(() => `el_${String.fromCharCode(65 + Math.floor(Math.random() * 26))}`, []);\n return (\n <div\n className={`em-ds-query-builder-row-input child-type-${target} ${hasError && hasError.error ? 'row-input-error' : ''\n }`}\n onMouseDownCapture={() => {\n // eslint-disable-next-line no-underscore-dangle\n const _refInput = ref.current?.querySelector(`#${id}`);\n if (_refInput && _refInput.focus) setTimeout(_refInput.focus());\n handleMouseEnterInput();\n }}\n onMouseEnter={() => handleMouseEnterInput()}\n onMouseLeave={() => handleMouseLeaveInput()}\n >\n <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n {React.cloneElement(component, {\n id,\n onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n value: valueProp != null ? valueProp : '',\n checked: valueProp === true,\n additionalInfo: additionalInfo ? additionalInfo[target] : additionalInfo || {},\n 'aria-invalid': Boolean(hasError),\n })}\n </div>\n {hasError && hasError.errorMessage ? (\n <div style={{ width: '40px' }}>\n <DSTooltipV3 text={hasError.errorMessage}>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div tabIndex={0} className=\"row-icon-alert\" data-testid=\"qb-error-state-icon\" role=\"alert\">\n <AlertsDetail width={20} height={20} color={['danger', 900]} title={hasError.errorMessage} />\n </div>\n </DSTooltipV3>\n </div>\n ) : null}\n </div>\n );\n // return React.useMemo(\n // () => (\n // <div\n // className={`em-ds-query-builder-row-input child-type-${target}`}\n // onMouseDownCapture={() => {\n // // eslint-disable-next-line no-underscore-dangle\n // const _refInput = ref.current.querySelector(`#${id}`);\n // if (_refInput && _refInput.focus) setTimeout(_refInput.focus());\n // handleMouseEnterInput();\n // }}\n // onMouseEnter={() => handleMouseEnterInput()}\n // onMouseLeave={() => handleMouseLeaveInput()}\n // >\n // <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n // {React.cloneElement(component, {\n // id,\n // onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n // value: valueProp != null ? valueProp : '',\n // checked: valueProp === true,\n // additionalInfo: additionalInfo ? additionalInfo[target] : {},\n // })}\n // </div>\n // </div>\n // ),\n // [target, component, valueProp, additionalInfo],\n // );\n};\nclass QueryBuilderRow extends Component<any, any> {\n constructor(props: any) {\n super(props);\n this.state = {\n isOpen: false,\n };\n }\n\n onChangeHandler(e, target, extraData, hasError) {\n const { handleFieldChange, idFilter, idGroup, additionalInfo, field, operator, value } = this.props;\n let eventValue = e;\n if (e && e.target) {\n const { value, checked } = e.target;\n if (value || value === '' || typeof value === 'boolean') eventValue = value;\n else eventValue = checked || e;\n }\n handleFieldChange({\n [target]: eventValue,\n idFilter,\n idGroup,\n additionalInfo: {\n ...additionalInfo,\n [target]: extraData,\n [`${target}_error`]: hasError,\n [`${target}_touched`]: true,\n },\n target,\n });\n }\n\n handleMouseEnterRow = () => { };\n\n handleMouseLeaveRow = () => {\n this.handleTooltipRow(false);\n };\n\n handleMouseEnterInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(false);\n };\n\n handleMouseLeaveInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(true);\n };\n\n handleTooltipRow = (isOpen) => {\n this.setState({ isOpen });\n };\n\n render() {\n const { isOpen } = this.state;\n const {\n fields,\n onAddFilter,\n onRemoveFilter,\n onAddRuleContainer,\n field,\n operator,\n value,\n additionalInfo,\n items,\n singleRow,\n toolTipZIndex,\n error,\n } = this.props;\n const { cssClassName, classNameBlock, classNameElement } = convertPropToCssClassName(\n 'query-builder-row',\n isOpen ? 'has-open-tooltip' : 'has-close-tooltip',\n singleRow ? 'is-single-row' : 'is-multiple-row',\n );\n const test = resolveDependencies(\n {\n field,\n operator,\n value,\n additionalInfo,\n },\n fields,\n );\n\n const gridTemplateColumns = [\n '24px',\n ...test.map((r) => {\n if (r.handleWidth) {\n return r.handleWidth(this.props[r.target], {\n field,\n operator,\n value,\n additionalInfo,\n });\n }\n return 'minmax(0, 1fr)';\n }),\n '30px',\n ].join(' ');\n\n return (\n <>\n <div\n className={cssClassName}\n onMouseEnter={this.handleMouseEnterRow}\n onMouseLeave={this.handleMouseLeaveRow}\n style={{\n gridTemplateColumns,\n }}\n >\n {!singleRow && (\n <DragControllerRow\n className={classNameElement('drag-controller')}\n onMouseDownCapture={() => this.handleMouseLeaveInput()}\n />\n )}\n {test.map((renderField) => {\n const { target, component } = renderField;\n const { [target]: valueProp } = this.props;\n\n const isTouched = additionalInfo && additionalInfo[`${target}_touched`];\n const hasError =\n renderField && renderField.validation\n ? renderField.validation(valueProp, {\n field,\n operator,\n value,\n additionalInfo,\n })\n : false;\n return (\n <RenderField\n component={component}\n target={target}\n valueProp={valueProp}\n onChangeHandler={(e, target, extraData) => {\n this.onChangeHandler(e, target, extraData, hasError);\n }}\n handleMouseEnterInput={this.handleMouseEnterInput}\n handleMouseLeaveInput={this.handleMouseLeaveInput}\n additionalInfo={additionalInfo}\n hasError={isTouched && hasError}\n />\n );\n })}\n {!singleRow && (\n <div className={classNameBlock('controller')}>\n <ConditionController\n handleTooltipRow={this.handleTooltipRow}\n isOpen={isOpen}\n items={items}\n onAddFilter={onAddFilter}\n onAddRuleContainer={onAddRuleContainer}\n onRemoveFilter={onRemoveFilter}\n toolTipZIndex={toolTipZIndex}\n />\n </div>\n )}\n </div>\n </>\n );\n }\n}\n\nexport default QueryBuilderRow;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAiC;AACjC,sBAA6B;AAC7B,wBAA4B;AAC5B,2BAA0C;AAC1C,0BAAoC;AACpC,iCAAgC;AAChC,+BAA8B;AAE9B,MAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,MAAM,qBAAM;AAClB,QAAM,KAAK,qBAAM,QAAQ,MAAM,MAAM,OAAO,aAAa,KAAK,KAAK,MAAM,KAAK,WAAW,QAAQ;AACjG,SACE,mDAAC,OAAD;AAAA,IACE,WAAW,4CAA4C,UAAU,YAAY,SAAS,QAAQ,oBAAoB;AAAA,IAElH,oBAAoB,MAAM;AAExB,YAAM,YAAY,IAAI,SAAS,cAAc,IAAI;AACjD,UAAI,aAAa,UAAU;AAAO,mBAAW,UAAU;AACvD;AAAA;AAAA,IAEF,cAAc,MAAM;AAAA,IACpB,cAAc,MAAM;AAAA,KAEpB,mDAAC,OAAD;AAAA,IAAK;AAAA,IAAU,WAAU;AAAA,KACtB,qBAAM,aAAa,WAAW;AAAA,IAC7B;AAAA,IACA,UAAU,CAAC,GAAG,cAAc,gBAAgB,GAAG,QAAQ;AAAA,IACvD,OAAO,aAAa,OAAO,YAAY;AAAA,IACvC,SAAS,cAAc;AAAA,IACvB,gBAAgB,iBAAiB,eAAe,UAAU,kBAAkB;AAAA,IAC5E,gBAAgB,QAAQ;AAAA,OAG3B,YAAY,SAAS,eACpB,mDAAC,OAAD;AAAA,IAAK,OAAO,EAAE,OAAO;AAAA,KACnB,mDAAC,+BAAD;AA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5B;AAAA,QACA,UAAU,aAAa;AAAA;AAAA,QAI5B,CAAC,aACA,mDAAC,OAAD;AAAA,MAAK,WAAW,eAAe;AAAA,OAC7B,mDAAC,oCAAD;AAAA,MACE,kBAAkB,KAAK;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;AAUhB,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
30
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(module2))
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
33
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
|
+
var ToolBarAnimation_exports = {};
|
|
46
|
+
__export(ToolBarAnimation_exports, {
|
|
47
|
+
ToolBarAnimation: () => ToolBarAnimation
|
|
48
|
+
});
|
|
49
|
+
var React = __toESM(require("react"));
|
|
50
|
+
var import_react = __toESM(require("react"));
|
|
51
|
+
var import_GrowRight = __toESM(require("@elliemae/ds-shared/Animations/GrowRight"));
|
|
52
|
+
const ToolBarAnimation = (props) => /* @__PURE__ */ import_react.default.createElement(import_GrowRight.default, __spreadProps(__spreadValues({}, props), {
|
|
53
|
+
key: "popper-animation-key",
|
|
54
|
+
from: 0.5,
|
|
55
|
+
to: 1
|
|
56
|
+
}));
|
|
57
|
+
module.exports = __toCommonJS(ToolBarAnimation_exports);
|
|
58
|
+
//# sourceMappingURL=ToolBarAnimation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ToolBarAnimation/ToolBarAnimation.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport GrowRight from '@elliemae/ds-shared/Animations/GrowRight';\n\nconst ToolBarAnimation = props => (\n <GrowRight {...props} key=\"popper-animation-key\" from={0.5} to={1} />\n);\n\nexport { ToolBarAnimation };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,uBAAsB;AAEtB,MAAM,mBAAmB,WACvB,mDAAC,0BAAD,iCAAe,QAAf;AAAA,EAAsB,KAAI;AAAA,EAAuB,MAAM;AAAA,EAAK,IAAI;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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");
|
|
36
|
+
class QueryBuilderFormat {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.format = {
|
|
39
|
+
defaultFormat: (query) => query,
|
|
40
|
+
sqlFormat: import_sqlFormat.sqlFormat,
|
|
41
|
+
xmlFormat: import_xmlFormat.xmlFormat,
|
|
42
|
+
sqlSafeFormat: import_sqlSafeFormat.sqlSafeFormat
|
|
43
|
+
};
|
|
44
|
+
this.currentFormat = "sqlFormat";
|
|
45
|
+
this.setDefaultFormat = (formatName) => {
|
|
46
|
+
if (this.format[formatName])
|
|
47
|
+
this.currentFormat = formatName;
|
|
48
|
+
};
|
|
49
|
+
this.addFormat = (formatName, format) => this.format[formatName] = format;
|
|
50
|
+
this.run = (query, formatName) => {
|
|
51
|
+
if (this.format[formatName])
|
|
52
|
+
return this.format[formatName](query);
|
|
53
|
+
return this.format[this.currentFormat](query);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var format_default = new QueryBuilderFormat();
|
|
58
|
+
module.exports = __toCommonJS(format_exports);
|
|
59
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/format/format.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA0B;AAC1B,uBAA0B;AAC1B,2BAA8B;AAE9B,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
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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");
|
|
34
|
+
const conditionSql = (condition, value) => {
|
|
35
|
+
const {
|
|
36
|
+
EQUAL,
|
|
37
|
+
NOT_EQUAL,
|
|
38
|
+
GREATER_THAN,
|
|
39
|
+
LESS_THAN,
|
|
40
|
+
CONTAINS,
|
|
41
|
+
NOT_CONTAINS,
|
|
42
|
+
BETWEEN,
|
|
43
|
+
GREATER_THAN_OR_EQUAL,
|
|
44
|
+
LESS_THAN_OR_EQUAL,
|
|
45
|
+
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}%'`;
|
|
67
|
+
return condition;
|
|
68
|
+
};
|
|
69
|
+
const renderFilterSQl = (filter) => {
|
|
70
|
+
const { field, operator, value } = filter.element;
|
|
71
|
+
return `${field} ${conditionSql(operator, value) || ""}`;
|
|
72
|
+
};
|
|
73
|
+
const sqlFormat = ({ main, mapGroups, items }) => {
|
|
74
|
+
const groupSql = (item, idGroup) => {
|
|
75
|
+
if (idGroup === main) {
|
|
76
|
+
const groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
|
|
77
|
+
return ` ( ${filterSql(item, groupCondition2)} ) `;
|
|
78
|
+
}
|
|
79
|
+
const groupCondition = item.element.condition === true ? "AND" : "OR";
|
|
80
|
+
return ` ( ${filterSql(item.children, groupCondition)} ) `;
|
|
81
|
+
};
|
|
82
|
+
const filterSql = (filters, groupCondition) => {
|
|
83
|
+
const filterGroup = filters.map((filter) => {
|
|
84
|
+
if (filter.element.type === "filter")
|
|
85
|
+
return ` ${renderFilterSQl(filter)} `;
|
|
86
|
+
return ` ${groupSql(filter) || ""} `;
|
|
87
|
+
});
|
|
88
|
+
return filterGroup.join(groupCondition);
|
|
89
|
+
};
|
|
90
|
+
const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
|
|
91
|
+
return sql;
|
|
92
|
+
};
|
|
93
|
+
module.exports = __toCommonJS(sqlFormat_exports);
|
|
94
|
+
//# sourceMappingURL=sqlFormat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/format/sqlFormat.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkC;AAElC,MAAM,eAAe,CAAC,WAAW,UAAU;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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Prop = 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");
|
|
35
|
+
const specialChar = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
|
|
36
|
+
const conditionSql = (condition, value) => {
|
|
37
|
+
const {
|
|
38
|
+
EQUAL,
|
|
39
|
+
NOT_EQUAL,
|
|
40
|
+
GREATER_THAN,
|
|
41
|
+
LESS_THAN,
|
|
42
|
+
CONTAINS,
|
|
43
|
+
NOT_CONTAINS,
|
|
44
|
+
BETWEEN,
|
|
45
|
+
GREATER_THAN_OR_EQUAL,
|
|
46
|
+
LESS_THAN_OR_EQUAL,
|
|
47
|
+
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}%'`;
|
|
70
|
+
return condition;
|
|
71
|
+
};
|
|
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) || ""}`;
|
|
76
|
+
};
|
|
77
|
+
const sqlSafeFormat = ({ main, mapGroups, items }) => {
|
|
78
|
+
const groupSql = (item, idGroup) => {
|
|
79
|
+
if (idGroup === main) {
|
|
80
|
+
const groupCondition2 = mapGroups[idGroup].condition === true ? "AND" : "OR";
|
|
81
|
+
return ` ( ${filterSql(item, groupCondition2)} ) `;
|
|
82
|
+
}
|
|
83
|
+
const groupCondition = item.element.condition === true ? "AND" : "OR";
|
|
84
|
+
return ` ( ${filterSql(item.children, groupCondition)} ) `;
|
|
85
|
+
};
|
|
86
|
+
const filterSql = (filters, groupCondition) => {
|
|
87
|
+
const filterGroup = filters.map((filter) => {
|
|
88
|
+
if (filter.element.type === "filter")
|
|
89
|
+
return ` ${renderFilterSQl(filter)} `;
|
|
90
|
+
return ` ${groupSql(filter) || ""} `;
|
|
91
|
+
});
|
|
92
|
+
return filterGroup.join(groupCondition);
|
|
93
|
+
};
|
|
94
|
+
const sql = ` FROM [TABLE_NAME] WHERE ${groupSql(items, main) || ""} `;
|
|
95
|
+
return sql;
|
|
96
|
+
};
|
|
97
|
+
module.exports = __toCommonJS(sqlSafeFormat_exports);
|
|
98
|
+
//# sourceMappingURL=sqlSafeFormat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/format/sqlSafeFormat.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* 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)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