ode-explorer 1.0.0-develop-pedago.202308030939 → 1.0.0-develop-pedago.202308041648

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 E,h as a,e as s,t as F,af as U,ag as q,ah as G,ai as D,aj as H,q as J,ak as K,I as M,a7 as Q}from"./index.js";import{T as i}from"./Tooltip.js";const d=E.forwardRef(({app:t,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:l=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:o="",updatedAt:f="2 days ago",userSrc:n="",onOpen:u,onSelect:c,messagePublic:v,messageShared:N,...$},b)=>{const{getIconCode:w}=D(),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}),R=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=t?w(t):"placeholder",k=a(`color-app-${T}`,{placeholder:e});function z(B){B.stopPropagation(),c==null||c()}const P=l?s.jsx(H,{width:"48",height:"48",className:k}):o?s.jsx("div",{className:"card-image",children:s.jsx(M,{alt:"",src:o,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(Q,{app:t,iconFit:"ratio",size:"80",variant:"rounded"}),A=n?s.jsx(J,{alt:r,size:"xs",src:n,variant:"circle",width:"24",height:"24"}):s.jsx(K,{});return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(F,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(U,{}),onClick:z,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:[P,s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),l?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:f})})]})]}),l?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:R,children:[A,s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(i,{message:v,placement:"top",children:s.jsx(q,{width:16,height:16})}),p&&s.jsx(i,{message:N,placement:"top",children:s.jsx(G,{width:16,height:16})})]})]})]})});d.displayName="Card";const X=d;export{X as C};
1
+ import{r as E,g as a,j as s,s as F,ae as U,af as G,ag as q,ah as D,ai as H,p as J,aj as K,I as M,a6 as Q}from"./index.js";import{T as i}from"./Tooltip.js";const d=E.forwardRef(({app:t,className:h,creatorName:r="tom.mate",isAnimated:x=!1,isFolder:l=!1,isLoading:e=!1,isSelected:m=!1,isShared:p=!1,isPublic:j=!1,name:g="Resource",resourceSrc:o="",updatedAt:f="2 days ago",userSrc:n="",onOpen:u,onSelect:c,messagePublic:v,messageShared:N,...$},b)=>{const{getIconCode:w}=D(),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}),R=a("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:e}),T=t?w(t):"placeholder",z=a(`color-app-${T}`,{placeholder:e});function P(B){B.stopPropagation(),c==null||c()}const k=l?s.jsx(H,{width:"48",height:"48",className:z}):o?s.jsx("div",{className:"card-image",children:s.jsx(M,{alt:"",src:o,width:"80",height:"80",objectFit:"cover",className:"h-full"})}):s.jsx(Q,{app:t,iconFit:"ratio",size:"80",variant:"rounded"}),A=n?s.jsx(J,{alt:r,size:"xs",src:n,variant:"circle",width:"24",height:"24"}):s.jsx(K,{});return s.jsxs("div",{ref:b,className:C,...$,children:[!e&&s.jsx(F,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:s.jsx(U,{}),onClick:P,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:[k,s.jsxs("div",{children:[s.jsx("h3",{className:y,children:s.jsx("strong",{children:g})}),l?null:s.jsx("p",{className:"card-text small",children:s.jsx("em",{className:I,children:f})})]})]}),l?null:s.jsxs("div",{className:"card-footer gap-16",children:[s.jsxs("div",{className:R,children:[A,s.jsx("p",{className:O,children:r})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[j&&s.jsx(i,{message:v,placement:"top",children:s.jsx(G,{width:16,height:16})}),p&&s.jsx(i,{message:N,placement:"top",children:s.jsx(q,{width:16,height:16})})]})]})]})});d.displayName="Card";const X=d;export{X as C};
@@ -1 +1 @@
1
- import{u as d,C as u,D as x,E as p,o as m,A as j,a as y,j as e,M as n,B as i}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";function f({onSuccess:o}){const{t:l}=d(),s=u(),t=x(),r=p(),{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 T({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{T as default};
1
+ import{u as d,z as u,C as x,D as p,n as m,A as j,a as f,j as e,M as n,B as i}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";function y({onSuccess:o}){const{t:l}=d(),s=u(),t=x(),r=p(),{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 T({isOpen:o,onSuccess:l=()=>({}),onCancel:s=()=>({})}){const{t}=d(),{isTrashFolder:r,onDelete:a}=y({onSuccess:l});return f.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:"danger",onClick:a,type:"button",variant:"filled",children:t(r?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{T as default};
@@ -1 +1 @@
1
- import{H as D,O as B,P as q,Q as L,r as C,u as R,a as U,j as r,M as s,F as w,U as H,y as P,B as b}from"./index.js";import{FOLDER as T}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{u as V}from"./index.esm.js";function _({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}}=V({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name:j}){var y;try{if(a){const d=(y=l[0])==null?void 0:y.parentId,$=l[0].id;await c.mutate({folderId:$,parentId:d,name:j}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||T.DEFAULT;await m.mutate({name:j,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 J({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}=_({edit:e,onSuccess:i,onClose:l});return C.useEffect(()=>{a&&h("name")},[a]),U.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(w,{id:"nameFolder",isRequired:!0,children:[r.jsx(H,{children:t("explorer.create.folder.name")}),r.jsx(P,{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(b,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(b,{form:o,type:"submit",color:"primary",variant:"filled",disabled:!m||!c||u,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal"))}export{J as default};
1
+ import{G as D,N as B,O as q,P as L,r as C,u as R,a as w,j as r,M as s,F as P,Q as T,x as U,B as y}from"./index.js";import{FOLDER as V}from"/assets/js/ode-ts-client/ode-ts-client.esm.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:j}){var b;try{if(a){const d=(b=l[0])==null?void 0:b.parentId,$=l[0].id;await c.mutate({folderId:$,parentId:d,name:j}),o(),e==null||e()}else{const d=(t==null?void 0:t.id)||V.DEFAULT;await m.mutate({name:j,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 Q({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]),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(U,{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{Q as default};
@@ -1 +1 @@
1
- import{u as E,j as e,A as V,F as g,y as A,W as le,B as T,X as ae,d as q,m as ie,Y as oe,l as H,r as h,O as re,o as ne,Z as ce,a as de,M as C,U,$ as ue}from"./index.js";import{APP as G}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{H as W}from"./Heading.js";import{u as pe}from"./index.esm.js";import{I as me}from"./ImagePicker.js";const xe=({appCode:o,correctSlug:a,disableSlug:r,onPublicChange:c,onSlugChange:p,refPublic:d,refSlug:v,register:t,resource:m,slug:x,onCopyToClipBoard:b})=>{const{t:i}=E();return e.jsxs(e.Fragment,{children:[e.jsxs(W,{headingStyle:"h4",level:"h3",className:"mb-16",children:[i("explorer.resource.editModal.heading.access"),o]}),e.jsx(V,{type:"info",children:i("explorer.resource.editModal.access.alert")}),e.jsxs(g,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(g.Input,{type:"checkbox",role:"switch",...t("enablePublic",{value:m.public,onChange:n=>c(n.target.checked)}),className:"form-check-input mt-0",size:"md"},d),e.jsx(g.Label,{className:"form-check-label mb-0",children:i("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(g,{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(A,{type:"text",...t("safeSlug",{validate:{required:n=>!n&&!r?i("explorer.slug.name.mandatory"):!0},disabled:r,value:x,onChange:n=>p(n.target.value)}),size:"md",placeholder:i("explorer.resource.editModal.access.url.extension")},v),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(le,{children:i("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:r,onClick:()=>{b()},type:"button",leftIcon:e.jsx(ae,{}),variant:"ghost",className:"text-nowrap",children:i("explorer.resource.editModal.access.url.button")})]})})]})};function he({resource:o,edit:a,onSuccess:r,onCancel:c}){var _;const{appCode:p}=q(),{t:d}=E(),v=ie(),t=oe(),m=H(),{reset:x,register:b,handleSubmit:i,setFocus:n,formState:{errors:I,isSubmitting:M,isValid:f}}=pe({mode:"onChange"}),$=h.useId(),u=re(),[k,N]=h.useState(new Date().getTime()),[P,R]=h.useState(!(o!=null&&o.public)),[S,y]=h.useState((o==null?void 0:o.slug)||""),[l,F]=h.useState(!1),{hotToast:L}=ne(V),[z,O]=h.useState({name:"",image:(_=m[0])==null?void 0:_.thumbnail}),X=s=>{O(s)},Y=()=>{O({name:"",image:""})};function Z(s){R(!s),s||(y(""),N(new Date().getTime()))}function D(s){if(!s)return"";const j="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",w="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",B=new RegExp(j.split("").join("|"),"g"),se=s.toString().toLowerCase().replace(/\s+/g,"-").replace(B,te=>w.charAt(j.indexOf(te))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");y(se)}const J=async function(s){var j,w;try{a?await v.mutateAsync({description:s.description,entId:(j=m[0])==null?void 0:j.assetId,name:s.title,public:s.enablePublic,slug:s.safeSlug,trashed:(w=m[0])==null?void 0:w.trashed,thumbnail:z.image}):await t.mutateAsync({name:s.title,description:s.description,thumbnail:z.image,folder:(u==null?void 0:u.id)==="default"?void 0:parseInt((u==null?void 0:u.id)||""),public:s.enablePublic,slug:s.safeSlug,app:p}),a&&F(!1),L.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:d("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",s.title]}),e.jsxs("p",{children:["Description: ",s.description]}),a&&p===G.BLOG&&e.jsxs("p",{children:["Public:"," ",s.enablePublic?d("explorer.enable.public.yes"):d("explorer.enable.public.no")]})]})),r==null||r()}catch(B){F(!0),console.error(B)}};function K(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${S}`),L.success(d("explorer.copy.clipboard"))}function Q(){x(),c()}const ee=`resource_edit_modal_${$}`;return{slug:S,disableSlug:P,formId:ee,errors:I,isSubmitting:M,isValid:f,versionSlug:k,correctSlug:l,onPublicChange:Z,onSlugChange:D,register:b,setFocus:n,handleSubmit:i,onFormCancel:Q,onSubmit:J,handleUploadImage:X,handleDeleteImage:Y,onCopyToClipBoard:K}}function Se({isOpen:o,edit:a,onSuccess:r,onCancel:c}){const{appCode:p,currentApp:d}=q(),t=H()[0],{slug:m,formId:x,isValid:b,isSubmitting:i,disableSlug:n,versionSlug:I,correctSlug:M,register:f,handleSubmit:$,onSubmit:u,handleUploadImage:k,handleDeleteImage:N,onCopyToClipBoard:P,onSlugChange:R,onPublicChange:S}=he({resource:t,edit:a,onSuccess:r,onCancel:c}),{data:y}=ce(),{t:l}=E();return de.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:o,onModalClose:c,children:[e.jsx(C.Header,{onModalClose:c,children:l(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(W,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:x,onSubmit:$(u),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(me,{app:d,src:t==null?void 0:t.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:k,onDeleteImage:N,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(g,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(U,{children:l("title")}),e.jsx(A,{type:"text",defaultValue:a?t==null?void 0:t.name:"",...f("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(g,{id:"description",isOptional:!0,children:[e.jsx(U,{children:l("description")}),e.jsx(A,{type:"text",defaultValue:a?t==null?void 0:t.description:"",...f("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),p===G.BLOG&&ue({workflow:"createPublic",actions:y})&&e.jsx(xe,{appCode:p,correctSlug:M,disableSlug:n,onCopyToClipBoard:P,onPublicChange:S,onSlugChange:R,resource:t,slug:m,versionSlug:I,register:f})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:x,type:"submit",color:"primary",variant:"filled",disabled:!b||i,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{Se as default};
1
+ import{u as E,j as e,A as V,F as g,x as A,U as le,B as T,W as ae,d as q,l as ie,X as oe,k as H,r as h,N as re,n as ne,Y as ce,a as de,M as C,Q as U,Z as ue}from"./index.js";import{APP as G}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{H as Q}from"./Heading.js";import{u as pe}from"./index.esm.js";import{I as me}from"./ImagePicker.js";const xe=({appCode:o,correctSlug:a,disableSlug:r,onPublicChange:c,onSlugChange:p,refPublic:d,refSlug:v,register:t,resource:m,slug:x,onCopyToClipBoard:b})=>{const{t:i}=E();return e.jsxs(e.Fragment,{children:[e.jsxs(Q,{headingStyle:"h4",level:"h3",className:"mb-16",children:[i("explorer.resource.editModal.heading.access"),o]}),e.jsx(V,{type:"info",children:i("explorer.resource.editModal.access.alert")}),e.jsxs(g,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(g.Input,{type:"checkbox",role:"switch",...t("enablePublic",{value:m.public,onChange:n=>c(n.target.checked)}),className:"form-check-input mt-0",size:"md"},d),e.jsx(g.Label,{className:"form-check-label mb-0",children:i("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(g,{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(A,{type:"text",...t("safeSlug",{validate:{required:n=>!n&&!r?i("explorer.slug.name.mandatory"):!0},disabled:r,value:x,onChange:n=>p(n.target.value)}),size:"md",placeholder:i("explorer.resource.editModal.access.url.extension")},v),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(le,{children:i("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:r,onClick:()=>{b()},type:"button",leftIcon:e.jsx(ae,{}),variant:"ghost",className:"text-nowrap",children:i("explorer.resource.editModal.access.url.button")})]})})]})};function he({resource:o,edit:a,onSuccess:r,onCancel:c}){var O;const{appCode:p}=q(),{t:d}=E(),v=ie(),t=oe(),m=H(),{reset:x,register:b,handleSubmit:i,setFocus:n,formState:{errors:I,isSubmitting:M,isValid:f}}=pe({mode:"onChange"}),$=h.useId(),u=re(),[k,N]=h.useState(new Date().getTime()),[P,R]=h.useState(!(o!=null&&o.public)),[S,w]=h.useState((o==null?void 0:o.slug)||""),[l,F]=h.useState(!1),{hotToast:L}=ne(V),[z,_]=h.useState({name:"",image:(O=m[0])==null?void 0:O.thumbnail}),W=s=>{_(s)},X=()=>{_({name:"",image:""})};function Y(s){R(!s),s||(w(""),N(new Date().getTime()))}function Z(s){if(!s)return"";const j="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",y="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",B=new RegExp(j.split("").join("|"),"g"),se=s.toString().toLowerCase().replace(/\s+/g,"-").replace(B,te=>y.charAt(j.indexOf(te))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");w(se)}const D=async function(s){var j,y;try{a?await v.mutateAsync({description:s.description,entId:(j=m[0])==null?void 0:j.assetId,name:s.title,public:s.enablePublic,slug:s.safeSlug,trashed:(y=m[0])==null?void 0:y.trashed,thumbnail:z.image}):await t.mutateAsync({name:s.title,description:s.description,thumbnail:z.image,folder:(u==null?void 0:u.id)==="default"?void 0:parseInt((u==null?void 0:u.id)||""),public:s.enablePublic,slug:s.safeSlug,app:p}),a&&F(!1),L.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:d("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",s.title]}),e.jsxs("p",{children:["Description: ",s.description]}),a&&p===G.BLOG&&e.jsxs("p",{children:["Public:"," ",s.enablePublic?d("explorer.enable.public.yes"):d("explorer.enable.public.no")]})]})),r==null||r()}catch(B){F(!0),console.error(B)}};function J(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${S}`),L.success(d("explorer.copy.clipboard"))}function K(){x(),c()}const ee=`resource_edit_modal_${$}`;return{slug:S,disableSlug:P,formId:ee,errors:I,isSubmitting:M,isValid:f,versionSlug:k,correctSlug:l,onPublicChange:Y,onSlugChange:Z,register:b,setFocus:n,handleSubmit:i,onFormCancel:K,onSubmit:D,handleUploadImage:W,handleDeleteImage:X,onCopyToClipBoard:J}}function Se({isOpen:o,edit:a,onSuccess:r,onCancel:c}){const{appCode:p,currentApp:d}=q(),t=H()[0],{slug:m,formId:x,isValid:b,isSubmitting:i,disableSlug:n,versionSlug:I,correctSlug:M,register:f,handleSubmit:$,onSubmit:u,handleUploadImage:k,handleDeleteImage:N,onCopyToClipBoard:P,onSlugChange:R,onPublicChange:S}=he({resource:t,edit:a,onSuccess:r,onCancel:c}),{data:w}=ce(),{t:l}=E();return de.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:o,onModalClose:c,children:[e.jsx(C.Header,{onModalClose:c,children:l(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(Q,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:x,onSubmit:$(u),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(me,{app:d,src:t==null?void 0:t.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:k,onDeleteImage:N,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(g,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(U,{children:l("title")}),e.jsx(A,{type:"text",defaultValue:a?t==null?void 0:t.name:"",...f("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(g,{id:"description",isOptional:!0,children:[e.jsx(U,{children:l("description")}),e.jsx(A,{type:"text",defaultValue:a?t==null?void 0:t.description:"",...f("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),p===G.BLOG&&ue({workflow:"createPublic",actions:w})&&e.jsx(xe,{appCode:p,correctSlug:M,disableSlug:n,onCopyToClipBoard:P,onPublicChange:S,onSlugChange:R,resource:t,slug:m,versionSlug:I,register:f})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:x,type:"submit",color:"primary",variant:"filled",disabled:!b||i,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{Se as default};
@@ -1 +1 @@
1
- import{e}from"./index.js";import{H as c}from"./Heading.js";const r=({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(c,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),m&&e.jsx("div",{className:"text",children:m})]});r.displayName="EmptyScreen";const l=r;export{l as E};
1
+ import{j as e}from"./index.js";import{H as c}from"./Heading.js";const r=({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(c,{level:"h2",headingStyle:"h2",className:"text-secondary mb-8",children:a}),m&&e.jsx("div",{className:"text",children:m})]});r.displayName="EmptyScreen";const l=r;export{l as E};
@@ -1 +1 @@
1
- import{d as n,g as a,u as c,Z as u,j as m,b as x}from"./index.js";import{E as d}from"./EmptyScreen.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Heading.js";function f(){const{appCode:o}=n(),{theme:t}=a(),[s]=x(),{t:r}=c(),{data:l}=u(),e=l==null?void 0:l.find(i=>i.id==="create"),p=()=>e!=null&&e.available&&(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):e!=null&&e.available&&!(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(e!=null&&e.available)&&(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return m.jsx(d,{imageSrc:`${s}/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${e!=null&&e.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{f as default};
1
+ import{d as n,f as a,u as c,Y as u,j as m,b as x}from"./index.js";import{E as d}from"./EmptyScreen.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Heading.js";function f(){const{appCode:o}=n(),{theme:t}=a(),[s]=x(),{t:r}=c(),{data:l}=u(),e=l==null?void 0:l.find(i=>i.id==="create"),p=()=>e!=null&&e.available&&(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt1d.create"):e!=null&&e.available&&!(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt2d.create"):!(e!=null&&e.available)&&(t!=null&&t.is1d)?r("explorer.emptyScreen.blog.txt1d.consultation"):r("explorer.emptyScreen.blog.txt2d.consultation");return m.jsx(d,{imageSrc:`${s}/emptyscreen/illu-${o}.svg`,imageAlt:r("explorer.emptyScreen.app.alt"),title:`${e!=null&&e.available?r("explorer.emptyScreen.blog.title.create"):r("explorer.emptyScreen.blog.title.consultation")}`,text:p()})}export{f as default};
@@ -1 +1 @@
1
- import{d as h,a8 as j,H as f,a9 as y,J as C,aa as I,ab as T,j as i,a1 as a}from"./index.js";import{C as b}from"./Card.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Tooltip.js";import"./usePopper.js";const H=()=>{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(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{H as default};
1
+ import{d as h,a7 as j,G as f,a8 as y,H as C,a9 as I,aa as T,j as i,a0 as a}from"./index.js";import{C as A}from"./Card.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Tooltip.js";import"./usePopper.js";const G=()=>{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{G as default};
package/dist/Heading.js CHANGED
@@ -1 +1 @@
1
- import{r as i,h as l,e as x}from"./index.js";const s=i.forwardRef(({level:a="h1",headingStyle:e="h1",children:r,className:t,...o},n)=>{const c=l(e,t);return x.jsx(a,{ref:n,className:c,...o,children:r})});s.displayName="Heading";const m=s;export{m as H};
1
+ import{r as i,g as l,j as x}from"./index.js";const s=i.forwardRef(({level:a="h1",headingStyle:e="h1",children:r,className:t,...o},n)=>{const c=l(e,t);return x.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 o,h as y,e,F as j,t as f,a5 as L,a6 as R,y as z,q as E,a7 as N}from"./index.js";const S=(s,d)=>{const[,c]=o.useState(!1),p=o.useCallback(a=>{a.preventDefault(),a.stopPropagation(),c(!0)},[]),l=a=>{a.preventDefault(),a.stopPropagation(),c(!1)};return{handleDragging:p,handleDragLeave:l,handleDrop:a=>{var g;l(a);const r=(g=a.dataTransfer)==null?void 0:g.files;d(r),s!=null&&s.current&&r&&(s.current.files=r)}}},A=S,C=o.forwardRef(({label:s,addButtonLabel:d="Add image",deleteButtonLabel:c="Delete image",src:p,className:l,app:h,onUploadImage:a,onDeleteImage:r},g)=>{const i=o.useRef(null),[t,u]=o.useState({name:"",image:p||""}),D=n=>{u({...t,name:"",image:""});const m=n==null?void 0:n[0];if(!m)return;const v={...t,name:m.name,image:URL.createObjectURL(m)};u(v),a(v)},$=()=>{var n;(n=i.current)==null||n.click()},b=()=>{i.current&&(i.current.value="");const n={...t,name:"",image:""};u(n),r()},k=n=>{D(n.target.files)},I=y("image-input",l),{handleDragging:x,handleDragLeave:P,handleDrop:w}=A(i,D);return e.jsxs(j,{id:"image-input",className:I,onDragEnter:x,onDragOver:x,onDragLeave:P,onDrop:w,ref:g,children:[e.jsxs("div",{className:"image-input-actions gap-8",children:[e.jsx(f,{"aria-label":d,color:"tertiary",icon:e.jsx(L,{}),onClick:$,type:"button",variant:"ghost"}),e.jsx(f,{"aria-label":c,color:"danger",disabled:!t.image,icon:e.jsx(R,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),e.jsxs(j.Label,{children:[e.jsx("span",{className:"visually-hidden",children:s}),e.jsx(z,{accept:"image/*",hidden:!0,onChange:k,ref:i,size:"sm",type:"file"}),t.image?e.jsx(E,{alt:t.name,src:t.image,size:"xl"}):e.jsx(N,{app:h,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const O=C;export{O as I};
1
+ import{r as o,g as y,j as e,F as j,s as f,a4 as L,a5 as R,x as z,p as E,a6 as N}from"./index.js";const S=(s,d)=>{const[,c]=o.useState(!1),p=o.useCallback(a=>{a.preventDefault(),a.stopPropagation(),c(!0)},[]),l=a=>{a.preventDefault(),a.stopPropagation(),c(!1)};return{handleDragging:p,handleDragLeave:l,handleDrop:a=>{var g;l(a);const r=(g=a.dataTransfer)==null?void 0:g.files;d(r),s!=null&&s.current&&r&&(s.current.files=r)}}},A=S,C=o.forwardRef(({label:s,addButtonLabel:d="Add image",deleteButtonLabel:c="Delete image",src:p,className:l,app:h,onUploadImage:a,onDeleteImage:r},g)=>{const i=o.useRef(null),[t,u]=o.useState({name:"",image:p||""}),x=n=>{u({...t,name:"",image:""});const m=n==null?void 0:n[0];if(!m)return;const v={...t,name:m.name,image:URL.createObjectURL(m)};u(v),a(v)},$=()=>{var n;(n=i.current)==null||n.click()},b=()=>{i.current&&(i.current.value="");const n={...t,name:"",image:""};u(n),r()},k=n=>{x(n.target.files)},I=y("image-input",l),{handleDragging:D,handleDragLeave:P,handleDrop:w}=A(i,x);return e.jsxs(j,{id:"image-input",className:I,onDragEnter:D,onDragOver:D,onDragLeave:P,onDrop:w,ref:g,children:[e.jsxs("div",{className:"image-input-actions gap-8",children:[e.jsx(f,{"aria-label":d,color:"tertiary",icon:e.jsx(L,{}),onClick:$,type:"button",variant:"ghost"}),e.jsx(f,{"aria-label":c,color:"danger",disabled:!t.image,icon:e.jsx(R,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),e.jsxs(j.Label,{children:[e.jsx("span",{className:"visually-hidden",children:s}),e.jsx(z,{accept:"image/*",hidden:!0,onChange:k,ref:i,size:"sm",type:"file"}),t.image?e.jsx(E,{alt:t.name,src:t.image,size:"xl"}):e.jsx(N,{app:h,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 l,e as r,I as x,B as c,f as m,u as p,g as d,j as g,b as h}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";const i=l.forwardRef(({text:e,textButton:a,src:s,alt:t,url:o},n)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:n,className:"p-16",children:[r.jsx(x,{width:"270",height:"140",loading:"lazy",className:"rounded",src:s,alt:t}),r.jsx("p",{className:"m-8",children:e}),r.jsx("a",{href:o,target:"_blank",rel:"noreferrer",children:r.jsx(c,{rightIcon:r.jsx(m,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));i.displayName="Library";const b=i,j=({url:e})=>{const{t:a}=p(),{theme:s}=d(),[t]=h();return g.jsx(b,{src:`${t}/${s==null?void 0:s.bootstrapVersion}/image-library.svg`,url:e,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{j as default};
1
+ import{r as n,j as r,I as c,B as x,e as m,u as p,f as d,b as h}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";const i=n.forwardRef(({text:e,textButton:a,src:s,alt:t,url:o},l)=>r.jsx(r.Fragment,{children:r.jsxs("div",{ref:l,className:"p-16",children:[r.jsx(c,{width:"270",height:"140",loading:"lazy",className:"rounded",src:s,alt:t}),r.jsx("p",{className:"m-8",children:e}),r.jsx("a",{href:o,target:"_blank",rel:"noreferrer",children:r.jsx(x,{rightIcon:r.jsx(m,{}),className:"py-0 px-8",variant:"ghost",color:"primary",children:a})})]})}));i.displayName="Library";const g=i,u=({url:e})=>{const{t:a}=p(),{theme:s}=d(),[t]=h();return r.jsx(g,{src:`${t}/${s==null?void 0:s.bootstrapVersion}/image-library.svg`,url:e,alt:a("explorer.libray.img.alt"),text:a("explorer.libray.title"),textButton:a("explorer.libray.btn")})};export{u as default};
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{r as I,G as v,H as T,l as M,J as y,K as j,u as b,N as F,a as S,j as o,M as n,T as w,B as h}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";function E({onSuccess:a}){const[s,r]=I.useState(),l=v(),d=T(),i=M(),{foldTreeItem:c,unfoldTreeItem:m}=y(),u=j();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 p=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of i)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=>{p(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function C({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=b(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,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:i,onTreeItemFold:d,onTreeItemUnfold:c})}),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{C as default};
1
+ import{r as I,E as v,G as T,k as M,H as y,J as j,u as b,K as F,a as S,j as o,M as n,T as w,B as h}from"./index.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";function E({onSuccess:a}){const[s,r]=I.useState(),l=v(),d=T(),i=M(),{foldTreeItem:c,unfoldTreeItem:m}=y(),u=j();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 p=e=>{var x;for(const t of d)if(e===t.id||e===t.parentId)return!1;for(const t of i)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=>{p(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function k({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=b(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,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:i,onTreeItemFold:d,onTreeItemUnfold:c})}),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{k as default};
@@ -1,2 +1,2 @@
1
- import{r as g,a0 as ae,R as re,e as i,a1 as se,h as B,a2 as le,a3 as ie,d as K,l as Q,o as ce,J as oe,a4 as H,j as e,A as D,u as O,a as ne,M as E,F as f,U as F,y as L,B as W,b as ue}from"./index.js";import{TransportFrameworkFactory as be,RESOURCE as pe}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{u as de}from"./index.esm.js";import{H as $}from"./Heading.js";import{I as me}from"./ImagePicker.js";import{u as he}from"./usePopper.js";import{S as G}from"./SelectList.js";const X=({trigger:t,content:r})=>{const[s,l]=g.useState(null),[c,a]=g.useState(null),{styles:o,attributes:h}=he(s,c,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[p,v]=g.useState(!1),d=ae(p,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),x=()=>{v(m=>!m)},b=re.cloneElement(t,{ref:l,onClick:x,state:p?"selected":"default"});return g.useEffect(()=>{const m=n=>{c&&!c.contains(n.target)&&s&&!s.contains(n.target)&&v(!1)};return document.addEventListener("mousedown",m,!0),document.addEventListener("touchstart",m,!0),()=>{document.removeEventListener("mousedown",m,!0),document.removeEventListener("touchstart",m,!0)}},[c,s]),i.jsxs(i.Fragment,{children:[b,d((m,n)=>i.jsx(i.Fragment,{children:n&&i.jsx(se.div,{className:B("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:a,style:{...o.popper,...m},...h.popper,children:r})}))]})};X.displayName="Dropdown";const J=X,ee=g.forwardRef(({title:t="",state:r,variant:s,icon:l,size:c="lg",grow:a=!1,badgeContent:o,...h},p)=>{const v=B("dropdown-trigger",r,c,s,a&&"flex-grow-1 justify-content-between");return i.jsxs("button",{ref:p,className:v,...h,type:"button",children:[l&&i.jsx("div",{className:"dropdown-trigger-icon",children:l}),i.jsx("div",{children:t}),o?i.jsx("div",{children:i.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:o})}):i.jsx("div",{className:"dropdown-trigger-carret-icon",children:i.jsx(le,{width:16,height:16})})]})});ee.displayName="DropdownTrigger";const Z=ee,te=g.forwardRef(({options:t,model:r,disabled:s=!1,placeholderOption:l=!1,...c},a)=>{const{isRequired:o,status:h}=ie(),p=g.useId(),v={...c,id:p,disabled:s,ref:a,className:B(c.className,"form-select c-pointer",{"is-invalid":h==="invalid","is-valid":h==="valid"})};return i.jsx(i.Fragment,{children:i.jsxs("select",{...v,required:o,children:[l&&i.jsx("option",{disabled:!0,selected:r===void 0,children:l}),t==null?void 0:t.map(d=>{const x=typeof d=="object"?d.value:d,b=typeof d=="object"?d.label:d;return i.jsx("option",{value:x,selected:r===x,children:b},x)})]})})});te.displayName="Select";const z=te,{http:C}=be.instance();function je({onSuccess:t}){const{user:r,currentApp:s}=K(),l=Q(),[c,a]=g.useState({name:"",image:l[0].thumbnail}),[o,h]=g.useState(!1),{hotToast:p}=ce(D),{publishApi:v}=oe(),{register:d,handleSubmit:x,formState:{errors:b,isSubmitting:m,isDirty:n,isValid:P}}=de({mode:"onChange"}),[T,I]=g.useState([]),[A,R]=g.useState([]);function k(u){a(u)}const N=r?r==null?void 0:r.userId:"";return{selectedResources:l,register:d,handleSubmit:x,formState:{errors:b,isSubmitting:m,isDirty:n,isValid:P},publish:async u=>{try{h(!0);let y=new Blob;c.image?y=await C.get(c.image,{responseType:"blob"}):l[0].thumbnail&&(y=await C.get(l[0].thumbnail,{responseType:"blob"}));const _=await C.get(`/userbook/avatar/${N}?thumbnail=48x48`,{responseType:"blob"}),M=await C.get(`/directory/user/${N}/attachment-school`,{responseType:"json"});let w="";s!=null&&s.displayName&&(w=H(s==null?void 0:s.displayName));const j={activityType:T,age:[u.ageMin,u.ageMax],application:H(w),cover:y,description:u.description,keyWords:u.keyWords,language:u.language,licence:"CC-BY",resourceId:l[0].assetId,resourceEntId:l[0].assetId,subjectArea:A,teacherAvatar:_,title:u.title,userId:N,userStructureName:M.name||(r==null?void 0:r.structureNames[0])},S=[pe.BLOG][0],V=await v(S,j);V.success?p.success(e.jsx(ve,{result:V}),{duration:1e4}):p.error(e.jsx(Y,{formData:u})),t==null||t()}catch{p.error(e.jsx(Y,{formData:u}))}finally{h(!1)}},handleDeleteImage:()=>{a({name:"",image:""})},handleUploadImage:k,selectedActivities:T,setSelectedActivities:I,selectedSubjectAreas:A,setSelectedSubjectAreas:R,loaderPublish:o,cover:c}}function ge(){const{t}=O(),r=[{value:"bpr.activityType.classroomActivity",label:t("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:t("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:t("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:t("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:t("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:t("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:t("bpr.activityType.courseElement")},{value:"bpr.other",label:t("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:t("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:t("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:t("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:t("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:t("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:t("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:t("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:t("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:t("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:t("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:t("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:t("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:t("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:t("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:t("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:t("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:t("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:t("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:t("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:t("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:t("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:t("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:t("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:t("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:t("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:t("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:t("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:t("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:t("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:t("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:t("bpr.subjectArea.technology")},{value:"bpr.other",label:t("bpr.other")}],l=[{value:"de_DE",label:t("de_DE")},{value:"en_EN",label:t("en_EN")},{value:"ar_DZ",label:t("ar_DZ")},{value:"es_ES",label:t("es_ES")},{value:"fr_FR",label:t("fr_FR")},{value:"it_IT",label:t("it_IT")},{value:"ja_JP",label:t("ja_JP")},{value:"zh_CN",label:t("zh_CN")},{value:"pt_PT",label:t("pt_PT")},{value:"ru_RU",label:t("ru_RU")},{value:"bpr.other",label:t("bpr.other")}];return{activityTypeOptions:r,subjectAreaOptions:s,languageOptions:l,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function Ee({isOpen:t,onSuccess:r,onCancel:s}){var M,w;const{currentApp:l}=K(),[c]=ue(),{t:a}=O(),{register:o,handleSubmit:h,publish:p,formState:{isDirty:v,isValid:d},handleUploadImage:x,selectedActivities:b,setSelectedActivities:m,selectedSubjectAreas:n,setSelectedSubjectAreas:P,handleDeleteImage:T,loaderPublish:I,cover:A}=je({onSuccess:r}),R=Q(),{activityTypeOptions:k,subjectAreaOptions:N,languageOptions:U,ageOptions:q}=ge(),u=a("bpr.form.publication.language"),y=a("bpr.form.publication.age.min"),_=a("bpr.form.publication.age.max");return ne.createPortal(e.jsxs(E,{isOpen:t,onModalClose:s,id:"libraryModal",size:"lg",children:[e.jsx(E.Header,{onModalClose:s,children:a("bpr.publish")}),e.jsx(E.Subtitle,{children:a("bpr.form.tip")}),e.jsxs(E.Body,{children:[e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:h(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:a("bpr.form.publication.cover.title")}),e.jsx(me,{app:l,src:(M=R[0])==null?void 0:M.thumbnail,label:a("bpr.form.publication.cover.upload.label"),addButtonLabel:a("bpr.form.publication.cover.upload.add"),deleteButtonLabel:a("bpr.form.publication.cover.upload.remove"),onUploadImage:x,onDeleteImage:T,className:"align-self-center"}),!A.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:a("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(f,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:a("bpr.form.publication.title")}),e.jsx(L,{type:"text",defaultValue:(w=R[0])==null?void 0:w.name,...o("title",{required:!0}),placeholder:a("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(f,{id:"description",isRequired:!0,children:[e.jsx(F,{children:a("bpr.form.publication.description")}),e.jsx(L,{type:"text",...o("description",{required:!0}),placeholder:a("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]})]})]}),e.jsx("hr",{}),e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("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(J,{trigger:e.jsx(Z,{title:a("bpr.form.publication.type"),size:"md",grow:!0,badgeContent:b==null?void 0:b.length}),content:e.jsx(G,{options:k,model:b,onChange:j=>m(j)})})}),e.jsx("div",{className:"col d-flex",children:e.jsx(J,{trigger:e.jsx(Z,{title:a("bpr.form.publication.discipline"),size:"md",grow:!0,badgeContent:n==null?void 0:n.length}),content:e.jsx(G,{options:N,model:n,onChange:j=>P(j)})})}),e.jsx("div",{className:"col",children:e.jsx(f,{id:"language",isRequired:!0,children:e.jsx(z,{...o("language",{required:!0,validate:j=>j!==u}),options:U,placeholderOption:u,defaultValue:u,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:a("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(f,{id:"ageMin",isRequired:!0,children:e.jsx(z,{...o("ageMin",{required:!0,validate:(j,S)=>parseInt(j)<=parseInt(S.ageMax)}),options:q,placeholderOption:y,defaultValue:y,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(f,{id:"ageMax",isRequired:!0,children:e.jsx(z,{...o("ageMax",{required:!0,validate:(j,S)=>parseInt(j)>=parseInt(S.ageMin)}),options:q,placeholderOption:_,defaultValue:_,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(f,{id:"keywords",isOptional:!0,children:[e.jsx(F,{children:a("bpr.form.publication.keywords")}),e.jsx(L,{type:"text",...o("keyWords"),size:"md",placeholder:a("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[a("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${c}image-cc-by-nc-sa.svg`,alt:`Icone licence Creative
2
- Commons`})]}),e.jsx("li",{children:a("bpr.form.publication.licence.text.2")})]}),e.jsx(D,{type:"info",className:"mb-12",children:a("bpr.form.publication.licence.text.3")}),e.jsx(D,{type:"warning",children:a("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(E.Footer,{children:[e.jsx(W,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:a("cancel")}),e.jsx(W,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:I,disabled:!A.image||I||!v||!d||(b==null?void 0:b.length)===0||(n==null?void 0:n.length)===0,children:a("bpr.form.submit")})]})]}),document.getElementById("portal"))}function ve({result:t}){const{t:r}=O();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:r("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:r("bpr.form.publication.response.success.content.2")}),t.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:t.details.front_url,target:"_blank",rel:"noreferrer",children:r("bpr.form.publication.response.success.button")})})]})}function Y({formData:t}){const{t:r}=O(),s=l=>l.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:r("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[s(t.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:r("bpr.form.publication.response.empty.title")})}),s(t.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:r("bpr.form.publication.response.empty.description")})})]})]})}export{Y as PublishModalError,ve as PublishModalSuccess,Ee as default};
1
+ import{r as j,$ as te,R as ae,j as e,a0 as re,g as D,a1 as se,a2 as le,d as Q,k as Y,n as ie,H as ce,a3 as U,A as z,u as C,a as oe,M as S,F as y,Q as q,x as F,B as V,b as ne}from"./index.js";import{TransportFrameworkFactory as ue,RESOURCE as be}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{u as pe}from"./index.esm.js";import{H as L}from"./Heading.js";import{I as de}from"./ImagePicker.js";import{u as me}from"./usePopper.js";import{S as W}from"./SelectList.js";const K=({trigger:t,content:r})=>{const[s,l]=j.useState(null),[i,a]=j.useState(null),{styles:c,attributes:m}=me(s,i,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,12]}}]}),[b,g]=j.useState(!1),p=te(b,{from:{opacity:0,y:10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}}),v=()=>{g(d=>!d)},u=ae.cloneElement(t,{ref:l,onClick:v,state:b?"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:[u,p((d,o)=>e.jsx(e.Fragment,{children:o&&e.jsx(re.div,{className:D("bg-white shadow rounded-4 d-block show py-12 px-8","bs-tooltip-auto"),ref:a,style:{...c.popper,...d},...m.popper,children:r})}))]})};K.displayName="Dropdown";const G=K,X=j.forwardRef(({title:t="",state:r,variant:s,icon:l,size:i="lg",grow:a=!1,badgeContent:c,...m},b)=>{const g=D("dropdown-trigger",r,i,s,a&&"flex-grow-1 justify-content-between");return e.jsxs("button",{ref:b,className:g,...m,type:"button",children:[l&&e.jsx("div",{className:"dropdown-trigger-icon",children:l}),e.jsx("div",{children:t}),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:t,model:r,disabled:s=!1,placeholderOption:l=!1,...i},a)=>{const{isRequired:c,status:m}=le(),b=j.useId(),g={...i,id:b,disabled:s,ref:a,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:r===void 0,children:l}),t==null?void 0:t.map(p=>{const v=typeof p=="object"?p.value:p,u=typeof p=="object"?p.label:p;return e.jsx("option",{value:v,selected:r===v,children:u},v)})]})})});ee.displayName="Select";const $=ee,{http:R}=ue.instance();function he({onSuccess:t}){const{user:r,currentApp:s}=Q(),l=Y(),[i,a]=j.useState({name:"",image:l[0].thumbnail}),[c,m]=j.useState(!1),{hotToast:b}=ie(z),{publishApi:g}=ce(),{register:p,handleSubmit:v,formState:{errors:u,isSubmitting:d,isDirty:o,isValid:O}}=pe({mode:"onChange"}),[T,E]=j.useState([]),[f,I]=j.useState([]);function P(n){a(n)}const A=r?r==null?void 0:r.userId:"";return{selectedResources:l,register:p,handleSubmit:v,formState:{errors:u,isSubmitting:d,isDirty:o,isValid:O},publish:async n=>{try{m(!0);let x=new Blob;i.image?x=await R.get(i.image,{responseType:"blob"}):l[0].thumbnail&&(x=await R.get(l[0].thumbnail,{responseType:"blob"}));const _=await R.get(`/userbook/avatar/${A}?thumbnail=48x48`,{responseType:"blob"}),M=await R.get(`/directory/user/${A}/attachment-school`,{responseType:"json"});let N="";s!=null&&s.displayName&&(N=U(s==null?void 0:s.displayName));const h={activityType:T,age:[n.ageMin,n.ageMax],application:U(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:M.name||(r==null?void 0:r.structureNames[0])},w=[be.BLOG][0],H=await g(w,h);H.success?b.success(e.jsx(ge,{result:H}),{duration:1e4}):b.error(e.jsx(Z,{formData:n})),t==null||t()}catch{b.error(e.jsx(Z,{formData:n}))}finally{m(!1)}},handleDeleteImage:()=>{a({name:"",image:""})},handleUploadImage:P,selectedActivities:T,setSelectedActivities:E,selectedSubjectAreas:f,setSelectedSubjectAreas:I,loaderPublish:c,cover:i}}function je(){const{t}=C(),r=[{value:"bpr.activityType.classroomActivity",label:t("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:t("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:t("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:t("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:t("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:t("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:t("bpr.activityType.courseElement")},{value:"bpr.other",label:t("bpr.other")}],s=[{value:"bpr.subjectArea.artActivity",label:t("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:t("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:t("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:t("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:t("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:t("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:t("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:t("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:t("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:t("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:t("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:t("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:t("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:t("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:t("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:t("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:t("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:t("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:t("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:t("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:t("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:t("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:t("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:t("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:t("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:t("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:t("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:t("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:t("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:t("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:t("bpr.subjectArea.technology")},{value:"bpr.other",label:t("bpr.other")}],l=[{value:"de_DE",label:t("de_DE")},{value:"en_EN",label:t("en_EN")},{value:"ar_DZ",label:t("ar_DZ")},{value:"es_ES",label:t("es_ES")},{value:"fr_FR",label:t("fr_FR")},{value:"it_IT",label:t("it_IT")},{value:"ja_JP",label:t("ja_JP")},{value:"zh_CN",label:t("zh_CN")},{value:"pt_PT",label:t("pt_PT")},{value:"ru_RU",label:t("ru_RU")},{value:"bpr.other",label:t("bpr.other")}];return{activityTypeOptions:r,subjectAreaOptions:s,languageOptions:l,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function Se({isOpen:t,onSuccess:r,onCancel:s}){var M,N;const{currentApp:l}=Q(),[i]=ne(),{t:a}=C(),{register:c,handleSubmit:m,publish:b,formState:{isDirty:g,isValid:p},handleUploadImage:v,selectedActivities:u,setSelectedActivities:d,selectedSubjectAreas:o,setSelectedSubjectAreas:O,handleDeleteImage:T,loaderPublish:E,cover:f}=he({onSuccess:r}),I=Y(),{activityTypeOptions:P,subjectAreaOptions:A,languageOptions:B,ageOptions:k}=je(),n=a("bpr.form.publication.language"),x=a("bpr.form.publication.age.min"),_=a("bpr.form.publication.age.max");return oe.createPortal(e.jsxs(S,{isOpen:t,onModalClose:s,id:"libraryModal",size:"lg",children:[e.jsx(S.Header,{onModalClose:s,children:a("bpr.publish")}),e.jsx(S.Subtitle,{children:a("bpr.form.tip")}),e.jsxs(S.Body,{children:[e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:m(b),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:a("bpr.form.publication.cover.title")}),e.jsx(de,{app:l,src:(M=I[0])==null?void 0:M.thumbnail,label:a("bpr.form.publication.cover.upload.label"),addButtonLabel:a("bpr.form.publication.cover.upload.add"),deleteButtonLabel:a("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:a("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:a("bpr.form.publication.title")}),e.jsx(F,{type:"text",defaultValue:(N=I[0])==null?void 0:N.name,...c("title",{required:!0}),placeholder:a("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(y,{id:"description",isRequired:!0,children:[e.jsx(q,{children:a("bpr.form.publication.description")}),e.jsx(F,{type:"text",...c("description",{required:!0}),placeholder:a("bpr.form.publication.description.placeholder"),size:"md","aria-required":!0})]})]})]}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("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:a("bpr.form.publication.type"),size:"md",grow:!0,badgeContent:u==null?void 0:u.length}),content:e.jsx(W,{options:P,model:u,onChange:h=>d(h)})})}),e.jsx("div",{className:"col d-flex",children:e.jsx(G,{trigger:e.jsx(J,{title:a("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:a("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:k,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:k,placeholderOption:_,defaultValue:_,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(y,{id:"keywords",isOptional:!0,children:[e.jsx(q,{children:a("bpr.form.publication.keywords")}),e.jsx(F,{type:"text",...c("keyWords"),size:"md",placeholder:a("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[a("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${i}image-cc-by-nc-sa.svg`,alt:`Icone licence Creative
2
+ Commons`})]}),e.jsx("li",{children:a("bpr.form.publication.licence.text.2")})]}),e.jsx(z,{type:"info",className:"mb-12",children:a("bpr.form.publication.licence.text.3")}),e.jsx(z,{type:"warning",children:a("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(S.Footer,{children:[e.jsx(V,{color:"tertiary",onClick:s,type:"button",variant:"ghost",children:a("cancel")}),e.jsx(V,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:E,disabled:!f.image||E||!g||!p||(u==null?void 0:u.length)===0||(o==null?void 0:o.length)===0,children:a("bpr.form.submit")})]})]}),document.getElementById("portal"))}function ge({result:t}){const{t:r}=C();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:r("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:r("bpr.form.publication.response.success.content.2")}),t.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:t.details.front_url,target:"_blank",rel:"noreferrer",children:r("bpr.form.publication.response.success.button")})})]})}function Z({formData:t}){const{t:r}=C(),s=l=>l.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:r("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[s(t.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:r("bpr.form.publication.response.empty.title")})}),s(t.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:r("bpr.form.publication.response.empty.description")})})]})]})}export{Z as PublishModalError,ge as PublishModalSuccess,Se as default};
@@ -1 +1 @@
1
- import{ac as W,ad as tt,d as st,u as it,a8 as at,i as ot,ae as ut,l as dt,J as mt,E as ct,aa as lt,r as _t,h as ft,j as z,R as K,a1 as X,B as ht}from"./index.js";import{C as Mt}from"./Card.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Tooltip.js";import"./usePopper.js";var et={exports:{}};(function($,T){(function(m,u){$.exports=u()})(W,function(){var m=1e3,u=6e4,p=36e5,_="millisecond",r="second",S="minute",M="hour",c="day",Y="week",f="month",I="quarter",w="year",j="date",k="Invalid Date",q=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,J={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(s){var e=["th","st","nd","rd"],t=s%100;return"["+s+(e[(t-20)%10]||e[t]||e[0])+"]"}},F=function(s,e,t){var i=String(s);return!i||i.length>=e?s:""+Array(e+1-i.length).join(t)+s},O={s:F,z:function(s){var e=-s.utcOffset(),t=Math.abs(e),i=Math.floor(t/60),n=t%60;return(e<=0?"+":"-")+F(i,2,"0")+":"+F(n,2,"0")},m:function s(e,t){if(e.date()<t.date())return-s(t,e);var i=12*(t.year()-e.year())+(t.month()-e.month()),n=e.clone().add(i,f),o=t-n<0,a=e.clone().add(i+(o?-1:1),f);return+(-(i+(t-n)/(o?n-a:a-n))||0)},a:function(s){return s<0?Math.ceil(s)||0:Math.floor(s)},p:function(s){return{M:f,y:w,w:Y,d:c,D:j,h:M,m:S,s:r,ms:_,Q:I}[s]||String(s||"").toLowerCase().replace(/s$/,"")},u:function(s){return s===void 0}},D="en",h={};h[D]=J;var H=function(s){return s instanceof E},b=function s(e,t,i){var n;if(!e)return D;if(typeof e=="string"){var o=e.toLowerCase();h[o]&&(n=o),t&&(h[o]=t,n=o);var a=e.split("-");if(!n&&a.length>1)return s(a[0])}else{var l=e.name;h[l]=e,n=l}return!i&&n&&(D=n),n||!i&&D},v=function(s,e){if(H(s))return s.clone();var t=typeof e=="object"?e:{};return t.date=s,t.args=arguments,new E(t)},d=O;d.l=b,d.i=H,d.w=function(s,e){return v(s,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var E=function(){function s(t){this.$L=b(t.locale,null,!0),this.parse(t)}var e=s.prototype;return e.parse=function(t){this.$d=function(i){var n=i.date,o=i.utc;if(n===null)return new Date(NaN);if(d.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var a=n.match(q);if(a){var l=a[2]-1||0,y=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],l,a[3]||1,a[4]||0,a[5]||0,a[6]||0,y)):new Date(a[1],l,a[3]||1,a[4]||0,a[5]||0,a[6]||0,y)}}return new Date(n)}(t),this.$x=t.x||{},this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return d},e.isValid=function(){return this.$d.toString()!==k},e.isSame=function(t,i){var n=v(t);return this.startOf(i)<=n&&n<=this.endOf(i)},e.isAfter=function(t,i){return v(t)<this.startOf(i)},e.isBefore=function(t,i){return this.endOf(i)<v(t)},e.$g=function(t,i,n){return d.u(t)?this[i]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,i){var n=this,o=!!d.u(i)||i,a=d.p(t),l=function(P,x){var C=d.w(n.$u?Date.UTC(n.$y,x,P):new Date(n.$y,x,P),n);return o?C:C.endOf(c)},y=function(P,x){return d.w(n.toDate()[P].apply(n.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(x)),n)},g=this.$W,L=this.$M,N=this.$D,A="set"+(this.$u?"UTC":"");switch(a){case w:return o?l(1,0):l(31,11);case f:return o?l(1,L):l(0,L+1);case Y:var U=this.$locale().weekStart||0,Z=(g<U?g+7:g)-U;return l(o?N-Z:N+(6-Z),L);case c:case j:return y(A+"Hours",0);case M:return y(A+"Minutes",1);case S:return y(A+"Seconds",2);case r:return y(A+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,i){var n,o=d.p(t),a="set"+(this.$u?"UTC":""),l=(n={},n[c]=a+"Date",n[j]=a+"Date",n[f]=a+"Month",n[w]=a+"FullYear",n[M]=a+"Hours",n[S]=a+"Minutes",n[r]=a+"Seconds",n[_]=a+"Milliseconds",n)[o],y=o===c?this.$D+(i-this.$W):i;if(o===f||o===w){var g=this.clone().set(j,1);g.$d[l](y),g.init(),this.$d=g.set(j,Math.min(this.$D,g.daysInMonth())).$d}else l&&this.$d[l](y);return this.init(),this},e.set=function(t,i){return this.clone().$set(t,i)},e.get=function(t){return this[d.p(t)]()},e.add=function(t,i){var n,o=this;t=Number(t);var a=d.p(i),l=function(L){var N=v(o);return d.w(N.date(N.date()+Math.round(L*t)),o)};if(a===f)return this.set(f,this.$M+t);if(a===w)return this.set(w,this.$y+t);if(a===c)return l(1);if(a===Y)return l(7);var y=(n={},n[S]=u,n[M]=p,n[r]=m,n)[a]||1,g=this.$d.getTime()+t*y;return d.w(g,this)},e.subtract=function(t,i){return this.add(-1*t,i)},e.format=function(t){var i=this,n=this.$locale();if(!this.isValid())return n.invalidDate||k;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=d.z(this),l=this.$H,y=this.$m,g=this.$M,L=n.weekdays,N=n.months,A=function(x,C,Q,G){return x&&(x[C]||x(i,o))||Q[C].slice(0,G)},U=function(x){return d.s(l%12||12,x,"0")},Z=n.meridiem||function(x,C,Q){var G=x<12?"AM":"PM";return Q?G.toLowerCase():G},P={YY:String(this.$y).slice(-2),YYYY:d.s(this.$y,4,"0"),M:g+1,MM:d.s(g+1,2,"0"),MMM:A(n.monthsShort,g,N,3),MMMM:A(N,g),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:A(n.weekdaysMin,this.$W,L,2),ddd:A(n.weekdaysShort,this.$W,L,3),dddd:L[this.$W],H:String(l),HH:d.s(l,2,"0"),h:U(1),hh:U(2),a:Z(l,y,!0),A:Z(l,y,!1),m:String(y),mm:d.s(y,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:a};return o.replace(R,function(x,C){return C||P[x]||a.replace(":","")})},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,i,n){var o,a=d.p(i),l=v(t),y=(l.utcOffset()-this.utcOffset())*u,g=this-l,L=d.m(this,l);return L=(o={},o[w]=L/12,o[f]=L,o[I]=L/3,o[Y]=(g-y)/6048e5,o[c]=(g-y)/864e5,o[M]=g/p,o[S]=g/u,o[r]=g/m,o)[a]||g,n?L:d.a(L)},e.daysInMonth=function(){return this.endOf(f).$D},e.$locale=function(){return h[this.$L]},e.locale=function(t,i){if(!t)return this.$L;var n=this.clone(),o=b(t,i,!0);return o&&(n.$L=o),n},e.clone=function(){return d.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},s}(),V=E.prototype;return v.prototype=V,[["$ms",_],["$s",r],["$m",S],["$H",M],["$W",c],["$M",f],["$y",w],["$D",j]].forEach(function(s){V[s[1]]=function(e){return this.$g(e,s[0],s[1])}}),v.extend=function(s,e){return s.$i||(s(e,E,v),s.$i=!0),v},v.locale=b,v.isDayjs=H,v.unix=function(s){return v(1e3*s)},v.en=h[D],v.Ls=h,v.p={},v})})(et);var B=et.exports;const nt=tt(B);var rt={exports:{}};(function($,T){(function(m,u){$.exports=u()})(W,function(){return function(m,u,p){m=m||{};var _=u.prototype,r={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function S(c,Y,f,I){return _.fromToBase(c,Y,f,I)}p.en.relativeTime=r,_.fromToBase=function(c,Y,f,I,w){for(var j,k,q,R=f.$locale().relativeTime||r,J=m.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],F=J.length,O=0;O<F;O+=1){var D=J[O];D.d&&(j=I?p(c).diff(f,D.d,!0):f.diff(c,D.d,!0));var h=(m.rounding||Math.round)(Math.abs(j));if(q=j>0,h<=D.r||!D.r){h<=1&&O>0&&(D=J[O-1]);var H=R[D.l];w&&(h=w(""+h)),k=typeof H=="string"?H.replace("%d",h):H(h,Y,D.l,q);break}}if(Y)return k;var b=q?R.future:R.past;return typeof b=="function"?b(k):b.replace("%s",k)},_.to=function(c,Y){return S(c,Y,this,!0)},_.from=function(c,Y){return S(c,Y,this)};var M=function(c){return c.$u?p.utc():p()};_.toNow=function(c){return this.to(M(this),c)},_.fromNow=function(c){return this.from(M(this),c)}}})})(rt);var pt=rt.exports;const gt=tt(pt);var vt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var p=u(m),_={s:"ein paar Sekunden",m:["eine Minute","einer Minute"],mm:"%d Minuten",h:["eine Stunde","einer Stunde"],hh:"%d Stunden",d:["ein Tag","einem Tag"],dd:["%d Tage","%d Tagen"],M:["ein Monat","einem Monat"],MM:["%d Monate","%d Monaten"],y:["ein Jahr","einem Jahr"],yy:["%d Jahre","%d Jahren"]};function r(M,c,Y){var f=_[Y];return Array.isArray(f)&&(f=f[c?0:1]),f.replace("%d",M)}var S={name:"de",weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),ordinal:function(M){return M+"."},weekStart:1,yearStart:4,formats:{LTS:"HH:mm:ss",LT:"HH:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"vor %s",s:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r}};return p.default.locale(S,null,!0),S})})(vt);var yt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(r){return r+"º"}};return p.default.locale(_,null,!0),_})})(yt);var Yt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"pt",weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sab".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"),months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(r){return r+"º"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},relativeTime:{future:"em %s",past:"há %s",s:"alguns segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"}};return p.default.locale(_,null,!0),_})})(Yt);var $t={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(r){return""+r+(r===1?"er":"")}};return p.default.locale(_,null,!0),_})})($t);var St={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"it",weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),weekStart:1,monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"tra %s",past:"%s fa",s:"qualche secondo",m:"un minuto",mm:"%d minuti",h:"un' ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(r){return r+"º"}};return p.default.locale(_,null,!0),_})})(St);nt.extend(gt);function Dt($){const{rights:T,creatorId:m}=$;return T.filter(p=>!p.includes(m)).length>=1}const jt=()=>{const{currentApp:$,currentLanguage:T,appCode:m}=st(),{t:u}=it(),{data:p,isFetching:_,fetchNextPage:r}=at(),S=ot(),M=ut(),c=dt(),{setSelectedResources:Y,setResourceIds:f,openResource:I,setResourceIsTrash:w}=mt(),j=ct(),k=lt({from:{opacity:0},to:{opacity:1}}),R=S.pagination.startIdx+S.pagination.pageSize<(S.pagination.maxIdx||0),J=_t.useCallback(()=>{r()},[]),F=h=>{j?(w(!0),f([h.id]),Y([h])):I(h)};function O(h){M.includes(h.id)?(f(M.filter(H=>H!==h.id)),Y(c.filter(H=>H.id!==h.id))):(f([...M,h.id]),Y([...c,h]))}const D=ft("grid ps-0 list-unstyled");return z.jsxs(K.Fragment,{children:[z.jsx(X.ul,{className:D,children:p==null?void 0:p.pages.map((h,H)=>z.jsx(K.Fragment,{children:h.resources.map(b=>{const{id:v,creatorName:d,creatorId:E,name:V,thumbnail:s,updatedAt:e}=b,t=Dt(b),i=nt(e).locale(T).fromNow();return z.jsx(X.li,{className:"g-col-4",style:{...k},children:z.jsx(Mt,{app:$,className:"c-pointer",creatorName:d,isPublic:b.public,isSelected:M.includes(b.id),isLoading:_,isShared:t,messagePublic:u("tooltip.public",{ns:m}),messageShared:u("tooltip.shared",{ns:m}),name:V,onOpen:()=>F(b),onSelect:()=>O(b),resourceSrc:s,updatedAt:i,userSrc:`/userbook/avatar/${E}`})},v)})},H))}),R&&z.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:z.jsx(ht,{type:"button",color:"secondary",variant:"filled",onClick:J,children:u("explorer.see.more")})})]})};export{jt as default};
1
+ import{ab as W,ac as tt,d as st,u as it,a7 as at,h as ot,ad as ut,k as dt,H as mt,D as ct,a9 as lt,r as _t,g as ft,j as z,R as K,a0 as X,B as ht}from"./index.js";import{C as Mt}from"./Card.js";import"/assets/js/ode-ts-client/ode-ts-client.esm.js";import"./Tooltip.js";import"./usePopper.js";var et={exports:{}};(function($,T){(function(m,u){$.exports=u()})(W,function(){var m=1e3,u=6e4,p=36e5,_="millisecond",r="second",S="minute",M="hour",c="day",Y="week",f="month",I="quarter",w="year",j="date",k="Invalid Date",q=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(s){var e=["th","st","nd","rd"],t=s%100;return"["+s+(e[(t-20)%10]||e[t]||e[0])+"]"}},J=function(s,e,t){var i=String(s);return!i||i.length>=e?s:""+Array(e+1-i.length).join(t)+s},O={s:J,z:function(s){var e=-s.utcOffset(),t=Math.abs(e),i=Math.floor(t/60),n=t%60;return(e<=0?"+":"-")+J(i,2,"0")+":"+J(n,2,"0")},m:function s(e,t){if(e.date()<t.date())return-s(t,e);var i=12*(t.year()-e.year())+(t.month()-e.month()),n=e.clone().add(i,f),o=t-n<0,a=e.clone().add(i+(o?-1:1),f);return+(-(i+(t-n)/(o?n-a:a-n))||0)},a:function(s){return s<0?Math.ceil(s)||0:Math.floor(s)},p:function(s){return{M:f,y:w,w:Y,d:c,D:j,h:M,m:S,s:r,ms:_,Q:I}[s]||String(s||"").toLowerCase().replace(/s$/,"")},u:function(s){return s===void 0}},D="en",h={};h[D]=F;var H=function(s){return s instanceof P},b=function s(e,t,i){var n;if(!e)return D;if(typeof e=="string"){var o=e.toLowerCase();h[o]&&(n=o),t&&(h[o]=t,n=o);var a=e.split("-");if(!n&&a.length>1)return s(a[0])}else{var l=e.name;h[l]=e,n=l}return!i&&n&&(D=n),n||!i&&D},v=function(s,e){if(H(s))return s.clone();var t=typeof e=="object"?e:{};return t.date=s,t.args=arguments,new P(t)},d=O;d.l=b,d.i=H,d.w=function(s,e){return v(s,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var P=function(){function s(t){this.$L=b(t.locale,null,!0),this.parse(t)}var e=s.prototype;return e.parse=function(t){this.$d=function(i){var n=i.date,o=i.utc;if(n===null)return new Date(NaN);if(d.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var a=n.match(q);if(a){var l=a[2]-1||0,y=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],l,a[3]||1,a[4]||0,a[5]||0,a[6]||0,y)):new Date(a[1],l,a[3]||1,a[4]||0,a[5]||0,a[6]||0,y)}}return new Date(n)}(t),this.$x=t.x||{},this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return d},e.isValid=function(){return this.$d.toString()!==k},e.isSame=function(t,i){var n=v(t);return this.startOf(i)<=n&&n<=this.endOf(i)},e.isAfter=function(t,i){return v(t)<this.startOf(i)},e.isBefore=function(t,i){return this.endOf(i)<v(t)},e.$g=function(t,i,n){return d.u(t)?this[i]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,i){var n=this,o=!!d.u(i)||i,a=d.p(t),l=function(E,x){var C=d.w(n.$u?Date.UTC(n.$y,x,E):new Date(n.$y,x,E),n);return o?C:C.endOf(c)},y=function(E,x){return d.w(n.toDate()[E].apply(n.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(x)),n)},g=this.$W,L=this.$M,N=this.$D,A="set"+(this.$u?"UTC":"");switch(a){case w:return o?l(1,0):l(31,11);case f:return o?l(1,L):l(0,L+1);case Y:var U=this.$locale().weekStart||0,Z=(g<U?g+7:g)-U;return l(o?N-Z:N+(6-Z),L);case c:case j:return y(A+"Hours",0);case M:return y(A+"Minutes",1);case S:return y(A+"Seconds",2);case r:return y(A+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,i){var n,o=d.p(t),a="set"+(this.$u?"UTC":""),l=(n={},n[c]=a+"Date",n[j]=a+"Date",n[f]=a+"Month",n[w]=a+"FullYear",n[M]=a+"Hours",n[S]=a+"Minutes",n[r]=a+"Seconds",n[_]=a+"Milliseconds",n)[o],y=o===c?this.$D+(i-this.$W):i;if(o===f||o===w){var g=this.clone().set(j,1);g.$d[l](y),g.init(),this.$d=g.set(j,Math.min(this.$D,g.daysInMonth())).$d}else l&&this.$d[l](y);return this.init(),this},e.set=function(t,i){return this.clone().$set(t,i)},e.get=function(t){return this[d.p(t)]()},e.add=function(t,i){var n,o=this;t=Number(t);var a=d.p(i),l=function(L){var N=v(o);return d.w(N.date(N.date()+Math.round(L*t)),o)};if(a===f)return this.set(f,this.$M+t);if(a===w)return this.set(w,this.$y+t);if(a===c)return l(1);if(a===Y)return l(7);var y=(n={},n[S]=u,n[M]=p,n[r]=m,n)[a]||1,g=this.$d.getTime()+t*y;return d.w(g,this)},e.subtract=function(t,i){return this.add(-1*t,i)},e.format=function(t){var i=this,n=this.$locale();if(!this.isValid())return n.invalidDate||k;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=d.z(this),l=this.$H,y=this.$m,g=this.$M,L=n.weekdays,N=n.months,A=function(x,C,Q,G){return x&&(x[C]||x(i,o))||Q[C].slice(0,G)},U=function(x){return d.s(l%12||12,x,"0")},Z=n.meridiem||function(x,C,Q){var G=x<12?"AM":"PM";return Q?G.toLowerCase():G},E={YY:String(this.$y).slice(-2),YYYY:d.s(this.$y,4,"0"),M:g+1,MM:d.s(g+1,2,"0"),MMM:A(n.monthsShort,g,N,3),MMMM:A(N,g),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:A(n.weekdaysMin,this.$W,L,2),ddd:A(n.weekdaysShort,this.$W,L,3),dddd:L[this.$W],H:String(l),HH:d.s(l,2,"0"),h:U(1),hh:U(2),a:Z(l,y,!0),A:Z(l,y,!1),m:String(y),mm:d.s(y,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:a};return o.replace(R,function(x,C){return C||E[x]||a.replace(":","")})},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,i,n){var o,a=d.p(i),l=v(t),y=(l.utcOffset()-this.utcOffset())*u,g=this-l,L=d.m(this,l);return L=(o={},o[w]=L/12,o[f]=L,o[I]=L/3,o[Y]=(g-y)/6048e5,o[c]=(g-y)/864e5,o[M]=g/p,o[S]=g/u,o[r]=g/m,o)[a]||g,n?L:d.a(L)},e.daysInMonth=function(){return this.endOf(f).$D},e.$locale=function(){return h[this.$L]},e.locale=function(t,i){if(!t)return this.$L;var n=this.clone(),o=b(t,i,!0);return o&&(n.$L=o),n},e.clone=function(){return d.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},s}(),V=P.prototype;return v.prototype=V,[["$ms",_],["$s",r],["$m",S],["$H",M],["$W",c],["$M",f],["$y",w],["$D",j]].forEach(function(s){V[s[1]]=function(e){return this.$g(e,s[0],s[1])}}),v.extend=function(s,e){return s.$i||(s(e,P,v),s.$i=!0),v},v.locale=b,v.isDayjs=H,v.unix=function(s){return v(1e3*s)},v.en=h[D],v.Ls=h,v.p={},v})})(et);var B=et.exports;const nt=tt(B);var rt={exports:{}};(function($,T){(function(m,u){$.exports=u()})(W,function(){return function(m,u,p){m=m||{};var _=u.prototype,r={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function S(c,Y,f,I){return _.fromToBase(c,Y,f,I)}p.en.relativeTime=r,_.fromToBase=function(c,Y,f,I,w){for(var j,k,q,R=f.$locale().relativeTime||r,F=m.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],J=F.length,O=0;O<J;O+=1){var D=F[O];D.d&&(j=I?p(c).diff(f,D.d,!0):f.diff(c,D.d,!0));var h=(m.rounding||Math.round)(Math.abs(j));if(q=j>0,h<=D.r||!D.r){h<=1&&O>0&&(D=F[O-1]);var H=R[D.l];w&&(h=w(""+h)),k=typeof H=="string"?H.replace("%d",h):H(h,Y,D.l,q);break}}if(Y)return k;var b=q?R.future:R.past;return typeof b=="function"?b(k):b.replace("%s",k)},_.to=function(c,Y){return S(c,Y,this,!0)},_.from=function(c,Y){return S(c,Y,this)};var M=function(c){return c.$u?p.utc():p()};_.toNow=function(c){return this.to(M(this),c)},_.fromNow=function(c){return this.from(M(this),c)}}})})(rt);var pt=rt.exports;const gt=tt(pt);var vt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var p=u(m),_={s:"ein paar Sekunden",m:["eine Minute","einer Minute"],mm:"%d Minuten",h:["eine Stunde","einer Stunde"],hh:"%d Stunden",d:["ein Tag","einem Tag"],dd:["%d Tage","%d Tagen"],M:["ein Monat","einem Monat"],MM:["%d Monate","%d Monaten"],y:["ein Jahr","einem Jahr"],yy:["%d Jahre","%d Jahren"]};function r(M,c,Y){var f=_[Y];return Array.isArray(f)&&(f=f[c?0:1]),f.replace("%d",M)}var S={name:"de",weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),ordinal:function(M){return M+"."},weekStart:1,yearStart:4,formats:{LTS:"HH:mm:ss",LT:"HH:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},relativeTime:{future:"in %s",past:"vor %s",s:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r}};return p.default.locale(S,null,!0),S})})(vt);var yt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(r){return r+"º"}};return p.default.locale(_,null,!0),_})})(yt);var Yt={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"pt",weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sab".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"),months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(r){return r+"º"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},relativeTime:{future:"em %s",past:"há %s",s:"alguns segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"}};return p.default.locale(_,null,!0),_})})(Yt);var $t={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(r){return""+r+(r===1?"er":"")}};return p.default.locale(_,null,!0),_})})($t);var St={exports:{}};(function($,T){(function(m,u){$.exports=u(B)})(W,function(m){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(m),_={name:"it",weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),weekStart:1,monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"tra %s",past:"%s fa",s:"qualche secondo",m:"un minuto",mm:"%d minuti",h:"un' ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(r){return r+"º"}};return p.default.locale(_,null,!0),_})})(St);nt.extend(gt);function Dt($){const{rights:T,creatorId:m}=$;return T.filter(p=>!p.includes(m)).length>=1}const jt=()=>{const{currentApp:$,currentLanguage:T,appCode:m}=st(),{t:u}=it(),{data:p,isFetching:_,fetchNextPage:r}=at(),S=ot(),M=ut(),c=dt(),{setSelectedResources:Y,setResourceIds:f,openResource:I,setResourceIsTrash:w}=mt(),j=ct(),k=lt({from:{opacity:0},to:{opacity:1}}),R=S.pagination.startIdx+S.pagination.pageSize<(S.pagination.maxIdx||0),F=_t.useCallback(()=>{r()},[]),J=h=>{j?(w(!0),f([h.id]),Y([h])):I(h)};function O(h){M.includes(h.id)?(f(M.filter(H=>H!==h.id)),Y(c.filter(H=>H.id!==h.id))):(f([...M,h.id]),Y([...c,h]))}const D=ft("grid ps-0 list-unstyled");return z.jsxs(K.Fragment,{children:[z.jsx(X.ul,{className:D,children:p==null?void 0:p.pages.map((h,H)=>z.jsx(K.Fragment,{children:h.resources.map(b=>{const{id:v,creatorName:d,creatorId:P,name:V,thumbnail:s,updatedAt:e}=b,t=Dt(b),i=nt(e).locale(T).fromNow();return z.jsx(X.li,{className:"g-col-4",style:{...k},children:z.jsx(Mt,{app:$,className:"c-pointer",creatorName:d,isPublic:b.public,isSelected:M.includes(b.id),isLoading:_,isShared:t,messagePublic:u("tooltip.public",{ns:m}),messageShared:u("tooltip.shared",{ns:m}),name:V,onOpen:()=>J(b),onSelect:()=>O(b),resourceSrc:s,updatedAt:i,userSrc:`/userbook/avatar/${P}`})},v)})},H))}),R&&z.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:z.jsx(ht,{type:"button",color:"secondary",variant:"filled",onClick:F,children:u("explorer.see.more")})})]})};export{jt as default};
@@ -1 +1 @@
1
- import{r as x,e as s,h as o,R as f}from"./index.js";const u=({options:a,hideCheckbox:d,isMonoSelection:m,onChange:i,model:h=[]})=>{const[c,r]=x.useState(h),n=e=>{r(m?[e]:l=>{const t=[...l];return l.includes(e)?t.splice(t.indexOf(e),1):t.push(e),t})};return x.useEffect(()=>{i==null||i(c)},[c]),s.jsx(s.Fragment,{children:s.jsx("div",{className:"select-list",children:a==null?void 0:a.map(e=>s.jsxs("div",{className:o("select-list-option",d&&c.includes(e.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":c.includes(e.value),onMouseUp:()=>{n(e.value)},tabIndex:0,onKeyDown:l=>{l.key==="Enter"&&n(e.value)},children:[s.jsx("div",{className:"select-list-option-icon",children:e.icon&&f.createElement(e.icon,{width:"20px",height:"20px"})}),s.jsx("div",{className:"select-list-option-label",children:e.label}),!d&&s.jsx("div",{className:"select-list-option-checkbox",children:s.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:c.includes(e.value),className:"form-check-input c-pointer",id:"option.value"})})]},e.value))})})};u.displayName="SelectList";const p=u;export{p as S};
1
+ import{r as x,j as s,g as o,R as j}from"./index.js";const u=({options:a,hideCheckbox:d,isMonoSelection:m,onChange:i,model:h=[]})=>{const[c,r]=x.useState(h),n=e=>{r(m?[e]:l=>{const t=[...l];return l.includes(e)?t.splice(t.indexOf(e),1):t.push(e),t})};return x.useEffect(()=>{i==null||i(c)},[c]),s.jsx(s.Fragment,{children:s.jsx("div",{className:"select-list",children:a==null?void 0:a.map(e=>s.jsxs("div",{className:o("select-list-option",d&&c.includes(e.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":c.includes(e.value),onMouseUp:()=>{n(e.value)},tabIndex:0,onKeyDown:l=>{l.key==="Enter"&&n(e.value)},children:[s.jsx("div",{className:"select-list-option-icon",children:e.icon&&j.createElement(e.icon,{width:"20px",height:"20px"})}),s.jsx("div",{className:"select-list-option-label",children:e.label}),!d&&s.jsx("div",{className:"select-list-option-checkbox",children:s.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:c.includes(e.value),className:"form-check-input c-pointer",id:"option.value"})})]},e.value))})})};u.displayName="SelectList";const p=u;export{p as S};
@@ -1 +1 @@
1
- import{r,h as W,e as R,d as de,u as te,j as e,i as ye,k as je,l as he,m as ve,n as Se,o as Ne,p as se,A as we,a as Ie,M as G,V as Z,q as ie,B as V,s as ne,t as Be,v as Ae,F as ee,w as Re,x as Ce,y as Me,z as Te}from"./index.js";import{odeServices as F,APP as $e}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{H as ae}from"./Heading.js";import{T as Ee}from"./Tooltip.js";import{S as Fe}from"./SelectList.js";import"./usePopper.js";function Ue(){const[n,h]=r.useState(!1);r.useEffect(()=>{u()},[]);const u=r.useCallback(async()=>{const m=await F.session().isAdml();h(m)},[]);return{isAdml:n}}function Pe(n,h){const[u,m]=r.useState(n);return r.useEffect(()=>{const o=setTimeout(()=>{m(n)},h||500);return()=>{clearTimeout(o)}},[n,h]),u}const ue=r.forwardRef(({label:n,disabled:h=!1,checked:u=!1,indeterminate:m=!1,...o},S)=>{const g=r.useRef(null);r.useImperativeHandle(S,()=>({...g.current})),r.useEffect(()=>{g.current.indeterminate=m},[g,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:g,className:W(o.className,"form-check-input c-pointer"),id:y};return R.jsxs("div",{className:"position-relative d-inline-block",children:[R.jsx("input",{...p}),n&&R.jsx("label",{className:"ms-8 form-check-label",htmlFor:p.id,children:n})]})});ue.displayName="Checkbox";const le=ue,me=r.forwardRef(({model:n,icon:h,label:u=!1,disabled:m=!1,...o},S)=>{const g=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:W(o.className,"form-check-input c-pointer",h&&"d-none"),id:g};return R.jsxs("div",{className:W("position-relative form-check",h&&"ps-0"),children:[R.jsx("input",{...y}),h&&R.jsx("label",{htmlFor:y.id,className:W("c-pointer",n!==o.value&&"text-muted"),children:h}),!h&&u&&R.jsx("label",{className:"form-check-label",htmlFor:y.id,children:u})]})});me.displayName="Radio";const ce=me;function De({radioPublicationValue:n,onRadioPublicationChange:h}){const{appCode:u}=de(),{t:m}=te(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(ae,{headingStyle:"h4",level:"h3",className:"mb-16",children:m("explorer.publication.steps")}),e.jsx(ce,{label:m("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:n,onChange:o=>h(o.target.value)}),e.jsx(ce,{label:m("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:n,onChange:o=>h(o.target.value)})]})}function ze({radioPublicationValue:n,onRadioPublicationChange:h}){const{app:u}=ye();return u===$e.BLOG?e.jsx(De,{radioPublicationValue:n,onRadioPublicationChange:h}):e.jsx(e.Fragment,{})}function Le({onSuccess:n,payloadUpdatePublishType:h}){const{appCode:u}=de(),{t:m}=te(),{user:o,avatar:S}=je(),[g,y]=r.useState(r.useId()),[p,k]=r.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[j,N]=r.useState([]),[U,H]=r.useState(""),[w,q]=r.useState(!1),[C,_]=r.useState(""),I=Pe(C,500),[J,K]=r.useState([]),[M,P]=r.useState([]),[D,Q]=r.useState(!1),[T,O]=r.useState(!1),{isAdml:B}=Ue(),A=he(),X=ve(),Y=Se(),{hotToast:l}=Ne(we);r.useEffect(()=>{z()},[]),r.useEffect(()=>{be(I)},[I]);const z=r.useCallback(async()=>{var a;const t=await F.share().getActionsForApp(u);N(t);const d=await F.share().getRightsForResource(u,(a=A[0])==null?void 0:a.assetId);k(d)},[]),c=(t,d)=>{k(({rights:a,...f})=>{var re,oe;const s=[...a],i=s.findIndex(x=>x.id===t.id),$=j.filter(x=>x.id===d)[0];if(s[i].actions.findIndex(x=>x.id===d)>-1){let x=s[i].actions.filter(b=>b.id!==d);const v=j.filter(b=>{var E;return(E=b.requires)==null?void 0:E.includes(d)});x=x.filter(b=>!v.find(E=>E.id===b.id)),s[i]={...s[i],actions:x}}else{const x=j.filter(v=>{var b;return((b=$.requires)==null?void 0:b.includes(v.id))&&!s[i].actions.find(E=>E.id===v.id)});s[i]={...s[i],actions:[...s[i].actions,$,...x]}}return t.type==="sharebookmark"&&((re=s[i].users)==null||re.forEach(x=>{const v=s.findIndex(b=>b.id===x.id);s[v]={...s[v],actions:s[i].actions}}),(oe=s[i].groups)==null||oe.forEach(x=>{const v=s.findIndex(b=>b.id===x.id);s[v]={...s[v],actions:s[i].actions}})),{rights:s,...f}})},L=async()=>{var t;try{await X.mutateAsync(h),await Y.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"))}},pe=t=>{k(d=>({...d,rights:p.rights.filter(a=>{var f,s;return a.id!==t.id&&!((f=t.users)!=null&&f.find(i=>i.id===a.id))&&!((s=t.groups)!=null&&s.find(i=>i.id===a.id))})}))},xe=t=>{_(t.target.value)},ke=()=>!T&&!B&&I.length>0&&M.length===0||!T&&B&&I.length>3&&M.length===0,fe=()=>B&&C.length<3,ge=()=>T&&C.length>0,be=async t=>{var d;if(O(!0),!B&&t.length>=1||B&&t.length>=3){const a=await F.share().searchShareSubjects(u,(d=A[0])==null?void 0:d.assetId,t);K(a);const f=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}));P(f)}else P([]),Promise.resolve();O(!1)};return{currentIsAuthor:()=>{for(const t of A)if(t.creatorId!==(o==null?void 0:o.userId))return!1;return!0},idBookmark:g,myAvatar:S,shareRights:p,shareRightActions:j,showBookmarkInput:w,searchInputValue:C,searchResults:M,bookmarkName:U,showBookmarkMembers:D,debouncedSearchInputValue:I,searchPending:T,setBookmarkName:H,saveBookmark:async t=>{try{const d=await F.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(g+new Date().getTime().toString()),q(!1)}catch(d){console.error("Failed to save bookmark",d),l.error(m("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:q,handleActionCheckbox:c,handleShare:L,handleDeleteRow:pe,handleSearchInputChange:xe,handleSearchResultsChange:async t=>{const d=J.find(f=>f.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(d){let f=[];if(d.type==="sharebookmark"){const s=await F.directory().getBookMarkById(d.id);f.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(i=>!p.rights.find($=>$.id===i.id)).forEach(i=>{f.push({...i,type:"user",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})}),s.groups.filter(i=>!p.rights.find($=>$.id===i.id)).forEach(i=>{f.push({...i,type:"group",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})})}else f=[{...d,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];k({...p,rights:[...p.rights,...f]}),P(M.filter(s=>s.value!==t[0]))}},showSearchNoResults:ke,showSearchAdmlHint:fe,showSearchLoading:ge,handleBookmarkMembersToggle:()=>{Q(!D)},hasRight:(t,d)=>t.actions.filter(a=>d.id===a.id).length>0,showShareRightLine:t=>t.isBookmarkMember&&D||!t.isBookmarkMember}}function Ve(){const n=he(),{assetId:h,description:u,thumbnail:m,name:o,public:S,trashed:g,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,U]=r.useState({description:u,entId:h,name:o,public:!!S,slug:y||"",thumbnail:m,trashed:g,"publish-type":p});return r.useEffect(()=>{k&&U(w=>({...w,"publish-type":k}))},[k]),{radioPublicationValue:k,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{j(w)}}}function as({isOpen:n,onSuccess:h,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:o,handleRadioPublicationChange:S}=Ve(),{myAvatar:g,idBookmark:y,shareRights:p,shareRightActions:k,showBookmarkInput:j,searchResults:N,bookmarkName:U,showBookmarkMembers:H,searchPending:w,currentIsAuthor:q,setBookmarkName:C,saveBookmark:_,canSave:I,toggleBookmarkInput:J,handleActionCheckbox:K,handleShare:M,handleDeleteRow:P,handleSearchInputChange:D,handleSearchResultsChange:Q,showSearchNoResults:T,showSearchAdmlHint:O,showSearchLoading:B,handleBookmarkMembersToggle:A,hasRight:X,showShareRightLine:Y}=Le({payloadUpdatePublishType:m,onSuccess:h,onCancel:u}),{t:l}=te(),z=r.useRef(null);return Ie.createPortal(e.jsxs(G,{id:"share_modal",size:"lg",isOpen:n,onModalClose:u,children:[e.jsx(G.Header,{onModalClose:u,children:l("share.title")}),e.jsxs(G.Body,{children:[e.jsx(ae,{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",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"w-32",children:e.jsx(Z,{children:l("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Z,{children:l("explorer.modal.share.search.placeholder")})}),k.map(c=>e.jsx("th",{scope:"col",className:"text-center text-white",children:l(c.displayName)},c.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Z,{children:l("close")})})]})}),e.jsxs("tbody",{children:[q()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(ie,{alt:l("explorer.modal.share.avatar.me.alt"),size:"xs",src:g,variant:"circle"})}),e.jsx("td",{children:l("share.me")}),k.map(c=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(le,{checked:!0,disabled:!0})},c.displayName)),e.jsx("td",{})]}),p==null?void 0:p.rights.map(c=>Y(c)&&e.jsxs("tr",{className:c.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[c.type!=="sharebookmark"&&e.jsx(ie,{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(ne,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:H?"-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 text-white",children:e.jsx(le,{checked:X(c,L),onChange:()=>K(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:()=>P(c)})})]},c.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(V,{color:"tertiary",leftIcon:e.jsx(se,{}),rightIcon:e.jsx(ne,{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(!j),children:l("share.save.sharebookmark")}),j&&e.jsx("div",{className:"mt-16",children:e.jsxs(ee,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[e.jsx("div",{className:"flex-fill",children:e.jsx(ee.Input,{ref:z,onChange:()=>{C(()=>{var c;return((c=z.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:U.length===0,leftIcon:e.jsx(Re,{}),onClick:()=>{_(z.current.value)},className:"text-nowrap",children:l("explorer.modal.share.sharebookmark.save")})]})})]}),e.jsx("hr",{}),e.jsxs(ae,{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(Ce,{className:"c-pointer",height:"18"})})]}),e.jsxs(ee,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Me,{className:"max-w-512",noValidationIcon:!0,placeholder:O()?l("explorer.search.adml.hint"):l("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:D}),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")})]}),T()&&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(Fe,{options:N,hideCheckbox:!0,isMonoSelection:!0,onChange:Q})}),e.jsx(ze,{radioPublicationValue:o,onRadioPublicationChange:S})]}),e.jsxs(G.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:M,disabled:!I(),children:l("share")})]})]}),document.getElementById("portal"))}export{as as default};
1
+ import{r,g as G,j as e,d as ce,u as ae,h as be,i as ye,k as de,l as je,m as ve,n as Se,o as ee,A as Ne,a as we,M as O,V as Y,p as oe,B as V,q as ie,s as Ie,t as Be,F as Z,v as Ae,w as Ce,x as Re,y as Me}from"./index.js";import{odeServices as E,APP as Te}from"/assets/js/ode-ts-client/ode-ts-client.esm.js";import{H as se}from"./Heading.js";import{T as $e}from"./Tooltip.js";import{S as Ee}from"./SelectList.js";import"./usePopper.js";function Fe(){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}}function Ue(n,h){const[u,m]=r.useState(n);return r.useEffect(()=>{const o=setTimeout(()=>{m(n)},h||500);return()=>{clearTimeout(o)}},[n,h]),u}const he=r.forwardRef(({label:n,disabled:h=!1,checked:u=!1,indeterminate:m=!1,...o},S)=>{const g=r.useRef(null);r.useImperativeHandle(S,()=>({...g.current})),r.useEffect(()=>{g.current.indeterminate=m},[g,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:g,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 g=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:g};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}=be();return u===Te.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}=ye(),[g,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=Ue(C,500),[_,J]=r.useState([]),[R,U]=r.useState([]),[P,K]=r.useState(!1),[M,q]=r.useState(!1),{isAdml:B}=Fe(),A=de(),Q=je(),X=ve(),{hotToast:l}=Se(Ne);r.useEffect(()=>{D()},[]),r.useEffect(()=>{ge(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,...f})=>{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(b=>b.id!==d);const v=j.filter(b=>{var $;return($=b.requires)==null?void 0:$.includes(d)});x=x.filter(b=>!v.find($=>$.id===b.id)),s[i]={...s[i],actions:x}}else{const x=j.filter(v=>{var b;return((b=T.requires)==null?void 0:b.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(b=>b.id===x.id);s[v]={...s[v],actions:s[i].actions}}),(re=s[i].groups)==null||re.forEach(x=>{const v=s.findIndex(b=>b.id===x.id);s[v]={...s[v],actions:s[i].actions}})),{rights:s,...f}})},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 f,s;return a.id!==t.id&&!((f=t.users)!=null&&f.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,fe=()=>M&&C.length>0,ge=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 f=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(f)}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:g,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(g+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(f=>f.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(d){let f=[];if(d.type==="sharebookmark"){const s=await E.directory().getBookMarkById(d.id);f.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{f.push({...i,type:"user",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})}),s.groups.filter(i=>!p.rights.find(T=>T.id===i.id)).forEach(i=>{f.push({...i,type:"group",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})})}else f=[{...d,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];k({...p,rights:[...p.rights,...f]}),U(R.filter(s=>s.value!==t[0]))}},showSearchNoResults:xe,showSearchAdmlHint:ke,showSearchLoading:fe,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:g,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:g,"publish-type":p});return r.useEffect(()=>{k&&F(w=>({...w,"publish-type":k}))},[k]),{radioPublicationValue:k,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{j(w)}}}function ss({isOpen:n,onSuccess:h,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:o,handleRadioPublicationChange:S}=Ve(),{myAvatar:g,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 we.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",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 text-white",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:g,variant:"circle"})}),e.jsx("td",{children:l("share.me")}),k.map(c=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",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 text-white",children:e.jsx(ne,{checked:Q(c,L),onChange:()=>J(c,L.id)})},L.displayName)),e.jsx("td",{children:!c.isBookmarkMember&&e.jsx(Ie,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Be,{}),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(Ae,{}),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($e,{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(Ce,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Re,{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(Me,{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(Ee,{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{ss as default};
package/dist/Tooltip.js CHANGED
@@ -1 +1 @@
1
- import{r as s,e,h as v}from"./index.js";import{u as E}from"./usePopper.js";const h=({children:l,message:n,icon:t=null,placement:a="auto"})=>{const[i,p]=s.useState(null),[c,m]=s.useState(null),[u,d]=s.useState(null),{styles:o,attributes:x}=E(i,c,{placement:a,modifiers:[{name:"arrow",options:{element:u}}]}),[f,r]=s.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:m,style:o.popper,...x.popper,children:[e.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[t&&t,e.jsx("div",{children:n})]}),e.jsx("div",{className:"tooltip-arrow",ref:d,style:o.arrow})]})]})},b=h;export{b as T};
1
+ import{r as s,j as e,g as v}from"./index.js";import{u as E}from"./usePopper.js";const j=({children:l,message:n,icon:t=null,placement:a="auto"})=>{const[i,p]=s.useState(null),[c,m]=s.useState(null),[u,d]=s.useState(null),{styles:o,attributes:x}=E(i,c,{placement:a,modifiers:[{name:"arrow",options:{element:u}}]}),[f,r]=s.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:m,style:o.popper,...x.popper,children:[e.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[t&&t,e.jsx("div",{children:n})]}),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,21 @@
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";
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";
25
30
  var WORKFLOW_PUBLISH =
26
- "org.entcore.blog.controllers.BlogController|publish";
27
- var WORKFLOW_PRINT = "org.entcore.blog.controllers.BlogController|print";
31
+ "net.atos.entng.mindmap.controllers.MindmapController|publish";
28
32
  var odeConfig = {
29
- app: "blog",
30
- types: ["blog"],
33
+ app: "mindmap",
34
+ types: ["mindmap"],
31
35
  filters: [
32
36
  { id: "owner", defaultValue: true },
33
37
  { id: "public", defaultValue: false },
@@ -61,11 +65,6 @@
61
65
  workflow: WORKFLOW_CREATE,
62
66
  target: "tree",
63
67
  },
64
- {
65
- id: "createPublic",
66
- workflow: WORKFLOW_CREATE_PUBLIC,
67
- target: "tree",
68
- },
69
68
  {
70
69
  id: "move",
71
70
  workflow: WORFLOW_ACCESS,