Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-querybuilder/native

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-querybuilder/native - npm Package Compare versions

Comparing version 7.0.0-alpha.1 to 7.0.0-alpha.2

22

dist/cjs/react-querybuilder_native.cjs.development.d.ts

@@ -5,3 +5,3 @@ import * as react from 'react';

import * as react_querybuilder from 'react-querybuilder';
import { Schema, RuleGroupProps, RuleProps, NotToggleProps, InlineCombinatorProps, ActionProps, ShiftActionsProps, ValueSelectorProps, ValueEditorProps, RuleGroupType, RuleGroupTypeIC, QueryBuilderProps } from 'react-querybuilder';
import { ToFullOption, Field, Schema, RuleGroupProps, RuleProps, NotToggleProps, InlineCombinatorProps, ActionProps, ShiftActionsProps, ValueSelectorProps, ValueEditorProps, RuleGroupTypeAny, ToFlexibleOption, Operator, Combinator, QueryBuilderProps } from 'react-querybuilder';

@@ -17,6 +17,6 @@ type WrapEachPropertyInStyleProp<K> = {

}
interface SchemaNative extends Schema, WithOptionalStyleSheets {
interface SchemaNative<F extends ToFullOption<Field>, O extends string> extends Schema<F, O>, WithOptionalStyleSheets {
}
interface WithSchemaNative {
schema: SchemaNative;
schema: SchemaNative<any, any>;
}

@@ -59,3 +59,3 @@ interface QueryBuilderNativeStyles {

};
type QueryBuilderNativeProps<RG extends RuleGroupType | RuleGroupTypeIC = RuleGroupType> = QueryBuilderProps<RG> & WithOptionalStyles;
type QueryBuilderNativeProps<RG extends RuleGroupTypeAny, F extends ToFlexibleOption<Field>, O extends ToFlexibleOption<Operator>, C extends ToFlexibleOption<Combinator>> = QueryBuilderProps<RG, F, O, C> & WithOptionalStyles;

@@ -78,3 +78,3 @@ declare const NativeActionElement: {

declare const NativeShiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -101,3 +101,9 @@ };

declare const QueryBuilderNative: {
<RG extends RuleGroupType | RuleGroupTypeIC>(props: QueryBuilderNativeProps<RG>): react.JSX.Element;
<RG extends RuleGroupTypeAny, F extends Omit<Field<string, string, string, react_querybuilder.Option<string>, react_querybuilder.Option<string>>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>, O extends Omit<Operator<string>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>, C extends Omit<Combinator<string>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>>(props: QueryBuilderNativeProps<RG, F, O, C>): react.JSX.Element;
displayName: string;

@@ -179,3 +185,3 @@ };

shiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -260,3 +266,3 @@ };

shiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -263,0 +269,0 @@ };

@@ -183,11 +183,12 @@ "use strict";

