@zjpcy/simple-design 1.3.9 → 1.4.4

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.
Files changed (54) hide show
  1. package/dist/cjs/index.css +13969 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/es/Anchor/index.js +1 -1
  4. package/dist/es/Button/Button.js +1 -1
  5. package/dist/es/Carousel/index.js +1 -1
  6. package/dist/es/Cascader/index.js +1 -1
  7. package/dist/es/Checkbox/index.js +1 -1
  8. package/dist/es/ColorPicker/index.js +1 -1
  9. package/dist/es/DatePicker/RangePicker.js +1 -1
  10. package/dist/es/DatePicker/index.js +1 -1
  11. package/dist/es/DatePicker/styles.js +1 -1
  12. package/dist/es/Divider/index.js +1 -1
  13. package/dist/es/Drawer/index.js +1 -1
  14. package/dist/es/Dropdown/index.js +1 -1
  15. package/dist/es/Empty/index.js +1 -1
  16. package/dist/es/Grid/index.js +1 -1
  17. package/dist/es/Icon/Icon.js +1 -1
  18. package/dist/es/Input/InputBase.js +1 -1
  19. package/dist/es/Input/Textarea.js +1 -1
  20. package/dist/es/Layout/styles.js +1 -1
  21. package/dist/es/Masonry/index.js +1 -1
  22. package/dist/es/Menu/index.js +1 -1
  23. package/dist/es/Message/Message.js +1 -1
  24. package/dist/es/Modal/index.js +1 -1
  25. package/dist/es/Notice/Notice.js +1 -1
  26. package/dist/es/Pagination/index.js +1 -1
  27. package/dist/es/Popconfirm/index.js +1 -1
  28. package/dist/es/Progress/index.js +1 -1
  29. package/dist/es/Radio/index.js +1 -1
  30. package/dist/es/Rate/index.js +1 -1
  31. package/dist/es/Select/index.js +1 -1
  32. package/dist/es/Select/styles.js +1 -1
  33. package/dist/es/Slider/index.js +1 -1
  34. package/dist/es/Spin/index.js +1 -1
  35. package/dist/es/Splitter/index.js +1 -1
  36. package/dist/es/Splitter/styles.js +1 -1
  37. package/dist/es/Steps/index.js +1 -1
  38. package/dist/es/Switch/styles.js +1 -1
  39. package/dist/es/Table/SortableRow.js +1 -1
  40. package/dist/es/Table/index.js +1 -1
  41. package/dist/es/Tabs/index.js +1 -1
  42. package/dist/es/Tag/index.js +1 -1
  43. package/dist/es/TimePicker/RangePicker.js +1 -1
  44. package/dist/es/TimePicker/TimePickerPanel.js +1 -1
  45. package/dist/es/TimePicker/index.js +1 -1
  46. package/dist/es/Tooltip/Tooltip.js +1 -1
  47. package/dist/es/Tree/index.js +1 -1
  48. package/dist/es/TreeSelect/index.js +1 -1
  49. package/dist/es/TreeSelect/styles.js +1 -1
  50. package/dist/es/Typography/index.js +1 -1
  51. package/dist/es/Upload/index.js +1 -1
  52. package/dist/es/index.css +13969 -1
  53. package/dist/variables.css +177 -177
  54. package/package.json +3 -24
