????

Your IP : 3.140.250.173


Current Path : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/
Upload File :
Current File : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/Dropdown-ab2dfbba.js

import{R as l,P as u}from"./index-727ccf4d.js";import{b as I}from"./Manager-0c2f0563.js";import{t as K,k as i,o as S,m as A,_ as L}from"./Button-9330b92c.js";var x=l.createContext({}),z=l.createContext({});function P(t){"@babel/helpers - typeof";return P=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},P(t)}var F=["className","cssModule","direction","isOpen","group","size","nav","setActiveFromChild","active","tag","menuRole"];function T(){return T=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},T.apply(this,arguments)}function h(t,n,o){return n in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}function U(t,n){if(t==null)return{};var o=V(t,n),r,e;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(e=0;e<a.length;e++)r=a[e],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function V(t,n){if(t==null)return{};var o={},r=Object.keys(t),e,a;for(a=0;a<r.length;a++)e=r[a],!(n.indexOf(e)>=0)&&(o[e]=t[e]);return o}function W(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function j(t,n){for(var o=0;o<n.length;o++){var r=n[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function B(t,n,o){return n&&j(t.prototype,n),o&&j(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function G(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&D(t,n)}function D(t,n){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},D(t,n)}function q(t){var n=J();return function(){var r=C(t),e;if(n){var a=C(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return H(this,e)}}function H(t,n){if(n&&(P(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g(t)}function g(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function J(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(t){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},C(t)}var Q={a11y:u.bool,disabled:u.bool,direction:u.oneOf(["up","down","start","end","left","right"]),group:u.bool,isOpen:u.bool,nav:u.bool,active:u.bool,size:u.string,tag:K,toggle:u.func,children:u.node,className:u.string,cssModule:u.object,dropup:u.bool,inNavbar:u.bool,setActiveFromChild:u.bool,menuRole:u.oneOf(["listbox","menu"])},X={a11y:!0,isOpen:!1,direction:"down",nav:!1,active:!1,inNavbar:!1,setActiveFromChild:!1},Y=[i.space,i.enter,i.up,i.down,i.end,i.home],k=function(t){G(o,t);var n=q(o);function o(r){var e;return W(this,o),e=n.call(this,r),e.addEvents=e.addEvents.bind(g(e)),e.handleDocumentClick=e.handleDocumentClick.bind(g(e)),e.handleKeyDown=e.handleKeyDown.bind(g(e)),e.removeEvents=e.removeEvents.bind(g(e)),e.toggle=e.toggle.bind(g(e)),e.handleMenuRef=e.handleMenuRef.bind(g(e)),e.handleToggleRef=e.handleToggleRef.bind(g(e)),e.containerRef=l.createRef(),e.menuRef=l.createRef(),e.toggleRef=l.createRef(),e}return B(o,[{key:"componentDidMount",value:function(){this.handleProps()}},{key:"componentDidUpdate",value:function(e){this.props.isOpen!==e.isOpen&&this.handleProps()}},{key:"componentWillUnmount",value:function(){this.removeEvents()}},{key:"handleMenuRef",value:function(e){this.menuRef.current=e}},{key:"handleToggleRef",value:function(e){this.toggleRef.current=e}},{key:"handleDocumentClick",value:function(e){if(!(e&&(e.which===3||e.type==="keyup"&&e.which!==i.tab))){var a=this.getContainer(),s=this.getMenu(),d=this.getToggle();if(d){var v=d.contains(e.target),c=s&&s.contains(e.target)&&s!==e.target,p=!1;a&&(p=a.classList.contains("input-group")&&a.classList.contains("dropdown")&&e.target.tagName==="INPUT"),!((v&&!p||c)&&(e.type!=="keyup"||e.which===i.tab))&&this.toggle(e)}}}},{key:"handleKeyDown",value:function(e){var a=this,s=e.target.getAttribute("role")==="menuitem"||e.target.getAttribute("role")==="option",d=this.getMenuCtrl()===e.target,v=i.tab===e.which;if(!(/input|textarea/i.test(e.target.tagName)||v&&!this.props.a11y||v&&!(s||d))&&((Y.indexOf(e.which)!==-1||e.which>=48&&e.which<=90)&&e.preventDefault(),!this.props.disabled)){if(d)if([i.space,i.enter,i.up,i.down].indexOf(e.which)>-1)this.props.isOpen||this.toggle(e),setTimeout(function(){var b;return(b=a.getMenuItems()[0])===null||b===void 0?void 0:b.focus()});else if(this.props.isOpen&&v){var c;e.preventDefault(),(c=this.getMenuItems()[0])===null||c===void 0||c.focus()}else this.props.isOpen&&e.which===i.esc&&this.toggle(e);if(this.props.isOpen&&s){if([i.tab,i.esc].indexOf(e.which)>-1)this.toggle(e),this.getMenuCtrl().focus();else if([i.space,i.enter].indexOf(e.which)>-1)e.target.click(),this.getMenuCtrl().focus();else if([i.down,i.up].indexOf(e.which)>-1||[i.n,i.p].indexOf(e.which)>-1&&e.ctrlKey){var p=this.getMenuItems(),f=p.indexOf(e.target);i.up===e.which||i.p===e.which&&e.ctrlKey?f=f!==0?f-1:p.length-1:(i.down===e.which||i.n===e.which&&e.ctrlKey)&&(f=f===p.length-1?0:f+1),p[f].focus()}else if(i.end===e.which){var w=this.getMenuItems();w[w.length-1].focus()}else if(i.home===e.which){var O=this.getMenuItems();O[0].focus()}else if(e.which>=48&&e.which<=90)for(var y=this.getMenuItems(),_=String.fromCharCode(e.which).toLowerCase(),m=0;m<y.length;m+=1){var M=y[m].textContent&&y[m].textContent[0].toLowerCase();if(M===_){y[m].focus();break}}}}}},{key:"handleProps",value:function(){this.props.isOpen?this.addEvents():this.removeEvents()}},{key:"getContextValue",value:function(){return{toggle:this.toggle,isOpen:this.props.isOpen,direction:this.props.direction==="down"&&this.props.dropup?"up":this.props.direction,inNavbar:this.props.inNavbar,disabled:this.props.disabled,onMenuRef:this.handleMenuRef,onToggleRef:this.handleToggleRef,menuRole:this.props.menuRole}}},{key:"getContainer",value:function(){return this.containerRef.current}},{key:"getMenu",value:function(){return this.menuRef.current}},{key:"getToggle",value:function(){return this.toggleRef.current}},{key:"getMenuCtrl",value:function(){return this._$menuCtrl?this._$menuCtrl:(this._$menuCtrl=this.getToggle(),this._$menuCtrl)}},{key:"getItemType",value:function(){return this.props.menuRole==="listbox"?"option":"menuitem"}},{key:"getMenuItems",value:function(){var e=this.getMenu()||this.getContainer();return[].slice.call(e.querySelectorAll('[role="'.concat(this.getItemType(),'"]')))}},{key:"addEvents",value:function(){var e=this;["click","touchstart","keyup"].forEach(function(a){return document.addEventListener(a,e.handleDocumentClick,!0)})}},{key:"removeEvents",value:function(){var e=this;["click","touchstart","keyup"].forEach(function(a){return document.removeEventListener(a,e.handleDocumentClick,!0)})}},{key:"toggle",value:function(e){return this.props.disabled?e&&e.preventDefault():this.props.toggle(e)}},{key:"render",value:function(){var e,a=this,s=S(this.props,["toggle","disabled","inNavbar","a11y"]),d=s.className,v=s.cssModule,c=s.direction,p=s.isOpen,f=s.group,w=s.size,O=s.nav,y=s.setActiveFromChild,_=s.active,m=s.tag;s.menuRole;var M=U(s,F),b=m||(O?"li":"div"),E=!1;y&&l.Children.map(this.props.children[1].props.children,function(R){R&&R.props.active&&(E=!0)});var N=A(L(d,O&&_?"active":!1,y&&E?"active":!1,(e={"btn-group":f},h(e,"btn-group-".concat(w),!!w),h(e,"dropdown",!f),h(e,"dropup",c==="up"),h(e,"dropstart",c==="start"||c==="left"),h(e,"dropend",c==="end"||c==="right"),h(e,"show",p),h(e,"nav-item",O),e)),v);return this.context.insideInputGroup?l.createElement(x.Provider,{value:this.getContextValue()},l.createElement(I,null,l.Children.map(this.props.children,function(R){return l.cloneElement(R,{onKeyDown:a.handleKeyDown})}))):l.createElement(x.Provider,{value:this.getContextValue()},l.createElement(I,null,l.createElement(b,T({},M,h({},typeof b=="string"?"ref":"innerRef",this.containerRef),{onKeyDown:this.handleKeyDown,className:N}))))}}]),o}(l.Component);k.propTypes=Q;k.defaultProps=X;k.contextType=z;const te=k;export{te as D,z as I,x as a};