zy-react-library 2.2.20 → 2.2.21

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.
@@ -1 +1 @@
1
- import{Select as e}from"antd";import{useMemo as t,useEffect as l}from"react";import{getUnmatchedItems as a,getMatchedItems as n}from"../../../utils/index.js";import{jsx as o}from"react/jsx-runtime";function i(i){const{onGetData:r,onChange:s,onGetLabel:d,onGetOption:c,placeholder:p="",data:f=[],nameKey:h="name",idKey:m="id",labelRender:u,exclude:y=[],include:g=[],...x}=i,K=t(()=>{let e=f;return y.length>0&&(e=a({list:e,value:y,idKey:m})),g.length>0&&(e=n({list:e,value:g,idKey:m})),e},[f,y,g,m]);return l(()=>{r?.(K)},[K]),o(e,{placeholder:`请选择${p}`,showSearch:{optionFilterProp:"children"},allowClear:!0,onChange:(e,t)=>{if(d||c)if(Array.isArray(e))if(e.length>0){const t=[],l=[];e.forEach(e=>{const a=K.find(t=>t[m]===e);a&&(t.push(a),l.push(a[h]))}),d?.(l),c?.(t)}else d?.([]),c?.([]);else if(e){const t=K.find(t=>t[m]===e);d?.(t[h]),c?.(t)}else d?.(""),c?.({});s?.(e,t)},options:K.map(e=>({value:e[m],label:u?u(e):e[h]})),...x})}i.displayName="BasicSelect";export{i as default};
1
+ import{Select as e}from"antd";import{useMemo as t,useEffect as l}from"react";import{getUnmatchedItems as a,getMatchedItems as n}from"../../../utils/index.js";import{jsx as o}from"react/jsx-runtime";function i(i){const{onGetData:r,onChange:s,onGetLabel:d,onGetOption:c,placeholder:p="",data:f=[],nameKey:m="name",idKey:u="id",labelRender:h,exclude:y=[],include:g=[],...b}=i,x=t(()=>{let e=f;return y.length>0&&(e=a({list:e,value:y,idKey:u})),g.length>0&&(e=n({list:e,value:g,idKey:u})),e},[f,y,g,u]);return l(()=>{r?.(x)},[x]),o(e,{placeholder:`请选择${p}`,showSearch:{optionFilterProp:"label"},allowClear:!0,onChange:(e,t)=>{if(d||c)if(Array.isArray(e))if(e.length>0){const t=[],l=[];e.forEach(e=>{const a=x.find(t=>t[u]===e);a&&(t.push(a),l.push(a[m]))}),d?.(l),c?.(t)}else d?.([]),c?.([]);else if(e){const t=x.find(t=>t[u]===e);d?.(t[m]),c?.(t)}else d?.(""),c?.({});s?.(e,t)},options:x.map(e=>({value:e[u],label:h?h(e):e[m]})),...b})}i.displayName="BasicSelect";export{i as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "2.2.20",
4
+ "version": "2.2.21",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",