@bikdotai/bik-component-library 0.0.35 → 0.0.36-beta.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/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/package.json +1 -1
package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),t=require("../../Connectors/Connector.js"),a=require("../../DropdownWrapper.js"),i=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:p,onPropertyValueChange:c,property:v,mode:y}=n;var j,f,g,h,m,x,b;const[A,C]=r.useState([]),[O,P]=r.useState({}),[w,S]=r.useState(!0),[q,L]=r.useState("create"===y),T=Array.isArray(A)?A.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(A,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function N(e){if(!Array.isArray(e)){L(!0);let r=null;Array.isArray(A)?r=A.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(A).forEach((o=>{const n=A[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),P({}),r?null==u||u(r,v).then((e=>{P({options:Array.isArray(e)?[...e]:Object.assign({},e)}),L(!1)})):L(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?C([...e]):C(Object.assign({},e))),S(!1)})):S(!1)}),[]),r.useEffect((()=>{if("create"!==y&&Array.isArray(A)){const e=A.find((e=>e.id===(null==v?void 0:v.name))),r=v;e&&N({value:e.id,label:e.name}),null==c||c(null==r?void 0:r.value,v)}}),[A]),e.jsxs(e.Fragment,{children:[e.jsxs(i.Container,{children:[e.jsx(a.default,{disabled:"view"===y,width:"200px",isLoading:w,dropdownLabel:null!=l?l:"Select property",options:T,onSelect:N,error:null===(j=null==v?void 0:v.error)||void 0===j?void 0:j.name}),(null==v?void 0:v.name)&&!(null===(f=o.isNewLineConnectorPosition[v.dataType])||void 0===f?void 0:f[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(g=v.error)||void 0===g?void 0:g.value,operator:null===(h=v.error)||void 0===h?void 0:h.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==p||p(e,v)},onValueChange:e=>null==c?void 0:c(e,v)})]}),(null==v?void 0:v.name)&&(null===(m=o.isNewLineConnectorPosition[v.dataType])||void 0===m?void 0:m[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(x=v.error)||void 0===x?void 0:x.value,operator:null===(b=v.error)||void 0===b?void 0:b.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==p?void 0:p(e,v),onValueChange:e=>null==c?void 0:c(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),t=require("../../Connectors/Connector.js"),a=require("../../DropdownWrapper.js"),i=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:p,onPropertyValueChange:c,property:v,mode:y}=n;var j,f,g,h,m,x,b;const[A,C]=r.useState([]),[O,P]=r.useState({}),[w,S]=r.useState(!0),[q,L]=r.useState("create"===y),T=Array.isArray(A)?A.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(A,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function N(e){if(!Array.isArray(e)){L(!0);let r=null;Array.isArray(A)?r=A.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(A).forEach((o=>{const n=A[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),P({}),r?null==u||u(r,v).then((e=>{P({options:Array.isArray(e)?[...e]:Object.assign({},e)}),L(!1)})):L(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?C([...e]):C(Object.assign({},e))),S(!1),L(!1)})):(S(!1),L(!1))}),[]),r.useEffect((()=>{if("create"!==y&&Array.isArray(A)){const e=A.find((e=>e.id===(null==v?void 0:v.name))),r=v;e&&N({value:e.id,label:e.name}),null==c||c(null==r?void 0:r.value,v)}}),[A]),e.jsxs(e.Fragment,{children:[e.jsxs(i.Container,{children:[e.jsx(a.default,{disabled:"view"===y,width:"200px",isLoading:w,dropdownLabel:null!=l?l:"Select property",options:T,onSelect:N,error:null===(j=null==v?void 0:v.error)||void 0===j?void 0:j.name}),(null==v?void 0:v.name)&&!(null===(f=o.isNewLineConnectorPosition[v.dataType])||void 0===f?void 0:f[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(g=v.error)||void 0===g?void 0:g.value,operator:null===(h=v.error)||void 0===h?void 0:h.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==p||p(e,v)},onValueChange:e=>null==c?void 0:c(e,v)})]}),(null==v?void 0:v.name)&&(null===(m=o.isNewLineConnectorPosition[v.dataType])||void 0===m?void 0:m[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(x=v.error)||void 0===x?void 0:x.value,operator:null===(b=v.error)||void 0===b?void 0:b.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==p?void 0:p(e,v),onValueChange:e=>null==c?void 0:c(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
|
package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("../../../../dropdown/Dropdown.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("../../../../dropdown/Dropdown.js"),o=require("../../../constants/operators.js"),i=require("../../../types/QueryBuilder.type.js"),s=require("../../DeleteButton.js"),d=require("./AddPropertyButton.js"),l=require("./PropertyNode.js"),n=require("./PropertyNodeUIWrapper.styled.js");exports.default=p=>{var a,u,{node:c,addPropertyBtnText:j,deleteProperty:y,createProperty:v,selectPropertyJoinOperator:x,mode:O}=p,P=e.__rest(p,["node","addPropertyBtnText","deleteProperty","createProperty","selectPropertyJoinOperator","mode"]);const _=o.JOIN_OPERATOR_OPTIONS.map((e=>{if(c.PropertyOperator){if(e.value===c.PropertyOperator)return Object.assign(Object.assign({},e),{selected:!0})}else if(e.value===i.QueryBuilderJoinOperators.AND)return Object.assign(Object.assign({},e),{selected:!0});return e}));return r.jsxs(r.Fragment,{children:[null===(a=null==c?void 0:c.properties)||void 0===a?void 0:a.map(((e,o)=>r.jsxs(r.Fragment,{children:[0!==o&&r.jsx("div",Object.assign({style:{width:80,position:"relative"}},{children:r.jsx(t.Dropdown,{disabled:"view"===O,onSelect:e=>{null==x||x(e.value,c._id)},options:_,width:"80px",height:96,size:"small"},`${o}-operator-selector`)}),`${o}-operator`),r.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[r.jsx(l.PropertyNode,Object.assign({isLast:!!c.properties&&o===c.properties.length-1,property:e},P,{mode:O}),`${e._id}-property-node`),"view"!==O&&r.jsx(s.default,{onClick:()=>y(e,c._id)},`${e._id}-${o}-delete-btn`)]}),e._id)]}))),"view"!==O&&r.jsxs("div",{children:[0===(null===(u=null==c?void 0:c.properties)||void 0===u?void 0:u.length)&&r.jsx("div",{children:r.jsx(n.Line,{})}),r.jsx(d.default,{buttonText:null!=j?j:"Add Property",onClick:()=>v({},c._id)})]})]})};
|
package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as e,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as t}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as i}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new i,u=e=>r(p,Object.assign({isLast:e.isLast,mode:e.mode},{children:r("div",Object.assign({style:{padding:12}},{children:r(v,Object.assign({},e))}))})),v=i=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:f,mode:g}=i;var h,j,b,A,O,C,T;const[w,P]=n([]),[x,L]=n({}),[S,V]=n(!0),[N,D]=n("create"===g),W=Array.isArray(w)?w.map((r=>Object.assign(Object.assign({},r),{label:r.name,value:r.id,description:r.description,selected:(null==f?void 0:f.name)===r.id}))):c.convertToGroupOptions(w,(null==f?void 0:f.name)?[f.name.toString()]:void 0);function k(r){if(!Array.isArray(r)){D(!0);let e=null;Array.isArray(w)?e=w.find((e=>{let{id:o}=e;return o===r.value})):Object.keys(w).forEach((o=>{const n=w[o].find((e=>{let{id:o}=e;return o===r.value}));n&&(e=n)})),L({}),e?null==v||v(e,f).then((r=>{L({options:Array.isArray(r)?[...r]:Object.assign({},r)}),D(!1)})):D(!1)}}return a((()=>{u?u().then((r=>{r&&(Array.isArray(r)?P([...r]):P(Object.assign({},r))),V(!1)})):V(!1)}),[]),a((()=>{if("create"!==g&&Array.isArray(w)){const r=w.find((r=>r.id===(null==f?void 0:f.name))),e=f;r&&k({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,f)}}),[w]),e(o,{children:[e(s,{children:[r(d,{disabled:"view"===g,width:"200px",isLoading:S,dropdownLabel:null!=p?p:"Select property",options:W,onSelect:k,error:null===(h=null==f?void 0:f.error)||void 0===h?void 0:h.name}),(null==f?void 0:f.name)&&!(null===(j=t[f.dataType])||void 0===j?void 0:j[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(b=f.error)||void 0===b?void 0:b.value,operator:null===(A=f.error)||void 0===A?void 0:A.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>{null==m||m(r,f)},onValueChange:r=>null==y?void 0:y(r,f)})]}),(null==f?void 0:f.name)&&(null===(O=t[f.dataType])||void 0===O?void 0:O[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(C=f.error)||void 0===C?void 0:C.value,operator:null===(T=f.error)||void 0===T?void 0:T.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>null==m?void 0:m(r,f),onValueChange:r=>null==y?void 0:y(r,f)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
|
|
1
|
+
import{jsx as r,jsxs as e,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as t}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as i}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new i,u=e=>r(p,Object.assign({isLast:e.isLast,mode:e.mode},{children:r("div",Object.assign({style:{padding:12}},{children:r(v,Object.assign({},e))}))})),v=i=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:f,mode:g}=i;var h,j,b,A,O,C,T;const[w,P]=n([]),[x,L]=n({}),[S,V]=n(!0),[N,D]=n("create"===g),W=Array.isArray(w)?w.map((r=>Object.assign(Object.assign({},r),{label:r.name,value:r.id,description:r.description,selected:(null==f?void 0:f.name)===r.id}))):c.convertToGroupOptions(w,(null==f?void 0:f.name)?[f.name.toString()]:void 0);function k(r){if(!Array.isArray(r)){D(!0);let e=null;Array.isArray(w)?e=w.find((e=>{let{id:o}=e;return o===r.value})):Object.keys(w).forEach((o=>{const n=w[o].find((e=>{let{id:o}=e;return o===r.value}));n&&(e=n)})),L({}),e?null==v||v(e,f).then((r=>{L({options:Array.isArray(r)?[...r]:Object.assign({},r)}),D(!1)})):D(!1)}}return a((()=>{u?u().then((r=>{r&&(Array.isArray(r)?P([...r]):P(Object.assign({},r))),V(!1),D(!1)})):(V(!1),D(!1))}),[]),a((()=>{if("create"!==g&&Array.isArray(w)){const r=w.find((r=>r.id===(null==f?void 0:f.name))),e=f;r&&k({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,f)}}),[w]),e(o,{children:[e(s,{children:[r(d,{disabled:"view"===g,width:"200px",isLoading:S,dropdownLabel:null!=p?p:"Select property",options:W,onSelect:k,error:null===(h=null==f?void 0:f.error)||void 0===h?void 0:h.name}),(null==f?void 0:f.name)&&!(null===(j=t[f.dataType])||void 0===j?void 0:j[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(b=f.error)||void 0===b?void 0:b.value,operator:null===(A=f.error)||void 0===A?void 0:A.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>{null==m||m(r,f)},onValueChange:r=>null==y?void 0:y(r,f)})]}),(null==f?void 0:f.name)&&(null===(O=t[f.dataType])||void 0===O?void 0:O[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(C=f.error)||void 0===C?void 0:C.value,operator:null===(T=f.error)||void 0===T?void 0:T.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>null==m?void 0:m(r,f),onValueChange:r=>null==y?void 0:y(r,f)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
|
package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../../../_virtual/_tslib.js";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{Dropdown as i}from"../../../../dropdown/Dropdown.js";import{JOIN_OPERATOR_OPTIONS as p}from"../../../constants/operators.js";import{QueryBuilderJoinOperators as
|
|
1
|
+
import{__rest as e}from"../../../../../_virtual/_tslib.js";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{Dropdown as i}from"../../../../dropdown/Dropdown.js";import{JOIN_OPERATOR_OPTIONS as p}from"../../../constants/operators.js";import{QueryBuilderJoinOperators as d}from"../../../types/QueryBuilder.type.js";import s from"../../DeleteButton.js";import l from"./AddPropertyButton.js";import{PropertyNode as n}from"./PropertyNode.js";import{Line as a}from"./PropertyNodeUIWrapper.styled.js";const c=c=>{var m,y,{node:u,addPropertyBtnText:v,deleteProperty:j,createProperty:f,selectPropertyJoinOperator:P,mode:h}=c,b=e(c,["node","addPropertyBtnText","deleteProperty","createProperty","selectPropertyJoinOperator","mode"]);const O=p.map((e=>{if(u.PropertyOperator){if(e.value===u.PropertyOperator)return Object.assign(Object.assign({},e),{selected:!0})}else if(e.value===d.AND)return Object.assign(Object.assign({},e),{selected:!0});return e}));return r(t,{children:[null===(m=null==u?void 0:u.properties)||void 0===m?void 0:m.map(((e,p)=>r(t,{children:[0!==p&&o("div",Object.assign({style:{width:80,position:"relative"}},{children:o(i,{disabled:"view"===h,onSelect:e=>{null==P||P(e.value,u._id)},options:O,width:"80px",height:96,size:"small"},`${p}-operator-selector`)}),`${p}-operator`),r("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[o(n,Object.assign({isLast:!!u.properties&&p===u.properties.length-1,property:e},b,{mode:h}),`${e._id}-property-node`),"view"!==h&&o(s,{onClick:()=>j(e,u._id)},`${e._id}-${p}-delete-btn`)]}),e._id)]}))),"view"!==h&&r("div",{children:[0===(null===(y=null==u?void 0:u.properties)||void 0===y?void 0:y.length)&&o("div",{children:o(a,{})}),o(l,{buttonText:null!=v?v:"Add Property",onClick:()=>f({},u._id)})]})]})};export{c as default};
|