????

Your IP : 3.15.34.191


Current Path : C:/inetpub/vhost/hotrochinhsach.nextform.vn/www/assets/
Upload File :
Current File : C:/inetpub/vhost/hotrochinhsach.nextform.vn/www/assets/SelectCustom-a3812854.js

import{P as c,R as O,j as y,K,r as U}from"./index-3ac6b886.js";import{t as D,m as F,_ as M}from"./utils-1da25c48.js";import{I as W}from"./Input-a404c875.js";import{S as G}from"./DataSelect-21292454.js";var H=["className","cssModule","children","toggle","tag","wrapTag","closeAriaLabel","close"];function v(){return v=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n])}return i},v.apply(this,arguments)}function Z(i,t){if(i==null)return{};var e=q(i,t),n,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(o=0;o<s.length;o++)n=s[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(e[n]=i[n])}return e}function q(i,t){if(i==null)return{};var e={},n=Object.keys(i),o,s;for(s=0;s<n.length;s++)o=n[s],!(t.indexOf(o)>=0)&&(e[o]=i[o]);return e}var z={children:c.node,className:c.string,close:c.object,closeAriaLabel:c.string,cssModule:c.object,tag:D,toggle:c.func,wrapTag:D};function J(i){var t,e=i.className,n=i.cssModule,o=i.children,s=i.toggle,r=i.tag,a=r===void 0?"h5":r,u=i.wrapTag,l=u===void 0?"div":u,f=i.closeAriaLabel,p=f===void 0?"Close":f,h=i.close,g=Z(i,H),m=F(M(e,"modal-header"),n);return!h&&s&&(t=O.createElement("button",{type:"button",onClick:s,className:F("btn-close",n),"aria-label":p})),O.createElement(l,v({},g,{className:m}),O.createElement(a,{className:F("modal-title",n)},o),h||t)}J.propTypes=z;var Q=["className","cssModule","tag"];function I(){return I=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n])}return i},I.apply(this,arguments)}function X(i,t){if(i==null)return{};var e=Y(i,t),n,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(o=0;o<s.length;o++)n=s[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(e[n]=i[n])}return e}function Y(i,t){if(i==null)return{};var e={},n=Object.keys(i),o,s;for(s=0;s<n.length;s++)o=n[s],!(t.indexOf(o)>=0)&&(e[o]=i[o]);return e}var tt={className:c.string,cssModule:c.object,tag:D};function et(i){var t=i.className,e=i.cssModule,n=i.tag,o=n===void 0?"div":n,s=X(i,Q),r=F(M(t,"modal-body"),e);return O.createElement(o,I({},s,{className:r}))}et.propTypes=tt;function b(){}function nt(){return!0}function w(i){return!!(i||"").match(/\d/)}function E(i){return i.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function ot(i){switch(i){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function rt(i,t,e){const n=ot(e);let o=i.search(/[1-9]/);return o=o===-1?i.length:o,i.substring(0,o)+i.substring(o,i.length).replace(n,"$1"+t)}function R(i,t=!0){const e=i[0]==="-",n=e&&t;i=i.replace("-","");const o=i.split("."),s=o[0],r=o[1]||"";return{beforeDecimal:s,afterDecimal:r,hasNagation:e,addNegation:n}}function st(i){if(!i)return i;const t=i[0]==="-";t&&(i=i.substring(1,i.length));const e=i.split("."),n=e[0].replace(/^0+/,"")||"0",o=e[1]||"";return`${t?"-":""}${n}${o?`.${o}`:""}`}function B(i,t,e){let n="";const o=e?"0":"";for(let s=0;s<=t-1;s++)n+=i[s]||o;return n}function it(i,t,e){if(["","-"].indexOf(i)!==-1)return i;const n=i.indexOf(".")!==-1&&t,{beforeDecimal:o,afterDecimal:s,hasNagation:r}=R(i),a=parseFloat(`0.${s||"0"}`).toFixed(t).split("."),u=o.split("").reverse().reduce((h,g,m)=>h.length>m?(Number(h[0])+Number(g)).toString()+h.substring(1,h.length):g+h,a[0]),l=B(a[1]||"",Math.min(t,s.length),e);return`${r?"-":""}${u}${n?".":""}${l}`}function at(i,t){const e={};return Object.keys(i).forEach(n=>{t[n]||(e[n]=i[n])}),e}function V(i,t){if(i!==null){if(i.createTextRange){const e=i.createTextRange();return e.move("character",t),e.select(),!0}return i.selectionStart||i.selectionStart===0?(i.focus(),i.setSelectionRange(t,t),!0):(i.focus(),!1)}}function ct(i,t){let e=0,n=0;const o=i.length,s=t.length;for(;i[e]===t[e]&&e<o;)e++;for(;i[o-1-n]===t[s-1-n]&&s-n>e&&o-n>e;)n++;return{start:e,end:o-n}}function T(i,t,e){return Math.min(Math.max(i,t),e)}function $(i){return Math.max(i.selectionStart,i.selectionEnd)}const L={thousandSeparator:c.oneOfType([c.string,c.oneOf([!0])]),decimalSeparator:c.string,thousandsGroupStyle:c.oneOf(["thousand","lakh","wan"]),decimalScale:c.number,fixedDecimalScale:c.bool,displayType:c.oneOf(["input","text"]),prefix:c.string,suffix:c.string,format:c.oneOfType([c.string,c.func]),removeFormatting:c.func,mask:c.oneOfType([c.string,c.arrayOf(c.string)]),value:c.oneOfType([c.number,c.string]),defaultValue:c.oneOfType([c.number,c.string]),isNumericString:c.bool,customInput:c.elementType,allowNegative:c.bool,allowEmptyFormatting:c.bool,allowLeadingZeros:c.bool,onValueChange:c.func,onKeyDown:c.func,onMouseUp:c.func,onChange:c.func,onFocus:c.func,onBlur:c.func,type:c.oneOf(["text","tel","password"]),isAllowed:c.func,renderText:c.func,getInputRef:c.func},lt={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:b,onChange:b,onKeyDown:b,onMouseUp:b,onFocus:b,onBlur:b,isAllowed:nt,getInputRef:b};let A=class extends O.Component{constructor(t){super(t);const{defaultValue:e}=t;this.validateProps();const n=this.formatValueProp(e);this.state={value:n,numAsString:this.removeFormatting(n)},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}componentDidUpdate(t){this.updateValueIfRequired(t)}updateValueIfRequired(t){const{props:e,state:n,focusedElm:o}=this,{value:s,numAsString:r=""}=n;if(t!==e){this.validateProps();const a=this.formatNumString(r),u=e.value===void 0?a:this.formatValueProp(),l=this.removeFormatting(u),f=parseFloat(l),p=parseFloat(r);((!isNaN(f)||!isNaN(p))&&f!==p||a!==s||o===null&&u!==s)&&this.updateValue({formattedValue:u,numAsString:l,input:o})}}getFloatString(t=""){const{decimalScale:e}=this.props,{decimalSeparator:n}=this.getSeparators(),o=this.getNumberRegex(!0),s=t[0]==="-";s&&(t=t.replace("-","")),n&&e===0&&(t=t.split(n)[0]),t=(t.match(o)||[]).join("").replace(n,".");const r=t.indexOf(".");return r!==-1&&(t=`${t.substring(0,r)}.${t.substring(r+1,t.length).replace(new RegExp(E(n),"g"),"")}`),s&&(t="-"+t),t}getNumberRegex(t,e){const{format:n,decimalScale:o}=this.props,{decimalSeparator:s}=this.getSeparators();return new RegExp("\\d"+(s&&o!==0&&!e&&!n?"|"+E(s):""),t?"g":void 0)}getSeparators(){const{decimalSeparator:t}=this.props;let{thousandSeparator:e}=this.props;return e===!0&&(e=","),{decimalSeparator:t,thousandSeparator:e}}getMaskAtIndex(t){const{mask:e=" "}=this.props;return typeof e=="string"?e:e[t]||" "}getValueObject(t,e){const n=parseFloat(e);return{formattedValue:t,value:e,floatValue:isNaN(n)?void 0:n}}validateProps(){const{mask:t}=this.props,{decimalSeparator:e,thousandSeparator:n}=this.getSeparators();if(e===n)throw new Error(`
          Decimal separator can't be same as thousand separator.
          thousandSeparator: ${n} (thousandSeparator = {true} is same as thousandSeparator = ",")
          decimalSeparator: ${e} (default value for decimalSeparator is .)
       `);if(t&&(t==="string"?t:t.toString()).match(/\d/g))throw new Error(`
          Mask ${t} should not contain numeric character;
        `)}setPatchedCaretPosition(t,e,n){V(t,e),setTimeout(()=>{t.value===n&&V(t,e)},0)}correctCaretPosition(t,e,n){const{prefix:o,suffix:s,format:r}=this.props;if(t==="")return 0;if(e=T(e,0,t.length),!r){const g=t[0]==="-";return T(e,o.length+(g?1:0),t.length-s.length)}if(typeof r=="function"||r[e]==="#"&&w(t[e])||r[e-1]==="#"&&w(t[e-1]))return e;const a=r.indexOf("#"),u=r.lastIndexOf("#");e=T(e,a,u+1);const l=r.substring(e,r.length).indexOf("#");let f=e;const p=e+(l===-1?0:l);for(;f>a&&(r[f]!=="#"||!w(t[f]));)f-=1;return!w(t[p])||n==="left"&&e!==a||e-f<p-e?w(t[f])?f+1:f:p}getCaretPosition(t,e,n){const{format:o}=this.props,s=this.state.value,r=this.getNumberRegex(!0),a=(t.match(r)||[]).join(""),u=(e.match(r)||[]).join("");let l,f;for(l=0,f=0;f<n;f++){const p=t[f]||"",h=e[l]||"";if(!(!p.match(r)&&p!==h)&&!(p==="0"&&h.match(r)&&h!=="0"&&a.length!==u.length)){for(;p!==e[l]&&l<e.length;)l++;l++}}return typeof o=="string"&&!s&&(l=e.length),l=this.correctCaretPosition(e,l),l}removePrefixAndSuffix(t){const{format:e,prefix:n,suffix:o}=this.props;if(!e&&t){const s=t[0]==="-";s&&(t=t.substring(1,t.length)),t=n&&t.indexOf(n)===0?t.substring(n.length,t.length):t;const r=t.lastIndexOf(o);t=o&&r!==-1&&r===t.length-o.length?t.substring(0,r):t,s&&(t="-"+t)}return t}removePatternFormatting(t){const{format:e}=this.props,n=e.split("#").filter(r=>r!=="");let o=0,s="";for(let r=0,a=n.length;r<=a;r++){const u=n[r]||"",l=r===a?t.length:t.indexOf(u,o);if(l===-1){s=t;break}else s+=t.substring(o,l),o=l+u.length}return(s.match(/\d/g)||[]).join("")}removeFormatting(t){const{format:e,removeFormatting:n}=this.props;return t&&(e?typeof e=="string"?t=this.removePatternFormatting(t):typeof n=="function"?t=n(t):t=(t.match(/\d/g)||[]).join(""):(t=this.removePrefixAndSuffix(t),t=this.getFloatString(t)),t)}formatWithPattern(t){const{format:e}=this.props;let n=0;const o=e.split("");for(let s=0,r=e.length;s<r;s++)e[s]==="#"&&(o[s]=t[n]||this.getMaskAtIndex(n),n+=1);return o.join("")}formatAsNumber(t){const{decimalScale:e,fixedDecimalScale:n,prefix:o,suffix:s,allowNegative:r,thousandsGroupStyle:a}=this.props,{thousandSeparator:u,decimalSeparator:l}=this.getSeparators(),f=t.indexOf(".")!==-1||e&&n;let{beforeDecimal:p,afterDecimal:h,addNegation:g}=R(t,r);return e!==void 0&&(h=B(h,e,n)),u&&(p=rt(p,u,a)),o&&(p=o+p),s&&(h=h+s),g&&(p="-"+p),t=p+(f&&l||"")+h,t}formatNumString(t=""){const{format:e,allowEmptyFormatting:n}=this.props;let o=t;return t===""&&!n?o="":t==="-"&&!e?o="-":typeof e=="string"?o=this.formatWithPattern(o):typeof e=="function"?o=e(o):o=this.formatAsNumber(o),o}formatValueProp(t){const{format:e,decimalScale:n,fixedDecimalScale:o,allowEmptyFormatting:s}=this.props;let{value:r=t,isNumericString:a}=this.props;const u=!r&&r!==0;return u&&s&&(r=""),u&&!s?"":(typeof r=="number"&&(r=r.toString(),a=!0),r==="Infinity"&&a&&(r=""),a&&!e&&typeof n=="number"&&(r=it(r,n,o)),a?this.formatNumString(r):this.formatInput(r))}formatNegation(t=""){const{allowNegative:e}=this.props,n=new RegExp("(-)"),o=new RegExp("(-)(.)*(-)"),s=n.test(t),r=o.test(t);return t=t.replace(/-/g,""),s&&!r&&e&&(t="-"+t),t}formatInput(t=""){const{format:e}=this.props;return e||(t=this.removePrefixAndSuffix(t),t=this.formatNegation(t)),t=this.removeFormatting(t),this.formatNumString(t)}isCharacterAFormat(t,e){const{format:n,prefix:o,suffix:s,decimalScale:r,fixedDecimalScale:a}=this.props,{decimalSeparator:u}=this.getSeparators();return!!(typeof n=="string"&&n[t]!=="#"||!n&&(t<o.length||t>=e.length-s.length||r&&a&&e[t]===u))}checkIfFormatGotDeleted(t,e,n){for(let o=t;o<e;o++)if(this.isCharacterAFormat(o,n))return!0;return!1}correctInputValue(t,e,n){const{format:o,allowNegative:s,prefix:r,suffix:a}=this.props,{decimalSeparator:u}=this.getSeparators(),l=this.state.numAsString||"",{selectionStart:f,selectionEnd:p}=this.selectionBeforeInput,{start:h,end:g}=ct(e,n);if(!o&&u!=="."&&h===g&&n[f]===".")return n.substr(0,f)+u+n.substr(f+1,n.length);const m=o?0:r.length,x=e.length-(o?0:a.length);if(n.length>e.length||!n.length||h===g||f===0&&p===e.length||f===m&&p===x)return n;if(this.checkIfFormatGotDeleted(h,g,e)&&(n=e),!o){const S=this.removeFormatting(n);let{beforeDecimal:C,afterDecimal:d,addNegation:N}=R(S,s);const P=t<n.indexOf(u)+1;if(S.length<l.length&&P&&C===""&&!parseFloat(d))return N?"-":""}return n}updateValue(t,e){const{formattedValue:n,input:o}=t;let{numAsString:s,caretPos:r}=t;const{onValueChange:a}=this.props,{value:u}=this.state;if(o){if(!r){const l=t.inputValue||o.value,f=$(o);r=this.getCaretPosition(l,n,f)}o.value=n,this.setPatchedCaretPosition(o,r,n)}s===void 0&&(s=this.removeFormatting(n)),n!==u&&this.setState({value:n,numAsString:s},()=>{a(this.getValueObject(n,s))})}onChange(t){t.persist();const e=t.target;let n=e.value;const{state:o,props:s}=this,{isAllowed:r}=s,a=o.value||"",u=$(e);n=this.correctInputValue(u,a,n);let l=this.formatInput(n)||"";const f=this.removeFormatting(l),p=this.getValueObject(l,f);r(p)||(l=a),this.updateValue({formattedValue:l,numAsString:f,inputValue:n,input:e},()=>{s.onChange(t)})}onBlur(t){const{props:e,state:n}=this,{format:o,onBlur:s,allowLeadingZeros:r}=e;let{numAsString:a}=n;const u=n.value;if(this.focusedElm=null,!o){r||(a=st(a));const l=this.formatNumString(a);if(l!==u){t.persist(),this.updateValue({formattedValue:l,numAsString:a},()=>{s(a)});return}}s(a)}onKeyDown(t){const e=t.target,{key:n}=t,{selectionStart:o,selectionEnd:s,value:r=""}=e;let a;const{decimalScale:u,fixedDecimalScale:l,prefix:f,suffix:p,format:h,onKeyDown:g}=this.props,m=u!==void 0&&l,x=this.getNumberRegex(!1,m),S=new RegExp("-"),C=typeof h=="string";if(this.selectionBeforeInput={selectionStart:o,selectionEnd:s},n==="ArrowLeft"||n==="Backspace"?a=o-1:n==="ArrowRight"?a=o+1:n==="Delete"&&(a=o),a===void 0||o!==s){g(t);return}let d=a;const N=C?h.indexOf("#"):f.length,P=C?h.lastIndexOf("#")+1:r.length-p.length;if(n==="ArrowLeft"||n==="ArrowRight"){const j=n==="ArrowLeft"?"left":"right";d=this.correctCaretPosition(r,a,j)}else if(n==="Delete"&&!x.test(r[a])&&!S.test(r[a]))for(;!x.test(r[d])&&d<P;)d++;else if(n==="Backspace"&&!x.test(r[a])){if(o<=N+1&&r[0]==="-"&&typeof h>"u"){const j=r.substring(1);t.persist(),this.updateValue({formattedValue:j,caretPos:d,input:e})}else if(!S.test(r[a])){for(;!x.test(r[d-1])&&d>N;)d--;d=this.correctCaretPosition(r,d,"left")}}(d!==a||a<N||a>P)&&(t.preventDefault(),this.setPatchedCaretPosition(e,d,r)),t.isUnitTestRun&&this.setPatchedCaretPosition(e,d,r),this.props.onKeyDown(t)}onMouseUp(t){const e=t.target,{selectionStart:n,selectionEnd:o,value:s=""}=e;if(n===o){const r=this.correctCaretPosition(s,n);r!==n&&this.setPatchedCaretPosition(e,r,s)}this.props.onMouseUp(t)}onFocus(t){t.persist(),this.focusedElm=t.target,setTimeout(()=>{const e=t.target,{selectionStart:n,selectionEnd:o,value:s=""}=e,r=this.correctCaretPosition(s,n);r!==n&&!(n===0&&o===s.length)&&this.setPatchedCaretPosition(e,r,s),this.props.onFocus(t)},0)}render(){const{type:t,displayType:e,customInput:n,renderText:o,getInputRef:s}=this.props,{value:r}=this.state,a=at(this.props,L),u=Object.assign({},a,{type:t,value:r,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if(e==="text")return o?o(r)||null:y.jsx("span",{...a,ref:s,children:r});if(n){const l=n;return y.jsx(l,{...u,ref:s})}return y.jsx("input",{...u,ref:s})}};A.propTypes=L;A.defaultProps=lt;function k(i){const{isDetail:t,value:e,invalid:n,onValueChange:o,onKeyDown:s,bsSize:r="sm",style:a,onBlur:u,onFocus:l,decimalScale:f,thousandSeparator:p,decimalSeparator:h,customInput:g,...m}=i||{};return t?y.jsx("div",{style:{textAlign:"right"},children:e===0||e===null?"":K(e)}):y.jsx(A,{...m,style:{textAlign:"right",...a},value:e,thousandSeparator:".",decimalSeparator:",",onValueChange:o,onBlur:x=>u&&u(x),onKeyDown:s,onFocus:l,customInput:g||W,bsSize:r,decimalScale:f==="0"?0:f||2,invalid:n})}k.defaultProps={placeholder:"Nhâp..."};k.propTypes={placeholder:c.string};class _ extends U.Component{render(){const{value:t,onChange:e,options:n}=this.props,o=t||"";var s="value",r="label";return y.jsx(G,{value:o,onChange:e,options:n,valueRef:s,labelRef:r,placeholder:"Chọn..."})}}_.propTypes={};_.defaultProps={placeholder:"Chọn..."};export{J as M,A as N,_ as S,et as a,k as b};