zavadil-react-common 1.2.131 → 1.2.133

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.
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ import { ActiveButtonProps } from "./LoadingButton";
3
+ export type DeleteButtonProps = ActiveButtonProps & {
4
+ isChanged?: boolean;
5
+ };
6
+ export declare function DeleteButton({ disabled, icon, loading, children, size, onClick, isChanged }: PropsWithChildren<DeleteButtonProps>): import("react/jsx-runtime").JSX.Element;
7
+ export default DeleteButton;
@@ -3,5 +3,5 @@ import { IconButtonProps } from "./IconButton";
3
3
  export type ActiveButtonProps = IconButtonProps & {
4
4
  loading?: boolean;
5
5
  };
6
- export declare function LoadingButton({ disabled, icon, loading, children, size, onClick }: PropsWithChildren<ActiveButtonProps>): import("react/jsx-runtime").JSX.Element;
6
+ export declare function LoadingButton({ disabled, icon, loading, children, size, variant, onClick }: PropsWithChildren<ActiveButtonProps>): import("react/jsx-runtime").JSX.Element;
7
7
  export default LoadingButton;
@@ -5,6 +5,7 @@ export * from './IconButton';
5
5
  export * from './IconSwitch';
6
6
  export * from './LoadingButton';
7
7
  export * from './SaveButton';
8
+ export * from './DeleteButton';
8
9
  export * from './LookupSelect';
9
10
  export * from './NumberSelect';
10
11
  export * from './StringSelect';