var import_react_native5 = require("react-native");
var import_react_querybuilder2 = require("react-querybuilder");
var NativeShiftActions = ({
path,
shiftUp,
shiftDown,
shiftUpDisabled,
shiftDownDisabled,
disabled,
labels,
testID,
lastInGroup,
schema: { combinators, dispatchQuery, getQuery, styles }
schema: { styles }
}) => {
const { shiftUp, shiftDown } = (0, import_react_querybuilder2.useShiftActions)({ combinators, dispatchQuery, getQuery, path });
const style = React4.useMemo(

@@ -202,3 +203,3 @@ () => ({

{
disabled: (0, import_react_querybuilder2.pathsAreEqual)([0], path),
disabled: disabled || shiftUpDisabled,
onPress: shiftUp,

@@ -211,3 +212,3 @@ accessibilityLabel: labels?.shiftUp,

{
disabled: lastInGroup && path.length === 1,
disabled: disabled || shiftDownDisabled,
onPress: shiftDown,

@@ -225,3 +226,3 @@ accessibilityLabel: labels?.shiftDown,

var import_react_native7 = require("react-native");
var import_react_querybuilder4 = require("react-querybuilder");
var import_react_querybuilder3 = require("react-querybuilder");

@@ -232,3 +233,3 @@ // src/components/NativeValueSelector.tsx

var import_react_native6 = require("react-native");
var import_react_querybuilder3 = require("react-querybuilder");
var import_react_querybuilder2 = require("react-querybuilder");
var NativeValueSelector = ({

@@ -245,3 +246,3 @@ handleOnChange,

const styles = (0, import_react3.useMemo)(() => {
if (testID === import_react_querybuilder3.TestID.combinators) {
if (testID === import_react_querybuilder2.TestID.combinators) {
return {

@@ -257,3 +258,3 @@ selector: import_react_native6.StyleSheet.flatten([

};
} else if (testID === import_react_querybuilder3.TestID.fields) {
} else if (testID === import_react_querybuilder2.TestID.fields) {
return {

@@ -266,3 +267,3 @@ selector: import_react_native6.StyleSheet.flatten([

};
} else if (testID === import_react_querybuilder3.TestID.operators) {
} else if (testID === import_react_querybuilder2.TestID.operators) {
return {

@@ -278,3 +279,3 @@ selector: import_react_native6.StyleSheet.flatten([

};
} else if (testID === import_react_querybuilder3.TestID.valueSourceSelector) {
} else if (testID === import_react_querybuilder2.TestID.valueSourceSelector) {
return {

@@ -290,3 +291,3 @@ selector: import_react_native6.StyleSheet.flatten([

};
} else if (testID === import_react_querybuilder3.TestID.valueEditor) {
} else if (testID === import_react_querybuilder2.TestID.valueEditor) {
return {

@@ -317,4 +318,4 @@ selector: import_react_native6.StyleSheet.flatten([

]);
const { onChange } = (0, import_react_querybuilder3.useValueSelector)({ handleOnChange, listsAsArrays, multiple, value });
const val = multiple ? Array.isArray(value) ? (0, import_react_querybuilder3.joinWith)(value, ",") : value : value;
const { onChange } = (0, import_react_querybuilder2.useValueSelector)({ handleOnChange, listsAsArrays, multiple, value });
const val = multiple ? Array.isArray(value) ? (0, import_react_querybuilder2.joinWith)(value, ",") : value : value;
return /* @__PURE__ */ React5.createElement(

@@ -371,3 +372,3 @@ import_react_native6.TextInput,

);
const { valueAsArray, multiValueHandler } = (0, import_react_querybuilder4.useValueEditor)({
const { valueAsArray, multiValueHandler } = (0, import_react_querybuilder3.useValueEditor)({
skipHook,

@@ -411,3 +412,3 @@ handleOnChange,

disabled,
value: valueAsArray[i] ?? (0, import_react_querybuilder4.getFirstOption)(values),
value: valueAsArray[i] ?? (0, import_react_querybuilder3.getFirstOption)(values),
options: values,

@@ -470,3 +471,3 @@ listsAsArrays

value,
onChangeText: (v) => handleOnChange((0, import_react_querybuilder4.parseNumber)(v, { parseNumbers }))
onChangeText: (v) => handleOnChange((0, import_react_querybuilder3.parseNumber)(v, { parseNumbers }))
}

@@ -490,4 +491,3 @@ );

var React11 = __toESM(require("react"));
var import_react8 = require("react");
var import_react_native10 = require("react-native");
var import_react9 = require("react");
var import_react_querybuilder7 = require("react-querybuilder");

@@ -503,24 +503,21 @@ var import_react_redux = require("react-redux");

var import_react_native8 = require("react-native");
var import_react_querybuilder5 = require("react-querybuilder");
var import_react_querybuilder4 = require("react-querybuilder");
var RuleGroupNative = (props) => {
const rg = { ...props, ...(0, import_react_querybuilder5.useRuleGroup)(props) };
const rg = (0, import_react_querybuilder4.useRuleGroup)(props);
const schema = rg.schema;
const styles = (0, import_react5.useMemo)(
() => ({
ruleGroup: import_react_native8.StyleSheet.flatten([defaultNativeStyles.ruleGroup, rg.schema.styles?.ruleGroup]),
ruleGroup: import_react_native8.StyleSheet.flatten([defaultNativeStyles.ruleGroup, schema.styles?.ruleGroup]),
ruleGroupHeader: import_react_native8.StyleSheet.flatten([
defaultNativeStyles.ruleGroupHeader,
rg.schema.styles?.ruleGroupHeader
schema.styles?.ruleGroupHeader
]),
ruleGroupBody: import_react_native8.StyleSheet.flatten([
defaultNativeStyles.ruleGroupBody,
rg.schema.styles?.ruleGroupBody
schema.styles?.ruleGroupBody
])
}),
[
rg.schema.styles?.ruleGroup,
rg.schema.styles?.ruleGroupBody,
rg.schema.styles?.ruleGroupHeader
]
[schema.styles?.ruleGroup, schema.styles?.ruleGroupBody, schema.styles?.ruleGroupHeader]
);
return /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroup, testID: import_react_querybuilder5.TestID.ruleGroup }, /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroupHeader }, /* @__PURE__ */ React9.createElement(import_react_querybuilder5.RuleGroupHeaderComponents, { ...rg })), /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroupBody }, /* @__PURE__ */ React9.createElement(import_react_querybuilder5.RuleGroupBodyComponents, { ...rg })));
return /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroup, testID: import_react_querybuilder4.TestID.ruleGroup }, /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroupHeader }, /* @__PURE__ */ React9.createElement(import_react_querybuilder4.RuleGroupHeaderComponents, { ...rg })), /* @__PURE__ */ React9.createElement(import_react_native8.View, { style: styles.ruleGroupBody }, /* @__PURE__ */ React9.createElement(import_react_querybuilder4.RuleGroupBodyComponents, { ...rg })));
};

@@ -533,10 +530,11 @@ RuleGroupNative.displayName = "RuleGroupNative";

var import_react_native9 = require("react-native");
var import_react_querybuilder6 = require("react-querybuilder");
var import_react_querybuilder5 = require("react-querybuilder");
var RuleNative = (props) => {
const r = { ...props, ...(0, import_react_querybuilder6.useRule)(props) };
const r = (0, import_react_querybuilder5.useRule)(props);
const schema = r.schema;
const styles = (0, import_react6.useMemo)(
() => ({ rule: import_react_native9.StyleSheet.flatten([defaultNativeStyles.rule, r.schema.styles?.rule]) }),
[r.schema.styles?.rule]
() => ({ rule: import_react_native9.StyleSheet.flatten([defaultNativeStyles.rule, schema.styles?.rule]) }),
[schema.styles?.rule]
);
return /* @__PURE__ */ React10.createElement(import_react_native9.View, { style: styles.rule, testID: import_react_querybuilder6.TestID.rule }, /* @__PURE__ */ React10.createElement(import_react_querybuilder6.RuleComponents, { ...r }));
return /* @__PURE__ */ React10.createElement(import_react_native9.View, { style: styles.rule, testID: import_react_querybuilder5.TestID.rule }, /* @__PURE__ */ React10.createElement(import_react_querybuilder5.RuleComponents, { ...r }));
};

@@ -580,22 +578,22 @@ RuleNative.displayName = "RuleNative";

// src/components/useQueryBuilderSchemaNative.ts
var import_react8 = require("react");
var import_react_native10 = require("react-native");
var import_react_querybuilder6 = require("react-querybuilder");
var useQueryBuilderSchemaNative = (props, setup) => {
const qb = (0, import_react_querybuilder6.useQueryBuilderSchema)(props, setup);
qb.schema.styles = (0, import_react8.useMemo)(
() => import_react_native10.StyleSheet.create(props.styles ?? {}),
[props.styles]
);
return qb;
};
// src/components/QueryBuilderNative.tsx
var rootPath = [];
var QueryBuilderNative = (props) => {
const controlElements = (0, import_react8.useMemo)(
() => ({ ...defaultNativeControlElements, ...props.controlElements }),
[props.controlElements]
);
const setup = (0, import_react_querybuilder7.useQueryBuilderSetup)({ ...props, controlElements });
return /* @__PURE__ */ React11.createElement(import_react_redux.Provider, { context: import_react_querybuilder7.QueryBuilderStateContext, store: import_react_querybuilder7.queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, { ...props, setup }));
};
var QueryBuilderNativeInternal = (allProps) => {
const { setup, ...props } = allProps;
const qb = {
...props,
...(0, import_react_querybuilder7.useQueryBuilderSchema)(
props,
setup
)
};
qb.schema.styles = (0, import_react8.useMemo)(() => import_react_native10.StyleSheet.create(allProps.styles ?? {}), [allProps.styles]);
var QueryBuilderNativeInternal = ({
props,
setup
}) => {
const qb = useQueryBuilderSchemaNative(props, setup);
const { ruleGroup: RuleGroupComponent } = qb.schema.controls;

@@ -605,3 +603,3 @@ return /* @__PURE__ */ React11.createElement(import_react_querybuilder7.QueryBuilderContext.Provider, { value: qb.rqbContext }, /* @__PURE__ */ React11.createElement(

{
ruleGroup: qb.rootQuery,
ruleGroup: qb.rootGroup,
...qb.combinatorPropObject,

@@ -612,4 +610,4 @@ path: rootPath,

actions: qb.actions,
id: qb.rootQuery.id,
disabled: !!qb.rootQuery.disabled || qb.queryDisabled,
id: qb.rootGroup.id,
disabled: qb.rootGroupDisabled,
parentDisabled: qb.queryDisabled,

@@ -620,2 +618,10 @@ context: qb.context

};
var QueryBuilderNative = (props) => {
const controlElements = (0, import_react9.useMemo)(
() => ({ ...defaultNativeControlElements, ...props.controlElements }),
[props.controlElements]
);
const setup = (0, import_react_querybuilder7.useQueryBuilderSetup)({ ...props, controlElements });
return /* @__PURE__ */ React11.createElement(import_react_redux.Provider, { context: import_react_querybuilder7.QueryBuilderStateContext, store: import_react_querybuilder7.queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, { props, setup }));
};
QueryBuilderNative.displayName = "QueryBuilderNative";

@@ -622,0 +628,0 @@ // Annotate the CommonJS export names for ESM import in node:

@@ -5,3 +5,3 @@ import * as react from 'react';

import * as react_querybuilder from 'react-querybuilder';
import { Schema, RuleGroupProps, RuleProps, NotToggleProps, InlineCombinatorProps, ActionProps, ShiftActionsProps, ValueSelectorProps, ValueEditorProps, RuleGroupType, RuleGroupTypeIC, QueryBuilderProps } from 'react-querybuilder';
import { ToFullOption, Field, Schema, RuleGroupProps, RuleProps, NotToggleProps, InlineCombinatorProps, ActionProps, ShiftActionsProps, ValueSelectorProps, ValueEditorProps, RuleGroupTypeAny, ToFlexibleOption, Operator, Combinator, QueryBuilderProps } from 'react-querybuilder';

@@ -17,6 +17,6 @@ type WrapEachPropertyInStyleProp<K> = {

}
interface SchemaNative extends Schema, WithOptionalStyleSheets {
interface SchemaNative<F extends ToFullOption<Field>, O extends string> extends Schema<F, O>, WithOptionalStyleSheets {
}
interface WithSchemaNative {
schema: SchemaNative;
schema: SchemaNative<any, any>;
}

@@ -59,3 +59,3 @@ interface QueryBuilderNativeStyles {

};
type QueryBuilderNativeProps<RG extends RuleGroupType | RuleGroupTypeIC = RuleGroupType> = QueryBuilderProps<RG> & WithOptionalStyles;
type QueryBuilderNativeProps<RG extends RuleGroupTypeAny, F extends ToFlexibleOption<Field>, O extends ToFlexibleOption<Operator>, C extends ToFlexibleOption<Combinator>> = QueryBuilderProps<RG, F, O, C> & WithOptionalStyles;

@@ -78,3 +78,3 @@ declare const NativeActionElement: {

declare const NativeShiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -101,3 +101,9 @@ };

declare const QueryBuilderNative: {
<RG extends RuleGroupType | RuleGroupTypeIC>(props: QueryBuilderNativeProps<RG>): react.JSX.Element;
<RG extends RuleGroupTypeAny, F extends Omit<Field<string, string, string, react_querybuilder.Option<string>, react_querybuilder.Option<string>>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>, O extends Omit<Operator<string>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>, C extends Omit<Combinator<string>, "value" | "name"> & {
[x: string]: any;
} & react_querybuilder.FlexibleOption<string>>(props: QueryBuilderNativeProps<RG, F, O, C>): react.JSX.Element;
displayName: string;

@@ -179,3 +185,3 @@ };

shiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -260,3 +266,3 @@ };

shiftActions: {
({ path, labels, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery, styles }, }: ShiftActionsNativeProps): react.JSX.Element;
({ shiftUp, shiftDown, shiftUpDisabled, shiftDownDisabled, disabled, labels, testID, schema: { styles }, }: ShiftActionsNativeProps): react.JSX.Element;
displayName: string;

@@ -263,0 +269,0 @@ };

@@ -1,2 +0,2 @@

"use strict";var we=Object.create;var L=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var o in t)L(e,o,{get:t[o],enumerable:!0})},ae=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ce(t))!Ae.call(e,s)&&s!==o&&L(e,s,{get:()=>t[s],enumerable:!(r=Ve(t,s))||r.enumerable});return e};var c=(e,t,o)=>(o=e!=null?we(Ee(e)):{},ae(t||!e||!e.__esModule?L(o,"default",{value:e,enumerable:!0}):o,e)),Be=e=>ae(L({},"__esModule",{value:!0}),e);var Le={};Pe(Le,{NativeActionElement:()=>y,NativeInlineCombinator:()=>H,NativeNotToggle:()=>q,NativeShiftActions:()=>j,NativeValueEditor:()=>E,NativeValueEditorWeb:()=>Z,NativeValueSelector:()=>f,NativeValueSelectorWeb:()=>N,QueryBuilderNative:()=>Te,RuleGroupNative:()=>U,RuleNative:()=>_,defaultNativeControlElements:()=>F,defaultNativeSelectStyles:()=>p,defaultNativeStyles:()=>l,defaultNativeWebControlElements:()=>De});module.exports=Be(Le);var ne=c(require("react")),ue=require("react-native"),y=({handleOnClick:e,label:t,disabled:o,disabledTranslation:r,testID:s})=>ne.createElement(ue.Button,{testID:s,disabled:o&&!r,title:`${r&&o?r.label??"":t??""}`,onPress:n=>e(n)});y.displayName="NativeActionElement";var X=c(require("react")),me=require("react"),W=require("react-native"),Y=require("react-querybuilder");var pe=require("react-native"),p={selector:{borderWidth:1,height:32,width:100},option:{}},Oe={combinatorOption:p.option,combinatorSelector:p.selector,dragHandle:{},fieldOption:p.option,fieldSelector:p.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:p.option,operatorSelector:p.selector,rule:{flexDirection:"row",paddingBottom:10},ruleGroup:{backgroundColor:"rgba(0, 75, 183, 0.2)",borderColor:"#8081a2",borderRadius:4,borderWidth:1,marginBottom:10},ruleGroupBody:{paddingTop:10,paddingRight:10,paddingLeft:10},ruleGroupHeader:{flexDirection:"row",paddingTop:10,paddingRight:10,paddingLeft:10},shiftActions:{flexDirection:"column"},value:{borderWidth:1,height:32,width:150},valueEditorOption:p.option,valueEditorSelector:p.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:p.option,valueSourceSelector:p.selector},l=pe.StyleSheet.create(Oe);var H=({component:e,path:t,independentCombinators:o,...r})=>{let s=(0,me.useMemo)(()=>({inlineCombinator:W.StyleSheet.flatten([l.inlineCombinator,r.schema.styles?.inlineCombinator])}),[r.schema.styles?.inlineCombinator]);return X.createElement(W.View,{style:s.inlineCombinator,key:"no-dnd",testID:Y.TestID.inlineCombinator},X.createElement(e,{...r,path:t,testID:Y.TestID.combinators}))};H.displayName="NativeInlineCombinator";var k=c(require("react")),ce=require("react"),d=require("react-native");var q=({handleOnChange:e,label:t,checked:o,disabled:r,schema:s,testID:n})=>{let i=(0,ce.useMemo)(()=>({notToggle:d.StyleSheet.flatten([l.notToggle,s.styles?.notToggle]),notToggleLabel:d.StyleSheet.flatten([l.notToggleLabel,s.styles?.notToggleLabel]),notToggleSwitch:d.StyleSheet.flatten([l.notToggleSwitch,s.styles?.notToggleSwitch])}),[s.styles?.notToggle,s.styles?.notToggleLabel,s.styles?.notToggleSwitch]);return k.createElement(d.View,{style:i.notToggle,testID:n},k.createElement(d.Text,{style:i.notToggleLabel},t),k.createElement(d.Switch,{style:i.notToggleSwitch,disabled:r,value:o,onValueChange:a=>e(a)}))};q.displayName="NativeNotToggle";var V=c(require("react")),G=require("react-native"),M=require("react-querybuilder");var j=({path:e,labels:t,testID:o,lastInGroup:r,schema:{combinators:s,dispatchQuery:n,getQuery:i,styles:a}})=>{let{shiftUp:R,shiftDown:w}=(0,M.useShiftActions)({combinators:s,dispatchQuery:n,getQuery:i,path:e}),B=V.useMemo(()=>({shiftActions:G.StyleSheet.flatten([l.shiftActions,a?.shiftActions])}),[a?.shiftActions]);return V.createElement(G.View,{testID:o,style:B.shiftActions},V.createElement(G.Button,{disabled:(0,M.pathsAreEqual)([0],e),onPress:R,accessibilityLabel:t?.shiftUp,title:t?.shiftUp}),V.createElement(G.Button,{disabled:r&&e.length===1,onPress:w,accessibilityLabel:t?.shiftDown,title:t?.shiftDown}))};j.displayName="NativeShiftActions";var h=c(require("react")),de=require("react"),m=require("react-native"),C=require("react-querybuilder");var ye=c(require("react")),fe=require("react"),u=require("react-native"),v=require("react-querybuilder");var f=({handleOnChange:e,options:t,value:o,disabled:r,multiple:s,listsAsArrays:n,schema:i,testID:a})=>{let R=(0,fe.useMemo)(()=>a===v.TestID.combinators?{selector:u.StyleSheet.flatten([l.combinatorSelector,i.styles?.combinatorSelector]),option:u.StyleSheet.flatten([l.combinatorOption,i.styles?.combinatorOption])}:a===v.TestID.fields?{selector:u.StyleSheet.flatten([l.fieldSelector,i.styles?.fieldSelector]),option:u.StyleSheet.flatten([l.fieldOption,i.styles?.fieldOption])}:a===v.TestID.operators?{selector:u.StyleSheet.flatten([l.operatorSelector,i.styles?.operatorSelector]),option:u.StyleSheet.flatten([l.operatorOption,i.styles?.operatorOption])}:a===v.TestID.valueSourceSelector?{selector:u.StyleSheet.flatten([l.valueSourceSelector,i.styles?.valueSourceSelector]),option:u.StyleSheet.flatten([l.valueSourceOption,i.styles?.valueSourceOption])}:a===v.TestID.valueEditor?{selector:u.StyleSheet.flatten([l.valueEditorSelector,i.styles?.valueEditorSelector]),option:u.StyleSheet.flatten([l.valueEditorOption,i.styles?.valueEditorOption])}:u.StyleSheet.create(p),[i.styles?.combinatorOption,i.styles?.combinatorSelector,i.styles?.fieldOption,i.styles?.fieldSelector,i.styles?.operatorOption,i.styles?.operatorSelector,i.styles?.valueEditorOption,i.styles?.valueEditorSelector,i.styles?.valueSourceOption,i.styles?.valueSourceSelector,a]),{onChange:w}=(0,v.useValueSelector)({handleOnChange:e,listsAsArrays:n,multiple:s,value:o}),B=s&&Array.isArray(o)?(0,v.joinWith)(o,","):o;return ye.createElement(u.TextInput,{testID:a,"aria-disabled":r,style:R.selector,value:B,onChangeText:w})};f.displayName="NativeValueSelector";var E=({operator:e,value:t,handleOnChange:o,title:r,className:s,type:n="text",inputType:i="text",values:a=[],listsAsArrays:R,parseNumbers:w,fieldData:B,disabled:$,separator:Re=null,skipHook:Ge=!1,testID:O,selectorComponent:oe=f,...g})=>{let D=(0,de.useMemo)(()=>({value:m.StyleSheet.flatten([l.value,g.schema.styles?.value]),valueEditorSwitch:m.StyleSheet.flatten([l.valueEditorSwitch,g.schema.styles?.valueEditorSwitch]),valueList:m.StyleSheet.flatten([l.valueList,g.schema.styles?.valueList])}),[g.schema.styles?.value,g.schema.styles?.valueEditorSwitch,g.schema.styles?.valueList]),{valueAsArray:re,multiValueHandler:le}=(0,C.useValueEditor)({skipHook:Ge,handleOnChange:o,inputType:i,operator:e,value:t,type:n,listsAsArrays:R,parseNumbers:w,values:a});if(e==="null"||e==="notNull")return null;let z=B?.placeholder??"",ie="default";if((e==="between"||e==="notBetween")&&(n==="select"||n==="text")){let b=["from","to"].map((se,I)=>n==="text"?h.createElement(m.TextInput,{key:se,style:D.value,keyboardType:ie,placeholder:z,value:re[I]??"",onChangeText:J=>le(J,I)}):h.createElement(oe,{...g,key:se,handleOnChange:J=>le(J,I),className:s,disabled:$,value:re[I]??(0,C.getFirstOption)(a),options:a,listsAsArrays:R}));return h.createElement(m.View,{testID:O,style:D.valueList},b[0],Re,b[1])}switch(n){case"select":case"multiselect":return h.createElement(oe,{...g,testID:O,className:s,title:r,handleOnChange:o,disabled:$,value:t,options:a,multiple:n==="multiselect",listsAsArrays:R});case"textarea":return h.createElement(m.TextInput,{testID:O,style:D.value,placeholder:z,value:t,onChangeText:b=>o(b)});case"switch":case"checkbox":return h.createElement(m.Switch,{testID:O,style:D.valueEditorSwitch,disabled:$,value:!!t,onValueChange:b=>o(b)})}return h.createElement(m.TextInput,{testID:O,style:D.value,keyboardType:ie,placeholder:z,value:t,onChangeText:b=>o((0,C.parseNumber)(b,{parseNumbers:w}))})};E.displayName="NativeValueEditor";var Se=c(require("react"));var ve=c(require("react"));var N=e=>ve.createElement(f,{...e});N.displayName="NativeValueSelectorWeb";var Z=e=>Se.createElement(E,{...e,selectorComponent:N});var Q=c(require("react")),te=require("react"),he=require("react-native"),S=require("react-querybuilder"),xe=require("react-redux");var be=require("react");var A=c(require("react")),Ne=require("react"),x=require("react-native"),T=require("react-querybuilder");var U=e=>{let t={...e,...(0,T.useRuleGroup)(e)},o=(0,Ne.useMemo)(()=>({ruleGroup:x.StyleSheet.flatten([l.ruleGroup,t.schema.styles?.ruleGroup]),ruleGroupHeader:x.StyleSheet.flatten([l.ruleGroupHeader,t.schema.styles?.ruleGroupHeader]),ruleGroupBody:x.StyleSheet.flatten([l.ruleGroupBody,t.schema.styles?.ruleGroupBody])}),[t.schema.styles?.ruleGroup,t.schema.styles?.ruleGroupBody,t.schema.styles?.ruleGroupHeader]);return A.createElement(x.View,{style:o.ruleGroup,testID:T.TestID.ruleGroup},A.createElement(x.View,{style:o.ruleGroupHeader},A.createElement(T.RuleGroupHeaderComponents,{...t})),A.createElement(x.View,{style:o.ruleGroupBody},A.createElement(T.RuleGroupBodyComponents,{...t})))};U.displayName="RuleGroupNative";var ee=c(require("react")),ge=require("react"),K=require("react-native"),P=require("react-querybuilder");var _=e=>{let t={...e,...(0,P.useRule)(e)},o=(0,ge.useMemo)(()=>({rule:K.StyleSheet.flatten([l.rule,t.schema.styles?.rule])}),[t.schema.styles?.rule]);return ee.createElement(K.View,{style:o.rule,testID:P.TestID.rule},ee.createElement(P.RuleComponents,{...t}))};_.displayName="RuleNative";var F={addGroupAction:y,addRuleAction:y,cloneGroupAction:y,cloneRuleAction:y,combinatorSelector:f,dragHandle:(0,be.forwardRef)(()=>null),fieldSelector:f,inlineCombinator:H,lockGroupAction:y,lockRuleAction:y,notToggle:q,operatorSelector:f,removeGroupAction:y,removeRuleAction:y,rule:_,ruleGroup:U,shiftActions:j,valueEditor:E,valueSourceSelector:f},De={...F,combinatorSelector:N,fieldSelector:N,operatorSelector:N,valueEditor:Z,valueSourceSelector:N};var Qe=[],Te=e=>{let t=(0,te.useMemo)(()=>({...F,...e.controlElements}),[e.controlElements]),o=(0,S.useQueryBuilderSetup)({...e,controlElements:t});return Q.createElement(xe.Provider,{context:S.QueryBuilderStateContext,store:S.queryBuilderStore},Q.createElement(Ie,{...e,setup:o}))},Ie=e=>{let{setup:t,...o}=e,r={...o,...(0,S.useQueryBuilderSchema)(o,t)};r.schema.styles=(0,te.useMemo)(()=>he.StyleSheet.create(e.styles??{}),[e.styles]);let{ruleGroup:s}=r.schema.controls;return Q.createElement(S.QueryBuilderContext.Provider,{value:r.rqbContext},Q.createElement(s,{ruleGroup:r.rootQuery,...r.combinatorPropObject,path:Qe,translations:r.translations,schema:r.schema,actions:r.actions,id:r.rootQuery.id,disabled:!!r.rootQuery.disabled||r.queryDisabled,parentDisabled:r.queryDisabled,context:r.context}))};Te.displayName="QueryBuilderNative";0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeShiftActions,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements});
"use strict";var Ve=Object.create;var D=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Be=(t,o)=>{for(var e in o)D(t,e,{get:o[e],enumerable:!0})},le=(t,o,e,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of Ee(o))!Ae.call(t,a)&&a!==e&&D(t,a,{get:()=>o[a],enumerable:!(l=we(o,a))||l.enumerable});return t};var c=(t,o,e)=>(e=t!=null?Ve(Pe(t)):{},le(o||!t||!t.__esModule?D(e,"default",{value:t,enumerable:!0}):e,t)),Fe=t=>le(D({},"__esModule",{value:!0}),t);var We={};Be(We,{NativeActionElement:()=>y,NativeInlineCombinator:()=>L,NativeNotToggle:()=>H,NativeShiftActions:()=>k,NativeValueEditor:()=>V,NativeValueEditorWeb:()=>Y,NativeValueSelector:()=>d,NativeValueSelectorWeb:()=>S,QueryBuilderNative:()=>Oe,RuleGroupNative:()=>M,RuleNative:()=>j,defaultNativeControlElements:()=>K,defaultNativeSelectStyles:()=>p,defaultNativeStyles:()=>r,defaultNativeWebControlElements:()=>De});module.exports=Fe(We);var ae=c(require("react")),se=require("react-native"),y=({handleOnClick:t,label:o,disabled:e,disabledTranslation:l,testID:a})=>ae.createElement(se.Button,{testID:a,disabled:e&&!l,title:`${l&&e?l.label??"":o??""}`,onPress:s=>t(s)});y.displayName="NativeActionElement";var J=c(require("react")),ue=require("react"),I=require("react-native"),X=require("react-querybuilder");var ne=require("react-native"),p={selector:{borderWidth:1,height:32,width:100},option:{}},Qe={combinatorOption:p.option,combinatorSelector:p.selector,dragHandle:{},fieldOption:p.option,fieldSelector:p.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:p.option,operatorSelector:p.selector,rule:{flexDirection:"row",paddingBottom:10},ruleGroup:{backgroundColor:"rgba(0, 75, 183, 0.2)",borderColor:"#8081a2",borderRadius:4,borderWidth:1,marginBottom:10},ruleGroupBody:{paddingTop:10,paddingRight:10,paddingLeft:10},ruleGroupHeader:{flexDirection:"row",paddingTop:10,paddingRight:10,paddingLeft:10},shiftActions:{flexDirection:"column"},value:{borderWidth:1,height:32,width:150},valueEditorOption:p.option,valueEditorSelector:p.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:p.option,valueSourceSelector:p.selector},r=ne.StyleSheet.create(Qe);var L=({component:t,path:o,independentCombinators:e,...l})=>{let a=(0,ue.useMemo)(()=>({inlineCombinator:I.StyleSheet.flatten([r.inlineCombinator,l.schema.styles?.inlineCombinator])}),[l.schema.styles?.inlineCombinator]);return J.createElement(I.View,{style:a.inlineCombinator,key:"no-dnd",testID:X.TestID.inlineCombinator},J.createElement(t,{...l,path:o,testID:X.TestID.combinators}))};L.displayName="NativeInlineCombinator";var W=c(require("react")),pe=require("react"),f=require("react-native");var H=({handleOnChange:t,label:o,checked:e,disabled:l,schema:a,testID:s})=>{let i=(0,pe.useMemo)(()=>({notToggle:f.StyleSheet.flatten([r.notToggle,a.styles?.notToggle]),notToggleLabel:f.StyleSheet.flatten([r.notToggleLabel,a.styles?.notToggleLabel]),notToggleSwitch:f.StyleSheet.flatten([r.notToggleSwitch,a.styles?.notToggleSwitch])}),[a.styles?.notToggle,a.styles?.notToggleLabel,a.styles?.notToggleSwitch]);return W.createElement(f.View,{style:i.notToggle,testID:s},W.createElement(f.Text,{style:i.notToggleLabel},o),W.createElement(f.Switch,{style:i.notToggleSwitch,disabled:l,value:e,onValueChange:n=>t(n)}))};H.displayName="NativeNotToggle";var C=c(require("react")),O=require("react-native");var k=({shiftUp:t,shiftDown:o,shiftUpDisabled:e,shiftDownDisabled:l,disabled:a,labels:s,testID:i,schema:{styles:n}})=>{let G=C.useMemo(()=>({shiftActions:O.StyleSheet.flatten([r.shiftActions,n?.shiftActions])}),[n?.shiftActions]);return C.createElement(O.View,{testID:i,style:G.shiftActions},C.createElement(O.Button,{disabled:a||e,onPress:t,accessibilityLabel:s?.shiftUp,title:s?.shiftUp}),C.createElement(O.Button,{disabled:a||l,onPress:o,accessibilityLabel:s?.shiftDown,title:s?.shiftDown}))};k.displayName="NativeShiftActions";var x=c(require("react")),ye=require("react"),m=require("react-native"),R=require("react-querybuilder");var me=c(require("react")),ce=require("react"),u=require("react-native"),v=require("react-querybuilder");var d=({handleOnChange:t,options:o,value:e,disabled:l,multiple:a,listsAsArrays:s,schema:i,testID:n})=>{let G=(0,ce.useMemo)(()=>n===v.TestID.combinators?{selector:u.StyleSheet.flatten([r.combinatorSelector,i.styles?.combinatorSelector]),option:u.StyleSheet.flatten([r.combinatorOption,i.styles?.combinatorOption])}:n===v.TestID.fields?{selector:u.StyleSheet.flatten([r.fieldSelector,i.styles?.fieldSelector]),option:u.StyleSheet.flatten([r.fieldOption,i.styles?.fieldOption])}:n===v.TestID.operators?{selector:u.StyleSheet.flatten([r.operatorSelector,i.styles?.operatorSelector]),option:u.StyleSheet.flatten([r.operatorOption,i.styles?.operatorOption])}:n===v.TestID.valueSourceSelector?{selector:u.StyleSheet.flatten([r.valueSourceSelector,i.styles?.valueSourceSelector]),option:u.StyleSheet.flatten([r.valueSourceOption,i.styles?.valueSourceOption])}:n===v.TestID.valueEditor?{selector:u.StyleSheet.flatten([r.valueEditorSelector,i.styles?.valueEditorSelector]),option:u.StyleSheet.flatten([r.valueEditorOption,i.styles?.valueEditorOption])}:u.StyleSheet.create(p),[i.styles?.combinatorOption,i.styles?.combinatorSelector,i.styles?.fieldOption,i.styles?.fieldSelector,i.styles?.operatorOption,i.styles?.operatorSelector,i.styles?.valueEditorOption,i.styles?.valueEditorSelector,i.styles?.valueSourceOption,i.styles?.valueSourceSelector,n]),{onChange:F}=(0,v.useValueSelector)({handleOnChange:t,listsAsArrays:s,multiple:a,value:e}),U=a&&Array.isArray(e)?(0,v.joinWith)(e,","):e;return me.createElement(u.TextInput,{testID:n,"aria-disabled":l,style:G.selector,value:U,onChangeText:F})};d.displayName="NativeValueSelector";var V=({operator:t,value:o,handleOnChange:e,title:l,className:a,type:s="text",inputType:i="text",values:n=[],listsAsArrays:G,parseNumbers:F,fieldData:U,disabled:_,separator:Ce=null,skipHook:Re=!1,testID:P,selectorComponent:ee=d,...N})=>{let A=(0,ye.useMemo)(()=>({value:m.StyleSheet.flatten([r.value,N.schema.styles?.value]),valueEditorSwitch:m.StyleSheet.flatten([r.valueEditorSwitch,N.schema.styles?.valueEditorSwitch]),valueList:m.StyleSheet.flatten([r.valueList,N.schema.styles?.valueList])}),[N.schema.styles?.value,N.schema.styles?.valueEditorSwitch,N.schema.styles?.valueList]),{valueAsArray:te,multiValueHandler:oe}=(0,R.useValueEditor)({skipHook:Re,handleOnChange:e,inputType:i,operator:t,value:o,type:s,listsAsArrays:G,parseNumbers:F,values:n});if(t==="null"||t==="notNull")return null;let $=U?.placeholder??"",re="default";if((t==="between"||t==="notBetween")&&(s==="select"||s==="text")){let b=["from","to"].map((ie,Q)=>s==="text"?x.createElement(m.TextInput,{key:ie,style:A.value,keyboardType:re,placeholder:$,value:te[Q]??"",onChangeText:z=>oe(z,Q)}):x.createElement(ee,{...N,key:ie,handleOnChange:z=>oe(z,Q),className:a,disabled:_,value:te[Q]??(0,R.getFirstOption)(n),options:n,listsAsArrays:G}));return x.createElement(m.View,{testID:P,style:A.valueList},b[0],Ce,b[1])}switch(s){case"select":case"multiselect":return x.createElement(ee,{...N,testID:P,className:a,title:l,handleOnChange:e,disabled:_,value:o,options:n,multiple:s==="multiselect",listsAsArrays:G});case"textarea":return x.createElement(m.TextInput,{testID:P,style:A.value,placeholder:$,value:o,onChangeText:b=>e(b)});case"switch":case"checkbox":return x.createElement(m.Switch,{testID:P,style:A.valueEditorSwitch,disabled:_,value:!!o,onValueChange:b=>e(b)})}return x.createElement(m.TextInput,{testID:P,style:A.value,keyboardType:re,placeholder:$,value:o,onChangeText:b=>e((0,R.parseNumber)(b,{parseNumbers:F}))})};V.displayName="NativeValueEditor";var fe=c(require("react"));var de=c(require("react"));var S=t=>de.createElement(d,{...t});S.displayName="NativeValueSelectorWeb";var Y=t=>fe.createElement(V,{...t,selectorComponent:S});var B=c(require("react")),Te=require("react"),T=require("react-querybuilder"),Ge=require("react-redux");var Ne=require("react");var w=c(require("react")),ve=require("react"),g=require("react-native"),h=require("react-querybuilder");var M=t=>{let o=(0,h.useRuleGroup)(t),e=o.schema,l=(0,ve.useMemo)(()=>({ruleGroup:g.StyleSheet.flatten([r.ruleGroup,e.styles?.ruleGroup]),ruleGroupHeader:g.StyleSheet.flatten([r.ruleGroupHeader,e.styles?.ruleGroupHeader]),ruleGroupBody:g.StyleSheet.flatten([r.ruleGroupBody,e.styles?.ruleGroupBody])}),[e.styles?.ruleGroup,e.styles?.ruleGroupBody,e.styles?.ruleGroupHeader]);return w.createElement(g.View,{style:l.ruleGroup,testID:h.TestID.ruleGroup},w.createElement(g.View,{style:l.ruleGroupHeader},w.createElement(h.RuleGroupHeaderComponents,{...o})),w.createElement(g.View,{style:l.ruleGroupBody},w.createElement(h.RuleGroupBodyComponents,{...o})))};M.displayName="RuleGroupNative";var Z=c(require("react")),Se=require("react"),q=require("react-native"),E=require("react-querybuilder");var j=t=>{let o=(0,E.useRule)(t),e=o.schema,l=(0,Se.useMemo)(()=>({rule:q.StyleSheet.flatten([r.rule,e.styles?.rule])}),[e.styles?.rule]);return Z.createElement(q.View,{style:l.rule,testID:E.TestID.rule},Z.createElement(E.RuleComponents,{...o}))};j.displayName="RuleNative";var K={addGroupAction:y,addRuleAction:y,cloneGroupAction:y,cloneRuleAction:y,combinatorSelector:d,dragHandle:(0,Ne.forwardRef)(()=>null),fieldSelector:d,inlineCombinator:L,lockGroupAction:y,lockRuleAction:y,notToggle:H,operatorSelector:d,removeGroupAction:y,removeRuleAction:y,rule:j,ruleGroup:M,shiftActions:k,valueEditor:V,valueSourceSelector:d},De={...K,combinatorSelector:S,fieldSelector:S,operatorSelector:S,valueEditor:Y,valueSourceSelector:S};var be=require("react"),xe=require("react-native"),ge=require("react-querybuilder"),he=(t,o)=>{let e=(0,ge.useQueryBuilderSchema)(t,o);return e.schema.styles=(0,be.useMemo)(()=>xe.StyleSheet.create(t.styles??{}),[t.styles]),e};var Ie=[],Le=({props:t,setup:o})=>{let e=he(t,o),{ruleGroup:l}=e.schema.controls;return B.createElement(T.QueryBuilderContext.Provider,{value:e.rqbContext},B.createElement(l,{ruleGroup:e.rootGroup,...e.combinatorPropObject,path:Ie,translations:e.translations,schema:e.schema,actions:e.actions,id:e.rootGroup.id,disabled:e.rootGroupDisabled,parentDisabled:e.queryDisabled,context:e.context}))},Oe=t=>{let o=(0,Te.useMemo)(()=>({...K,...t.controlElements}),[t.controlElements]),e=(0,T.useQueryBuilderSetup)({...t,controlElements:o});return B.createElement(Ge.Provider,{context:T.QueryBuilderStateContext,store:T.queryBuilderStore},B.createElement(Le,{props:t,setup:e}))};Oe.displayName="QueryBuilderNative";0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeShiftActions,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements});
//# sourceMappingURL=react-querybuilder_native.cjs.production.js.map

@@ -180,11 +180,12 @@ var __defProp = Object.defineProperty;

import { Button as Button2, StyleSheet as StyleSheet4, View as View3 } from "react-native";
import { pathsAreEqual, useShiftActions } from "react-querybuilder";
var NativeShiftActions = ({
path,
shiftUp,
shiftDown,
shiftUpDisabled,
shiftDownDisabled,
disabled,
labels,
testID,
lastInGroup,
schema: { combinators, dispatchQuery, getQuery, styles }
schema: { styles }
}) => {
const { shiftUp, shiftDown } = useShiftActions({ combinators, dispatchQuery, getQuery, path });
const style = React4.useMemo(

@@ -199,3 +200,3 @@ () => ({

{
disabled: pathsAreEqual([0], path),
disabled: disabled || shiftUpDisabled,
onPress: shiftUp,

@@ -208,3 +209,3 @@ accessibilityLabel: labels == null ? void 0 : labels.shiftUp,

{
disabled: lastInGroup && path.length === 1,
disabled: disabled || shiftDownDisabled,
onPress: shiftDown,

@@ -498,4 +499,3 @@ accessibilityLabel: labels == null ? void 0 : labels.shiftDown,

import * as React11 from "react";
import { useMemo as useMemo8 } from "react";
import { StyleSheet as StyleSheet9 } from "react-native";
import { useMemo as useMemo9 } from "react";
import {

@@ -505,3 +505,2 @@ QueryBuilderContext,

queryBuilderStore,
useQueryBuilderSchema,
useQueryBuilderSetup

@@ -526,3 +525,4 @@ } from "react-querybuilder";

var _a, _b, _c;
const rg = __spreadValues(__spreadValues({}, props), useRuleGroup(props));
const rg = useRuleGroup(props);
const schema = rg.schema;
const styles = useMemo6(

@@ -532,18 +532,14 @@ () => {

return {
ruleGroup: StyleSheet7.flatten([defaultNativeStyles.ruleGroup, (_a2 = rg.schema.styles) == null ? void 0 : _a2.ruleGroup]),
ruleGroup: StyleSheet7.flatten([defaultNativeStyles.ruleGroup, (_a2 = schema.styles) == null ? void 0 : _a2.ruleGroup]),
ruleGroupHeader: StyleSheet7.flatten([
defaultNativeStyles.ruleGroupHeader,
(_b2 = rg.schema.styles) == null ? void 0 : _b2.ruleGroupHeader
(_b2 = schema.styles) == null ? void 0 : _b2.ruleGroupHeader
]),
ruleGroupBody: StyleSheet7.flatten([
defaultNativeStyles.ruleGroupBody,
(_c2 = rg.schema.styles) == null ? void 0 : _c2.ruleGroupBody
(_c2 = schema.styles) == null ? void 0 : _c2.ruleGroupBody
])
};
},
[
(_a = rg.schema.styles) == null ? void 0 : _a.ruleGroup,
(_b = rg.schema.styles) == null ? void 0 : _b.ruleGroupBody,
(_c = rg.schema.styles) == null ? void 0 : _c.ruleGroupHeader
]
[(_a = schema.styles) == null ? void 0 : _a.ruleGroup, (_b = schema.styles) == null ? void 0 : _b.ruleGroupBody, (_c = schema.styles) == null ? void 0 : _c.ruleGroupHeader]
);

@@ -561,9 +557,10 @@ return /* @__PURE__ */ React9.createElement(View5, { style: styles.ruleGroup, testID: TestID3.ruleGroup }, /* @__PURE__ */ React9.createElement(View5, { style: styles.ruleGroupHeader }, /* @__PURE__ */ React9.createElement(RuleGroupHeaderComponents, __spreadValues({}, rg))), /* @__PURE__ */ React9.createElement(View5, { style: styles.ruleGroupBody }, /* @__PURE__ */ React9.createElement(RuleGroupBodyComponents, __spreadValues({}, rg))));

var _a;
const r = __spreadValues(__spreadValues({}, props), useRule(props));
const r = useRule(props);
const schema = r.schema;
const styles = useMemo7(
() => {
var _a2;
return { rule: StyleSheet8.flatten([defaultNativeStyles.rule, (_a2 = r.schema.styles) == null ? void 0 : _a2.rule]) };
return { rule: StyleSheet8.flatten([defaultNativeStyles.rule, (_a2 = schema.styles) == null ? void 0 : _a2.rule]) };
},
[(_a = r.schema.styles) == null ? void 0 : _a.rule]
[(_a = schema.styles) == null ? void 0 : _a.rule]
);

@@ -608,22 +605,25 @@ return /* @__PURE__ */ React10.createElement(View6, { style: styles.rule, testID: TestID4.rule }, /* @__PURE__ */ React10.createElement(RuleComponents, __spreadValues({}, r)));

// src/components/useQueryBuilderSchemaNative.ts
import { useMemo as useMemo8 } from "react";
import { StyleSheet as StyleSheet9 } from "react-native";
import { useQueryBuilderSchema } from "react-querybuilder";
var useQueryBuilderSchemaNative = (props, setup) => {
const qb = useQueryBuilderSchema(props, setup);
qb.schema.styles = useMemo8(
() => {
var _a;
return StyleSheet9.create((_a = props.styles) != null ? _a : {});
},
[props.styles]
);
return qb;
};
// src/components/QueryBuilderNative.tsx
var rootPath = [];
var QueryBuilderNative = (props) => {
const controlElements = useMemo8(
() => __spreadValues(__spreadValues({}, defaultNativeControlElements), props.controlElements),
[props.controlElements]
);
const setup = useQueryBuilderSetup(__spreadProps(__spreadValues({}, props), { controlElements }));
return /* @__PURE__ */ React11.createElement(Provider, { context: QueryBuilderStateContext, store: queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, __spreadProps(__spreadValues({}, props), { setup })));
};
var QueryBuilderNativeInternal = (allProps) => {
const _a = allProps, { setup } = _a, props = __objRest(_a, ["setup"]);
const qb = __spreadValues(__spreadValues({}, props), useQueryBuilderSchema(
props,
setup
));
qb.schema.styles = useMemo8(() => {
var _a2;
return StyleSheet9.create((_a2 = allProps.styles) != null ? _a2 : {});
}, [allProps.styles]);
var QueryBuilderNativeInternal = ({
props,
setup
}) => {
const qb = useQueryBuilderSchemaNative(props, setup);
const { ruleGroup: RuleGroupComponent } = qb.schema.controls;

@@ -633,3 +633,3 @@ return /* @__PURE__ */ React11.createElement(QueryBuilderContext.Provider, { value: qb.rqbContext }, /* @__PURE__ */ React11.createElement(

__spreadProps(__spreadValues({
ruleGroup: qb.rootQuery
ruleGroup: qb.rootGroup
}, qb.combinatorPropObject), {

@@ -640,4 +640,4 @@ path: rootPath,

actions: qb.actions,
id: qb.rootQuery.id,
disabled: !!qb.rootQuery.disabled || qb.queryDisabled,
id: qb.rootGroup.id,
disabled: qb.rootGroupDisabled,
parentDisabled: qb.queryDisabled,

@@ -648,2 +648,10 @@ context: qb.context

};
var QueryBuilderNative = (props) => {
const controlElements = useMemo9(
() => __spreadValues(__spreadValues({}, defaultNativeControlElements), props.controlElements),
[props.controlElements]
);
const setup = useQueryBuilderSetup(__spreadProps(__spreadValues({}, props), { controlElements }));
return /* @__PURE__ */ React11.createElement(Provider, { context: QueryBuilderStateContext, store: queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, { props, setup }));
};
QueryBuilderNative.displayName = "QueryBuilderNative";

@@ -650,0 +658,0 @@ export {

{
"name": "@react-querybuilder/native",
"description": "React Native components for react-querybuilder",
"version": "7.0.0-alpha.1",
"version": "7.0.0-alpha.2",
"publishConfig": {

@@ -51,3 +51,3 @@ "access": "public"

"react-native-web": "~0.19.9",
"react-querybuilder": "^7.0.0-alpha.1",
"react-querybuilder": "^7.0.0-alpha.2",
"react-redux": "^8.1.3",

@@ -61,6 +61,6 @@ "react-test-renderer": "^18.2.0",

"react": ">=16.8.0",
"react-querybuilder": "^7.0.0-alpha.1",
"react-querybuilder": "^7.0.0-alpha.2",
"react-redux": "^8.1.1"
},
"gitHead": "07b50090de711f00f3ddeeaddb5666706a6e7c9f"
"gitHead": "b2557742eb611820d453681120a2fc0f3d679692"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc