@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,27 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { convertPropToCssClassName } from
|
|
4
|
-
import DSTooltip, { TooltipType } from
|
|
5
|
-
import { PopperInteractions
|
|
6
|
-
import { DSToggle } from
|
|
7
|
-
import DSButton from
|
|
8
|
-
import { ParenthesisRemove, MoreOptionsVert
|
|
9
|
-
import {
|
|
10
|
-
import { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION } from
|
|
11
|
-
import { ToolBarAnimation } from
|
|
12
|
-
import DragContainerController from
|
|
13
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
4
|
+
import DSTooltip, { TooltipType } from '@elliemae/ds-tooltip';
|
|
5
|
+
import { PopperInteractions, PopperPositions } from '@elliemae/ds-popper';
|
|
6
|
+
import { DSToggle } from '@elliemae/ds-form';
|
|
7
|
+
import DSButton from '@elliemae/ds-button';
|
|
8
|
+
import { QueryAdd, ParenthesisRemove, MoreOptionsVert } from '@elliemae/ds-icons';
|
|
9
|
+
import { DSIconSizes, DSIconColors } from '@elliemae/ds-icon';
|
|
10
|
+
import { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION } from '../helpers/constants.js';
|
|
11
|
+
import { ToolBarAnimation } from '../ToolBarAnimation/ToolBarAnimation.js';
|
|
12
|
+
import DragContainerController from '../DragContainerController/DragContainerController.js';
|
|
13
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
var _QueryAdd, _ParenthesisRemove, _div;
|
|
16
|
+
const {
|
|
17
|
+
cssClassName,
|
|
18
|
+
classNameBlock,
|
|
19
|
+
classNameElement,
|
|
20
|
+
mainModifier,
|
|
21
|
+
classNameBlockModifier
|
|
22
|
+
} = convertPropToCssClassName('query-builder-and-or-controller');
|
|
23
|
+
/**
|
|
24
|
+
* condition-display-step: required to avoid the cache of the trigger
|
|
25
|
+
*
|
|
26
|
+
* @param e
|
|
27
|
+
* @param isOpen
|
|
28
|
+
*/
|
|
29
|
+
|
|
14
30
|
class AndOrController extends Component {
|
|
15
31
|
constructor(props) {
|
|
16
32
|
super(props);
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
|
|
34
|
+
this.handleMouseEnterRow = e => {
|
|
35
|
+
this.handleTooltipRow(true); // this.handleMouseMove(e)
|
|
19
36
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
|
|
38
|
+
this.handleMouseMove = e => {
|
|
39
|
+
if (!this.contenerRef.current) return;
|
|
23
40
|
const mouse = e.clientY;
|
|
24
|
-
const {
|
|
41
|
+
const {
|
|
42
|
+
height
|
|
43
|
+
} = this.contenerRef.current.getBoundingClientRect();
|
|
25
44
|
const delta = height / 2;
|
|
26
45
|
const topDiff = this.myRef.current.getBoundingClientRect().top;
|
|
27
46
|
const refHeight = this.myRef.current.getBoundingClientRect().height;
|
|
@@ -29,22 +48,30 @@ class AndOrController extends Component {
|
|
|
29
48
|
top: mouse - topDiff - refHeight / 2 - delta
|
|
30
49
|
});
|
|
31
50
|
};
|
|
51
|
+
|
|
32
52
|
this.handleMouseLeaveRow = () => {
|
|
33
53
|
this.handleTooltipRow(false);
|
|
34
54
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
|
|
56
|
+
this.handleTooltipRow = isOpen => {
|
|
57
|
+
this.setState({
|
|
58
|
+
isOpen
|
|
59
|
+
});
|
|
60
|
+
const {
|
|
61
|
+
handleTooltipGroup
|
|
62
|
+
} = this.props;
|
|
38
63
|
handleTooltipGroup(isOpen);
|
|
39
64
|
};
|
|
40
|
-
|
|
41
|
-
this.
|
|
65
|
+
|
|
66
|
+
this.contenerRef = /*#__PURE__*/React.createRef();
|
|
67
|
+
this.myRef = /*#__PURE__*/React.createRef();
|
|
42
68
|
this.state = {
|
|
43
69
|
isOpen: false,
|
|
44
70
|
top: 0,
|
|
45
71
|
right: -2
|
|
46
72
|
};
|
|
47
73
|
}
|
|
74
|
+
|
|
48
75
|
render() {
|
|
49
76
|
const {
|
|
50
77
|
handleRuleContainerOperator,
|
|
@@ -68,100 +95,110 @@ class AndOrController extends Component {
|
|
|
68
95
|
isMain,
|
|
69
96
|
toolTipZIndex
|
|
70
97
|
} = this.props;
|
|
71
|
-
const {
|
|
72
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
73
|
-
ref: this.myRef,
|
|
74
|
-
className: `${cssClassName} ${mainModifier(condition ? "active" : "default")} step-${step} ${isMain ? "is-main-group-join" : ""}`,
|
|
75
|
-
onMouseLeave: this.handleMouseLeaveRow
|
|
76
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
77
|
-
className: `${classNameBlock("content")} step-${step}`
|
|
78
|
-
}, /* @__PURE__ */ React2.createElement(DSTooltip, {
|
|
79
|
-
delayClose,
|
|
80
|
-
delayOpen,
|
|
81
|
-
interactionType: toolBarInteractionType,
|
|
98
|
+
const {
|
|
82
99
|
isOpen,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
step,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
100
|
+
top,
|
|
101
|
+
right
|
|
102
|
+
} = this.state;
|
|
103
|
+
return /*#__PURE__*/jsx("div", {
|
|
104
|
+
ref: this.myRef,
|
|
105
|
+
className: "".concat(cssClassName, " ").concat(mainModifier(condition ? 'active' : 'default'), " step-").concat(step, " ").concat(isMain ? 'is-main-group-join' : '') // onMouseEnter={this.handleMouseEnterRow}
|
|
106
|
+
,
|
|
107
|
+
onMouseLeave: this.handleMouseLeaveRow // onMouseMove={this.handleMouseMove}
|
|
108
|
+
,
|
|
109
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
110
|
+
className: "".concat(classNameBlock('content'), " step-").concat(step)
|
|
111
|
+
}, void 0, /*#__PURE__*/_jsx(DSTooltip, {
|
|
112
|
+
delayClose: delayClose,
|
|
113
|
+
delayOpen: delayOpen,
|
|
114
|
+
interactionType: toolBarInteractionType,
|
|
115
|
+
isOpen: isOpen,
|
|
116
|
+
onOpen: this.handleTooltipRow,
|
|
117
|
+
placement: toolBarPosition,
|
|
118
|
+
springAnimationComponent: /*#__PURE__*/_jsx(ToolBarAnimation, {
|
|
119
|
+
duration: toolBarAnimationDuration
|
|
120
|
+
}),
|
|
121
|
+
step: step,
|
|
122
|
+
title: /*#__PURE__*/jsxs("div", {
|
|
123
|
+
ref: this.contenerRef,
|
|
124
|
+
className: classNameBlock('actions'),
|
|
125
|
+
style: {
|
|
126
|
+
transition: '0.2s',
|
|
127
|
+
position: 'absolute',
|
|
128
|
+
top: "".concat(top, "px"),
|
|
129
|
+
right: "".concat(right, "px")
|
|
130
|
+
},
|
|
131
|
+
children: [/*#__PURE__*/_jsx(DSButton, {
|
|
132
|
+
buttonType: buttonActionType,
|
|
133
|
+
className: classNameElement('add-rule'),
|
|
134
|
+
icon: _QueryAdd || (_QueryAdd = /*#__PURE__*/_jsx(QueryAdd, {})),
|
|
135
|
+
onClick: onAddFilter,
|
|
136
|
+
size: buttonActionSize,
|
|
137
|
+
containerProps: {
|
|
138
|
+
'data-testid': 'query-add-button'
|
|
139
|
+
}
|
|
140
|
+
}), allowUnGroup && /*#__PURE__*/_jsx(DSButton, {
|
|
141
|
+
buttonType: "text",
|
|
142
|
+
className: classNameElement('ungroup'),
|
|
143
|
+
icon: _ParenthesisRemove || (_ParenthesisRemove = /*#__PURE__*/_jsx(ParenthesisRemove, {})),
|
|
144
|
+
onClick: handleRuleContainerUnGroup,
|
|
145
|
+
size: buttonActionSize,
|
|
146
|
+
containerProps: {
|
|
147
|
+
'data-testid': 'parenthesis-remove-button'
|
|
148
|
+
}
|
|
149
|
+
}), /*#__PURE__*/_jsx(DSToggle, {
|
|
150
|
+
checked: condition,
|
|
151
|
+
className: classNameElement('and-or-toggle'),
|
|
152
|
+
labelOff: labelOff,
|
|
153
|
+
labelOn: labelOn,
|
|
154
|
+
onChange: e => handleRuleContainerOperator(e.target.checked),
|
|
155
|
+
size: toogleActionSize,
|
|
156
|
+
containerProps: {
|
|
157
|
+
'data-testid': 'and-or-toggle-button'
|
|
158
|
+
}
|
|
159
|
+
})]
|
|
160
|
+
}),
|
|
161
|
+
tooltipType: TooltipType.TOOLBAR,
|
|
162
|
+
triggerComponent: /*#__PURE__*/_jsx("div", {
|
|
163
|
+
className: "".concat(classNameBlock('trigger-controller'), " ").concat(showDragController ? classNameBlockModifier('draggable', 'trigger-controller') : '', " step-").concat(step)
|
|
164
|
+
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
165
|
+
className: classNameElement('condition-display')
|
|
166
|
+
}, void 0, /*#__PURE__*/_jsx("span", {
|
|
167
|
+
className: classNameElement('condition-display-label')
|
|
168
|
+
}, void 0, condition ? labelOn : labelOff), /*#__PURE__*/_jsx("span", {
|
|
169
|
+
className: classNameElement('condition-display-step')
|
|
170
|
+
}, void 0, step), _div || (_div = /*#__PURE__*/_jsx("div", {
|
|
171
|
+
className: "separator"
|
|
172
|
+
})), /*#__PURE__*/_jsx(MoreOptionsVert, {
|
|
173
|
+
color: DSIconColors.NEUTRAL,
|
|
174
|
+
onClick: this.handleMouseEnterRow,
|
|
175
|
+
size: DSIconSizes.S,
|
|
176
|
+
containerProps: {
|
|
177
|
+
'data-testid': 'and-or-more-options-button'
|
|
178
|
+
}
|
|
179
|
+
})), showDragController && /*#__PURE__*/_jsx(DragContainerController, {
|
|
180
|
+
multipleSize: multipleSize,
|
|
181
|
+
onClick: this.handleMouseEnterRow
|
|
182
|
+
})),
|
|
183
|
+
zIndex: toolTipZIndex
|
|
184
|
+
}))
|
|
185
|
+
});
|
|
151
186
|
}
|
|
187
|
+
|
|
152
188
|
}
|
|
189
|
+
|
|
153
190
|
AndOrController.defaultProps = {
|
|
154
191
|
isMain: false,
|
|
155
192
|
handleRuleContainerOperator: () => null,
|
|
156
193
|
handleRuleContainerUnGroup: () => null,
|
|
157
194
|
handleTooltipGroup: () => null,
|
|
158
|
-
labelOn:
|
|
159
|
-
labelOff:
|
|
195
|
+
labelOn: 'AND',
|
|
196
|
+
labelOff: 'OR',
|
|
160
197
|
condition: true,
|
|
161
198
|
showDragController: true,
|
|
162
199
|
allowUnGroup: true,
|
|
163
200
|
buttonActionSize: DSIconSizes.M,
|
|
164
|
-
buttonActionType:
|
|
201
|
+
buttonActionType: 'text',
|
|
165
202
|
toogleActionSize: DSIconSizes.S,
|
|
166
203
|
onAddFilter: () => null,
|
|
167
204
|
multipleSize: false,
|
|
@@ -169,11 +206,8 @@ AndOrController.defaultProps = {
|
|
|
169
206
|
delayOpen: DELAY_OPEN,
|
|
170
207
|
step: null,
|
|
171
208
|
toolBarAnimationDuration: TOOLBAR_ANIMATION_DURATION,
|
|
172
|
-
toolBarInteractionType:
|
|
173
|
-
toolBarPosition:
|
|
174
|
-
};
|
|
175
|
-
var AndOrController_default = AndOrController;
|
|
176
|
-
export {
|
|
177
|
-
AndOrController_default as default
|
|
209
|
+
toolBarInteractionType: PopperInteractions.CLICK,
|
|
210
|
+
toolBarPosition: PopperPositions.LEFT
|
|
178
211
|
};
|
|
179
|
-
|
|
212
|
+
|
|
213
|
+
export { AndOrController as default };
|
|
@@ -1,87 +1,92 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { convertPropToCssClassName } from
|
|
4
|
-
import DSTooltip, { TooltipType } from
|
|
5
|
-
import { PopperInteractions
|
|
6
|
-
import { DSIconSizes } from
|
|
7
|
-
import { QueryRemove,
|
|
8
|
-
import DSButton from
|
|
9
|
-
import { ToolBarAnimation } from
|
|
10
|
-
import { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION } from
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
4
|
+
import DSTooltip, { TooltipType } from '@elliemae/ds-tooltip';
|
|
5
|
+
import { PopperInteractions, PopperPositions } from '@elliemae/ds-popper';
|
|
6
|
+
import { DSIconSizes } from '@elliemae/ds-icon';
|
|
7
|
+
import { QueryRemove, QueryAdd, ParenthesisAdd, MoreOptionsVert } from '@elliemae/ds-icons';
|
|
8
|
+
import DSButton from '@elliemae/ds-button';
|
|
9
|
+
import { ToolBarAnimation } from '../ToolBarAnimation/ToolBarAnimation.js';
|
|
10
|
+
import { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION } from '../helpers/constants.js';
|
|
11
|
+
|
|
12
|
+
var _ToolBarAnimation, _QueryRemove, _QueryAdd, _ParenthesisAdd;
|
|
13
|
+
|
|
14
|
+
const ConditionController = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
onAddFilter = () => null,
|
|
17
|
+
onAddRuleContainer = () => null,
|
|
18
|
+
onRemoveFilter = () => null,
|
|
19
|
+
handleTooltipRow = () => null,
|
|
20
|
+
buttonTriggerSize = DSIconSizes.M,
|
|
21
|
+
buttonTriggerType = 'text',
|
|
22
|
+
buttonActionSize = DSIconSizes.M,
|
|
23
|
+
buttonActionType = 'text',
|
|
24
|
+
delayClose = DELAY_CLOSE,
|
|
25
|
+
delayOpen = DELAY_OPEN,
|
|
26
|
+
isOpen = false,
|
|
27
|
+
toolTipZIndex
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
cssClassName,
|
|
31
|
+
classNameBlock,
|
|
32
|
+
classNameElement
|
|
33
|
+
} = convertPropToCssClassName('query-builder-condition-controller');
|
|
34
|
+
return /*#__PURE__*/_jsx("div", {
|
|
27
35
|
className: cssClassName
|
|
28
|
-
},
|
|
29
|
-
delayClose,
|
|
30
|
-
delayOpen,
|
|
31
|
-
interactionType:
|
|
32
|
-
isOpen,
|
|
36
|
+
}, void 0, /*#__PURE__*/_jsx(DSTooltip, {
|
|
37
|
+
delayClose: delayClose,
|
|
38
|
+
delayOpen: delayOpen,
|
|
39
|
+
interactionType: PopperInteractions.CLICK,
|
|
40
|
+
isOpen: isOpen,
|
|
33
41
|
onOpen: handleTooltipRow,
|
|
34
|
-
placement:
|
|
35
|
-
springAnimationComponent:
|
|
42
|
+
placement: PopperPositions.LEFT,
|
|
43
|
+
springAnimationComponent: _ToolBarAnimation || (_ToolBarAnimation = /*#__PURE__*/_jsx(ToolBarAnimation, {
|
|
36
44
|
duration: TOOLBAR_ANIMATION_DURATION
|
|
37
|
-
}),
|
|
38
|
-
title:
|
|
39
|
-
className: classNameBlock(
|
|
40
|
-
},
|
|
45
|
+
})),
|
|
46
|
+
title: /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: classNameBlock('actions')
|
|
48
|
+
}, void 0, /*#__PURE__*/_jsx(DSButton, {
|
|
41
49
|
buttonType: buttonActionType,
|
|
42
|
-
className: classNameElement(
|
|
43
|
-
icon:
|
|
50
|
+
className: classNameElement('remove-rule'),
|
|
51
|
+
icon: _QueryRemove || (_QueryRemove = /*#__PURE__*/_jsx(QueryRemove, {})),
|
|
44
52
|
onClick: onRemoveFilter,
|
|
45
53
|
size: buttonActionSize,
|
|
46
54
|
containerProps: {
|
|
47
|
-
|
|
55
|
+
'data-testid': 'query-remove-button'
|
|
48
56
|
}
|
|
49
|
-
}),
|
|
57
|
+
}), /*#__PURE__*/_jsx(DSButton, {
|
|
50
58
|
buttonType: buttonActionType,
|
|
51
|
-
className: classNameElement(
|
|
52
|
-
icon:
|
|
59
|
+
className: classNameElement('add-rule'),
|
|
60
|
+
icon: _QueryAdd || (_QueryAdd = /*#__PURE__*/_jsx(QueryAdd, {})),
|
|
53
61
|
onClick: onAddFilter,
|
|
54
62
|
size: buttonActionSize,
|
|
55
63
|
containerProps: {
|
|
56
|
-
|
|
64
|
+
'data-testid': 'query-add-button'
|
|
57
65
|
}
|
|
58
|
-
}),
|
|
66
|
+
}), /*#__PURE__*/_jsx(DSButton, {
|
|
59
67
|
buttonType: buttonActionType,
|
|
60
|
-
className:
|
|
61
|
-
icon:
|
|
68
|
+
className: "".concat(classNameElement('add-rule-container'), " no-border-right"),
|
|
69
|
+
icon: _ParenthesisAdd || (_ParenthesisAdd = /*#__PURE__*/_jsx(ParenthesisAdd, {})),
|
|
62
70
|
onClick: onAddRuleContainer,
|
|
63
71
|
size: buttonActionSize,
|
|
64
72
|
containerProps: {
|
|
65
|
-
|
|
73
|
+
'data-testid': 'parenthesis-add-button'
|
|
66
74
|
}
|
|
67
75
|
})),
|
|
68
76
|
tooltipType: TooltipType.TOOLBAR,
|
|
69
|
-
triggerComponent:
|
|
77
|
+
triggerComponent: /*#__PURE__*/_jsx(DSButton, {
|
|
70
78
|
buttonType: buttonTriggerType,
|
|
71
|
-
icon:
|
|
72
|
-
color: [
|
|
79
|
+
icon: /*#__PURE__*/_jsx(MoreOptionsVert, {
|
|
80
|
+
color: ['neutral', '500']
|
|
73
81
|
}),
|
|
74
82
|
onClick: handleTooltipRow,
|
|
75
83
|
size: buttonTriggerSize,
|
|
76
84
|
containerProps: {
|
|
77
|
-
|
|
85
|
+
'data-testid': 'condition-more-options-button'
|
|
78
86
|
}
|
|
79
87
|
}),
|
|
80
88
|
zIndex: toolTipZIndex
|
|
81
89
|
}));
|
|
82
90
|
};
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
ConditionController_default as default
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=ConditionController.js.map
|
|
91
|
+
|
|
92
|
+
export { ConditionController as default };
|
|
@@ -1,59 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Grid } from
|
|
4
|
-
import { convertPropToCssClassName } from
|
|
5
|
-
import { DSAccordion, DSAccordionItem } from
|
|
6
|
-
import {
|
|
7
|
-
import { QueryBuilderContext } from
|
|
8
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { Grid } from '@elliemae/ds-grid';
|
|
4
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
5
|
+
import { DSAccordion, DSAccordionItem } from '@elliemae/ds-accordion';
|
|
6
|
+
import { ChevronRight, ChevronDown } from '@elliemae/ds-icons';
|
|
7
|
+
import { QueryBuilderContext } from '../QueryBuilderContext/QueryBuilderContext.js';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
cssClassName
|
|
11
|
+
} = convertPropToCssClassName('query-builder-output');
|
|
12
|
+
|
|
9
13
|
class DisplayOutput extends Component {
|
|
10
14
|
constructor(props) {
|
|
11
15
|
super(props);
|
|
16
|
+
|
|
12
17
|
this.handleChange = () => {
|
|
13
|
-
this.setState(
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
this.setState(_ref => {
|
|
19
|
+
let {
|
|
20
|
+
show
|
|
21
|
+
} = _ref;
|
|
22
|
+
return {
|
|
23
|
+
show: !show
|
|
24
|
+
};
|
|
25
|
+
});
|
|
16
26
|
};
|
|
27
|
+
|
|
17
28
|
this.state = {
|
|
18
29
|
show: props.show
|
|
19
30
|
};
|
|
20
31
|
}
|
|
32
|
+
|
|
21
33
|
render() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
var _Grid;
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
show
|
|
38
|
+
} = this.state;
|
|
39
|
+
const {
|
|
40
|
+
showLabel,
|
|
41
|
+
hideLabel,
|
|
42
|
+
displayFixedOutput
|
|
43
|
+
} = this.props;
|
|
44
|
+
return /*#__PURE__*/_jsx(QueryBuilderContext.Consumer, {}, void 0, _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
format
|
|
47
|
+
} = _ref2;
|
|
48
|
+
let display = '';
|
|
49
|
+
|
|
26
50
|
try {
|
|
27
|
-
display = typeof format ===
|
|
51
|
+
display = typeof format === 'object' ? JSON.stringify(format) : format;
|
|
28
52
|
} catch (e) {
|
|
29
53
|
display = e;
|
|
30
54
|
}
|
|
55
|
+
|
|
31
56
|
if (displayFixedOutput) {
|
|
32
|
-
return
|
|
33
|
-
className: cssClassName
|
|
34
|
-
|
|
57
|
+
return /*#__PURE__*/_jsx("div", {
|
|
58
|
+
className: cssClassName,
|
|
59
|
+
"data-testid": "qb-fixed-output-wrapper"
|
|
60
|
+
}, void 0, _Grid || (_Grid = /*#__PURE__*/_jsx(Grid, {
|
|
35
61
|
p: "xxs"
|
|
36
|
-
},
|
|
62
|
+
}, void 0, /*#__PURE__*/_jsx("strong", {
|
|
63
|
+
"data-testid": "qb-fixed-output-label"
|
|
64
|
+
}, void 0, displayFixedOutput))), /*#__PURE__*/_jsx(Grid, {
|
|
37
65
|
pl: "xxs",
|
|
38
|
-
pr: "xxs"
|
|
39
|
-
|
|
66
|
+
pr: "xxs",
|
|
67
|
+
"data-testid": "qb-fixed-output-content"
|
|
68
|
+
}, void 0, display));
|
|
40
69
|
}
|
|
41
|
-
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/_jsx("div", {
|
|
42
72
|
className: cssClassName
|
|
43
|
-
},
|
|
73
|
+
}, void 0, /*#__PURE__*/_jsx(DSAccordion, {
|
|
44
74
|
activeValue: show,
|
|
45
75
|
onChange: this.handleChange
|
|
46
|
-
},
|
|
76
|
+
}, void 0, /*#__PURE__*/_jsx(DSAccordionItem, {
|
|
47
77
|
iconClosed: ChevronRight,
|
|
48
78
|
iconOpened: ChevronDown,
|
|
49
79
|
title: show ? hideLabel : showLabel,
|
|
50
80
|
value: true
|
|
51
|
-
},
|
|
81
|
+
}, void 0, /*#__PURE__*/_jsx("div", {}, void 0, display))));
|
|
52
82
|
});
|
|
53
83
|
}
|
|
84
|
+
|
|
54
85
|
}
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
DisplayOutput_default as default
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=DisplayOutput.js.map
|
|
86
|
+
|
|
87
|
+
export { DisplayOutput as default };
|