package/dist/index.d.ts CHANGED
@@ -106,13 +106,18 @@ declare function IconSwitch({ disabled, checked, iconOn, iconOff, size, onChange
106
106
  type ActiveButtonProps = IconButtonProps & {
107
107
  loading?: boolean;
108
108
  };
109
- declare function LoadingButton({ disabled, icon, loading, children, size, onClick }: PropsWithChildren<ActiveButtonProps>): react_jsx_runtime.JSX.Element;
109
+ declare function LoadingButton({ disabled, icon, loading, children, size, variant, onClick }: PropsWithChildren<ActiveButtonProps>): react_jsx_runtime.JSX.Element;
110
110
 
111
111
  type SaveButtonProps = ActiveButtonProps & {
112
112
  isChanged?: boolean;
113
113
  };
114
114
  declare function SaveButton({ disabled, icon, loading, children, size, onClick, isChanged }: PropsWithChildren<SaveButtonProps>): react_jsx_runtime.JSX.Element;
115
115
 
116
+ type DeleteButtonProps = ActiveButtonProps & {
117
+ isChanged?: boolean;
118
+ };
119
+ declare function DeleteButton({ disabled, icon, loading, children, size, onClick, isChanged }: PropsWithChildren<DeleteButtonProps>): react_jsx_runtime.JSX.Element;
120
+
116
121
  type LookupSelectProps = {
117
122
  id?: number | null;
118
123
  onChange: (n: number | null | undefined) => any;
@@ -277,4 +282,4 @@ type LocalizeProps = {
277
282
  };
278
283
  declare function Localize({ text, tag }: LocalizeProps): react_jsx_runtime.JSX.Element;
279
284
 
280
- export { type ActiveButtonProps, AdvancedTable, type AdvancedTableProps, AutocompleteEntityIdSelect, AutocompleteEntitySelect, type AutocompleteEntitySelectProps, type AutocompleteIdSelectProps, AutocompleteLookupIdSelect, type AutocompleteLookupIdSelectProps, AutocompleteLookupSelect, type AutocompleteLookupSelectProps, AutocompleteSelect, type AutocompleteSelectProps, type BasicDialogProps, CacheStatsControl, type CacheStatsControlProps, ConfirmDialog, ConfirmDialogContext, ConfirmDialogContextData, type ConfirmDialogProps, DateInput, type DateInputProps, DateTimeInput, type DateTimeInputProps, EnumSelect, type EnumSelectProps, type GenericSelectOption, type GenericSelectProps, type HeaderCol, IconButton, type IconButtonProps, IconSwitch, type IconSwitchProps, JavaHeapControl, LoadingButton, LocalizationContext, Localize, type LocalizeProps, LookupSelect, type LookupSelectProps, NumberSelect, type NumberSelectProps, QueueStateControl, type QueueStateControlProps, QueueStatsControl, type QueueStatsControlProps, type RenderFunc, type RenderResult, SaveButton, type SaveButtonProps, type SelectableHeaderCol, type SelectableItem, type SelectableTableHeader, Spread, type SpreadProps, StringSelect, type StringSelectProps, Switch, type SwitchProps, type TableHeader, TablePagination, type TablePaginationProps, TablePlaceholder, type TablePlaceholderProps, TableWithSelect, type TableWithSelectProps, TextInputWithReset, type TextInputWithResetProps, UserAlertTypeIcon, type UserAlertTypeIconProps, UserAlertWidget, type UserAlertWidgetProps, UserAlertsWidget, type UserAlertsWidgetProps, type WorkerJavaHeapControlProps };
285
+ export { type ActiveButtonProps, AdvancedTable, type AdvancedTableProps, AutocompleteEntityIdSelect, AutocompleteEntitySelect, type AutocompleteEntitySelectProps, type AutocompleteIdSelectProps, AutocompleteLookupIdSelect, type AutocompleteLookupIdSelectProps, AutocompleteLookupSelect, type AutocompleteLookupSelectProps, AutocompleteSelect, type AutocompleteSelectProps, type BasicDialogProps, CacheStatsControl, type CacheStatsControlProps, ConfirmDialog, ConfirmDialogContext, ConfirmDialogContextData, type ConfirmDialogProps, DateInput, type DateInputProps, DateTimeInput, type DateTimeInputProps, DeleteButton, type DeleteButtonProps, EnumSelect, type EnumSelectProps, type GenericSelectOption, type GenericSelectProps, type HeaderCol, IconButton, type IconButtonProps, IconSwitch, type IconSwitchProps, JavaHeapControl, LoadingButton, LocalizationContext, Localize, type LocalizeProps, LookupSelect, type LookupSelectProps, NumberSelect, type NumberSelectProps, QueueStateControl, type QueueStateControlProps, QueueStatsControl, type QueueStatsControlProps, type RenderFunc, type RenderResult, SaveButton, type SaveButtonProps, type SelectableHeaderCol, type SelectableItem, type SelectableTableHeader, Spread, type SpreadProps, StringSelect, type StringSelectProps, Switch, type SwitchProps, type TableHeader, TablePagination, type TablePaginationProps, TablePlaceholder, type TablePlaceholderProps, TableWithSelect, type TableWithSelectProps, TextInputWithReset, type TextInputWithResetProps, UserAlertTypeIcon, type UserAlertTypeIconProps, UserAlertWidget, type UserAlertWidgetProps, UserAlertsWidget, type UserAlertsWidgetProps, type WorkerJavaHeapControlProps };
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 m,useState as p,useRef as f,useEffect 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 S,ProgressBar as O,Modal as P,Badge as I,Placeholder as E}from"react-bootstrap";import{BsXCircle as B,BsFillCaretDownFill as M,BsFillCaretUpFill as A,BsCheckCircle as L,BsCircle as G,BsCheckAll as j,BsBug as D,BsExclamationDiamond as F,BsInfo as H,BsQuestion as T,BsEye as V,BsTrash 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]),p=m((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:p,disabled:u},{children:n("div",K({className:"d-flex align-items-center"},{children:n(B,{})}))}))]}))}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.onClick;return n(X,K(!0===r?{disabled:!0,onClick:l,size:o,icon:n(x,{size:"sm"})}:{disabled:t,onClick:l,icon:i,size:o},{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(t){var r=t.value,a=t.options,o=t.disabled,l=t.onChange,c=t.showEmptyOption,s=t.emptyOptionLabel;return i.isEmpty(r)&&a.length>0&&!0!==c?(l(a[0].id),e("span",{children:[r," - selecting default ",a[0].id]})):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 ne(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=m((function(e){return o(a.parseNumber(e))}),[o]);return n(ee,{disabled:r,value:s,options:d,onChange:u,showEmptyOption:l,emptyOptionLabel:c})}function te(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(ne,{disabled:r,value:t,options:d,onChange:o,showEmptyOption:c,emptyOptionLabel:s})}function ie(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(ee,{value:t,options:l,onChange:r,showEmptyOption:a,emptyOptionLabel:o})}function re(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 ae(t){var i=t.selected,r=t.disabled,a=t.labelGetter,l=t.onChange,c=t.onSearch,s=p(),d=s[0],u=s[1],v=p(),b=v[0],y=v[1],C=p(),w=C[0],x=C[1],z=f(),k=m((function(e){return a?a(e):"name"in e&&"string"==typeof e.name?e.name:"[".concat(e.id,"]")}),[a]),S=h((function(){return i?"border rounded border-primary":void 0}),[i]),O=m((function(){console.log("user left control"),w&&(x(void 0),y(i?k(i):""))}),[l,w,i,k]),P=m((function(){z.current=window.setTimeout(O,100)}),[z,O]),I=m((function(){z.current&&clearTimeout(z.current)}),[z]);g((function(){return I}),[]),g((function(){y(i?k(i):""),d&&(d.cancel(),u(void 0)),x(void 0)}),[i]);var E=m((function(){l(null),y(""),d&&(d.cancel(),u(void 0)),x(void 0)}),[l,d]),B=m((function(e){y(e),d&&d.cancel();var n=new o(c(e));n.promise.then(x),u(n)}),[d,c]),M=m((function(e){console.log("user selected item"),x(void 0),l(K({},e))}),[l]);return n("div",K({onBlur:P,onFocus:I},{children:e(N,K({defaultShow:!1,show:null!==w},{children:[n(q,{disabled:r,value:b,onChange:B,onReset:E,className:S}),w&&n(N.Menu,{children:w.map((function(e){return n(N.Item,K({onClick:function(n){I(),M(e)},active:e.id===(null==i?void 0:i.id)},{children:k(e)}),e.id)}))})]}))}))}function oe(e){var t=e.selected,r=e.disabled,a=e.labelGetter,o=e.onChange,l=e.entityClient,c=m((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(ae,{disabled:r,selected:t,labelGetter:a,onSearch:c,onChange:o})}function le(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.entityClient,c=p(null),s=c[0],d=c[1];g((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=m((function(e){var n=e?e.id:null;n!==t&&a(n),d(e)}),[t,a]);return n(oe,{disabled:i,selected:s,labelGetter:r,entityClient:o,onChange:u})}function ce(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=m((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(ae,{disabled:r,selected:t,labelGetter:c,onSearch:s,onChange:o})}function se(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.lookupClient,l=p(null),c=l[0],s=l[1];g((function(){t?c&&c.id===t?s(K({},c)):o.loadSingle(t).then(s):s(null)}),[t]);var d=m((function(e){var n=e?e.id:null;n!==t&&a(n),s(e)}),[t,c]);return n(ce,{disabled:i,selected:c,labelGetter:r,lookupClient:o,onChange:d})}"function"==typeof SuppressedError&&SuppressedError;var de=v(new c);function ue(e){var i=e.text,r=e.tag,a=b(de),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 he(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))},m=d;m<=u;m++)h(m);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 me=[{id:10,label:"10"},{id:100,label:"100"},{id:1e3,label:"1000"}];function pe(r){var a=r.hover,o=r.showPagingOnBottom,l=r.showPageSizeSelection,c=r.striped,d=r.bordered,u=r.header,m=r.children,p=r.paging,f=r.totalItems,g=r.onPagingChanged,v=Math.ceil(f/p.size),b=h((function(){var e=p.size;if(null===me.find((function(n){return n.id===e}))){var n=s.clone(me);return n.push({id:e,label:String(e)}),n}return me}),[p]);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(ue,{text:"Page"}),": ",p.page+1," / ",v]}),v>0&&n(he,{paging:p,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ue,{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=p.sorting&&p.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){p.sorting||(p.sorting=[]);var t=p.sorting.find((function(e){return e.name===n})),i=t&&1===p.sorting.length;e.ctrlKey||i||(p.sorting=[],t=void 0),t?t.desc=!t.desc:p.sorting.push({name:n}),g(s.clone(p))}(e,o)}},{children:[r.label,l?l.desc?n(M,{}):n(A,{}):n(t,{})]}),a)}))})]}),n("tbody",{children:m}),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(ue,{text:"Page"}),": ",p.page+1," / ",v]}),v>0&&n(he,{paging:p,totalItems:f,onPagingChanged:g}),e("div",{children:[n(ue,{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(ue,{text:"Page size"}),":"]})),n("div",{children:n(ne,{value:p.size,options:b,onChange:function(e){p.size=e||10,g(K({},p))},showEmptyOption:!1})})]}))}))})]})]}))})}function fe(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(L,{size:a}):r||n(G,{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 ge(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,f=p(!1),v=f[0],b=f[1],y=p(),C=y[0],w=y[1],x=m((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(fe,{checked:v,onChange:function(){return x(!v)},iconOn:n(j,{})})}))}),e}),[r,v,x]);return g((function(){w(a?a.map((function(e){return{selected:v,item:e}})):void 0)}),[a]),g((function(){C&&o&&o(C.filter((function(e){return e.selected})).map((function(e){return e.item})))}),[C,o]),n(pe,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(fe,{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 ve(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)}))})}))})}var be=new Map([[d.error,D],[d.warning,F],[d.info,H]]);function ye(e){var t=e.type,i=e.size,r=e.customVariant,a=be.get(t)||T;return n("div",K({className:"d-flex align-items-center text-".concat(void 0===r?t:r)},{children:a({size:i})}))}function Ce(t){var i=t.userAlert,a=t.maxDurationMs;return e(S,K({direction:"horizontal",gap:2,className:"align-items-center"},{children:[i.remainsMs&&n("div",K({style:{width:20}},{children:n(O,{min:0,max:a,now:i.remainsMs,variant:i.type})})),n("div",{children:r.formatDateForHumans(i.time)}),n(ye,{type:i.type}),n("div",{children:i.message})]}))}function we(i){var r=i.userAlerts,a=p(!1),o=a[0],l=a[1],c=p(r.alerts.length),s=c[0],d=c[1],u=p(Y([],r.visibleAlerts,!0)),h=u[0],f=u[1],v=p(r.getSummary()),b=v[0],y=v[1],C=m((function(){d(r.alerts.length),f(Y([],o?r.alerts:r.visibleAlerts,!0)),y(r.getSummary())}),[r,o]);return g((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(Ce,{userAlert:e,maxDurationMs:r.maxVisibilityMs},t)}))})),n("div",K({className:"p-2"},{children:e(S,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(V,{})},{children:"Show All"})),Array.from(b.entries()).map((function(t,i){return e(S,K({direction:"horizontal",gap:1,className:"px-1 border rounded align-items-center"},{children:[n(ye,{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(R,{})},{children:"Reset"}))]}))}))]}))}var xe=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}(),Ne=v(new xe((function(){})));function ze(t){var i=t.name,r=t.text,a=t.onClose,o=t.onConfirm;return e(P,K({show:!0,backdrop:!0,onHide:a},{children:[n(P.Header,{children:i||"Confirm"}),n(P.Body,{children:r}),n(P.Footer,{children:e(S,K({direction:"horizontal"},{children:[n(w,K({variant:"link",onClick:a},{children:n(ue,{text:"Back"})})),n(w,K({variant:"primary",onClick:o},{children:n(ue,{text:"Yes"})}))]}))})]}))}function ke(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(I,K({className:"bg-warning text-bg-warning"},{children:u.formatByteSize(l)})),n("pre",{children:"Free:"}),n(I,K({className:"bg-success text-white"},{children:u.formatByteSize(o)}))]})),n("div",K({className:"p-1"},{children:e(O,K({min:0,max:a},{children:[n(O,{variant:"warning",min:0,now:l,max:a}),n(O,{variant:"success",min:0,now:o,max:a})]}))}))]})}function Se(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(O,{now:r.cachedItems,min:0,max:r.capacity})}))]})}var Oe=new Map([["Idle","secondary"],["Processing","success"],["Loading","warn"]]);function Pe(e){var t=e.state,i=Oe.get(t)||"light";return n(I,K({className:"bg-".concat(i," text-bg-").concat(i)},{children:t}))}function Ie(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(Pe,{state:r?r.state:"Unknown"})]})),n("div",K({className:"p-1"},{children:r?n(O,{variant:"primary",striped:!0,animated:!0,min:0,now:r.processed,max:a||1}):n(E,K({className:"w-100",animation:"glow"},{children:n(E,{className:"w-100"})}))}))]})}function Ee(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{pe as AdvancedTable,le as AutocompleteEntityIdSelect,oe as AutocompleteEntitySelect,se as AutocompleteLookupIdSelect,ce as AutocompleteLookupSelect,ae as AutocompleteSelect,Se as CacheStatsControl,ze as ConfirmDialog,Ne as ConfirmDialogContext,xe as ConfirmDialogContextData,Q as DateInput,W as DateTimeInput,ie as EnumSelect,X as IconButton,Z as IconSwitch,ke as JavaHeapControl,$ as LoadingButton,de as LocalizationContext,ue as Localize,te as LookupSelect,ne as NumberSelect,Pe as QueueStateControl,Ie as QueueStatsControl,_ as SaveButton,Ee as Spread,ee as StringSelect,re as Switch,he as TablePagination,ve as TablePlaceholder,ge as TableWithSelect,q as TextInputWithReset,ye as UserAlertTypeIcon,Ce as UserAlertWidget,we 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 d,UserAlertType as s,ByteUtil as u}from"zavadil-ts-common";import{useMemo as h,useCallback as m,useState as p,useRef as f,useEffect 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 z,Pagination as N,Table as k,Stack as S,ProgressBar as O,Modal as P,Badge as I,Placeholder as E}from"react-bootstrap";import{BsXCircle as B,BsTrash as M,BsFillCaretDownFill as A,BsFillCaretUpFill as L,BsCheckCircle as G,BsCircle as j,BsCheckAll as D,BsBug as F,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,d=t.className,s=h((function(){return i.getNonEmpty(r)}),[r]),u=h((function(){return i.isBlank(r)}),[s]),p=m((function(){o?o():a("")}),[o,a]);return e(y,K({className:d},{children:[n(C.Control,{type:"text",disabled:c,value:s,onChange:function(e){return a(e.target.value)},onBlur:l}),n(w,K({onClick:p,disabled:u},{children:n("div",K({className:"d-flex align-items-center"},{children:n(B,{})}))}))]}))}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,d=h((function(){return i||n(U,{})}),[i]),s=h((function(){return c?n("strong",{children:a}):a}),[c,a]);return n($,K({disabled:t||!1===c,onClick:l,icon:d,loading:r,size:o},{children:s}))}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,d=h((function(){return i||n(M,{})}),[i]);return n($,K({disabled:t||!1===c,onClick:l,icon:d,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,d=t.emptyOptionLabel;return i.isEmpty(r)&&a.length>0&&!0!==c?(l(a[0].id),e("span",{children:[r," - selecting default ",a[0].id]})):e(C.Select,K({value:r||"",onChange:function(e){return l(e.target.value)},disabled:o},{children:[!0===c&&n("option",K({value:""},{children:d||""}),""),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,d=h((function(){return t?String(t):""}),[t]),s=h((function(){return i?i.map((function(e){return{id:e.id?String(e.id):"",label:e.label}})):[]}),[i]),u=m((function(e){return o(a.parseNumber(e))}),[o]);return n(ne,{disabled:r,value:d,options:s,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,d=e.emptyOptionLabel,s=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:s,onChange:o,showEmptyOption:c,emptyOptionLabel:d})}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,d=p(),s=d[0],u=d[1],v=p(),b=v[0],y=v[1],C=p(),w=C[0],x=C[1],N=f(),k=m((function(e){return a?a(e):"name"in e&&"string"==typeof e.name?e.name:"[".concat(e.id,"]")}),[a]),S=h((function(){return i?"border rounded border-primary":void 0}),[i]),O=m((function(){console.log("user left control"),w&&(x(void 0),y(i?k(i):""))}),[l,w,i,k]),P=m((function(){N.current=window.setTimeout(O,100)}),[N,O]),I=m((function(){N.current&&clearTimeout(N.current)}),[N]);g((function(){return I}),[]),g((function(){y(i?k(i):""),s&&(s.cancel(),u(void 0)),x(void 0)}),[i]);var E=m((function(){l(null),y(""),s&&(s.cancel(),u(void 0)),x(void 0)}),[l,s]),B=m((function(e){y(e),s&&s.cancel();var n=new o(c(e));n.promise.then(x),u(n)}),[s,c]),M=m((function(e){console.log("user selected item"),x(void 0),l(K({},e))}),[l]);return n("div",K({onBlur:P,onFocus:I},{children:e(z,K({defaultShow:!1,show:null!==w},{children:[n(q,{disabled:r,value:b,onChange:B,onReset:E,className:S}),w&&n(z.Menu,{children:w.map((function(e){return n(z.Item,K({onClick:function(n){I(),M(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=m((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=p(null),d=c[0],s=c[1];g((function(){t?d&&d.id===t?s(K({},d)):o instanceof l?o.loadSingleStub(t).then(s):o.loadSingle(t).then(s):s(null)}),[t]);var u=m((function(e){var n=e?e.id:null;n!==t&&a(n),s(e)}),[t,a]);return n(le,{disabled:i,selected:d,labelGetter:r,entityClient:o,onChange:u})}function de(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]),d=m((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:d,onChange:o})}function se(e){var t=e.id,i=e.disabled,r=e.labelGetter,a=e.onChange,o=e.lookupClient,l=p(null),c=l[0],d=l[1];g((function(){t?c&&c.id===t?d(K({},c)):o.loadSingle(t).then(d):d(null)}),[t]);var s=m((function(e){var n=e?e.id:null;n!==t&&a(n),d(e)}),[t,c]);return n(de,{disabled:i,selected:c,labelGetter:r,lookupClient:o,onChange:s})}"function"==typeof SuppressedError&&SuppressedError;var ue=v(new c);function he(e){var i=e.text,r=e.tag,a=b(ue),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 me(e){var t=e.paging,i=e.totalItems,r=e.onPagingChanged,a=Math.ceil(i/t.size),o=function(e){t.page=e,r(d.clone(t))},l=[];if(a>1){l.push(n(N.First,{onClick:function(){return o(0)},disabled:0===t.page},"first")),l.push(n(N.Prev,{onClick:function(){return o(t.page-1)},disabled:0===t.page},"prev"));var c=Math.round(3.5),s=t.page>c?t.page-c:0,u=s+10;u>=a&&(u=a-1),s>0&&l.push(n(N.Ellipsis,{disabled:!0},"ellipsisStart"));for(var h=function(e){l.push(n(N.Item,K({active:e===t.page,onClick:function(){return o(e)}},{children:e+1}),e))},m=s;m<=u;m++)h(m);u<a-1&&l.push(n(N.Ellipsis,{disabled:!0},"ellipsisEnd")),l.push(n(N.Next,{onClick:function(){return o(t.page+1)},disabled:t.page===a-1},"next")),l.push(n(N.Last,{onClick:function(){return o(a-1)},disabled:t.page===a-1},"last"))}return n(N,K({size:"sm",className:"flex-wrap m-0"},{children:l}))}var pe=[{id:10,label:"10"},{id:100,label:"100"},{id:1e3,label:"1000"}];function fe(r){var a=r.hover,o=r.showPagingOnBottom,l=r.showPageSizeSelection,c=r.striped,s=r.bordered,u=r.header,m=r.children,p=r.paging,f=r.totalItems,g=r.onPagingChanged,v=Math.ceil(f/p.size),b=h((function(){var e=p.size;if(null===pe.find((function(n){return n.id===e}))){var n=d.clone(pe);return n.push({id:e,label:String(e)}),n}return pe}),[p]);return n("div",{children:e(k,K({hover:a,striped:c,responsive:!0,bordered:s},{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(he,{text:"Page"}),": ",p.page+1," / ",v]}),v>0&&n(me,{paging:p,totalItems:f,onPagingChanged:g}),e("div",{children:[n(he,{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=p.sorting&&p.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){p.sorting||(p.sorting=[]);var t=p.sorting.find((function(e){return e.name===n})),i=t&&1===p.sorting.length;e.ctrlKey||i||(p.sorting=[],t=void 0),t?t.desc=!t.desc:p.sorting.push({name:n}),g(d.clone(p))}(e,o)}},{children:[r.label,l?l.desc?n(A,{}):n(L,{}):n(t,{})]}),a)}))})]}),n("tbody",{children:m}),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(he,{text:"Page"}),": ",p.page+1," / ",v]}),v>0&&n(me,{paging:p,totalItems:f,onPagingChanged:g}),e("div",{children:[n(he,{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(he,{text:"Page size"}),":"]})),n("div",{children:n(te,{value:p.size,options:b,onChange:function(e){p.size=e||10,g(K({},p))},showEmptyOption:!1})})]}))}))})]})]}))})}function ge(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(G,{size:a}):r||n(j,{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 ve(t){var i=t.showSelect,r=t.header,a=t.items,o=t.onSelect,l=t.onClick,c=t.totalItems,s=t.paging,u=t.onPagingChanged,f=p(!1),v=f[0],b=f[1],y=p(),C=y[0],w=y[1],x=m((function(e){C&&w(C.map((function(n){return{selected:e,item:n.item}}))),b(e)}),[C]),z=h((function(){var e=Y([],r,!0);return!1!==i&&e.unshift({name:"",label:n("div",K({className:"py-1"},{children:n(ge,{checked:v,onChange:function(){return x(!v)},iconOn:n(D,{})})}))}),e}),[r,v,x]);return g((function(){w(a?a.map((function(e){return{selected:v,item:e}})):void 0)}),[a]),g((function(){C&&o&&o(C.filter((function(e){return e.selected})).map((function(e){return e.item})))}),[C,o]),n(fe,K({header:z,hover:void 0!==l,paging:s,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(ge,{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 d.getNestedValue(e,r)});return n("td",{children:a(t.item)},i)}))]}),a)}))}))}function be(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)}))})}))})}var ye=new Map([[s.error,F],[s.warning,H],[s.info,T]]);function Ce(e){var t=e.type,i=e.size,r=e.customVariant,a=ye.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 we(t){var i=t.userAlert,a=t.maxDurationMs;return e(S,K({direction:"horizontal",gap:2,className:"align-items-center"},{children:[i.remainsMs&&n("div",K({style:{width:20}},{children:n(O,{min:0,max:a,now:i.remainsMs,variant:i.type})})),n("div",{children:r.formatDateForHumans(i.time)}),n(Ce,{type:i.type}),n("div",{children:i.message})]}))}function xe(i){var r=i.userAlerts,a=p(!1),o=a[0],l=a[1],c=p(r.alerts.length),d=c[0],s=c[1],u=p(Y([],r.visibleAlerts,!0)),h=u[0],f=u[1],v=p(r.getSummary()),b=v[0],y=v[1],C=m((function(){s(r.alerts.length),f(Y([],o?r.alerts:r.visibleAlerts,!0)),y(r.getSummary())}),[r,o]);return g((function(){r.addOnChangeHandler(C);var e=setInterval((function(){return r.updateVisibility()}),100);return function(){clearInterval(e),r.removeOnChangeHandler(C)}}),[r,C]),d<=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(we,{userAlert:e,maxDurationMs:r.maxVisibilityMs},t)}))})),n("div",K({className:"p-2"},{children:e(S,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(S,K({direction:"horizontal",gap:1,className:"px-1 border rounded align-items-center"},{children:[n(Ce,{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(M,{})},{children:"Reset"}))]}))}))]}))}var ze=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}(),Ne=v(new ze((function(){})));function ke(t){var i=t.name,r=t.text,a=t.onClose,o=t.onConfirm;return e(P,K({show:!0,backdrop:!0,onHide:a},{children:[n(P.Header,{children:i||"Confirm"}),n(P.Body,{children:r}),n(P.Footer,{children:e(S,K({direction:"horizontal"},{children:[n(w,K({variant:"link",onClick:a},{children:n(he,{text:"Back"})})),n(w,K({variant:"primary",onClick:o},{children:n(he,{text:"Yes"})}))]}))})]}))}function Se(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(I,K({className:"bg-warning text-bg-warning"},{children:u.formatByteSize(l)})),n("pre",{children:"Free:"}),n(I,K({className:"bg-success text-white"},{children:u.formatByteSize(o)}))]})),n("div",K({className:"p-1"},{children:e(O,K({min:0,max:a},{children:[n(O,{variant:"warning",min:0,now:l,max:a}),n(O,{variant:"success",min:0,now:o,max:a})]}))}))]})}function Oe(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(O,{now:r.cachedItems,min:0,max:r.capacity})}))]})}var Pe=new Map([["Idle","secondary"],["Processing","success"],["Loading","warn"]]);function Ie(e){var t=e.state,i=Pe.get(t)||"light";return n(I,K({className:"bg-".concat(i," text-bg-").concat(i)},{children:t}))}function Ee(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(Ie,{state:r?r.state:"Unknown"})]})),n("div",K({className:"p-1"},{children:r?n(O,{variant:"primary",striped:!0,animated:!0,min:0,now:r.processed,max:a||1}):n(E,K({className:"w-100",animation:"glow"},{children:n(E,{className:"w-100"})}))}))]})}function Be(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{fe as AdvancedTable,ce as AutocompleteEntityIdSelect,le as AutocompleteEntitySelect,se as AutocompleteLookupIdSelect,de as AutocompleteLookupSelect,oe as AutocompleteSelect,Oe as CacheStatsControl,ke as ConfirmDialog,Ne as ConfirmDialogContext,ze as ConfirmDialogContextData,Q as DateInput,W as DateTimeInput,ee as DeleteButton,re as EnumSelect,X as IconButton,Z as IconSwitch,Se as JavaHeapControl,$ as LoadingButton,ue as LocalizationContext,he as Localize,ie as LookupSelect,te as NumberSelect,Ie as QueueStateControl,Ee as QueueStatsControl,_ as SaveButton,Be as Spread,ne as StringSelect,ae as Switch,me as TablePagination,be as TablePlaceholder,ve as TableWithSelect,q as TextInputWithReset,Ce as UserAlertTypeIcon,we as UserAlertWidget,xe as UserAlertsWidget};
2
2
  //# sourceMappingURL=index.esm.js.map