@react-querybuilder/datetime 8.8.4 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/date-fns.d.ts +1 -0
- package/dist/cjs/dayjs.d.ts +1 -0
- package/dist/cjs/getDatetimeRuleProcessorSQL-D95jgDK6.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorSQL-D95jgDK6.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/jsdate.d.ts +1 -0
- package/dist/cjs/luxon.d.ts +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +108 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +12 -11
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +12 -11
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +5 -4
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +56 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +10 -10
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +12 -11
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +108 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +56 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +53 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
- package/dist/cjs/types-QCQUGVZa.d.ts +1694 -0
- package/dist/{getDatetimeRuleProcessorSQL-CutYTD23.js → getDatetimeRuleProcessorSQL-CN80oEFK.js} +23 -29
- package/dist/getDatetimeRuleProcessorSQL-CN80oEFK.js.map +1 -0
- package/dist/{getDatetimeRuleProcessorSQL-CocyaiI5.mjs → getDatetimeRuleProcessorSQL-KYRPP9qd.mjs} +17 -23
- package/dist/getDatetimeRuleProcessorSQL-KYRPP9qd.mjs.map +1 -0
- package/dist/react-querybuilder_datetime.d.mts +108 -0
- package/dist/react-querybuilder_datetime.date-fns.d.mts +53 -0
- package/dist/react-querybuilder_datetime.date-fns.mjs +10 -10
- package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.dayjs.d.mts +53 -0
- package/dist/react-querybuilder_datetime.dayjs.mjs +10 -10
- package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.jsdate.d.mts +56 -0
- package/dist/react-querybuilder_datetime.jsdate.mjs +10 -10
- package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.d.ts +108 -0
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +53 -0
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +10 -10
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +53 -0
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +10 -10
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.js +4 -4
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +56 -0
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +11 -11
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +53 -0
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +10 -10
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
- package/dist/react-querybuilder_datetime.luxon.d.mts +53 -0
- package/dist/react-querybuilder_datetime.luxon.mjs +10 -10
- package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.mjs +3 -3
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.d.mts +108 -0
- package/dist/react-querybuilder_datetime.production.date-fns.d.mts +53 -0
- package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.d.mts +53 -0
- package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.d.mts +56 -0
- package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.d.mts +53 -0
- package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
- package/dist/types-CDEkL2M_.d.mts +1694 -0
- package/dist/types-EgfSemtR.d.ts +1694 -0
- package/package.json +23 -23
- package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js.map +0 -1
- package/dist/getDatetimeRuleProcessorSQL-CocyaiI5.mjs.map +0 -1
- package/dist/getDatetimeRuleProcessorSQL-CutYTD23.js.map +0 -1
- package/dist/types/QueryBuilderDateTime.d.ts +0 -4
- package/dist/types/datetimeRuleProcessorJsonLogic.d.ts +0 -10
- package/dist/types/getDatetimeJsonLogicOperations.d.ts +0 -6
- package/dist/types/getDatetimeRuleProcessorCEL.d.ts +0 -7
- package/dist/types/getDatetimeRuleProcessorJSONata.d.ts +0 -7
- package/dist/types/getDatetimeRuleProcessorMongoDBQuery.d.ts +0 -7
- package/dist/types/getDatetimeRuleProcessorNL.d.ts +0 -13
- package/dist/types/getDatetimeRuleProcessorSQL.d.ts +0 -32
- package/dist/types/index.d.ts +0 -8
- package/dist/types/index.date-fns.d.ts +0 -48
- package/dist/types/index.dayjs.d.ts +0 -48
- package/dist/types/index.jsdate.d.ts +0 -48
- package/dist/types/index.luxon.d.ts +0 -48
- package/dist/types/rqbDateTimeLibraryAPI.date-fns.d.ts +0 -5
- package/dist/types/rqbDateTimeLibraryAPI.dayjs.d.ts +0 -5
- package/dist/types/rqbDateTimeLibraryAPI.jsdate.d.ts +0 -8
- package/dist/types/rqbDateTimeLibraryAPI.luxon.d.ts +0 -5
- package/dist/types/types.d.ts +0 -111
- package/dist/types/utils.d.ts +0 -5
- package/dist/types-esm/QueryBuilderDateTime.d.mts +0 -4
- package/dist/types-esm/datetimeRuleProcessorJsonLogic.d.mts +0 -10
- package/dist/types-esm/getDatetimeJsonLogicOperations.d.mts +0 -6
- package/dist/types-esm/getDatetimeRuleProcessorCEL.d.mts +0 -7
- package/dist/types-esm/getDatetimeRuleProcessorJSONata.d.mts +0 -7
- package/dist/types-esm/getDatetimeRuleProcessorMongoDBQuery.d.mts +0 -7
- package/dist/types-esm/getDatetimeRuleProcessorNL.d.mts +0 -13
- package/dist/types-esm/getDatetimeRuleProcessorSQL.d.mts +0 -32
- package/dist/types-esm/index.d.mts +0 -8
- package/dist/types-esm/index.date-fns.d.mts +0 -48
- package/dist/types-esm/index.dayjs.d.mts +0 -48
- package/dist/types-esm/index.jsdate.d.mts +0 -48
- package/dist/types-esm/index.luxon.d.mts +0 -48
- package/dist/types-esm/rqbDateTimeLibraryAPI.date-fns.d.mts +0 -5
- package/dist/types-esm/rqbDateTimeLibraryAPI.dayjs.d.mts +0 -5
- package/dist/types-esm/rqbDateTimeLibraryAPI.jsdate.d.mts +0 -8
- package/dist/types-esm/rqbDateTimeLibraryAPI.luxon.d.mts +0 -5
- package/dist/types-esm/types.d.mts +0 -111
- package/dist/types-esm/utils.d.mts +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react-querybuilder_datetime.cjs.development.date-fns.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react-querybuilder_datetime.cjs.development.dayjs.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react-querybuilder`);c=s(c);const l=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e),u=(...[e,t])=>e.operator!==`contains`&&e.operator!==`beginsWith`&&e.operator!==`endsWith`&&e.operator!==`doesNotContain`&&e.operator!==`doesNotBeginWith`&&e.operator!==`doesNotEndWith`&&e.operator!==`null`&&e.operator!==`notNull`&&/^(?:date|datetime|datetimeoffset|timestamp)\b/i.test(t?.fieldData?.datatype),d=(e,...[t,n])=>typeof e==`boolean`?e:typeof e==`function`?e(t,n):Array.isArray(e)?e.some(e=>Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t)):typeof e==`object`?Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t):u(t,n),f=({isAfter:e,isBefore:t,isSame:n})=>({dateAfter:(t,n)=>e(t,n),dateBefore:(e,n)=>t(e,n),dateBetween:(r,i,a)=>n(i,r)||n(i,a)||e(i,r)&&t(i,a)||e(i,a)&&t(i,r),dateNotBetween:(r,i,a)=>!n(i,r)&&!n(i,a)&&(t(r,a)&&(t(i,r)||e(i,a))||e(r,a)&&(t(i,a)||e(i,r))),dateIn:(e,t)=>t.some(t=>n(e,t)),dateNotIn:(e,t)=>t.every(t=>!n(e,t)),dateNotOn:(e,t)=>!n(e,t),dateOn:(e,t)=>n(e,t),dateOnOrAfter:(t,r)=>e(t,r)||n(t,r),dateOnOrBefore:(e,r)=>t(e,r)||n(e,r)}),p=e=>/^(does)?not/i.test(e),m=e=>(t,n)=>{let r=n??{},{context:i={}}=r;if(t.valueSource===`field`||!d(i.isDateField,t,r))return(0,c.defaultRuleProcessorCEL)(t,r);let a=t=>`timestamp("${e.toISOString(t)}")`,o=(0,c.lc)(t.operator.replace(/^=$/,`==`));switch(o){case`<`:case`<=`:case`==`:case`!=`:case`>`:case`>=`:return`${t.field} ${o} ${a(t.value)}`}let s=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(o){case`in`:case`notin`:{if(s.length===0)return``;let[e,n]=p(o)?[`!(`,`)`]:[``,``];return`${e}${t.field} in [${s.map(e=>a(e)).join(`, `)}]${n}`}case`between`:case`notbetween`:{if(s.length<2)return``;let[n,r]=s,[i,c]=e.isBefore(n,r)?[n,r]:[r,n];return o===`between`?`(${t.field} >= ${a(i)} && ${t.field} <= ${a(c)})`:`(${t.field} < ${a(i)} || ${t.field} > ${a(c)})`}}return(0,c.defaultRuleProcessorCEL)(t,r)},h=e=>(t,n)=>{let r=n??{},{field:i,operator:a,value:o,valueSource:s}=t;if(s===`field`||!d(r.context?.isDateField,t,r))return(0,c.defaultRuleProcessorMongoDBQuery)(t,r);if(a===`=`)return{[i]:e.toDate(o)};switch(a){case`<`:case`<=`:case`!=`:case`>`:case`>=`:return{[i]:{[c.mongoOperators[a]]:e.toDate(o)}}}let l=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(a){case`in`:case`notIn`:return{[i]:{[c.mongoOperators[a]]:l}};case`between`:case`notBetween`:{if(l.length<2)return``;let[t,n]=l,r=e.isBefore(t,n)?[t,n]:[n,t];return a===`between`?{[i]:{$gte:r[0],$lte:r[1]}}:{$or:[{[i]:{$lt:r[0]}},{[i]:{$gt:r[1]}}]}}}return(0,c.defaultRuleProcessorMongoDBQuery)(t,r)},g={"<":`is before`,">":`is after`,"<=":`is on or before`,">=":`is on or after`,in:[`is one of the dates`,`is the same as a date in`],notin:[`is not one of the dates`,`is not the same as any date in`],between:[`is between`,`is between the dates in`],notbetween:[`is not between`,`is not between the dates in`]},_=(e,t)=>l(t?.context?.originalValue)?new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,...t?.context?.dateFormat}).format(e.value):new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,timeStyle:`long`,...t?.context?.dateTimeFormat}).format(e.value),v=e=>(t,n)=>{let r=n??{},i=(0,c.lc)(t.operator),a=``,{fieldData:o,quoteFieldNamesWith:s=[``,``],fieldIdentifierSeparator:l=``,operatorProcessor:u=c.defaultOperatorProcessorNL,wordOrder:f=`SVO`,context:p={},operatorMap:m=g}=r;if(!d(p.isDateField,t,r))return(0,c.defaultRuleProcessorNL)(t,r);if(t.valueSource===`field`)return(0,c.defaultRuleProcessorNL)(t,{...r,operatorMap:g});if((i===`in`||i===`notin`||i===`between`||i===`notbetween`)&&!t.value)return``;let h=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(i){case`in`:case`notin`:if(h.length===0)return``;a=`(${h.map(e=>_({field:t.field,operator:`=`,value:e[1]},{...r,context:{...p,originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`notbetween`:{if(h.length<2)return``;let[n,i]=h;a=(e.isBefore(n[1],i[1])?[n,i]:[i,n]).map(([e,n])=>_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}})).join(` ${r.translations?.and??`and`} `)}break;default:{let[e,n]=h[0]??[``,``];a=e?_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}}):``}}let v=(0,c.getQuotedFieldName)(o?.label??t.field,{quoteFieldNamesWith:s,fieldIdentifierSeparator:l}),y=u(t,{...r,operatorMap:{...g,...m}}),b={S:v,V:y,O:a};return(0,c.normalizeConstituentWordOrder)(f).map(e=>`${b[e]}`).join(` `).trim()},y=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>l(r?.context?.originalValue)?(0,c.defaultValueProcessorByRule)({...n,value:e(n.value)},r):(0,c.defaultValueProcessorByRule)({...n,value:t(n.value)},r),b=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:small)?datetime/i.test(r?.fieldData?.datatype)?`datetimeoffset`:`date`,a=i===`datetimeoffset`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},x=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:datetime|timestamp)/i.test(r?.fieldData?.datatype)?`datetime`:`date`,a=i===`datetime`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},S=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value).replaceAll(`T`,` `).replace(`Z`,` UTC`):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},C=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},w={ansi:y,mssql:b,mysql:x,oracle:S,postgresql:C,sqlite:y},T=e=>(t,n)=>{let r=n??{},i=(0,c.mapSQLOperator)(t.operator),a=(0,c.lc)(i),{quoteFieldNamesWith:o=[``,``],fieldIdentifierSeparator:s=``,context:l={}}=r,u=``;if(t.valueSource===`field`||!d(l.isDateField,t,r))return(0,c.defaultRuleProcessorSQL)(t,r);let f=w[r.preset](e),p=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(a){case`in`:case`not in`:if(p.length===0)return``;u=`(${p.map(e=>f({field:t.field,operator:`=`,value:e[1]},{...r,context:{originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`not between`:{if(p.length<2)return``;let[n,i]=p;u=(e.isBefore(n[1],i[1])?[n,i]:[i,n]).map(([e,n])=>f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})).join(` and `)}break;default:{let[e,n]=p[0]??[``,``];u=f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})}}return`${(0,c.getQuotedFieldName)(t.field,{quoteFieldNamesWith:o,fieldIdentifierSeparator:s})} ${i} ${u}`.trim()};Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`datetimeValueProcessorNL`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`defaultDateTimeNLOperatorMap`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`getDatetimeJsonLogicOperations`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`getDatetimeRuleProcessorCEL`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`getDatetimeRuleProcessorMongoDBQuery`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`getDatetimeRuleProcessorNL`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`getDatetimeRuleProcessorSQL`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`getDatetimeValueProcessorANSI`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`getDatetimeValueProcessorMSSQL`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`getDatetimeValueProcessorMySQL`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`getDatetimeValueProcessorOracle`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`getDatetimeValueProcessorPostgreSQL`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`isISOStringDateOnly`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`processIsDateField`,{enumerable:!0,get:function(){return d}});
|
|
2
|
+
//# sourceMappingURL=getDatetimeRuleProcessorSQL-D95jgDK6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDatetimeRuleProcessorSQL-D95jgDK6.js","names":["defaultIsDateField: IsDateFieldFunction","mongoOperators","defaultDateTimeNLOperatorMap: ExportOperatorMap","datetimeValueProcessorNL: ValueProcessorByRule","defaultOperatorProcessorNL"],"sources":["../../src/utils.ts","../../src/getDatetimeJsonLogicOperations.ts","../../src/getDatetimeRuleProcessorCEL.ts","../../src/getDatetimeRuleProcessorMongoDBQuery.ts","../../src/getDatetimeRuleProcessorNL.ts","../../src/getDatetimeRuleProcessorSQL.ts"],"sourcesContent":["import type { RuleProcessor } from 'react-querybuilder';\nimport type { IsDateField, IsDateFieldFunction } from './types';\n\nexport const isISOStringDateOnly = (\n date: unknown\n): date is `${number}${number}${number}${number}-${number}${number}-${number}${number}` =>\n typeof date === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(date);\n\nexport const defaultIsDateField: IsDateFieldFunction = (\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean =>\n rule.operator !== 'contains' &&\n rule.operator !== 'beginsWith' &&\n rule.operator !== 'endsWith' &&\n rule.operator !== 'doesNotContain' &&\n rule.operator !== 'doesNotBeginWith' &&\n rule.operator !== 'doesNotEndWith' &&\n rule.operator !== 'null' &&\n rule.operator !== 'notNull' &&\n /^(?:date|datetime|datetimeoffset|timestamp)\\b/i.test(opts?.fieldData?.datatype as string);\n\nexport const processIsDateField = (\n isDateField: IsDateField,\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean => {\n if (typeof isDateField === 'boolean') {\n return isDateField;\n }\n\n if (typeof isDateField === 'function') {\n return isDateField(rule, opts);\n }\n\n if (Array.isArray(isDateField)) {\n return isDateField.some(condition =>\n Object.entries(condition).every(([key, value]) => opts?.fieldData?.[key] === value)\n );\n }\n\n if (typeof isDateField === 'object') {\n return Object.entries(isDateField).every(([key, value]) => opts?.fieldData?.[key] === value);\n }\n\n return defaultIsDateField(rule, opts);\n};\n","import type { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom operations for use with JsonLogic objects generated by\n * {@link datetimeRuleProcessorJsonLogic}.\n */\nexport const getDatetimeJsonLogicOperations = ({\n isAfter,\n isBefore,\n isSame,\n}: RQBDateTimeLibraryAPI): RQBJsonLogicDateTimeOperations => ({\n dateAfter: (a, b) => isAfter(a, b),\n dateBefore: (a, b) => isBefore(a, b),\n dateBetween: (a, b, c) =>\n isSame(b, a) ||\n isSame(b, c) ||\n (isAfter(b, a) && isBefore(b, c)) ||\n (isAfter(b, c) && isBefore(b, a)),\n dateNotBetween: (a, b, c) =>\n !isSame(b, a) &&\n !isSame(b, c) &&\n ((isBefore(a, c) && (isBefore(b, a) || isAfter(b, c))) ||\n (isAfter(a, c) && (isBefore(b, c) || isAfter(b, a)))),\n dateIn: (a, b) => b.some(v => isSame(a, v)),\n dateNotIn: (a, b) => b.every(v => !isSame(a, v)),\n dateNotOn: (a, b) => !isSame(a, b),\n dateOn: (a, b) => isSame(a, b),\n dateOnOrAfter: (a, b) => isAfter(a, b) || isSame(a, b),\n dateOnOrBefore: (a, b) => isBefore(a, b) || isSame(a, b),\n});\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorCEL, lc, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"cel\" format.\n */\nexport const getDatetimeRuleProcessorCEL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { context = {} } = opts;\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorCEL(rule, opts);\n }\n\n const ts = (d: string | Date) => `timestamp(\"${apiFns.toISOString(d)}\")`;\n\n const operatorTL = lc(rule.operator.replace(/^=$/, '=='));\n\n switch (operatorTL) {\n case '<':\n case '<=':\n case '==':\n case '!=':\n case '>':\n case '>=':\n return `${rule.field} ${operatorTL} ${ts(rule.value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operatorTL) {\n case 'in':\n case 'notin': {\n if (valueAsDateArray.length === 0) return '';\n const [prefix, suffix] = shouldNegate(operatorTL) ? ['!(', ')'] : ['', ''];\n return `${prefix}${rule.field} in [${valueAsDateArray\n .map(val => ts(val))\n .join(', ')}]${suffix}`;\n }\n\n case 'between':\n case 'notbetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n return operatorTL === 'between'\n ? `(${rule.field} >= ${ts(firstDate)} && ${rule.field} <= ${ts(secondDate)})`\n : `(${rule.field} < ${ts(firstDate)} || ${rule.field} > ${ts(secondDate)})`;\n }\n }\n\n return defaultRuleProcessorCEL(rule, opts);\n };\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorMongoDBQuery, mongoOperators, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"mongodb_query\" format.\n */\nexport const getDatetimeRuleProcessorMongoDBQuery =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { field, operator, value, valueSource } = rule;\n\n if (valueSource === 'field' || !processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n }\n\n if (operator === '=') {\n return { [field]: apiFns.toDate(value) };\n }\n\n switch (operator) {\n case '<':\n case '<=':\n case '!=':\n case '>':\n case '>=':\n return { [field]: { [mongoOperators[operator]]: apiFns.toDate(value) } };\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn':\n return { [field]: { [mongoOperators[operator]]: valueAsDateArray } };\n\n case 'between':\n case 'notBetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first, second) ? [first, second] : [second, first];\n return operator === 'between'\n ? { [field]: { $gte: orderedArray[0], $lte: orderedArray[1] } }\n : {\n $or: [{ [field]: { $lt: orderedArray[0] } }, { [field]: { $gt: orderedArray[1] } }],\n };\n }\n }\n\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n };\n","import type { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultOperatorProcessorNL,\n defaultRuleProcessorNL,\n getQuotedFieldName,\n lc,\n normalizeConstituentWordOrder,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\nexport const defaultDateTimeNLOperatorMap: ExportOperatorMap = {\n // '=': 'is',\n // '!=': 'is not',\n '<': 'is before',\n '>': 'is after',\n '<=': 'is on or before',\n '>=': 'is on or after',\n in: ['is one of the dates', 'is the same as a date in'],\n notin: ['is not one of the dates', 'is not the same as any date in'],\n between: ['is between', 'is between the dates in'],\n notbetween: ['is not between', 'is not between the dates in'],\n};\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"natural_language\" format.\n */\nexport const datetimeValueProcessorNL: ValueProcessorByRule = (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n ...opts?.context?.dateFormat,\n }).format(rule.value);\n }\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n timeStyle: 'long',\n ...opts?.context?.dateTimeFormat,\n }).format(rule.value);\n};\n\n/**\n * Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"natural_language\" format.\n */\nexport const getDatetimeRuleProcessorNL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operatorLowerCase = lc(rule.operator);\n let finalValue = '';\n\n // istanbul ignore next\n const {\n fieldData,\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n operatorProcessor = defaultOperatorProcessorNL,\n // valueProcessor = datetimeValueProcessorNL,\n wordOrder = 'SVO',\n context = {},\n operatorMap = defaultDateTimeNLOperatorMap,\n } = opts;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorNL(rule, opts);\n }\n\n if (rule.valueSource === 'field') {\n return defaultRuleProcessorNL(rule, { ...opts, operatorMap: defaultDateTimeNLOperatorMap });\n }\n\n if (\n (operatorLowerCase === 'in' ||\n operatorLowerCase === 'notin' ||\n operatorLowerCase === 'between' ||\n operatorLowerCase === 'notbetween') &&\n !rule.value\n ) {\n return '';\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'notin':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { ...context, originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'notbetween':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n )\n .join(` ${opts.translations?.and ?? 'and'} `);\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = originalValue\n ? datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n : '';\n }\n }\n\n const processedField = getQuotedFieldName(fieldData?.label ?? rule.field, {\n quoteFieldNamesWith,\n fieldIdentifierSeparator,\n });\n\n const processedOperator = operatorProcessor(rule, {\n ...opts,\n operatorMap: { ...defaultDateTimeNLOperatorMap, ...operatorMap },\n });\n\n const wordOrderMap = {\n S: processedField,\n V: processedOperator,\n O: finalValue,\n };\n\n return normalizeConstituentWordOrder(wordOrder)\n .map(term => `${wordOrderMap[term]}`)\n .join(' ')\n .trim();\n };\n","import type { RuleProcessor, SQLPreset, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultRuleProcessorSQL,\n defaultValueProcessorByRule,\n getQuotedFieldName,\n lc,\n mapSQLOperator,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"sql\" format and \"ansi\" preset.\n */\nexport const getDatetimeValueProcessorANSI =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return defaultValueProcessorByRule({ ...rule, value: toISOStringDateOnly(rule.value) }, opts);\n }\n return defaultValueProcessorByRule({ ...rule, value: toISOString(rule.value as Date) }, opts);\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"sql\" format and \"mssql\" preset.\n */\nexport const getDatetimeValueProcessorMSSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:small)?datetime/i.test(opts?.fieldData?.datatype as string)\n ? 'datetimeoffset'\n : 'date';\n const value =\n datatype === 'datetimeoffset' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"sql\" format and \"mysql\" preset.\n */\nexport const getDatetimeValueProcessorMySQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:datetime|timestamp)/i.test(opts?.fieldData?.datatype as string)\n ? 'datetime'\n : 'date';\n const value =\n datatype === 'datetime' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"sql\" format and \"oracle\" preset.\n */\nexport const getDatetimeValueProcessorOracle =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n // Oracle date format for _reading_ ISO 8601: 'YYYY-MM-DD\"T\"HH24:MI:SS.ff3\"Z\"'\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp'\n ? toISOString(rule.value).replaceAll('T', ' ').replace('Z', ' UTC')\n : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"sql\" format and \"postgresql\" preset.\n */\nexport const getDatetimeValueProcessorPostgreSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\nconst presetToValueProcessorMap = {\n ansi: getDatetimeValueProcessorANSI,\n mssql: getDatetimeValueProcessorMSSQL,\n mysql: getDatetimeValueProcessorMySQL,\n oracle: getDatetimeValueProcessorOracle,\n postgresql: getDatetimeValueProcessorPostgreSQL,\n sqlite: getDatetimeValueProcessorANSI,\n} satisfies Record<SQLPreset, (apiFns: RQBDateTimeLibraryAPI) => ValueProcessorByRule>;\n\n/**\n * Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with\n * the \"sql\" format.\n */\nexport const getDatetimeRuleProcessorSQL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operator = mapSQLOperator(rule.operator);\n const operatorLowerCase = lc(operator);\n // istanbul ignore next\n const {\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n context = {},\n } = opts;\n let finalValue = '';\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorSQL(rule, opts);\n }\n\n const valueProcessor = presetToValueProcessorMap[opts.preset!](apiFns);\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'not in':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n valueProcessor(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'not between':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n )\n )\n .join(' and ');\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n );\n }\n }\n\n return `${getQuotedFieldName(rule.field, { quoteFieldNamesWith, fieldIdentifierSeparator })} ${operator} ${finalValue}`.trim();\n };\n"],"mappings":"ygBAGA,MAAa,EACX,GAEA,OAAO,GAAS,UAAY,sBAAsB,KAAK,EAAK,CAEjDA,GACX,GAAG,CAAC,EAAM,KAEV,EAAK,WAAa,YAClB,EAAK,WAAa,cAClB,EAAK,WAAa,YAClB,EAAK,WAAa,kBAClB,EAAK,WAAa,oBAClB,EAAK,WAAa,kBAClB,EAAK,WAAa,QAClB,EAAK,WAAa,WAClB,iDAAiD,KAAK,GAAM,WAAW,SAAmB,CAE/E,GACX,EACA,GAAG,CAAC,EAAM,KAEN,OAAO,GAAgB,UAClB,EAGL,OAAO,GAAgB,WAClB,EAAY,EAAM,EAAK,CAG5B,MAAM,QAAQ,EAAY,CACrB,EAAY,KAAK,GACtB,OAAO,QAAQ,EAAU,CAAC,OAAO,CAAC,EAAK,KAAW,GAAM,YAAY,KAAS,EAAM,CACpF,CAGC,OAAO,GAAgB,SAClB,OAAO,QAAQ,EAAY,CAAC,OAAO,CAAC,EAAK,KAAW,GAAM,YAAY,KAAS,EAAM,CAGvF,EAAmB,EAAM,EAAK,CCrC1B,GAAkC,CAC7C,UACA,WACA,aAC4D,CAC5D,WAAY,EAAG,IAAM,EAAQ,EAAG,EAAE,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P,GAAM,CAAC,EAAe,GAAS,EAAiB,IAAM,CAAC,GAAI,GAAG,CAC9D,EAAa,EACX,CAAE,MAAO,EAAK,MAAO,SAAU,IAAK,QAAO,CAC3C,CAAE,GAAG,EAAM,QAAS,CAAE,gBAAe,CAAE,CACxC,EAIL,MAAO,IAAA,EAAA,EAAA,oBAAsB,EAAK,MAAO,CAAE,sBAAqB,2BAA0B,CAAC,CAAC,GAAG,EAAS,GAAG,IAAa,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react-querybuilder_datetime.cjs.development.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react-querybuilder_datetime.cjs.development.jsdate.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react-querybuilder_datetime.cjs.development.luxon.js';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ExportOperatorMap, IsDateField, IsDateFieldFunction, RQBDateTimeJsonLogic, RQBDateTimeLibraryAPI, RQBJsonLogicDateAfter, RQBJsonLogicDateBefore, RQBJsonLogicDateBetween, RQBJsonLogicDateIn, RQBJsonLogicDateNotBetween, RQBJsonLogicDateNotIn, RQBJsonLogicDateNotOn, RQBJsonLogicDateOn, RQBJsonLogicDateOnOrAfter, RQBJsonLogicDateOnOrBefore, RQBJsonLogicDateTimeOperations, RuleProcessor, ValueProcessorByRule } from "./types-QCQUGVZa.js";
|
|
2
|
+
|
|
3
|
+
//#region src/datetimeRuleProcessorJsonLogic.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}
|
|
7
|
+
* with the "jsonlogic" format.
|
|
8
|
+
*
|
|
9
|
+
* Note: Unlike other date/time rule processors from this library, this function does
|
|
10
|
+
* not require a date/time library API. Instead, the date/time library API is used by
|
|
11
|
+
* {@link getDatetimeJsonLogicOperations} during the evaluation process.
|
|
12
|
+
*/
|
|
13
|
+
declare const datetimeRuleProcessorJsonLogic: RuleProcessor;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/getDatetimeJsonLogicOperations.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Custom operations for use with JsonLogic objects generated by
|
|
18
|
+
* {@link datetimeRuleProcessorJsonLogic}.
|
|
19
|
+
*/
|
|
20
|
+
declare const getDatetimeJsonLogicOperations: ({
|
|
21
|
+
isAfter,
|
|
22
|
+
isBefore,
|
|
23
|
+
isSame
|
|
24
|
+
}: RQBDateTimeLibraryAPI) => RQBJsonLogicDateTimeOperations;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/getDatetimeRuleProcessorCEL.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* Generates a rule processor with date/time features for use by
|
|
29
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "cel" format.
|
|
30
|
+
*/
|
|
31
|
+
declare const getDatetimeRuleProcessorCEL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/getDatetimeRuleProcessorJSONata.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Generates a rule processor with date/time features for use by
|
|
36
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "jsonata" format.
|
|
37
|
+
*/
|
|
38
|
+
declare const getDatetimeRuleProcessorJSONata: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/getDatetimeRuleProcessorMongoDBQuery.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Generates a rule processor with date/time features for use by
|
|
43
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "mongodb_query" format.
|
|
44
|
+
*/
|
|
45
|
+
declare const getDatetimeRuleProcessorMongoDBQuery: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/getDatetimeRuleProcessorNL.d.ts
|
|
48
|
+
declare const defaultDateTimeNLOperatorMap: ExportOperatorMap;
|
|
49
|
+
/**
|
|
50
|
+
* Generates a value processor with date/time features for use by
|
|
51
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "natural_language" format.
|
|
52
|
+
*/
|
|
53
|
+
declare const datetimeValueProcessorNL: ValueProcessorByRule;
|
|
54
|
+
/**
|
|
55
|
+
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
56
|
+
* the "natural_language" format.
|
|
57
|
+
*/
|
|
58
|
+
declare const getDatetimeRuleProcessorNL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/getDatetimeRuleProcessorSQL.d.ts
|
|
61
|
+
/**
|
|
62
|
+
* Generates a value processor with date/time features for use by
|
|
63
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sql" format and "ansi" preset.
|
|
64
|
+
*/
|
|
65
|
+
declare const getDatetimeValueProcessorANSI: ({
|
|
66
|
+
toISOStringDateOnly,
|
|
67
|
+
toISOString
|
|
68
|
+
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
69
|
+
/**
|
|
70
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
71
|
+
* the "sql" format and "mssql" preset.
|
|
72
|
+
*/
|
|
73
|
+
declare const getDatetimeValueProcessorMSSQL: ({
|
|
74
|
+
toISOStringDateOnly,
|
|
75
|
+
toISOString
|
|
76
|
+
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
77
|
+
/**
|
|
78
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
79
|
+
* the "sql" format and "mysql" preset.
|
|
80
|
+
*/
|
|
81
|
+
declare const getDatetimeValueProcessorMySQL: ({
|
|
82
|
+
toISOStringDateOnly,
|
|
83
|
+
toISOString
|
|
84
|
+
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
85
|
+
/**
|
|
86
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
87
|
+
* the "sql" format and "oracle" preset.
|
|
88
|
+
*/
|
|
89
|
+
declare const getDatetimeValueProcessorOracle: ({
|
|
90
|
+
toISOStringDateOnly,
|
|
91
|
+
toISOString
|
|
92
|
+
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
93
|
+
/**
|
|
94
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
95
|
+
* the "sql" format and "postgresql" preset.
|
|
96
|
+
*/
|
|
97
|
+
declare const getDatetimeValueProcessorPostgreSQL: ({
|
|
98
|
+
toISOStringDateOnly,
|
|
99
|
+
toISOString
|
|
100
|
+
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
101
|
+
/**
|
|
102
|
+
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
103
|
+
* the "sql" format.
|
|
104
|
+
*/
|
|
105
|
+
declare const getDatetimeRuleProcessorSQL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
106
|
+
//#endregion
|
|
107
|
+
export { IsDateField, IsDateFieldFunction, RQBDateTimeJsonLogic, RQBDateTimeLibraryAPI, RQBJsonLogicDateAfter, RQBJsonLogicDateBefore, RQBJsonLogicDateBetween, RQBJsonLogicDateIn, RQBJsonLogicDateNotBetween, RQBJsonLogicDateNotIn, RQBJsonLogicDateNotOn, RQBJsonLogicDateOn, RQBJsonLogicDateOnOrAfter, RQBJsonLogicDateOnOrBefore, RQBJsonLogicDateTimeOperations, datetimeRuleProcessorJsonLogic, datetimeValueProcessorNL, defaultDateTimeNLOperatorMap, getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorJSONata, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorSQL, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL };
|
|
108
|
+
//# sourceMappingURL=react-querybuilder_datetime.cjs.development.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations, RuleProcessor, ValueProcessorByRule } from "./types-QCQUGVZa.js";
|
|
2
|
+
|
|
3
|
+
//#region src/rqbDateTimeLibraryAPI.date-fns.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* {@link RQBDateTimeLibraryAPI} for date-fns
|
|
7
|
+
*/
|
|
8
|
+
declare const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/index.date-fns.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Custom JsonLogic date/time operations using date-fns
|
|
13
|
+
*/
|
|
14
|
+
declare const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations;
|
|
15
|
+
/**
|
|
16
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using date-fns
|
|
17
|
+
*/
|
|
18
|
+
declare const datetimeRuleProcessorSQL: RuleProcessor;
|
|
19
|
+
/**
|
|
20
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using date-fns
|
|
21
|
+
*/
|
|
22
|
+
declare const datetimeValueProcessorANSI: ValueProcessorByRule;
|
|
23
|
+
/**
|
|
24
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using date-fns
|
|
25
|
+
*/
|
|
26
|
+
declare const datetimeValueProcessorMSSQL: ValueProcessorByRule;
|
|
27
|
+
/**
|
|
28
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using date-fns
|
|
29
|
+
*/
|
|
30
|
+
declare const datetimeValueProcessorMySQL: ValueProcessorByRule;
|
|
31
|
+
/**
|
|
32
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using date-fns
|
|
33
|
+
*/
|
|
34
|
+
declare const datetimeValueProcessorOracle: ValueProcessorByRule;
|
|
35
|
+
/**
|
|
36
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using date-fns
|
|
37
|
+
*/
|
|
38
|
+
declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
|
|
39
|
+
/**
|
|
40
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using date-fns
|
|
41
|
+
*/
|
|
42
|
+
declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
|
|
43
|
+
/**
|
|
44
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using date-fns
|
|
45
|
+
*/
|
|
46
|
+
declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
|
|
47
|
+
/**
|
|
48
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using date-fns
|
|
49
|
+
*/
|
|
50
|
+
declare const datetimeRuleProcessorNL: ValueProcessorByRule;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
53
|
+
//# sourceMappingURL=react-querybuilder_datetime.cjs.development.date-fns.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-
|
|
2
|
-
|
|
1
|
+
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-D95jgDK6.js');
|
|
2
|
+
let date_fns = require("date-fns");
|
|
3
|
+
date_fns = require_getDatetimeRuleProcessorSQL.__toESM(date_fns);
|
|
3
4
|
|
|
4
5
|
//#region src/rqbDateTimeLibraryAPI.date-fns.ts
|
|
5
6
|
const toDate = (a) => typeof a === "string" ? (0, date_fns.parseISO)(a) : (0, date_fns.toDate)(a);
|
|
@@ -35,39 +36,39 @@ const rqbDateTimeLibraryAPI = {
|
|
|
35
36
|
*/
|
|
36
37
|
const jsonLogicDateTimeOperations = require_getDatetimeRuleProcessorSQL.getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);
|
|
37
38
|
/**
|
|
38
|
-
* {@link react-querybuilder!
|
|
39
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using date-fns
|
|
39
40
|
*/
|
|
40
41
|
const datetimeRuleProcessorSQL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);
|
|
41
42
|
/**
|
|
42
|
-
* {@link react-querybuilder!
|
|
43
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using date-fns
|
|
43
44
|
*/
|
|
44
45
|
const datetimeValueProcessorANSI = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);
|
|
45
46
|
/**
|
|
46
|
-
* {@link react-querybuilder!
|
|
47
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using date-fns
|
|
47
48
|
*/
|
|
48
49
|
const datetimeValueProcessorMSSQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);
|
|
49
50
|
/**
|
|
50
|
-
* {@link react-querybuilder!
|
|
51
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using date-fns
|
|
51
52
|
*/
|
|
52
53
|
const datetimeValueProcessorMySQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);
|
|
53
54
|
/**
|
|
54
|
-
* {@link react-querybuilder!
|
|
55
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using date-fns
|
|
55
56
|
*/
|
|
56
57
|
const datetimeValueProcessorOracle = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);
|
|
57
58
|
/**
|
|
58
|
-
* {@link react-querybuilder!
|
|
59
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using date-fns
|
|
59
60
|
*/
|
|
60
61
|
const datetimeValueProcessorPostgreSQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);
|
|
61
62
|
/**
|
|
62
|
-
* {@link react-querybuilder!
|
|
63
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using date-fns
|
|
63
64
|
*/
|
|
64
65
|
const datetimeRuleProcessorCEL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
65
66
|
/**
|
|
66
|
-
* {@link react-querybuilder!
|
|
67
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using date-fns
|
|
67
68
|
*/
|
|
68
69
|
const datetimeRuleProcessorMongoDBQuery = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
69
70
|
/**
|
|
70
|
-
* {@link react-querybuilder!
|
|
71
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using date-fns
|
|
71
72
|
*/
|
|
72
73
|
const datetimeRuleProcessorNL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);
|
|
73
74
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.date-fns.js","names":["toDate: typeof dateFnsToDate","rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","isISOStringDateOnly","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","getDatetimeJsonLogicOperations","datetimeRuleProcessorSQL: RuleProcessor","getDatetimeRuleProcessorSQL","datetimeValueProcessorANSI: ValueProcessorByRule","getDatetimeValueProcessorANSI","datetimeValueProcessorMSSQL: ValueProcessorByRule","getDatetimeValueProcessorMSSQL","datetimeValueProcessorMySQL: ValueProcessorByRule","getDatetimeValueProcessorMySQL","datetimeValueProcessorOracle: ValueProcessorByRule","getDatetimeValueProcessorOracle","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","getDatetimeValueProcessorPostgreSQL","datetimeRuleProcessorCEL: ValueProcessorByRule","getDatetimeRuleProcessorCEL","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","getDatetimeRuleProcessorMongoDBQuery","datetimeRuleProcessorNL: ValueProcessorByRule","getDatetimeRuleProcessorNL"],"sources":["../../src/rqbDateTimeLibraryAPI.date-fns.ts","../../src/index.date-fns.ts"],"sourcesContent":["import {\n toDate as dateFnsToDate,\n format,\n isAfter,\n isBefore,\n isSameDay,\n isValid,\n parseISO,\n} from 'date-fns';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDate: typeof dateFnsToDate = a => (typeof a === 'string' ? parseISO(a) : dateFnsToDate(a));\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for date-fns\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => format(toDate(d), fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter,\n isBefore,\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? isSameDay(aToDate, bToDate)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid: d => isValid(toDate(d)),\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? format(dToDate, iso8601DateOnly) : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/date-fns\"` for enhanced date/time support using [date-fns](https://date-fns.org/).\n *\n * @module date-fns\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.date-fns';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using date-fns\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.development.date-fns.js","names":["toDate: typeof dateFnsToDate","rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","isISOStringDateOnly","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","getDatetimeJsonLogicOperations","datetimeRuleProcessorSQL: RuleProcessor","getDatetimeRuleProcessorSQL","datetimeValueProcessorANSI: ValueProcessorByRule","getDatetimeValueProcessorANSI","datetimeValueProcessorMSSQL: ValueProcessorByRule","getDatetimeValueProcessorMSSQL","datetimeValueProcessorMySQL: ValueProcessorByRule","getDatetimeValueProcessorMySQL","datetimeValueProcessorOracle: ValueProcessorByRule","getDatetimeValueProcessorOracle","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","getDatetimeValueProcessorPostgreSQL","datetimeRuleProcessorCEL: ValueProcessorByRule","getDatetimeRuleProcessorCEL","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","getDatetimeRuleProcessorMongoDBQuery","datetimeRuleProcessorNL: ValueProcessorByRule","getDatetimeRuleProcessorNL"],"sources":["../../src/rqbDateTimeLibraryAPI.date-fns.ts","../../src/index.date-fns.ts"],"sourcesContent":["import {\n toDate as dateFnsToDate,\n format,\n isAfter,\n isBefore,\n isSameDay,\n isValid,\n parseISO,\n} from 'date-fns';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDate: typeof dateFnsToDate = a => (typeof a === 'string' ? parseISO(a) : dateFnsToDate(a));\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for date-fns\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => format(toDate(d), fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter,\n isBefore,\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? isSameDay(aToDate, bToDate)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid: d => isValid(toDate(d)),\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? format(dToDate, iso8601DateOnly) : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/date-fns\"` for enhanced date/time support using [date-fns](https://date-fns.org/).\n *\n * @module date-fns\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.date-fns';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using date-fns\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using date-fns\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using date-fns\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using date-fns\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using date-fns\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using date-fns\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using date-fns\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using date-fns\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using date-fns\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using date-fns\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.date-fns';\n"],"mappings":";;;;;AAYA,MAAMA,UAA+B,MAAM,OAAO,MAAM,kCAAoB,EAAE,wBAAiB,EAAE;AACjG,MAAM,kBAAkB;;;;AAKxB,MAAaC,wBAA+C;CAC1D,SAAS,GAAG,6BAAe,OAAO,EAAE,EAAE,IAAI,QAAQ,cAAc,gBAAgB,CAAC;CACjF;CACA;CACA,SAAS,GAAG,MAAM;EAChB,MAAM,UAAU,OAAO,EAAE;EACzB,MAAM,UAAU,OAAO,EAAE;AACzB,SAAOC,wDAAoB,EAAE,IAAIA,wDAAoB,EAAE,2BACzC,SAAS,QAAQ,GAC3B,QAAQ,SAAS,KAAK,QAAQ,SAAS;;CAE7C,UAAS,4BAAa,OAAO,EAAE,CAAC;CAChC;CACA,cAAa,MAAK;EAChB,MAAM,UAAU,OAAO,EAAE;AACzB,+BAAe,QAAQ,GAAG,QAAQ,aAAa,GAAG;;CAEpD,sBAAqB,MAAK;EACxB,MAAM,UAAU,OAAO,EAAE;AACzB,+BAAe,QAAQ,wBAAU,SAAS,gBAAgB,GAAG;;CAEhE;;;;;;;ACdD,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAKvD,MAAaC,2BACXC,gEAA4B,sBAAsB;;;;AAIpD,MAAaC,6BACXC,kEAA8B,sBAAsB;;;;AAItD,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAIvD,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAIvD,MAAaC,+BACXC,oEAAgC,sBAAsB;;;;AAIxD,MAAaC,mCACXC,wEAAoC,sBAAsB;;;;AAK5D,MAAaC,2BACXC,gEAA4B,sBAAsB;;;;AAKpD,MAAaC,oCACXC,yEAAqC,sBAAsB;;;;AAK7D,MAAaC,0BACXC,+DAA2B,sBAAsB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations, RuleProcessor, ValueProcessorByRule } from "./types-QCQUGVZa.js";
|
|
2
|
+
|
|
3
|
+
//#region src/rqbDateTimeLibraryAPI.dayjs.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* {@link RQBDateTimeLibraryAPI} for Day.js
|
|
7
|
+
*/
|
|
8
|
+
declare const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/index.dayjs.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Custom JsonLogic date/time operations using Day.js
|
|
13
|
+
*/
|
|
14
|
+
declare const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations;
|
|
15
|
+
/**
|
|
16
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using Day.js
|
|
17
|
+
*/
|
|
18
|
+
declare const datetimeRuleProcessorSQL: RuleProcessor;
|
|
19
|
+
/**
|
|
20
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Day.js
|
|
21
|
+
*/
|
|
22
|
+
declare const datetimeValueProcessorANSI: ValueProcessorByRule;
|
|
23
|
+
/**
|
|
24
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Day.js
|
|
25
|
+
*/
|
|
26
|
+
declare const datetimeValueProcessorMSSQL: ValueProcessorByRule;
|
|
27
|
+
/**
|
|
28
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Day.js
|
|
29
|
+
*/
|
|
30
|
+
declare const datetimeValueProcessorMySQL: ValueProcessorByRule;
|
|
31
|
+
/**
|
|
32
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Day.js
|
|
33
|
+
*/
|
|
34
|
+
declare const datetimeValueProcessorOracle: ValueProcessorByRule;
|
|
35
|
+
/**
|
|
36
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Day.js
|
|
37
|
+
*/
|
|
38
|
+
declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
|
|
39
|
+
/**
|
|
40
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using Day.js
|
|
41
|
+
*/
|
|
42
|
+
declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
|
|
43
|
+
/**
|
|
44
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Day.js
|
|
45
|
+
*/
|
|
46
|
+
declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
|
|
47
|
+
/**
|
|
48
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using Day.js
|
|
49
|
+
*/
|
|
50
|
+
declare const datetimeRuleProcessorNL: ValueProcessorByRule;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
53
|
+
//# sourceMappingURL=react-querybuilder_datetime.cjs.development.dayjs.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-
|
|
2
|
-
|
|
1
|
+
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-D95jgDK6.js');
|
|
2
|
+
let dayjs = require("dayjs");
|
|
3
|
+
dayjs = require_getDatetimeRuleProcessorSQL.__toESM(dayjs);
|
|
3
4
|
|
|
4
5
|
//#region src/rqbDateTimeLibraryAPI.dayjs.ts
|
|
5
6
|
/**
|
|
@@ -29,39 +30,39 @@ const rqbDateTimeLibraryAPI = {
|
|
|
29
30
|
*/
|
|
30
31
|
const jsonLogicDateTimeOperations = require_getDatetimeRuleProcessorSQL.getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);
|
|
31
32
|
/**
|
|
32
|
-
* {@link react-querybuilder!
|
|
33
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using Day.js
|
|
33
34
|
*/
|
|
34
35
|
const datetimeRuleProcessorSQL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);
|
|
35
36
|
/**
|
|
36
|
-
* {@link react-querybuilder!
|
|
37
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Day.js
|
|
37
38
|
*/
|
|
38
39
|
const datetimeValueProcessorANSI = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);
|
|
39
40
|
/**
|
|
40
|
-
* {@link react-querybuilder!
|
|
41
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Day.js
|
|
41
42
|
*/
|
|
42
43
|
const datetimeValueProcessorMSSQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);
|
|
43
44
|
/**
|
|
44
|
-
* {@link react-querybuilder!
|
|
45
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Day.js
|
|
45
46
|
*/
|
|
46
47
|
const datetimeValueProcessorMySQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);
|
|
47
48
|
/**
|
|
48
|
-
* {@link react-querybuilder!
|
|
49
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Day.js
|
|
49
50
|
*/
|
|
50
51
|
const datetimeValueProcessorOracle = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);
|
|
51
52
|
/**
|
|
52
|
-
* {@link react-querybuilder!
|
|
53
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Day.js
|
|
53
54
|
*/
|
|
54
55
|
const datetimeValueProcessorPostgreSQL = require_getDatetimeRuleProcessorSQL.getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);
|
|
55
56
|
/**
|
|
56
|
-
* {@link react-querybuilder!
|
|
57
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using Day.js
|
|
57
58
|
*/
|
|
58
59
|
const datetimeRuleProcessorCEL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
59
60
|
/**
|
|
60
|
-
* {@link react-querybuilder!
|
|
61
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Day.js
|
|
61
62
|
*/
|
|
62
63
|
const datetimeRuleProcessorMongoDBQuery = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
63
64
|
/**
|
|
64
|
-
* {@link react-querybuilder!
|
|
65
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using Day.js
|
|
65
66
|
*/
|
|
66
67
|
const datetimeRuleProcessorNL = require_getDatetimeRuleProcessorSQL.getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);
|
|
67
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.dayjs.js","names":["rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","isISOStringDateOnly","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","getDatetimeJsonLogicOperations","datetimeRuleProcessorSQL: RuleProcessor","getDatetimeRuleProcessorSQL","datetimeValueProcessorANSI: ValueProcessorByRule","getDatetimeValueProcessorANSI","datetimeValueProcessorMSSQL: ValueProcessorByRule","getDatetimeValueProcessorMSSQL","datetimeValueProcessorMySQL: ValueProcessorByRule","getDatetimeValueProcessorMySQL","datetimeValueProcessorOracle: ValueProcessorByRule","getDatetimeValueProcessorOracle","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","getDatetimeValueProcessorPostgreSQL","datetimeRuleProcessorCEL: ValueProcessorByRule","getDatetimeRuleProcessorCEL","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","getDatetimeRuleProcessorMongoDBQuery","datetimeRuleProcessorNL: ValueProcessorByRule","getDatetimeRuleProcessorNL"],"sources":["../../src/rqbDateTimeLibraryAPI.dayjs.ts","../../src/index.dayjs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Day.js\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => dayjs(d).format(fmt),\n isAfter: (a, b) => dayjs(a).isAfter(b),\n isBefore: (a, b) => dayjs(a).isBefore(b),\n isSame: (a, b) =>\n dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? 'd' : 'ms'),\n isValid: d => dayjs(d).isValid(),\n toDate: d => dayjs(d).toDate(),\n toISOString: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.format('YYYY-MM-DD') : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/dayjs\"` for enhanced date/time support using [Day.js](https://day.js.org/).\n *\n * @module dayjs\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Day.js\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.development.dayjs.js","names":["rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","isISOStringDateOnly","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","getDatetimeJsonLogicOperations","datetimeRuleProcessorSQL: RuleProcessor","getDatetimeRuleProcessorSQL","datetimeValueProcessorANSI: ValueProcessorByRule","getDatetimeValueProcessorANSI","datetimeValueProcessorMSSQL: ValueProcessorByRule","getDatetimeValueProcessorMSSQL","datetimeValueProcessorMySQL: ValueProcessorByRule","getDatetimeValueProcessorMySQL","datetimeValueProcessorOracle: ValueProcessorByRule","getDatetimeValueProcessorOracle","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","getDatetimeValueProcessorPostgreSQL","datetimeRuleProcessorCEL: ValueProcessorByRule","getDatetimeRuleProcessorCEL","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","getDatetimeRuleProcessorMongoDBQuery","datetimeRuleProcessorNL: ValueProcessorByRule","getDatetimeRuleProcessorNL"],"sources":["../../src/rqbDateTimeLibraryAPI.dayjs.ts","../../src/index.dayjs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Day.js\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => dayjs(d).format(fmt),\n isAfter: (a, b) => dayjs(a).isAfter(b),\n isBefore: (a, b) => dayjs(a).isBefore(b),\n isSame: (a, b) =>\n dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? 'd' : 'ms'),\n isValid: d => dayjs(d).isValid(),\n toDate: d => dayjs(d).toDate(),\n toISOString: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.format('YYYY-MM-DD') : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/dayjs\"` for enhanced date/time support using [Day.js](https://day.js.org/).\n *\n * @module dayjs\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Day.js\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Day.js\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Day.js\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Day.js\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Day.js\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Day.js\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Day.js\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.dayjs';\n"],"mappings":";;;;;;;;AAOA,MAAaA,wBAA+C;CAC1D,SAAS,GAAG,2BAAc,EAAE,CAAC,OAAO,IAAI;CACxC,UAAU,GAAG,yBAAY,EAAE,CAAC,QAAQ,EAAE;CACtC,WAAW,GAAG,yBAAY,EAAE,CAAC,SAAS,EAAE;CACxC,SAAS,GAAG,yBACJ,EAAE,CAAC,OAAO,GAAGC,wDAAoB,EAAE,IAAIA,wDAAoB,EAAE,GAAG,MAAM,KAAK;CACnF,UAAS,yBAAW,EAAE,CAAC,SAAS;CAChC,SAAQ,yBAAW,EAAE,CAAC,QAAQ;CAC9B,cAAa,MAAK;EAChB,MAAM,6BAAgB,EAAE;AACxB,SAAO,QAAQ,SAAS,GAAG,QAAQ,aAAa,GAAG;;CAErD,sBAAqB,MAAK;EACxB,MAAM,6BAAgB,EAAE;AACxB,SAAO,QAAQ,SAAS,GAAG,QAAQ,OAAO,aAAa,GAAG;;CAE7D;;;;;;;ACED,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAKvD,MAAaC,2BACXC,gEAA4B,sBAAsB;;;;AAIpD,MAAaC,6BACXC,kEAA8B,sBAAsB;;;;AAItD,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAIvD,MAAaC,8BACXC,mEAA+B,sBAAsB;;;;AAIvD,MAAaC,+BACXC,oEAAgC,sBAAsB;;;;AAIxD,MAAaC,mCACXC,wEAAoC,sBAAsB;;;;AAK5D,MAAaC,2BACXC,gEAA4B,sBAAsB;;;;AAKpD,MAAaC,oCACXC,yEAAqC,sBAAsB;;;;AAK7D,MAAaC,0BACXC,+DAA2B,sBAAsB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-
|
|
2
|
-
|
|
1
|
+
const require_getDatetimeRuleProcessorSQL = require('./getDatetimeRuleProcessorSQL-D95jgDK6.js');
|
|
2
|
+
let react_querybuilder = require("react-querybuilder");
|
|
3
|
+
react_querybuilder = require_getDatetimeRuleProcessorSQL.__toESM(react_querybuilder);
|
|
3
4
|
|
|
4
5
|
//#region src/datetimeRuleProcessorJsonLogic.ts
|
|
5
6
|
const dateOperationMap = {
|
|
@@ -15,7 +16,7 @@ const dateOperationMap = {
|
|
|
15
16
|
notIn: "dateNotIn"
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
* Date/time rule processor for use by {@link react-querybuilder!
|
|
19
|
+
* Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}
|
|
19
20
|
* with the "jsonlogic" format.
|
|
20
21
|
*
|
|
21
22
|
* Note: Unlike other date/time rule processors from this library, this function does
|
|
@@ -61,7 +62,7 @@ const shouldNegate = (op) => /^(does)?not/i.test(op);
|
|
|
61
62
|
const negate = (clause, negate$1) => negate$1 ? `$not(${clause})` : `${clause}`;
|
|
62
63
|
/**
|
|
63
64
|
* Generates a rule processor with date/time features for use by
|
|
64
|
-
* {@link react-querybuilder!
|
|
65
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "jsonata" format.
|
|
65
66
|
*/
|
|
66
67
|
const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
67
68
|
const opts = options ?? ( /* istanbul ignore next */ {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.js","names":["datetimeRuleProcessorJsonLogic: RuleProcessor","processIsDateField","fieldObject: JsonLogicVar","negate","processIsDateField","valueAsArray: string[]","expression"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/getDatetimeRuleProcessorJSONata.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeJsonLogic } from './types';\nimport { processIsDateField } from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link react-querybuilder!
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.development.js","names":["datetimeRuleProcessorJsonLogic: RuleProcessor","processIsDateField","fieldObject: JsonLogicVar","negate","processIsDateField","valueAsArray: string[]","expression"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/getDatetimeRuleProcessorJSONata.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeJsonLogic } from './types';\nimport { processIsDateField } from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* istanbul ignore next */ {};\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, operator, value, valueSource } = rule;\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const maybeFieldRenderer = (v: string) => (valueIsField ? { var: `${v}` } : v);\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, maybeFieldRenderer(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = toArray(value).map(v => maybeFieldRenderer(v));\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = toArray(value).map(v => maybeFieldRenderer(v));\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { RuleProcessor } from 'react-querybuilder';\nimport {\n defaultRuleProcessorJSONata,\n getQuotedFieldName,\n nullOrUndefinedOrEmpty,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\nconst negate = (clause: string, negate: boolean) => (negate ? `$not(${clause})` : `${clause}`);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"jsonata\" format.\n */\nexport const getDatetimeRuleProcessorJSONata =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { context = {} } = opts;\n\n // istanbul ignore next\n const { quoteFieldNamesWith = ['', ''] as [string, string], fieldIdentifierSeparator = '' } =\n opts;\n const { field, operator, value, valueSource } = rule;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorJSONata(rule, opts);\n }\n\n const valueIsField = valueSource === 'field';\n\n const fldToMs = (f: string) =>\n `$toMillis(${getQuotedFieldName(f, { quoteFieldNamesWith, fieldIdentifierSeparator })})`;\n const valToMs = (v: string | Date) => `$toMillis(\"${apiFns.toISOString(v)}\")`;\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return `${fldToMs(field)} ${operator} ${valueIsField ? fldToMs(value) : valToMs(value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn': {\n if (valueIsField) {\n if (valueAsArray.length === 0) return '';\n return negate(\n `${fldToMs(field)} in [${valueAsArray.map(val => fldToMs(val)).join(', ')}]`,\n shouldNegate(operator)\n );\n }\n if (valueAsDateArray.length === 0) return '';\n return negate(\n `${fldToMs(field)} in [${valueAsDateArray.map(val => valToMs(val)).join(', ')}]`,\n shouldNegate(operator)\n );\n }\n\n case 'between':\n case 'notBetween': {\n if (\n valueAsArray.length < 2 ||\n nullOrUndefinedOrEmpty(valueAsArray[0]) ||\n nullOrUndefinedOrEmpty(valueAsArray[1]) ||\n (!valueIsField && valueAsDateArray.length < 2)\n ) {\n return '';\n }\n\n if (valueIsField) {\n const [firstValue, secondValue] = valueAsArray;\n const expression = `${fldToMs(field)} >= ${fldToMs(firstValue)} and ${fldToMs(field)} <= ${fldToMs(secondValue)}`;\n return operator === 'between' ? `(${expression})` : negate(expression, true);\n }\n\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n const expression = `${fldToMs(field)} >= ${valToMs(firstDate)} and ${fldToMs(field)} <= ${valToMs(secondDate)}`;\n return operator === 'between' ? `(${expression})` : negate(expression, true);\n }\n }\n\n return defaultRuleProcessorJSONata(rule, opts);\n };\n"],"mappings":";;;;;AAKA,MAAM,mBAAmB;CACvB,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,SAAS;CACT,IAAI;CACJ,YAAY;CACZ,OAAO;CACR;;;;;;;;;AAUD,MAAaA,kCACX,MACA,YACyB;CACzB,MAAM,OAAO,wCAAsC,EAAE;AAErD,KAAI,CAACC,uDAAmB,KAAK,SAAS,aAAa,MAAM,KAAK,CAC5D,8DAAqC,MAAM,KAAK;CAGlD,MAAM,EAAE,OAAO,UAAU,OAAO,gBAAgB;CAChD,MAAM,eAAe,gBAAgB;CACrC,MAAMC,cAA4B,EAAE,KAAK,OAAO;CAChD,MAAM,sBAAsB,MAAe,eAAe,EAAE,KAAK,GAAG,KAAK,GAAG;AAE5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