Socket
Socket
Sign inDemoInstall

adintel-lib-poc

Package Overview
Dependencies
Maintainers
1
Versions
246
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.32 to 0.1.33

4

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

@@ -588,6 +588,6 @@ 'use strict';

React.useEffect(function () {
if (onSearchTextChange) {
if (onSearchTextChange.length) {
setQueryArray(onSearchTextChange.split(' '));
}
}, []);
}, [onSearchTextChange]);
React.useEffect(function () {

@@ -594,0 +594,0 @@ var query = getSearchQueryReplacedByValues();

@@ -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 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=e.onSearchTextChange,b=r.columns,C=r.searchResults,y=t.useState(!1),W=y[0],D=y[1],A=t.useState([]),O=A[0],P=A[1],j=t.useState(u?u.split(" "):[]),T=j[0],B=j[1],K=t.useState(null),z=K[0],F=K[1],q=t.useState(h.singleSelect),U=q[0],Y=q[1],V=t.useState(null),M=V[0],Z=V[1],_=t.useState({status:!0,position:0}),$=_[0],Q=_[1],J=t.useState({left:0}),G=J[0],H=J[1],X=t.useRef(),ee=T.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",ue),function(){return document.removeEventListener("mousedown",ue)}}),[]),t.useEffect((function(){d&&B([])}),[d]),t.useEffect((function(){p&&B(p.split(" "))}),[]),t.useEffect((function(){var e=te();a(e||ee,ee,N(ee))}),[c]),t.useEffect((function(){var e=te();a(e||ee,ee,N(ee))}),[T]),t.useEffect((function(){if($&&$.position&&T.length){var e=[].concat(T);e&&e.length&&(e.splice($.position+1,T.length-$.position),ie(e.join(" ").length))}}),[$]);var te=function(){var e=ee.match(/'.*?'/g),t=e&&e.filter((function(e){return b&&b.find((function(t){return t.label.toLowerCase()===e.split("'").join("").toLowerCase()}))})),n=ee.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(){z&&C&&(P(C),D(!0))}),[JSON.stringify(r)]);var ne=function(e,t,n){var r=L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(b,[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 b;if(e===R.label||e===R.value)return[].concat(b,[R]);var o=b.find((function(t){return t.label.toLowerCase()===ae(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},re=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},oe=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}},ae=function(e,t){var n="";return t.forEach((function(t){n=n?n.split(t).join(""):e.split(t).join("")})),n},ie=function(e){X.current.setSelectionRange&&(X.current.focus(),X.current.setSelectionRange(e,e))},le=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},ue=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 D(!1)}};return t.createElement("div",{className:"custom-search"},t.createElement(g,{type:v.text,customClass:"custom-search-input",reference:X,value:ee,onChange:function(e){!function(e){" "===e&&(P(ne(null,null,null)),D(!0));var t=function(e){var t=oe(e);if(t.status)return e;var n=t.incompleteWordIndex,r=e.slice(n);return e.splice(n,e.length-n,r.join(" ")),e}(re(e)),n=function(e){var t=e.findIndex((function(e,t){return e!==re(T.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==R.label&&r!==R.value||(r=e[t-3]);var o=b.find((function(e){return r&&e.label.toLowerCase()===ae(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&F(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){Y(h.datePicker),Z({index:l,word:a});var c=t;return c.splice(l+1,t.length-(l+1)),B(t),console.log(c),H({left:76,inputLeft:parseInt(X.current.getBoundingClientRect().left,10)+parseInt(X.current.clientWidth,10)}),void(")"!==a.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===r.toLowerCase()}))?D(!0):D(!1))}var s=t.filter((function(e){return""===e}));Y(h.singleSelect);var f=s.length>1?[]:ne(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(),P([]);else if(i&&!f.length&&a&&ae(a,["'"]).length>=2&&"'"!==a.substr(-1))if("("===a.substr(0,1)){var d=a.replace("(","").split(","),p="",m=oe(d);p=m.status?d[d.length-1]:d[m.incompleteWordIndex],","!==a.substr(-1)&&")"!==a.substr(-1)&&p&&p.split("'").join("").length>=2&&o({searchText:p.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 P(f.filter((function(e){return e.label.toLowerCase().includes(a&&a.split("(").join("")&&a.split("(").join("").toLowerCase())}))),D(!0);Z({index:l,word:a}),B(t)}(e.target.value)},onClick:function(){P([]),D(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&N(ee)&&ee.length&&i()},placeholder:s?"Loading...":"Example: Product = 'Apple Rubber Pdts Inc - Corporate Promotion'",disabled:s}),ee.length?t.createElement(m,{customClass:"clear-query",onClick:function(){B([])},tabIndex:W?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,N(ee)?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}),W&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(I,{searchResultType:U,searchResults:ee.length>0?O:[],onOptionClick:function(e){var t=T[T.length-2],n=null;M&&(t&&t.toLowerCase()===w.label.toLowerCase()&&M.word.includes("(")?B(T.map((function(t,r){return r===M.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""}(M.word,U===h.datePicker?e:e.label)):t}))):U===h.datePicker?n=function(e,t,n){return B(T.map((function(r,o){return o===M.index?(n=o,le(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):U===h.singleSelect&&(n=function(e,t,n){return B(T.map((function(r,o){return o===M.index?(n=o,le(e,t.label)||(b.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&&Q({status:!$.status,position:n}),D(!1),X.current.focus()},setShowResults:D,datePickerPosition:G})))};exports.Button=m,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=e.onClearSearch,l=e.changedSearchText,u=t.useState({columns:[]}),s=u[0],f=u[1];return t.useEffect((function(){f(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(O,{customSearchData:s,onChange:function(e,t,n){var r=c({},s,{searchResults:[]});f(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!s,onClearSearch:i,onSearchTextChange:l}))};
"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=e.onSearchTextChange,b=r.columns,C=r.searchResults,y=t.useState(!1),W=y[0],D=y[1],A=t.useState([]),O=A[0],P=A[1],j=t.useState(u?u.split(" "):[]),T=j[0],B=j[1],K=t.useState(null),z=K[0],F=K[1],q=t.useState(h.singleSelect),U=q[0],Y=q[1],V=t.useState(null),M=V[0],Z=V[1],_=t.useState({status:!0,position:0}),$=_[0],Q=_[1],J=t.useState({left:0}),G=J[0],H=J[1],X=t.useRef(),ee=T.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",ue),function(){return document.removeEventListener("mousedown",ue)}}),[]),t.useEffect((function(){d&&B([])}),[d]),t.useEffect((function(){p.length&&B(p.split(" "))}),[p]),t.useEffect((function(){var e=te();a(e||ee,ee,N(ee))}),[c]),t.useEffect((function(){var e=te();a(e||ee,ee,N(ee))}),[T]),t.useEffect((function(){if($&&$.position&&T.length){var e=[].concat(T);e&&e.length&&(e.splice($.position+1,T.length-$.position),ie(e.join(" ").length))}}),[$]);var te=function(){var e=ee.match(/'.*?'/g),t=e&&e.filter((function(e){return b&&b.find((function(t){return t.label.toLowerCase()===e.split("'").join("").toLowerCase()}))})),n=ee.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(){z&&C&&(P(C),D(!0))}),[JSON.stringify(r)]);var ne=function(e,t,n){var r=L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(b,[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 b;if(e===R.label||e===R.value)return[].concat(b,[R]);var o=b.find((function(t){return t.label.toLowerCase()===ae(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},re=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},oe=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}},ae=function(e,t){var n="";return t.forEach((function(t){n=n?n.split(t).join(""):e.split(t).join("")})),n},ie=function(e){X.current.setSelectionRange&&(X.current.focus(),X.current.setSelectionRange(e,e))},le=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},ue=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 D(!1)}};return t.createElement("div",{className:"custom-search"},t.createElement(g,{type:v.text,customClass:"custom-search-input",reference:X,value:ee,onChange:function(e){!function(e){" "===e&&(P(ne(null,null,null)),D(!0));var t=function(e){var t=oe(e);if(t.status)return e;var n=t.incompleteWordIndex,r=e.slice(n);return e.splice(n,e.length-n,r.join(" ")),e}(re(e)),n=function(e){var t=e.findIndex((function(e,t){return e!==re(T.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==R.label&&r!==R.value||(r=e[t-3]);var o=b.find((function(e){return r&&e.label.toLowerCase()===ae(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&F(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){Y(h.datePicker),Z({index:l,word:a});var c=t;return c.splice(l+1,t.length-(l+1)),B(t),console.log(c),H({left:76,inputLeft:parseInt(X.current.getBoundingClientRect().left,10)+parseInt(X.current.clientWidth,10)}),void(")"!==a.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===r.toLowerCase()}))?D(!0):D(!1))}var s=t.filter((function(e){return""===e}));Y(h.singleSelect);var f=s.length>1?[]:ne(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(),P([]);else if(i&&!f.length&&a&&ae(a,["'"]).length>=2&&"'"!==a.substr(-1))if("("===a.substr(0,1)){var d=a.replace("(","").split(","),p="",m=oe(d);p=m.status?d[d.length-1]:d[m.incompleteWordIndex],","!==a.substr(-1)&&")"!==a.substr(-1)&&p&&p.split("'").join("").length>=2&&o({searchText:p.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 P(f.filter((function(e){return e.label.toLowerCase().includes(a&&a.split("(").join("")&&a.split("(").join("").toLowerCase())}))),D(!0);Z({index:l,word:a}),B(t)}(e.target.value)},onClick:function(){P([]),D(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&N(ee)&&ee.length&&i()},placeholder:s?"Loading...":"Example: Product = 'Apple Rubber Pdts Inc - Corporate Promotion'",disabled:s}),ee.length?t.createElement(m,{customClass:"clear-query",onClick:function(){B([])},tabIndex:W?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,N(ee)?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}),W&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(I,{searchResultType:U,searchResults:ee.length>0?O:[],onOptionClick:function(e){var t=T[T.length-2],n=null;M&&(t&&t.toLowerCase()===w.label.toLowerCase()&&M.word.includes("(")?B(T.map((function(t,r){return r===M.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""}(M.word,U===h.datePicker?e:e.label)):t}))):U===h.datePicker?n=function(e,t,n){return B(T.map((function(r,o){return o===M.index?(n=o,le(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):U===h.singleSelect&&(n=function(e,t,n){return B(T.map((function(r,o){return o===M.index?(n=o,le(e,t.label)||(b.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&&Q({status:!$.status,position:n}),D(!1),X.current.focus()},setShowResults:D,datePickerPosition:G})))};exports.Button=m,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=e.onClearSearch,l=e.changedSearchText,u=t.useState({columns:[]}),s=u[0],f=u[1];return t.useEffect((function(){f(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(O,{customSearchData:s,onChange:function(e,t,n){var r=c({},s,{searchResults:[]});f(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!s,onClearSearch:i,onSearchTextChange:l}))};
//# sourceMappingURL=adintel-lib-poc.cjs.production.min.js.map

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

useEffect(function () {
if (onSearchTextChange) {
if (onSearchTextChange.length) {
setQueryArray(onSearchTextChange.split(' '));
}
}, []);
}, [onSearchTextChange]);
useEffect(function () {

@@ -590,0 +590,0 @@ var query = getSearchQueryReplacedByValues();

{
"version": "0.1.32",
"version": "0.1.33",
"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