@react-querybuilder/native
Advanced tools
Comparing version 6.5.1 to 6.6.0-alpha.0
@@ -89,3 +89,3 @@ import * as React from 'react'; | ||
declare const QueryBuilderNative: { | ||
<RG extends RuleGroupType | RuleGroupTypeIC = RuleGroupType>(props: QueryBuilderNativeProps<RG>): React.JSX.Element; | ||
<RG extends RuleGroupType | RuleGroupTypeIC>(props: QueryBuilderNativeProps<RG>): React.JSX.Element; | ||
displayName: string; | ||
@@ -92,0 +92,0 @@ }; |
@@ -439,2 +439,3 @@ "use strict"; | ||
var import_react_querybuilder6 = require("react-querybuilder"); | ||
var import_react_redux = require("react-redux"); | ||
@@ -523,2 +524,3 @@ // src/components/defaults.ts | ||
// src/components/QueryBuilderNative.tsx | ||
var rootPath = []; | ||
var QueryBuilderNative = (props) => { | ||
@@ -529,13 +531,29 @@ const controlElements = (0, import_react8.useMemo)( | ||
); | ||
const qb = (0, import_react_querybuilder6.useQueryBuilder)({ ...props, controlElements }); | ||
qb.schema.styles = (0, import_react8.useMemo)(() => import_react_native9.StyleSheet.create(props.styles ?? {}), [props.styles]); | ||
const { ruleGroup: RuleGroupComponent } = controlElements; | ||
const setup = (0, import_react_querybuilder6.useQueryBuilderSetup)({ ...props, controlElements }); | ||
return /* @__PURE__ */ React10.createElement(import_react_redux.Provider, { store: import_react_querybuilder6.queryBuilderStore }, /* @__PURE__ */ React10.createElement(QueryBuilderNativeInternal, { ...props, setup })); | ||
}; | ||
var QueryBuilderNativeInternal = (allProps) => { | ||
const { setup, ...props } = allProps; | ||
const qb = { | ||
...props, | ||
...(0, import_react_querybuilder6.useQueryBuilderSchema)( | ||
props, | ||
setup | ||
) | ||
}; | ||
qb.schema.styles = (0, import_react8.useMemo)(() => import_react_native9.StyleSheet.create(allProps.styles ?? {}), [allProps.styles]); | ||
const { ruleGroup: RuleGroupComponent } = qb.schema.controls; | ||
return /* @__PURE__ */ React10.createElement(import_react_querybuilder6.QueryBuilderContext.Provider, { value: qb.rqbContext }, /* @__PURE__ */ React10.createElement( | ||
RuleGroupComponent, | ||
{ | ||
ruleGroup: qb.query, | ||
path: [], | ||
ruleGroup: qb.rootQuery, | ||
...qb.combinatorPropObject, | ||
path: rootPath, | ||
translations: qb.translations, | ||
schema: qb.schema, | ||
actions: qb.actions | ||
actions: qb.actions, | ||
id: qb.rootQuery.id, | ||
disabled: !!qb.rootQuery.disabled || qb.queryDisabled, | ||
parentDisabled: qb.queryDisabled, | ||
context: qb.context | ||
} | ||
@@ -542,0 +560,0 @@ )); |
@@ -89,3 +89,3 @@ import * as React from 'react'; | ||
declare const QueryBuilderNative: { | ||
<RG extends RuleGroupType | RuleGroupTypeIC = RuleGroupType>(props: QueryBuilderNativeProps<RG>): React.JSX.Element; | ||
<RG extends RuleGroupType | RuleGroupTypeIC>(props: QueryBuilderNativeProps<RG>): React.JSX.Element; | ||
displayName: string; | ||
@@ -92,0 +92,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var xe=Object.create;var B=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Ve=(e,t)=>{for(var o in t)B(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of he(t))!Re.call(e,i)&&i!==o&&B(e,i,{get:()=>t[i],enumerable:!(a=Te(t,i))||a.enumerable});return e};var d=(e,t,o)=>(o=e!=null?xe(Ge(e)):{},re(t||!e||!e.__esModule?B(o,"default",{value:e,enumerable:!0}):o,e)),Ce=e=>re(B({},"__esModule",{value:!0}),e);var Pe={};Ve(Pe,{NativeActionElement:()=>c,NativeInlineCombinator:()=>I,NativeNotToggle:()=>W,NativeValueEditor:()=>G,NativeValueEditorWeb:()=>J,NativeValueSelector:()=>y,NativeValueSelectorWeb:()=>S,QueryBuilderNative:()=>Ne,RuleGroupNative:()=>D,RuleNative:()=>Q,defaultNativeControlElements:()=>k,defaultNativeSelectStyles:()=>u,defaultNativeStyles:()=>r,defaultNativeWebControlElements:()=>Ee});module.exports=Ce(Pe);var le=d(require("react")),ie=require("react-native"),c=({handleOnClick:e,label:t,disabled:o,disabledTranslation:a,testID:i})=>le.createElement(ie.Button,{testID:i,disabled:o&&!a,title:a&&o?a.label??"":t??"",onPress:p=>e(p)});c.displayName="NativeActionElement";var F=d(require("react")),se=require("react"),A=require("react-native"),z=require("react-querybuilder");var ae=require("react-native"),u={selector:{borderWidth:1,height:32,width:100},option:{}},we={combinatorOption:u.option,combinatorSelector:u.selector,dragHandle:{},fieldOption:u.option,fieldSelector:u.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:u.option,operatorSelector:u.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},value:{borderWidth:1,height:32,width:150},valueEditorOption:u.option,valueEditorSelector:u.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:u.option,valueSourceSelector:u.selector},r=ae.StyleSheet.create(we);var I=({component:e,path:t,independentCombinators:o,...a})=>{let i=(0,se.useMemo)(()=>({inlineCombinator:A.StyleSheet.flatten([r.inlineCombinator,a.schema.styles?.inlineCombinator])}),[a.schema.styles?.inlineCombinator]);return F.createElement(A.View,{style:i.inlineCombinator,key:"no-dnd",testID:z.TestID.inlineCombinator},F.createElement(e,{...a,path:t,testID:z.TestID.combinators}))};I.displayName="NativeInlineCombinator";var L=d(require("react")),ne=require("react"),f=require("react-native");var W=({handleOnChange:e,label:t,checked:o,disabled:a,schema:i,testID:p})=>{let l=(0,ne.useMemo)(()=>({notToggle:f.StyleSheet.flatten([r.notToggle,i.styles?.notToggle]),notToggleLabel:f.StyleSheet.flatten([r.notToggleLabel,i.styles?.notToggleLabel]),notToggleSwitch:f.StyleSheet.flatten([r.notToggleSwitch,i.styles?.notToggleSwitch])}),[i.styles?.notToggle,i.styles?.notToggleLabel,i.styles?.notToggleSwitch]);return L.createElement(f.View,{style:l.notToggle,testID:p},L.createElement(f.Text,{style:l.notToggleLabel},t),L.createElement(f.Switch,{style:l.notToggleSwitch,disabled:a,value:o,onValueChange:s=>e(s)}))};W.displayName="NativeNotToggle";var b=d(require("react")),me=require("react"),m=require("react-native"),h=require("react-querybuilder");var ue=d(require("react")),pe=require("react"),n=require("react-native"),v=require("react-querybuilder");var y=({handleOnChange:e,options:t,value:o,disabled:a,multiple:i,listsAsArrays:p,schema:l,testID:s})=>{let C=(0,pe.useMemo)(()=>s===v.TestID.combinators?{selector:n.StyleSheet.flatten([r.combinatorSelector,l.styles?.combinatorSelector]),option:n.StyleSheet.flatten([r.combinatorOption,l.styles?.combinatorOption])}:s===v.TestID.fields?{selector:n.StyleSheet.flatten([r.fieldSelector,l.styles?.fieldSelector]),option:n.StyleSheet.flatten([r.fieldOption,l.styles?.fieldOption])}:s===v.TestID.operators?{selector:n.StyleSheet.flatten([r.operatorSelector,l.styles?.operatorSelector]),option:n.StyleSheet.flatten([r.operatorOption,l.styles?.operatorOption])}:s===v.TestID.valueSourceSelector?{selector:n.StyleSheet.flatten([r.valueSourceSelector,l.styles?.valueSourceSelector]),option:n.StyleSheet.flatten([r.valueSourceOption,l.styles?.valueSourceOption])}:s===v.TestID.valueEditor?{selector:n.StyleSheet.flatten([r.valueEditorSelector,l.styles?.valueEditorSelector]),option:n.StyleSheet.flatten([r.valueEditorOption,l.styles?.valueEditorOption])}:n.StyleSheet.create(u),[l.styles?.combinatorOption,l.styles?.combinatorSelector,l.styles?.fieldOption,l.styles?.fieldSelector,l.styles?.operatorOption,l.styles?.operatorSelector,l.styles?.valueEditorOption,l.styles?.valueEditorSelector,l.styles?.valueSourceOption,l.styles?.valueSourceSelector,s]),{onChange:P}=(0,v.useValueSelector)({handleOnChange:e,listsAsArrays:p,multiple:i,value:o}),q=i&&Array.isArray(o)?(0,v.joinWith)(o,","):o;return ue.createElement(n.TextInput,{testID:s,"aria-disabled":a,style:C.selector,value:q,onChangeText:P})};y.displayName="NativeValueSelector";var G=({operator:e,value:t,handleOnChange:o,title:a,className:i,type:p="text",inputType:l="text",values:s=[],listsAsArrays:C,parseNumbers:P,fieldData:q,disabled:j,separator:ge=null,skipHook:be=!1,testID:w,selectorComponent:Z=y,...N})=>{let E=(0,me.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:$,multiValueHandler:ee}=(0,h.useValueEditor)({skipHook:be,handleOnChange:o,inputType:l,operator:e,value:t,type:p,listsAsArrays:C,parseNumbers:P,values:s});if(e==="null"||e==="notNull")return null;let K=q?.placeholder??"",te="default";if((e==="between"||e==="notBetween")&&(p==="select"||p==="text")){let g=["from","to"].map((oe,O)=>p==="text"?b.createElement(m.TextInput,{key:oe,style:E.value,keyboardType:te,placeholder:K,value:$[O]??"",onChangeText:_=>ee(_,O)}):b.createElement(Z,{...N,key:oe,handleOnChange:_=>ee(_,O),className:i,disabled:j,value:$[O]??(0,h.getFirstOption)(s),options:s,listsAsArrays:C}));return b.createElement(m.View,{testID:w,style:E.valueList},g[0],ge,g[1])}switch(p){case"select":case"multiselect":return b.createElement(Z,{...N,testID:w,className:i,title:a,handleOnChange:o,disabled:j,value:t,options:s,multiple:p==="multiselect",listsAsArrays:C});case"textarea":return b.createElement(m.TextInput,{testID:w,style:E.value,placeholder:K,value:t,onChangeText:g=>o(g)});case"switch":case"checkbox":return b.createElement(m.Switch,{testID:w,style:E.valueEditorSwitch,disabled:j,value:!!t,onValueChange:g=>o(g)})}return b.createElement(m.TextInput,{testID:w,style:E.value,keyboardType:te,placeholder:K,value:t,onChangeText:g=>o((0,h.parseNumber)(g,{parseNumbers:P}))})};G.displayName="NativeValueEditor";var ye=d(require("react"));var ce=d(require("react"));var S=e=>ce.createElement(y,{...e});S.displayName="NativeValueSelectorWeb";var J=e=>ye.createElement(G,{...e,selectorComponent:S});var X=d(require("react")),Y=require("react"),Se=require("react-native"),M=require("react-querybuilder");var ve=require("react");var R=d(require("react")),de=require("react"),x=require("react-native"),T=require("react-querybuilder");var D=e=>{let t={...e,...(0,T.useRuleGroup)(e)},o=(0,de.useMemo)(()=>({ruleGroup:x.StyleSheet.flatten([r.ruleGroup,t.schema.styles?.ruleGroup]),ruleGroupHeader:x.StyleSheet.flatten([r.ruleGroupHeader,t.schema.styles?.ruleGroupHeader]),ruleGroupBody:x.StyleSheet.flatten([r.ruleGroupBody,t.schema.styles?.ruleGroupBody])}),[t.schema.styles?.ruleGroup,t.schema.styles?.ruleGroupBody,t.schema.styles?.ruleGroupHeader]);return R.createElement(x.View,{style:o.ruleGroup,testID:T.TestID.ruleGroup},R.createElement(x.View,{style:o.ruleGroupHeader},R.createElement(T.RuleGroupHeaderComponents,{...t})),R.createElement(x.View,{style:o.ruleGroupBody},R.createElement(T.RuleGroupBodyComponents,{...t})))};D.displayName="RuleGroupNative";var U=d(require("react")),fe=require("react"),H=require("react-native"),V=require("react-querybuilder");var Q=e=>{let t={...e,...(0,V.useRule)(e)},o=(0,fe.useMemo)(()=>({rule:H.StyleSheet.flatten([r.rule,t.schema.styles?.rule])}),[t.schema.styles?.rule]);return U.createElement(H.View,{style:o.rule,testID:V.TestID.rule},U.createElement(V.RuleComponents,{...t}))};Q.displayName="RuleNative";var k={addGroupAction:c,addRuleAction:c,cloneGroupAction:c,cloneRuleAction:c,combinatorSelector:y,dragHandle:(0,ve.forwardRef)(()=>null),fieldSelector:y,inlineCombinator:I,lockGroupAction:c,lockRuleAction:c,notToggle:W,operatorSelector:y,removeGroupAction:c,removeRuleAction:c,rule:Q,ruleGroup:D,valueEditor:G,valueSourceSelector:y},Ee={...k,combinatorSelector:S,fieldSelector:S,operatorSelector:S,valueEditor:J,valueSourceSelector:S};var Ne=e=>{let t=(0,Y.useMemo)(()=>({...k,...e.controlElements}),[e.controlElements]),o=(0,M.useQueryBuilder)({...e,controlElements:t});o.schema.styles=(0,Y.useMemo)(()=>Se.StyleSheet.create(e.styles??{}),[e.styles]);let{ruleGroup:a}=t;return X.createElement(M.QueryBuilderContext.Provider,{value:o.rqbContext},X.createElement(a,{ruleGroup:o.query,path:[],translations:o.translations,schema:o.schema,actions:o.actions}))};Ne.displayName="QueryBuilderNative";0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements}); | ||
"use strict";var Te=Object.create;var Q=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var o in t)Q(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Re(t))!Ve.call(e,a)&&a!==o&&Q(e,a,{get:()=>t[a],enumerable:!(r=he(t,a))||r.enumerable});return e};var d=(e,t,o)=>(o=e!=null?Te(Ge(e)):{},re(t||!e||!e.__esModule?Q(o,"default",{value:e,enumerable:!0}):o,e)),we=e=>re(Q({},"__esModule",{value:!0}),e);var Ae={};Ce(Ae,{NativeActionElement:()=>c,NativeInlineCombinator:()=>D,NativeNotToggle:()=>W,NativeValueEditor:()=>G,NativeValueEditorWeb:()=>U,NativeValueSelector:()=>y,NativeValueSelectorWeb:()=>S,QueryBuilderNative:()=>ge,RuleGroupNative:()=>H,RuleNative:()=>q,defaultNativeControlElements:()=>M,defaultNativeSelectStyles:()=>u,defaultNativeStyles:()=>l,defaultNativeWebControlElements:()=>Pe});module.exports=we(Ae);var le=d(require("react")),ie=require("react-native"),c=({handleOnClick:e,label:t,disabled:o,disabledTranslation:r,testID:a})=>le.createElement(ie.Button,{testID:a,disabled:o&&!r,title:r&&o?r.label??"":t??"",onPress:p=>e(p)});c.displayName="NativeActionElement";var z=d(require("react")),se=require("react"),I=require("react-native"),J=require("react-querybuilder");var ae=require("react-native"),u={selector:{borderWidth:1,height:32,width:100},option:{}},Ee={combinatorOption:u.option,combinatorSelector:u.selector,dragHandle:{},fieldOption:u.option,fieldSelector:u.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:u.option,operatorSelector:u.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},value:{borderWidth:1,height:32,width:150},valueEditorOption:u.option,valueEditorSelector:u.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:u.option,valueSourceSelector:u.selector},l=ae.StyleSheet.create(Ee);var D=({component:e,path:t,independentCombinators:o,...r})=>{let a=(0,se.useMemo)(()=>({inlineCombinator:I.StyleSheet.flatten([l.inlineCombinator,r.schema.styles?.inlineCombinator])}),[r.schema.styles?.inlineCombinator]);return z.createElement(I.View,{style:a.inlineCombinator,key:"no-dnd",testID:J.TestID.inlineCombinator},z.createElement(e,{...r,path:t,testID:J.TestID.combinators}))};D.displayName="NativeInlineCombinator";var L=d(require("react")),ne=require("react"),f=require("react-native");var W=({handleOnChange:e,label:t,checked:o,disabled:r,schema:a,testID:p})=>{let i=(0,ne.useMemo)(()=>({notToggle:f.StyleSheet.flatten([l.notToggle,a.styles?.notToggle]),notToggleLabel:f.StyleSheet.flatten([l.notToggleLabel,a.styles?.notToggleLabel]),notToggleSwitch:f.StyleSheet.flatten([l.notToggleSwitch,a.styles?.notToggleSwitch])}),[a.styles?.notToggle,a.styles?.notToggleLabel,a.styles?.notToggleSwitch]);return L.createElement(f.View,{style:i.notToggle,testID:p},L.createElement(f.Text,{style:i.notToggleLabel},t),L.createElement(f.Switch,{style:i.notToggleSwitch,disabled:r,value:o,onValueChange:s=>e(s)}))};W.displayName="NativeNotToggle";var b=d(require("react")),me=require("react"),m=require("react-native"),R=require("react-querybuilder");var ue=d(require("react")),pe=require("react"),n=require("react-native"),v=require("react-querybuilder");var y=({handleOnChange:e,options:t,value:o,disabled:r,multiple:a,listsAsArrays:p,schema:i,testID:s})=>{let w=(0,pe.useMemo)(()=>s===v.TestID.combinators?{selector:n.StyleSheet.flatten([l.combinatorSelector,i.styles?.combinatorSelector]),option:n.StyleSheet.flatten([l.combinatorOption,i.styles?.combinatorOption])}:s===v.TestID.fields?{selector:n.StyleSheet.flatten([l.fieldSelector,i.styles?.fieldSelector]),option:n.StyleSheet.flatten([l.fieldOption,i.styles?.fieldOption])}:s===v.TestID.operators?{selector:n.StyleSheet.flatten([l.operatorSelector,i.styles?.operatorSelector]),option:n.StyleSheet.flatten([l.operatorOption,i.styles?.operatorOption])}:s===v.TestID.valueSourceSelector?{selector:n.StyleSheet.flatten([l.valueSourceSelector,i.styles?.valueSourceSelector]),option:n.StyleSheet.flatten([l.valueSourceOption,i.styles?.valueSourceOption])}:s===v.TestID.valueEditor?{selector:n.StyleSheet.flatten([l.valueEditorSelector,i.styles?.valueEditorSelector]),option:n.StyleSheet.flatten([l.valueEditorOption,i.styles?.valueEditorOption])}:n.StyleSheet.create(u),[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,s]),{onChange:O}=(0,v.useValueSelector)({handleOnChange:e,listsAsArrays:p,multiple:a,value:o}),j=a&&Array.isArray(o)?(0,v.joinWith)(o,","):o;return ue.createElement(n.TextInput,{testID:s,"aria-disabled":r,style:w.selector,value:j,onChangeText:O})};y.displayName="NativeValueSelector";var G=({operator:e,value:t,handleOnChange:o,title:r,className:a,type:p="text",inputType:i="text",values:s=[],listsAsArrays:w,parseNumbers:O,fieldData:j,disabled:K,separator:be=null,skipHook:xe=!1,testID:E,selectorComponent:Z=y,...N})=>{let P=(0,me.useMemo)(()=>({value:m.StyleSheet.flatten([l.value,N.schema.styles?.value]),valueEditorSwitch:m.StyleSheet.flatten([l.valueEditorSwitch,N.schema.styles?.valueEditorSwitch]),valueList:m.StyleSheet.flatten([l.valueList,N.schema.styles?.valueList])}),[N.schema.styles?.value,N.schema.styles?.valueEditorSwitch,N.schema.styles?.valueList]),{valueAsArray:$,multiValueHandler:ee}=(0,R.useValueEditor)({skipHook:xe,handleOnChange:o,inputType:i,operator:e,value:t,type:p,listsAsArrays:w,parseNumbers:O,values:s});if(e==="null"||e==="notNull")return null;let _=j?.placeholder??"",te="default";if((e==="between"||e==="notBetween")&&(p==="select"||p==="text")){let g=["from","to"].map((oe,A)=>p==="text"?b.createElement(m.TextInput,{key:oe,style:P.value,keyboardType:te,placeholder:_,value:$[A]??"",onChangeText:F=>ee(F,A)}):b.createElement(Z,{...N,key:oe,handleOnChange:F=>ee(F,A),className:a,disabled:K,value:$[A]??(0,R.getFirstOption)(s),options:s,listsAsArrays:w}));return b.createElement(m.View,{testID:E,style:P.valueList},g[0],be,g[1])}switch(p){case"select":case"multiselect":return b.createElement(Z,{...N,testID:E,className:a,title:r,handleOnChange:o,disabled:K,value:t,options:s,multiple:p==="multiselect",listsAsArrays:w});case"textarea":return b.createElement(m.TextInput,{testID:E,style:P.value,placeholder:_,value:t,onChangeText:g=>o(g)});case"switch":case"checkbox":return b.createElement(m.Switch,{testID:E,style:P.valueEditorSwitch,disabled:K,value:!!t,onValueChange:g=>o(g)})}return b.createElement(m.TextInput,{testID:E,style:P.value,keyboardType:te,placeholder:_,value:t,onChangeText:g=>o((0,R.parseNumber)(g,{parseNumbers:O}))})};G.displayName="NativeValueEditor";var ye=d(require("react"));var ce=d(require("react"));var S=e=>ce.createElement(y,{...e});S.displayName="NativeValueSelectorWeb";var U=e=>ye.createElement(G,{...e,selectorComponent:S});var B=d(require("react")),Y=require("react"),Se=require("react-native"),h=require("react-querybuilder"),Ne=require("react-redux");var ve=require("react");var V=d(require("react")),de=require("react"),x=require("react-native"),T=require("react-querybuilder");var H=e=>{let t={...e,...(0,T.useRuleGroup)(e)},o=(0,de.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 V.createElement(x.View,{style:o.ruleGroup,testID:T.TestID.ruleGroup},V.createElement(x.View,{style:o.ruleGroupHeader},V.createElement(T.RuleGroupHeaderComponents,{...t})),V.createElement(x.View,{style:o.ruleGroupBody},V.createElement(T.RuleGroupBodyComponents,{...t})))};H.displayName="RuleGroupNative";var X=d(require("react")),fe=require("react"),k=require("react-native"),C=require("react-querybuilder");var q=e=>{let t={...e,...(0,C.useRule)(e)},o=(0,fe.useMemo)(()=>({rule:k.StyleSheet.flatten([l.rule,t.schema.styles?.rule])}),[t.schema.styles?.rule]);return X.createElement(k.View,{style:o.rule,testID:C.TestID.rule},X.createElement(C.RuleComponents,{...t}))};q.displayName="RuleNative";var M={addGroupAction:c,addRuleAction:c,cloneGroupAction:c,cloneRuleAction:c,combinatorSelector:y,dragHandle:(0,ve.forwardRef)(()=>null),fieldSelector:y,inlineCombinator:D,lockGroupAction:c,lockRuleAction:c,notToggle:W,operatorSelector:y,removeGroupAction:c,removeRuleAction:c,rule:q,ruleGroup:H,valueEditor:G,valueSourceSelector:y},Pe={...M,combinatorSelector:S,fieldSelector:S,operatorSelector:S,valueEditor:U,valueSourceSelector:S};var Be=[],ge=e=>{let t=(0,Y.useMemo)(()=>({...M,...e.controlElements}),[e.controlElements]),o=(0,h.useQueryBuilderSetup)({...e,controlElements:t});return B.createElement(Ne.Provider,{store:h.queryBuilderStore},B.createElement(Oe,{...e,setup:o}))},Oe=e=>{let{setup:t,...o}=e,r={...o,...(0,h.useQueryBuilderSchema)(o,t)};r.schema.styles=(0,Y.useMemo)(()=>Se.StyleSheet.create(e.styles??{}),[e.styles]);let{ruleGroup:a}=r.schema.controls;return B.createElement(h.QueryBuilderContext.Provider,{value:r.rqbContext},B.createElement(a,{ruleGroup:r.rootQuery,...r.combinatorPropObject,path:Be,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}))};ge.displayName="QueryBuilderNative";0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements}); | ||
//# sourceMappingURL=react-querybuilder_native.cjs.production.js.map |
@@ -458,3 +458,9 @@ var __defProp = Object.defineProperty; | ||
import { StyleSheet as StyleSheet8 } from "react-native"; | ||
import { QueryBuilderContext, useQueryBuilder } from "react-querybuilder"; | ||
import { | ||
QueryBuilderContext, | ||
queryBuilderStore, | ||
useQueryBuilderSchema, | ||
useQueryBuilderSetup | ||
} from "react-querybuilder"; | ||
import { Provider } from "react-redux"; | ||
@@ -555,2 +561,3 @@ // src/components/defaults.ts | ||
// src/components/QueryBuilderNative.tsx | ||
var rootPath = []; | ||
var QueryBuilderNative = (props) => { | ||
@@ -561,17 +568,30 @@ const controlElements = useMemo7( | ||
); | ||
const qb = useQueryBuilder(__spreadProps(__spreadValues({}, props), { controlElements })); | ||
const setup = useQueryBuilderSetup(__spreadProps(__spreadValues({}, props), { controlElements })); | ||
return /* @__PURE__ */ React10.createElement(Provider, { store: queryBuilderStore }, /* @__PURE__ */ React10.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 = useMemo7(() => { | ||
var _a; | ||
return StyleSheet8.create((_a = props.styles) != null ? _a : {}); | ||
}, [props.styles]); | ||
const { ruleGroup: RuleGroupComponent } = controlElements; | ||
var _a2; | ||
return StyleSheet8.create((_a2 = allProps.styles) != null ? _a2 : {}); | ||
}, [allProps.styles]); | ||
const { ruleGroup: RuleGroupComponent } = qb.schema.controls; | ||
return /* @__PURE__ */ React10.createElement(QueryBuilderContext.Provider, { value: qb.rqbContext }, /* @__PURE__ */ React10.createElement( | ||
RuleGroupComponent, | ||
{ | ||
ruleGroup: qb.query, | ||
path: [], | ||
__spreadProps(__spreadValues({ | ||
ruleGroup: qb.rootQuery | ||
}, qb.combinatorPropObject), { | ||
path: rootPath, | ||
translations: qb.translations, | ||
schema: qb.schema, | ||
actions: qb.actions | ||
} | ||
actions: qb.actions, | ||
id: qb.rootQuery.id, | ||
disabled: !!qb.rootQuery.disabled || qb.queryDisabled, | ||
parentDisabled: qb.queryDisabled, | ||
context: qb.context | ||
}) | ||
)); | ||
@@ -578,0 +598,0 @@ }; |
{ | ||
"name": "@react-querybuilder/native", | ||
"description": "React Native components for react-querybuilder", | ||
"version": "6.5.1", | ||
"version": "6.6.0-alpha.0", | ||
"publishConfig": { | ||
@@ -43,4 +43,4 @@ "access": "public" | ||
"@testing-library/jest-native": "^5.4.2", | ||
"@testing-library/react-native": "^12.1.2", | ||
"@types/react": "^18.2.14", | ||
"@testing-library/react-native": "^12.2.0", | ||
"@types/react": "^18.2.18", | ||
"@types/react-test-renderer": "^18.0.0", | ||
@@ -50,15 +50,17 @@ "@vitejs/plugin-react-swc": "^3.3.2", | ||
"react-dom": "^18.2.0", | ||
"react-native": "~0.72.0", | ||
"react-native-web": "~0.19.5", | ||
"react-querybuilder": "^6.5.1", | ||
"react-native": "~0.72.3", | ||
"react-native-web": "~0.19.7", | ||
"react-querybuilder": "^6.6.0-alpha.0", | ||
"react-redux": "^8.1.2", | ||
"react-test-renderer": "^18.2.0", | ||
"rollup-plugin-visualizer": "^5.9.2", | ||
"typescript": "^5.1.3", | ||
"vite": "^4.3.9" | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.8" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8.0", | ||
"react-querybuilder": "^6.5.1" | ||
"react-querybuilder": "^6.6.0-alpha.0", | ||
"react-redux": "^8.1.1" | ||
}, | ||
"gitHead": "c86d6699f6c2b060862f2259fe90585fa5f73fa5" | ||
"gitHead": "263e6810cca032c7e6ec127dabd47e6162316808" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262539
20
1967
3
16
2
2