UNPKG

react-querybuilder

Version:

React Query Builder component for constructing queries and filters, with utilities for executing them in various database and evaluation contexts

1 lines 234 kB
{"version":3,"file":"QueryBuilderInternal-UQNlwx1o.mjs","names":["QueryBuilderContext: Context<QueryBuilderContextType>","DragHandle: React.ForwardRefExoticComponent<\n DragHandleProps & React.RefAttributes<HTMLSpanElement>\n>","dummyFieldData: FullField","dummyPath: Path","initialState: QueriesSliceState","queriesSlice: Slice<\n QueriesSliceState,\n {\n setQueryState: (\n state: QueriesSliceState,\n {\n payload: { qbId, query },\n }: PayloadAction<SetQueryStateParams>\n ) => void;\n },\n 'queries',\n 'queries',\n { getQuerySelectorById: (state: QueriesSliceState, qbId: string) => RuleGroupTypeAny }\n>","QueryBuilderStateContext: React.Context<ReactReduxContextValue<RqbState> | null>","initialState: WarningsSliceState","warningsSlice: Slice<\n {\n [messages.errorInvalidIndependentCombinatorsProp]: boolean;\n [messages.errorUnnecessaryIndependentCombinatorsProp]: boolean;\n [messages.errorDeprecatedRuleGroupProps]: boolean;\n [messages.errorDeprecatedRuleProps]: boolean;\n [messages.errorBothQueryDefaultQuery]: boolean;\n [messages.errorUncontrolledToControlled]: boolean;\n [messages.errorControlledToUncontrolled]: boolean;\n [messages.errorEnabledDndWithoutReactDnD]: boolean;\n },\n {\n // oxlint-disable-next-line typescript/no-explicit-any\n rqbWarn: (state: any, { payload }: PayloadAction<Messages>) => void;\n },\n 'warnings'\n>","useRQB_INTERNAL_QueryBuilderDispatch: UseQueryBuilderDispatch","useRQB_INTERNAL_QueryBuilderStore: UseStore<Store<RqbState>>","storeCommon: ConfigureStoreOptions","om: Partial<FullOptionRecord<FullOption>>","nullFwdComp: ForwardRefExoticComponent<DragHandleProps & RefAttributes<HTMLElement>>","rqbContext: QueryBuilderContextProps<F, O>","contextCE: ControlElementsProp<F, O>","propsCE: ControlElementsProp<F, O>","propsT: Partial<Translations>","contextT: Partial<Translations>","useRQB_INTERNAL_QueryBuilderSelector: TypedUseSelectorHook<RqbState>","useQueryBuilderSelector: TypedUseSelectorHook<RqbState>","defaultValidationResult: ReturnType<QueryValidator>","defaultValidationMap: ValidationMap","defaultDisabledPaths: Path[]","validationResult","combinatorPropObject: Pick<RuleGroupProps, 'combinator'>","valsFinal: FullOptionList<BaseOption>","value: string | (string | null)[] | boolean | null","RuleGroup: React.MemoExoticComponent<(props: RuleGroupProps) => React.JSX.Element>","RuleGroup","RuleGroupHeaderComponents: React.MemoExoticComponent<\n (rg: UseRuleGroup) => React.JSX.Element\n>","RuleGroupHeaderComponents","RuleGroupBodyComponents: React.MemoExoticComponent<\n (rg: UseRuleGroup) => React.JSX.Element\n>","RuleGroupBodyComponents","onCombinatorChange: ValueChangeEventHandler","addRule: ActionElementEventHandler","addGroup: ActionElementEventHandler","cloneGroup: ActionElementEventHandler","toggleLockGroup: ActionElementEventHandler","removeGroup: ActionElementEventHandler","paths: { path: Path; disabled: boolean }[]","defaultSubproperties: FullOption[]","Rule: React.MemoExoticComponent<(r: RuleProps) => React.JSX.Element>","Rule","RuleComponents: React.MemoExoticComponent<\n (r: RuleComponentsProps) => React.JSX.Element\n>","RuleComponents","RuleComponentsWithSubQuery: React.MemoExoticComponent<\n (r: RuleComponentsProps) => React.JSX.Element\n>","RuleComponentsWithSubQuery","cloneRule: ActionElementEventHandler","toggleLockRule: ActionElementEventHandler","removeRule: ActionElementEventHandler","shiftRuleUp: ActionElementEventHandler","shiftRuleDown: ActionElementEventHandler","fieldData: FullField","bi: bigint","defaultTranslations: TranslationsFull","defaultControlElements: {\n actionElement: typeof ActionElement;\n addGroupAction: typeof ActionElement;\n addRuleAction: typeof ActionElement;\n cloneGroupAction: typeof ActionElement;\n cloneRuleAction: typeof ActionElement;\n combinatorSelector: typeof ValueSelector;\n dragHandle: typeof DragHandle;\n fieldSelector: typeof ValueSelector;\n inlineCombinator: typeof InlineCombinator;\n lockGroupAction: typeof ActionElement;\n lockRuleAction: typeof ActionElement;\n matchModeEditor: typeof MatchModeEditor;\n notToggle: typeof NotToggle;\n operatorSelector: typeof ValueSelector;\n removeGroupAction: typeof ActionElement;\n removeRuleAction: typeof ActionElement;\n rule: typeof Rule;\n ruleGroup: typeof RuleGroup;\n ruleGroupBodyElements: typeof RuleGroupBodyComponents;\n ruleGroupHeaderElements: typeof RuleGroupHeaderComponents;\n shiftActions: typeof ShiftActions;\n valueEditor: typeof ValueEditor;\n valueSelector: typeof ValueSelector;\n valueSourceSelector: typeof ValueSelector;\n}","QueryBuilderContext","_QBC"],"sources":["../src/context/QueryBuilderContext.ts","../src/components/ActionElement.tsx","../src/components/DragHandle.tsx","../src/components/InlineCombinator.tsx","../src/components/MatchModeEditor.tsx","../src/components/NotToggle.tsx","../src/messages.ts","../src/redux/queriesSlice.ts","../src/redux/QueryBuilderStateContext.ts","../src/redux/warningsSlice.ts","../src/redux/_internal.ts","../src/hooks/usePrevious.ts","../src/hooks/useControlledOrUncontrolled.ts","../src/hooks/useDeprecatedProps.ts","../src/hooks/useOptionListProp.ts","../src/hooks/useFields.ts","../src/utils/getCompatContextProvider.tsx","../src/utils/mergeTranslations.ts","../src/utils/toOptions.tsx","../src/hooks/usePreferProp.ts","../src/hooks/useMergedContext.ts","../src/hooks/useReactDndWarning.ts","../src/hooks/useSelectElementChangeHandler.ts","../src/hooks/useStopEventPropagation.ts","../src/redux/selectors.ts","../src/redux/hooks.ts","../src/components/QueryBuilder.useQueryBuilderSchema.ts","../src/components/QueryBuilder.useQueryBuilderSetup.ts","../src/components/QueryBuilder.useQueryBuilder.ts","../src/components/RuleGroup.tsx","../src/components/Rule.tsx","../src/components/ShiftActions.tsx","../src/components/ValueEditor.tsx","../src/components/ValueSelector.tsx","../src/defaults.ts","../src/components/QueryBuilderInternal.tsx"],"sourcesContent":["import type { RuleGroupTypeAny } from '@react-querybuilder/core';\nimport type { Context } from 'react';\nimport { createContext } from 'react';\nimport type { QueryBuilderContextProps } from '../types';\n\ninterface QueryBuilderContextInternals {\n initialQuery?: RuleGroupTypeAny;\n qbId?: string;\n}\n\ninterface QueryBuilderContextType\n // oxlint-disable-next-line typescript/no-explicit-any\n extends QueryBuilderContextProps<any, any>,\n QueryBuilderContextInternals {}\n\n/**\n * Context provider for {@link QueryBuilder}. Any descendant query builders\n * will inherit the props from a context provider.\n */\nexport const QueryBuilderContext: Context<QueryBuilderContextType> = createContext({});\n","import * as React from 'react';\nimport type { ActionProps } from '../types';\n\n/**\n * Default `<button>` component used by {@link QueryBuilder}.\n *\n * @group Components\n */\nexport const ActionElement = (props: ActionProps): React.JSX.Element => (\n <button\n type=\"button\"\n data-testid={props.testID}\n disabled={props.disabled && !props.disabledTranslation}\n className={props.className}\n title={\n props.disabledTranslation && props.disabled ? props.disabledTranslation.title : props.title\n }\n onClick={e => props.handleOnClick(e)}>\n {props.disabledTranslation && props.disabled ? props.disabledTranslation.label : props.label}\n </button>\n);\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport type { DragHandleProps } from '../types';\n\n/**\n * Default drag handle component used by {@link QueryBuilder} when `enableDragAndDrop` is `true`.\n *\n * @group Components\n */\nexport const DragHandle: React.ForwardRefExoticComponent<\n DragHandleProps & React.RefAttributes<HTMLSpanElement>\n> = forwardRef<HTMLSpanElement, DragHandleProps>((props, dragRef) => (\n <span data-testid={props.testID} ref={dragRef} className={props.className} title={props.title}>\n {props.label}\n </span>\n));\n","import { clsx, standardClassnames, TestID } from '@react-querybuilder/core';\nimport * as React from 'react';\nimport type { InlineCombinatorProps } from '../types';\n\n/**\n * Default `inlineCombinator` component used by {@link QueryBuilder}. A small `<div>`\n * wrapper around the `combinatorSelector` component, used when either\n * `showCombinatorsBetweenRules` or `independentCombinators` are `true`.\n *\n * @group Components\n */\nexport const InlineCombinator = (allProps: InlineCombinatorProps): React.JSX.Element => {\n const { component: CombinatorSelectorComponent, ...props } = allProps;\n\n const className = clsx(\n props.schema.suppressStandardClassnames || standardClassnames.betweenRules,\n props.schema.classNames.betweenRules\n );\n\n return (\n <div className={className} data-testid={TestID.inlineCombinator}>\n <CombinatorSelectorComponent {...props} testID={TestID.combinators} />\n </div>\n );\n};\n","import type { FullField, MatchMode, Path, RuleType } from '@react-querybuilder/core';\nimport { lc, parseNumber } from '@react-querybuilder/core';\nimport * as React from 'react';\nimport { useCallback } from 'react';\nimport type { MatchModeEditorProps, Schema } from '../types';\n\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\nconst requiresThreshold = (mm?: string | null) =>\n ['atleast', 'atmost', 'exactly'].includes(lc(mm) ?? /* istanbul ignore next */ '');\nconst dummyPath: Path = [];\n\n/**\n * Default `matchModeEditor` component used by {@link QueryBuilder}.\n *\n * @group Components\n */\nexport const MatchModeEditor = (props: MatchModeEditorProps): React.JSX.Element | null => {\n const {\n match,\n options,\n title,\n className,\n disabled,\n testID,\n schema,\n selectorComponent: SelectorComponent = props.schema.controls.valueSelector,\n numericEditorComponent: NumericEditorComponent = props.schema.controls.valueEditor,\n } = props;\n\n const { thresholdNum, thresholdRule, thresholdSchema, handleChangeMode, handleChangeThreshold } =\n useMatchModeEditor(props);\n\n return (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n className={className}\n title={title}\n handleOnChange={handleChangeMode}\n disabled={disabled}\n value={match.mode}\n options={options}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n {requiresThreshold(match.mode) && (\n <NumericEditorComponent\n skipHook\n testID={testID}\n inputType=\"number\"\n // TODO: Implement `matchThresholdPlaceholderText`?\n // placeholder={placeHolderText}\n title={title}\n className={className}\n disabled={disabled}\n handleOnChange={handleChangeThreshold}\n field={''}\n operator={''}\n value={thresholdNum}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={thresholdSchema}\n path={dummyPath}\n level={0}\n rule={thresholdRule}\n />\n )}\n </React.Fragment>\n );\n};\n\nexport interface UseMatchModeEditor {\n thresholdNum: number;\n thresholdRule: RuleType;\n thresholdSchema: Schema<FullField, string>;\n handleChangeMode: (mode: MatchMode) => void;\n handleChangeThreshold: (threshold: number) => void;\n}\nexport const useMatchModeEditor = (props: MatchModeEditorProps): UseMatchModeEditor => {\n const { match, handleOnChange } = props;\n\n const thresholdNum = React.useMemo(\n () => (typeof match.threshold === 'number' ? Math.max(0, match.threshold) : 1),\n [match.threshold]\n );\n const thresholdRule = React.useMemo(\n () => ({ field: '', operator: '=', value: thresholdNum }),\n [thresholdNum]\n );\n const thresholdSchema = React.useMemo(\n () => ({ ...props.schema, parseNumbers: true }),\n [props.schema]\n );\n\n const handleChangeMode = useCallback(\n (mode: MatchMode) => {\n if (requiresThreshold(mode) && typeof match.threshold !== 'number') {\n handleOnChange({ ...match, mode, threshold: 1 });\n } else {\n handleOnChange({ ...match, mode });\n }\n },\n [handleOnChange, match]\n );\n\n const handleChangeThreshold = useCallback(\n (threshold: number) => {\n handleOnChange({ ...match, threshold: parseNumber(threshold, { parseNumbers: true }) });\n },\n [handleOnChange, match]\n );\n\n return {\n thresholdNum,\n thresholdRule,\n thresholdSchema,\n handleChangeMode,\n handleChangeThreshold,\n };\n};\n","import * as React from 'react';\nimport type { NotToggleProps } from '../types';\n\n/**\n * Default `notToggle` (aka inversion) component used by {@link QueryBuilder}.\n *\n * @group Components\n */\nexport const NotToggle = (props: NotToggleProps): React.JSX.Element => {\n const id = React.useId();\n return (\n <label data-testid={props.testID} className={props.className} title={props.title} htmlFor={id}>\n <input\n id={id}\n type=\"checkbox\"\n onChange={e => props.handleOnChange(e.target.checked)}\n checked={!!props.checked}\n disabled={props.disabled}\n />\n {props.label}\n </label>\n );\n};\n","export const messages = {\n errorInvalidIndependentCombinatorsProp:\n 'QueryBuilder was rendered with a truthy independentCombinators prop. This prop is deprecated and unnecessary. Furthermore, the initial query/defaultQuery prop was of type RuleGroupType instead of type RuleGroupIC. More info: https://react-querybuilder.js.org/docs/components/querybuilder#independent-combinators',\n\n errorUnnecessaryIndependentCombinatorsProp:\n 'QueryBuilder was rendered with the deprecated and unnecessary independentCombinators prop. To use independent combinators, make sure the query/defaultQuery prop is of type RuleGroupIC when the component mounts. More info: https://react-querybuilder.js.org/docs/components/querybuilder#independent-combinators',\n\n errorDeprecatedRuleGroupProps:\n 'A custom RuleGroup component has rendered a standard RuleGroup component with deprecated props. The combinator, not, and rules props should not be used. Instead, the full group object should be passed as the ruleGroup prop.',\n\n errorDeprecatedRuleProps:\n 'A custom RuleGroup component has rendered a standard Rule component with deprecated props. The field, operator, value, and valueSource props should not be used. Instead, the full rule object should be passed as the rule prop.',\n\n errorBothQueryDefaultQuery:\n 'QueryBuilder was rendered with both query and defaultQuery props. QueryBuilder must be either controlled or uncontrolled (specify either the query prop, or the defaultQuery prop, but not both). Decide between using a controlled or uncontrolled query builder and remove one of these props. More info: https://reactjs.org/link/controlled-components',\n\n errorUncontrolledToControlled:\n 'QueryBuilder is changing from an uncontrolled component to be controlled. This is likely caused by the query changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components',\n\n errorControlledToUncontrolled:\n 'QueryBuilder is changing from a controlled component to be uncontrolled. This is likely caused by the query changing from defined to undefined, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components',\n\n errorEnabledDndWithoutReactDnD:\n 'QueryBuilder was rendered with the enableDragAndDrop prop set to true, but either react-dnd was not detected or one of react-dnd-html5-backend or react-dnd-touch-backend was not detected. To enable drag-and-drop functionality, install react-dnd and one of the backend packages and wrap QueryBuilder in QueryBuilderDnD from @react-querybuilder/dnd.',\n} as const;\n","import type { RuleGroupTypeAny } from '@react-querybuilder/core';\nimport type { PayloadAction, Slice } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport type QueriesSliceState = Record<string, RuleGroupTypeAny>;\n\nexport interface SetQueryStateParams {\n qbId: string;\n query: RuleGroupTypeAny;\n}\n\nexport const initialState: QueriesSliceState = {};\n\nexport const queriesSlice: Slice<\n QueriesSliceState,\n {\n setQueryState: (\n state: QueriesSliceState,\n {\n payload: { qbId, query },\n }: PayloadAction<SetQueryStateParams>\n ) => void;\n },\n 'queries',\n 'queries',\n { getQuerySelectorById: (state: QueriesSliceState, qbId: string) => RuleGroupTypeAny }\n> = createSlice({\n name: 'queries',\n initialState,\n reducers: {\n setQueryState: (state, { payload: { qbId, query } }: PayloadAction<SetQueryStateParams>) => {\n state[qbId] = query;\n },\n },\n selectors: {\n getQuerySelectorById: (state: QueriesSliceState, qbId: string) => state[qbId],\n },\n});\n","import * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport type { RqbState } from './types';\n\nexport const QueryBuilderStateContext: React.Context<ReactReduxContextValue<RqbState> | null> =\n React.createContext<ReactReduxContextValue<RqbState> | null>(null);\n","import type { PayloadAction, Slice } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\nimport { messages } from '../messages';\n\ntype ValuesAsKeys<T> =\n T extends Record<infer _K, infer V>\n ? [V] extends [string]\n ? { [Key in V]: boolean }\n : never\n : never;\ntype ValuesType<T> =\n T extends Record<infer _K, infer V> ? ([V] extends [string] ? V : never) : never;\nexport type WarningsSliceState = ValuesAsKeys<typeof messages>;\nexport type Messages = ValuesType<typeof messages>;\nexport const initialState: WarningsSliceState = {\n [messages.errorInvalidIndependentCombinatorsProp]: false,\n [messages.errorUnnecessaryIndependentCombinatorsProp]: false,\n [messages.errorDeprecatedRuleGroupProps]: false,\n [messages.errorDeprecatedRuleProps]: false,\n [messages.errorBothQueryDefaultQuery]: false,\n [messages.errorUncontrolledToControlled]: false,\n [messages.errorControlledToUncontrolled]: false,\n [messages.errorEnabledDndWithoutReactDnD]: false,\n};\n\nexport const warningsSlice: Slice<\n {\n [messages.errorInvalidIndependentCombinatorsProp]: boolean;\n [messages.errorUnnecessaryIndependentCombinatorsProp]: boolean;\n [messages.errorDeprecatedRuleGroupProps]: boolean;\n [messages.errorDeprecatedRuleProps]: boolean;\n [messages.errorBothQueryDefaultQuery]: boolean;\n [messages.errorUncontrolledToControlled]: boolean;\n [messages.errorControlledToUncontrolled]: boolean;\n [messages.errorEnabledDndWithoutReactDnD]: boolean;\n },\n {\n // oxlint-disable-next-line typescript/no-explicit-any\n rqbWarn: (state: any, { payload }: PayloadAction<Messages>) => void;\n },\n 'warnings'\n> = createSlice({\n name: 'warnings',\n initialState,\n reducers: {\n rqbWarn: (state, { payload }: PayloadAction<Messages>) => {\n if (!state[payload]) {\n console.error(payload);\n state[payload] = true;\n }\n },\n },\n});\n","import type { RuleGroupType, RuleGroupTypeIC } from '@react-querybuilder/core';\nimport type {\n ConfigureStoreOptions,\n Dispatch,\n PayloadAction,\n Store,\n ThunkAction,\n ThunkDispatch,\n UnknownAction,\n} from '@reduxjs/toolkit';\nimport type { UseStore } from 'react-redux';\nimport { createDispatchHook, createStoreHook } from 'react-redux';\nimport type { RqbState } from '.';\nimport type { SetQueryStateParams } from './queriesSlice';\nimport { queriesSlice } from './queriesSlice';\nimport { QueryBuilderStateContext } from './QueryBuilderStateContext';\nimport type { Messages } from './warningsSlice';\nimport { warningsSlice } from './warningsSlice';\n\nexport const _RQB_INTERNAL_dispatchThunk =\n ({\n payload,\n onQueryChange,\n }: {\n payload: SetQueryStateParams;\n onQueryChange?: ((query: RuleGroupType) => void) | ((query: RuleGroupTypeIC) => void);\n }): ThunkAction<void, RqbState, unknown, PayloadAction<SetQueryStateParams>> =>\n dispatch => {\n dispatch(queriesSlice.actions.setQueryState(payload));\n if (typeof onQueryChange === 'function') {\n onQueryChange(payload.query as never /* ??? */);\n }\n };\n\n/**\n * Gets the `dispatch` function for the RQB Redux store.\n */\nexport const useRQB_INTERNAL_QueryBuilderDispatch: UseQueryBuilderDispatch =\n createDispatchHook(QueryBuilderStateContext);\ntype UseQueryBuilderDispatch = () => ThunkDispatch<RqbState, undefined, UnknownAction> & Dispatch;\n\n/**\n * Gets the full RQB Redux store.\n */\nexport const useRQB_INTERNAL_QueryBuilderStore: UseStore<Store<RqbState>> =\n createStoreHook(QueryBuilderStateContext);\n\nconst { rqbWarn: _SYNC_rqbWarn } = warningsSlice.actions;\n\nexport const rqbWarn =\n (msg: Messages): ThunkAction<void, RqbState, unknown, PayloadAction<Messages>> =>\n dispatch => {\n setTimeout(() => dispatch(_SYNC_rqbWarn(msg)));\n };\n\nconst preloadedState = {\n queries: queriesSlice.getInitialState(),\n warnings: warningsSlice.getInitialState(),\n} satisfies RqbState;\n\nexport const storeCommon: ConfigureStoreOptions = {\n reducer: {\n queries: queriesSlice.reducer,\n warnings: warningsSlice.reducer,\n },\n preloadedState,\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n // Ignore non-serializable values in setQueryState actions and rule `value`s\n // https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data\n serializableCheck: {\n ignoredActions: [queriesSlice.actions.setQueryState.type],\n ignoredPaths: [/^queries\\b.*\\.rules\\.\\d+\\.value$/],\n },\n }),\n};\n","import { useRef } from 'react';\n\n/**\n * Returns the prop value from the last render.\n *\n * Adapted from https://usehooks.com/usePrevious/.\n *\n * @group Hooks\n */\nexport const usePrevious = <T>(value: T): T | null => {\n const ref = useRef<{ value: T | null; prev: T | null }>({ value, prev: null });\n\n const current = ref.current.value;\n\n if (value !== current) {\n ref.current = { value, prev: current };\n }\n\n return ref.current.prev;\n};\n","import type { RuleGroupTypeAny } from '@react-querybuilder/core';\nimport { messages } from '../messages';\nimport { rqbWarn, useRQB_INTERNAL_QueryBuilderDispatch } from '../redux/_internal';\nimport { usePrevious } from './usePrevious';\n\nexport interface UseControlledOrUncontrolledParams {\n defaultQuery?: RuleGroupTypeAny;\n queryProp?: RuleGroupTypeAny;\n}\n\n/**\n * Logs a warning when the component changes from controlled to uncontrolled,\n * vice versa, or both `query` and `defaultQuery` are provided.\n *\n * @group Hooks\n */\nexport const useControlledOrUncontrolled = (params: UseControlledOrUncontrolledParams): void => {\n const dispatch = useRQB_INTERNAL_QueryBuilderDispatch();\n const { defaultQuery, queryProp } = params;\n const prevQueryPresent = usePrevious(!!queryProp);\n\n // istanbul ignore else\n if (process.env.NODE_ENV !== 'production') {\n if (!!queryProp && !!defaultQuery) {\n dispatch(rqbWarn(messages.errorBothQueryDefaultQuery));\n } else if (prevQueryPresent === true && !queryProp && !!defaultQuery) {\n dispatch(rqbWarn(messages.errorControlledToUncontrolled));\n } else if (prevQueryPresent === false && !!queryProp && !defaultQuery) {\n dispatch(rqbWarn(messages.errorUncontrolledToControlled));\n }\n }\n};\n","import { messages } from '../messages';\nimport { rqbWarn, useRQB_INTERNAL_QueryBuilderDispatch } from '../redux/_internal';\n\n/**\n * Logs an error to the console if any of the following are true:\n * - `QueryBuilder` is rendered with an `independentCombinators` prop\n * - `RuleGroup` is rendered with `combinator` or `rules` props (deprecated in favor of `ruleGroup`)\n * - `Rule` is rendered with `field`, `operator`, or `value` props (deprecated in favor of `rule`)\n *\n * @group Hooks\n */\nfunction useDeprecatedProps(\n type: 'independentCombinators',\n logWarning: boolean,\n otherParams: 'invalid' | 'unnecessary'\n): void;\nfunction useDeprecatedProps(type: 'rule' | 'ruleGroup', logWarning: boolean): void;\nfunction useDeprecatedProps(\n /** Type of error to be logged, if logWarning is true. */\n type: 'independentCombinators' | 'rule' | 'ruleGroup',\n /** If true, the error (well...warning, really) will be logged. */\n logWarning: boolean,\n otherParams?: 'invalid' | 'unnecessary'\n) {\n const dispatch = useRQB_INTERNAL_QueryBuilderDispatch();\n if (process.env.NODE_ENV !== 'production' && logWarning) {\n if (type === 'independentCombinators') {\n if (otherParams === 'invalid') {\n dispatch(rqbWarn(messages.errorInvalidIndependentCombinatorsProp));\n }\n\n if (otherParams === 'unnecessary') {\n dispatch(rqbWarn(messages.errorUnnecessaryIndependentCombinatorsProp));\n }\n }\n\n if (type === 'rule') {\n dispatch(rqbWarn(messages.errorDeprecatedRuleProps));\n }\n\n if (type === 'ruleGroup') {\n dispatch(rqbWarn(messages.errorDeprecatedRuleGroupProps));\n }\n }\n}\n\nexport { useDeprecatedProps };\n","import type {\n BaseOptionMap,\n FlexibleOptionList,\n FlexibleOptionListProp,\n FullOption,\n FullOptionList,\n FullOptionMap,\n FullOptionRecord,\n GetOptionIdentifierType,\n OptionGroup,\n} from '@react-querybuilder/core';\nimport {\n defaultPlaceholderLabel,\n defaultPlaceholderName,\n isFlexibleOptionGroupArray,\n objectKeys,\n toFullOption,\n toFullOptionList,\n toFullOptionMap,\n uniqByIdentifier,\n uniqOptGroups,\n} from '@react-querybuilder/core';\nimport { useMemo } from 'react';\nimport type { Placeholder } from '../types';\n\nexport interface UseOptionListProp<O extends FullOption> {\n defaultOption: FullOption;\n optionList: O[] | OptionGroup<O>[];\n optionsMap: Partial<FullOptionRecord<FullOption>>;\n}\n\nexport interface UseOptionListPropParams<O extends FullOption> {\n placeholder?: Placeholder;\n optionList?: FlexibleOptionListProp<O> | BaseOptionMap<O>;\n baseOption?: Record<string, unknown>;\n labelMap?: Record<string, string>;\n autoSelectOption?: boolean;\n}\n\nexport const useOptionListProp = <O extends FullOption>(\n props: UseOptionListPropParams<O>\n): UseOptionListProp<O> => {\n type OptionIdentifier = GetOptionIdentifierType<O>;\n\n // istanbul ignore next\n const {\n optionList: optionListPropOriginal,\n baseOption = {},\n labelMap = {},\n placeholder: {\n placeholderName = defaultPlaceholderName,\n placeholderLabel = defaultPlaceholderLabel,\n placeholderGroupLabel = defaultPlaceholderLabel,\n } = {},\n autoSelectOption = true,\n } = props;\n\n const defaultOption = useMemo(\n () =>\n ({\n id: placeholderName,\n name: placeholderName,\n value: placeholderName,\n label: placeholderLabel,\n }) as FullOption,\n [placeholderLabel, placeholderName]\n );\n const optionsProp = useMemo(\n () => optionListPropOriginal ?? ([defaultOption] as FlexibleOptionList<O>),\n [defaultOption, optionListPropOriginal]\n );\n\n const optionList = useMemo((): O[] | OptionGroup<O>[] => {\n const opts = (\n Array.isArray(optionsProp)\n ? toFullOptionList(optionsProp, baseOption, labelMap)\n : (objectKeys(toFullOptionMap(optionsProp, baseOption)) as unknown as OptionIdentifier[])\n .map<\n FullOption<OptionIdentifier>\n >(opt => ({ ...optionsProp[opt]!, name: opt, value: opt }))\n .sort((a, b) => a.label.localeCompare(b.label))\n ) as FullOptionList<O>;\n if (isFlexibleOptionGroupArray(opts)) {\n return autoSelectOption\n ? (uniqOptGroups(opts) as FullOptionList<O>)\n : (uniqOptGroups([\n {\n label: placeholderGroupLabel,\n options: [defaultOption],\n },\n ...opts,\n ]) as FullOptionList<O>);\n } else {\n return autoSelectOption\n ? (uniqByIdentifier(opts as O[]) as FullOptionList<O>)\n : (uniqByIdentifier([defaultOption, ...(opts as O[])]) as FullOptionList<O>);\n }\n }, [autoSelectOption, baseOption, defaultOption, labelMap, optionsProp, placeholderGroupLabel]);\n\n const optionsMap = useMemo(() => {\n if (!Array.isArray(optionsProp)) {\n const op = toFullOptionMap(optionsProp, baseOption) as FullOptionMap<\n FullOption,\n OptionIdentifier\n >;\n return autoSelectOption ? op : { ...op, [placeholderName]: defaultOption };\n }\n const om: Partial<FullOptionRecord<FullOption>> = {};\n if (isFlexibleOptionGroupArray(optionList)) {\n for (const og of optionList) {\n for (const opt of og.options) {\n om[(opt.value ?? /* istanbul ignore next */ opt.name) as OptionIdentifier] = toFullOption(\n opt,\n baseOption\n ) as FullOption;\n }\n }\n } else {\n for (const opt of optionList) {\n om[(opt.value ?? /* istanbul ignore next */ opt.name) as OptionIdentifier] = toFullOption(\n opt,\n baseOption\n ) as FullOption;\n }\n }\n return om;\n }, [autoSelectOption, baseOption, defaultOption, optionList, optionsProp, placeholderName]);\n\n return { defaultOption, optionList, optionsMap };\n};\n","import type {\n FullCombinator,\n FullField,\n FullOperator,\n FullOptionRecord,\n OptionGroup,\n RuleGroupTypeAny,\n} from '@react-querybuilder/core';\nimport type { QueryBuilderProps, TranslationsFull } from '../types';\nimport { useOptionListProp } from './useOptionListProp';\n\nexport interface UseFields<F extends FullField> {\n defaultField: FullField;\n fields: F[] | OptionGroup<F>[];\n fieldMap: Partial<FullOptionRecord<FullField>>;\n}\n\nexport const useFields = <F extends FullField>(\n props: { translations: TranslationsFull } & Pick<\n QueryBuilderProps<RuleGroupTypeAny, F, FullOperator, FullCombinator>,\n 'fields' | 'baseField' | 'autoSelectField'\n >\n): UseFields<F> => {\n const { optionList, optionsMap, defaultOption } = useOptionListProp({\n placeholder: props.translations.fields,\n optionList: props.fields,\n autoSelectOption: props.autoSelectField,\n baseOption: props.baseField,\n });\n return {\n fields: optionList,\n fieldMap: optionsMap,\n defaultField: defaultOption,\n };\n};\n","import type { FullField } from '@react-querybuilder/core';\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { QueryBuilderContext } from '../context';\nimport { useMergedContext } from '../hooks/useMergedContext';\nimport type {\n QueryBuilderContextProps,\n QueryBuilderContextProvider,\n QueryBuilderContextProviderProps,\n} from '../types';\n\nexport type GetCompatContextProviderProps = QueryBuilderContextProps<FullField, string>;\n\n/**\n * Generates a context provider for a compatibility package.\n */\nexport const getCompatContextProvider = <F extends FullField, O extends string>(\n gccpProps: QueryBuilderContextProps<F, O>\n): QueryBuilderContextProvider => {\n const QBContextWrapper = (props: { children: ReactNode }) => {\n const rqbContext = useMergedContext(gccpProps);\n return (\n <QueryBuilderContext.Provider value={rqbContext}>\n {props.children}\n </QueryBuilderContext.Provider>\n );\n };\n\n const QBContextInner = (props: QueryBuilderContextProviderProps) => {\n const rqbContext = useMergedContext(props);\n\n return (\n <QueryBuilderContext.Provider value={rqbContext}>\n {props.children}\n </QueryBuilderContext.Provider>\n );\n };\n\n return props => {\n return (\n <QBContextWrapper>\n <QBContextInner {...props}>{props.children}</QBContextInner>\n </QBContextWrapper>\n );\n };\n};\n","import { objectEntries, objectKeys } from '@react-querybuilder/core';\nimport { produce } from 'immer';\nimport type { ReactNode } from 'react';\nimport { defaultTranslations } from '../defaults';\nimport type { Translations } from '../types';\n\n/**\n * Merges any number of partial {@link Translations} into a single definition.\n */\nexport const mergeTranslations = (\n base: Partial<Translations>,\n ...otherTranslations: (Partial<Translations> | undefined)[]\n): Partial<Translations> =>\n produce(base, draft => {\n for (const translations of otherTranslations) {\n // istanbul ignore else\n if (translations) {\n for (const t of objectKeys(translations)) {\n if (draft[t]) {\n Object.assign(draft[t], translations[t]);\n } else {\n Object.assign(draft, { [t]: translations[t] });\n }\n }\n }\n }\n });\n\nexport const mergeTranslation = (\n el: keyof Translations,\n keyPropContextMap: Record<string, [ReactNode, ReactNode]>,\n finalize?: boolean\n): Record<string, Record<string, string>> | undefined => {\n type RSRSS = Record<string, Record<string, string>>;\n const finalKeys = objectEntries(keyPropContextMap)\n .map(([key, [pT, cT]]) => [\n key,\n pT ?? cT ?? ((finalize ? defaultTranslations : {}) as RSRSS)[el]?.[key],\n ])\n .filter(k => !!k[1]);\n return finalKeys.length > 0 ? { [el]: Object.fromEntries(finalKeys) } : undefined;\n};\n","import type { OptionList } from '@react-querybuilder/core';\nimport { isOptionGroupArray } from '@react-querybuilder/core';\nimport * as React from 'react';\n\n/**\n * Generates an array of `<option>` or `<optgroup>` elements\n * from a given {@link OptionList}.\n *\n * @group Option Lists\n */\nexport const toOptions = (arr?: OptionList): React.JSX.Element[] | null =>\n isOptionGroupArray(arr)\n ? arr.map(og => (\n <optgroup key={og.label} label={og.label}>\n {og.options.map(opt => (\n <option key={opt.name} value={opt.name} disabled={opt.disabled}>\n {opt.label}\n </option>\n ))}\n </optgroup>\n ))\n : Array.isArray(arr)\n ? arr.map(opt => (\n <option key={opt.name} value={opt.name} disabled={opt.disabled}>\n {opt.label}\n </option>\n ))\n : null;\n","const preferPropDefaultTrue = (prop?: boolean, context?: boolean) =>\n prop === false ? false : prop ? true : !(context === false);\n\nconst preferPropDefaultFalse = (prop?: boolean, context?: boolean) =>\n prop ? true : prop === false ? false : !!context;\n\nexport const preferProp = (def: boolean, prop?: boolean, context?: boolean): boolean =>\n def ? preferPropDefaultTrue(prop, context) : preferPropDefaultFalse(prop, context);\n\n/**\n * For given default, prop, and context values, return the first provided of prop,\n * context, and default, in that order.\n *\n * @group Hooks\n */\nexport const usePreferProp = (def: boolean, prop?: boolean, context?: boolean): boolean =>\n preferProp(def, prop, context);\n\n/**\n * For given default, prop, and context values, return the first provided of prop,\n * context, and default, in that order.\n *\n * @group Hooks\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const usePreferAnyProp = (def?: any, prop?: any, context?: any): any =>\n prop !== undefined && prop != null\n ? prop\n : context !== undefined && context != null\n ? context\n : def;\n","import type { Classnames, FullField, RuleGroupTypeAny } from '@react-querybuilder/core';\nimport { defaultControlClassnames, mergeClassnames } from '@react-querybuilder/core';\nimport type { ComponentType, ForwardRefExoticComponent, RefAttributes } from 'react';\nimport { forwardRef, useCallback, useContext, useMemo } from 'react';\nimport { QueryBuilderContext } from '../context';\nimport { defaultControlElements, defaultTranslations } from '../defaults';\nimport type {\n ControlElementsProp,\n Controls,\n DragHandleProps,\n QueryBuilderContextProps,\n Translations,\n TranslationsFull,\n ValueEditorProps,\n} from '../types';\nimport { mergeTranslation } from '../utils';\nimport { usePreferProp } from './usePreferProp';\n\nexport type UseMergedContextParams<\n F extends FullField = FullField,\n O extends string = string,\n Finalize extends boolean | undefined = undefined,\n> = QueryBuilderContextProps<F, O> & {\n initialQuery?: RuleGroupTypeAny;\n qbId?: string;\n /**\n * When true, props and context are merged with defaults to ensure all properties\n * are defined. Action elements and value selectors are merged with their respective\n * bulk override components. Only needs to be true when run from `QueryBuilder`.\n */\n finalize?: Finalize;\n};\n\nexport type UseMergedContextReturn<\n F extends FullField = FullField,\n O extends string = string,\n Finalize extends boolean | undefined = undefined,\n> = QueryBuilderContextProps<F, O> & {\n initialQuery?: RuleGroupTypeAny;\n qbId?: string;\n} & {\n controlElements: Finalize extends true ? Controls<F, O> : Partial<Controls<F, O>>;\n controlClassnames: Classnames;\n translations: Finalize extends true ? TranslationsFull : Partial<Translations>;\n} & Required<\n Pick<\n QueryBuilderContextProps<F, O>,\n 'debugMode' | 'enableDragAndDrop' | 'enableMountQueryChange'\n >\n >;\n\nconst nullComp = () => null;\nconst nullFwdComp: ForwardRefExoticComponent<DragHandleProps & RefAttributes<HTMLElement>> =\n forwardRef(nullComp);\nconst emptyObject = {} as const;\n\n/**\n * Merges inherited context values with props, giving precedence to props.\n *\n * @group Hooks\n */\nexport const useMergedContext = <\n F extends FullField = FullField,\n O extends string = string,\n Finalize extends boolean | undefined = undefined,\n>({\n finalize,\n ...props\n}: UseMergedContextParams<F, O, Finalize>): UseMergedContextReturn<F, O, Finalize> => {\n const rqbContext: QueryBuilderContextProps<F, O> = useContext(QueryBuilderContext);\n\n const debugModePreferred = usePreferProp(false, props.debugMode, rqbContext.debugMode);\n const debugMode = finalize\n ? debugModePreferred\n : (props.debugMode ?? (rqbContext.debugMode as boolean));\n const enableMountQueryChangePreferred = usePreferProp(\n true,\n props.enableMountQueryChange,\n rqbContext.enableMountQueryChange\n );\n const enableMountQueryChange = finalize\n ? enableMountQueryChangePreferred\n : (props.enableMountQueryChange ?? (rqbContext.enableMountQueryChange as boolean));\n\n // Drag-and-drop should be disabled if context sets it to false because\n // QueryBuilderDnD might not have loaded react-dnd yet. Therefore we prefer\n // the prop here only if context is true or undefined.\n const enableDragAndDropPreferred =\n usePreferProp(false, props.enableDragAndDrop, rqbContext.enableDragAndDrop) &&\n rqbContext.enableDragAndDrop !== false;\n const enableDragAndDrop = finalize\n ? enableDragAndDropPreferred\n : (props.enableDragAndDrop ?? (rqbContext.enableDragAndDrop as boolean));\n\n const cc = useMemo(\n () =>\n mergeClassnames(\n finalize ? Object.assign({}, defaultControlClassnames) : emptyObject,\n rqbContext.controlClassnames,\n props.controlClassnames\n ),\n [rqbContext.controlClassnames, props.controlClassnames, finalize]\n );\n\n const controlClassnames = useMemo(\n () => ({\n actionElement: cc.actionElement,\n addGroup: cc.addGroup,\n addRule: cc.addRule,\n body: cc.body,\n cloneGroup: cc.cloneGroup,\n cloneRule: cc.cloneRule,\n combinators: cc.combinators,\n dragHandle: cc.dragHandle,\n fields: cc.fields,\n header: cc.header,\n lockGroup: cc.lockGroup,\n lockRule: cc.lockRule,\n notToggle: cc.notToggle,\n operators: cc.operators,\n queryBuilder: cc.queryBuilder,\n removeGroup: cc.removeGroup,\n removeRule: cc.removeRule,\n rule: cc.rule,\n ruleGroup: cc.ruleGroup,\n shiftActions: cc.shiftActions,\n value: cc.value,\n valueSelector: cc.valueSelector,\n valueSource: cc.valueSource,\n betweenRules: cc.betweenRules,\n valid: cc.valid,\n invalid: cc.invalid,\n dndDragging: cc.dndDragging,\n dndOver: cc.dndOver,\n dndCopy: cc.dndCopy,\n dndGroup: cc.dndGroup,\n dndDropNotAllowed: cc.dndDropNotAllowed,\n disabled: cc.disabled,\n valueListItem: cc.valueListItem,\n matchMode: cc.matchMode,\n matchThreshold: cc.matchThreshold,\n branches: cc.branches,\n hasSubQuery: cc.hasSubQuery,\n }),\n [\n cc.actionElement,\n cc.addGroup,\n cc.addRule,\n cc.betweenRules,\n cc.body,\n cc.branches,\n cc.cloneGroup,\n cc.cloneRule,\n cc.combinators,\n cc.disabled,\n cc.dndCopy,\n cc.dndDropNotAllowed,\n cc.dndGroup,\n cc.dndDragging,\n cc.dndOver,\n cc.dragHandle,\n cc.fields,\n cc.hasSubQuery,\n cc.header,\n cc.invalid,\n cc.lockGroup,\n cc.lockRule,\n cc.matchMode,\n cc.matchThreshold,\n cc.notToggle,\n cc.operators,\n cc.queryBuilder,\n cc.removeGroup,\n cc.removeRule,\n cc.rule,\n cc.ruleGroup,\n cc.shiftActions,\n cc.valid,\n cc.value,\n cc.valueListItem,\n cc.valueSelector,\n cc.valueSource,\n ]\n );\n\n const contextCE: ControlElementsProp<F, O> = rqbContext.controlElements ?? emptyObject;\n const propsCE: ControlElementsProp<F, O> = props.controlElements ?? emptyObject;\n const mergeControlElement = useCallback(\n (\n name: keyof Controls<F, O>,\n // oxlint-disable-next-line typescript/no-explicit-any\n propComp: ComponentType<any> | null | undefined,\n // oxlint-disable-next-line typescript/no-explicit-any\n contextComp: ComponentType<any> | null | undefined\n ) => {\n const nc = name === 'dragHandle' ? nullFwdComp : nullComp;\n const propBulkOverride =\n (name.endsWith('Action') && propsCE.actionElement ? propsCE.actionElement : undefined) ??\n (name.endsWith('Selector') && propsCE.valueSelector ? propsCE.valueSelector : undefined);\n const contextBulkOverride =\n (name.endsWith('Action') && contextCE.actionElement\n ? contextCE.actionElement\n : undefined) ??\n (name.endsWith('Selector') && contextCE.valueSelector\n ? contextCE.valueSelector\n : undefined);\n const comp =\n propComp === null\n ? nc\n : (propComp ??\n (finalize ? propBulkOverride : undefined) ??\n (contextComp === null\n ? nc\n : (contextComp ?? (finalize ? contextBulkOverride : undefined))));\n return comp\n ? { [name]: comp }\n : finalize\n ? { [name]: defaultControlElements[name] }\n : emptyObject;\n },\n [\n contextCE.actionElement,\n contextCE.valueSelector,\n finalize,\n propsCE.actionElement,\n propsCE.valueSelector,\n ]\n );\n const controlElements = useMemo(\n () =>\n // For some reason TypeScript doesn't like the object spread syntax here.\n // Something about a union type being too complex to represent.\n Object.assign(\n {},\n mergeControlElement('addGroupAction', propsCE.addGroupAction, contextCE.addGroupAction),\n mergeControlElement('addRuleAction', propsCE.addRuleAction, contextCE.addRuleAction),\n mergeControlElement(\n 'cloneGroupAction',\n propsCE.cloneGroupAction,\n contextCE.cloneGroupAction\n ),\n mergeControlElement('cloneRuleAction', propsCE.cloneRuleAction, contextCE.cloneRuleAction),\n mergeControlElement(\n 'combinatorSelector',\n propsCE.combinatorSelector,\n contextCE.combinatorSelector\n ),\n mergeControlElement('dragHandle', propsCE.dragHandle, contextCE.dragHandle),\n mergeControlElement('fieldSelector', propsCE.fieldSelector, contextCE.fieldSelector),\n mergeControlElement(\n 'inlineCombinator',\n propsCE.inlineCombinator,\n contextCE.inlineCombinator\n ),\n mergeControlElement('lockGroupAction', propsCE.lockGroupAction, contextCE.lockGroupAction),\n mergeControlElement('lockRuleAction', propsCE.lockRuleAction, contextCE.lockRuleAction),\n mergeControlElement('notToggle', propsCE.notToggle, contextCE.notToggle),\n mergeControlElement(\n 'operatorSelector',\n propsCE.operatorSelector,\n contextCE.operatorSelector\n ),\n mergeControlElement(\n 'removeGroupAction',\n propsCE.removeGroupAction,\n contextCE.removeGroupAction\n ),\n mergeControlElement(\n 'removeRuleAction',\n propsCE.removeRuleAction,\n contextCE.removeRuleAction\n ),\n mergeControlElement('shiftActions', propsCE.shiftActions, contextCE.shiftActions),\n {\n valueEditor:\n propsCE.valueEditor === null\n ? nullComp\n : (propsCE.valueEditor ??\n (contextCE.valueEditor === null ? nullComp : contextCE.valueEditor) ??\n (defaultControlElements.valueEditor as unknown as ComponentType<\n ValueEditorProps<F, O>\n >)),\n },\n mergeControlElement(\n 'valueSourceSelector',\n propsCE.valueSourceSelector,\n contextCE.valueSourceSelector\n ),\n mergeControlElement('matchModeEditor', propsCE.matchModeEditor, contextCE.matchModeEditor),\n mergeControlElement('rule', propsCE.rule, contextCE.rule),\n mergeControlElement('ruleGroup', propsCE.ruleGroup, contextCE.ruleGroup),\n mergeControlElement(\n 'ruleGroupBodyElements',\n propsCE.ruleGroupBodyElements,\n contextCE.ruleGroupBodyElements\n ),\n mergeControlElement(\n 'ruleGroupHeaderElements',\n propsCE.ruleGroupHeaderElements,\n contextCE.ruleGroupHeaderElements\n ),\n {\n actionElement:\n propsCE.actionElement ??\n contextCE.actionElement ??\n (finalize ? defaultControlElements.actionElement : undefined),\n },\n {\n valueSelector:\n propsCE.valueSelector ??\n contextCE.valueSelector ??\n (finalize ? defaultControlElements.valueSelector : undefined),\n }\n ) as Finalize extends true ? ControlElementsProp<F, O> : Partial<ControlElementsProp<F, O>>,\n [\n contextCE.actionElement,\n contextCE.addGroupAction,\n contextCE.addRuleAction,\n contextCE.cloneGroupAction,\n contextCE.cloneRuleAction,\n contextCE.combinatorSelector,\n contextCE.dragHandle,\n contextCE.fieldSelector,\n contextCE.inlineCombinator,\n contextCE.lockGroupAction,\n contextCE.lockRuleAction,\n contextCE.matchModeEditor,\n contextCE.notToggle,\n contextCE.operatorSelector,\n contextCE.removeGroupAction,\n contextCE.removeRuleAction,\n contextCE.rule,\n contextCE.ruleGroup,\n contextCE.ruleGroupBodyElements,\n contextCE.ruleGroupHeaderElements,\n contextCE.shiftActions,\n contextCE.valueEditor,\n contextCE.valueSelector,\n contextCE.valueSourceSelector,\n mergeControlElement,\n finalize,\n propsCE.actionElement,\n propsCE.addGroupAction,\n propsCE.addRuleAction,\n propsCE.cloneGroupAction,\n propsCE.cloneRuleAction,\n propsCE.combinatorSelector,\n propsCE.dragHandle,\n propsCE.fieldSelector,\n propsCE.inlineCombinator,\n propsCE.lockGroupAction,\n propsCE.lockRuleAction,\n propsCE.matchModeEditor,\n propsCE.notToggle,\n propsCE.operatorSelector,\n propsCE.removeGroupAction,\n propsCE.removeRuleAction,\n propsCE.rule,\n propsCE.ruleGroup,\n propsCE.ruleGroupBodyElements,\n propsCE.ruleGroupHeaderElements,\n propsCE.shiftActions,\n propsCE.valueEditor,\n propsCE.valueSelector,\n propsCE.valueSourceSelector,\n ]\n ) as Finalize extends true ? Controls<F, O> : Partial<Controls<F, O>>;\n\n const propsT: Partial<Translations> = props.translations ?? emptyObject;\n const contextT: Partial<Translations> = rqbContext.translations ?? emptyObject;\n const translations = useMemo(\n () =>\n Object.assign(\n finalize ? Object.assign({}, defaultTranslations) : {},\n mergeTranslation(\n 'addGroup',\n {\n label: [propsT.addGroup?.label, contextT.addGroup?.label],\n title: [propsT.addGroup?.title, contextT.addGroup?.title],\n },\n finalize\n ),\n mergeTranslation(\n 'addRule',\n {\n label: [propsT.addRule?.label, contextT.addRule?.label],\n title: [propsT.addRule?.title, contextT.addRule?.title],\n },\n finalize\n ),\n mergeTranslation(\n 'cloneRule',\n {\n label: [propsT.cloneRule?.label, contextT.cloneRule?.label],\n title: [propsT.cloneRule?.title, contextT.cloneRule?.title],\n },\n finalize\n ),\n mergeTranslation(\n 'cloneRuleGroup',\n {\n label: [propsT.cloneRuleGroup?.label