ode-explorer 1.0.0-dev.202307131701 → 1.0.0-develop-pedago.202307262104

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/Card.js CHANGED
@@ -1 +1 @@
1
- import{r as R,f as a,j as s,t as B,ae as E,af as F,I as q,a8 as G,q as U,ag as D,ah as H,ai as J,aj as K}from"./index.js";import{T as n}from"./Tooltip.js";const d=R.forwardRef(({app:l,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:t=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:i="",updatedAt:v="2 days ago",userSrc:o="",onOpen:u,onSelect:c,messagePublic:N,messageShared:f,...$},b)=>{const{getIconCode:w}=K(),C=a("card",{"placeholder-glow":e,"is-selected":m,"is-animated":x},h),y=a("card-title body text-break text-truncate text-truncate--2 pe-32",{placeholder:e}),I=a("card-text small",{placeholder:e}),O=a("small text-truncate",{placeholder:e}),z=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=l?w(l):"placeholder",k=a(`color-app-${T}`,{placeholder:e});function A(P){P.stopPropagation(),c==null||c()}return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(B,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(E,{}),onClick:A,variant:"ghost"}),s.jsx("button",{onClick:u,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"}),s.jsxs("div",{className:"card-body",children:[t?s.jsx(F,{width:"48",height:"48",className:k}):i?s.jsx("div",{className:"card-image",children:s.jsx(q,{alt:"",src:i,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(G,{app:l,iconFit:"ratio",size:"80",variant:"rounded"}),s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),t?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:v})})]})]}),t?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:z,children:[o?s.jsx(U,{alt:r,size:"xs",src:o,variant:"circle",width:"24",height:"24"}):s.jsx(D,{}),s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(n,{message:N,placement:"top",children:s.jsx(H,{width:16,height:16})}),p&&s.jsx(n,{message:f,placement:"top",children:s.jsx(J,{width:16,height:16})})]})]})]})});d.displayName="Card";const S=d;export{S as C};
1
+ import{r as R,d as a,j as s,q as B,ac as E,ad as F,I as q,a6 as G,n as U,ae as D,af as H,ag as J,ah as K}from"./index.js";import{T as n}from"./Tooltip.js";const d=R.forwardRef(({app:l,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:t=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:i="",updatedAt:v="2 days ago",userSrc:o="",onOpen:u,onSelect:c,messagePublic:N,messageShared:f,...$},b)=>{const{getIconCode:w}=K(),C=a("card",{"placeholder-glow":e,"is-selected":m,"is-animated":x},h),y=a("card-title body text-break text-truncate text-truncate--2 pe-32",{placeholder:e}),I=a("card-text small",{placeholder:e}),O=a("small text-truncate",{placeholder:e}),z=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=l?w(l):"placeholder",k=a(`color-app-${T}`,{placeholder:e});function A(P){P.stopPropagation(),c==null||c()}return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(B,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(E,{}),onClick:A,variant:"ghost"}),s.jsx("button",{onClick:u,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":"Open resource"}),s.jsxs("div",{className:"card-body",children:[t?s.jsx(F,{width:"48",height:"48",className:k}):i?s.jsx("div",{className:"card-image",children:s.jsx(q,{alt:"",src:i,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(G,{app:l,iconFit:"ratio",size:"80",variant:"rounded"}),s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),t?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:v})})]})]}),t?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:z,children:[o?s.jsx(U,{alt:r,size:"xs",src:o,variant:"circle",width:"24",height:"24"}):s.jsx(D,{}),s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(n,{message:N,placement:"top",children:s.jsx(H,{width:16,height:16})}),p&&s.jsx(n,{message:f,placement:"top",children:s.jsx(J,{width:16,height:16})})]})]})]})});d.displayName="Card";const S=d;export{S as C};
@@ -1 +1 @@
1
- import{a as d,z as x,C as p,D as u,m,p as j,b as y,j as e,M as n,B as i}from"./index.js";function f({onSuccess:o}){const{t:l}=d(),s=x(),t=p(),r=u(),{hotToast:a}=m(j);async function c(){try{r?(await s.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),o==null||o()}catch(h){console.error(h)}}return{isTrashFolder:r,onDelete:c}}function M({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=f({onSuccess:l});return y.createPortal(e.jsxs(n,{isOpen:o,onModalClose:s,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:s,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"primary",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{M as default};
1
+ import{a as d,x as h,y as u,z as p,k as m,m as y,b as j,j as e,M as n,B as i}from"./index.js";function f({onSuccess:o}){const{t:l}=d(),s=h(),t=u(),r=p(),{hotToast:a}=m(y);async function c(){try{r?(await s.mutate(),a.success(l("explorer.removed.from.trash"))):(await t.mutate(),a.success(l("explorer.trash.title"))),o==null||o()}catch(x){console.error(x)}}return{isTrashFolder:r,onDelete:c}}function T({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=f({onSuccess:l});return j.createPortal(e.jsxs(n,{isOpen:o,onModalClose:s,id:"deleteModal",children:[e.jsx(n.Header,{onModalClose:s,children:t(r?"explorer.delete.title":"explorer.trash.title")}),e.jsx(n.Body,{children:e.jsx("p",{className:"body",children:t(r?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),e.jsxs(n.Footer,{children:[e.jsx(i,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:t("explorer.cancel")}),e.jsx(i,{color:"primary",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{T as default};
@@ -1 +1 @@
1
- import{G as D,N as B,O as q,P as L,r as C,Q as R,a as U,b as w,j as r,M as s,F as P,U as T,y as V,B as y}from"./index.js";import{u as _}from"./index.esm.js";function k({edit:a,onSuccess:e,onClose:i}){var F;const l=D(),t=B(),m=q(),c=L(),u=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:n,setFocus:p,formState:{errors:x,isSubmitting:h,isDirty:I,isValid:E}}=_({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name:b}){var j;try{if(a){const d=(j=l[0])==null?void 0:j.parentId,$=l[0].id;await c.mutate({folderId:$,parentId:d,name:b}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||R.DEFAULT;await m.mutate({name:b,parentId:d}),o(),e==null||e()}}catch(d){console.error(d)}};function v(){o(),i()}return{formId:`createModal_${g}`,errors:x,isSubmitting:h,isDirty:I,isValid:E,register:f,setFocus:p,handleSubmit:n,onCancel:v,onSubmit:M}}function N({isOpen:a,edit:e,onSuccess:i,onCancel:l}){const{t}=U(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:n,handleSubmit:p,register:x,setFocus:h}=k({edit:e,onSuccess:i,onClose:l});return C.useEffect(()=>{a&&h("name")},[a]),w.createPortal(r.jsxs(s,{isOpen:a,onModalClose:n,id:"modal_"+o,children:[r.jsx(s.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(s.Body,{children:r.jsx("form",{id:o,onSubmit:p(f),children:r.jsxs(P,{id:"nameFolder",isRequired:!0,children:[r.jsx(T,{children:t("explorer.create.folder.name")}),r.jsx(V,{type:"text",...x("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{N as default};
1
+ import{D as $,J as B,K as q,N as w,r as C,O as L,a as R,b as P,j as r,M as s,F as T,P as U,w as V,B as y}from"./index.js";import{u as _}from"./index.esm.js";function k({edit:a,onSuccess:e,onClose:i}){var F;const l=$(),t=B(),m=q(),c=w(),u=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:n,setFocus:p,formState:{errors:x,isSubmitting:h,isDirty:I,isValid:E}}=_({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name:b}){var j;try{if(a){const d=(j=l[0])==null?void 0:j.parentId,D=l[0].id;await c.mutate({folderId:D,parentId:d,name:b}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||L.DEFAULT;await m.mutate({name:b,parentId:d}),o(),e==null||e()}}catch(d){console.error(d)}};function v(){o(),i()}return{formId:`createModal_${g}`,errors:x,isSubmitting:h,isDirty:I,isValid:E,register:f,setFocus:p,handleSubmit:n,onCancel:v,onSubmit:M}}function K({isOpen:a,edit:e,onSuccess:i,onCancel:l}){const{t}=R(),{isDirty:m,isValid:c,isSubmitting:u,formId:o,onSubmit:f,onCancel:n,handleSubmit:p,register:x,setFocus:h}=k({edit:e,onSuccess:i,onClose:l});return C.useEffect(()=>{a&&h("name")},[a]),P.createPortal(r.jsxs(s,{isOpen:a,onModalClose:n,id:"modal_"+o,children:[r.jsx(s.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(s.Body,{children:r.jsx("form",{id:o,onSubmit:p(f),children:r.jsxs(T,{id:"nameFolder",isRequired:!0,children:[r.jsx(U,{children:t("explorer.create.folder.name")}),r.jsx(V,{type:"text",...x("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(s.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{K as default};
@@ -1 +1 @@
1
- import{a as B,j as e,H as A,p as E,F as m,y as P,W as G,B as T,X as J,k as K,i as z,r as p,m as Q,u as ee,Y as se,b as te,M as C,U as F,Z as le}from"./index.js";import{I as ae}from"./ImagePicker.js";import{u as re}from"./index.esm.js";const oe=({appCode:d,correctSlug:a,disableSlug:n,onPublicChange:r,onSlugChange:x,refPublic:c,refSlug:j,register:s,resource:h,slug:u,onCopyToClipBoard:g})=>{const{t:o}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(E,{type:"info",children:o("explorer.resource.editModal.access.alert")}),e.jsxs(m,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(m.Input,{type:"checkbox",role:"switch",...s("enablePublic",{value:h.public,onChange:i=>r(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(m.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(m,{id:"slug",status:a?"invalid":void 0,children:e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[e.jsxs("div",{children:[window.location.origin,window.location.pathname,"/pub/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...s("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:u,onChange:i=>x(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},j),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(G,{children:o("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:n,onClick:()=>{g()},type:"button",leftIcon:e.jsx(J,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})})]})};function ie({resource:d,onSuccess:a,onCancel:n}){const{t:r}=B(),x=K(),c=z(),{reset:j,register:s,handleSubmit:h,setFocus:u,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=p.useId(),[M,b]=p.useState(new Date().getTime()),[$,k]=p.useState(!d.public),[f,v]=p.useState(d.slug||""),[N,S]=p.useState(!1),{hotToast:y}=Q(E),[R,l]=p.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(v(""),b(new Date().getTime()))}function V(t){if(!t)return"";const w="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",W="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",X=new RegExp(w.split("").join("|"),"g"),Y=t.toString().toLowerCase().replace(/\s+/g,"-").replace(X,Z=>W.charAt(w.indexOf(Z))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");v(Y)}const q=async function(t){try{await x.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),S(!1),y.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",t.title]}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{children:["Public:"," ",t.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(w){S(!0),console.error(w)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${f}`),y.success(r("explorer.copy.clipboard"))}function H(){j(),n()}const O=`resource_edit_modal_${I}`;return{slug:f,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,setFocus:u,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function ue({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:x,currentApp:c}=ee(),s=z()[0],{slug:h,formId:u,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:f,handleDeleteImage:v,onCopyToClipBoard:N,onSlugChange:S,onPublicChange:y}=ie({resource:s,onSuccess:n,onCancel:r}),{data:R}=se(),{t:l}=B();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:l(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:u,onSubmit:$(k),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(ae,{app:c,src:s==null?void 0:s.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:f,onDeleteImage:v,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(m,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:l("title")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(m,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),le({workflow:"createPublic",actions:R})&&e.jsx(oe,{appCode:x,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:y,onSlugChange:S,resource:s,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:u,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
1
+ import{a as B,j as e,m as A,F as m,w as R,Q as J,B as T,U as K,h as Y,g as E,r as p,k as Z,u as ee,W as se,b as te,M as C,P as F,X as le}from"./index.js";import{H as z}from"./Heading.js";import{I as ae}from"./ImagePicker.js";import{u as re}from"./index.esm.js";const oe=({appCode:d,correctSlug:a,disableSlug:n,onPublicChange:r,onSlugChange:x,refPublic:c,refSlug:f,register:s,resource:h,slug:u,onCopyToClipBoard:g})=>{const{t:o}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(z,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(A,{type:"info",children:o("explorer.resource.editModal.access.alert")}),e.jsxs(m,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(m.Input,{type:"checkbox",role:"switch",...s("enablePublic",{value:h.public,onChange:i=>r(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(m.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(m,{id:"slug",status:a?"invalid":void 0,children:e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[e.jsxs("div",{children:[window.location.origin,window.location.pathname,"/pub/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(R,{type:"text",...s("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:u,onChange:i=>x(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},f),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(J,{children:o("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:n,onClick:()=>{g()},type:"button",leftIcon:e.jsx(K,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})})]})};function ie({resource:d,onSuccess:a,onCancel:n}){const{t:r}=B(),x=Y(),c=E(),{reset:f,register:s,handleSubmit:h,setFocus:u,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=p.useId(),[M,b]=p.useState(new Date().getTime()),[$,k]=p.useState(!d.public),[j,v]=p.useState(d.slug||""),[N,S]=p.useState(!1),{hotToast:w}=Z(A),[P,l]=p.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(v(""),b(new Date().getTime()))}function V(t){if(!t)return"";const y="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",Q="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",W=new RegExp(y.split("").join("|"),"g"),X=t.toString().toLowerCase().replace(/\s+/g,"-").replace(W,G=>Q.charAt(y.indexOf(G))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");v(X)}const q=async function(t){try{await x.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:P.image}),S(!1),w.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",t.title]}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{children:["Public:"," ",t.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(y){S(!0),console.error(y)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${j}`),w.success(r("explorer.copy.clipboard"))}function H(){f(),n()}const O=`resource_edit_modal_${I}`;return{slug:j,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,setFocus:u,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function pe({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:x,currentApp:c}=ee(),s=E()[0],{slug:h,formId:u,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:j,handleDeleteImage:v,onCopyToClipBoard:N,onSlugChange:S,onPublicChange:w}=ie({resource:s,onSuccess:n,onCancel:r}),{data:P}=se(),{t:l}=B();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:l(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(z,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:u,onSubmit:$(k),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(ae,{app:c,src:s==null?void 0:s.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:j,onDeleteImage:v,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(m,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:l("title")}),e.jsx(R,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(m,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(R,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),le({workflow:"createPublic",actions:P})&&e.jsx(oe,{appCode:x,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:w,onSlugChange:S,resource:s,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:u,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{pe as default};
@@ -1 +1 @@
1
- import{j as e,H as n}from"./index.js";const c=({imageSrc:s,imageAlt:t="",title:a,text:m})=>e.jsxs("div",{className:"emptyscreen",children:[s&&e.jsx("div",{className:"emptyscreen-image mb-12",children:e.jsx("img",{className:"mx-auto",src:s,alt:t,width:"250",height:"250"})}),a&&e.jsx(n,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),m&&e.jsx("div",{className:"text",children:m})]});c.displayName="EmptyScreen";const r=c;export{r as E};
1
+ import{j as e}from"./index.js";import{H as r}from"./Heading.js";const c=({imageSrc:s,imageAlt:t="",title:a,text:m})=>e.jsxs("div",{className:"emptyscreen",children:[s&&e.jsx("div",{className:"emptyscreen-image mb-12",children:e.jsx("img",{className:"mx-auto",src:s,alt:t,width:"250",height:"250"})}),a&&e.jsx(r,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),m&&e.jsx("div",{className:"text",children:m})]});c.displayName="EmptyScreen";const l=c;export{l as E};
@@ -1 +1 @@
1
- import{u as i,a as n,Y as a,j as c}from"./index.js";import{E as u}from"./EmptyScreen.js";function b(){const{appCode:o,theme:e}=i(),{t:r}=n(),{data:l}=a(),t=l==null?void 0:l.find(s=>s.id==="create"),p=()=>t!=null&&t.available&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):t!=null&&t.available&&!(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(t!=null&&t.available)&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return c.jsx(u,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${t!=null&&t.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{b as default};
1
+ import{u as i,a as n,W as a,j as c}from"./index.js";import{E as u}from"./EmptyScreen.js";import"./Heading.js";function b(){const{appCode:o,theme:e}=i(),{t:r}=n(),{data:l}=a(),t=l==null?void 0:l.find(s=>s.id==="create"),p=()=>t!=null&&t.available&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):t!=null&&t.available&&!(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(t!=null&&t.available)&&(e!=null&&e.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return c.jsx(u,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${t!=null&&t.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{b as default};
@@ -1 +1 @@
1
- import{u as r,a as n,j as o}from"./index.js";import{E as s}from"./EmptyScreen.js";function m(){const{theme:e}=r(),{t}=n();return o.jsx(s,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:t("explorer.emptyScreen.folder.empty.alt"),text:t("explorer.emptyScreen.label")})}export{m as default};
1
+ import{u as r,a as o,j as n}from"./index.js";import{E as s}from"./EmptyScreen.js";import"./Heading.js";function p(){const{theme:e}=r(),{t}=o();return n.jsx(s,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:t("explorer.emptyScreen.folder.empty.alt"),text:t("explorer.emptyScreen.label")})}export{p as default};
@@ -1 +1 @@
1
- import{u as r,a,j as n}from"./index.js";import{E as o}from"./EmptyScreen.js";function i(){const{appCode:s}=r(),{theme:e}=r(),{t}=a();return n.jsx(o,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-trash.svg`,imageAlt:t("explorer.emptyScreen.trash.alt"),title:t("explorer.emptyScreen.trash.title"),text:t("explorer.emptyScreen.trash.empty",{ns:s})})}export{i as default};
1
+ import{u as r,a,j as o}from"./index.js";import{E as p}from"./EmptyScreen.js";import"./Heading.js";function l(){const{appCode:s}=r(),{theme:e}=r(),{t}=a();return o.jsx(p,{imageSrc:`${e==null?void 0:e.bootstrapPath}/images/emptyscreen/illu-trash.svg`,imageAlt:t("explorer.emptyScreen.trash.alt"),title:t("explorer.emptyScreen.trash.title"),text:t("explorer.emptyScreen.trash.empty",{ns:s})})}export{l as default};
@@ -1 +1 @@
1
- import{u as h,a9 as j,G as f,aa as y,c as C,ab as I,ac as T,j as i,$ as a}from"./index.js";import{C as b}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const $=()=>{var r,d;const{currentApp:p}=h(),{data:e,isFetching:u}=j(),l=f(),o=y(),{setSelectedFolders:n,setFolderIds:c,openFolder:m}=C();function g(s){o.includes(s.id)?(c(o.filter(t=>t!==s.id)),n(l.filter(t=>t.id!==s.id))):(c([...o,s.id]),n([...l,s]))}const F=I({from:{opacity:0},to:{opacity:1}}),S=T();return(r=e==null?void 0:e.pages[0])!=null&&r.folders.length?i.jsx(a.ul,{className:"grid ps-0 list-unstyled mb-24",children:(d=e==null?void 0:e.pages[0])==null?void 0:d.folders.map(s=>{const{id:t,name:x}=s;return i.jsx(a.li,{className:"g-col-4",style:{...F},children:i.jsx(b,{app:p,name:x,isFolder:!0,isLoading:u,isSelected:o.includes(s.id),onOpen:()=>{S(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},t)})}):null};export{$ as default};
1
+ import{u as h,a7 as j,D as f,a8 as y,E as C,a9 as I,aa as T,j as i,Z as a}from"./index.js";import{C as A}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const b=()=>{var c,d;const{currentApp:p}=h(),{data:e,isFetching:u}=j(),l=f(),o=y(),{setSelectedFolders:n,setFolderIds:r,openFolder:m}=C();function g(s){o.includes(s.id)?(r(o.filter(t=>t!==s.id)),n(l.filter(t=>t.id!==s.id))):(r([...o,s.id]),n([...l,s]))}const F=I({from:{opacity:0},to:{opacity:1}}),S=T();return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?i.jsx(a.ul,{className:"grid ps-0 list-unstyled mb-24",children:(d=e==null?void 0:e.pages[0])==null?void 0:d.folders.map(s=>{const{id:t,name:x}=s;return i.jsx(a.li,{className:"g-col-4",style:{...F},children:i.jsx(A,{app:p,name:x,isFolder:!0,isLoading:u,isSelected:o.includes(s.id),onOpen:()=>{S(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},t)})}):null};export{b as default};
@@ -0,0 +1 @@
1
+ import{r as d,d as i,j as l}from"./index.js";const s=d.forwardRef(({level:a="h1",headingStyle:e="h1",children:r,className:t,...o},n)=>{const c=i(e,t);return l.jsx(a,{ref:n,className:c,...o,children:r})});s.displayName="Heading";const m=s;export{m as H};
@@ -1 +1 @@
1
- import{r as s,f as R,j as a,F as d,t as p,a6 as L,a7 as E,y as N,q as S,a8 as z}from"./index.js";const u=s.forwardRef(({label:h,addButtonLabel:x="Add image",deleteButtonLabel:v="Delete image",src:j,className:f,app:D,onUploadImage:C,onDeleteImage:I},P)=>{const r=s.useRef(null),[n,o]=s.useState({name:"",image:j||""}),[,l]=s.useState(!1),c=e=>{o({...n,name:"",image:""});const t=e==null?void 0:e[0];if(!t)return;const i={...n,name:t.name,image:URL.createObjectURL(t)};o(i),C(i)},$=()=>{var e;(e=r.current)==null||e.click()},b=()=>{r.current&&(r.current.value="");const e={...n,name:"",image:""};o(e),I()},k=e=>{c(e.target.files)},g=e=>{e.preventDefault(),e.stopPropagation(),l(!0)},m=e=>{e.preventDefault(),e.stopPropagation(),l(!1)},w=e=>{var i;m(e);const t=(i=e.dataTransfer)==null?void 0:i.files;c(t),r.current&&t&&(r.current.files=t)},y=R("image-input",f);return a.jsxs(d,{id:"image-input",className:y,onDragEnter:g,onDragOver:g,onDragLeave:m,onDrop:w,ref:P,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(p,{"aria-label":x,color:"tertiary",icon:a.jsx(L,{}),onClick:$,type:"button",variant:"ghost"}),a.jsx(p,{"aria-label":v,color:"danger",disabled:!n.image,icon:a.jsx(E,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),a.jsxs(d.Label,{children:[a.jsx("span",{className:"visually-hidden",children:h}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:k,ref:r,size:"sm",type:"file"}),n.image?a.jsx(S,{alt:n.name,src:n.image,size:"xl"}):a.jsx(z,{app:D,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});u.displayName="ImagePicker";const F=u;export{F as I};
1
+ import{r as o,d as y,j as e,F as v,q as j,a4 as L,a5 as R,w as z,n as E,a6 as N}from"./index.js";const S=(r,d)=>{const[,l]=o.useState(!1),m=o.useCallback(a=>{a.preventDefault(),a.stopPropagation(),l(!0)},[]),c=a=>{a.preventDefault(),a.stopPropagation(),l(!1)};return{handleDragging:m,handleDragLeave:c,handleDrop:a=>{var g;c(a);const s=(g=a.dataTransfer)==null?void 0:g.files;d(s),r!=null&&r.current&&s&&(r.current.files=s)}}},A=S,C=o.forwardRef(({label:r,addButtonLabel:d="Add image",deleteButtonLabel:l="Delete image",src:m,className:c,app:a,onUploadImage:s,onDeleteImage:g},$)=>{const i=o.useRef(null),[t,p]=o.useState({name:"",image:m||""}),h=n=>{p({...t,name:"",image:""});const u=n==null?void 0:n[0];if(!u)return;const D={...t,name:u.name,image:URL.createObjectURL(u)};p(D),s(D)},b=()=>{var n;(n=i.current)==null||n.click()},k=()=>{i.current&&(i.current.value="");const n={...t,name:"",image:""};p(n),g()},w=n=>{h(n.target.files)},I=y("image-input",c),{handleDragging:x,handleDragLeave:P,handleDrop:f}=A(i,h);return e.jsxs(v,{id:"image-input",className:I,onDragEnter:x,onDragOver:x,onDragLeave:P,onDrop:f,ref:$,children:[e.jsxs("div",{className:"image-input-actions gap-8",children:[e.jsx(j,{"aria-label":d,color:"tertiary",icon:e.jsx(L,{}),onClick:b,type:"button",variant:"ghost"}),e.jsx(j,{"aria-label":l,color:"danger",disabled:!t.image,icon:e.jsx(R,{width:"20",height:"20"}),onClick:k,type:"button",variant:"ghost"})]}),e.jsxs(v.Label,{children:[e.jsx("span",{className:"visually-hidden",children:r}),e.jsx(z,{accept:"image/*",hidden:!0,onChange:w,ref:i,size:"sm",type:"file"}),t.image?e.jsx(E,{alt:t.name,src:t.image,size:"xl"}):e.jsx(N,{app:a,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const O=C;export{O as I};
package/dist/Library.js CHANGED
@@ -1 +1 @@
1
- import{r as n,j as r,I as c,B as x,d as m,a as d,e as p}from"./index.js";const t=n.forwardRef(({text:e,textButton:a,src:s,alt:i,url:l},o)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:o,className:"p-16",children:[r.jsx(c,{width:"270",height:"140",loading:"lazy",className:"rounded",src:s,alt:i}),r.jsx("p",{className:"m-8",children:e}),r.jsx("a",{href:l,target:"_blank",rel:"noreferrer",children:r.jsx(x,{rightIcon:r.jsx(m,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));t.displayName="Library";const g=t,y=({url:e})=>{const{t:a}=d(),{theme:s}=p();return r.jsx(g,{src:`${s==null?void 0:s.bootstrapPath}/images/image-library.svg`,url:e,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{y as default};
1
+ import{r as n,j as r,I as c,B as x,S as m,a as p,c as d}from"./index.js";const t=n.forwardRef(({text:e,textButton:a,src:s,alt:i,url:l},o)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:o,className:"p-16",children:[r.jsx(c,{width:"270",height:"140",loading:"lazy",className:"rounded",src:s,alt:i}),r.jsx("p",{className:"m-8",children:e}),r.jsx("a",{href:l,target:"_blank",rel:"noreferrer",children:r.jsx(x,{rightIcon:r.jsx(m,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));t.displayName="Library";const g=t,y=({url:e})=>{const{t:a}=p(),{theme:s}=d();return r.jsx(g,{src:`${s==null?void 0:s.bootstrapPath}/images/image-library.svg`,url:e,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{y as default};
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{r as p,E as v,G as T,i as M,c as y,J as b,a as j,K as F,b as S,j as o,M as n,T as w,B as h}from"./index.js";function E({onSuccess:a}){const[s,r]=p.useState(),l=v(),d=T(),c=M(),{foldTreeItem:i,unfoldTreeItem:m}=y(),u=b();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const I=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of c)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((x=t==null?void 0:t.folderIds)==null?void 0:x.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{I(e)?r(e):r(void 0)},handleTreeItemFold:i,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function g({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=j(),{handleTreeItemFold:d,handleTreeItemSelect:c,handleTreeItemUnfold:i,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:c,onTreeItemFold:d,onTreeItemUnfold:i})}),o.jsxs(n.Footer,{children:[o.jsx(h,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(h,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{g as default};
1
+ import{r as p,C as v,D as T,g as M,E as y,G as b,a as j,H as F,b as S,j as o,M as n,T as w,B as h}from"./index.js";function E({onSuccess:a}){const[s,r]=p.useState(),l=v(),d=T(),c=M(),{foldTreeItem:i,unfoldTreeItem:m}=y(),u=b();async function f(){try{if(!s)throw new Error("explorer.move.selection.empty");await l.mutate(s),await(a==null?void 0:a())}catch(e){console.error(e)}}const I=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of c)if(e===((t==null?void 0:t.folderIds)&&t.folderIds[0])||((x=t==null?void 0:t.folderIds)==null?void 0:x.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{I(e)?r(e):r(void 0)},handleTreeItemFold:i,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function B({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=j(),{handleTreeItemFold:d,handleTreeItemSelect:c,handleTreeItemUnfold:i,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=F();return S.createPortal(o.jsxs(n,{isOpen:a,onModalClose:r,id:"moveModal",children:[o.jsx(n.Header,{onModalClose:r,children:l("explorer.move.title")}),o.jsx(n.Subtitle,{children:l("explorer.move.subtitle")}),o.jsx(n.Body,{children:o.jsx(w,{data:f,onTreeItemSelect:c,onTreeItemFold:d,onTreeItemUnfold:i})}),o.jsxs(n.Footer,{children:[o.jsx(h,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(h,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{B as default};
@@ -1,2 +1,2 @@
1
- import{r as j,_ as ae,R as re,j as e,$ as te,f as D,a0 as se,a1 as le,a2 as ie,u as Y,i as K,m as ce,a3 as oe,c as ne,a4 as V,a5 as be,p as z,a as M,b as pe,M as S,H as F,F as y,U as L,y as P,B as H}from"./index.js";import{u as ue}from"./usePopper.js";import{S as W}from"./SelectList.js";import{I as de}from"./ImagePicker.js";import{u as me}from"./index.esm.js";const Q=({trigger:a,content:t})=>{const[s,l]=j.useState(null),[i,r]=j.useState(null),{styles:c,attributes:m}=ue(s,i,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[p,g]=j.useState(!1),u=ae(p,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),v=()=>{g(d=>!d)},b=re.cloneElement(a,{ref:l,onClick:v,state:p?"selected":"default"});return j.useEffect(()=>{const d=o=>{i&&!i.contains(o.target)&&s&&!s.contains(o.target)&&g(!1)};return document.addEventListener("mousedown",d,!0),document.addEventListener("touchstart",d,!0),()=>{document.removeEventListener("mousedown",d,!0),document.removeEventListener("touchstart",d,!0)}},[i,s]),e.jsxs(e.Fragment,{children:[b,u((d,o)=>e.jsx(e.Fragment,{children:o&&e.jsx(te.div,{className:D("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:r,style:{...c.popper,...d},...m.popper,children:t})}))]})};Q.displayName="Dropdown";const G=Q,X=j.forwardRef(({title:a="",state:t,variant:s,icon:l,size:i="lg",grow:r=!1,badgeContent:c,...m},p)=>{const g=D("dropdown-trigger",t,i,s,r&&"flex-grow-1 justify-content-between");return e.jsxs("button",{ref:p,className:g,...m,type:"button",children:[l&&e.jsx("div",{className:"dropdown-trigger-icon",children:l}),e.jsx("div",{children:a}),c?e.jsx("div",{children:e.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:c})}):e.jsx("div",{className:"dropdown-trigger-carret-icon",children:e.jsx(se,{width:16,height:16})})]})});X.displayName="DropdownTrigger";const J=X,ee=j.forwardRef(({options:a,model:t,disabled:s=!1,placeholderOption:l=!1,...i},r)=>{const{isRequired:c,status:m}=le(),p=j.useId(),g={...i,id:p,disabled:s,ref:r,className:D(i.className,"form-select c-pointer",{"is-invalid":m==="invalid","is-valid":m==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...g,required:c,children:[l&&e.jsx("option",{disabled:!0,selected:t===void 0,children:l}),a==null?void 0:a.map(u=>{const v=typeof u=="object"?u.value:u,b=typeof u=="object"?u.label:u;return e.jsx("option",{value:v,selected:t===v,children:b},v)})]})})});ee.displayName="Select";const $=ee,{http:C}=ie.instance();function he({onSuccess:a}){const{user:t,currentApp:s}=Y(),l=K(),[i,r]=j.useState({name:"",image:l[0].thumbnail}),[c,m]=j.useState(!1),{hotToast:p}=ce(z);oe();const{publishApi:g}=ne(),{register:u,handleSubmit:v,formState:{errors:b,isSubmitting:d,isDirty:o,isValid:O}}=me({mode:"onChange"}),[T,E]=j.useState([]),[f,I]=j.useState([]);function k(n){r(n)}const A=t?t==null?void 0:t.userId:"";return{selectedResources:l,register:u,handleSubmit:v,formState:{errors:b,isSubmitting:d,isDirty:o,isValid:O},publish:async n=>{try{m(!0);let x=new Blob;i.image?x=await C.get(i.image,{responseType:"blob"}):l[0].thumbnail&&(x=await C.get(l[0].thumbnail,{responseType:"blob"}));const _=await C.get(`/userbook/avatar/${A}?thumbnail=48x48`,{responseType:"blob"}),R=await C.get(`/directory/user/${A}/attachment-school`,{responseType:"json"});let N="";s!=null&&s.displayName&&(N=V(s==null?void 0:s.displayName));const h={activityType:T,age:[n.ageMin,n.ageMax],application:V(N),cover:x,description:n.description,keyWords:n.keyWords,language:n.language,licence:"CC-BY",resourceId:l[0].assetId,resourceEntId:l[0].assetId,subjectArea:f,teacherAvatar:_,title:n.title,userId:A,userStructureName:R.name||(t==null?void 0:t.structureNames[0])},w=[be.BLOG][0],U=await g(w,h);U.success?p.success(e.jsx(ge,{result:U}),{duration:1e4}):p.error(e.jsx(Z,{formData:n})),a==null||a()}catch{p.error(e.jsx(Z,{formData:n}))}finally{m(!1)}},handleDeleteImage:()=>{r({name:"",image:""})},handleUploadImage:k,selectedActivities:T,setSelectedActivities:E,selectedSubjectAreas:f,setSelectedSubjectAreas:I,loaderPublish:c,cover:i}}function je(){const{t:a}=M(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],l=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:s,languageOptions:l,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function Ne({isOpen:a,onSuccess:t,onCancel:s}){var R,N;const{currentApp:l,appCode:i}=Y(),{t:r}=M(),{register:c,handleSubmit:m,publish:p,formState:{isDirty:g,isValid:u},handleUploadImage:v,selectedActivities:b,setSelectedActivities:d,selectedSubjectAreas:o,setSelectedSubjectAreas:O,handleDeleteImage:T,loaderPublish:E,cover:f}=he({onSuccess:t}),I=K(),{activityTypeOptions:k,subjectAreaOptions:A,languageOptions:B,ageOptions:q}=je(),n=r("bpr.form.publication.language"),x=r("bpr.form.publication.age.min"),_=r("bpr.form.publication.age.max");return pe.createPortal(e.jsxs(S,{isOpen:a,onModalClose:s,id:"libraryModal",size:"lg",children:[e.jsx(S.Header,{onModalClose:s,children:r("bpr.publish")}),e.jsx(S.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(S.Body,{children:[e.jsx(F,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:m(p),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(de,{app:l,src:(R=I[0])==null?void 0:R.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:v,onDeleteImage:T,className:"align-self-center"}),!f.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(y,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(L,{children:r("bpr.form.publication.title")}),e.jsx(P,{type:"text",defaultValue:(N=I[0])==null?void 0:N.name,...c("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(y,{id:"description",isRequired:!0,children:[e.jsx(L,{children:r("bpr.form.publication.description")}),e.jsx(P,{type:"text",...c("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]})]})]}),e.jsx("hr",{}),e.jsx(F,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsx(G,{trigger:e.jsx(J,{title:r("bpr.form.publication.type"),size:"md",grow:!0,badgeContent:b==null?void 0:b.length}),content:e.jsx(W,{options:k,model:b,onChange:h=>d(h)})})}),e.jsx("div",{className:"col d-flex",children:e.jsx(G,{trigger:e.jsx(J,{title:r("bpr.form.publication.discipline"),size:"md",grow:!0,badgeContent:o==null?void 0:o.length}),content:e.jsx(W,{options:A,model:o,onChange:h=>O(h)})})}),e.jsx("div",{className:"col",children:e.jsx(y,{id:"language",isRequired:!0,children:e.jsx($,{...c("language",{required:!0,validate:h=>h!==n}),options:B,placeholderOption:n,defaultValue:n,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(y,{id:"ageMin",isRequired:!0,children:e.jsx($,{...c("ageMin",{required:!0,validate:(h,w)=>parseInt(h)<=parseInt(w.ageMax)}),options:q,placeholderOption:x,defaultValue:x,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(y,{id:"ageMax",isRequired:!0,children:e.jsx($,{...c("ageMax",{required:!0,validate:(h,w)=>parseInt(h)>=parseInt(w.ageMin)}),options:q,placeholderOption:_,defaultValue:_,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(y,{id:"keywords",isOptional:!0,children:[e.jsx(L,{children:r("bpr.form.publication.keywords")}),e.jsx(P,{type:"text",...c("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(F,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:"/assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg",alt:`Icone licence Creative
2
- Commons`})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(z,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(z,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(S.Footer,{children:[e.jsx(H,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(H,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:E,disabled:!f.image||E||!g||!u||(b==null?void 0:b.length)===0||(o==null?void 0:o.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function ge({result:a}){const{t}=M();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function Z({formData:a}){const{t}=M(),s=l=>l.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[s(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),s(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{Z as PublishModalError,ge as PublishModalSuccess,Ne as default};
1
+ import{r as j,Y as ae,R as re,j as e,Z as te,d as D,_ as se,$ as le,a0 as ie,u as Y,g as K,k as ce,a1 as oe,E as ne,a2 as V,a3 as be,m as z,a as M,b as pe,M as S,F as y,P as q,w as F,B as H}from"./index.js";import{u as ue}from"./usePopper.js";import{S as W}from"./SelectList.js";import{H as L}from"./Heading.js";import{I as de}from"./ImagePicker.js";import{u as me}from"./index.esm.js";const Q=({trigger:a,content:t})=>{const[s,l]=j.useState(null),[i,r]=j.useState(null),{styles:c,attributes:m}=ue(s,i,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[p,g]=j.useState(!1),u=ae(p,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),v=()=>{g(d=>!d)},b=re.cloneElement(a,{ref:l,onClick:v,state:p?"selected":"default"});return j.useEffect(()=>{const d=o=>{i&&!i.contains(o.target)&&s&&!s.contains(o.target)&&g(!1)};return document.addEventListener("mousedown",d,!0),document.addEventListener("touchstart",d,!0),()=>{document.removeEventListener("mousedown",d,!0),document.removeEventListener("touchstart",d,!0)}},[i,s]),e.jsxs(e.Fragment,{children:[b,u((d,o)=>e.jsx(e.Fragment,{children:o&&e.jsx(te.div,{className:D("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:r,style:{...c.popper,...d},...m.popper,children:t})}))]})};Q.displayName="Dropdown";const G=Q,X=j.forwardRef(({title:a="",state:t,variant:s,icon:l,size:i="lg",grow:r=!1,badgeContent:c,...m},p)=>{const g=D("dropdown-trigger",t,i,s,r&&"flex-grow-1 justify-content-between");return e.jsxs("button",{ref:p,className:g,...m,type:"button",children:[l&&e.jsx("div",{className:"dropdown-trigger-icon",children:l}),e.jsx("div",{children:a}),c?e.jsx("div",{children:e.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:c})}):e.jsx("div",{className:"dropdown-trigger-carret-icon",children:e.jsx(se,{width:16,height:16})})]})});X.displayName="DropdownTrigger";const Z=X,ee=j.forwardRef(({options:a,model:t,disabled:s=!1,placeholderOption:l=!1,...i},r)=>{const{isRequired:c,status:m}=le(),p=j.useId(),g={...i,id:p,disabled:s,ref:r,className:D(i.className,"form-select c-pointer",{"is-invalid":m==="invalid","is-valid":m==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...g,required:c,children:[l&&e.jsx("option",{disabled:!0,selected:t===void 0,children:l}),a==null?void 0:a.map(u=>{const v=typeof u=="object"?u.value:u,b=typeof u=="object"?u.label:u;return e.jsx("option",{value:v,selected:t===v,children:b},v)})]})})});ee.displayName="Select";const $=ee,{http:C}=ie.instance();function he({onSuccess:a}){const{user:t,currentApp:s}=Y(),l=K(),[i,r]=j.useState({name:"",image:l[0].thumbnail}),[c,m]=j.useState(!1),{hotToast:p}=ce(z);oe();const{publishApi:g}=ne(),{register:u,handleSubmit:v,formState:{errors:b,isSubmitting:d,isDirty:o,isValid:O}}=me({mode:"onChange"}),[E,T]=j.useState([]),[f,I]=j.useState([]);function k(n){r(n)}const A=t?t==null?void 0:t.userId:"";return{selectedResources:l,register:u,handleSubmit:v,formState:{errors:b,isSubmitting:d,isDirty:o,isValid:O},publish:async n=>{try{m(!0);let x=new Blob;i.image?x=await C.get(i.image,{responseType:"blob"}):l[0].thumbnail&&(x=await C.get(l[0].thumbnail,{responseType:"blob"}));const _=await C.get(`/userbook/avatar/${A}?thumbnail=48x48`,{responseType:"blob"}),R=await C.get(`/directory/user/${A}/attachment-school`,{responseType:"json"});let N="";s!=null&&s.displayName&&(N=V(s==null?void 0:s.displayName));const h={activityType:E,age:[n.ageMin,n.ageMax],application:V(N),cover:x,description:n.description,keyWords:n.keyWords,language:n.language,licence:"CC-BY",resourceId:l[0].assetId,resourceEntId:l[0].assetId,subjectArea:f,teacherAvatar:_,title:n.title,userId:A,userStructureName:R.name||(t==null?void 0:t.structureNames[0])},w=[be.BLOG][0],U=await g(w,h);U.success?p.success(e.jsx(ge,{result:U}),{duration:1e4}):p.error(e.jsx(J,{formData:n})),a==null||a()}catch{p.error(e.jsx(J,{formData:n}))}finally{m(!1)}},handleDeleteImage:()=>{r({name:"",image:""})},handleUploadImage:k,selectedActivities:E,setSelectedActivities:T,selectedSubjectAreas:f,setSelectedSubjectAreas:I,loaderPublish:c,cover:i}}function je(){const{t:a}=M(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],l=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:s,languageOptions:l,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function we({isOpen:a,onSuccess:t,onCancel:s}){var R,N;const{currentApp:l,appCode:i}=Y(),{t:r}=M(),{register:c,handleSubmit:m,publish:p,formState:{isDirty:g,isValid:u},handleUploadImage:v,selectedActivities:b,setSelectedActivities:d,selectedSubjectAreas:o,setSelectedSubjectAreas:O,handleDeleteImage:E,loaderPublish:T,cover:f}=he({onSuccess:t}),I=K(),{activityTypeOptions:k,subjectAreaOptions:A,languageOptions:B,ageOptions:P}=je(),n=r("bpr.form.publication.language"),x=r("bpr.form.publication.age.min"),_=r("bpr.form.publication.age.max");return pe.createPortal(e.jsxs(S,{isOpen:a,onModalClose:s,id:"libraryModal",size:"lg",children:[e.jsx(S.Header,{onModalClose:s,children:r("bpr.publish")}),e.jsx(S.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(S.Body,{children:[e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:m(p),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(de,{app:l,src:(R=I[0])==null?void 0:R.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:v,onDeleteImage:E,className:"align-self-center"}),!f.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(y,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(q,{children:r("bpr.form.publication.title")}),e.jsx(F,{type:"text",defaultValue:(N=I[0])==null?void 0:N.name,...c("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(y,{id:"description",isRequired:!0,children:[e.jsx(q,{children:r("bpr.form.publication.description")}),e.jsx(F,{type:"text",...c("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]})]})]}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsx(G,{trigger:e.jsx(Z,{title:r("bpr.form.publication.type"),size:"md",grow:!0,badgeContent:b==null?void 0:b.length}),content:e.jsx(W,{options:k,model:b,onChange:h=>d(h)})})}),e.jsx("div",{className:"col d-flex",children:e.jsx(G,{trigger:e.jsx(Z,{title:r("bpr.form.publication.discipline"),size:"md",grow:!0,badgeContent:o==null?void 0:o.length}),content:e.jsx(W,{options:A,model:o,onChange:h=>O(h)})})}),e.jsx("div",{className:"col",children:e.jsx(y,{id:"language",isRequired:!0,children:e.jsx($,{...c("language",{required:!0,validate:h=>h!==n}),options:B,placeholderOption:n,defaultValue:n,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(y,{id:"ageMin",isRequired:!0,children:e.jsx($,{...c("ageMin",{required:!0,validate:(h,w)=>parseInt(h)<=parseInt(w.ageMax)}),options:P,placeholderOption:x,defaultValue:x,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(y,{id:"ageMax",isRequired:!0,children:e.jsx($,{...c("ageMax",{required:!0,validate:(h,w)=>parseInt(h)>=parseInt(w.ageMin)}),options:P,placeholderOption:_,defaultValue:_,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(y,{id:"keywords",isOptional:!0,children:[e.jsx(q,{children:r("bpr.form.publication.keywords")}),e.jsx(F,{type:"text",...c("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:"/assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg",alt:`Icone licence Creative
2
+ Commons`})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(z,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(z,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(S.Footer,{children:[e.jsx(H,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(H,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:T,disabled:!f.image||T||!g||!u||(b==null?void 0:b.length)===0||(o==null?void 0:o.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function ge({result:a}){const{t}=M();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function J({formData:a}){const{t}=M(),s=l=>l.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[s(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),s(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{J as PublishModalError,ge as PublishModalSuccess,we as default};
@@ -1 +1 @@
1
- import{u as O,a as B,a9 as E,g as w,a3 as z,i as D,c as q,D as G,ab as H,r as J,f as K,j as e,R as g,$ as h,ad as Q,B as U}from"./index.js";import{C as V}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";function W(r){const{rights:l,creatorId:i}=r;return l.filter(a=>!a.includes(i)).length>=1}const es=()=>{const{currentApp:r,currentLanguage:l,appCode:i}=O(),{t:n}=B(),{data:a,isFetching:x,fetchNextPage:f}=E(),d=w(),o=z(),m=D(),{setSelectedResources:u,setResourceIds:p,openResource:R,setResourceIsTrash:S}=q(),I=G(),j=H({from:{opacity:0},to:{opacity:1}}),b=d.pagination.startIdx+d.pagination.pageSize<(d.pagination.maxIdx||0),y=J.useCallback(()=>{f()},[]),N=s=>{I?(S(!0),p([s.id]),u([s])):R(s)};function C(s){o.includes(s.id)?(p(o.filter(c=>c!==s.id)),u(m.filter(c=>c.id!==s.id))):(p([...o,s.id]),u([...m,s]))}const P=K("grid ps-0 list-unstyled");return e.jsxs(g.Fragment,{children:[e.jsx(h.ul,{className:P,children:a==null?void 0:a.pages.map((s,c)=>e.jsx(g.Fragment,{children:s.resources.map(t=>{const{id:k,creatorName:A,creatorId:F,name:T,thumbnail:$,updatedAt:v}=t,L=W(t),M=Q(v).locale(l).fromNow();return e.jsx(h.li,{className:"g-col-4",style:{...j},children:e.jsx(V,{app:r,className:"c-pointer",creatorName:A,isPublic:t.public,isSelected:o.includes(t.id),isLoading:x,isShared:L,messagePublic:n("tooltip.public",{ns:i}),messageShared:n("tooltip.shared",{ns:i}),name:T,onOpen:()=>N(t),onSelect:()=>C(t),resourceSrc:$,updatedAt:M,userSrc:`/userbook/avatar/${F}`})},k)})},c))}),b&&e.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:e.jsx(U,{type:"button",color:"secondary",variant:"filled",onClick:y,children:n("explorer.see.more")})})]})};export{es as default};
1
+ import{u as O,a as $,a7 as z,e as B,a1 as w,g as Z,E as q,z as D,a9 as G,r as H,d as J,j as e,R as g,Z as h,ab as K,B as Q}from"./index.js";import{C as U}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";function V(r){const{rights:l,creatorId:i}=r;return l.filter(a=>!a.includes(i)).length>=1}const es=()=>{const{currentApp:r,currentLanguage:l,appCode:i}=O(),{t:n}=$(),{data:a,isFetching:x,fetchNextPage:f}=z(),d=B(),o=w(),m=Z(),{setSelectedResources:u,setResourceIds:p,openResource:R,setResourceIsTrash:S}=q(),I=D(),j=G({from:{opacity:0},to:{opacity:1}}),b=d.pagination.startIdx+d.pagination.pageSize<(d.pagination.maxIdx||0),y=H.useCallback(()=>{f()},[]),N=s=>{I?(S(!0),p([s.id]),u([s])):R(s)};function C(s){o.includes(s.id)?(p(o.filter(c=>c!==s.id)),u(m.filter(c=>c.id!==s.id))):(p([...o,s.id]),u([...m,s]))}const P=J("grid ps-0 list-unstyled");return e.jsxs(g.Fragment,{children:[e.jsx(h.ul,{className:P,children:a==null?void 0:a.pages.map((s,c)=>e.jsx(g.Fragment,{children:s.resources.map(t=>{const{id:k,creatorName:A,creatorId:F,name:T,thumbnail:v,updatedAt:E}=t,L=V(t),M=K(E).locale(l).fromNow();return e.jsx(h.li,{className:"g-col-4",style:{...j},children:e.jsx(U,{app:r,className:"c-pointer",creatorName:A,isPublic:t.public,isSelected:o.includes(t.id),isLoading:x,isShared:L,messagePublic:n("tooltip.public",{ns:i}),messageShared:n("tooltip.shared",{ns:i}),name:T,onOpen:()=>N(t),onSelect:()=>C(t),resourceSrc:v,updatedAt:M,userSrc:`/userbook/avatar/${F}`})},k)})},c))}),b&&e.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:e.jsx(Q,{type:"button",color:"secondary",variant:"filled",onClick:y,children:n("explorer.see.more")})})]})};export{es as default};
@@ -1 +1 @@
1
- import{r as n,j as c,f as j,R as o}from"./index.js";const x=({options:a,hideCheckbox:d,isMonoSelection:u,onChange:i,model:m=[]})=>{const[s,h]=n.useState(m),r=e=>{h(u?[e]:l=>{const t=[...l];return l.includes(e)?t.splice(t.indexOf(e),1):t.push(e),t})};return n.useEffect(()=>{i==null||i(s)},[s]),c.jsx(c.Fragment,{children:c.jsx("div",{className:"select-list",children:a==null?void 0:a.map(e=>c.jsxs("div",{className:j("select-list-option",d&&s.includes(e.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":s.includes(e.value),onMouseUp:()=>{r(e.value)},tabIndex:0,onKeyDown:l=>{l.key==="Enter"&&r(e.value)},children:[c.jsx("div",{className:"select-list-option-icon",children:e.icon&&o.createElement(e.icon,{width:"20px",height:"20px"})}),c.jsx("div",{className:"select-list-option-label",children:e.label}),!d&&c.jsx("div",{className:"select-list-option-checkbox",children:c.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:s.includes(e.value),className:"form-check-input c-pointer",id:"option.value"})})]},e.value))})})};x.displayName="SelectList";const v=x;export{v as S};
1
+ import{r as n,j as c,d as j,R as o}from"./index.js";const x=({options:a,hideCheckbox:d,isMonoSelection:u,onChange:i,model:m=[]})=>{const[s,h]=n.useState(m),r=e=>{h(u?[e]:l=>{const t=[...l];return l.includes(e)?t.splice(t.indexOf(e),1):t.push(e),t})};return n.useEffect(()=>{i==null||i(s)},[s]),c.jsx(c.Fragment,{children:c.jsx("div",{className:"select-list",children:a==null?void 0:a.map(e=>c.jsxs("div",{className:j("select-list-option",d&&s.includes(e.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":s.includes(e.value),onMouseUp:()=>{r(e.value)},tabIndex:0,onKeyDown:l=>{l.key==="Enter"&&r(e.value)},children:[c.jsx("div",{className:"select-list-option-icon",children:e.icon&&o.createElement(e.icon,{width:"20px",height:"20px"})}),c.jsx("div",{className:"select-list-option-label",children:e.label}),!d&&c.jsx("div",{className:"select-list-option-checkbox",children:c.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:s.includes(e.value),className:"form-check-input c-pointer",id:"option.value"})})]},e.value))})})};x.displayName="SelectList";const v=x;export{v as S};
@@ -1 +1 @@
1
- import{r,o as E,f as G,j as e,u as ce,a as ae,H as ee,g as fe,A as ye,h as je,i as de,k as ve,l as Se,m as Ne,n as se,p as we,b as Ie,M as O,V as Y,q as oe,B as V,s as ie,t as Be,v as Ae,F as Z,w as Ce,x as Re,y as Me,L as Te}from"./index.js";import{S as $e}from"./SelectList.js";import{T as Ee}from"./Tooltip.js";import"./usePopper.js";function Fe(n,h){const[u,m]=r.useState(n);return r.useEffect(()=>{const o=setTimeout(()=>{m(n)},h||500);return()=>{clearTimeout(o)}},[n,h]),u}function Ue(){const[n,h]=r.useState(!1);r.useEffect(()=>{u()},[]);const u=r.useCallback(async()=>{const m=await E.session().isAdml();h(m)},[]);return{isAdml:n}}const he=r.forwardRef(({label:n,disabled:h=!1,checked:u=!1,indeterminate:m=!1,...o},S)=>{const b=r.useRef(null);r.useImperativeHandle(S,()=>({...b.current})),r.useEffect(()=>{b.current.indeterminate=m},[b,m]);const y=r.useMemo(()=>o.id?o.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[o.id]),p={...o,type:"checkbox",checked:u,disabled:h,ref:b,className:G(o.className,"form-check-input c-pointer"),id:y};return e.jsxs("div",{className:"position-relative d-inline-block",children:[e.jsx("input",{...p}),n&&e.jsx("label",{className:"ms-8 form-check-label",htmlFor:p.id,children:n})]})});he.displayName="Checkbox";const ne=he,ue=r.forwardRef(({model:n,icon:h,label:u=!1,disabled:m=!1,...o},S)=>{const b=r.useMemo(()=>o.id?o.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[o.id]),y={...o,type:"radio",checked:n===o.value,disabled:m,ref:S,className:G(o.className,"form-check-input c-pointer",h&&"d-none"),id:b};return e.jsxs("div",{className:G("position-relative form-check",h&&"ps-0"),children:[e.jsx("input",{...y}),h&&e.jsx("label",{htmlFor:y.id,className:G("c-pointer",n!==o.value&&"text-muted"),children:h}),!h&&u&&e.jsx("label",{className:"form-check-label",htmlFor:y.id,children:u})]})});ue.displayName="Radio";const le=ue;function Pe({radioPublicationValue:n,onRadioPublicationChange:h}){const{appCode:u}=ce(),{t:m}=ae(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(ee,{headingStyle:"h4",level:"h3",className:"mb-16",children:m("explorer.publication.steps")}),e.jsx(le,{label:m("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:n,onChange:o=>h(o.target.value)}),e.jsx(le,{label:m("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:n,onChange:o=>h(o.target.value)})]})}function De({radioPublicationValue:n,onRadioPublicationChange:h}){const{app:u}=fe();return u===ye.BLOG?e.jsx(Pe,{radioPublicationValue:n,onRadioPublicationChange:h}):e.jsx(e.Fragment,{})}function Le({onSuccess:n,payloadUpdatePublishType:h}){const{appCode:u}=ce(),{t:m}=ae(),{user:o,avatar:S}=je(),[b,y]=r.useState(r.useId()),[p,k]=r.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[j,N]=r.useState([]),[F,z]=r.useState(""),[w,H]=r.useState(!1),[C,W]=r.useState(""),I=Fe(C,500),[_,J]=r.useState([]),[R,U]=r.useState([]),[P,K]=r.useState(!1),[M,q]=r.useState(!1),{isAdml:B}=Ue(),A=de(),Q=ve(),X=Se(),{hotToast:l}=Ne(we);r.useEffect(()=>{D()},[]),r.useEffect(()=>{be(I)},[I]);const D=r.useCallback(async()=>{var a;const t=await E.share().getActionsForApp(u);N(t);const d=await E.share().getRightsForResource(u,(a=A[0])==null?void 0:a.assetId);k(d)},[]),c=(t,d)=>{k(({rights:a,...g})=>{var te,re;const s=[...a],i=s.findIndex(x=>x.id===t.id),T=j.filter(x=>x.id===d)[0];if(s[i].actions.findIndex(x=>x.id===d)>-1){let x=s[i].actions.filter(f=>f.id!==d);const v=j.filter(f=>{var $;return($=f.requires)==null?void 0:$.includes(d)});x=x.filter(f=>!v.find($=>$.id===f.id)),s[i]={...s[i],actions:x}}else{const x=j.filter(v=>{var f;return((f=T.requires)==null?void 0:f.includes(v.id))&&!s[i].actions.find($=>$.id===v.id)});s[i]={...s[i],actions:[...s[i].actions,T,...x]}}return t.type==="sharebookmark"&&((te=s[i].users)==null||te.forEach(x=>{const v=s.findIndex(f=>f.id===x.id);s[v]={...s[v],actions:s[i].actions}}),(re=s[i].groups)==null||re.forEach(x=>{const v=s.findIndex(f=>f.id===x.id);s[v]={...s[v],actions:s[i].actions}})),{rights:s,...g}})},L=async()=>{var t;try{await Q.mutateAsync(h),await X.mutateAsync({entId:(t=A[0])==null?void 0:t.assetId,shares:p.rights}),l.success(m("explorer.shared.status.saved")),n==null||n()}catch(d){console.error("Failed to save share",d),l.error(m("explorer.shared.status.error"))}},me=t=>{k(d=>({...d,rights:p.rights.filter(a=>{var g,s;return a.id!==t.id&&!((g=t.users)!=null&&g.find(i=>i.id===a.id))&&!((s=t.groups)!=null&&s.find(i=>i.id===a.id))})}))},pe=t=>{W(t.target.value)},xe=()=>!M&&!B&&I.length>0&&R.length===0||!M&&B&&I.length>3&&R.length===0,ke=()=>B&&C.length<3,ge=()=>M&&C.length>0,be=async t=>{var d;if(q(!0),!B&&t.length>=1||B&&t.length>=3){const a=await E.share().searchShareSubjects(u,(d=A[0])==null?void 0:d.assetId,t);J(a);const g=a.filter(s=>!p.rights.find(i=>i.id===s.id)).filter(s=>!(s.type==="user"&&s.id===A[0].creatorId)).map(s=>({value:s.id,label:s.displayName,icon:s.type==="sharebookmark"?se:null}));U(g)}else U([]),Promise.resolve();q(!1)};return{currentIsAuthor:()=>{for(const t of A)if(t.creatorId!==(o==null?void 0:o.userId))return!1;return!0},idBookmark:b,myAvatar:S,shareRights:p,shareRightActions:j,showBookmarkInput:w,searchInputValue:C,searchResults:R,bookmarkName:F,showBookmarkMembers:P,debouncedSearchInputValue:I,searchPending:M,setBookmarkName:z,saveBookmark:async t=>{try{const d=await E.directory().saveBookmarks(t,{users:p.rights.filter(a=>a.type==="user").map(a=>a.id),groups:p.rights.filter(a=>a.type==="group").map(a=>a.id),bookmarks:p.rights.filter(a=>a.type==="sharebookmark").map(a=>a.id)});l.success(m("explorer.bookmarked.status.saved")),k(a=>({...a,visibleBookmarks:[...a.visibleBookmarks,{displayName:t,id:d.id}]})),y(b+new Date().getTime().toString()),H(!1)}catch(d){console.error("Failed to save bookmark",d),l.error(m("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:H,handleActionCheckbox:c,handleShare:L,handleDeleteRow:me,handleSearchInputChange:pe,handleSearchResultsChange:async t=>{const d=_.find(g=>g.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(d){let g=[];if(d.type==="sharebookmark"){const s=await E.directory().getBookMarkById(d.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{g.push({...i,type:"user",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})}),s.groups.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{g.push({...i,type:"group",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})})}else g=[{...d,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];k({...p,rights:[...p.rights,...g]}),U(R.filter(s=>s.value!==t[0]))}},showSearchNoResults:xe,showSearchAdmlHint:ke,showSearchLoading:ge,handleBookmarkMembersToggle:()=>{K(!P)},hasRight:(t,d)=>t.actions.filter(a=>d.id===a.id).length>0,showShareRightLine:t=>t.isBookmarkMember&&P||!t.isBookmarkMember}}function Ve(){const n=de(),{assetId:h,description:u,thumbnail:m,name:o,public:S,trashed:b,slug:y,"publish-type":p}=n.length>0?n[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[k,j]=r.useState(p||"RESTRAINT"),[N,F]=r.useState({description:u,entId:h,name:o,public:!!S,slug:y||"",thumbnail:m,trashed:b,"publish-type":p});return r.useEffect(()=>{k&&F(w=>({...w,"publish-type":k}))},[k]),{radioPublicationValue:k,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{j(w)}}}function Ze({isOpen:n,onSuccess:h,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:o,handleRadioPublicationChange:S}=Ve(),{myAvatar:b,idBookmark:y,shareRights:p,shareRightActions:k,showBookmarkInput:j,searchResults:N,bookmarkName:F,showBookmarkMembers:z,searchPending:w,currentIsAuthor:H,setBookmarkName:C,saveBookmark:W,canSave:I,toggleBookmarkInput:_,handleActionCheckbox:J,handleShare:R,handleDeleteRow:U,handleSearchInputChange:P,handleSearchResultsChange:K,showSearchNoResults:M,showSearchAdmlHint:q,showSearchLoading:B,handleBookmarkMembersToggle:A,hasRight:Q,showShareRightLine:X}=Le({payloadUpdatePublishType:m,onSuccess:h,onCancel:u}),{t:l}=ae(),D=r.useRef(null);return Ie.createPortal(e.jsxs(O,{id:"share_modal",size:"lg",isOpen:n,onModalClose:u,children:[e.jsx(O.Header,{onModalClose:u,children:l("share.title")}),e.jsxs(O.Body,{children:[e.jsx(ee,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.modal.share.usersWithAccess")}),e.jsx("div",{className:"table-responsive",children:e.jsxs("table",{className:"table border align-middle mb-0",children:[e.jsx("thead",{className:"bg-secondary text-white",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"w-32",children:e.jsx(Y,{children:l("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:l("explorer.modal.share.search.placeholder")})}),k.map(c=>e.jsx("th",{scope:"col",className:"text-center",children:l(c.displayName)},c.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:l("close")})})]})}),e.jsxs("tbody",{children:[H()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(oe,{alt:l("explorer.modal.share.avatar.me.alt"),size:"xs",src:b,variant:"circle"})}),e.jsx("td",{children:l("share.me")}),k.map(c=>e.jsx("td",{style:{width:"80px"},className:"text-center",children:e.jsx(ne,{checked:!0,disabled:!0})},c.displayName)),e.jsx("td",{})]}),p==null?void 0:p.rights.map(c=>X(c)&&e.jsxs("tr",{className:c.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[c.type!=="sharebookmark"&&e.jsx(oe,{alt:l("explorer.modal.share.avatar.shared.alt"),size:"xs",src:c.avatarUrl,variant:"circle"}),c.type==="sharebookmark"&&e.jsx(se,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[c.type==="sharebookmark"&&e.jsx(V,{color:"tertiary",rightIcon:e.jsx(ie,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:z?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal ps-0",onClick:A,children:c.displayName}),c.type!=="sharebookmark"&&c.displayName]})}),k.map(L=>e.jsx("td",{style:{width:"80px"},className:"text-center",children:e.jsx(ne,{checked:Q(c,L),onChange:()=>J(c,L.id)})},L.displayName)),e.jsx("td",{children:!c.isBookmarkMember&&e.jsx(Be,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Ae,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>U(c)})})]},c.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(V,{color:"tertiary",leftIcon:e.jsx(se,{}),rightIcon:e.jsx(ie,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:j?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>_(!j),children:l("share.save.sharebookmark")}),j&&e.jsx("div",{className:"mt-16",children:e.jsxs(Z,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[e.jsx("div",{className:"flex-fill",children:e.jsx(Z.Input,{ref:D,onChange:()=>{C(()=>{var c;return((c=D.current)==null?void 0:c.value)||""})},placeholder:l("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},y)}),e.jsx(V,{type:"button",color:"primary",variant:"ghost",disabled:F.length===0,leftIcon:e.jsx(Ce,{}),onClick:()=>{W(D.current.value)},className:"text-nowrap",children:l("explorer.modal.share.sharebookmark.save")})]})})]}),e.jsx("hr",{}),e.jsxs(ee,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[e.jsx("div",{className:"me-8",children:l("explorer.modal.share.search")}),e.jsx(Ee,{message:"Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.",placement:"top",children:e.jsx(Re,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Me,{className:"max-w-512",noValidationIcon:!0,placeholder:q()?l("explorer.search.adml.hint"):l("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:P}),B()&&e.jsxs("div",{className:"d-flex align-items-center p-4",children:[e.jsx(Te,{isLoading:w}),e.jsx("span",{className:"ps-4",children:l("explorer.search.pending")})]}),M()&&e.jsx("div",{className:"p-4",children:l("portal.no.result")})]}),(N==null?void 0:N.length)>0&&e.jsx("div",{className:"position-absolute w-100 max-w-512 z-1 bg-white shadow rounded-4 d-block show py-12 px-8",children:e.jsx($e,{options:N,hideCheckbox:!0,isMonoSelection:!0,onChange:K})}),e.jsx(De,{radioPublicationValue:o,onRadioPublicationChange:S})]}),e.jsxs(O.Footer,{children:[e.jsx(V,{type:"button",color:"tertiary",variant:"ghost",onClick:u,children:l("explorer.cancel")}),e.jsx(V,{type:"button",color:"primary",variant:"filled",onClick:R,disabled:!I(),children:l("share")})]})]}),document.getElementById("portal"))}export{Ze as default};
1
+ import{r,o as E,d as G,j as e,u as ce,a as ae,e as fe,A as ye,f as je,g as de,h as ve,i as Se,k as Ne,l as ee,m as we,b as Ie,M as O,V as Y,n as oe,B as V,p as ie,q as Be,s as Ae,F as Z,t as Ce,v as Re,w as Me,L as Te}from"./index.js";import{S as $e}from"./SelectList.js";import{H as se}from"./Heading.js";import{T as Ee}from"./Tooltip.js";import"./usePopper.js";function Fe(n,h){const[u,m]=r.useState(n);return r.useEffect(()=>{const o=setTimeout(()=>{m(n)},h||500);return()=>{clearTimeout(o)}},[n,h]),u}function Ue(){const[n,h]=r.useState(!1);r.useEffect(()=>{u()},[]);const u=r.useCallback(async()=>{const m=await E.session().isAdml();h(m)},[]);return{isAdml:n}}const he=r.forwardRef(({label:n,disabled:h=!1,checked:u=!1,indeterminate:m=!1,...o},S)=>{const b=r.useRef(null);r.useImperativeHandle(S,()=>({...b.current})),r.useEffect(()=>{b.current.indeterminate=m},[b,m]);const y=r.useMemo(()=>o.id?o.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[o.id]),p={...o,type:"checkbox",checked:u,disabled:h,ref:b,className:G(o.className,"form-check-input c-pointer"),id:y};return e.jsxs("div",{className:"position-relative d-inline-block",children:[e.jsx("input",{...p}),n&&e.jsx("label",{className:"ms-8 form-check-label",htmlFor:p.id,children:n})]})});he.displayName="Checkbox";const ne=he,ue=r.forwardRef(({model:n,icon:h,label:u=!1,disabled:m=!1,...o},S)=>{const b=r.useMemo(()=>o.id?o.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[o.id]),y={...o,type:"radio",checked:n===o.value,disabled:m,ref:S,className:G(o.className,"form-check-input c-pointer",h&&"d-none"),id:b};return e.jsxs("div",{className:G("position-relative form-check",h&&"ps-0"),children:[e.jsx("input",{...y}),h&&e.jsx("label",{htmlFor:y.id,className:G("c-pointer",n!==o.value&&"text-muted"),children:h}),!h&&u&&e.jsx("label",{className:"form-check-label",htmlFor:y.id,children:u})]})});ue.displayName="Radio";const le=ue;function Pe({radioPublicationValue:n,onRadioPublicationChange:h}){const{appCode:u}=ce(),{t:m}=ae(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:m("explorer.publication.steps")}),e.jsx(le,{label:m("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:n,onChange:o=>h(o.target.value)}),e.jsx(le,{label:m("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:n,onChange:o=>h(o.target.value)})]})}function De({radioPublicationValue:n,onRadioPublicationChange:h}){const{app:u}=fe();return u===ye.BLOG?e.jsx(Pe,{radioPublicationValue:n,onRadioPublicationChange:h}):e.jsx(e.Fragment,{})}function Le({onSuccess:n,payloadUpdatePublishType:h}){const{appCode:u}=ce(),{t:m}=ae(),{user:o,avatar:S}=je(),[b,y]=r.useState(r.useId()),[p,k]=r.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[j,N]=r.useState([]),[F,z]=r.useState(""),[w,H]=r.useState(!1),[C,W]=r.useState(""),I=Fe(C,500),[_,J]=r.useState([]),[R,U]=r.useState([]),[P,K]=r.useState(!1),[M,q]=r.useState(!1),{isAdml:B}=Ue(),A=de(),Q=ve(),X=Se(),{hotToast:l}=Ne(we);r.useEffect(()=>{D()},[]),r.useEffect(()=>{be(I)},[I]);const D=r.useCallback(async()=>{var a;const t=await E.share().getActionsForApp(u);N(t);const d=await E.share().getRightsForResource(u,(a=A[0])==null?void 0:a.assetId);k(d)},[]),c=(t,d)=>{k(({rights:a,...g})=>{var te,re;const s=[...a],i=s.findIndex(x=>x.id===t.id),T=j.filter(x=>x.id===d)[0];if(s[i].actions.findIndex(x=>x.id===d)>-1){let x=s[i].actions.filter(f=>f.id!==d);const v=j.filter(f=>{var $;return($=f.requires)==null?void 0:$.includes(d)});x=x.filter(f=>!v.find($=>$.id===f.id)),s[i]={...s[i],actions:x}}else{const x=j.filter(v=>{var f;return((f=T.requires)==null?void 0:f.includes(v.id))&&!s[i].actions.find($=>$.id===v.id)});s[i]={...s[i],actions:[...s[i].actions,T,...x]}}return t.type==="sharebookmark"&&((te=s[i].users)==null||te.forEach(x=>{const v=s.findIndex(f=>f.id===x.id);s[v]={...s[v],actions:s[i].actions}}),(re=s[i].groups)==null||re.forEach(x=>{const v=s.findIndex(f=>f.id===x.id);s[v]={...s[v],actions:s[i].actions}})),{rights:s,...g}})},L=async()=>{var t;try{await Q.mutateAsync(h),await X.mutateAsync({entId:(t=A[0])==null?void 0:t.assetId,shares:p.rights}),l.success(m("explorer.shared.status.saved")),n==null||n()}catch(d){console.error("Failed to save share",d),l.error(m("explorer.shared.status.error"))}},me=t=>{k(d=>({...d,rights:p.rights.filter(a=>{var g,s;return a.id!==t.id&&!((g=t.users)!=null&&g.find(i=>i.id===a.id))&&!((s=t.groups)!=null&&s.find(i=>i.id===a.id))})}))},pe=t=>{W(t.target.value)},xe=()=>!M&&!B&&I.length>0&&R.length===0||!M&&B&&I.length>3&&R.length===0,ke=()=>B&&C.length<3,ge=()=>M&&C.length>0,be=async t=>{var d;if(q(!0),!B&&t.length>=1||B&&t.length>=3){const a=await E.share().searchShareSubjects(u,(d=A[0])==null?void 0:d.assetId,t);J(a);const g=a.filter(s=>!p.rights.find(i=>i.id===s.id)).filter(s=>!(s.type==="user"&&s.id===A[0].creatorId)).map(s=>({value:s.id,label:s.displayName,icon:s.type==="sharebookmark"?ee:null}));U(g)}else U([]),Promise.resolve();q(!1)};return{currentIsAuthor:()=>{for(const t of A)if(t.creatorId!==(o==null?void 0:o.userId))return!1;return!0},idBookmark:b,myAvatar:S,shareRights:p,shareRightActions:j,showBookmarkInput:w,searchInputValue:C,searchResults:R,bookmarkName:F,showBookmarkMembers:P,debouncedSearchInputValue:I,searchPending:M,setBookmarkName:z,saveBookmark:async t=>{try{const d=await E.directory().saveBookmarks(t,{users:p.rights.filter(a=>a.type==="user").map(a=>a.id),groups:p.rights.filter(a=>a.type==="group").map(a=>a.id),bookmarks:p.rights.filter(a=>a.type==="sharebookmark").map(a=>a.id)});l.success(m("explorer.bookmarked.status.saved")),k(a=>({...a,visibleBookmarks:[...a.visibleBookmarks,{displayName:t,id:d.id}]})),y(b+new Date().getTime().toString()),H(!1)}catch(d){console.error("Failed to save bookmark",d),l.error(m("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:H,handleActionCheckbox:c,handleShare:L,handleDeleteRow:me,handleSearchInputChange:pe,handleSearchResultsChange:async t=>{const d=_.find(g=>g.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(d){let g=[];if(d.type==="sharebookmark"){const s=await E.directory().getBookMarkById(d.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{g.push({...i,type:"user",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})}),s.groups.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{g.push({...i,type:"group",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})})}else g=[{...d,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];k({...p,rights:[...p.rights,...g]}),U(R.filter(s=>s.value!==t[0]))}},showSearchNoResults:xe,showSearchAdmlHint:ke,showSearchLoading:ge,handleBookmarkMembersToggle:()=>{K(!P)},hasRight:(t,d)=>t.actions.filter(a=>d.id===a.id).length>0,showShareRightLine:t=>t.isBookmarkMember&&P||!t.isBookmarkMember}}function Ve(){const n=de(),{assetId:h,description:u,thumbnail:m,name:o,public:S,trashed:b,slug:y,"publish-type":p}=n.length>0?n[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[k,j]=r.useState(p||"RESTRAINT"),[N,F]=r.useState({description:u,entId:h,name:o,public:!!S,slug:y||"",thumbnail:m,trashed:b,"publish-type":p});return r.useEffect(()=>{k&&F(w=>({...w,"publish-type":k}))},[k]),{radioPublicationValue:k,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{j(w)}}}function es({isOpen:n,onSuccess:h,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:o,handleRadioPublicationChange:S}=Ve(),{myAvatar:b,idBookmark:y,shareRights:p,shareRightActions:k,showBookmarkInput:j,searchResults:N,bookmarkName:F,showBookmarkMembers:z,searchPending:w,currentIsAuthor:H,setBookmarkName:C,saveBookmark:W,canSave:I,toggleBookmarkInput:_,handleActionCheckbox:J,handleShare:R,handleDeleteRow:U,handleSearchInputChange:P,handleSearchResultsChange:K,showSearchNoResults:M,showSearchAdmlHint:q,showSearchLoading:B,handleBookmarkMembersToggle:A,hasRight:Q,showShareRightLine:X}=Le({payloadUpdatePublishType:m,onSuccess:h,onCancel:u}),{t:l}=ae(),D=r.useRef(null);return Ie.createPortal(e.jsxs(O,{id:"share_modal",size:"lg",isOpen:n,onModalClose:u,children:[e.jsx(O.Header,{onModalClose:u,children:l("share.title")}),e.jsxs(O.Body,{children:[e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.modal.share.usersWithAccess")}),e.jsx("div",{className:"table-responsive",children:e.jsxs("table",{className:"table border align-middle mb-0",children:[e.jsx("thead",{className:"bg-secondary text-white",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"w-32",children:e.jsx(Y,{children:l("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:l("explorer.modal.share.search.placeholder")})}),k.map(c=>e.jsx("th",{scope:"col",className:"text-center",children:l(c.displayName)},c.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:l("close")})})]})}),e.jsxs("tbody",{children:[H()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(oe,{alt:l("explorer.modal.share.avatar.me.alt"),size:"xs",src:b,variant:"circle"})}),e.jsx("td",{children:l("share.me")}),k.map(c=>e.jsx("td",{style:{width:"80px"},className:"text-center",children:e.jsx(ne,{checked:!0,disabled:!0})},c.displayName)),e.jsx("td",{})]}),p==null?void 0:p.rights.map(c=>X(c)&&e.jsxs("tr",{className:c.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[c.type!=="sharebookmark"&&e.jsx(oe,{alt:l("explorer.modal.share.avatar.shared.alt"),size:"xs",src:c.avatarUrl,variant:"circle"}),c.type==="sharebookmark"&&e.jsx(ee,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[c.type==="sharebookmark"&&e.jsx(V,{color:"tertiary",rightIcon:e.jsx(ie,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:z?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal ps-0",onClick:A,children:c.displayName}),c.type!=="sharebookmark"&&c.displayName]})}),k.map(L=>e.jsx("td",{style:{width:"80px"},className:"text-center",children:e.jsx(ne,{checked:Q(c,L),onChange:()=>J(c,L.id)})},L.displayName)),e.jsx("td",{children:!c.isBookmarkMember&&e.jsx(Be,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Ae,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>U(c)})})]},c.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(V,{color:"tertiary",leftIcon:e.jsx(ee,{}),rightIcon:e.jsx(ie,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:j?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>_(!j),children:l("share.save.sharebookmark")}),j&&e.jsx("div",{className:"mt-16",children:e.jsxs(Z,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[e.jsx("div",{className:"flex-fill",children:e.jsx(Z.Input,{ref:D,onChange:()=>{C(()=>{var c;return((c=D.current)==null?void 0:c.value)||""})},placeholder:l("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},y)}),e.jsx(V,{type:"button",color:"primary",variant:"ghost",disabled:F.length===0,leftIcon:e.jsx(Ce,{}),onClick:()=>{W(D.current.value)},className:"text-nowrap",children:l("explorer.modal.share.sharebookmark.save")})]})})]}),e.jsx("hr",{}),e.jsxs(se,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[e.jsx("div",{className:"me-8",children:l("explorer.modal.share.search")}),e.jsx(Ee,{message:"Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.",placement:"top",children:e.jsx(Re,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Me,{className:"max-w-512",noValidationIcon:!0,placeholder:q()?l("explorer.search.adml.hint"):l("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:P}),B()&&e.jsxs("div",{className:"d-flex align-items-center p-4",children:[e.jsx(Te,{isLoading:w}),e.jsx("span",{className:"ps-4",children:l("explorer.search.pending")})]}),M()&&e.jsx("div",{className:"p-4",children:l("portal.no.result")})]}),(N==null?void 0:N.length)>0&&e.jsx("div",{className:"position-absolute w-100 max-w-512 z-1 bg-white shadow rounded-4 d-block show py-12 px-8",children:e.jsx($e,{options:N,hideCheckbox:!0,isMonoSelection:!0,onChange:K})}),e.jsx(De,{radioPublicationValue:o,onRadioPublicationChange:S})]}),e.jsxs(O.Footer,{children:[e.jsx(V,{type:"button",color:"tertiary",variant:"ghost",onClick:u,children:l("explorer.cancel")}),e.jsx(V,{type:"button",color:"primary",variant:"filled",onClick:R,disabled:!I(),children:l("share")})]})]}),document.getElementById("portal"))}export{es as default};
package/dist/Tooltip.js CHANGED
@@ -1 +1 @@
1
- import{r as t,j as e,f as v}from"./index.js";import{u as E}from"./usePopper.js";const j=({children:l,message:i,icon:s=null,placement:n="auto"})=>{const[a,p]=t.useState(null),[m,u]=t.useState(null),[c,d]=t.useState(null),{styles:o,attributes:x}=E(a,m,{placement:n,modifiers:[{name:"arrow",options:{element:c}}]}),[f,r]=t.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"d-inline-block position-relative z-2",ref:p,onMouseEnter:()=>{r(!0)},onMouseLeave:()=>{r(!1)},children:l}),f&&e.jsxs("div",{className:v("tooltip d-block show","bs-tooltip-auto"),ref:u,style:o.popper,...x.popper,children:[e.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[s&&s,e.jsx("div",{children:i})]}),e.jsx("div",{className:"tooltip-arrow",ref:d,style:o.arrow})]})]})},b=j;export{b as T};
1
+ import{r as t,j as e,d as v}from"./index.js";import{u as E}from"./usePopper.js";const j=({children:l,message:i,icon:s=null,placement:n="auto"})=>{const[a,p]=t.useState(null),[m,u]=t.useState(null),[c,d]=t.useState(null),{styles:o,attributes:x}=E(a,m,{placement:n,modifiers:[{name:"arrow",options:{element:c}}]}),[f,r]=t.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"d-inline-block position-relative z-2",ref:p,onMouseEnter:()=>{r(!0)},onMouseLeave:()=>{r(!1)},children:l}),f&&e.jsxs("div",{className:v("tooltip d-block show","bs-tooltip-auto"),ref:u,style:o.popper,...x.popper,children:[e.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[s&&s,e.jsx("div",{children:i})]}),e.jsx("div",{className:"tooltip-arrow",ref:d,style:o.arrow})]})]})},b=j;export{b as T};
package/dist/index.html CHANGED
@@ -17,17 +17,19 @@
17
17
 
18
18
  <!-- SET INITIALISATION CONFIG -->
19
19
  <script>
20
- var WORFLOW_ACCESS = "org.entcore.blog.controllers.BlogController|blog";
20
+ var WORFLOW_ACCESS =
21
+ "net.atos.entng.mindmap.controllers.MindmapController|view";
21
22
  var WORKFLOW_CREATE =
22
- "org.entcore.blog.controllers.BlogController|create";
23
- var WORKFLOW_CREATE_PUBLIC =
24
- "org.entcore.blog.controllers.BlogController|createPublicBlog";
25
- var WORKFLOW_PUBLISH =
26
- "org.entcore.blog.controllers.BlogController|publish";
27
- var WORKFLOW_PRINT = "org.entcore.blog.controllers.BlogController|print";
23
+ "net.atos.entng.mindmap.controllers.FolderController|createFolder";
24
+ var WORKFLOW_PRINT =
25
+ "net.atos.entng.mindmap.controllers.MindmapController|printView";
26
+ var WORKFLOW_EXPORT_PNG =
27
+ "net.atos.entng.mindmap.controllers.MindmapController|exportPngMindmap";
28
+ var WORKFLOW_EXPORT_SVG =
29
+ "net.atos.entng.mindmap.controllers.MindmapController|exportSvgMindmap";
28
30
  var odeConfig = {
29
- app: "blog",
30
- types: ["blog"],
31
+ app: "mindmap",
32
+ types: ["mindmap"],
31
33
  filters: [
32
34
  { id: "owner", defaultValue: true },
33
35
  { id: "public", defaultValue: false },
@@ -61,23 +63,12 @@
61
63
  workflow: WORKFLOW_CREATE,
62
64
  target: "tree",
63
65
  },
64
- {
65
- id: "createPublic",
66
- workflow: WORKFLOW_CREATE_PUBLIC,
67
- target: "tree",
68
- },
69
66
  {
70
67
  id: "move",
71
68
  workflow: WORFLOW_ACCESS,
72
69
  target: "actionbar",
73
70
  right: "read",
74
71
  },
75
- {
76
- id: "publish",
77
- workflow: WORKFLOW_PUBLISH,
78
- target: "actionbar",
79
- right: "creator",
80
- },
81
72
  {
82
73
  id: "print",
83
74
  workflow: WORKFLOW_PRINT,