@@ -1 +1 @@
1
- import{jsx as n,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useState as e,useRef as o,useEffect as i,useLayoutEffect as a,useCallback as l,useMemo as c}from"react";import s from"../Icon/Icon.js";var u=function(u){var f=u.value,d=void 0===f?0:f,p=u.count,h=void 0===p?5:p,m=u.allowHalf,g=void 0===m||m,v=u.disabled,y=void 0!==v&&v,x=u.color,N=void 0===x?"#1677ff":x,C=u.onChange,A=u.className,M=void 0===A?"":A,P=u.size,b=void 0===P?24:P,j=u.chats,z=e(0),F=z[0],S=z[1],k=o([]),E=o(0),H=Array.isArray(j)&&j.length>=h&&j.every(function(n){return null!=n&&""!==n}),I=e([]),w=I[0],L=I[1],O=e(!1),T=O[0],q=O[1];k.current.length!==h&&(k.current=Array(h).fill(null)),i(function(){if(H)if("string"==typeof d&&d.length>0){var n=Math.min(d.length,h);L(j.slice(0,n))}else L([]);else L([])},[d,H,j,h]),a(function(){0===F&&T&&q(!1)},[F,T]);var B=F||(H?w.length:parseFloat(Number(d).toFixed(1)||"0")),D=l(function(n){return function(r){k.current[n]=r}},[]),G=c(function(){return Array.from({length:h}).map(function(n,r){var t=r+1,e=!1,o=!1;H?e=r<(T&&F>0?F:w.length):B>=t?e=!0:g&&B>r&&B<t&&(o=!0);return{index:r,isHalf:o,isFull:e,iconType:o?"half":e?"full":"empty",iconColor:e||o?N:"#d9d9d9"}})},[h,B,g,N,H,w.length,T,F]),J=function(e){if(H){var o=j[e.index],i=e.isFull;return n("span",{className:"rate-chat-item",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",fontSize:"inherit",backgroundColor:"transparent",color:y?"inherit":i?N:"inherit",cursor:y?"default":"pointer"},onMouseEnter:function(n){if(!y){n.stopPropagation();var r=e.index+1;r!==E.current&&(E.current=r,S(r))}},onClick:function(n){if(!y){n.stopPropagation();var r=e.index+1;if(j&&Array.isArray(j)&&j.length>=0){var t=j.slice(0,r);L(t),null==C||C(t.join(""))}else null==C||C(r.toString());S(0),E.current=0,q(!1)}},children:o})}return r(t,{children:[n(s,{type:"starOutline",size:b,color:"#d9d9d9",className:"rate-star-bg"}),n("span",{className:"rate-star-left",onMouseEnter:function(n){if(!y&&g){n.stopPropagation();var r=e.index+.5;r!==E.current&&(E.current=r,S(r))}},onClick:function(n){!y&&g&&(n.stopPropagation(),null==C||C((e.index+.5).toString()),S(0),E.current=0,q(!1))}}),n("span",{className:"rate-star-right",onMouseEnter:function(n){if(!y){n.stopPropagation();var r=e.index+1;r!==E.current&&(E.current=r,S(r))}},onClick:function(n){if(!y){if(n.stopPropagation(),H){var r=j.slice(0,e.index+1);null==C||C(r.join(""))}else null==C||C((e.index+1).toString());S(0),E.current=0,q(!1)}}}),n("span",{className:"rate-star-fill ".concat(e.isHalf?"half":""," ").concat(e.isFull?"full":""),style:{color:e.iconColor},children:n(s,{type:"star",size:b,color:e.iconColor,className:"rate-star-icon"})})]})};return n("div",{className:"rate ".concat(y?"disabled":""," ").concat(H?"rate-chats-mode":"rate-star-mode"," ").concat(M),style:{"--rate-color":N},onMouseEnter:function(){y||q(!0)},onMouseLeave:function(){y||(q(!1),S(0),E.current=0)},children:G.map(function(r){return n("span",{ref:D(r.index),className:"rate-star",style:{fontSize:"".concat(b,"px")},children:J(r)},r.index)})})},f=u;export{u as Rate,f as default};
1
+ import{jsx as r,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as e,useRef as i,useEffect as a,useLayoutEffect as o,useCallback as l,useMemo as s}from"react";import c from"classnames";import u from"../Icon/Icon.js";var f=function(f){var d=f.value,p=void 0===d?0:d,m=f.count,h=void 0===m?5:m,g=f.allowHalf,v=void 0===g||g,y=f.disabled,x=void 0!==y&&y,N=f.color,C=void 0===N?"#1677ff":N,b=f.onChange,A=f.className,F=void 0===A?"":A,M=f.size,P=void 0===M?24:M,j=f.chats,z=e(0),S=z[0],k=z[1],E=i([]),H=i(0),I=Array.isArray(j)&&j.length>=h&&j.every(function(r){return null!=r&&""!==r}),w=e([]),L=w[0],O=w[1],T=e(!1),q=T[0],B=T[1];E.current.length!==h&&(E.current=Array(h).fill(null)),a(function(){if(I)if("string"==typeof p&&p.length>0){var r=Math.min(p.length,h);O(j.slice(0,r))}else O([]);else O([])},[p,I,j,h]),o(function(){0===S&&q&&B(!1)},[S,q]);var D=S||(I?L.length:parseFloat(Number(p).toFixed(1)||"0")),G=l(function(r){return function(n){E.current[r]=n}},[]),J=s(function(){return Array.from({length:h}).map(function(r,n){var t=n+1,e=!1,i=!1;I?e=n<(q&&S>0?S:L.length):D>=t?e=!0:v&&D>n&&D<t&&(i=!0);return{index:n,isHalf:i,isFull:e,iconType:i?"half":e?"full":"empty",iconColor:e||i?C:"#d9d9d9"}})},[h,D,v,C,I,L.length,q,S]),K=function(e){if(I){var i=j[e.index],a=e.isFull;return r("span",{className:"rate-chat-item",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",fontSize:"inherit",backgroundColor:"transparent",color:x?"inherit":a?C:"inherit",cursor:x?"default":"pointer"},onMouseEnter:function(r){if(!x){r.stopPropagation();var n=e.index+1;n!==H.current&&(H.current=n,k(n))}},onClick:function(r){if(!x){r.stopPropagation();var n=e.index+1;if(j&&Array.isArray(j)&&j.length>=0){var t=j.slice(0,n);O(t),null==b||b(t.join(""))}else null==b||b(n.toString());k(0),H.current=0,B(!1)}},children:i})}return n(t,{children:[r(u,{type:"starOutline",size:P,color:"#d9d9d9",className:"rate-star-bg"}),r("span",{className:"rate-star-left",onMouseEnter:function(r){if(!x&&v){r.stopPropagation();var n=e.index+.5;n!==H.current&&(H.current=n,k(n))}},onClick:function(r){!x&&v&&(r.stopPropagation(),null==b||b((e.index+.5).toString()),k(0),H.current=0,B(!1))}}),r("span",{className:"rate-star-right",onMouseEnter:function(r){if(!x){r.stopPropagation();var n=e.index+1;n!==H.current&&(H.current=n,k(n))}},onClick:function(r){if(!x){if(r.stopPropagation(),I){var n=j.slice(0,e.index+1);null==b||b(n.join(""))}else null==b||b((e.index+1).toString());k(0),H.current=0,B(!1)}}}),r("span",{className:c("rate-star-fill",{"rate-star-fill-half":e.isHalf,"rate-star-fill-full":e.isFull,"rate-star-fill-empty":!e.isHalf&&!e.isFull}),style:{color:e.iconColor},children:r(u,{type:"star",size:P,color:e.iconColor,className:"rate-star-icon"})})]})};return r("div",{className:c("rate",{"rate-disabled":x,"rate-chats-mode":I,"rate-chats-mode-disabled":I&&x,"rate-star-mode":!I},F),style:{"--rate-color":C},onMouseEnter:function(){x||B(!0)},onMouseLeave:function(){x||(B(!1),k(0),H.current=0)},children:J.map(function(n){return r("span",{ref:G(n.index),className:"rate-star",style:{fontSize:"".concat(P,"px")},children:K(n)},n.index)})})},d=f;export{f as Rate,d as default};
@@ -1 +1 @@
1
- import{__spreadArray as e,__assign as n}from"../node_modules/tslib/tslib.es6.js";import{jsx as l,jsxs as t,Fragment as r}from"react/jsx-runtime";import{useState as o,useRef as i,useEffect as a,useMemo as c,useCallback as u}from"react";import{injectGlobalStyles as s,Wrapper as d,LabelWrapper as v,Label as f,Selector as p,SelectorContent as h,SuffixArea as m,ClearButton as g,LoadingIcon as b,Arrow as y,SearchInput as w,TagsContainer as C,Placeholder as x,SingleValue as $,Dropdown as A,OptionList as N,Empty as k,Tag as L,TagClose as M,CheckIcon as D,Option as E}from"./styles.js";var z=function(z){var B=z.value,P=z.defaultValue,S=z.options,j=void 0===S?[]:S,H=z.disabled,R=void 0!==H&&H,T=z.loading,V=void 0!==T&&T,G=z.mode,I=void 0===G?"single":G,K=z.placeholder,O=void 0===K?"请选择":K,U=z.searchable,Z=void 0!==U&&U,_=z.clearable,q=void 0!==_&&_,F=z.size,J=void 0===F?"default":F,Q=z.width,W=z.styles,X=z.onChange,Y=z.onOpenChange,ee=z.onSearch,ne=z.optionRender,le=z.tagRender,te=z.label,re=z.labelGap,oe=void 0===re?8:re,ie=z.labelClassName,ae=void 0===ie?"":ie,ce=z.labelStyle,ue=z.className,se=void 0===ue?"":ue,de=z.style,ve=z.showArrow,fe=void 0===ve||ve,pe=z.maxHeight,he=void 0===pe?256:pe,me=z.emptyContent,ge=void 0===me?"暂无数据":me,be=z.getPopupContainer,ye=void 0!==B,we=o(void 0!==P?P:"multiple"===I?[]:""),Ce=we[0],xe=we[1],$e=o(!1),Ae=$e[0],Ne=$e[1],ke=o(""),Le=ke[0],Me=ke[1],De=o(-1),Ee=De[0],ze=De[1],Be=o(!1),Pe=Be[0],Se=Be[1],je=i(null),He=i(null),Re=i(null);a(function(){s()},[]);var Te=ye?B:Ce,Ve="multiple"===I,Ge=c(function(){return Le?j.filter(function(e){return String(e.label).toLowerCase().includes(Le.toLowerCase())}):j},[j,Le]),Ie=c(function(){if(Ve){var e=Array.isArray(Te)?Te:[];return j.filter(function(n){return e.includes(n.value)})}return j.find(function(e){return e.value===Te})||null},[Te,j,Ve]),Ke=u(function(e,n){ye||xe(e),null==X||X(e,n)},[ye,X]),Oe=u(function(e){e.disabled||(Ke(e.value,e),Me(""),Ne(!1))},[Ke]),Ue=u(function(n){if(!n.disabled){var l,t,r=Array.isArray(Te)?Te:[];r.includes(n.value)?(l=r.filter(function(e){return e!==n.value}),t=Ie.filter(function(e){return e.value!==n.value})):(l=e(e([],r,!0),[n.value],!1),t=e(e([],Ie,!0),[n],!1)),Ke(l,t),Me(""),setTimeout(function(){var e;return null===(e=Re.current)||void 0===e?void 0:e.focus()},0)}},[Te,Ke,Ie]),Ze=u(function(e){Ve?Ue(e):Oe(e)},[Ve,Ue,Oe]),_e=u(function(e,n){if(e.stopPropagation(),!R){var l=(Array.isArray(Te)?Te:[]).filter(function(e){return e!==n}),t=Ie.filter(function(e){return e.value!==n});Ke(l,t)}},[Te,R,Ke,Ie]),qe=u(function(e){(e.stopPropagation(),R)||(Ke(Ve?[]:"",Ve?[]:void 0),Me(""))},[R,Ve,Ke]),Fe=u(function(e){var n=e.target.value;Me(n),null==ee||ee(n)},[ee]);a(function(){var e=function(e){je.current&&!je.current.contains(e.target)&&(Ne(!1),Me(""))};return Ae&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[Ae]),a(function(){null==Y||Y(Ae),Ae&&Z&&setTimeout(function(){var e;return null===(e=Re.current)||void 0===e?void 0:e.focus()},0)},[Ae,Z,Y]);var Je,Qe=u(function(e){if(Ae)switch(e.key){case"Escape":e.preventDefault(),Ne(!1);break;case"ArrowDown":e.preventDefault(),ze(function(e){return e<Ge.length-1?e+1:0});break;case"ArrowUp":e.preventDefault(),ze(function(e){return e>0?e-1:Ge.length-1});break;case"Enter":e.preventDefault(),Ee>=0&&Ee<Ge.length&&Ze(Ge[Ee])}else"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Ne(!0))},[Ae,Ee,Ge,Ze]),We=function(e){return le?le({value:e.value,label:e.label,onClose:function(n){return _e(n,e.value)},disabled:R}):t(L,{className:"select-tag",$disabled:R,$styles:null==W?void 0:W.tag,children:[l("span",{children:e.label}),!R&&l(M,{className:"select-tag-close",onClick:function(n){return _e(n,e.value)},children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]},e.value)},Xe=function(e,n){var o=Ve?Te.includes(e.value):Te===e.value,i=n===Ee,a=ne?ne(e):t(r,{children:[o&&Ve&&l(D,{children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),l("span",{children:e.label})]});return l(E,{className:"select-option ".concat(o?"select-option-selected":""," ").concat(i?"select-option-active":""),$selected:o,$active:i,$disabled:!!e.disabled,$styles:null==W?void 0:W.option,onClick:function(){return Ze(e)},onMouseEnter:function(){return ze(n)},children:a},e.value)},Ye=Ve?Array.isArray(Te)&&Te.length>0:""!==Te&&null!=Te,en=q&&!R&&Ye&&!V&&Pe,nn=fe&&!V&&!en;return l(d,{ref:je,className:"select-wrapper ".concat(se),$styles:null==W?void 0:W.wrapper,style:n({width:Q},de),children:t(v,{children:[te&&l(f,{className:"select-label ".concat(ae),style:n({marginRight:"number"==typeof oe?"".concat(oe,"px"):oe},ce),children:te}),t("div",{style:{flex:1,position:"relative"},children:[t(p,{className:"select-selector select-".concat(J," ").concat(Ae?"select-open":""," ").concat(R?"select-disabled":""),$disabled:R,$loading:V,$size:J,$open:Ae,$styles:null==W?void 0:W.selector,onClick:function(){return!R&&!V&&Ne(!Ae)},onKeyDown:Qe,onMouseEnter:function(){return Se(!0)},onMouseLeave:function(){return Se(!1)},tabIndex:R?-1:0,role:"combobox","aria-expanded":Ae,"aria-haspopup":"listbox",children:[l(h,{children:function(){if(Z&&Ae){var e=Ve?"搜索...":String((null==Ie?void 0:Ie.label)||O);return l(w,{ref:Re,type:"text",value:Le,onChange:Fe,placeholder:e,onClick:function(e){return e.stopPropagation()}})}if(Ve){var n=Ie;return n.length>0?l(C,{children:n.map(We)}):l(x,{children:O})}return Ie?l($,{children:Ie.label}):l(x,{children:O})}()}),t(m,{children:[en&&l(g,{className:"select-clear",onClick:qe,children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}),V&&l(b,{className:"select-loading",children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})})}),nn&&l(y,{className:"select-arrow ".concat(Ae?"select-open":""),$open:Ae,children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M7 10l5 5 5-5z"})})})]})]}),(Je=l(A,{ref:He,className:"select-dropdown",$open:Ae,$styles:null==W?void 0:W.dropdown,children:l(N,{$maxHeight:he,children:Ge.length>0?Ge.map(Xe):l(k,{className:"select-empty",children:ge})})}),be?be()?Je:null:Je)]})]})})};export{z as default};
1
+ import{__spreadArray as e,__assign as n}from"../node_modules/tslib/tslib.es6.js";import{jsx as l,jsxs as t,Fragment as r}from"react/jsx-runtime";import{useState as o,useRef as i,useEffect as a,useMemo as c,useCallback as u}from"react";import{injectGlobalStyles as s,Wrapper as d,LabelWrapper as v,Label as f,Selector as p,SelectorContent as h,SuffixArea as m,ClearButton as g,LoadingIcon as b,Arrow as y,SearchInput as w,TagsContainer as C,Placeholder as x,SingleValue as $,Dropdown as A,OptionList as N,Empty as k,Tag as L,TagClose as M,CheckIcon as D,Option as E}from"./styles.js";var z=function(z){var B=z.value,P=z.defaultValue,S=z.options,j=void 0===S?[]:S,H=z.disabled,R=void 0!==H&&H,T=z.loading,V=void 0!==T&&T,G=z.mode,I=void 0===G?"single":G,K=z.placeholder,O=void 0===K?"请选择":K,U=z.searchable,Z=void 0!==U&&U,_=z.clearable,q=void 0!==_&&_,F=z.size,J=void 0===F?"default":F,Q=z.width,W=z.styles,X=z.onChange,Y=z.onOpenChange,ee=z.onSearch,ne=z.optionRender,le=z.tagRender,te=z.label,re=z.labelGap,oe=void 0===re?8:re,ie=z.labelClassName,ae=void 0===ie?"":ie,ce=z.labelStyle,ue=z.className,se=void 0===ue?"":ue,de=z.style,ve=z.showArrow,fe=void 0===ve||ve,pe=z.maxHeight,he=void 0===pe?256:pe,me=z.emptyContent,ge=void 0===me?"暂无数据":me,be=z.getPopupContainer,ye=void 0!==B,we=o(void 0!==P?P:"multiple"===I?[]:""),Ce=we[0],xe=we[1],$e=o(!1),Ae=$e[0],Ne=$e[1],ke=o(""),Le=ke[0],Me=ke[1],De=o(-1),Ee=De[0],ze=De[1],Be=o(!1),Pe=Be[0],Se=Be[1],je=i(null),He=i(null),Re=i(null);a(function(){s()},[]);var Te=ye?B:Ce,Ve="multiple"===I,Ge=c(function(){return Le?j.filter(function(e){return String(e.label).toLowerCase().includes(Le.toLowerCase())}):j},[j,Le]),Ie=c(function(){if(Ve){var e=Array.isArray(Te)?Te:[];return j.filter(function(n){return e.includes(n.value)})}return j.find(function(e){return e.value===Te})||null},[Te,j,Ve]),Ke=u(function(e,n){ye||xe(e),null==X||X(e,n)},[ye,X]),Oe=u(function(e){e.disabled||(Ke(e.value,e),Me(""),Ne(!1))},[Ke]),Ue=u(function(n){if(!n.disabled){var l,t,r=Array.isArray(Te)?Te:[];r.includes(n.value)?(l=r.filter(function(e){return e!==n.value}),t=Ie.filter(function(e){return e.value!==n.value})):(l=e(e([],r,!0),[n.value],!1),t=e(e([],Ie,!0),[n],!1)),Ke(l,t),Me(""),setTimeout(function(){var e;return null===(e=Re.current)||void 0===e?void 0:e.focus()},0)}},[Te,Ke,Ie]),Ze=u(function(e){Ve?Ue(e):Oe(e)},[Ve,Ue,Oe]),_e=u(function(e,n){if(e.stopPropagation(),!R){var l=(Array.isArray(Te)?Te:[]).filter(function(e){return e!==n}),t=Ie.filter(function(e){return e.value!==n});Ke(l,t)}},[Te,R,Ke,Ie]),qe=u(function(e){(e.stopPropagation(),R)||(Ke(Ve?[]:"",Ve?[]:void 0),Me(""))},[R,Ve,Ke]),Fe=u(function(e){var n=e.target.value;Me(n),null==ee||ee(n)},[ee]);a(function(){var e=function(e){je.current&&!je.current.contains(e.target)&&(Ne(!1),Me(""))};return Ae&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[Ae]),a(function(){null==Y||Y(Ae),Ae&&Z&&setTimeout(function(){var e;return null===(e=Re.current)||void 0===e?void 0:e.focus()},0)},[Ae,Z,Y]);var Je,Qe=u(function(e){if(Ae)switch(e.key){case"Escape":e.preventDefault(),Ne(!1);break;case"ArrowDown":e.preventDefault(),ze(function(e){return e<Ge.length-1?e+1:0});break;case"ArrowUp":e.preventDefault(),ze(function(e){return e>0?e-1:Ge.length-1});break;case"Enter":e.preventDefault(),Ee>=0&&Ee<Ge.length&&Ze(Ge[Ee])}else"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Ne(!0))},[Ae,Ee,Ge,Ze]),We=function(e){return le?le({value:e.value,label:e.label,onClose:function(n){return _e(n,e.value)},disabled:R}):t(L,{className:"select-tag",$disabled:R,$styles:null==W?void 0:W.tag,children:[l("span",{children:e.label}),!R&&l(M,{className:"select-tag-close",onClick:function(n){return _e(n,e.value)},children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]},e.value)},Xe=function(e,n){var o=Ve?Te.includes(e.value):Te===e.value,i=n===Ee,a=ne?ne(e):t(r,{children:[o&&Ve&&l(D,{children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),l("span",{children:e.label})]});return l(E,{className:"select-option ".concat(o?"select-option-selected":""," ").concat(i?"select-option-active":""),$selected:o,$active:i,$disabled:!!e.disabled,$styles:null==W?void 0:W.option,onClick:function(){return Ze(e)},onMouseEnter:function(){return ze(n)},children:a},e.value)},Ye=Ve?Array.isArray(Te)&&Te.length>0:""!==Te&&null!=Te,en=q&&!R&&Ye&&!V&&Pe,nn=fe&&!V&&!en;return l(d,{ref:je,className:"select-wrapper ".concat(se),$styles:null==W?void 0:W.wrapper,style:n({width:Q},de),children:t(v,{children:[te&&l(f,{className:"select-label ".concat(ae),style:n({marginRight:"number"==typeof oe?"".concat(oe,"px"):oe},ce),children:te}),t("div",{style:{flex:1,position:"relative"},children:[t(p,{className:"select-selector ".concat(J?"select-selector-".concat(J):""," ").concat(Ae?"select-selector-open":""," ").concat(R?"select-selector-disabled":""),$disabled:R,$loading:V,$size:J,$open:Ae,$styles:null==W?void 0:W.selector,onClick:function(){return!R&&!V&&Ne(!Ae)},onKeyDown:Qe,onMouseEnter:function(){return Se(!0)},onMouseLeave:function(){return Se(!1)},tabIndex:R?-1:0,role:"combobox","aria-expanded":Ae,"aria-haspopup":"listbox",children:[l(h,{children:function(){if(Z&&Ae){var e=Ve?"搜索...":String((null==Ie?void 0:Ie.label)||O);return l(w,{ref:Re,type:"text",value:Le,onChange:Fe,placeholder:e,onClick:function(e){return e.stopPropagation()}})}if(Ve){var n=Ie;return n.length>0?l(C,{children:n.map(We)}):l(x,{children:O})}return Ie?l($,{children:Ie.label}):l(x,{children:O})}()}),t(m,{children:[en&&l(g,{className:"select-clear",onClick:qe,children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}),V&&l(b,{className:"select-loading",children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})})}),nn&&l(y,{className:"select-arrow ".concat(Ae?"select-arrow-open":""),$open:Ae,children:l("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M7 10l5 5 5-5z"})})})]})]}),(Je=l(A,{ref:He,className:"select-dropdown",$open:Ae,$styles:null==W?void 0:W.dropdown,children:l(N,{$maxHeight:he,children:Ge.length>0?Ge.map(Xe):l(k,{className:"select-empty",children:ge})})}),be?be()?Je:null:Je)]})]})})};export{z as default};
@@ -1 +1 @@
1
- import{__makeTemplateObject as n}from"../node_modules/tslib/tslib.es6.js";import e from"styled-components";var t,r,i,o,a,l,d,s,p,c,f,g,x,u,b,h,m,w,y,v,k=function(n,e){return"var(".concat(n,", ").concat(e,")")},$=e.div(t||(t=n(["\n display: inline-block;\n position: relative;\n width: 100%;\n\n &.select-wrapper {\n /* 外部可通过 .select-wrapper 选择器覆盖样式 */\n }\n\n ","\n"],["\n display: inline-block;\n position: relative;\n width: 100%;\n\n &.select-wrapper {\n /* 外部可通过 .select-wrapper 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),j=e.div(r||(r=n(["\n display: flex;\n align-items: center;\n"],["\n display: flex;\n align-items: center;\n"]))),z=e.div(i||(i=n(["\n font-size: 14px;\n color: ",";\n white-space: nowrap;\n flex-shrink: 0;\n font-weight: 500;\n letter-spacing: 0.2px;\n"],["\n font-size: 14px;\n color: ",";\n white-space: nowrap;\n flex-shrink: 0;\n font-weight: 500;\n letter-spacing: 0.2px;\n"])),k("--idp-text-color","rgba(0, 0, 0, 0.85)")),O=e.div(o||(o=n(["\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n border: 1px solid ",";\n border-radius: ",";\n background: linear-gradient(135deg, "," 0%, "," 100%);\n transition: all "," ",";\n outline: none;\n box-sizing: border-box;\n box-shadow: ","; \n overflow: hidden;\n cursor: ",";\n opacity: ",";\n\n &:hover {\n border-color: ",";\n box-shadow: ",";\n }\n\n &.select-selector {\n /* 外部可通过 .select-selector 选择器覆盖样式 */\n }\n\n /* 尺寸样式 */\n ","\n\n ","\n"],["\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n border: 1px solid ",";\n border-radius: ",";\n background: linear-gradient(135deg, "," 0%, "," 100%);\n transition: all "," ",";\n outline: none;\n box-sizing: border-box;\n box-shadow: ","; \n overflow: hidden;\n cursor: ",";\n opacity: ",";\n\n &:hover {\n border-color: ",";\n box-shadow: ",";\n }\n\n &.select-selector {\n /* 外部可通过 .select-selector 选择器覆盖样式 */\n }\n\n /* 尺寸样式 */\n ","\n\n ","\n"])),function(n){return n.$open?k("--idp-primary-color","#1890ff"):k("--idp-input-border","#d9d9d9")},k("--idp-border-radius-lg","8px"),k("--idp-bg-color-white","#fff"),k("--idp-bg-color","#fafafa"),k("--idp-transition-duration","0.2s"),k("--idp-transition-timing-function","ease-in-out"),function(n){return n.$open?k("--idp-input-box-shadow-focus","0 0 0 2px rgba(51, 154, 240, 0.2)"):k("--idp-shadow-extra-light","0 2px 8px rgba(0, 0, 0, 0.08)")},function(n){return n.$disabled?"not-allowed":"pointer"},function(n){return n.$disabled?k("--idp-opacity-disabled","0.65"):1},function(n){return n.$disabled?k("--idp-input-border","#d9d9d9"):k("--idp-primary-color","#1890ff")},function(n){return n.$disabled?"none":k("--idp-input-box-shadow-hover","0 0 0 2px rgba(51, 154, 240, 0.2)")},function(n){switch(n.$size){case"small":return"\n min-height: 24px;\n padding: 2px 8px;\n font-size: 13px;\n ";case"large":return"\n min-height: 40px;\n padding: 8px 16px;\n font-size: 15px;\n ";default:return"\n min-height: 32px;\n padding: 6px 12px;\n font-size: 14px;\n "}},function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),C=e.div(a||(a=n(["\n flex: 1;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n overflow: hidden;\n"],["\n flex: 1;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n overflow: hidden;\n"]))),E=e.span(l||(l=n(["\n color: ",";\n user-select: none;\n"],["\n color: ",";\n user-select: none;\n"])),k("--idp-text-color-light","#bfbfbf")),Y=e.span(d||(d=n(["\n color: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"],["\n color: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])),k("--idp-text-color","rgba(0, 0, 0, 0.85)")),B=e.div(s||(s=n(["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n"],["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n"]))),H=e.span(p||(p=n(["\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n color: ",";\n font-size: 13px;\n line-height: 1.4;\n transition: all "," ease;\n\n &:hover {\n background: ",";\n color: ",";\n }\n\n ","\n\n ","\n"],["\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n color: ",";\n font-size: 13px;\n line-height: 1.4;\n transition: all "," ease;\n\n &:hover {\n background: ",";\n color: ",";\n }\n\n ","\n\n ","\n"])),k("--idp-primary-light-color","rgba(24, 100, 240, 0.1)"),k("--idp-primary-color","#1890ff"),k("--idp-border-radius-sm","4px"),k("--idp-primary-color","#1890ff"),k("--idp-transition-duration","0.2s"),k("--idp-primary-color","#1890ff"),k("--idp-bg-color-white","#fff"),function(n){return n.$disabled&&"\n cursor: not-allowed;\n opacity: 0.6;\n "},function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),I=e.span(c||(c=n(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: 4px;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.1);\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"],["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: 4px;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.1);\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"]))),_=e.input(f||(f=n(["\n flex: 1;\n min-width: 60px;\n border: none;\n outline: none;\n background: transparent;\n padding: 0;\n font-size: inherit;\n color: ",";\n\n &::placeholder {\n color: ",";\n }\n"],["\n flex: 1;\n min-width: 60px;\n border: none;\n outline: none;\n background: transparent;\n padding: 0;\n font-size: inherit;\n color: ",";\n\n &::placeholder {\n color: ",";\n }\n"])),k("--idp-text-color","rgba(0, 0, 0, 0.85)"),k("--idp-text-color-light","#bfbfbf")),q=e.div(g||(g=n(["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: 8px;\n flex-shrink: 0;\n"],["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: 8px;\n flex-shrink: 0;\n"]))),A=e.div(x||(x=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n color: ",";\n cursor: pointer;\n transition: all "," ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.12);\n color: ",";\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n color: ",";\n cursor: pointer;\n transition: all "," ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.12);\n color: ",";\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"])),k("--idp-text-color-tertiary","rgba(0, 0, 0, 0.45)"),k("--idp-transition-duration","0.2s"),k("--idp-text-color-secondary","rgba(0, 0, 0, 0.65)")),D=e.div(u||(u=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n transition: transform "," ease;\n transform: ",";\n\n svg {\n width: 12px;\n height: 12px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n transition: transform "," ease;\n transform: ",";\n\n svg {\n width: 12px;\n height: 12px;\n }\n"])),k("--idp-text-color-tertiary","rgba(0, 0, 0, 0.45)"),k("--idp-transition-duration","0.2s"),function(n){return n.$open?"rotate(180deg)":"rotate(0deg)"}),F=e.div(b||(b=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n animation: select-spin 1s linear infinite;\n\n svg {\n width: 14px;\n height: 14px;\n }\n\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n animation: select-spin 1s linear infinite;\n\n svg {\n width: 14px;\n height: 14px;\n }\n\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n"])),k("--idp-primary-color","#1890ff")),G=e.div(h||(h=n(["\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n right: 0;\n z-index: ",";\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n box-shadow: ",";\n opacity: ",";\n visibility: ",";\n transform: ",";\n transition: all "," ",";\n overflow: hidden;\n\n &.select-dropdown {\n /* 外部可通过 .select-dropdown 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n right: 0;\n z-index: ",";\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n box-shadow: ",";\n opacity: ",";\n visibility: ",";\n transform: ",";\n transition: all "," ",";\n overflow: hidden;\n\n &.select-dropdown {\n /* 外部可通过 .select-dropdown 选择器覆盖样式 */\n }\n\n ","\n"])),k("--idp-z-index-modal","1000"),k("--idp-bg-color-white","#fff"),k("--idp-border-color-light","#f0f0f0"),k("--idp-border-radius-md","6px"),k("--idp-shadow-lg","0 8px 24px rgba(0, 0, 0, 0.15)"),function(n){return n.$open?1:0},function(n){return n.$open?"visible":"hidden"},function(n){return n.$open?"translateY(0)":"translateY(-8px)"},k("--idp-transition-duration","0.2s"),k("--idp-transition-timing-function","ease-in-out"),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),J=e.div(m||(m=n(["\n max-height: ",";\n overflow-y: auto;\n padding: 4px 0;\n\n /* 滚动条样式 */\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: ",";\n border-radius: 3px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: ",";\n }\n"],["\n max-height: ",";\n overflow-y: auto;\n padding: 4px 0;\n\n /* 滚动条样式 */\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: ",";\n border-radius: 3px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: ",";\n }\n"])),function(n){var e=n.$maxHeight;return e?"".concat(e,"px"):"256px"},k("--idp-border-color","#e8e8e8"),k("--idp-text-color-light","#bfbfbf")),K=e.div(w||(w=n(["\n display: flex;\n align-items: center;\n padding: 10px 12px;\n cursor: ",";\n transition: all "," ease;\n background: ",";\n color: ",";\n opacity: ",";\n\n &:hover {\n background: ",";\n }\n\n &.select-option {\n /* 外部可通过 .select-option 选择器覆盖样式 */\n }\n\n &.select-option-selected {\n font-weight: 500;\n }\n\n &.select-option-active {\n background: ",";\n }\n\n ","\n"],["\n display: flex;\n align-items: center;\n padding: 10px 12px;\n cursor: ",";\n transition: all "," ease;\n background: ",";\n color: ",";\n opacity: ",";\n\n &:hover {\n background: ",";\n }\n\n &.select-option {\n /* 外部可通过 .select-option 选择器覆盖样式 */\n }\n\n &.select-option-selected {\n font-weight: 500;\n }\n\n &.select-option-active {\n background: ",";\n }\n\n ","\n"])),function(n){return n.$disabled?"not-allowed":"pointer"},k("--idp-transition-duration","0.2s"),function(n){return n.$selected?k("--idp-primary-light-color","rgba(24, 100, 240, 0.1)"):"transparent"},function(n){var e=n.$disabled,t=n.$selected;return e?k("--idp-text-color-light","#bfbfbf"):t?k("--idp-primary-color","#1890ff"):k("--idp-text-color","rgba(0, 0, 0, 0.85)")},function(n){return n.$disabled?.6:1},function(n){var e=n.$disabled,t=n.$selected;return e?"transparent":t?k("--idp-primary-light-color","rgba(24, 100, 240, 0.1)"):k("--idp-bg-color","#fafafa")},k("--idp-bg-color","#fafafa"),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),L=e.div(y||(y=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n color: ",";\n\n svg {\n width: 14px;\n height: 14px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n color: ",";\n\n svg {\n width: 14px;\n height: 14px;\n }\n"])),k("--idp-primary-color","#1890ff")),M=e.div(v||(v=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px 16px;\n color: ",";\n font-size: 14px;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px 16px;\n color: ",";\n font-size: 14px;\n"])),k("--idp-text-color-tertiary","rgba(0, 0, 0, 0.45)")),N=function(){if("undefined"!=typeof document){var n="select-global-styles";if(!document.getElementById(n)){var e=document.createElement("style");e.id=n,e.textContent="\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}}};export{D as Arrow,L as CheckIcon,A as ClearButton,G as Dropdown,M as Empty,z as Label,j as LabelWrapper,F as LoadingIcon,K as Option,J as OptionList,E as Placeholder,_ as SearchInput,O as Selector,C as SelectorContent,Y as SingleValue,q as SuffixArea,H as Tag,I as TagClose,B as TagsContainer,$ as Wrapper,N as injectGlobalStyles};
1
+ import{__makeTemplateObject as n}from"../node_modules/tslib/tslib.es6.js";import e from"styled-components";var t,r,o,i,a,c,l,s,p,d,f,g,x,u,b,h,y,m,w,v,j=function(n,e){return"var(".concat(n,", ").concat(e,")")},z=e.div(t||(t=n(["\n display: inline-block;\n position: relative;\n width: 100%;\n\n &.select-wrapper {\n /* 外部可通过 .select-wrapper 选择器覆盖样式 */\n }\n\n ","\n"],["\n display: inline-block;\n position: relative;\n width: 100%;\n\n &.select-wrapper {\n /* 外部可通过 .select-wrapper 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),k=e.div(r||(r=n(["\n display: flex;\n align-items: center;\n"],["\n display: flex;\n align-items: center;\n"]))),$=e.div(o||(o=n(["\n font-size: 14px;\n color: ",";\n white-space: nowrap;\n flex-shrink: 0;\n font-weight: 500;\n letter-spacing: 0.2px;\n"],["\n font-size: 14px;\n color: ",";\n white-space: nowrap;\n flex-shrink: 0;\n font-weight: 500;\n letter-spacing: 0.2px;\n"])),j("--zjpcy-text-color","rgba(0, 0, 0, 0.85)")),O=e.div(i||(i=n(["\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n border: 1px solid ",";\n border-radius: ",";\n background: linear-gradient(135deg, "," 0%, "," 100%);\n transition: all "," ",";\n outline: none;\n box-sizing: border-box;\n box-shadow: ","; \n overflow: hidden;\n cursor: ",";\n opacity: ",";\n\n &:hover {\n border-color: ",";\n box-shadow: ",";\n }\n\n &.select-selector {\n /* 外部可通过 .select-selector 选择器覆盖样式 */\n }\n\n /* 尺寸样式 */\n ","\n\n ","\n"],["\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n border: 1px solid ",";\n border-radius: ",";\n background: linear-gradient(135deg, "," 0%, "," 100%);\n transition: all "," ",";\n outline: none;\n box-sizing: border-box;\n box-shadow: ","; \n overflow: hidden;\n cursor: ",";\n opacity: ",";\n\n &:hover {\n border-color: ",";\n box-shadow: ",";\n }\n\n &.select-selector {\n /* 外部可通过 .select-selector 选择器覆盖样式 */\n }\n\n /* 尺寸样式 */\n ","\n\n ","\n"])),function(n){return n.$open?j("--zjpcy-primary-color","#1890ff"):j("--zjpcy-input-border","#d9d9d9")},j("--zjpcy-border-radius-lg","8px"),j("--zjpcy-bg-color-white","#fff"),j("--zjpcy-bg-color","#fafafa"),j("--zjpcy-transition-duration","0.2s"),j("--zjpcy-transition-timing-function","ease-in-out"),function(n){return n.$open?j("--zjpcy-input-box-shadow-focus","0 0 0 2px rgba(51, 154, 240, 0.2)"):j("--zjpcy-shadow-extra-light","0 2px 8px rgba(0, 0, 0, 0.08)")},function(n){return n.$disabled?"not-allowed":"pointer"},function(n){return n.$disabled?j("--zjpcy-opacity-disabled","0.65"):1},function(n){return n.$disabled?j("--zjpcy-input-border","#d9d9d9"):j("--zjpcy-primary-color","#1890ff")},function(n){return n.$disabled?"none":j("--zjpcy-input-box-shadow-hover","0 0 0 2px rgba(51, 154, 240, 0.2)")},function(n){switch(n.$size){case"small":return"\n min-height: 24px;\n padding: 2px 8px;\n font-size: 13px;\n ";case"large":return"\n min-height: 40px;\n padding: 8px 16px;\n font-size: 15px;\n ";default:return"\n min-height: 32px;\n padding: 6px 12px;\n font-size: 14px;\n "}},function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),C=e.div(a||(a=n(["\n flex: 1;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n overflow: hidden;\n"],["\n flex: 1;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n overflow: hidden;\n"]))),E=e.span(c||(c=n(["\n color: ",";\n user-select: none;\n"],["\n color: ",";\n user-select: none;\n"])),j("--zjpcy-text-color-light","#bfbfbf")),Y=e.span(l||(l=n(["\n color: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"],["\n color: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])),j("--zjpcy-text-color","rgba(0, 0, 0, 0.85)")),B=e.div(s||(s=n(["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n"],["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n"]))),H=e.span(p||(p=n(["\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n color: ",";\n font-size: 13px;\n line-height: 1.4;\n transition: all "," ease;\n\n &:hover {\n background: ",";\n color: ",";\n }\n\n ","\n\n ","\n"],["\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n color: ",";\n font-size: 13px;\n line-height: 1.4;\n transition: all "," ease;\n\n &:hover {\n background: ",";\n color: ",";\n }\n\n ","\n\n ","\n"])),j("--zjpcy-primary-light-color","rgba(24, 100, 240, 0.1)"),j("--zjpcy-primary-color","#1890ff"),j("--zjpcy-border-radius-sm","4px"),j("--zjpcy-primary-color","#1890ff"),j("--zjpcy-transition-duration","0.2s"),j("--zjpcy-primary-color","#1890ff"),j("--zjpcy-bg-color-white","#fff"),function(n){return n.$disabled&&"\n cursor: not-allowed;\n opacity: 0.6;\n "},function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),I=e.span(d||(d=n(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: 4px;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.1);\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"],["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: 4px;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.1);\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"]))),_=e.input(f||(f=n(["\n flex: 1;\n min-width: 60px;\n border: none;\n outline: none;\n background: transparent;\n padding: 0;\n font-size: inherit;\n color: ",";\n\n &::placeholder {\n color: ",";\n }\n"],["\n flex: 1;\n min-width: 60px;\n border: none;\n outline: none;\n background: transparent;\n padding: 0;\n font-size: inherit;\n color: ",";\n\n &::placeholder {\n color: ",";\n }\n"])),j("--zjpcy-text-color","rgba(0, 0, 0, 0.85)"),j("--zjpcy-text-color-light","#bfbfbf")),q=e.div(g||(g=n(["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: 8px;\n flex-shrink: 0;\n"],["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: 8px;\n flex-shrink: 0;\n"]))),A=e.div(x||(x=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n color: ",";\n cursor: pointer;\n transition: all "," ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.12);\n color: ",";\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n color: ",";\n cursor: pointer;\n transition: all "," ease;\n\n &:hover {\n background: rgba(0, 0, 0, 0.12);\n color: ",";\n }\n\n svg {\n width: 10px;\n height: 10px;\n }\n"])),j("--zjpcy-text-color-tertiary","rgba(0, 0, 0, 0.45)"),j("--zjpcy-transition-duration","0.2s"),j("--zjpcy-text-color-secondary","rgba(0, 0, 0, 0.65)")),D=e.div(u||(u=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n transition: transform "," ease;\n transform: ",";\n\n svg {\n width: 12px;\n height: 12px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n transition: transform "," ease;\n transform: ",";\n\n svg {\n width: 12px;\n height: 12px;\n }\n"])),j("--zjpcy-text-color-tertiary","rgba(0, 0, 0, 0.45)"),j("--zjpcy-transition-duration","0.2s"),function(n){return n.$open?"rotate(180deg)":"rotate(0deg)"}),F=e.div(b||(b=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n animation: select-spin 1s linear infinite;\n\n svg {\n width: 14px;\n height: 14px;\n }\n\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n color: ",";\n animation: select-spin 1s linear infinite;\n\n svg {\n width: 14px;\n height: 14px;\n }\n\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n"])),j("--zjpcy-primary-color","#1890ff")),G=e.div(h||(h=n(["\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n right: 0;\n z-index: ",";\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n box-shadow: ",";\n opacity: ",";\n visibility: ",";\n transform: ",";\n transition: all "," ",";\n overflow: hidden;\n\n &.select-dropdown {\n /* 外部可通过 .select-dropdown 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n right: 0;\n z-index: ",";\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n box-shadow: ",";\n opacity: ",";\n visibility: ",";\n transform: ",";\n transition: all "," ",";\n overflow: hidden;\n\n &.select-dropdown {\n /* 外部可通过 .select-dropdown 选择器覆盖样式 */\n }\n\n ","\n"])),j("--zjpcy-z-index-modal","1000"),j("--zjpcy-bg-color-white","#fff"),j("--zjpcy-border-color-light","#f0f0f0"),j("--zjpcy-border-radius-md","6px"),j("--zjpcy-shadow-lg","0 8px 24px rgba(0, 0, 0, 0.15)"),function(n){return n.$open?1:0},function(n){return n.$open?"visible":"hidden"},function(n){return n.$open?"translateY(0)":"translateY(-8px)"},j("--zjpcy-transition-duration","0.2s"),j("--zjpcy-transition-timing-function","ease-in-out"),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),J=e.div(y||(y=n(["\n max-height: ",";\n overflow-y: auto;\n padding: 4px 0;\n\n /* 滚动条样式 */\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: ",";\n border-radius: 3px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: ",";\n }\n"],["\n max-height: ",";\n overflow-y: auto;\n padding: 4px 0;\n\n /* 滚动条样式 */\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: ",";\n border-radius: 3px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: ",";\n }\n"])),function(n){var e=n.$maxHeight;return e?"".concat(e,"px"):"256px"},j("--zjpcy-border-color","#e8e8e8"),j("--zjpcy-text-color-light","#bfbfbf")),K=e.div(m||(m=n(["\n display: flex;\n align-items: center;\n padding: 10px 12px;\n cursor: ",";\n transition: all "," ease;\n background: ",";\n color: ",";\n opacity: ",";\n\n &:hover {\n background: ",";\n }\n\n &.select-option {\n /* 外部可通过 .select-option 选择器覆盖样式 */\n }\n\n &.select-option-selected {\n font-weight: 500;\n }\n\n &.select-option-active {\n background: ",";\n }\n\n ","\n"],["\n display: flex;\n align-items: center;\n padding: 10px 12px;\n cursor: ",";\n transition: all "," ease;\n background: ",";\n color: ",";\n opacity: ",";\n\n &:hover {\n background: ",";\n }\n\n &.select-option {\n /* 外部可通过 .select-option 选择器覆盖样式 */\n }\n\n &.select-option-selected {\n font-weight: 500;\n }\n\n &.select-option-active {\n background: ",";\n }\n\n ","\n"])),function(n){return n.$disabled?"not-allowed":"pointer"},j("--zjpcy-transition-duration","0.2s"),function(n){return n.$selected?j("--zjpcy-primary-light-color","rgba(24, 100, 240, 0.1)"):"transparent"},function(n){var e=n.$disabled,t=n.$selected;return e?j("--zjpcy-text-color-light","#bfbfbf"):t?j("--zjpcy-primary-color","#1890ff"):j("--zjpcy-text-color","rgba(0, 0, 0, 0.85)")},function(n){return n.$disabled?.6:1},function(n){var e=n.$disabled,t=n.$selected;return e?"transparent":t?j("--zjpcy-primary-light-color","rgba(24, 100, 240, 0.1)"):j("--zjpcy-bg-color","#fafafa")},j("--zjpcy-bg-color","#fafafa"),function(n){var e=n.$styles;return e&&Object.entries(e).map(function(n){var e=n[0],t=n[1];return"".concat(e,": ").concat(t,";")}).join("\n")}),L=e.div(w||(w=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n color: ",";\n\n svg {\n width: 14px;\n height: 14px;\n }\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n color: ",";\n\n svg {\n width: 14px;\n height: 14px;\n }\n"])),j("--zjpcy-primary-color","#1890ff")),M=e.div(v||(v=n(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px 16px;\n color: ",";\n font-size: 14px;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px 16px;\n color: ",";\n font-size: 14px;\n"])),j("--zjpcy-text-color-tertiary","rgba(0, 0, 0, 0.45)")),N=function(){if("undefined"!=typeof document){var n="select-global-styles";if(!document.getElementById(n)){var e=document.createElement("style");e.id=n,e.textContent="\n @keyframes select-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}}};export{D as Arrow,L as CheckIcon,A as ClearButton,G as Dropdown,M as Empty,$ as Label,k as LabelWrapper,F as LoadingIcon,K as Option,J as OptionList,E as Placeholder,_ as SearchInput,O as Selector,C as SelectorContent,Y as SingleValue,q as SuffixArea,H as Tag,I as TagClose,B as TagsContainer,z as Wrapper,N as injectGlobalStyles};
@@ -1 +1 @@
1
- import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as a,useRef as t,useEffect as o,useCallback as l,useMemo as i}from"react";var c=function(c){var d,u=c.min,s=void 0===u?0:u,m=c.max,v=void 0===m?100:m,h=c.step,f=void 0===h?1:h,k=c.value,C=c.defaultValue,p=void 0===C?0:C,b=c.disabled,g=void 0!==b&&b,M=c.marks,w=void 0===M?{}:M,x=c.showValue,L=void 0!==x&&x,N=c.trackColor,y=void 0===N?"#1890ff":N,A=c.handleColor,E=void 0===A?"#1890ff":A,D=c.gradient,F=c.onChange,j=c.onAfterChange,X=c.className,P=void 0===X?"":X,R=c.style,U=a(p),V=U[0],q=U[1],B=a(!1),H=B[0],I=B[1],K=t(null),O=t(null),S=t(void 0!==k?k:p),T=void 0!==k,_=T?k:V;o(function(){S.current=_},[_]);var z=l(function(e){var r=(e-s)/(v-s);return Math.max(0,Math.min(1,r))},[s,v]),G=l(function(e){var r=Math.max(0,Math.min(1,e)),n=s+r*(v-s);if(f>0){var a=Math.round(n/f)*f;return Math.min(v,Math.max(s,a))}return Math.min(v,Math.max(s,n))},[s,v,f]),J=function(e){return"touches"in e?e.touches[0].clientX:e.clientX},Q=l(function(e){K.current&&!g&&(O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame(function(){var r=K.current.getBoundingClientRect(),n=(e-r.left)/r.width,a=G(n);a!==S.current&&(S.current=a,T||q(a),null==F||F(a))}))},[g,T,G,F]),W=function(e){if(!g){e.preventDefault(),I(!0);var r=J(e);Q(r)}};o(function(){if(H){var e=function(e){e.preventDefault();var r=J(e);Q(r)},r=function(){I(!1),O.current&&(cancelAnimationFrame(O.current),O.current=null),null==j||j(S.current)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),O.current&&(cancelAnimationFrame(O.current),O.current=null)}}},[H,Q,j]);var Y=z(_),Z=i(function(){return Object.entries(w).map(function(e){var r=e[0],n=e[1],a=Number(r),t="string"==typeof n?{trackColor:void 0,handleColor:void 0,mark:n}:n;return{value:a,label:t.mark,trackColor:t.trackColor,handleColor:t.handleColor,position:z(a)}}).sort(function(e,r){return e.value-r.value})},[w,z]),$=i(function(){for(var e=0;e<Z.length;e++){var r=Z[e];if(_<=r.value)return{trackColor:r.trackColor,handleColor:r.handleColor,mark:r.label}}var n=Z[Z.length-1];return n?{trackColor:n.trackColor,handleColor:n.handleColor,mark:n.label}:{trackColor:void 0,handleColor:void 0,mark:""}},[Z,_]),ee=R&&R["--idp-slider-track-filled-bg"],re=R&&R["--idp-slider-handle-border"],ne=D&&!$.trackColor&&!ee&&"#1890ff"===y,ae=$.trackColor||ee||y,te=$.handleColor||re||E;return r("div",{className:"slider-container ".concat(g?"disabled":""," ").concat(H?"dragging":""," ").concat(P),style:e((d={},d["--idp-slider-track-filled-bg"]=ae,d["--idp-slider-handle-border"]="2px solid ".concat(te),d),R),children:[r("div",{ref:K,className:"slider-track",onClick:function(e){g||(e.target.classList.contains("slider-handle")||(Q(e.clientX),null==j||j(_)))},role:"presentation",children:[n("div",{className:"slider-track-filled",style:e({width:"".concat(100*Y,"%")},ne&&D?{background:"linear-gradient(to right, ".concat(D.startColor,", ").concat(D.endColor,")")}:{})}),n("div",{className:"slider-handle",style:{left:"".concat(100*Y,"%")},onMouseDown:W,onTouchStart:W,onKeyDown:function(e){if(!g){var r=_;switch(e.key){case"ArrowLeft":case"ArrowDown":r=Math.max(s,_-f);break;case"ArrowRight":case"ArrowUp":r=Math.min(v,_+f);break;case"Home":r=s;break;case"End":r=v;break;case"PageDown":r=Math.max(s,_-10*f);break;case"PageUp":r=Math.min(v,_+10*f);break;default:return}e.preventDefault(),void 0===k&&q(r),null==F||F(r),null==j||j(r)}},role:"slider","aria-valuemin":s,"aria-valuemax":v,"aria-valuenow":_,"aria-disabled":g,tabIndex:g?-1:0,children:n("div",{className:"slider-tooltip",children:_})})]}),Z.length>0&&n("div",{className:"slider-marks",children:Z.map(function(e){return n("div",{className:"slider-mark",style:{left:"".concat(100*e.position,"%"),color:e.trackColor||void 0},children:e.label},e.value)})}),L&&r("div",{className:"slider-value-display",children:["当前值:",_]})]})},d=c;export{c as Slider,d as default};
1
+ import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as a,useRef as t,useEffect as o,useCallback as l,useMemo as i}from"react";var c=function(c){var d,u=c.min,s=void 0===u?0:u,m=c.max,v=void 0===m?100:m,h=c.step,f=void 0===h?1:h,k=c.value,C=c.defaultValue,p=void 0===C?0:C,b=c.disabled,g=void 0!==b&&b,M=c.marks,w=void 0===M?{}:M,y=c.showValue,x=void 0!==y&&y,L=c.trackColor,N=void 0===L?"#1890ff":L,A=c.handleColor,E=void 0===A?"#1890ff":A,j=c.gradient,D=c.onChange,z=c.onAfterChange,F=c.className,X=void 0===F?"":F,P=c.style,R=a(p),U=R[0],V=R[1],q=a(!1),B=q[0],H=q[1],I=t(null),K=t(null),O=t(void 0!==k?k:p),S=void 0!==k,T=S?k:U;o(function(){O.current=T},[T]);var _=l(function(e){var r=(e-s)/(v-s);return Math.max(0,Math.min(1,r))},[s,v]),G=l(function(e){var r=Math.max(0,Math.min(1,e)),n=s+r*(v-s);if(f>0){var a=Math.round(n/f)*f;return Math.min(v,Math.max(s,a))}return Math.min(v,Math.max(s,n))},[s,v,f]),J=function(e){return"touches"in e?e.touches[0].clientX:e.clientX},Q=l(function(e){I.current&&!g&&(K.current&&cancelAnimationFrame(K.current),K.current=requestAnimationFrame(function(){var r=I.current.getBoundingClientRect(),n=(e-r.left)/r.width,a=G(n);a!==O.current&&(O.current=a,S||V(a),null==D||D(a))}))},[g,S,G,D]),W=function(e){if(!g){e.preventDefault(),H(!0);var r=J(e);Q(r)}};o(function(){if(B){var e=function(e){e.preventDefault();var r=J(e);Q(r)},r=function(){H(!1),K.current&&(cancelAnimationFrame(K.current),K.current=null),null==z||z(O.current)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),K.current&&(cancelAnimationFrame(K.current),K.current=null)}}},[B,Q,z]);var Y=_(T),Z=i(function(){return Object.entries(w).map(function(e){var r=e[0],n=e[1],a=Number(r),t="string"==typeof n?{trackColor:void 0,handleColor:void 0,mark:n}:n;return{value:a,label:t.mark,trackColor:t.trackColor,handleColor:t.handleColor,position:_(a)}}).sort(function(e,r){return e.value-r.value})},[w,_]),$=i(function(){for(var e=0;e<Z.length;e++){var r=Z[e];if(T<=r.value)return{trackColor:r.trackColor,handleColor:r.handleColor,mark:r.label}}var n=Z[Z.length-1];return n?{trackColor:n.trackColor,handleColor:n.handleColor,mark:n.label}:{trackColor:void 0,handleColor:void 0,mark:""}},[Z,T]),ee=P&&P["--zjpcy-slider-track-filled-bg"],re=P&&P["--zjpcy-slider-handle-border"],ne=j&&!$.trackColor&&!ee&&"#1890ff"===N,ae=$.trackColor||ee||N,te=$.handleColor||re||E;return r("div",{className:"slider-container ".concat(g?"slider-container-disabled":""," ").concat(B?"slider-container-dragging":""," ").concat(X),style:e((d={},d["--zjpcy-slider-track-filled-bg"]=ae,d["--zjpcy-slider-handle-border"]="2px solid ".concat(te),d),P),children:[r("div",{ref:I,className:"slider-track",onClick:function(e){g||(e.target.classList.contains("slider-handle")||(Q(e.clientX),null==z||z(T)))},role:"presentation",children:[n("div",{className:"slider-track-filled",style:e({width:"".concat(100*Y,"%")},ne&&j?{background:"linear-gradient(to right, ".concat(j.startColor,", ").concat(j.endColor,")")}:{})}),n("div",{className:"slider-handle",style:{left:"".concat(100*Y,"%")},onMouseDown:W,onTouchStart:W,onKeyDown:function(e){if(!g){var r=T;switch(e.key){case"ArrowLeft":case"ArrowDown":r=Math.max(s,T-f);break;case"ArrowRight":case"ArrowUp":r=Math.min(v,T+f);break;case"Home":r=s;break;case"End":r=v;break;case"PageDown":r=Math.max(s,T-10*f);break;case"PageUp":r=Math.min(v,T+10*f);break;default:return}e.preventDefault(),void 0===k&&V(r),null==D||D(r),null==z||z(r)}},role:"slider","aria-valuemin":s,"aria-valuemax":v,"aria-valuenow":T,"aria-disabled":g,tabIndex:g?-1:0,children:n("div",{className:"slider-tooltip",children:T})})]}),Z.length>0&&n("div",{className:"slider-marks",children:Z.map(function(e){return n("div",{className:"slider-mark",style:{left:"".concat(100*e.position,"%"),color:e.trackColor||void 0},children:e.label},e.value)})}),x&&r("div",{className:"slider-value-display",children:["当前值:",T]})]})},d=c;export{c as Slider,d as default};
@@ -1 +1 @@
1
- import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useState as e,useEffect as c,useMemo as s}from"react";var t=function(e){var c=e.size;return n("svg",{viewBox:"0 0 24 24",className:"idp-spin-icon",style:{width:c,height:c},children:[i("circle",{className:"idp-spin-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"}),i("circle",{className:"idp-spin-indicator",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"})]})},a={small:16,default:24,large:32},r=function(r){var l=r.spinning,d=void 0===l||l,o=r.indicator,p=r.tip,u=r.size,m=void 0===u?"default":u,f=r.delay,v=void 0===f?0:f,h=r.className,N=void 0===h?"":h,y=r.style,k=r.children,x=r.fullscreen,g=void 0!==x&&x,w=e(d),z=w[0],T=w[1],W=e(0===v),j=W[0],B=W[1];c(function(){if(d){if(T(!0),v>0){var i=setTimeout(function(){B(!0)},v);return function(){return clearTimeout(i)}}B(!0)}else T(!1),B(!1)},[d,v]);var b=a[m],q=s(function(){return o||i(t,{size:b})},[o,b]),A=function(){return n("div",{className:"idp-spin-content ".concat(p?"idp-spin-has-tip":""),children:[q,p&&i("div",{className:"idp-spin-tip",children:p})]})};return g?z&&j?i("div",{className:"idp-spin-fullscreen ".concat(N),style:y,children:A()}):null:k?n("div",{className:"idp-spin-nested-wrapper ".concat(N),style:y,children:[k,z&&j&&i("div",{className:"idp-spin-mask idp-spin-mask-".concat(m),children:A()})]}):z&&j?i("div",{className:"idp-spin idp-spin-".concat(m," ").concat(N),style:y,children:A()}):null};export{r as default};
1
+ import{jsx as i,jsxs as c}from"react/jsx-runtime";import{useState as e,useEffect as n,useMemo as s}from"react";var t=function(e){var n=e.size,s=e.sizeType;return c("svg",{viewBox:"0 0 24 24",className:"zjpcy-spin-icon zjpcy-spin-icon-".concat(s),style:{width:n,height:n},children:[i("circle",{className:"zjpcy-spin-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"}),i("circle",{className:"zjpcy-spin-indicator",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"})]})},r={small:16,default:24,large:32},a=function(a){var l=a.spinning,o=void 0===l||l,p=a.indicator,d=a.tip,u=a.size,y=void 0===u?"default":u,m=a.delay,f=void 0===m?0:m,v=a.className,z=void 0===v?"":v,h=a.style,j=a.children,N=a.fullscreen,x=void 0!==N&&N,g=e(o),k=g[0],T=g[1],w=e(0===f),W=w[0],B=w[1];n(function(){if(o){if(T(!0),f>0){var i=setTimeout(function(){B(!0)},f);return function(){return clearTimeout(i)}}B(!0)}else T(!1),B(!1)},[o,f]);var b=r[y],q=s(function(){return p||i(t,{size:b,sizeType:y})},[p,b,y]),A=function(){return c("div",{className:"zjpcy-spin-content ".concat(d?"zjpcy-spin-content-tip":""),children:[q,d&&i("div",{className:"zjpcy-spin-tip zjpcy-spin-tip-".concat(y),children:d})]})};return x?k&&W?i("div",{className:"zjpcy-spin-fullscreen ".concat(z),style:h,children:A()}):null:j?c("div",{className:"zjpcy-spin-nested-wrapper ".concat(z),style:h,children:[j,k&&W&&i("div",{className:"zjpcy-spin-mask",children:A()})]}):k&&W?i("div",{className:"zjpcy-spin ".concat(z),style:h,children:A()}):null};export{a as default};
@@ -1 +1 @@
1
- import{__spreadArray as e}from"../node_modules/tslib/tslib.es6.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r,{useRef as i,useState as o,useMemo as u,useCallback as a,useEffect as s}from"react";import{parseSizeConfig as l,parseNumberConfig as c,parseSizeToPixels as d,getContainerStyle as m,getPanelStyle as v,getSplitterBarStyle as f,getSplitterLineStyle as p}from"./styles.js";var h=function(h){var g=h.layout,z=void 0===g?"horizontal":g,S=h.panels,x=h.defaultSize,b=void 0===x?"50%":x,E=h.minSize,y=void 0===E?50:E,_=h.maxSize,L=void 0===_?1/0:_,w=h.splitterSize,D=h.lineColor,j=h.lineHoverColor,M=h.disabled,N=void 0!==M&&M,C=h.onResize,I=h.onResizeEnd,P=h.className,X=void 0===P?"":P,Y=h.style,B=h.left,O=h.right,R=h.top,A=h.bottom,q=h.children,F=i(null),H=o([]),T=H[0],V=H[1],k=o(!1),G=k[0],J=k[1],K=o(-1),Q=K[0],U=K[1],W=i({isDragging:!1,startPosition:0,startSizes:[],containerSize:0,splitterIndex:-1}),Z=u(function(){if(S&&S.length>0)return S.map(function(e){return e.content});if("vertical"===z){if(R&&A)return[R,A]}else if(B&&O)return[B,O];return q&&Array.isArray(q)?q:[]},[S,z,B,O,R,A,q]),$=Z.length,ee=a(function(e){return S&&S[e]?S[e]:{}},[S]),te=a(function(){if(!F.current)return 0;var e=F.current.getBoundingClientRect();return"horizontal"===z?e.width:e.height},[z]),ne=a(function(){if(void 0!==w)return w;var e=getComputedStyle(document.documentElement).getPropertyValue("--idp-splitter-bar-size").trim();return parseInt(e,10)||10},[w]);s(function(){var e=te();if(e>0&&$>0){var t=ne()*($-1),n=Math.max(0,e-t),r=l(b,$,"".concat(100/$,"%")),i=c(y,$,50),o=c(L,$,1/0),u=S?S.map(function(e){var t;return null!==(t=e.defaultSize)&&void 0!==t?t:r[S.indexOf(e)]}):r,a=S?S.map(function(e){var t;return null!==(t=e.minSize)&&void 0!==t?t:i[S.indexOf(e)]}):i,s=S?S.map(function(e){var t;return null!==(t=e.maxSize)&&void 0!==t?t:o[S.indexOf(e)]}):o,m=u.map(function(e){return d(e,n)}),v=m.reduce(function(e,t){return e+t},0);if(v!==n&&n>0){var f=n/v;m=m.map(function(e){return e*f})}m=m.map(function(e,t){return Math.max(a[t],Math.min(s[t],e))}),V(m)}},[$]),s(function(){var e=function(){var e=te();if(e>0&&T.length>0){var t=ne()*($-1),n=Math.max(0,e-t),r=T.reduce(function(e,t){return e+t},0);if(r>0){var i=n/r;V(function(e){return e.map(function(e){return e*i})})}}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[T,$,te,ne]);var re=a(function(t){return function(n){if(!N){var r=ee(t),i=ee(t+1);if(!r.disabled&&!i.disabled){n.preventDefault();var o="touches"in n?n.touches[0].clientX:n.clientX,u="touches"in n?n.touches[0].clientY:n.clientY,a="horizontal"===z?o:u,s=te();W.current={isDragging:!0,startPosition:a,startSizes:e([],T,!0),containerSize:s,splitterIndex:t},J(!0),U(t)}}}},[N,z,T,te,ee]),ie=a(function(t){if(W.current.isDragging&&!N){var n="touches"in t?t.touches[0].clientX:t.clientX,r="touches"in t?t.touches[0].clientY:t.clientY,i=("horizontal"===z?n:r)-W.current.startPosition,o=W.current.splitterIndex,u=W.current.startSizes,a=c(y,$,50),s=c(L,$,1/0),l=S?S.map(function(e,t){var n;return null!==(n=e.minSize)&&void 0!==n?n:a[t]}):a,d=S?S.map(function(e,t){var n;return null!==(n=e.maxSize)&&void 0!==n?n:s[t]}):s,m=l[o],v=d[o],f=l[o+1],p=d[o+1],h=u[o],g=u[o+1],x=h+i,b=g-i;x<m?(x=m,b=h+g-m):x>v&&(x=v,b=h+g-v),b<f?(b=f,x=h+g-f):b>p&&(b=p,x=h+g-p);var E=e([],T,!0);E[o]=x,E[o+1]=b,V(E),null==C||C(E,o)}},[N,z,T,$,y,L,S,C]),oe=a(function(){W.current.isDragging&&(W.current.isDragging=!1,J(!1),U(-1),null==I||I(T))},[T,I]);if(s(function(){if(G)return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",oe),document.addEventListener("touchmove",ie,{passive:!1}),document.addEventListener("touchend",oe),function(){document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",oe),document.removeEventListener("touchmove",ie),document.removeEventListener("touchend",oe)}},[G,ie,oe]),$<2)return console.warn("Splitter requires at least 2 panels"),null;var ue=["idp-splitter","idp-splitter--".concat(z),G?"idp-splitter--dragging":"",X].filter(Boolean).join(" ");return t("div",{ref:F,className:ue,style:m(z,Y),children:Z.map(function(e,i){var o=T[i]||0,u=i===$-1;return n(r.Fragment,{children:[t("div",{className:"idp-splitter__panel",style:v(o,z,i,$),children:e}),!u&&t("div",{className:["idp-splitter__bar",Q===i?"idp-splitter__bar--dragging":"",N||ee(i).disabled||ee(i+1).disabled?"idp-splitter__bar--disabled":""].filter(Boolean).join(" "),style:f(z,w,N,i),onMouseDown:re(i),onTouchStart:re(i),children:t("div",{className:"idp-splitter__line",style:p(z,D,j,G,Q===i)})})]},i)})})},g=h;export{h as Splitter,g as default};
1
+ import{__spreadArray as e}from"../node_modules/tslib/tslib.es6.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r,{useRef as i,useState as o,useMemo as u,useCallback as a,useEffect as c}from"react";import{parseSizeConfig as s,parseNumberConfig as l,parseSizeToPixels as d,getContainerStyle as m,getPanelStyle as v,getSplitterBarStyle as f,getSplitterLineStyle as p}from"./styles.js";var h=function(h){var z=h.layout,g=void 0===z?"horizontal":z,y=h.panels,S=h.defaultSize,j=void 0===S?"50%":S,x=h.minSize,b=void 0===x?50:x,E=h.maxSize,_=void 0===E?1/0:E,L=h.splitterSize,w=h.lineColor,D=h.lineHoverColor,M=h.disabled,N=void 0!==M&&M,C=h.onResize,I=h.onResizeEnd,P=h.className,X=void 0===P?"":P,Y=h.style,B=h.left,O=h.right,R=h.top,A=h.bottom,q=h.children,F=i(null),H=o([]),T=H[0],V=H[1],k=o(!1),G=k[0],J=k[1],K=o(-1),Q=K[0],U=K[1],W=i({isDragging:!1,startPosition:0,startSizes:[],containerSize:0,splitterIndex:-1}),Z=u(function(){if(y&&y.length>0)return y.map(function(e){return e.content});if("vertical"===g){if(R&&A)return[R,A]}else if(B&&O)return[B,O];return q&&Array.isArray(q)?q:[]},[y,g,B,O,R,A,q]),$=Z.length,ee=a(function(e){return y&&y[e]?y[e]:{}},[y]),te=a(function(){if(!F.current)return 0;var e=F.current.getBoundingClientRect();return"horizontal"===g?e.width:e.height},[g]),ne=a(function(){if(void 0!==L)return L;var e=getComputedStyle(document.documentElement).getPropertyValue("--zjpcy-splitter-bar-size").trim();return parseInt(e,10)||10},[L]);c(function(){var e=te();if(e>0&&$>0){var t=ne()*($-1),n=Math.max(0,e-t),r=s(j,$,"".concat(100/$,"%")),i=l(b,$,50),o=l(_,$,1/0),u=y?y.map(function(e){var t;return null!==(t=e.defaultSize)&&void 0!==t?t:r[y.indexOf(e)]}):r,a=y?y.map(function(e){var t;return null!==(t=e.minSize)&&void 0!==t?t:i[y.indexOf(e)]}):i,c=y?y.map(function(e){var t;return null!==(t=e.maxSize)&&void 0!==t?t:o[y.indexOf(e)]}):o,m=u.map(function(e){return d(e,n)}),v=m.reduce(function(e,t){return e+t},0);if(v!==n&&n>0){var f=n/v;m=m.map(function(e){return e*f})}m=m.map(function(e,t){return Math.max(a[t],Math.min(c[t],e))}),V(m)}},[$]),c(function(){var e=function(){var e=te();if(e>0&&T.length>0){var t=ne()*($-1),n=Math.max(0,e-t),r=T.reduce(function(e,t){return e+t},0);if(r>0){var i=n/r;V(function(e){return e.map(function(e){return e*i})})}}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[T,$,te,ne]);var re=a(function(t){return function(n){if(!N){var r=ee(t),i=ee(t+1);if(!r.disabled&&!i.disabled){n.preventDefault();var o="touches"in n?n.touches[0].clientX:n.clientX,u="touches"in n?n.touches[0].clientY:n.clientY,a="horizontal"===g?o:u,c=te();W.current={isDragging:!0,startPosition:a,startSizes:e([],T,!0),containerSize:c,splitterIndex:t},J(!0),U(t)}}}},[N,g,T,te,ee]),ie=a(function(t){if(W.current.isDragging&&!N){var n="touches"in t?t.touches[0].clientX:t.clientX,r="touches"in t?t.touches[0].clientY:t.clientY,i=("horizontal"===g?n:r)-W.current.startPosition,o=W.current.splitterIndex,u=W.current.startSizes,a=l(b,$,50),c=l(_,$,1/0),s=y?y.map(function(e,t){var n;return null!==(n=e.minSize)&&void 0!==n?n:a[t]}):a,d=y?y.map(function(e,t){var n;return null!==(n=e.maxSize)&&void 0!==n?n:c[t]}):c,m=s[o],v=d[o],f=s[o+1],p=d[o+1],h=u[o],z=u[o+1],S=h+i,j=z-i;S<m?(S=m,j=h+z-m):S>v&&(S=v,j=h+z-v),j<f?(j=f,S=h+z-f):j>p&&(j=p,S=h+z-p);var x=e([],T,!0);x[o]=S,x[o+1]=j,V(x),null==C||C(x,o)}},[N,g,T,$,b,_,y,C]),oe=a(function(){W.current.isDragging&&(W.current.isDragging=!1,J(!1),U(-1),null==I||I(T))},[T,I]);if(c(function(){if(G)return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",oe),document.addEventListener("touchmove",ie,{passive:!1}),document.addEventListener("touchend",oe),function(){document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",oe),document.removeEventListener("touchmove",ie),document.removeEventListener("touchend",oe)}},[G,ie,oe]),$<2)return console.warn("Splitter requires at least 2 panels"),null;var ue=["zjpcy-splitter","zjpcy-splitter-".concat(g),G?"zjpcy-splitter-dragging":"",X].filter(Boolean).join(" ");return t("div",{ref:F,className:ue,style:m(g,Y),children:Z.map(function(e,i){var o=T[i]||0,u=i===$-1;return n(r.Fragment,{children:[t("div",{className:"zjpcy-splitter__panel",style:v(o,g,i,$),children:e}),!u&&t("div",{className:["zjpcy-splitter__bar",Q===i?"zjpcy-splitter__bar-dragging":"",N||ee(i).disabled||ee(i+1).disabled?"zjpcy-splitter__bar-disabled":""].filter(Boolean).join(" "),style:f(g,L,N,i),onMouseDown:re(i),onTouchStart:re(i),children:t("div",{className:"zjpcy-splitter__line",style:p(g,w,D,G,Q===i)})})]},i)})})},z=h;export{h as Splitter,z as default};
@@ -1 +1 @@
1
- import{__assign as i,__spreadArray as r}from"../node_modules/tslib/tslib.es6.js";var t=function(r,t){return i({display:"flex",flexDirection:"horizontal"===r?"row":"column",alignItems:"stretch",width:"100%",height:"100%",overflow:"hidden",background:"var(--idp-splitter-panel-bg)",borderRadius:"var(--idp-splitter-panel-radius)"},t)},n=function(i,r,t,n){void 0===t&&(t=0),void 0===n&&(n=2);var e={position:"relative",overflow:"auto",flexShrink:0,alignSelf:"stretch",background:"var(--idp-splitter-panel-bg)"};return"horizontal"===r?(e.width="".concat(i,"px"),e.height="auto",e.minHeight="100%"):(e.width="auto",e.minWidth="100%",e.height="".concat(i,"px")),t<n-1&&(e.boxShadow="horizontal"===r?"var(--idp-splitter-panel-shadow)":"var(--idp-splitter-panel-shadow-vertical)",e.zIndex=n-t),e},e=function(i,r,t,n){void 0===n&&(n=0);var e={position:"relative",flexShrink:0,background:t?"var(--idp-bg-color-light)":"var(--idp-splitter-bar-bg)",cursor:t?"not-allowed":"horizontal"===i?"col-resize":"row-resize",userSelect:"none",touchAction:"none",zIndex:10+5*n,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"var(--idp-splitter-shadow-sm)",transition:"all var(--idp-transition-duration) var(--idp-transition-timing-function)"};return void 0!==r&&("horizontal"===i?(e.width="".concat(r,"px"),e.height="100%"):(e.width="100%",e.height="".concat(r,"px"))),t&&(e.opacity="var(--idp-opacity-disabled)"),e},o=function(i,r,t,n,e){void 0===e&&(e=!1);var o={borderRadius:"var(--idp-border-radius-sm)",transition:"all var(--idp-transition-duration) var(--idp-transition-timing-function)"};return"horizontal"===i?(o.width=r?"2px":"var(--idp-splitter-line-width)",o.height=r?"32px":"var(--idp-splitter-line-length)",o.minHeight="var(--idp-splitter-line-min-length)"):(o.width=r?"32px":"var(--idp-splitter-line-length)",o.minWidth="var(--idp-splitter-line-min-length)",o.height=r?"2px":"var(--idp-splitter-line-width)"),e&&n&&t?(o.backgroundColor=t,o.boxShadow="var(--idp-splitter-shadow-active)"):n&&t?(o.backgroundColor=t,o.boxShadow="var(--idp-splitter-shadow-md)"):r?o.backgroundColor=r:o.background="var(--idp-splitter-line-bg)",o},a=function(i,t,n){var e;if(void 0===n&&(n="50%"),void 0===i){var o="".concat(100/t,"%");return new Array(t).fill(o)}if(Array.isArray(i)){for(var a=r([],i,!0);a.length<t;)a.push(null!==(e=a[a.length-1])&&void 0!==e?e:n);return a.slice(0,t)}return new Array(t).fill(i)},l=function(i,t,n){var e;if(void 0===i)return new Array(t).fill(n);if(Array.isArray(i)){for(var o=r([],i,!0);o.length<t;)o.push(null!==(e=o[o.length-1])&&void 0!==e?e:n);return o.slice(0,t)}return new Array(t).fill(i)},d=function(i,r){return"number"==typeof i?i:"string"==typeof i&&i.endsWith("%")?r*(parseFloat(i)/100):parseFloat(i)||r/2};export{t as getContainerStyle,n as getPanelStyle,e as getSplitterBarStyle,o as getSplitterLineStyle,l as parseNumberConfig,a as parseSizeConfig,d as parseSizeToPixels};
1
+ import{__assign as r,__spreadArray as t}from"../node_modules/tslib/tslib.es6.js";var i=function(t,i){return r({display:"flex",flexDirection:"horizontal"===t?"row":"column",alignItems:"stretch",width:"100%",height:"100%",overflow:"hidden",background:"var(--zjpcy-splitter-panel-bg)",borderRadius:"var(--zjpcy-splitter-panel-radius)"},i)},n=function(r,t,i,n){void 0===i&&(i=0),void 0===n&&(n=2);var e={position:"relative",overflow:"auto",flexShrink:0,alignSelf:"stretch",background:"var(--zjpcy-splitter-panel-bg)"};return"horizontal"===t?(e.width="".concat(r,"px"),e.height="auto",e.minHeight="100%"):(e.width="auto",e.minWidth="100%",e.height="".concat(r,"px")),i<n-1&&(e.boxShadow="horizontal"===t?"var(--zjpcy-splitter-panel-shadow)":"var(--zjpcy-splitter-panel-shadow-vertical)",e.zIndex=n-i),e},e=function(r,t,i,n){void 0===n&&(n=0);var e={position:"relative",flexShrink:0,background:i?"var(--zjpcy-bg-color-light)":"var(--zjpcy-splitter-bar-bg)",cursor:i?"not-allowed":"horizontal"===r?"col-resize":"row-resize",userSelect:"none",touchAction:"none",zIndex:10+5*n,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"var(--zjpcy-splitter-shadow-sm)",transition:"all var(--zjpcy-transition-duration) var(--zjpcy-transition-timing-function)"};return void 0!==t&&("horizontal"===r?(e.width="".concat(t,"px"),e.height="100%"):(e.width="100%",e.height="".concat(t,"px"))),i&&(e.opacity="var(--zjpcy-opacity-disabled)"),e},o=function(r,t,i,n,e){void 0===e&&(e=!1);var o={borderRadius:"var(--zjpcy-border-radius-sm)",transition:"all var(--zjpcy-transition-duration) var(--zjpcy-transition-timing-function)"};return"horizontal"===r?(o.width=t?"2px":"var(--zjpcy-splitter-line-width)",o.height=t?"32px":"var(--zjpcy-splitter-line-length)",o.minHeight="var(--zjpcy-splitter-line-min-length)"):(o.width=t?"32px":"var(--zjpcy-splitter-line-length)",o.minWidth="var(--zjpcy-splitter-line-min-length)",o.height=t?"2px":"var(--zjpcy-splitter-line-width)"),e&&n&&i?(o.backgroundColor=i,o.boxShadow="var(--zjpcy-splitter-shadow-active)"):n&&i?(o.backgroundColor=i,o.boxShadow="var(--zjpcy-splitter-shadow-md)"):t?o.backgroundColor=t:o.background="var(--zjpcy-splitter-line-bg)",o},a=function(r,i,n){var e;if(void 0===n&&(n="50%"),void 0===r){var o="".concat(100/i,"%");return new Array(i).fill(o)}if(Array.isArray(r)){for(var a=t([],r,!0);a.length<i;)a.push(null!==(e=a[a.length-1])&&void 0!==e?e:n);return a.slice(0,i)}return new Array(i).fill(r)},l=function(r,i,n){var e;if(void 0===r)return new Array(i).fill(n);if(Array.isArray(r)){for(var o=t([],r,!0);o.length<i;)o.push(null!==(e=o[o.length-1])&&void 0!==e?e:n);return o.slice(0,i)}return new Array(i).fill(r)},c=function(r,t){return"number"==typeof r?r:"string"==typeof r&&r.endsWith("%")?t*(parseFloat(r)/100):parseFloat(r)||t/2};export{i as getContainerStyle,n as getPanelStyle,e as getSplitterBarStyle,o as getSplitterLineStyle,l as parseNumberConfig,a as parseSizeConfig,c as parseSizeToPixels};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import n,{createContext as s,useContext as d,useState as a,useMemo as r}from"react";var c=s(null),l=function(t){var i=t.index,n=t.status,s=t.item;return s.node?e("span",{className:"idp-step-node idp-step-node-".concat(n),children:s.node}):s.title?e("span",{className:"idp-step-node idp-step-node-".concat(n),children:s.title}):s.description?e("span",{className:"idp-step-node idp-step-node-".concat(n),children:s.description}):e("span","finish"===n?{className:"idp-step-node idp-step-node-finish",children:"✓"}:"error"===n?{className:"idp-step-node idp-step-node-error",children:"✕"}:{className:"idp-step-node idp-step-node-".concat(n),children:i+1})},o=function(s){var o=s.item,p=s.index,u=s.isLast,h=n.useRef(null),v=d(c),m=a(0),f=m[0],N=m[1];if(!v)return null;var g=v.current,y=v.status,C=v.direction,x=v.onChange,b=o.status||(p<g?"finish":p===g?y:"wait");n.useEffect(function(){var e;if(h.current&&"panel"===v.type){var t=null===(e=h.current.getBoundingClientRect())||void 0===e?void 0:e.height;N(t||0)}},[h,v]);var k=r(function(){return"panel"!==v.type||0===f?null:e("div",{style:{transform:"translateY(".concat(f/4-8,"px)")},className:"idp-step-arrow",children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:e("path",{d:"M5.5 3L10.5 8L5.5 13",stroke:"currentColor",strokeWidth:"2",fill:"none"})})})},[f,v]),w={};o.tailColor&&(w.backgroundColor=o.tailColor);var L=o.tailType||"solid";return t("div",{className:"idp-step ".concat(C," ").concat(b," ").concat(o.disabled?"disabled":""),onClick:function(){!o.disabled&&x&&p!==g&&x(p)},ref:h,children:[t("div",{className:"idp-step-head",children:[e(l,{index:p,status:b,item:o}),!u&&t(i,{children:["default"===v.type&&e("div",{className:"idp-step-tail idp-step-tail-".concat(L),style:w,children:o.tailTitle&&e("div",{className:"idp-step-tail-title",children:o.tailTitle})}),k]})]}),t("div",{className:"idp-step-content",children:[o.title&&e("div",{className:"idp-step-title",children:o.title}),o.description&&e("div",{className:"idp-step-description",children:o.description})]})]})},p=function(t){var i=t.current,n=void 0===i?0:i,s=t.status,d=void 0===s?"process":s,a=t.direction,r=void 0===a?"horizontal":a,l=t.size,p=void 0===l?"default":l,u=t.type,h=void 0===u?"default":u,v=t.items,m=t.onChange,f=t.className,N=void 0===f?"":f,g=t.style,y={current:n,status:d,direction:r,size:p,type:h,onChange:m};return e(c.Provider,{value:y,children:e("div",{className:"idp-steps ".concat(r," ").concat(p," ").concat(h," ").concat(N),style:g,children:v.map(function(t,i){return e(o,{item:t,index:i,isLast:i===v.length-1},i)})})})};export{p as default};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import i,{createContext as c,useContext as s,useState as a,useMemo as r}from"react";import l from"classnames";var o=c(null),d=function(t){var n=t.index,i=t.status,c=t.item;return c.node?e("span",{className:"zjpcy-step-node zjpcy-step-node-".concat(i),children:c.node}):c.title?e("span",{className:"zjpcy-step-node zjpcy-step-node-".concat(i),children:c.title}):c.description?e("span",{className:"zjpcy-step-node zjpcy-step-node-".concat(i),children:c.description}):e("span","finish"===i?{className:"zjpcy-step-node zjpcy-step-node-finish",children:"✓"}:"error"===i?{className:"zjpcy-step-node zjpcy-step-node-error",children:"✕"}:{className:"zjpcy-step-node zjpcy-step-node-".concat(i),children:n+1})},p=function(c){var p=c.item,u=c.index,y=c.isLast,h=i.useRef(null),m=s(o),v=a(0),z=v[0],f=v[1];if(!m)return null;var j=m.current,N=m.status,g=m.direction,C=m.onChange,x=p.status||(u<j?"finish":u===j?N:"wait");i.useEffect(function(){var e;if(h.current&&"panel"===m.type){var t=null===(e=h.current.getBoundingClientRect())||void 0===e?void 0:e.height;f(t||0)}},[h,m]);var b=r(function(){return"panel"!==m.type||0===z?null:e("div",{style:{transform:"translateY(".concat(z/4-8,"px)")},className:"zjpcy-step-arrow",children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:e("path",{d:"M5.5 3L10.5 8L5.5 13",stroke:"currentColor",strokeWidth:"2",fill:"none"})})})},[z,m]),k={};p.tailColor&&(k.backgroundColor=p.tailColor);var w=p.tailType||"solid";return t("div",{className:l("zjpcy-step","zjpcy-step-direction-".concat(g),"zjpcy-step-".concat(x),{"zjpcy-step-disabled":p.disabled}),onClick:function(){!p.disabled&&C&&u!==j&&C(u)},ref:h,children:[t("div",{className:"zjpcy-step-head",children:[e(d,{index:u,status:x,item:p}),!y&&t(n,{children:["default"===m.type&&e("div",{className:"zjpcy-step-tail zjpcy-step-tail-".concat(w),style:k,children:p.tailTitle&&e("div",{className:"zjpcy-step-tail-title",children:p.tailTitle})}),b]})]}),t("div",{className:"zjpcy-step-content",children:[p.title&&e("div",{className:"zjpcy-step-title",children:p.title}),p.description&&e("div",{className:"zjpcy-step-description",children:p.description})]})]})},u=function(t){var n=t.current,i=void 0===n?0:n,c=t.status,s=void 0===c?"process":c,a=t.direction,r=void 0===a?"horizontal":a,l=t.size,d=void 0===l?"default":l,u=t.type,y=void 0===u?"default":u,h=t.items,m=t.onChange,v=t.className,z=void 0===v?"":v,f=t.style,j={current:i,status:s,direction:r,size:d,type:y,onChange:m};return e(o.Provider,{value:j,children:e("div",{className:"zjpcy-steps ".concat(r," ").concat(d," ").concat(y," ").concat(z),style:f,children:h.map(function(t,n){return e(p,{item:t,index:n,isLast:n===h.length-1},n)})})})};export{u as default};
@@ -1 +1 @@
1
- import{__makeTemplateObject as n}from"../node_modules/tslib/tslib.es6.js";import t from"styled-components";var i,e,c,a,o,r,s=function(n,t){return"var(".concat(n,", ").concat(t,")")},d=t.div(i||(i=n(["\n display: inline-block;\n\n &.switch-wrapper {\n /* 外部可通过 .switch-wrapper 选择器覆盖样式 */\n }\n\n ","\n"],["\n display: inline-block;\n\n &.switch-wrapper {\n /* 外部可通过 .switch-wrapper 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),p=t.div(e||(e=n(["\n position: relative;\n background: ",";\n border-radius: ",";\n transition: ",";\n cursor: ",";\n opacity: ",";\n box-sizing: border-box;\n overflow: hidden;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);\n\n &.switch-track {\n /* 外部可通过 .switch-track 选择器覆盖样式 */\n }\n\n &.switch-track-checked {\n background: ",";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n &.switch-track-disabled {\n cursor: not-allowed;\n opacity: var(--idp-switch-disabled-opacity, 0.65);\n background: ",";\n }\n\n &.switch-track-loading {\n cursor: wait;\n }\n\n &:hover:not(.switch-track-disabled) {\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);\n }\n\n &.switch-track-checked:hover:not(.switch-track-disabled) {\n box-shadow: 0 4px 12px rgba(24, 144, 255, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n ","\n\n ","\n\n ","\n\n ","\n"],["\n position: relative;\n background: ",";\n border-radius: ",";\n transition: ",";\n cursor: ",";\n opacity: ",";\n box-sizing: border-box;\n overflow: hidden;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);\n\n &.switch-track {\n /* 外部可通过 .switch-track 选择器覆盖样式 */\n }\n\n &.switch-track-checked {\n background: ",";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n &.switch-track-disabled {\n cursor: not-allowed;\n opacity: var(--idp-switch-disabled-opacity, 0.65);\n background: ",";\n }\n\n &.switch-track-loading {\n cursor: wait;\n }\n\n &:hover:not(.switch-track-disabled) {\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);\n }\n\n &.switch-track-checked:hover:not(.switch-track-disabled) {\n box-shadow: 0 4px 12px rgba(24, 144, 255, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n ","\n\n ","\n\n ","\n\n ","\n"])),s("--idp-switch-track-bg-gradient","linear-gradient(135deg, #e8e8e8 0%, #d9d9d9 100%)"),s("--idp-switch-track-radius","12px"),s("--idp-switch-transition","all 0.2s ease-in-out"),function(n){return n.$disabled?"not-allowed":"pointer"},function(n){return n.$disabled?"var(--idp-switch-disabled-opacity, 0.65)":1},s("--idp-switch-track-active-gradient","linear-gradient(135deg, #1890ff 0%, #40a9ff 100%)"),s("--idp-switch-disabled-bg","#f5f5f5"),function(n){var t=n.$size,i=n.$hasChildren,e=n.$width;return e?"\n width: ".concat(e,"px;\n min-width: ").concat(e,"px;\n height: ").concat("small"===t?s("--idp-switch-small-height","16px"):s("--idp-switch-default-height","22px"),";\n "):"small"===t?"\n width: ".concat(i?"auto":s("--idp-switch-small-width","28px"),";\n min-width: ").concat(s("--idp-switch-small-width","28px"),";\n height: ").concat(s("--idp-switch-small-height","16px"),";\n "):"\n width: ".concat(i?"auto":s("--idp-switch-default-width","44px"),";\n min-width: ").concat(s("--idp-switch-default-width","44px"),";\n height: ").concat(s("--idp-switch-default-height","22px"),";\n ")},function(n){return n.$checked&&"\n background: ".concat(s("--idp-switch-track-active-gradient","linear-gradient(135deg, #1890ff 0%, #40a9ff 100%)"),";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n ")},function(n){return n.$loading&&"\n cursor: wait;\n "},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),h=t.div(c||(c=n(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n background: linear-gradient(135deg, "," 0%, "," 100%);\n border-radius: ",";\n box-shadow: ",";\n transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;\n z-index: 2;\n\n &.switch-thumb {\n /* 外部可通过 .switch-thumb 选择器覆盖样式 */\n }\n\n &.switch-thumb-checked {\n box-shadow: ",";\n }\n\n ","\n\n ","\n\n ","\n"],["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n background: linear-gradient(135deg, "," 0%, "," 100%);\n border-radius: ",";\n box-shadow: ",";\n transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;\n z-index: 2;\n\n &.switch-thumb {\n /* 外部可通过 .switch-thumb 选择器覆盖样式 */\n }\n\n &.switch-thumb-checked {\n box-shadow: ",";\n }\n\n ","\n\n ","\n\n ","\n"])),s("--idp-switch-thumb-bg","#fff"),s("--idp-bg-color-light","#f5f5f5"),s("--idp-switch-thumb-radius","50%"),s("--idp-switch-thumb-shadow","0 2px 8px rgba(0, 0, 0, 0.15)"),s("--idp-switch-thumb-shadow-active","0 2px 8px rgba(24, 144, 255, 0.4)"),function(n){var t=n.$size,i=n.$checked,e=n.$width,c="small"===t?12:18;if(e){var a="".concat(i?e-c-2:2,"px");return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(a,";\n ")}if("small"===t){var o=i?"14px":"2px";return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(o,";\n ")}var r=i?"24px":"2px";return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(r,";\n ")},function(n){return n.$loading&&"\n animation: idp-switch-thumb-spin 1s linear infinite;\n "},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),l=t.div(a||(a=n(["\n position: absolute;\n top: 50%;\n margin-top: -6px; /* 12px 高度的一半,实现垂直居中 */\n width: ",";\n height: ",";\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.switch-loading-icon {\n /* 外部可通过 .switch-loading-icon 选择器覆盖样式 */\n }\n\n /* SVG 旋转动画 - 以中心点旋转 */\n & > svg {\n width: 100%;\n height: 100%;\n animation: idp-switch-spin 1s linear infinite;\n transform-origin: center center;\n display: block;\n fill: ",";\n }\n\n ","\n\n ","\n"],["\n position: absolute;\n top: 50%;\n margin-top: -6px; /* 12px 高度的一半,实现垂直居中 */\n width: ",";\n height: ",";\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.switch-loading-icon {\n /* 外部可通过 .switch-loading-icon 选择器覆盖样式 */\n }\n\n /* SVG 旋转动画 - 以中心点旋转 */\n & > svg {\n width: 100%;\n height: 100%;\n animation: idp-switch-spin 1s linear infinite;\n transform-origin: center center;\n display: block;\n fill: ",";\n }\n\n ","\n\n ","\n"])),s("--idp-switch-loading-size","12px"),s("--idp-switch-loading-size","12px"),s("--idp-switch-loading-color","#1890ff"),function(n){var t=n.$size,i=n.$checked,e=n.$width,c="small"===t?12:18;return e?"\n left: ".concat((i?e-c-2:2)+(c-12)/2,"px;\n "):"small"===t?"\n left: ".concat((i?14:2)+(c-12)/2,"px;\n "):"\n left: ".concat((i?24:2)+(c-12)/2,"px;\n ")},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),w=t.span(o||(o=n(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: ",";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n font-size: ",";\n color: #fff;\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-right: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-checked-inner {\n /* 外部可通过 .switch-checked-inner 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: 0;\n bottom: 0;\n left: ",";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n font-size: ",";\n color: #fff;\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-right: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-checked-inner {\n /* 外部可通过 .switch-checked-inner 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){return"small"===n.$size?"3px":"4px"},function(n){return"small"===n.$size?"9px":"10px"},function(n){return"small"===n.$size?"14px":"20px"},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),u=t.span(r||(r=n(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: ",";\n display: flex;\n align-items: center;\n justify-content: flex-end;\n font-size: ",";\n color: ",";\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-left: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-unchecked-inner {\n /* 外部可通过 .switch-unchecked-inner 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: 0;\n bottom: 0;\n right: ",";\n display: flex;\n align-items: center;\n justify-content: flex-end;\n font-size: ",";\n color: ",";\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-left: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-unchecked-inner {\n /* 外部可通过 .switch-unchecked-inner 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){return"small"===n.$size?"3px":"4px"},function(n){return"small"===n.$size?"9px":"10px"},s("--idp-text-color-secondary","rgba(0, 0, 0, 0.65)"),function(n){return"small"===n.$size?"14px":"20px"},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),f=function(){if("undefined"!=typeof document&&!document.getElementById("idp-switch-styles")){var n=document.createElement("style");n.id="idp-switch-styles",n.textContent="\n @keyframes idp-switch-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes idp-switch-thumb-spin {\n from { transform: translateY(-50%) rotate(0deg); }\n to { transform: translateY(-50%) rotate(360deg); }\n }\n ",document.head.appendChild(n)}};export{w as CheckedInner,l as LoadingIcon,h as Thumb,p as Track,u as UnCheckedInner,d as Wrapper,f as injectGlobalStyles};
1
+ import{__makeTemplateObject as n}from"../node_modules/tslib/tslib.es6.js";import t from"styled-components";var i,e,c,a,o,r,s=function(n,t){return"var(".concat(n,", ").concat(t,")")},p=t.div(i||(i=n(["\n display: inline-block;\n\n &.switch-wrapper {\n /* 外部可通过 .switch-wrapper 选择器覆盖样式 */\n }\n\n ","\n"],["\n display: inline-block;\n\n &.switch-wrapper {\n /* 外部可通过 .switch-wrapper 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),d=t.div(e||(e=n(["\n position: relative;\n background: ",";\n border-radius: ",";\n transition: ",";\n cursor: ",";\n opacity: ",";\n box-sizing: border-box;\n overflow: hidden;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);\n\n &.switch-track {\n /* 外部可通过 .switch-track 选择器覆盖样式 */\n }\n\n &.switch-track-checked {\n background: ",";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n &.switch-track-disabled {\n cursor: not-allowed;\n opacity: var(--zjpcy-switch-disabled-opacity, 0.65);\n background: ",";\n }\n\n &.switch-track-loading {\n cursor: wait;\n }\n\n &:hover:not(.switch-track-disabled) {\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);\n }\n\n &.switch-track-checked:hover:not(.switch-track-disabled) {\n box-shadow: 0 4px 12px rgba(24, 144, 255, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n ","\n\n ","\n\n ","\n\n ","\n"],["\n position: relative;\n background: ",";\n border-radius: ",";\n transition: ",";\n cursor: ",";\n opacity: ",";\n box-sizing: border-box;\n overflow: hidden;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);\n\n &.switch-track {\n /* 外部可通过 .switch-track 选择器覆盖样式 */\n }\n\n &.switch-track-checked {\n background: ",";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n &.switch-track-disabled {\n cursor: not-allowed;\n opacity: var(--zjpcy-switch-disabled-opacity, 0.65);\n background: ",";\n }\n\n &.switch-track-loading {\n cursor: wait;\n }\n\n &:hover:not(.switch-track-disabled) {\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);\n }\n\n &.switch-track-checked:hover:not(.switch-track-disabled) {\n box-shadow: 0 4px 12px rgba(24, 144, 255, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n }\n\n ","\n\n ","\n\n ","\n\n ","\n"])),s("--zjpcy-switch-track-bg-gradient","linear-gradient(135deg, #e8e8e8 0%, #d9d9d9 100%)"),s("--zjpcy-switch-track-radius","12px"),s("--zjpcy-switch-transition","all 0.2s ease-in-out"),function(n){return n.$disabled?"not-allowed":"pointer"},function(n){return n.$disabled?"var(--zjpcy-switch-disabled-opacity, 0.65)":1},s("--zjpcy-switch-track-active-gradient","linear-gradient(135deg, #1890ff 0%, #40a9ff 100%)"),s("--zjpcy-switch-disabled-bg","#f5f5f5"),function(n){var t=n.$size,i=n.$hasChildren,e=n.$width;return e?"\n width: ".concat(e,"px;\n min-width: ").concat(e,"px;\n height: ").concat("small"===t?s("--zjpcy-switch-small-height","16px"):s("--zjpcy-switch-default-height","22px"),";\n "):"small"===t?"\n width: ".concat(i?"auto":s("--zjpcy-switch-small-width","28px"),";\n min-width: ").concat(s("--zjpcy-switch-small-width","28px"),";\n height: ").concat(s("--zjpcy-switch-small-height","16px"),";\n "):"\n width: ".concat(i?"auto":s("--zjpcy-switch-default-width","44px"),";\n min-width: ").concat(s("--zjpcy-switch-default-width","44px"),";\n height: ").concat(s("--zjpcy-switch-default-height","22px"),";\n ")},function(n){return n.$checked&&"\n background: ".concat(s("--zjpcy-switch-track-active-gradient","linear-gradient(135deg, #1890ff 0%, #40a9ff 100%)"),";\n box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);\n ")},function(n){return n.$loading&&"\n cursor: wait;\n "},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),h=t.div(c||(c=n(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n background: linear-gradient(135deg, "," 0%, "," 100%);\n border-radius: ",";\n box-shadow: ",";\n transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;\n z-index: 2;\n\n &.switch-thumb {\n /* 外部可通过 .switch-thumb 选择器覆盖样式 */\n }\n\n &.switch-thumb-checked {\n box-shadow: ",";\n }\n\n ","\n\n ","\n\n ","\n"],["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n background: linear-gradient(135deg, "," 0%, "," 100%);\n border-radius: ",";\n box-shadow: ",";\n transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;\n z-index: 2;\n\n &.switch-thumb {\n /* 外部可通过 .switch-thumb 选择器覆盖样式 */\n }\n\n &.switch-thumb-checked {\n box-shadow: ",";\n }\n\n ","\n\n ","\n\n ","\n"])),s("--zjpcy-switch-thumb-bg","#fff"),s("--zjpcy-bg-color-light","#f5f5f5"),s("--zjpcy-switch-thumb-radius","50%"),s("--zjpcy-switch-thumb-shadow","0 2px 8px rgba(0, 0, 0, 0.15)"),s("--zjpcy-switch-thumb-shadow-active","0 2px 8px rgba(24, 144, 255, 0.4)"),function(n){var t=n.$size,i=n.$checked,e=n.$width,c="small"===t?12:18;if(e){var a="".concat(i?e-c-2:2,"px");return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(a,";\n ")}if("small"===t){var o=i?"14px":"2px";return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(o,";\n ")}var r=i?"24px":"2px";return"\n width: ".concat(c,"px;\n height: ").concat(c,"px;\n left: ").concat(r,";\n ")},function(n){return n.$loading&&"\n animation: zjpcy-switch-thumb-spin 1s linear infinite;\n "},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),l=t.div(a||(a=n(["\n position: absolute;\n top: 50%;\n margin-top: -6px; /* 12px 高度的一半,实现垂直居中 */\n width: ",";\n height: ",";\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.switch-loading-icon {\n /* 外部可通过 .switch-loading-icon 选择器覆盖样式 */\n }\n\n /* SVG 旋转动画 - 以中心点旋转 */\n & > svg {\n width: 100%;\n height: 100%;\n animation: zjpcy-switch-spin 1s linear infinite;\n transform-origin: center center;\n display: block;\n fill: ",";\n }\n\n ","\n\n ","\n"],["\n position: absolute;\n top: 50%;\n margin-top: -6px; /* 12px 高度的一半,实现垂直居中 */\n width: ",";\n height: ",";\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.switch-loading-icon {\n /* 外部可通过 .switch-loading-icon 选择器覆盖样式 */\n }\n\n /* SVG 旋转动画 - 以中心点旋转 */\n & > svg {\n width: 100%;\n height: 100%;\n animation: zjpcy-switch-spin 1s linear infinite;\n transform-origin: center center;\n display: block;\n fill: ",";\n }\n\n ","\n\n ","\n"])),s("--zjpcy-switch-loading-size","12px"),s("--zjpcy-switch-loading-size","12px"),s("--zjpcy-switch-loading-color","#1890ff"),function(n){var t=n.$size,i=n.$checked,e=n.$width,c="small"===t?12:18;return e?"\n left: ".concat((i?e-c-2:2)+(c-12)/2,"px;\n "):"small"===t?"\n left: ".concat((i?14:2)+(c-12)/2,"px;\n "):"\n left: ".concat((i?24:2)+(c-12)/2,"px;\n ")},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),w=t.span(o||(o=n(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: ",";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n font-size: ",";\n color: #fff;\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-right: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-checked-inner {\n /* 外部可通过 .switch-checked-inner 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: 0;\n bottom: 0;\n left: ",";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n font-size: ",";\n color: #fff;\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-right: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-checked-inner {\n /* 外部可通过 .switch-checked-inner 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){return"small"===n.$size?"3px":"4px"},function(n){return"small"===n.$size?"9px":"10px"},function(n){return"small"===n.$size?"14px":"20px"},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),u=t.span(r||(r=n(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: ",";\n display: flex;\n align-items: center;\n justify-content: flex-end;\n font-size: ",";\n color: ",";\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-left: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-unchecked-inner {\n /* 外部可通过 .switch-unchecked-inner 选择器覆盖样式 */\n }\n\n ","\n"],["\n position: absolute;\n top: 0;\n bottom: 0;\n right: ",";\n display: flex;\n align-items: center;\n justify-content: flex-end;\n font-size: ",";\n color: ",";\n white-space: nowrap;\n user-select: none;\n z-index: 1;\n padding-left: ",";\n font-weight: 500;\n letter-spacing: 0.2px;\n\n &.switch-unchecked-inner {\n /* 外部可通过 .switch-unchecked-inner 选择器覆盖样式 */\n }\n\n ","\n"])),function(n){return"small"===n.$size?"3px":"4px"},function(n){return"small"===n.$size?"9px":"10px"},s("--zjpcy-text-color-secondary","rgba(0, 0, 0, 0.65)"),function(n){return"small"===n.$size?"14px":"20px"},function(n){var t=n.$styles;return t&&Object.entries(t).map(function(n){var t=n[0],i=n[1];return"".concat(t,": ").concat(i,";")}).join("\n")}),f=function(){if("undefined"!=typeof document&&!document.getElementById("zjpcy-switch-styles")){var n=document.createElement("style");n.id="zjpcy-switch-styles",n.textContent="\n @keyframes zjpcy-switch-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes zjpcy-switch-thumb-spin {\n from { transform: translateY(-50%) rotate(0deg); }\n to { transform: translateY(-50%) rotate(360deg); }\n }\n ",document.head.appendChild(n)}};export{w as CheckedInner,l as LoadingIcon,h as Thumb,d as Track,u as UnCheckedInner,p as Wrapper,f as injectGlobalStyles};
@@ -1 +1 @@
1
- import{__assign as r}from"../node_modules/tslib/tslib.es6.js";import{jsx as t}from"react/jsx-runtime";import{useSortable as i}from"@dnd-kit/sortable";import{CSS as e}from"@dnd-kit/utilities";var o=function(o){var a=o.id,n=o.record,s=o.rowIndex,d=o.allColumns,l=o.renderTableCell,m=i({id:a}),f=m.attributes,g=m.listeners,u=m.setNodeRef,c=m.transform,b=m.transition,p=m.isDragging,x={transform:e.Transform.toString(c),transition:b,opacity:p?.5:1,cursor:"grab"};return t("tr",r({ref:u,style:x},f,g,{className:"idp-table-sortable-row ".concat(p?"is-dragging":""),"data-dragging":p,children:d.map(function(r,t){return l(r,n,s,t,d)})}))};export{o as default};
1
+ import{__assign as r}from"../node_modules/tslib/tslib.es6.js";import{jsx as t}from"react/jsx-runtime";import e from"classnames";import{useSortable as o}from"@dnd-kit/sortable";import{CSS as a}from"@dnd-kit/utilities";var i=function(i){var s=i.id,n=i.record,l=i.rowIndex,m=i.allColumns,d=i.renderTableCell,f=o({id:s}),c=f.attributes,g=f.listeners,u=f.setNodeRef,b=f.transform,p=f.transition,j=f.isDragging,y={transform:a.Transform.toString(b),transition:p,opacity:j?.5:1,cursor:"grab"};return t("tr",r({ref:u,style:y},c,g,{className:e("zjpcy-table-sortable-row",{"zjpcy-table-sortable-row-dragging":j}),"data-dragging":j,children:m.map(function(r,t){return d(r,n,l,t,m)})}))};export{i as default};
@@ -1 +1 @@
1
- import{__assign as t,__spreadArray as e,__rest as n}from"../node_modules/tslib/tslib.es6.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import o,{useState as a,useRef as c,useEffect as l,useMemo as d}from"react";import{useSensors as u,useSensor as s,PointerSensor as f,KeyboardSensor as m,DndContext as p,closestCenter as h}from"@dnd-kit/core";import{sortableKeyboardCoordinates as g,SortableContext as v,verticalListSortingStrategy as b,arrayMove as x}from"@dnd-kit/sortable";import y from"../Empty/index.js";import S from"../Pagination/index.js";import w from"../Icon/Icon.js";import k from"./SortableRow.js";import N from"../Tooltip/Tooltip.js";var C=function(C){var I=C.dataSource,z=void 0===I?[]:I,j=C.columns,T=void 0===j?[]:j,E=C.bordered,A=void 0!==E&&E,L=C.scroll,_=void 0===L?{}:L,F=C.rowKey,D=void 0===F?"key":F,M=C.className,P=void 0===M?"":M,V=C.pagination,W=C.empty,q=C.loading,J=void 0!==q&&q,K=C.loadingText,X=void 0===K?"加载中...":K,O=C.loadingDelay,R=C.draggable,B=void 0!==R&&R,G=C.onDragEnd,H=a([]),Q=H[0],Y=H[1],U=a([]),Z=U[0],$=U[1],tt=a([]),et=tt[0],nt=tt[1],rt=a([]),it=rt[0],ot=rt[1],at=a(1),ct=at[0],lt=at[1],dt=a(10),ut=dt[0],st=dt[1],ft=a(J),mt=ft[0],pt=ft[1],ht=a(z),gt=ht[0],vt=ht[1],bt=c(null),xt=c(null),yt=c(null),St=c(null),wt=c(null),kt=c(0),Nt=c(!1),Ct=c(null),It=c(0),zt=a(null),jt=zt[0],Tt=zt[1],Et=a(""),At=Et[0],Lt=Et[1];l(function(){vt(z)},[z]),l(function(){return bt.current&&(clearTimeout(bt.current),bt.current=null),J&&O&&O>0?(pt(!0),bt.current=setTimeout(function(){pt(!1)},O)):pt(J),function(){bt.current&&clearTimeout(bt.current)}},[J,O]),l(function(){V&&"object"==typeof V&&(void 0!==V.current&&lt(V.current),void 0!==V.pageSize&&st(V.pageSize))},[V&&"object"==typeof V?V.current:void 0,V&&"object"==typeof V?V.pageSize:void 0]),l(function(){return function(){wt.current&&cancelAnimationFrame(wt.current),Ct.current&&clearTimeout(Ct.current)}},[]);l(function(){var e=[],n=[],r=[],i=[];T.forEach(function(o,a){var c,l=(c=o.width)?"number"==typeof c?c:parseInt(c,10)||0:0;i[a]=l;var d=t(t({},o),{_index:a});"start"===o.fixed||!0===o.fixed?e.push(d):"end"===o.fixed?n.push(d):r.push(d)}),Y(e),$(n),nt(r),ot(i),requestAnimationFrame(function(){_t.current(0)})},[T]);var _t=c(function(t){xt.current&&xt.current.querySelectorAll('.custom-table th[style*="sticky"], .custom-table td[style*="sticky"]').forEach(function(e){var n=e,r=window.getComputedStyle(n),i=r.left,o=r.right;"auto"!==i&&"0px"!==i?n.style.transform="translateX(".concat(t,"px)"):"auto"!==o&&"0px"!==o&&(n.style.transform="translateX(".concat(-t,"px)"))})}),Ft=function(t,e,n){wt.current&&cancelAnimationFrame(wt.current),wt.current=requestAnimationFrame(function(){e&&e.scrollLeft!==n&&(e.scrollLeft=n),_t.current(n),wt.current=null})},Dt=function(t,e){var n=e||ut,r=n!==ut?1:t;lt(r),st(n),V&&"function"==typeof V.onChange&&V.onChange(r,e)},Mt=function(t,e){if(void 0===t&&(t=ct),void 0===e&&(e=ut),!1===V)return null;var n,r=void 0!==(null==V?void 0:V.total)?V.total:gt.length,i=Math.ceil(r/e)||1,o=Math.min(t,i);if(void 0!==(null==V?void 0:V.total))n=gt;else{var a=(o-1)*e,c=a+e;n=gt.slice(a,c)}return{data:n,total:r,pageSize:e,current:o,totalPages:i}},Pt=function(t,e){return"function"==typeof D?D(t,e):t[D]||e},Vt=function(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t)return String(t);if("boolean"==typeof t)return"";if(Array.isArray(t))return t.map(Vt).join("");if("object"==typeof t&&!o.isValidElement(t)){if(void 0!==t.name)return String(t.name);if(void 0!==t.label)return String(t.label);if(void 0!==t.title)return String(t.title);try{return JSON.stringify(t)}catch(t){return""}}return"object"==typeof t&&t.props&&t.props.children?Vt(t.props.children):""},Wt=function(t,e,n){Tt({rowIndex:t,colKey:e}),Lt(String(n||""))},qt=function(t,e){e.onSave&&e.onSave(t,At),Tt(null),Lt("")},Jt=function(){Tt(null),Lt("")},Kt=function(t,e,n,a,c){var l={width:t.width||"auto",textAlign:t.align||"left",backgroundColor:"white"};if("start"===t.fixed||!0===t.fixed){l.position="sticky";for(var d=0,u=0;u<a;u++)d+=it[u]||0;l.left="".concat(d,"px"),l.zIndex=5}else if("end"===t.fixed){l.position="sticky";var s=0;for(u=c.length-1;u>a;u--)s+=it[u]||0;l.right="".concat(s,"px"),l.zIndex=5}var f=Q.length?Q.length-1:-1,m=Z.length?Q.length+et.length:-1,p=("start"===t.fixed||!0===t.fixed)&&a===f,h="end"===t.fixed&&a===m,g=t.key||t.dataIndex||t._index,v=(null==jt?void 0:jt.rowIndex)===n&&(null==jt?void 0:jt.colKey)===String(g),b=t.dataIndex?e[t.dataIndex]:null;t.render&&(b=t.render(b,e,n));var x=b;if(null!==b&&"object"==typeof b&&!o.isValidElement(b))if(void 0!==b.name)x=String(b.name);else if(void 0!==b.label)x=String(b.label);else if(void 0!==b.title)x=String(b.title);else try{x=JSON.stringify(b)}catch(t){x=""}var y=t.maxLines&&t.maxLines>0,S="";if(t.tooltip&&!v&&!(S=Vt(x))&&t.dataIndex){var k=e[t.dataIndex];S="object"==typeof k?Vt(k):String(k||"")}if(t.editable&&v)return i("td",{style:l,className:"".concat(p?"idp-table-fixed-left-shadow":"").concat(h?" idp-table-fixed-right-shadow":""),children:r("div",{className:"idp-table-edit-cell",onClick:function(t){return t.stopPropagation()},children:[i("input",{type:"text",className:"idp-table-edit-input",value:At,onChange:function(t){return Lt(t.target.value)},autoFocus:!0,onClick:function(t){return t.stopPropagation()}}),r("div",{className:"idp-table-edit-actions",children:[i("span",{className:"idp-table-edit-icon idp-edit-submit",onClick:function(){return qt(e,t)},title:"保存",children:i(w,{type:"check",size:24,color:"#339af0"})}),i("span",{className:"idp-table-edit-icon idp-edit-cancel",onClick:Jt,title:"取消",children:i(w,{type:"close",size:24,color:"#339af0"})})]})]})},t.key||t.dataIndex||t._index);var C=y?i("div",{className:"idp-table-cell-ellipsis",style:{WebkitLineClamp:t.maxLines},children:x}):x,I=S?i(N,{title:S,placement:"top",children:C}):C;return r("td",{style:l,onClick:t.editable?function(){return Wt(n,String(g),b)}:void 0,className:"".concat(p?"idp-table-fixed-left-shadow":"").concat(h?" idp-table-fixed-right-shadow":"").concat(y?" idp-table-cell-has-ellipsis":"").concat(t.editable?" idp-table-editable-cell":""),children:[I,t.editable&&i("span",{className:"idp-table-edit-icon-wrapper",children:i(w,{type:"edit",size:16,color:"#339af0"})})]},t.key||t.dataIndex||t._index)},Xt=u(s(f,{activationConstraint:{distance:8}}),s(m,{coordinateGetter:g})),Ot=function(t){var n=t.active,r=t.over;if(r&&n.id!==r.id){var i=Mt(),o=i?i.data:gt,a=o.findIndex(function(t,e){return String(Pt(t,e))===String(n.id)}),c=o.findIndex(function(t,e){return String(Pt(t,e))===String(r.id)});if(-1!==a&&-1!==c){var l=x(o,a,c);if(i&&V&&"object"==typeof V&&void 0===V.total){var d=(i.current-1)*i.pageSize,u=e([],gt,!0);l.forEach(function(t,e){u[d+e]=t}),vt(u),G&&G(u)}else vt(l),G&&G(l)}}},Rt={width:_.x?"number"==typeof _.x?"".concat(_.x,"px"):_.x:"100%"},Bt={maxHeight:_.y?"number"==typeof _.y?"".concat(_.y,"px"):_.y:"auto",overflowY:_.y?"auto":"visible",overflowX:_.x?"auto":"visible"},Gt=e(e(e([],Q,!0),et,!0),Z,!0),Ht=d(function(){return Mt()},[gt,V,ut,ct]),Qt=Ht?Ht.data:gt;return r("div",{ref:xt,className:"custom-table-container ".concat(A?"bordered":""," ").concat(P," ").concat(B?"draggable":""),style:Rt,children:[mt&&i("div",{className:"custom-table-loading-mask",children:r("div",{className:"custom-table-loading-content",children:[i("div",{className:"custom-table-loading-spinner",children:r("svg",{viewBox:"0 0 24 24",className:"custom-table-loading-icon",children:[i("circle",{className:"custom-table-loading-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"}),i("circle",{className:"custom-table-loading-indicator",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"})]})}),X&&i("div",{className:"custom-table-loading-text",children:X})]})}),i("div",{className:"custom-table-header",ref:yt,onScroll:function(t){if(yt.current&&St.current){var e=t.target;if(e===yt.current){var n=e.scrollLeft;Nt.current=!0,Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(function(){Nt.current=!1},150),Math.abs(n-kt.current)>.5&&(kt.current=n,It.current=n,Ft(yt.current,St.current,n))}}},children:r("table",{className:"custom-table ".concat(A?"bordered":""),children:[i("colgroup",{children:Gt.map(function(t,e){return i("col",{style:{width:t.width||"auto"}},"header-col-".concat(t.dataIndex||t.key||e))})}),i("thead",{children:i("tr",{children:Gt.map(function(t,e){return function(t,e,n){var r={width:t.width||"auto",textAlign:t.align||"left",backgroundColor:"#fafafa !important",top:0};if("start"===t.fixed||!0===t.fixed){r.position="sticky";for(var o=0,a=0;a<e;a++)o+=it[a]||0;r.left="".concat(o,"px"),r.zIndex=10}else if("end"===t.fixed){r.position="sticky";var c=0;for(a=n.length-1;a>e;a--)c+=it[a]||0;r.right="".concat(c,"px"),r.zIndex=10}return i("th",{style:r,children:t.title||""},t.key||t.dataIndex||t._index)}(t,e,Gt)})})})]})}),i("div",{className:"custom-table-body",ref:St,style:Bt,onScroll:function(t){if(yt.current&&St.current){var e=t.target;if(e===St.current){var n=e.scrollLeft;Nt.current=!0,Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(function(){Nt.current=!1},150),Math.abs(n-kt.current)>.5&&(kt.current=n,It.current=n,Ft(St.current,yt.current,n))}}},children:function(){var t=r("table",{className:"custom-table ".concat(A?"bordered":""),children:[i("colgroup",{children:Gt.map(function(t,e){return i("col",{style:{width:t.width||"auto"}},"body-col-".concat(t.dataIndex||t.key||e))})}),i("tbody",{children:B?Qt.map(function(t,e){return i(k,{id:String(Pt(t,e)),record:t,rowIndex:e,columns:T,columnWidths:it,fixedLeftColumns:Q,fixedRightColumns:Z,normalColumns:et,allColumns:Gt,editingCell:jt,editingValue:At,handleEdit:Wt,handleSave:qt,handleCancel:Jt,setEditingValue:Lt,renderTableCell:Kt},Pt(t,e))}):Qt.map(function(t,e){return i("tr",{children:Gt.map(function(n,r){return Kt(n,t,e,r,Gt)})},Pt(t,e))})})]});if(B){var e=Qt.map(function(t,e){return String(Pt(t,e))});return i(p,{sensors:Xt,collisionDetection:h,onDragEnd:Ot,children:i(v,{items:e,strategy:b,children:t})})}return t}()}),0===Qt.length&&i("div",{className:"custom-table-empty",children:W||i(y,{size:"small",description:"暂无数据"})}),function(){if(!1===V||!Ht)return null;var e=Ht.total,r=Ht.current,o=Ht.pageSize,a=n(V||{},["onChange","pageSize","current"]);return i("div",{className:"custom-table-pagination-wrapper",children:i(S,t({total:e,current:r,pageSize:o,onChange:Dt,showTotal:function(t,e){return"第 ".concat(e[0],"-").concat(e[1]," 条,共 ").concat(t," 条")},showSizeChanger:!0,showQuickJumper:!0,align:"flex-end"},a))})}()]})};export{C as default};
1
+ import{__assign as e,__spreadArray as t,__rest as n}from"../node_modules/tslib/tslib.es6.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import o,{useState as a,useRef as c,useEffect as l,useMemo as u}from"react";import d from"classnames";import{useSensors as s,useSensor as f,PointerSensor as m,KeyboardSensor as p,DndContext as h,closestCenter as g}from"@dnd-kit/core";import{sortableKeyboardCoordinates as y,SortableContext as v,verticalListSortingStrategy as b,arrayMove as x}from"@dnd-kit/sortable";import S from"../Empty/index.js";import z from"../Pagination/index.js";import j from"../Icon/Icon.js";import w from"./SortableRow.js";import k from"../Tooltip/Tooltip.js";var N=function(N){var C=N.dataSource,I=void 0===C?[]:C,T=N.columns,E=void 0===T?[]:T,A=N.bordered,L=void 0!==A&&A,_=N.scroll,F=void 0===_?{}:_,D=N.rowKey,M=void 0===D?"key":D,P=N.className,V=void 0===P?"":P,W=N.pagination,q=N.empty,J=N.loading,K=void 0!==J&&J,X=N.loadingText,O=void 0===X?"加载中...":X,R=N.loadingDelay,B=N.draggable,G=void 0!==B&&B,H=N.onDragEnd,Q=a([]),Y=Q[0],U=Q[1],Z=a([]),$=Z[0],ee=Z[1],te=a([]),ne=te[0],re=te[1],ie=a([]),oe=ie[0],ae=ie[1],ce=a(1),le=ce[0],ue=ce[1],de=a(10),se=de[0],fe=de[1],me=a(K),pe=me[0],he=me[1],ge=a(I),ye=ge[0],ve=ge[1],be=c(null),xe=c(null),Se=c(null),ze=c(null),je=c(null),we=c(0),ke=c(!1),Ne=c(null),Ce=c(0),Ie=a(null),Te=Ie[0],Ee=Ie[1],Ae=a(""),Le=Ae[0],_e=Ae[1];l(function(){ve(I)},[I]),l(function(){return be.current&&(clearTimeout(be.current),be.current=null),K&&R&&R>0?(he(!0),be.current=setTimeout(function(){he(!1)},R)):he(K),function(){be.current&&clearTimeout(be.current)}},[K,R]),l(function(){W&&"object"==typeof W&&(void 0!==W.current&&ue(W.current),void 0!==W.pageSize&&fe(W.pageSize))},[W&&"object"==typeof W?W.current:void 0,W&&"object"==typeof W?W.pageSize:void 0]),l(function(){return function(){je.current&&cancelAnimationFrame(je.current),Ne.current&&clearTimeout(Ne.current)}},[]);l(function(){var t=[],n=[],r=[],i=[];E.forEach(function(o,a){var c,l=(c=o.width)?"number"==typeof c?c:parseInt(c,10)||0:0;i[a]=l;var u=e(e({},o),{_index:a});"start"===o.fixed||!0===o.fixed?t.push(u):"end"===o.fixed?n.push(u):r.push(u)}),U(t),ee(n),re(r),ae(i),requestAnimationFrame(function(){Fe.current(0)})},[E]);var Fe=c(function(e){xe.current&&xe.current.querySelectorAll('.custom-table th[style*="sticky"], .custom-table td[style*="sticky"]').forEach(function(t){var n=t,r=window.getComputedStyle(n),i=r.left,o=r.right;"auto"!==i&&"0px"!==i?n.style.transform="translateX(".concat(e,"px)"):"auto"!==o&&"0px"!==o&&(n.style.transform="translateX(".concat(-e,"px)"))})}),De=function(e,t,n){je.current&&cancelAnimationFrame(je.current),je.current=requestAnimationFrame(function(){t&&t.scrollLeft!==n&&(t.scrollLeft=n),Fe.current(n),je.current=null})},Me=function(e,t){var n=t||se,r=n!==se?1:e;ue(r),fe(n),W&&"function"==typeof W.onChange&&W.onChange(r,t)},Pe=function(e,t){if(void 0===e&&(e=le),void 0===t&&(t=se),!1===W)return null;var n,r=void 0!==(null==W?void 0:W.total)?W.total:ye.length,i=Math.ceil(r/t)||1,o=Math.min(e,i);if(void 0!==(null==W?void 0:W.total))n=ye;else{var a=(o-1)*t,c=a+t;n=ye.slice(a,c)}return{data:n,total:r,pageSize:t,current:o,totalPages:i}},Ve=function(e,t){return"function"==typeof M?M(e,t):e[M]||t},We=function(e){if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if("boolean"==typeof e)return"";if(Array.isArray(e))return e.map(We).join("");if("object"==typeof e&&!o.isValidElement(e)){if(void 0!==e.name)return String(e.name);if(void 0!==e.label)return String(e.label);if(void 0!==e.title)return String(e.title);try{return JSON.stringify(e)}catch(e){return""}}return"object"==typeof e&&e.props&&e.props.children?We(e.props.children):""},qe=function(e,t,n){Ee({rowIndex:e,colKey:t}),_e(String(n||""))},Je=function(e,t){t.onSave&&t.onSave(e,Le),Ee(null),_e("")},Ke=function(){Ee(null),_e("")},Xe=function(e,t,n,a,c){var l={width:e.width||"auto",textAlign:e.align||"left",backgroundColor:"white"};if("start"===e.fixed||!0===e.fixed){l.position="sticky";for(var u=0,d=0;d<a;d++)u+=oe[d]||0;l.left="".concat(u,"px"),l.zIndex=5}else if("end"===e.fixed){l.position="sticky";var s=0;for(d=c.length-1;d>a;d--)s+=oe[d]||0;l.right="".concat(s,"px"),l.zIndex=5}var f=Y.length?Y.length-1:-1,m=$.length?Y.length+ne.length:-1,p=("start"===e.fixed||!0===e.fixed)&&a===f,h="end"===e.fixed&&a===m,g=e.key||e.dataIndex||e._index,y=(null==Te?void 0:Te.rowIndex)===n&&(null==Te?void 0:Te.colKey)===String(g),v=e.dataIndex?t[e.dataIndex]:null;e.render&&(v=e.render(v,t,n));var b=v;if(null!==v&&"object"==typeof v&&!o.isValidElement(v))if(void 0!==v.name)b=String(v.name);else if(void 0!==v.label)b=String(v.label);else if(void 0!==v.title)b=String(v.title);else try{b=JSON.stringify(v)}catch(e){b=""}var x=e.maxLines&&e.maxLines>0,S="";if(e.tooltip&&!y&&!(S=We(b))&&e.dataIndex){var z=t[e.dataIndex];S="object"==typeof z?We(z):String(z||"")}if(e.editable&&y)return i("td",{style:l,className:"".concat(p?"zjpcy-table-fixed-left-shadow":"").concat(h?" zjpcy-table-fixed-right-shadow":""),children:r("div",{className:"zjpcy-table-edit-cell",onClick:function(e){return e.stopPropagation()},children:[i("input",{type:"text",className:"zjpcy-table-edit-input",value:Le,onChange:function(e){return _e(e.target.value)},autoFocus:!0,onClick:function(e){return e.stopPropagation()}}),r("div",{className:"zjpcy-table-edit-actions",children:[i("span",{className:"zjpcy-table-edit-icon zjpcy-edit-submit",onClick:function(){return Je(t,e)},title:"保存",children:i(j,{type:"check",size:24,color:"#339af0"})}),i("span",{className:"zjpcy-table-edit-icon zjpcy-edit-cancel",onClick:Ke,title:"取消",children:i(j,{type:"close",size:24,color:"#339af0"})})]})]})},e.key||e.dataIndex||e._index);var w=x?i("div",{className:"zjpcy-table-cell-ellipsis",style:{WebkitLineClamp:e.maxLines},children:b}):b,N=S?i(k,{title:S,placement:"top",children:w}):w;return r("td",{style:l,onClick:e.editable?function(){return qe(n,String(g),v)}:void 0,className:"".concat(p?"zjpcy-table-fixed-left-shadow":"").concat(h?" zjpcy-table-fixed-right-shadow":"").concat(x?" zjpcy-table-cell-has-ellipsis":"").concat(e.editable?" zjpcy-table-editable-cell":""),children:[N,e.editable&&i("span",{className:"zjpcy-table-edit-icon-wrapper",children:i(j,{type:"edit",size:16,color:"#339af0"})})]},e.key||e.dataIndex||e._index)},Oe=s(f(m,{activationConstraint:{distance:8}}),f(p,{coordinateGetter:y})),Re=function(e){var n=e.active,r=e.over;if(r&&n.id!==r.id){var i=Pe(),o=i?i.data:ye,a=o.findIndex(function(e,t){return String(Ve(e,t))===String(n.id)}),c=o.findIndex(function(e,t){return String(Ve(e,t))===String(r.id)});if(-1!==a&&-1!==c){var l=x(o,a,c);if(i&&W&&"object"==typeof W&&void 0===W.total){var u=(i.current-1)*i.pageSize,d=t([],ye,!0);l.forEach(function(e,t){d[u+t]=e}),ve(d),H&&H(d)}else ve(l),H&&H(l)}}},Be={width:F.x?"number"==typeof F.x?"".concat(F.x,"px"):F.x:"100%"},Ge={maxHeight:F.y?"number"==typeof F.y?"".concat(F.y,"px"):F.y:"auto",overflowY:F.y?"auto":"visible",overflowX:F.x?"auto":"visible"},He=t(t(t([],Y,!0),ne,!0),$,!0),Qe=u(function(){return Pe()},[ye,W,se,le]),Ye=Qe?Qe.data:ye;return r("div",{ref:xe,className:d("custom-table-container",{"custom-table-bordered":L,"custom-table-draggable":G},V),style:Be,children:[pe&&i("div",{className:"custom-table-loading-mask",children:r("div",{className:"custom-table-loading-content",children:[i("div",{className:"custom-table-loading-spinner",children:r("svg",{viewBox:"0 0 24 24",className:"custom-table-loading-icon",children:[i("circle",{className:"custom-table-loading-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"}),i("circle",{className:"custom-table-loading-indicator",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"})]})}),O&&i("div",{className:"custom-table-loading-text",children:O})]})}),i("div",{className:"custom-table-header",ref:Se,onScroll:function(e){if(Se.current&&ze.current){var t=e.target;if(t===Se.current){var n=t.scrollLeft;ke.current=!0,Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){ke.current=!1},150),Math.abs(n-we.current)>.5&&(we.current=n,Ce.current=n,De(Se.current,ze.current,n))}}},children:r("table",{className:d("custom-table",{"custom-table-bordered-body":L,"custom-table-header-separator":!L}),children:[i("colgroup",{children:He.map(function(e,t){return i("col",{style:{width:e.width||"auto"}},"header-col-".concat(e.dataIndex||e.key||t))})}),i("thead",{children:i("tr",{children:He.map(function(e,t){return function(e,t,n){var r={width:e.width||"auto",textAlign:e.align||"left",backgroundColor:"#fafafa !important",top:0};if("start"===e.fixed||!0===e.fixed){r.position="sticky";for(var o=0,a=0;a<t;a++)o+=oe[a]||0;r.left="".concat(o,"px"),r.zIndex=10}else if("end"===e.fixed){r.position="sticky";var c=0;for(a=n.length-1;a>t;a--)c+=oe[a]||0;r.right="".concat(c,"px"),r.zIndex=10}return i("th",{style:r,children:e.title||""},e.key||e.dataIndex||e._index)}(e,t,He)})})})]})}),i("div",{className:"custom-table-body",ref:ze,style:Ge,onScroll:function(e){if(Se.current&&ze.current){var t=e.target;if(t===ze.current){var n=t.scrollLeft;ke.current=!0,Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){ke.current=!1},150),Math.abs(n-we.current)>.5&&(we.current=n,Ce.current=n,De(ze.current,Se.current,n))}}},children:function(){var e=r("table",{className:d("custom-table",{"custom-table-bordered-body":L,"custom-table-header-separator":!L}),children:[i("colgroup",{children:He.map(function(e,t){return i("col",{style:{width:e.width||"auto"}},"body-col-".concat(e.dataIndex||e.key||t))})}),i("tbody",{children:G?Ye.map(function(e,t){return i(w,{id:String(Ve(e,t)),record:e,rowIndex:t,columns:E,columnWidths:oe,fixedLeftColumns:Y,fixedRightColumns:$,normalColumns:ne,allColumns:He,editingCell:Te,editingValue:Le,handleEdit:qe,handleSave:Je,handleCancel:Ke,setEditingValue:_e,renderTableCell:Xe},Ve(e,t))}):Ye.map(function(e,t){return i("tr",{children:He.map(function(n,r){return Xe(n,e,t,r,He)})},Ve(e,t))})})]});if(G){var t=Ye.map(function(e,t){return String(Ve(e,t))});return i(h,{sensors:Oe,collisionDetection:g,onDragEnd:Re,children:i(v,{items:t,strategy:b,children:e})})}return e}()}),0===Ye.length&&i("div",{className:"custom-table-empty",children:q||i(S,{size:"small",description:"暂无数据"})}),function(){if(!1===W||!Qe)return null;var t=Qe.total,r=Qe.current,o=Qe.pageSize,a=n(W||{},["onChange","pageSize","current"]);return i("div",{className:"custom-table-pagination-wrapper",children:i(z,e({total:t,current:r,pageSize:o,onChange:Me,showTotal:function(e,t){return"第 ".concat(t[0],"-").concat(t[1]," 条,共 ").concat(e," 条")},showSizeChanger:!0,showQuickJumper:!0,align:"flex-end"},a))})}()]})};export{N as default};
@@ -1 +1 @@
1
- import{__assign as t}from"../node_modules/tslib/tslib.es6.js";import{jsx as e,jsxs as n,Fragment as i}from"react/jsx-runtime";import r,{useState as o,useRef as a,useEffect as s,useMemo as c}from"react";import l from"classnames";import{useSensors as d,useSensor as u,PointerSensor as f,DndContext as b,closestCenter as v}from"@dnd-kit/core";import{SortableContext as m,horizontalListSortingStrategy as p,arrayMove as h,useSortable as y}from"@dnd-kit/sortable";import{CSS as k}from"@dnd-kit/utilities";import g from"../Icon/Icon.js";var _=function(i){var r=i.item,o=i.isActive,a=i.isClosable,s=i.onClick,c=i.onClose,d=i.tabRefs,u=y({id:r.key,disabled:r.disabled}),f=u.attributes,b=u.listeners,v=u.setNodeRef,m=u.transform,p=u.transition,h=u.isDragging,_={transform:k.Transform.toString(m),transition:p,opacity:h?.5:1,zIndex:h?1e3:"auto",position:"relative"};return n("div",{ref:function(t){v(t),t?d.current.set(r.key,t):d.current.delete(r.key)},className:l("idp-tabs-tab",{"idp-tabs-tab--active":o,"idp-tabs-tab--disabled":r.disabled,"idp-tabs-tab--dragging":h}),role:"tab","aria-selected":o,style:_,children:[n("div",t({className:"idp-tabs-tab__drag-handle"},f,b,{onClick:s,style:{cursor:r.disabled?"not-allowed":"grab",display:"flex",alignItems:"center",gap:"6px"},children:[r.icon&&e("span",{className:"idp-tabs-tab__icon",children:r.icon}),e("span",{className:"idp-tabs-tab__label",children:r.label})]})),a&&!r.disabled&&e("span",{className:"idp-tabs-tab__close",onClick:function(t){return c(t)},children:e(g,{type:"close",size:12})})]})},C=function(y){var k=y.items,C=void 0===k?[]:k,N=y.activeKey,L=y.defaultActiveKey,w=y.onChange,z=y.onClose,E=y.tabsClosable,W=void 0!==E&&E,T=y.tabPlacement,A=void 0===T?"top":T,x=y.type,I=void 0===x?"line":x,M=y.onAdd,R=y.className,D=y.style,q=y.contentClassName,F=y.contentStyle,S=y.draggable,j=void 0!==S&&S,B=y.onDragEnd,K=o(function(){return L}),P=K[0],V=K[1],H=a(null),G=a(new Map),J=a(null),O=o({}),Q=O[0],U=O[1],X=o(!1),Y=X[0],Z=X[1],$=o(!1),tt=$[0],et=$[1],nt=o(!1),it=nt[0],rt=nt[1],ot=o(!1),at=ot[0],st=ot[1],ct=a(!1),lt=a(!0),dt=o(!1),ut=dt[0],ft=dt[1],bt=o(C),vt=bt[0],mt=bt[1];s(function(){void 0!==N&&V(N)},[N]),s(function(){mt(C)},[C]),s(function(){var t;if(void 0===N){var e=null===(t=C[0])||void 0===t?void 0:t.key;if(!(!!L&&C.some(function(t){return t.key===L}))||P)if(e)C.some(function(t){return t.key===P})||V(e);else V(void 0);else V(L)}},[C,P,N,L]);var pt=void 0!==N?N:P,ht=c(function(){return C.find(function(t){return t.key===pt})||C[0]},[C,pt]),yt=function(t,e){if(void 0===e&&(e=!0),t&&H.current){var n=G.current.get(t),i=H.current;if(n&&i){var r=i.querySelector(".idp-tabs-indicator"),o=lt.current;if(r&&o&&(r.style.transition="none"),"top"===A||"bottom"===A){if(U({left:n.offsetLeft,width:n.offsetWidth,top:void 0,height:void 0}),!e){var a=n.offsetLeft,s=a+n.offsetWidth,c=i.scrollLeft,l=i.clientWidth;(a<c||s>c+l)&&n.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"})}}else U({top:n.offsetTop,height:n.offsetHeight,left:void 0,width:void 0});r&&o&&e?requestAnimationFrame(function(){r.style.transition="",lt.current=!1}):o&&(lt.current=!1)}}},kt=r.useCallback(function(){if(H.current){var t=H.current,e="top"===A||"bottom"===A;if("card"===I)return Z(!1),et(!1),void rt(!1);if(e){var n=Math.ceil(t.scrollWidth)>Math.floor(t.clientWidth);if(Z(n),n){var i=t.scrollLeft>1;et(i);var r=t.scrollWidth-t.clientWidth,o=t.scrollLeft<r-1;rt(o)}else et(!1),rt(!1)}else Z(!1),et(!1),rt(!1)}},[A,I]),gt=function(t){if(H.current&&!ct.current){var e=H.current,n=e.clientWidth,i=Math.max(200,.6*n);ct.current=!0,"left"===t?e.scrollTo({left:e.scrollLeft-i,behavior:"smooth"}):e.scrollTo({left:e.scrollLeft+i,behavior:"smooth"}),setTimeout(function(){ct.current=!1,kt()},400)}};s(function(){pt&&(yt(pt,!1),kt())},[pt,C,A,kt]),s(function(){kt();var t=requestAnimationFrame(function(){pt&&yt(pt,!1),kt()});return function(){return cancelAnimationFrame(t)}},[kt,pt]),s(function(){var t,e=function(){pt&&yt(pt,!1),kt()},n=function(){clearTimeout(t),t=setTimeout(function(){kt()},100)},i=H.current;return i&&i.addEventListener("scroll",n),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),i&&i.removeEventListener("scroll",n),clearTimeout(t)}},[kt,pt]),s(function(){var t=function(){if(J.current&&H.current&&"card"===I&&M){var t=H.current,e=J.current,n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.right-i.right;ft(r<=20)}else ft(!1)};t();var e=function(){t()},n=H.current;return n&&(n.addEventListener("scroll",e),window.addEventListener("resize",e)),function(){n&&n.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[I,M,C]);var _t=function(t){t.disabled||(void 0===N&&V(t.key),yt(t.key,!0),kt(),null==w||w(t.key))},Ct=function(t,e){t.stopPropagation(),e.disabled||null==z||z(e.key)},Nt=function(){null==M||M(),setTimeout(function(){H.current&&requestAnimationFrame(function(){if(H.current&&G.current.size>0){var t=Array.from(G.current.keys());if(t.length>0){var e=t[t.length-1],n=G.current.get(e),i=H.current;if(n&&i&&J.current)if("card"===I){var r=J.current.offsetWidth+4,o=n.offsetLeft+n.offsetWidth,a=i.clientWidth;if(o-i.scrollLeft>a-r){var s=o-a+r;i.scrollTo({left:s,behavior:"smooth"})}}else n.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"})}}})},100)},Lt=d(u(f,{activationConstraint:{distance:8}})),wt=function(t){},zt=function(t){var e=t.active,n=t.over;if(n&&e.id!==n.id){var i=vt.findIndex(function(t){return t.key===e.id}),r=vt.findIndex(function(t){return t.key===n.id});if(-1!==i&&-1!==r){var o=h(vt,i,r);mt(o),null==B||B(o)}}},Et=function(){var t="top"===A||"bottom"===A,i="card"===I,r=j?vt:C,o=n("div",{className:"idp-tabs-nav-wrapper",onMouseEnter:function(){return st(!0)},onMouseLeave:function(){return st(!1)},children:[t&&Y&&!i&&e("button",{className:l("idp-tabs-nav__button","idp-tabs-nav__button--left",{"idp-tabs-nav__button--disabled":!tt,"idp-tabs-nav__button--visible":at}),onClick:function(){return gt("left")},disabled:!tt,type:"button",children:e(g,{type:"arrowLeft",size:12})}),n("div",{className:"idp-tabs-nav",ref:H,children:[r.map(function(t){return function(t,i,r){return!j||t.disabled||"top"!==A&&"bottom"!==A?n("div",{ref:function(e){e?G.current.set(t.key,e):G.current.delete(t.key)},className:l("idp-tabs-tab",{"idp-tabs-tab--active":i,"idp-tabs-tab--disabled":t.disabled}),role:"tab","aria-selected":i,onClick:function(){return _t(t)},children:[t.icon&&e("span",{className:"idp-tabs-tab__icon",children:t.icon}),e("span",{className:"idp-tabs-tab__label",children:t.label}),r&&!t.disabled&&e("span",{className:"idp-tabs-tab__close",onClick:function(e){return Ct(e,t)},children:e(g,{type:"close",size:12})})]},t.key):e(_,{item:t,isActive:i,isClosable:r,onClick:function(){return _t(t)},onClose:function(e){return Ct(e,t)},tabRefs:G},t.key)}(t,t.key===pt,W||t.closable||!1)}),"card"===I&&M&&e("div",{ref:J,className:l("idp-tabs-tab idp-tabs-tab--add",{sticky:!0===ut}),role:"tab",onClick:Nt,children:e(g,{type:"plus",size:16})}),e("div",{className:"idp-tabs-indicator",style:Q})]}),t&&Y&&!i&&e("button",{className:l("idp-tabs-nav__button","idp-tabs-nav__button--right",{"idp-tabs-nav__button--disabled":!it,"idp-tabs-nav__button--visible":at}),onClick:function(){return gt("right")},disabled:!it,type:"button",children:e(g,{type:"arrowRight",size:12})})]});return!j||i||"top"!==A&&"bottom"!==A?o:e(b,{sensors:Lt,collisionDetection:v,onDragStart:wt,onDragEnd:zt,children:e(m,{items:r.map(function(t){return t.key}),strategy:p,children:o})})},Wt=function(){var n=(null==ht?void 0:ht.renderContent)?ht.renderContent():null==ht?void 0:ht.content,i=l("idp-tabs-content","idp-tabs-content--".concat(A),q),r=t({},F);return e("div",{className:i,style:r,children:n})};return e("div",{className:l("idp-tabs","idp-tabs--".concat(A),"idp-tabs--".concat(I),R),style:D,children:n(i,"bottom"===A?{children:[Wt(),Et()]}:{children:[Et(),Wt()]})})};export{C as default};
1
+ import{__assign as t}from"../node_modules/tslib/tslib.es6.js";import{jsx as e,jsxs as n,Fragment as i}from"react/jsx-runtime";import r,{useState as o,useRef as a,useEffect as c,useMemo as s}from"react";import l from"classnames";import{useSensors as d,useSensor as u,PointerSensor as f,DndContext as b,closestCenter as v}from"@dnd-kit/core";import{SortableContext as m,horizontalListSortingStrategy as p,arrayMove as y,useSortable as h}from"@dnd-kit/sortable";import{CSS as z}from"@dnd-kit/utilities";import j from"../Icon/Icon.js";var k=function(i){var r=i.item,o=i.isActive,a=i.isClosable,c=i.onClick,s=i.onClose,d=i.tabRefs,u=h({id:r.key,disabled:r.disabled}),f=u.attributes,b=u.listeners,v=u.setNodeRef,m=u.transform,p=u.transition,y=u.isDragging,k={transform:z.Transform.toString(m),transition:p,opacity:y?.5:1,zIndex:y?1e3:"auto",position:"relative"};return n("div",{ref:function(t){v(t),t?d.current.set(r.key,t):d.current.delete(r.key)},className:l("zjpcy-tabs-tab",{"zjpcy-tabs-tab--active":o,"zjpcy-tabs-tab--disabled":r.disabled,"zjpcy-tabs-tab--dragging":y}),role:"tab","aria-selected":o,style:k,children:[n("div",t({className:"zjpcy-tabs-tab__drag-handle"},f,b,{onClick:c,style:{cursor:r.disabled?"not-allowed":"grab",display:"flex",alignItems:"center",gap:"6px"},children:[r.icon&&e("span",{className:"zjpcy-tabs-tab__icon",children:r.icon}),e("span",{className:"zjpcy-tabs-tab__label",children:r.label})]})),a&&!r.disabled&&e("span",{className:"zjpcy-tabs-tab__close",onClick:function(t){return s(t)},children:e(j,{type:"close",size:12})})]})},g=function(h){var z=h.items,g=void 0===z?[]:z,_=h.activeKey,C=h.defaultActiveKey,N=h.onChange,L=h.onClose,w=h.tabsClosable,E=void 0!==w&&w,W=h.tabPlacement,T=void 0===W?"top":W,A=h.type,x=void 0===A?"line":A,I=h.onAdd,M=h.className,R=h.style,D=h.contentClassName,q=h.contentStyle,F=h.draggable,S=void 0!==F&&F,B=h.onDragEnd,K=o(function(){return C}),P=K[0],V=K[1],H=a(null),G=a(new Map),J=a(null),O=o({}),Q=O[0],U=O[1],X=o(!1),Y=X[0],Z=X[1],$=o(!1),tt=$[0],et=$[1],nt=o(!1),it=nt[0],rt=nt[1],ot=o(!1),at=ot[0],ct=ot[1],st=a(!1),lt=a(!0),dt=o(!1),ut=dt[0],ft=dt[1],bt=o(g),vt=bt[0],mt=bt[1];c(function(){void 0!==_&&V(_)},[_]),c(function(){mt(g)},[g]),c(function(){var t;if(void 0===_){var e=null===(t=g[0])||void 0===t?void 0:t.key;if(!(!!C&&g.some(function(t){return t.key===C}))||P)if(e)g.some(function(t){return t.key===P})||V(e);else V(void 0);else V(C)}},[g,P,_,C]);var pt=void 0!==_?_:P,yt=s(function(){return g.find(function(t){return t.key===pt})||g[0]},[g,pt]),ht=function(t,e){if(void 0===e&&(e=!0),t&&H.current){var n=G.current.get(t),i=H.current;if(n&&i){var r=i.querySelector(".zjpcy-tabs-indicator"),o=lt.current;if(r&&o&&(r.style.transition="none"),"top"===T||"bottom"===T){if(U({left:n.offsetLeft,width:n.offsetWidth,top:void 0,height:void 0}),!e){var a=n.offsetLeft,c=a+n.offsetWidth,s=i.scrollLeft,l=i.clientWidth;(a<s||c>s+l)&&n.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"})}}else U({top:n.offsetTop,height:n.offsetHeight,left:void 0,width:void 0});r&&o&&e?requestAnimationFrame(function(){r.style.transition="",lt.current=!1}):o&&(lt.current=!1)}}},zt=r.useCallback(function(){if(H.current){var t=H.current,e="top"===T||"bottom"===T;if("card"===x)return Z(!1),et(!1),void rt(!1);if(e){var n=Math.ceil(t.scrollWidth)>Math.floor(t.clientWidth);if(Z(n),n){var i=t.scrollLeft>1;et(i);var r=t.scrollWidth-t.clientWidth,o=t.scrollLeft<r-1;rt(o)}else et(!1),rt(!1)}else Z(!1),et(!1),rt(!1)}},[T,x]),jt=function(t){if(H.current&&!st.current){var e=H.current,n=e.clientWidth,i=Math.max(200,.6*n);st.current=!0,"left"===t?e.scrollTo({left:e.scrollLeft-i,behavior:"smooth"}):e.scrollTo({left:e.scrollLeft+i,behavior:"smooth"}),setTimeout(function(){st.current=!1,zt()},400)}};c(function(){pt&&(ht(pt,!1),zt())},[pt,g,T,zt]),c(function(){zt();var t=requestAnimationFrame(function(){pt&&ht(pt,!1),zt()});return function(){return cancelAnimationFrame(t)}},[zt,pt]),c(function(){var t,e=function(){pt&&ht(pt,!1),zt()},n=function(){clearTimeout(t),t=setTimeout(function(){zt()},100)},i=H.current;return i&&i.addEventListener("scroll",n),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),i&&i.removeEventListener("scroll",n),clearTimeout(t)}},[zt,pt]),c(function(){var t=function(){if(J.current&&H.current&&"card"===x&&I){var t=H.current,e=J.current,n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.right-i.right;ft(r<=20)}else ft(!1)};t();var e=function(){t()},n=H.current;return n&&(n.addEventListener("scroll",e),window.addEventListener("resize",e)),function(){n&&n.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[x,I,g]);var kt=function(t){t.disabled||(void 0===_&&V(t.key),ht(t.key,!0),zt(),null==N||N(t.key))},gt=function(t,e){t.stopPropagation(),e.disabled||null==L||L(e.key)},_t=function(){null==I||I(),setTimeout(function(){H.current&&requestAnimationFrame(function(){if(H.current&&G.current.size>0){var t=Array.from(G.current.keys());if(t.length>0){var e=t[t.length-1],n=G.current.get(e),i=H.current;if(n&&i&&J.current)if("card"===x){var r=J.current.offsetWidth+4,o=n.offsetLeft+n.offsetWidth,a=i.clientWidth;if(o-i.scrollLeft>a-r){var c=o-a+r;i.scrollTo({left:c,behavior:"smooth"})}}else n.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"})}}})},100)},Ct=d(u(f,{activationConstraint:{distance:8}})),Nt=function(t){},Lt=function(t){var e=t.active,n=t.over;if(n&&e.id!==n.id){var i=vt.findIndex(function(t){return t.key===e.id}),r=vt.findIndex(function(t){return t.key===n.id});if(-1!==i&&-1!==r){var o=y(vt,i,r);mt(o),null==B||B(o)}}},wt=function(){var t="top"===T||"bottom"===T,i="card"===x,r=S?vt:g,o=n("div",{className:"zjpcy-tabs-nav-wrapper",onMouseEnter:function(){return ct(!0)},onMouseLeave:function(){return ct(!1)},children:[t&&Y&&!i&&e("button",{className:l("zjpcy-tabs-nav__button","zjpcy-tabs-nav__button--left",{"zjpcy-tabs-nav__button--disabled":!tt,"zjpcy-tabs-nav__button--visible":at}),onClick:function(){return jt("left")},disabled:!tt,type:"button",children:e(j,{type:"arrowLeft",size:12})}),n("div",{className:"zjpcy-tabs-nav",ref:H,children:[r.map(function(t){return function(t,i,r){return!S||t.disabled||"top"!==T&&"bottom"!==T?n("div",{ref:function(e){e?G.current.set(t.key,e):G.current.delete(t.key)},className:l("zjpcy-tabs-tab",{"zjpcy-tabs-tab--active":i,"zjpcy-tabs-tab--disabled":t.disabled}),role:"tab","aria-selected":i,onClick:function(){return kt(t)},children:[t.icon&&e("span",{className:"zjpcy-tabs-tab__icon",children:t.icon}),e("span",{className:"zjpcy-tabs-tab__label",children:t.label}),r&&!t.disabled&&e("span",{className:"zjpcy-tabs-tab__close",onClick:function(e){return gt(e,t)},children:e(j,{type:"close",size:12})})]},t.key):e(k,{item:t,isActive:i,isClosable:r,onClick:function(){return kt(t)},onClose:function(e){return gt(e,t)},tabRefs:G},t.key)}(t,t.key===pt,E||t.closable||!1)}),"card"===x&&I&&e("div",{ref:J,className:l("zjpcy-tabs-tab zjpcy-tabs-tab--add",{sticky:!0===ut}),role:"tab",onClick:_t,children:e(j,{type:"plus",size:16})}),e("div",{className:"zjpcy-tabs-indicator",style:Q})]}),t&&Y&&!i&&e("button",{className:l("zjpcy-tabs-nav__button","zjpcy-tabs-nav__button--right",{"zjpcy-tabs-nav__button--disabled":!it,"zjpcy-tabs-nav__button--visible":at}),onClick:function(){return jt("right")},disabled:!it,type:"button",children:e(j,{type:"arrowRight",size:12})})]});return!S||i||"top"!==T&&"bottom"!==T?o:e(b,{sensors:Ct,collisionDetection:v,onDragStart:Nt,onDragEnd:Lt,children:e(m,{items:r.map(function(t){return t.key}),strategy:p,children:o})})},Et=function(){var n=(null==yt?void 0:yt.renderContent)?yt.renderContent():null==yt?void 0:yt.content,i=l("zjpcy-tabs-content","zjpcy-tabs-content--".concat(T),D),r=t({},q);return e("div",{className:i,style:r,children:n})};return e("div",{className:l("zjpcy-tabs","zjpcy-tabs--".concat(T),"zjpcy-tabs--".concat(x),M),style:R,children:n(i,"bottom"===T?{children:[Et(),wt()]}:{children:[wt(),Et()]})})};export{g as default};
@@ -1 +1 @@
1
- import{__rest as o,__assign as l}from"../node_modules/tslib/tslib.es6.js";import{jsxs as a,jsx as e}from"react/jsx-runtime";import c,{useState as n}from"react";import r from"classnames";import s from"../Icon/Icon.js";var i=c.forwardRef(function(c,i){var t=c.children,d=c.className,p=c.style,m=c.size,u=void 0===m?"medium":m,g=c.backgroundColor,f=c.color,b=c.icon,C=c.closable,_=void 0!==C&&C,k=c.onClose,N=c.onClick,h=o(c,["children","className","style","size","backgroundColor","color","icon","closable","onClose","onClick"]),y=n(!0),v=y[0],j=y[1];if(!v)return null;var x=r("idp-tag","idp-tag--".concat(u),{"idp-tag--clickable":N,"idp-tag--closable":_},d),I=l({backgroundColor:g,color:f},p);return a("span",l({ref:i,className:x,style:I,onClick:N},h,{children:[b?e("span","string"==typeof b?{className:"idp-tag__icon",children:e(s,{type:b})}:{className:"idp-tag__icon",children:b}):null,e("span",{className:"idp-tag__content",children:t}),_&&e("span",{className:"idp-tag__close",onClick:function(o){o.stopPropagation(),null==k||k(o),j(!1)},role:"button",tabIndex:0,"aria-label":"close",children:e(s,{type:"close"})})]}))});i.displayName="Tag";var t=i;export{t as default};
1
+ import{__rest as o,__assign as l}from"../node_modules/tslib/tslib.es6.js";import{jsxs as a,jsx as c}from"react/jsx-runtime";import e,{useState as n}from"react";import r from"classnames";import s from"../Icon/Icon.js";var t=e.forwardRef(function(e,t){var i=e.children,p=e.className,m=e.style,d=e.size,u=void 0===d?"medium":d,y=e.backgroundColor,g=e.color,f=e.icon,b=e.closable,j=void 0!==b&&b,z=e.onClose,C=e.onClick,_=o(e,["children","className","style","size","backgroundColor","color","icon","closable","onClose","onClick"]),k=n(!0),N=k[0],h=k[1];if(!N)return null;var v=r("zjpcy-tag","zjpcy-tag--".concat(u),{"zjpcy-tag--clickable":C,"zjpcy-tag--closable":j},p),x=l({backgroundColor:y,color:g},m);return a("span",l({ref:t,className:v,style:x,onClick:C},_,{children:[f?c("span","string"==typeof f?{className:"zjpcy-tag__icon",children:c(s,{type:f})}:{className:"zjpcy-tag__icon",children:f}):null,c("span",{className:"zjpcy-tag__content",children:i}),j&&c("span",{className:"zjpcy-tag__close",onClick:function(o){o.stopPropagation(),null==z||z(o),h(!1)},role:"button",tabIndex:0,"aria-label":"close",children:c(s,{type:"close"})})]}))});t.displayName="Tag";var i=t;export{i as default};
@@ -1 +1 @@
1
- import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useCallback as o,useEffect as a}from"react";import l from"react-dom";import s from"classnames";import d from"../Icon/Icon.js";import c from"./TimePickerPanel.js";var u=function(u){var m,p=u.size,v=void 0===p?"middle":p,f=u.value,h=u.defaultValue,w=u.onChange,g=u.placeholder,b=void 0===g?["开始时间","结束时间"]:g,k=u.disabled,y=void 0!==k&&k,N=u.readOnly,C=void 0!==N&&N,x=u.className,S=void 0===x?"":x,z=u.style,H=u.width,E=void 0===H?"auto":H,L=u.format,O=void 0===L?"HH:mm:ss":L,j=u.allowClear,I=void 0===j||j,P=u.hourStep,M=void 0===P?1:P,R=u.minuteStep,Y=void 0===R?1:R,B=u.secondStep,D=void 0===B?1:B,W=u.disabledHours,q=u.disabledMinutes,A=u.disabledSeconds,F=u.hideDisabledOptions,G=void 0!==F&&F,T=u.label,V=u.labelGap,X=void 0===V?8:V,_=u.labelClassName,J=void 0===_?"":_,K=u.labelStyle,Q=u.onOpenChange,U=u.open,Z=u.separator,$=n(h),ee=$[0],ie=$[1],te=n(!1),ne=te[0],re=te[1],oe=n("start"),ae=oe[0],le=oe[1],se=n(!1),de=se[0],ce=se[1],ue=n({top:0,left:0,width:0}),me=ue[0],pe=ue[1],ve=n(!1),fe=ve[0],he=ve[1],we=r(null),ge=r(null),be=void 0!==f,ke=be?f:ee,ye=void 0!==U?U:ne,Ne=(null==ke?void 0:ke[0])||"",Ce=(null==ke?void 0:ke[1])||"",xe=o(function(){if(we.current){var e=we.current.getBoundingClientRect(),i=Math.max(e.width,200),t=window.innerHeight-e.bottom,n=e.bottom+window.scrollY+4,r=e.left+window.scrollX;t<280&&e.top>280&&(n=e.top+window.scrollY-280-4);var o=window.innerWidth;r+i>o&&(r=o-i-16),pe({top:n,left:r,width:i})}},[]);a(function(){if(ye&&ge.current&&we.current){return he(!1),requestAnimationFrame(function(){var i=we.current.getBoundingClientRect(),t=ge.current.offsetHeight;if(window.innerHeight-i.bottom<280&&i.top>280){var n=i.top+window.scrollY-t-4;pe(function(i){return e(e({},i),{top:n})})}he(!0)}),function(){he(!1)}}},[ye]),a(function(){var e=function(e){we.current&&!we.current.contains(e.target)&&ge.current&&!ge.current.contains(e.target)&&(void 0===U&&re(!1),null==Q||Q(!1),ce(!1))};return ye&&(document.addEventListener("mousedown",e),xe(),window.addEventListener("scroll",xe,!0),window.addEventListener("resize",xe)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",xe,!0),window.removeEventListener("resize",xe)}},[ye,U,Q,xe]);var Se=o(function(e,i){var t=[0===e?i:(null==ke?void 0:ke[0])||"",1===e?i:(null==ke?void 0:ke[1])||""];be||ie(t),null==w||w(t)},[be,w,ke]),ze=function(e){y||C||(le(e),void 0===U&&re(!0),null==Q||Q(!0),ce(!0))},He=function(){void 0===U&&re(!1),null==Q||Q(!1),ce(!1)},Ee=e({width:"number"==typeof E?"".concat(E,"px"):E},z),Le=e({marginRight:"number"==typeof X?"".concat(X,"px"):X},K),Oe=Ne||Ce;return i("div",{className:s("time-picker time-range-picker",S,{"time-picker-with-label":T}),style:Ee,children:[T&&t("span",{className:s("time-picker-label",J),style:Le,children:T}),i("div",{ref:we,className:s("time-range-picker-trigger",(m={focused:de,disabled:y},m["size-".concat(v)]=v,m)),children:[t("div",{className:s("time-range-picker-input",{active:"start"===ae&&ye}),onClick:function(){return ze("start")},children:t("span",{className:s("time-range-picker-value",{placeholder:!Ne}),children:Ne||b[0]})}),t("span",{className:"time-range-picker-separator",children:Z||t(d,{type:"arrow-right",size:"small"})}),t("div",{className:s("time-range-picker-input",{active:"end"===ae&&ye}),onClick:function(){return ze("end")},children:t("span",{className:s("time-range-picker-value",{placeholder:!Ce}),children:Ce||b[1]})}),i("span",{className:"time-picker-suffix time-range-picker-suffix",children:[I&&Oe&&!y&&!C&&t("span",{className:"time-picker-clear",onClick:function(e){e.stopPropagation(),be||ie(void 0),null==w||w(["",""])},children:t(d,{type:"close",size:"small"})}),t(d,{type:"clock",size:"small",className:s("time-picker-icon",{"has-clear":I&&Oe&&!y&&!C})})]})]}),function(){if(!ye)return null;var e="start"===ae?Ne:Ce,i=t("div",{ref:ge,className:"time-picker-dropdown time-range-picker-dropdown",style:{position:"fixed",top:me.top,left:me.left,minWidth:me.width||("number"==typeof E?E:parseInt(E,10)),zIndex:999,opacity:fe?1:0,transition:"opacity 0.15s ease"},children:t(c,{value:e,onChange:function(e){return Se("start"===ae?0:1,e)},format:O,hourStep:M,minuteStep:Y,secondStep:D,disabledHours:W,disabledMinutes:q,disabledSeconds:A,hideDisabledOptions:G,showNow:!1,showOk:!0,onOk:He})});return l.createPortal(i,document.body)}()]})};export{u as default};
1
+ import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useCallback as o,useEffect as a}from"react";import l from"react-dom";import s from"classnames";import d from"../Icon/Icon.js";import c from"./TimePickerPanel.js";var u=function(u){var m,p=u.size,v=void 0===p?"middle":p,f=u.value,h=u.defaultValue,w=u.onChange,g=u.placeholder,b=void 0===g?["开始时间","结束时间"]:g,k=u.disabled,y=void 0!==k&&k,N=u.readOnly,C=void 0!==N&&N,x=u.className,S=void 0===x?"":x,z=u.style,H=u.width,E=void 0===H?"auto":H,L=u.format,O=void 0===L?"HH:mm:ss":L,j=u.allowClear,I=void 0===j||j,P=u.hourStep,M=void 0===P?1:P,R=u.minuteStep,Y=void 0===R?1:R,B=u.secondStep,D=void 0===B?1:B,W=u.disabledHours,q=u.disabledMinutes,A=u.disabledSeconds,F=u.hideDisabledOptions,G=void 0!==F&&F,T=u.label,V=u.labelGap,X=void 0===V?8:V,_=u.labelClassName,J=void 0===_?"":_,K=u.labelStyle,Q=u.onOpenChange,U=u.open,Z=u.separator,$=n(h),ee=$[0],ie=$[1],te=n(!1),ne=te[0],re=te[1],oe=n("start"),ae=oe[0],le=oe[1],se=n(!1),de=se[0],ce=se[1],ue=n({top:0,left:0,width:0}),me=ue[0],pe=ue[1],ve=n(!1),fe=ve[0],he=ve[1],we=r(null),ge=r(null),be=void 0!==f,ke=be?f:ee,ye=void 0!==U?U:ne,Ne=(null==ke?void 0:ke[0])||"",Ce=(null==ke?void 0:ke[1])||"",xe=o(function(){if(we.current){var e=we.current.getBoundingClientRect(),i=Math.max(e.width,200),t=window.innerHeight-e.bottom,n=e.bottom+window.scrollY+4,r=e.left+window.scrollX;t<280&&e.top>280&&(n=e.top+window.scrollY-280-4);var o=window.innerWidth;r+i>o&&(r=o-i-16),pe({top:n,left:r,width:i})}},[]);a(function(){if(ye&&ge.current&&we.current){return he(!1),requestAnimationFrame(function(){var i=we.current.getBoundingClientRect(),t=ge.current.offsetHeight;if(window.innerHeight-i.bottom<280&&i.top>280){var n=i.top+window.scrollY-t-4;pe(function(i){return e(e({},i),{top:n})})}he(!0)}),function(){he(!1)}}},[ye]),a(function(){var e=function(e){we.current&&!we.current.contains(e.target)&&ge.current&&!ge.current.contains(e.target)&&(void 0===U&&re(!1),null==Q||Q(!1),ce(!1))};return ye&&(document.addEventListener("mousedown",e),xe(),window.addEventListener("scroll",xe,!0),window.addEventListener("resize",xe)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",xe,!0),window.removeEventListener("resize",xe)}},[ye,U,Q,xe]);var Se=o(function(e,i){var t=[0===e?i:(null==ke?void 0:ke[0])||"",1===e?i:(null==ke?void 0:ke[1])||""];be||ie(t),null==w||w(t)},[be,w,ke]),ze=function(e){y||C||(le(e),void 0===U&&re(!0),null==Q||Q(!0),ce(!0))},He=function(){void 0===U&&re(!1),null==Q||Q(!1),ce(!1)},Ee=e({width:"number"==typeof E?"".concat(E,"px"):E},z),Le=e({marginRight:"number"==typeof X?"".concat(X,"px"):X},K),Oe=Ne||Ce;return i("div",{className:s("time-picker time-range-picker",S,{"time-picker-with-label":T}),style:Ee,children:[T&&t("span",{className:s("time-picker-label",J),style:Le,children:T}),i("div",{ref:we,className:s("time-range-picker-trigger",(m={"is-focused":de,"is-disabled":y},m["size-".concat(v)]=v,m)),children:[t("div",{className:s("time-range-picker-input",{"is-active":"start"===ae&&ye}),onClick:function(){return ze("start")},children:t("span",{className:s("time-range-picker-value",{"is-placeholder":!Ne}),children:Ne||b[0]})}),t("span",{className:"time-range-picker-separator",children:Z||t(d,{type:"arrow-right",size:"small"})}),t("div",{className:s("time-range-picker-input",{"is-active":"end"===ae&&ye}),onClick:function(){return ze("end")},children:t("span",{className:s("time-range-picker-value",{"is-placeholder":!Ce}),children:Ce||b[1]})}),i("span",{className:"time-picker-suffix time-range-picker-suffix",children:[I&&Oe&&!y&&!C&&t("span",{className:"time-picker-clear",onClick:function(e){e.stopPropagation(),be||ie(void 0),null==w||w(["",""])},children:t(d,{type:"close",size:"small"})}),t(d,{type:"clock",size:"small",className:s("time-picker-icon",{"has-clear":I&&Oe&&!y&&!C})})]})]}),function(){if(!ye)return null;var e="start"===ae?Ne:Ce,i=t("div",{ref:ge,className:"time-picker-dropdown time-range-picker-dropdown",style:{position:"fixed",top:me.top,left:me.left,minWidth:me.width||("number"==typeof E?E:parseInt(E,10)),zIndex:999,opacity:fe?1:0,transition:"opacity 0.15s ease"},children:t(c,{value:e,onChange:function(e){return Se("start"===ae?0:1,e)},format:O,hourStep:M,minuteStep:Y,secondStep:D,disabledHours:W,disabledMinutes:q,disabledSeconds:A,hideDisabledOptions:G,showNow:!1,showOk:!0,onOk:He})});return l.createPortal(i,document.body)}()]})};export{u as default};
@@ -1 +1 @@
1
- import{jsxs as n,jsx as e}from"react/jsx-runtime";import t,{useState as i,useEffect as o,useMemo as r}from"react";import u from"classnames";var l=function(n,e,t,i){var o=function(n){return n.toString().padStart(2,"0")};return"HH:mm"===i?"".concat(o(n),":").concat(o(e)):"".concat(o(n),":").concat(o(e),":").concat(o(t))},c=function(i){var o=i.options,r=i.value,l=i.onChange,c=i.unit,a=t.useRef(null),s=t.useRef(null);return t.useEffect(function(){if(s.current&&a.current){var n=a.current,e=s.current,t=n.clientHeight,i=e.offsetTop-t/2+18;requestAnimationFrame(function(){n.scrollTo({top:Math.max(0,i),behavior:"smooth"})})}},[r]),n("div",{className:"time-picker-column",children:[e("div",{className:"time-picker-column-header",children:c}),e("div",{className:"time-picker-column-list",ref:a,children:o.map(function(n){return e("div",{ref:r===n?s:null,className:u("time-picker-option",{selected:r===n}),onClick:function(){return null==l?void 0:l(n)},children:n.toString().padStart(2,"0")},n)})})]})},a=function(t){var u,a,s,d=t.value,m=t.onChange,f=t.format,v=t.hourStep,p=t.minuteStep,h=t.secondStep,k=t.disabledHours,g=t.disabledMinutes,N=t.disabledSeconds,b=t.hideDisabledOptions,S=void 0!==b&&b,C=t.showNow,w=void 0===C||C,H=t.showOk,x=void 0===H||H,I=t.onNow,M=t.onOk,O=function(n){if(!n)return null;var e=n.split(":");return e.length<2?null:{hour:parseInt(e[0],10)||0,minute:parseInt(e[1],10)||0,second:parseInt(e[2],10)||0}}(d),D=i(null!==(u=null==O?void 0:O.hour)&&void 0!==u?u:0),R=D[0],T=D[1],j=i(null!==(a=null==O?void 0:O.minute)&&void 0!==a?a:0),q=j[0],A=j[1],E=i(null!==(s=null==O?void 0:O.second)&&void 0!==s?s:0),F=E[0],y=E[1];o(function(){if(O)T(O.hour),A(O.minute),y(O.second);else{var n=new Date;T(n.getHours()),A(n.getMinutes()),y(n.getSeconds())}},[d,O]);var z=function(n,e,t){void 0===t&&(t=[]);for(var i=[],o=0;o<n;o+=e)S&&t.includes(o)||i.push(o);return i},B=r(function(){return(null==k?void 0:k())||[]},[k]),G=r(function(){return(null==g?void 0:g(R))||[]},[g,R]),J=r(function(){return(null==N?void 0:N(R,q))||[]},[N,R,q]),K=r(function(){return z(24,v,B)},[v,B,S]),L=r(function(){return z(60,p,G)},[p,G,S]),P=r(function(){return z(60,h,J)},[h,J,S]),Q=f.includes("ss");return n("div",{className:"time-picker-panel-container",children:[n("div",{className:"time-picker-panel",children:[e(c,{unit:"时",options:K,value:R,onChange:function(n){T(n),null==m||m(l(n,q,F,f))}}),e(c,{unit:"分",options:L,value:q,onChange:function(n){A(n),null==m||m(l(R,n,F,f))}}),Q&&e(c,{unit:"秒",options:P,value:F,onChange:function(n){y(n),null==m||m(l(R,q,n,f))}})]}),(w||x)&&n("div",{className:"time-picker-footer",children:[w&&e("button",{className:"time-picker-now-btn",onClick:I,children:"此刻"}),x&&e("button",{className:"time-picker-ok-btn",onClick:function(){return null==M?void 0:M(l(R,q,F,f))},children:"确定"})]})]})};export{a as default};
1
+ import{jsxs as n,jsx as e}from"react/jsx-runtime";import t,{useState as i,useEffect as o,useMemo as r}from"react";import u from"classnames";var l=function(n,e,t,i){var o=function(n){return n.toString().padStart(2,"0")};return"HH:mm"===i?"".concat(o(n),":").concat(o(e)):"".concat(o(n),":").concat(o(e),":").concat(o(t))},c=function(i){var o=i.options,r=i.value,l=i.onChange,c=i.unit,a=t.useRef(null),s=t.useRef(null);return t.useEffect(function(){if(s.current&&a.current){var n=a.current,e=s.current,t=n.clientHeight,i=e.offsetTop-t/2+18;requestAnimationFrame(function(){n.scrollTo({top:Math.max(0,i),behavior:"smooth"})})}},[r]),n("div",{className:"time-picker-column",children:[e("div",{className:"time-picker-column-header",children:c}),e("div",{className:"time-picker-column-list",ref:a,children:o.map(function(n){return e("div",{ref:r===n?s:null,className:u("time-picker-option",{"is-selected":r===n}),onClick:function(){return null==l?void 0:l(n)},children:n.toString().padStart(2,"0")},n)})})]})},a=function(t){var u,a,s,d=t.value,m=t.onChange,f=t.format,v=t.hourStep,p=t.minuteStep,h=t.secondStep,k=t.disabledHours,g=t.disabledMinutes,N=t.disabledSeconds,b=t.hideDisabledOptions,S=void 0!==b&&b,C=t.showNow,w=void 0===C||C,H=t.showOk,x=void 0===H||H,I=t.onNow,M=t.onOk,O=function(n){if(!n)return null;var e=n.split(":");return e.length<2?null:{hour:parseInt(e[0],10)||0,minute:parseInt(e[1],10)||0,second:parseInt(e[2],10)||0}}(d),D=i(null!==(u=null==O?void 0:O.hour)&&void 0!==u?u:0),R=D[0],T=D[1],j=i(null!==(a=null==O?void 0:O.minute)&&void 0!==a?a:0),q=j[0],A=j[1],E=i(null!==(s=null==O?void 0:O.second)&&void 0!==s?s:0),F=E[0],y=E[1];o(function(){if(O)T(O.hour),A(O.minute),y(O.second);else{var n=new Date;T(n.getHours()),A(n.getMinutes()),y(n.getSeconds())}},[d,O]);var z=function(n,e,t){void 0===t&&(t=[]);for(var i=[],o=0;o<n;o+=e)S&&t.includes(o)||i.push(o);return i},B=r(function(){return(null==k?void 0:k())||[]},[k]),G=r(function(){return(null==g?void 0:g(R))||[]},[g,R]),J=r(function(){return(null==N?void 0:N(R,q))||[]},[N,R,q]),K=r(function(){return z(24,v,B)},[v,B,S]),L=r(function(){return z(60,p,G)},[p,G,S]),P=r(function(){return z(60,h,J)},[h,J,S]),Q=f.includes("ss");return n("div",{className:"time-picker-panel-container",children:[n("div",{className:"time-picker-panel",children:[e(c,{unit:"时",options:K,value:R,onChange:function(n){T(n),null==m||m(l(n,q,F,f))}}),e(c,{unit:"分",options:L,value:q,onChange:function(n){A(n),null==m||m(l(R,n,F,f))}}),Q&&e(c,{unit:"秒",options:P,value:F,onChange:function(n){y(n),null==m||m(l(R,q,n,f))}})]}),(w||x)&&n("div",{className:"time-picker-footer",children:[w&&e("button",{className:"time-picker-now-btn",onClick:I,children:"此刻"}),x&&e("button",{className:"time-picker-ok-btn",onClick:function(){return null==M?void 0:M(l(R,q,F,f))},children:"确定"})]})]})};export{a as default};
@@ -1 +1 @@
1
- import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as o,useCallback as r,useEffect as a}from"react";import c from"react-dom";import l from"classnames";import d from"../Icon/Icon.js";import s from"./TimePickerPanel.js";import u from"./RangePicker.js";var m=function(u){var m,p=u.size,f=void 0===p?"middle":p,v=u.value,w=u.defaultValue,h=u.onChange,b=u.placeholder,g=void 0===b?"请选择时间":b,k=u.disabled,y=void 0!==k&&k,N=u.readOnly,S=void 0!==N&&N,H=u.className,C=void 0===H?"":H,x=u.style,z=u.width,O=void 0===z?120:z,E=u.format,L=void 0===E?"HH:mm:ss":E,P=u.allowClear,j=void 0===P||P,R=u.hourStep,I=void 0===R?1:R,M=u.minuteStep,D=void 0===M?1:M,Y=u.secondStep,B=void 0===Y?1:Y,W=u.disabledHours,q=u.disabledMinutes,A=u.disabledSeconds,F=u.hideDisabledOptions,G=void 0!==F&&F,T=u.label,V=u.labelGap,X=void 0===V?8:V,_=u.labelClassName,J=void 0===_?"":_,K=u.labelStyle,Q=u.onOpenChange,U=u.open,Z=u.showNow,$=void 0===Z||Z,ee=u.showOk,te=void 0===ee||ee,ne=i(w),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],ce=re[1],le=i(!1),de=le[0],se=le[1],ue=i({top:0,left:0,width:0}),me=ue[0],pe=ue[1],fe=i(!1),ve=fe[0],we=fe[1],he=o(null),be=o(null),ge=void 0!==v,ke=ge?v:ie,ye=void 0!==U?U:ae,Ne=r(function(){if(he.current){var e=he.current.getBoundingClientRect(),t=Math.max(e.width,200),n=window.innerHeight-e.bottom,i=e.bottom+window.scrollY+4,o=e.left+window.scrollX;n<280&&e.top>280&&(i=e.top+window.scrollY-280-4);var r=window.innerWidth;o+t>r&&(o=r-t-16),pe({top:i,left:o,width:t})}},[]);a(function(){if(ye&&be.current&&he.current){return we(!1),requestAnimationFrame(function(){var t=he.current.getBoundingClientRect(),n=be.current.offsetHeight;if(window.innerHeight-t.bottom<280&&t.top>280){var i=t.top+window.scrollY-n-4;pe(function(t){return e(e({},t),{top:i})})}we(!0)}),function(){we(!1)}}},[ye]),a(function(){var e=function(e){he.current&&!he.current.contains(e.target)&&be.current&&!be.current.contains(e.target)&&(void 0===U&&ce(!1),null==Q||Q(!1),se(!1))};return ye&&(document.addEventListener("mousedown",e),Ne(),window.addEventListener("scroll",Ne,!0),window.addEventListener("resize",Ne)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",Ne,!0),window.removeEventListener("resize",Ne)}},[ye,U,Q,Ne]);var Se=r(function(e){ge||oe(e),null==h||h(e)},[ge,h]),He=function(){var e=new Date,t=function(e,t,n,i){var o=function(e){return e.toString().padStart(2,"0")};return"HH:mm"===i?"".concat(o(e),":").concat(o(t)):"".concat(o(e),":").concat(o(t),":").concat(o(n))}(e.getHours(),e.getMinutes(),e.getSeconds(),L);Se(t)},Ce=e({width:"number"==typeof O?"".concat(O,"px"):O},x),xe=e({marginRight:"number"==typeof X?"".concat(X,"px"):X},K),ze=t("div",{ref:he,className:l("time-picker-trigger",(m={focused:de,disabled:y},m["size-".concat(f)]=f,m)),onClick:function(){if(!y&&!S){var e=!ye;void 0===U&&ce(e),null==Q||Q(e),se(e)}},children:[n("span",{className:l("time-picker-value",{placeholder:!ke}),children:ke||g}),t("span",{className:"time-picker-suffix",children:[j&&ke&&!y&&!S&&n("span",{className:"time-picker-clear",onClick:function(e){e.stopPropagation(),ge||oe(void 0),null==h||h("")},children:n(d,{type:"close",size:"small"})}),n(d,{type:"clock",size:"small",className:l("time-picker-icon",{open:ye,"has-clear":j&&ke&&!y&&!S})})]})]});return t("div",{className:l("time-picker",C,{"time-picker-with-label":T}),style:Ce,children:[T&&n("span",{className:l("time-picker-label",J),style:xe,children:T}),ze,function(){if(!ye)return null;var e=n("div",{ref:be,className:"time-picker-dropdown",style:{position:"fixed",top:me.top,left:me.left,minWidth:me.width||("number"==typeof O?O:parseInt(O,10)),zIndex:999,opacity:ve?1:0,transition:"opacity 0.15s ease"},children:n(s,{value:ke,onChange:Se,format:L,hourStep:I,minuteStep:D,secondStep:B,disabledHours:W,disabledMinutes:q,disabledSeconds:A,hideDisabledOptions:G,showNow:$,showOk:te,onNow:He,onOk:function(e){return function(e){e&&!ke&&Se(e),void 0===U&&ce(!1),null==Q||Q(!1),se(!1)}(e)}})});return c.createPortal(e,document.body)}()]})};m.RangePicker=u;var p=m;export{u as RangePicker,p as default};
1
+ import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as o,useCallback as r,useEffect as a}from"react";import c from"react-dom";import l from"classnames";import s from"../Icon/Icon.js";import d from"./TimePickerPanel.js";import u from"./RangePicker.js";var m=function(u){var m,p=u.size,f=void 0===p?"middle":p,v=u.value,w=u.defaultValue,h=u.onChange,b=u.placeholder,g=void 0===b?"请选择时间":b,k=u.disabled,y=void 0!==k&&k,N=u.readOnly,S=void 0!==N&&N,H=u.className,C=void 0===H?"":H,x=u.style,z=u.width,O=void 0===z?120:z,E=u.format,L=void 0===E?"HH:mm:ss":E,P=u.allowClear,j=void 0===P||P,R=u.hourStep,I=void 0===R?1:R,M=u.minuteStep,D=void 0===M?1:M,Y=u.secondStep,B=void 0===Y?1:Y,W=u.disabledHours,q=u.disabledMinutes,A=u.disabledSeconds,F=u.hideDisabledOptions,G=void 0!==F&&F,T=u.label,V=u.labelGap,X=void 0===V?8:V,_=u.labelClassName,J=void 0===_?"":_,K=u.labelStyle,Q=u.onOpenChange,U=u.open,Z=u.showNow,$=void 0===Z||Z,ee=u.showOk,te=void 0===ee||ee,ne=i(w),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],ce=re[1],le=i(!1),se=le[0],de=le[1],ue=i({top:0,left:0,width:0}),me=ue[0],pe=ue[1],fe=i(!1),ve=fe[0],we=fe[1],he=o(null),be=o(null),ge=void 0!==v,ke=ge?v:ie,ye=void 0!==U?U:ae,Ne=r(function(){if(he.current){var e=he.current.getBoundingClientRect(),t=Math.max(e.width,200),n=window.innerHeight-e.bottom,i=e.bottom+window.scrollY+4,o=e.left+window.scrollX;n<280&&e.top>280&&(i=e.top+window.scrollY-280-4);var r=window.innerWidth;o+t>r&&(o=r-t-16),pe({top:i,left:o,width:t})}},[]);a(function(){if(ye&&be.current&&he.current){return we(!1),requestAnimationFrame(function(){var t=he.current.getBoundingClientRect(),n=be.current.offsetHeight;if(window.innerHeight-t.bottom<280&&t.top>280){var i=t.top+window.scrollY-n-4;pe(function(t){return e(e({},t),{top:i})})}we(!0)}),function(){we(!1)}}},[ye]),a(function(){var e=function(e){he.current&&!he.current.contains(e.target)&&be.current&&!be.current.contains(e.target)&&(void 0===U&&ce(!1),null==Q||Q(!1),de(!1))};return ye&&(document.addEventListener("mousedown",e),Ne(),window.addEventListener("scroll",Ne,!0),window.addEventListener("resize",Ne)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",Ne,!0),window.removeEventListener("resize",Ne)}},[ye,U,Q,Ne]);var Se=r(function(e){ge||oe(e),null==h||h(e)},[ge,h]),He=function(){var e=new Date,t=function(e,t,n,i){var o=function(e){return e.toString().padStart(2,"0")};return"HH:mm"===i?"".concat(o(e),":").concat(o(t)):"".concat(o(e),":").concat(o(t),":").concat(o(n))}(e.getHours(),e.getMinutes(),e.getSeconds(),L);Se(t)},Ce=e({width:"number"==typeof O?"".concat(O,"px"):O},x),xe=e({marginRight:"number"==typeof X?"".concat(X,"px"):X},K),ze=t("div",{ref:he,className:l("time-picker-trigger",(m={"is-focused":se,"is-disabled":y},m["size-".concat(f)]=f,m)),onClick:function(){if(!y&&!S){var e=!ye;void 0===U&&ce(e),null==Q||Q(e),de(e)}},children:[n("span",{className:l("time-picker-value",{"is-placeholder":!ke}),children:ke||g}),t("span",{className:"time-picker-suffix",children:[j&&ke&&!y&&!S&&n("span",{className:"time-picker-clear",onClick:function(e){e.stopPropagation(),ge||oe(void 0),null==h||h("")},children:n(s,{type:"close",size:"small"})}),n(s,{type:"clock",size:"small",className:l("time-picker-icon",{"is-open":ye,"has-clear":j&&ke&&!y&&!S})})]})]});return t("div",{className:l("time-picker",C,{"time-picker-with-label":T}),style:Ce,children:[T&&n("span",{className:l("time-picker-label",J),style:xe,children:T}),ze,function(){if(!ye)return null;var e=n("div",{ref:be,className:"time-picker-dropdown",style:{position:"fixed",top:me.top,left:me.left,minWidth:me.width||("number"==typeof O?O:parseInt(O,10)),zIndex:999,opacity:ve?1:0,transition:"opacity 0.15s ease"},children:n(d,{value:ke,onChange:Se,format:L,hourStep:I,minuteStep:D,secondStep:B,disabledHours:W,disabledMinutes:q,disabledSeconds:A,hideDisabledOptions:G,showNow:$,showOk:te,onNow:He,onOk:function(e){return function(e){e&&!ke&&Se(e),void 0===U&&ce(!1),null==Q||Q(!1),de(!1)}(e)}})});return c.createPortal(e,document.body)}()]})};m.RangePicker=u;var p=m;export{u as RangePicker,p as default};