@react-querybuilder/native
Advanced tools
Comparing version 7.7.1-rc.0 to 7.7.1-rc.1
@@ -571,3 +571,3 @@ "use strict"; | ||
valueEditor: NativeValueEditorWeb, | ||
valueSelector: NativeValueSelector, | ||
valueSelector: NativeValueSelectorWeb, | ||
valueSourceSelector: NativeValueSelectorWeb | ||
@@ -574,0 +574,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var Ee=Object.create;var D=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Ae=(t,o)=>{for(var e in o)D(t,e,{get:o[e],enumerable:!0})},ne=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of we(o))!Ve.call(t,s)&&s!==e&&D(t,s,{get:()=>o[s],enumerable:!(i=Pe(o,s))||i.enumerable});return t};var c=(t,o,e)=>(e=t!=null?Ee(Be(t)):{},ne(o||!t||!t.__esModule?D(e,"default",{value:t,enumerable:!0}):e,t)),Ie=t=>ne(D({},"__esModule",{value:!0}),t);var Je={};Ae(Je,{NativeActionElement:()=>d,NativeInlineCombinator:()=>z,NativeNotToggle:()=>K,NativeShiftActions:()=>Y,NativeValueEditor:()=>V,NativeValueEditorWeb:()=>Z,NativeValueSelector:()=>v,NativeValueSelectorWeb:()=>g,QueryBuilderNative:()=>qe,RuleGroupNative:()=>ee,RuleNative:()=>oe,defaultNativeControlElements:()=>X,defaultNativeSelectStyles:()=>a,defaultNativeStyles:()=>l,defaultNativeWebControlElements:()=>De});module.exports=Ie(Je);var L=c(require("react")),G=require("react-native");var ue=require("react-native"),a={selector:{borderRadius:4,borderWidth:1,height:32,width:100,paddingLeft:4},option:{}},Qe={actionElement:{borderWidth:1,borderRadius:4,height:32,padding:8,paddingBottom:4,paddingTop:4},actionElementText:{},combinatorOption:a.option,combinatorSelector:a.selector,dragHandle:{},fieldOption:a.option,fieldSelector:a.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:a.option,operatorSelector:a.selector,rule:{flexDirection:"row",gap:10,alignItems:"center"},ruleGroup:{backgroundColor:"rgba(0, 75, 183, 0.2)",borderColor:"#8081a2",borderRadius:4,borderWidth:1,padding:10,gap:10},ruleGroupBody:{gap:10},ruleGroupHeader:{flexDirection:"row",gap:10,alignItems:"center"},shiftActions:{flexDirection:"column"},value:{...a.selector,width:150},valueEditorOption:a.option,valueEditorSelector:a.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:a.option,valueSourceSelector:a.selector},l=ue.StyleSheet.create(Qe);var d=({handleOnClick:t,label:o,disabled:e,disabledTranslation:i,testID:s,schema:u})=>L.createElement(G.Pressable,{testID:s,disabled:e&&!i,onPress:r=>t()},L.createElement(G.View,{style:l.actionElement},L.createElement(G.Text,{style:l.actionElementText},`${i&&e?i.label??"":o??""}`)));var U=c(require("react")),pe=require("react"),M=require("react-native"),$=require("react-querybuilder");var z=({component:t,path:o,...e})=>{let i=(0,pe.useMemo)(()=>({inlineCombinator:M.StyleSheet.flatten([l.inlineCombinator,e.schema.styles?.inlineCombinator])}),[e.schema.styles?.inlineCombinator]);return U.createElement(M.View,{style:i.inlineCombinator,key:"no-dnd",testID:$.TestID.inlineCombinator},U.createElement(t,{...e,path:o,testID:$.TestID.combinators}))};var H=c(require("react")),me=require("react"),y=require("react-native");var K=({handleOnChange:t,label:o,checked:e,disabled:i,schema:s,testID:u})=>{let r=(0,me.useMemo)(()=>({notToggle:y.StyleSheet.flatten([l.notToggle,s.styles?.notToggle]),notToggleLabel:y.StyleSheet.flatten([l.notToggleLabel,s.styles?.notToggleLabel]),notToggleSwitch:y.StyleSheet.flatten([l.notToggleSwitch,s.styles?.notToggleSwitch])}),[s.styles?.notToggle,s.styles?.notToggleLabel,s.styles?.notToggleSwitch]);return H.createElement(y.View,{style:r.notToggle,testID:u},H.createElement(y.Text,{style:r.notToggleLabel},o),H.createElement(y.Switch,{style:r.notToggleSwitch,disabled:i,value:e,onValueChange:m=>t(m)}))};var O=c(require("react")),C=require("react-native");var Y=({shiftUp:t,shiftDown:o,shiftUpDisabled:e,shiftDownDisabled:i,disabled:s,labels:u,testID:r,schema:{styles:m}})=>{let R=O.useMemo(()=>({shiftActions:C.StyleSheet.flatten([l.shiftActions,m?.shiftActions])}),[m?.shiftActions]);return O.createElement(C.View,{testID:r,style:R.shiftActions},O.createElement(C.Button,{disabled:s||e,onPress:t,accessibilityLabel:u?.shiftUp,title:u?.shiftUp}),O.createElement(C.Button,{disabled:s||i,onPress:o,accessibilityLabel:u?.shiftDown,title:u?.shiftDown}))};var b=c(require("react")),ce=require("react"),p=require("react-native"),F=require("react-querybuilder");var V=t=>{let{operator:o,value:e,handleOnChange:i,title:s,className:u,type:r="text",inputType:m="text",values:R=[],listsAsArrays:I,fieldData:W,disabled:k,separator:Fe=null,testID:w,selectorComponent:re=t.schema.controls.valueSelector,...S}=t,B=(0,ce.useMemo)(()=>({value:p.StyleSheet.flatten([l.value,S.schema.styles?.value]),valueEditorSwitch:p.StyleSheet.flatten([l.valueEditorSwitch,S.schema.styles?.valueEditorSwitch]),valueList:p.StyleSheet.flatten([l.valueList,S.schema.styles?.valueList])}),[S.schema.styles?.value,S.schema.styles?.valueEditorSwitch,S.schema.styles?.valueList]),{valueAsArray:le,multiValueHandler:ie,parseNumberMethod:Te}=(0,F.useValueEditor)(t);if(o==="null"||o==="notNull")return null;let _=W?.placeholder??"",se=["in","notIn"].includes(o)?"text":m==="number"?"decimal":m??"text";if((o==="between"||o==="notBetween")&&(r==="select"||r==="text")){let N=["from","to"].map((ae,Q)=>r==="text"?b.createElement(p.TextInput,{key:ae,style:B.value,inputMode:se,placeholder:_,value:le[Q]??"",onChangeText:j=>ie(j,Q)}):b.createElement(re,{key:ae,...S,handleOnChange:j=>ie(j,Q),className:u,disabled:k,value:le[Q]??(0,F.getFirstOption)(R),options:R,listsAsArrays:I}));return b.createElement(p.View,{testID:w,style:B.valueList},N[0],Fe,N[1])}switch(r){case"select":case"multiselect":return b.createElement(re,{...S,testID:w,className:u,title:s,handleOnChange:i,disabled:k,value:e,options:R,multiple:r==="multiselect",listsAsArrays:I});case"textarea":return b.createElement(p.TextInput,{testID:w,style:B.value,placeholder:_,value:e,onChangeText:N=>i(N)});case"switch":case"checkbox":return b.createElement(p.Switch,{testID:w,style:B.valueEditorSwitch,disabled:k,value:!!e,onValueChange:N=>i(N)})}return b.createElement(p.TextInput,{testID:w,style:B.value,inputMode:se,placeholder:_,value:e,onChangeText:N=>i((0,F.parseNumber)(N,{parseNumbers:Te}))})};var ve=c(require("react"));var fe=c(require("react"));var de=c(require("react")),ye=require("react"),n=require("react-native"),f=require("react-querybuilder");var v=({handleOnChange:t,options:o,value:e,disabled:i,multiple:s,listsAsArrays:u,schema:r,testID:m})=>{let R=(0,ye.useMemo)(()=>{switch(m){case f.TestID.combinators:return{selector:n.StyleSheet.flatten([l.combinatorSelector,r.styles?.combinatorSelector]),option:n.StyleSheet.flatten([l.combinatorOption,r.styles?.combinatorOption])};case f.TestID.fields:return{selector:n.StyleSheet.flatten([l.fieldSelector,r.styles?.fieldSelector]),option:n.StyleSheet.flatten([l.fieldOption,r.styles?.fieldOption])};case f.TestID.operators:return{selector:n.StyleSheet.flatten([l.operatorSelector,r.styles?.operatorSelector]),option:n.StyleSheet.flatten([l.operatorOption,r.styles?.operatorOption])};case f.TestID.valueSourceSelector:return{selector:n.StyleSheet.flatten([l.valueSourceSelector,r.styles?.valueSourceSelector]),option:n.StyleSheet.flatten([l.valueSourceOption,r.styles?.valueSourceOption])};case f.TestID.valueEditor:return{selector:n.StyleSheet.flatten([l.valueEditorSelector,r.styles?.valueEditorSelector]),option:n.StyleSheet.flatten([l.valueEditorOption,r.styles?.valueEditorOption])};default:}return n.StyleSheet.create(a)},[r.styles?.combinatorOption,r.styles?.combinatorSelector,r.styles?.fieldOption,r.styles?.fieldSelector,r.styles?.operatorOption,r.styles?.operatorSelector,r.styles?.valueEditorOption,r.styles?.valueEditorSelector,r.styles?.valueSourceOption,r.styles?.valueSourceSelector,m]),{onChange:I}=(0,f.useValueSelector)({handleOnChange:t,listsAsArrays:u,multiple:s,value:e}),W=s&&Array.isArray(e)?(0,f.joinWith)(e,","):e;return de.createElement(n.TextInput,{testID:m,"aria-disabled":i,style:R.selector,value:W,onChangeText:I})};var g=t=>fe.createElement(v,{...t});var Z=t=>ve.createElement(V,{...t,selectorComponent:g});var A=c(require("react")),Ge=require("react"),P=require("react-querybuilder"),Oe=require("react-redux");var be=require("react"),J=require("react-querybuilder");var T=c(require("react")),Se=require("react"),h=require("react-native"),x=require("react-querybuilder");var ee=t=>{let o=(0,x.useRuleGroup)(t),e=o.schema,i=(0,Se.useMemo)(()=>({ruleGroup:h.StyleSheet.flatten([l.ruleGroup,e.styles?.ruleGroup]),ruleGroupHeader:h.StyleSheet.flatten([l.ruleGroupHeader,e.styles?.ruleGroupHeader]),ruleGroupBody:h.StyleSheet.flatten([l.ruleGroupBody,e.styles?.ruleGroupBody])}),[e.styles?.ruleGroup,e.styles?.ruleGroupBody,e.styles?.ruleGroupHeader]);return T.createElement(h.View,{style:i.ruleGroup,testID:x.TestID.ruleGroup},T.createElement(h.View,{style:i.ruleGroupHeader},T.createElement(x.RuleGroupHeaderComponents,{...o})),T.createElement(h.View,{style:i.ruleGroupBody},T.createElement(x.RuleGroupBodyComponents,{...o})))};var te=c(require("react")),Ne=require("react"),q=require("react-native"),E=require("react-querybuilder");var oe=t=>{let o=(0,E.useRule)(t),e=o.schema,i=(0,Ne.useMemo)(()=>({rule:q.StyleSheet.flatten([l.rule,e.styles?.rule])}),[e.styles?.rule]);return te.createElement(q.View,{style:i.rule,testID:E.TestID.rule},te.createElement(E.RuleComponents,{...o}))};var X={actionElement:d,addGroupAction:d,addRuleAction:d,cloneGroupAction:d,cloneRuleAction:d,combinatorSelector:v,dragHandle:(0,be.forwardRef)(()=>null),fieldSelector:v,inlineCombinator:z,lockGroupAction:d,lockRuleAction:d,notToggle:K,operatorSelector:v,removeGroupAction:d,removeRuleAction:d,rule:oe,ruleGroup:ee,ruleGroupBodyElements:J.RuleGroupBodyComponents,ruleGroupHeaderElements:J.RuleGroupHeaderComponents,shiftActions:Y,valueEditor:V,valueSelector:v,valueSourceSelector:v},De={...X,combinatorSelector:g,fieldSelector:g,operatorSelector:g,valueEditor:Z,valueSelector:v,valueSourceSelector:g};var ge=require("react"),he=require("react-native"),xe=require("react-querybuilder"),Re=require("react-querybuilder"),Ce=t=>Le(t,(0,xe.useQueryBuilderSetup)(t)),Le=(t,o)=>{let e=(0,Re.useQueryBuilderSchema)(t,o),i=(0,ge.useMemo)(()=>he.StyleSheet.create(t.styles??{}),[t.styles]);return{...e,schema:{...e.schema,styles:i}}};var Me=[],He=({props:t})=>{let o=(0,Ge.useMemo)(()=>({...X,...t.controlElements}),[t.controlElements]),e=Ce({...t,controlElements:o}),{ruleGroup:i}=e.schema.controls;return A.createElement(P.QueryBuilderContext.Provider,{value:e.rqbContext},A.createElement(i,{ruleGroup:e.rootGroup,...e.combinatorPropObject,path:Me,translations:e.translations,schema:e.schema,actions:e.actions,id:e.rootGroup.id,disabled:e.rootGroupDisabled,parentDisabled:e.queryDisabled,context:t.context}))},qe=t=>A.createElement(Oe.Provider,{context:P.QueryBuilderStateContext,store:P.queryBuilderStore},A.createElement(He,{props:t}));0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeShiftActions,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements}); | ||
"use strict";var Ee=Object.create;var D=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Ae=(t,o)=>{for(var e in o)D(t,e,{get:o[e],enumerable:!0})},ne=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of we(o))!Ve.call(t,s)&&s!==e&&D(t,s,{get:()=>o[s],enumerable:!(i=Pe(o,s))||i.enumerable});return t};var c=(t,o,e)=>(e=t!=null?Ee(Be(t)):{},ne(o||!t||!t.__esModule?D(e,"default",{value:t,enumerable:!0}):e,t)),Ie=t=>ne(D({},"__esModule",{value:!0}),t);var Je={};Ae(Je,{NativeActionElement:()=>d,NativeInlineCombinator:()=>z,NativeNotToggle:()=>K,NativeShiftActions:()=>Y,NativeValueEditor:()=>V,NativeValueEditorWeb:()=>Z,NativeValueSelector:()=>v,NativeValueSelectorWeb:()=>S,QueryBuilderNative:()=>qe,RuleGroupNative:()=>ee,RuleNative:()=>oe,defaultNativeControlElements:()=>X,defaultNativeSelectStyles:()=>a,defaultNativeStyles:()=>l,defaultNativeWebControlElements:()=>De});module.exports=Ie(Je);var L=c(require("react")),G=require("react-native");var ue=require("react-native"),a={selector:{borderRadius:4,borderWidth:1,height:32,width:100,paddingLeft:4},option:{}},Qe={actionElement:{borderWidth:1,borderRadius:4,height:32,padding:8,paddingBottom:4,paddingTop:4},actionElementText:{},combinatorOption:a.option,combinatorSelector:a.selector,dragHandle:{},fieldOption:a.option,fieldSelector:a.selector,inlineCombinator:{},notToggle:{flexDirection:"row"},notToggleLabel:{},notToggleSwitch:{},operatorOption:a.option,operatorSelector:a.selector,rule:{flexDirection:"row",gap:10,alignItems:"center"},ruleGroup:{backgroundColor:"rgba(0, 75, 183, 0.2)",borderColor:"#8081a2",borderRadius:4,borderWidth:1,padding:10,gap:10},ruleGroupBody:{gap:10},ruleGroupHeader:{flexDirection:"row",gap:10,alignItems:"center"},shiftActions:{flexDirection:"column"},value:{...a.selector,width:150},valueEditorOption:a.option,valueEditorSelector:a.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:a.option,valueSourceSelector:a.selector},l=ue.StyleSheet.create(Qe);var d=({handleOnClick:t,label:o,disabled:e,disabledTranslation:i,testID:s,schema:u})=>L.createElement(G.Pressable,{testID:s,disabled:e&&!i,onPress:r=>t()},L.createElement(G.View,{style:l.actionElement},L.createElement(G.Text,{style:l.actionElementText},`${i&&e?i.label??"":o??""}`)));var U=c(require("react")),pe=require("react"),M=require("react-native"),$=require("react-querybuilder");var z=({component:t,path:o,...e})=>{let i=(0,pe.useMemo)(()=>({inlineCombinator:M.StyleSheet.flatten([l.inlineCombinator,e.schema.styles?.inlineCombinator])}),[e.schema.styles?.inlineCombinator]);return U.createElement(M.View,{style:i.inlineCombinator,key:"no-dnd",testID:$.TestID.inlineCombinator},U.createElement(t,{...e,path:o,testID:$.TestID.combinators}))};var H=c(require("react")),me=require("react"),y=require("react-native");var K=({handleOnChange:t,label:o,checked:e,disabled:i,schema:s,testID:u})=>{let r=(0,me.useMemo)(()=>({notToggle:y.StyleSheet.flatten([l.notToggle,s.styles?.notToggle]),notToggleLabel:y.StyleSheet.flatten([l.notToggleLabel,s.styles?.notToggleLabel]),notToggleSwitch:y.StyleSheet.flatten([l.notToggleSwitch,s.styles?.notToggleSwitch])}),[s.styles?.notToggle,s.styles?.notToggleLabel,s.styles?.notToggleSwitch]);return H.createElement(y.View,{style:r.notToggle,testID:u},H.createElement(y.Text,{style:r.notToggleLabel},o),H.createElement(y.Switch,{style:r.notToggleSwitch,disabled:i,value:e,onValueChange:m=>t(m)}))};var O=c(require("react")),C=require("react-native");var Y=({shiftUp:t,shiftDown:o,shiftUpDisabled:e,shiftDownDisabled:i,disabled:s,labels:u,testID:r,schema:{styles:m}})=>{let R=O.useMemo(()=>({shiftActions:C.StyleSheet.flatten([l.shiftActions,m?.shiftActions])}),[m?.shiftActions]);return O.createElement(C.View,{testID:r,style:R.shiftActions},O.createElement(C.Button,{disabled:s||e,onPress:t,accessibilityLabel:u?.shiftUp,title:u?.shiftUp}),O.createElement(C.Button,{disabled:s||i,onPress:o,accessibilityLabel:u?.shiftDown,title:u?.shiftDown}))};var g=c(require("react")),ce=require("react"),p=require("react-native"),F=require("react-querybuilder");var V=t=>{let{operator:o,value:e,handleOnChange:i,title:s,className:u,type:r="text",inputType:m="text",values:R=[],listsAsArrays:I,fieldData:W,disabled:k,separator:Fe=null,testID:w,selectorComponent:re=t.schema.controls.valueSelector,...N}=t,B=(0,ce.useMemo)(()=>({value:p.StyleSheet.flatten([l.value,N.schema.styles?.value]),valueEditorSwitch:p.StyleSheet.flatten([l.valueEditorSwitch,N.schema.styles?.valueEditorSwitch]),valueList:p.StyleSheet.flatten([l.valueList,N.schema.styles?.valueList])}),[N.schema.styles?.value,N.schema.styles?.valueEditorSwitch,N.schema.styles?.valueList]),{valueAsArray:le,multiValueHandler:ie,parseNumberMethod:Te}=(0,F.useValueEditor)(t);if(o==="null"||o==="notNull")return null;let _=W?.placeholder??"",se=["in","notIn"].includes(o)?"text":m==="number"?"decimal":m??"text";if((o==="between"||o==="notBetween")&&(r==="select"||r==="text")){let b=["from","to"].map((ae,Q)=>r==="text"?g.createElement(p.TextInput,{key:ae,style:B.value,inputMode:se,placeholder:_,value:le[Q]??"",onChangeText:j=>ie(j,Q)}):g.createElement(re,{key:ae,...N,handleOnChange:j=>ie(j,Q),className:u,disabled:k,value:le[Q]??(0,F.getFirstOption)(R),options:R,listsAsArrays:I}));return g.createElement(p.View,{testID:w,style:B.valueList},b[0],Fe,b[1])}switch(r){case"select":case"multiselect":return g.createElement(re,{...N,testID:w,className:u,title:s,handleOnChange:i,disabled:k,value:e,options:R,multiple:r==="multiselect",listsAsArrays:I});case"textarea":return g.createElement(p.TextInput,{testID:w,style:B.value,placeholder:_,value:e,onChangeText:b=>i(b)});case"switch":case"checkbox":return g.createElement(p.Switch,{testID:w,style:B.valueEditorSwitch,disabled:k,value:!!e,onValueChange:b=>i(b)})}return g.createElement(p.TextInput,{testID:w,style:B.value,inputMode:se,placeholder:_,value:e,onChangeText:b=>i((0,F.parseNumber)(b,{parseNumbers:Te}))})};var ve=c(require("react"));var fe=c(require("react"));var de=c(require("react")),ye=require("react"),n=require("react-native"),f=require("react-querybuilder");var v=({handleOnChange:t,options:o,value:e,disabled:i,multiple:s,listsAsArrays:u,schema:r,testID:m})=>{let R=(0,ye.useMemo)(()=>{switch(m){case f.TestID.combinators:return{selector:n.StyleSheet.flatten([l.combinatorSelector,r.styles?.combinatorSelector]),option:n.StyleSheet.flatten([l.combinatorOption,r.styles?.combinatorOption])};case f.TestID.fields:return{selector:n.StyleSheet.flatten([l.fieldSelector,r.styles?.fieldSelector]),option:n.StyleSheet.flatten([l.fieldOption,r.styles?.fieldOption])};case f.TestID.operators:return{selector:n.StyleSheet.flatten([l.operatorSelector,r.styles?.operatorSelector]),option:n.StyleSheet.flatten([l.operatorOption,r.styles?.operatorOption])};case f.TestID.valueSourceSelector:return{selector:n.StyleSheet.flatten([l.valueSourceSelector,r.styles?.valueSourceSelector]),option:n.StyleSheet.flatten([l.valueSourceOption,r.styles?.valueSourceOption])};case f.TestID.valueEditor:return{selector:n.StyleSheet.flatten([l.valueEditorSelector,r.styles?.valueEditorSelector]),option:n.StyleSheet.flatten([l.valueEditorOption,r.styles?.valueEditorOption])};default:}return n.StyleSheet.create(a)},[r.styles?.combinatorOption,r.styles?.combinatorSelector,r.styles?.fieldOption,r.styles?.fieldSelector,r.styles?.operatorOption,r.styles?.operatorSelector,r.styles?.valueEditorOption,r.styles?.valueEditorSelector,r.styles?.valueSourceOption,r.styles?.valueSourceSelector,m]),{onChange:I}=(0,f.useValueSelector)({handleOnChange:t,listsAsArrays:u,multiple:s,value:e}),W=s&&Array.isArray(e)?(0,f.joinWith)(e,","):e;return de.createElement(n.TextInput,{testID:m,"aria-disabled":i,style:R.selector,value:W,onChangeText:I})};var S=t=>fe.createElement(v,{...t});var Z=t=>ve.createElement(V,{...t,selectorComponent:S});var A=c(require("react")),Ge=require("react"),P=require("react-querybuilder"),Oe=require("react-redux");var be=require("react"),J=require("react-querybuilder");var T=c(require("react")),Se=require("react"),h=require("react-native"),x=require("react-querybuilder");var ee=t=>{let o=(0,x.useRuleGroup)(t),e=o.schema,i=(0,Se.useMemo)(()=>({ruleGroup:h.StyleSheet.flatten([l.ruleGroup,e.styles?.ruleGroup]),ruleGroupHeader:h.StyleSheet.flatten([l.ruleGroupHeader,e.styles?.ruleGroupHeader]),ruleGroupBody:h.StyleSheet.flatten([l.ruleGroupBody,e.styles?.ruleGroupBody])}),[e.styles?.ruleGroup,e.styles?.ruleGroupBody,e.styles?.ruleGroupHeader]);return T.createElement(h.View,{style:i.ruleGroup,testID:x.TestID.ruleGroup},T.createElement(h.View,{style:i.ruleGroupHeader},T.createElement(x.RuleGroupHeaderComponents,{...o})),T.createElement(h.View,{style:i.ruleGroupBody},T.createElement(x.RuleGroupBodyComponents,{...o})))};var te=c(require("react")),Ne=require("react"),q=require("react-native"),E=require("react-querybuilder");var oe=t=>{let o=(0,E.useRule)(t),e=o.schema,i=(0,Ne.useMemo)(()=>({rule:q.StyleSheet.flatten([l.rule,e.styles?.rule])}),[e.styles?.rule]);return te.createElement(q.View,{style:i.rule,testID:E.TestID.rule},te.createElement(E.RuleComponents,{...o}))};var X={actionElement:d,addGroupAction:d,addRuleAction:d,cloneGroupAction:d,cloneRuleAction:d,combinatorSelector:v,dragHandle:(0,be.forwardRef)(()=>null),fieldSelector:v,inlineCombinator:z,lockGroupAction:d,lockRuleAction:d,notToggle:K,operatorSelector:v,removeGroupAction:d,removeRuleAction:d,rule:oe,ruleGroup:ee,ruleGroupBodyElements:J.RuleGroupBodyComponents,ruleGroupHeaderElements:J.RuleGroupHeaderComponents,shiftActions:Y,valueEditor:V,valueSelector:v,valueSourceSelector:v},De={...X,combinatorSelector:S,fieldSelector:S,operatorSelector:S,valueEditor:Z,valueSelector:S,valueSourceSelector:S};var ge=require("react"),he=require("react-native"),xe=require("react-querybuilder"),Re=require("react-querybuilder"),Ce=t=>Le(t,(0,xe.useQueryBuilderSetup)(t)),Le=(t,o)=>{let e=(0,Re.useQueryBuilderSchema)(t,o),i=(0,ge.useMemo)(()=>he.StyleSheet.create(t.styles??{}),[t.styles]);return{...e,schema:{...e.schema,styles:i}}};var Me=[],He=({props:t})=>{let o=(0,Ge.useMemo)(()=>({...X,...t.controlElements}),[t.controlElements]),e=Ce({...t,controlElements:o}),{ruleGroup:i}=e.schema.controls;return A.createElement(P.QueryBuilderContext.Provider,{value:e.rqbContext},A.createElement(i,{ruleGroup:e.rootGroup,...e.combinatorPropObject,path:Me,translations:e.translations,schema:e.schema,actions:e.actions,id:e.rootGroup.id,disabled:e.rootGroupDisabled,parentDisabled:e.queryDisabled,context:t.context}))},qe=t=>A.createElement(Oe.Provider,{context:P.QueryBuilderStateContext,store:P.queryBuilderStore},A.createElement(He,{props:t}));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 |
@@ -603,3 +603,3 @@ var __defProp = Object.defineProperty; | ||
valueEditor: NativeValueEditorWeb, | ||
valueSelector: NativeValueSelector, | ||
valueSelector: NativeValueSelectorWeb, | ||
valueSourceSelector: NativeValueSelectorWeb | ||
@@ -606,0 +606,0 @@ }); |
{ | ||
"name": "@react-querybuilder/native", | ||
"description": "React Native components for react-querybuilder", | ||
"version": "7.7.1-rc.0", | ||
"version": "7.7.1-rc.1", | ||
"publishConfig": { | ||
@@ -52,3 +52,3 @@ "access": "public" | ||
"react-native-web": "~0.19.12", | ||
"react-querybuilder": "7.7.1-rc.0", | ||
"react-querybuilder": "7.7.1-rc.1", | ||
"react-redux": "^9.1.2", | ||
@@ -62,6 +62,6 @@ "react-test-renderer": "^18.3.1", | ||
"react": ">=18", | ||
"react-querybuilder": "7.7.1-rc.0", | ||
"react-querybuilder": "7.7.1-rc.1", | ||
"react-redux": "^9.1.0" | ||
}, | ||
"gitHead": "926c333065a2ad41d49b0732354bfdb76ac10ea1" | ||
"gitHead": "bb43af45775f5c806af47abd2bba944c96e4c651" | ||
} |
@@ -17,2 +17,52 @@ ## @react-querybuilder/native | ||
To render a React Native-compatible query builder, use `<QueryBuilderNative />` which accepts the same props `<QueryBuilder />`. | ||
To render a React Native-compatible query builder, use `QueryBuilderNative`. | ||
```tsx | ||
import { QueryBuilderNative } from '@react-querybuilder/native'; | ||
import { useState } from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import { type Field, formatQuery, type RuleGroupType } from 'react-querybuilder'; | ||
const styles = StyleSheet.create({ | ||
outer: { padding: 10, gap: 20 }, | ||
code: { fontFamily: 'monospace' }, | ||
}); | ||
const fields: Field[] = [ | ||
{ name: 'firstName', label: 'First Name' }, | ||
{ name: 'lastName', label: 'Last Name' }, | ||
]; | ||
export function App() { | ||
const [query, setQuery] = useState<RuleGroupType>({ combinator: 'and', rules: [] }); | ||
return ( | ||
<View style={styles.outer}> | ||
<QueryBuilderNative fields={fields} query={query} onQueryChange={setQuery} /> | ||
<Text style={styles.code}>{formatQuery(query, 'sql')}</Text> | ||
</View> | ||
); | ||
} | ||
``` | ||
`QueryBuilderNative` accepts the same props `QueryBuilder` and assigns the following props by default. | ||
| Export | `QueryBuilder` prop | | ||
| ------------------------------ | ---------------------------------- | | ||
| `defaultNativeControlElements` | `controlElements` | | ||
| `NativeActionElement` | `controlElements.actionElement` | | ||
| `NativeInlineCombinator` | `controlElements.inlineCombinator` | | ||
| `NativeNotToggle` | `controlElements.notToggle` | | ||
| `NativeShiftActions` | `controlElements.shiftActions` | | ||
| `NativeValueEditor` | `controlElements.valueEditor` | | ||
| `NativeValueSelector` | `controlElements.valueSelector` | | ||
| `RuleGroupNative` | `controlElements.ruleGroup` | | ||
| `RuleNative` | `controlElements.rule` | | ||
For `react-native-web`, assign `defaultNativeWebControlElements` to `controlElements` as in the example above. | ||
| Export | `QueryBuilder` prop | | ||
| --------------------------------- | ------------------------------- | | ||
| `defaultNativeWebControlElements` | `controlElements` | | ||
| `NativeValueEditorWeb` | `controlElements.valueEditor` | | ||
| `NativeValueSelectorWeb` | `controlElements.valueSelector` | |
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
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
287667
68