@daoyi/nmtl-ui 1.1.31-beta.15 → 1.1.31-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Autocomplete.js +1 -1
- package/lib/components/{ContactModal-9331fe25.js → ContactModal-5f5f97fb.js} +3 -3
- package/lib/components/ContactModal.js +1 -1
- package/lib/components/Footer.js +1 -1
- package/lib/components/Header.js +1 -1
- package/lib/components/KeywordSearch-f9ae75da.js +1 -0
- package/lib/components/KeywordSearch.js +1 -1
- package/lib/components/Modal.js +1 -1
- package/package.json +1 -1
- package/lib/components/KeywordSearch-fc762540.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as n,b as o}from"./_rollupPluginBabelHelpers-b18bba19.js";import t,{useCallback as a,useState as r,useRef as l,useMemo as u,useEffect as i}from"react";import c from"prop-types";import{c as p}from"./index-b2745105.js";import{d as s}from"./debounce-c993109b.js";import{Autocomplete as d}from"@material-ui/lab";import{Chip as f,TextField as m,CircularProgress as b}from"@material-ui/core";import{Close as g,SearchOutlined as h}from"@material-ui/icons";import y from"./Empty.js";import{s as I}from"./style-inject.es-1f59c1d0.js";I(".autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 0px 8px; }\n\n.autocomplete .MuiChip-deleteIcon {\n width: 16px;\n height: 16px; }\n\n.autocomplete__icon {\n font-size: 1.25rem;\n margin-right: 8px; }\n\n.autocomplete--showSearchIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n display: flex;\n flex-wrap: nowrap;\n padding: 4px 8px
|
|
1
|
+
import{_ as e,a as n,b as o}from"./_rollupPluginBabelHelpers-b18bba19.js";import t,{useCallback as a,useState as r,useRef as l,useMemo as u,useEffect as i}from"react";import c from"prop-types";import{c as p}from"./index-b2745105.js";import{d as s}from"./debounce-c993109b.js";import{Autocomplete as d}from"@material-ui/lab";import{Chip as f,TextField as m,CircularProgress as b}from"@material-ui/core";import{Close as g,SearchOutlined as h}from"@material-ui/icons";import y from"./Empty.js";import{s as I}from"./style-inject.es-1f59c1d0.js";I(".autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 0px 8px; }\n\n.autocomplete .MuiChip-deleteIcon {\n width: 16px;\n height: 16px; }\n\n.autocomplete__icon {\n font-size: 1.25rem;\n margin-right: 8px; }\n\n.autocomplete--showSearchIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n display: flex;\n flex-wrap: nowrap;\n padding: 4px 8px; }\n");var v=function(c){var I=c.options,v=c.defaultValue,A=c.renderAfterDefaultValueChange,V=c.filterable,x=c.loading,C=c.labelInValue,T=c.disabled,E=c.className,O=c.multiple,_=c.freeTyping,j=c.placeholder,w=c.searchIcon,F=c.renderInput,N=c.renderTags,S=c.onChange,B=c.onSearch,M=c.onFocus,P=c.onBlur,D=r(!0),R=n(D,2),L=R[0],z=R[1],H=r(),k=n(H,2),q=k[0],G=k[1],J=r(),K=n(J,2),Q=K[0],U=K[1],W=(({options:n,placeholder:o,loading:r,searchIcon:l,labelInValue:u})=>{const i=a((e=>"object"==typeof e?e.value:e),[]),c=a((e=>{const o=(Array.isArray(n)?n:[]).find((n=>i(n)===i(e)));return o?"object"==typeof o?o.label:o:"object"==typeof e?e.label:e}),[n]),p=a((e=>{if(Array.isArray(n)){if(Array.isArray(e))return e.map((e=>n.find((({value:n})=>e===n||e.value===n))||e));const o=n.find((({value:n})=>e===n));return u?e:o||{label:e,value:e}}return e}),[n,u]),s=a(((n,o)=>n.map(((n,a)=>t.createElement(f,e({label:c(n),deleteIcon:t.createElement(g,null)},o({index:a})))))),[n]),d=a((n=>t.createElement(m,e({},n,{variant:"outlined",placeholder:o,InputProps:{...n.InputProps,endAdornment:t.createElement(t.Fragment,null,r&&t.createElement(b,{className:"autocomplete__icon",color:"inherit",size:20}),l&&t.createElement(h,{className:"autocomplete__icon"}),n.InputProps.endAdornment)}}))),[r,l]);return{getValue:i,getValueFromOptions:p,defaultTag:s,defaultRenderInput:d}})(o({},{options:I,placeholder:j,loading:x,searchIcon:w,labelInValue:C})),X=W.getValue,Y=W.getValueFromOptions,Z=W.defaultTag,$=W.defaultRenderInput,ee=l(s((function(e){return B(e)}),500)).current,ne=u((function(){return"string"==typeof v&&O?{label:q,value:q}:Y(v)}),[v]);return i((function(){A&&z(!1)}),[ne]),i((function(){L||z(!0)}),[L]),i((function(){Q&&(G(Q),ee(Q))}),[Q]),t.createElement("div",{className:p("autocomplete",{"autocomplete--showSearchIcon":w},E)},L&&t.createElement(d,{className:"autocomplete__component",options:Array.isArray(I)&&(_&&q?[{label:q,value:q}].concat(I):I)||[],defaultValue:ne,disabled:T,multiple:O,filterOptions:function(e,n){var o=n.inputValue,t=void 0===o?"":o;return(Array.isArray(e)?e:[]).filter((function(e){var n=(e||{}).label;return!V||(void 0===n?"":n).toLowerCase().indexOf(t.toLowerCase())>-1}))},onChange:function(e,n){Array.isArray(n)?S(n.map((function(e){return C?e:X(e)}))):n&&S(C?n:X(n))},onInputChange:function(e,n,o){n&&"string"==typeof n&&"input"===o&&U(n)},getOptionLabel:function(e){return e&&e.label||""},getOptionDisabled:function(e){return e.disabled},renderInput:function(e){return F&&F(e)||$(e)},renderTags:function(e,n){return N&&N(e,n)||Z(e,n)},popupIcon:null,noOptionsText:t.createElement(y,null),onFocus:M,onBlur:P}))};v.defaultProps={className:void 0,defaultValue:void 0,renderAfterDefaultValueChange:!1,options:void 0,freeTyping:!1,loading:!1,disabled:!1,labelInValue:!0,searchIcon:!0,multiple:!1,placeholder:"Search...",filterable:!1,renderInput:void 0,renderTags:void 0,onChange:function(){},onSearch:function(){},onFocus:function(){},onBlur:function(){}},v.propTypes={className:c.string,defaultValue:c.any,renderAfterDefaultValueChange:c.bool,options:c.arrayOf(c.any),freeTyping:c.bool,loading:c.bool,disabled:c.bool,labelInValue:c.bool,searchIcon:c.bool,multiple:c.bool,placeholder:c.string,filterable:c.bool,renderInput:c.func,renderTags:c.func,onChange:c.func,onSearch:c.func,onFocus:c.func,onBlur:c.func};export{v as default};
|