@famalabs/web-form 1.0.0-beta.7 → 1.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/compiler/FormCompiler.js +1 -1
- package/dist/core/compiler/common/SidebarCompiler.js +1 -1
- package/dist/core/compiler/containers/PageCompiler.js +1 -1
- package/dist/core/compiler/question_forms/ItemFunctionCompiler.js +1 -1
- package/dist/core/compiler/question_forms/QuestionCheckCompiler.js +1 -1
- package/dist/core/components/common/DrawerCommon.js +1 -1
- package/dist/core/components/common/ModalCommon.js +1 -1
- package/dist/core/components/common/ResponsiveDrawer.js +1 -1
- package/dist/core/components/forms/QuestionCheckCommon.js +1 -1
- package/dist/core/components/forms/QuestionListCommon.js +1 -1
- package/dist/core/editor/common/CommonEditor.js +1 -1
- package/dist/core/editor/common/HierarchyEditor.js +1 -1
- package/dist/core/editor/common/SnapshotDrawer.js +1 -1
- package/dist/core/editor/common/SurveyCreateNew.js +1 -1
- package/dist/core/editor/common/sidebar/SidebarEditor.js +1 -1
- package/dist/core/editor/common/sidebar/SidebarPageStructure.js +1 -1
- package/dist/core/editor/common/sidebar/SidebarQuestionStructure.js +1 -1
- package/dist/core/editor/containers/FolderEditor.js +1 -1
- package/dist/core/editor/containers/PageEditor.js +1 -1
- package/dist/core/editor/containers/RenderPageEditModal.js +1 -1
- package/dist/core/editor/containers/RenderSectionEditModal.js +1 -1
- package/dist/core/editor/question_editor/QuestionCommonEditor.js +1 -1
- package/dist/core/editor/question_editor/QuestionPreviewRender.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import{DrawerCommon as e}from"../components/common/DrawerCommon.js";import"@mui/material/Typography";import o from"@mui/material/Grid";import{jsx as
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import{DrawerCommon as e}from"../components/common/DrawerCommon.js";import"@mui/material/Typography";import o from"@mui/material/Grid";import{jsx as t,jsxs as i}from"react/jsx-runtime";import"@mui/material/Card";import"@mui/material/CardContent";import"@mui/material/Modal";import"../components/common/Skeletons.js";import m,{useEffect as a}from"react";import{useFormStateContext as n}from"../providers/common/FormStateProvider.js";import{CompilerStateProvider as l}from"../providers/compiler/CompilerStateProvider.js";import"isomorphic-dompurify";import s from"@mui/material/Box";import"@mui/material/Button";import{ShieldCheck as p}from"lucide-react";import"@mui/material/SvgIcon";import u from"@mui/material/Chip";import"@mui/material/FormLabel";import"@mui/material/IconButton";import d from"@mui/material/Stack";import c from"@mui/material/Tooltip";import"../utils/config-map.js";import"../utils/locale.js";import"@famalabs/survey";import"acorn";import"@famalabs/web-ui";import{useForm as f,FormProvider as g}from"react-hook-form";import"@mui/material/FormControl";import"@mui/material/FormControlLabel";import"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../components/forms/QuestionListCommon.js";import"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import{useNavigation as b}from"../hooks/common/NavigationHook.js";import"lodash-es";import"idb";import{useCompilerInit as h}from"../hooks/compiler/InitCompiler.js";import{useParseQuestionsForm as v,useParseQuestionsValidators as w,useZodCompilerResolver as y}from"../validators/compiler/CompilerValidators.js";import x from"@mui/material/Container";import C from"@mui/material/Paper";import{getItemProgress as j,isPageProgressComplete as S,SegmentedLinearProgress as P}from"./common/CompilerProgress.js";import{NavigationButtons as I}from"./common/NavigationButtonsCompiler.js";import{SidebarCompiler as T}from"./common/SidebarCompiler.js";import{PageCompilerForm as A}from"./containers/PageCompiler.js";function M(M){const O=r(81),{submissionInfo:L,onAnswersSave:D,loading:V,onSubmit:N,configuration:R}=M,{formInfo:_,formInstance:G,mutateAndSync:H,globalConfig:Q}=n();let W,$;O[0]!==R.warnOnExit?(W=()=>{if(!R.warnOnExit||"undefined"==typeof window)return;const r=z;return window.addEventListener("beforeunload",r),()=>{window.removeEventListener("beforeunload",r)}},$=[R.warnOnExit],O[0]=R.warnOnExit,O[1]=W,O[2]=$):(W=O[1],$=O[2]),a(W,$);const U=L?.answers||L;let J;O[3]!==R.loadAnswerMethod||O[4]!==V||O[5]!==U?(J={initAnswers:U,loadAnswerMethod:R.loadAnswerMethod,loading:V},O[3]=R.loadAnswerMethod,O[4]=V,O[5]=U,O[6]=J):J=O[6],h(J);const q=b(G,!1),K="user"===R.navigation?G.root?.layout?.navigation??"strict":R.navigation,X=q.getValidatedPages();let Y;O[7]!==G?(Y=r=>{try{return G.get(r.id)}catch(e){const o=e;return console.error("Error retrieving page with id:",r.id,o),null}},O[7]=G,O[8]=Y):Y=O[8];const Z=q.getPages().filter(E).map(Y).filter(F),rr=Z.map(r=>{const e=j(G,o=r).progress<100&&X.includes(o.id)&&"free"===K;var o;return r.update({...r.toJSON(),layout:{...r.layout,error:e}}),r}),er=Q.readonlyMode,or=q.getPageByIndex(0)?.id,tr=q.currentPage?.id;let ir;r:try{if(tr){ir=G.get(tr);break r}if(or){ir=G.get(or);break r}ir=null}catch(sr){const r=sr;console.error("Error retrieving current page with id:",tr,r),ir=null}const mr=ir,ar=v(mr?.items),nr=w(mr?.items),lr=y(nr),sr=Q.readonlyMode?void 0:lr;let pr;O[9]!==ar||O[10]!==sr?(pr={values:ar,resolver:sr,mode:"onBlur",reValidateMode:"onBlur"},O[9]=ar,O[10]=sr,O[11]=pr):pr=O[11];const ur=f(pr),{trigger:dr}=ur,cr=j(G,mr).progress<100&&X.includes(mr?.id||"")&&"free"===K&&!er;let fr;O[12]!==cr||O[13]!==dr?(fr=()=>{cr&&dr()},O[12]=cr,O[13]=dr,O[14]=fr):fr=O[14];const gr=mr?.id;let br;O[15]!==cr||O[16]!==gr||O[17]!==dr?(br=[gr,cr,dr],O[15]=cr,O[16]=gr,O[17]=dr,O[18]=br):br=O[18],a(fr,br);const hr=R.submitMode;let vr;O[19]!==G||O[20]!==H||O[21]!==D||O[22]!==cr||O[23]!==hr||O[24]!==dr?(vr=async(r,e)=>{if(void 0!==e&&r){try{const o=G.get(r);H(()=>o.setAnswer(e))}catch(r){const e=r;console.error(e)}"live"===hr&&await(D?.({id:r,answer:e})),cr&&dr()}else console.error("Invalid id or value for submitting answer")},O[19]=G,O[20]=H,O[21]=D,O[22]=cr,O[23]=hr,O[24]=dr,O[25]=vr):vr=O[25];const wr=vr,yr="user"===R.sidebar?"visible"===(G.root?.layout?.sidebar??"visible"):"visible"===R.sidebar,xr="user"===R.compilerProgress?"linear"===(G.root?.layout?.compilerProgress??"circular"):("linear"===R.compilerProgress||"full"===R.compilerProgress)&&Z.length>1;let Cr;O[26]!==G||O[27]!==q?(Cr=2!==G.mode||!S(G,q.getPages()),O[26]=G,O[27]=q,O[28]=Cr):Cr=O[28];const jr=Cr,Sr=Q.locale,[Pr,Ir]=m.useState(!0);let Tr;O[29]!==Pr?(Tr=()=>Ir(!Pr),O[29]=Pr,O[30]=Tr):Tr=O[30];const Ar=Tr,[Mr]=m.useState(B),kr=Q.bannerUploadMethods?.bannerUrl,Br=Boolean(_.icon&&kr&&or===tr),Fr=L?.pseudoId,Er=_.name;let zr;O[31]!==V||O[32]!==Fr||O[33]!==Er?(zr=t(T,{title:Er,pseudoId:Fr,loading:V}),O[31]=V,O[32]=Fr,O[33]=Er,O[34]=zr):zr=O[34];const Or=zr;let Lr,Dr,Vr,Nr,Rr,_r,Gr,Hr,Qr;O[35]===Symbol.for("react.memo_cache_sentinel")?(Lr={height:"100%",width:"100%"},O[35]=Lr):Lr=O[35],O[36]!==V||O[37]!==er||O[38]!==xr||O[39]!==rr?(Dr=!V&&xr&&!er&&t(o,{container:!0,size:12,justifyContent:"center",alignItems:"center",p:3,sx:{position:"sticky",top:0,zIndex:1001,backdropFilter:"saturate(180%) blur(5px)"},children:t(o,{size:6,children:t(P,{segments:rr})})}),O[36]=V,O[37]=er,O[38]=xr,O[39]=rr,O[40]=Dr):Dr=O[40],O[41]!==Mr||O[42]!==kr||O[43]!==Br?(Vr=Br&&t(x,{maxWidth:"md",sx:{p:"0 !important"},children:t(o,{position:"relative",component:C,container:!0,size:12,borderRadius:3,overflow:"hidden",mb:3,height:"200px",children:t("img",{alt:"",src:`${kr}?t=${Mr}`,sizes:"(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw",loading:"eager",fetchPriority:"high",draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top"}})})}),O[41]=Mr,O[42]=kr,O[43]=Br,O[44]=Vr):Vr=O[44],O[45]===Symbol.for("react.memo_cache_sentinel")?(Nr={flex:1},O[45]=Nr):Nr=O[45],O[46]!==R.sidebar||O[47]!==V||O[48]!==Fr?(Rr=!V&&Fr&&"hidden"===R.sidebar&&t(s,{px:3,py:2,children:t(c,{title:"Identificativo",arrow:!0,children:t(u,{label:Fr,variant:"outlined",icon:t(p,{size:16})})})}),O[46]=R.sidebar,O[47]=V,O[48]=Fr,O[49]=Rr):Rr=O[49],O[50]!==mr||O[51]!==jr||O[52]!==V||O[53]!==N?(_r=mr&&i(x,{"aria-label":`page-container-${mr?.text}`,maxWidth:"md",sx:{p:"0 !important",py:2},children:[mr&&t(A,{currentPage:mr,loading:V}),!V&&t(I,{submit:{onSubmit:N,disabled:jr}})]}),O[50]=mr,O[51]=jr,O[52]=V,O[53]=N,O[54]=_r):_r=O[54],O[55]!==ur||O[56]!==_r?(Gr=t(g,{...ur,children:_r}),O[55]=ur,O[56]=_r,O[57]=Gr):Gr=O[57],O[58]!==Rr||O[59]!==Gr?(Hr=i(s,{component:"form",sx:Nr,onSubmit:k,children:[Rr,Gr]}),O[58]=Rr,O[59]=Gr,O[60]=Hr):Hr=O[60],O[61]!==Dr||O[62]!==Vr||O[63]!==Hr?(Qr=i(d,{sx:Lr,children:[Dr,Vr,Hr]}),O[61]=Dr,O[62]=Vr,O[63]=Hr,O[64]=Qr):Qr=O[64];const Wr=Qr;let $r,Ur,Jr;return O[65]!==R||O[66]!==Sr||O[67]!==q||O[68]!==cr||O[69]!==wr?($r={navigationState:q,submitAnswer:wr,shouldTriggerValidation:cr,configuration:R,locale:Sr},O[65]=R,O[66]=Sr,O[67]=q,O[68]=cr,O[69]=wr,O[70]=$r):$r=O[70],O[71]!==Or||O[72]!==Wr||O[73]!==G.root||O[74]!==yr||O[75]!==Ar||O[76]!==Pr?(Ur=yr?t(e,{sidebar:Or,content:Wr,drawerWidth:260,title:G.root.text,onToggleOpen:Ar,isOpen:Pr}):Wr,O[71]=Or,O[72]=Wr,O[73]=G.root,O[74]=yr,O[75]=Ar,O[76]=Pr,O[77]=Ur):Ur=O[77],O[78]!==$r||O[79]!==Ur?(Jr=t(l,{value:$r,children:Ur}),O[78]=$r,O[79]=Ur,O[80]=Jr):Jr=O[80],Jr}function k(r){return r.preventDefault()}function B(){return Date.now()}function F(r){return null!=r&&r.items.length>0}function E(r){return!r.isDisabled}function z(r){r.preventDefault(),r.returnValue=""}export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import{useFormStateContext as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import{useFormStateContext as r}from"../../providers/common/FormStateProvider.js";import t from"react";import{jsx as i,jsxs as o}from"react/jsx-runtime";import{useCompilerStateContext as n}from"../../providers/compiler/CompilerStateProvider.js";import a from"@mui/material/Box";import l from"@mui/material/Button";import s from"@mui/material/Chip";import m from"@mui/material/Collapse";import d from"@mui/material/Divider";import c from"@mui/material/List";import p from"@mui/material/ListItemButton";import u from"@mui/material/ListItemIcon";import f from"@mui/material/ListItemText";import g from"@mui/material/Stack";import h from"@mui/material/Tooltip";import x from"@mui/material/Typography";import{FolderOpen as v,Folder as b,FileText as y,ChevronDown as w,LockKeyhole as P,ShieldCheck as S}from"lucide-react";import{SidebarSkeleton as I}from"../../components/common/Skeletons.js";import{getMapType as C,Mapper as z}from"../../utils/config-map.js";import"../../utils/locale.js";import{LegacyConditionParser as j}from"../../utils/parsers/LegacyConditionParser.js";import{ProgressIndicator as k,getItemProgress as B}from"./CompilerProgress.js";const L=L=>{const $=e(32),{loading:_,title:T,pseudoId:E,showPageAndFolder:O}=L,W=void 0!==O&&O,{formInstance:H}=r(),{navigationState:R,configuration:D}=n(),F=H.root.items||[],V=R.currentPage?.folderId,Z=R.currentPage?.id,[A,q]=t.useState(V);let G;$[0]!==R?(G=e=>Boolean(R.getItem(e.id)?.isDisabled),$[0]=R,$[1]=G):G=$[1];const J=G,K="user"===D.compilerProgress?"circular"===(H.root?.layout?.compilerProgress??"circular"):"circular"===D.compilerProgress||"full"===D.compilerProgress,M="user"===D.navigation?H.root?.layout?.navigation??"strict":D.navigation;let N;$[2]!==Z||$[3]!==H||$[4]!==J||$[5]!==R||$[6]!==M?(N=e=>{if(!e||J(e)||!Z)return;const r=H.get(Z||"0"),t=B(H,r).progress,i=B(H,e).progress,o=R.getItem(Z||"0")?.globalIndex,n=R.getItem(e.id)?.globalIndex;"strict"===M?(100===i||100===t&&n===(o||0)+1)&&R.goToPage(e.id):R.goToPage(e.id)},$[2]=Z,$[3]=H,$[4]=J,$[5]=R,$[6]=M,$[7]=N):N=$[7];const Q=N,U=R.getValidatedPages(),X=e=>B(H,e).progress<100&&U.includes(e.id)&&"free"===M;let Y;$[8]!==H||$[9]!==R||$[10]!==M?(Y=e=>{e&&"free"===M&&B(H,e).progress>0&&R.addValidatedPage(e.id)},$[8]=H,$[9]=R,$[10]=M,$[11]=Y):Y=$[11];const ee=Y;let re;$[12]!==H?(re=e=>{const{item:r}=e,t=r.parent(),n=t.parameters,l=(()=>{try{return n.length?H.get(n[0]):void 0}catch(e){const r=e;return void console.error("Error getting first condition for disabled icon lock:",r)}})(),s=(()=>{try{return n.length>1?H.get(n[1]):void 0}catch(e){const r=e;return void console.error("Error getting first condition for disabled icon lock:",r)}})(),m=j(t),d=m?.expression,c="exp"===d?.type?d?.right?.value:"";return i(h,{arrow:!0,title:o(a,{children:[i(x,{variant:"caption",gutterBottom:!0,children:`Risposta in ${l?.text} richiesta: "${c}"\n`}),i(x,{variant:"caption",gutterBottom:!0,sx:{display:s?"block":"none"},children:`Condizione di sblocco su ${s?.text} richiesta: }`})]}),children:i(P,{size:20})})},$[12]=H,$[13]=re):re=$[13];const te=re;let ie,oe;if($[14]!==V?(ie=()=>{q(V||"")},oe=[V],$[14]=V,$[15]=ie,$[16]=oe):(ie=$[15],oe=$[16]),t.useEffect(ie,oe),_)return I;const ne=g;let ae,le;$[17]===Symbol.for("react.memo_cache_sentinel")?(ae={justifyContent:"space-between",alignItems:"center",position:"relative",px:1},$[17]=ae):ae=$[17],$[18]===Symbol.for("react.memo_cache_sentinel")?(le={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"250px"},$[18]=le):le=$[18];const se=T??H.root.text;let me,de,ce,pe;$[19]!==se?(me=i(x,{variant:"h4",sx:le,children:se}),$[19]=se,$[20]=me):me=$[20],$[21]!==E?(de=E&&i(h,{title:"Identificativo",arrow:!0,children:i(s,{label:E,variant:"outlined",icon:i(S,{size:16})})}),$[21]=E,$[22]=de):de=$[22],$[23]!==me||$[24]!==de?(ce=o(g,{direction:"row",gap:2,sx:ae,children:[me,de]}),$[23]=me,$[24]=de,$[25]=ce):ce=$[25],$[26]===Symbol.for("react.memo_cache_sentinel")?(pe=i(d,{flexItem:!0,sx:{flexShrink:0}}),$[26]=pe):pe=$[26];const ue=W?F.map(e=>i(l,{variant:e.id===V?"contained":"outlined",onClick:()=>{"folder"===C(e)?q(A===e.id?void 0:e.id):Q(e)},children:i("span",{style:{paddingLeft:10},children:e.text})},e.id)):i(c,{component:"nav",sx:{width:"100%"},children:F.map((e,r)=>{const t=C(e)===z.cond.type?e.items[0]:e;return o(a,{"aria-label":"folder"===C(t)?`sidebar-root-container-${t.text}`:`sidebar-page-${t.text}`,sx:{mx:1,mb:1,p:.5,borderColor:"divider",borderStyle:"solid",borderWidth:"1px",borderRadius:2},children:[o(p,{dense:!0,divider:!0,selected:"folder"===C(e)?V===t.id:Z===t.id,onClick:()=>{t.id===Z||J(t)||("folder"===C(e)?q(A===t.id?void 0:t.id):(ee(t),Q(t)))},sx:{borderRadius:1.5,whiteSpace:"normal",minHeight:"42px",cursor:J(t)?"not-allowed":"pointer"},children:[i(u,{children:"folder"===C(e)?A===t.id?i(v,{size:20}):i(b,{size:20}):i(y,{size:20})}),i(f,{primary:t.text,slotProps:{primary:{variant:"subtitle1",style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:14,maxWidth:"25ch"}}}}),J(t)?i(te,{item:t}):K&&i(k,{item:t,color:X(t)?"error":"success"}),"folder"===C(t)&&i(w,{size:20,style:{transform:A===t.id?"rotateZ(180deg)":"rotateZ(0deg)",transition:"transform 0.3s ease"}})]},t.id),"folder"===C(e)&&i(m,{in:A===e.id,timeout:"auto",unmountOnExit:!0,children:i(c,{component:"div",disablePadding:!0,sx:{minHeight:"20px"},children:e.items.map(e=>{const r="cond"===C(e)?e.items[0]:e;return o(p,{"aria-label":`sidebar-page-${r.text}`,selected:Z===r.id,onClick:()=>{t.id===Z||J(r)||(Q(r),ee(r))},disabled:J(r),sx:{whiteSpace:"normal",pl:4,mt:.5,minHeight:"42px",cursor:J(t)?"not-allowed":"pointer"},children:[i(u,{children:i(y,{size:20})}),i(f,{primary:r.text,slotProps:{primary:{variant:"subtitle1",style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:14,maxWidth:"25ch"}}}}),J(r)?i(te,{item:r}):K&&i(k,{item:r,color:X(r)?"error":"success"})]},r.id)})})},"c"+e.id)]},r)})});let fe;return $[27]!==ne||$[28]!==ce||$[29]!==pe||$[30]!==ue?(fe=o(ne,{gap:2,children:[ce,pe,ue]}),$[27]=ne,$[28]=ce,$[29]=pe,$[30]=ue,$[31]=fe):fe=$[31],fe};export{L as SidebarCompiler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import i from"@mui/material/Typography";import"@mui/material/Grid";import{jsx as o,jsxs as r}from"react/jsx-runtime";import"@mui/material/Card";import"@mui/material/CardContent";import"@mui/material/Modal";import{CompilerPageSkeleton as m}from"../../components/common/Skeletons.js";import"react";import{useFormStateContext as e}from"../../providers/common/FormStateProvider.js";import{useCompilerStateContext as a}from"../../providers/compiler/CompilerStateProvider.js";import{PurifiedSpan as l}from"../../components/common/PurifiedSpan.js";import n from"@mui/material/Box";import"@mui/material/Button";import"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import"@mui/material/IconButton";import p from"@mui/material/Stack";import"@mui/material/Tooltip";import{getMapType as u,Mapper as s}from"../../utils/config-map.js";import"../../utils/locale.js";import{ItemConditional as c}from"@famalabs/survey";import"acorn";import"@famalabs/web-ui";import"react-hook-form";import"@mui/material/FormControl";import"@mui/material/FormControlLabel";import"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import d from"@mui/material/Paper";import{QuestionCompilerForm as f}from"../common/QuestionCompiler.js";const b=b=>{const y=t(24),{currentPage:g,loading:C}=b,{formInstance:h,globalConfig:S}=e(),{navigationState:j}=a(),v=S.readonlyMode,T="multi-card"===h.root?.layout?.pageStyle?"div":d,F=x;if(g instanceof c&&!g.result){let t;return y[0]===Symbol.for("react.memo_cache_sentinel")?(t=o(i,{children:"Non puoi accedere a questa pagina"}),y[0]=t):t=y[0],t}if(C)return m;const I=T===d?4:3,q=T===d?3:0,Q=T===d?4:0;let w,P,k,B
|
|
1
|
+
import{c as t}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import i from"@mui/material/Typography";import"@mui/material/Grid";import{jsx as o,jsxs as r}from"react/jsx-runtime";import"@mui/material/Card";import"@mui/material/CardContent";import"@mui/material/Modal";import{CompilerPageSkeleton as m}from"../../components/common/Skeletons.js";import"react";import{useFormStateContext as e}from"../../providers/common/FormStateProvider.js";import{useCompilerStateContext as a}from"../../providers/compiler/CompilerStateProvider.js";import{PurifiedSpan as l}from"../../components/common/PurifiedSpan.js";import n from"@mui/material/Box";import"@mui/material/Button";import"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import"@mui/material/IconButton";import p from"@mui/material/Stack";import"@mui/material/Tooltip";import{getMapType as u,Mapper as s}from"../../utils/config-map.js";import"../../utils/locale.js";import{ItemConditional as c}from"@famalabs/survey";import"acorn";import"@famalabs/web-ui";import"react-hook-form";import"@mui/material/FormControl";import"@mui/material/FormControlLabel";import"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import d from"@mui/material/Paper";import{QuestionCompilerForm as f}from"../common/QuestionCompiler.js";const b=b=>{const y=t(24),{currentPage:g,loading:C}=b,{formInstance:h,globalConfig:S}=e(),{navigationState:j}=a(),v=S.readonlyMode,T="multi-card"===h.root?.layout?.pageStyle?"div":d,F=x;if(g instanceof c&&!g.result){let t;return y[0]===Symbol.for("react.memo_cache_sentinel")?(t=o(i,{children:"Non puoi accedere a questa pagina"}),y[0]=t):t=y[0],t}if(C)return m;const I=T===d?4:3,q=T===d?3:0,Q=T===d?4:0;let w,P,R,k,B;if(y[1]!==q||y[2]!==Q?(w={borderRadius:3,px:q,py:Q},y[1]=q,y[2]=Q,y[3]=w):w=y[3],y[4]!==g.text?(P=g.text&&o(i,{variant:"h5",children:g.text}),y[4]=g.text,y[5]=P):P=y[5],y[6]!==g.description?(R=g.description&&o(i,{component:"legend",sx:{fontSize:14},children:o(l,{value:g.description})}),y[6]=g.description,y[7]=R):R=y[7],y[8]!==g.items||y[9]!==h.root||y[10]!==j||y[11]!==v){let t;y[13]!==h.root||y[14]!==j||y[15]!==v?(t=t=>{const i=j.getItem(t.id)?.globalIndex.toString()||"";return u(t)!==s.cond.type&&u(t)!==s.alert.type||F(t)?t.layout&&0===t.layout.visibility?null:"multi-card"===h.root.layout?.pageStyle?o(n,{component:d,id:`Question-${t.id}`,"aria-label":`question-compiler-${t?.text}`,sx:{borderRadius:3,px:3,py:4,mt:"0 !important"},children:o(f,{index:i,question:t,disabled:v})},t.id):o(n,{component:"div",id:`Question-${t.id}`,"aria-label":`question-compiler-${t?.text}`,sx:t instanceof c&&!F(t)?{mt:"0 !important"}:{},children:o(f,{index:i,question:t,disabled:v})},t.id):(t.items,null)},y[13]=h.root,y[14]=j,y[15]=v,y[16]=t):t=y[16],k=g.items.map(t),y[8]=g.items,y[9]=h.root,y[10]=j,y[11]=v,y[12]=k}else k=y[12];return y[17]!==T||y[18]!==I||y[19]!==w||y[20]!==P||y[21]!==R||y[22]!==k?(B=r(p,{component:T,gap:I,sx:w,children:[P,R,k]}),y[17]=T,y[18]=I,y[19]=w,y[20]=P,y[21]=R,y[22]=k,y[23]=B):B=y[23],B};function x(t){if(!t)return!1;try{return t.compute()}catch(t){const i=t;return console.warn("Error computing question condition",i),!1}}export{b as PageCompilerForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import"@mui/material/Typography";import"@mui/material/Grid";import{jsx as o,jsxs as r,Fragment as t}from"react/jsx-runtime";import{ModalCommon as i}from"../../components/common/ModalCommon.js";import"../../components/common/Skeletons.js";import m from"react";import{useFormStateContext as a}from"../../providers/common/FormStateProvider.js";import{useCompilerStateContext as n}from"../../providers/compiler/CompilerStateProvider.js";import"isomorphic-dompurify";import"@mui/material/Box";import"@mui/material/Button";import"lucide-react";import"@mui/material/SvgIcon";import{QuestionHeaderCommon as l}from"../../components/forms/QuestionCommon.js";import"@famalabs/web-ui";import"@mui/material/IconButton";import s from"@mui/material/Stack";import"react-hook-form";import"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import"@mui/material/FormControl";import"@mui/material/FormControlLabel";import"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import u from"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import c from"@mui/material/CardContent";import p from"@mui/material/Divider";import{QuestionCompilerForm as f}from"../common/QuestionCompiler.js";const d=t=>{const i=e(25),{question:m,index:d}=t,{formInstance:b,globalConfig:h}=a(),{navigationState:g}=n();if(!m)return null;let y;try{let e;i[0]!==m?(e=m.compute(),i[0]=m,i[1]=e):e=i[1],y=e}catch(e){const o=e;console.error("Error computing ItemFunction value",o),y="Errore nel calcolo"}const x=y;let S;i[2]!==b?(S=e=>{if("string"!=typeof e)return null;try{return b.get(e)}catch(e){const o=e;return console.error("Error getting parameter for ItemFunction:",o),null}},i[2]=b,i[3]=S):S=i[3];const v=S;let C;i[4]===Symbol.for("react.memo_cache_sentinel")?(C={display:"flex",flexDirection:"column",p:3,gap:2},i[4]=C):C=i[4];const j=d;let I,_,F,z,T,k,q,w;return i[5]!==m||i[6]!==j?(I=o(l,{index:j,question:m,required:!1}),i[5]=m,i[6]=j,i[7]=I):I=i[7],i[8]!==x||i[9]!==h.fieldSize?(_=o(u,{disabled:!0,variant:"outlined",value:x,size:h.fieldSize}),i[8]=x,i[9]=h.fieldSize,i[10]=_):_=i[10],i[11]!==I||i[12]!==_?(F=r(s,{children:[I,_]}),i[11]=I,i[12]=_,i[13]=F):F=i[13],i[14]===Symbol.for("react.memo_cache_sentinel")?(z=o(p,{flexItem:!0,sx:{width:"100%"}}),i[14]=z):z=i[14],i[15]===Symbol.for("react.memo_cache_sentinel")?(T={maxHeight:"70vh",flexWrap:"nowrap",overflow:"auto"},i[15]=T):T=i[15],i[16]!==v||i[17]!==g||i[18]!==m?.parameters?(k=m?.parameters.map((e,r)=>{const t=v(e);return t?o(f,{index:g.getItem(t.id)?.globalIndex.toString()||"",question:t,disabled:!0},r):null}),i[16]=v,i[17]=g,i[18]=m?.parameters,i[19]=k):k=i[19],i[20]!==k?(q=o(s,{gap:2,sx:T,children:k}),i[20]=k,i[21]=q):q=i[21],i[22]!==q||i[23]!==F?(w=r(c,{sx:C,children:[F,z,q]}),i[22]=q,i[23]=F,i[24]=w):w=i[24],w},b=n=>{const c=e(32),{question:p,index:f,disabled:b}=n,{formInstance:h,globalConfig:g}=a(),[y,x]=m.useState(!1),[S,v]=m.useState(0);let C;if(p&&h)try{let e;c[0]!==p?(e=p.compute(),c[0]=p,c[1]=e):e=c[1],C=e}catch(_){const e=_;console.error("Error computing ItemFunction value",e),C="Errore nel calcolo"}else C=null;const j=C,I=p?.layout?.precision?p?.layout?.precision:0;let _,F,z,T,k,q,w,E,Q,B,M,A;return c[2]!==S||c[3]!==j||c[4]!==h||c[5]!==I||c[6]!==p?(_=()=>{const e=e=>{if("string"!=typeof e)return null;try{return h.get(e)}catch(e){const o=e;return console.error("Error getting parameter for ItemFunction:",o),null}};if(p&&h){for(const o of p.parameters){if("object"==typeof o)break;const r=e(o);if(r&&void 0===r?.answer&&null!==S){v(null);break}}null==j||isNaN(j)||v(j.toFixed(I))}},F=[S,j,I,p,h],c[2]=S,c[3]=j,c[4]=h,c[5]=I,c[6]=p,c[7]=_,c[8]=F):(_=c[7],F=c[8]),m.useEffect(_,F),p?(c[9]===Symbol.for("react.memo_cache_sentinel")?(z=()=>x(!1),c[9]=z):z=c[9],c[10]!==b||c[11]!==f||c[12]!==p?(T=o(d,{question:p,index:f,disabled:b}),c[10]=b,c[11]=f,c[12]=p,c[13]=T):T=c[13],c[14]!==y||c[15]!==T?(k=o(i,{open:y,onClose:z,minWidth:320,children:T}),c[14]=y,c[15]=T,c[16]=k):k=c[16],c[17]===Symbol.for("react.memo_cache_sentinel")?(q=()=>x(!0),w={"&::after":{content:'""',position:"absolute",inset:0,zIndex:1,pointerEvents:"auto",backgroundColor:"transparent"},"&:hover, &.Mui-focusVisible":{cursor:"pointer"}},c[17]=q,c[18]=w):(q=c[17],w=c[18]),c[19]!==f||c[20]!==p?(E=o(l,{index:f,question:p,required:!1}),c[19]=f,c[20]=p,c[21]=E):E=c[21],c[22]===Symbol.for("react.memo_cache_sentinel")?(Q={input:{readOnly:!0}},c[22]=Q):Q=c[22],c[23]!==S||c[24]!==g.fieldSize?(B=o(u,{variant:"outlined",value:S,size:g.fieldSize,slotProps:Q}),c[23]=S,c[24]=g.fieldSize,c[25]=B):B=c[25],c[26]!==B||c[27]!==E?(M=r(s,{position:"relative",onClick:q,sx:w,children:[E,B]}),c[26]=B,c[27]=E,c[28]=M):M=c[28],c[29]!==M||c[30]!==k?(A=r(t,{children:[k,M]}),c[29]=M,c[30]=k,c[31]=A):A=c[31],A):null};export{b as ItemFunctionCompilerForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as i}from"react/compiler-runtime";import{useFormStateContext as
|
|
1
|
+
import{c as i}from"react/compiler-runtime";import{useFormStateContext as m}from"../../providers/common/FormStateProvider.js";import"react";import{jsx as o}from"react/jsx-runtime";import{useCompilerStateContext as r}from"../../providers/compiler/CompilerStateProvider.js";import{useFormContext as t,useFormState as e,useWatch as a}from"react-hook-form";import"@mui/material/Chip";import"@mui/material/FormLabel";import"@mui/material/IconButton";import"@mui/material/Stack";import"@mui/material/Tooltip";import"@mui/material/Typography";import"lucide-react";import"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import"../../components/common/DrawerCommon.js";import"@mui/material/Grid";import"@mui/material/Card";import"@mui/material/CardContent";import"@mui/material/Modal";import"../../components/common/Skeletons.js";import"isomorphic-dompurify";import"@mui/material/Box";import"@mui/material/Button";import"@mui/material/SvgIcon";import"@famalabs/web-ui";import"@mui/material/FormControl";import"@mui/material/FormControlLabel";import"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import"@mui/material/Select";import{QuestionCheckCommon as l}from"../../components/forms/QuestionCheckCommon.js";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/Checkbox";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";const p=p=>{const n=i(22),{question:u,index:s,disabled:c}=p,{globalConfig:d}=m(),{submitAnswer:b,shouldTriggerValidation:f,locale:C}=r(),{control:T,setValue:j}=t();let w;n[0]!==T?(w={control:T},n[0]=T,n[1]=w):w=n[1];const{errors:h}=e(w),v=`${u?.id}.answer`;let y;n[2]!==T||n[3]!==v?(y={control:T,name:v},n[2]=T,n[3]=v,n[4]=y):y=n[4];const g=a(y);if(!u)return null;let x;n[5]!==u.answer||n[6]!==u.id||n[7]!==j||n[8]!==b?(x=async i=>{i!==u.answer&&(j(`${u.id}.answer`,i),b(u.id,i))},n[5]=u.answer,n[6]=u.id,n[7]=j,n[8]=b,n[9]=x):x=n[9];const B=x,F=(void 0!==h[u.id]||void 0!==h[`${u.id}.answer`]||f)&&!1===g,S=Boolean(u?.options.required);let k;n[10]!==B?(k=i=>B(i),n[10]=B,n[11]=k):k=n[11];const q=Boolean(c),A=Boolean(F),I="small"===d.fieldSize;let L;return n[12]!==g||n[13]!==s||n[14]!==C||n[15]!==u||n[16]!==S||n[17]!==k||n[18]!==q||n[19]!==A||n[20]!==I?(L=o(l,{index:s,value:g,question:u,required:S,handleOnChange:k,disabled:q,error:A,small:I,locale:C}),n[12]=g,n[13]=s,n[14]=C,n[15]=u,n[16]=S,n[17]=k,n[18]=q,n[19]=A,n[20]=I,n[21]=L):L=n[21],L};export{p as QuestionCheckCompilerForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import r from"@mui/material/Box";import o from"@mui/material/CssBaseline";import i from"@mui/material/Drawer";import t from"@mui/material/Fab";import n from"@mui/material/Paper";import{styled as a,alpha as l,useTheme as m}from"@mui/material/styles";import s from"@mui/material/SwipeableDrawer";import p from"@mui/material/useMediaQuery";import{ArrowRight as d}from"lucide-react";import"react";import{useFormStateContext as c}from"../../providers/common/FormStateProvider.js";import{jsx as f,jsxs as h,Fragment as b}from"react/jsx-runtime";const x=a(t)(({theme:e})=>({position:"fixed",bottom:e.spacing(2),left:e.spacing(2),zIndex:e.zIndex.drawer-1,backgroundColor:l(e.palette.grey[800],.3),boxShadow:"none","&:hover":{backgroundColor:l(e.palette.grey[900],.5)}})),u=a("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",padding:e.spacing(0,1),spacing:e.spacing(2),...e.mixins.toolbar})),g=a(i)(()=>({width:420,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",overflowX:"hidden","& .MuiDrawer-paper":{width:420,overflowX:"hidden",background:"none",border:"none"}})),v=i=>{const t=e(18),{sidebar:a,content:l,isOpen:v,onToggleOpen:w}=i,{globalConfig:y}=c(),S=m();let k;t[0]!==S.breakpoints?(k=S.breakpoints.down("sm"),t[0]=S.breakpoints,t[1]=k):k=t[1];const C=p(k);let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent),t[2]=_):_=t[2];const P=_;let D,z,B,M,O,j;return t[3]===Symbol.for("react.memo_cache_sentinel")?(D=f(o,{}),t[3]=D):D=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(z={flexShrink:0},t[4]=z):z=t[4],t[5]!==y||t[6]!==v||t[7]!==C||t[8]!==w||t[9]!==a||t[10]!==S?(B=f(r,{component:"nav",sx:z,children:C?h(b,{children:[!v&&f(x,{color:"inherit","aria-label":"swipe-sidebar-button",onClick:w,size:"medium",children:f(d,{})}),f(s,{disableBackdropTransition:!P,disableDiscovery:P,variant:C?"temporary":"permanent",open:v,onClose:w,onOpen:w,ModalProps:{keepMounted:!0},children:f(r,{sx:{height:"100%"},children:a})})]}):h(g,{variant:"permanent",slotProps:{paper:{sx:{left:`${y.leftSidebarOffset}px !important`}}},children:[y.reseveHeaderSpace&&f(u,{}),f(r,{component:n,sx:{height:"100%",overflow:"hidden",borderRadius:
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/Box";import o from"@mui/material/CssBaseline";import i from"@mui/material/Drawer";import t from"@mui/material/Fab";import n from"@mui/material/Paper";import{styled as a,alpha as l,useTheme as m}from"@mui/material/styles";import s from"@mui/material/SwipeableDrawer";import p from"@mui/material/useMediaQuery";import{ArrowRight as d}from"lucide-react";import"react";import{useFormStateContext as c}from"../../providers/common/FormStateProvider.js";import{jsx as f,jsxs as h,Fragment as b}from"react/jsx-runtime";const x=a(t)(({theme:e})=>({position:"fixed",bottom:e.spacing(2),left:e.spacing(2),zIndex:e.zIndex.drawer-1,backgroundColor:l(e.palette.grey[800],.3),boxShadow:"none","&:hover":{backgroundColor:l(e.palette.grey[900],.5)}})),u=a("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",padding:e.spacing(0,1),spacing:e.spacing(2),...e.mixins.toolbar})),g=a(i)(()=>({width:420,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",overflowX:"hidden","& .MuiDrawer-paper":{width:420,overflowX:"hidden",background:"none",border:"none"}})),v=i=>{const t=e(18),{sidebar:a,content:l,isOpen:v,onToggleOpen:w}=i,{globalConfig:y}=c(),S=m();let k;t[0]!==S.breakpoints?(k=S.breakpoints.down("sm"),t[0]=S.breakpoints,t[1]=k):k=t[1];const C=p(k);let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent),t[2]=_):_=t[2];const P=_;let D,z,B,M,O,j;return t[3]===Symbol.for("react.memo_cache_sentinel")?(D=f(o,{}),t[3]=D):D=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(z={flexShrink:0},t[4]=z):z=t[4],t[5]!==y||t[6]!==v||t[7]!==C||t[8]!==w||t[9]!==a||t[10]!==S?(B=f(r,{component:"nav",sx:z,children:C?h(b,{children:[!v&&f(x,{color:"inherit","aria-label":"swipe-sidebar-button",onClick:w,size:"medium",children:f(d,{})}),f(s,{disableBackdropTransition:!P,disableDiscovery:P,variant:C?"temporary":"permanent",open:v,onClose:w,onOpen:w,ModalProps:{keepMounted:!0},children:f(r,{sx:{height:"100%"},children:a})})]}):h(g,{variant:"permanent",slotProps:{paper:{sx:{left:`${y.leftSidebarOffset}px !important`}}},children:[y.reseveHeaderSpace&&f(u,{}),f(r,{component:n,sx:{height:"100%",overflow:"hidden",borderRadius:3,margin:S.spacing(2),border:"1px solid",borderColor:S.palette.divider,display:"flex",flexDirection:"column"},children:f(r,{sx:{py:3,px:1,minHeight:0,flex:1,overflowY:"auto",scrollBehavior:"smooth",scrollbarColor:"silver transparent",scrollbarWidth:"thin"},children:a})})]})}),t[5]=y,t[6]=v,t[7]=C,t[8]=w,t[9]=a,t[10]=S,t[11]=B):B=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(M={flexGrow:1,height:"100%"},t[12]=M):M=t[12],t[13]!==l?(O=f(r,{component:"main",className:"crf-main",sx:M,children:l}),t[13]=l,t[14]=O):O=t[14],t[15]!==B||t[16]!==O?(j=h(r,{display:"flex",width:"100%",children:[D,B,O]}),t[15]=B,t[16]=O,t[17]=j):j=t[17],j};export{v as DrawerCommon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"react/compiler-runtime";import t from"@mui/material/Card";import
|
|
1
|
+
import{c as o}from"react/compiler-runtime";import t from"@mui/material/Card";import r from"@mui/material/CardContent";import e from"@mui/material/Modal";import{jsx as i}from"react/jsx-runtime";function n(n){const m=o(25),{children:l,open:d,onClose:h,minWidth:s,width:p,maxWidth:c,minHeight:u,maxHeight:f,height:v,overflowY:x}=n,b=void 0===p?"40svw":p,g=void 0===c?"720px":c,w=void 0===u?"25svh":u,C=void 0===f?"80svh":f,H=void 0===v?"auto":v,W=void 0===x?"auto":x;let _,k,y,M,S,P,Y,j;return m[0]!==h?(_=o=>{o.stopPropagation(),h()},m[0]=h,m[1]=_):_=m[1],m[2]===Symbol.for("react.memo_cache_sentinel")?(k={".MuiModal-backdrop":{backdropFilter:"saturate(180%) blur(5px)"}},m[2]=k):k=m[2],m[3]!==H||m[4]!==C||m[5]!==g||m[6]!==w||m[7]!==s||m[8]!==b?(y={minWidth:s,maxWidth:g,width:b,minHeight:w,maxHeight:C,height:H},m[3]=H,m[4]=C,m[5]=g,m[6]=w,m[7]=s,m[8]=b,m[9]=y):y=m[9],m[10]===Symbol.for("react.memo_cache_sentinel")?(M={borderRadius:3,pb:0,zIndex:1e3,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)","&:hover":{boxShadow:"none",border:"none"},overflow:"hidden"},m[10]=M):M=m[10],m[11]!==H||m[12]!==C||m[13]!==W?(S={p:0,scrollbarWidth:"thin",scrollbarColor:"silver transparent",overflowY:W,maxHeight:C,height:H},m[11]=H,m[12]=C,m[13]=W,m[14]=S):S=m[14],m[15]!==l||m[16]!==S?(P=i(r,{sx:S,children:l}),m[15]=l,m[16]=S,m[17]=P):P=m[17],m[18]!==P||m[19]!==y?(Y=i(t,{onClick:a,style:y,sx:M,children:P}),m[18]=P,m[19]=y,m[20]=Y):Y=m[20],m[21]!==d||m[22]!==Y||m[23]!==_?(j=i(e,{open:d,onClose:_,sx:k,children:Y}),m[21]=d,m[22]=Y,m[23]=_,m[24]=j):j=m[24],j}function a(o){return o.stopPropagation()}export{n as ModalCommon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"react/compiler-runtime";import e from"@mui/material/Box";import r from"@mui/material/Drawer";import t from"@mui/material/Grid";import i from"@mui/material/IconButton";import n from"@mui/material/Paper";import
|
|
1
|
+
import{c as o}from"react/compiler-runtime";import e from"@mui/material/Box";import r from"@mui/material/Drawer";import t from"@mui/material/Grid";import i from"@mui/material/IconButton";import n from"@mui/material/Paper";import c from"@mui/material/Typography";import a from"@mui/material/useMediaQuery";import{X as l}from"lucide-react";import"react";import{jsx as m,jsxs as d,Fragment as p}from"react/jsx-runtime";const s=s=>{const h=o(56),{children:x,useToolbar:u,toolbarHeight:f,zIndex:b,header:k,footer:g,onClose:w,mainComponentProps:y,paperProps:C,title:v,onSubmit:z,isForm:I}=s,S=void 0===f?53:f,_=void 0===b?2e3:b,P=void 0!==I&&I,W=a("(max-width: 600px)"),j=`calc(100dvh - 8px - ${u?S+24:24}px)`,B=`calc(8px + ${u?S+8:8}px)`;let G,D,F,M,R;h[0]!==v?(G=m(t,{children:m(c,{fontSize:20,color:"text.secondary",children:v})}),h[0]=v,h[1]=G):G=h[1],h[2]!==w?(D=o=>w?.(o,"backdropClick"),h[2]=w,h[3]=D):D=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(F=m(l,{size:22}),h[4]=F):F=h[4],h[5]!==D?(M=m(t,{children:m(i,{disableRipple:!0,onClick:D,children:F})}),h[5]=D,h[6]=M):M=h[6],h[7]!==G||h[8]!==M?(R=d(t,{container:!0,size:12,justifyContent:"space-between",alignItems:"center",p:2,children:[G,M]}),h[7]=G,h[8]=M,h[9]=R):R=h[9];const T=R,$=P?"form":"div",H=P?z:void 0,Q=W?0:"16px",X=W?0:B,Y=W?"100%":j,q=W?0:void 0,A=W?0:void 0,E=C?.sx;let J;h[10]!==Q||h[11]!==X||h[12]!==Y||h[13]!==q||h[14]!==A||h[15]!==E?(J={paper:{sx:{borderRadius:3,mx:Q,my:X,height:Y,scrollbarWidth:"thin",maxWidth:"100%",left:q,right:A,...E}}},h[10]=Q,h[11]=X,h[12]=Y,h[13]=q,h[14]=A,h[15]=E,h[16]=J):J=h[16];const K="bottom"===s.anchor?"saturate(100%) blur(4px) !important":"saturate(100%) !important";let L,N,O,U;h[17]!==K?(L={backdropFilter:K},h[17]=K,h[18]=L):L=h[18],h[19]!==L||h[20]!==_?(N={zIndex:_,"& .MuiBackdrop-root":L},h[19]=L,h[20]=_,h[21]=N):N=h[21],h[22]===Symbol.for("react.memo_cache_sentinel")?(O={display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden"},h[22]=O):O=h[22],h[23]!==T||h[24]!==k||h[25]!==s.anchor?(U="bottom"!==s.anchor&&m(e,{component:"header",sx:{backgroundColor:"background.paper",position:"sticky",top:0,width:"100%",zIndex:1},children:k&&"string"!=typeof k?k:T}),h[23]=T,h[24]=k,h[25]=s.anchor,h[26]=U):U=h[26];const V=y?.sx;let Z,oo,eo,ro,to,io,no,co;return h[27]!==V?(Z={width:"100%",backgroundColor:"background.paper",flexGrow:1,overflowY:"auto",overflowX:"hidden",scrollbarWidth:"thin",scrollbarColor:"silver transparent",...V},h[27]=V,h[28]=Z):Z=h[28],h[29]!==x||h[30]!==y||h[31]!==Z?(oo=m(e,{...y,component:"main",sx:Z,children:x}),h[29]=x,h[30]=y,h[31]=Z,h[32]=oo):oo=h[32],h[33]===Symbol.for("react.memo_cache_sentinel")?(eo={backgroundColor:"background.paper",position:"sticky",bottom:0,width:"100%",zIndex:1},h[33]=eo):eo=h[33],h[34]!==g?(ro=m(e,{component:"footer",sx:eo,children:g}),h[34]=g,h[35]=ro):ro=h[35],h[36]!==U||h[37]!==oo||h[38]!==ro?(to=d(e,{component:n,sx:O,children:[U,oo,ro]}),h[36]=U,h[37]=oo,h[38]=ro,h[39]=to):to=h[39],h[40]!==s||h[41]!==J||h[42]!==N||h[43]!==to||h[44]!==$||h[45]!==H?(io=m(r,{component:$,onSubmit:H,slotProps:J,...s,sx:N,children:to}),h[40]=s,h[41]=J,h[42]=N,h[43]=to,h[44]=$,h[45]=H,h[46]=io):io=h[46],h[47]!==k||h[48]!==w||h[49]!==s.anchor||h[50]!==s.open||h[51]!==v?(no="bottom"===s.anchor&&s.open&&d(t,{container:!0,size:12,justifyContent:"space-between",alignItems:"center",p:2,width:"100%",sx:{position:"fixed",top:0,right:0,zIndex:2001},children:[m(t,{children:m(e,{component:"header",sx:{backgroundColor:"transparent",position:"sticky",top:0,width:"100%",zIndex:2001},children:k??m(c,{fontSize:22,fontWeight:"light bold",color:"white",children:v})})}),m(t,{children:m(i,{title:"Chiudi",onClick:o=>w?.(o,"backdropClick"),children:m(l,{size:24,color:"white"})})})]}),h[47]=k,h[48]=w,h[49]=s.anchor,h[50]=s.open,h[51]=v,h[52]=no):no=h[52],h[53]!==io||h[54]!==no?(co=d(p,{children:[io,no]}),h[53]=io,h[54]=no,h[55]=co):co=h[55],co};export{s as ResponsiveDrawer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"react/compiler-runtime";import r from"@mui/material/Checkbox";import t from"@mui/material/FormControlLabel";import e from"@mui/material/Stack";import i from"@mui/material/Switch";import{QuestionCheckMap as l}from"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import{QuestionHeaderCommon as a}from"./QuestionCommon.js";import{jsx as m,jsxs as n}from"react/jsx-runtime";function s(s){const c=o(45),{index:u,value:d,question:p,handleOnChange:h,required:y,small:f,disabled:b,error:g,showValidity:k}=s,x=void 0!==f&&f,C=Boolean(d),v=p.layout?.style?p.layout.style:l.layout.style.check,w=p.layout?.trueLabel,j=p.layout?.falseLabel,q=g?"error.main":"inherit";let
|
|
1
|
+
import{c as o}from"react/compiler-runtime";import r from"@mui/material/Checkbox";import t from"@mui/material/FormControlLabel";import e from"@mui/material/Stack";import i from"@mui/material/Switch";import{QuestionCheckMap as l}from"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import{QuestionHeaderCommon as a}from"./QuestionCommon.js";import{jsx as m,jsxs as n}from"react/jsx-runtime";function s(s){const c=o(45),{index:u,value:d,question:p,handleOnChange:h,required:y,small:f,disabled:b,error:g,showValidity:k}=s,x=void 0!==f&&f,C=Boolean(d),v=p.layout?.style?p.layout.style:l.layout.style.check,w=p.layout?.trueLabel,j=p.layout?.falseLabel,q=C?w:j,S=g?"error.main":"inherit";let L;c[0]!==S?(L={typography:{color:S}},c[0]=S,c[1]=L):L=c[1];const P=x?"small":"medium";let z;c[2]!==h?(z=(o,r)=>h?.(r),c[2]=h,c[3]=z):z=c[3];const M=g?"error.main":void 0;let V;c[4]!==M?(V={color:M},c[4]=M,c[5]=V):V=c[5];const B=g?"error.main":void 0;let F,O,Q,A;c[6]!==B?(F={backgroundColor:B},c[6]=B,c[7]=F):F=c[7],c[8]!==F||c[9]!==V?(O={"& .MuiSwitch-colorPrimary":V,"& .MuiSwitch-track":F},c[8]=F,c[9]=V,c[10]=O):O=c[10],c[11]!==O||c[12]!==P||c[13]!==z?(Q=m(i,{size:P,onChange:z,sx:O}),c[11]=O,c[12]=P,c[13]=z,c[14]=Q):Q=c[14],c[15]!==b||c[16]!==C||c[17]!==Q||c[18]!==q||c[19]!==L?(A=m(t,{label:q,checked:C,disabled:b,slotProps:L,control:Q}),c[15]=b,c[16]=C,c[17]=Q,c[18]=q,c[19]=L,c[20]=A):A=c[20];const D=A,E=g?"error.main":"inherit";let G;c[21]!==E?(G={typography:{color:E}},c[21]=E,c[22]=G):G=c[22];const H=x?"small":"medium";let I;c[23]!==h?(I=(o,r)=>h?.(r),c[23]=h,c[24]=I):I=c[24];const J=g?"error.main":void 0;let K,N;c[25]!==J?(K={color:J},c[25]=J,c[26]=K):K=c[26],c[27]!==C||c[28]!==H||c[29]!==I||c[30]!==K?(N=m(r,{size:H,checked:C,onChange:I,sx:K}),c[27]=C,c[28]=H,c[29]=I,c[30]=K,c[31]=N):N=c[31];const R=C?w:j;let T;c[32]!==b||c[33]!==G||c[34]!==N||c[35]!==R?(T=m(t,{disabled:b,slotProps:G,control:N,label:R}),c[32]=b,c[33]=G,c[34]=N,c[35]=R,c[36]=T):T=c[36];const U=T;let W;c[37]!==u||c[38]!==p||c[39]!==y||c[40]!==k?(W=m(a,{index:u,question:p,required:y,showValidity:k}),c[37]=u,c[38]=p,c[39]=y,c[40]=k,c[41]=W):W=c[41];const X=v===l.layout.style.switch?D:U;let Y;return c[42]!==W||c[43]!==X?(Y=n(e,{spacing:1,children:[W,X]}),c[42]=W,c[43]=X,c[44]=Y):Y=c[44],Y}export{s as QuestionCheckCommon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import t,{createFilterOptions as o}from"@mui/material/Autocomplete";import i from"@mui/material/Chip";import n from"@mui/material/FormControl";import r from"@mui/material/TextField";import
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t,{createFilterOptions as o}from"@mui/material/Autocomplete";import i from"@mui/material/Chip";import n from"@mui/material/FormControl";import r from"@mui/material/TextField";import a from"@mui/material/Typography";import{useState as l,startTransition as m,createElement as s}from"react";import{QuestionHeaderCommon as u}from"./QuestionCommon.js";import{jsx as c,jsxs as p,Fragment as d}from"react/jsx-runtime";const f=o({matchFrom:"any",limit:100,trim:!0,ignoreCase:!0,ignoreAccents:!0});function h(o){const h=e(35),{index:v,question:b,value:z,handleOnBlur:C,required:_,disabled:A,sourceMap:O,mode:S,small:V,showValidity:q}=o,w=void 0===S?"static":S,T=void 0!==V&&V;let F;h[0]===Symbol.for("react.memo_cache_sentinel")?(F=[],h[0]=F):F=h[0];const[I,M]=l(F),[j,L]=l(""),Q=O instanceof Map&&0===O.size;let k;h[1]!==O?(k=O instanceof Map&&O.size>0?Array.from(O.values()):[],h[1]=O,h[2]=k):k=h[2];const B=k,[E,N]=l(!1);if(!E&&z&&z?.length>0){const e=O&&z.length>0?z.map(e=>O.get(e)).filter(y):z??[];M(e),N(!0)}let R;h[3]!==C||h[4]!==w||h[5]!==O?(R=(e,t)=>{const o="string"==typeof t?[t]:t;if(!o)return console.warn("QuestionListCommon: actualValue is null or undefined"),M([]),void C?.([]);"dynamic"===w?(M(o),C?.(o)):(M(o),m(()=>{const e=O?o.map(e=>{for(const[t,o]of O.entries())if(o===e)return t;return null}).filter(g):[];C?.(e)}))},h[3]=C,h[4]=w,h[5]=O,h[6]=R):R=h[6];const W=R;let $,D;h[7]!==v||h[8]!==b||h[9]!==_||h[10]!==q?($=c(u,{index:v,question:b,required:_,showValidity:q}),h[7]=v,h[8]=b,h[9]=_,h[10]=q,h[11]=$):$=h[11],h[12]===Symbol.for("react.memo_cache_sentinel")?(D={width:"100%"},h[12]=D):D=h[12];const G=1!==b.options?.max,H=1!==b.options?.max;let J;h[13]===Symbol.for("react.memo_cache_sentinel")?(J=(e,t)=>L(t),h[13]=J):J=h[13];const K=j.trim()?"Nessun risultato trovato":"Inizia a digitare per cercare",P=A||Q,U=T?"small":"medium";let X,Y,Z,ee;return h[14]!==I?.length||h[15]!==Q||h[16]!==b.options?.max?(X=e=>c(r,{...e,placeholder:Q?"Errore di configurazione":I?.length?void 0:"Ricerca e seleziona "+(1===b.options?.max?"un elemento":"uno o più elementi"),helperText:b.options?.max&&I?.length>b.options?.max?`Selezionare al massimo ${b.options?.max} elementi.`:""}),h[14]=I?.length,h[15]=Q,h[16]=b.options?.max,h[17]=X):X=h[17],h[18]!==b.options?.max?(Y=(e,t)=>1===b.options?.max?"string"==typeof e[0]&&c(a,{sx:{pl:1},children:e[0].trim()}):Array.isArray(e)&&e.map((e,o)=>s(i,{...t({index:o}),key:e??o,label:e,size:"small",variant:"outlined"})),h[18]=b.options?.max,h[19]=Y):Y=h[19],h[20]!==I||h[21]!==W||h[22]!==j||h[23]!==B||h[24]!==K||h[25]!==P||h[26]!==U||h[27]!==X||h[28]!==Y||h[29]!==G||h[30]!==H?(Z=c(n,{fullWidth:!0,sx:D,children:c(t,{multiple:G,disableCloseOnSelect:H,value:I,inputValue:j,onInputChange:J,onChange:W,options:B,filterOptions:f,noOptionsText:K,getOptionLabel:x,disabled:P,size:U,renderInput:X,renderValue:Y})}),h[20]=I,h[21]=W,h[22]=j,h[23]=B,h[24]=K,h[25]=P,h[26]=U,h[27]=X,h[28]=Y,h[29]=G,h[30]=H,h[31]=Z):Z=h[31],h[32]!==Z||h[33]!==$?(ee=p(d,{children:[$,Z]}),h[32]=Z,h[33]=$,h[34]=ee):ee=h[34],ee}function x(e){return"string"==typeof e?e:e[0]||""}function g(e){return null!==e}function y(e){return null!=e}export{h as QuestionListCommon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import t from"@mui/material/Typography";import o from"@mui/material/Grid";import{jsxs as i,jsx as r,Fragment as n}from"react/jsx-runtime";import{ModalCommon as l}from"../../components/common/ModalCommon.js";import"../../components/common/Skeletons.js";import a from"react";import{useFormStateContext as m}from"../../providers/common/FormStateProvider.js";import{useEditorStateContext as c}from"../../providers/editor/EditorStateProvider.js";import{useIsQuestionNew as s}from"../../providers/editor/QuestionEditProvider.js";import"isomorphic-dompurify";import d from"@mui/material/Box";import p from"@mui/material/Button";import{PlusCircle as u,FilePlus2 as h,Pencil as f,MoveIcon as y,Copy as v,Trash2 as g,CircleHelp as b,EllipsisVertical as x,EyeIcon as C,Trash as S}from"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import z from"@mui/material/IconButton";import k from"@mui/material/Stack";import _ from"@mui/material/Tooltip";import{Mapper as w,getMapType as I}from"../../utils/config-map.js";import{getLocale as O,LocaleMap as T,getLocaleItemTypeId as j}from"../../utils/locale.js";import"@famalabs/survey";import"acorn";import{RichTextEditor as P}from"@famalabs/web-ui";import"react-hook-form";import B from"@mui/material/FormControl";import"@mui/material/FormControlLabel";import A from"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import Q from"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import L from"@mui/material/ListItem";import F from"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import{useTheme as E}from"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import{useQuestionStateContext as M}from"../../providers/editor/QuestionStateProvider.js";import W from"@mui/material/CardContent";import D from"@mui/material/InputLabel";import $ from"@mui/material/List";import q from"@mui/material/ListItemButton";import G from"@mui/material/ListItemIcon";import N from"@mui/material/ListItemText";import R from"@mui/material/ListSubheader";import V from"@mui/material/Popover";import{OptionTextField as H}from"./OptionsEditor.js";import{ScoreSelectModal as K}from"./ScoreSelectModal.js";const U=[w.landing.type,w.page.type,w.cond.type,w.section.type,w.folder.type,w.check.type,w.time.type,w.score.type,w.fn.type,w.alert.type];function J(t){const n=e(51),{item:l,readonlyMode:a}=t,d=void 0!==a&&a,{globalConfig:p}=m(),{editorState:u,editorConfig:h}=c();let f;n[0]!==l?(f=I(l),n[0]=l,n[1]=f):f=n[1];const y=f,v=h.availableQuestions,g=M(),b=s(l.id);let x;n[2]!==g?(x=g.getQuestionValue("text"),n[2]=g,n[3]=x):x=n[3];const C=x;let S;n[4]!==g?(S=g.getQuestionValue("description"),n[4]=g,n[5]=S):S=n[5];const z=S;let k;n[6]!==C||n[7]!==g?(k=e=>{e!==C&&g.updateItem("text",e)},n[6]=C,n[7]=g,n[8]=k):k=n[8];const _=k;let j;n[9]!==z||n[10]!==g?(j=e=>{e!==z&&g.updateItem("description",e)},n[9]=z,n[10]=g,n[11]=j):j=n[11];const A=j;let L;n[12]!==u||n[13]!==l?(L=async e=>{await u.changeQuestionType(l,e.target.value)||console.error("Error changing question type: new item has no id")},n[12]=u,n[13]=l,n[14]=L):L=n[14];const F=L;let E;n[15]!==C||n[16]!==g?(E=e=>{const t="${"+e+"}",o=C?`${C}${t}`:t;g.updateItem("text",o)},n[15]=C,n[16]=g,n[17]=E):E=n[17];const W=E,$=p.VariableSelector;let q;n[18]!==$||n[19]!==W?(q=$&&r($,{mode:"variable",buttonProps:{variant:"text",color:"primary",isIconButton:!0},onConfirm:e=>W(e.templateKey),environment:"education"}),n[18]=$,n[19]=W,n[20]=q):q=n[20];const G=q;let N;n[21]===Symbol.for("react.memo_cache_sentinel")?(N={p:1,backgroundColor:"background.default"},n[21]=N):N=n[21];const R=y===w.section.type?12:6;let V;n[22]===Symbol.for("react.memo_cache_sentinel")?(V={justifyContent:"flex-end",alignItems:"flex-end",p:1},n[22]=V):V=n[22];const K=b&&!C;let J;n[23]===Symbol.for("react.memo_cache_sentinel")?(J=w.section.type.toString(),n[23]=J):J=n[23];const Y=y!==J;let Z,ee,te,oe,ie,re,ne,le;return n[24]===Symbol.for("react.memo_cache_sentinel")?(Z=O(T.general.title),n[24]=Z):Z=n[24],n[25]!==G||n[26]!==C||n[27]!==_||n[28]!==d||n[29]!==K||n[30]!==Y?(ee=r(H,{label:"Titolo",className:"titleEditor",autoFocus:K,fullWidth:!0,required:Y,text:Z,value:C,handleOnChange:_,disabled:d,endAdornment:G}),n[25]=G,n[26]=C,n[27]=_,n[28]=d,n[29]=K,n[30]=Y,n[31]=ee):ee=n[31],n[32]!==R||n[33]!==ee?(te=r(o,{container:!0,size:R,sx:V,children:ee}),n[32]=R,n[33]=ee,n[34]=te):te=n[34],n[35]===Symbol.for("react.memo_cache_sentinel")?(oe={justifyContent:"flex-end",alignItems:"flex-end",p:1},n[35]=oe):oe=n[35],n[36]!==v||n[37]!==F||n[38]!==y||n[39]!==d?(ie=![w.section.type.toString(),w.cond.type.toString()].includes(y)&&i(B,{fullWidth:!0,children:[r(D,{id:"formType-label",children:"Tipologia"}),r(Q,{labelId:"formType-label",label:"Tipologia",value:y,onChange:F,disabled:d,children:Object.keys(w).filter(e=>e===y||!U.includes(e)&&(!v||Boolean(v[e]))).map(X)})]}),n[36]=v,n[37]=F,n[38]=y,n[39]=d,n[40]=ie):ie=n[40],n[41]!==ie?(re=r(o,{container:!0,size:6,sx:oe,children:ie}),n[41]=ie,n[42]=re):re=n[42],n[43]!==z||n[44]!==A||n[45]!==d?(ne=r(o,{container:!0,size:12,p:1,children:r(P,{placeholder:"Aggiungi una descrizione",value:z,onBlur:A,trailingBlock:!0,backgroundPreset:"default",toolbar:"static",disabled:d})}),n[43]=z,n[44]=A,n[45]=d,n[46]=ne):ne=n[46],n[47]!==te||n[48]!==re||n[49]!==ne?(le=i(o,{container:!0,sx:N,children:[te,re,ne]}),n[47]=te,n[48]=re,n[49]=ne,n[50]=le):le=n[50],le}function X(e){return r(A,{value:e,children:i(d,{component:"div",sx:{display:"flex"},children:[w[e].icon,r(t,{sx:{ml:2},children:j(e)})]})},e)}function Y(o){const i=e(23),{value:n,handleOnSave:l,handleOnChange:m,variant:c,fullWidth:s,fontSize:d,autoFocus:p,readOnly:u,size:h}=o,f=void 0===c?"body1":c,y=void 0!==s&&s,v=void 0!==p&&p,g=void 0!==u&&u,b=void 0===h?"medium":h,[x,C]=a.useState(v);if(x&&!g){let e,t,o,a,c;return i[0]!==m?(e=e=>m?.(e),i[0]=m,i[1]=e):e=i[1],i[2]!==l?(t=e=>{C(!1),l&&l(e)},o=e=>{"Enter"===e.key&&(e.preventDefault(),C(!1),l&&l(e))},i[2]=l,i[3]=t,i[4]=o):(t=i[3],o=i[4]),i[5]!==y||i[6]!==b||i[7]!==e||i[8]!==t||i[9]!==o||i[10]!==n?(a=r(k,{direction:"row",spacing:2,children:r(F,{defaultValue:n,onChange:e,onBlur:t,onKeyDown:o,autoFocus:!0,fullWidth:y,onClick:Z,size:b})}),i[5]=y,i[6]=b,i[7]=e,i[8]=t,i[9]=o,i[10]=n,i[11]=a):a=i[11],i[12]!==y||i[13]!==a?(c=r(B,{fullWidth:y,children:a}),i[12]=y,i[13]=a,i[14]=c):c=i[14],c}{let e,o;i[15]===Symbol.for("react.memo_cache_sentinel")?(e={width:"100%",justifyContent:"flex-start"},o=e=>{e.stopPropagation(),C(!0)},i[15]=e,i[16]=o):(e=i[15],o=i[16]);const l=f;let a,m;return i[17]!==d?(a={fontSize:d,textOverflow:"ellipsis",margin:"auto 0",verticalAlign:"middle"},i[17]=d,i[18]=a):a=i[18],i[19]!==l||i[20]!==a||i[21]!==n?(m=r(k,{sx:e,onClick:o,children:r(t,{variant:l,sx:a,children:n})}),i[19]=l,i[20]=a,i[21]=n,i[22]=m):m=i[22],m}}function Z(e){return e.stopPropagation()}const ee=t=>{const o=e(31),{button:l,options:m,handleOnChoose:c}=t,s=void 0===c?void 0:c,[d,p]=a.useState(null),u=Boolean(d);let h;o[0]===Symbol.for("react.memo_cache_sentinel")?(h=e=>{e.preventDefault(),e.stopPropagation(),p(e.currentTarget)},o[0]=h):h=o[0];const f=h;let y;o[1]!==s?(y=(e,t)=>{e.preventDefault(),e.stopPropagation(),p(null),void 0!==t&&void 0!==s&&s(t)},o[1]=s,o[2]=y):y=o[2];const v=y,g=l?.size??"small",b=u?"long-menu":void 0,C=u?"true":void 0,S=l?.color??"default";let k,_,w,I,O,T,j,P,B,A;if(o[3]!==l?.icon?(k=l?.icon??r(x,{size:18}),o[3]=l?.icon,o[4]=k):k=o[4],o[5]!==g||o[6]!==b||o[7]!==C||o[8]!==S||o[9]!==k?(_=r(z,{"aria-label":"ellipsis-more",size:g,id:"more-icon-button","aria-controls":b,"aria-expanded":C,"aria-haspopup":"true",onClick:f,color:S,children:k}),o[5]=g,o[6]=b,o[7]=C,o[8]=S,o[9]=k,o[10]=_):_=o[10],o[11]!==v?(w=e=>v(e,void 0),o[11]=v,o[12]=w):w=o[12],o[13]===Symbol.for("react.memo_cache_sentinel")?(I={vertical:"top",horizontal:"right"},O={vertical:"top",horizontal:"left"},o[13]=I,o[14]=O):(I=o[13],O=o[14]),o[15]===Symbol.for("react.memo_cache_sentinel")?(T={padding:0},o[15]=T):T=o[15],o[16]!==v||o[17]!==m){let e;o[19]!==v?(e=e=>e&&i(q,{onClick:t=>{v(t,e.key),void 0!==e.onChoose&&e.onChoose(e.key)},children:[e.icon&&i(G,{children:[" ",e.icon," "]}),r(N,{primary:e.text,slotProps:{primary:{color:e.textColor??"textPrimary"}}})]},e.key),o[19]=v,o[20]=e):e=o[20],j=m.map(e),o[16]=v,o[17]=m,o[18]=j}else j=o[18];return o[21]!==j?(P=r($,{dense:!0,sx:T,children:j}),o[21]=j,o[22]=P):P=o[22],o[23]!==d||o[24]!==u||o[25]!==w||o[26]!==P?(B=r(V,{id:"long-menu",anchorEl:d,open:u,onClose:w,anchorOrigin:I,transformOrigin:O,children:P}),o[23]=d,o[24]=u,o[25]=w,o[26]=P,o[27]=B):B=o[27],o[28]!==B||o[29]!==_?(A=i(n,{children:[_,B]}),o[28]=B,o[29]=_,o[30]=A):A=o[30],A};function te(t){const o=e(20),{handleOnEdit:i,handleOnMove:n,handleOnDuplicate:l,handleOnRemove:a,handleOnAddPage:m}=t,c=E();let s,d,p,u,b,x,C,S;return o[0]!==m?(s=m&&{key:"add",text:O(T.hover.addPage),icon:r(h,{size:20}),onChoose:m},o[0]=m,o[1]=s):s=o[1],o[2]!==i?(d=i&&{key:"edit",text:O(T.hover.rename),icon:r(f,{size:20}),onChoose:i},o[2]=i,o[3]=d):d=o[3],o[4]!==n?(p=n&&{key:"move",text:O(T.hover.move),icon:r(y,{size:20}),onChoose:n},o[4]=n,o[5]=p):p=o[5],o[6]!==l?(u=l&&{key:"duplicate",text:O(T.hover.duplicate),icon:r(v,{size:20}),onChoose:l},o[6]=l,o[7]=u):u=o[7],o[8]===Symbol.for("react.memo_cache_sentinel")?(b=O(T.hover.remove),o[8]=b):b=o[8],o[9]!==c.palette.error.main?(x=r(g,{size:20,style:{color:c.palette.error.main}}),o[9]=c.palette.error.main,o[10]=x):x=o[10],o[11]!==a||o[12]!==x?(C={key:"remove",text:b,textColor:"error",icon:x,onChoose:a},o[11]=a,o[12]=x,o[13]=C):C=o[13],o[14]!==s||o[15]!==d||o[16]!==p||o[17]!==u||o[18]!==C?(S=r(ee,{options:[s,d,p,u,C].filter(oe)}),o[14]=s,o[15]=d,o[16]=p,o[17]=u,o[18]=C,o[19]=S):S=o[19],S}function oe(e){return Boolean(e)}function ie(s){const h=e(87),{mode:f,isOpen:y,setIsOpen:v,handleAddQuestion:g,nextQuestionIndex:x,excludeKeys:C,parent:S}=s,k=void 0===f?"default":f,I=void 0!==y&&y;let O;h[0]!==C?(O=void 0===C?[]:C,h[0]=C,h[1]=O):O=h[1];const T=O,{formInstance:P,globalConfig:B}=m(),{editorConfig:A}=c(),[Q,F]=a.useState(!1),E=B.readonlyMode,M=A?.availableQuestions;let D;h[2]!==M?(D=e=>!M||Boolean(M[e]),h[2]=M,h[3]=D):D=h[3];const G=D,V="default"===k?Q:I;let H;h[4]!==k||h[5]!==v?(H=()=>{"default"===k?F(!1):v?.(!1)},h[4]=k,h[5]=v,h[6]=H):H=h[6];const U=H,[J,X]=a.useState(!1);let Y;h[7]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>X(!1),h[7]=Y):Y=h[7];const Z=Y;let ee;h[8]!==g||h[9]!==U||h[10]!==E?(ee=async(e,t)=>{if(!E){if(e.stopPropagation(),t===w.score.type)return U(),void X(!0);await g(t),U()}},h[8]=g,h[9]=U,h[10]=E,h[11]=ee):ee=h[11];const te=ee,oe="user"===B.questionIndex?"visible"===(P?.root?.layout?.questionIndex??"visible"):"visible"===B.questionIndex,ie="single"===B.pagination?"campo":"domanda",re="single"===B.pagination?"Nuovo campo":"Nuova domanda",ne=oe?x:"";let le;h[12]!==te?(le=(e,t)=>e&&0!==e.length?r($,{dense:!0,subheader:r(R,{component:"div",id:"nested-list-subheader",children:t}),children:e.map((e,t)=>{const o=w[e];return e in w?r(L,{disablePadding:!0,secondaryAction:"hint"in o&&o.hint&&r(_,{title:o.hint,arrow:!0,children:r(z,{"aria-label":"hint",size:"small",children:r(b,{size:12})})}),children:i(q,{onClick:async t=>await te(t,e),children:[w[e].icon,r(N,{primary:j(e),sx:{ml:1,fontSize:12}})]},"title"+t)},e):null})}):null,h[12]=te,h[13]=le):le=h[13];const ae=le;let me,ce,se,de,pe,ue,he,fe,ye,ve,ge,be,xe,Ce,Se,ze,ke,_e,we,Ie,Oe,Te,je;if(h[14]!==ae||h[15]!==T||h[16]!==U||h[17]!==G||h[18]!==oe||h[19]!==k||h[20]!==re||h[21]!==x||h[22]!==V||h[23]!==S?.items||h[24]!==ne||h[25]!==ie){const e=[w.select.type,w.number.type,w.text.type].filter(e=>G(e)).filter(e=>!T.includes(e)),n=[w.text.type,w.textArea.type,w.date.type,w.time.type].filter(e=>G(e)).filter(e=>!T.includes(e)),a=[w.number.type,w.range.type,w.rating.type,w.switch.type].filter(e=>G(e)).filter(e=>!T.includes(e)),m=[w.select.type,w.dropdown.type,w.multipleSelect.type,w.autocomplete.type,w.selectTable.type,w.sourceList.type].filter(e=>G(e)).filter(e=>!T.includes(e)),c=[w.section.type,w.fileUpload.type,w.alert.type,w.fn.type,w.score.type].filter(e=>G(e)).filter(e=>!T.includes(e));h[42]!==oe||h[43]!==k||h[44]!==re||h[45]!==x||h[46]!==S?.items||h[47]!==ne||h[48]!==ie?(ze="default"===k&&i(p,{fullWidth:!1,color:"inherit",onClick:()=>F(!0),"aria-label":"add-question-button",children:[r(u,{size:20}),r(t,{sx:{pl:1},children:x?`Aggiungi ${ie} ${oe?x:""}`:S?.items.length?`Aggiungi ${ie} ${ne}`:re})]}),h[42]=oe,h[43]=k,h[44]=re,h[45]=x,h[46]=S?.items,h[47]=ne,h[48]=ie,h[49]=ze):ze=h[49],pe=l,xe=800,Ce=V,Se=U,de=W,se=d,h[50]===Symbol.for("react.memo_cache_sentinel")?(be={minWidth:"400px",minHeight:"250px"},h[50]=be):be=h[50],ce=o,ye=!0;const s=ae(e,"Più usate"),f=ae(c,"Avanzate");h[51]!==s||h[52]!==f?(ve=i(o,{flexGrow:1,flex:1,children:[s,f]}),h[51]=s,h[52]=f,h[53]=ve):ve=h[53];const y=ae(n,"Testuali"),v=ae(a,"Numerici");h[54]!==y||h[55]!==v?(ge=i(o,{flexGrow:1,flex:1,children:[y,v]}),h[54]=y,h[55]=v,h[56]=ge):ge=h[56],me=o,ue=1,he=1,fe=ae(m,"Scelta multipla"),h[14]=ae,h[15]=T,h[16]=U,h[17]=G,h[18]=oe,h[19]=k,h[20]=re,h[21]=x,h[22]=V,h[23]=S?.items,h[24]=ne,h[25]=ie,h[26]=me,h[27]=ce,h[28]=se,h[29]=de,h[30]=pe,h[31]=ue,h[32]=he,h[33]=fe,h[34]=ye,h[35]=ve,h[36]=ge,h[37]=be,h[38]=xe,h[39]=Ce,h[40]=Se,h[41]=ze}else me=h[26],ce=h[27],se=h[28],de=h[29],pe=h[30],ue=h[31],he=h[32],fe=h[33],ye=h[34],ve=h[35],ge=h[36],be=h[37],xe=h[38],Ce=h[39],Se=h[40],ze=h[41];return h[57]!==me||h[58]!==ue||h[59]!==he||h[60]!==fe?(ke=r(me,{flexGrow:ue,flex:he,children:fe}),h[57]=me,h[58]=ue,h[59]=he,h[60]=fe,h[61]=ke):ke=h[61],h[62]!==ce||h[63]!==ye||h[64]!==ve||h[65]!==ge||h[66]!==ke?(_e=i(ce,{container:ye,children:[ve,ge,ke]}),h[62]=ce,h[63]=ye,h[64]=ve,h[65]=ge,h[66]=ke,h[67]=_e):_e=h[67],h[68]!==se||h[69]!==be||h[70]!==_e?(we=r(se,{sx:be,children:_e}),h[68]=se,h[69]=be,h[70]=_e,h[71]=we):we=h[71],h[72]!==de||h[73]!==we?(Ie=r(de,{children:we}),h[72]=de,h[73]=we,h[74]=Ie):Ie=h[74],h[75]!==pe||h[76]!==xe||h[77]!==Ce||h[78]!==Se||h[79]!==Ie?(Oe=r(pe,{minWidth:xe,open:Ce,onClose:Se,children:Ie}),h[75]=pe,h[76]=xe,h[77]=Ce,h[78]=Se,h[79]=Ie,h[80]=Oe):Oe=h[80],h[81]!==J?(Te=r(K,{open:J,onClose:Z}),h[81]=J,h[82]=Te):Te=h[82],h[83]!==ze||h[84]!==Oe||h[85]!==Te?(je=i(n,{children:[ze,Oe,Te]}),h[83]=ze,h[84]=Oe,h[85]=Te,h[86]=je):je=h[86],je}function re(t){const o=e(36),{variant:n,handleOnEdit:l,handleOnMove:a,handleOnDuplicate:m,handleOnRemove:c,hasCondition:s,readonlyMode:d}=t,p=void 0===n?"buttons":n,u=void 0!==d&&d,h=le;let b,z,_,w,I,j,P,B;o[0]===Symbol.for("react.memo_cache_sentinel")?(b={alignSelf:"center"},o[0]=b):b=o[0],o[1]!==u?(z=u?r(C,{size:20}):r(f,{size:18}),o[1]=u,o[2]=z):z=o[2],o[3]!==l||o[4]!==u||o[5]!==z?(_=h(z,l,O(u?T.hover.view:T.hover.edit)),o[3]=l,o[4]=u,o[5]=z,o[6]=_):_=o[6],o[7]!==a||o[8]!==s?(w=!s&&Boolean(a)&&h(r(y,{size:18}),a,O(T.hover.move)),o[7]=a,o[8]=s,o[9]=w):w=o[9],o[10]!==m||o[11]!==s?(I=!s&&Boolean(m)&&h(r(v,{size:18}),m,O(T.hover.duplicate)),o[10]=m,o[11]=s,o[12]=I):I=o[12],o[13]===Symbol.for("react.memo_cache_sentinel")?(j=r(S,{size:18}),o[13]=j):j=o[13],o[14]!==c?(P=h(j,c,O(T.hover.remove)),o[14]=c,o[15]=P):P=o[15],o[16]!==_||o[17]!==w||o[18]!==I||o[19]!==P?(B=i(k,{direction:"row",spacing:1,sx:b,children:[_,w,I,P]}),o[16]=_,o[17]=w,o[18]=I,o[19]=P,o[20]=B):B=o[20];const A=B;let Q,L,F,E,M,W;o[21]===Symbol.for("react.memo_cache_sentinel")?(Q={icon:r(x,{size:20}),size:"medium",color:"primary"},o[21]=Q):Q=o[21],o[22]!==l||o[23]!==u?(L=l&&{key:"edit",text:O(u?T.hover.view:T.hover.edit),icon:r(u?C:f,{size:20}),onChoose:l},o[22]=l,o[23]=u,o[24]=L):L=o[24],o[25]!==a?(F=a&&{key:"move",text:O(T.hover.move),icon:r(y,{size:20}),onChoose:a},o[25]=a,o[26]=F):F=o[26],o[27]!==m?(E=m&&{key:"duplicate",text:O(T.hover.duplicate),icon:r(v,{size:20}),onChoose:m},o[27]=m,o[28]=E):E=o[28],o[29]!==c?(M=c&&{key:"remove",text:O(T.hover.remove),textColor:"error",icon:r(g,{size:20,style:{color:"red"}}),onChoose:c},o[29]=c,o[30]=M):M=o[30],o[31]!==L||o[32]!==F||o[33]!==E||o[34]!==M?(W=r(ee,{button:Q,options:[L,F,E,M].filter(ne)}),o[31]=L,o[32]=F,o[33]=E,o[34]=M,o[35]=W):W=o[35];return"buttons"===p?A:W}function ne(e){return Boolean(e)}function le(e,t,o){return t?r(_,{title:o,arrow:!0,children:r(p,{variant:"outlined",color:"secondary",onClick:t,children:e})}):null}export{ie as AddQuestionMenu,Y as InlineTextEdit,re as ItemHoverSymbols,ee as MoreVerticalCommon,te as MoreVerticalItemHover,J as QuestionGeneralEdit};
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import o from"@mui/material/Typography";import t from"@mui/material/Grid";import{jsxs as i,jsx as r,Fragment as n}from"react/jsx-runtime";import{ModalCommon as l}from"../../components/common/ModalCommon.js";import"../../components/common/Skeletons.js";import a from"react";import{useFormStateContext as m}from"../../providers/common/FormStateProvider.js";import{useEditorStateContext as c}from"../../providers/editor/EditorStateProvider.js";import{useIsQuestionNew as s}from"../../providers/editor/QuestionEditProvider.js";import"isomorphic-dompurify";import d from"@mui/material/Box";import p from"@mui/material/Button";import{PlusCircle as u,FilePlus2 as h,Pencil as f,MoveIcon as y,Copy as v,Trash2 as g,CircleHelp as b,EllipsisVertical as x,EyeIcon as C}from"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import S from"@mui/material/IconButton";import k from"@mui/material/Stack";import z from"@mui/material/Tooltip";import{Mapper as _,getMapType as O}from"../../utils/config-map.js";import{getLocale as w,LocaleMap as I,getLocaleItemTypeId as T}from"../../utils/locale.js";import"@famalabs/survey";import"acorn";import{RichTextEditor as j}from"@famalabs/web-ui";import"react-hook-form";import P from"@mui/material/FormControl";import"@mui/material/FormControlLabel";import B from"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import A from"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import Q from"@mui/material/ListItem";import L from"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import{useTheme as F}from"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import{useQuestionStateContext as E}from"../../providers/editor/QuestionStateProvider.js";import M from"@mui/material/CardContent";import W from"@mui/material/InputLabel";import D from"@mui/material/List";import $ from"@mui/material/ListItemButton";import q from"@mui/material/ListItemIcon";import G from"@mui/material/ListItemText";import N from"@mui/material/ListSubheader";import R from"@mui/material/Popover";import{OptionTextField as V}from"./OptionsEditor.js";import{ScoreSelectModal as H}from"./ScoreSelectModal.js";const K=[_.landing.type,_.page.type,_.cond.type,_.section.type,_.folder.type,_.check.type,_.time.type,_.score.type,_.fn.type,_.alert.type];function U(o){const n=e(51),{item:l,readonlyMode:a}=o,d=void 0!==a&&a,{globalConfig:p}=m(),{editorState:u,editorConfig:h}=c();let f;n[0]!==l?(f=O(l),n[0]=l,n[1]=f):f=n[1];const y=f,v=h.availableQuestions,g=E(),b=s(l.id);let x;n[2]!==g?(x=g.getQuestionValue("text"),n[2]=g,n[3]=x):x=n[3];const C=x;let S;n[4]!==g?(S=g.getQuestionValue("description"),n[4]=g,n[5]=S):S=n[5];const k=S;let z;n[6]!==C||n[7]!==g?(z=e=>{e!==C&&g.updateItem("text",e)},n[6]=C,n[7]=g,n[8]=z):z=n[8];const T=z;let B;n[9]!==k||n[10]!==g?(B=e=>{e!==k&&g.updateItem("description",e)},n[9]=k,n[10]=g,n[11]=B):B=n[11];const Q=B;let L;n[12]!==u||n[13]!==l?(L=async e=>{await u.changeQuestionType(l,e.target.value)||console.error("Error changing question type: new item has no id")},n[12]=u,n[13]=l,n[14]=L):L=n[14];const F=L;let M;n[15]!==C||n[16]!==g?(M=e=>{const o="${"+e+"}",t=C?`${C}${o}`:o;g.updateItem("text",t)},n[15]=C,n[16]=g,n[17]=M):M=n[17];const D=M,$=p.VariableSelector;let q;n[18]!==$||n[19]!==D?(q=$&&r($,{mode:"variable",buttonProps:{variant:"text",color:"primary",isIconButton:!0},onConfirm:e=>D(e.templateKey),environment:"education"}),n[18]=$,n[19]=D,n[20]=q):q=n[20];const G=q;let N;n[21]===Symbol.for("react.memo_cache_sentinel")?(N={p:1,backgroundColor:"background.default"},n[21]=N):N=n[21];const R=y===_.section.type?12:6;let H;n[22]===Symbol.for("react.memo_cache_sentinel")?(H={justifyContent:"flex-end",alignItems:"flex-end",p:1},n[22]=H):H=n[22];const U=b&&!C;let X;n[23]===Symbol.for("react.memo_cache_sentinel")?(X=_.section.type.toString(),n[23]=X):X=n[23];const Y=y!==X;let Z,ee,oe,te,ie,re,ne,le;return n[24]===Symbol.for("react.memo_cache_sentinel")?(Z=w(I.general.title),n[24]=Z):Z=n[24],n[25]!==G||n[26]!==C||n[27]!==T||n[28]!==d||n[29]!==U||n[30]!==Y?(ee=r(V,{label:"Titolo",className:"titleEditor",autoFocus:U,fullWidth:!0,required:Y,text:Z,value:C,handleOnChange:T,disabled:d,endAdornment:G}),n[25]=G,n[26]=C,n[27]=T,n[28]=d,n[29]=U,n[30]=Y,n[31]=ee):ee=n[31],n[32]!==R||n[33]!==ee?(oe=r(t,{container:!0,size:R,sx:H,children:ee}),n[32]=R,n[33]=ee,n[34]=oe):oe=n[34],n[35]===Symbol.for("react.memo_cache_sentinel")?(te={justifyContent:"flex-end",alignItems:"flex-end",p:1},n[35]=te):te=n[35],n[36]!==v||n[37]!==F||n[38]!==y||n[39]!==d?(ie=![_.section.type.toString(),_.cond.type.toString()].includes(y)&&i(P,{fullWidth:!0,children:[r(W,{id:"formType-label",children:"Tipologia"}),r(A,{labelId:"formType-label",label:"Tipologia",value:y,onChange:F,disabled:d,children:Object.keys(_).filter(e=>e===y||!K.includes(e)&&(!v||Boolean(v[e]))).map(J)})]}),n[36]=v,n[37]=F,n[38]=y,n[39]=d,n[40]=ie):ie=n[40],n[41]!==ie?(re=r(t,{container:!0,size:6,sx:te,children:ie}),n[41]=ie,n[42]=re):re=n[42],n[43]!==k||n[44]!==Q||n[45]!==d?(ne=r(t,{container:!0,size:12,p:1,children:r(j,{placeholder:"Aggiungi una descrizione",value:k,onBlur:Q,trailingBlock:!0,backgroundPreset:"default",toolbar:"static",disabled:d})}),n[43]=k,n[44]=Q,n[45]=d,n[46]=ne):ne=n[46],n[47]!==oe||n[48]!==re||n[49]!==ne?(le=i(t,{container:!0,sx:N,children:[oe,re,ne]}),n[47]=oe,n[48]=re,n[49]=ne,n[50]=le):le=n[50],le}function J(e){return r(B,{value:e,children:i(d,{component:"div",sx:{display:"flex"},children:[_[e].icon,r(o,{sx:{ml:2},children:T(e)})]})},e)}function X(t){const i=e(23),{value:n,handleOnSave:l,handleOnChange:m,variant:c,fullWidth:s,fontSize:d,autoFocus:p,readOnly:u,size:h}=t,f=void 0===c?"body1":c,y=void 0!==s&&s,v=void 0!==p&&p,g=void 0!==u&&u,b=void 0===h?"medium":h,[x,C]=a.useState(v);if(x&&!g){let e,o,t,a,c;return i[0]!==m?(e=e=>m?.(e),i[0]=m,i[1]=e):e=i[1],i[2]!==l?(o=e=>{C(!1),l&&l(e)},t=e=>{"Enter"===e.key&&(e.preventDefault(),C(!1),l&&l(e))},i[2]=l,i[3]=o,i[4]=t):(o=i[3],t=i[4]),i[5]!==y||i[6]!==b||i[7]!==e||i[8]!==o||i[9]!==t||i[10]!==n?(a=r(k,{direction:"row",spacing:2,children:r(L,{defaultValue:n,onChange:e,onBlur:o,onKeyDown:t,autoFocus:!0,fullWidth:y,onClick:Y,size:b})}),i[5]=y,i[6]=b,i[7]=e,i[8]=o,i[9]=t,i[10]=n,i[11]=a):a=i[11],i[12]!==y||i[13]!==a?(c=r(P,{fullWidth:y,children:a}),i[12]=y,i[13]=a,i[14]=c):c=i[14],c}{let e,t;i[15]===Symbol.for("react.memo_cache_sentinel")?(e={width:"100%",justifyContent:"flex-start"},t=e=>{e.stopPropagation(),C(!0)},i[15]=e,i[16]=t):(e=i[15],t=i[16]);const l=f;let a,m;return i[17]!==d?(a={fontSize:d,textOverflow:"ellipsis",margin:"auto 0",verticalAlign:"middle"},i[17]=d,i[18]=a):a=i[18],i[19]!==l||i[20]!==a||i[21]!==n?(m=r(k,{sx:e,onClick:t,children:r(o,{variant:l,sx:a,children:n})}),i[19]=l,i[20]=a,i[21]=n,i[22]=m):m=i[22],m}}function Y(e){return e.stopPropagation()}const Z=o=>{const t=e(31),{button:l,options:m,handleOnChoose:c}=o,s=void 0===c?void 0:c,[d,p]=a.useState(null),u=Boolean(d);let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h=e=>{e.preventDefault(),e.stopPropagation(),p(e.currentTarget)},t[0]=h):h=t[0];const f=h;let y;t[1]!==s?(y=(e,o)=>{e.preventDefault(),e.stopPropagation(),p(null),void 0!==o&&void 0!==s&&s(o)},t[1]=s,t[2]=y):y=t[2];const v=y,g=l?.size??"small",b=u?"long-menu":void 0,C=u?"true":void 0,k=l?.color??"default";let z,_,O,w,I,T,j,P,B,A;if(t[3]!==l?.icon?(z=l?.icon??r(x,{size:18}),t[3]=l?.icon,t[4]=z):z=t[4],t[5]!==g||t[6]!==b||t[7]!==C||t[8]!==k||t[9]!==z?(_=r(S,{"aria-label":"ellipsis-more",size:g,id:"more-icon-button","aria-controls":b,"aria-expanded":C,"aria-haspopup":"true",onClick:f,color:k,children:z}),t[5]=g,t[6]=b,t[7]=C,t[8]=k,t[9]=z,t[10]=_):_=t[10],t[11]!==v?(O=e=>v(e,void 0),t[11]=v,t[12]=O):O=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(w={vertical:"top",horizontal:"right"},I={vertical:"top",horizontal:"left"},t[13]=w,t[14]=I):(w=t[13],I=t[14]),t[15]===Symbol.for("react.memo_cache_sentinel")?(T={padding:0},t[15]=T):T=t[15],t[16]!==v||t[17]!==m){let e;t[19]!==v?(e=e=>e&&i($,{onClick:o=>{v(o,e.key),void 0!==e.onChoose&&e.onChoose(e.key)},children:[e.icon&&i(q,{children:[" ",e.icon," "]}),r(G,{primary:e.text,slotProps:{primary:{color:e.textColor??"textPrimary"}}})]},e.key),t[19]=v,t[20]=e):e=t[20],j=m.map(e),t[16]=v,t[17]=m,t[18]=j}else j=t[18];return t[21]!==j?(P=r(D,{dense:!0,sx:T,children:j}),t[21]=j,t[22]=P):P=t[22],t[23]!==d||t[24]!==u||t[25]!==O||t[26]!==P?(B=r(R,{id:"long-menu",anchorEl:d,open:u,onClose:O,anchorOrigin:w,transformOrigin:I,children:P}),t[23]=d,t[24]=u,t[25]=O,t[26]=P,t[27]=B):B=t[27],t[28]!==B||t[29]!==_?(A=i(n,{children:[_,B]}),t[28]=B,t[29]=_,t[30]=A):A=t[30],A};function ee(o){const t=e(20),{handleOnEdit:i,handleOnMove:n,handleOnDuplicate:l,handleOnRemove:a,handleOnAddPage:m}=o,c=F();let s,d,p,u,b,x,C,S;return t[0]!==m?(s=m&&{key:"add",text:w(I.hover.addPage),icon:r(h,{size:20}),onChoose:m},t[0]=m,t[1]=s):s=t[1],t[2]!==i?(d=i&&{key:"edit",text:w(I.hover.rename),icon:r(f,{size:20}),onChoose:i},t[2]=i,t[3]=d):d=t[3],t[4]!==n?(p=n&&{key:"move",text:w(I.hover.move),icon:r(y,{size:20}),onChoose:n},t[4]=n,t[5]=p):p=t[5],t[6]!==l?(u=l&&{key:"duplicate",text:w(I.hover.duplicate),icon:r(v,{size:20}),onChoose:l},t[6]=l,t[7]=u):u=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(b=w(I.hover.remove),t[8]=b):b=t[8],t[9]!==c.palette.error.main?(x=r(g,{size:20,style:{color:c.palette.error.main}}),t[9]=c.palette.error.main,t[10]=x):x=t[10],t[11]!==a||t[12]!==x?(C={key:"remove",text:b,textColor:"error",icon:x,onChoose:a},t[11]=a,t[12]=x,t[13]=C):C=t[13],t[14]!==s||t[15]!==d||t[16]!==p||t[17]!==u||t[18]!==C?(S=r(Z,{options:[s,d,p,u,C].filter(oe)}),t[14]=s,t[15]=d,t[16]=p,t[17]=u,t[18]=C,t[19]=S):S=t[19],S}function oe(e){return Boolean(e)}function te(s){const h=e(87),{mode:f,isOpen:y,setIsOpen:v,handleAddQuestion:g,nextQuestionIndex:x,excludeKeys:C,parent:k}=s,O=void 0===f?"default":f,w=void 0!==y&&y;let I;h[0]!==C?(I=void 0===C?[]:C,h[0]=C,h[1]=I):I=h[1];const j=I,{formInstance:P,globalConfig:B}=m(),{editorConfig:A}=c(),[L,F]=a.useState(!1),E=B.readonlyMode,W=A?.availableQuestions;let q;h[2]!==W?(q=e=>!W||Boolean(W[e]),h[2]=W,h[3]=q):q=h[3];const R=q,V="default"===O?L:w;let K;h[4]!==O||h[5]!==v?(K=()=>{"default"===O?F(!1):v?.(!1)},h[4]=O,h[5]=v,h[6]=K):K=h[6];const U=K,[J,X]=a.useState(!1);let Y;h[7]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>X(!1),h[7]=Y):Y=h[7];const Z=Y;let ee;h[8]!==g||h[9]!==U||h[10]!==E?(ee=async(e,o)=>{if(!E){if(e.stopPropagation(),o===_.score.type)return U(),void X(!0);await g(o),U()}},h[8]=g,h[9]=U,h[10]=E,h[11]=ee):ee=h[11];const oe=ee,te="user"===B.questionIndex?"visible"===(P?.root?.layout?.questionIndex??"visible"):"visible"===B.questionIndex,ie="single"===B.pagination?"campo":"domanda",re="single"===B.pagination?"Nuovo campo":"Nuova domanda",ne=te?x:"";let le;h[12]!==oe?(le=(e,o)=>e&&0!==e.length?r(D,{dense:!0,subheader:r(N,{component:"div",id:"nested-list-subheader",children:o}),children:e.map((e,o)=>{const t=_[e];return e in _?r(Q,{disablePadding:!0,secondaryAction:"hint"in t&&t.hint&&r(z,{title:t.hint,arrow:!0,children:r(S,{"aria-label":"hint",size:"small",children:r(b,{size:12})})}),children:i($,{onClick:async o=>await oe(o,e),children:[_[e].icon,r(G,{primary:T(e),sx:{ml:1,fontSize:12}})]},"title"+o)},e):null})}):null,h[12]=oe,h[13]=le):le=h[13];const ae=le;let me,ce,se,de,pe,ue,he,fe,ye,ve,ge,be,xe,Ce,Se,ke,ze,_e,Oe,we,Ie,Te,je;if(h[14]!==ae||h[15]!==j||h[16]!==U||h[17]!==R||h[18]!==te||h[19]!==O||h[20]!==re||h[21]!==x||h[22]!==V||h[23]!==k?.items||h[24]!==ne||h[25]!==ie){const e=[_.select.type,_.number.type,_.text.type].filter(e=>R(e)).filter(e=>!j.includes(e)),n=[_.text.type,_.textArea.type,_.date.type,_.time.type].filter(e=>R(e)).filter(e=>!j.includes(e)),a=[_.number.type,_.range.type,_.rating.type,_.switch.type].filter(e=>R(e)).filter(e=>!j.includes(e)),m=[_.select.type,_.dropdown.type,_.multipleSelect.type,_.autocomplete.type,_.selectTable.type,_.sourceList.type].filter(e=>R(e)).filter(e=>!j.includes(e)),c=[_.section.type,_.fileUpload.type,_.alert.type,_.fn.type,_.score.type].filter(e=>R(e)).filter(e=>!j.includes(e));h[42]!==te||h[43]!==O||h[44]!==re||h[45]!==x||h[46]!==k?.items||h[47]!==ne||h[48]!==ie?(ke="default"===O&&i(p,{fullWidth:!1,color:"inherit",onClick:()=>F(!0),"aria-label":"add-question-button",children:[r(u,{size:20}),r(o,{sx:{pl:1},children:x?`Aggiungi ${ie} ${te?x:""}`:k?.items.length?`Aggiungi ${ie} ${ne}`:re})]}),h[42]=te,h[43]=O,h[44]=re,h[45]=x,h[46]=k?.items,h[47]=ne,h[48]=ie,h[49]=ke):ke=h[49],pe=l,xe=800,Ce=V,Se=U,de=M,se=d,h[50]===Symbol.for("react.memo_cache_sentinel")?(be={minWidth:"400px",minHeight:"250px"},h[50]=be):be=h[50],ce=t,ye=!0;const s=ae(e,"Più usate"),f=ae(c,"Avanzate");h[51]!==s||h[52]!==f?(ve=i(t,{flexGrow:1,flex:1,children:[s,f]}),h[51]=s,h[52]=f,h[53]=ve):ve=h[53];const y=ae(n,"Testuali"),v=ae(a,"Numerici");h[54]!==y||h[55]!==v?(ge=i(t,{flexGrow:1,flex:1,children:[y,v]}),h[54]=y,h[55]=v,h[56]=ge):ge=h[56],me=t,ue=1,he=1,fe=ae(m,"Scelta multipla"),h[14]=ae,h[15]=j,h[16]=U,h[17]=R,h[18]=te,h[19]=O,h[20]=re,h[21]=x,h[22]=V,h[23]=k?.items,h[24]=ne,h[25]=ie,h[26]=me,h[27]=ce,h[28]=se,h[29]=de,h[30]=pe,h[31]=ue,h[32]=he,h[33]=fe,h[34]=ye,h[35]=ve,h[36]=ge,h[37]=be,h[38]=xe,h[39]=Ce,h[40]=Se,h[41]=ke}else me=h[26],ce=h[27],se=h[28],de=h[29],pe=h[30],ue=h[31],he=h[32],fe=h[33],ye=h[34],ve=h[35],ge=h[36],be=h[37],xe=h[38],Ce=h[39],Se=h[40],ke=h[41];return h[57]!==me||h[58]!==ue||h[59]!==he||h[60]!==fe?(ze=r(me,{flexGrow:ue,flex:he,children:fe}),h[57]=me,h[58]=ue,h[59]=he,h[60]=fe,h[61]=ze):ze=h[61],h[62]!==ce||h[63]!==ye||h[64]!==ve||h[65]!==ge||h[66]!==ze?(_e=i(ce,{container:ye,children:[ve,ge,ze]}),h[62]=ce,h[63]=ye,h[64]=ve,h[65]=ge,h[66]=ze,h[67]=_e):_e=h[67],h[68]!==se||h[69]!==be||h[70]!==_e?(Oe=r(se,{sx:be,children:_e}),h[68]=se,h[69]=be,h[70]=_e,h[71]=Oe):Oe=h[71],h[72]!==de||h[73]!==Oe?(we=r(de,{children:Oe}),h[72]=de,h[73]=Oe,h[74]=we):we=h[74],h[75]!==pe||h[76]!==xe||h[77]!==Ce||h[78]!==Se||h[79]!==we?(Ie=r(pe,{minWidth:xe,open:Ce,onClose:Se,children:we}),h[75]=pe,h[76]=xe,h[77]=Ce,h[78]=Se,h[79]=we,h[80]=Ie):Ie=h[80],h[81]!==J?(Te=r(H,{open:J,onClose:Z}),h[81]=J,h[82]=Te):Te=h[82],h[83]!==ke||h[84]!==Ie||h[85]!==Te?(je=i(n,{children:[ke,Ie,Te]}),h[83]=ke,h[84]=Ie,h[85]=Te,h[86]=je):je=h[86],je}const ie=o=>{const t=e(7),{color:i,icon:n,handleOnClick:l,tooltip:a}=o;let m,c;return t[0]!==i||t[1]!==l||t[2]!==n?(m=r(p,{variant:"outlined",color:i,onClick:l,children:n}),t[0]=i,t[1]=l,t[2]=n,t[3]=m):m=t[3],t[4]!==m||t[5]!==a?(c=r(z,{title:a,arrow:!0,children:m}),t[4]=m,t[5]=a,t[6]=c):c=t[6],c};function re(o){const t=e(38),{variant:n,handleOnEdit:l,handleOnMove:a,handleOnDuplicate:m,handleOnRemove:c,hasCondition:s,readonlyMode:d}=o,p=void 0===n?"buttons":n,u=void 0!==d&&d;let h,b,S,z,_,O,T,j,P,B;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={alignSelf:"center"},t[0]=h):h=t[0],t[1]!==u?(b=u?r(C,{size:20}):r(f,{size:18}),t[1]=u,t[2]=b):b=t[2],t[3]!==u?(S=w(u?I.hover.view:I.hover.edit),t[3]=u,t[4]=S):S=t[4],t[5]!==l||t[6]!==b||t[7]!==S?(z=r(ie,{color:"primary",icon:b,handleOnClick:l,tooltip:S}),t[5]=l,t[6]=b,t[7]=S,t[8]=z):z=t[8],t[9]!==a?(_=Boolean(a)&&r(ie,{color:"primary",icon:r(y,{size:18}),handleOnClick:a,tooltip:w(I.hover.move)}),t[9]=a,t[10]=_):_=t[10],t[11]!==m||t[12]!==s?(O=!s&&Boolean(m)&&r(ie,{color:"primary",icon:r(v,{size:18}),handleOnClick:m,tooltip:w(I.hover.duplicate)}),t[11]=m,t[12]=s,t[13]=O):O=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(T=r(g,{size:18}),t[14]=T):T=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(j=w(I.hover.remove),t[15]=j):j=t[15],t[16]!==c?(P=r(ie,{color:"error",icon:T,handleOnClick:c,tooltip:j}),t[16]=c,t[17]=P):P=t[17],t[18]!==P||t[19]!==z||t[20]!==_||t[21]!==O?(B=i(k,{direction:"row",spacing:1,sx:h,children:[z,_,O,P]}),t[18]=P,t[19]=z,t[20]=_,t[21]=O,t[22]=B):B=t[22];const A=B;let Q,L,F,E,M,W;t[23]===Symbol.for("react.memo_cache_sentinel")?(Q={icon:r(x,{size:20}),size:"medium",color:"primary"},t[23]=Q):Q=t[23],t[24]!==l||t[25]!==u?(L=l&&{key:"edit",text:w(u?I.hover.view:I.hover.edit),icon:r(u?C:f,{size:20}),onChoose:l},t[24]=l,t[25]=u,t[26]=L):L=t[26],t[27]!==a?(F=a&&{key:"move",text:w(I.hover.move),icon:r(y,{size:20}),onChoose:a},t[27]=a,t[28]=F):F=t[28],t[29]!==m?(E=m&&{key:"duplicate",text:w(I.hover.duplicate),icon:r(v,{size:20}),onChoose:m},t[29]=m,t[30]=E):E=t[30],t[31]!==c?(M=c&&{key:"remove",text:w(I.hover.remove),textColor:"error",icon:r(g,{size:20,style:{color:"red"}}),onChoose:c},t[31]=c,t[32]=M):M=t[32],t[33]!==L||t[34]!==F||t[35]!==E||t[36]!==M?(W=r(Z,{button:Q,options:[L,F,E,M].filter(ne)}),t[33]=L,t[34]=F,t[35]=E,t[36]=M,t[37]=W):W=t[37];return"buttons"===p?A:W}function ne(e){return Boolean(e)}export{te as AddQuestionMenu,X as InlineTextEdit,re as ItemHoverSymbols,Z as MoreVerticalCommon,ee as MoreVerticalItemHover,U as QuestionGeneralEdit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import t from"@mui/material/Typography";import"@mui/material/Grid";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{ModalCommon as n}from"../../components/common/ModalCommon.js";import"../../components/common/Skeletons.js";import o from"react";import{useFormStateContext as l}from"../../providers/common/FormStateProvider.js";import{useEditorStateContext as a}from"../../providers/editor/EditorStateProvider.js";import"isomorphic-dompurify";import"@mui/material/Box";import m from"@mui/material/Button";import{CircleHelp as c,ChevronLeft as s,CheckCircle as d,CircleArrowUp as p,CircleArrowDown as u,Circle as f,ChevronRight as h}from"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import x from"@mui/material/IconButton";import y from"@mui/material/Stack";import"@mui/material/Tooltip";import{getMapType as b,Mapper as I}from"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import"@famalabs/web-ui";import"react-hook-form";import g from"@mui/material/FormControl";import"@mui/material/FormControlLabel";import S from"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import C from"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import{useTheme as w}from"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import v from"@mui/material/Breadcrumbs";import z from"@mui/material/CardHeader";import T from"@mui/material/Divider";import k from"@mui/material/InputLabel";import j from"@mui/material/Link";function W(e,t){if(!e)return t;const i=e.parent();return i?("cond"!==i.type&&t.unshift(i),W(i,t)):t}function _(e){return"cond"===e.type&&e.parent()?e.parent():e}function D(e){const t=[];return W(e,t),t}function P(e){return I[b(e)].icon}const A={folder:"Cartella",page:"Pagina",section:"Sezione",question:"Domanda",move:"Sposta",duplicate:"Duplica",select:"Seleziona"};function F(n){const W=e(80),{currentItem:F,currentAction:H,handleCancel:$,handleConfirm:L,selectableItemTypes:B,disabledItems:R}=n,{formInfo:q,formInstance:N}=l(),{navigationState:G}=a(),Q=w(),E=q?.name||"Modulo senza titolo",[O,U]=o.useState(void 0),[Y,J]=o.useState(void 0),[K,V]=o.useState("after");if(F||O){if(F&&!O){let e=F.parent()||N.root;b(e)===I.cond.type&&(e=e.parent()),U(e)}}else{const e=G.currentPage?.folderId;let t;if(e)try{t=N.get(e)}catch(ee){const i=ee;console.error("Error retrieving current folder with id:",e,i),t=N.root}else t=N.root;U(t)}let X;W[0]===Symbol.for("react.memo_cache_sentinel")?(X=e=>{U(e)},W[0]=X):X=W[0];const Z=X;let ee;W[1]!==Y?(ee=e=>{Y&&Y?.id===e.id?J(void 0):J(e)},W[1]=Y,W[2]=ee):ee=W[2];const te=ee;let ie;W[3]!==O||W[4]!==F||W[5]!==L||W[6]!==K||W[7]!==G||W[8]!==Y?(ie=()=>{if(!F||!O)return;const e=b(F)===I.cond.type?F.parent()?.parent():F.parent(),t=O.id===e.id?F:O.items?.length>=1?O.items[O.items.length-1]:O.items[0],i=b(Y)===I.cond.type?Y?.items[0]:Y||t,r=b(F),n=b(F?.parent())===I.cond.type?O.items.findIndex(e=>e.id===F.parent().id):O.items.findIndex(e=>e.id===F.id),o=b(i?.parent())===I.cond.type?O.items.findIndex(e=>e.id===i?.parent().id):O.items.findIndex(e=>e.id===i?.id),l=i&&b(i?.parent())!==I.cond.type?i.parent():O;let a=n,m=o;r!==I.page.type&&r!==I.folder.type&&i?(a=b(F?.parent())===I.cond.type?G.getItem(F?.parent()?.id)?.localIndex??a:G.getItem(F?.id)?.localIndex??a,m=b(i?.parent())===I.cond.type?G.getItem(i?.parent()?.id)?.localIndex??m:G.getItem(i?.id)?.localIndex??m,m=b(i?.parent())===I.cond.type?G.getItem(i?.parent()?.id)?.localIndex??m:b(i?.parent())===I.multipleSelect.type||b(i?.parent())===I.autocomplete.type||b(i?.parent())===I.section.type||b(i?.parent())===I.selectTable.type?O.items.findIndex(e=>e.id===i.id):G.getItem(i?.id)?.localIndex??m):"0"===O.id||Y||(m=O.items?.length||a),L({selectedItem:Y,currentContainerId:F?F.parent().id:"0",nextContainer:l,currentItem:F,currentIndex:F?a:0,nextIndex:m,placement:K}),J(void 0)},W[3]=O,W[4]=F,W[5]=L,W[6]=K,W[7]=G,W[8]=Y,W[9]=ie):ie=W[9];const re=ie;let ne;W[10]!==H||W[11]!==F?(ne=e=>{let t=b(F);return"select"===H&&t===I.cond.type&&(t=b(F?.items[0])),t===I.folder.type?"root"===b(e):t===I.page.type?H===I.select.type?b(e)!==I.folder.type:b(e)===I.folder.type||"root"===b(e):b(e)===I.page.type||b(e)===I.section.type||b(e)===I.selectTable.type||H===I.select.type&&b(e)===I.multipleSelect.type},W[10]=H,W[11]=F,W[12]=ne):ne=W[12];const oe=ne;let le;W[13]!==H||W[14]!==G?(le=e=>i(y,{sx:{flexDirection:"row",width:"100%"},children:i(t,"select"===H?{noWrap:!0,sx:{pl:"5px",alignSelf:"center",width:"auto"},children:"Seleziona una domanda"}:{noWrap:!0,sx:{pl:"5px",alignSelf:"center",width:"auto"},children:("item"!==e.type?G.getItem(e.id)?.globalIndex:"")+" "+(e.text||"Sezione")})}),W[13]=H,W[14]=G,W[15]=le):le=W[15];const ae=le;let me;W[16]!==H||W[17]!==F||W[18]!==R||W[19]!==K||W[20]!==G||W[21]!==te||W[22]!==B||W[23]!==Y||W[24]!==Q?(me=(e,n)=>{if(!e)return null;let o;if("item"!==e.type)if(e.parent().layout?.style===I.section.type){const t=G.getItem(e.parent().id)?.globalIndex;o=`${t}.${e.parent().items?.indexOf(e)+1}. `}else if(b(e)===I.check.type){o=`${e.parent().items.filter(M).indexOf(e)+1}. `}else{const t=G.getItem(e.id)?.globalIndex;o=Number(t)>=0?`${t}. `:""}else if(e.layout?.style===I.section.type){const t=G.getItem(e.id)?.globalIndex;o=`${t}. `}else if(b(e)===I.multipleSelect.type){const t=G.getItem(e.id)?.globalIndex;o=`${t}. `}else o="";const l=()=>!(R&&R.includes(e.id)||!B)&&!(B?.length>0&&!B.includes(b(e)));return r(y,{sx:0===n?{pt:1,width:"100%"}:{width:"100%"},children:["select"!==H&&Y&&"before"===K&&e.id===Y.id&&i(m,{disabled:!0,size:"small",sx:{pl:3,width:"100%",justifyContent:"flex-start"},children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:F?.text||"Sezione"})}),r(m,{"aria-label":`hierarchy-item-${e.text}`,color:"inherit",disabled:R&&R?.length>0&&R?.includes(e.id),size:"small",variant:e.id===F?.id?"text":e.id===F?.parent()?.id?"outlined":"text",onClick:()=>{e.id!==F?.id&&l()?te(e):b(e)!==I.page.type&&b(e)!==I.folder.type&&b(e)!==I.multipleSelect.type||Z(e)},sx:{pl:3,my:.5,alignItems:"initial",justifyContent:"flex-start",width:"100%",bgcolor:e.id===F?.id?Q.palette.background.default:"inherit",transition:"none",...e.id!==F?.id&&{...!l()&&b(e)!==I.page.type&&b(e)!==I.folder.type&&b(e)!==I.multipleSelect.type&&{backgroundColor:Q.palette.action.selected,opacity:.5,cursor:"not-allowed"},"&:hover":{...l()?{"& > .position":{display:"flex"},"& > .iconType":{display:"none"},cursor:"pointer",bgcolor:Q.palette.action.hover,transition:"none"}:{}}}},children:[e.id!==F?.id&&i(y,{className:"position",sx:e.id!==Y?.id?{display:"none",alignSelf:"center"}:{alignSelf:"center"},children:i(x,{size:"small",color:e.id===Y?.id?"primary":"inherit",onClick:()=>l()&&te(e),sx:{p:"0px !important"},children:e.id===Y?.id?i("select"===H?d:"before"===K?p:u,{size:20}):i(f,{size:20})})}),i(y,{className:"iconType",sx:e.id===Y?.id?{display:"none",alignSelf:"center"}:{alignSelf:"center"},children:P(e)}),r(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:[o,e.text||"Sezione"]}),"item"===e.type&&i(x,{size:"small",sx:{position:"absolute",right:"3px",top:0},onClick:t=>{t.stopPropagation(),Z(e)},children:i(h,{size:20})})]}),"select"!==H&&Y&&"after"===K&&e.id===Y.id&&i(m,{size:"small",disabled:!0,sx:{pl:3,justifyContent:"flex-start",width:"100%"},children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:F?.text||"Sezione"})})]},e.id)},W[16]=H,W[17]=F,W[18]=R,W[19]=K,W[20]=G,W[21]=te,W[22]=B,W[23]=Y,W[24]=Q,W[25]=me):me=W[25];const ce=me;let se;W[26]!==E?(se=e=>i(j,{underline:"hover",color:"inherit",onClick:()=>Z(e),sx:{fontSize:"small",cursor:"pointer"},children:"0"===e.id?E:e.text},e.id),W[26]=E,W[27]=se):se=W[27];const de=se;let pe,ue,fe,he,xe,ye,be,Ie,ge,Se,Ce,we,ve,ze,Te,ke;return W[28]!==ae||W[29]!==H||W[30]!==F||W[31]!==Q?(pe=F&&H&&i(z,{title:A[H],subheader:ae(F),slotProps:{title:{sx:{color:Q.palette.primary.contrastText}},subheader:{sx:{color:Q.palette.primary.contrastText}}},action:i(x,{"aria-label":"settings",sx:{position:"absolute",right:"10px",color:Q.palette.primary.contrastText},children:i(c,{})}),sx:{position:"relative",width:"100%",backgroundColor:Q.palette.primary.main,"& > .MuiCardHeader-content":{width:"100%"}}}),W[28]=ae,W[29]=H,W[30]=F,W[31]=Q,W[32]=pe):pe=W[32],W[33]!==O||W[34]!==H||W[35]!==F?(ue=O?.parent()&&i(y,{sx:{p:1},children:r(y,{sx:{flexDirection:"row",alignItems:"center",justifyContent:"start",display:"flex"},children:[("select"!==H||O?.id!==F?.parent().id)&&i(x,{size:"medium",color:"inherit","aria-label":"navigate-back",onClick:()=>Z(_(O?.parent())),disableRipple:!0,disableFocusRipple:!0,children:i(s,{size:20})}),r(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"},children:[P(_(O)),i(t,{sx:{alignSelf:"center",pl:"10px"},children:_(O)?.text||"Sezione"})]})]})}),W[33]=O,W[34]=H,W[35]=F,W[36]=ue):ue=W[36],W[37]===Symbol.for("react.memo_cache_sentinel")?(fe=i(T,{}),W[37]=fe):fe=W[37],W[38]===Symbol.for("react.memo_cache_sentinel")?(he={maxHeight:"450px",height:"50vh",overflowY:"scroll",position:"relative",width:"100%"},W[38]=he):he=W[38],W[39]!==ce||W[40]!==O?(xe=O?.items.map((e,t)=>{const i=b(e)===I.cond.type?e.items[0]:e;return b(O)===I.multipleSelect.type&&b(i)!==I.check.type?null:ce(i,t)}),W[39]=ce,W[40]=O,W[41]=xe):xe=W[41],W[42]!==O||W[43]!==H||W[44]!==F||W[45]!==oe||W[46]!==Y?(ye=O&&oe(O)&&"select"!==H&&!Y&&O.id!==F?.parent().id&&i(m,{sx:{pl:3,justifyContent:"flex-start",width:"100%"},size:"small",disabled:!0,children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:F?.text||"Sezione"})}),W[42]=O,W[43]=H,W[44]=F,W[45]=oe,W[46]=Y,W[47]=ye):ye=W[47],W[48]!==xe||W[49]!==ye?(be=r(y,{sx:he,children:[xe,ye]}),W[48]=xe,W[49]=ye,W[50]=be):be=W[50],W[51]===Symbol.for("react.memo_cache_sentinel")?(Ie=i(T,{}),W[51]=Ie):Ie=W[51],W[52]===Symbol.for("react.memo_cache_sentinel")?(ge={py:1,px:3},W[52]=ge):ge=W[52],W[53]===Symbol.for("react.memo_cache_sentinel")?(Se=i(h,{size:14}),W[53]=Se):Se=W[53],W[54]!==de||W[55]!==O?(Ce=O&&D(O).map(de),W[54]=de,W[55]=O,W[56]=Ce):Ce=W[56],W[57]!==O||W[58]!==E?(we=O&&i(t,{sx:{color:"text.primary",fontSize:"small"},children:"0"===O.id?E:O.text}),W[57]=O,W[58]=E,W[59]=we):we=W[59],W[60]!==Ce||W[61]!==we?(ve=r(v,{"aria-label":"breadcrumb",separator:Se,children:[Ce,we]}),W[60]=Ce,W[61]=we,W[62]=ve):ve=W[62],W[63]!==O||W[64]!==H||W[65]!==F||W[66]!==re||W[67]!==$||W[68]!==oe||W[69]!==K||W[70]!==Y?(ze=O&&r(y,{direction:"row",spacing:2,sx:{justifyContent:"space-between",pt:2},children:[i(y,{sx:{flexDirection:"row"},children:"select"!==H&&r(g,{"aria-label":"position-select",children:[i(k,{id:"position-label",children:"Posizione"}),r(C,{size:"small",label:"Posizione",disabled:!Y,value:Y||O.id===F?.parent().id?K:"last",onChange:e=>V(e.target.value),sx:{width:100},children:[i(S,{value:"before",children:"Prima"},"before"),i(S,{value:"after",children:"Dopo"},"after"),!Y&&i(S,{value:"last",children:"Ultimo"},"last")]})]})}),r(y,{sx:{flexDirection:"row",alignItems:"center"},children:[i(m,{color:"secondary",onClick:$,children:"Annulla"}),i(m,{sx:{ml:1},variant:"contained",color:"primary",disabled:!oe(O),onClick:re,children:H?A[H]:"Seleziona"})]})]}),W[63]=O,W[64]=H,W[65]=F,W[66]=re,W[67]=$,W[68]=oe,W[69]=K,W[70]=Y,W[71]=ze):ze=W[71],W[72]!==ve||W[73]!==ze?(Te=r(y,{sx:ge,children:[ve,ze]}),W[72]=ve,W[73]=ze,W[74]=Te):Te=W[74],W[75]!==be||W[76]!==Te||W[77]!==pe||W[78]!==ue?(ke=r(y,{component:"div","aria-label":"hierarchy-editor-window",children:[pe,ue,fe,be,Ie,Te]}),W[75]=be,W[76]=Te,W[77]=pe,W[78]=ue,W[79]=ke):ke=W[79],ke}function M(e){return"check"===e.type}function H(t){const r=e(16),{question:o,editorState:l,open:a,closeModal:m,selectableItemTypes:c,disabledItems:s}=t;if(!o)return null;let d;r[0]!==l?(d=async e=>{let t=e.nextIndex;e.currentContainerId===e.nextContainer.id&&e.currentIndex<e.nextIndex?"before"===e.placement&&(t-=1):t+="after"===e.placement?1:0,await l.moveItem(e.currentItem,t,e.nextContainer.id)},r[0]=l,r[1]=d):d=r[1];const p=d;let u,f,h;return r[2]!==m||r[3]!==l||r[4]!==p?(u=async e=>{await p(e),m(),await l.createHistorySnapshot()},r[2]=m,r[3]=l,r[4]=p,r[5]=u):u=r[5],r[6]!==m||r[7]!==s||r[8]!==o||r[9]!==c||r[10]!==u?(f=i(F,{currentItem:o,currentAction:"move",selectableItemTypes:c,disabledItems:s,handleCancel:m,handleConfirm:u}),r[6]=m,r[7]=s,r[8]=o,r[9]=c,r[10]=u,r[11]=f):f=r[11],r[12]!==m||r[13]!==a||r[14]!==f?(h=i(n,{open:a,onClose:m,minWidth:"520px",width:"50vw",maxWidth:"720px",children:f}),r[12]=m,r[13]=a,r[14]=f,r[15]=h):h=r[15],h}function $(t){const r=e(16),{question:o,editorState:l,open:a,closeModal:m,selectableItemTypes:c,disabledItems:s}=t;if(!o)return null;let d;r[0]!==l?(d=async e=>{const t=e.nextIndex+("after"===e.placement?1:0);await l.duplicateItem(e.currentItem,e.nextContainer,t)},r[0]=l,r[1]=d):d=r[1];const p=d;let u,f,h;return r[2]!==m||r[3]!==l||r[4]!==p?(u=async e=>{await p(e),m(),await l.createHistorySnapshot()},r[2]=m,r[3]=l,r[4]=p,r[5]=u):u=r[5],r[6]!==m||r[7]!==s||r[8]!==o||r[9]!==c||r[10]!==u?(f=i(F,{currentItem:o,currentAction:"duplicate",selectableItemTypes:c,disabledItems:s,handleCancel:m,handleConfirm:u}),r[6]=m,r[7]=s,r[8]=o,r[9]=c,r[10]=u,r[11]=f):f=r[11],r[12]!==m||r[13]!==a||r[14]!==f?(h=i(n,{open:a,onClose:m,minWidth:"520px",width:"50vw",maxWidth:"720px",children:f}),r[12]=m,r[13]=a,r[14]=f,r[15]=h):h=r[15],h}function L(t){const r=e(13),{question:o,open:l,closeModal:a,select:m,selectableItemTypes:c,disabledItems:s}=t,d=b(o)===I.cond.type?o.items[0]:o;let p,u,f;return r[0]!==a||r[1]!==m?(p=e=>{m(e),a()},r[0]=a,r[1]=m,r[2]=p):p=r[2],r[3]!==a||r[4]!==d||r[5]!==s||r[6]!==c||r[7]!==p?(u=i(F,{currentItem:d,currentAction:"select",selectableItemTypes:c,disabledItems:s,handleCancel:a,handleConfirm:p}),r[3]=a,r[4]=d,r[5]=s,r[6]=c,r[7]=p,r[8]=u):u=r[8],r[9]!==a||r[10]!==l||r[11]!==u?(f=i(n,{open:l,onClose:a,minWidth:"520px",width:"50vw",maxWidth:"720px",children:u}),r[9]=a,r[10]=l,r[11]=u,r[12]=f):f=r[12],f}export{F as Hierarchy,$ as RenderDuplicateModal,H as RenderMoveModal,L as RenderSelectModal};
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"../../components/common/DrawerCommon.js";import t from"@mui/material/Typography";import"@mui/material/Grid";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{ModalCommon as n}from"../../components/common/ModalCommon.js";import"../../components/common/Skeletons.js";import o from"react";import{useFormStateContext as l}from"../../providers/common/FormStateProvider.js";import{useEditorStateContext as a}from"../../providers/editor/EditorStateProvider.js";import"isomorphic-dompurify";import"@mui/material/Box";import m from"@mui/material/Button";import{ChevronLeft as c,CheckCircle as p,CircleArrowUp as s,CircleArrowDown as d,Circle as u,ChevronRight as f}from"lucide-react";import"@mui/material/SvgIcon";import"@mui/material/Chip";import"@mui/material/FormLabel";import h from"@mui/material/IconButton";import y from"@mui/material/Stack";import"@mui/material/Tooltip";import{getMapType as x,Mapper as b}from"../../utils/config-map.js";import"../../utils/locale.js";import"@famalabs/survey";import"acorn";import"@famalabs/web-ui";import"react-hook-form";import I from"@mui/material/FormControl";import"@mui/material/FormControlLabel";import g from"@mui/material/MenuItem";import"@mui/material/Radio";import"@mui/material/RadioGroup";import S from"@mui/material/Select";import"@mui/material/Checkbox";import"@mui/material/Switch";import"../../components/forms/QuestionNumberCommon.js";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"dayjs";import"@mui/material/Autocomplete";import"@mui/material/FormGroup";import"@mui/material/FormHelperText";import"@mui/material/ListItem";import"@mui/material/TextField";import"../../components/forms/QuestionListCommon.js";import{useTheme as C}from"@mui/material/styles";import"@mui/material/useMediaQuery";import"react-dropzone";import"@mui/material/Alert";import"@mui/material/AlertTitle";import w from"@mui/material/Breadcrumbs";import v from"@mui/material/CardHeader";import z from"@mui/material/Divider";import T from"@mui/material/InputLabel";import k from"@mui/material/Link";function j(e,t){if(!e)return t;const i=e.parent();return i?("cond"!==i.type&&t.unshift(i),j(i,t)):t}function W(e){return"cond"===e.type&&e.parent()?e.parent():e}function _(e){const t=[];return j(e,t),t}function D(e){return b[x(e)].icon}const P={folder:"Cartella",page:"Pagina",section:"Sezione",question:"Domanda",move:"Sposta",duplicate:"Duplica",select:"Seleziona"};function A(n){const j=e(87),{currentItem:A,currentAction:M,handleCancel:H,handleConfirm:$,selectableItemTypes:L,disabledItems:B}=n,{formInfo:R,formInstance:q}=l(),{navigationState:N}=a(),G=C(),Q=R?.name||"Modulo senza titolo",[E,O]=o.useState(void 0),[U,Y]=o.useState(void 0),[J,K]=o.useState("after");if(A||E){if(A&&!E){let e=A.parent()||q.root;x(e)===b.cond.type&&(e=e.parent()),O(e)}}else{const e=N.currentPage?.folderId;let t;if(e)try{t=q.get(e)}catch(Z){const i=Z;console.error("Error retrieving current folder with id:",e,i),t=q.root}else t=q.root;O(t)}let V;j[0]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{O(e)},j[0]=V):V=j[0];const X=V;let Z;j[1]!==U?(Z=e=>{U&&U?.id===e.id?Y(void 0):Y(e)},j[1]=U,j[2]=Z):Z=j[2];const ee=Z;let te;j[3]!==A||j[4]!==$||j[5]!==J||j[6]!==N||j[7]!==U||j[8]!==E?(te=()=>{if(!A||!E)return;const e=x(A),t=x(A)===b.cond.type?A.parent()?.parent():A.parent(),i=E.id===t.id?A:E.items?.length>=1?E.items[E.items.length-1]:E.items[0],r=x(U)===b.cond.type?U?.items[0]:U||i,n=x(A?.parent())===b.cond.type?E.items.findIndex(e=>e.id===A.parent().id):E.items.findIndex(e=>e.id===A.id),o=x(r?.parent())===b.cond.type?E.items.findIndex(e=>e.id===r?.parent().id):E.items.findIndex(e=>e.id===r?.id),l=r&&x(r?.parent())!==b.cond.type?r.parent():E;let a=n,m=o;e!==b.page.type&&e!==b.folder.type&&r?(a=x(A?.parent())===b.cond.type?N.getItem(A?.parent()?.id)?.localIndex??a:N.getItem(A?.id)?.localIndex??a,m=x(r?.parent())===b.cond.type?N.getItem(r?.parent()?.id)?.localIndex??m:N.getItem(r?.id)?.localIndex??m,m=x(r?.parent())===b.cond.type?N.getItem(r?.parent()?.id)?.localIndex??m:x(r?.parent())===b.multipleSelect.type||x(r?.parent())===b.autocomplete.type||x(r?.parent())===b.section.type||x(r?.parent())===b.selectTable.type?E.items.findIndex(e=>e.id===r.id):N.getItem(r?.id)?.localIndex??m):"0"===E.id||U||(m=E.items?.length||a),$({selectedItem:U,currentContainerId:A?A.parent().id:"0",nextContainer:l,currentItem:A,currentIndex:A?a:0,nextIndex:m,placement:J}),Y(void 0)},j[3]=A,j[4]=$,j[5]=J,j[6]=N,j[7]=U,j[8]=E,j[9]=te):te=j[9];const ie=te;let re;j[10]!==M||j[11]!==A?(re=e=>{let t=x(A);return"select"===M&&t===b.cond.type&&(t=x(A?.items[0])),t===b.folder.type?"root"===x(e):t===b.page.type?M===b.select.type?x(e)!==b.folder.type:x(e)===b.folder.type||"root"===x(e):x(e)===b.page.type||x(e)===b.section.type||x(e)===b.selectTable.type||M===b.select.type&&x(e)===b.multipleSelect.type},j[10]=M,j[11]=A,j[12]=re):re=j[12];const ne=re;let oe;j[13]!==M||j[14]!==A||j[15]!==E?.id?(oe=("select"!==M||E?.id!==A?.parent().id)&&x(A?.parent())!==b.cond.type&&x(A)!==b.alert.type,j[13]=M,j[14]=A,j[15]=E?.id,j[16]=oe):oe=j[16];const le=oe;let ae;j[17]!==M||j[18]!==A?(ae=e=>{if(!e)return!1;const t=x(e),i=x(A);return"select"===M?"item"===e.type:"item"===e.type&&(t!==i&&(x(A?.parent())!==b.cond.type&&(t!==b.multipleSelect.type&&t!==b.autocomplete.type&&t!==b.selectTable.type&&((t!==b.page.type||i!==b.folder.type)&&(t!==b.section.type||i!==b.page.type&&i!==b.folder.type&&i!==b.cond.type&&i!==b.alert.type&&i!==b.fn.type&&i!==b.score.type)))))},j[17]=M,j[18]=A,j[19]=ae):ae=j[19];const me=ae;let ce;j[20]!==M||j[21]!==N?(ce=e=>i(y,{sx:{flexDirection:"row",width:"100%"},children:i(t,"select"===M?{noWrap:!0,sx:{pl:"5px",alignSelf:"center",width:"auto"},children:"Seleziona una domanda"}:{noWrap:!0,sx:{pl:"5px",alignSelf:"center",width:"auto"},children:("item"!==e.type?N.getItem(e.id)?.globalIndex:"")+" "+(e.text||"Sezione")})}),j[20]=M,j[21]=N,j[22]=ce):ce=j[22];const pe=ce;let se;j[23]!==M||j[24]!==A||j[25]!==B||j[26]!==me||j[27]!==J||j[28]!==N||j[29]!==ee||j[30]!==L||j[31]!==U||j[32]!==G?(se=(e,n)=>{if(!e)return null;let o;if("item"!==e.type)if(e.parent().layout?.style===b.section.type){const t=N.getItem(e.parent().id)?.globalIndex;o=`${t}.${e.parent().items?.indexOf(e)+1}. `}else if(x(e)===b.check.type){o=`${e.parent().items.filter(F).indexOf(e)+1}. `}else{const t=N.getItem(e.id)?.globalIndex;o=Number(t)>=0?`${t}. `:""}else if(e.layout?.style===b.section.type){const t=N.getItem(e.id)?.globalIndex;o=`${t}. `}else if(x(e)===b.multipleSelect.type){const t=N.getItem(e.id)?.globalIndex;o=`${t}. `}else o="";const l=()=>!(B&&B.includes(e.id)||!L)&&!(L?.length>0&&!L.includes(x(e)));return r(y,{sx:0===n?{pt:1,width:"100%"}:{width:"100%"},children:["select"!==M&&U&&"before"===J&&e.id===U.id&&i(m,{disabled:!0,size:"small",sx:{pl:3,width:"100%",justifyContent:"flex-start"},children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:A?.text||"Sezione"})}),r(m,{"aria-label":`hierarchy-item-${e.text}`,color:"inherit",disabled:B&&B?.length>0&&B?.includes(e.id),size:"small",variant:e.id===A?.id?"text":e.id===A?.parent()?.id?"outlined":"text",onClick:()=>{e.id!==A?.id&&l()?ee(e):x(e)!==b.page.type&&x(e)!==b.folder.type&&x(e)!==b.multipleSelect.type||X(e)},sx:{pl:3,my:.5,alignItems:"initial",justifyContent:"flex-start",width:"100%",bgcolor:e.id===A?.id?G.palette.background.default:"inherit",transition:"none",...e.id!==A?.id&&{...!l()&&x(e)!==b.page.type&&x(e)!==b.folder.type&&x(e)!==b.multipleSelect.type&&{backgroundColor:G.palette.action.selected,opacity:.5,cursor:"not-allowed"},"&:hover":{...l()?{"& > .position":{display:"flex"},"& > .iconType":{display:"none"},cursor:"pointer",bgcolor:G.palette.action.hover,transition:"none"}:{}}}},children:[e.id!==A?.id&&i(y,{className:"position",sx:e.id!==U?.id?{display:"none",alignSelf:"center"}:{alignSelf:"center"},children:i(h,{size:"small",color:e.id===U?.id?"primary":"inherit",onClick:()=>l()&&ee(e),sx:{p:"0px !important"},children:e.id===U?.id?i("select"===M?p:"before"===J?s:d,{size:20}):i(u,{size:20})})}),i(y,{className:"iconType",sx:e.id===U?.id?{display:"none",alignSelf:"center"}:{alignSelf:"center"},children:D(e)}),r(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:[o,e.text||"Sezione"]}),me(e)&&i(h,{size:"small",sx:{position:"absolute",right:"3px",top:0},onClick:t=>{t.stopPropagation(),X(e)},children:i(f,{size:20})})]}),"select"!==M&&U&&"after"===J&&e.id===U.id&&i(m,{size:"small",disabled:!0,sx:{pl:3,justifyContent:"flex-start",width:"100%"},children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:A?.text||"Sezione"})})]},e.id)},j[23]=M,j[24]=A,j[25]=B,j[26]=me,j[27]=J,j[28]=N,j[29]=ee,j[30]=L,j[31]=U,j[32]=G,j[33]=se):se=j[33];const de=se;let ue;j[34]!==Q?(ue=e=>i(k,{underline:"hover",color:"inherit",onClick:()=>X(e),sx:{fontSize:"small",cursor:"pointer"},children:"0"===e.id?Q:e.text},e.id),j[34]=Q,j[35]=ue):ue=j[35];const fe=ue;let he,ye,xe,be,Ie,ge,Se,Ce,we,ve,ze,Te,ke,je,We,_e;return j[36]!==pe||j[37]!==M||j[38]!==A||j[39]!==G?(he=A&&M&&i(v,{title:P[M],subheader:pe(A),slotProps:{title:{sx:{color:G.palette.primary.contrastText}},subheader:{sx:{color:G.palette.primary.contrastText}}},sx:{position:"relative",width:"100%",backgroundColor:G.palette.primary.main,"& > .MuiCardHeader-content":{width:"100%"}}}),j[36]=pe,j[37]=M,j[38]=A,j[39]=G,j[40]=he):he=j[40],j[41]!==le||j[42]!==E?(ye=E?.parent()&&i(y,{sx:{p:1},children:r(y,{sx:{flexDirection:"row",alignItems:"center",justifyContent:"start",display:"flex"},children:[le&&i(h,{size:"medium",color:"inherit","aria-label":"navigate-back",onClick:()=>X(W(E?.parent())),disableRipple:!0,disableFocusRipple:!0,children:i(c,{size:20})}),r(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",p:1},children:[D(W(E)),i(t,{sx:{alignSelf:"center",pl:"10px"},children:W(E)?.text||"Sezione"})]})]})}),j[41]=le,j[42]=E,j[43]=ye):ye=j[43],j[44]===Symbol.for("react.memo_cache_sentinel")?(xe=i(z,{}),j[44]=xe):xe=j[44],j[45]===Symbol.for("react.memo_cache_sentinel")?(be={maxHeight:"450px",height:"50vh",overflowY:"scroll",position:"relative",width:"100%"},j[45]=be):be=j[45],j[46]!==de||j[47]!==E?(Ie=E?.items.map((e,t)=>{const i=x(e)===b.cond.type?e.items[0]:e;return x(E)===b.multipleSelect.type&&x(i)!==b.check.type?null:de(i,t)}),j[46]=de,j[47]=E,j[48]=Ie):Ie=j[48],j[49]!==M||j[50]!==A||j[51]!==ne||j[52]!==U||j[53]!==E?(ge=E&&ne(E)&&"select"!==M&&!U&&E.id!==A?.parent().id&&i(m,{sx:{pl:3,justifyContent:"flex-start",width:"100%"},size:"small",disabled:!0,children:i(t,{noWrap:!0,sx:{fontSize:"small",pl:"10px",alignSelf:"center",width:"auto"},children:A?.text||"Sezione"})}),j[49]=M,j[50]=A,j[51]=ne,j[52]=U,j[53]=E,j[54]=ge):ge=j[54],j[55]!==Ie||j[56]!==ge?(Se=r(y,{sx:be,children:[Ie,ge]}),j[55]=Ie,j[56]=ge,j[57]=Se):Se=j[57],j[58]===Symbol.for("react.memo_cache_sentinel")?(Ce=i(z,{}),j[58]=Ce):Ce=j[58],j[59]===Symbol.for("react.memo_cache_sentinel")?(we={py:2,px:3},j[59]=we):we=j[59],j[60]===Symbol.for("react.memo_cache_sentinel")?(ve=i(f,{size:14}),j[60]=ve):ve=j[60],j[61]!==fe||j[62]!==E?(ze=E&&_(E).map(fe),j[61]=fe,j[62]=E,j[63]=ze):ze=j[63],j[64]!==Q||j[65]!==E?(Te=E&&i(t,{sx:{color:"text.primary",fontSize:"small"},children:"0"===E.id?Q:E.text}),j[64]=Q,j[65]=E,j[66]=Te):Te=j[66],j[67]!==ze||j[68]!==Te?(ke=r(w,{"aria-label":"breadcrumb",separator:ve,children:[ze,Te]}),j[67]=ze,j[68]=Te,j[69]=ke):ke=j[69],j[70]!==M||j[71]!==A||j[72]!==ie||j[73]!==H||j[74]!==ne||j[75]!==J||j[76]!==U||j[77]!==E?(je=E&&r(y,{direction:"row",spacing:2,sx:{justifyContent:"space-between",pt:2},children:[i(y,{sx:{flexDirection:"row"},children:"select"!==M&&r(I,{"aria-label":"position-select",children:[i(T,{id:"position-label",children:"Posizione"}),r(S,{size:"small",label:"Posizione",disabled:!U,value:U||E.id===A?.parent().id?J:"last",onChange:e=>K(e.target.value),sx:{width:100},children:[i(g,{value:"before",children:"Prima"},"before"),i(g,{value:"after",children:"Dopo"},"after"),!U&&i(g,{value:"last",children:"Ultimo"},"last")]})]})}),r(y,{sx:{flexDirection:"row",alignItems:"center"},children:[i(m,{color:"secondary",onClick:H,children:"Annulla"}),i(m,{sx:{ml:1},variant:"contained",color:"primary",disabled:!ne(E),onClick:ie,children:M?P[M]:"Seleziona"})]})]}),j[70]=M,j[71]=A,j[72]=ie,j[73]=H,j[74]=ne,j[75]=J,j[76]=U,j[77]=E,j[78]=je):je=j[78],j[79]!==ke||j[80]!==je?(We=r(y,{sx:we,children:[ke,je]}),j[79]=ke,j[80]=je,j[81]=We):We=j[81],j[82]!==he||j[83]!==ye||j[84]!==Se||j[85]!==We?(_e=r(y,{component:"div","aria-label":"hierarchy-editor-window",children:[he,ye,xe,Se,Ce,We]}),j[82]=he,j[83]=ye,j[84]=Se,j[85]=We,j[86]=_e):_e=j[86],_e}function F(e){return"check"===e.type}function M(t){const r=e(14),{question:o,editorState:l,open:a,closeModal:m,selectableItemTypes:c,disabledItems:p}=t;if(!o)return null;let s;r[0]!==m||r[1]!==l||r[2]!==o?(s=async e=>{let t=e.nextIndex;e.currentContainerId===e.nextContainer.id&&e.currentIndex<e.nextIndex?"before"===e.placement&&(t-=1):t+="after"===e.placement?1:0;const i=x(o.parent())===b.cond.type?o.parent():o;await l.moveItem(i,t,e.nextContainer.id),m(),l.createHistorySnapshot()},r[0]=m,r[1]=l,r[2]=o,r[3]=s):s=r[3];const d=s;let u,f;return r[4]!==m||r[5]!==p||r[6]!==d||r[7]!==o||r[8]!==c?(u=i(A,{currentItem:o,currentAction:"move",selectableItemTypes:c,disabledItems:p,handleCancel:m,handleConfirm:d}),r[4]=m,r[5]=p,r[6]=d,r[7]=o,r[8]=c,r[9]=u):u=r[9],r[10]!==m||r[11]!==a||r[12]!==u?(f=i(n,{open:a,onClose:m,minWidth:"520px",width:"50vw",maxWidth:"720px",children:u}),r[10]=m,r[11]=a,r[12]=u,r[13]=f):f=r[13],f}function H(t){const r=e(13),{question:o,editorState:l,open:a,closeModal:m,selectableItemTypes:c,disabledItems:p}=t;if(!o)return null;let s;r[0]!==m||r[1]!==l?(s=async e=>{const t=e.nextIndex+("after"===e.placement?1:0);await l.duplicateItem(e.currentItem,e.nextContainer,t),m(),l.createHistorySnapshot()},r[0]=m,r[1]=l,r[2]=s):s=r[2];const d=s;let u,f;return r[3]!==m||r[4]!==p||r[5]!==d||r[6]!==o||r[7]!==c?(u=i(A,{currentItem:o,currentAction:"duplicate",selectableItemTypes:c,disabledItems:p,handleCancel:m,handleConfirm:d}),r[3]=m,r[4]=p,r[5]=d,r[6]=o,r[7]=c,r[8]=u):u=r[8],r[9]!==m||r[10]!==a||r[11]!==u?(f=i(n,{open:a,onClose:m,minWidth:"520px",width:"50vw",maxWidth:"720px",children:u}),r[9]=m,r[10]=a,r[11]=u,r[12]=f):f=r[12],f}function $(t){const r=e(13),{question:o,open:l,closeModal:a,select:m,selectableItemTypes:c,disabledItems:p}=t,s=x(o)===b.cond.type?o.items[0]:o;let d,u,f;return r[0]!==a||r[1]!==m?(d=e=>{m(e),a()},r[0]=a,r[1]=m,r[2]=d):d=r[2],r[3]!==a||r[4]!==s||r[5]!==p||r[6]!==c||r[7]!==d?(u=i(A,{currentItem:s,currentAction:"select",selectableItemTypes:c,disabledItems:p,handleCancel:a,handleConfirm:d}),r[3]=a,r[4]=s,r[5]=p,r[6]=c,r[7]=d,r[8]=u):u=r[8],r[9]!==a||r[10]!==l||r[11]!==u?(f=i(n,{open:l,onClose:a,minWidth:"520px",width:"50vw",maxWidth:"720px",children:u}),r[9]=a,r[10]=l,r[11]=u,r[12]=f):f=r[12],f}export{A as Hierarchy,H as RenderDuplicateModal,M as RenderMoveModal,$ as RenderSelectModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"react";import{jsx as t,Fragment as r,jsxs as o}from"react/jsx-runtime";import{useEditorStateContext as i}from"../../providers/editor/EditorStateProvider.js";import n from"@mui/material/List";import m from"@mui/material/ListItemButton";import a from"@mui/material/ListItemIcon";import s from"@mui/material/ListItemText";import l from"@mui/material/Skeleton";import c from"@mui/material/Tooltip";import{CircleCheck as p,UndoDotIcon as d}from"lucide-react";import{ResponsiveDrawer as h}from"../../components/common/ResponsiveDrawer.js";const u=l=>{const u=e(21),{open:g,onClose:S,historySnapshots:v}=l,{editorState:C}=i();let y;u[0]!==C||u[1]!==S?(y=async e=>{S(),C.getCurrentSnapshot()!==e&&await C.restoreHistorySnapshot(e)},u[0]=C,u[1]=S,u[2]=y):y=u[2];const w=y;let x;if(u[3]!==C||u[4]!==w||u[5]!==v){let e;u[7]!==C||u[8]!==w?(e=(e,r)=>{return t(c,{open:C.getCurrentSnapshot()!==e&&void 0,title:"Ripristina Versione",placement:"left",arrow:!0,children:o(m,{sx:{cursor:C.getCurrentSnapshot()===e?"default":"pointer",mx:1},onClick:()=>w(e),children:[t(a,{children:C.getCurrentSnapshot()===e?t(p,{size:20,color:"green"}):t(d,{size:20})}),t(s,{primary:`${i=e,new Date(i).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})} ${C.getCurrentSnapshot()===e?"(corrente)":""}`})]})},r);var i},u[7]=C,u[8]=w,u[9]=e):e=u[9],x=v.slice().reverse().map(e),u[3]=C,u[4]=w,u[5]=v,u[6]=x}else x=u[6];const L=x;let b,I,_,j,k;return u[10]===Symbol.for("react.memo_cache_sentinel")?(b={disablePortal:!1,keepMounted:!1},u[10]=b):b=u[10],u[11]===Symbol.for("react.memo_cache_sentinel")?(I={width:350,pt:0},u[11]=I):I=u[11],u[12]!==L||u[13]!==v?(_=v?0===v.length?t(m,{children:t(s,{primary:"Nessuna modifica recente"})}):L:t(r,{children:Array.from({length:5}).map(f)}),u[12]=L,u[13]=v,u[14]=_):_=u[14],u[15]!==_?(j=t(n,{dense:!0,sx:I,children:_}),u[15]=_,u[16]=j):j=u[16],u[17]!==S||u[18]!==g||u[19]!==j?(k=t(h,{anchor:"right",title:"Storico Cambiamenti",open:g,onClose:S,ModalProps:b,children:j}),u[17]=S,u[18]=g,u[19]=j,u[20]=k):k=u[20],k};function f(e,r){return t(m,{children:t(l,{variant:"text",width:100,height:20,animation:"wave"})},r)}export{u as SnapshotDrawer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import"react";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useEditorStateContext as o}from"../../providers/editor/EditorStateProvider.js";import r from"@mui/material/Card";import n from"@mui/material/CardActionArea";import a from"@mui/material/CardContent";import c from"@mui/material/CardMedia";import m from"@mui/material/Grid";import l from"@mui/material/Paper";import d from"@mui/material/Typography";import{Sparkles as p,Plus as s,LayoutPanelLeft as u,Import as f}from"lucide-react";const h=h=>{const g=e(16),{setSelectCreate:C,setFirstQuestionTab:b}=h,{editorConfig:y}=o();let x;g[0]!==b||g[1]!==C?(x=e=>{b(e),C(!1)},g[0]=b,g[1]=C,g[2]=x):x=g[2];const v=x;let S,z,k,_,j;g[3]===Symbol.for("react.memo_cache_sentinel")?(S={type:"add",title:"Parti da zero",description:"Crea da un elenco di tipi di contenuto disponibili",icon:t(s,{style:{fontSize:"2.5rem"}}),backgroundColor:"#d4ebfd"},g[3]=S):S=g[3],g[4]===Symbol.for("react.memo_cache_sentinel")?(z={type:"template",title:"Crea da Template",description:"Scegli un template da cui iniziare",icon:t(u,{size:34}),backgroundColor:"#c1f1d0"},g[4]=z):z=g[4],g[5]===Symbol.for("react.memo_cache_sentinel")?(k={type:"import",title:"Importa Domande",description:"Copia e incolla le tue domande o importa un file",icon:t(f,{size:34}),backgroundColor:"#fae8c8"},g[5]=k):k=g[5],g[6]!==y.aiFeatures?(_="disabled"!==y.aiFeatures&&{3:{type:"create",title:"Crea con l'AI",description:"Genera domande con l'AI e trova ispirazione",icon:t(p,{style:{fontSize:"2.5rem"}}),backgroundColor:"#f4e4fc"}},g[6]=y.aiFeatures,g[7]=_):_=g[7],g[8]!==_?(j={0:S,1:z,2:k,..._},g[8]=_,g[9]=j):j=g[9];const I=j;let A,F,w;return g[10]===Symbol.for("react.memo_cache_sentinel")?(A={justifyContent:"center",alignItems:"center",minHeight:"70vh",gap:{xs:2,md:3,lg:4}},g[10]=A):A=g[10],g[11]!==I?(F=Object.values(I),g[11]=I,g[12]=F):F=g[12],g[13]!==v||g[14]!==F?(w=t(m,{container:!0,size:12,sx:A,children:F.map((e,o)=>t(m,{children:t(r,{component:l,variant:"outlined",onClick:()=>v(e.type),sx:{width:"300px",height:"300px",border:"1px solid rgba(0, 0, 0, 0.12) !important",backgroundColor:"white",borderRadius:
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"react";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useEditorStateContext as o}from"../../providers/editor/EditorStateProvider.js";import r from"@mui/material/Card";import n from"@mui/material/CardActionArea";import a from"@mui/material/CardContent";import c from"@mui/material/CardMedia";import m from"@mui/material/Grid";import l from"@mui/material/Paper";import d from"@mui/material/Typography";import{Sparkles as p,Plus as s,LayoutPanelLeft as u,Import as f}from"lucide-react";const h=h=>{const g=e(16),{setSelectCreate:C,setFirstQuestionTab:b}=h,{editorConfig:y}=o();let x;g[0]!==b||g[1]!==C?(x=e=>{b(e),C(!1)},g[0]=b,g[1]=C,g[2]=x):x=g[2];const v=x;let S,z,k,_,j;g[3]===Symbol.for("react.memo_cache_sentinel")?(S={type:"add",title:"Parti da zero",description:"Crea da un elenco di tipi di contenuto disponibili",icon:t(s,{style:{fontSize:"2.5rem"}}),backgroundColor:"#d4ebfd"},g[3]=S):S=g[3],g[4]===Symbol.for("react.memo_cache_sentinel")?(z={type:"template",title:"Crea da Template",description:"Scegli un template da cui iniziare",icon:t(u,{size:34}),backgroundColor:"#c1f1d0"},g[4]=z):z=g[4],g[5]===Symbol.for("react.memo_cache_sentinel")?(k={type:"import",title:"Importa Domande",description:"Copia e incolla le tue domande o importa un file",icon:t(f,{size:34}),backgroundColor:"#fae8c8"},g[5]=k):k=g[5],g[6]!==y.aiFeatures?(_="disabled"!==y.aiFeatures&&{3:{type:"create",title:"Crea con l'AI",description:"Genera domande con l'AI e trova ispirazione",icon:t(p,{style:{fontSize:"2.5rem"}}),backgroundColor:"#f4e4fc"}},g[6]=y.aiFeatures,g[7]=_):_=g[7],g[8]!==_?(j={0:S,1:z,2:k,..._},g[8]=_,g[9]=j):j=g[9];const I=j;let A,F,w;return g[10]===Symbol.for("react.memo_cache_sentinel")?(A={justifyContent:"center",alignItems:"center",minHeight:"70vh",gap:{xs:2,md:3,lg:4}},g[10]=A):A=g[10],g[11]!==I?(F=Object.values(I),g[11]=I,g[12]=F):F=g[12],g[13]!==v||g[14]!==F?(w=t(m,{container:!0,size:12,sx:A,children:F.map((e,o)=>t(m,{children:t(r,{component:l,variant:"outlined",onClick:()=>v(e.type),sx:{width:"300px",height:"300px",border:"1px solid rgba(0, 0, 0, 0.12) !important",backgroundColor:"white",borderRadius:3},children:t(n,{sx:{height:"100%"},children:i(a,{component:m,container:!0,direction:"column",justifyContent:"center",alignItems:"center",gap:3,children:[t(c,{component:m,container:!0,color:"primary",justifyContent:"flex-start",alignContent:"center",width:"min-content",sx:{backgroundColor:e.backgroundColor,padding:"12px",borderRadius:1},children:e.icon}),t(d,{variant:"h5",component:"div",sx:{fontWeight:"bold"},children:e.title}),t(d,{component:"div",align:"center",variant:"subtitle1",sx:{color:"text.secondary",fontSize:14},children:e.description})]})})})},`${e.title}${o}`))}),g[13]=v,g[14]=F,g[15]=w):w=g[15],w};export{h as SurveyNewCreation};
|