@blueprintjs/select
Advanced tools
Comparing version 3.15.1 to 3.15.2
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["@blueprintjs/core","tslib","react","classnames"],t):"object"==typeof exports?exports.Select=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Select=t(e.Blueprint.Core,e.window,e.React,e.classNames))}(window,(function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},,,function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return r})),n.d(t,"renderFilteredItems",(function(){return v})),n.d(t,"executeItemsEqual",(function(){return m})),n.d(t,"getCreateNewItem",(function(){return h})),n.d(t,"isCreateNewItem",(function(){return f})),n.d(t,"getActiveItem",(function(){return y})),n.d(t,"Omnibar",(function(){return L})),n.d(t,"QueryList",(function(){return C})),n.d(t,"getFirstEnabledItem",(function(){return T})),n.d(t,"MultiSelect",(function(){return A})),n.d(t,"Select",(function(){return S})),n.d(t,"Suggest",(function(){return K}));var r={};n.r(r),n.d(r,"MULTISELECT",(function(){return s})),n.d(r,"MULTISELECT_POPOVER",(function(){return l})),n.d(r,"MULTISELECT_TAG_INPUT_INPUT",(function(){return a})),n.d(r,"OMNIBAR",(function(){return p})),n.d(r,"OMNIBAR_OVERLAY",(function(){return u})),n.d(r,"SELECT",(function(){return c})),n.d(r,"SELECT_POPOVER",(function(){return d}));var i=n(0),o=i.Classes.getClassNamespace(),s=o+"-multi-select",l=s+"-popover",a=s+"-tag-input-input",p=o+"-omnibar",u=p+"-overlay",c=o+"-select",d=c+"-popover";function v(e,t,n){if(0===e.query.length&&void 0!==n)return n;var r=e.filteredItems.map(e.renderItem).filter((function(e){return null!=e}));return r.length>0?r:t}function m(e,t,n){return void 0===e||null==t||null==n?t===n:i.Utils.isFunction(e)?e(t,n):t[e]===n[e]}function h(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function f(e){if(null==e)return!1;var t=Object.keys(e);return 1===t.length&&"__blueprintCreateNewItemBrand"===t[0]&&"blueprint-create-new-item"===e.__blueprintCreateNewItemBrand}function y(e){return null==e||f(e)?null:e}var I=n(1),O=n(3),P=n.n(O),g=n(2),C=function(e){function t(t,n){var r,o,s=e.call(this,t,n)||this;s.refHandlers={itemsParent:function(e){return s.itemsParentRef=e}},s.shouldCheckActiveItemInViewport=!1,s.expectedNextActiveItem=null,s.isEnterKeyPressed=!1,s.renderItemList=function(e){var t=s.props,n=t.initialContent,r=t.noResults,o=e.renderCreateItem(),l=v(e,null!=o?null:r,n);if(null==l&&null==o)return null;var a=s.isCreateItemFirst();return g.createElement(i.Menu,{ulRef:e.itemsParentRef},a&&o,l,!a&&o)},s.renderItem=function(e,t){if(!0!==s.props.disabled){var n=s.state,r=n.activeItem,i=n.query,o=s.state.filteredItems.indexOf(e)>=0,l={active:m(s.props.itemsEqual,y(r),e),disabled:R(e,t,s.props.itemDisabled),matchesPredicate:o};return s.props.itemRenderer(e,{handleClick:function(t){return s.handleItemSelect(e,t)},index:t,modifiers:l,query:i})}return null},s.renderCreateItemMenuItem=function(){if(s.isCreateItemRendered()){var e=s.state,t=e.activeItem,n=e.query.trim(),r=f(t);return s.props.createNewItemRenderer(n,r,(function(e){s.handleItemCreate(n,e)}))}return null},s.handleItemCreate=function(e,t){var n,r,i,o,l=null===(r=(n=s.props).createNewItemFromQuery)||void 0===r?void 0:r.call(n,e);null!=l&&(null===(o=(i=s.props).onItemSelect)||void 0===o||o.call(i,l,t),s.maybeResetQuery())},s.handleItemSelect=function(e,t){var n,r;s.setActiveItem(e),null===(r=(n=s.props).onItemSelect)||void 0===r||r.call(n,e,t),s.maybeResetQuery()},s.handlePaste=function(e){for(var t,n=s.props,r=n.createNewItemFromQuery,i=n.onItemsPaste,o=[],l=[],a=0,p=e;a<p.length;a++){var u=p[a],c=_(u,s.props);if(void 0!==c)t=c,l.push(c);else if(s.canCreateItems()){var d=null==r?void 0:r(u);void 0!==d&&l.push(d)}else o.push(u)}s.setQuery(o.join(", "),!1),void 0!==t&&s.setActiveItem(t),null==i||i(l)},s.handleKeyDown=function(e){var t,n,r=e.keyCode;if(r===i.Keys.ARROW_UP||r===i.Keys.ARROW_DOWN){e.preventDefault();var o=s.getNextActiveItem(r===i.Keys.ARROW_UP?-1:1);null!=o&&s.setActiveItem(o)}else r===i.Keys.ENTER&&(s.isEnterKeyPressed=!0);null===(n=(t=s.props).onKeyDown)||void 0===n||n.call(t,e)},s.handleKeyUp=function(e){var t=s.props.onKeyUp,n=s.state.activeItem;e.keyCode===i.Keys.ENTER&&s.isEnterKeyPressed&&(e.preventDefault(),null==n||f(n)?s.handleItemCreate(s.state.query,e):s.handleItemSelect(n,e),s.isEnterKeyPressed=!1),null==t||t(e)},s.handleInputQueryChange=function(e){var t,n,r=null==e?"":e.target.value;s.setQuery(r),null===(n=(t=s.props).onQueryChange)||void 0===n||n.call(t,r,e)};var l=t.query,a=void 0===l?"":l,p=null===(r=t.createNewItemFromQuery)||void 0===r?void 0:r.call(t,a),u=b(a,t);return s.state={activeItem:void 0!==t.activeItem?t.activeItem:null!==(o=t.initialActiveItem)&&void 0!==o?o:T(u,t.itemDisabled),createNewItem:p,filteredItems:u,query:a},s}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=e.className,n=e.items,r=e.renderer,i=e.itemListRenderer,o=void 0===i?this.renderItemList:i,s=this.state,l=(s.createNewItem,Object(I.__rest)(s,["createNewItem"]));return r(Object(I.__assign)(Object(I.__assign)({},l),{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handlePaste:this.handlePaste,handleQueryChange:this.handleInputQueryChange,itemList:o(Object(I.__assign)(Object(I.__assign)({},l),{items:n,itemsParentRef:this.refHandlers.itemsParent,renderCreateItem:this.renderCreateItemMenuItem,renderItem:this.renderItem}))}))},t.prototype.componentDidUpdate=function(e){var t=this;void 0!==this.props.activeItem&&this.props.activeItem!==this.state.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:this.props.activeItem})),null!=this.props.query&&this.props.query!==e.query?this.setQuery(this.props.query,this.props.resetOnQuery,this.props):i.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(this.requestAnimationFrame((function(){return t.scrollActiveItemIntoView()})),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,y(this.expectedNextActiveItem),y(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,i=n.offsetHeight,o=this.itemsParentRef,s=o.offsetTop,l=o.scrollTop,a=o.clientHeight,p=this.getItemsParentPadding(),u=p.paddingTop,c=r+i+p.paddingBottom-s,d=r-u-s;c>=l+a?this.itemsParentRef.scrollTop=c+i-a:d<=l&&(this.itemsParentRef.scrollTop=d-i)}}},t.prototype.setQuery=function(e,t,n){var r;void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var i=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0,e!==this.state.query&&(null===(r=n.onQueryChange)||void 0===r||r.call(n,e));var o=e.trim(),s=b(o,n),l=null!=i&&""!==o?i(o):void 0;this.setState({createNewItem:l,filteredItems:s,query:e});var a=this.getActiveIndex(s);(t||a<0||R(y(this.state.activeItem),a,n.itemDisabled))&&(this.isCreateItemRendered()&&this.isCreateItemFirst()?this.setActiveItem({__blueprintCreateNewItemBrand:"blueprint-create-new-item"}):this.setActiveItem(T(s,n.itemDisabled)))},t.prototype.setActiveItem=function(e){var t,n,r,i;this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),f(e)?null===(n=(t=this.props).onActiveItemChange)||void 0===n||n.call(t,null,!0):null===(i=(r=this.props).onActiveItemChange)||void 0===i||i.call(r,e,!1)},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(f(e)){var t=this.isCreateItemFirst()?0:this.state.filteredItems.length;return this.itemsParentRef.children.item(t)}var n=this.getActiveIndex();return this.itemsParentRef.children.item(n)}},t.prototype.getActiveIndex=function(e){void 0===e&&(e=this.state.filteredItems);var t=this.state.activeItem;if(null==t||f(t))return-1;for(var n=0;n<e.length;++n)if(m(this.props.itemsEqual,e[n],t))return n;return-1},t.prototype.getItemsParentPadding=function(){var e=getComputedStyle(this.itemsParentRef),t=e.paddingTop;return{paddingBottom:E(e.paddingBottom),paddingTop:E(t)}},t.prototype.getNextActiveItem=function(e,t){if((void 0===t&&(t=this.getActiveIndex()),this.isCreateItemRendered())&&(0===t&&-1===e||t===this.state.filteredItems.length-1&&1===e))return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"};return T(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},t.prototype.isCreateItemFirst=function(){return"first"===this.props.createNewItemPosition},t.prototype.canCreateItems=function(){return null!=this.props.createNewItemFromQuery&&null!=this.props.createNewItemRenderer},t.prototype.wouldCreatedItemMatchSomeExistingItem=function(){var e=this;return this.state.filteredItems.some((function(t){return m(e.props.itemsEqual,t,e.state.createNewItem)}))},t.prototype.maybeResetQuery=function(){this.props.resetOnSelect&&this.setQuery("",!0)},t.displayName=i.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={disabled:!1,resetOnQuery:!0},t}(i.AbstractComponent2);function E(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate;if(i.Utils.isFunction(r))for(var o=0;o<n.length;o++){var s=n[o];if(r(e,s,o,!0))return s}}function b(e,t){var n=t.items,r=t.itemPredicate,o=t.itemListPredicate;return i.Utils.isFunction(o)?o(e,n):i.Utils.isFunction(r)?n.filter((function(t,n){return r(e,t,n)})):n}function R(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function T(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=e.length-1),0===e.length)return null;var i,o,s,l=r,a=e.length-1;do{if(s=a,!R(e[l=(i=l+n)<(o=0)?s:i>s?o:i],l,t))return e[l]}while(l!==r&&-1!==r);return null}var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=C.ofType(),t.renderQueryList=function(e){var n=t.props,o=n.inputProps,s=void 0===o?{}:o,l=n.isOpen,a=n.overlayProps,p=void 0===a?{}:a,u=e.handleKeyDown,c=e.handleKeyUp,d=l?{onKeyDown:u,onKeyUp:c}:{};return g.createElement(i.Overlay,Object(I.__assign)({hasBackdrop:!0},p,{isOpen:l,className:P()(r.OMNIBAR_OVERLAY,p.className),onClose:t.handleOverlayClose}),g.createElement("div",Object(I.__assign)({className:P()(r.OMNIBAR,e.className)},d),g.createElement(i.InputGroup,Object(I.__assign)({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){var n,r,i,o;null===(r=null===(n=t.props.overlayProps)||void 0===n?void 0:n.onClose)||void 0===r||r.call(n,e),null===(o=(i=t.props).onClose)||void 0===o||o.call(i,e)},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["isOpen","inputProps","overlayProps"])),n="initialContent"in this.props?this.props.initialContent:null;return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{initialContent:n,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".Omnibar",t}(g.PureComponent),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:t.props.popoverProps&&t.props.popoverProps.isOpen||!1},t.TypedQueryList=C.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){var n,r;t.input=e,null===(r=null===(n=t.props.tagInputProps)||void 0===n?void 0:n.inputRef)||void 0===r||r.call(n,e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n,o=t.props,s=o.fill,l=o.tagInputProps,a=void 0===l?{}:l,p=o.popoverProps,u=void 0===p?{}:p,c=o.selectedItems,d=void 0===c?[]:c,v=o.placeholder,m=e.handlePaste,h=e.handleKeyDown,f=e.handleKeyUp;s&&(u.fill=!0,a.fill=!0);var y=Object(I.__assign)(Object(I.__assign)({},a.inputProps),{className:P()(null===(n=a.inputProps)||void 0===n?void 0:n.className,r.MULTISELECT_TAG_INPUT_INPUT)});return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:i.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,u.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTagInputKeyDownHandler(h),onKeyUp:t.getTagInputKeyUpHandler(f)},g.createElement(i.TagInput,Object(I.__assign)({placeholder:v},a,{className:P()(r.MULTISELECT,a.className),inputRef:t.refHandlers.input,inputProps:y,inputValue:e.query,onAdd:function(e,t){"paste"===t&&m(e)},onInputChange:e.handleQueryChange,onRemove:t.handleTagRemove,values:d.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:h,onKeyUp:f},e.itemList))},t.handleItemSelect=function(e,n){var r,i;null!=t.input&&t.input.focus(),null===(i=(r=t.props).onItemSelect)||void 0===i||i.call(r,e,n)},t.handleQueryChange=function(e,n){var r,i;t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),null===(i=(r=t.props).onQueryChange)||void 0===i||i.call(r,e,n)},t.handlePopoverInteraction=function(e){return t.requestAnimationFrame((function(){var n,r,i=t.input===document.activeElement;null==t.input||i?t.props.openOnKeyDown||t.setState({isOpen:!0}):t.setState({isOpen:!1}),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onInteraction)||void 0===r||r.call(n,e)}))},t.handlePopoverOpened=function(e){var n,r;null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onOpened)||void 0===r||r.call(n,e)},t.handleTagRemove=function(e,n){var r,i=t.props,o=i.selectedItems,s=void 0===o?[]:o,l=i.onRemove,a=i.tagInputProps;null==l||l(s[n],n),null===(r=null==a?void 0:a.onRemove)||void 0===r||r.call(a,e,n)},t.getTagInputKeyDownHandler=function(e){return function(n){var r=n.which;r===i.Keys.ESCAPE||r===i.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==i.Keys.BACKSPACE&&r!==i.Keys.ARROW_LEFT&&r!==i.Keys.ARROW_RIGHT&&t.setState({isOpen:!0});var o=null!=n.target.closest("."+i.Classes.TAG_REMOVE);t.state.isOpen&&!o&&(null==e||e(n))}},t.getTagInputKeyUpHandler=function(e){return function(n){var i=n.target.classList.contains(r.MULTISELECT_TAG_INPUT_INPUT);t.state.isOpen&&i&&(null==e||e(n))}},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,Object(I.__rest)(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={fill:!1,placeholder:"Search..."},t}(i.AbstractPureComponent2),S=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:!1},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.filterable,s=void 0===o||o,l=t.disabled,a=void 0!==l&&l,p=t.inputProps,u=void 0===p?{}:p,c=t.popoverProps,d=void 0===c?{}:c,v=g.createElement(i.InputGroup,Object(I.__assign)({leftIcon:"search",placeholder:"Filter...",rightElement:n.maybeRenderClearButton(e.query)},u,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,value:e.query})),m=e.handleKeyDown,h=e.handleKeyUp;return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:n.state.isOpen,disabled:a,position:i.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened,onClosing:n.handlePopoverClosing}),g.createElement("div",{onKeyDown:n.state.isOpen?m:n.handleTargetKeyDown,onKeyUp:n.state.isOpen?h:void 0},n.props.children),g.createElement("div",{onKeyDown:m,onKeyUp:h},s?v:void 0,e.itemList))},n.handleTargetKeyDown=function(e){e.which!==i.Keys.ARROW_UP&&e.which!==i.Keys.ARROW_DOWN||(e.preventDefault(),n.setState({isOpen:!0}))},n.handleItemSelect=function(e,t){var r,i;n.setState({isOpen:!1}),null===(i=(r=n.props).onItemSelect)||void 0===i||i.call(r,e,t)},n.handlePopoverInteraction=function(e){var t,r;n.setState({isOpen:e}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)},n.handlePopoverOpening=function(e){var t,r;n.previousFocusedElement=document.activeElement,n.props.resetOnClose&&n.resetQuery(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),n.requestAnimationFrame((function(){var e,t=n.props.inputProps;!1!==(void 0===t?{}:t).autoFocus&&(null===(e=Object(i.getRef)(n.inputElement))||void 0===e||e.focus())})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.handlePopoverClosing=function(e){var t,r;n.requestAnimationFrame((function(){void 0!==n.previousFocusedElement&&(n.previousFocusedElement.focus(),n.previousFocusedElement=void 0)})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onClosing)||void 0===r||r.call(t,e)},n.resetQuery=function(){return n.queryList&&n.queryList.setQuery("",!0)},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,Object(I.__rest)(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.maybeRenderClearButton=function(e){return e.length>0?g.createElement(i.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=i.DISPLAYNAME_PREFIX+".Select",t}(i.AbstractPureComponent2),K=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:null!=n.props.popoverProps&&n.props.popoverProps.isOpen||!1,selectedItem:n.getInitialSelectedItem()},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.fill,s=t.inputProps,l=void 0===s?{}:s,a=t.popoverProps,p=void 0===a?{}:a,u=n.state,c=u.isOpen,d=u.selectedItem,v=e.handleKeyDown,m=e.handleKeyUp,h=l.autoComplete,f=void 0===h?"off":h,y=l.placeholder,O=void 0===y?"Search...":y,C=d?n.props.inputValueRenderer(d):"",E=c&&C?C:O,_=c?e.query:C||(n.props.resetOnClose?"":e.query);return o&&(p.fill=!0,l.fill=!0),g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:c,position:i.Position.BOTTOM_LEFT},p,{className:P()(e.className,p.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,p.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened}),g.createElement(i.InputGroup,Object(I.__assign)({autoComplete:f,disabled:n.props.disabled},l,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,onFocus:n.handleInputFocus,onKeyDown:n.getTargetKeyDownHandler(v),onKeyUp:n.getTargetKeyUpHandler(m),placeholder:E,value:_})),g.createElement("div",{onKeyDown:v,onKeyUp:m},e.itemList))},n.selectText=function(){n.requestAnimationFrame((function(){var e=Object(i.getRef)(n.inputElement);null==e||e.setSelectionRange(0,e.value.length)}))},n.handleInputFocus=function(e){var t,r;n.selectText(),n.props.openOnKeyDown||n.setState({isOpen:!0}),null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.onFocus)||void 0===r||r.call(t,e)},n.handleItemSelect=function(e,t){var r,o,s,l,a;n.props.closeOnSelect?(null===(o=Object(i.getRef)(n.inputElement))||void 0===o||o.blur(),a=!1):(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.focus(),n.selectText(),a=!0),void 0===n.props.selectedItem?n.setState({isOpen:a,selectedItem:e}):n.setState({isOpen:a}),null===(l=(s=n.props).onItemSelect)||void 0===l||l.call(s,e,t)},n.handlePopoverInteraction=function(e){return n.requestAnimationFrame((function(){var t,r,o=Object(i.getRef)(n.inputElement)===document.activeElement;null==n.inputElement||o||n.setState({isOpen:!1}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)}))},n.handlePopoverOpening=function(e){var t,r;n.props.resetOnClose&&n.queryList&&n.queryList.setQuery("",!0),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.getTargetKeyDownHandler=function(e){return function(t){var r,o,s,l=t.which;l===i.Keys.ESCAPE||l===i.Keys.TAB?(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.blur(),n.setState({isOpen:!1})):n.props.openOnKeyDown&&l!==i.Keys.BACKSPACE&&l!==i.Keys.ARROW_LEFT&&l!==i.Keys.ARROW_RIGHT&&n.setState({isOpen:!0}),n.state.isOpen&&(null==e||e(t)),null===(s=null===(o=n.props.inputProps)||void 0===o?void 0:o.onKeyDown)||void 0===s||s.call(o,t)}},n.getTargetKeyUpHandler=function(e){return function(t){var r,i;n.state.isOpen&&(null==e||e(t)),null===(i=null===(r=n.props.inputProps)||void 0===r?void 0:r.onKeyUp)||void 0===i||i.call(r,t)}},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e,t=this.props,n=(t.disabled,t.inputProps,t.popoverProps,Object(I.__rest)(t,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},n,{initialActiveItem:null!==(e=this.props.selectedItem)&&void 0!==e?e:void 0,onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){var n,r,o=this;void 0!==this.props.selectedItem&&this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem}),!1===this.state.isOpen&&!0===t.isOpen&&setTimeout((function(){o.maybeResetActiveItemToSelectedItem()}),null!==(r=null===(n=this.props.popoverProps)||void 0===n?void 0:n.transitionDuration)&&void 0!==r?r:i.Popover.defaultProps.transitionDuration),this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.getInitialSelectedItem=function(){return void 0!==this.props.selectedItem?this.props.selectedItem:void 0!==this.props.defaultSelectedItem?this.props.defaultSelectedItem:null},t.prototype.maybeResetActiveItemToSelectedItem=function(){var e,t=void 0===this.props.activeItem&&null!==this.state.selectedItem&&!this.props.resetOnSelect;null!==this.queryList&&t&&this.queryList.setActiveItem(null!==(e=this.props.selectedItem)&&void 0!==e?e:this.state.selectedItem)},t.displayName=i.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,fill:!1,openOnKeyDown:!1,resetOnClose:!1},t}(i.AbstractPureComponent2)}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["@blueprintjs/core","tslib","react","classnames"],t):"object"==typeof exports?exports.Select=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Select=t(e.Blueprint.Core,e.window,e.React,e.classNames))}(window,(function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},,,function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return r})),n.d(t,"renderFilteredItems",(function(){return v})),n.d(t,"executeItemsEqual",(function(){return m})),n.d(t,"getCreateNewItem",(function(){return h})),n.d(t,"isCreateNewItem",(function(){return f})),n.d(t,"getActiveItem",(function(){return y})),n.d(t,"Omnibar",(function(){return L})),n.d(t,"QueryList",(function(){return C})),n.d(t,"getFirstEnabledItem",(function(){return T})),n.d(t,"MultiSelect",(function(){return A})),n.d(t,"Select",(function(){return S})),n.d(t,"Suggest",(function(){return K}));var r={};n.r(r),n.d(r,"MULTISELECT",(function(){return s})),n.d(r,"MULTISELECT_POPOVER",(function(){return l})),n.d(r,"MULTISELECT_TAG_INPUT_INPUT",(function(){return a})),n.d(r,"OMNIBAR",(function(){return u})),n.d(r,"OMNIBAR_OVERLAY",(function(){return p})),n.d(r,"SELECT",(function(){return c})),n.d(r,"SELECT_POPOVER",(function(){return d}));var i=n(0),o=i.Classes.getClassNamespace(),s=o+"-multi-select",l=s+"-popover",a=s+"-tag-input-input",u=o+"-omnibar",p=u+"-overlay",c=o+"-select",d=c+"-popover";function v(e,t,n){if(0===e.query.length&&void 0!==n)return n;var r=e.filteredItems.map(e.renderItem).filter((function(e){return null!=e}));return r.length>0?r:t}function m(e,t,n){return void 0===e||null==t||null==n?t===n:i.Utils.isFunction(e)?e(t,n):t[e]===n[e]}function h(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function f(e){if(null==e)return!1;var t=Object.keys(e);return 1===t.length&&"__blueprintCreateNewItemBrand"===t[0]&&"blueprint-create-new-item"===e.__blueprintCreateNewItemBrand}function y(e){return null==e||f(e)?null:e}var I=n(1),O=n(3),P=n.n(O),g=n(2),C=function(e){function t(t,n){var r,o,s=e.call(this,t,n)||this;s.refHandlers={itemsParent:function(e){return s.itemsParentRef=e}},s.shouldCheckActiveItemInViewport=!1,s.expectedNextActiveItem=null,s.isEnterKeyPressed=!1,s.renderItemList=function(e){var t=s.props,n=t.initialContent,r=t.noResults,o=e.renderCreateItem(),l=v(e,null!=o?null:r,n);if(null==l&&null==o)return null;var a=s.isCreateItemFirst();return g.createElement(i.Menu,{ulRef:e.itemsParentRef},a&&o,l,!a&&o)},s.renderItem=function(e,t){if(!0!==s.props.disabled){var n=s.state,r=n.activeItem,i=n.query,o=s.state.filteredItems.indexOf(e)>=0,l={active:m(s.props.itemsEqual,y(r),e),disabled:R(e,t,s.props.itemDisabled),matchesPredicate:o};return s.props.itemRenderer(e,{handleClick:function(t){return s.handleItemSelect(e,t)},index:t,modifiers:l,query:i})}return null},s.renderCreateItemMenuItem=function(){if(s.isCreateItemRendered()){var e=s.state,t=e.activeItem,n=e.query.trim(),r=f(t);return s.props.createNewItemRenderer(n,r,(function(e){s.handleItemCreate(n,e)}))}return null},s.handleItemCreate=function(e,t){var n,r,i,o,l=null===(r=(n=s.props).createNewItemFromQuery)||void 0===r?void 0:r.call(n,e);null!=l&&(null===(o=(i=s.props).onItemSelect)||void 0===o||o.call(i,l,t),s.maybeResetQuery())},s.handleItemSelect=function(e,t){var n,r;s.setActiveItem(e),null===(r=(n=s.props).onItemSelect)||void 0===r||r.call(n,e,t),s.maybeResetQuery()},s.handlePaste=function(e){for(var t,n=s.props,r=n.createNewItemFromQuery,i=n.onItemsPaste,o=[],l=[],a=0,u=e;a<u.length;a++){var p=u[a],c=_(p,s.props);if(void 0!==c)t=c,l.push(c);else if(s.canCreateItems()){var d=null==r?void 0:r(p);void 0!==d&&l.push(d)}else o.push(p)}s.setQuery(o.join(", "),!1),void 0!==t&&s.setActiveItem(t),null==i||i(l)},s.handleKeyDown=function(e){var t,n,r=e.keyCode;if(r===i.Keys.ARROW_UP||r===i.Keys.ARROW_DOWN){e.preventDefault();var o=s.getNextActiveItem(r===i.Keys.ARROW_UP?-1:1);null!=o&&s.setActiveItem(o)}else r===i.Keys.ENTER&&(s.isEnterKeyPressed=!0);null===(n=(t=s.props).onKeyDown)||void 0===n||n.call(t,e)},s.handleKeyUp=function(e){var t=s.props.onKeyUp,n=s.state.activeItem;e.keyCode===i.Keys.ENTER&&s.isEnterKeyPressed&&(e.preventDefault(),null==n||f(n)?s.handleItemCreate(s.state.query,e):s.handleItemSelect(n,e),s.isEnterKeyPressed=!1),null==t||t(e)},s.handleInputQueryChange=function(e){var t,n,r=null==e?"":e.target.value;s.setQuery(r),null===(n=(t=s.props).onQueryChange)||void 0===n||n.call(t,r,e)};var l=t.query,a=void 0===l?"":l,u=null===(r=t.createNewItemFromQuery)||void 0===r?void 0:r.call(t,a),p=b(a,t);return s.state={activeItem:void 0!==t.activeItem?t.activeItem:null!==(o=t.initialActiveItem)&&void 0!==o?o:T(p,t.itemDisabled),createNewItem:u,filteredItems:p,query:a},s}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=e.className,n=e.items,r=e.renderer,i=e.itemListRenderer,o=void 0===i?this.renderItemList:i,s=this.state,l=(s.createNewItem,Object(I.__rest)(s,["createNewItem"]));return r(Object(I.__assign)(Object(I.__assign)({},l),{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handlePaste:this.handlePaste,handleQueryChange:this.handleInputQueryChange,itemList:o(Object(I.__assign)(Object(I.__assign)({},l),{items:n,itemsParentRef:this.refHandlers.itemsParent,renderCreateItem:this.renderCreateItemMenuItem,renderItem:this.renderItem}))}))},t.prototype.componentDidUpdate=function(e){var t=this;void 0!==this.props.activeItem&&this.props.activeItem!==this.state.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:this.props.activeItem})),null!=this.props.query&&this.props.query!==e.query?this.setQuery(this.props.query,this.props.resetOnQuery,this.props):i.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(this.requestAnimationFrame((function(){return t.scrollActiveItemIntoView()})),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,y(this.expectedNextActiveItem),y(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,i=n.offsetHeight,o=this.itemsParentRef,s=o.offsetTop,l=o.scrollTop,a=o.clientHeight,u=this.getItemsParentPadding(),p=u.paddingTop,c=r+i+u.paddingBottom-s,d=r-p-s;c>=l+a?this.itemsParentRef.scrollTop=c+i-a:d<=l&&(this.itemsParentRef.scrollTop=d-i)}}},t.prototype.setQuery=function(e,t,n){var r;void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var i=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0,e!==this.state.query&&(null===(r=n.onQueryChange)||void 0===r||r.call(n,e));var o=e.trim(),s=b(o,n),l=null!=i&&""!==o?i(o):void 0;this.setState({createNewItem:l,filteredItems:s,query:e});var a=this.getActiveIndex(s);(t||a<0||R(y(this.state.activeItem),a,n.itemDisabled))&&(this.isCreateItemRendered()&&this.isCreateItemFirst()?this.setActiveItem({__blueprintCreateNewItemBrand:"blueprint-create-new-item"}):this.setActiveItem(T(s,n.itemDisabled)))},t.prototype.setActiveItem=function(e){var t,n,r,i;this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),f(e)?null===(n=(t=this.props).onActiveItemChange)||void 0===n||n.call(t,null,!0):null===(i=(r=this.props).onActiveItemChange)||void 0===i||i.call(r,e,!1)},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(f(e)){var t=this.isCreateItemFirst()?0:this.state.filteredItems.length;return this.itemsParentRef.children.item(t)}var n=this.getActiveIndex();return this.itemsParentRef.children.item(n)}},t.prototype.getActiveIndex=function(e){void 0===e&&(e=this.state.filteredItems);var t=this.state.activeItem;if(null==t||f(t))return-1;for(var n=0;n<e.length;++n)if(m(this.props.itemsEqual,e[n],t))return n;return-1},t.prototype.getItemsParentPadding=function(){var e=getComputedStyle(this.itemsParentRef),t=e.paddingTop;return{paddingBottom:E(e.paddingBottom),paddingTop:E(t)}},t.prototype.getNextActiveItem=function(e,t){if((void 0===t&&(t=this.getActiveIndex()),this.isCreateItemRendered())&&(0===t&&-1===e||t===this.state.filteredItems.length-1&&1===e))return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"};return T(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},t.prototype.isCreateItemFirst=function(){return"first"===this.props.createNewItemPosition},t.prototype.canCreateItems=function(){return null!=this.props.createNewItemFromQuery&&null!=this.props.createNewItemRenderer},t.prototype.wouldCreatedItemMatchSomeExistingItem=function(){var e=this;return this.state.filteredItems.some((function(t){return m(e.props.itemsEqual,t,e.state.createNewItem)}))},t.prototype.maybeResetQuery=function(){this.props.resetOnSelect&&this.setQuery("",!0)},t.displayName=i.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={disabled:!1,resetOnQuery:!0},t}(i.AbstractComponent2);function E(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate;if(i.Utils.isFunction(r))for(var o=0;o<n.length;o++){var s=n[o];if(r(e,s,o,!0))return s}}function b(e,t){var n=t.items,r=t.itemPredicate,o=t.itemListPredicate;return i.Utils.isFunction(o)?o(e,n):i.Utils.isFunction(r)?n.filter((function(t,n){return r(e,t,n)})):n}function R(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function T(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=e.length-1),0===e.length)return null;var i,o,s,l=r,a=e.length-1;do{if(s=a,!R(e[l=(i=l+n)<(o=0)?s:i>s?o:i],l,t))return e[l]}while(l!==r&&-1!==r);return null}var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=C.ofType(),t.renderQueryList=function(e){var n=t.props,o=n.inputProps,s=void 0===o?{}:o,l=n.isOpen,a=n.overlayProps,u=void 0===a?{}:a,p=e.handleKeyDown,c=e.handleKeyUp,d=l?{onKeyDown:p,onKeyUp:c}:{};return g.createElement(i.Overlay,Object(I.__assign)({hasBackdrop:!0},u,{isOpen:l,className:P()(r.OMNIBAR_OVERLAY,u.className),onClose:t.handleOverlayClose}),g.createElement("div",Object(I.__assign)({className:P()(r.OMNIBAR,e.className)},d),g.createElement(i.InputGroup,Object(I.__assign)({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){var n,r,i,o;null===(r=null===(n=t.props.overlayProps)||void 0===n?void 0:n.onClose)||void 0===r||r.call(n,e),null===(o=(i=t.props).onClose)||void 0===o||o.call(i,e)},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["isOpen","inputProps","overlayProps"])),n="initialContent"in this.props?this.props.initialContent:null;return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{initialContent:n,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".Omnibar",t}(g.PureComponent),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:t.props.popoverProps&&t.props.popoverProps.isOpen||!1},t.TypedQueryList=C.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){var n,r;t.input=e,null===(r=null===(n=t.props.tagInputProps)||void 0===n?void 0:n.inputRef)||void 0===r||r.call(n,e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n,o=t.props,s=o.fill,l=o.tagInputProps,a=void 0===l?{}:l,u=o.popoverProps,p=void 0===u?{}:u,c=o.selectedItems,d=void 0===c?[]:c,v=o.placeholder,m=e.handlePaste,h=e.handleKeyDown,f=e.handleKeyUp;s&&(p.fill=!0,a.fill=!0);var y=Object(I.__assign)(Object(I.__assign)({},a.inputProps),{className:P()(null===(n=a.inputProps)||void 0===n?void 0:n.className,r.MULTISELECT_TAG_INPUT_INPUT)});return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:i.Position.BOTTOM_LEFT},p,{className:P()(e.className,p.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,p.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTagInputKeyDownHandler(h),onKeyUp:t.getTagInputKeyUpHandler(f)},g.createElement(i.TagInput,Object(I.__assign)({placeholder:v},a,{className:P()(r.MULTISELECT,a.className),inputRef:t.refHandlers.input,inputProps:y,inputValue:e.query,onAdd:function(e,t){"paste"===t&&m(e)},onInputChange:e.handleQueryChange,onRemove:t.handleTagRemove,values:d.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:h,onKeyUp:f},e.itemList))},t.handleItemSelect=function(e,n){var r,i;null!=t.input&&t.input.focus(),null===(i=(r=t.props).onItemSelect)||void 0===i||i.call(r,e,n)},t.handleQueryChange=function(e,n){var r,i;t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),null===(i=(r=t.props).onQueryChange)||void 0===i||i.call(r,e,n)},t.handlePopoverInteraction=function(e){return t.requestAnimationFrame((function(){var n,r,i=t.input===document.activeElement;null==t.input||i?t.props.openOnKeyDown||t.setState({isOpen:!0}):t.setState({isOpen:!1}),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onInteraction)||void 0===r||r.call(n,e)}))},t.handlePopoverOpened=function(e){var n,r;null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onOpened)||void 0===r||r.call(n,e)},t.handleTagRemove=function(e,n){var r,i=t.props,o=i.selectedItems,s=void 0===o?[]:o,l=i.onRemove,a=i.tagInputProps;null==l||l(s[n],n),null===(r=null==a?void 0:a.onRemove)||void 0===r||r.call(a,e,n)},t.getTagInputKeyDownHandler=function(e){return function(n){var r=n.which;r===i.Keys.ESCAPE||r===i.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==i.Keys.BACKSPACE&&r!==i.Keys.ARROW_LEFT&&r!==i.Keys.ARROW_RIGHT&&t.setState({isOpen:!0});var o=null!=n.target.closest("."+i.Classes.TAG_REMOVE);t.state.isOpen&&!o&&(null==e||e(n))}},t.getTagInputKeyUpHandler=function(e){return function(n){var i=n.target.classList.contains(r.MULTISELECT_TAG_INPUT_INPUT);t.state.isOpen&&i&&(null==e||e(n))}},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,Object(I.__rest)(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={fill:!1,placeholder:"Search..."},t}(i.AbstractPureComponent2),S=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:!1},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.filterable,s=void 0===o||o,l=t.disabled,a=void 0!==l&&l,u=t.inputProps,p=void 0===u?{}:u,c=t.popoverProps,d=void 0===c?{}:c,v=g.createElement(i.InputGroup,Object(I.__assign)({leftIcon:"search",placeholder:"Filter...",rightElement:n.maybeRenderClearButton(e.query)},p,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,value:e.query})),m=e.handleKeyDown,h=e.handleKeyUp;return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:n.state.isOpen,disabled:a,position:i.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened,onClosing:n.handlePopoverClosing}),g.createElement("div",{onKeyDown:n.state.isOpen?m:n.handleTargetKeyDown,onKeyUp:n.state.isOpen?h:void 0},n.props.children),g.createElement("div",{onKeyDown:m,onKeyUp:h},s?v:void 0,e.itemList))},n.handleTargetKeyDown=function(e){e.which!==i.Keys.ARROW_UP&&e.which!==i.Keys.ARROW_DOWN||(e.preventDefault(),n.setState({isOpen:!0}))},n.handleItemSelect=function(e,t){var r,i;n.setState({isOpen:!1}),null===(i=(r=n.props).onItemSelect)||void 0===i||i.call(r,e,t)},n.handlePopoverInteraction=function(e){var t,r;n.setState({isOpen:e}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)},n.handlePopoverOpening=function(e){var t,r;n.previousFocusedElement=document.activeElement,n.props.resetOnClose&&n.resetQuery(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),n.requestAnimationFrame((function(){var e,t=n.props.inputProps;!1!==(void 0===t?{}:t).autoFocus&&(null===(e=Object(i.getRef)(n.inputElement))||void 0===e||e.focus())})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.handlePopoverClosing=function(e){var t,r;n.requestAnimationFrame((function(){void 0!==n.previousFocusedElement&&(n.previousFocusedElement.focus(),n.previousFocusedElement=void 0)})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onClosing)||void 0===r||r.call(t,e)},n.resetQuery=function(){return n.queryList&&n.queryList.setQuery("",!0)},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,Object(I.__rest)(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.maybeRenderClearButton=function(e){return e.length>0?g.createElement(i.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=i.DISPLAYNAME_PREFIX+".Select",t}(i.AbstractPureComponent2),K=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:null!=n.props.popoverProps&&n.props.popoverProps.isOpen||!1,selectedItem:n.getInitialSelectedItem()},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.fill,s=t.inputProps,l=void 0===s?{}:s,a=t.popoverProps,u=void 0===a?{}:a,p=n.state,c=p.isOpen,d=p.selectedItem,v=e.handleKeyDown,m=e.handleKeyUp,h=l.autoComplete,f=void 0===h?"off":h,y=l.placeholder,O=void 0===y?"Search...":y,C=d?n.props.inputValueRenderer(d):"",E=c&&C?C:O,_=c?e.query:C||(n.props.resetOnClose?"":e.query);return o&&(u.fill=!0,l.fill=!0),g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:c,position:i.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,u.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened}),g.createElement(i.InputGroup,Object(I.__assign)({autoComplete:f,disabled:n.props.disabled},l,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,onFocus:n.handleInputFocus,onKeyDown:n.getTargetKeyDownHandler(v),onKeyUp:n.getTargetKeyUpHandler(m),placeholder:E,value:_})),g.createElement("div",{onKeyDown:v,onKeyUp:m},e.itemList))},n.selectText=function(){n.requestAnimationFrame((function(){var e=Object(i.getRef)(n.inputElement);null==e||e.setSelectionRange(0,e.value.length)}))},n.handleInputFocus=function(e){var t,r;n.selectText(),n.props.openOnKeyDown||n.setState({isOpen:!0}),null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.onFocus)||void 0===r||r.call(t,e)},n.handleItemSelect=function(e,t){var r,o,s,l,a;n.props.closeOnSelect?(null===(o=Object(i.getRef)(n.inputElement))||void 0===o||o.blur(),a=!1):(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.focus(),n.selectText(),a=!0),void 0===n.props.selectedItem?n.setState({isOpen:a,selectedItem:e}):n.setState({isOpen:a}),null===(l=(s=n.props).onItemSelect)||void 0===l||l.call(s,e,t)},n.handlePopoverInteraction=function(e){return n.requestAnimationFrame((function(){var t,r,o=Object(i.getRef)(n.inputElement)===document.activeElement;null==n.inputElement||o||n.setState({isOpen:!1}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)}))},n.handlePopoverOpening=function(e){var t,r;n.props.resetOnClose&&n.queryList&&n.queryList.setQuery("",!0),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.getTargetKeyDownHandler=function(e){return function(t){var r,o,s,l=t.which;l===i.Keys.ESCAPE||l===i.Keys.TAB?(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.blur(),n.setState({isOpen:!1})):n.props.openOnKeyDown&&l!==i.Keys.BACKSPACE&&l!==i.Keys.ARROW_LEFT&&l!==i.Keys.ARROW_RIGHT&&n.setState({isOpen:!0}),n.state.isOpen&&(null==e||e(t)),null===(s=null===(o=n.props.inputProps)||void 0===o?void 0:o.onKeyDown)||void 0===s||s.call(o,t)}},n.getTargetKeyUpHandler=function(e){return function(t){var r,i;n.state.isOpen&&(null==e||e(t)),null===(i=null===(r=n.props.inputProps)||void 0===r?void 0:r.onKeyUp)||void 0===i||i.call(r,t)}},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e,t=this.props,n=(t.disabled,t.inputProps,t.popoverProps,Object(I.__rest)(t,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},n,{initialActiveItem:null!==(e=this.props.selectedItem)&&void 0!==e?e:void 0,onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){var n,r,o=this;if(void 0!==this.props.selectedItem&&this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem}),!1===this.state.isOpen&&!0===t.isOpen){var s=null!==(r=null===(n=this.props.popoverProps)||void 0===n?void 0:n.transitionDuration)&&void 0!==r?r:i.Popover.defaultProps.transitionDuration;setTimeout((function(){return o.maybeResetActiveItemToSelectedItem()}),s)}this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.getInitialSelectedItem=function(){return void 0!==this.props.selectedItem?this.props.selectedItem:void 0!==this.props.defaultSelectedItem?this.props.defaultSelectedItem:null},t.prototype.maybeResetActiveItemToSelectedItem=function(){var e,t=void 0===this.props.activeItem&&null!==this.state.selectedItem&&!this.props.resetOnSelect;null!==this.queryList&&t&&this.queryList.setActiveItem(null!==(e=this.props.selectedItem)&&void 0!==e?e:this.state.selectedItem)},t.displayName=i.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,fill:!1,openOnKeyDown:!1,resetOnClose:!1},t}(i.AbstractPureComponent2)}])})); |
@@ -57,3 +57,5 @@ "use strict"; | ||
}; | ||
return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), interactionKind: core_1.PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), interactionKind: core_1.PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }), | ||
React.createElement("div", { onKeyDown: _this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: _this.getTagInputKeyUpHandler(handleKeyUp) }, | ||
@@ -60,0 +62,0 @@ React.createElement(core_1.TagInput, tslib_1.__assign({ placeholder: placeholder }, tagInputProps, { className: classnames_1.default(common_1.Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, |
@@ -41,3 +41,5 @@ "use strict"; | ||
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp; | ||
return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }), | ||
React.createElement("div", { onKeyDown: _this.state.isOpen ? handleKeyDown : _this.handleTargetKeyDown, onKeyUp: _this.state.isOpen ? handleKeyUp : undefined }, _this.props.children), | ||
@@ -44,0 +46,0 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, |
@@ -56,3 +56,5 @@ "use strict"; | ||
} | ||
return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), interactionKind: core_1.PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), interactionKind: core_1.PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }), | ||
React.createElement(core_1.InputGroup, tslib_1.__assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })), | ||
@@ -184,5 +186,5 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList))); | ||
// wait until the transition ends so there isn't a flash of content in the popover | ||
setTimeout(function () { | ||
_this.maybeResetActiveItemToSelectedItem(); | ||
}, (_b = (_a = this.props.popoverProps) === null || _a === void 0 ? void 0 : _a.transitionDuration) !== null && _b !== void 0 ? _b : core_1.Popover.defaultProps.transitionDuration); | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
var timeout = (_b = (_a = this.props.popoverProps) === null || _a === void 0 ? void 0 : _a.transitionDuration) !== null && _b !== void 0 ? _b : core_1.Popover.defaultProps.transitionDuration; | ||
setTimeout(function () { return _this.maybeResetActiveItemToSelectedItem(); }, timeout); | ||
} | ||
@@ -189,0 +191,0 @@ if (this.state.isOpen && !prevState.isOpen && this.queryList != null) { |
@@ -54,3 +54,5 @@ /* | ||
}; | ||
return (React.createElement(Popover, __assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, __assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }), | ||
React.createElement("div", { onKeyDown: _this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: _this.getTagInputKeyUpHandler(handleKeyUp) }, | ||
@@ -57,0 +59,0 @@ React.createElement(TagInput, __assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, |
@@ -38,3 +38,5 @@ /* | ||
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp; | ||
return (React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }), | ||
React.createElement("div", { onKeyDown: _this.state.isOpen ? handleKeyDown : _this.handleTargetKeyDown, onKeyUp: _this.state.isOpen ? handleKeyUp : undefined }, _this.props.children), | ||
@@ -41,0 +43,0 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, |
@@ -53,3 +53,5 @@ /* | ||
} | ||
return (React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }), | ||
React.createElement(InputGroup, __assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })), | ||
@@ -181,5 +183,5 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList))); | ||
// wait until the transition ends so there isn't a flash of content in the popover | ||
setTimeout(function () { | ||
_this.maybeResetActiveItemToSelectedItem(); | ||
}, (_b = (_a = this.props.popoverProps) === null || _a === void 0 ? void 0 : _a.transitionDuration) !== null && _b !== void 0 ? _b : Popover.defaultProps.transitionDuration); | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
var timeout = (_b = (_a = this.props.popoverProps) === null || _a === void 0 ? void 0 : _a.transitionDuration) !== null && _b !== void 0 ? _b : Popover.defaultProps.transitionDuration; | ||
setTimeout(function () { return _this.maybeResetActiveItemToSelectedItem(); }, timeout); | ||
} | ||
@@ -186,0 +188,0 @@ if (this.state.isOpen && !prevState.isOpen && this.queryList != null) { |
@@ -53,3 +53,5 @@ /* | ||
}; | ||
return (React.createElement(Popover, Object.assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, Object.assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: this.handlePopoverOpened }), | ||
React.createElement("div", { onKeyDown: this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: this.getTagInputKeyUpHandler(handleKeyUp) }, | ||
@@ -56,0 +58,0 @@ React.createElement(TagInput, Object.assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, |
@@ -35,3 +35,5 @@ /* | ||
const { handleKeyDown, handleKeyUp } = listProps; | ||
return (React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened, onClosing: this.handlePopoverClosing }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened, onClosing: this.handlePopoverClosing }), | ||
React.createElement("div", { onKeyDown: this.state.isOpen ? handleKeyDown : this.handleTargetKeyDown, onKeyUp: this.state.isOpen ? handleKeyUp : undefined }, this.props.children), | ||
@@ -38,0 +40,0 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, |
@@ -50,3 +50,5 @@ /* | ||
} | ||
return (React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened }), | ||
return ( | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened }), | ||
React.createElement(InputGroup, Object.assign({ autoComplete: autoComplete, disabled: this.props.disabled }, inputProps, { inputRef: this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: this.handleInputFocus, onKeyDown: this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })), | ||
@@ -165,5 +167,5 @@ React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList))); | ||
// wait until the transition ends so there isn't a flash of content in the popover | ||
setTimeout(() => { | ||
this.maybeResetActiveItemToSelectedItem(); | ||
}, this.props.popoverProps?.transitionDuration ?? Popover.defaultProps.transitionDuration); | ||
/* eslint-disable-next-line deprecation/deprecation */ | ||
const timeout = this.props.popoverProps?.transitionDuration ?? Popover.defaultProps.transitionDuration; | ||
setTimeout(() => this.maybeResetActiveItemToSelectedItem(), timeout); | ||
} | ||
@@ -170,0 +172,0 @@ if (this.state.isOpen && !prevState.isOpen && this.queryList != null) { |
{ | ||
"name": "@blueprintjs/select", | ||
"version": "3.15.1", | ||
"version": "3.15.2", | ||
"description": "Components related to selecting items from a list", | ||
@@ -38,3 +38,3 @@ "main": "lib/cjs/index.js", | ||
"dependencies": { | ||
"@blueprintjs/core": "^3.37.0", | ||
"@blueprintjs/core": "^3.38.0", | ||
"classnames": "^2.2", | ||
@@ -41,0 +41,0 @@ "tslib": "~1.13.0" |
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
551870
8046
Updated@blueprintjs/core@^3.38.0