Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adintel-lib-poc

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adintel-lib-poc - npm Package Compare versions

Comparing version 0.1.30 to 0.1.31

5

dist/adintel-lib-poc.cjs.development.js

@@ -582,3 +582,6 @@ 'use strict';

React.useEffect(function () {
setQueryArray([]);
console.log('clearing the search called');
if (onClearSearch) {
setQueryArray([]);
}
}, [onClearSearch]);

@@ -585,0 +588,0 @@ React.useEffect(function () {

2

dist/adintel-lib-poc.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=require("@fortawesome/react-fontawesome"),r=require("@fortawesome/free-regular-svg-icons");require("flatpickr/dist/themes/material_green.css");var o,a,i=e(require("react-flatpickr")),l=require("@fortawesome/free-solid-svg-icons"),u=e(require("moment"));function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(o=exports.buttonSize||(exports.buttonSize={})).small="small",o.medium="medium",o.large="large",(a=exports.buttonVariant||(exports.buttonVariant={})).primary="primary",a.secondary="secondary";var d,p=function(e,t){var n=e.size,r=void 0===n?exports.buttonSize.medium:n,o=e.block,a=e.variant,i=void 0===a?exports.buttonVariant.primary:a,l="c_btn c_btn-"+r;return l=void 0!==o&&o?l+" c_btn-block":l,l=i?l+" c_btn-"+i:l,t?l+" "+t:l},m=function(e){var n=e.type,r=e.children,o=e.customClass,a=e.disabled,i=void 0!==a&&a,l=e.id,u=void 0===l?"":l,s=e.tabIndex,c=void 0===s?0:s,f=e.onKeyDown,d=e.onKeyUp,m=e.autoFocus,v=void 0!==m&&m,b=e.onFocus,h=e.onDoubleClick,C=e.testId;return t.createElement("button",{ref:e.btnRef,type:void 0===n?"button":n,name:e.name,onClick:e.onClick,className:p(e,o),disabled:i,id:u,"aria-label":u,tabIndex:c,onKeyDown:f,onKeyUp:d,autoFocus:v,onFocus:b,onDoubleClick:h,"data-test-id":C||u||"","data-test-class":o||""},r)};!function(e){e.left="left-tooltip",e.top="top-tooltip",e.bottom="bottom-tooltip",e.right="right-tooltip"}(d||(d={}));var v,b=function(e){var n=e.children,r=e.text,o=e.position,a=t.useRef(null),i=t.useRef(null),l=function(){return i.current.style.visibility="visible"},u=function(){return i.current.style.visibility="hidden"};return t.useEffect((function(){var e=a.current;if(e&&(e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",u)),!o){var t=i.current;e&&t&&(t.getBoundingClientRect().top<0&&(e.className="bottom-tooltip"),e.getBoundingClientRect().left+t.getBoundingClientRect().width>screen.width&&(e.className="left-tooltip"))}return function(){return a.current&&a.current.removeEventListener("mouseenter",l)}}),[]),r?t.createElement("div",{ref:a,className:o||"top-tooltip",onClick:function(e){e.stopPropagation(),i.current.style.visibility="hidden"}},n,t.createElement("span",{ref:i,className:"tooltiptext",onMouseEnter:function(e){return e.preventDefault()}},r)):n};!function(e){e.text="text",e.email="email",e.number="number",e.password="password"}(v||(v={}));var h,C,g=function(e){var n=e.id,r=e.customClass,o=e.tabIndex,a=e.disabled,i=void 0!==a&&a,l=e.hasError,u=e.autofocus,s=e.spellCheck;return t.createElement(b,{text:e.title},t.createElement("input",{id:n,"aria-label":n,autoComplete:"off",name:e.name,placeholder:e.placeholder,value:e.value,type:e.type,className:"input "+(void 0!==l&&l?"input-error":"")+(r||"")+" "+(i?"disabled":""),onChange:e.onChange,tabIndex:void 0===o?0:o,disabled:i,autoFocus:void 0!==u&&u,ref:e.reference,onKeyUp:e.onKeyUp,onKeyDown:e.onKeyDown,spellCheck:void 0===s||s,onBlur:e.onBlur,onClick:e.onClick,"data-test-id":n||"","data-test-class":r||"",step:e.step,min:e.min,onKeyPress:e.onKeyPress,maxLength:e.maxLength}))},y=function(e){var o=e.id,a=e.date,u=e.onChange,s=e.clearDate,c=e.disabled;return t.createElement("div",{className:e.small?"date-picker-small":"date-picker"},t.createElement(i,{ref:e.reference,id:o,"data-test-id":o||"",name:e.name,className:e.customClass+" date-picker-input "+(c?" disabled":""),value:a,options:{minDate:e.minDate,maxDate:e.maxDate,dateFormat:"m-d-Y"},placeholder:e.placeholder,autocomplete:"off",disabled:c,"data-selected-date":a,onChange:function(e){u&&u(e[0])}}),t.createElement("div",{className:"icon-container"},a?t.createElement(m,{id:o,customClass:"cross",onClick:s,disabled:c},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes,className:c?"cross-icon disabled":"cross-icon"})):t.createElement("label",{htmlFor:o,className:c?"calender-icon disabled":"calender-icon"},t.createElement(n.FontAwesomeIcon,{icon:r.faCalendarAlt}))))};!function(e){e.singleSelect="singleSelect",e.multiSelect="multiSelect",e.datePicker="datePicker"}(h||(h={})),function(e){e.date="date",e.string="string"}(C||(C={}));var E,w={label:"IN",value:"in",type:"any"},k={label:"BY",value:"by"},S=[{label:"=",value:"=",type:"any"},{label:"<",value:"<",type:"number"},{label:">",value:">",type:"number"},{label:"<=",value:"<=",type:"number"},{label:">=",value:">=",type:"number"},{label:"!=",value:">=",type:"any"},w,{label:"NOT IN",value:"not in",type:"any"}],x=[{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],L=[{label:"AND",value:"and"},{label:"OR",value:"or"},{label:"ORDER BY",value:"order by"}],R={label:"NOT",value:"not"},W=function(e){var n=e.option,r=e.onClick,o=e.focus,a=e.index,i=e.onkeyPressed,l=e.optionRef,u=n.value,s=n.label;return t.useEffect((function(){o&&l&&l.current&&l.current.focus()}),[o]),t.createElement(m,{key:u,btnRef:l,onClick:function(){return r(n)},customClass:"option",tabIndex:0,onKeyDown:function(e){i(e,a)}},t.createElement("div",null,s))};!function(e){e[e.Down=40]="Down",e[e.Up=38]="Up",e[e.Enter=13]="Enter",e[e.Tab=9]="Tab",e[e.Space=32]="Space",e[e.Ctrl=17]="Ctrl",e[e.Right=39]="Right",e[e.Left=37]="Left",e[e.One=49]="One",e[e.Two=50]="Two",e[e.Three=51]="Three",e[e.Period=46]="Period",e[e.Minus=45]="Minus"}(E||(E={}));var D=function(e){var n=e.options,r=e.onOptionClick,o=e.highlight,a=e.setShowResults,i=t.useState(),l=i[0],u=i[1],s=t.useRef([]);t.useEffect((function(){s.current=Array(n.length).fill(null).map((function(e,n){return s.current[n]||t.createRef()}))}),[n]);var c=function(e,t){e.keyCode===E.Down?u(t+1):e.keyCode===E.Up?u(t-1):e.keyCode===E.Tab&&a(!1),s.current[t]&&s.current[t].current&&s.current[t].current.scrollIntoView({block:"center",behavior:"auto"})};return t.createElement("div",{className:"search-body"},n&&n.length>0?t.createElement("div",null,t.createElement("div",{className:"options scroller"},n.map((function(e,n){return t.createElement(W,{key:n,option:e,onClick:r,index:n,focus:l===n,onkeyPressed:c,highlight:o,optionRef:s.current[n]})})))):null)},I=function(e){var n=e.searchResultType,r=e.searchResults,o=e.onOptionClick,a=void 0===o?function(){}:o,i=e.highlight,l=e.setShowResults,s=e.datePickerPosition,c=t.useRef(null),f=t.useState(!1),d=f[0],p=f[1];return t.useEffect((function(){c.current&&n===h.datePicker?(c.current.flatpickr.open(),p(!d)):p(!d)}),[s]),t.useEffect((function(){if(s&&n===h.datePicker&&c.current){var e=parseInt(s.left,10);c.current.flatpickr.calendarContainer.style.left=(e>s.inputLeft?s.inputLeft-50:e)+"px",c.current.flatpickr.open()}}),[d]),n===h.singleSelect?t.createElement(D,{options:r||[],onOptionClick:a,highlight:i,setShowResults:l}):n===h.datePicker?t.createElement(y,{reference:c,date:new Date,onChange:function(e){return a(u(e).format("MM-DD-YYYY"))}}):t.createElement(t.Fragment,null)},N=function(e){return!e||/^\(*(NOT )*(\(*((([A-Za-z]\s*)|('[^']*'\s*))+((?:^|\W)in\s*(\('[^']*'\s*([,]\s*'[^']*'\s*)*\))|(?:^|\W)not\s*in\s*([A-Za-z]+\s*)|(?:^|\W)in\s*([A-Za-z]+\s*)|(?:^|\W)= '[^']*'|(?:^|\W)!= '[^']*'|(?:^|\W)> '[^']*'|(?:^|\W)< '[^']*'|(?:^|\W)<= '[^']*'|(?:^|\W)>= '[^']*'|(?:^|\W)is '[^']*'|(?:^|\W)not is '[^']*')\)*((?:^|\W)AND\W|(?:^|\W)OR\W)+(NOT\W)*)*\(*((([A-Za-z])|('[^']*'))+((?:^|\W)in (\('[^']*' *([,] *'[^']*')*\))|(?:^|\W)in ([A-Za-z]+)|(?:^|\W)not in (\('[^']*'([,]'[^']*')*\))|(?:^|\W)not in ([A-Za-z]+)|(?:^|\W)= '[^']*'|(?:^|\W)!= '[^']*'|(?:^|\W)> '[^']*'|(?:^|\W)< '[^']*'|(?:^|\W)<= '[^']*'|(?:^|\W)>= '[^']*'|(?:^|\W)is '[^']*'|(?:^|\W)not is '[^']*'))*\)*)* *\(*(((ORDER BY '[^']*')*)|((ORDER BY [A-Za-z]*)*) *(ASC|DESC)*)*\)*\)*$/gi.test(e.trim())&&A(e)},A=function(e){for(var t,n=[],r={"(":")"},o=f(e);!(t=o()).done;){var a=t.value;if("("===a&&n.push(a),")"===a&&a!==r[n.pop()])return!1}return 0===n.length},O=function(e){var r=e.customSearchData,o=e.onSearch,a=e.onChange,i=e.onEnterButtonClick,u=e.planeQuery,s=e.onCheckBoxChecked,c=e.isLoading,d=e.onClearSearch,p=r.columns,b=r.searchResults,C=t.useState(!1),y=C[0],W=C[1],D=t.useState([]),A=D[0],O=D[1],P=t.useState(u?u.split(" "):[]),j=P[0],T=P[1],B=t.useState(null),K=B[0],z=B[1],F=t.useState(h.singleSelect),q=F[0],U=F[1],Y=t.useState(null),V=Y[0],M=Y[1],Z=t.useState({status:!0,position:0}),_=Z[0],$=Z[1],Q=t.useState({left:0}),J=Q[0],G=Q[1],H=t.useRef(),X=j.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",le),function(){return document.removeEventListener("mousedown",le)}}),[]),t.useEffect((function(){T([])}),[d]),t.useEffect((function(){var e=ee();a(e||X,X,N(X))}),[s]),t.useEffect((function(){var e=ee();a(e||X,X,N(X))}),[j]),t.useEffect((function(){if(_&&_.position&&j.length){var e=[].concat(j);e&&e.length&&(e.splice(_.position+1,j.length-_.position),ae(e.join(" ").length))}}),[_]);var ee=function(){var e=X.match(/'.*?'/g),t=e&&e.filter((function(e){return p&&p.find((function(t){return t.label.toLowerCase()===e.split("'").join("").toLowerCase()}))})),n=X.replace(/'.*?'/g,"$"),o=[];r.columns&&r.columns.forEach((function(e){var t=0;n=n.replace(new RegExp(e.label,"gi"),(function(){return t++,e.value.toString()})),t||o.push(e)}));var a=[],i=0;return n.split(" ").forEach((function(n){for(var r,l="",u=f(n);!(r=u()).done;){var s=r.value;if("$"===s){if(t.find((function(t){return t.toLowerCase()===e[i].toLowerCase()}))){var c=o.find((function(t){return e[i].split("'").join("").toLowerCase()===t.label.toLowerCase()}));l+=c?c.value:""}else l+=e[i].toUpperCase();i++}else l+=s}a.push(l)})),a.join(" ")};t.useEffect((function(){K&&b&&(O(b),W(!0))}),[JSON.stringify(r)]);var te=function(e,t,n){var r=L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(p,[R]);if((e===R.label||e===R.value)&&t)return[w];if(x.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()})))return[];if("ORDER"===e||"order"===e)return[k];if(e===k.label||e===k.value)return p;if(e===R.label||e===R.value)return[].concat(p,[R]);var o=p.find((function(t){return t.label.toLowerCase()===oe(e,["'","("]).toLowerCase()}));return!o||n!==k.label&&n!==k.value?o&&"string"===o.type?[].concat(S.filter((function(e){return"any"===e.type}))):o&&"date"===o.type?S:S.find((function(t){return t.label.toLowerCase()===e.toLowerCase()}))?[]:L:x},ne=function(e){var t=[],n=e.match(/'.*?'/g),r=e.replace(/'.*?'/g,"$").split(" "),o=0;return r.forEach((function(e){for(var r,a="",i=f(e);!(r=i()).done;){var l=r.value;"$"===l?(a+=n[o],o++):a+=l}t.push(a)})),t},re=function(e){var t=-1,n=0;return e.forEach((function(e,r){for(var o,a=f(e);!(o=a()).done;)"'"===o.value&&(t=r,n++)})),{incompleteWordIndex:t,status:n%2==0}},oe=function(e,t){var n="";return t.forEach((function(t){n=n?n.split(t).join(""):e.split(t).join("")})),n},ae=function(e){H.current.setSelectionRange&&(H.current.focus(),H.current.setSelectionRange(e,e))},ie=function(e,t){return[].concat(L,S,[R]).find((function(e){return e.label.toLowerCase()===t.toLowerCase()}))?t:e&&e.toLowerCase()===w.label.toLowerCase()?"('"+t+"'":S.find((function(t){return t.label===e}))?"'"+t+"'":null},le=function(e){var t=document.getElementById("dynamic-results"),n=document.getElementsByClassName("flatpickr-calendar");if(!t||!t.contains(e.target)){var r=!1;if(Array.from(n).forEach((function(t){t.contains(e.target)&&(r=!0)})),!r)return W(!1)}};return t.createElement("div",{className:"custom-search"},t.createElement(g,{type:v.text,customClass:"custom-search-input",reference:H,value:X,onChange:function(e){!function(e){" "===e&&(O(te(null,null,null)),W(!0));var t=function(e){var t=re(e);if(t.status)return e;var n=t.incompleteWordIndex,r=e.slice(n);return e.splice(n,e.length-n,r.join(" ")),e}(ne(e)),n=function(e){var t=e.findIndex((function(e,t){return e!==ne(j.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==R.label&&r!==R.value||(r=e[t-3]);var o=p.find((function(e){return r&&e.label.toLowerCase()===oe(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&z(o),{lastExpression:n,modifiedWord:e[t],currentColumn:o,modifiedWordIndex:t,newColumnValue:r}}(t),r=n.lastExpression,a=n.modifiedWord,i=n.currentColumn,l=n.modifiedWordIndex,u=n.newColumnValue;if(i&&"date"===i.type){U(h.datePicker),M({index:l,word:a});var s=t;return s.splice(l+1,t.length-(l+1)),T(t),console.log(s),G({left:76,inputLeft:parseInt(H.current.getBoundingClientRect().left,10)+parseInt(H.current.clientWidth,10)}),void(")"!==a.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===r.toLowerCase()}))?W(!0):W(!1))}var c=t.filter((function(e){return""===e}));U(h.singleSelect);var f=c.length>1?[]:te(r,i,u);if(!t[a]&&t[l-1]&&"("===t[l-1].substr(0,1)&&t[l-2]&&t[l-2].toLowerCase()===w.label.toLowerCase()&&")"!==t[l-1].substr(-1))t.pop(),O([]);else if(i&&!f.length&&a&&oe(a,["'"]).length>=2&&"'"!==a.substr(-1))if("("===a.substr(0,1)){var d=a.replace("(","").split(","),m="",v=re(d);m=v.status?d[d.length-1]:d[v.incompleteWordIndex],","!==a.substr(-1)&&")"!==a.substr(-1)&&m&&m.split("'").join("").length>=2&&o({searchText:m.split("'").join(""),id:i.id,currentValueKey:i.value})}else/[a-zA-z]/.test(a.substr(-1))&&o({searchText:a.split("'").join(""),id:i.id,currentValueKey:i.value});else O(f.filter((function(e){return e.label.toLowerCase().includes(a&&a.split("(").join("")&&a.split("(").join("").toLowerCase())}))),W(!0);M({index:l,word:a}),T(t)}(e.target.value)},onClick:function(){O([]),W(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&N(X)&&X.length&&i()},placeholder:c?"Loading...":"Example: Product = 'Apple Rubber Pdts Inc - Corporate Promotion'",disabled:c}),X.length?t.createElement(m,{customClass:"clear-query",onClick:function(){T([])},tabIndex:y?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,N(X)?t.createElement(n.FontAwesomeIcon,{className:"custom-search-query-status valid",icon:l.faCheckCircle}):t.createElement(n.FontAwesomeIcon,{className:"custom-search-query-status invalid",icon:l.faTimesCircle}),y&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(I,{searchResultType:q,searchResults:X.length>0?A:[],onOptionClick:function(e){var t=j[j.length-2],n=null;V&&(t&&t.toLowerCase()===w.label.toLowerCase()&&V.word.includes("(")?T(j.map((function(t,r){return r===V.index?(n=r,""+function(e,t){if("("===e.substr(0,1)){var n=e.replace("(","").split(",");return n.length?(n[n.length-1]="'"+t+"'","("+n):"("+[t]}return""}(V.word,q===h.datePicker?e:e.label)):t}))):q===h.datePicker?n=function(e,t,n){return T(j.map((function(r,o){return o===V.index?(n=o,ie(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):q===h.singleSelect&&(n=function(e,t,n){return T(j.map((function(r,o){return o===V.index?(n=o,ie(e,t.label)||(p.find((function(e){return e.label.toLowerCase()===t.label.toLowerCase()}))?t.label.includes(" ")?"'"+t.label+"'":t.label:t.label.includes(" ")?"'"+t.label+"'":""+t.label)):r}))),n}(t,e,n))),n&&$({status:!_.status,position:n}),W(!1),H.current.focus()},setShowResults:W,datePickerPosition:J})))};exports.Button=m,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=e.onClearSearch,l=t.useState({columns:[]}),u=l[0],c=l[1];return t.useEffect((function(){c(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(O,{customSearchData:u,onChange:function(e,t,n){var r=s({},u,{searchResults:[]});c(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!u,onClearSearch:i}))};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=require("@fortawesome/react-fontawesome"),r=require("@fortawesome/free-regular-svg-icons");require("flatpickr/dist/themes/material_green.css");var o,a,i=e(require("react-flatpickr")),l=require("@fortawesome/free-solid-svg-icons"),u=e(require("moment"));function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(o=exports.buttonSize||(exports.buttonSize={})).small="small",o.medium="medium",o.large="large",(a=exports.buttonVariant||(exports.buttonVariant={})).primary="primary",a.secondary="secondary";var d,p=function(e,t){var n=e.size,r=void 0===n?exports.buttonSize.medium:n,o=e.block,a=e.variant,i=void 0===a?exports.buttonVariant.primary:a,l="c_btn c_btn-"+r;return l=void 0!==o&&o?l+" c_btn-block":l,l=i?l+" c_btn-"+i:l,t?l+" "+t:l},m=function(e){var n=e.type,r=e.children,o=e.customClass,a=e.disabled,i=void 0!==a&&a,l=e.id,u=void 0===l?"":l,c=e.tabIndex,s=void 0===c?0:c,f=e.onKeyDown,d=e.onKeyUp,m=e.autoFocus,v=void 0!==m&&m,b=e.onFocus,h=e.onDoubleClick,C=e.testId;return t.createElement("button",{ref:e.btnRef,type:void 0===n?"button":n,name:e.name,onClick:e.onClick,className:p(e,o),disabled:i,id:u,"aria-label":u,tabIndex:s,onKeyDown:f,onKeyUp:d,autoFocus:v,onFocus:b,onDoubleClick:h,"data-test-id":C||u||"","data-test-class":o||""},r)};!function(e){e.left="left-tooltip",e.top="top-tooltip",e.bottom="bottom-tooltip",e.right="right-tooltip"}(d||(d={}));var v,b=function(e){var n=e.children,r=e.text,o=e.position,a=t.useRef(null),i=t.useRef(null),l=function(){return i.current.style.visibility="visible"},u=function(){return i.current.style.visibility="hidden"};return t.useEffect((function(){var e=a.current;if(e&&(e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",u)),!o){var t=i.current;e&&t&&(t.getBoundingClientRect().top<0&&(e.className="bottom-tooltip"),e.getBoundingClientRect().left+t.getBoundingClientRect().width>screen.width&&(e.className="left-tooltip"))}return function(){return a.current&&a.current.removeEventListener("mouseenter",l)}}),[]),r?t.createElement("div",{ref:a,className:o||"top-tooltip",onClick:function(e){e.stopPropagation(),i.current.style.visibility="hidden"}},n,t.createElement("span",{ref:i,className:"tooltiptext",onMouseEnter:function(e){return e.preventDefault()}},r)):n};!function(e){e.text="text",e.email="email",e.number="number",e.password="password"}(v||(v={}));var h,C,g=function(e){var n=e.id,r=e.customClass,o=e.tabIndex,a=e.disabled,i=void 0!==a&&a,l=e.hasError,u=e.autofocus,c=e.spellCheck;return t.createElement(b,{text:e.title},t.createElement("input",{id:n,"aria-label":n,autoComplete:"off",name:e.name,placeholder:e.placeholder,value:e.value,type:e.type,className:"input "+(void 0!==l&&l?"input-error":"")+(r||"")+" "+(i?"disabled":""),onChange:e.onChange,tabIndex:void 0===o?0:o,disabled:i,autoFocus:void 0!==u&&u,ref:e.reference,onKeyUp:e.onKeyUp,onKeyDown:e.onKeyDown,spellCheck:void 0===c||c,onBlur:e.onBlur,onClick:e.onClick,"data-test-id":n||"","data-test-class":r||"",step:e.step,min:e.min,onKeyPress:e.onKeyPress,maxLength:e.maxLength}))},y=function(e){var o=e.id,a=e.date,u=e.onChange,c=e.clearDate,s=e.disabled;return t.createElement("div",{className:e.small?"date-picker-small":"date-picker"},t.createElement(i,{ref:e.reference,id:o,"data-test-id":o||"",name:e.name,className:e.customClass+" date-picker-input "+(s?" disabled":""),value:a,options:{minDate:e.minDate,maxDate:e.maxDate,dateFormat:"m-d-Y"},placeholder:e.placeholder,autocomplete:"off",disabled:s,"data-selected-date":a,onChange:function(e){u&&u(e[0])}}),t.createElement("div",{className:"icon-container"},a?t.createElement(m,{id:o,customClass:"cross",onClick:c,disabled:s},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes,className:s?"cross-icon disabled":"cross-icon"})):t.createElement("label",{htmlFor:o,className:s?"calender-icon disabled":"calender-icon"},t.createElement(n.FontAwesomeIcon,{icon:r.faCalendarAlt}))))};!function(e){e.singleSelect="singleSelect",e.multiSelect="multiSelect",e.datePicker="datePicker"}(h||(h={})),function(e){e.date="date",e.string="string"}(C||(C={}));var E,w={label:"IN",value:"in",type:"any"},k={label:"BY",value:"by"},S=[{label:"=",value:"=",type:"any"},{label:"<",value:"<",type:"number"},{label:">",value:">",type:"number"},{label:"<=",value:"<=",type:"number"},{label:">=",value:">=",type:"number"},{label:"!=",value:">=",type:"any"},w,{label:"NOT IN",value:"not in",type:"any"}],x=[{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],L=[{label:"AND",value:"and"},{label:"OR",value:"or"},{label:"ORDER BY",value:"order by"}],R={label:"NOT",value:"not"},W=function(e){var n=e.option,r=e.onClick,o=e.focus,a=e.index,i=e.onkeyPressed,l=e.optionRef,u=n.value,c=n.label;return t.useEffect((function(){o&&l&&l.current&&l.current.focus()}),[o]),t.createElement(m,{key:u,btnRef:l,onClick:function(){return r(n)},customClass:"option",tabIndex:0,onKeyDown:function(e){i(e,a)}},t.createElement("div",null,c))};!function(e){e[e.Down=40]="Down",e[e.Up=38]="Up",e[e.Enter=13]="Enter",e[e.Tab=9]="Tab",e[e.Space=32]="Space",e[e.Ctrl=17]="Ctrl",e[e.Right=39]="Right",e[e.Left=37]="Left",e[e.One=49]="One",e[e.Two=50]="Two",e[e.Three=51]="Three",e[e.Period=46]="Period",e[e.Minus=45]="Minus"}(E||(E={}));var D=function(e){var n=e.options,r=e.onOptionClick,o=e.highlight,a=e.setShowResults,i=t.useState(),l=i[0],u=i[1],c=t.useRef([]);t.useEffect((function(){c.current=Array(n.length).fill(null).map((function(e,n){return c.current[n]||t.createRef()}))}),[n]);var s=function(e,t){e.keyCode===E.Down?u(t+1):e.keyCode===E.Up?u(t-1):e.keyCode===E.Tab&&a(!1),c.current[t]&&c.current[t].current&&c.current[t].current.scrollIntoView({block:"center",behavior:"auto"})};return t.createElement("div",{className:"search-body"},n&&n.length>0?t.createElement("div",null,t.createElement("div",{className:"options scroller"},n.map((function(e,n){return t.createElement(W,{key:n,option:e,onClick:r,index:n,focus:l===n,onkeyPressed:s,highlight:o,optionRef:c.current[n]})})))):null)},I=function(e){var n=e.searchResultType,r=e.searchResults,o=e.onOptionClick,a=void 0===o?function(){}:o,i=e.highlight,l=e.setShowResults,c=e.datePickerPosition,s=t.useRef(null),f=t.useState(!1),d=f[0],p=f[1];return t.useEffect((function(){s.current&&n===h.datePicker?(s.current.flatpickr.open(),p(!d)):p(!d)}),[c]),t.useEffect((function(){if(c&&n===h.datePicker&&s.current){var e=parseInt(c.left,10);s.current.flatpickr.calendarContainer.style.left=(e>c.inputLeft?c.inputLeft-50:e)+"px",s.current.flatpickr.open()}}),[d]),n===h.singleSelect?t.createElement(D,{options:r||[],onOptionClick:a,highlight:i,setShowResults:l}):n===h.datePicker?t.createElement(y,{reference:s,date:new Date,onChange:function(e){return a(u(e).format("MM-DD-YYYY"))}}):t.createElement(t.Fragment,null)},N=function(e){return!e||/^\(*(NOT )*(\(*((([A-Za-z]\s*)|('[^']*'\s*))+((?:^|\W)in\s*(\('[^']*'\s*([,]\s*'[^']*'\s*)*\))|(?:^|\W)not\s*in\s*([A-Za-z]+\s*)|(?:^|\W)in\s*([A-Za-z]+\s*)|(?:^|\W)= '[^']*'|(?:^|\W)!= '[^']*'|(?:^|\W)> '[^']*'|(?:^|\W)< '[^']*'|(?:^|\W)<= '[^']*'|(?:^|\W)>= '[^']*'|(?:^|\W)is '[^']*'|(?:^|\W)not is '[^']*')\)*((?:^|\W)AND\W|(?:^|\W)OR\W)+(NOT\W)*)*\(*((([A-Za-z])|('[^']*'))+((?:^|\W)in (\('[^']*' *([,] *'[^']*')*\))|(?:^|\W)in ([A-Za-z]+)|(?:^|\W)not in (\('[^']*'([,]'[^']*')*\))|(?:^|\W)not in ([A-Za-z]+)|(?:^|\W)= '[^']*'|(?:^|\W)!= '[^']*'|(?:^|\W)> '[^']*'|(?:^|\W)< '[^']*'|(?:^|\W)<= '[^']*'|(?:^|\W)>= '[^']*'|(?:^|\W)is '[^']*'|(?:^|\W)not is '[^']*'))*\)*)* *\(*(((ORDER BY '[^']*')*)|((ORDER BY [A-Za-z]*)*) *(ASC|DESC)*)*\)*\)*$/gi.test(e.trim())&&A(e)},A=function(e){for(var t,n=[],r={"(":")"},o=f(e);!(t=o()).done;){var a=t.value;if("("===a&&n.push(a),")"===a&&a!==r[n.pop()])return!1}return 0===n.length},O=function(e){var r=e.customSearchData,o=e.onSearch,a=e.onChange,i=e.onEnterButtonClick,u=e.planeQuery,c=e.onCheckBoxChecked,s=e.isLoading,d=e.onClearSearch,p=r.columns,b=r.searchResults,C=t.useState(!1),y=C[0],W=C[1],D=t.useState([]),A=D[0],O=D[1],P=t.useState(u?u.split(" "):[]),j=P[0],T=P[1],B=t.useState(null),K=B[0],z=B[1],F=t.useState(h.singleSelect),q=F[0],U=F[1],Y=t.useState(null),V=Y[0],M=Y[1],Z=t.useState({status:!0,position:0}),_=Z[0],$=Z[1],Q=t.useState({left:0}),J=Q[0],G=Q[1],H=t.useRef(),X=j.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",le),function(){return document.removeEventListener("mousedown",le)}}),[]),t.useEffect((function(){console.log("clearing the search called"),d&&T([])}),[d]),t.useEffect((function(){var e=ee();a(e||X,X,N(X))}),[c]),t.useEffect((function(){var e=ee();a(e||X,X,N(X))}),[j]),t.useEffect((function(){if(_&&_.position&&j.length){var e=[].concat(j);e&&e.length&&(e.splice(_.position+1,j.length-_.position),ae(e.join(" ").length))}}),[_]);var ee=function(){var e=X.match(/'.*?'/g),t=e&&e.filter((function(e){return p&&p.find((function(t){return t.label.toLowerCase()===e.split("'").join("").toLowerCase()}))})),n=X.replace(/'.*?'/g,"$"),o=[];r.columns&&r.columns.forEach((function(e){var t=0;n=n.replace(new RegExp(e.label,"gi"),(function(){return t++,e.value.toString()})),t||o.push(e)}));var a=[],i=0;return n.split(" ").forEach((function(n){for(var r,l="",u=f(n);!(r=u()).done;){var c=r.value;if("$"===c){if(t.find((function(t){return t.toLowerCase()===e[i].toLowerCase()}))){var s=o.find((function(t){return e[i].split("'").join("").toLowerCase()===t.label.toLowerCase()}));l+=s?s.value:""}else l+=e[i].toUpperCase();i++}else l+=c}a.push(l)})),a.join(" ")};t.useEffect((function(){K&&b&&(O(b),W(!0))}),[JSON.stringify(r)]);var te=function(e,t,n){var r=L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(p,[R]);if((e===R.label||e===R.value)&&t)return[w];if(x.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()})))return[];if("ORDER"===e||"order"===e)return[k];if(e===k.label||e===k.value)return p;if(e===R.label||e===R.value)return[].concat(p,[R]);var o=p.find((function(t){return t.label.toLowerCase()===oe(e,["'","("]).toLowerCase()}));return!o||n!==k.label&&n!==k.value?o&&"string"===o.type?[].concat(S.filter((function(e){return"any"===e.type}))):o&&"date"===o.type?S:S.find((function(t){return t.label.toLowerCase()===e.toLowerCase()}))?[]:L:x},ne=function(e){var t=[],n=e.match(/'.*?'/g),r=e.replace(/'.*?'/g,"$").split(" "),o=0;return r.forEach((function(e){for(var r,a="",i=f(e);!(r=i()).done;){var l=r.value;"$"===l?(a+=n[o],o++):a+=l}t.push(a)})),t},re=function(e){var t=-1,n=0;return e.forEach((function(e,r){for(var o,a=f(e);!(o=a()).done;)"'"===o.value&&(t=r,n++)})),{incompleteWordIndex:t,status:n%2==0}},oe=function(e,t){var n="";return t.forEach((function(t){n=n?n.split(t).join(""):e.split(t).join("")})),n},ae=function(e){H.current.setSelectionRange&&(H.current.focus(),H.current.setSelectionRange(e,e))},ie=function(e,t){return[].concat(L,S,[R]).find((function(e){return e.label.toLowerCase()===t.toLowerCase()}))?t:e&&e.toLowerCase()===w.label.toLowerCase()?"('"+t+"'":S.find((function(t){return t.label===e}))?"'"+t+"'":null},le=function(e){var t=document.getElementById("dynamic-results"),n=document.getElementsByClassName("flatpickr-calendar");if(!t||!t.contains(e.target)){var r=!1;if(Array.from(n).forEach((function(t){t.contains(e.target)&&(r=!0)})),!r)return W(!1)}};return t.createElement("div",{className:"custom-search"},t.createElement(g,{type:v.text,customClass:"custom-search-input",reference:H,value:X,onChange:function(e){!function(e){" "===e&&(O(te(null,null,null)),W(!0));var t=function(e){var t=re(e);if(t.status)return e;var n=t.incompleteWordIndex,r=e.slice(n);return e.splice(n,e.length-n,r.join(" ")),e}(ne(e)),n=function(e){var t=e.findIndex((function(e,t){return e!==ne(j.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==R.label&&r!==R.value||(r=e[t-3]);var o=p.find((function(e){return r&&e.label.toLowerCase()===oe(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&z(o),{lastExpression:n,modifiedWord:e[t],currentColumn:o,modifiedWordIndex:t,newColumnValue:r}}(t),r=n.lastExpression,a=n.modifiedWord,i=n.currentColumn,l=n.modifiedWordIndex,u=n.newColumnValue;if(i&&"date"===i.type){U(h.datePicker),M({index:l,word:a});var c=t;return c.splice(l+1,t.length-(l+1)),T(t),console.log(c),G({left:76,inputLeft:parseInt(H.current.getBoundingClientRect().left,10)+parseInt(H.current.clientWidth,10)}),void(")"!==a.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===r.toLowerCase()}))?W(!0):W(!1))}var s=t.filter((function(e){return""===e}));U(h.singleSelect);var f=s.length>1?[]:te(r,i,u);if(!t[a]&&t[l-1]&&"("===t[l-1].substr(0,1)&&t[l-2]&&t[l-2].toLowerCase()===w.label.toLowerCase()&&")"!==t[l-1].substr(-1))t.pop(),O([]);else if(i&&!f.length&&a&&oe(a,["'"]).length>=2&&"'"!==a.substr(-1))if("("===a.substr(0,1)){var d=a.replace("(","").split(","),m="",v=re(d);m=v.status?d[d.length-1]:d[v.incompleteWordIndex],","!==a.substr(-1)&&")"!==a.substr(-1)&&m&&m.split("'").join("").length>=2&&o({searchText:m.split("'").join(""),id:i.id,currentValueKey:i.value})}else/[a-zA-z]/.test(a.substr(-1))&&o({searchText:a.split("'").join(""),id:i.id,currentValueKey:i.value});else O(f.filter((function(e){return e.label.toLowerCase().includes(a&&a.split("(").join("")&&a.split("(").join("").toLowerCase())}))),W(!0);M({index:l,word:a}),T(t)}(e.target.value)},onClick:function(){O([]),W(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&N(X)&&X.length&&i()},placeholder:s?"Loading...":"Example: Product = 'Apple Rubber Pdts Inc - Corporate Promotion'",disabled:s}),X.length?t.createElement(m,{customClass:"clear-query",onClick:function(){T([])},tabIndex:y?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,N(X)?t.createElement(n.FontAwesomeIcon,{className:"custom-search-query-status valid",icon:l.faCheckCircle}):t.createElement(n.FontAwesomeIcon,{className:"custom-search-query-status invalid",icon:l.faTimesCircle}),y&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(I,{searchResultType:q,searchResults:X.length>0?A:[],onOptionClick:function(e){var t=j[j.length-2],n=null;V&&(t&&t.toLowerCase()===w.label.toLowerCase()&&V.word.includes("(")?T(j.map((function(t,r){return r===V.index?(n=r,""+function(e,t){if("("===e.substr(0,1)){var n=e.replace("(","").split(",");return n.length?(n[n.length-1]="'"+t+"'","("+n):"("+[t]}return""}(V.word,q===h.datePicker?e:e.label)):t}))):q===h.datePicker?n=function(e,t,n){return T(j.map((function(r,o){return o===V.index?(n=o,ie(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):q===h.singleSelect&&(n=function(e,t,n){return T(j.map((function(r,o){return o===V.index?(n=o,ie(e,t.label)||(p.find((function(e){return e.label.toLowerCase()===t.label.toLowerCase()}))?t.label.includes(" ")?"'"+t.label+"'":t.label:t.label.includes(" ")?"'"+t.label+"'":""+t.label)):r}))),n}(t,e,n))),n&&$({status:!_.status,position:n}),W(!1),H.current.focus()},setShowResults:W,datePickerPosition:J})))};exports.Button=m,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=e.onClearSearch,l=t.useState({columns:[]}),u=l[0],s=l[1];return t.useEffect((function(){s(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(O,{customSearchData:u,onChange:function(e,t,n){var r=c({},u,{searchResults:[]});s(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!u,onClearSearch:i}))};
//# sourceMappingURL=adintel-lib-poc.cjs.production.min.js.map

@@ -578,3 +578,6 @@ import { createElement, useRef, useEffect, useState, createRef, Fragment } from 'react';

useEffect(function () {
setQueryArray([]);
console.log('clearing the search called');
if (onClearSearch) {
setQueryArray([]);
}
}, [onClearSearch]);

@@ -581,0 +584,0 @@ useEffect(function () {

{
"version": "0.1.30",
"version": "0.1.31",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc