@artibet/react-mui-components 3.7.0 → 3.7.1
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/package.json +3 -2
- package/properties/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artibet/react-mui-components",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Various react components build with mui library",
|
|
5
5
|
"main": "./core/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"modals",
|
|
51
51
|
"form-fields",
|
|
52
52
|
"tables",
|
|
53
|
-
"inertiajs"
|
|
53
|
+
"inertiajs",
|
|
54
|
+
"properties"
|
|
54
55
|
],
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@babel/core": "^7.26.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{TextField as t,Dialog as r,DialogTitle as n,DialogContent as o,DialogActions as a,Button as l,Typography as i,Box as u,ListItem as c,Grid2 as d,Stack as s,Chip as m,Divider as f}from"@mui/material";import{router as p}from"@inertiajs/react";import{ErrorOutline as v,Edit as h}from"@mui/icons-material";import{Controller as b,useForm as x}from"react-hook-form";import{yupResolver as y}from"@hookform/resolvers/yup";import*as g from"yup";import"react-color";import"date-fns";import"date-fns/locale";import"axios";import"react-number-format";import"@mui/x-date-pickers/AdapterDateFnsV3";import"@mui/x-date-pickers/LocalizationProvider";import"@mui/x-date-pickers";import"date-fns/locale/el";function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S.apply(null,arguments)}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,i=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t);else for(;!(u=(n=a.call(r)).done)&&(i.push(n.value),i.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var w=["form","name","label","maxLength","required","disabled","autofocus","showErrors","readonly","readonlyBackgroundColor","bold"],k=function(r){var n=r.form,o=r.name,a=r.label,l=r.maxLength,i=void 0===l?255:l,u=r.required,c=void 0!==u&&u,d=r.disabled,s=void 0!==d&&d,m=r.autofocus,f=void 0!==m&&m,p=r.showErrors,v=void 0===p||p,h=r.readonly,x=void 0!==h&&h,y=r.readonlyBackgroundColor,g=void 0===y?"#dddddd":y,E=r.bold,C=void 0!==E&&E,k=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,w),O=n.control,j=n.formState.errors;return e.createElement(b,{name:o,control:O,rules:{required:c,disabled:s},render:function(r){var n,l,u=r.field,d=u.onChange,m=u.onBlur,p=u.value;return e.createElement(t,S({required:c,label:a,value:p,onChange:d,onBlur:m,error:v&&Boolean(null===(n=j[o])||void 0===n?void 0:n.message),fullWidth:!0,helperText:v&&(null===(l=j[o])||void 0===l?void 0:l.message),variant:"outlined",disabled:s,autoFocus:f,slotProps:{input:{maxLength:i,readOnly:x,sx:{fontWeight:C?"bold":"",backgroundColor:x?g:""}}}},k))}})},O=function(t){var c=t.open,d=t.title,s=t.label,m=t.value,f=t.onSubmit,p=t.onCancel,v=t.size,h=void 0===v?"sm":v,b=t.required,E=void 0===b||b,S=t.requiredMessage,C=void 0===S?"Υποχρεωτικό πεδίο":S,w=t.okLabel,O=void 0===w?"ΚΑΤΑΧΩΡΗΣΗ":w,j=t.cancelLabel,q=void 0===j?"ΑΚΥΡΩΣΗ":j,z=t.maxLength,L=void 0===z?255:z,W=t.message,T=void 0===W?null:W,A={text:m||""},B=g.object({text:E?g.string().max(L,"Παρακαλώ πληκτρολογείστε μέχρι ".concat(L," χαρακτήρες")).required(C):g.string().max(L)}),I=x({defaultValues:A,resolver:y(B)});return e.useEffect((function(){c&&(I.clearErrors(),I.setValue("text",m||"",{shouldValidate:!1,shouldDirty:!1,shouldTouch:!1}))}),[c,m]),e.createElement(r,{fullWidth:!0,maxWidth:h,open:c,onClose:function(){},onKeyDown:function(e){"Enter"!==e.code&&"NumpadEnter"!==e.code||(e.preventDefault(),I.handleSubmit((function(e){return f(e.text)}))())},disableRestoreFocus:!0},e.createElement(n,null,d),e.createElement(o,null,T?"string"==typeof T?e.createElement(i,{variant:"body1",color:"text.secondary",sx:{mb:2}},T):e.createElement(u,{sx:{mb:2}},T):null,e.createElement(k,{form:I,name:"text",label:s,required:E,autofocus:!0,maxLength:L,sx:{marginTop:2}})),e.createElement(a,null,e.createElement(l,{color:"success",onClick:I.handleSubmit((function(e){return f(e.text)}))},O),e.createElement(l,{color:"error",onClick:function(){return p()}},q)))};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".chrome-picker {\r\n -webkit-box-shadow: none !important;\r\n -moz-box-shadow: none !important;\r\n box-shadow: none !important;\r\n}");var j=function(t){var r=t.label,n=t.value,o=t.render,a=void 0===o?null:o,u=t.fieldName,b=void 0===u?null:u,x=t.editable,y=void 0!==x&&x,g=t.required,E=void 0===g||g,S=t.placeholder,w=void 0===S?"":S,k=t.modalTitle,j=void 0===k?"Επεξεργασία":k,q=t.updateUrl,z=void 0===q?null:q,L=t.maxLength,W=void 0===L?255:L,T=t.message,A=void 0===T?null:T,B=t.hasDivider,I=void 0===B||B,P=C(e.useState(!1),2),D=P[0],F=P[1],N=!n&&E;return e.createElement(e.Fragment,null,e.createElement(c,{sx:{py:2.5,px:4}},e.createElement(d,{container:!0,spacing:2,sx:{width:"100%"},alignItems:"center"},e.createElement(d,{size:{xs:12,sm:3}},e.createElement(i,{variant:"subtitle2",color:"text.secondary",fontWeight:600},r)),e.createElement(d,{size:{xs:12,sm:6}},E&&!n?e.createElement(s,{direction:"row",spacing:1,alignItems:"center"},e.createElement(i,{variant:"body1",color:"error.main",fontWeight:600},"Δεν έχει καταχωρηθεί"),e.createElement(m,{size:"small",color:"error",variant:"soft",label:"Απαιτείται",icon:e.createElement(v,{sx:{fontSize:"14px !important"}}),sx:{fontWeight:700,height:22}})):a||e.createElement(i,{variant:"body1",fontWeight:500},n||w)),e.createElement(d,{size:{xs:12,sm:3},sx:{display:"flex",justifyContent:"flex-end"}},y&&e.createElement(l,{size:"small",variant:N?"contained":"outlined",color:N?"error":"primary",startIcon:e.createElement(h,{fontSize:"small"}),onClick:function(){return F(!0)},sx:{borderRadius:2,textTransform:"none",fontWeight:700,minWidth:"120px"}},n?"Επεξεργασία":"Συμπλήρωση")))),I&&e.createElement(f,{component:"li"}),e.createElement(O,{open:D,title:j,label:r,value:n,required:E,maxLength:W,onSubmit:function(e){p.put(z,{field:b,value:e},{preserveScroll:!0}),F(!1)},onCancel:function(){return F(!1)},message:A}))};export{j as TextProperty};
|