umwd-components 0.1.706 → 0.1.707

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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useEffect as o}from"react";import l from"@mui/material/IconButton";import i from"@mui/material/Dialog";import a from"@mui/material/DialogContent";import n from"@mui/material/DialogActions";import m from"@mui/material/Button";import s from"@mui/material/Typography";import c from"@mui/material/Paper";import u from"@mui/material/Stack";import f from"../../../../node_modules/dayjs/dayjs.min.js";import d from"@mui/icons-material/NoteAlt";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as g}from"react-dom";import{createNoteAction as v}from"../../../data/actions/logistics/note/createNoteAction.js";import E from"../../common/markdown/MarkdownEditor.js";import{useSnackbar as b}from"../../../context/common/SnackbarContext.js";var x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function k(k){var h,y,j=k.content,C=k.related,w=k.revalidateCallback,D=e(r(!1),2),A=D[0],S=D[1],z=v.bind(null,C),M=e(g(z,x),2),T=M[0],Y=M[1],B=b().handleAddMessage;return o((function(){(null==T?void 0:T.strapiErrors)&&B({message:T.strapiErrors,severity:T.severity||"error"}),(null==T?void 0:T.message)&&(B({message:T.message,severity:T.severity||"success"}),"success"===(null==T?void 0:T.severity)&&(S(!1),w&&w()))}),[T]),t.createElement(t.Fragment,null,t.createElement(l,{onClick:function(){return S(!0)},sx:{width:50,height:50,color:"#ffff88"}},t.createElement(d,{fontSize:"large"})),t.createElement(i,{open:A,fullWidth:!0,maxWidth:"lg",onClose:function(){return S(!1)}},t.createElement("form",{action:Y},t.createElement(a,{sx:{p:1}},t.createElement(c,{elevation:4,sx:{background:"linear-gradient(135deg, #ffff88 81%,#ffff88 82%,#ffff88 82%,#ffffc6 100%)",color:"black",p:1}},t.createElement(u,{spacing:2},t.createElement(s,{variant:"body1",textAlign:"right"},f(Date.now()).format("DD-MM-YYYY")),t.createElement(E,{name:"content",label:"The note",defaultValue:j,sx:{color:"black",label:{color:"black"},input:{color:"black"},div:{color:"black"}},textfieldProps:{placeholder:"Write your note here...",multiline:!0,minRows:5,maxRows:10,error:null!=(null===(h=null==T?void 0:T.zodErrors)||void 0===h?void 0:h.content),helperText:(null===(y=null==T?void 0:T.zodErrors)||void 0===y?void 0:y.content)||""}})))),t.createElement(n,null,t.createElement(m,{onClick:function(){return S(!1)}},"Cancel"),t.createElement(p,{text:"Submit",loadingText:"Loading..."})))))}export{k as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useEffect as o}from"react";import l from"@mui/material/IconButton";import i from"@mui/material/Dialog";import n from"@mui/material/DialogContent";import a from"@mui/material/DialogActions";import m from"@mui/material/Button";import c from"@mui/material/Typography";import s from"@mui/material/Paper";import u from"@mui/material/Stack";import f from"../../../../node_modules/dayjs/dayjs.min.js";import d from"@mui/icons-material/NoteAlt";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as g}from"react-dom";import{createNoteAction as v}from"../../../data/actions/logistics/note/createNoteAction.js";import E from"../../common/markdown/MarkdownEditor.js";import{useSnackbar as b}from"../../../context/common/SnackbarContext.js";var x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function k(k){var h,y,j=k.content,C=k.related,w=k.revalidateCallback,D=e(r(!1),2),A=D[0],S=D[1],z=v.bind(null,C),M=e(g(z,x),2),T=M[0],Y=M[1],B=b().handleAddMessage;return o((function(){(null==T?void 0:T.strapiErrors)&&B({message:T.strapiErrors,severity:T.severity||"error"}),(null==T?void 0:T.message)&&(B({message:T.message,severity:T.severity||"success"}),"success"===(null==T?void 0:T.severity)&&(S(!1),w&&w()))}),[T]),t.createElement(t.Fragment,null,t.createElement(l,{onClick:function(){return S(!0)},sx:{width:50,height:50,color:"#ffff88"}},t.createElement(d,{fontSize:"large"})),t.createElement(i,{open:A,fullWidth:!0,maxWidth:"lg",onClose:function(){return S(!1)}},t.createElement("form",{action:Y},t.createElement(n,{sx:{p:1}},t.createElement(s,{elevation:4,sx:{background:"linear-gradient(135deg, #ffff88 81%,#ffff88 82%,#ffff88 82%,#ffffc6 100%)",color:"black",p:1}},t.createElement(u,{spacing:2},t.createElement(c,{variant:"body1",textAlign:"right"},f(Date.now()).format("DD-MM-YYYY")),t.createElement(E,{name:"content",label:"The note",defaultValue:j,sx:{color:"black",label:{color:"black"},input:{color:"black"},div:{color:"black"}},textfieldProps:{id:"content",placeholder:"Write your note here...",multiline:!0,minRows:5,maxRows:10,error:null!=(null===(h=null==T?void 0:T.zodErrors)||void 0===h?void 0:h.content),helperText:(null===(y=null==T?void 0:T.zodErrors)||void 0===y?void 0:y.content)||""}})))),t.createElement(a,null,t.createElement(m,{onClick:function(){return S(!1)}},"Cancel"),t.createElement(p,{text:"Submit",loadingText:"Loading..."})))))}export{k as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{z as t}from"zod";import{mutateData as o}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";var i=t.object({content:t.string().min(10).max(5e3,{message:"Description must be at least 10 characters"})});function n(t,n,l){return r(this,void 0,void 0,(function(){var r,d,u,m,c;return e(this,(function(e){switch(e.label){case 0:return null==t?[2,s(s({},n),{zodErrors:null,strapiErrors:null,message:"Failed to Create Note. Related entity is missing.",severity:"error"})]:(r=i.safeParse({id:l.get("content")})).success?(d=r.data,u={data:s(s({},d),{related:t})},[4,o("POST","/api/notes",u)]):[2,s(s({},n),{zodErrors:r.error.flatten().fieldErrors,strapiErrors:null,message:"Missing Fields. Failed to Update Page."})];case 1:return(m=e.sent())?m.error?[2,s(s({},n),{zodErrors:null,strapiErrors:m.error,message:"Failed to Create Note.",severity:"error"})]:(c=a(m),[2,s(s({},n),{zodErrors:null,message:"New Note Created",severity:"success",data:c,strapiErrors:null})]):[2,s(s({},n),{zodErrors:null,strapiErrors:null,message:"Ops! Something went wrong. Please try again.",severity:"error"})]}}))}))}export{n as createNoteAction};
7
+ import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{z as s}from"zod";import{mutateData as o}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";var n=s.object({content:s.string().min(10,"Description must be at least 10 characters long").max(5e3,"Description cannot be more than 5000 characters long")});function i(s,i,l){return r(this,void 0,void 0,(function(){var r,u,c,m,d;return e(this,(function(e){switch(e.label){case 0:return null==s?[2,t(t({},i),{zodErrors:null,strapiErrors:null,message:"Failed to Create Note. Related entity is missing.",severity:"error"})]:(r=n.safeParse({content:l.get("content")})).success?(u=r.data,c={data:t(t({},u),{related:s})},[4,o("POST","/api/notes",c)]):[2,t(t({},i),{zodErrors:r.error.flatten().fieldErrors,strapiErrors:null,message:"null"})];case 1:return(m=e.sent())?m.error?[2,t(t({},i),{zodErrors:null,strapiErrors:m.error,message:"Failed to Create Note.",severity:"error"})]:(d=a(m),[2,t(t({},i),{zodErrors:null,message:"New Note Created",severity:"success",data:d,strapiErrors:null})]):[2,t(t({},i),{zodErrors:null,strapiErrors:null,message:"Ops! Something went wrong. Please try again.",severity:"error"})]}}))}))}export{i as createNoteAction};