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.20 to 0.1.21

6

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

@@ -816,3 +816,4 @@ 'use strict';

if (modifiedWord.substr(-1) !== ',' && modifiedWord.substr(-1) !== ')' && modifiedColumnValue && modifiedColumnValue.split("'").join('').length >= 2) onSearch({
searchText: btoa(modifiedColumnValue.split("'").join('')),
// searchText: btoa(modifiedColumnValue.split("'").join('')),
searchText: modifiedColumnValue.split("'").join(''),
id: currentColumn.id,

@@ -823,3 +824,4 @@ currentValueKey: currentColumn.value

if (/[a-zA-z]/.test(modifiedWord.substr(-1))) onSearch({
searchText: btoa(modifiedWord.split("'").join('')),
// searchText: btoa(modifiedWord.split("'").join('')),
searchText: modifiedWord.split("'").join(''),
id: currentColumn.id,

@@ -826,0 +828,0 @@ currentValueKey: currentColumn.value

@@ -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=require("canvas"),s=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 f(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 d(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 f(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)?f(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 m,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},v=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,g=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":g||u||"","data-test-class":o||""},r)};!function(e){e.left="left-tooltip",e.top="top-tooltip",e.bottom="bottom-tooltip",e.right="right-tooltip"}(m||(m={}));var b,h=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"}(b||(b={}));var g,C,y=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(h,{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}))},w=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(v,{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"}(g||(g={})),function(e){e.date="date",e.string="string"}(C||(C={}));var E,k={label:"IN",value:"in",type:"any"},x={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"},k,{label:"NOT IN",value:"not in",type:"any"}],L=[{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],R=[{label:"AND",value:"and"},{label:"OR",value:"or"},{label:"ORDER BY",value:"order by"}],W={label:"NOT",value:"not"},D=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(v,{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 I=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(D,{key:n,option:e,onClick:r,index:n,focus:l===n,onkeyPressed:c,highlight:o,optionRef:s.current[n]})})))):null)},N=function(e){var n=e.searchResultType,r=e.searchResults,o=e.onOptionClick,a=void 0===o?function(){}:o,i=e.highlight,l=e.setShowResults,u=e.datePickerPosition,c=t.useRef(null),f=t.useState(!1),d=f[0],m=f[1];return t.useEffect((function(){c.current&&n===g.datePicker?(c.current.flatpickr.open(),m(!d)):m(!d)}),[u]),t.useEffect((function(){if(u&&n===g.datePicker&&c.current){var e=parseInt(u.left,10);c.current.flatpickr.calendarContainer.style.left=(e>u.inputLeft?u.inputLeft-50:e)+"px",c.current.flatpickr.open()}}),[d]),n===g.singleSelect?t.createElement(I,{options:r||[],onOptionClick:a,highlight:i,setShowResults:l}):n===g.datePicker?t.createElement(w,{reference:c,date:new Date,onChange:function(e){return a(s(e).format("MM-DD-YYYY"))}}):t.createElement(t.Fragment,null)},A=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())&&O(e)},O=function(e){for(var t,n=[],r={"(":")"},o=d(e);!(t=o()).done;){var a=t.value;if("("===a&&n.push(a),")"===a&&a!==r[n.pop()])return!1}return 0===n.length},j=function(e){var r=e.customSearchData,o=e.onSearch,a=e.onChange,i=e.onEnterButtonClick,s=e.planeQuery,c=e.onCheckBoxChecked,f=e.isLoading,m=r.columns,p=r.searchResults,h=t.useState(!1),C=h[0],w=h[1],D=t.useState([]),I=D[0],O=D[1],j=t.useState(s?s.split(" "):[]),P=j[0],T=j[1],B=t.useState(null),F=B[0],K=B[1],z=t.useState(g.singleSelect),q=z[0],U=z[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=P.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",le),function(){return document.removeEventListener("mousedown",le)}}),[]),t.useEffect((function(){var e=ee();a(e||X,X,A(X))}),[c]),t.useEffect((function(){var e=ee();a(e||X,X,A(X))}),[P]),t.useEffect((function(){if(_&&_.position&&P.length){var e=[].concat(P);e&&e.length&&(e.splice(_.position+1,P.length-_.position),ae(e.join(" ").length))}}),[_]);var ee=function(){var e=X.match(/'.*?'/g),t=e&&e.filter((function(e){return m&&m.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=d(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(){F&&p&&(O(p),w(!0))}),[JSON.stringify(r)]);var te=function(e,t,n){var r=R.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(m,[W]);if((e===W.label||e===W.value)&&t)return[k];if(L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()})))return[];if("ORDER"===e||"order"===e)return[x];if(e===x.label||e===x.value)return m;if(e===W.label||e===W.value)return[].concat(m,[W]);var o=m.find((function(t){return t.label.toLowerCase()===oe(e,["'","("]).toLowerCase()}));return!o||n!==x.label&&n!==x.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()}))?[]:R:L},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=d(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=d(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(R,S,[W]).find((function(e){return e.label.toLowerCase()===t.toLowerCase()}))?t:e&&e.toLowerCase()===k.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(y,{type:b.text,customClass:"custom-search-input",reference:H,value:X,onChange:function(e){!function(e){" "===e&&(O(te(null,null,null)),w(!0));var t,n,r=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)),a=function(e){var t=e.findIndex((function(e,t){return e!==ne(P.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==W.label&&r!==W.value||(r=e[t-3]);var o=m.find((function(e){return r&&e.label.toLowerCase()===oe(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&K(o),{lastExpression:n,modifiedWord:e[t],currentColumn:o,modifiedWordIndex:t,newColumnValue:r}}(r),i=a.lastExpression,l=a.modifiedWord,s=a.currentColumn,c=a.modifiedWordIndex,f=a.newColumnValue;if(s&&"date"===s.type){U(g.datePicker),M({index:c,word:l});var d=r;return d.splice(c+1,r.length-(c+1)),T(r),G({left:(t=d.join(" "),n=u.createCanvas(0,0).getContext("2d"),(n?(n.font="12px system-ui",n.measureText(t).width):0)+76),inputLeft:parseInt(H.current.getBoundingClientRect().left,10)+parseInt(H.current.clientWidth,10)}),void(")"!==l.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===i.toLowerCase()}))?w(!0):w(!1))}var p=r.filter((function(e){return""===e}));U(g.singleSelect);var v=p.length>1?[]:te(i,s,f);if(!r[l]&&r[c-1]&&"("===r[c-1].substr(0,1)&&r[c-2]&&r[c-2].toLowerCase()===k.label.toLowerCase()&&")"!==r[c-1].substr(-1))r.pop(),O([]);else if(s&&!v.length&&l&&oe(l,["'"]).length>=2&&"'"!==l.substr(-1))if("("===l.substr(0,1)){var b=l.replace("(","").split(","),h="",C=re(b);h=C.status?b[b.length-1]:b[C.incompleteWordIndex],","!==l.substr(-1)&&")"!==l.substr(-1)&&h&&h.split("'").join("").length>=2&&o({searchText:btoa(h.split("'").join("")),id:s.id,currentValueKey:s.value})}else/[a-zA-z]/.test(l.substr(-1))&&o({searchText:btoa(l.split("'").join("")),id:s.id,currentValueKey:s.value});else O(v.filter((function(e){return e.label.toLowerCase().includes(l&&l.split("(").join("")&&l.split("(").join("").toLowerCase())}))),w(!0);M({index:c,word:l}),T(r)}(e.target.value)},onClick:function(){O([]),w(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&A(X)&&X.length&&i()},placeholder:f?"Loading...":"Find records using search query",disabled:f}),X.length?t.createElement(v,{customClass:"clear-query",onClick:function(){T([])},tabIndex:C?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,A(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}),C&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(N,{searchResultType:q,searchResults:X.length>0?I:[],onOptionClick:function(e){var t=P[P.length-2],n=null;V&&(t&&t.toLowerCase()===k.label.toLowerCase()&&V.word.includes("(")?T(P.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===g.datePicker?e:e.label)):t}))):q===g.datePicker?n=function(e,t,n){return T(P.map((function(r,o){return o===V.index?(n=o,ie(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):q===g.singleSelect&&(n=function(e,t,n){return T(P.map((function(r,o){return o===V.index?(n=o,ie(e,t.label)||(m.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=v,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=t.useState({columns:[]}),l=i[0],u=i[1];return t.useEffect((function(){u(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(j,{customSearchData:l,onChange:function(e,t,n){var r=c({},l,{searchResults:[]});u(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!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=require("canvas"),s=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 f(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 d(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 f(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)?f(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 m,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},v=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,g=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":g||u||"","data-test-class":o||""},r)};!function(e){e.left="left-tooltip",e.top="top-tooltip",e.bottom="bottom-tooltip",e.right="right-tooltip"}(m||(m={}));var b,h=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"}(b||(b={}));var g,C,y=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(h,{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}))},w=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(v,{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"}(g||(g={})),function(e){e.date="date",e.string="string"}(C||(C={}));var E,k={label:"IN",value:"in",type:"any"},x={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"},k,{label:"NOT IN",value:"not in",type:"any"}],L=[{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],R=[{label:"AND",value:"and"},{label:"OR",value:"or"},{label:"ORDER BY",value:"order by"}],W={label:"NOT",value:"not"},D=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(v,{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 I=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(D,{key:n,option:e,onClick:r,index:n,focus:l===n,onkeyPressed:c,highlight:o,optionRef:s.current[n]})})))):null)},N=function(e){var n=e.searchResultType,r=e.searchResults,o=e.onOptionClick,a=void 0===o?function(){}:o,i=e.highlight,l=e.setShowResults,u=e.datePickerPosition,c=t.useRef(null),f=t.useState(!1),d=f[0],m=f[1];return t.useEffect((function(){c.current&&n===g.datePicker?(c.current.flatpickr.open(),m(!d)):m(!d)}),[u]),t.useEffect((function(){if(u&&n===g.datePicker&&c.current){var e=parseInt(u.left,10);c.current.flatpickr.calendarContainer.style.left=(e>u.inputLeft?u.inputLeft-50:e)+"px",c.current.flatpickr.open()}}),[d]),n===g.singleSelect?t.createElement(I,{options:r||[],onOptionClick:a,highlight:i,setShowResults:l}):n===g.datePicker?t.createElement(w,{reference:c,date:new Date,onChange:function(e){return a(s(e).format("MM-DD-YYYY"))}}):t.createElement(t.Fragment,null)},A=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())&&O(e)},O=function(e){for(var t,n=[],r={"(":")"},o=d(e);!(t=o()).done;){var a=t.value;if("("===a&&n.push(a),")"===a&&a!==r[n.pop()])return!1}return 0===n.length},j=function(e){var r=e.customSearchData,o=e.onSearch,a=e.onChange,i=e.onEnterButtonClick,s=e.planeQuery,c=e.onCheckBoxChecked,f=e.isLoading,m=r.columns,p=r.searchResults,h=t.useState(!1),C=h[0],w=h[1],D=t.useState([]),I=D[0],O=D[1],j=t.useState(s?s.split(" "):[]),P=j[0],T=j[1],B=t.useState(null),F=B[0],K=B[1],z=t.useState(g.singleSelect),q=z[0],U=z[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=P.join(" ");t.useEffect((function(){return document.addEventListener("mousedown",le),function(){return document.removeEventListener("mousedown",le)}}),[]),t.useEffect((function(){var e=ee();a(e||X,X,A(X))}),[c]),t.useEffect((function(){var e=ee();a(e||X,X,A(X))}),[P]),t.useEffect((function(){if(_&&_.position&&P.length){var e=[].concat(P);e&&e.length&&(e.splice(_.position+1,P.length-_.position),ae(e.join(" ").length))}}),[_]);var ee=function(){var e=X.match(/'.*?'/g),t=e&&e.filter((function(e){return m&&m.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=d(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(){F&&p&&(O(p),w(!0))}),[JSON.stringify(r)]);var te=function(e,t,n){var r=R.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()}));if(!e||r)return[].concat(m,[W]);if((e===W.label||e===W.value)&&t)return[k];if(L.find((function(t){return e&&t.label.toLowerCase()===e.toLowerCase()})))return[];if("ORDER"===e||"order"===e)return[x];if(e===x.label||e===x.value)return m;if(e===W.label||e===W.value)return[].concat(m,[W]);var o=m.find((function(t){return t.label.toLowerCase()===oe(e,["'","("]).toLowerCase()}));return!o||n!==x.label&&n!==x.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()}))?[]:R:L},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=d(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=d(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(R,S,[W]).find((function(e){return e.label.toLowerCase()===t.toLowerCase()}))?t:e&&e.toLowerCase()===k.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(y,{type:b.text,customClass:"custom-search-input",reference:H,value:X,onChange:function(e){!function(e){" "===e&&(O(te(null,null,null)),w(!0));var t,n,r=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)),a=function(e){var t=e.findIndex((function(e,t){return e!==ne(P.join(" ").replace(/ +/g," "))[t]})),n=e[t-1],r=e[t-2];r!==W.label&&r!==W.value||(r=e[t-3]);var o=m.find((function(e){return r&&e.label.toLowerCase()===oe(r,["("]).toLowerCase().replace(/\'/gi,"")}));return o&&K(o),{lastExpression:n,modifiedWord:e[t],currentColumn:o,modifiedWordIndex:t,newColumnValue:r}}(r),i=a.lastExpression,l=a.modifiedWord,s=a.currentColumn,c=a.modifiedWordIndex,f=a.newColumnValue;if(s&&"date"===s.type){U(g.datePicker),M({index:c,word:l});var d=r;return d.splice(c+1,r.length-(c+1)),T(r),G({left:(t=d.join(" "),n=u.createCanvas(0,0).getContext("2d"),(n?(n.font="12px system-ui",n.measureText(t).width):0)+76),inputLeft:parseInt(H.current.getBoundingClientRect().left,10)+parseInt(H.current.clientWidth,10)}),void(")"!==l.substr(-1)&&S.find((function(e){return e.label.toLowerCase()===i.toLowerCase()}))?w(!0):w(!1))}var p=r.filter((function(e){return""===e}));U(g.singleSelect);var v=p.length>1?[]:te(i,s,f);if(!r[l]&&r[c-1]&&"("===r[c-1].substr(0,1)&&r[c-2]&&r[c-2].toLowerCase()===k.label.toLowerCase()&&")"!==r[c-1].substr(-1))r.pop(),O([]);else if(s&&!v.length&&l&&oe(l,["'"]).length>=2&&"'"!==l.substr(-1))if("("===l.substr(0,1)){var b=l.replace("(","").split(","),h="",C=re(b);h=C.status?b[b.length-1]:b[C.incompleteWordIndex],","!==l.substr(-1)&&")"!==l.substr(-1)&&h&&h.split("'").join("").length>=2&&o({searchText:h.split("'").join(""),id:s.id,currentValueKey:s.value})}else/[a-zA-z]/.test(l.substr(-1))&&o({searchText:l.split("'").join(""),id:s.id,currentValueKey:s.value});else O(v.filter((function(e){return e.label.toLowerCase().includes(l&&l.split("(").join("")&&l.split("(").join("").toLowerCase())}))),w(!0);M({index:c,word:l}),T(r)}(e.target.value)},onClick:function(){O([]),w(!1)},onKeyUp:function(e){e.keyCode===E.Enter&&A(X)&&X.length&&i()},placeholder:f?"Loading...":"Find records using search query",disabled:f}),X.length?t.createElement(v,{customClass:"clear-query",onClick:function(){T([])},tabIndex:C?-1:0},t.createElement(n.FontAwesomeIcon,{icon:l.faTimes})):null,A(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}),C&&t.createElement("div",{id:"dynamic-results",className:"custom-search-results"},t.createElement(N,{searchResultType:q,searchResults:X.length>0?I:[],onOptionClick:function(e){var t=P[P.length-2],n=null;V&&(t&&t.toLowerCase()===k.label.toLowerCase()&&V.word.includes("(")?T(P.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===g.datePicker?e:e.label)):t}))):q===g.datePicker?n=function(e,t,n){return T(P.map((function(r,o){return o===V.index?(n=o,ie(e,t)||(t.includes(" ")?"'"+t+"'":""+t)):r}))),n}(t,e,n):q===g.singleSelect&&(n=function(e,t,n){return T(P.map((function(r,o){return o===V.index?(n=o,ie(e,t.label)||(m.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=v,exports.CustomSearchWrapper=function(e){var n=e.searchData,r=e.handleSearchData,o=e.plainQuery,a=e.onChange,i=t.useState({columns:[]}),l=i[0],u=i[1];return t.useEffect((function(){u(n)}),[n]),t.createElement("div",{className:"custom-wrapper"},t.createElement(j,{customSearchData:l,onChange:function(e,t,n){var r=c({},l,{searchResults:[]});u(r),a(e,t,n)},onCheckBoxChecked:!0,onEnterButtonClick:function(){},onSearch:r,planeQuery:o,isLoading:!l}))};
//# sourceMappingURL=adintel-lib-poc.cjs.production.min.js.map

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

if (modifiedWord.substr(-1) !== ',' && modifiedWord.substr(-1) !== ')' && modifiedColumnValue && modifiedColumnValue.split("'").join('').length >= 2) onSearch({
searchText: btoa(modifiedColumnValue.split("'").join('')),
// searchText: btoa(modifiedColumnValue.split("'").join('')),
searchText: modifiedColumnValue.split("'").join(''),
id: currentColumn.id,

@@ -819,3 +820,4 @@ currentValueKey: currentColumn.value

if (/[a-zA-z]/.test(modifiedWord.substr(-1))) onSearch({
searchText: btoa(modifiedWord.split("'").join('')),
// searchText: btoa(modifiedWord.split("'").join('')),
searchText: modifiedWord.split("'").join(''),
id: currentColumn.id,

@@ -822,0 +824,0 @@ currentValueKey: currentColumn.value

{
"version": "0.1.20",
"version": "0.1.21",
"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