@elliemae/ds-query-builder 2.2.0-alpha.4 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSQueryBuilder.js +97 -117
- package/cjs/components/AndOrController/AndOrController.js +162 -148
- package/cjs/components/ConditionController/ConditionController.js +72 -88
- package/cjs/components/DisplayOutput/DisplayOutput.js +68 -63
- package/cjs/components/DragContainerController/DragContainerController.js +41 -61
- package/cjs/components/DragControllerRow/DragControllerRow.js +46 -50
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +32 -54
- package/cjs/components/Nestable/Nestable.js +209 -143
- package/cjs/components/Nestable/NestableItem.js +90 -98
- package/cjs/components/Nestable/actions/events.js +95 -72
- package/cjs/components/Nestable/actions/getItemOptions.js +15 -36
- package/cjs/components/Nestable/actions/getPaths.js +51 -46
- package/cjs/components/Nestable/actions/index.js +28 -42
- package/cjs/components/Nestable/actions/moveItem.js +42 -44
- package/cjs/components/Nestable/actions/paths.js +55 -48
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +23 -39
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +26 -39
- package/cjs/components/Nestable/index.js +7 -36
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +13 -36
- package/cjs/components/QueryBuilderImpl.js +202 -118
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +78 -80
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +211 -154
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +26 -39
- package/cjs/components/format/format.js +22 -48
- package/cjs/components/format/sqlFormat.js +48 -69
- package/cjs/components/format/sqlSafeFormat.js +55 -72
- package/cjs/components/format/xmlFormat.js +50 -71
- package/cjs/components/helpers/actions.js +186 -151
- package/cjs/components/helpers/constants.js +8 -36
- package/cjs/components/helpers/dependencies.js +64 -49
- package/cjs/components/helpers/selectors.js +101 -161
- package/cjs/components/helpers/store.js +104 -86
- package/cjs/components/helpers/types.js +44 -72
- package/cjs/index.js +29 -36
- package/cjs/propTypes.js +94 -102
- package/esm/DSQueryBuilder.js +72 -103
- package/esm/components/AndOrController/AndOrController.js +147 -113
- package/esm/components/ConditionController/ConditionController.js +62 -57
- package/esm/components/DisplayOutput/DisplayOutput.js +59 -31
- package/esm/components/DragContainerController/DragContainerController.js +35 -32
- package/esm/components/DragControllerRow/DragControllerRow.js +38 -21
- package/esm/components/FieldControllerRow/FieldControllerRow.js +26 -25
- package/esm/components/Nestable/Nestable.js +186 -115
- package/esm/components/Nestable/NestableItem.js +82 -69
- package/esm/components/Nestable/actions/events.js +79 -45
- package/esm/components/Nestable/actions/getItemOptions.js +11 -7
- package/esm/components/Nestable/actions/getPaths.js +43 -17
- package/esm/components/Nestable/actions/index.js +6 -13
- package/esm/components/Nestable/actions/moveItem.js +31 -13
- package/esm/components/Nestable/actions/paths.js +47 -19
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +19 -10
- package/esm/components/Nestable/actions/tryIncreaseDepth.js +22 -10
- package/esm/components/Nestable/index.js +2 -7
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +5 -7
- package/esm/components/QueryBuilderImpl.js +187 -82
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +70 -50
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +201 -123
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +17 -10
- package/esm/components/format/format.js +17 -16
- package/esm/components/format/sqlFormat.js +43 -39
- package/esm/components/format/sqlSafeFormat.js +50 -43
- package/esm/components/format/xmlFormat.js +45 -41
- package/esm/components/helpers/actions.js +160 -123
- package/esm/components/helpers/constants.js +2 -7
- package/esm/components/helpers/dependencies.js +39 -19
- package/esm/components/helpers/selectors.js +93 -132
- package/esm/components/helpers/store.js +82 -54
- package/esm/components/helpers/types.js +33 -44
- package/esm/index.js +4 -7
- package/esm/propTypes.js +72 -55
- package/package.json +12 -12
- package/cjs/DSQueryBuilder.js.map +0 -7
- package/cjs/components/AndOrController/AndOrController.js.map +0 -7
- package/cjs/components/ConditionController/ConditionController.js.map +0 -7
- package/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/cjs/components/DragContainerController/DragContainerController.js.map +0 -7
- package/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/cjs/components/Nestable/Nestable.js.map +0 -7
- package/cjs/components/Nestable/NestableItem.js.map +0 -7
- package/cjs/components/Nestable/actions/events.js.map +0 -7
- package/cjs/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/cjs/components/Nestable/actions/getPaths.js.map +0 -7
- package/cjs/components/Nestable/actions/index.js.map +0 -7
- package/cjs/components/Nestable/actions/moveItem.js.map +0 -7
- package/cjs/components/Nestable/actions/paths.js.map +0 -7
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/cjs/components/Nestable/index.js.map +0 -7
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/cjs/components/QueryBuilderImpl.js.map +0 -7
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/cjs/components/format/format.js.map +0 -7
- package/cjs/components/format/sqlFormat.js.map +0 -7
- package/cjs/components/format/sqlSafeFormat.js.map +0 -7
- package/cjs/components/format/xmlFormat.js.map +0 -7
- package/cjs/components/helpers/actions.js.map +0 -7
- package/cjs/components/helpers/constants.js.map +0 -7
- package/cjs/components/helpers/dependencies.js.map +0 -7
- package/cjs/components/helpers/selectors.js.map +0 -7
- package/cjs/components/helpers/store.js.map +0 -7
- package/cjs/components/helpers/types.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/esm/DSQueryBuilder.js.map +0 -7
- package/esm/components/AndOrController/AndOrController.js.map +0 -7
- package/esm/components/ConditionController/ConditionController.js.map +0 -7
- package/esm/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/esm/components/DragContainerController/DragContainerController.js.map +0 -7
- package/esm/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/esm/components/Nestable/Nestable.js.map +0 -7
- package/esm/components/Nestable/NestableItem.js.map +0 -7
- package/esm/components/Nestable/actions/events.js.map +0 -7
- package/esm/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/esm/components/Nestable/actions/getPaths.js.map +0 -7
- package/esm/components/Nestable/actions/index.js.map +0 -7
- package/esm/components/Nestable/actions/moveItem.js.map +0 -7
- package/esm/components/Nestable/actions/paths.js.map +0 -7
- package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/esm/components/Nestable/index.js.map +0 -7
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/esm/components/QueryBuilderImpl.js.map +0 -7
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/esm/components/format/format.js.map +0 -7
- package/esm/components/format/sqlFormat.js.map +0 -7
- package/esm/components/format/sqlSafeFormat.js.map +0 -7
- package/esm/components/format/xmlFormat.js.map +0 -7
- package/esm/components/helpers/actions.js.map +0 -7
- package/esm/components/helpers/constants.js.map +0 -7
- package/esm/components/helpers/dependencies.js.map +0 -7
- package/esm/components/helpers/selectors.js.map +0 -7
- package/esm/components/helpers/store.js.map +0 -7
- package/esm/components/helpers/types.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
|
@@ -1,63 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { QueryBuilderContext } from '../QueryBuilderContext/QueryBuilderContext.js';
|
|
10
|
+
import { QB_DRAG_TYPES } from '../helpers/types.js';
|
|
11
|
+
import AndOrController from '../AndOrController/AndOrController.js';
|
|
12
|
+
import QueryBuilderRow from '../QueryBuilderRow/QueryBuilderRow.js';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
|
|
19
|
+
const QueryBuilderItem = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
item
|
|
22
|
+
} = _ref;
|
|
23
|
+
const {
|
|
24
|
+
element
|
|
25
|
+
} = item;
|
|
26
|
+
const {
|
|
27
|
+
type,
|
|
28
|
+
idFilter,
|
|
29
|
+
idGroup,
|
|
30
|
+
condition
|
|
31
|
+
} = element;
|
|
32
|
+
return /*#__PURE__*/_jsx(QueryBuilderContext.Consumer, {}, void 0, _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
fields,
|
|
35
|
+
handleFieldChange,
|
|
36
|
+
onAddFilter,
|
|
37
|
+
onAddFilterToGroup,
|
|
38
|
+
onAddRuleContainer,
|
|
39
|
+
onRemoveFilter,
|
|
40
|
+
showDragController,
|
|
41
|
+
handleRuleContainerOperator,
|
|
42
|
+
handleRuleContainerUnGroup,
|
|
43
|
+
step,
|
|
44
|
+
items,
|
|
45
|
+
isDraggableItem,
|
|
46
|
+
setDraggableItems,
|
|
47
|
+
singleRow,
|
|
48
|
+
toolTipZIndex
|
|
49
|
+
} = _ref2;
|
|
50
|
+
|
|
27
51
|
if (type === QB_DRAG_TYPES.FILTER) {
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
items,
|
|
52
|
+
return /*#__PURE__*/jsx(QueryBuilderRow, _objectSpread(_objectSpread({}, element), {}, {
|
|
53
|
+
fields: fields,
|
|
54
|
+
handleFieldChange: handleFieldChange,
|
|
55
|
+
isDraggableItem: isDraggableItem,
|
|
56
|
+
items: items,
|
|
34
57
|
onAddFilter: () => onAddFilter(idGroup, idFilter),
|
|
35
58
|
onAddRuleContainer: () => onAddRuleContainer(idGroup, idFilter),
|
|
36
59
|
onRemoveFilter: () => onRemoveFilter(idFilter),
|
|
37
|
-
setDraggableItems,
|
|
38
|
-
showDragController,
|
|
39
|
-
step,
|
|
40
|
-
singleRow,
|
|
41
|
-
toolTipZIndex
|
|
42
|
-
});
|
|
60
|
+
setDraggableItems: setDraggableItems,
|
|
61
|
+
showDragController: showDragController,
|
|
62
|
+
step: step,
|
|
63
|
+
singleRow: singleRow,
|
|
64
|
+
toolTipZIndex: toolTipZIndex
|
|
65
|
+
}));
|
|
43
66
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
67
|
+
|
|
68
|
+
if (singleRow) return null;
|
|
69
|
+
return /*#__PURE__*/_jsx(AndOrController, {
|
|
47
70
|
allowUnGroup: true,
|
|
48
|
-
condition,
|
|
49
|
-
handleRuleContainerOperator:
|
|
71
|
+
condition: condition,
|
|
72
|
+
handleRuleContainerOperator: value => handleRuleContainerOperator(idGroup, value),
|
|
50
73
|
handleRuleContainerUnGroup: () => handleRuleContainerUnGroup(idGroup),
|
|
51
74
|
multipleSize: false,
|
|
52
75
|
onAddFilter: () => onAddFilterToGroup(idGroup),
|
|
53
76
|
showDragController: true,
|
|
54
|
-
step,
|
|
55
|
-
toolTipZIndex
|
|
77
|
+
step: step,
|
|
78
|
+
toolTipZIndex: toolTipZIndex
|
|
56
79
|
});
|
|
57
80
|
});
|
|
58
81
|
};
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
QueryBuilderItem_default as default
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=QueryBuilderItem.js.map
|
|
82
|
+
|
|
83
|
+
export { QueryBuilderItem as default };
|
|
@@ -1,107 +1,179 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
11
|
+
import React, { Component } from 'react';
|
|
12
|
+
import { AlertsDetail } from '@elliemae/ds-icons';
|
|
13
|
+
import { DSTooltipV3 } from '@elliemae/ds-tooltip';
|
|
14
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
15
|
+
import { resolveDependencies } from '../helpers/dependencies.js';
|
|
16
|
+
import ConditionController from '../ConditionController/ConditionController.js';
|
|
17
|
+
import DragControllerRow from '../DragControllerRow/DragControllerRow.js';
|
|
18
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
|
|
24
|
+
const RenderField = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
target,
|
|
27
|
+
component,
|
|
28
|
+
valueProp,
|
|
29
|
+
additionalInfo,
|
|
30
|
+
handleMouseEnterInput,
|
|
31
|
+
handleMouseLeaveInput,
|
|
32
|
+
onChangeHandler,
|
|
33
|
+
hasError
|
|
34
|
+
} = _ref;
|
|
35
|
+
const ref = React.useRef();
|
|
36
|
+
const id = React.useMemo(() => "el_".concat(String.fromCharCode(65 + Math.floor(Math.random() * 26))), []);
|
|
37
|
+
return /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: "em-ds-query-builder-row-input child-type-".concat(target, " ").concat(hasError && hasError.error ? 'row-input-error' : ''),
|
|
23
39
|
onMouseDownCapture: () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
var _ref$current;
|
|
41
|
+
|
|
42
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
43
|
+
const _refInput = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("#".concat(id));
|
|
44
|
+
|
|
45
|
+
if (_refInput && _refInput.focus) setTimeout(_refInput.focus());
|
|
27
46
|
handleMouseEnterInput();
|
|
28
47
|
},
|
|
29
48
|
onMouseEnter: () => handleMouseEnterInput(),
|
|
30
49
|
onMouseLeave: () => handleMouseLeaveInput()
|
|
31
|
-
},
|
|
32
|
-
ref,
|
|
33
|
-
className: "em-ds-query-builder-row__input-controller"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
}, void 0, /*#__PURE__*/jsx("div", {
|
|
51
|
+
ref: ref,
|
|
52
|
+
className: "em-ds-query-builder-row__input-controller",
|
|
53
|
+
children: /*#__PURE__*/React.cloneElement(component, {
|
|
54
|
+
id,
|
|
55
|
+
onChange: (e, extraData) => onChangeHandler(e, target, extraData),
|
|
56
|
+
value: valueProp != null ? valueProp : '',
|
|
57
|
+
checked: valueProp === true,
|
|
58
|
+
additionalInfo: additionalInfo ? additionalInfo[target] : additionalInfo || {},
|
|
59
|
+
'aria-invalid': Boolean(hasError)
|
|
60
|
+
})
|
|
61
|
+
}), hasError && hasError.errorMessage ? /*#__PURE__*/_jsx("div", {
|
|
62
|
+
style: {
|
|
63
|
+
width: '40px'
|
|
64
|
+
}
|
|
65
|
+
}, void 0, /*#__PURE__*/_jsx(DSTooltipV3, {
|
|
44
66
|
text: hasError.errorMessage
|
|
45
|
-
},
|
|
67
|
+
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
46
68
|
tabIndex: 0,
|
|
47
69
|
className: "row-icon-alert",
|
|
48
70
|
"data-testid": "qb-error-state-icon",
|
|
49
71
|
role: "alert"
|
|
50
|
-
},
|
|
72
|
+
}, void 0, /*#__PURE__*/_jsx(AlertsDetail, {
|
|
51
73
|
width: 20,
|
|
52
74
|
height: 20,
|
|
53
|
-
color: [
|
|
75
|
+
color: ['danger', 900],
|
|
54
76
|
title: hasError.errorMessage
|
|
55
|
-
})))) : null);
|
|
77
|
+
})))) : null); // return React.useMemo(
|
|
78
|
+
// () => (
|
|
79
|
+
// <div
|
|
80
|
+
// className={`em-ds-query-builder-row-input child-type-${target}`}
|
|
81
|
+
// onMouseDownCapture={() => {
|
|
82
|
+
// // eslint-disable-next-line no-underscore-dangle
|
|
83
|
+
// const _refInput = ref.current.querySelector(`#${id}`);
|
|
84
|
+
// if (_refInput && _refInput.focus) setTimeout(_refInput.focus());
|
|
85
|
+
// handleMouseEnterInput();
|
|
86
|
+
// }}
|
|
87
|
+
// onMouseEnter={() => handleMouseEnterInput()}
|
|
88
|
+
// onMouseLeave={() => handleMouseLeaveInput()}
|
|
89
|
+
// >
|
|
90
|
+
// <div ref={ref} className="em-ds-query-builder-row__input-controller">
|
|
91
|
+
// {React.cloneElement(component, {
|
|
92
|
+
// id,
|
|
93
|
+
// onChange: (e, extraData) => onChangeHandler(e, target, extraData),
|
|
94
|
+
// value: valueProp != null ? valueProp : '',
|
|
95
|
+
// checked: valueProp === true,
|
|
96
|
+
// additionalInfo: additionalInfo ? additionalInfo[target] : {},
|
|
97
|
+
// })}
|
|
98
|
+
// </div>
|
|
99
|
+
// </div>
|
|
100
|
+
// ),
|
|
101
|
+
// [target, component, valueProp, additionalInfo],
|
|
102
|
+
// );
|
|
56
103
|
};
|
|
104
|
+
|
|
57
105
|
class QueryBuilderRow extends Component {
|
|
58
106
|
constructor(props) {
|
|
59
107
|
super(props);
|
|
60
|
-
|
|
61
|
-
};
|
|
108
|
+
|
|
109
|
+
this.handleMouseEnterRow = () => {};
|
|
110
|
+
|
|
62
111
|
this.handleMouseLeaveRow = () => {
|
|
63
112
|
this.handleTooltipRow(false);
|
|
64
113
|
};
|
|
114
|
+
|
|
65
115
|
this.handleMouseEnterInput = () => {
|
|
66
|
-
const {
|
|
116
|
+
const {
|
|
117
|
+
setDraggableItems
|
|
118
|
+
} = this.props;
|
|
67
119
|
setDraggableItems(false);
|
|
68
120
|
};
|
|
121
|
+
|
|
69
122
|
this.handleMouseLeaveInput = () => {
|
|
70
|
-
const {
|
|
123
|
+
const {
|
|
124
|
+
setDraggableItems
|
|
125
|
+
} = this.props;
|
|
71
126
|
setDraggableItems(true);
|
|
72
127
|
};
|
|
73
|
-
|
|
74
|
-
|
|
128
|
+
|
|
129
|
+
this.handleTooltipRow = isOpen => {
|
|
130
|
+
this.setState({
|
|
131
|
+
isOpen
|
|
132
|
+
});
|
|
75
133
|
};
|
|
134
|
+
|
|
76
135
|
this.state = {
|
|
77
136
|
isOpen: false
|
|
78
137
|
};
|
|
79
138
|
}
|
|
139
|
+
|
|
80
140
|
onChangeHandler(e, target, extraData, hasError) {
|
|
81
|
-
const {
|
|
141
|
+
const {
|
|
142
|
+
handleFieldChange,
|
|
143
|
+
idFilter,
|
|
144
|
+
idGroup,
|
|
145
|
+
additionalInfo,
|
|
146
|
+
field,
|
|
147
|
+
operator,
|
|
148
|
+
value
|
|
149
|
+
} = this.props;
|
|
82
150
|
let eventValue = e;
|
|
151
|
+
|
|
83
152
|
if (e && e.target) {
|
|
84
|
-
const {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
153
|
+
const {
|
|
154
|
+
value,
|
|
155
|
+
checked
|
|
156
|
+
} = e.target;
|
|
157
|
+
if (value || value === '' || typeof value === 'boolean') eventValue = value;else eventValue = checked || e;
|
|
89
158
|
}
|
|
159
|
+
|
|
90
160
|
handleFieldChange({
|
|
91
161
|
[target]: eventValue,
|
|
92
162
|
idFilter,
|
|
93
163
|
idGroup,
|
|
94
|
-
additionalInfo: {
|
|
95
|
-
...additionalInfo,
|
|
164
|
+
additionalInfo: _objectSpread(_objectSpread({}, additionalInfo), {}, {
|
|
96
165
|
[target]: extraData,
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
},
|
|
166
|
+
["".concat(target, "_error")]: hasError,
|
|
167
|
+
["".concat(target, "_touched")]: true
|
|
168
|
+
}),
|
|
100
169
|
target
|
|
101
170
|
});
|
|
102
171
|
}
|
|
172
|
+
|
|
103
173
|
render() {
|
|
104
|
-
const {
|
|
174
|
+
const {
|
|
175
|
+
isOpen
|
|
176
|
+
} = this.state;
|
|
105
177
|
const {
|
|
106
178
|
fields,
|
|
107
179
|
onAddFilter,
|
|
@@ -116,75 +188,81 @@ class QueryBuilderRow extends Component {
|
|
|
116
188
|
toolTipZIndex,
|
|
117
189
|
error
|
|
118
190
|
} = this.props;
|
|
119
|
-
const {
|
|
191
|
+
const {
|
|
192
|
+
cssClassName,
|
|
193
|
+
classNameBlock,
|
|
194
|
+
classNameElement
|
|
195
|
+
} = convertPropToCssClassName('query-builder-row', isOpen ? 'has-open-tooltip' : 'has-close-tooltip', singleRow ? 'is-single-row' : 'is-multiple-row');
|
|
120
196
|
const test = resolveDependencies({
|
|
121
197
|
field,
|
|
122
198
|
operator,
|
|
123
199
|
value,
|
|
124
200
|
additionalInfo
|
|
125
201
|
}, fields);
|
|
126
|
-
const gridTemplateColumns = [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
additionalInfo
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return "minmax(0, 1fr)";
|
|
138
|
-
}),
|
|
139
|
-
"30px"
|
|
140
|
-
].join(" ");
|
|
141
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", {
|
|
142
|
-
className: cssClassName,
|
|
143
|
-
onMouseEnter: this.handleMouseEnterRow,
|
|
144
|
-
onMouseLeave: this.handleMouseLeaveRow,
|
|
145
|
-
style: {
|
|
146
|
-
gridTemplateColumns
|
|
202
|
+
const gridTemplateColumns = ['24px', ...test.map(r => {
|
|
203
|
+
if (r.handleWidth) {
|
|
204
|
+
return r.handleWidth(this.props[r.target], {
|
|
205
|
+
field,
|
|
206
|
+
operator,
|
|
207
|
+
value,
|
|
208
|
+
additionalInfo
|
|
209
|
+
});
|
|
147
210
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
additionalInfo,
|
|
171
|
-
hasError
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
211
|
+
|
|
212
|
+
return 'minmax(0, 1fr)';
|
|
213
|
+
}), '30px'].join(' ');
|
|
214
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
215
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
216
|
+
className: cssClassName,
|
|
217
|
+
onMouseEnter: this.handleMouseEnterRow,
|
|
218
|
+
onMouseLeave: this.handleMouseLeaveRow,
|
|
219
|
+
style: {
|
|
220
|
+
gridTemplateColumns
|
|
221
|
+
}
|
|
222
|
+
}, void 0, !singleRow && /*#__PURE__*/_jsx(DragControllerRow, {
|
|
223
|
+
className: classNameElement('drag-controller'),
|
|
224
|
+
onMouseDownCapture: () => this.handleMouseLeaveInput()
|
|
225
|
+
}), test.map(renderField => {
|
|
226
|
+
const {
|
|
227
|
+
target,
|
|
228
|
+
component
|
|
229
|
+
} = renderField;
|
|
230
|
+
const {
|
|
231
|
+
[target]: valueProp
|
|
232
|
+
} = this.props;
|
|
233
|
+
const isTouched = additionalInfo && additionalInfo["".concat(target, "_touched")];
|
|
234
|
+
const hasError = renderField && renderField.validation ? renderField.validation(valueProp, {
|
|
235
|
+
field,
|
|
236
|
+
operator,
|
|
237
|
+
value,
|
|
238
|
+
additionalInfo
|
|
239
|
+
}) : false;
|
|
240
|
+
return /*#__PURE__*/_jsx(RenderField, {
|
|
241
|
+
component: component,
|
|
242
|
+
target: target,
|
|
243
|
+
valueProp: valueProp,
|
|
244
|
+
onChangeHandler: (e, target, extraData) => {
|
|
245
|
+
this.onChangeHandler(e, target, extraData, hasError);
|
|
246
|
+
},
|
|
247
|
+
handleMouseEnterInput: this.handleMouseEnterInput,
|
|
248
|
+
handleMouseLeaveInput: this.handleMouseLeaveInput,
|
|
249
|
+
additionalInfo: additionalInfo,
|
|
250
|
+
hasError: isTouched && hasError
|
|
251
|
+
});
|
|
252
|
+
}), !singleRow && /*#__PURE__*/_jsx("div", {
|
|
253
|
+
className: classNameBlock('controller')
|
|
254
|
+
}, void 0, /*#__PURE__*/_jsx(ConditionController, {
|
|
255
|
+
handleTooltipRow: this.handleTooltipRow,
|
|
256
|
+
isOpen: isOpen,
|
|
257
|
+
items: items,
|
|
258
|
+
onAddFilter: onAddFilter,
|
|
259
|
+
onAddRuleContainer: onAddRuleContainer,
|
|
260
|
+
onRemoveFilter: onRemoveFilter,
|
|
261
|
+
toolTipZIndex: toolTipZIndex
|
|
262
|
+
})))
|
|
263
|
+
});
|
|
184
264
|
}
|
|
265
|
+
|
|
185
266
|
}
|
|
186
|
-
|
|
187
|
-
export {
|
|
188
|
-
QueryBuilderRow_default as default
|
|
189
|
-
};
|
|
190
|
-
//# sourceMappingURL=QueryBuilderRow.js.map
|
|
267
|
+
|
|
268
|
+
export { QueryBuilderRow as default };
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import { createElement } from 'react';
|
|
8
|
+
import GrowRight from '@elliemae/ds-shared/Animations/GrowRight';
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
|
|
14
|
+
const ToolBarAnimation = props => /*#__PURE__*/createElement(GrowRight, _objectSpread(_objectSpread({}, props), {}, {
|
|
6
15
|
key: "popper-animation-key",
|
|
7
16
|
from: 0.5,
|
|
8
17
|
to: 1
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=ToolBarAnimation.js.map
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export { ToolBarAnimation };
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { sqlFormat } from './sqlFormat.js';
|
|
2
|
+
import { xmlFormat } from './xmlFormat.js';
|
|
3
|
+
import { sqlSafeFormat } from './sqlSafeFormat.js';
|
|
4
|
+
|
|
5
5
|
class QueryBuilderFormat {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.format = {
|
|
8
|
-
defaultFormat:
|
|
8
|
+
defaultFormat: query => query,
|
|
9
9
|
sqlFormat,
|
|
10
10
|
xmlFormat,
|
|
11
11
|
sqlSafeFormat
|
|
12
12
|
};
|
|
13
|
-
this.currentFormat =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
this.currentFormat = 'sqlFormat';
|
|
14
|
+
|
|
15
|
+
this.setDefaultFormat = formatName => {
|
|
16
|
+
if (this.format[formatName]) this.currentFormat = formatName;
|
|
17
17
|
};
|
|
18
|
+
|
|
18
19
|
this.addFormat = (formatName, format) => this.format[formatName] = format;
|
|
20
|
+
|
|
19
21
|
this.run = (query, formatName) => {
|
|
20
|
-
if (this.format[formatName])
|
|
21
|
-
return this.format[formatName](query);
|
|
22
|
+
if (this.format[formatName]) return this.format[formatName](query);
|
|
22
23
|
return this.format[this.currentFormat](query);
|
|
23
24
|
};
|
|
24
25
|
}
|
|
26
|
+
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=format.js.map
|
|
28
|
+
|
|
29
|
+
var QueryBuilderFormat$1 = new QueryBuilderFormat();
|
|
30
|
+
|
|
31
|
+
export { QueryBuilderFormat$1 as default };
|