@elliemae/ds-query-builder 3.70.0-next.14 → 3.70.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AndOrController/AndOrController.js +98 -137
- package/dist/cjs/components/AndOrController/AndOrController.js.map +3 -3
- package/dist/cjs/components/ConditionController/ConditionController.js +75 -94
- package/dist/cjs/components/ConditionController/ConditionController.js.map +3 -3
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js +2 -2
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +2 -2
- package/dist/esm/components/AndOrController/AndOrController.js +99 -138
- package/dist/esm/components/AndOrController/AndOrController.js.map +2 -2
- package/dist/esm/components/ConditionController/ConditionController.js +75 -94
- package/dist/esm/components/ConditionController/ConditionController.js.map +2 -2
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js +1 -1
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +1 -1
- package/dist/types/components/AndOrController/AndOrController.d.ts +0 -5
- package/dist/types/components/ConditionController/ConditionController.d.ts +3 -6
- package/package.json +11 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/QueryBuilderRow/QueryBuilderRow.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-argument, max-params */\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */\n/* eslint-disable max-lines, complexity, @typescript-eslint/no-unsafe-call */\n/* eslint-disable no-unused-vars, @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */\n/* tslint:disable */\n// @ts-nocheck\n// What's with all the above disables?\n// this is what a legacy 7 year old codebase looks like.\n// also, react class components.\n\nimport React, { Component } from 'react';\nimport { AlertsDetail } from '@elliemae/ds-icons';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { styled } from '@elliemae/ds-system';\nimport { resolveDependencies } from '../helpers/dependencies.js';\nimport ConditionController from '../ConditionController/ConditionController.js';\nimport DragControllerRow from '../DragControllerRow/DragControllerRow.js';\n\nconst StyledDiv = styled.div`\n .em-ds-query-builder-row__input-controller {\n padding-top: 0.1538rem; // 2px converted to rem based on 1rem = 13px\n }\n`;\n\nconst RenderField = ({\n target,\n component,\n valueProp,\n additionalInfo,\n handleMouseEnterInput,\n handleMouseLeaveInput,\n onChangeHandler,\n hasError,\n}) => {\n const ref = React.useRef<HTMLElement>();\n const id = React.useMemo(() => `el_${String.fromCharCode(65 + Math.floor(Math.random() * 26))}`, []);\n const UserComponent = component;\n const componentNewProps = {\n id,\n onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n value: valueProp != null ? valueProp : '',\n checked: valueProp === true,\n additionalInfo: additionalInfo ? additionalInfo[target] : additionalInfo || {},\n 'aria-invalid': Boolean(hasError),\n };\n\n return (\n <StyledDiv\n className={`em-ds-query-builder-row-input child-type-${target} ${\n hasError && hasError.error ? 'row-input-error' : ''\n }`}\n onMouseDownCapture={() => {\n // eslint-disable-next-line no-underscore-dangle\n const refInput = ref.current?.querySelector(`#${id}`);\n // eslint-disable-next-line @typescript-eslint/no-implied-eval\n if (refInput && refInput.focus) setTimeout(refInput.focus());\n handleMouseEnterInput();\n }}\n onMouseEnter={() => handleMouseEnterInput()}\n onMouseLeave={() => handleMouseLeaveInput()}\n >\n <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n {React.isValidElement(UserComponent) ? (\n React.cloneElement(UserComponent, componentNewProps)\n ) : (\n <UserComponent {...componentNewProps} />\n )}\n </div>\n {hasError && hasError.errorMessage ? (\n <div style={{ width: '40px' }}>\n <DSTooltipV3 text={hasError.errorMessage}>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div tabIndex={0} className=\"row-icon-alert\" data-testid=\"qb-error-state-icon\" role=\"alert\">\n <AlertsDetail width={20} height={20} color={['danger', 900]} title={hasError.errorMessage} />\n </div>\n </DSTooltipV3>\n </div>\n ) : null}\n </StyledDiv>\n );\n // return React.useMemo(\n // () => (\n // <div\n // className={`em-ds-query-builder-row-input child-type-${target}`}\n // onMouseDownCapture={() => {\n // // eslint-disable-next-line no-underscore-dangle\n // const _refInput = ref.current.querySelector(`#${id}`);\n // if (_refInput && _refInput.focus) setTimeout(_refInput.focus());\n // handleMouseEnterInput();\n // }}\n // onMouseEnter={() => handleMouseEnterInput()}\n // onMouseLeave={() => handleMouseLeaveInput()}\n // >\n // <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n // {React.cloneElement(component, {\n // id,\n // onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n // value: valueProp != null ? valueProp : '',\n // checked: valueProp === true,\n // additionalInfo: additionalInfo ? additionalInfo[target] : {},\n // })}\n // </div>\n // </div>\n // ),\n // [target, component, valueProp, additionalInfo],\n // );\n};\nclass QueryBuilderRow extends Component<any, any> {\n constructor(props: any) {\n super(props);\n this.state = {\n isOpen: false,\n };\n\n this.onChangeHandler = this.onChangeHandler.bind(this);\n }\n\n onChangeHandler(e, target, extraData, hasError) {\n const { handleFieldChange, idFilter, idGroup, additionalInfo, field, operator, value } = this.props;\n let eventValue = e;\n if (e && e.target) {\n const { value: targetValue, checked } = e.target;\n if (targetValue || targetValue === '' || typeof targetValue === 'boolean') eventValue = targetValue;\n else eventValue = checked || e;\n }\n handleFieldChange({\n [target]: eventValue,\n idFilter,\n idGroup,\n additionalInfo: {\n ...additionalInfo,\n [target]: extraData,\n [`${target}_error`]: hasError,\n [`${target}_touched`]: true,\n },\n target,\n });\n }\n\n handleMouseEnterRow = () => {};\n\n handleMouseLeaveRow = () => {\n this.handleTooltipRow(false);\n };\n\n handleMouseEnterInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(false);\n };\n\n handleMouseLeaveInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(true);\n };\n\n handleTooltipRow = (isOpen) => {\n this.setState({ isOpen });\n };\n\n render() {\n const { isOpen } = this.state;\n const {\n fields,\n onAddFilter,\n onRemoveFilter,\n onAddRuleContainer,\n field,\n operator,\n value,\n additionalInfo,\n items,\n singleRow,\n toolTipZIndex,\n error,\n } = this.props;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { cssClassName, classNameBlock, classNameElement } = convertPropToCssClassName(\n 'query-builder-row',\n isOpen ? 'has-open-tooltip' : 'has-close-tooltip',\n singleRow ? 'is-single-row' : 'is-multiple-row',\n );\n const test = resolveDependencies(\n {\n field,\n operator,\n value,\n additionalInfo,\n },\n fields,\n );\n\n const gridTemplateColumns = [\n singleRow ? '' : '24px',\n ...test.map((r) => {\n if (r.handleWidth) {\n return r.handleWidth(this.props[r.target], {\n field,\n operator,\n value,\n additionalInfo,\n });\n }\n return 'minmax(0, 1fr)';\n }),\n '30px',\n ].join(' ');\n\n return (\n <div\n className={cssClassName}\n onMouseEnter={this.handleMouseEnterRow}\n onMouseLeave={this.handleMouseLeaveRow}\n style={{\n gridTemplateColumns,\n }}\n >\n {!singleRow && (\n <DragControllerRow\n className={classNameElement('drag-controller')}\n onMouseDownCapture={() => this.handleMouseLeaveInput()}\n />\n )}\n {test.map((renderField) => {\n const { target, component } = renderField;\n const { [target]: valueProp } = this.props;\n\n const isTouched = additionalInfo && additionalInfo[`${target}_touched`];\n const hasError =\n renderField && renderField.validation\n ? renderField.validation(valueProp, {\n field,\n operator,\n value,\n additionalInfo,\n })\n : false;\n return (\n <RenderField\n component={component}\n target={target}\n valueProp={valueProp}\n onChangeHandler={(e, changeTarget, extraData) => {\n this.onChangeHandler(e, changeTarget, extraData, hasError);\n }}\n handleMouseEnterInput={this.handleMouseEnterInput}\n handleMouseLeaveInput={this.handleMouseLeaveInput}\n additionalInfo={additionalInfo}\n hasError={isTouched && hasError}\n />\n );\n })}\n {!singleRow && (\n <div className={classNameBlock('controller')}>\n <ConditionController\n handleTooltipRow={this.handleTooltipRow}\n isOpen={isOpen}\n items={items}\n onAddFilter={onAddFilter}\n onAddRuleContainer={onAddRuleContainer}\n onRemoveFilter={onRemoveFilter}\n toolTipZIndex={toolTipZIndex}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default QueryBuilderRow;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiDnB;AAtCJ,mBAAiC;AACjC,sBAA6B;AAC7B,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-argument, max-params */\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */\n/* eslint-disable max-lines, complexity, @typescript-eslint/no-unsafe-call */\n/* eslint-disable no-unused-vars, @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */\n/* tslint:disable */\n// @ts-nocheck\n// What's with all the above disables?\n// this is what a legacy 7 year old codebase looks like.\n// also, react class components.\n\nimport React, { Component } from 'react';\nimport { AlertsDetail } from '@elliemae/ds-icons';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip-v3';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { styled } from '@elliemae/ds-system';\nimport { resolveDependencies } from '../helpers/dependencies.js';\nimport ConditionController from '../ConditionController/ConditionController.js';\nimport DragControllerRow from '../DragControllerRow/DragControllerRow.js';\n\nconst StyledDiv = styled.div`\n .em-ds-query-builder-row__input-controller {\n padding-top: 0.1538rem; // 2px converted to rem based on 1rem = 13px\n }\n`;\n\nconst RenderField = ({\n target,\n component,\n valueProp,\n additionalInfo,\n handleMouseEnterInput,\n handleMouseLeaveInput,\n onChangeHandler,\n hasError,\n}) => {\n const ref = React.useRef<HTMLElement>();\n const id = React.useMemo(() => `el_${String.fromCharCode(65 + Math.floor(Math.random() * 26))}`, []);\n const UserComponent = component;\n const componentNewProps = {\n id,\n onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n value: valueProp != null ? valueProp : '',\n checked: valueProp === true,\n additionalInfo: additionalInfo ? additionalInfo[target] : additionalInfo || {},\n 'aria-invalid': Boolean(hasError),\n };\n\n return (\n <StyledDiv\n className={`em-ds-query-builder-row-input child-type-${target} ${\n hasError && hasError.error ? 'row-input-error' : ''\n }`}\n onMouseDownCapture={() => {\n // eslint-disable-next-line no-underscore-dangle\n const refInput = ref.current?.querySelector(`#${id}`);\n // eslint-disable-next-line @typescript-eslint/no-implied-eval\n if (refInput && refInput.focus) setTimeout(refInput.focus());\n handleMouseEnterInput();\n }}\n onMouseEnter={() => handleMouseEnterInput()}\n onMouseLeave={() => handleMouseLeaveInput()}\n >\n <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n {React.isValidElement(UserComponent) ? (\n React.cloneElement(UserComponent, componentNewProps)\n ) : (\n <UserComponent {...componentNewProps} />\n )}\n </div>\n {hasError && hasError.errorMessage ? (\n <div style={{ width: '40px' }}>\n <DSTooltipV3 text={hasError.errorMessage}>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div tabIndex={0} className=\"row-icon-alert\" data-testid=\"qb-error-state-icon\" role=\"alert\">\n <AlertsDetail width={20} height={20} color={['danger', 900]} title={hasError.errorMessage} />\n </div>\n </DSTooltipV3>\n </div>\n ) : null}\n </StyledDiv>\n );\n // return React.useMemo(\n // () => (\n // <div\n // className={`em-ds-query-builder-row-input child-type-${target}`}\n // onMouseDownCapture={() => {\n // // eslint-disable-next-line no-underscore-dangle\n // const _refInput = ref.current.querySelector(`#${id}`);\n // if (_refInput && _refInput.focus) setTimeout(_refInput.focus());\n // handleMouseEnterInput();\n // }}\n // onMouseEnter={() => handleMouseEnterInput()}\n // onMouseLeave={() => handleMouseLeaveInput()}\n // >\n // <div ref={ref} className=\"em-ds-query-builder-row__input-controller\">\n // {React.cloneElement(component, {\n // id,\n // onChange: (e, extraData) => onChangeHandler(e, target, extraData),\n // value: valueProp != null ? valueProp : '',\n // checked: valueProp === true,\n // additionalInfo: additionalInfo ? additionalInfo[target] : {},\n // })}\n // </div>\n // </div>\n // ),\n // [target, component, valueProp, additionalInfo],\n // );\n};\nclass QueryBuilderRow extends Component<any, any> {\n constructor(props: any) {\n super(props);\n this.state = {\n isOpen: false,\n };\n\n this.onChangeHandler = this.onChangeHandler.bind(this);\n }\n\n onChangeHandler(e, target, extraData, hasError) {\n const { handleFieldChange, idFilter, idGroup, additionalInfo, field, operator, value } = this.props;\n let eventValue = e;\n if (e && e.target) {\n const { value: targetValue, checked } = e.target;\n if (targetValue || targetValue === '' || typeof targetValue === 'boolean') eventValue = targetValue;\n else eventValue = checked || e;\n }\n handleFieldChange({\n [target]: eventValue,\n idFilter,\n idGroup,\n additionalInfo: {\n ...additionalInfo,\n [target]: extraData,\n [`${target}_error`]: hasError,\n [`${target}_touched`]: true,\n },\n target,\n });\n }\n\n handleMouseEnterRow = () => {};\n\n handleMouseLeaveRow = () => {\n this.handleTooltipRow(false);\n };\n\n handleMouseEnterInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(false);\n };\n\n handleMouseLeaveInput = () => {\n const { setDraggableItems } = this.props;\n setDraggableItems(true);\n };\n\n handleTooltipRow = (isOpen) => {\n this.setState({ isOpen });\n };\n\n render() {\n const { isOpen } = this.state;\n const {\n fields,\n onAddFilter,\n onRemoveFilter,\n onAddRuleContainer,\n field,\n operator,\n value,\n additionalInfo,\n items,\n singleRow,\n toolTipZIndex,\n error,\n } = this.props;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { cssClassName, classNameBlock, classNameElement } = convertPropToCssClassName(\n 'query-builder-row',\n isOpen ? 'has-open-tooltip' : 'has-close-tooltip',\n singleRow ? 'is-single-row' : 'is-multiple-row',\n );\n const test = resolveDependencies(\n {\n field,\n operator,\n value,\n additionalInfo,\n },\n fields,\n );\n\n const gridTemplateColumns = [\n singleRow ? '' : '24px',\n ...test.map((r) => {\n if (r.handleWidth) {\n return r.handleWidth(this.props[r.target], {\n field,\n operator,\n value,\n additionalInfo,\n });\n }\n return 'minmax(0, 1fr)';\n }),\n '30px',\n ].join(' ');\n\n return (\n <div\n className={cssClassName}\n onMouseEnter={this.handleMouseEnterRow}\n onMouseLeave={this.handleMouseLeaveRow}\n style={{\n gridTemplateColumns,\n }}\n >\n {!singleRow && (\n <DragControllerRow\n className={classNameElement('drag-controller')}\n onMouseDownCapture={() => this.handleMouseLeaveInput()}\n />\n )}\n {test.map((renderField) => {\n const { target, component } = renderField;\n const { [target]: valueProp } = this.props;\n\n const isTouched = additionalInfo && additionalInfo[`${target}_touched`];\n const hasError =\n renderField && renderField.validation\n ? renderField.validation(valueProp, {\n field,\n operator,\n value,\n additionalInfo,\n })\n : false;\n return (\n <RenderField\n component={component}\n target={target}\n valueProp={valueProp}\n onChangeHandler={(e, changeTarget, extraData) => {\n this.onChangeHandler(e, changeTarget, extraData, hasError);\n }}\n handleMouseEnterInput={this.handleMouseEnterInput}\n handleMouseLeaveInput={this.handleMouseLeaveInput}\n additionalInfo={additionalInfo}\n hasError={isTouched && hasError}\n />\n );\n })}\n {!singleRow && (\n <div className={classNameBlock('controller')}>\n <ConditionController\n handleTooltipRow={this.handleTooltipRow}\n isOpen={isOpen}\n items={items}\n onAddFilter={onAddFilter}\n onAddRuleContainer={onAddRuleContainer}\n onRemoveFilter={onRemoveFilter}\n toolTipZIndex={toolTipZIndex}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default QueryBuilderRow;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiDnB;AAtCJ,mBAAiC;AACj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AK,sBAAsB;AAAA;AAAA,UACvD;AAAA,UAED,KAAK,IAAI,CAAC,gBAAgB;AACzB,kBAAM,EAAE,QAAQ,UAAU,IAAI;AAC9B,kBAAM,EAAE,CAAC,MAAM,GAAG,UAAU,IAAI,KAAK;AAErC,kBAAM,YAAY,kBAAkB,eAAe,GAAG,MAAM,UAAU;AACtE,kBAAM,WACJ,eAAe,YAAY,aACvB,YAAY,WAAW,WAAW;AAAA,cAChC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC,IACD;AACN,mBACE;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,iBAAiB,CAAC,GAAG,cAAc,cAAc;AAC/C,uBAAK,gBAAgB,GAAG,cAAc,WAAW,QAAQ;AAAA,gBAC3D;AAAA,gBACA,uBAAuB,KAAK;AAAA,gBAC5B,uBAAuB,KAAK;AAAA,gBAC5B;AAAA,gBACA,UAAU,aAAa;AAAA;AAAA,YACzB;AAAA,UAEJ,CAAC;AAAA,UACA,CAAC,aACA,4CAAC,SAAI,WAAW,eAAe,YAAY,GACzC;AAAA,YAAC,2BAAAC;AAAA,YAAA;AAAA,cACC,kBAAkB,KAAK;AAAA,cACvB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF,GACF;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["React", "DragControllerRow", "ConditionController"]
|
|
7
7
|
}
|
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React2, { Component } from "react";
|
|
4
4
|
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
6
|
+
import { DSTooltipV3 } from "@elliemae/ds-tooltip-v3";
|
|
7
7
|
import { DSToggle } from "@elliemae/ds-legacy-form";
|
|
8
|
-
import
|
|
8
|
+
import DSButton from "@elliemae/ds-legacy-button-v1";
|
|
9
9
|
import { ParenthesisRemove, MoreOptionsVert, QueryAdd } from "@elliemae/ds-icons";
|
|
10
10
|
import { DSIconColors, DSIconSizes } from "@elliemae/ds-icon";
|
|
11
|
-
import { DELAY_CLOSE, DELAY_OPEN, TOOLBAR_ANIMATION_DURATION } from "../helpers/constants.js";
|
|
12
|
-
import { ToolBarAnimation } from "../ToolBarAnimation/ToolBarAnimation.js";
|
|
13
11
|
import DragContainerController from "../DragContainerController/DragContainerController.js";
|
|
14
12
|
const { cssClassName, classNameBlock, classNameElement, mainModifier, classNameBlockModifier } = convertPropToCssClassName("query-builder-and-or-controller");
|
|
13
|
+
const AndOrToolbarContent = ({
|
|
14
|
+
buttonActionType,
|
|
15
|
+
onAddFilter,
|
|
16
|
+
buttonActionSize,
|
|
17
|
+
allowUnGroup,
|
|
18
|
+
handleRuleContainerUnGroup,
|
|
19
|
+
condition,
|
|
20
|
+
labelOff,
|
|
21
|
+
labelOn,
|
|
22
|
+
handleRuleContainerOperator,
|
|
23
|
+
toogleActionSize
|
|
24
|
+
}) => /* @__PURE__ */ jsxs("div", { className: classNameBlock("actions"), children: [
|
|
25
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { text: "Add condition", children: /* @__PURE__ */ jsx(
|
|
26
|
+
DSButton,
|
|
27
|
+
{
|
|
28
|
+
buttonType: buttonActionType,
|
|
29
|
+
className: classNameElement("add-rule"),
|
|
30
|
+
icon: /* @__PURE__ */ jsx(QueryAdd, {}),
|
|
31
|
+
onClick: onAddFilter,
|
|
32
|
+
size: buttonActionSize,
|
|
33
|
+
containerProps: { "data-testid": "query-add-button" }
|
|
34
|
+
}
|
|
35
|
+
) }),
|
|
36
|
+
allowUnGroup && /* @__PURE__ */ jsx(DSTooltipV3, { text: "Remove group", children: /* @__PURE__ */ jsx(
|
|
37
|
+
DSButton,
|
|
38
|
+
{
|
|
39
|
+
buttonType: "text",
|
|
40
|
+
className: classNameElement("ungroup"),
|
|
41
|
+
icon: /* @__PURE__ */ jsx(ParenthesisRemove, {}),
|
|
42
|
+
onClick: handleRuleContainerUnGroup,
|
|
43
|
+
size: buttonActionSize,
|
|
44
|
+
containerProps: { "data-testid": "parenthesis-remove-button" }
|
|
45
|
+
}
|
|
46
|
+
) }),
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
DSToggle,
|
|
49
|
+
{
|
|
50
|
+
checked: condition,
|
|
51
|
+
className: classNameElement("and-or-toggle"),
|
|
52
|
+
labelOff,
|
|
53
|
+
labelOn,
|
|
54
|
+
onChange: (e) => handleRuleContainerOperator(e.target.checked),
|
|
55
|
+
size: toogleActionSize,
|
|
56
|
+
containerProps: { "data-testid": "and-or-toggle-button" }
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
const AndOrFloatingToolbar = ({ isOpen, placement, toolbarProps, children }) => {
|
|
61
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
62
|
+
externallyControlledIsOpen: isOpen,
|
|
63
|
+
placement,
|
|
64
|
+
customOffset: [0, 0]
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
+
children(refs.setReference),
|
|
68
|
+
/* @__PURE__ */ jsx(FloatingWrapper, { innerRef: refs.setFloating, isOpen, floatingStyles, context, children: /* @__PURE__ */ jsx(AndOrToolbarContent, { ...toolbarProps }) })
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
15
71
|
class AndOrController extends Component {
|
|
16
72
|
static defaultProps = {
|
|
17
73
|
isMain: false,
|
|
@@ -28,37 +84,19 @@ class AndOrController extends Component {
|
|
|
28
84
|
toogleActionSize: DSIconSizes.S,
|
|
29
85
|
onAddFilter: () => null,
|
|
30
86
|
multipleSize: false,
|
|
31
|
-
delayClose: DELAY_CLOSE,
|
|
32
|
-
delayOpen: DELAY_OPEN,
|
|
33
87
|
step: null,
|
|
34
|
-
|
|
35
|
-
toolBarInteractionType: Interaction.CLICK,
|
|
36
|
-
toolBarPosition: Position.LEFT
|
|
88
|
+
toolBarPosition: "left"
|
|
37
89
|
};
|
|
38
90
|
constructor(props) {
|
|
39
91
|
super(props);
|
|
40
|
-
this.contenerRef = React2.createRef();
|
|
41
92
|
this.myRef = React2.createRef();
|
|
42
93
|
this.state = {
|
|
43
|
-
isOpen: false
|
|
44
|
-
top: 0,
|
|
45
|
-
right: -2
|
|
94
|
+
isOpen: false
|
|
46
95
|
};
|
|
47
96
|
}
|
|
48
97
|
handleMouseEnterRow = (e) => {
|
|
49
98
|
this.handleTooltipRow(true);
|
|
50
99
|
};
|
|
51
|
-
handleMouseMove = (e) => {
|
|
52
|
-
if (!this.contenerRef.current) return;
|
|
53
|
-
const mouse = e.clientY;
|
|
54
|
-
const { height } = this.contenerRef.current.getBoundingClientRect();
|
|
55
|
-
const delta = height / 2;
|
|
56
|
-
const topDiff = this.myRef.current.getBoundingClientRect().top;
|
|
57
|
-
const refHeight = this.myRef.current.getBoundingClientRect().height;
|
|
58
|
-
this.setState({
|
|
59
|
-
top: mouse - topDiff - refHeight / 2 - delta
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
100
|
handleMouseLeaveRow = () => {
|
|
63
101
|
this.handleTooltipRow(false);
|
|
64
102
|
};
|
|
@@ -81,129 +119,52 @@ class AndOrController extends Component {
|
|
|
81
119
|
toogleActionSize,
|
|
82
120
|
onAddFilter,
|
|
83
121
|
multipleSize,
|
|
84
|
-
delayClose,
|
|
85
|
-
delayOpen,
|
|
86
122
|
step,
|
|
87
|
-
toolBarAnimationDuration,
|
|
88
|
-
toolBarInteractionType,
|
|
89
123
|
toolBarPosition,
|
|
90
|
-
isMain
|
|
91
|
-
toolTipZIndex
|
|
124
|
+
isMain
|
|
92
125
|
} = this.props;
|
|
93
|
-
const { isOpen
|
|
126
|
+
const { isOpen } = this.state;
|
|
127
|
+
const toolbarProps = {
|
|
128
|
+
buttonActionType,
|
|
129
|
+
onAddFilter,
|
|
130
|
+
buttonActionSize,
|
|
131
|
+
allowUnGroup,
|
|
132
|
+
handleRuleContainerUnGroup,
|
|
133
|
+
condition,
|
|
134
|
+
labelOff,
|
|
135
|
+
labelOn,
|
|
136
|
+
handleRuleContainerOperator,
|
|
137
|
+
toogleActionSize
|
|
138
|
+
};
|
|
94
139
|
return /* @__PURE__ */ jsx(
|
|
95
140
|
"div",
|
|
96
141
|
{
|
|
97
142
|
ref: this.myRef,
|
|
98
143
|
className: `${cssClassName} ${mainModifier(condition ? "active" : "default")} step-${step} ${isMain ? "is-main-group-join" : ""}`,
|
|
99
144
|
onMouseLeave: this.handleMouseLeaveRow,
|
|
100
|
-
children: /* @__PURE__ */ jsx("div", { className: `${classNameBlock("content")} step-${step}`, children: /* @__PURE__ */ jsx(
|
|
101
|
-
|
|
145
|
+
children: /* @__PURE__ */ jsx("div", { className: `${classNameBlock("content")} step-${step}`, children: /* @__PURE__ */ jsx(AndOrFloatingToolbar, { isOpen, placement: toolBarPosition, toolbarProps, children: (setRef) => /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
102
147
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
DSTooltip,
|
|
125
|
-
{
|
|
126
|
-
title: "Add condition",
|
|
127
|
-
triggerComponent: /* @__PURE__ */ jsx(
|
|
128
|
-
DSButton,
|
|
129
|
-
{
|
|
130
|
-
buttonType: buttonActionType,
|
|
131
|
-
className: classNameElement("add-rule"),
|
|
132
|
-
icon: /* @__PURE__ */ jsx(QueryAdd, {}),
|
|
133
|
-
onClick: onAddFilter,
|
|
134
|
-
size: buttonActionSize,
|
|
135
|
-
containerProps: {
|
|
136
|
-
"data-testid": "query-add-button"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
allowUnGroup && /* @__PURE__ */ jsx(
|
|
143
|
-
DSTooltip,
|
|
144
|
-
{
|
|
145
|
-
title: "Remove group",
|
|
146
|
-
triggerComponent: /* @__PURE__ */ jsx(
|
|
147
|
-
DSButton,
|
|
148
|
-
{
|
|
149
|
-
buttonType: "text",
|
|
150
|
-
className: classNameElement("ungroup"),
|
|
151
|
-
icon: /* @__PURE__ */ jsx(ParenthesisRemove, {}),
|
|
152
|
-
onClick: handleRuleContainerUnGroup,
|
|
153
|
-
size: buttonActionSize,
|
|
154
|
-
containerProps: {
|
|
155
|
-
"data-testid": "parenthesis-remove-button"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
/* @__PURE__ */ jsx(
|
|
162
|
-
DSToggle,
|
|
163
|
-
{
|
|
164
|
-
checked: condition,
|
|
165
|
-
className: classNameElement("and-or-toggle"),
|
|
166
|
-
labelOff,
|
|
167
|
-
labelOn,
|
|
168
|
-
onChange: (e) => handleRuleContainerOperator(e.target.checked),
|
|
169
|
-
size: toogleActionSize,
|
|
170
|
-
containerProps: {
|
|
171
|
-
"data-testid": "and-or-toggle-button"
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
tooltipType: TooltipType.TOOLBAR,
|
|
179
|
-
triggerComponent: /* @__PURE__ */ jsxs(
|
|
180
|
-
"div",
|
|
181
|
-
{
|
|
182
|
-
className: `${classNameBlock("trigger-controller")} ${showDragController ? classNameBlockModifier("draggable", "trigger-controller") : ""} step-${step}`,
|
|
183
|
-
children: [
|
|
184
|
-
/* @__PURE__ */ jsxs("div", { className: classNameElement("condition-display"), children: [
|
|
185
|
-
/* @__PURE__ */ jsx("span", { className: classNameElement("condition-display-label"), children: condition ? labelOn : labelOff }),
|
|
186
|
-
/* @__PURE__ */ jsx("span", { className: classNameElement("condition-display-step"), children: step }),
|
|
187
|
-
/* @__PURE__ */ jsx("div", { className: "separator" }),
|
|
188
|
-
/* @__PURE__ */ jsx(
|
|
189
|
-
MoreOptionsVert,
|
|
190
|
-
{
|
|
191
|
-
color: DSIconColors.NEUTRAL,
|
|
192
|
-
onClick: this.handleMouseEnterRow,
|
|
193
|
-
size: DSIconSizes.S,
|
|
194
|
-
containerProps: {
|
|
195
|
-
"data-testid": "and-or-more-options-button"
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
)
|
|
199
|
-
] }),
|
|
200
|
-
showDragController && /* @__PURE__ */ jsx(DragContainerController, { multipleSize, onClick: this.handleMouseEnterRow })
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
zIndex: toolTipZIndex
|
|
148
|
+
className: `${classNameBlock("trigger-controller")} ${showDragController ? classNameBlockModifier("draggable", "trigger-controller") : ""} step-${step}`,
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsxs("div", { className: classNameElement("condition-display"), children: [
|
|
151
|
+
/* @__PURE__ */ jsx("span", { className: classNameElement("condition-display-label"), children: condition ? labelOn : labelOff }),
|
|
152
|
+
/* @__PURE__ */ jsx("span", { className: classNameElement("condition-display-step"), children: step }),
|
|
153
|
+
/* @__PURE__ */ jsx("div", { className: "separator" }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { ref: setRef, children: /* @__PURE__ */ jsx(
|
|
155
|
+
MoreOptionsVert,
|
|
156
|
+
{
|
|
157
|
+
color: DSIconColors.NEUTRAL,
|
|
158
|
+
onClick: this.handleMouseEnterRow,
|
|
159
|
+
size: DSIconSizes.S,
|
|
160
|
+
containerProps: { "data-testid": "and-or-more-options-button" }
|
|
161
|
+
}
|
|
162
|
+
) })
|
|
163
|
+
] }),
|
|
164
|
+
showDragController && /* @__PURE__ */ jsx(DragContainerController, { multipleSize, onClick: this.handleMouseEnterRow })
|
|
165
|
+
]
|
|
205
166
|
}
|
|
206
|
-
) })
|
|
167
|
+
) }) })
|
|
207
168
|
}
|
|
208
169
|
);
|
|
209
170
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/AndOrController/AndOrController.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport React, { Component } from 'react';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip-v3';\nimport { DSToggle } from '@elliemae/ds-legacy-form';\nimport DSButton from '@elliemae/ds-legacy-button-v1';\nimport { ParenthesisRemove, MoreOptionsVert, QueryAdd } from '@elliemae/ds-icons';\nimport { DSIconColors, DSIconSizes } from '@elliemae/ds-icon';\nimport DragContainerController from '../DragContainerController/DragContainerController.js';\n\nconst { cssClassName, classNameBlock, classNameElement, mainModifier, classNameBlockModifier } =\n convertPropToCssClassName('query-builder-and-or-controller');\n\nconst AndOrToolbarContent = ({\n buttonActionType,\n onAddFilter,\n buttonActionSize,\n allowUnGroup,\n handleRuleContainerUnGroup,\n condition,\n labelOff,\n labelOn,\n handleRuleContainerOperator,\n toogleActionSize,\n}: Record<string, any>) => (\n <div className={classNameBlock('actions')}>\n <DSTooltipV3 text=\"Add condition\">\n <DSButton\n buttonType={buttonActionType}\n className={classNameElement('add-rule')}\n icon={<QueryAdd />}\n onClick={onAddFilter}\n size={buttonActionSize}\n containerProps={{ 'data-testid': 'query-add-button' }}\n />\n </DSTooltipV3>\n {allowUnGroup && (\n <DSTooltipV3 text=\"Remove group\">\n <DSButton\n buttonType=\"text\"\n className={classNameElement('ungroup')}\n icon={<ParenthesisRemove />}\n onClick={handleRuleContainerUnGroup}\n size={buttonActionSize}\n containerProps={{ 'data-testid': 'parenthesis-remove-button' }}\n />\n </DSTooltipV3>\n )}\n <DSToggle\n checked={condition}\n className={classNameElement('and-or-toggle')}\n labelOff={labelOff}\n labelOn={labelOn}\n onChange={(e) => handleRuleContainerOperator(e.target.checked)}\n size={toogleActionSize}\n containerProps={{ 'data-testid': 'and-or-toggle-button' }}\n />\n </div>\n);\n\nconst AndOrFloatingToolbar = ({ isOpen, placement, toolbarProps, children }) => {\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: isOpen,\n placement,\n customOffset: [0, 0],\n });\n\n return (\n <>\n {children(refs.setReference)}\n <FloatingWrapper innerRef={refs.setFloating} isOpen={isOpen} floatingStyles={floatingStyles} context={context}>\n <AndOrToolbarContent {...toolbarProps} />\n </FloatingWrapper>\n </>\n );\n};\n\n/**\n * condition-display-step: required to avoid the cache of the trigger\n * @param e\n * @param isOpen\n */\nclass AndOrController extends Component {\n static defaultProps = {\n isMain: false,\n handleRuleContainerOperator: () => null,\n handleRuleContainerUnGroup: () => null,\n handleTooltipGroup: () => null,\n labelOn: 'AND',\n labelOff: 'OR',\n condition: true,\n showDragController: true,\n allowUnGroup: true,\n buttonActionSize: DSIconSizes.M,\n buttonActionType: 'text',\n toogleActionSize: DSIconSizes.S,\n onAddFilter: () => null,\n multipleSize: false,\n step: null,\n toolBarPosition: 'left',\n };\n\n constructor(props) {\n super(props);\n this.myRef = React.createRef();\n this.state = {\n isOpen: false,\n };\n }\n\n handleMouseEnterRow = (e) => {\n this.handleTooltipRow(true);\n };\n\n handleMouseLeaveRow = () => {\n this.handleTooltipRow(false);\n };\n\n handleTooltipRow = (isOpen) => {\n this.setState({ isOpen });\n const { handleTooltipGroup } = this.props;\n handleTooltipGroup(isOpen);\n };\n\n render() {\n const {\n handleRuleContainerOperator,\n handleRuleContainerUnGroup,\n labelOn,\n labelOff,\n condition,\n showDragController,\n allowUnGroup,\n buttonActionSize,\n buttonActionType,\n toogleActionSize,\n onAddFilter,\n multipleSize,\n step,\n toolBarPosition,\n isMain,\n } = this.props;\n const { isOpen } = this.state;\n\n const toolbarProps = {\n buttonActionType,\n onAddFilter,\n buttonActionSize,\n allowUnGroup,\n handleRuleContainerUnGroup,\n condition,\n labelOff,\n labelOn,\n handleRuleContainerOperator,\n toogleActionSize,\n };\n\n return (\n <div\n ref={this.myRef}\n className={`${cssClassName} ${mainModifier(condition ? 'active' : 'default')} step-${step} ${\n isMain ? 'is-main-group-join' : ''\n }`}\n onMouseLeave={this.handleMouseLeaveRow}\n >\n <div className={`${classNameBlock('content')} step-${step}`}>\n <AndOrFloatingToolbar isOpen={isOpen} placement={toolBarPosition} toolbarProps={toolbarProps}>\n {(setRef) => (\n <div\n className={`${classNameBlock('trigger-controller')} ${\n showDragController ? classNameBlockModifier('draggable', 'trigger-controller') : ''\n } step-${step}`}\n >\n <div className={classNameElement('condition-display')}>\n <span className={classNameElement('condition-display-label')}>{condition ? labelOn : labelOff}</span>\n <span className={classNameElement('condition-display-step')}>{step}</span>\n <div className=\"separator\" />\n <span ref={setRef}>\n <MoreOptionsVert\n color={DSIconColors.NEUTRAL}\n onClick={this.handleMouseEnterRow}\n size={DSIconSizes.S}\n containerProps={{ 'data-testid': 'and-or-more-options-button' }}\n />\n </span>\n </div>\n {showDragController && (\n <DragContainerController multipleSize={multipleSize} onClick={this.handleMouseEnterRow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AK;AAAA,oBACd,MAAM,YAAY;AAAA,oBAClB,gBAAgB,EAAE,eAAe,6BAA6B;AAAA;AAAA,gBAChE,GACF;AAAA,iBACF;AAAA,cACC,sBACC,oBAAC,2BAAwB,cAA4B,SAAS,KAAK,qBAAqB;AAAA;AAAA;AAAA,QAE5F,GAEJ,GACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,115 +1,96 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
5
|
+
import { DSTooltipV3 } from "@elliemae/ds-tooltip-v3";
|
|
6
6
|
import { DSIconSizes } from "@elliemae/ds-icon";
|
|
7
7
|
import { QueryRemove, MoreOptionsVert, QueryAdd, ParenthesisAdd } from "@elliemae/ds-icons";
|
|
8
8
|
import { DSButton } from "@elliemae/ds-legacy-button-v1";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const ConditionToolbarContent = ({
|
|
10
|
+
classNameBlock,
|
|
11
|
+
classNameElement,
|
|
12
|
+
onRemoveFilter,
|
|
13
|
+
onAddFilter,
|
|
14
|
+
onAddRuleContainer,
|
|
15
|
+
buttonActionType,
|
|
16
|
+
buttonActionSize
|
|
17
|
+
}) => /* @__PURE__ */ jsxs("div", { className: classNameBlock("actions"), children: [
|
|
18
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { text: "Remove condition", children: /* @__PURE__ */ jsx(
|
|
19
|
+
DSButton,
|
|
20
|
+
{
|
|
21
|
+
buttonType: buttonActionType,
|
|
22
|
+
className: classNameElement("remove-rule"),
|
|
23
|
+
icon: /* @__PURE__ */ jsx(QueryRemove, {}),
|
|
24
|
+
onClick: onRemoveFilter,
|
|
25
|
+
size: buttonActionSize,
|
|
26
|
+
containerProps: { "data-testid": "query-remove-button" }
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { text: "Add condition", children: /* @__PURE__ */ jsx(
|
|
30
|
+
DSButton,
|
|
31
|
+
{
|
|
32
|
+
buttonType: buttonActionType,
|
|
33
|
+
className: classNameElement("add-rule"),
|
|
34
|
+
icon: /* @__PURE__ */ jsx(QueryAdd, {}),
|
|
35
|
+
onClick: onAddFilter,
|
|
36
|
+
size: buttonActionSize,
|
|
37
|
+
containerProps: { "data-testid": "query-add-button" }
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { text: "Add group", children: /* @__PURE__ */ jsx(
|
|
41
|
+
DSButton,
|
|
42
|
+
{
|
|
43
|
+
buttonType: buttonActionType,
|
|
44
|
+
className: `${classNameElement("add-rule-container")} no-border-right`,
|
|
45
|
+
icon: /* @__PURE__ */ jsx(ParenthesisAdd, {}),
|
|
46
|
+
onClick: onAddRuleContainer,
|
|
47
|
+
size: buttonActionSize,
|
|
48
|
+
containerProps: { "data-testid": "parenthesis-add-button" }
|
|
49
|
+
}
|
|
50
|
+
) })
|
|
51
|
+
] });
|
|
11
52
|
const ConditionController = ({
|
|
12
53
|
onAddFilter = () => null,
|
|
13
54
|
onAddRuleContainer = () => null,
|
|
14
55
|
onRemoveFilter = () => null,
|
|
15
|
-
handleTooltipRow = () => null,
|
|
56
|
+
handleTooltipRow = (() => null),
|
|
16
57
|
buttonTriggerSize = DSIconSizes.M,
|
|
17
58
|
buttonTriggerType = "text",
|
|
18
59
|
buttonActionSize = DSIconSizes.M,
|
|
19
60
|
buttonActionType = "text",
|
|
20
|
-
|
|
21
|
-
delayOpen = DELAY_OPEN,
|
|
22
|
-
isOpen = false,
|
|
23
|
-
toolTipZIndex
|
|
61
|
+
isOpen = false
|
|
24
62
|
}) => {
|
|
25
63
|
const { cssClassName, classNameBlock, classNameElement } = convertPropToCssClassName(
|
|
26
64
|
"query-builder-condition-controller"
|
|
27
65
|
);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
DSTooltip,
|
|
60
|
-
{
|
|
61
|
-
title: "Add condition",
|
|
62
|
-
triggerComponent: /* @__PURE__ */ jsx(
|
|
63
|
-
DSButton,
|
|
64
|
-
{
|
|
65
|
-
buttonType: buttonActionType,
|
|
66
|
-
className: classNameElement("add-rule"),
|
|
67
|
-
icon: /* @__PURE__ */ jsx(QueryAdd, {}),
|
|
68
|
-
onClick: onAddFilter,
|
|
69
|
-
size: buttonActionSize,
|
|
70
|
-
containerProps: {
|
|
71
|
-
"data-testid": "query-add-button"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
),
|
|
77
|
-
/* @__PURE__ */ jsx(
|
|
78
|
-
DSTooltip,
|
|
79
|
-
{
|
|
80
|
-
title: "Add group",
|
|
81
|
-
triggerComponent: /* @__PURE__ */ jsx(
|
|
82
|
-
DSButton,
|
|
83
|
-
{
|
|
84
|
-
buttonType: buttonActionType,
|
|
85
|
-
className: `${classNameElement("add-rule-container")} no-border-right`,
|
|
86
|
-
icon: /* @__PURE__ */ jsx(ParenthesisAdd, {}),
|
|
87
|
-
onClick: onAddRuleContainer,
|
|
88
|
-
size: buttonActionSize,
|
|
89
|
-
containerProps: {
|
|
90
|
-
"data-testid": "parenthesis-add-button"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
] }),
|
|
97
|
-
tooltipType: TooltipType.TOOLBAR,
|
|
98
|
-
triggerComponent: /* @__PURE__ */ jsx(
|
|
99
|
-
DSButton,
|
|
100
|
-
{
|
|
101
|
-
buttonType: buttonTriggerType,
|
|
102
|
-
icon: /* @__PURE__ */ jsx(MoreOptionsVert, { color: ["neutral", "500"] }),
|
|
103
|
-
onClick: handleTooltipRow,
|
|
104
|
-
size: buttonTriggerSize,
|
|
105
|
-
containerProps: {
|
|
106
|
-
"data-testid": "condition-more-options-button"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
zIndex: toolTipZIndex
|
|
111
|
-
}
|
|
112
|
-
) });
|
|
66
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
67
|
+
externallyControlledIsOpen: isOpen,
|
|
68
|
+
placement: "left"
|
|
69
|
+
});
|
|
70
|
+
return /* @__PURE__ */ jsxs("div", { className: cssClassName, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
DSButton,
|
|
73
|
+
{
|
|
74
|
+
buttonType: buttonTriggerType,
|
|
75
|
+
icon: /* @__PURE__ */ jsx(MoreOptionsVert, { color: ["neutral", "500"] }),
|
|
76
|
+
onClick: () => handleTooltipRow(!isOpen),
|
|
77
|
+
size: buttonTriggerSize,
|
|
78
|
+
containerProps: { "data-testid": "condition-more-options-button", ref: refs.setReference }
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(FloatingWrapper, { innerRef: refs.setFloating, isOpen, floatingStyles, context, children: /* @__PURE__ */ jsx(
|
|
82
|
+
ConditionToolbarContent,
|
|
83
|
+
{
|
|
84
|
+
classNameBlock,
|
|
85
|
+
classNameElement,
|
|
86
|
+
onRemoveFilter,
|
|
87
|
+
onAddFilter,
|
|
88
|
+
onAddRuleContainer,
|
|
89
|
+
buttonActionType,
|
|
90
|
+
buttonActionSize
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
] });
|
|
113
94
|
};
|
|
114
95
|
var ConditionController_default = ConditionController;
|
|
115
96
|
export {
|