@react-querybuilder/native
Advanced tools
Comparing version 7.6.1 to 7.8.0-alpha.0
@@ -53,32 +53,26 @@ "use strict"; | ||
var React = __toESM(require("react")); | ||
var import_react_native = require("react-native"); | ||
var NativeActionElement = ({ | ||
handleOnClick, | ||
label, | ||
disabled, | ||
disabledTranslation, | ||
testID | ||
}) => /* @__PURE__ */ React.createElement( | ||
import_react_native.Button, | ||
{ | ||
testID, | ||
disabled: disabled && !disabledTranslation, | ||
title: `${disabledTranslation && disabled ? disabledTranslation.label ?? "" : label ?? ""}`, | ||
onPress: (_e) => handleOnClick() | ||
} | ||
); | ||
var import_react_native2 = require("react-native"); | ||
// src/components/NativeInlineCombinator.tsx | ||
var React2 = __toESM(require("react")); | ||
var import_react = require("react"); | ||
var import_react_native3 = require("react-native"); | ||
var import_react_querybuilder = require("react-querybuilder"); | ||
// src/styles.ts | ||
var import_react_native2 = require("react-native"); | ||
var import_react_native = require("react-native"); | ||
var defaultNativeSelectStyles = { | ||
selector: { borderWidth: 1, height: 32, width: 100 }, | ||
selector: { | ||
borderRadius: 4, | ||
borderWidth: 1, | ||
height: 32, | ||
width: 100, | ||
paddingLeft: 4 | ||
}, | ||
option: {} | ||
}; | ||
var defaultStylesObject = { | ||
actionElement: { | ||
borderWidth: 1, | ||
borderRadius: 4, | ||
height: 32, | ||
padding: 8, | ||
paddingBottom: 4, | ||
paddingTop: 4 | ||
}, | ||
actionElementText: {}, | ||
combinatorOption: defaultNativeSelectStyles.option, | ||
@@ -112,3 +106,3 @@ combinatorSelector: defaultNativeSelectStyles.selector, | ||
shiftActions: { flexDirection: "column" }, | ||
value: { borderWidth: 1, height: 32, width: 150 }, | ||
value: { ...defaultNativeSelectStyles.selector, width: 150 }, | ||
valueEditorOption: defaultNativeSelectStyles.option, | ||
@@ -121,5 +115,33 @@ valueEditorSelector: defaultNativeSelectStyles.selector, | ||
}; | ||
var defaultNativeStyles = import_react_native2.StyleSheet.create(defaultStylesObject); | ||
var defaultNativeStyles = import_react_native.StyleSheet.create(defaultStylesObject); | ||
// src/components/NativeActionElement.tsx | ||
var NativeActionElement = ({ | ||
handleOnClick, | ||
label, | ||
disabled, | ||
disabledTranslation, | ||
testID, | ||
schema: _schema | ||
}) => /* @__PURE__ */ React.createElement( | ||
import_react_native2.Pressable, | ||
{ | ||
testID, | ||
disabled: disabled && !disabledTranslation, | ||
onPress: (_e) => handleOnClick() | ||
}, | ||
/* @__PURE__ */ React.createElement(import_react_native2.View, { style: defaultNativeStyles.actionElement }, /* @__PURE__ */ React.createElement( | ||
import_react_native2.Text, | ||
{ | ||
style: defaultNativeStyles.actionElementText | ||
}, | ||
`${disabledTranslation && disabled ? disabledTranslation.label ?? "" : label ?? ""}` | ||
)) | ||
); | ||
// src/components/NativeInlineCombinator.tsx | ||
var React2 = __toESM(require("react")); | ||
var import_react = require("react"); | ||
var import_react_native3 = require("react-native"); | ||
var import_react_querybuilder = require("react-querybuilder"); | ||
var NativeInlineCombinator = ({ | ||
@@ -358,3 +380,3 @@ component: CombinatorSelectorComponent, | ||
); | ||
const { valueAsArray, multiValueHandler } = (0, import_react_querybuilder3.useValueEditor)({ | ||
const { valueAsArray, multiValueHandler, parseNumberMethod } = (0, import_react_querybuilder3.useValueEditor)({ | ||
skipHook, | ||
@@ -374,3 +396,3 @@ handleOnChange, | ||
const placeHolderText = fieldData?.placeholder ?? ""; | ||
const keyboardType = "default"; | ||
const inputMode = ["in", "notIn"].includes(operator) ? "text" : inputType === "number" ? "decimal" : inputType ?? "text"; | ||
if ((operator === "between" || operator === "notBetween") && (type === "select" || type === "text")) { | ||
@@ -384,3 +406,3 @@ const editors = ["from", "to"].map((key, i) => { | ||
style: styles.value, | ||
keyboardType, | ||
inputMode, | ||
placeholder: placeHolderText, | ||
@@ -395,4 +417,4 @@ value: valueAsArray[i] ?? "", | ||
{ | ||
key, | ||
...props, | ||
key, | ||
handleOnChange: (v) => multiValueHandler(v, i), | ||
@@ -456,6 +478,6 @@ className, | ||
style: styles.value, | ||
keyboardType, | ||
inputMode, | ||
placeholder: placeHolderText, | ||
value, | ||
onChangeText: (v) => handleOnChange((0, import_react_querybuilder3.parseNumber)(v, { parseNumbers })) | ||
onChangeText: (v) => handleOnChange((0, import_react_querybuilder3.parseNumber)(v, { parseNumbers: parseNumberMethod })) | ||
} | ||
@@ -478,3 +500,3 @@ ); | ||
var import_react9 = require("react"); | ||
var import_react_querybuilder7 = require("react-querybuilder"); | ||
var import_react_querybuilder9 = require("react-querybuilder"); | ||
var import_react_redux = require("react-redux"); | ||
@@ -484,2 +506,3 @@ | ||
var import_react7 = require("react"); | ||
var import_react_querybuilder6 = require("react-querybuilder"); | ||
@@ -549,2 +572,4 @@ // src/components/RuleGroupNative.tsx | ||
ruleGroup: RuleGroupNative, | ||
ruleGroupBodyElements: import_react_querybuilder6.RuleGroupBodyComponents, | ||
ruleGroupHeaderElements: import_react_querybuilder6.RuleGroupHeaderComponents, | ||
shiftActions: NativeShiftActions, | ||
@@ -565,8 +590,10 @@ valueEditor: NativeValueEditor, | ||
// src/components/useQueryBuilderSchemaNative.ts | ||
// src/components/useQueryBuilderNative.ts | ||
var import_react8 = require("react"); | ||
var import_react_native10 = require("react-native"); | ||
var import_react_querybuilder6 = require("react-querybuilder"); | ||
var import_react_querybuilder7 = require("react-querybuilder"); | ||
var import_react_querybuilder8 = require("react-querybuilder"); | ||
var useQueryBuilderNative = (props) => useQueryBuilderSchemaNative(props, (0, import_react_querybuilder7.useQueryBuilderSetup)(props)); | ||
var useQueryBuilderSchemaNative = (props, setup) => { | ||
const qb = (0, import_react_querybuilder6.useQueryBuilderSchema)(props, setup); | ||
const qb = (0, import_react_querybuilder8.useQueryBuilderSchema)(props, setup); | ||
const styles = (0, import_react8.useMemo)(() => import_react_native10.StyleSheet.create(props.styles ?? {}), [props.styles]); | ||
@@ -579,8 +606,11 @@ return { ...qb, schema: { ...qb.schema, styles } }; | ||
var QueryBuilderNativeInternal = ({ | ||
props, | ||
setup | ||
props | ||
}) => { | ||
const qb = useQueryBuilderSchemaNative(props, setup); | ||
const controlElements = (0, import_react9.useMemo)( | ||
() => ({ ...defaultNativeControlElements, ...props.controlElements }), | ||
[props.controlElements] | ||
); | ||
const qb = useQueryBuilderNative({ ...props, controlElements }); | ||
const { ruleGroup: RuleGroupComponent } = qb.schema.controls; | ||
const QueryBuilderContext = import_react_querybuilder7.QueryBuilderContext; | ||
const QueryBuilderContext = import_react_querybuilder9.QueryBuilderContext; | ||
return /* @__PURE__ */ React11.createElement(QueryBuilderContext.Provider, { value: qb.rqbContext }, /* @__PURE__ */ React11.createElement( | ||
@@ -602,10 +632,3 @@ RuleGroupComponent, | ||
}; | ||
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 })); | ||
}; | ||
var QueryBuilderNative = (props) => /* @__PURE__ */ React11.createElement(import_react_redux.Provider, { context: import_react_querybuilder9.QueryBuilderStateContext, store: import_react_querybuilder9.queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, { props })); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -612,0 +635,0 @@ 0 && (module.exports = { |
@@ -1,2 +0,2 @@ | ||
"use strict";var Fe=Object.create;var I=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var Ve=(t,o)=>{for(var e in o)I(t,e,{get:o[e],enumerable:!0})},ie=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Pe(o))!Be.call(t,s)&&s!==e&&I(t,s,{get:()=>o[s],enumerable:!(i=Oe(o,s))||i.enumerable});return t};var y=(t,o,e)=>(e=t!=null?Fe(we(t)):{},ie(o||!t||!t.__esModule?I(e,"default",{value:t,enumerable:!0}):e,t)),Ee=t=>ie(I({},"__esModule",{value:!0}),t);var qe={};Ve(qe,{NativeActionElement:()=>d,NativeInlineCombinator:()=>U,NativeNotToggle:()=>$,NativeShiftActions:()=>z,NativeValueEditor:()=>V,NativeValueEditorWeb:()=>J,NativeValueSelector:()=>c,NativeValueSelectorWeb:()=>g,QueryBuilderNative:()=>Le,RuleGroupNative:()=>X,RuleNative:()=>Z,defaultNativeControlElements:()=>H,defaultNativeSelectStyles:()=>p,defaultNativeStyles:()=>r,defaultNativeWebControlElements:()=>Qe});module.exports=Ee(qe);var se=y(require("react")),ue=require("react-native"),d=({handleOnClick:t,label:o,disabled:e,disabledTranslation:i,testID:s})=>se.createElement(ue.Button,{testID:s,disabled:e&&!i,title:`${i&&e?i.label??"":o??""}`,onPress:n=>t()});var _=y(require("react")),ae=require("react"),D=require("react-native"),K=require("react-querybuilder");var ne=require("react-native"),p={selector:{borderWidth:1,height:32,width:100},option:{}},Ae={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",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:{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(Ae);var U=({component:t,path:o,...e})=>{let i=(0,ae.useMemo)(()=>({inlineCombinator:D.StyleSheet.flatten([r.inlineCombinator,e.schema.styles?.inlineCombinator])}),[e.schema.styles?.inlineCombinator]);return _.createElement(D.View,{style:i.inlineCombinator,key:"no-dnd",testID:K.TestID.inlineCombinator},_.createElement(t,{...e,path:o,testID:K.TestID.combinators}))};var L=y(require("react")),pe=require("react"),f=require("react-native");var $=({handleOnChange:t,label:o,checked:e,disabled:i,schema:s,testID:n})=>{let l=(0,pe.useMemo)(()=>({notToggle:f.StyleSheet.flatten([r.notToggle,s.styles?.notToggle]),notToggleLabel:f.StyleSheet.flatten([r.notToggleLabel,s.styles?.notToggleLabel]),notToggleSwitch:f.StyleSheet.flatten([r.notToggleSwitch,s.styles?.notToggleSwitch])}),[s.styles?.notToggle,s.styles?.notToggleLabel,s.styles?.notToggleSwitch]);return L.createElement(f.View,{style:l.notToggle,testID:n},L.createElement(f.Text,{style:l.notToggleLabel},o),L.createElement(f.Switch,{style:l.notToggleSwitch,disabled:i,value:e,onValueChange:u=>t(u)}))};var T=y(require("react")),R=require("react-native");var z=({shiftUp:t,shiftDown:o,shiftUpDisabled:e,shiftDownDisabled:i,disabled:s,labels:n,testID:l,schema:{styles:u}})=>{let C=T.useMemo(()=>({shiftActions:R.StyleSheet.flatten([r.shiftActions,u?.shiftActions])}),[u?.shiftActions]);return T.createElement(R.View,{testID:l,style:C.shiftActions},T.createElement(R.Button,{disabled:s||e,onPress:t,accessibilityLabel:n?.shiftUp,title:n?.shiftUp}),T.createElement(R.Button,{disabled:s||i,onPress:o,accessibilityLabel:n?.shiftDown,title:n?.shiftDown}))};var N=y(require("react")),ye=require("react"),m=require("react-native"),F=require("react-querybuilder");var ce=y(require("react")),me=require("react"),a=require("react-native"),v=require("react-querybuilder");var c=({handleOnChange:t,options:o,value:e,disabled:i,multiple:s,listsAsArrays:n,schema:l,testID:u})=>{let C=(0,me.useMemo)(()=>u===v.TestID.combinators?{selector:a.StyleSheet.flatten([r.combinatorSelector,l.styles?.combinatorSelector]),option:a.StyleSheet.flatten([r.combinatorOption,l.styles?.combinatorOption])}:u===v.TestID.fields?{selector:a.StyleSheet.flatten([r.fieldSelector,l.styles?.fieldSelector]),option:a.StyleSheet.flatten([r.fieldOption,l.styles?.fieldOption])}:u===v.TestID.operators?{selector:a.StyleSheet.flatten([r.operatorSelector,l.styles?.operatorSelector]),option:a.StyleSheet.flatten([r.operatorOption,l.styles?.operatorOption])}:u===v.TestID.valueSourceSelector?{selector:a.StyleSheet.flatten([r.valueSourceSelector,l.styles?.valueSourceSelector]),option:a.StyleSheet.flatten([r.valueSourceOption,l.styles?.valueSourceOption])}:u===v.TestID.valueEditor?{selector:a.StyleSheet.flatten([r.valueEditorSelector,l.styles?.valueEditorSelector]),option:a.StyleSheet.flatten([r.valueEditorOption,l.styles?.valueEditorOption])}:a.StyleSheet.create(p),[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,u]),{onChange:A}=(0,v.useValueSelector)({handleOnChange:t,listsAsArrays:n,multiple:s,value:e}),W=s&&Array.isArray(e)?(0,v.joinWith)(e,","):e;return ce.createElement(a.TextInput,{testID:u,"aria-disabled":i,style:C.selector,value:W,onChangeText:A})};var V=({operator:t,value:o,handleOnChange:e,title:i,className:s,type:n="text",inputType:l="text",values:u=[],listsAsArrays:C,parseNumbers:A,fieldData:W,disabled:k,separator:Re=null,skipHook:Te=!1,testID:w,selectorComponent:ee=c,...S})=>{let B=(0,ye.useMemo)(()=>({value:m.StyleSheet.flatten([r.value,S.schema.styles?.value]),valueEditorSwitch:m.StyleSheet.flatten([r.valueEditorSwitch,S.schema.styles?.valueEditorSwitch]),valueList:m.StyleSheet.flatten([r.valueList,S.schema.styles?.valueList])}),[S.schema.styles?.value,S.schema.styles?.valueEditorSwitch,S.schema.styles?.valueList]),{valueAsArray:te,multiValueHandler:oe}=(0,F.useValueEditor)({skipHook:Te,handleOnChange:e,inputType:l,operator:t,value:o,type:n,listsAsArrays:C,parseNumbers:A,values:u});if(t==="null"||t==="notNull")return null;let M=W?.placeholder??"",re="default";if((t==="between"||t==="notBetween")&&(n==="select"||n==="text")){let b=["from","to"].map((le,Q)=>n==="text"?N.createElement(m.TextInput,{key:le,style:B.value,keyboardType:re,placeholder:M,value:te[Q]??"",onChangeText:j=>oe(j,Q)}):N.createElement(ee,{...S,key:le,handleOnChange:j=>oe(j,Q),className:s,disabled:k,value:te[Q]??(0,F.getFirstOption)(u),options:u,listsAsArrays:C}));return N.createElement(m.View,{testID:w,style:B.valueList},b[0],Re,b[1])}switch(n){case"select":case"multiselect":return N.createElement(ee,{...S,testID:w,className:s,title:i,handleOnChange:e,disabled:k,value:o,options:u,multiple:n==="multiselect",listsAsArrays:C});case"textarea":return N.createElement(m.TextInput,{testID:w,style:B.value,placeholder:M,value:o,onChangeText:b=>e(b)});case"switch":case"checkbox":return N.createElement(m.Switch,{testID:w,style:B.valueEditorSwitch,disabled:k,value:!!o,onValueChange:b=>e(b)})}return N.createElement(m.TextInput,{testID:w,style:B.value,keyboardType:re,placeholder:M,value:o,onChangeText:b=>e((0,F.parseNumber)(b,{parseNumbers:A}))})};var fe=y(require("react"));var de=y(require("react"));var g=t=>de.createElement(c,{...t});var J=t=>fe.createElement(V,{...t,selectorComponent:g});var E=y(require("react")),Ge=require("react"),G=require("react-querybuilder"),Ce=require("react-redux");var be=require("react");var O=y(require("react")),ve=require("react"),x=require("react-native"),h=require("react-querybuilder");var X=t=>{let o=(0,h.useRuleGroup)(t),e=o.schema,i=(0,ve.useMemo)(()=>({ruleGroup:x.StyleSheet.flatten([r.ruleGroup,e.styles?.ruleGroup]),ruleGroupHeader:x.StyleSheet.flatten([r.ruleGroupHeader,e.styles?.ruleGroupHeader]),ruleGroupBody:x.StyleSheet.flatten([r.ruleGroupBody,e.styles?.ruleGroupBody])}),[e.styles?.ruleGroup,e.styles?.ruleGroupBody,e.styles?.ruleGroupHeader]);return O.createElement(x.View,{style:i.ruleGroup,testID:h.TestID.ruleGroup},O.createElement(x.View,{style:i.ruleGroupHeader},O.createElement(h.RuleGroupHeaderComponents,{...o})),O.createElement(x.View,{style:i.ruleGroupBody},O.createElement(h.RuleGroupBodyComponents,{...o})))};var Y=y(require("react")),Se=require("react"),q=require("react-native"),P=require("react-querybuilder");var Z=t=>{let o=(0,P.useRule)(t),e=o.schema,i=(0,Se.useMemo)(()=>({rule:q.StyleSheet.flatten([r.rule,e.styles?.rule])}),[e.styles?.rule]);return Y.createElement(q.View,{style:i.rule,testID:P.TestID.rule},Y.createElement(P.RuleComponents,{...o}))};var H={actionElement:d,addGroupAction:d,addRuleAction:d,cloneGroupAction:d,cloneRuleAction:d,combinatorSelector:c,dragHandle:(0,be.forwardRef)(()=>null),fieldSelector:c,inlineCombinator:U,lockGroupAction:d,lockRuleAction:d,notToggle:$,operatorSelector:c,removeGroupAction:d,removeRuleAction:d,rule:Z,ruleGroup:X,shiftActions:z,valueEditor:V,valueSelector:c,valueSourceSelector:c},Qe={...H,combinatorSelector:g,fieldSelector:g,operatorSelector:g,valueEditor:J,valueSelector:c,valueSourceSelector:g};var Ne=require("react"),ge=require("react-native"),xe=require("react-querybuilder"),he=(t,o)=>{let e=(0,xe.useQueryBuilderSchema)(t,o),i=(0,Ne.useMemo)(()=>ge.StyleSheet.create(t.styles??{}),[t.styles]);return{...e,schema:{...e.schema,styles:i}}};var Ie=[],De=({props:t,setup:o})=>{let e=he(t,o),{ruleGroup:i}=e.schema.controls;return E.createElement(G.QueryBuilderContext.Provider,{value:e.rqbContext},E.createElement(i,{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:t.context}))},Le=t=>{let o=(0,Ge.useMemo)(()=>({...H,...t.controlElements}),[t.controlElements]),e=(0,G.useQueryBuilderSetup)({...t,controlElements:o});return E.createElement(Ce.Provider,{context:G.QueryBuilderStateContext,store:G.queryBuilderStore},E.createElement(De,{props:t,setup:e}))};0&&(module.exports={NativeActionElement,NativeInlineCombinator,NativeNotToggle,NativeShiftActions,NativeValueEditor,NativeValueEditorWeb,NativeValueSelector,NativeValueSelectorWeb,QueryBuilderNative,RuleGroupNative,RuleNative,defaultNativeControlElements,defaultNativeSelectStyles,defaultNativeStyles,defaultNativeWebControlElements}); | ||
"use strict";var Pe=Object.create;var I=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Qe=(t,o)=>{for(var e in o)I(t,e,{get:o[e],enumerable:!0})},ae=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of we(o))!Ae.call(t,s)&&s!==e&&I(t,s,{get:()=>o[s],enumerable:!(i=Be(o,s))||i.enumerable});return t};var d=(t,o,e)=>(e=t!=null?Pe(Ve(t)):{},ae(o||!t||!t.__esModule?I(e,"default",{value:t,enumerable:!0}):e,t)),Ie=t=>ae(I({},"__esModule",{value:!0}),t);var Xe={};Qe(Xe,{NativeActionElement:()=>y,NativeInlineCombinator:()=>z,NativeNotToggle:()=>K,NativeShiftActions:()=>Y,NativeValueEditor:()=>V,NativeValueEditorWeb:()=>Z,NativeValueSelector:()=>m,NativeValueSelectorWeb:()=>x,QueryBuilderNative:()=>Je,RuleGroupNative:()=>ee,RuleNative:()=>oe,defaultNativeControlElements:()=>J,defaultNativeSelectStyles:()=>u,defaultNativeStyles:()=>r,defaultNativeWebControlElements:()=>Le});module.exports=Ie(Xe);var D=d(require("react")),C=require("react-native");var ue=require("react-native"),u={selector:{borderRadius:4,borderWidth:1,height:32,width:100,paddingLeft:4},option:{}},De={actionElement:{borderWidth:1,borderRadius:4,height:32,padding:8,paddingBottom:4,paddingTop:4},actionElementText:{},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",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:{...u.selector,width:150},valueEditorOption:u.option,valueEditorSelector:u.selector,valueEditorSwitch:{},valueList:{flexDirection:"row"},valueSourceOption:u.option,valueSourceSelector:u.selector},r=ue.StyleSheet.create(De);var y=({handleOnClick:t,label:o,disabled:e,disabledTranslation:i,testID:s,schema:a})=>D.createElement(C.Pressable,{testID:s,disabled:e&&!i,onPress:l=>t()},D.createElement(C.View,{style:r.actionElement},D.createElement(C.Text,{style:r.actionElementText},`${i&&e?i.label??"":o??""}`)));var U=d(require("react")),pe=require("react"),L=require("react-native"),$=require("react-querybuilder");var z=({component:t,path:o,...e})=>{let i=(0,pe.useMemo)(()=>({inlineCombinator:L.StyleSheet.flatten([r.inlineCombinator,e.schema.styles?.inlineCombinator])}),[e.schema.styles?.inlineCombinator]);return U.createElement(L.View,{style:i.inlineCombinator,key:"no-dnd",testID:$.TestID.inlineCombinator},U.createElement(t,{...e,path:o,testID:$.TestID.combinators}))};var M=d(require("react")),me=require("react"),f=require("react-native");var K=({handleOnChange:t,label:o,checked:e,disabled:i,schema:s,testID:a})=>{let l=(0,me.useMemo)(()=>({notToggle:f.StyleSheet.flatten([r.notToggle,s.styles?.notToggle]),notToggleLabel:f.StyleSheet.flatten([r.notToggleLabel,s.styles?.notToggleLabel]),notToggleSwitch:f.StyleSheet.flatten([r.notToggleSwitch,s.styles?.notToggleSwitch])}),[s.styles?.notToggle,s.styles?.notToggleLabel,s.styles?.notToggleSwitch]);return M.createElement(f.View,{style:l.notToggle,testID:a},M.createElement(f.Text,{style:l.notToggleLabel},o),M.createElement(f.Switch,{style:l.notToggleSwitch,disabled:i,value:e,onValueChange:n=>t(n)}))};var O=d(require("react")),h=require("react-native");var Y=({shiftUp:t,shiftDown:o,shiftUpDisabled:e,shiftDownDisabled:i,disabled:s,labels:a,testID:l,schema:{styles:n}})=>{let G=O.useMemo(()=>({shiftActions:h.StyleSheet.flatten([r.shiftActions,n?.shiftActions])}),[n?.shiftActions]);return O.createElement(h.View,{testID:l,style:G.shiftActions},O.createElement(h.Button,{disabled:s||e,onPress:t,accessibilityLabel:a?.shiftUp,title:a?.shiftUp}),O.createElement(h.Button,{disabled:s||i,onPress:o,accessibilityLabel:a?.shiftDown,title:a?.shiftDown}))};var b=d(require("react")),ye=require("react"),c=require("react-native"),F=require("react-querybuilder");var ce=d(require("react")),de=require("react"),p=require("react-native"),S=require("react-querybuilder");var m=({handleOnChange:t,options:o,value:e,disabled:i,multiple:s,listsAsArrays:a,schema:l,testID:n})=>{let G=(0,de.useMemo)(()=>n===S.TestID.combinators?{selector:p.StyleSheet.flatten([r.combinatorSelector,l.styles?.combinatorSelector]),option:p.StyleSheet.flatten([r.combinatorOption,l.styles?.combinatorOption])}:n===S.TestID.fields?{selector:p.StyleSheet.flatten([r.fieldSelector,l.styles?.fieldSelector]),option:p.StyleSheet.flatten([r.fieldOption,l.styles?.fieldOption])}:n===S.TestID.operators?{selector:p.StyleSheet.flatten([r.operatorSelector,l.styles?.operatorSelector]),option:p.StyleSheet.flatten([r.operatorOption,l.styles?.operatorOption])}:n===S.TestID.valueSourceSelector?{selector:p.StyleSheet.flatten([r.valueSourceSelector,l.styles?.valueSourceSelector]),option:p.StyleSheet.flatten([r.valueSourceOption,l.styles?.valueSourceOption])}:n===S.TestID.valueEditor?{selector:p.StyleSheet.flatten([r.valueEditorSelector,l.styles?.valueEditorSelector]),option:p.StyleSheet.flatten([r.valueEditorOption,l.styles?.valueEditorOption])}:p.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,n]),{onChange:X}=(0,S.useValueSelector)({handleOnChange:t,listsAsArrays:a,multiple:s,value:e}),W=s&&Array.isArray(e)?(0,S.joinWith)(e,","):e;return ce.createElement(p.TextInput,{testID:n,"aria-disabled":i,style:G.selector,value:W,onChangeText:X})};var V=({operator:t,value:o,handleOnChange:e,title:i,className:s,type:a="text",inputType:l="text",values:n=[],listsAsArrays:G,parseNumbers:X,fieldData:W,disabled:k,separator:Fe=null,skipHook:Te=!1,testID:B,selectorComponent:re=m,...v})=>{let w=(0,ye.useMemo)(()=>({value:c.StyleSheet.flatten([r.value,v.schema.styles?.value]),valueEditorSwitch:c.StyleSheet.flatten([r.valueEditorSwitch,v.schema.styles?.valueEditorSwitch]),valueList:c.StyleSheet.flatten([r.valueList,v.schema.styles?.valueList])}),[v.schema.styles?.value,v.schema.styles?.valueEditorSwitch,v.schema.styles?.valueList]),{valueAsArray:le,multiValueHandler:ie,parseNumberMethod:Ee}=(0,F.useValueEditor)({skipHook:Te,handleOnChange:e,inputType:l,operator:t,value:o,type:a,listsAsArrays:G,parseNumbers:X,values:n});if(t==="null"||t==="notNull")return null;let _=W?.placeholder??"",se=["in","notIn"].includes(t)?"text":l==="number"?"decimal":l??"text";if((t==="between"||t==="notBetween")&&(a==="select"||a==="text")){let N=["from","to"].map((ne,Q)=>a==="text"?b.createElement(c.TextInput,{key:ne,style:w.value,inputMode:se,placeholder:_,value:le[Q]??"",onChangeText:j=>ie(j,Q)}):b.createElement(re,{key:ne,...v,handleOnChange:j=>ie(j,Q),className:s,disabled:k,value:le[Q]??(0,F.getFirstOption)(n),options:n,listsAsArrays:G}));return b.createElement(c.View,{testID:B,style:w.valueList},N[0],Fe,N[1])}switch(a){case"select":case"multiselect":return b.createElement(re,{...v,testID:B,className:s,title:i,handleOnChange:e,disabled:k,value:o,options:n,multiple:a==="multiselect",listsAsArrays:G});case"textarea":return b.createElement(c.TextInput,{testID:B,style:w.value,placeholder:_,value:o,onChangeText:N=>e(N)});case"switch":case"checkbox":return b.createElement(c.Switch,{testID:B,style:w.valueEditorSwitch,disabled:k,value:!!o,onValueChange:N=>e(N)})}return b.createElement(c.TextInput,{testID:B,style:w.value,inputMode:se,placeholder:_,value:o,onChangeText:N=>e((0,F.parseNumber)(N,{parseNumbers:Ee}))})};var Se=d(require("react"));var fe=d(require("react"));var x=t=>fe.createElement(m,{...t});var Z=t=>Se.createElement(V,{...t,selectorComponent:x});var A=d(require("react")),Ce=require("react"),P=require("react-querybuilder"),Oe=require("react-redux");var be=require("react"),q=require("react-querybuilder");var T=d(require("react")),ve=require("react"),R=require("react-native"),g=require("react-querybuilder");var ee=t=>{let o=(0,g.useRuleGroup)(t),e=o.schema,i=(0,ve.useMemo)(()=>({ruleGroup:R.StyleSheet.flatten([r.ruleGroup,e.styles?.ruleGroup]),ruleGroupHeader:R.StyleSheet.flatten([r.ruleGroupHeader,e.styles?.ruleGroupHeader]),ruleGroupBody:R.StyleSheet.flatten([r.ruleGroupBody,e.styles?.ruleGroupBody])}),[e.styles?.ruleGroup,e.styles?.ruleGroupBody,e.styles?.ruleGroupHeader]);return T.createElement(R.View,{style:i.ruleGroup,testID:g.TestID.ruleGroup},T.createElement(R.View,{style:i.ruleGroupHeader},T.createElement(g.RuleGroupHeaderComponents,{...o})),T.createElement(R.View,{style:i.ruleGroupBody},T.createElement(g.RuleGroupBodyComponents,{...o})))};var te=d(require("react")),Ne=require("react"),H=require("react-native"),E=require("react-querybuilder");var oe=t=>{let o=(0,E.useRule)(t),e=o.schema,i=(0,Ne.useMemo)(()=>({rule:H.StyleSheet.flatten([r.rule,e.styles?.rule])}),[e.styles?.rule]);return te.createElement(H.View,{style:i.rule,testID:E.TestID.rule},te.createElement(E.RuleComponents,{...o}))};var J={actionElement:y,addGroupAction:y,addRuleAction:y,cloneGroupAction:y,cloneRuleAction:y,combinatorSelector:m,dragHandle:(0,be.forwardRef)(()=>null),fieldSelector:m,inlineCombinator:z,lockGroupAction:y,lockRuleAction:y,notToggle:K,operatorSelector:m,removeGroupAction:y,removeRuleAction:y,rule:oe,ruleGroup:ee,ruleGroupBodyElements:q.RuleGroupBodyComponents,ruleGroupHeaderElements:q.RuleGroupHeaderComponents,shiftActions:Y,valueEditor:V,valueSelector:m,valueSourceSelector:m},Le={...J,combinatorSelector:x,fieldSelector:x,operatorSelector:x,valueEditor:Z,valueSelector:m,valueSourceSelector:x};var xe=require("react"),Re=require("react-native"),ge=require("react-querybuilder"),Ge=require("react-querybuilder"),he=t=>Me(t,(0,ge.useQueryBuilderSetup)(t)),Me=(t,o)=>{let e=(0,Ge.useQueryBuilderSchema)(t,o),i=(0,xe.useMemo)(()=>Re.StyleSheet.create(t.styles??{}),[t.styles]);return{...e,schema:{...e.schema,styles:i}}};var He=[],qe=({props:t})=>{let o=(0,Ce.useMemo)(()=>({...J,...t.controlElements}),[t.controlElements]),e=he({...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:He,translations:e.translations,schema:e.schema,actions:e.actions,id:e.rootGroup.id,disabled:e.rootGroupDisabled,parentDisabled:e.queryDisabled,context:t.context}))},Je=t=>A.createElement(Oe.Provider,{context:P.QueryBuilderStateContext,store:P.queryBuilderStore},A.createElement(qe,{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 |
@@ -35,35 +35,26 @@ var __defProp = Object.defineProperty; | ||
import * as React from "react"; | ||
import { Button } from "react-native"; | ||
var NativeActionElement = ({ | ||
handleOnClick, | ||
label, | ||
disabled, | ||
disabledTranslation, | ||
testID | ||
}) => { | ||
var _a; | ||
return /* @__PURE__ */ React.createElement( | ||
Button, | ||
{ | ||
testID, | ||
disabled: disabled && !disabledTranslation, | ||
title: `${disabledTranslation && disabled ? (_a = disabledTranslation.label) != null ? _a : "" : label != null ? label : ""}`, | ||
onPress: (_e) => handleOnClick() | ||
} | ||
); | ||
}; | ||
import { Pressable, Text, View } from "react-native"; | ||
// src/components/NativeInlineCombinator.tsx | ||
import * as React2 from "react"; | ||
import { useMemo } from "react"; | ||
import { StyleSheet as StyleSheet2, View } from "react-native"; | ||
import { TestID } from "react-querybuilder"; | ||
// src/styles.ts | ||
import { StyleSheet } from "react-native"; | ||
var defaultNativeSelectStyles = { | ||
selector: { borderWidth: 1, height: 32, width: 100 }, | ||
selector: { | ||
borderRadius: 4, | ||
borderWidth: 1, | ||
height: 32, | ||
width: 100, | ||
paddingLeft: 4 | ||
}, | ||
option: {} | ||
}; | ||
var defaultStylesObject = { | ||
actionElement: { | ||
borderWidth: 1, | ||
borderRadius: 4, | ||
height: 32, | ||
padding: 8, | ||
paddingBottom: 4, | ||
paddingTop: 4 | ||
}, | ||
actionElementText: {}, | ||
combinatorOption: defaultNativeSelectStyles.option, | ||
@@ -97,3 +88,3 @@ combinatorSelector: defaultNativeSelectStyles.selector, | ||
shiftActions: { flexDirection: "column" }, | ||
value: { borderWidth: 1, height: 32, width: 150 }, | ||
value: __spreadProps(__spreadValues({}, defaultNativeSelectStyles.selector), { width: 150 }), | ||
valueEditorOption: defaultNativeSelectStyles.option, | ||
@@ -108,3 +99,34 @@ valueEditorSelector: defaultNativeSelectStyles.selector, | ||
// src/components/NativeActionElement.tsx | ||
var NativeActionElement = ({ | ||
handleOnClick, | ||
label, | ||
disabled, | ||
disabledTranslation, | ||
testID, | ||
schema: _schema | ||
}) => { | ||
var _a; | ||
return /* @__PURE__ */ React.createElement( | ||
Pressable, | ||
{ | ||
testID, | ||
disabled: disabled && !disabledTranslation, | ||
onPress: (_e) => handleOnClick() | ||
}, | ||
/* @__PURE__ */ React.createElement(View, { style: defaultNativeStyles.actionElement }, /* @__PURE__ */ React.createElement( | ||
Text, | ||
{ | ||
style: defaultNativeStyles.actionElementText | ||
}, | ||
`${disabledTranslation && disabled ? (_a = disabledTranslation.label) != null ? _a : "" : label != null ? label : ""}` | ||
)) | ||
); | ||
}; | ||
// src/components/NativeInlineCombinator.tsx | ||
import * as React2 from "react"; | ||
import { useMemo } from "react"; | ||
import { StyleSheet as StyleSheet2, View as View2 } from "react-native"; | ||
import { TestID } from "react-querybuilder"; | ||
var NativeInlineCombinator = (_a) => { | ||
@@ -131,3 +153,3 @@ var _b = _a, { | ||
); | ||
return /* @__PURE__ */ React2.createElement(View, { style: styles.inlineCombinator, key: "no-dnd", testID: TestID.inlineCombinator }, /* @__PURE__ */ React2.createElement(CombinatorSelectorComponent, __spreadProps(__spreadValues({}, props), { path, testID: TestID.combinators }))); | ||
return /* @__PURE__ */ React2.createElement(View2, { style: styles.inlineCombinator, key: "no-dnd", testID: TestID.inlineCombinator }, /* @__PURE__ */ React2.createElement(CombinatorSelectorComponent, __spreadProps(__spreadValues({}, props), { path, testID: TestID.combinators }))); | ||
}; | ||
@@ -138,3 +160,3 @@ | ||
import { useMemo as useMemo2 } from "react"; | ||
import { StyleSheet as StyleSheet3, Switch, Text, View as View2 } from "react-native"; | ||
import { StyleSheet as StyleSheet3, Switch, Text as Text2, View as View3 } from "react-native"; | ||
var NativeNotToggle = ({ | ||
@@ -166,3 +188,3 @@ handleOnChange, | ||
); | ||
return /* @__PURE__ */ React3.createElement(View2, { style: styles.notToggle, testID }, /* @__PURE__ */ React3.createElement(Text, { style: styles.notToggleLabel }, label), /* @__PURE__ */ React3.createElement( | ||
return /* @__PURE__ */ React3.createElement(View3, { style: styles.notToggle, testID }, /* @__PURE__ */ React3.createElement(Text2, { style: styles.notToggleLabel }, label), /* @__PURE__ */ React3.createElement( | ||
Switch, | ||
@@ -180,3 +202,3 @@ { | ||
import * as React4 from "react"; | ||
import { Button as Button2, StyleSheet as StyleSheet4, View as View3 } from "react-native"; | ||
import { Button, StyleSheet as StyleSheet4, View as View4 } from "react-native"; | ||
var NativeShiftActions = ({ | ||
@@ -198,4 +220,4 @@ shiftUp, | ||
); | ||
return /* @__PURE__ */ React4.createElement(View3, { testID, style: style.shiftActions }, /* @__PURE__ */ React4.createElement( | ||
Button2, | ||
return /* @__PURE__ */ React4.createElement(View4, { testID, style: style.shiftActions }, /* @__PURE__ */ React4.createElement( | ||
Button, | ||
{ | ||
@@ -208,3 +230,3 @@ disabled: disabled || shiftUpDisabled, | ||
), /* @__PURE__ */ React4.createElement( | ||
Button2, | ||
Button, | ||
{ | ||
@@ -222,3 +244,3 @@ disabled: disabled || shiftDownDisabled, | ||
import { useMemo as useMemo5 } from "react"; | ||
import { StyleSheet as StyleSheet6, Switch as Switch2, TextInput as TextInput2, View as View4 } from "react-native"; | ||
import { StyleSheet as StyleSheet6, Switch as Switch2, TextInput as TextInput2, View as View5 } from "react-native"; | ||
import { getFirstOption, parseNumber, useValueEditor } from "react-querybuilder"; | ||
@@ -384,3 +406,3 @@ | ||
); | ||
const { valueAsArray, multiValueHandler } = useValueEditor({ | ||
const { valueAsArray, multiValueHandler, parseNumberMethod } = useValueEditor({ | ||
skipHook, | ||
@@ -400,3 +422,3 @@ handleOnChange, | ||
const placeHolderText = (_d = fieldData == null ? void 0 : fieldData.placeholder) != null ? _d : ""; | ||
const keyboardType = "default"; | ||
const inputMode = ["in", "notIn"].includes(operator) ? "text" : inputType === "number" ? "decimal" : inputType != null ? inputType : "text"; | ||
if ((operator === "between" || operator === "notBetween") && (type === "select" || type === "text")) { | ||
@@ -411,3 +433,3 @@ const editors = ["from", "to"].map((key, i) => { | ||
style: styles.value, | ||
keyboardType, | ||
inputMode, | ||
placeholder: placeHolderText, | ||
@@ -421,4 +443,5 @@ value: (_a3 = valueAsArray[i]) != null ? _a3 : "", | ||
SelectorComponent, | ||
__spreadProps(__spreadValues({}, props), { | ||
key, | ||
__spreadProps(__spreadValues({ | ||
key | ||
}, props), { | ||
handleOnChange: (v) => multiValueHandler(v, i), | ||
@@ -433,3 +456,3 @@ className, | ||
}); | ||
return /* @__PURE__ */ React6.createElement(View4, { testID, style: styles.valueList }, editors[0], separator, editors[1]); | ||
return /* @__PURE__ */ React6.createElement(View5, { testID, style: styles.valueList }, editors[0], separator, editors[1]); | ||
} | ||
@@ -482,6 +505,6 @@ switch (type) { | ||
style: styles.value, | ||
keyboardType, | ||
inputMode, | ||
placeholder: placeHolderText, | ||
value, | ||
onChangeText: (v) => handleOnChange(parseNumber(v, { parseNumbers })) | ||
onChangeText: (v) => handleOnChange(parseNumber(v, { parseNumbers: parseNumberMethod })) | ||
} | ||
@@ -507,4 +530,3 @@ ); | ||
QueryBuilderStateContext, | ||
queryBuilderStore, | ||
useQueryBuilderSetup | ||
queryBuilderStore | ||
} from "react-querybuilder"; | ||
@@ -515,2 +537,3 @@ import { Provider } from "react-redux"; | ||
import { forwardRef } from "react"; | ||
import { RuleGroupBodyComponents as RuleGroupBodyComponents2, RuleGroupHeaderComponents as RuleGroupHeaderComponents2 } from "react-querybuilder"; | ||
@@ -520,3 +543,3 @@ // src/components/RuleGroupNative.tsx | ||
import { useMemo as useMemo6 } from "react"; | ||
import { StyleSheet as StyleSheet7, View as View5 } from "react-native"; | ||
import { StyleSheet as StyleSheet7, View as View6 } from "react-native"; | ||
import { | ||
@@ -549,3 +572,3 @@ RuleGroupBodyComponents, | ||
); | ||
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)))); | ||
return /* @__PURE__ */ React9.createElement(View6, { style: styles.ruleGroup, testID: TestID3.ruleGroup }, /* @__PURE__ */ React9.createElement(View6, { style: styles.ruleGroupHeader }, /* @__PURE__ */ React9.createElement(RuleGroupHeaderComponents, __spreadValues({}, rg))), /* @__PURE__ */ React9.createElement(View6, { style: styles.ruleGroupBody }, /* @__PURE__ */ React9.createElement(RuleGroupBodyComponents, __spreadValues({}, rg)))); | ||
}; | ||
@@ -556,3 +579,3 @@ | ||
import { useMemo as useMemo7 } from "react"; | ||
import { StyleSheet as StyleSheet8, View as View6 } from "react-native"; | ||
import { StyleSheet as StyleSheet8, View as View7 } from "react-native"; | ||
import { RuleComponents, TestID as TestID4, useRule } from "react-querybuilder"; | ||
@@ -570,3 +593,3 @@ var RuleNative = (props) => { | ||
); | ||
return /* @__PURE__ */ React10.createElement(View6, { style: styles.rule, testID: TestID4.rule }, /* @__PURE__ */ React10.createElement(RuleComponents, __spreadValues({}, r))); | ||
return /* @__PURE__ */ React10.createElement(View7, { style: styles.rule, testID: TestID4.rule }, /* @__PURE__ */ React10.createElement(RuleComponents, __spreadValues({}, r))); | ||
}; | ||
@@ -597,2 +620,4 @@ | ||
ruleGroup: RuleGroupNative, | ||
ruleGroupBodyElements: RuleGroupBodyComponents2, | ||
ruleGroupHeaderElements: RuleGroupHeaderComponents2, | ||
shiftActions: NativeShiftActions, | ||
@@ -612,6 +637,8 @@ valueEditor: NativeValueEditor, | ||
// src/components/useQueryBuilderSchemaNative.ts | ||
// src/components/useQueryBuilderNative.ts | ||
import { useMemo as useMemo8 } from "react"; | ||
import { StyleSheet as StyleSheet9 } from "react-native"; | ||
import { useQueryBuilderSetup } from "react-querybuilder"; | ||
import { useQueryBuilderSchema } from "react-querybuilder"; | ||
var useQueryBuilderNative = (props) => useQueryBuilderSchemaNative(props, useQueryBuilderSetup(props)); | ||
var useQueryBuilderSchemaNative = (props, setup) => { | ||
@@ -629,6 +656,9 @@ const qb = useQueryBuilderSchema(props, setup); | ||
var QueryBuilderNativeInternal = ({ | ||
props, | ||
setup | ||
props | ||
}) => { | ||
const qb = useQueryBuilderSchemaNative(props, setup); | ||
const controlElements = useMemo9( | ||
() => __spreadValues(__spreadValues({}, defaultNativeControlElements), props.controlElements), | ||
[props.controlElements] | ||
); | ||
const qb = useQueryBuilderNative(__spreadProps(__spreadValues({}, props), { controlElements })); | ||
const { ruleGroup: RuleGroupComponent } = qb.schema.controls; | ||
@@ -652,10 +682,3 @@ const QueryBuilderContext = _QBC; | ||
}; | ||
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 })); | ||
}; | ||
var QueryBuilderNative = (props) => /* @__PURE__ */ React11.createElement(Provider, { context: QueryBuilderStateContext, store: queryBuilderStore }, /* @__PURE__ */ React11.createElement(QueryBuilderNativeInternal, { props })); | ||
export { | ||
@@ -662,0 +685,0 @@ NativeActionElement, |
{ | ||
"name": "@react-querybuilder/native", | ||
"description": "React Native components for react-querybuilder", | ||
"version": "7.6.1", | ||
"version": "7.8.0-alpha.0", | ||
"publishConfig": { | ||
@@ -14,7 +14,7 @@ "access": "public" | ||
"import": { | ||
"types": "./dist/react-querybuilder_native.d.mts", | ||
"types": "./dist/types-esm/index.d.mts", | ||
"default": "./dist/react-querybuilder_native.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/react-querybuilder_native.cjs.development.d.ts", | ||
"types": "./dist/types/index.d.ts", | ||
"default": "./dist/cjs/index.js" | ||
@@ -24,3 +24,3 @@ } | ||
}, | ||
"types": "./dist/cjs/react-querybuilder_native.cjs.production.d.ts", | ||
"types": "./dist/types/index.d.ts", | ||
"files": [ | ||
@@ -39,3 +39,3 @@ "dist" | ||
"start": "bunx --bun vite", | ||
"build": "tsup", | ||
"build": "bunx --bun tsup", | ||
"typecheck": "tsc --noEmit", | ||
@@ -47,4 +47,4 @@ "typecheck:watch": "tsc --noEmit --watch" | ||
"@testing-library/jest-native": "^5.4.3", | ||
"@testing-library/react-native": "^12.5.2", | ||
"@types/react": "^18.3.3", | ||
"@testing-library/react-native": "^12.7.2", | ||
"@types/react": "^18.3.9", | ||
"@types/react-test-renderer": "^18.3.0", | ||
@@ -54,17 +54,17 @@ "@vitejs/plugin-react-swc": "^3.7.0", | ||
"react-dom": "^18.3.1", | ||
"react-native": "~0.74.4", | ||
"react-native": "~0.75.3", | ||
"react-native-web": "~0.19.12", | ||
"react-querybuilder": "7.6.1", | ||
"react-querybuilder": "7.8.0-alpha.0", | ||
"react-redux": "^9.1.2", | ||
"react-test-renderer": "^18.3.1", | ||
"rollup-plugin-visualizer": "^5.12.0", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.3.5" | ||
"typescript": "^5.6.2", | ||
"vite": "^5.4.8" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=18", | ||
"react-querybuilder": "7.6.1", | ||
"react-querybuilder": "7.8.0-alpha.0", | ||
"react-redux": "^9.1.0" | ||
}, | ||
"gitHead": "d8070659c830444fbf304a702ab8d246bdeffadd" | ||
"gitHead": "2e7089a27e676cff934dcd6514dbd379b7a6d869" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
50
286564
2092
2