@pautena/react-design-system 0.14.5 → 0.14.6
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/cjs/index.js +4 -4
- package/cjs/index.js.map +1 -1
- package/header/cjs/index.js +1 -1
- package/header/cjs/index.js.map +1 -1
- package/header/header.dummy.d.ts +1 -6
- package/header/header.types.d.ts +1 -0
- package/header/index.js +1 -1
- package/header/index.js.map +1 -1
- package/hooks/cjs/index.js +1 -1
- package/hooks/cjs/index.js.map +1 -1
- package/hooks/index.js +1 -1
- package/hooks/index.js.map +1 -1
- package/hooks/routing/routing.hooks.d.ts +1 -0
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/list-panel/cjs/index.js +1 -1
- package/list-panel/cjs/index.js.map +1 -1
- package/list-panel/index.js +1 -1
- package/list-panel/index.js.map +1 -1
- package/list-panel/list-panel.d.ts +1 -0
- package/model-router/cjs/index.js +1 -1
- package/model-router/cjs/index.js.map +1 -1
- package/model-router/index.js +4 -4
- package/model-router/index.js.map +1 -1
- package/package.json +1 -1
package/model-router/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{useNavigate as n,Link as o,useLocation as i,useParams as a,Routes as l,Route as c}from"react-router-dom";import{useMemo as s,useState as u,useRef as d,useEffect as f,createContext as m,useContext as p,forwardRef as y}from"react";import h from"@mui/material/Button";import b from"@mui/material/Grid";import g from"@mui/material/Box";import v from"@mui/material/FormControlLabel";import x from"@mui/material/Checkbox";import S from"@mui/material/FormControl";import w from"@mui/material/InputLabel";import $ from"@mui/material/Select";import C from"@mui/material/MenuItem";import E from"@mui/material/ListItemText";import k from"@mui/material/TextField";import{DesktopDatePicker as O,TimePicker as T,DateTimePicker as P}from"@mui/x-date-pickers";import{useTheme as I}from"@mui/material";import j from"@mui/material/Paper";import R from"@mui/material/Typography";import{useTheme as N}from"@mui/material/styles";import z from"@mui/material/LinearProgress";import M from"@mui/material/CircularProgress";import _ from"@mui/icons-material/ReportProblem";import"@mui/material/Snackbar";import"@mui/material/Alert";import"@mui/material/AlertTitle";import V from"@mui/material/Breadcrumbs";import A from"@mui/material/Container";import D from"@mui/material/Tabs";import F from"@mui/material/Tab";import L from"@mui/material/Link";import W from"@mui/material/TableRow";import q from"@mui/material/TableCell";import B from"@mui/material/IconButton";import U from"@mui/material/Menu";import Y from"@mui/material/TableContainer";import H from"@mui/material/TableBody";import J from"@mui/material/InputAdornment";import G from"@mui/material/Table";import X from"@mui/icons-material/Search";import K from"@mui/material/TableSortLabel";import Q from"@mui/material/TableHead";import Z from"@mui/icons-material/MoreVert";import ee from"@mui/material/Switch";import te from"@mui/icons-material/Check";import re from"@mui/icons-material/Close";import ne from"@mui/icons-material/Clear";import oe from"@mui/icons-material/Edit";import ie from"@mui/material/Tooltip";import{format as ae}from"date-fns";import{DatePicker as le}from"@mui/x-date-pickers/DatePicker";import{DateTimePicker as ce}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as se}from"@mui/x-date-pickers/TimePicker";import{DataGrid as ue}from"@mui/x-data-grid";const de={string:"",number:0,boolean:!1,enum:"",multienum:[],date:new Date(1970,0,1,0,0),time:new Date(1970,0,1,0,0),datetime:new Date(1970,0,1,0,0),group:{},"group[]":[],"string[]":[],"number[]":[]},fe=(e,t)=>t&&t[e.id]||"default"in e&&e.default||de[e.type],me=({lightWeight:e=100,darkWeight:t=900}={})=>{const{palette:r}=I();return"light"===r.mode?r.grey[e]:r.grey[t]},pe=(e=12)=>{const t=(t,r,n)=>{const o=t[r];return t[r]+=n,t[r]>e?(t[r]=n,!1):(t[r]==e&&(t[r]=0),o>0)};return{xs:0,sm:0,md:0,lg:0,xl:0,increment:function({xs:e=0,sm:r=0,md:n=0,lg:o=0,xl:i=0}){const a=r||e,l=n||a,c=o||l,s=i||c;return{xs:t(this,"xs",e),sm:t(this,"sm",a),md:t(this,"md",l),lg:t(this,"lg",c),xl:t(this,"xl",s)}}}},ye=({title:r,subtitle:n,centered:o,children:i,dense:a})=>{const{typography:l}=N(),c=me({lightWeight:200,darkWeight:800});return e(j,{sx:{paddingBottom:a?0:1},children:[e(g,{bgcolor:c,px:a?1:2,py:a?.5:1,lineHeight:a?0:void 0,children:[t(R,{variant:a?"body1":"h6",role:"heading","aria-level":1,children:r}),n&&t(R,{variant:a?"caption":"body2",role:"heading","aria-level":2,lineHeight:a?l.pxToRem(15):void 0,children:n})]}),t(b,{container:!0,padding:1,rowSpacing:a?1:2,justifyContent:o?"center":"flex-start",children:i})]})},he=({field:r,path:n=[],value:o,dense:i,update:a,onChangeValue:l})=>{const c=e=>{e.preventDefault(),l([...n,e.target.name],e.target.checked)},s=e=>{e.preventDefault(),l([...n,e.target.name],e.target.value)},u=e=>{e.preventDefault();const{value:t}=e.target,r="string"==typeof t?t.split(","):t;l([...n,e.target.name],r)},d=(e,t)=>{e.preventDefault();let r=e.target.value;"number"===t&&"string"==typeof r?r=parseInt(e.target.value,10):t.includes("[]")&&(r=e.target.value.split(",")),l([...n,e.target.name],r)},f=(e,t)=>{l([...n,t],e)};me({lightWeight:200,darkWeight:800});const{id:m,type:p,name:y,description:h,updatable:I=!0,required:j=!0,xs:R,sm:N,md:z,lg:M,xl:_}=r,V=!I&&a;let A;const D=i?"small":"medium";if("group"===p)A=t(ye,{title:y,subtitle:h,dense:i,children:t(b,{container:!0,spacing:2,sx:{p:2},children:r.value.map((e=>t(he,{field:e,dense:i,path:[...n,m],value:o[e.id],update:a,onChangeValue:l},e.id)))})});else if("boolean"===p)A=t(g,{sx:{height:1,display:"flex",alignItems:"center"},children:t(v,{control:t(x,{name:m,size:D,onChange:c,checked:o,disabled:V}),label:y})});else if("enum"===p)A=e(S,{fullWidth:!0,children:[t(w,{id:`${m}-select-label`,children:y}),t($,{labelId:`${m}-select-label`,id:`${m}-select`,value:o,label:y,name:m,size:D,onChange:s,required:j,disabled:V,children:r.value.map((e=>t(C,{value:e,children:e},e)))})]});else if("multienum"===p)A=e(S,{fullWidth:!0,children:[t(w,{id:`${m}-select-label`,children:y}),t($,{labelId:`${m}-select-label`,id:`${m}-select`,value:o||[],renderValue:e=>e.join(", "),label:y,name:m,size:D,onChange:u,required:j,disabled:V,multiple:!0,children:r.value.map((r=>e(C,{value:r,children:[t(x,{checked:(o||[]).includes(r)}),t(E,{primary:r})]},r)))})]});else if("date"===p)A=t(O,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else if("time"===p)A=t(T,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else if("datetime"===p)A=t(P,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else{if("group[]"===p)return null;A=p.includes("[]")?t(k,{required:j,type:"text",label:y,name:m,size:D,variant:"outlined",helperText:"Use comas to separate multiple values",fullWidth:!0,disabled:V,value:o.join(","),onChange:e=>d(e,p)}):t(k,{required:j,type:p,label:y,size:D,name:m,variant:"outlined",fullWidth:!0,value:o,disabled:V,onChange:e=>d(e,p)})}return t(b,{item:!0,xs:R,sm:N,md:z,lg:M,xl:_,children:A},m)};function be(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ge(e){return function t(r){return 0===arguments.length||be(r)?t:e.apply(this,arguments)}}function ve(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return be(r)?t:ge((function(t){return e(r,t)}));default:return be(r)&&be(n)?t:be(r)?ge((function(t){return e(t,n)})):be(n)?ge((function(t){return e(r,t)})):e(r,n)}}}function xe(e){return function t(r,n,o){switch(arguments.length){case 0:return t;case 1:return be(r)?t:ve((function(t,n){return e(r,t,n)}));case 2:return be(r)&&be(n)?t:be(r)?ve((function(t,r){return e(t,n,r)})):be(n)?ve((function(t,n){return e(r,t,n)})):ge((function(t){return e(r,n,t)}));default:return be(r)&&be(n)&&be(o)?t:be(r)&&be(n)?ve((function(t,r){return e(t,r,o)})):be(r)&&be(o)?ve((function(t,r){return e(t,n,r)})):be(n)&&be(o)?ve((function(t,n){return e(r,t,n)})):be(r)?ge((function(t){return e(t,n,o)})):be(n)?ge((function(t){return e(r,t,o)})):be(o)?ge((function(t){return e(r,n,t)})):e(r,n,o)}}}var Se=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};var we=Number.isInteger||function(e){return e<<0===e};var $e=ge((function(e){return null==e})),Ce=xe((function e(t,r,n){if(0===t.length)return r;var o=t[0];if(t.length>1){var i=!$e(n)&&function(e,t){return Object.prototype.hasOwnProperty.call(t,e)}(o,n)&&"object"==typeof n[o]?n[o]:we(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,i)}return function(e,t,r){if(we(e)&&Se(r)){var n=[].concat(r);return n[e]=t,n}var o={};for(var i in r)o[i]=r[i];return o[e]=t,o}(o,r,n)}));const Ee=({model:r,saveButtonText:n,dense:o,onSubmit:i,initialValues:a})=>{const l=s((()=>((e,t=undefined)=>{const r={};return e.fields.forEach((e=>{if("group"===e.type){const n={};e.value.forEach((r=>{n[r.id]=fe(r,t&&t[e.id])})),r[e.id]=n}else r[e.id]=fe(e,t)})),r})(r,a)),[r,a]),[c,d]=u(l),f=(e,t)=>{d((r=>Ce(e,t,r)))};return e(b,{container:!0,component:"form",spacing:2,onSubmit:e=>{e.preventDefault(),i(c)},children:[r.fields.map((e=>t(he,{dense:o,field:e,value:c[e.id],update:!!a,onChangeValue:f},e.id))),t(b,{item:!0,xs:12,children:t(h,{type:"submit",variant:"contained",size:o?"small":"medium",children:n})})]})},ke=(e,t,{from:r,to:o})=>{const i=d(),a=n();f((()=>{i.current===r&&t===o&&a(e),i.current=t}),[t])},Oe=()=>t(g,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:t(M,{})}),Te=m([0,()=>null]),Pe=Te.Provider,Ie=({children:e,initialValue:r=0})=>{const n=u(r);return t(Pe,{value:n,children:e})},je=({title:r,subtitle:n,icon:o,iconSize:i=200,actions:a})=>e(g,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",children:[o&&o({size:i,color:"primary"}),t(R,{variant:"h4",role:"heading","aria-level":1,children:r}),t(R,{variant:"subtitle1",role:"heading","aria-level":2,sx:{mt:2},children:n}),a&&t(g,{sx:{pt:2},children:a.map((({id:e,text:r,href:n,onClick:o},i)=>t(h,{role:"button",variant:"contained",href:n,onClick:o,sx:{mr:i<a.length-1?2:0},children:r},e)))})]}),Re=()=>t(_,{color:"error",sx:{width:200,height:200}}),Ne=({loading:r,children:n,fetching:o,error:i})=>{const[a,l]=n;return t(Ie,{children:e(g,{display:"flex",flexDirection:"column",height:1,children:[a,o&&t(g,{width:1,children:t(z,{})}),r&&t(Oe,{}),i&&t(g,{mt:4,children:t(je,{icon:i.icon||Re,title:i.title||"There has been an error",subtitle:i.message})}),!r&&!i&&l]})})},ze=new Error("NotificationCenterContext.Provider is required and was undefined"),Me=m(void 0),_e=(e,t,{from:r,to:n})=>{const o=d(),{show:i}=(()=>{const e=p(Me);if(void 0===e)throw ze;return e})();f((()=>{o.current===r&&t===n&&i(e),o.current=t}),[t])},Ve=y(((e,r)=>{const{href:n,...i}=e;return t(o,{ref:r,to:n,...i})})),Ae=y(((e,r)=>t(L,{...e,component:Ve}))),De=({loading:e,children:n})=>{const{typography:o}=N();return e?t(M,{color:"inherit",size:o.h4.fontSize,"aria-label":"title loading"}):"string"==typeof n?t(R,{variant:"h4",role:"heading","aria-level":1,children:n}):t(r,{children:n})},Fe=({loading:e,children:n})=>{const{typography:o}=N();return e?t(M,{color:"inherit",size:o.body1.fontSize,"aria-label":"subtitle loading"}):"string"==typeof n?t(R,{variant:"body1",role:"heading","aria-level":2,children:n}):t(r,{children:n})},Le=({title:r="",loadingTitle:n,subtitle:o,loadingSubtitle:a,preset:l="default",actionsVariant:c="outlined",breadcrumbs:s,actions:u,tabs:d,tabsMode:f="panel",navigationButton:m})=>{const y=i(),{palette:b}=N(),v=me(),[x,S]=p(Te),w={default:v,primary:b.primary.main,secondary:b.secondary.main,inherit:"inherit",transparent:"transparent"},$=w[l],C={default:b.getContrastText(w.default),primary:b.primary.contrastText,secondary:b.secondary.contrastText,inherit:"inherit",transparent:b.text.primary}[l],E="panel"===f?x:d?.findIndex((e=>e.href===y.pathname));return t(g,{bgcolor:$,color:C,children:e(A,{children:[e(g,{sx:{py:3,display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[e(g,{children:[m&&t(h,{href:m.href,size:"small",color:"inherit",LinkComponent:Ae,startIcon:m.icon,sx:{mb:1},children:m.text}),s?.length&&t(V,{color:"inherit",separator:"›","aria-label":"breadcrumb",sx:{marginTop:1},children:s.map((({id:e,link:r,text:n})=>t(Ae,{underline:"hover",color:"inherit",href:r,variant:"body2",role:"link",children:n},e)))}),t(De,{loading:n,children:r}),(o||a)&&t(Fe,{loading:a,children:o})]}),u&&t(g,{children:u.map((({disabled:e,id:r,href:n,onClick:o,text:i},a)=>t(h,{component:n?Ae:"button",role:"button",color:"inherit",disabled:e,variant:c,size:"small",href:n,onClick:o,sx:{mr:a!=u.length-1?1:0},children:i},r)))})]}),d&&t(D,{value:E,textColor:"inherit",onChange:"panel"===f?(e,t)=>S(t):void 0,children:d.map((({id:e,label:r,disabled:n,href:o})=>{const i={label:r,disabled:n};return t(F,"panel"===f?{...i}:{...i,component:Ae,href:o},e)}))})]})})},We=({children:e})=>t(A,{component:"main",sx:{py:3,flexGrow:1},children:e}),qe=({model:r,modelName:n,basePath:o="",submitUpdateItemRequest:i,updateItemRequest:l,updateItem:c,onSubmitUpdateItem:s,onRequestUpdateItem:u})=>{const{id:d=""}=a(),m=l.loading||i.loading;return f((()=>{u(d)}),[d]),_e({title:"Item updated",message:`The item ${d} has been updated successfully`,severity:"success"},!!i.success,{from:!1,to:!0}),ke(`${o}/`,!!i.success,{from:!1,to:!0}),_e({title:"We had an error",message:i.error||"",severity:"error"},!!i.error,{from:!1,to:!0}),e(Ne,{loading:m,children:[t(Le,{title:`Edit ${d}`,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"update",text:`Edit ${d}`,link:`${o}/${d}/update`}]}),t(We,{children:t(Ee,{model:r,initialValues:c,saveButtonText:"Save",onSubmit:s})})]})};function Be(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...r){return e(...r)||t(...r)}}var Ue,Ye={exports:{}},He={exports:{}},Je={};var Ge,Xe,Ke,Qe,Ze,et,tt,rt,nt,ot,it,at,lt,ct,st={};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{useNavigate as n,useLocation as o,matchPath as i,Link as a,useParams as l,Routes as c,Route as s}from"react-router-dom";import{useMemo as u,useState as d,useRef as f,useEffect as m,createContext as p,useContext as y,forwardRef as h}from"react";import b from"@mui/material/Button";import g from"@mui/material/Grid";import v from"@mui/material/Box";import x from"@mui/material/FormControlLabel";import S from"@mui/material/Checkbox";import w from"@mui/material/FormControl";import $ from"@mui/material/InputLabel";import C from"@mui/material/Select";import E from"@mui/material/MenuItem";import k from"@mui/material/ListItemText";import O from"@mui/material/TextField";import{DesktopDatePicker as T,TimePicker as P,DateTimePicker as I}from"@mui/x-date-pickers";import{useTheme as j}from"@mui/material";import R from"@mui/material/Paper";import N from"@mui/material/Typography";import{useTheme as z}from"@mui/material/styles";import M from"@mui/material/LinearProgress";import _ from"@mui/material/CircularProgress";import V from"@mui/icons-material/ReportProblem";import"@mui/material/Snackbar";import"@mui/material/Alert";import"@mui/material/AlertTitle";import A from"@mui/material/Breadcrumbs";import D from"@mui/material/Container";import F from"@mui/material/Tabs";import L from"@mui/material/Tab";import W from"@mui/material/Link";import q from"@mui/material/TableRow";import B from"@mui/material/TableCell";import U from"@mui/material/IconButton";import Y from"@mui/material/Menu";import H from"@mui/material/TableContainer";import J from"@mui/material/TableBody";import G from"@mui/material/InputAdornment";import X from"@mui/material/Table";import K from"@mui/icons-material/Search";import Q from"@mui/material/TableSortLabel";import Z from"@mui/material/TableHead";import ee from"@mui/icons-material/MoreVert";import te from"@mui/material/Switch";import re from"@mui/icons-material/Check";import ne from"@mui/icons-material/Close";import oe from"@mui/icons-material/Clear";import ie from"@mui/icons-material/Edit";import ae from"@mui/material/Tooltip";import{format as le}from"date-fns";import{DatePicker as ce}from"@mui/x-date-pickers/DatePicker";import{DateTimePicker as se}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as ue}from"@mui/x-date-pickers/TimePicker";import{DataGrid as de}from"@mui/x-data-grid";const fe={string:"",number:0,boolean:!1,enum:"",multienum:[],date:new Date(1970,0,1,0,0),time:new Date(1970,0,1,0,0),datetime:new Date(1970,0,1,0,0),group:{},"group[]":[],"string[]":[],"number[]":[]},me=(e,t)=>t&&t[e.id]||"default"in e&&e.default||fe[e.type],pe=({lightWeight:e=100,darkWeight:t=900}={})=>{const{palette:r}=j();return"light"===r.mode?r.grey[e]:r.grey[t]},ye=(e=12)=>{const t=(t,r,n)=>{const o=t[r];return t[r]+=n,t[r]>e?(t[r]=n,!1):(t[r]==e&&(t[r]=0),o>0)};return{xs:0,sm:0,md:0,lg:0,xl:0,increment:function({xs:e=0,sm:r=0,md:n=0,lg:o=0,xl:i=0}){const a=r||e,l=n||a,c=o||l,s=i||c;return{xs:t(this,"xs",e),sm:t(this,"sm",a),md:t(this,"md",l),lg:t(this,"lg",c),xl:t(this,"xl",s)}}}},he=({title:r,subtitle:n,centered:o,children:i,dense:a})=>{const{typography:l}=z(),c=pe({lightWeight:200,darkWeight:800});return e(R,{sx:{paddingBottom:a?0:1},children:[e(v,{bgcolor:c,px:a?1:2,py:a?.5:1,lineHeight:a?0:void 0,children:[t(N,{variant:a?"body1":"h6",role:"heading","aria-level":1,children:r}),n&&t(N,{variant:a?"caption":"body2",role:"heading","aria-level":2,lineHeight:a?l.pxToRem(15):void 0,children:n})]}),t(g,{container:!0,padding:1,rowSpacing:a?1:2,justifyContent:o?"center":"flex-start",children:i})]})},be=({field:r,path:n=[],value:o,dense:i,update:a,onChangeValue:l})=>{const c=e=>{e.preventDefault(),l([...n,e.target.name],e.target.checked)},s=e=>{e.preventDefault(),l([...n,e.target.name],e.target.value)},u=e=>{e.preventDefault();const{value:t}=e.target,r="string"==typeof t?t.split(","):t;l([...n,e.target.name],r)},d=(e,t)=>{e.preventDefault();let r=e.target.value;"number"===t&&"string"==typeof r?r=parseInt(e.target.value,10):t.includes("[]")&&(r=e.target.value.split(",")),l([...n,e.target.name],r)},f=(e,t)=>{l([...n,t],e)};pe({lightWeight:200,darkWeight:800});const{id:m,type:p,name:y,description:h,updatable:b=!0,required:j=!0,xs:R,sm:N,md:z,lg:M,xl:_}=r,V=!b&&a;let A;const D=i?"small":"medium";if("group"===p)A=t(he,{title:y,subtitle:h,dense:i,children:t(g,{container:!0,spacing:2,sx:{p:2},children:r.value.map((e=>t(be,{field:e,dense:i,path:[...n,m],value:o[e.id],update:a,onChangeValue:l},e.id)))})});else if("boolean"===p)A=t(v,{sx:{height:1,display:"flex",alignItems:"center"},children:t(x,{control:t(S,{name:m,size:D,onChange:c,checked:o,disabled:V}),label:y})});else if("enum"===p)A=e(w,{fullWidth:!0,children:[t($,{id:`${m}-select-label`,children:y}),t(C,{labelId:`${m}-select-label`,id:`${m}-select`,value:o,label:y,name:m,size:D,onChange:s,required:j,disabled:V,children:r.value.map((e=>t(E,{value:e,children:e},e)))})]});else if("multienum"===p)A=e(w,{fullWidth:!0,children:[t($,{id:`${m}-select-label`,children:y}),t(C,{labelId:`${m}-select-label`,id:`${m}-select`,value:o||[],renderValue:e=>e.join(", "),label:y,name:m,size:D,onChange:u,required:j,disabled:V,multiple:!0,children:r.value.map((r=>e(E,{value:r,children:[t(S,{checked:(o||[]).includes(r)}),t(k,{primary:r})]},r)))})]});else if("date"===p)A=t(T,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else if("time"===p)A=t(P,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else if("datetime"===p)A=t(I,{label:y,format:r.format,value:o,slotProps:{field:{size:D}},disabled:V,onChange:e=>f(e,m)});else{if("group[]"===p)return null;A=p.includes("[]")?t(O,{required:j,type:"text",label:y,name:m,size:D,variant:"outlined",helperText:"Use comas to separate multiple values",fullWidth:!0,disabled:V,value:o.join(","),onChange:e=>d(e,p)}):t(O,{required:j,type:p,label:y,size:D,name:m,variant:"outlined",fullWidth:!0,value:o,disabled:V,onChange:e=>d(e,p)})}return t(g,{item:!0,xs:R,sm:N,md:z,lg:M,xl:_,children:A},m)};function ge(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ve(e){return function t(r){return 0===arguments.length||ge(r)?t:e.apply(this,arguments)}}function xe(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return ge(r)?t:ve((function(t){return e(r,t)}));default:return ge(r)&&ge(n)?t:ge(r)?ve((function(t){return e(t,n)})):ge(n)?ve((function(t){return e(r,t)})):e(r,n)}}}function Se(e){return function t(r,n,o){switch(arguments.length){case 0:return t;case 1:return ge(r)?t:xe((function(t,n){return e(r,t,n)}));case 2:return ge(r)&&ge(n)?t:ge(r)?xe((function(t,r){return e(t,n,r)})):ge(n)?xe((function(t,n){return e(r,t,n)})):ve((function(t){return e(r,n,t)}));default:return ge(r)&&ge(n)&&ge(o)?t:ge(r)&&ge(n)?xe((function(t,r){return e(t,r,o)})):ge(r)&&ge(o)?xe((function(t,r){return e(t,n,r)})):ge(n)&&ge(o)?xe((function(t,n){return e(r,t,n)})):ge(r)?ve((function(t){return e(t,n,o)})):ge(n)?ve((function(t){return e(r,t,o)})):ge(o)?ve((function(t){return e(r,n,t)})):e(r,n,o)}}}var we=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};var $e=Number.isInteger||function(e){return e<<0===e};var Ce=ve((function(e){return null==e})),Ee=Se((function e(t,r,n){if(0===t.length)return r;var o=t[0];if(t.length>1){var i=!Ce(n)&&function(e,t){return Object.prototype.hasOwnProperty.call(t,e)}(o,n)&&"object"==typeof n[o]?n[o]:$e(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,i)}return function(e,t,r){if($e(e)&&we(r)){var n=[].concat(r);return n[e]=t,n}var o={};for(var i in r)o[i]=r[i];return o[e]=t,o}(o,r,n)}));const ke=({model:r,saveButtonText:n,dense:o,onSubmit:i,initialValues:a})=>{const l=u((()=>((e,t=undefined)=>{const r={};return e.fields.forEach((e=>{if("group"===e.type){const n={};e.value.forEach((r=>{n[r.id]=me(r,t&&t[e.id])})),r[e.id]=n}else r[e.id]=me(e,t)})),r})(r,a)),[r,a]),[c,s]=d(l),f=(e,t)=>{s((r=>Ee(e,t,r)))};return e(g,{container:!0,component:"form",spacing:2,onSubmit:e=>{e.preventDefault(),i(c)},children:[r.fields.map((e=>t(be,{dense:o,field:e,value:c[e.id],update:!!a,onChangeValue:f},e.id))),t(g,{item:!0,xs:12,children:t(b,{type:"submit",variant:"contained",size:o?"small":"medium",children:n})})]})},Oe=(e,t,{from:r,to:o})=>{const i=f(),a=n();m((()=>{i.current===r&&t===o&&a(e),i.current=t}),[t])},Te=()=>t(v,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:t(_,{})}),Pe=p([0,()=>null]),Ie=Pe.Provider,je=({children:e,initialValue:r=0})=>{const n=d(r);return t(Ie,{value:n,children:e})},Re=({title:r,subtitle:n,icon:o,iconSize:i=200,actions:a})=>e(v,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",children:[o&&o({size:i,color:"primary"}),t(N,{variant:"h4",role:"heading","aria-level":1,children:r}),t(N,{variant:"subtitle1",role:"heading","aria-level":2,sx:{mt:2},children:n}),a&&t(v,{sx:{pt:2},children:a.map((({id:e,text:r,href:n,onClick:o},i)=>t(b,{role:"button",variant:"contained",href:n,onClick:o,sx:{mr:i<a.length-1?2:0},children:r},e)))})]}),Ne=()=>t(V,{color:"error",sx:{width:200,height:200}}),ze=({loading:r,children:n,fetching:o,error:i})=>{const[a,l]=n;return t(je,{children:e(v,{display:"flex",flexDirection:"column",height:1,children:[a,o&&t(v,{width:1,children:t(M,{})}),r&&t(Te,{}),i&&t(v,{mt:4,children:t(Re,{icon:i.icon||Ne,title:i.title||"There has been an error",subtitle:i.message})}),!r&&!i&&l]})})},Me=new Error("NotificationCenterContext.Provider is required and was undefined"),_e=p(void 0),Ve=(e,t,{from:r,to:n})=>{const o=f(),{show:i}=(()=>{const e=y(_e);if(void 0===e)throw Me;return e})();m((()=>{o.current===r&&t===n&&i(e),o.current=t}),[t])},Ae=h(((e,r)=>{const{href:n,...o}=e;return t(a,{ref:r,to:n,...o})})),De=h(((e,r)=>t(W,{...e,component:Ae}))),Fe=({loading:e,children:n})=>{const{typography:o}=z();return e?t(_,{color:"inherit",size:o.h4.fontSize,"aria-label":"title loading"}):"string"==typeof n?t(N,{variant:"h4",role:"heading","aria-level":1,children:n}):t(r,{children:n})},Le=({loading:e,children:n})=>{const{typography:o}=z();return e?t(_,{color:"inherit",size:o.body1.fontSize,"aria-label":"subtitle loading"}):"string"==typeof n?t(N,{variant:"body1",role:"heading","aria-level":2,children:n}):t(r,{children:n})},We=({title:r="",loadingTitle:n,subtitle:a,loadingSubtitle:l,preset:c="default",actionsVariant:s="outlined",breadcrumbs:u,actions:d,tabs:f,tabsMode:m="panel",navigationButton:p})=>{const h=(f||[]).map((e=>e.path)).filter(Boolean),{palette:g}=z(),x=pe(),[S,w]=y(Pe),$=(e=>{const{pathname:t}=o();for(let r=0;r<e.length;r+=1){const n=e[r],o=i(n,t);if(null!==o)return o}return null})(h),C={default:x,primary:g.primary.main,secondary:g.secondary.main,inherit:"inherit",transparent:"transparent"},E=C[c],k={default:g.getContrastText(C.default),primary:g.primary.contrastText,secondary:g.secondary.contrastText,inherit:"inherit",transparent:g.text.primary}[c],O="panel"===m?S:$?.pattern?.path;return t(v,{bgcolor:E,color:k,children:e(D,{children:[e(v,{sx:{py:3,display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[e(v,{children:[p&&t(b,{href:p.href,size:"small",color:"inherit",LinkComponent:De,startIcon:p.icon,sx:{mb:1},children:p.text}),u?.length&&t(A,{color:"inherit",separator:"›","aria-label":"breadcrumb",sx:{marginTop:1},children:u.map((({id:e,link:r,text:n})=>t(De,{underline:"hover",color:"inherit",href:r,variant:"body2",role:"link",children:n},e)))}),t(Fe,{loading:n,children:r}),(a||l)&&t(Le,{loading:l,children:a})]}),d&&t(v,{children:d.map((({disabled:e,id:r,href:n,onClick:o,text:i},a)=>t(b,{component:n?De:"button",role:"button",color:"inherit",disabled:e,variant:s,size:"small",href:n,onClick:o,sx:{mr:a!=d.length-1?1:0},children:i},r)))})]}),f&&t(F,{value:O,textColor:"inherit",onChange:"panel"===m?(e,t)=>w(t):void 0,children:f.map((({id:e,label:r,disabled:n,path:o,href:i})=>{const a={label:r,disabled:n};return t(L,"panel"===m?{...a}:{...a,component:De,href:i,value:o},e)}))})]})})},qe=({children:e})=>t(D,{component:"main",sx:{py:3,flexGrow:1},children:e}),Be=({model:r,modelName:n,basePath:o="",submitUpdateItemRequest:i,updateItemRequest:a,updateItem:c,onSubmitUpdateItem:s,onRequestUpdateItem:u})=>{const{id:d=""}=l(),f=a.loading||i.loading;return m((()=>{u(d)}),[d]),Ve({title:"Item updated",message:`The item ${d} has been updated successfully`,severity:"success"},!!i.success,{from:!1,to:!0}),Oe(`${o}/`,!!i.success,{from:!1,to:!0}),Ve({title:"We had an error",message:i.error||"",severity:"error"},!!i.error,{from:!1,to:!0}),e(ze,{loading:f,children:[t(We,{title:`Edit ${d}`,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"update",text:`Edit ${d}`,link:`${o}/${d}/update`}]}),t(qe,{children:t(ke,{model:r,initialValues:c,saveButtonText:"Save",onSubmit:s})})]})};function Ue(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...r){return e(...r)||t(...r)}}var Ye,He={exports:{}},Je={exports:{}},Ge={};var Xe,Ke,Qe,Ze,et,tt,rt,nt,ot,it,at,lt,ct,st,ut={};
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.development.js
|
|
4
4
|
*
|
|
@@ -6,12 +6,12 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{useNaviga
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/function
|
|
9
|
+
*/function dt(){return Ke||(Ke=1,e=Je,"production"===process.env.NODE_ENV?e.exports=function(){if(Ye)return Ge;Ye=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case c:case s:case n:case i:case o:case d:return e;default:switch(e=e&&e.$$typeof){case l:case u:case p:case m:case a:return e;default:return f}}case r:return f}}}function x(e){return v(e)===s}return Ge.AsyncMode=c,Ge.ConcurrentMode=s,Ge.ContextConsumer=l,Ge.ContextProvider=a,Ge.Element=t,Ge.ForwardRef=u,Ge.Fragment=n,Ge.Lazy=p,Ge.Memo=m,Ge.Portal=r,Ge.Profiler=i,Ge.StrictMode=o,Ge.Suspense=d,Ge.isAsyncMode=function(e){return x(e)||v(e)===c},Ge.isConcurrentMode=x,Ge.isContextConsumer=function(e){return v(e)===l},Ge.isContextProvider=function(e){return v(e)===a},Ge.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Ge.isForwardRef=function(e){return v(e)===u},Ge.isFragment=function(e){return v(e)===n},Ge.isLazy=function(e){return v(e)===p},Ge.isMemo=function(e){return v(e)===m},Ge.isPortal=function(e){return v(e)===r},Ge.isProfiler=function(e){return v(e)===i},Ge.isStrictMode=function(e){return v(e)===o},Ge.isSuspense=function(e){return v(e)===d},Ge.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===m||e.$$typeof===a||e.$$typeof===l||e.$$typeof===u||e.$$typeof===h||e.$$typeof===b||e.$$typeof===g||e.$$typeof===y)},Ge.typeOf=v,Ge}():e.exports=(Xe||(Xe=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var y=e.type;switch(y){case c:case s:case n:case i:case o:case d:return y;default:var h=y&&y.$$typeof;switch(h){case l:case u:case p:case m:case a:return h;default:return f}}case r:return f}}}var x=c,S=s,w=l,$=a,C=t,E=u,k=n,O=p,T=m,P=r,I=i,j=o,R=d,N=!1;function z(e){return v(e)===s}ut.AsyncMode=x,ut.ConcurrentMode=S,ut.ContextConsumer=w,ut.ContextProvider=$,ut.Element=C,ut.ForwardRef=E,ut.Fragment=k,ut.Lazy=O,ut.Memo=T,ut.Portal=P,ut.Profiler=I,ut.StrictMode=j,ut.Suspense=R,ut.isAsyncMode=function(e){return N||(N=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),z(e)||v(e)===c},ut.isConcurrentMode=z,ut.isContextConsumer=function(e){return v(e)===l},ut.isContextProvider=function(e){return v(e)===a},ut.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},ut.isForwardRef=function(e){return v(e)===u},ut.isFragment=function(e){return v(e)===n},ut.isLazy=function(e){return v(e)===p},ut.isMemo=function(e){return v(e)===m},ut.isPortal=function(e){return v(e)===r},ut.isProfiler=function(e){return v(e)===i},ut.isStrictMode=function(e){return v(e)===o},ut.isSuspense=function(e){return v(e)===d},ut.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===m||e.$$typeof===a||e.$$typeof===l||e.$$typeof===u||e.$$typeof===h||e.$$typeof===b||e.$$typeof===g||e.$$typeof===y)},ut.typeOf=v}()),ut)),Je.exports;var e}
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/function dt(){if(Qe)return Ke;Qe=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Ke=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,o){for(var i,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),c=1;c<arguments.length;c++){for(var s in i=Object(arguments[c]))t.call(i,s)&&(l[s]=i[s]);if(e){a=e(i);for(var u=0;u<a.length;u++)r.call(i,a[u])&&(l[a[u]]=i[a[u]])}}return l},Ke}function ft(){if(et)return Ze;et=1;return Ze="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function mt(){return rt?tt:(rt=1,tt=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var pt=ut();Ye.exports=function(){if(at)return it;at=1;var e=ut(),t=dt(),r=ft(),n=mt(),o=function(){if(ot)return nt;ot=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=ft(),r={},n=mt();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,a,l,c){if("production"!==process.env.NODE_ENV)for(var s in o)if(n(o,s)){var u;try{if("function"!=typeof o[s]){var d=Error((l||"React class")+": "+a+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=o[s](i,s,l,a,null,t)}catch(e){u=e}if(!u||u instanceof Error||e((l||"React class")+": type specification of "+a+" `"+s+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in r)){r[u.message]=!0;var f=c?c():"";e("Failed "+a+" type: "+u.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},nt=o}(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),it=function(l,c){var s="function"==typeof Symbol&&Symbol.iterator,u="@@iterator",d="<<anonymous>>",f={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:y(a),arrayOf:function(e){return y((function(t,n,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[n];if(!Array.isArray(l))return new p("Invalid "+i+" `"+a+"` of type `"+v(l)+"` supplied to `"+o+"`, expected an array.");for(var c=0;c<l.length;c++){var s=e(l,c,o,i,a+"["+c+"]",r);if(s instanceof Error)return s}return null}))},element:y((function(e,t,r,n,o){var i=e[t];return l(i)?null:new p("Invalid "+n+" `"+o+"` of type `"+v(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:y((function(t,r,n,o,i){var a=t[r];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+v(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return y((function(t,r,n,o,i){if(!(t[r]instanceof e)){var a=e.name||d;return new p("Invalid "+o+" `"+i+"` of type `"+((l=t[r]).constructor&&l.constructor.name?l.constructor.name:d)+"` supplied to `"+n+"`, expected instance of `"+a+"`.")}var l;return null}))},node:y((function(e,t,r,n,o){return g(e[t])?null:new p("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return y((function(t,o,i,a,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var c=t[o],s=v(c);if("object"!==s)return new p("Invalid "+a+" `"+l+"` of type `"+s+"` supplied to `"+i+"`, expected an object.");for(var u in c)if(n(c,u)){var d=e(c,u,i,a,l+"."+u,r);if(d instanceof Error)return d}return null}))},oneOf:function(e){return Array.isArray(e)?y((function(t,r,n,o,i){for(var a=t[r],l=0;l<e.length;l++)if(m(a,e[l]))return null;var c=JSON.stringify(e,(function(e,t){return"symbol"===x(t)?String(t):t}));return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+n+"`, expected one of "+c+".")})):("production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+S(o)+" at index "+t+"."),a}return y((function(t,o,i,a,l){for(var c=[],s=0;s<e.length;s++){var u=(0,e[s])(t,o,i,a,l,r);if(null==u)return null;u.data&&n(u.data,"expectedType")&&c.push(u.data.expectedType)}return new p("Invalid "+a+" `"+l+"` supplied to `"+i+"`"+(c.length>0?", expected one of type ["+c.join(", ")+"]":"")+".")}))},shape:function(e){return y((function(t,n,o,i,a){var l=t[n],c=v(l);if("object"!==c)return new p("Invalid "+i+" `"+a+"` of type `"+c+"` supplied to `"+o+"`, expected `object`.");for(var s in e){var u=e[s];if("function"!=typeof u)return b(o,i,a,s,x(u));var d=u(l,s,o,i,a+"."+s,r);if(d)return d}return null}))},exact:function(e){return y((function(o,i,a,l,c){var s=o[i],u=v(s);if("object"!==u)return new p("Invalid "+l+" `"+c+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var d=t({},o[i],e);for(var f in d){var m=e[f];if(n(e,f)&&"function"!=typeof m)return b(a,l,c,f,x(m));if(!m)return new p("Invalid "+l+" `"+c+"` key `"+f+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=m(s,f,a,l,c+"."+f,r);if(y)return y}return null}))}};function m(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function y(e){if("production"!==process.env.NODE_ENV)var t={},n=0;function o(o,a,l,s,u,f,m){if(s=s||d,f=f||l,m!==r){if(c){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=s+":"+l;!t[h]&&n<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+s+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[h]=!0,n++)}}return null==a[l]?o?null===a[l]?new p("The "+u+" `"+f+"` is marked as required in `"+s+"`, but its value is `null`."):new p("The "+u+" `"+f+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(a,l,s,u,f)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function h(e){return y((function(t,r,n,o,i,a){var l=t[r];return v(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function b(e,t,r,n,o){return new p((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function g(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(g);if(null===e||l(e))return!0;var t=function(e){var t=e&&(s&&e[s]||e[u]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!g(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!g(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function x(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function S(e){var t=x(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,f.checkPropTypes=o,f.resetWarningCache=o.resetWarningCache,f.PropTypes=f,f},it}()(pt.isElement,!0)}else Ye.exports=function(){if(ct)return lt;ct=1;var e=ft();function t(){}function r(){}return r.resetWarningCache=t,lt=function(){function n(t,r,n,o,i,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return n}n.isRequired=n;var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i}}()();function yt(e,t,r,n,o){const i=e[t],a=o||t;if(null==i||"undefined"==typeof window)return null;let l;const c=i.type;return"function"!=typeof c||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(c)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${n} \`${a}\` supplied to \`${r}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}Be(Ye.exports.element,yt).isRequired=Be(Ye.exports.element.isRequired,yt),Be(Ye.exports.elementType,(function(e,t,r,n,o){const i=e[t],a=o||t;if(null==i||"undefined"==typeof window)return null;let l;return"function"!=typeof i||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(i)||(l="Did you accidentally provide a plain function component instead?"),void 0!==l?new Error(`Invalid ${n} \`${a}\` supplied to \`${r}\`. Expected an element type that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}));var ht,bt={};var gt,vt,xt={};
|
|
14
|
+
*/function ft(){if(Ze)return Qe;Ze=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Qe=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,o){for(var i,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),c=1;c<arguments.length;c++){for(var s in i=Object(arguments[c]))t.call(i,s)&&(l[s]=i[s]);if(e){a=e(i);for(var u=0;u<a.length;u++)r.call(i,a[u])&&(l[a[u]]=i[a[u]])}}return l},Qe}function mt(){if(tt)return et;tt=1;return et="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function pt(){return nt?rt:(nt=1,rt=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var yt=dt();He.exports=function(){if(lt)return at;lt=1;var e=dt(),t=ft(),r=mt(),n=pt(),o=function(){if(it)return ot;it=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=mt(),r={},n=pt();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,a,l,c){if("production"!==process.env.NODE_ENV)for(var s in o)if(n(o,s)){var u;try{if("function"!=typeof o[s]){var d=Error((l||"React class")+": "+a+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=o[s](i,s,l,a,null,t)}catch(e){u=e}if(!u||u instanceof Error||e((l||"React class")+": type specification of "+a+" `"+s+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in r)){r[u.message]=!0;var f=c?c():"";e("Failed "+a+" type: "+u.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},ot=o}(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),at=function(l,c){var s="function"==typeof Symbol&&Symbol.iterator,u="@@iterator",d="<<anonymous>>",f={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:y(a),arrayOf:function(e){return y((function(t,n,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[n];if(!Array.isArray(l))return new p("Invalid "+i+" `"+a+"` of type `"+v(l)+"` supplied to `"+o+"`, expected an array.");for(var c=0;c<l.length;c++){var s=e(l,c,o,i,a+"["+c+"]",r);if(s instanceof Error)return s}return null}))},element:y((function(e,t,r,n,o){var i=e[t];return l(i)?null:new p("Invalid "+n+" `"+o+"` of type `"+v(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:y((function(t,r,n,o,i){var a=t[r];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+v(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return y((function(t,r,n,o,i){if(!(t[r]instanceof e)){var a=e.name||d;return new p("Invalid "+o+" `"+i+"` of type `"+((l=t[r]).constructor&&l.constructor.name?l.constructor.name:d)+"` supplied to `"+n+"`, expected instance of `"+a+"`.")}var l;return null}))},node:y((function(e,t,r,n,o){return g(e[t])?null:new p("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return y((function(t,o,i,a,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var c=t[o],s=v(c);if("object"!==s)return new p("Invalid "+a+" `"+l+"` of type `"+s+"` supplied to `"+i+"`, expected an object.");for(var u in c)if(n(c,u)){var d=e(c,u,i,a,l+"."+u,r);if(d instanceof Error)return d}return null}))},oneOf:function(e){return Array.isArray(e)?y((function(t,r,n,o,i){for(var a=t[r],l=0;l<e.length;l++)if(m(a,e[l]))return null;var c=JSON.stringify(e,(function(e,t){return"symbol"===x(t)?String(t):t}));return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+n+"`, expected one of "+c+".")})):("production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+S(o)+" at index "+t+"."),a}return y((function(t,o,i,a,l){for(var c=[],s=0;s<e.length;s++){var u=(0,e[s])(t,o,i,a,l,r);if(null==u)return null;u.data&&n(u.data,"expectedType")&&c.push(u.data.expectedType)}return new p("Invalid "+a+" `"+l+"` supplied to `"+i+"`"+(c.length>0?", expected one of type ["+c.join(", ")+"]":"")+".")}))},shape:function(e){return y((function(t,n,o,i,a){var l=t[n],c=v(l);if("object"!==c)return new p("Invalid "+i+" `"+a+"` of type `"+c+"` supplied to `"+o+"`, expected `object`.");for(var s in e){var u=e[s];if("function"!=typeof u)return b(o,i,a,s,x(u));var d=u(l,s,o,i,a+"."+s,r);if(d)return d}return null}))},exact:function(e){return y((function(o,i,a,l,c){var s=o[i],u=v(s);if("object"!==u)return new p("Invalid "+l+" `"+c+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var d=t({},o[i],e);for(var f in d){var m=e[f];if(n(e,f)&&"function"!=typeof m)return b(a,l,c,f,x(m));if(!m)return new p("Invalid "+l+" `"+c+"` key `"+f+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=m(s,f,a,l,c+"."+f,r);if(y)return y}return null}))}};function m(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function y(e){if("production"!==process.env.NODE_ENV)var t={},n=0;function o(o,a,l,s,u,f,m){if(s=s||d,f=f||l,m!==r){if(c){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=s+":"+l;!t[h]&&n<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+s+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[h]=!0,n++)}}return null==a[l]?o?null===a[l]?new p("The "+u+" `"+f+"` is marked as required in `"+s+"`, but its value is `null`."):new p("The "+u+" `"+f+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(a,l,s,u,f)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function h(e){return y((function(t,r,n,o,i,a){var l=t[r];return v(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function b(e,t,r,n,o){return new p((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function g(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(g);if(null===e||l(e))return!0;var t=function(e){var t=e&&(s&&e[s]||e[u]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!g(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!g(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function x(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function S(e){var t=x(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,f.checkPropTypes=o,f.resetWarningCache=o.resetWarningCache,f.PropTypes=f,f},at}()(yt.isElement,!0)}else He.exports=function(){if(st)return ct;st=1;var e=mt();function t(){}function r(){}return r.resetWarningCache=t,ct=function(){function n(t,r,n,o,i,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return n}n.isRequired=n;var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i}}()();function ht(e,t,r,n,o){const i=e[t],a=o||t;if(null==i||"undefined"==typeof window)return null;let l;const c=i.type;return"function"!=typeof c||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(c)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${n} \`${a}\` supplied to \`${r}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}Ue(He.exports.element,ht).isRequired=Ue(He.exports.element.isRequired,ht),Ue(He.exports.elementType,(function(e,t,r,n,o){const i=e[t],a=o||t;if(null==i||"undefined"==typeof window)return null;let l;return"function"!=typeof i||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(i)||(l="Did you accidentally provide a plain function component instead?"),void 0!==l?new Error(`Invalid ${n} \`${a}\` supplied to \`${r}\`. Expected an element type that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}));var bt,gt={};var vt,xt,St={};
|
|
15
15
|
/**
|
|
16
16
|
* @license React
|
|
17
17
|
* react-is.development.js
|
|
@@ -20,5 +20,5 @@ object-assign
|
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the MIT license found in the
|
|
22
22
|
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/vt={exports:{}},"production"===process.env.NODE_ENV?vt.exports=function(){if(ht)return bt;ht=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case n:case i:case o:case u:case d:return e;default:switch(e=e&&e.$$typeof){case c:case l:case s:case m:case f:case a:return e;default:return p}}case r:return p}}}return e=Symbol.for("react.module.reference"),bt.ContextConsumer=l,bt.ContextProvider=a,bt.Element=t,bt.ForwardRef=s,bt.Fragment=n,bt.Lazy=m,bt.Memo=f,bt.Portal=r,bt.Profiler=i,bt.StrictMode=o,bt.Suspense=u,bt.SuspenseList=d,bt.isAsyncMode=function(){return!1},bt.isConcurrentMode=function(){return!1},bt.isContextConsumer=function(e){return y(e)===l},bt.isContextProvider=function(e){return y(e)===a},bt.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},bt.isForwardRef=function(e){return y(e)===s},bt.isFragment=function(e){return y(e)===n},bt.isLazy=function(e){return y(e)===m},bt.isMemo=function(e){return y(e)===f},bt.isPortal=function(e){return y(e)===r},bt.isProfiler=function(e){return y(e)===i},bt.isStrictMode=function(e){return y(e)===o},bt.isSuspense=function(e){return y(e)===u},bt.isSuspenseList=function(e){return y(e)===d},bt.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===i||t===o||t===u||t===d||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===f||t.$$typeof===a||t.$$typeof===l||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},bt.typeOf=y,bt}():vt.exports=(gt||(gt=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var y=e.type;switch(y){case n:case i:case o:case u:case d:return y;default:var h=y&&y.$$typeof;switch(h){case c:case l:case s:case m:case f:case a:return h;default:return p}}case r:return p}}}e=Symbol.for("react.module.reference");var h=l,b=a,g=t,v=s,x=n,S=m,w=f,$=r,C=i,E=o,k=u,O=d,T=!1,P=!1;xt.ContextConsumer=h,xt.ContextProvider=b,xt.Element=g,xt.ForwardRef=v,xt.Fragment=x,xt.Lazy=S,xt.Memo=w,xt.Portal=$,xt.Profiler=C,xt.StrictMode=E,xt.Suspense=k,xt.SuspenseList=O,xt.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},xt.isConcurrentMode=function(e){return P||(P=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},xt.isContextConsumer=function(e){return y(e)===l},xt.isContextProvider=function(e){return y(e)===a},xt.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},xt.isForwardRef=function(e){return y(e)===s},xt.isFragment=function(e){return y(e)===n},xt.isLazy=function(e){return y(e)===m},xt.isMemo=function(e){return y(e)===f},xt.isPortal=function(e){return y(e)===r},xt.isProfiler=function(e){return y(e)===i},xt.isStrictMode=function(e){return y(e)===o},xt.isSuspense=function(e){return y(e)===u},xt.isSuspenseList=function(e){return y(e)===d},xt.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===i||t===o||t===u||t===d||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===f||t.$$typeof===a||t.$$typeof===l||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},xt.typeOf=y}()),xt),"undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),Ye.exports.oneOfType([Ye.exports.func,Ye.exports.object]);const St={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:-1,overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};const wt=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function $t(e,t,r,n){const o=e[t];if(null==o||!wt(o)){const e=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":Number.isFinite(e)?e!==Math.floor(e)?"float":"number":"Infinity";case"object":return null===e?"null":e.constructor.name;default:return t}}(o);return new RangeError(`Invalid ${n} \`${t}\` of type \`${e}\` supplied to \`${r}\`, expected \`integer\`.`)}return null}function Ct(e,t,...r){return void 0===e[t]?null:$t(e,t,...r)}function Et(){return null}Ct.isRequired=$t,Et.isRequired=Et,process.env.NODE_ENV;const kt=({order:r,orderBy:n,headCells:o,onRequestSort:i})=>t(Q,{children:t(W,{children:o.map((o=>{return t(q,{variant:"head",padding:o.disablePadding?"none":"normal",sortDirection:n===o.id&&r,sx:{fontWeight:"bold"},children:o.sort?e(K,{active:n===o.id,direction:n===o.id?r:"asc",onClick:(a=o.id,()=>{i(a)}),children:[o.label,n===o.id?t(g,{component:"span",sx:St,children:"desc"===r?"sorted descending":"sorted ascending"}):null]}):o.label},String(o.id));var a}))})});function Ot(e,t,r){return t[r]<e[r]?-1:t[r]>e[r]?1:0}const Tt=({children:n,data:o,search:i,columns:a,defaultSort:l,defaultOrder:c="asc",loading:s=!1})=>{const[d,f]=u(""),[m,p]=u(c),[y,h]=u(l),b=o.slice().filter(function(e,t){return r=>!t||e.some((e=>{let n=r[e.id];return n?.toLowerCase&&(n=n.toLowerCase()),n?.toString().includes(t.toLowerCase())}))}(a,d)).sort(function(e,t){return"desc"===e?(e,r)=>Ot(e,r,t):(e,r)=>-Ot(e,r,t)}(m,y));return t(r,{children:e(g,{sx:{paddingX:1,paddingBottom:2},children:[i&&t(g,{paddingY:2,children:t(k,{fullWidth:!0,placeholder:"Search",InputProps:{role:"search",startAdornment:t(J,{position:"start",children:t(X,{})})},onChange:e=>f(e.target.value)})}),t(Y,{children:e(G,{children:[t(kt,{order:m,orderBy:y,headCells:a,onRequestSort:e=>{p(y===e&&"asc"===m?"desc":"asc"),h(e)}}),t(H,{children:s?t(W,{children:t(q,{colSpan:a.length,sx:{textAlign:"center"},children:t(M,{})})}):0===b.length?t(W,{children:t(q,{colSpan:a.length,sx:{textAlign:"center"},children:"No data"})}):n(b)})]})})]})})};Tt.defaultProps={defaultOrder:"asc"};const Pt=({columns:n,options:o,data:i,onClick:a,search:l,defaultSort:c,defaultOrder:s,loading:d})=>{const f=[...n,{id:"__options",label:"",disablePadding:!1,numeric:!1,sort:!1}],[m,p]=u(null);return e(r,{children:[t(Tt,{columns:f,data:i,search:l,defaultSort:c,defaultOrder:s,loading:d,children:r=>r.map(((r,n)=>e(W,{onClick:()=>a&&a(r),role:"row","aria-rowindex":n,sx:{cursor:a&&"pointer"},children:[f.map((({id:e},o)=>t(q,{role:"cell",scope:"row","aria-rowindex":n,"aria-colindex":o,children:r[e]},e.toString()))),o&&t(q,{children:t(B,{"data-testid":`options-${r.id}`,onClick:e=>{e.stopPropagation(),p({item:r,anchor:e.currentTarget})},children:t(Z,{})})})]},r.id)))}),o&&t(U,{anchorEl:m?.anchor,open:!!m,onClose:()=>p(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:o.map((({id:e,label:r,onClick:n})=>t(C,{onClick:()=>{m&&n(m?.item),p(null)},children:r},e)))})]})},It=({model:r,modelName:o,listData:i,listRequest:a,deleteRequest:l,basePath:c="",deleteFeature:s=!0,updateFeature:u=!0,addFeature:d=!0,detailsFeature:m=!0,onRequestList:p,onClickDeleteItem:y})=>{const h=n();f((()=>{p()}),[]),_e({title:"Item deleted",message:"The item has been deleted successfully",severity:"success"},!!l.success,{from:!1,to:!0}),_e({title:"We had an error",message:l.error||"",severity:"error"},!!l.error,{from:!1,to:!0});const b=m?e=>{h(`${c}/${e.id}`)}:void 0,g=(e,t)=>{"edit"===e?h(`${c}/${t.id}/update`):y(t)},v=[];u&&v.push({id:"edit",label:"Edit",onClick:e=>g("edit",e)}),s&&v.push({id:"remove",label:"Remove",onClick:e=>g("remove",e)});const x=[];return d&&x.push({id:"add",text:"Add",href:`${c}/add`}),e(Ne,{loading:a.loading||l.loading,children:[t(Le,{title:o,preset:"default",actions:x.length>0?x:void 0}),t(We,{children:t(Pt,{columns:r.fields.filter((({listable:e})=>e)).map((({id:e,name:t,type:r})=>({disablePadding:!1,id:e,label:t,numeric:"number"===r,sort:!1}))),data:i,defaultSort:r.fields[0].id,onClick:b,options:v.length>0?v:void 0})})]})},jt=({model:r,modelName:n,basePath:o="",onSubmitNewItem:i,newItemRequest:a})=>(_e({message:"Item added successfully",severity:"success"},!!a.success,{from:!1,to:!0}),ke(`${o}/`,!!a.success,{from:!1,to:!0}),_e({title:"We had an error",message:a.error||"",severity:"error"},!!a.error,{from:!1,to:!0}),e(Ne,{loading:a.loading,children:[t(Le,{title:`Add ${n}`,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"add",text:`Add new ${n}`,link:`${o}/add`}]}),t(We,{children:t(Ee,{model:r,saveButtonText:"Save",onSubmit:i})})]})),Rt=({onClickCancel:r,onClickSubmit:n,sx:o})=>e(J,{position:"end",sx:o,children:[t(h,{variant:"contained",size:"small",color:"error","aria-label":"cancel button",startIcon:t(ne,{sx:{fontSize:12}}),onClick:r,sx:{paddingRight:0,minWidth:0,marginRight:1}}),t(h,{variant:"contained",size:"small",color:"primary","aria-label":"submit button",startIcon:t(te,{sx:{fontSize:12}}),onClick:n,sx:{paddingRight:0,minWidth:0}})]}),Nt=(e,t)=>{const[r,n]=u(!1),[o,i]=u(e),a=()=>{n(!1),i(e)};return{isEditing:r,cancelEdit:a,editValue:o,setEditValue:i,startEdit:()=>{n(!0)},submitEdit:()=>{t(o),a()}}},zt=({dense:e,onClick:r})=>{const{typography:n}=N();return t(B,{size:"small",onClick:r,sx:{ml:e?.5:1},"aria-label":"edit button",children:t(oe,{sx:{fontSize:n.pxToRem(e?18:24)}})})},Mt=e=>`label-${e.replace(/ /g,"-")}`,_t=({label:r,hideLabel:n,tooltip:o,tooltipEnterDelay:i=2e3,children:a,dense:l,sx:c})=>{const{typography:s}=N(),u=Mt(r);return e(g,{width:1,lineHeight:l?0:void 0,sx:c,children:[!n&&t(R,{variant:l?"caption":"subtitle2",role:"label",id:u,lineHeight:l?s.pxToRem(15):void 0,children:r}),o?t(ie,{title:o,placement:"top",enterDelay:i,children:a}):a]})},Vt=({label:r,value:n,placeholder:o="-",editable:i,dense:a,onEdit:l=(()=>null)})=>{const c=Mt(r),{typography:s}=N(),{isEditing:u,editValue:d,startEdit:f,cancelEdit:m,setEditValue:p,submitEdit:y}=Nt(n,l),h={fontSize:a?s.h6.fontSize:s.h5.fontSize};return t(_t,{label:r,dense:a,children:e(g,u?{display:"flex",alignItems:"center",children:[t(ee,{size:a?"small":"medium",checked:d,onChange:e=>p(e.target.checked)}),t(Rt,{onClickCancel:m,onClickSubmit:y})]}:{display:"flex",alignItems:"center","aria-labelledby":c,role:"checkbox","aria-checked":n,children:[void 0===n?t(R,{variant:"h5",children:o}):n?t(te,{color:"success",sx:h}):t(re,{color:"error",sx:h}),i&&t(zt,{dense:a,onClick:f})]})})},At=({label:n,value:o,format:i,placeholder:a="-",editable:l,editInputType:c="datetime",dense:s,onEdit:u=(()=>null)})=>{const{isEditing:d,editValue:f,startEdit:m,cancelEdit:p,setEditValue:y,submitEdit:h}=Nt(o,u),b=Mt(n),v=o&&ae(o,i)||a;return t(_t,{label:n,hideLabel:d,tooltip:v,dense:s,sx:{display:"flex",flexDirection:"column"},children:d?t("datetime"===c?ce:"time"===c?se:le,{value:f,format:i,label:n,onChange:e=>y(e||void 0),slots:{textField:n=>t(k,{...n,size:"small",InputProps:{...n.InputProps,endAdornment:e(r,{children:[n.InputProps?.endAdornment,t(Rt,{onClickCancel:p,onClickSubmit:h,sx:{ml:2}})]}),sx:{marginY:s?.2:1}}})}}):e(g,{display:"flex",alignItems:"center","aria-labelledby":b,children:[t(R,{variant:s?"body1":"h5",noWrap:!0,children:v}),l&&t(zt,{dense:s,onClick:m})]})})},Dt=({label:r,value:n,placeholder:o="-",editable:i,dense:a,onEdit:l=(()=>null)})=>{const c=d(null),{isEditing:s,editValue:u,startEdit:m,cancelEdit:p,setEditValue:y,submitEdit:h}=Nt(n?.toString(),l),b=Mt(r),v=n?.toString()||o,x=e=>{"Enter"===e.key&&l(e.target.value)};return f((()=>(c.current?.addEventListener("keypress",x),()=>c.current?.removeEventListener("keypress",x))),[c.current]),t(_t,{hideLabel:s,label:r,tooltip:v,dense:a,children:s?t(k,{inputRef:c,value:u,label:r,size:"small",onChange:e=>y(e.target.value),InputProps:{endAdornment:t(Rt,{onClickCancel:p,onClickSubmit:h})},sx:{marginY:a?0:1}}):e(g,{display:"flex","aria-labelledby":b,children:[t(R,{variant:a?"body1":"h5",noWrap:!0,children:v}),i&&t(zt,{dense:a,onClick:m})]})})},Ft="RdsValueItem-root",Lt="RdsValueItem-content",Wt=({children:e,bordered:r=!0,...n})=>{const o=((e,t)=>{const r=`solid ${t} 1px`,n="none";if(e){if(Array.isArray(e))return e.map((e=>e?r:n));if("object"==typeof e){const t={};return Object.entries(e).forEach((([e,o])=>{t[e]=o?r:n})),t}return r}})(r,me({lightWeight:200,darkWeight:800}));return t(b,{item:!0,className:Ft,...n,children:t(g,{className:Lt,px:1,borderLeft:o,children:e})})},qt=(e,r,{dense:n}={})=>{const{id:o,name:i,type:a}=e,l=r[o];return"boolean"===a?t(Vt,{dense:n,label:i,value:l}):"date"===a||"time"===a||"datetime"===a?t(At,{dense:n,label:i,value:l,format:e.format}):"object"!=typeof l||Array.isArray(l)?t(Dt,{dense:n,label:i,value:l?.toString()}):t(Dt,{dense:n,label:i,value:JSON.stringify(l)})},Bt=({field:{name:e,description:r,value:n},instance:o,dense:i})=>{const a=[{field:"id",headerName:"ID",width:70}];n.forEach((e=>{a.push({field:e.id,headerName:e.name})}));const l=o.map(((e,t)=>({id:t,...e})));return t(ye,{title:e,subtitle:r,dense:i,children:t(b,{item:!0,xs:12,children:t(ue,{rows:l,columns:a,density:i?"compact":"standard",disableRowSelectionOnClick:!0,pageSizeOptions:[5],initialState:{pagination:{paginationModel:{pageSize:5}}},sx:{height:400}})})})},Ut=({field:{name:e,description:r,value:n},instance:o,dense:i})=>{const a=pe();return t(ye,{title:e,subtitle:r,dense:i,children:n.map((e=>{const{id:r,xs:n,sm:l,md:c,lg:s,xl:u}=e,d=a.increment(e);return t(Wt,{xs:n,sm:l,md:c,lg:s,xl:u,bordered:d,children:qt(e,o,{dense:i})},r)}))})},Yt=({model:e,instance:r,dense:n})=>{const o=pe();return t(b,{container:!0,spacing:n?1:2,children:e.fields.map((e=>{const{id:i,type:a,xs:l=3,sm:c=0,md:s=0,lg:u=0,xl:d=0}=e;if("group"===a)return o.increment({xs:12}),t(b,{item:!0,xs:12,children:t(Ut,{field:e,instance:r[i],dense:n})},i);if("group[]"===a)return o.increment({xs:12}),t(b,{item:!0,xs:12,children:t(Bt,{field:e,instance:r[i],dense:n})},i);const f=o.increment(e);return t(Wt,{xs:l,sm:c,md:s,lg:u,xl:d,bordered:f,children:qt(e,r,{dense:n})},i)}))})},Ht=({model:r,modelName:n,basePath:o="",onRequestItem:i,itemRequest:l,detailsItem:c})=>{const{id:s=""}=a();return f((()=>{i(s)}),[s]),e(Ne,{loading:l.loading,children:[t(Le,{title:s,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"detail",text:s,link:`${o}/${s}`}]}),t(We,{children:c&&t(Yt,{model:r,instance:c})})]})},Jt=r=>{const{updateFeature:n=!0,addFeature:o=!0,detailsFeature:i=!0}=r;return e(l,{children:[t(c,{path:"",element:t(It,{...r})}),i&&t(c,{path:":id",element:t(Ht,{...r})}),o&&t(c,{path:"add",element:t(jt,{...r})}),n&&t(c,{path:":id/update",element:t(qe,{...r})})]})},Gt={idle:!0},Xt={loading:!0},Kt={success:!0};export{Gt as IdleRequest,Xt as LoadingRequest,Jt as ModelRouter,Kt as SuccessRequest};
|
|
23
|
+
*/xt={exports:{}},"production"===process.env.NODE_ENV?xt.exports=function(){if(bt)return gt;bt=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case n:case i:case o:case u:case d:return e;default:switch(e=e&&e.$$typeof){case c:case l:case s:case m:case f:case a:return e;default:return p}}case r:return p}}}return e=Symbol.for("react.module.reference"),gt.ContextConsumer=l,gt.ContextProvider=a,gt.Element=t,gt.ForwardRef=s,gt.Fragment=n,gt.Lazy=m,gt.Memo=f,gt.Portal=r,gt.Profiler=i,gt.StrictMode=o,gt.Suspense=u,gt.SuspenseList=d,gt.isAsyncMode=function(){return!1},gt.isConcurrentMode=function(){return!1},gt.isContextConsumer=function(e){return y(e)===l},gt.isContextProvider=function(e){return y(e)===a},gt.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},gt.isForwardRef=function(e){return y(e)===s},gt.isFragment=function(e){return y(e)===n},gt.isLazy=function(e){return y(e)===m},gt.isMemo=function(e){return y(e)===f},gt.isPortal=function(e){return y(e)===r},gt.isProfiler=function(e){return y(e)===i},gt.isStrictMode=function(e){return y(e)===o},gt.isSuspense=function(e){return y(e)===u},gt.isSuspenseList=function(e){return y(e)===d},gt.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===i||t===o||t===u||t===d||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===f||t.$$typeof===a||t.$$typeof===l||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},gt.typeOf=y,gt}():xt.exports=(vt||(vt=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var y=e.type;switch(y){case n:case i:case o:case u:case d:return y;default:var h=y&&y.$$typeof;switch(h){case c:case l:case s:case m:case f:case a:return h;default:return p}}case r:return p}}}e=Symbol.for("react.module.reference");var h=l,b=a,g=t,v=s,x=n,S=m,w=f,$=r,C=i,E=o,k=u,O=d,T=!1,P=!1;St.ContextConsumer=h,St.ContextProvider=b,St.Element=g,St.ForwardRef=v,St.Fragment=x,St.Lazy=S,St.Memo=w,St.Portal=$,St.Profiler=C,St.StrictMode=E,St.Suspense=k,St.SuspenseList=O,St.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},St.isConcurrentMode=function(e){return P||(P=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},St.isContextConsumer=function(e){return y(e)===l},St.isContextProvider=function(e){return y(e)===a},St.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},St.isForwardRef=function(e){return y(e)===s},St.isFragment=function(e){return y(e)===n},St.isLazy=function(e){return y(e)===m},St.isMemo=function(e){return y(e)===f},St.isPortal=function(e){return y(e)===r},St.isProfiler=function(e){return y(e)===i},St.isStrictMode=function(e){return y(e)===o},St.isSuspense=function(e){return y(e)===u},St.isSuspenseList=function(e){return y(e)===d},St.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===i||t===o||t===u||t===d||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===f||t.$$typeof===a||t.$$typeof===l||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},St.typeOf=y}()),St),"undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),He.exports.oneOfType([He.exports.func,He.exports.object]);const wt={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:-1,overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};const $t=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function Ct(e,t,r,n){const o=e[t];if(null==o||!$t(o)){const e=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":Number.isFinite(e)?e!==Math.floor(e)?"float":"number":"Infinity";case"object":return null===e?"null":e.constructor.name;default:return t}}(o);return new RangeError(`Invalid ${n} \`${t}\` of type \`${e}\` supplied to \`${r}\`, expected \`integer\`.`)}return null}function Et(e,t,...r){return void 0===e[t]?null:Ct(e,t,...r)}function kt(){return null}Et.isRequired=Ct,kt.isRequired=kt,process.env.NODE_ENV;const Ot=({order:r,orderBy:n,headCells:o,onRequestSort:i})=>t(Z,{children:t(q,{children:o.map((o=>{return t(B,{variant:"head",padding:o.disablePadding?"none":"normal",sortDirection:n===o.id&&r,sx:{fontWeight:"bold"},children:o.sort?e(Q,{active:n===o.id,direction:n===o.id?r:"asc",onClick:(a=o.id,()=>{i(a)}),children:[o.label,n===o.id?t(v,{component:"span",sx:wt,children:"desc"===r?"sorted descending":"sorted ascending"}):null]}):o.label},String(o.id));var a}))})});function Tt(e,t,r){return t[r]<e[r]?-1:t[r]>e[r]?1:0}const Pt=({children:n,data:o,search:i,columns:a,defaultSort:l,defaultOrder:c="asc",loading:s=!1})=>{const[u,f]=d(""),[m,p]=d(c),[y,h]=d(l),b=o.slice().filter(function(e,t){return r=>!t||e.some((e=>{let n=r[e.id];return n?.toLowerCase&&(n=n.toLowerCase()),n?.toString().includes(t.toLowerCase())}))}(a,u)).sort(function(e,t){return"desc"===e?(e,r)=>Tt(e,r,t):(e,r)=>-Tt(e,r,t)}(m,y));return t(r,{children:e(v,{sx:{paddingX:1,paddingBottom:2},children:[i&&t(v,{paddingY:2,children:t(O,{fullWidth:!0,placeholder:"Search",InputProps:{role:"search",startAdornment:t(G,{position:"start",children:t(K,{})})},onChange:e=>f(e.target.value)})}),t(H,{children:e(X,{children:[t(Ot,{order:m,orderBy:y,headCells:a,onRequestSort:e=>{p(y===e&&"asc"===m?"desc":"asc"),h(e)}}),t(J,{children:s?t(q,{children:t(B,{colSpan:a.length,sx:{textAlign:"center"},children:t(_,{})})}):0===b.length?t(q,{children:t(B,{colSpan:a.length,sx:{textAlign:"center"},children:"No data"})}):n(b)})]})})]})})};Pt.defaultProps={defaultOrder:"asc"};const It=({columns:n,options:o,data:i,onClick:a,search:l,defaultSort:c,defaultOrder:s,loading:u})=>{const f=[...n,{id:"__options",label:"",disablePadding:!1,numeric:!1,sort:!1}],[m,p]=d(null);return e(r,{children:[t(Pt,{columns:f,data:i,search:l,defaultSort:c,defaultOrder:s,loading:u,children:r=>r.map(((r,n)=>e(q,{onClick:()=>a&&a(r),role:"row","aria-rowindex":n,sx:{cursor:a&&"pointer"},children:[f.map((({id:e},o)=>t(B,{role:"cell",scope:"row","aria-rowindex":n,"aria-colindex":o,children:r[e]},e.toString()))),o&&t(B,{children:t(U,{"data-testid":`options-${r.id}`,onClick:e=>{e.stopPropagation(),p({item:r,anchor:e.currentTarget})},children:t(ee,{})})})]},r.id)))}),o&&t(Y,{anchorEl:m?.anchor,open:!!m,onClose:()=>p(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:o.map((({id:e,label:r,onClick:n})=>t(E,{onClick:()=>{m&&n(m?.item),p(null)},children:r},e)))})]})},jt=({model:r,modelName:o,listData:i,listRequest:a,deleteRequest:l,basePath:c="",deleteFeature:s=!0,updateFeature:u=!0,addFeature:d=!0,detailsFeature:f=!0,onRequestList:p,onClickDeleteItem:y})=>{const h=n();m((()=>{p()}),[]),Ve({title:"Item deleted",message:"The item has been deleted successfully",severity:"success"},!!l.success,{from:!1,to:!0}),Ve({title:"We had an error",message:l.error||"",severity:"error"},!!l.error,{from:!1,to:!0});const b=f?e=>{h(`${c}/${e.id}`)}:void 0,g=(e,t)=>{"edit"===e?h(`${c}/${t.id}/update`):y(t)},v=[];u&&v.push({id:"edit",label:"Edit",onClick:e=>g("edit",e)}),s&&v.push({id:"remove",label:"Remove",onClick:e=>g("remove",e)});const x=[];return d&&x.push({id:"add",text:"Add",href:`${c}/add`}),e(ze,{loading:a.loading||l.loading,children:[t(We,{title:o,preset:"default",actions:x.length>0?x:void 0}),t(qe,{children:t(It,{columns:r.fields.filter((({listable:e})=>e)).map((({id:e,name:t,type:r})=>({disablePadding:!1,id:e,label:t,numeric:"number"===r,sort:!1}))),data:i,defaultSort:r.fields[0].id,onClick:b,options:v.length>0?v:void 0})})]})},Rt=({model:r,modelName:n,basePath:o="",onSubmitNewItem:i,newItemRequest:a})=>(Ve({message:"Item added successfully",severity:"success"},!!a.success,{from:!1,to:!0}),Oe(`${o}/`,!!a.success,{from:!1,to:!0}),Ve({title:"We had an error",message:a.error||"",severity:"error"},!!a.error,{from:!1,to:!0}),e(ze,{loading:a.loading,children:[t(We,{title:`Add ${n}`,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"add",text:`Add new ${n}`,link:`${o}/add`}]}),t(qe,{children:t(ke,{model:r,saveButtonText:"Save",onSubmit:i})})]})),Nt=({onClickCancel:r,onClickSubmit:n,sx:o})=>e(G,{position:"end",sx:o,children:[t(b,{variant:"contained",size:"small",color:"error","aria-label":"cancel button",startIcon:t(oe,{sx:{fontSize:12}}),onClick:r,sx:{paddingRight:0,minWidth:0,marginRight:1}}),t(b,{variant:"contained",size:"small",color:"primary","aria-label":"submit button",startIcon:t(re,{sx:{fontSize:12}}),onClick:n,sx:{paddingRight:0,minWidth:0}})]}),zt=(e,t)=>{const[r,n]=d(!1),[o,i]=d(e),a=()=>{n(!1),i(e)};return{isEditing:r,cancelEdit:a,editValue:o,setEditValue:i,startEdit:()=>{n(!0)},submitEdit:()=>{t(o),a()}}},Mt=({dense:e,onClick:r})=>{const{typography:n}=z();return t(U,{size:"small",onClick:r,sx:{ml:e?.5:1},"aria-label":"edit button",children:t(ie,{sx:{fontSize:n.pxToRem(e?18:24)}})})},_t=e=>`label-${e.replace(/ /g,"-")}`,Vt=({label:r,hideLabel:n,tooltip:o,tooltipEnterDelay:i=2e3,children:a,dense:l,sx:c})=>{const{typography:s}=z(),u=_t(r);return e(v,{width:1,lineHeight:l?0:void 0,sx:c,children:[!n&&t(N,{variant:l?"caption":"subtitle2",role:"label",id:u,lineHeight:l?s.pxToRem(15):void 0,children:r}),o?t(ae,{title:o,placement:"top",enterDelay:i,children:a}):a]})},At=({label:r,value:n,placeholder:o="-",editable:i,dense:a,onEdit:l=(()=>null)})=>{const c=_t(r),{typography:s}=z(),{isEditing:u,editValue:d,startEdit:f,cancelEdit:m,setEditValue:p,submitEdit:y}=zt(n,l),h={fontSize:a?s.h6.fontSize:s.h5.fontSize};return t(Vt,{label:r,dense:a,children:e(v,u?{display:"flex",alignItems:"center",children:[t(te,{size:a?"small":"medium",checked:d,onChange:e=>p(e.target.checked)}),t(Nt,{onClickCancel:m,onClickSubmit:y})]}:{display:"flex",alignItems:"center","aria-labelledby":c,role:"checkbox","aria-checked":n,children:[void 0===n?t(N,{variant:"h5",children:o}):n?t(re,{color:"success",sx:h}):t(ne,{color:"error",sx:h}),i&&t(Mt,{dense:a,onClick:f})]})})},Dt=({label:n,value:o,format:i,placeholder:a="-",editable:l,editInputType:c="datetime",dense:s,onEdit:u=(()=>null)})=>{const{isEditing:d,editValue:f,startEdit:m,cancelEdit:p,setEditValue:y,submitEdit:h}=zt(o,u),b=_t(n),g=o&&le(o,i)||a;return t(Vt,{label:n,hideLabel:d,tooltip:g,dense:s,sx:{display:"flex",flexDirection:"column"},children:d?t("datetime"===c?se:"time"===c?ue:ce,{value:f,format:i,label:n,onChange:e=>y(e||void 0),slots:{textField:n=>t(O,{...n,size:"small",InputProps:{...n.InputProps,endAdornment:e(r,{children:[n.InputProps?.endAdornment,t(Nt,{onClickCancel:p,onClickSubmit:h,sx:{ml:2}})]}),sx:{marginY:s?.2:1}}})}}):e(v,{display:"flex",alignItems:"center","aria-labelledby":b,children:[t(N,{variant:s?"body1":"h5",noWrap:!0,children:g}),l&&t(Mt,{dense:s,onClick:m})]})})},Ft=({label:r,value:n,placeholder:o="-",editable:i,dense:a,onEdit:l=(()=>null)})=>{const c=f(null),{isEditing:s,editValue:u,startEdit:d,cancelEdit:p,setEditValue:y,submitEdit:h}=zt(n?.toString(),l),b=_t(r),g=n?.toString()||o,x=e=>{"Enter"===e.key&&l(e.target.value)};return m((()=>(c.current?.addEventListener("keypress",x),()=>c.current?.removeEventListener("keypress",x))),[c.current]),t(Vt,{hideLabel:s,label:r,tooltip:g,dense:a,children:s?t(O,{inputRef:c,value:u,label:r,size:"small",onChange:e=>y(e.target.value),InputProps:{endAdornment:t(Nt,{onClickCancel:p,onClickSubmit:h})},sx:{marginY:a?0:1}}):e(v,{display:"flex","aria-labelledby":b,children:[t(N,{variant:a?"body1":"h5",noWrap:!0,children:g}),i&&t(Mt,{dense:a,onClick:d})]})})},Lt="RdsValueItem-root",Wt="RdsValueItem-content",qt=({children:e,bordered:r=!0,...n})=>{const o=((e,t)=>{const r=`solid ${t} 1px`,n="none";if(e){if(Array.isArray(e))return e.map((e=>e?r:n));if("object"==typeof e){const t={};return Object.entries(e).forEach((([e,o])=>{t[e]=o?r:n})),t}return r}})(r,pe({lightWeight:200,darkWeight:800}));return t(g,{item:!0,className:Lt,...n,children:t(v,{className:Wt,px:1,borderLeft:o,children:e})})},Bt=(e,r,{dense:n}={})=>{const{id:o,name:i,type:a}=e,l=r[o];return"boolean"===a?t(At,{dense:n,label:i,value:l}):"date"===a||"time"===a||"datetime"===a?t(Dt,{dense:n,label:i,value:l,format:e.format}):"object"!=typeof l||Array.isArray(l)?t(Ft,{dense:n,label:i,value:l?.toString()}):t(Ft,{dense:n,label:i,value:JSON.stringify(l)})},Ut=({field:{name:e,description:r,value:n},instance:o,dense:i})=>{const a=[{field:"id",headerName:"ID",width:70}];n.forEach((e=>{a.push({field:e.id,headerName:e.name})}));const l=o.map(((e,t)=>({id:t,...e})));return t(he,{title:e,subtitle:r,dense:i,children:t(g,{item:!0,xs:12,children:t(de,{rows:l,columns:a,density:i?"compact":"standard",disableRowSelectionOnClick:!0,pageSizeOptions:[5],initialState:{pagination:{paginationModel:{pageSize:5}}},sx:{height:400}})})})},Yt=({field:{name:e,description:r,value:n},instance:o,dense:i})=>{const a=ye();return t(he,{title:e,subtitle:r,dense:i,children:n.map((e=>{const{id:r,xs:n,sm:l,md:c,lg:s,xl:u}=e,d=a.increment(e);return t(qt,{xs:n,sm:l,md:c,lg:s,xl:u,bordered:d,children:Bt(e,o,{dense:i})},r)}))})},Ht=({model:e,instance:r,dense:n})=>{const o=ye();return t(g,{container:!0,spacing:n?1:2,children:e.fields.map((e=>{const{id:i,type:a,xs:l=3,sm:c=0,md:s=0,lg:u=0,xl:d=0}=e;if("group"===a)return o.increment({xs:12}),t(g,{item:!0,xs:12,children:t(Yt,{field:e,instance:r[i],dense:n})},i);if("group[]"===a)return o.increment({xs:12}),t(g,{item:!0,xs:12,children:t(Ut,{field:e,instance:r[i],dense:n})},i);const f=o.increment(e);return t(qt,{xs:l,sm:c,md:s,lg:u,xl:d,bordered:f,children:Bt(e,r,{dense:n})},i)}))})},Jt=({model:r,modelName:n,basePath:o="",onRequestItem:i,itemRequest:a,detailsItem:c})=>{const{id:s=""}=l();return m((()=>{i(s)}),[s]),e(ze,{loading:a.loading,children:[t(We,{title:s,preset:"default",breadcrumbs:[{id:"list",text:n,link:`${o}/`},{id:"detail",text:s,link:`${o}/${s}`}]}),t(qe,{children:c&&t(Ht,{model:r,instance:c})})]})},Gt=r=>{const{updateFeature:n=!0,addFeature:o=!0,detailsFeature:i=!0}=r;return e(c,{children:[t(s,{path:"",element:t(jt,{...r})}),i&&t(s,{path:":id",element:t(Jt,{...r})}),o&&t(s,{path:"add",element:t(Rt,{...r})}),n&&t(s,{path:":id/update",element:t(Be,{...r})})]})},Xt={idle:!0},Kt={loading:!0},Qt={success:!0};export{Xt as IdleRequest,Kt as LoadingRequest,Gt as ModelRouter,Qt as SuccessRequest};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|