@elliemae/ds-query-builder 2.0.0-next.1 → 2.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/cjs/components/AndOrController/AndOrController.js +5 -5
- package/cjs/components/ConditionController/ConditionController.js +1 -1
- package/cjs/components/DragContainerController/DragContainerController.js +1 -1
- package/cjs/components/Nestable/Nestable.js +3 -3
- package/cjs/components/Nestable/NestableItem.js +3 -3
- package/cjs/components/Nestable/actions/events.js +1 -1
- package/cjs/components/Nestable/actions/getPaths.js +2 -0
- package/cjs/components/Nestable/actions/paths.js +2 -0
- package/cjs/components/QueryBuilderImpl.js +1 -1
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +7 -6
- package/cjs/components/format/sqlFormat.js +16 -16
- package/cjs/components/format/sqlSafeFormat.js +18 -18
- package/cjs/components/format/xmlFormat.js +16 -16
- package/cjs/components/helpers/actions.js +2 -2
- package/cjs/propTypes.js +1 -3
- package/esm/components/AndOrController/AndOrController.js +5 -5
- package/esm/components/ConditionController/ConditionController.js +1 -1
- package/esm/components/DragContainerController/DragContainerController.js +1 -1
- package/esm/components/Nestable/Nestable.js +3 -3
- package/esm/components/Nestable/NestableItem.js +3 -3
- package/esm/components/Nestable/actions/events.js +1 -1
- package/esm/components/Nestable/actions/getPaths.js +2 -0
- package/esm/components/Nestable/actions/paths.js +2 -0
- package/esm/components/QueryBuilderImpl.js +1 -1
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +7 -6
- package/esm/components/format/sqlFormat.js +16 -16
- package/esm/components/format/sqlSafeFormat.js +18 -18
- package/esm/components/format/xmlFormat.js +16 -16
- package/esm/components/helpers/actions.js +2 -2
- package/esm/propTypes.js +1 -3
- package/package.json +6 -6
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -119,12 +119,12 @@ class AndOrController extends React.Component {
|
|
|
119
119
|
} = this.state;
|
|
120
120
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
121
121
|
ref: this.myRef,
|
|
122
|
-
className:
|
|
122
|
+
className: "".concat(cssClassName, " ").concat(mainModifier(condition ? 'active' : 'default'), " step-").concat(step, " ").concat(isMain ? 'is-main-group-join' : '') // onMouseEnter={this.handleMouseEnterRow}
|
|
123
123
|
,
|
|
124
124
|
onMouseLeave: this.handleMouseLeaveRow // onMouseMove={this.handleMouseMove}
|
|
125
125
|
,
|
|
126
126
|
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
127
|
-
className:
|
|
127
|
+
className: "".concat(classNameBlock('content'), " step-").concat(step)
|
|
128
128
|
}, void 0, /*#__PURE__*/_jsx__default["default"](DSTooltip__default["default"], {
|
|
129
129
|
delayClose: delayClose,
|
|
130
130
|
delayOpen: delayOpen,
|
|
@@ -142,8 +142,8 @@ class AndOrController extends React.Component {
|
|
|
142
142
|
style: {
|
|
143
143
|
transition: '0.2s',
|
|
144
144
|
position: 'absolute',
|
|
145
|
-
top:
|
|
146
|
-
right:
|
|
145
|
+
top: "".concat(top, "px"),
|
|
146
|
+
right: "".concat(right, "px")
|
|
147
147
|
},
|
|
148
148
|
children: [/*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
149
149
|
buttonType: buttonActionType,
|
|
@@ -177,7 +177,7 @@ class AndOrController extends React.Component {
|
|
|
177
177
|
}),
|
|
178
178
|
tooltipType: DSTooltip.TooltipType.TOOLBAR,
|
|
179
179
|
triggerComponent: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
180
|
-
className:
|
|
180
|
+
className: "".concat(classNameBlock('trigger-controller'), " ").concat(showDragController ? classNameBlockModifier('draggable', 'trigger-controller') : '', " step-").concat(step)
|
|
181
181
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
182
182
|
className: classNameElement('condition-display')
|
|
183
183
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
|
|
@@ -79,7 +79,7 @@ const ConditionController = ({
|
|
|
79
79
|
}
|
|
80
80
|
}), /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
81
81
|
buttonType: buttonActionType,
|
|
82
|
-
className:
|
|
82
|
+
className: "".concat(classNameElement('add-rule-container'), " no-border-right"),
|
|
83
83
|
icon: _ParenthesisAdd || (_ParenthesisAdd = /*#__PURE__*/_jsx__default["default"](ParenthesisAdd__default["default"], {})),
|
|
84
84
|
onClick: onAddRuleContainer,
|
|
85
85
|
size: buttonActionSize,
|
|
@@ -26,7 +26,7 @@ const DragContainerController = ({
|
|
|
26
26
|
cssClassName
|
|
27
27
|
} = dsClassnames.convertPropToCssClassName('query-builder-drag-group');
|
|
28
28
|
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
29
|
-
className:
|
|
29
|
+
className: "".concat(cssClassName)
|
|
30
30
|
}, void 0, /*#__PURE__*/_jsx__default["default"](Icon$1, {
|
|
31
31
|
color: color,
|
|
32
32
|
size: size
|
|
@@ -234,7 +234,7 @@ class Nestable extends React.Component {
|
|
|
234
234
|
const {
|
|
235
235
|
dragItem
|
|
236
236
|
} = this.state;
|
|
237
|
-
const el = document.querySelector(
|
|
237
|
+
const el = document.querySelector(".nestable-".concat(group, " .nestable-item-").concat(dragItem.id));
|
|
238
238
|
let listStyles = {};
|
|
239
239
|
|
|
240
240
|
if (el) {
|
|
@@ -276,11 +276,11 @@ class Nestable extends React.Component {
|
|
|
276
276
|
let childClass = 'single';
|
|
277
277
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
278
278
|
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
279
|
-
className: cn__default["default"]('nestable',
|
|
279
|
+
className: cn__default["default"]('nestable', "nestable-".concat(group), {
|
|
280
280
|
'is-drag-active': dragItem
|
|
281
281
|
})
|
|
282
282
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("ol", {
|
|
283
|
-
className:
|
|
283
|
+
className: "nestable-list nestable-group nestable-child-count-".concat(childClass)
|
|
284
284
|
}, void 0, items.map((item, i) => /*#__PURE__*/_jsx__default["default"](NestableItem, {
|
|
285
285
|
index: i,
|
|
286
286
|
isAndItem: isAndItem,
|
|
@@ -39,7 +39,7 @@ const NestableItem = ({
|
|
|
39
39
|
const isOrGroup = item.element.type === 'group' && (item.element.condition === '' || item.element.condition === false);
|
|
40
40
|
const isAndGroup = item.element.type === 'group' && !(item.element.condition === '' || item.element.condition === false);
|
|
41
41
|
const itemProps = {
|
|
42
|
-
className: cn__default["default"](
|
|
42
|
+
className: cn__default["default"]("nestable-item".concat(isCopy ? '-copy' : ''), "nestable-item".concat(isCopy ? '-copy' : '', "-").concat(item.id), "nestable-item-type-".concat(item.element.type), {
|
|
43
43
|
'is-or-group': isOrGroup,
|
|
44
44
|
'is-and-group': isAndGroup,
|
|
45
45
|
'is-and-filter': item.element.type === 'filter' && isAndItem,
|
|
@@ -79,7 +79,7 @@ const NestableItem = ({
|
|
|
79
79
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
80
80
|
return /*#__PURE__*/jsxRuntime.jsxs("li", _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
81
81
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
82
|
-
className:
|
|
82
|
+
className: "nestable-item-name nestable-item-name--".concat(item.element.type, " ")
|
|
83
83
|
}, rowProps), {}, {
|
|
84
84
|
children: renderItem({
|
|
85
85
|
item,
|
|
@@ -87,7 +87,7 @@ const NestableItem = ({
|
|
|
87
87
|
index
|
|
88
88
|
})
|
|
89
89
|
})), hasChildren && item.element.type === 'group' && !isCollapsed && /*#__PURE__*/_jsx__default["default"]("ol", {
|
|
90
|
-
className:
|
|
90
|
+
className: "nestable-list nestable-child-count-".concat(childClass, " ")
|
|
91
91
|
}, void 0, item[childrenProp].map((currentitem, i) => /*#__PURE__*/_jsx__default["default"](NestableItem, {
|
|
92
92
|
index: i,
|
|
93
93
|
isAndItem: isAndGroup,
|
|
@@ -54,7 +54,7 @@ function onMouseMove(e) {
|
|
|
54
54
|
clientY
|
|
55
55
|
} = e;
|
|
56
56
|
const transformProps = utils.getTransformProps(clientX, clientY);
|
|
57
|
-
const elCopy = document.querySelector(
|
|
57
|
+
const elCopy = document.querySelector(".nestable-".concat(group, " .nestable-drag-layer > .nestable-list"));
|
|
58
58
|
|
|
59
59
|
if (!this.elCopyStyles) {
|
|
60
60
|
const offset = utils.getOffsetRect(this.el);
|
|
@@ -268,7 +268,7 @@ class QueryBuilderImpl extends React.Component {
|
|
|
268
268
|
singleRow
|
|
269
269
|
}
|
|
270
270
|
}, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
271
|
-
className:
|
|
271
|
+
className: "nested-main-group ".concat(condition !== true ? 'is-or-group' : 'is-and-groupL', " ").concat(singleRow ? 'query-main-single-row' : 'query-main-multiple-row'),
|
|
272
272
|
children: [/*#__PURE__*/_jsx__default["default"](Nestable, {
|
|
273
273
|
isAndItem: condition === true,
|
|
274
274
|
isDraggableItem: this.isDraggableItem,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var AlertsDetail = require('@elliemae/ds-icons/AlertsDetail');
|
|
7
8
|
var DSTooltip = require('@elliemae/ds-basic/Tooltip');
|
|
@@ -33,14 +34,14 @@ const RenderField = ({
|
|
|
33
34
|
hasError
|
|
34
35
|
}) => {
|
|
35
36
|
const ref = React__default["default"].useRef();
|
|
36
|
-
const id = React__default["default"].useMemo(() =>
|
|
37
|
+
const id = React__default["default"].useMemo(() => "el_".concat(String.fromCharCode(65 + Math.floor(Math.random() * 26))), []);
|
|
37
38
|
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
38
|
-
className:
|
|
39
|
+
className: "em-ds-query-builder-row-input child-type-".concat(target, " ").concat(hasError && hasError.error ? 'row-input-error' : ''),
|
|
39
40
|
onMouseDownCapture: () => {
|
|
40
41
|
var _ref$current;
|
|
41
42
|
|
|
42
43
|
// eslint-disable-next-line no-underscore-dangle
|
|
43
|
-
const _refInput = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(
|
|
44
|
+
const _refInput = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("#".concat(id));
|
|
44
45
|
|
|
45
46
|
if (_refInput && _refInput.focus) setTimeout(_refInput.focus());
|
|
46
47
|
handleMouseEnterInput();
|
|
@@ -161,8 +162,8 @@ class QueryBuilderRow extends React.Component {
|
|
|
161
162
|
idGroup,
|
|
162
163
|
additionalInfo: _objectSpread(_objectSpread({}, additionalInfo), {}, {
|
|
163
164
|
[target]: extraData,
|
|
164
|
-
[
|
|
165
|
-
[
|
|
165
|
+
["".concat(target, "_error")]: hasError,
|
|
166
|
+
["".concat(target, "_touched")]: true
|
|
166
167
|
}),
|
|
167
168
|
target
|
|
168
169
|
});
|
|
@@ -217,7 +218,7 @@ class QueryBuilderRow extends React.Component {
|
|
|
217
218
|
const {
|
|
218
219
|
[target]: valueProp
|
|
219
220
|
} = this.props;
|
|
220
|
-
const isTouched = additionalInfo && additionalInfo[
|
|
221
|
+
const isTouched = additionalInfo && additionalInfo["".concat(target, "_touched")];
|
|
221
222
|
const hasError = renderField && renderField.validation ? renderField.validation(valueProp, {
|
|
222
223
|
field,
|
|
223
224
|
operator,
|
|
@@ -19,16 +19,16 @@ const conditionSql = (condition, value) => {
|
|
|
19
19
|
LESS_THAN_OR_EQUAL,
|
|
20
20
|
START_WITH
|
|
21
21
|
} = types.QB_OPERATOR_TYPES;
|
|
22
|
-
if (condition === EQUAL) return
|
|
23
|
-
if (condition === NOT_EQUAL) return
|
|
24
|
-
if (condition === GREATER_THAN) return
|
|
25
|
-
if (condition === LESS_THAN) return
|
|
26
|
-
if (condition === CONTAINS) return
|
|
27
|
-
if (condition === NOT_CONTAINS) return
|
|
28
|
-
if (condition === BETWEEN) return
|
|
29
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
30
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
31
|
-
if (condition === START_WITH) return
|
|
22
|
+
if (condition === EQUAL) return " = '".concat(value, "'");
|
|
23
|
+
if (condition === NOT_EQUAL) return " <> '".concat(value, "'");
|
|
24
|
+
if (condition === GREATER_THAN) return " > ".concat(value);
|
|
25
|
+
if (condition === LESS_THAN) return " < ".concat(value);
|
|
26
|
+
if (condition === CONTAINS) return " LIKE '%".concat(value, "%'");
|
|
27
|
+
if (condition === NOT_CONTAINS) return " NOT LIKE '%".concat(value, "%'");
|
|
28
|
+
if (condition === BETWEEN) return " BETWEEN ".concat(value[0], " AND ").concat(value[1], " ");
|
|
29
|
+
if (condition === GREATER_THAN_OR_EQUAL) return " >= ".concat(value);
|
|
30
|
+
if (condition === LESS_THAN_OR_EQUAL) return " <= ".concat(value);
|
|
31
|
+
if (condition === START_WITH) return " LIKE '".concat(value, "%'");
|
|
32
32
|
return condition;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ const renderFilterSQl = filter => {
|
|
|
38
38
|
operator,
|
|
39
39
|
value
|
|
40
40
|
} = filter.element;
|
|
41
|
-
return
|
|
41
|
+
return "".concat(field, " ").concat(conditionSql(operator, value) || '');
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const sqlFormat = ({
|
|
@@ -49,22 +49,22 @@ const sqlFormat = ({
|
|
|
49
49
|
const groupSql = (item, idGroup) => {
|
|
50
50
|
if (idGroup === main) {
|
|
51
51
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
52
|
-
return
|
|
52
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
56
|
-
return
|
|
56
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const filterSql = (filters, groupCondition) => {
|
|
60
60
|
const filterGroup = filters.map(filter => {
|
|
61
|
-
if (filter.element.type === 'filter') return
|
|
62
|
-
return
|
|
61
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
62
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
63
63
|
});
|
|
64
64
|
return filterGroup.join(groupCondition);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const sql =
|
|
67
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
68
68
|
return sql;
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -22,17 +22,17 @@ const conditionSql = (condition, value) => {
|
|
|
22
22
|
START_WITH
|
|
23
23
|
} = types.QB_OPERATOR_TYPES; // eslint-disable-next-line no-restricted-globals
|
|
24
24
|
|
|
25
|
-
const valueDisplay = isNaN(value) ?
|
|
26
|
-
if (condition === EQUAL) return
|
|
27
|
-
if (condition === NOT_EQUAL) return
|
|
28
|
-
if (condition === GREATER_THAN) return
|
|
29
|
-
if (condition === LESS_THAN) return
|
|
30
|
-
if (condition === CONTAINS) return
|
|
31
|
-
if (condition === NOT_CONTAINS) return
|
|
32
|
-
if (condition === BETWEEN) return
|
|
33
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
34
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
35
|
-
if (condition === START_WITH) return
|
|
25
|
+
const valueDisplay = isNaN(value) ? "'".concat(value, "'") : value;
|
|
26
|
+
if (condition === EQUAL) return " = ".concat(valueDisplay);
|
|
27
|
+
if (condition === NOT_EQUAL) return " <> ".concat(valueDisplay);
|
|
28
|
+
if (condition === GREATER_THAN) return " > ".concat(valueDisplay);
|
|
29
|
+
if (condition === LESS_THAN) return " < ".concat(valueDisplay);
|
|
30
|
+
if (condition === CONTAINS) return " LIKE '%".concat(value, "%'");
|
|
31
|
+
if (condition === NOT_CONTAINS) return " NOT LIKE '%".concat(value, "%'");
|
|
32
|
+
if (condition === BETWEEN) return " BETWEEN ".concat(value[0], " AND ").concat(value[1], " ");
|
|
33
|
+
if (condition === GREATER_THAN_OR_EQUAL) return " >= ".concat(value);
|
|
34
|
+
if (condition === LESS_THAN_OR_EQUAL) return " <= ".concat(value);
|
|
35
|
+
if (condition === START_WITH) return " LIKE '".concat(value, "%'");
|
|
36
36
|
return condition;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -44,8 +44,8 @@ const renderFilterSQl = filter => {
|
|
|
44
44
|
} = filter.element; // eslint-disable-next-line no-restricted-globals
|
|
45
45
|
|
|
46
46
|
const fieldDisplay = // eslint-disable-next-line no-restricted-globals
|
|
47
|
-
/[.]/.test(field) || !isNaN(field) ?
|
|
48
|
-
return
|
|
47
|
+
/[.]/.test(field) || !isNaN(field) ? "\\\"".concat(field, "\\\"") : field;
|
|
48
|
+
return "".concat(fieldDisplay, " ").concat(conditionSql(operator, value) || '');
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const sqlSafeFormat = ({
|
|
@@ -56,22 +56,22 @@ const sqlSafeFormat = ({
|
|
|
56
56
|
const groupSql = (item, idGroup) => {
|
|
57
57
|
if (idGroup === main) {
|
|
58
58
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
59
|
-
return
|
|
59
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
63
|
-
return
|
|
63
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
const filterSql = (filters, groupCondition) => {
|
|
67
67
|
const filterGroup = filters.map(filter => {
|
|
68
|
-
if (filter.element.type === 'filter') return
|
|
69
|
-
return
|
|
68
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
69
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
70
70
|
});
|
|
71
71
|
return filterGroup.join(groupCondition);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const sql =
|
|
74
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
75
75
|
return sql;
|
|
76
76
|
};
|
|
77
77
|
|
|
@@ -19,16 +19,16 @@ const conditionSql = (condition, value) => {
|
|
|
19
19
|
LESS_THAN_OR_EQUAL,
|
|
20
20
|
START_WITH
|
|
21
21
|
} = types.QB_OPERATOR_TYPES;
|
|
22
|
-
if (condition === EQUAL) return
|
|
23
|
-
if (condition === NOT_EQUAL) return
|
|
24
|
-
if (condition === GREATER_THAN) return
|
|
25
|
-
if (condition === LESS_THAN) return
|
|
26
|
-
if (condition === CONTAINS) return
|
|
27
|
-
if (condition === NOT_CONTAINS) return
|
|
28
|
-
if (condition === BETWEEN) return
|
|
29
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
30
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
31
|
-
if (condition === START_WITH) return
|
|
22
|
+
if (condition === EQUAL) return "<condition>EQUAL</condition><value>".concat(value, "</value>");
|
|
23
|
+
if (condition === NOT_EQUAL) return "<condition>NOT_EQUAL</condition><value>".concat(value, "</value>");
|
|
24
|
+
if (condition === GREATER_THAN) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
|
|
25
|
+
if (condition === LESS_THAN) return "<condition>LESS_THAN</condition><value>".concat(value, "</value>");
|
|
26
|
+
if (condition === CONTAINS) return "<condition>LIKE</condition><value>".concat(value, "</value>");
|
|
27
|
+
if (condition === NOT_CONTAINS) return "<condition>NOT_LIKE</condition><value>".concat(value, "</value>");
|
|
28
|
+
if (condition === BETWEEN) return "<condition>NOT_LIKE</condition><value><from>".concat(value[0], "</from><to>").concat(value[1], "</to></value>");
|
|
29
|
+
if (condition === GREATER_THAN_OR_EQUAL) return "<condition>GREATER_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
|
|
30
|
+
if (condition === LESS_THAN_OR_EQUAL) return "<condition>LESS_THAN_OR_EQUAL</condition><value>".concat(value, "</value>");
|
|
31
|
+
if (condition === START_WITH) return "<condition>GREATER_THAN</condition><value>".concat(value, "</value>");
|
|
32
32
|
return condition;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ const renderFilterSQl = filter => {
|
|
|
38
38
|
operator,
|
|
39
39
|
value
|
|
40
40
|
} = filter.element;
|
|
41
|
-
return
|
|
41
|
+
return "<filter><field>".concat(field, "</field>").concat(conditionSql(operator, value) || '', "</filter>");
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const xmlFormat = ({
|
|
@@ -49,22 +49,22 @@ const xmlFormat = ({
|
|
|
49
49
|
const groupXML = (item, idGroup) => {
|
|
50
50
|
if (idGroup === main) {
|
|
51
51
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
52
|
-
return
|
|
52
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
56
|
-
return
|
|
56
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item.children), "</group>"); // eslint-disable-line
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const filterXML = filters => {
|
|
60
60
|
const filterGroup = filters.map(filter => {
|
|
61
|
-
if (filter.element.type === 'filter') return
|
|
62
|
-
return
|
|
61
|
+
if (filter.element.type === 'filter') return "".concat(renderFilterSQl(filter) || '', " ");
|
|
62
|
+
return " ".concat(groupXML(filter), " ");
|
|
63
63
|
});
|
|
64
64
|
return filterGroup.join('');
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const xml =
|
|
67
|
+
const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
|
|
68
68
|
return xml;
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -20,7 +20,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
const createNewFilter = function (idGroup) {
|
|
23
|
-
const idFilter =
|
|
23
|
+
const idFilter = "filter_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
24
24
|
return {
|
|
25
25
|
idGroup,
|
|
26
26
|
field: '',
|
|
@@ -38,7 +38,7 @@ const createNewFilter = function (idGroup) {
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
const createNewGroup = function (parentIdGroup) {
|
|
41
|
-
const idGroup =
|
|
41
|
+
const idGroup = "group_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
42
42
|
return {
|
|
43
43
|
parentIdGroup,
|
|
44
44
|
idGroup,
|
package/cjs/propTypes.js
CHANGED
|
@@ -77,9 +77,7 @@ const props = {
|
|
|
77
77
|
|
|
78
78
|
/** remove filter callback */
|
|
79
79
|
onRemoveFilter: reactDesc.PropTypes.func.description('remove filter callback'),
|
|
80
|
-
displayFixedOutput: reactDesc.PropTypes.string.description(
|
|
81
|
-
and it will always render the output without the ability to close it.
|
|
82
|
-
`).defaultValue(''),
|
|
80
|
+
displayFixedOutput: reactDesc.PropTypes.string.description("Label for fixed output.Using this props it will ignore 'displayOutput' and 'displayOutputLabel' \n and it will always render the output without the ability to close it. \n ").defaultValue(''),
|
|
83
81
|
|
|
84
82
|
/** show output */
|
|
85
83
|
displayOutput: reactDesc.PropTypes.bool.description('show output'),
|
|
@@ -105,12 +105,12 @@ class AndOrController extends Component {
|
|
|
105
105
|
} = this.state;
|
|
106
106
|
return /*#__PURE__*/jsx("div", {
|
|
107
107
|
ref: this.myRef,
|
|
108
|
-
className:
|
|
108
|
+
className: "".concat(cssClassName, " ").concat(mainModifier(condition ? 'active' : 'default'), " step-").concat(step, " ").concat(isMain ? 'is-main-group-join' : '') // onMouseEnter={this.handleMouseEnterRow}
|
|
109
109
|
,
|
|
110
110
|
onMouseLeave: this.handleMouseLeaveRow // onMouseMove={this.handleMouseMove}
|
|
111
111
|
,
|
|
112
112
|
children: /*#__PURE__*/_jsx("div", {
|
|
113
|
-
className:
|
|
113
|
+
className: "".concat(classNameBlock('content'), " step-").concat(step)
|
|
114
114
|
}, void 0, /*#__PURE__*/_jsx(DSTooltip, {
|
|
115
115
|
delayClose: delayClose,
|
|
116
116
|
delayOpen: delayOpen,
|
|
@@ -128,8 +128,8 @@ class AndOrController extends Component {
|
|
|
128
128
|
style: {
|
|
129
129
|
transition: '0.2s',
|
|
130
130
|
position: 'absolute',
|
|
131
|
-
top:
|
|
132
|
-
right:
|
|
131
|
+
top: "".concat(top, "px"),
|
|
132
|
+
right: "".concat(right, "px")
|
|
133
133
|
},
|
|
134
134
|
children: [/*#__PURE__*/_jsx(DSButton, {
|
|
135
135
|
buttonType: buttonActionType,
|
|
@@ -163,7 +163,7 @@ class AndOrController extends Component {
|
|
|
163
163
|
}),
|
|
164
164
|
tooltipType: TooltipType.TOOLBAR,
|
|
165
165
|
triggerComponent: /*#__PURE__*/_jsx("div", {
|
|
166
|
-
className:
|
|
166
|
+
className: "".concat(classNameBlock('trigger-controller'), " ").concat(showDragController ? classNameBlockModifier('draggable', 'trigger-controller') : '', " step-").concat(step)
|
|
167
167
|
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
168
168
|
className: classNameElement('condition-display')
|
|
169
169
|
}, void 0, /*#__PURE__*/_jsx("span", {
|
|
@@ -67,7 +67,7 @@ const ConditionController = ({
|
|
|
67
67
|
}
|
|
68
68
|
}), /*#__PURE__*/_jsx(DSButton, {
|
|
69
69
|
buttonType: buttonActionType,
|
|
70
|
-
className:
|
|
70
|
+
className: "".concat(classNameElement('add-rule-container'), " no-border-right"),
|
|
71
71
|
icon: _ParenthesisAdd || (_ParenthesisAdd = /*#__PURE__*/_jsx(ParenthesisAdd, {})),
|
|
72
72
|
onClick: onAddRuleContainer,
|
|
73
73
|
size: buttonActionSize,
|
|
@@ -18,7 +18,7 @@ const DragContainerController = ({
|
|
|
18
18
|
cssClassName
|
|
19
19
|
} = convertPropToCssClassName('query-builder-drag-group');
|
|
20
20
|
return /*#__PURE__*/_jsx("div", {
|
|
21
|
-
className:
|
|
21
|
+
className: "".concat(cssClassName)
|
|
22
22
|
}, void 0, /*#__PURE__*/_jsx(Icon, {
|
|
23
23
|
color: color,
|
|
24
24
|
size: size
|
|
@@ -226,7 +226,7 @@ class Nestable extends Component {
|
|
|
226
226
|
const {
|
|
227
227
|
dragItem
|
|
228
228
|
} = this.state;
|
|
229
|
-
const el = document.querySelector(
|
|
229
|
+
const el = document.querySelector(".nestable-".concat(group, " .nestable-item-").concat(dragItem.id));
|
|
230
230
|
let listStyles = {};
|
|
231
231
|
|
|
232
232
|
if (el) {
|
|
@@ -268,11 +268,11 @@ class Nestable extends Component {
|
|
|
268
268
|
let childClass = 'single';
|
|
269
269
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
270
270
|
return /*#__PURE__*/_jsx("div", {
|
|
271
|
-
className: cn('nestable',
|
|
271
|
+
className: cn('nestable', "nestable-".concat(group), {
|
|
272
272
|
'is-drag-active': dragItem
|
|
273
273
|
})
|
|
274
274
|
}, void 0, /*#__PURE__*/_jsx("ol", {
|
|
275
|
-
className:
|
|
275
|
+
className: "nestable-list nestable-group nestable-child-count-".concat(childClass)
|
|
276
276
|
}, void 0, items.map((item, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
277
277
|
index: i,
|
|
278
278
|
isAndItem: isAndItem,
|
|
@@ -31,7 +31,7 @@ const NestableItem = ({
|
|
|
31
31
|
const isOrGroup = item.element.type === 'group' && (item.element.condition === '' || item.element.condition === false);
|
|
32
32
|
const isAndGroup = item.element.type === 'group' && !(item.element.condition === '' || item.element.condition === false);
|
|
33
33
|
const itemProps = {
|
|
34
|
-
className: cn(
|
|
34
|
+
className: cn("nestable-item".concat(isCopy ? '-copy' : ''), "nestable-item".concat(isCopy ? '-copy' : '', "-").concat(item.id), "nestable-item-type-".concat(item.element.type), {
|
|
35
35
|
'is-or-group': isOrGroup,
|
|
36
36
|
'is-and-group': isAndGroup,
|
|
37
37
|
'is-and-filter': item.element.type === 'filter' && isAndItem,
|
|
@@ -71,7 +71,7 @@ const NestableItem = ({
|
|
|
71
71
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
72
72
|
return /*#__PURE__*/jsxs("li", _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
73
73
|
children: [/*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
74
|
-
className:
|
|
74
|
+
className: "nestable-item-name nestable-item-name--".concat(item.element.type, " ")
|
|
75
75
|
}, rowProps), {}, {
|
|
76
76
|
children: renderItem({
|
|
77
77
|
item,
|
|
@@ -79,7 +79,7 @@ const NestableItem = ({
|
|
|
79
79
|
index
|
|
80
80
|
})
|
|
81
81
|
})), hasChildren && item.element.type === 'group' && !isCollapsed && /*#__PURE__*/_jsx("ol", {
|
|
82
|
-
className:
|
|
82
|
+
className: "nestable-list nestable-child-count-".concat(childClass, " ")
|
|
83
83
|
}, void 0, item[childrenProp].map((currentitem, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
84
84
|
index: i,
|
|
85
85
|
isAndItem: isAndGroup,
|
|
@@ -46,7 +46,7 @@ function onMouseMove(e) {
|
|
|
46
46
|
clientY
|
|
47
47
|
} = e;
|
|
48
48
|
const transformProps = getTransformProps(clientX, clientY);
|
|
49
|
-
const elCopy = document.querySelector(
|
|
49
|
+
const elCopy = document.querySelector(".nestable-".concat(group, " .nestable-drag-layer > .nestable-list"));
|
|
50
50
|
|
|
51
51
|
if (!this.elCopyStyles) {
|
|
52
52
|
const offset = getOffsetRect(this.el);
|
|
@@ -260,7 +260,7 @@ class QueryBuilderImpl extends Component {
|
|
|
260
260
|
singleRow
|
|
261
261
|
}
|
|
262
262
|
}, void 0, /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
263
|
-
className:
|
|
263
|
+
className: "nested-main-group ".concat(condition !== true ? 'is-or-group' : 'is-and-groupL', " ").concat(singleRow ? 'query-main-single-row' : 'query-main-multiple-row'),
|
|
264
264
|
children: [/*#__PURE__*/_jsx(Nestable, {
|
|
265
265
|
isAndItem: condition === true,
|
|
266
266
|
isDraggableItem: this.isDraggableItem,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
4
|
import React, { Component } from 'react';
|
|
4
5
|
import AlertsDetail from '@elliemae/ds-icons/AlertsDetail';
|
|
5
6
|
import { DSTooltipV2 } from '@elliemae/ds-basic/Tooltip';
|
|
@@ -24,14 +25,14 @@ const RenderField = ({
|
|
|
24
25
|
hasError
|
|
25
26
|
}) => {
|
|
26
27
|
const ref = React.useRef();
|
|
27
|
-
const id = React.useMemo(() =>
|
|
28
|
+
const id = React.useMemo(() => "el_".concat(String.fromCharCode(65 + Math.floor(Math.random() * 26))), []);
|
|
28
29
|
return /*#__PURE__*/_jsx("div", {
|
|
29
|
-
className:
|
|
30
|
+
className: "em-ds-query-builder-row-input child-type-".concat(target, " ").concat(hasError && hasError.error ? 'row-input-error' : ''),
|
|
30
31
|
onMouseDownCapture: () => {
|
|
31
32
|
var _ref$current;
|
|
32
33
|
|
|
33
34
|
// eslint-disable-next-line no-underscore-dangle
|
|
34
|
-
const _refInput = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(
|
|
35
|
+
const _refInput = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("#".concat(id));
|
|
35
36
|
|
|
36
37
|
if (_refInput && _refInput.focus) setTimeout(_refInput.focus());
|
|
37
38
|
handleMouseEnterInput();
|
|
@@ -152,8 +153,8 @@ class QueryBuilderRow extends Component {
|
|
|
152
153
|
idGroup,
|
|
153
154
|
additionalInfo: _objectSpread(_objectSpread({}, additionalInfo), {}, {
|
|
154
155
|
[target]: extraData,
|
|
155
|
-
[
|
|
156
|
-
[
|
|
156
|
+
["".concat(target, "_error")]: hasError,
|
|
157
|
+
["".concat(target, "_touched")]: true
|
|
157
158
|
}),
|
|
158
159
|
target
|
|
159
160
|
});
|
|
@@ -208,7 +209,7 @@ class QueryBuilderRow extends Component {
|
|
|
208
209
|
const {
|
|
209
210
|
[target]: valueProp
|
|
210
211
|
} = this.props;
|
|
211
|
-
const isTouched = additionalInfo && additionalInfo[
|
|
212
|
+
const isTouched = additionalInfo && additionalInfo["".concat(target, "_touched")];
|
|
212
213
|
const hasError = renderField && renderField.validation ? renderField.validation(valueProp, {
|
|
213
214
|
field,
|
|
214
215
|
operator,
|
|
@@ -15,16 +15,16 @@ const conditionSql = (condition, value) => {
|
|
|
15
15
|
LESS_THAN_OR_EQUAL,
|
|
16
16
|
START_WITH
|
|
17
17
|
} = QB_OPERATOR_TYPES;
|
|
18
|
-
if (condition === EQUAL) return
|
|
19
|
-
if (condition === NOT_EQUAL) return
|
|
20
|
-
if (condition === GREATER_THAN) return
|
|
21
|
-
if (condition === LESS_THAN) return
|
|
22
|
-
if (condition === CONTAINS) return
|
|
23
|
-
if (condition === NOT_CONTAINS) return
|
|
24
|
-
if (condition === BETWEEN) return
|
|
25
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
26
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
27
|
-
if (condition === START_WITH) return
|
|
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, "%'");
|
|
28
28
|
return condition;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ const renderFilterSQl = filter => {
|
|
|
34
34
|
operator,
|
|
35
35
|
value
|
|
36
36
|
} = filter.element;
|
|
37
|
-
return
|
|
37
|
+
return "".concat(field, " ").concat(conditionSql(operator, value) || '');
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const sqlFormat = ({
|
|
@@ -45,22 +45,22 @@ const sqlFormat = ({
|
|
|
45
45
|
const groupSql = (item, idGroup) => {
|
|
46
46
|
if (idGroup === main) {
|
|
47
47
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
48
|
-
return
|
|
48
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
52
|
-
return
|
|
52
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const filterSql = (filters, groupCondition) => {
|
|
56
56
|
const filterGroup = filters.map(filter => {
|
|
57
|
-
if (filter.element.type === 'filter') return
|
|
58
|
-
return
|
|
57
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
58
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
59
59
|
});
|
|
60
60
|
return filterGroup.join(groupCondition);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const sql =
|
|
63
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
64
64
|
return sql;
|
|
65
65
|
};
|
|
66
66
|
|
|
@@ -18,17 +18,17 @@ const conditionSql = (condition, value) => {
|
|
|
18
18
|
START_WITH
|
|
19
19
|
} = QB_OPERATOR_TYPES; // eslint-disable-next-line no-restricted-globals
|
|
20
20
|
|
|
21
|
-
const valueDisplay = isNaN(value) ?
|
|
22
|
-
if (condition === EQUAL) return
|
|
23
|
-
if (condition === NOT_EQUAL) return
|
|
24
|
-
if (condition === GREATER_THAN) return
|
|
25
|
-
if (condition === LESS_THAN) return
|
|
26
|
-
if (condition === CONTAINS) return
|
|
27
|
-
if (condition === NOT_CONTAINS) return
|
|
28
|
-
if (condition === BETWEEN) return
|
|
29
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
30
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
31
|
-
if (condition === START_WITH) return
|
|
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, "%'");
|
|
32
32
|
return condition;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -40,8 +40,8 @@ const renderFilterSQl = filter => {
|
|
|
40
40
|
} = filter.element; // eslint-disable-next-line no-restricted-globals
|
|
41
41
|
|
|
42
42
|
const fieldDisplay = // eslint-disable-next-line no-restricted-globals
|
|
43
|
-
/[.]/.test(field) || !isNaN(field) ?
|
|
44
|
-
return
|
|
43
|
+
/[.]/.test(field) || !isNaN(field) ? "\\\"".concat(field, "\\\"") : field;
|
|
44
|
+
return "".concat(fieldDisplay, " ").concat(conditionSql(operator, value) || '');
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
const sqlSafeFormat = ({
|
|
@@ -52,22 +52,22 @@ const sqlSafeFormat = ({
|
|
|
52
52
|
const groupSql = (item, idGroup) => {
|
|
53
53
|
if (idGroup === main) {
|
|
54
54
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
55
|
-
return
|
|
55
|
+
return " ( ".concat(filterSql(item, groupCondition), " ) "); // eslint-disable-line
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
59
|
-
return
|
|
59
|
+
return " ( ".concat(filterSql(item.children, groupCondition), " ) "); // eslint-disable-line
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const filterSql = (filters, groupCondition) => {
|
|
63
63
|
const filterGroup = filters.map(filter => {
|
|
64
|
-
if (filter.element.type === 'filter') return
|
|
65
|
-
return
|
|
64
|
+
if (filter.element.type === 'filter') return " ".concat(renderFilterSQl(filter), " ");
|
|
65
|
+
return " ".concat(groupSql(filter) || '', " ");
|
|
66
66
|
});
|
|
67
67
|
return filterGroup.join(groupCondition);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const sql =
|
|
70
|
+
const sql = " FROM [TABLE_NAME] WHERE ".concat(groupSql(items, main) || '', " ");
|
|
71
71
|
return sql;
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -15,16 +15,16 @@ const conditionSql = (condition, value) => {
|
|
|
15
15
|
LESS_THAN_OR_EQUAL,
|
|
16
16
|
START_WITH
|
|
17
17
|
} = QB_OPERATOR_TYPES;
|
|
18
|
-
if (condition === EQUAL) return
|
|
19
|
-
if (condition === NOT_EQUAL) return
|
|
20
|
-
if (condition === GREATER_THAN) return
|
|
21
|
-
if (condition === LESS_THAN) return
|
|
22
|
-
if (condition === CONTAINS) return
|
|
23
|
-
if (condition === NOT_CONTAINS) return
|
|
24
|
-
if (condition === BETWEEN) return
|
|
25
|
-
if (condition === GREATER_THAN_OR_EQUAL) return
|
|
26
|
-
if (condition === LESS_THAN_OR_EQUAL) return
|
|
27
|
-
if (condition === START_WITH) return
|
|
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>");
|
|
28
28
|
return condition;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ const renderFilterSQl = filter => {
|
|
|
34
34
|
operator,
|
|
35
35
|
value
|
|
36
36
|
} = filter.element;
|
|
37
|
-
return
|
|
37
|
+
return "<filter><field>".concat(field, "</field>").concat(conditionSql(operator, value) || '', "</filter>");
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const xmlFormat = ({
|
|
@@ -45,22 +45,22 @@ const xmlFormat = ({
|
|
|
45
45
|
const groupXML = (item, idGroup) => {
|
|
46
46
|
if (idGroup === main) {
|
|
47
47
|
const groupCondition = mapGroups[idGroup].condition === true ? 'AND' : 'OR';
|
|
48
|
-
return
|
|
48
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item), "</group>"); // eslint-disable-line
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const groupCondition = item.element.condition === true ? 'AND' : 'OR';
|
|
52
|
-
return
|
|
52
|
+
return "<group value=\"".concat(groupCondition, "\">").concat(filterXML(item.children), "</group>"); // eslint-disable-line
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const filterXML = filters => {
|
|
56
56
|
const filterGroup = filters.map(filter => {
|
|
57
|
-
if (filter.element.type === 'filter') return
|
|
58
|
-
return
|
|
57
|
+
if (filter.element.type === 'filter') return "".concat(renderFilterSQl(filter) || '', " ");
|
|
58
|
+
return " ".concat(groupXML(filter), " ");
|
|
59
59
|
});
|
|
60
60
|
return filterGroup.join('');
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const xml =
|
|
63
|
+
const xml = "<xml><query>".concat(groupXML(items, main) || '', "</query></xml>");
|
|
64
64
|
return xml;
|
|
65
65
|
};
|
|
66
66
|
|
|
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const createNewFilter = function (idGroup) {
|
|
15
|
-
const idFilter =
|
|
15
|
+
const idFilter = "filter_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
16
16
|
return {
|
|
17
17
|
idGroup,
|
|
18
18
|
field: '',
|
|
@@ -30,7 +30,7 @@ const createNewFilter = function (idGroup) {
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
const createNewGroup = function (parentIdGroup) {
|
|
33
|
-
const idGroup =
|
|
33
|
+
const idGroup = "group_".concat(new Date().getTime(), "_").concat(Math.random().toString(36).substring(7));
|
|
34
34
|
return {
|
|
35
35
|
parentIdGroup,
|
|
36
36
|
idGroup,
|
package/esm/propTypes.js
CHANGED
|
@@ -73,9 +73,7 @@ const props = {
|
|
|
73
73
|
|
|
74
74
|
/** remove filter callback */
|
|
75
75
|
onRemoveFilter: PropTypes.func.description('remove filter callback'),
|
|
76
|
-
displayFixedOutput: PropTypes.string.description(
|
|
77
|
-
and it will always render the output without the ability to close it.
|
|
78
|
-
`).defaultValue(''),
|
|
76
|
+
displayFixedOutput: PropTypes.string.description("Label for fixed output.Using this props it will ignore 'displayOutput' and 'displayOutputLabel' \n and it will always render the output without the ability to close it. \n ").defaultValue(''),
|
|
79
77
|
|
|
80
78
|
/** show output */
|
|
81
79
|
displayOutput: PropTypes.bool.description('show output'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-query-builder",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Query Builder",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -168,11 +168,11 @@
|
|
|
168
168
|
"build": "node ../../scripts/build/build.js"
|
|
169
169
|
},
|
|
170
170
|
"dependencies": {
|
|
171
|
-
"@elliemae/ds-basic": "2.0.0-next.
|
|
172
|
-
"@elliemae/ds-classnames": "2.0.0-next.
|
|
173
|
-
"@elliemae/ds-icons": "2.0.0-next.
|
|
174
|
-
"@elliemae/ds-shared": "2.0.0-next.
|
|
175
|
-
"@elliemae/ds-utilities": "2.0.0-next.
|
|
171
|
+
"@elliemae/ds-basic": "2.0.0-next.6",
|
|
172
|
+
"@elliemae/ds-classnames": "2.0.0-next.6",
|
|
173
|
+
"@elliemae/ds-icons": "2.0.0-next.6",
|
|
174
|
+
"@elliemae/ds-shared": "2.0.0-next.6",
|
|
175
|
+
"@elliemae/ds-utilities": "2.0.0-next.6",
|
|
176
176
|
"classnames": "~2.2.6",
|
|
177
177
|
"prop-types": "~15.7.2",
|
|
178
178
|
"react-addons-update": "~15.6.3"
|
package/cjs/package.json
DELETED