@zjpcy/simple-design 1.3.8-test → 1.3.9-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{__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 l,useEffect as c,useMemo as d}from"react";import u 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 v,SortableContext as b,verticalListSortingStrategy as x,arrayMove as y}from"@dnd-kit/sortable";import S from"../Empty/index.js";import w from"../Pagination/index.js";import k from"../Icon/Icon.js";import N from"./SortableRow.js";import C from"../Tooltip/Tooltip.js";var I=function(I){var z=I.dataSource,j=void 0===z?[]:z,T=I.columns,E=void 0===T?[]:T,A=I.bordered,L=void 0!==A&&A,_=I.scroll,F=void 0===_?{}:_,D=I.rowKey,M=void 0===D?"key":D,P=I.className,V=void 0===P?"":P,W=I.pagination,q=I.empty,J=I.loading,K=void 0!==J&&J,X=I.loadingText,O=void 0===X?"加载中...":X,R=I.loadingDelay,B=I.draggable,G=void 0!==B&&B,H=I.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],le=a(1),ce=le[0],de=le[1],ue=a(10),se=ue[0],fe=ue[1],me=a(K),pe=me[0],he=me[1],ge=a(j),ve=ge[0],be=ge[1],xe=l(null),ye=l(null),Se=l(null),we=l(null),ke=l(null),Ne=l(0),Ce=l(!1),Ie=l(null),ze=l(0),je=a(null),Te=je[0],Ee=je[1],Ae=a(""),Le=Ae[0],_e=Ae[1];c(function(){be(j)},[j]),c(function(){return xe.current&&(clearTimeout(xe.current),xe.current=null),K&&R&&R>0?(he(!0),xe.current=setTimeout(function(){he(!1)},R)):he(K),function(){xe.current&&clearTimeout(xe.current)}},[K,R]),c(function(){W&&"object"==typeof W&&(void 0!==W.current&&de(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]),c(function(){return function(){ke.current&&cancelAnimationFrame(ke.current),Ie.current&&clearTimeout(Ie.current)}},[]);c(function(){var t=[],n=[],r=[],i=[];E.forEach(function(o,a){var l,c=(l=o.width)?"number"==typeof l?l:parseInt(l,10)||0:0;i[a]=c;var d=e(e({},o),{_index:a});"start"===o.fixed||!0===o.fixed?t.push(d):"end"===o.fixed?n.push(d):r.push(d)}),U(t),ee(n),re(r),ae(i),requestAnimationFrame(function(){Fe.current(0)})},[E]);var Fe=l(function(e){ye.current&&ye.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){ke.current&&cancelAnimationFrame(ke.current),ke.current=requestAnimationFrame(function(){t&&t.scrollLeft!==n&&(t.scrollLeft=n),Fe.current(n),ke.current=null})},Me=function(e,t){var n=t||se,r=n!==se?1:e;de(r),fe(n),W&&"function"==typeof W.onChange&&W.onChange(r,t)},Pe=function(e,t){if(void 0===e&&(e=ce),void 0===t&&(t=se),!1===W)return null;var n,r=void 0!==(null==W?void 0:W.total)?W.total:ve.length,i=Math.ceil(r/t)||1,o=Math.min(e,i);if(void 0!==(null==W?void 0:W.total))n=ve;else{var a=(o-1)*t,l=a+t;n=ve.slice(a,l)}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,l){var c={width:e.width||"auto",textAlign:e.align||"left",backgroundColor:"white"};if("start"===e.fixed||!0===e.fixed){c.position="sticky";for(var d=0,u=0;u<a;u++)d+=oe[u]||0;c.left="".concat(d,"px"),c.zIndex=5}else if("end"===e.fixed){c.position="sticky";var s=0;for(u=l.length-1;u>a;u--)s+=oe[u]||0;c.right="".concat(s,"px"),c.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,v=(null==Te?void 0:Te.rowIndex)===n&&(null==Te?void 0:Te.colKey)===String(g),b=e.dataIndex?t[e.dataIndex]:null;e.render&&(b=e.render(b,t,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(e){x=""}var y=e.maxLines&&e.maxLines>0,S="";if(e.tooltip&&!v&&!(S=We(x))&&e.dataIndex){var w=t[e.dataIndex];S="object"==typeof w?We(w):String(w||"")}if(e.editable&&v)return i("td",{style:c,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(e){return e.stopPropagation()},children:[i("input",{type:"text",className:"idp-table-edit-input",value:Le,onChange:function(e){return _e(e.target.value)},autoFocus:!0,onClick:function(e){return e.stopPropagation()}}),r("div",{className:"idp-table-edit-actions",children:[i("span",{className:"idp-table-edit-icon idp-edit-submit",onClick:function(){return Je(t,e)},title:"保存",children:i(k,{type:"check",size:24,color:"#339af0"})}),i("span",{className:"idp-table-edit-icon idp-edit-cancel",onClick:Ke,title:"取消",children:i(k,{type:"close",size:24,color:"#339af0"})})]})]})},e.key||e.dataIndex||e._index);var N=y?i("div",{className:"idp-table-cell-ellipsis",style:{WebkitLineClamp:e.maxLines},children:x}):x,I=S?i(C,{title:S,placement:"top",children:N}):N;return r("td",{style:c,onClick:e.editable?function(){return qe(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(e.editable?" idp-table-editable-cell":""),children:[I,e.editable&&i("span",{className:"idp-table-edit-icon-wrapper",children:i(k,{type:"edit",size:16,color:"#339af0"})})]},e.key||e.dataIndex||e._index)},Oe=s(f(m,{activationConstraint:{distance:8}}),f(p,{coordinateGetter:v})),Re=function(e){var n=e.active,r=e.over;if(r&&n.id!==r.id){var i=Pe(),o=i?i.data:ve,a=o.findIndex(function(e,t){return String(Ve(e,t))===String(n.id)}),l=o.findIndex(function(e,t){return String(Ve(e,t))===String(r.id)});if(-1!==a&&-1!==l){var c=y(o,a,l);if(i&&W&&"object"==typeof W&&void 0===W.total){var d=(i.current-1)*i.pageSize,u=t([],ve,!0);c.forEach(function(e,t){u[d+t]=e}),be(u),H&&H(u)}else be(c),H&&H(c)}}},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=d(function(){return Pe()},[ve,W,se,ce]),Ye=Qe?Qe.data:ve;return r("div",{ref:ye,className:u("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&&we.current){var t=e.target;if(t===Se.current){var n=t.scrollLeft;Ce.current=!0,Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(function(){Ce.current=!1},150),Math.abs(n-Ne.current)>.5&&(Ne.current=n,ze.current=n,De(Se.current,we.current,n))}}},children:r("table",{className:u("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 l=0;for(a=n.length-1;a>t;a--)l+=oe[a]||0;r.right="".concat(l,"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:we,style:Ge,onScroll:function(e){if(Se.current&&we.current){var t=e.target;if(t===we.current){var n=t.scrollLeft;Ce.current=!0,Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(function(){Ce.current=!1},150),Math.abs(n-Ne.current)>.5&&(Ne.current=n,ze.current=n,De(we.current,Se.current,n))}}},children:function(){var e=r("table",{className:u("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(N,{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(b,{items:t,strategy:x,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(w,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{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};
@@ -1 +1 @@
1
- import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as t,Fragment as n,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as i,useCallback as c,useEffect as u}from"react";var l=function(l){var d=l.children,a=l.title,s=l.placement,f=void 0===s?"top":s,m=l.trigger,v=void 0===m?"hover":m,p=l.delay,h=void 0===p?100:p,g=l.open,w=l.backgroundColor,k=l.style,b=void 0===k?{}:k,T=l.className,E=void 0===T?"":T,L=o(!1),y=L[0],C=L[1],x=o(!1),M=x[0],N=x[1],q=o({top:0,left:0}),z=q[0],A=q[1],F=i(null),j=i(null),B=i(null),O=i(null),R=void 0!==g,I=(R?g:y)||M,X=c(function(){if(F.current&&j.current){var e=F.current.getBoundingClientRect(),t=j.current.getBoundingClientRect(),n=window.pageYOffset||document.documentElement.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft,o=0,i=0;switch(f){case"top":o=e.top-t.height-8,i=e.left+(e.width-t.width)/2;break;case"bottom":o=e.bottom+8,i=e.left+(e.width-t.width)/2;break;case"left":o=e.top+(e.height-t.height)/2,i=e.left-t.width-8;break;case"right":o=e.top+(e.height-t.height)/2,i=e.right+8}A({top:o+n,left:i+r})}},[f]),Y=c(function(){a&&(O.current&&(clearTimeout(O.current),O.current=null),R||(C(!0),requestAnimationFrame(function(){N(!0)})))},[a,R]),_=c(function(){R||(N(!1),O.current=setTimeout(function(){C(!1),O.current=null},200))},[R]),D=c(function(e){if("click"===v&&!R&&y){var t=e.target;F.current&&!F.current.contains(t)&&j.current&&!j.current.contains(t)&&_()}},[v,R,y,_]);return u(function(){R&&(g?(O.current&&(clearTimeout(O.current),O.current=null),requestAnimationFrame(function(){N(!0)})):(N(!1),O.current=setTimeout(function(){O.current=null},200)))},[g,R]),u(function(){if(I){requestAnimationFrame(X);var e=function(){return X()},t=function(){return X()};return window.addEventListener("resize",e),window.addEventListener("scroll",t,!0),"click"!==v||R||document.addEventListener("click",D),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",t,!0),"click"!==v||R||document.removeEventListener("click",D)}}},[I,f,v,R,X,D]),u(function(){return function(){B.current&&clearTimeout(B.current),O.current&&clearTimeout(O.current)}},[]),t(n,{children:[r("span",{ref:F,onMouseEnter:"hover"===v?function(){"hover"!==v||R||(B.current&&clearTimeout(B.current),B.current=setTimeout(function(){Y(),B.current=null},h))}:void 0,onMouseLeave:"hover"===v?function(){"hover"!==v||R||(B.current&&(clearTimeout(B.current),B.current=null),_())}:void 0,onClick:"click"===v?function(){"click"!==v||R||(y?_():Y())}:void 0,style:{display:"inline-block"},children:d}),I&&a&&t("div",{ref:j,className:"idp-tooltip idp-tooltip-".concat(f," ").concat(M?"idp-tooltip-visible":""," ").concat(E),style:e({position:"fixed",top:z.top,left:z.left,zIndex:1e3,backgroundColor:w},b),onMouseEnter:"hover"!==v||R?void 0:function(){O.current&&(clearTimeout(O.current),O.current=null),C(!0),N(!0)},onMouseLeave:"hover"!==v||R?void 0:_,children:[r("div",{className:"idp-tooltip-content",children:a}),r("div",{className:"idp-tooltip-arrow",style:{backgroundColor:w}})]})]})};export{l as default};
1
+ import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as t,Fragment as n,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as i,useCallback as c,useEffect as u}from"react";var l=function(l){var a=l.children,d=l.title,s=l.placement,f=void 0===s?"top":s,m=l.trigger,v=void 0===m?"hover":m,h=l.delay,p=void 0===h?100:h,g=l.open,w=l.backgroundColor,k=l.style,b=void 0===k?{}:k,T=l.className,E=void 0===T?"":T,L=o(!1),y=L[0],C=L[1],x=o(!1),M=x[0],N=x[1],q=o({top:0,left:0}),z=q[0],A=q[1],F=i(null),j=i(null),B=i(null),O=i(null),R=void 0!==g,I=(R?g:y)||M,X=c(function(){if(F.current&&j.current){var e=F.current.getBoundingClientRect(),t=j.current.getBoundingClientRect(),n=window.pageYOffset||document.documentElement.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft,o=0,i=0;switch(f){case"top":o=e.top-t.height-8,i=e.left+(e.width-t.width)/2;break;case"bottom":o=e.bottom+8,i=e.left+(e.width-t.width)/2;break;case"left":o=e.top+(e.height-t.height)/2,i=e.left-t.width-8;break;case"right":o=e.top+(e.height-t.height)/2,i=e.right+8}A({top:o+n,left:i+r})}},[f]),Y=c(function(){d&&(O.current&&(clearTimeout(O.current),O.current=null),R||(C(!0),requestAnimationFrame(function(){N(!0)})))},[d,R]),_=c(function(){R||(N(!1),O.current=setTimeout(function(){C(!1),O.current=null},200))},[R]),D=c(function(e){if("click"===v&&!R&&y){var t=e.target;F.current&&!F.current.contains(t)&&j.current&&!j.current.contains(t)&&_()}},[v,R,y,_]);return u(function(){R&&(g?(O.current&&(clearTimeout(O.current),O.current=null),requestAnimationFrame(function(){N(!0)})):(N(!1),O.current=setTimeout(function(){O.current=null},200)))},[g,R]),u(function(){if(I){requestAnimationFrame(X);var e=function(){return X()},t=function(){return X()};return window.addEventListener("resize",e),window.addEventListener("scroll",t,!0),"click"!==v||R||document.addEventListener("click",D),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",t,!0),"click"!==v||R||document.removeEventListener("click",D)}}},[I,f,v,R,X,D]),u(function(){return function(){B.current&&clearTimeout(B.current),O.current&&clearTimeout(O.current)}},[]),t(n,{children:[r("span",{ref:F,onMouseEnter:"hover"===v?function(){"hover"!==v||R||(B.current&&clearTimeout(B.current),B.current=setTimeout(function(){Y(),B.current=null},p))}:void 0,onMouseLeave:"hover"===v?function(){"hover"!==v||R||(B.current&&(clearTimeout(B.current),B.current=null),_())}:void 0,onClick:"click"===v?function(){"click"!==v||R||(y?_():Y())}:void 0,style:{display:"inline-block"},children:a}),I&&d&&t("div",{ref:j,className:"idp-tooltip idp-tooltip-".concat(f," ").concat(M?"is-visible":""," ").concat(E),style:e({position:"fixed",top:z.top,left:z.left,zIndex:1e3,backgroundColor:w},b),onMouseEnter:"hover"!==v||R?void 0:function(){O.current&&(clearTimeout(O.current),O.current=null),C(!0),N(!0)},onMouseLeave:"hover"!==v||R?void 0:_,children:[r("div",{className:"idp-tooltip-content",children:d}),r("div",{className:"idp-tooltip-arrow",style:{backgroundColor:w}})]})]})};export{l as default};