zavadil-react-common 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{StringUtil as i,DateUtil as r,NumberUtil as a,CancellablePromise as o,EntityClientWithStub as l,BasicLocalization as c,ObjectUtil as s,UserAlertType as d,ByteUtil as u}from"zavadil-ts-common";import{useMemo as h,useCallback as p,useEffect as m,useState as f,useRef as g,createContext as v,useContext as b}from"react";import{InputGroup as y,Form as C,Button as w,Spinner as x,Dropdown as N,Pagination as z,Table as k,Stack as O,ProgressBar as S,Modal as E,Badge as P,Placeholder as L}from"react-bootstrap";import{BsXCircle as I,BsTrash as G,BsFillCaretDownFill as B,BsFillCaretUpFill as M,BsCheckCircle as A,BsCircle as D,BsCheckAll as F,BsBug as j,BsExclamationDiamond as H,BsInfo as T,BsQuestion as V,BsEye as R}from"react-icons/bs";import{FaFloppyDisk as U}from"react-icons/fa6";import{VscEyeClosed as J}from"react-icons/vsc";var K=function(){return K=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},K.apply(this,arguments)};function Y(e,n,t){if(t||2===arguments.length)for(var i,r=0,a=n.length;r<a;r++)!i&&r in n||(i||(i=Array.prototype.slice.call(n,0,r)),i[r]=n[r]);return e.concat(i||Array.prototype.slice.call(n))}function q(t){var r=t.value,a=t.onChange,o=t.onReset,l=t.onBlur,c=t.disabled,s=t.className,d=h((function(){return i.getNonEmpty(r)}),[r]),u=h((function(){return i.isBlank(r)}),[d]),m=p((function(){o?o():a("")}),[o,a]);return e(y,K({className:s},{children:[n(C.Control,{type:"text",disabled:c,value:d,onChange:function(e){return a(e.target.value)},onBlur:l}),n(w,K({onClick:m,disabled:u},{children:n("div",K({className:"d-flex align-items-center"},{children:n(I,{})}))}))]}))}function Q(e){var t=e.value,i=e.onChange,a=e.disabled;return n(C.Control,{type:"date",disabled:a,value:r.formatDateForInput(t),onChange:function(e){i(r.parseDate(e.target.value))}})}function W(e){var t=e.value,i=e.onChange,a=e.disabled;return n(C.Control,{type:"datetime-local",disabled:a,value:r.formatDateTimeForInput(t),onChange:function(e){i(r.parseDate(e.target.value))}})}function X(t){var i=t.disabled,r=t.variant,a=t.icon,o=t.size,l=t.children,c=t.onClick;return n(w,K({disabled:!0===i,size:o,onClick:c,variant:r},{children:e("div",K({className:"d-flex align-items-center gap-2"},{children:[a,l&&n("div",{children:l})]}))}))}function Z(t){var i=t.disabled,r=t.checked,a=t.iconOn,o=t.iconOff,l=t.size,c=t.onChange;return e("div",K({className:"d-flex align-items-center gap-2 cursor-pointer",onClick:function(e){return c(!r)}},{children:[n(C.Switch,{disabled:i,size:l,type:"switch",checked:r,readOnly:!0,className:"cursor-pointer"}),r?a:o]}))}function $(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.variant,c=e.onClick;return n(X,K(!0===r?{disabled:!0,onClick:c,size:o,variant:l,icon:n(x,{size:"sm"})}:{disabled:t,onClick:c,icon:i,size:o,variant:l},{children:a}))}function _(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.onClick,c=e.isChanged,s=h((function(){return i||n(U,{})}),[i]),d=h((function(){return c?n("strong",{children:a}):a}),[c,a]);return n($,K({disabled:t||!1===c,onClick:l,icon:s,loading:r,size:o},{children:d}))}function ee(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.onClick,c=e.isChanged,s=h((function(){return i||n(G,{})}),[i]);return n($,K({disabled:t||!1===c,onClick:l,icon:s,loading:r,size:o,variant:"danger"},{children:a}))}function ne(t){var r=t.value,a=t.options,o=t.disabled,l=t.onChange,c=t.showEmptyOption,s=t.emptyOptionLabel;return m((function(){i.isBlank(r)?a.length>0&&!0!==c&&l(a[0].id):a.find((function(e){return e.id===r}))||(!0!==c&&a.length>0?l(a[0].id):l(""))}),[r,a,c,l]),e(C.Select,K({value:r||"",onChange:function(e){return l(e.target.value)},disabled:o},{children:[!0===c&&n("option",K({value:""},{children:s||""}),""),a?a.map((function(e,t){return n("option",K({value:e.id||""},{children:e.label||""}),t)})):n("span",{children:n(x,{})})]}))}function te(e){var t=e.value,i=e.options,r=e.disabled,o=e.onChange,l=e.showEmptyOption,c=e.emptyOptionLabel,s=h((function(){return t?String(t):""}),[t]),d=h((function(){return i?i.map((function(e){return{id:e.id?String(e.id):"",label:e.label}})):[]}),[i]),u=p((function(e){return o(a.parseNumber(e))}),[o]);return n(ne,{disabled:r,value:s,options:d,onChange:u,showEmptyOption:l,emptyOptionLabel:c})}function ie(e){var t=e.id,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel,d=h((function(){var e=[];return l&&(e=i?l.sort((function(e,n){return e.name>n.name?1:-1})):l),e.map((function(e){return{id:e.id,label:a?a(e):e.name}}))}),[l]);return n(te,{disabled:r,value:t,options:d,onChange:o,showEmptyOption:c,emptyOptionLabel:s})}function re(e){var t=e.value,i=e.options,r=e.onChange,a=e.showEmptyOption,o=e.emptyOptionLabel,l=h((function(){return i?i.map((function(e){return{id:e,label:e}})):[]}),[i]);return n(ne,{value:t,options:l,onChange:r,showEmptyOption:a,emptyOptionLabel:o})}function ae(e){var t=e.id,i=e.label,r=e.disabled,a=e.checked,o=e.size,l=e.onChange;return n(C.Switch,{disabled:r,id:t,size:o,type:"switch",checked:a,onChange:function(e){return l(!a)},className:"cursor-pointer",label:i})}function oe(t){var i=t.selected,r=t.disabled,a=t.labelGetter,l=t.onChange,c=t.onSearch,s=f(),d=s[0],u=s[1],v=f(),b=v[0],y=v[1],C=f(),w=C[0],x=C[1],z=g(),k=p((function(e){return a?a(e):"name"in e&&"string"==typeof e.name?e.name:"[".concat(e.id,"]")}),[a]),O=h((function(){return i?"border rounded border-primary":void 0}),[i]),S=p((function(){console.log("user left control"),w&&(x(void 0),y(i?k(i):""))}),[l,w,i,k]),E=p((function(){z.current=window.setTimeout(S,100)}),[z,S]),P=p((function(){z.current&&clearTimeout(z.current)}),[z]);m((function(){return P}),[]),m((function(){y(i?k(i):""),d&&(d.cancel(),u(void 0)),x(void 0)}),[i]);var L=p((function(){l(null),y(""),d&&(d.cancel(),u(void 0)),x(void 0)}),[l,d]),I=p((function(e){y(e),d&&d.cancel();var n=new o(c(e));n.promise.then(x),u(n)}),[d,c]),G=p((function(e){console.log("user selected item"),x(void 0),l(K({},e))}),[l]);return n("div",K({onBlur:E,onFocus:P},{children:e(N,K({defaultShow:!1,show:null!==w},{children:[n(q,{disabled:r,value:b,onChange:I,onReset:L,className:O}),w&&n(N.Menu,{children:w.map((function(e){return n(N.Item,K({onClick:function(n){P(),G(e)},active:e.id===(null==i?void 0:i.id)},{children:k(e)}),e.id)}))})]}))}))}function le(e){var t=e.selected,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.entityClient,c=p((function(e){return l.loadPage({search:i.safeLowercase(e),page:0,size:10,sorting:[{name:"id"}]}).then((function(e){return e.content}))}),[a]);return n(oe,{disabled:r,selected:t,labelGetter:a,onSearch:c,onChange:o})}function ce(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.entityClient,c=f(null),s=c[0],d=c[1];m((function(){t?s&&s.id===t?d(K({},s)):o instanceof l?o.loadSingleStub(t).then(d):o.loadSingle(t).then(d):d(null)}),[t]);var u=p((function(e){var n=e?e.id:null;n!==t&&a(n),d(e)}),[t,a]);return n(le,{disabled:i,selected:s,labelGetter:r,entityClient:o,onChange:u})}function se(e){var t=e.selected,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.lookupClient,c=h((function(){return a||function(e){return e.name}}),[a]),s=p((function(e){return l.loadPage({search:i.safeLowercase(e),page:0,size:10,sorting:[{name:"name"}]}).then((function(e){return e.content}))}),[a]);return n(oe,{disabled:r,selected:t,labelGetter:c,onSearch:s,onChange:o})}function de(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.lookupClient,l=f(null),c=l[0],s=l[1];m((function(){t?c&&c.id===t?s(K({},c)):o.loadSingle(t).then(s):s(null)}),[t]);var d=p((function(e){var n=e?e.id:null;n!==t&&a(n),s(e)}),[t,c]);return n(se,{disabled:i,selected:c,labelGetter:r,lookupClient:o,onChange:d})}function ue(e){var t=e.id,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel,d=h((function(){var e=[];return l&&(e=i?l.sort((function(e,n){return a(e)>a(n)?1:-1})):l),e.map((function(e){return{id:e.id,label:a(e)}}))}),[l]);return n(te,{disabled:r,value:t,options:d,onChange:o,showEmptyOption:c,emptyOptionLabel:s})}function he(e){var t=e.value,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel;return n(ue,{disabled:r,id:t?t.id:null,options:l,sort:i,onChange:function(e){o(l&&e?l.find((function(n){return n.id===e})):void 0)},labelGetter:a,showEmptyOption:c,emptyOptionLabel:s})}function pe(e){var t=e.value,i=e.sort,r=e.disabled,a=e.onChange,o=e.options,l=e.showEmptyOption,c=e.emptyOptionLabel;return n(he,{value:t,labelGetter:function(e){return e.name},disabled:r,sort:i,options:o,onChange:a,showEmptyOption:l,emptyOptionLabel:c})}function me(e){var t=e.id,i=e.sort,r=e.disabled,a=e.onChange,o=e.options,l=e.showEmptyOption,c=e.emptyOptionLabel;return n(ue,{id:t,labelGetter:function(e){return e.name},disabled:r,sort:i,options:o,onChange:a,showEmptyOption:l,emptyOptionLabel:c})}"function"==typeof SuppressedError&&SuppressedError;var fe=v(new c);function ge(e){var i=e.text,r=e.tag,a=b(fe),o=h((function(){if(void 0!==r&&""!==r)return"string"==typeof r?{tags:[r]}:{tags:r}}),[r]),l=h((function(){return a.translate(i,o)}),[a,i,o]);return n(t,{children:l})}function ve(e){var t=e.paging,i=e.totalItems,r=e.onPagingChanged,a=Math.ceil(i/t.size),o=function(e){t.page=e,r(s.clone(t))},l=[];if(a>1){l.push(n(z.First,{onClick:function(){return o(0)},disabled:0===t.page},"first")),l.push(n(z.Prev,{onClick:function(){return o(t.page-1)},disabled:0===t.page},"prev"));var c=Math.round(3.5),d=t.page>c?t.page-c:0,u=d+10;u>=a&&(u=a-1),d>0&&l.push(n(z.Ellipsis,{disabled:!0},"ellipsisStart"));for(var h=function(e){l.push(n(z.Item,K({active:e===t.page,onClick:function(){return o(e)}},{children:e+1}),e))},p=d;p<=u;p++)h(p);u<a-1&&l.push(n(z.Ellipsis,{disabled:!0},"ellipsisEnd")),l.push(n(z.Next,{onClick:function(){return o(t.page+1)},disabled:t.page===a-1},"next")),l.push(n(z.Last,{onClick:function(){return o(a-1)},disabled:t.page===a-1},"last"))}return n(z,K({size:"sm",className:"flex-wrap m-0"},{children:l}))}var be=[{id:10,label:"10"},{id:100,label:"100"},{id:1e3,label:"1000"}];function ye(r){var a=r.hover,o=r.showPagingOnBottom,l=r.showPageSizeSelection,c=r.striped,d=r.bordered,u=r.header,p=r.children,m=r.paging,f=r.totalItems,g=r.onPagingChanged,v=Math.ceil(f/m.size),b=h((function(){var e=m.size;if(null===be.find((function(n){return n.id===e}))){var n=s.clone(be);return n.push({id:e,label:String(e)}),n}return be}),[m]);return n("div",{children:e(k,K({hover:a,striped:c,responsive:!0,bordered:d},{children:[e("thead",{children:[n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex justify-content-between align-items-center gap-2"},{children:[e("div",{children:[n(ge,{text:"Page"}),": ",m.page+1," / ",v]}),v>0&&n(ve,{paging:m,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ge,{text:"Total items"}),": ",f]})]}))}))}),n("tr",{children:u.map((function(r,a){var o=!1===r.sort?"":i.isBlank(r.sort)?r.name:r.sort;if(i.isBlank(o)||!o)return n("th",{children:r.label},a);var l=m.sorting&&m.sorting.find((function(e){return e.name===o}));return e("th",K({className:"user-select-none text-nowrap",role:"button",onClick:function(e){return function(e,n){m.sorting||(m.sorting=[]);var t=m.sorting.find((function(e){return e.name===n})),i=t&&1===m.sorting.length;e.ctrlKey||i||(m.sorting=[],t=void 0),t?t.desc=!t.desc:m.sorting.push({name:n}),g(s.clone(m))}(e,o)}},{children:[r.label,l?l.desc?n(B,{}):n(M,{}):n(t,{})]}),a)}))})]}),n("tbody",{children:p}),f>0&&e("tfoot",{children:[o&&n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex justify-content-between align-items-center gap-2"},{children:[e("div",{children:[n(ge,{text:"Page"}),": ",m.page+1," / ",v]}),v>0&&n(ve,{paging:m,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ge,{text:"Total items"}),": ",f]})]}))}))}),l&&n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex align-items-center gap-2 justify-content-end"},{children:[e("div",K({className:"text-nowrap"},{children:[n(ge,{text:"Page size"}),":"]})),n("div",{children:n(te,{value:m.size,options:b,onChange:function(e){m.size=e||10,g(K({},m))},showEmptyOption:!1})})]}))}))})]})]}))})}function Ce(e){e.disabled;var t=e.checked,i=e.iconOn,r=e.iconOff,a=e.size,o=e.onChange,l=h((function(){return t?i||n(A,{size:a}):r||n(D,{size:a,className:"text-muted"})}),[t,i,r,a]);return n("div",K({className:"d-flex align-items-center cursor-pointer",onClick:function(e){e.stopPropagation(),e.preventDefault(),o(!t)}},{children:l}))}function we(t){var i=t.showSelect,r=t.header,a=t.items,o=t.onSelect,l=t.onClick,c=t.totalItems,d=t.paging,u=t.onPagingChanged,g=f(!1),v=g[0],b=g[1],y=f(),C=y[0],w=y[1],x=p((function(e){C&&w(C.map((function(n){return{selected:e,item:n.item}}))),b(e)}),[C]),N=h((function(){var e=Y([],r,!0);return!1!==i&&e.unshift({name:"",label:n("div",K({className:"py-1"},{children:n(Ce,{checked:v,onChange:function(){return x(!v)},iconOn:n(F,{})})}))}),e}),[r,v,x]);return m((function(){w(a?a.map((function(e){return{selected:v,item:e}})):void 0)}),[a]),m((function(){C&&o&&o(C.filter((function(e){return e.selected})).map((function(e){return e.item})))}),[C,o]),n(ye,K({header:N,hover:void 0!==l,paging:d,striped:!0,totalItems:c,onPagingChanged:u},{children:C&&C.map((function(t,a){return e("tr",K({className:"selectable ".concat(l?"cursor-pointer":""," ").concat(t.selected?"table-active table-primary":""),onClick:function(e){l&&l(t.item)}},{children:[!1!==i&&n("td",{children:n("div",K({className:"py-2 d-flex align-items-center"},{children:n(Ce,{checked:t.selected,onChange:function(){t.selected=!t.selected,v&&!t.selected&&b(!1),w(Y([],C,!0))}})}))}),r.map((function(e,i){var r,a=e.renderer||(r=e.name,function(e){return s.getNestedValue(e,r)});return n("td",{children:a(t.item)},i)}))]}),a)}))}))}function xe(e){var t=e.cols,i=e.rows,r=e.size,a=h((function(){return void 0===t?1:t}),[t]),o=h((function(){return void 0===i?20:i}),[i]);return h((function(){return void 0===r?"lg":r}),[r]),n("div",{children:n(k,K({responsive:!0},{children:n("tbody",{children:Array.from({length:o},(function(e,t){return n("tr",{children:Array.from({length:a},(function(e,t){return n("td",{children:n("div",{className:"w-100 p-1 m-1"})},t)}))},t)}))})}))})}function Ne(e){var t=e.value;return n("div",K({className:"text-nowrap"},{children:r.formatDateTimeForHumans(t)}))}function ze(e){var i=e.ms;return s.isEmpty(i)?n(t,{}):n("div",K({className:"text-nowrap"},{children:r.formatDuration(i)}))}function ke(e){var t=e.date,i=h((function(){return s.isEmpty(t)?null:Date.now()-t.getTime()}),[t]);return n(ze,{ms:i})}var Oe=new Map([[d.error,j],[d.warning,H],[d.info,T]]);function Se(e){var t=e.type,i=e.size,r=e.customVariant,a=Oe.get(t)||V;return n("div",K({className:"d-flex align-items-center text-".concat(void 0===r?t:r)},{children:a({size:i})}))}function Ee(t){var i=t.userAlert,a=t.maxDurationMs;return e(O,K({direction:"horizontal",gap:2,className:"align-items-center"},{children:[i.remainsMs&&n("div",K({style:{width:20}},{children:n(S,{min:0,max:a,now:i.remainsMs,variant:i.type})})),n("div",{children:r.formatDateForHumans(i.time)}),n(Se,{type:i.type}),n("div",{children:i.message})]}))}function Pe(i){var r=i.userAlerts,a=f(!1),o=a[0],l=a[1],c=f(r.alerts.length),s=c[0],d=c[1],u=f(Y([],r.visibleAlerts,!0)),h=u[0],g=u[1],v=f(r.getSummary()),b=v[0],y=v[1],C=p((function(){d(r.alerts.length),g(Y([],o?r.alerts:r.visibleAlerts,!0)),y(r.getSummary())}),[r,o]);return m((function(){r.addOnChangeHandler(C);var e=setInterval((function(){return r.updateVisibility()}),100);return function(){clearInterval(e),r.removeOnChangeHandler(C)}}),[r,C]),s<=0?n(t,{}):e("div",K({className:"user-alerts border rounded bg-body text-body position-fixed text-end",style:{bottom:15,right:15,zIndex:2147483647}},{children:[h.length>0&&n("div",K({className:"max-w-50 p-2 border-bottom"},{children:h.map((function(e,t){return n(Ee,{userAlert:e,maxDurationMs:r.maxVisibilityMs},t)}))})),n("div",K({className:"p-2"},{children:e(O,K({direction:"horizontal",gap:2,className:"justify-content-end align-items-center"},{children:[n(X,o?K({size:"sm",variant:"primary",onClick:function(){return l(!1)},icon:n(J,{})},{children:"Hide"}):K({size:"sm",variant:"primary",onClick:function(){return l(!0)},icon:n(R,{})},{children:"Show All"})),Array.from(b.entries()).map((function(t,i){return e(O,K({direction:"horizontal",gap:1,className:"px-1 border rounded align-items-center"},{children:[n(Se,{type:t[0],customVariant:0===t[1]?"muted":void 0}),n("div",K({className:t[1]>0?"text-".concat(t[0]," fw-bold"):"text-muted"},{children:t[1]}))]}),i)})),n(X,K({size:"sm",variant:"danger",onClick:function(){return r.reset()},icon:n(G,{})},{children:"Reset"}))]}))}))]}))}var Le=function(){function e(e){this.setProps=e}return e.prototype.confirm=function(e,n,t){var i=this;this.setProps({name:e,text:n,onConfirm:function(){t(),i.setProps(void 0)},onClose:function(){return i.setProps(void 0)}})},e}(),Ie=v(new Le((function(){})));function Ge(t){var i=t.name,r=t.text,a=t.onClose,o=t.onConfirm;return e(E,K({show:!0,backdrop:!0,onHide:a},{children:[n(E.Header,{children:i||"Confirm"}),n(E.Body,{children:r}),n(E.Footer,{children:e(O,K({direction:"horizontal"},{children:[n(w,K({variant:"link",onClick:a},{children:n(ge,{text:"Back"})})),n(w,K({variant:"primary",onClick:o},{children:n(ge,{text:"Yes"})}))]}))})]}))}function Be(t){var i=t.stats,r=i.heapSize,a=i.heapMaxSize,o=i.heapFreeSize,l=r-o;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:"Java Heap"}),e("pre",{children:["[",u.formatByteSize(r)," / ",u.formatByteSize(a),"]"]})]})),e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:"Used:"}),n(P,K({className:"bg-warning text-bg-warning"},{children:u.formatByteSize(l)})),n("pre",{children:"Free:"}),n(P,K({className:"bg-success text-white"},{children:u.formatByteSize(o)}))]})),n("div",K({className:"p-1"},{children:e(S,K({min:0,max:a},{children:[n(S,{variant:"warning",min:0,now:l,max:a}),n(S,{variant:"success",min:0,now:o,max:a})]}))}))]})}function Me(t){var i=t.name,r=t.stats;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:i}),e("pre",{children:["[",r.cachedItems,r.capacity>0&&" / ",r.capacity>0&&r.capacity,"]"]})]})),r.capacity>0&&n("div",K({className:"p-1"},{children:n(S,{now:r.cachedItems,min:0,max:r.capacity})}))]})}var Ae=new Map([["Idle","secondary"],["Processing","success"],["Loading","warn"]]);function De(e){var t=e.state,i=Ae.get(t)||"light";return n(P,K({className:"bg-".concat(i," text-bg-").concat(i)},{children:t}))}function Fe(t){var i=t.name,r=t.stats,a=r?r.remaining+r.processed:void 0;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:i}),e("pre",{children:["[",void 0!==(null==r?void 0:r.processed)?r.processed:"?"," / ",void 0!==a?a:"?","]"]}),n(De,{state:r?r.state:"Unknown"})]})),n("div",K({className:"p-1"},{children:r?n(S,{variant:"primary",striped:!0,animated:!0,min:0,now:r.processed,max:a||1}):n(L,K({className:"w-100",animation:"glow"},{children:n(L,{className:"w-100"})}))}))]})}function je(e){var t=e.children,i=e.center,r=h((function(){return!1===i?"":"d-flex align-items-center justify-content-center"}),[i]);return n("div",K({className:"w-100 h-100 position-absolute ".concat(r),style:{left:0,right:0,top:0,bottom:0}},{children:t}))}export{ye as AdvancedTable,ce as AutocompleteEntityIdSelect,le as AutocompleteEntitySelect,de as AutocompleteLookupIdSelect,se as AutocompleteLookupSelect,oe as AutocompleteSelect,Me as CacheStatsControl,Ge as ConfirmDialog,Ie as ConfirmDialogContext,Le as ConfirmDialogContextData,Q as DateInput,Ne as DateTime,W as DateTimeInput,ee as DeleteButton,ze as Duration,ke as Elapsed,ue as EntityIdSelect,he as EntitySelect,me as EntityWithNameIdSelect,pe as EntityWithNameSelect,re as EnumSelect,X as IconButton,Z as IconSwitch,Be as JavaHeapControl,$ as LoadingButton,fe as LocalizationContext,ge as Localize,ie as LookupSelect,te as NumberSelect,De as QueueStateControl,Fe as QueueStatsControl,_ as SaveButton,je as Spread,ne as StringSelect,ae as Switch,ve as TablePagination,xe as TablePlaceholder,we as TableWithSelect,q as TextInputWithReset,Se as UserAlertTypeIcon,Ee as UserAlertWidget,Pe as UserAlertsWidget};
1
+ import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{StringUtil as i,DateUtil as r,NumberUtil as a,CancellablePromise as o,EntityClientWithStub as l,BasicLocalization as c,ObjectUtil as s,UserAlertType as d,ByteUtil as u}from"zavadil-ts-common";import{useMemo as h,useCallback as p,useEffect as m,useState as f,useRef as g,createContext as v,useContext as b}from"react";import{InputGroup as y,Form as C,Button as w,Spinner as x,Dropdown as N,Pagination as z,Table as k,Stack as O,ProgressBar as S,Modal as E,Badge as P,Placeholder as L}from"react-bootstrap";import{BsXCircle as I,BsTrash as G,BsFillCaretDownFill as B,BsFillCaretUpFill as M,BsCheckCircle as A,BsCircle as D,BsCheckAll as F,BsBug as j,BsExclamationDiamond as H,BsInfo as T,BsQuestion as V,BsEye as R}from"react-icons/bs";import{FaFloppyDisk as U}from"react-icons/fa6";import{VscEyeClosed as J}from"react-icons/vsc";var K=function(){return K=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},K.apply(this,arguments)};function Y(e,n,t){if(t||2===arguments.length)for(var i,r=0,a=n.length;r<a;r++)!i&&r in n||(i||(i=Array.prototype.slice.call(n,0,r)),i[r]=n[r]);return e.concat(i||Array.prototype.slice.call(n))}function q(t){var r=t.value,a=t.onChange,o=t.onReset,l=t.onBlur,c=t.disabled,s=t.className,d=h((function(){return i.getNonEmpty(r)}),[r]),u=h((function(){return i.isBlank(r)}),[d]),m=p((function(){o?o():a("")}),[o,a]);return e(y,K({className:s},{children:[n(C.Control,{type:"text",disabled:c,value:d,onChange:function(e){return a(e.target.value)},onBlur:l}),n(w,K({onClick:m,disabled:u},{children:n("div",K({className:"d-flex align-items-center"},{children:n(I,{})}))}))]}))}function Q(e){var t=e.value,i=e.onChange,a=e.disabled;return n(C.Control,{type:"date",disabled:a,value:r.formatDateForInput(t),onChange:function(e){i(r.parseDate(e.target.value))}})}function W(e){var t=e.value,i=e.onChange,a=e.disabled;return n(C.Control,{type:"datetime-local",disabled:a,value:r.formatDateTimeForInput(t),onChange:function(e){i(r.parseDate(e.target.value))}})}function X(t){var i=t.disabled,r=t.variant,a=t.icon,o=t.size,l=t.children,c=t.onClick;return n(w,K({disabled:!0===i,size:o,onClick:c,variant:r},{children:e("div",K({className:"d-flex align-items-center gap-2"},{children:[a,l&&n("div",{children:l})]}))}))}function Z(t){var i=t.disabled,r=t.checked,a=t.iconOn,o=t.iconOff,l=t.size,c=t.onChange;return e("div",K({className:"d-flex align-items-center gap-2 cursor-pointer",onClick:function(e){return c(!r)}},{children:[n(C.Switch,{disabled:i,size:l,type:"switch",checked:r,readOnly:!0,className:"cursor-pointer"}),r?a:o]}))}function $(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.variant,c=e.onClick;return n(X,K(!0===r?{disabled:!0,onClick:c,size:o,variant:l,icon:n(x,{size:"sm"})}:{disabled:t,onClick:c,icon:i,size:o,variant:l},{children:a}))}function _(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.onClick,c=e.isChanged,s=h((function(){return i||n(U,{})}),[i]),d=h((function(){return c?n("strong",{children:a}):a}),[c,a]);return n($,K({disabled:t||!1===c,onClick:l,icon:s,loading:r,size:o},{children:d}))}function ee(e){var t=e.disabled,i=e.icon,r=e.loading,a=e.children,o=e.size,l=e.onClick,c=e.isChanged,s=h((function(){return i||n(G,{})}),[i]);return n($,K({disabled:t||!1===c,onClick:l,icon:s,loading:r,size:o,variant:"danger"},{children:a}))}function ne(t){var r=t.value,a=t.options,o=t.disabled,l=t.onChange,c=t.showEmptyOption,s=t.emptyOptionLabel;return m((function(){i.isBlank(r)&&a.length>0&&!0!==c&&l(a[0].id)}),[r,a,c,l]),e(C.Select,K({value:r||"",onChange:function(e){return l(e.target.value)},disabled:o},{children:[!0===c&&n("option",K({value:""},{children:s||""}),""),a?a.map((function(e,t){return n("option",K({value:e.id||""},{children:e.label||""}),t)})):n("span",{children:n(x,{})})]}))}function te(e){var t=e.value,i=e.options,r=e.disabled,o=e.onChange,l=e.showEmptyOption,c=e.emptyOptionLabel,s=h((function(){return t?String(t):""}),[t]),d=h((function(){return i?i.map((function(e){return{id:e.id?String(e.id):"",label:e.label}})):[]}),[i]),u=p((function(e){return o(a.parseNumber(e))}),[o]);return n(ne,{disabled:r,value:s,options:d,onChange:u,showEmptyOption:l,emptyOptionLabel:c})}function ie(e){var t=e.id,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel,d=h((function(){var e=[];return l&&(e=i?l.sort((function(e,n){return e.name>n.name?1:-1})):l),e.map((function(e){return{id:e.id,label:a?a(e):e.name}}))}),[l]);return n(te,{disabled:r,value:t,options:d,onChange:o,showEmptyOption:c,emptyOptionLabel:s})}function re(e){var t=e.value,i=e.options,r=e.onChange,a=e.showEmptyOption,o=e.emptyOptionLabel,l=h((function(){return i?i.map((function(e){return{id:e,label:e}})):[]}),[i]);return n(ne,{value:t,options:l,onChange:r,showEmptyOption:a,emptyOptionLabel:o})}function ae(e){var t=e.id,i=e.label,r=e.disabled,a=e.checked,o=e.size,l=e.onChange;return n(C.Switch,{disabled:r,id:t,size:o,type:"switch",checked:a,onChange:function(e){return l(!a)},className:"cursor-pointer",label:i})}function oe(t){var i=t.selected,r=t.disabled,a=t.labelGetter,l=t.onChange,c=t.onSearch,s=f(),d=s[0],u=s[1],v=f(),b=v[0],y=v[1],C=f(),w=C[0],x=C[1],z=g(),k=p((function(e){return a?a(e):"name"in e&&"string"==typeof e.name?e.name:"[".concat(e.id,"]")}),[a]),O=h((function(){return i?"border rounded border-primary":void 0}),[i]),S=p((function(){console.log("user left control"),w&&(x(void 0),y(i?k(i):""))}),[l,w,i,k]),E=p((function(){z.current=window.setTimeout(S,100)}),[z,S]),P=p((function(){z.current&&clearTimeout(z.current)}),[z]);m((function(){return P}),[]),m((function(){y(i?k(i):""),d&&(d.cancel(),u(void 0)),x(void 0)}),[i]);var L=p((function(){l(null),y(""),d&&(d.cancel(),u(void 0)),x(void 0)}),[l,d]),I=p((function(e){y(e),d&&d.cancel();var n=new o(c(e));n.promise.then(x),u(n)}),[d,c]),G=p((function(e){console.log("user selected item"),x(void 0),l(K({},e))}),[l]);return n("div",K({onBlur:E,onFocus:P},{children:e(N,K({defaultShow:!1,show:null!==w},{children:[n(q,{disabled:r,value:b,onChange:I,onReset:L,className:O}),w&&n(N.Menu,{children:w.map((function(e){return n(N.Item,K({onClick:function(n){P(),G(e)},active:e.id===(null==i?void 0:i.id)},{children:k(e)}),e.id)}))})]}))}))}function le(e){var t=e.selected,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.entityClient,c=p((function(e){return l.loadPage({search:i.safeLowercase(e),page:0,size:10,sorting:[{name:"id"}]}).then((function(e){return e.content}))}),[a]);return n(oe,{disabled:r,selected:t,labelGetter:a,onSearch:c,onChange:o})}function ce(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.entityClient,c=f(null),s=c[0],d=c[1];m((function(){t?s&&s.id===t?d(K({},s)):o instanceof l?o.loadSingleStub(t).then(d):o.loadSingle(t).then(d):d(null)}),[t]);var u=p((function(e){var n=e?e.id:null;n!==t&&a(n),d(e)}),[t,a]);return n(le,{disabled:i,selected:s,labelGetter:r,entityClient:o,onChange:u})}function se(e){var t=e.selected,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.lookupClient,c=h((function(){return a||function(e){return e.name}}),[a]),s=p((function(e){return l.loadPage({search:i.safeLowercase(e),page:0,size:10,sorting:[{name:"name"}]}).then((function(e){return e.content}))}),[a]);return n(oe,{disabled:r,selected:t,labelGetter:c,onSearch:s,onChange:o})}function de(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.lookupClient,l=f(null),c=l[0],s=l[1];m((function(){t?c&&c.id===t?s(K({},c)):o.loadSingle(t).then(s):s(null)}),[t]);var d=p((function(e){var n=e?e.id:null;n!==t&&a(n),s(e)}),[t,c]);return n(se,{disabled:i,selected:c,labelGetter:r,lookupClient:o,onChange:d})}function ue(e){var t=e.id,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel,d=h((function(){var e=[];return l&&(e=i?l.sort((function(e,n){return a(e)>a(n)?1:-1})):l),e.map((function(e){return{id:e.id,label:a(e)}}))}),[l]);return n(te,{disabled:r,value:t,options:d,onChange:o,showEmptyOption:c,emptyOptionLabel:s})}function he(e){var t=e.value,i=e.sort,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.options,c=e.showEmptyOption,s=e.emptyOptionLabel;return n(ue,{disabled:r,id:t?t.id:null,options:l,sort:i,onChange:function(e){o(l&&e?l.find((function(n){return n.id===e})):void 0)},labelGetter:a,showEmptyOption:c,emptyOptionLabel:s})}function pe(e){var t=e.value,i=e.sort,r=e.disabled,a=e.onChange,o=e.options,l=e.showEmptyOption,c=e.emptyOptionLabel;return n(he,{value:t,labelGetter:function(e){return e.name},disabled:r,sort:i,options:o,onChange:a,showEmptyOption:l,emptyOptionLabel:c})}function me(e){var t=e.id,i=e.sort,r=e.disabled,a=e.onChange,o=e.options,l=e.showEmptyOption,c=e.emptyOptionLabel;return n(ue,{id:t,labelGetter:function(e){return e.name},disabled:r,sort:i,options:o,onChange:a,showEmptyOption:l,emptyOptionLabel:c})}"function"==typeof SuppressedError&&SuppressedError;var fe=v(new c);function ge(e){var i=e.text,r=e.tag,a=b(fe),o=h((function(){if(void 0!==r&&""!==r)return"string"==typeof r?{tags:[r]}:{tags:r}}),[r]),l=h((function(){return a.translate(i,o)}),[a,i,o]);return n(t,{children:l})}function ve(e){var t=e.paging,i=e.totalItems,r=e.onPagingChanged,a=Math.ceil(i/t.size),o=function(e){t.page=e,r(s.clone(t))},l=[];if(a>1){l.push(n(z.First,{onClick:function(){return o(0)},disabled:0===t.page},"first")),l.push(n(z.Prev,{onClick:function(){return o(t.page-1)},disabled:0===t.page},"prev"));var c=Math.round(3.5),d=t.page>c?t.page-c:0,u=d+10;u>=a&&(u=a-1),d>0&&l.push(n(z.Ellipsis,{disabled:!0},"ellipsisStart"));for(var h=function(e){l.push(n(z.Item,K({active:e===t.page,onClick:function(){return o(e)}},{children:e+1}),e))},p=d;p<=u;p++)h(p);u<a-1&&l.push(n(z.Ellipsis,{disabled:!0},"ellipsisEnd")),l.push(n(z.Next,{onClick:function(){return o(t.page+1)},disabled:t.page===a-1},"next")),l.push(n(z.Last,{onClick:function(){return o(a-1)},disabled:t.page===a-1},"last"))}return n(z,K({size:"sm",className:"flex-wrap m-0"},{children:l}))}var be=[{id:10,label:"10"},{id:100,label:"100"},{id:1e3,label:"1000"}];function ye(r){var a=r.hover,o=r.showPagingOnBottom,l=r.showPageSizeSelection,c=r.striped,d=r.bordered,u=r.header,p=r.children,m=r.paging,f=r.totalItems,g=r.onPagingChanged,v=Math.ceil(f/m.size),b=h((function(){var e=m.size;if(null===be.find((function(n){return n.id===e}))){var n=s.clone(be);return n.push({id:e,label:String(e)}),n}return be}),[m]);return n("div",{children:e(k,K({hover:a,striped:c,responsive:!0,bordered:d},{children:[e("thead",{children:[n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex justify-content-between align-items-center gap-2"},{children:[e("div",{children:[n(ge,{text:"Page"}),": ",m.page+1," / ",v]}),v>0&&n(ve,{paging:m,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ge,{text:"Total items"}),": ",f]})]}))}))}),n("tr",{children:u.map((function(r,a){var o=!1===r.sort?"":i.isBlank(r.sort)?r.name:r.sort;if(i.isBlank(o)||!o)return n("th",{children:r.label},a);var l=m.sorting&&m.sorting.find((function(e){return e.name===o}));return e("th",K({className:"user-select-none text-nowrap",role:"button",onClick:function(e){return function(e,n){m.sorting||(m.sorting=[]);var t=m.sorting.find((function(e){return e.name===n})),i=t&&1===m.sorting.length;e.ctrlKey||i||(m.sorting=[],t=void 0),t?t.desc=!t.desc:m.sorting.push({name:n}),g(s.clone(m))}(e,o)}},{children:[r.label,l?l.desc?n(B,{}):n(M,{}):n(t,{})]}),a)}))})]}),n("tbody",{children:p}),f>0&&e("tfoot",{children:[o&&n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex justify-content-between align-items-center gap-2"},{children:[e("div",{children:[n(ge,{text:"Page"}),": ",m.page+1," / ",v]}),v>0&&n(ve,{paging:m,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ge,{text:"Total items"}),": ",f]})]}))}))}),l&&n("tr",{children:n("td",K({colSpan:u.length},{children:e("div",K({className:"d-flex align-items-center gap-2 justify-content-end"},{children:[e("div",K({className:"text-nowrap"},{children:[n(ge,{text:"Page size"}),":"]})),n("div",{children:n(te,{value:m.size,options:b,onChange:function(e){m.size=e||10,g(K({},m))},showEmptyOption:!1})})]}))}))})]})]}))})}function Ce(e){e.disabled;var t=e.checked,i=e.iconOn,r=e.iconOff,a=e.size,o=e.onChange,l=h((function(){return t?i||n(A,{size:a}):r||n(D,{size:a,className:"text-muted"})}),[t,i,r,a]);return n("div",K({className:"d-flex align-items-center cursor-pointer",onClick:function(e){e.stopPropagation(),e.preventDefault(),o(!t)}},{children:l}))}function we(t){var i=t.showSelect,r=t.header,a=t.items,o=t.onSelect,l=t.onClick,c=t.totalItems,d=t.paging,u=t.onPagingChanged,g=f(!1),v=g[0],b=g[1],y=f(),C=y[0],w=y[1],x=p((function(e){C&&w(C.map((function(n){return{selected:e,item:n.item}}))),b(e)}),[C]),N=h((function(){var e=Y([],r,!0);return!1!==i&&e.unshift({name:"",label:n("div",K({className:"py-1"},{children:n(Ce,{checked:v,onChange:function(){return x(!v)},iconOn:n(F,{})})}))}),e}),[r,v,x]);return m((function(){w(a?a.map((function(e){return{selected:v,item:e}})):void 0)}),[a]),m((function(){C&&o&&o(C.filter((function(e){return e.selected})).map((function(e){return e.item})))}),[C,o]),n(ye,K({header:N,hover:void 0!==l,paging:d,striped:!0,totalItems:c,onPagingChanged:u},{children:C&&C.map((function(t,a){return e("tr",K({className:"selectable ".concat(l?"cursor-pointer":""," ").concat(t.selected?"table-active table-primary":""),onClick:function(e){l&&l(t.item)}},{children:[!1!==i&&n("td",{children:n("div",K({className:"py-2 d-flex align-items-center"},{children:n(Ce,{checked:t.selected,onChange:function(){t.selected=!t.selected,v&&!t.selected&&b(!1),w(Y([],C,!0))}})}))}),r.map((function(e,i){var r,a=e.renderer||(r=e.name,function(e){return s.getNestedValue(e,r)});return n("td",{children:a(t.item)},i)}))]}),a)}))}))}function xe(e){var t=e.cols,i=e.rows,r=e.size,a=h((function(){return void 0===t?1:t}),[t]),o=h((function(){return void 0===i?20:i}),[i]);return h((function(){return void 0===r?"lg":r}),[r]),n("div",{children:n(k,K({responsive:!0},{children:n("tbody",{children:Array.from({length:o},(function(e,t){return n("tr",{children:Array.from({length:a},(function(e,t){return n("td",{children:n("div",{className:"w-100 p-1 m-1"})},t)}))},t)}))})}))})}function Ne(e){var t=e.value;return n("div",K({className:"text-nowrap"},{children:r.formatDateTimeForHumans(t)}))}function ze(e){var i=e.ms;return s.isEmpty(i)?n(t,{}):n("div",K({className:"text-nowrap"},{children:r.formatDuration(i)}))}function ke(e){var t=e.date,i=h((function(){return s.isEmpty(t)?null:Date.now()-t.getTime()}),[t]);return n(ze,{ms:i})}var Oe=new Map([[d.error,j],[d.warning,H],[d.info,T]]);function Se(e){var t=e.type,i=e.size,r=e.customVariant,a=Oe.get(t)||V;return n("div",K({className:"d-flex align-items-center text-".concat(void 0===r?t:r)},{children:a({size:i})}))}function Ee(t){var i=t.userAlert,a=t.maxDurationMs;return e(O,K({direction:"horizontal",gap:2,className:"align-items-center"},{children:[i.remainsMs&&n("div",K({style:{width:20}},{children:n(S,{min:0,max:a,now:i.remainsMs,variant:i.type})})),n("div",{children:r.formatDateForHumans(i.time)}),n(Se,{type:i.type}),n("div",{children:i.message})]}))}function Pe(i){var r=i.userAlerts,a=f(!1),o=a[0],l=a[1],c=f(r.alerts.length),s=c[0],d=c[1],u=f(Y([],r.visibleAlerts,!0)),h=u[0],g=u[1],v=f(r.getSummary()),b=v[0],y=v[1],C=p((function(){d(r.alerts.length),g(Y([],o?r.alerts:r.visibleAlerts,!0)),y(r.getSummary())}),[r,o]);return m((function(){r.addOnChangeHandler(C);var e=setInterval((function(){return r.updateVisibility()}),100);return function(){clearInterval(e),r.removeOnChangeHandler(C)}}),[r,C]),s<=0?n(t,{}):e("div",K({className:"user-alerts border rounded bg-body text-body position-fixed text-end",style:{bottom:15,right:15,zIndex:2147483647}},{children:[h.length>0&&n("div",K({className:"max-w-50 p-2 border-bottom"},{children:h.map((function(e,t){return n(Ee,{userAlert:e,maxDurationMs:r.maxVisibilityMs},t)}))})),n("div",K({className:"p-2"},{children:e(O,K({direction:"horizontal",gap:2,className:"justify-content-end align-items-center"},{children:[n(X,o?K({size:"sm",variant:"primary",onClick:function(){return l(!1)},icon:n(J,{})},{children:"Hide"}):K({size:"sm",variant:"primary",onClick:function(){return l(!0)},icon:n(R,{})},{children:"Show All"})),Array.from(b.entries()).map((function(t,i){return e(O,K({direction:"horizontal",gap:1,className:"px-1 border rounded align-items-center"},{children:[n(Se,{type:t[0],customVariant:0===t[1]?"muted":void 0}),n("div",K({className:t[1]>0?"text-".concat(t[0]," fw-bold"):"text-muted"},{children:t[1]}))]}),i)})),n(X,K({size:"sm",variant:"danger",onClick:function(){return r.reset()},icon:n(G,{})},{children:"Reset"}))]}))}))]}))}var Le=function(){function e(e){this.setProps=e}return e.prototype.confirm=function(e,n,t){var i=this;this.setProps({name:e,text:n,onConfirm:function(){t(),i.setProps(void 0)},onClose:function(){return i.setProps(void 0)}})},e}(),Ie=v(new Le((function(){})));function Ge(t){var i=t.name,r=t.text,a=t.onClose,o=t.onConfirm;return e(E,K({show:!0,backdrop:!0,onHide:a},{children:[n(E.Header,{children:i||"Confirm"}),n(E.Body,{children:r}),n(E.Footer,{children:e(O,K({direction:"horizontal"},{children:[n(w,K({variant:"link",onClick:a},{children:n(ge,{text:"Back"})})),n(w,K({variant:"primary",onClick:o},{children:n(ge,{text:"Yes"})}))]}))})]}))}function Be(t){var i=t.stats,r=i.heapSize,a=i.heapMaxSize,o=i.heapFreeSize,l=r-o;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:"Java Heap"}),e("pre",{children:["[",u.formatByteSize(r)," / ",u.formatByteSize(a),"]"]})]})),e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:"Used:"}),n(P,K({className:"bg-warning text-bg-warning"},{children:u.formatByteSize(l)})),n("pre",{children:"Free:"}),n(P,K({className:"bg-success text-white"},{children:u.formatByteSize(o)}))]})),n("div",K({className:"p-1"},{children:e(S,K({min:0,max:a},{children:[n(S,{variant:"warning",min:0,now:l,max:a}),n(S,{variant:"success",min:0,now:o,max:a})]}))}))]})}function Me(t){var i=t.name,r=t.stats;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:i}),e("pre",{children:["[",r.cachedItems,r.capacity>0&&" / ",r.capacity>0&&r.capacity,"]"]})]})),r.capacity>0&&n("div",K({className:"p-1"},{children:n(S,{now:r.cachedItems,min:0,max:r.capacity})}))]})}var Ae=new Map([["Idle","secondary"],["Processing","success"],["Loading","warn"]]);function De(e){var t=e.state,i=Ae.get(t)||"light";return n(P,K({className:"bg-".concat(i," text-bg-").concat(i)},{children:t}))}function Fe(t){var i=t.name,r=t.stats,a=r?r.remaining+r.processed:void 0;return e("div",{children:[e("div",K({className:"d-flex align-items-center gap-2"},{children:[n("pre",{children:i}),e("pre",{children:["[",void 0!==(null==r?void 0:r.processed)?r.processed:"?"," / ",void 0!==a?a:"?","]"]}),n(De,{state:r?r.state:"Unknown"})]})),n("div",K({className:"p-1"},{children:r?n(S,{variant:"primary",striped:!0,animated:!0,min:0,now:r.processed,max:a||1}):n(L,K({className:"w-100",animation:"glow"},{children:n(L,{className:"w-100"})}))}))]})}function je(e){var t=e.children,i=e.center,r=h((function(){return!1===i?"":"d-flex align-items-center justify-content-center"}),[i]);return n("div",K({className:"w-100 h-100 position-absolute ".concat(r),style:{left:0,right:0,top:0,bottom:0}},{children:t}))}export{ye as AdvancedTable,ce as AutocompleteEntityIdSelect,le as AutocompleteEntitySelect,de as AutocompleteLookupIdSelect,se as AutocompleteLookupSelect,oe as AutocompleteSelect,Me as CacheStatsControl,Ge as ConfirmDialog,Ie as ConfirmDialogContext,Le as ConfirmDialogContextData,Q as DateInput,Ne as DateTime,W as DateTimeInput,ee as DeleteButton,ze as Duration,ke as Elapsed,ue as EntityIdSelect,he as EntitySelect,me as EntityWithNameIdSelect,pe as EntityWithNameSelect,re as EnumSelect,X as IconButton,Z as IconSwitch,Be as JavaHeapControl,$ as LoadingButton,fe as LocalizationContext,ge as Localize,ie as LookupSelect,te as NumberSelect,De as QueueStateControl,Fe as QueueStatsControl,_ as SaveButton,je as Spread,ne as StringSelect,ae as Switch,ve as TablePagination,xe as TablePlaceholder,we as TableWithSelect,q as TextInputWithReset,Se as UserAlertTypeIcon,Ee as UserAlertWidget,Pe as UserAlertsWidget};
2
2
  //# sourceMappingURL=index.esm.js.map