ode-explorer 1.0.2-dev.202309281447 → 1.0.3-develop-pedago-develop-pedago.202310021429

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 l,j as e,ag as P,g as c,I,a8 as S,ah as T,ai as k,q as z,aj as A,t as E,ak as B,al as U}from"./index.js";import{T as w}from"./Tooltip.js";const $=l.createContext(null);$.displayName="CardContext";const y=()=>{const s=l.useContext($);if(!s)throw new Error("Cannot be rendered outside the Card component");return s},R=l.forwardRef(()=>{const{options:{name:s},isLoading:a,appCode:t,classesTitle:r}=y();return e.jsxs("div",{className:"card-body",children:[e.jsx(P,{width:"48",height:"48",className:c(`color-app-${t}`,{placeholder:a})}),e.jsx("div",{children:e.jsx("h3",{className:r,children:e.jsx("strong",{children:s})})})]})});R.displayName="Card.Folder";const q=R,F=l.forwardRef(()=>{const{options:s,isLoading:a,tooltips:t,classesTitle:r,app:o}=y(),{type:u,imageSrc:n,name:j,creatorName:d,userSrc:i,updatedAt:g,isShared:v,isPublic:N}=s,{messagePublic:C,messageShared:h}=t||{},x=c("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:a}),f=c("card-text small",{placeholder:a}),m=c("small text-truncate",{placeholder:a}),b=i?e.jsx(z,{alt:d||"",size:"xs",src:i,variant:"circle",width:"24",height:"24"}):e.jsx(A,{});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card-body",children:[n?e.jsx("div",{className:"card-image",children:e.jsx(I,{alt:"",src:n,width:"80",height:"80",objectFit:"cover",className:c("h-full",{placeholder:a})})}):e.jsx(S,{app:o,iconFit:"ratio",size:"80",variant:"rounded"}),e.jsxs("div",{children:[e.jsx("h3",{className:r,children:e.jsx("strong",{children:j})}),e.jsx("p",{className:"card-text small",children:e.jsx("em",{className:f,children:g})})]})]}),u==="resource"?e.jsxs("div",{className:"card-footer gap-16",children:[e.jsxs("div",{className:x,children:[b,e.jsx("p",{className:m,children:d})]}),e.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[N&&e.jsx(w,{message:C,placement:"top",children:e.jsx(T,{width:16,height:16})}),v&&e.jsx(w,{message:h,placement:"top",children:e.jsx(k,{width:16,height:16})})]})]}):null]})});F.displayName="Card.Resource";const G=F,O=l.forwardRef(({options:s,tooltips:a,isLoading:t,app:r,onSelect:o,onOpen:u,isSelected:n,isAnimated:j,className:d,...i},g)=>{const{getIconCode:v}=U();function N(b){b.stopPropagation(),o==null||o()}const{type:C}=s,h=r?v(r):"placeholder",x=c("card-title body text-break text-truncate text-truncate-2 pe-32",{placeholder:t}),f=l.useMemo(()=>({options:s,isLoading:t,classesTitle:x,app:r,appCode:h,tooltips:a}),[r,h,x,t,s,a]),m={folder:e.jsx(p.Folder,{}),resource:e.jsx(p.Resource,{}),undefined:e.jsx(p.Resource,{}),default:null};return e.jsx($.Provider,{value:f,children:e.jsxs("div",{ref:g,className:c("card",{"placeholder-glow":t,"is-selected":n,"is-animated":j},d),...i,children:[e.jsxs("div",{className:"card-header",children:[!t&&e.jsx(E,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:e.jsx(B,{}),onClick:N,variant:"ghost"}),e.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"})]}),m[C]||m.default]})})});O.displayName="Card";const p=Object.assign(O,{Resource:G,Folder:q}),H=p;export{H as C};
1
+ import{r as o,j as e,ae as P,g as c,I,a6 as S,af as T,ag as z,q as A,ah as k,t as E,ai as B,aj as U}from"./index.js";import{T as w}from"./Tooltip.js";const $=o.createContext(null);$.displayName="CardContext";const y=()=>{const s=o.useContext($);if(!s)throw new Error("Cannot be rendered outside the Card component");return s},R=o.forwardRef(()=>{const{options:{name:s},isLoading:a,appCode:t,classesTitle:r}=y();return e.jsxs("div",{className:"card-body",children:[e.jsx(P,{width:"48",height:"48",className:c(`color-app-${t}`,{placeholder:a})}),e.jsx("div",{children:e.jsx("h3",{className:r,children:e.jsx("strong",{children:s})})})]})});R.displayName="Card.Folder";const q=R,F=o.forwardRef(()=>{const{options:s,isLoading:a,tooltips:t,classesTitle:r,app:l}=y(),{type:u,imageSrc:n,name:j,creatorName:d,userSrc:i,updatedAt:g,isShared:v,isPublic:N}=s,{messagePublic:C,messageShared:h}=t||{},x=c("d-inline-flex align-items-center gap-8 text-truncate",{placeholder:a}),f=c("card-text small",{placeholder:a}),m=c("small text-truncate",{placeholder:a}),b=i?e.jsx(A,{alt:d||"",size:"xs",src:i,variant:"circle",width:"24",height:"24"}):e.jsx(k,{});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card-body",children:[n?e.jsx("div",{className:"card-image",children:e.jsx(I,{alt:"",src:n,width:"80",height:"80",objectFit:"cover",className:c("h-full",{placeholder:a})})}):e.jsx(S,{app:l,iconFit:"ratio",size:"80",variant:"rounded"}),e.jsxs("div",{children:[e.jsx("h3",{className:r,children:e.jsx("strong",{children:j})}),e.jsx("p",{className:"card-text small",children:e.jsx("em",{className:f,children:g})})]})]}),u==="resource"?e.jsxs("div",{className:"card-footer gap-16",children:[e.jsxs("div",{className:x,children:[b,e.jsx("p",{className:m,children:d})]}),e.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[N&&e.jsx(w,{message:C,placement:"top",children:e.jsx(T,{width:16,height:16})}),v&&e.jsx(w,{message:h,placement:"top",children:e.jsx(z,{width:16,height:16})})]})]}):null]})});F.displayName="Card.Resource";const G=F,O=o.forwardRef(({options:s,tooltips:a,isLoading:t,app:r,onSelect:l,onOpen:u,isSelected:n,isAnimated:j,className:d,...i},g)=>{const{getIconCode:v}=U();function N(b){b.stopPropagation(),l==null||l()}const{type:C}=s,h=r?v(r):"placeholder",x=c("card-title body text-break text-truncate text-truncate-2 pe-32",{placeholder:t}),f=o.useMemo(()=>({options:s,isLoading:t,classesTitle:x,app:r,appCode:h,tooltips:a}),[r,h,x,t,s,a]),m={folder:e.jsx(p.Folder,{}),resource:e.jsx(p.Resource,{}),undefined:e.jsx(p.Resource,{}),default:null};return e.jsx($.Provider,{value:f,children:e.jsxs("div",{ref:g,className:c("card",{"placeholder-glow":t,"is-selected":n,"is-animated":j},d),...i,children:[e.jsxs("div",{className:"card-header",children:[!t&&e.jsx(E,{"aria-label":"Open Action Bar",className:"z-3",color:"secondary",icon:e.jsx(B,{}),onClick:N,variant:"ghost"}),e.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"})]}),m[C]||m.default]})})});O.displayName="Card";const p=Object.assign(O,{Resource:G,Folder:q}),H=p;export{H as C};
@@ -1 +1 @@
1
- import{u as d,D as u,E as x,G as p,o as m,A as j,a as f,j as e,M as n,B as i}from"./index.js";import"/assets/js/edifice-ts-client/index.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
+ import{u as d,C as u,D as x,E as p,o as m,A as j,a as f,j as e,M as n,B as i}from"./index.js";import"/assets/js/edifice-ts-client/index.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{J as D,P as B,Q as q,U as L,r as C,u as R,a as U,j as r,M as s,F as w,W as P,y as T,B as b}from"./index.js";import{FOLDER as V}from"/assets/js/edifice-ts-client/index.js";import{u as _}from"./index.esm.js";function k({edit:a,onSuccess:e,onClose:i}){var F;const l=D(),t=B(),m=q(),c=L(),u=a?(F=l[0])==null?void 0:F.name:void 0,{reset:o,register:f,handleSubmit:n,setFocus:p,formState:{errors:x,isSubmitting:h,isDirty:I,isValid:E}}=_({mode:"onChange",values:{name:u||""}}),g=C.useId(),M=async function({name: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)||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 W({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]),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(P,{children:t("explorer.create.folder.name")}),r.jsx(T,{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{W as default};
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/edifice-ts-client/index.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 +1 @@
1
- import{u as B,j as e,A as V,F as g,y as H,X as ne,B as A,Y as ce,d as U,m as de,Z as ue,l as G,h as pe,r as x,P as me,o as he,N as xe,$ as ge,a as be,M as C,W as O,a0 as fe}from"./index.js";import{APP as Q}from"/assets/js/edifice-ts-client/index.js";import{H as K}from"./Heading.js";import{u as je}from"./index.esm.js";import{I as ve,T as ye}from"./TextArea.js";const Se=({appCode:r,correctSlug:l,disableSlug:o,onPublicChange:c,onSlugChange:m,refPublic:d,refSlug:v,register:t,resource:u,slug:h,onCopyToClipBoard:b})=>{const{t:i}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(K,{headingStyle:"h4",level:"h3",className:"mb-16",children:[i("explorer.resource.editModal.heading.access"),r]}),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:u&&u.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:l?"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(H,{type:"text",...t("safeSlug",{validate:{required:n=>!n&&!o?i("explorer.slug.name.mandatory"):!0},disabled:o,value:h,onChange:n=>m(n.target.value)}),size:"md",placeholder:i("explorer.resource.editModal.access.url.extension")},v),l&&e.jsx("div",{className:"position-absolute",children:e.jsx(ne,{children:i("explorer.slug.name.error")})})]}),e.jsx(A,{color:"primary",disabled:o,onClick:()=>{b()},type:"button",leftIcon:e.jsx(ce,{}),variant:"ghost",className:"text-nowrap",children:i("explorer.resource.editModal.access.url.button")})]})})]})};function Ce({resource:r,edit:l,onSuccess:o,onCancel:c}){var _;const{appCode:m}=U(),{t:d}=B(),v=de(),t=ue(),u=G(),h=pe(),{reset:b,register:i,handleSubmit:n,setFocus:w,formState:{errors:I,isSubmitting:f,isValid:$}}=je({mode:"onChange"}),M=x.useId(),p=me(),[P,N]=x.useState(new Date().getTime()),[k,R]=x.useState(!(r!=null&&r.public)),[y,a]=x.useState((r==null?void 0:r.slug)||""),[W,E]=x.useState(!1),{hotToast:F}=he(V),[L,q]=x.useState({name:"",image:(_=u[0])==null?void 0:_.thumbnail}),X=s=>{q(s)},Y=()=>{q({name:"",image:""})};function Z(s){R(!s),s||(a(""),N(new Date().getTime()))}function D(s){if(!s)return"";const j="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",S="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",T=new RegExp(j.split("").join("|"),"g"),re=s.toString().toLowerCase().replace(/\s+/g,"-").replace(T,oe=>S.charAt(j.indexOf(oe))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");a(re)}const J=xe(),{filters:z,trashed:ee}=h,se=["context",{folderId:z.folder,filters:z,trashed:ee}],te=async function(s){var j,S;try{l?(await v.mutateAsync({description:s.description||"",entId:(j=u[0])==null?void 0:j.assetId,name:s.title,public:s.enablePublic,slug:s.safeSlug,trashed:(S=u[0])==null?void 0:S.trashed,thumbnail:L.image}),E(!1)):(J.invalidateQueries(se),t.mutateAsync({name:s.title,description:s.description||"",thumbnail:L.image,folder:(p==null?void 0:p.id)==="default"?void 0:parseInt((p==null?void 0:p.id)||""),public:s.enablePublic,slug:s.safeSlug,app:m})),F.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]}),l&&m===Q.BLOG&&e.jsxs("p",{children:["Public:"," ",s.enablePublic?d("explorer.enable.public.yes"):d("explorer.enable.public.no")]})]})),o==null||o()}catch(T){E(!0),console.error(T)}};function ae(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${y}`),F.success(d("explorer.copy.clipboard"))}function le(){b(),c()}const ie=`resource_edit_modal_${M}`;return{slug:y,disableSlug:k,formId:ie,errors:I,isSubmitting:f,isValid:$,versionSlug:P,correctSlug:W,onPublicChange:Z,onSlugChange:D,register:i,setFocus:w,handleSubmit:n,onFormCancel:le,onSubmit:te,handleUploadImage:X,handleDeleteImage:Y,onCopyToClipBoard:ae}}function Ne({isOpen:r,edit:l,onSuccess:o,onCancel:c}){const{appCode:m,currentApp:d}=U(),t=G()[0],{slug:u,formId:h,isValid:b,isSubmitting:i,disableSlug:n,versionSlug:w,correctSlug:I,register:f,handleSubmit:$,onSubmit:M,handleUploadImage:p,handleDeleteImage:P,onCopyToClipBoard:N,onSlugChange:k,onPublicChange:R}=Ce({resource:t,edit:l,onSuccess:o,onCancel:c}),{data:y}=ge(),{t:a}=B();return be.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:r,onModalClose:c,children:[e.jsx(C.Header,{onModalClose:c,children:a(l?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(K,{headingStyle:"h4",level:"h3",className:"mb-16",children:a("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:h,onSubmit:$(M),children:[e.jsxs("div",{className:"d-flex gap-16 mb-24",children:[e.jsx("div",{children:e.jsx(ve,{app:d,src:t==null?void 0:t.thumbnail,label:a("explorer.imagepicker.label"),addButtonLabel:a("explorer.imagepicker.button.add"),deleteButtonLabel:a("explorer.imagepicker.button.delete"),onUploadImage:p,onDeleteImage:P,className:"align-self-center mt-8"})}),e.jsxs("div",{className:"col",children:[e.jsxs(g,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(O,{children:a("title")}),e.jsx(H,{type:"text",defaultValue:l?t==null?void 0:t.name:"",...f("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:a("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(g,{id:"description",isOptional:!0,children:[e.jsx(O,{children:a("description")}),e.jsx(ye,{defaultValue:l?t==null?void 0:t.description:"",...f("description"),placeholder:a("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),m===Q.BLOG&&fe({workflow:"createPublic",actions:y})&&e.jsx(Se,{appCode:m,correctSlug:I,disableSlug:n,onCopyToClipBoard:N,onPublicChange:R,onSlugChange:k,resource:t,slug:u,versionSlug:w,register:f})]})]}),e.jsxs(C.Footer,{children:[e.jsx(A,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:a("explorer.cancel")}),e.jsx(A,{form:h,type:"submit",color:"primary",variant:"filled",disabled:!b||i,children:a(l?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{Ne as default};
1
+ import{u as B,j as e,A as U,F as g,y as V,W as ne,B as A,X as ce,d as H,m as de,Y as ue,l as G,h as pe,r as x,O as me,o as he,K as xe,Z as ge,a as be,M as C,U as _,$ as fe}from"./index.js";import{APP as K}from"/assets/js/edifice-ts-client/index.js";import{H as Q}from"./Heading.js";import{u as je}from"./index.esm.js";import{I as ve,T as ye}from"./TextArea.js";const Se=({appCode:r,correctSlug:l,disableSlug:o,onPublicChange:c,onSlugChange:m,refPublic:d,refSlug:v,register:t,resource:u,slug:h,onCopyToClipBoard:b})=>{const{t:i}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(Q,{headingStyle:"h4",level:"h3",className:"mb-16",children:[i("explorer.resource.editModal.heading.access"),r]}),e.jsx(U,{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:u&&u.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:l?"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(V,{type:"text",...t("safeSlug",{validate:{required:n=>!n&&!o?i("explorer.slug.name.mandatory"):!0},disabled:o,value:h,onChange:n=>m(n.target.value)}),size:"md",placeholder:i("explorer.resource.editModal.access.url.extension")},v),l&&e.jsx("div",{className:"position-absolute",children:e.jsx(ne,{children:i("explorer.slug.name.error")})})]}),e.jsx(A,{color:"primary",disabled:o,onClick:()=>{b()},type:"button",leftIcon:e.jsx(ce,{}),variant:"ghost",className:"text-nowrap",children:i("explorer.resource.editModal.access.url.button")})]})})]})};function Ce({resource:r,edit:l,onSuccess:o,onCancel:c}){var O;const{appCode:m}=H(),{t:d}=B(),v=de(),t=ue(),u=G(),h=pe(),{reset:b,register:i,handleSubmit:n,setFocus:w,formState:{errors:I,isSubmitting:f,isValid:$}}=je({mode:"onChange"}),M=x.useId(),p=me(),[P,k]=x.useState(new Date().getTime()),[N,R]=x.useState(!(r!=null&&r.public)),[y,a]=x.useState((r==null?void 0:r.slug)||""),[W,E]=x.useState(!1),{hotToast:F}=he(U),[L,q]=x.useState({name:"",image:(O=u[0])==null?void 0:O.thumbnail}),X=s=>{q(s)},Y=()=>{q({name:"",image:""})};function Z(s){R(!s),s||(a(""),k(new Date().getTime()))}function D(s){if(!s)return"";const j="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",S="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",T=new RegExp(j.split("").join("|"),"g"),re=s.toString().toLowerCase().replace(/\s+/g,"-").replace(T,oe=>S.charAt(j.indexOf(oe))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");a(re)}const J=xe(),{filters:z,trashed:ee}=h,se=["context",{folderId:z.folder,filters:z,trashed:ee}],te=async function(s){var j,S;try{l?(await v.mutateAsync({description:s.description||"",entId:(j=u[0])==null?void 0:j.assetId,name:s.title,public:s.enablePublic,slug:s.safeSlug,trashed:(S=u[0])==null?void 0:S.trashed,thumbnail:L.image}),E(!1)):(J.invalidateQueries(se),t.mutateAsync({name:s.title,description:s.description||"",thumbnail:L.image,folder:(p==null?void 0:p.id)==="default"?void 0:parseInt((p==null?void 0:p.id)||""),public:s.enablePublic,slug:s.safeSlug,app:m})),F.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]}),l&&m===K.BLOG&&e.jsxs("p",{children:["Public:"," ",s.enablePublic?d("explorer.enable.public.yes"):d("explorer.enable.public.no")]})]})),o==null||o()}catch(T){E(!0),console.error(T)}};function ae(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${y}`),F.success(d("explorer.copy.clipboard"))}function le(){b(),c()}const ie=`resource_edit_modal_${M}`;return{slug:y,disableSlug:N,formId:ie,errors:I,isSubmitting:f,isValid:$,versionSlug:P,correctSlug:W,onPublicChange:Z,onSlugChange:D,register:i,setFocus:w,handleSubmit:n,onFormCancel:le,onSubmit:te,handleUploadImage:X,handleDeleteImage:Y,onCopyToClipBoard:ae}}function ke({isOpen:r,edit:l,onSuccess:o,onCancel:c}){const{appCode:m,currentApp:d}=H(),t=G()[0],{slug:u,formId:h,isValid:b,isSubmitting:i,disableSlug:n,versionSlug:w,correctSlug:I,register:f,handleSubmit:$,onSubmit:M,handleUploadImage:p,handleDeleteImage:P,onCopyToClipBoard:k,onSlugChange:N,onPublicChange:R}=Ce({resource:t,edit:l,onSuccess:o,onCancel:c}),{data:y}=ge(),{t:a}=B();return be.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:r,onModalClose:c,children:[e.jsx(C.Header,{onModalClose:c,children:a(l?"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:a("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:h,onSubmit:$(M),children:[e.jsxs("div",{className:"d-flex gap-16 mb-24",children:[e.jsx("div",{children:e.jsx(ve,{app:d,src:t==null?void 0:t.thumbnail,label:a("explorer.imagepicker.label"),addButtonLabel:a("explorer.imagepicker.button.add"),deleteButtonLabel:a("explorer.imagepicker.button.delete"),onUploadImage:p,onDeleteImage:P,className:"align-self-center mt-8"})}),e.jsxs("div",{className:"col",children:[e.jsxs(g,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(_,{children:a("title")}),e.jsx(V,{type:"text",defaultValue:l?t==null?void 0:t.name:"",...f("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:a("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(g,{id:"description",isOptional:!0,children:[e.jsx(_,{children:a("description")}),e.jsx(ye,{defaultValue:l?t==null?void 0:t.description:"",...f("description"),placeholder:a("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),m===K.BLOG&&fe({workflow:"createPublic",actions:y})&&e.jsx(Se,{appCode:m,correctSlug:I,disableSlug:n,onCopyToClipBoard:k,onPublicChange:R,onSlugChange:N,resource:t,slug:u,versionSlug:w,register:f})]})]}),e.jsxs(C.Footer,{children:[e.jsx(A,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:a("explorer.cancel")}),e.jsx(A,{form:h,type:"submit",color:"primary",variant:"filled",disabled:!b||i,children:a(l?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ke as default};
@@ -1 +1 @@
1
- import{d as i,f as a,u as c,$ as u,j as m,b as x}from"./index.js";import{E as d}from"./EmptyScreen.js";import"/assets/js/edifice-ts-client/index.js";import"./Heading.js";function v(){const{appCode:r}=i(),{theme:t}=a(),[l]=x(),{t:s}=c(),{data:n}=u(),e=n==null?void 0:n.find(o=>o.id==="create"),p=()=>e!=null&&e.available&&(t!=null&&t.is1d)?s("explorer.emptyScreen.txt1d.create",{ns:r}):e!=null&&e.available&&!(t!=null&&t.is1d)?s("explorer.emptyScreen.txt2d.create",{ns:r}):!(e!=null&&e.available)&&(t!=null&&t.is1d)?s("explorer.emptyScreen.txt1d.consultation",{ns:r}):s("explorer.emptyScreen.txt2d.consultation",{ns:r});return m.jsx(d,{imageSrc:`${l}/emptyscreen/illu-${r}.svg`,imageAlt:s("explorer.emptyScreen.app.alt",{ns:r}),title:`${e!=null&&e.available?s("explorer.emptyScreen.title.create",{ns:r}):s("explorer.emptyScreen.title.consultation")}`,text:p()})}export{v as default};
1
+ import{d as i,f 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/edifice-ts-client/index.js";import"./Heading.js";function v(){const{appCode:r}=i(),{theme:t}=a(),[l]=x(),{t:s}=c(),{data:n}=u(),e=n==null?void 0:n.find(o=>o.id==="create"),p=()=>e!=null&&e.available&&(t!=null&&t.is1d)?s("explorer.emptyScreen.txt1d.create",{ns:r}):e!=null&&e.available&&!(t!=null&&t.is1d)?s("explorer.emptyScreen.txt2d.create",{ns:r}):!(e!=null&&e.available)&&(t!=null&&t.is1d)?s("explorer.emptyScreen.txt1d.consultation",{ns:r}):s("explorer.emptyScreen.txt2d.consultation",{ns:r});return m.jsx(d,{imageSrc:`${l}/emptyscreen/illu-${r}.svg`,imageAlt:s("explorer.emptyScreen.app.alt",{ns:r}),title:`${e!=null&&e.available?s("explorer.emptyScreen.title.create",{ns:r}):s("explorer.emptyScreen.title.consultation")}`,text:p()})}export{v as default};
@@ -1 +1 @@
1
- import{d as f,J as j,a9 as y,K as I,aa as T,ab as h,j as t,ac as d}from"./index.js";import{C}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";import"./Tooltip.js";const O=({data:e,isFetching:u})=>{var c,p;const{currentApp:a}=f(),l=j(),i=y(),{setSelectedFolders:n,setFolderIds:r,openFolder:m}=I();function g(s){i.includes(s.id)?(r(i.filter(o=>o!==s.id)),n(l.filter(o=>o.id!==s.id))):(r([...i,s.id]),n([...l,s]))}const S=T({from:{opacity:0},to:{opacity:1}}),F=h();return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?t.jsx(d.ul,{className:"grid ps-0 list-unstyled mb-24",children:(p=e==null?void 0:e.pages[0])==null?void 0:p.folders.map(s=>{const{id:o,name:x}=s;return t.jsx(d.li,{className:"g-col-4 z-1",style:{position:"relative",...S},children:t.jsx(C,{app:a,options:{type:"folder",name:x},isLoading:u,isSelected:i.includes(s.id),onOpen:()=>{F(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},o)})}):null};export{O as default};
1
+ import{d as f,H as j,a7 as y,J as I,a8 as T,a9 as h,j as t,aa as d}from"./index.js";import{C}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";import"./Tooltip.js";const b=({data:e,isFetching:u})=>{var c,p;const{currentApp:a}=f(),l=j(),i=y(),{setSelectedFolders:n,setFolderIds:r,openFolder:m}=I();function g(s){i.includes(s.id)?(r(i.filter(o=>o!==s.id)),n(l.filter(o=>o.id!==s.id))):(r([...i,s.id]),n([...l,s]))}const S=T({from:{opacity:0},to:{opacity:1}}),F=h();return(c=e==null?void 0:e.pages[0])!=null&&c.folders.length?t.jsx(d.ul,{className:"grid ps-0 list-unstyled mb-24",children:(p=e==null?void 0:e.pages[0])==null?void 0:p.folders.map(s=>{const{id:o,name:x}=s;return t.jsx(d.li,{className:"g-col-4 z-1",style:{position:"relative",...S},children:t.jsx(C,{app:a,options:{type:"folder",name:x},isLoading:u,isSelected:i.includes(s.id),onOpen:()=>{F(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},o)})}):null};export{b as default};
Binary file
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{r as I,H as v,J as T,l as M,K as y,N as j,u as b,O as F,a as S,j as o,M as n,T as w,B as h}from"./index.js";import"/assets/js/edifice-ts-client/index.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,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/edifice-ts-client/index.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};
Binary file
@@ -1 +1 @@
1
- import{r as v,a1 as X,g as ee,j as e,d as Z,l as K,o as ae,K as re,a2 as D,a3 as Y,A as L,u as O,a as te,M as S,F as g,W as R,y as H,a4 as U,a5 as V,C as W,B as G,b as le}from"./index.js";import{TransportFrameworkFactory as se,RESOURCE as ie}from"/assets/js/edifice-ts-client/index.js";import{u as ce}from"./index.esm.js";import{H as $}from"./Heading.js";import{I as oe,T as ne}from"./TextArea.js";const Q=v.forwardRef(({options:a,model:t,disabled:l=!1,placeholderOption:s=!1,...p},r)=>{const{isRequired:n,status:d}=X(),m=v.useId(),x={...p,id:m,disabled:l,ref:r,className:ee(p.className,"form-select c-pointer",{"is-invalid":d==="invalid","is-valid":d==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...x,required:n,children:[s&&e.jsx("option",{disabled:!0,selected:t===void 0,children:s}),a==null?void 0:a.map(b=>{const h=typeof b=="object"?b.value:b,c=typeof b=="object"?b.label:b;return e.jsx("option",{value:h,selected:t===h,children:c},h)})]})})});Q.displayName="Select";const k=Q,{http:M}=se.instance();function be({onSuccess:a}){const{user:t,currentApp:l}=Z(),s=K(),[p,r]=v.useState({name:"",image:s[0].thumbnail}),[n,d]=v.useState(!1),{hotToast:m}=ae(L),{publishApi:x}=re(),{register:b,handleSubmit:h,formState:{errors:c,isSubmitting:P,isDirty:u,isValid:C}}=ce({mode:"onChange"}),[T,I]=v.useState([]),[y,w]=v.useState([]);function F(i){r(i)}const f=t?t==null?void 0:t.userId:"";return{selectedResources:s,register:b,handleSubmit:h,formState:{errors:c,isSubmitting:P,isDirty:u,isValid:C},publish:async i=>{try{d(!0);let j=new Blob;p.image?j=await M.get(p.image,{responseType:"blob"}):s[0].thumbnail&&(j=await M.get(s[0].thumbnail,{responseType:"blob"}));const E=await M.get(`/userbook/avatar/${f}?thumbnail=48x48`,{responseType:"blob"}),_=await M.get(`/directory/user/${f}/attachment-school`,{responseType:"json"});let A="";l!=null&&l.displayName&&(A=D(l==null?void 0:l.displayName));const o={activityType:T,age:[i.ageMin,i.ageMax],application:Y().libraryAppFilter??D(A),cover:j,description:i.description,keyWords:i.keyWords,language:i.language,licence:"CC-BY",resourceId:s[0].assetId,resourceEntId:s[0].assetId,subjectArea:y,teacherAvatar:E,title:i.title,userId:f,userStructureName:_.name||(t==null?void 0:t.structureNames[0])},N=[ie.BLOG][0],B=await x(N,o);B.success?m.success(e.jsx(ue,{result:B}),{duration:1e4}):m.error(e.jsx(J,{formData:i})),a==null||a()}catch{m.error(e.jsx(J,{formData:i}))}finally{d(!1)}},handleDeleteImage:()=>{r({name:"",image:""})},handleUploadImage:F,selectedActivities:T,setSelectedActivities:I,selectedSubjectAreas:y,setSelectedSubjectAreas:w,loaderPublish:n,cover:p}}function pe(){const{t:a}=O(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],l=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],s=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:l,languageOptions:s,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function ve({isOpen:a,onSuccess:t,onCancel:l}){var _,A;const{currentApp:s}=Z(),[p]=le(),{t:r}=O(),{register:n,handleSubmit:d,publish:m,formState:{isDirty:x,isValid:b},handleUploadImage:h,selectedActivities:c,setSelectedActivities:P,selectedSubjectAreas:u,setSelectedSubjectAreas:C,handleDeleteImage:T,loaderPublish:I,cover:y}=be({onSuccess:t}),w=K(),{activityTypeOptions:F,subjectAreaOptions:f,languageOptions:z,ageOptions:q}=pe(),i=r("bpr.form.publication.language"),j=r("bpr.form.publication.age.min"),E=r("bpr.form.publication.age.max");return te.createPortal(e.jsxs(S,{isOpen:a,onModalClose:l,id:"libraryModal",size:"lg",children:[e.jsx(S.Header,{onModalClose:l,children:r("bpr.publish")}),e.jsx(S.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(S.Body,{children:[e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:d(m),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(oe,{app:Y().libraryAppFilter??s,src:(_=w[0])==null?void 0:_.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:h,onDeleteImage:T,className:"align-self-center"}),!y.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(g,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(R,{children:r("bpr.form.publication.title")}),e.jsx(H,{type:"text",defaultValue:(A=w[0])==null?void 0:A.name,...n("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(g,{id:"description",isRequired:!0,children:[e.jsx(R,{children:r("bpr.form.publication.description")}),e.jsx(ne,{...n("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),e.jsx("hr",{}),e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsx(U,{trigger:e.jsx(V,{title:r("bpr.form.publication.type"),size:"md",grow:!0,badgeContent:c==null?void 0:c.length}),content:e.jsx(W,{options:F,model:c,onChange:o=>P(o)})})}),e.jsx("div",{className:"col d-flex",children:e.jsx(U,{trigger:e.jsx(V,{title:r("bpr.form.publication.discipline"),size:"md",grow:!0,badgeContent:u==null?void 0:u.length}),content:e.jsx(W,{options:f,model:u,onChange:o=>C(o)})})}),e.jsx("div",{className:"col",children:e.jsx(g,{id:"language",isRequired:!0,children:e.jsx(k,{...n("language",{required:!0,validate:o=>o!==i}),options:z,placeholderOption:i,defaultValue:i,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(g,{id:"ageMin",isRequired:!0,children:e.jsx(k,{...n("ageMin",{required:!0,validate:(o,N)=>parseInt(o)<=parseInt(N.ageMax)}),options:q,placeholderOption:j,defaultValue:j,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(g,{id:"ageMax",isRequired:!0,children:e.jsx(k,{...n("ageMax",{required:!0,validate:(o,N)=>parseInt(o)>=parseInt(N.ageMin)}),options:q,placeholderOption:E,defaultValue:E,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(g,{id:"keywords",isOptional:!0,children:[e.jsx(R,{children:r("bpr.form.publication.keywords")}),e.jsx(H,{type:"text",...n("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx($,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${p}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(L,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(L,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(S.Footer,{children:[e.jsx(G,{color:"tertiary",onClick:l,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(G,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:I,disabled:!y.image||I||!x||!b||(c==null?void 0:c.length)===0||(u==null?void 0:u.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function ue({result:a}){const{t}=O();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function J({formData:a}){const{t}=O(),l=s=>s.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[l(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),l(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{J as PublishModalError,ue as PublishModalSuccess,ve as default};
1
+ import{r as T,a0 as ae,g as re,j as e,d as Z,l as Y,o as le,J as te,a1 as H,a2 as K,A as V,u as C,a as se,M as _,F as N,U as L,y as W,a3 as j,B as G,b as ie}from"./index.js";import{TransportFrameworkFactory as ce,RESOURCE as ne}from"/assets/js/edifice-ts-client/index.js";import{u as oe}from"./index.esm.js";import{H as B}from"./Heading.js";import{I as be,T as ue}from"./TextArea.js";const Q=T.forwardRef(({options:a,model:t,disabled:i=!1,placeholderOption:c=!1,...p},r)=>{const{isRequired:b,status:g}=ae(),v=T.useId(),I={...p,id:v,disabled:i,ref:r,className:re(p.className,"form-select c-pointer",{"is-invalid":g==="invalid","is-valid":g==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...I,required:b,children:[c&&e.jsx("option",{disabled:!0,selected:t===void 0,children:c}),a==null?void 0:a.map(u=>{const x=typeof u=="object"?u.value:u,o=typeof u=="object"?u.label:u;return e.jsx("option",{value:x,selected:t===x,children:o},x)})]})})});Q.displayName="Select";const U=Q,{http:k}=ce.instance();function pe({onSuccess:a}){const{user:t,currentApp:i}=Z(),c=Y(),[p,r]=T.useState({name:"",image:c[0].thumbnail}),[b,g]=T.useState(!1),{hotToast:v}=le(V),{publishApi:I}=te(),{register:u,watch:x,setValue:o,handleSubmit:O,formState:{errors:d,isSubmitting:P,isDirty:F,isValid:E}}=oe({mode:"onChange"}),[m,M]=T.useState([]),[h,q]=T.useState([]),R=s=>{let l=[...m];const n=l.findIndex(y=>y===s);m.includes(s)?l=m.filter((y,A)=>A!==n):l=[...m,s],M(l)},w=s=>{let l=[...h];const n=l.findIndex(y=>y===s);h.includes(s)?l=h.filter((y,A)=>A!==n):l=[...h,s],q(l)};function S(s){r(s)}const f=t?t==null?void 0:t.userId:"";return{watch:x,setValue:o,selectedResources:c,register:u,handleSubmit:O,formState:{errors:d,isSubmitting:P,isDirty:F,isValid:E},publish:async s=>{try{g(!0);let l=new Blob;p.image?l=await k.get(p.image,{responseType:"blob"}):c[0].thumbnail&&(l=await k.get(c[0].thumbnail,{responseType:"blob"}));const n=await k.get(`/userbook/avatar/${f}?thumbnail=48x48`,{responseType:"blob"}),y=await k.get(`/directory/user/${f}/attachment-school`,{responseType:"json"});let A="";i!=null&&i.displayName&&(A=H(i==null?void 0:i.displayName));const X={activityType:m,age:[s.ageMin,s.ageMax],application:K().libraryAppFilter??H(A),cover:l,description:s.description,keyWords:s.keyWords,language:s.language,licence:"CC-BY",resourceId:c[0].assetId,resourceEntId:c[0].assetId,subjectArea:h,teacherAvatar:n,title:s.title,userId:f,userStructureName:y.name||(t==null?void 0:t.structureNames[0])},ee=[ne.BLOG][0],D=await I(ee,X);D.success?v.success(e.jsx(me,{result:D}),{duration:1e4}):v.error(e.jsx(J,{formData:s})),a==null||a()}catch{v.error(e.jsx(J,{formData:s}))}finally{g(!1)}},handleDeleteImage:()=>{r({name:"",image:""})},handleUploadImage:S,selectedActivities:m,selectActivities:R,selectedSubjectAreas:h,selectSubjects:w,loaderPublish:b,cover:p}}function de(){const{t:a}=C(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],i=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],c=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:i,languageOptions:c,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function ye({isOpen:a,onSuccess:t,onCancel:i}){var z,s;const{currentApp:c}=Z(),[p]=ie(),{t:r}=C(),{register:b,handleSubmit:g,publish:v,formState:{isDirty:I,isValid:u},handleUploadImage:x,selectedActivities:o,selectActivities:O,selectedSubjectAreas:d,selectSubjects:P,handleDeleteImage:F,loaderPublish:E,cover:m}=pe({onSuccess:t}),M=Y(),{activityTypeOptions:h,subjectAreaOptions:q,languageOptions:R,ageOptions:w}=de(),S=r("bpr.form.publication.language"),f=r("bpr.form.publication.age.min"),$=r("bpr.form.publication.age.max");return se.createPortal(e.jsxs(_,{isOpen:a,onModalClose:i,id:"libraryModal",size:"lg",children:[e.jsx(_.Header,{onModalClose:i,children:r("bpr.publish")}),e.jsx(_.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(_.Body,{children:[e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:g(v),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(be,{app:K().libraryAppFilter??c,src:(z=M[0])==null?void 0:z.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:x,onDeleteImage:F,className:"align-self-center"}),!m.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(N,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(L,{children:r("bpr.form.publication.title")}),e.jsx(W,{type:"text",defaultValue:(s=M[0])==null?void 0:s.name,...b("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(N,{id:"description",isRequired:!0,children:[e.jsx(L,{children:r("bpr.form.publication.description")}),e.jsx(ue,{...b("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),e.jsx("hr",{}),e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsxs(j,{block:!0,children:[e.jsx(j.Trigger,{size:"md",label:r("bpr.form.publication.type"),badgeContent:o==null?void 0:o.length}),e.jsx(j.Menu,{children:h.map((l,n)=>e.jsx(j.CheckboxItem,{value:l.value,model:o,onChange:()=>O(l.value),children:l.label},n))})]})}),e.jsx("div",{className:"col d-flex",children:e.jsxs(j,{block:!0,children:[e.jsx(j.Trigger,{size:"md",label:r("bpr.form.publication.discipline"),badgeContent:d==null?void 0:d.length}),e.jsx(j.Menu,{children:q.map((l,n)=>e.jsx(j.CheckboxItem,{value:l.value,model:d,onChange:()=>P(l.value),children:l.label},n))})]})}),e.jsx("div",{className:"col",children:e.jsx(N,{id:"language",isRequired:!0,children:e.jsx(U,{...b("language",{required:!0,validate:l=>l!==S}),options:R,placeholderOption:S,defaultValue:S,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(N,{id:"ageMin",isRequired:!0,children:e.jsx(U,{...b("ageMin",{required:!0,validate:(l,n)=>parseInt(l)<=parseInt(n.ageMax)}),options:w,placeholderOption:f,defaultValue:f,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(N,{id:"ageMax",isRequired:!0,children:e.jsx(U,{...b("ageMax",{required:!0,validate:(l,n)=>parseInt(l)>=parseInt(n.ageMin)}),options:w,placeholderOption:$,defaultValue:$,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(N,{id:"keywords",isOptional:!0,children:[e.jsx(L,{children:r("bpr.form.publication.keywords")}),e.jsx(W,{type:"text",...b("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${p}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(V,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(V,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(_.Footer,{children:[e.jsx(G,{color:"tertiary",onClick:i,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(G,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:E,disabled:!m.image||E||!I||!u||(o==null?void 0:o.length)===0||(d==null?void 0:d.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function me({result:a}){const{t}=C();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function J({formData:a}){const{t}=C(),i=c=>c.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[i(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),i(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{J as PublishModalError,me as PublishModalSuccess,ye as default};
@@ -1 +1 @@
1
- import{ad as q,ae as ee,d as se,u as ae,h as ie,af as oe,l as ue,K as de,G as ce,aa as me,r as le,g as _e,j as W,R as Q,ac as X,B as fe}from"./index.js";import{C as he}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";import"./Tooltip.js";var te={exports:{}};(function(y,T){(function(c,u){y.exports=u()})(q,function(){var c=1e3,u=6e4,p=36e5,l="millisecond",r="second",S="minute",M="hour",m="day",Y="week",_="month",I="quarter",w="year",j="date",O="Invalid Date",E=/^(\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,C={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(a){var n=["th","st","nd","rd"],e=a%100;return"["+a+(n[(e-20)%10]||n[e]||n[0])+"]"}},J=function(a,n,e){var s=String(a);return!s||s.length>=n?a:""+Array(n+1-s.length).join(e)+a},A={s:J,z:function(a){var n=-a.utcOffset(),e=Math.abs(n),s=Math.floor(e/60),t=e%60;return(n<=0?"+":"-")+J(s,2,"0")+":"+J(t,2,"0")},m:function a(n,e){if(n.date()<e.date())return-a(e,n);var s=12*(e.year()-n.year())+(e.month()-n.month()),t=n.clone().add(s,_),i=e-t<0,o=n.clone().add(s+(i?-1:1),_);return+(-(s+(e-t)/(i?t-o:o-t))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(a){return{M:_,y:w,w:Y,d:m,D:j,h:M,m:S,s:r,ms:l,Q:I}[a]||String(a||"").toLowerCase().replace(/s$/,"")},u:function(a){return a===void 0}},D="en",f={};f[D]=C;var H=function(a){return a instanceof P},L=function a(n,e,s){var t;if(!n)return D;if(typeof n=="string"){var i=n.toLowerCase();f[i]&&(t=i),e&&(f[i]=e,t=i);var o=n.split("-");if(!t&&o.length>1)return a(o[0])}else{var h=n.name;f[h]=n,t=h}return!s&&t&&(D=t),t||!s&&D},v=function(a,n){if(H(a))return a.clone();var e=typeof n=="object"?n:{};return e.date=a,e.args=arguments,new P(e)},d=A;d.l=L,d.i=H,d.w=function(a,n){return v(a,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var P=function(){function a(e){this.$L=L(e.locale,null,!0),this.parse(e)}var n=a.prototype;return n.parse=function(e){this.$d=function(s){var t=s.date,i=s.utc;if(t===null)return new Date(NaN);if(d.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var o=t.match(E);if(o){var h=o[2]-1||0,g=(o[7]||"0").substring(0,3);return i?new Date(Date.UTC(o[1],h,o[3]||1,o[4]||0,o[5]||0,o[6]||0,g)):new Date(o[1],h,o[3]||1,o[4]||0,o[5]||0,o[6]||0,g)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},n.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},n.$utils=function(){return d},n.isValid=function(){return this.$d.toString()!==O},n.isSame=function(e,s){var t=v(e);return this.startOf(s)<=t&&t<=this.endOf(s)},n.isAfter=function(e,s){return v(e)<this.startOf(s)},n.isBefore=function(e,s){return this.endOf(s)<v(e)},n.$g=function(e,s,t){return d.u(e)?this[s]:this.set(t,e)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(e,s){var t=this,i=!!d.u(s)||s,o=d.p(e),h=function(F,x){var N=d.w(t.$u?Date.UTC(t.$y,x,F):new Date(t.$y,x,F),t);return i?N:N.endOf(m)},g=function(F,x){return d.w(t.toDate()[F].apply(t.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(x)),t)},$=this.$W,b=this.$M,k=this.$D,B="set"+(this.$u?"UTC":"");switch(o){case w:return i?h(1,0):h(31,11);case _:return i?h(1,b):h(0,b+1);case Y:var z=this.$locale().weekStart||0,Z=($<z?$+7:$)-z;return h(i?k-Z:k+(6-Z),b);case m:case j:return g(B+"Hours",0);case M:return g(B+"Minutes",1);case S:return g(B+"Seconds",2);case r:return g(B+"Milliseconds",3);default:return this.clone()}},n.endOf=function(e){return this.startOf(e,!1)},n.$set=function(e,s){var t,i=d.p(e),o="set"+(this.$u?"UTC":""),h=(t={},t[m]=o+"Date",t[j]=o+"Date",t[_]=o+"Month",t[w]=o+"FullYear",t[M]=o+"Hours",t[S]=o+"Minutes",t[r]=o+"Seconds",t[l]=o+"Milliseconds",t)[i],g=i===m?this.$D+(s-this.$W):s;if(i===_||i===w){var $=this.clone().set(j,1);$.$d[h](g),$.init(),this.$d=$.set(j,Math.min(this.$D,$.daysInMonth())).$d}else h&&this.$d[h](g);return this.init(),this},n.set=function(e,s){return this.clone().$set(e,s)},n.get=function(e){return this[d.p(e)]()},n.add=function(e,s){var t,i=this;e=Number(e);var o=d.p(s),h=function(b){var k=v(i);return d.w(k.date(k.date()+Math.round(b*e)),i)};if(o===_)return this.set(_,this.$M+e);if(o===w)return this.set(w,this.$y+e);if(o===m)return h(1);if(o===Y)return h(7);var g=(t={},t[S]=u,t[M]=p,t[r]=c,t)[o]||1,$=this.$d.getTime()+e*g;return d.w($,this)},n.subtract=function(e,s){return this.add(-1*e,s)},n.format=function(e){var s=this,t=this.$locale();if(!this.isValid())return t.invalidDate||O;var i=e||"YYYY-MM-DDTHH:mm:ssZ",o=d.z(this),h=this.$H,g=this.$m,$=this.$M,b=t.weekdays,k=t.months,B=t.meridiem,z=function(x,N,V,K){return x&&(x[N]||x(s,i))||V[N].slice(0,K)},Z=function(x){return d.s(h%12||12,x,"0")},F=B||function(x,N,V){var K=x<12?"AM":"PM";return V?K.toLowerCase():K};return i.replace(R,function(x,N){return N||function(V){switch(V){case"YY":return String(s.$y).slice(-2);case"YYYY":return d.s(s.$y,4,"0");case"M":return $+1;case"MM":return d.s($+1,2,"0");case"MMM":return z(t.monthsShort,$,k,3);case"MMMM":return z(k,$);case"D":return s.$D;case"DD":return d.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return z(t.weekdaysMin,s.$W,b,2);case"ddd":return z(t.weekdaysShort,s.$W,b,3);case"dddd":return b[s.$W];case"H":return String(h);case"HH":return d.s(h,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return F(h,g,!0);case"A":return F(h,g,!1);case"m":return String(g);case"mm":return d.s(g,2,"0");case"s":return String(s.$s);case"ss":return d.s(s.$s,2,"0");case"SSS":return d.s(s.$ms,3,"0");case"Z":return o}return null}(x)||o.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(e,s,t){var i,o=this,h=d.p(s),g=v(e),$=(g.utcOffset()-this.utcOffset())*u,b=this-g,k=function(){return d.m(o,g)};switch(h){case w:i=k()/12;break;case _:i=k();break;case I:i=k()/3;break;case Y:i=(b-$)/6048e5;break;case m:i=(b-$)/864e5;break;case M:i=b/p;break;case S:i=b/u;break;case r:i=b/c;break;default:i=b}return t?i:d.a(i)},n.daysInMonth=function(){return this.endOf(_).$D},n.$locale=function(){return f[this.$L]},n.locale=function(e,s){if(!e)return this.$L;var t=this.clone(),i=L(e,s,!0);return i&&(t.$L=i),t},n.clone=function(){return d.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},a}(),G=P.prototype;return v.prototype=G,[["$ms",l],["$s",r],["$m",S],["$H",M],["$W",m],["$M",_],["$y",w],["$D",j]].forEach(function(a){G[a[1]]=function(n){return this.$g(n,a[0],a[1])}}),v.extend=function(a,n){return a.$i||(a(n,P,v),a.$i=!0),v},v.locale=L,v.isDayjs=H,v.unix=function(a){return v(1e3*a)},v.en=f[D],v.Ls=f,v.p={},v})})(te);var U=te.exports;const ne=ee(U);var re={exports:{}};(function(y,T){(function(c,u){y.exports=u()})(q,function(){return function(c,u,p){c=c||{};var l=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(m,Y,_,I){return l.fromToBase(m,Y,_,I)}p.en.relativeTime=r,l.fromToBase=function(m,Y,_,I,w){for(var j,O,E,R=_.$locale().relativeTime||r,C=c.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=C.length,A=0;A<J;A+=1){var D=C[A];D.d&&(j=I?p(m).diff(_,D.d,!0):_.diff(m,D.d,!0));var f=(c.rounding||Math.round)(Math.abs(j));if(E=j>0,f<=D.r||!D.r){f<=1&&A>0&&(D=C[A-1]);var H=R[D.l];w&&(f=w(""+f)),O=typeof H=="string"?H.replace("%d",f):H(f,Y,D.l,E);break}}if(Y)return O;var L=E?R.future:R.past;return typeof L=="function"?L(O):L.replace("%s",O)},l.to=function(m,Y){return S(m,Y,this,!0)},l.from=function(m,Y){return S(m,Y,this)};var M=function(m){return m.$u?p.utc():p()};l.toNow=function(m){return this.to(M(this),m)},l.fromNow=function(m){return this.from(M(this),m)}}})})(re);var Me=re.exports;const pe=ee(Me);var ge={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var p=u(c),l={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,m,Y){var _=l[Y];return Array.isArray(_)&&(_=_[m?0:1]),_.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})})(ge);var ve={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(ve);var ye={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(ye);var Ye={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(Ye);var $e={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})($e);ne.extend(pe);function Se(y){const{rights:T,creatorId:c}=y;return T.filter(p=>!p.includes(c)).length>=1}const we=({data:y,isFetching:T,fetchNextPage:c})=>{const{currentApp:u,currentLanguage:p,appCode:l}=se(),{t:r}=ae(),S=ie(),M=oe(),m=ue(),{setSelectedResources:Y,setResourceIds:_,openResource:I,setResourceIsTrash:w}=de(),j=ce(),O=me({from:{opacity:0},to:{opacity:1}}),R=S.pagination.startIdx+S.pagination.pageSize<(S.pagination.maxIdx||0),C=le.useCallback(()=>{c()},[]),J=f=>{j?(w(!0),_([f.id]),Y([f])):I(f)};async function A(f){if(M.includes(f.id)){_(M.filter(H=>H!==f.id)),Y(m.filter(H=>H.id!==f.id));return}_([...M,f.id]),Y([...m,f])}const D=_e("grid ps-0 list-unstyled");return W.jsxs(Q.Fragment,{children:[W.jsx(X.ul,{className:D,children:y==null?void 0:y.pages.map((f,H)=>W.jsx(Q.Fragment,{children:f.resources.map(L=>{const{id:v,creatorName:d,creatorId:P,name:G,thumbnail:a,updatedAt:n}=L,e=Se(L),s=ne(n).locale(p).fromNow(),t={messagePublic:r("tooltip.public",{ns:l}),messageShared:r("tooltip.shared",{ns:l})};return W.jsx(X.li,{className:"g-col-4 z-1",style:{position:"relative",...O},children:W.jsx(he,{app:u,className:"c-pointer",tooltips:t,options:{type:"resource",name:G,creatorName:d,userSrc:`/userbook/avatar/${P}`,updatedAt:s,isPublic:L.public,isShared:e,imageSrc:a},isSelected:M.includes(L.id),isLoading:T,onOpen:()=>J(L),onSelect:()=>A(L)})},v)})},H))}),R&&W.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:W.jsx(fe,{type:"button",color:"secondary",variant:"filled",onClick:C,children:r("explorer.see.more")})})]})};export{we as default};
1
+ import{ab as q,ac as ee,d as se,u as ae,h as ie,ad as oe,l as ue,J as de,E as ce,a8 as me,r as le,g as _e,j as W,R as K,aa as X,B as fe}from"./index.js";import{C as he}from"./Card.js";import"/assets/js/edifice-ts-client/index.js";import"./Tooltip.js";var te={exports:{}};(function(y,T){(function(c,u){y.exports=u()})(q,function(){var c=1e3,u=6e4,p=36e5,l="millisecond",r="second",S="minute",M="hour",m="day",Y="week",_="month",I="quarter",w="year",j="date",O="Invalid Date",E=/^(\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,C={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(a){var n=["th","st","nd","rd"],e=a%100;return"["+a+(n[(e-20)%10]||n[e]||n[0])+"]"}},J=function(a,n,e){var s=String(a);return!s||s.length>=n?a:""+Array(n+1-s.length).join(e)+a},A={s:J,z:function(a){var n=-a.utcOffset(),e=Math.abs(n),s=Math.floor(e/60),t=e%60;return(n<=0?"+":"-")+J(s,2,"0")+":"+J(t,2,"0")},m:function a(n,e){if(n.date()<e.date())return-a(e,n);var s=12*(e.year()-n.year())+(e.month()-n.month()),t=n.clone().add(s,_),i=e-t<0,o=n.clone().add(s+(i?-1:1),_);return+(-(s+(e-t)/(i?t-o:o-t))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(a){return{M:_,y:w,w:Y,d:m,D:j,h:M,m:S,s:r,ms:l,Q:I}[a]||String(a||"").toLowerCase().replace(/s$/,"")},u:function(a){return a===void 0}},b="en",f={};f[b]=C;var H=function(a){return a instanceof P},L=function a(n,e,s){var t;if(!n)return b;if(typeof n=="string"){var i=n.toLowerCase();f[i]&&(t=i),e&&(f[i]=e,t=i);var o=n.split("-");if(!t&&o.length>1)return a(o[0])}else{var h=n.name;f[h]=n,t=h}return!s&&t&&(b=t),t||!s&&b},v=function(a,n){if(H(a))return a.clone();var e=typeof n=="object"?n:{};return e.date=a,e.args=arguments,new P(e)},d=A;d.l=L,d.i=H,d.w=function(a,n){return v(a,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var P=function(){function a(e){this.$L=L(e.locale,null,!0),this.parse(e)}var n=a.prototype;return n.parse=function(e){this.$d=function(s){var t=s.date,i=s.utc;if(t===null)return new Date(NaN);if(d.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var o=t.match(E);if(o){var h=o[2]-1||0,g=(o[7]||"0").substring(0,3);return i?new Date(Date.UTC(o[1],h,o[3]||1,o[4]||0,o[5]||0,o[6]||0,g)):new Date(o[1],h,o[3]||1,o[4]||0,o[5]||0,o[6]||0,g)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},n.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},n.$utils=function(){return d},n.isValid=function(){return this.$d.toString()!==O},n.isSame=function(e,s){var t=v(e);return this.startOf(s)<=t&&t<=this.endOf(s)},n.isAfter=function(e,s){return v(e)<this.startOf(s)},n.isBefore=function(e,s){return this.endOf(s)<v(e)},n.$g=function(e,s,t){return d.u(e)?this[s]:this.set(t,e)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(e,s){var t=this,i=!!d.u(s)||s,o=d.p(e),h=function(F,x){var N=d.w(t.$u?Date.UTC(t.$y,x,F):new Date(t.$y,x,F),t);return i?N:N.endOf(m)},g=function(F,x){return d.w(t.toDate()[F].apply(t.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(x)),t)},$=this.$W,D=this.$M,k=this.$D,B="set"+(this.$u?"UTC":"");switch(o){case w:return i?h(1,0):h(31,11);case _:return i?h(1,D):h(0,D+1);case Y:var z=this.$locale().weekStart||0,Z=($<z?$+7:$)-z;return h(i?k-Z:k+(6-Z),D);case m:case j:return g(B+"Hours",0);case M:return g(B+"Minutes",1);case S:return g(B+"Seconds",2);case r:return g(B+"Milliseconds",3);default:return this.clone()}},n.endOf=function(e){return this.startOf(e,!1)},n.$set=function(e,s){var t,i=d.p(e),o="set"+(this.$u?"UTC":""),h=(t={},t[m]=o+"Date",t[j]=o+"Date",t[_]=o+"Month",t[w]=o+"FullYear",t[M]=o+"Hours",t[S]=o+"Minutes",t[r]=o+"Seconds",t[l]=o+"Milliseconds",t)[i],g=i===m?this.$D+(s-this.$W):s;if(i===_||i===w){var $=this.clone().set(j,1);$.$d[h](g),$.init(),this.$d=$.set(j,Math.min(this.$D,$.daysInMonth())).$d}else h&&this.$d[h](g);return this.init(),this},n.set=function(e,s){return this.clone().$set(e,s)},n.get=function(e){return this[d.p(e)]()},n.add=function(e,s){var t,i=this;e=Number(e);var o=d.p(s),h=function(D){var k=v(i);return d.w(k.date(k.date()+Math.round(D*e)),i)};if(o===_)return this.set(_,this.$M+e);if(o===w)return this.set(w,this.$y+e);if(o===m)return h(1);if(o===Y)return h(7);var g=(t={},t[S]=u,t[M]=p,t[r]=c,t)[o]||1,$=this.$d.getTime()+e*g;return d.w($,this)},n.subtract=function(e,s){return this.add(-1*e,s)},n.format=function(e){var s=this,t=this.$locale();if(!this.isValid())return t.invalidDate||O;var i=e||"YYYY-MM-DDTHH:mm:ssZ",o=d.z(this),h=this.$H,g=this.$m,$=this.$M,D=t.weekdays,k=t.months,B=t.meridiem,z=function(x,N,V,Q){return x&&(x[N]||x(s,i))||V[N].slice(0,Q)},Z=function(x){return d.s(h%12||12,x,"0")},F=B||function(x,N,V){var Q=x<12?"AM":"PM";return V?Q.toLowerCase():Q};return i.replace(R,function(x,N){return N||function(V){switch(V){case"YY":return String(s.$y).slice(-2);case"YYYY":return d.s(s.$y,4,"0");case"M":return $+1;case"MM":return d.s($+1,2,"0");case"MMM":return z(t.monthsShort,$,k,3);case"MMMM":return z(k,$);case"D":return s.$D;case"DD":return d.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return z(t.weekdaysMin,s.$W,D,2);case"ddd":return z(t.weekdaysShort,s.$W,D,3);case"dddd":return D[s.$W];case"H":return String(h);case"HH":return d.s(h,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return F(h,g,!0);case"A":return F(h,g,!1);case"m":return String(g);case"mm":return d.s(g,2,"0");case"s":return String(s.$s);case"ss":return d.s(s.$s,2,"0");case"SSS":return d.s(s.$ms,3,"0");case"Z":return o}return null}(x)||o.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(e,s,t){var i,o=this,h=d.p(s),g=v(e),$=(g.utcOffset()-this.utcOffset())*u,D=this-g,k=function(){return d.m(o,g)};switch(h){case w:i=k()/12;break;case _:i=k();break;case I:i=k()/3;break;case Y:i=(D-$)/6048e5;break;case m:i=(D-$)/864e5;break;case M:i=D/p;break;case S:i=D/u;break;case r:i=D/c;break;default:i=D}return t?i:d.a(i)},n.daysInMonth=function(){return this.endOf(_).$D},n.$locale=function(){return f[this.$L]},n.locale=function(e,s){if(!e)return this.$L;var t=this.clone(),i=L(e,s,!0);return i&&(t.$L=i),t},n.clone=function(){return d.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},a}(),G=P.prototype;return v.prototype=G,[["$ms",l],["$s",r],["$m",S],["$H",M],["$W",m],["$M",_],["$y",w],["$D",j]].forEach(function(a){G[a[1]]=function(n){return this.$g(n,a[0],a[1])}}),v.extend=function(a,n){return a.$i||(a(n,P,v),a.$i=!0),v},v.locale=L,v.isDayjs=H,v.unix=function(a){return v(1e3*a)},v.en=f[b],v.Ls=f,v.p={},v})})(te);var U=te.exports;const ne=ee(U);var re={exports:{}};(function(y,T){(function(c,u){y.exports=u()})(q,function(){return function(c,u,p){c=c||{};var l=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(m,Y,_,I){return l.fromToBase(m,Y,_,I)}p.en.relativeTime=r,l.fromToBase=function(m,Y,_,I,w){for(var j,O,E,R=_.$locale().relativeTime||r,C=c.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=C.length,A=0;A<J;A+=1){var b=C[A];b.d&&(j=I?p(m).diff(_,b.d,!0):_.diff(m,b.d,!0));var f=(c.rounding||Math.round)(Math.abs(j));if(E=j>0,f<=b.r||!b.r){f<=1&&A>0&&(b=C[A-1]);var H=R[b.l];w&&(f=w(""+f)),O=typeof H=="string"?H.replace("%d",f):H(f,Y,b.l,E);break}}if(Y)return O;var L=E?R.future:R.past;return typeof L=="function"?L(O):L.replace("%s",O)},l.to=function(m,Y){return S(m,Y,this,!0)},l.from=function(m,Y){return S(m,Y,this)};var M=function(m){return m.$u?p.utc():p()};l.toNow=function(m){return this.to(M(this),m)},l.fromNow=function(m){return this.from(M(this),m)}}})})(re);var Me=re.exports;const pe=ee(Me);var ge={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var p=u(c),l={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,m,Y){var _=l[Y];return Array.isArray(_)&&(_=_[m?0:1]),_.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})})(ge);var ve={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(ve);var ye={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(ye);var Ye={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})(Ye);var $e={exports:{}};(function(y,T){(function(c,u){y.exports=u(U)})(q,function(c){function u(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var p=u(c),l={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(l,null,!0),l})})($e);ne.extend(pe);function Se(y){const{rights:T,creatorId:c}=y;return T.filter(p=>!p.includes(c)).length>=1}const we=({data:y,isFetching:T,fetchNextPage:c})=>{const{currentApp:u,currentLanguage:p,appCode:l}=se(),{t:r}=ae(),S=ie(),M=oe(),m=ue(),{setSelectedResources:Y,setResourceIds:_,openResource:I,setResourceIsTrash:w}=de(),j=ce(),O=me({from:{opacity:0},to:{opacity:1}}),R=S.pagination.startIdx+S.pagination.pageSize<(S.pagination.maxIdx||0),C=le.useCallback(()=>{c()},[]),J=f=>{j?(w(!0),_([f.id]),Y([f])):I(f)};async function A(f){if(M.includes(f.id)){_(M.filter(H=>H!==f.id)),Y(m.filter(H=>H.id!==f.id));return}_([...M,f.id]),Y([...m,f])}const b=_e("grid ps-0 list-unstyled");return W.jsxs(K.Fragment,{children:[W.jsx(X.ul,{className:b,children:y==null?void 0:y.pages.map((f,H)=>W.jsx(K.Fragment,{children:f.resources.map(L=>{const{id:v,creatorName:d,creatorId:P,name:G,thumbnail:a,updatedAt:n}=L,e=Se(L),s=ne(n).locale(p).fromNow(),t={messagePublic:r("tooltip.public",{ns:l}),messageShared:r("tooltip.shared",{ns:l})};return W.jsx(X.li,{className:"g-col-4 z-1",style:{position:"relative",...O},children:W.jsx(he,{app:u,className:"c-pointer",tooltips:t,options:{type:"resource",name:G,creatorName:d,userSrc:`/userbook/avatar/${P}`,updatedAt:s,isPublic:L.public,isShared:e,imageSrc:a},isSelected:M.includes(L.id),isLoading:T,onOpen:()=>J(L),onSelect:()=>A(L)})},v)})},H))}),R&&W.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:W.jsx(fe,{type:"button",color:"secondary",variant:"filled",onClick:C,children:r("explorer.see.more")})})]})};export{we as default};
@@ -1 +1 @@
1
- import{r,g as G,j as e,d as ce,u as ae,h as be,i as ye,k as je,l as de,m as ve,n as Se,o as Ne,p as ee,A as we,a as Ie,M as O,V as Y,q as oe,B as L,s as ie,t as Be,v as Ae,F as Z,w as Ce,x as Re,y as Me,z as Te,C as $e}from"./index.js";import{odeServices as E,APP as Ee}from"/assets/js/edifice-ts-client/index.js";import{H as se}from"./Heading.js";import{T as Pe}from"./Tooltip.js";function Fe(){const[h,m]=r.useState(!1);r.useEffect(()=>{u()},[]);const u=r.useCallback(async()=>{const p=await E.session().isAdml();m(p)},[]);return{isAdml:h}}const he=r.forwardRef(({label:h,disabled:m=!1,checked:u=!1,indeterminate:p=!1,...d},v)=>{const f=r.useRef(null);r.useImperativeHandle(v,()=>({...f.current})),r.useEffect(()=>{f.current.indeterminate=p},[f,p]);const S=r.useId(),i={type:"checkbox",checked:u,disabled:m,ref:f,className:G(d.className,"form-check-input c-pointer"),id:S},x={...d,...i};return e.jsxs("div",{className:"form-check d-flex align-items-center gap-8",children:[e.jsx("input",{...x}),h&&e.jsx("label",{className:"form-check-label",htmlFor:x.id,children:h})]})});he.displayName="Checkbox";const ne=he,ue=r.forwardRef(({model:h,icon:m,label:u=!1,disabled:p=!1,...d},v)=>{const f=r.useMemo(()=>d.id?d.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[d.id]),i={...{type:"radio",checked:h===d.value,disabled:p,ref:v,className:G(d.className,"form-check-input c-pointer",m&&"d-none"),id:f},...d};return e.jsxs("div",{className:G("form-check d-flex align-items-center gap-8",m&&"ps-0"),children:[e.jsx("input",{...i}),m&&e.jsx("label",{htmlFor:i.id,className:G("c-pointer",h!==d.value&&"text-muted"),children:m}),!m&&u&&e.jsx("label",{className:"form-check-label",htmlFor:i.id,children:u})]})});ue.displayName="Radio";const le=ue;function Ue({radioPublicationValue:h,onRadioPublicationChange:m}){const{appCode:u}=ce(),{t:p}=ae(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:p("explorer.publication.steps")}),e.jsx(le,{label:p("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:h,onChange:d=>m(d.target.value)}),e.jsx(le,{label:p("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:h,onChange:d=>m(d.target.value)})]})}function ze({radioPublicationValue:h,onRadioPublicationChange:m}){const{app:u}=be();return u===Ee.BLOG?e.jsx(Ue,{radioPublicationValue:h,onRadioPublicationChange:m}):e.jsx(e.Fragment,{})}function De({onSuccess:h,payloadUpdatePublishType:m}){const{appCode:u}=ce(),{t:p}=ae(),{user:d,avatar:v}=ye(),[f,S]=r.useState(r.useId()),[i,x]=r.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[y,N]=r.useState([]),[P,H]=r.useState(""),[w,V]=r.useState(!1),[C,W]=r.useState(""),I=je(C,500),[_,J]=r.useState([]),[R,F]=r.useState([]),[U,K]=r.useState(!1),[M,q]=r.useState(!1),{isAdml:B}=Fe(),A=de(),Q=ve(),X=Se(),{hotToast:n}=Ne(we);r.useEffect(()=>{z()},[]),r.useEffect(()=>{fe(I)},[I]);const z=r.useCallback(async()=>{var a;const t=await E.share().getActionsForApp(u);N(t);const c=await E.share().getRightsForResource(u,(a=A[0])==null?void 0:a.assetId);x(c)},[]),l=(t,c)=>{x(({rights:a,...g})=>{var te,re;const s=[...a],o=s.findIndex(k=>k.id===t.id),T=y.filter(k=>k.id===c)[0];if(s[o].actions.findIndex(k=>k.id===c)>-1){let k=s[o].actions.filter(b=>b.id!==c);const j=y.filter(b=>{var $;return($=b.requires)==null?void 0:$.includes(c)});k=k.filter(b=>!j.find($=>$.id===b.id)),s[o]={...s[o],actions:k}}else{const k=y.filter(j=>{var b;return((b=T.requires)==null?void 0:b.includes(j.id))&&!s[o].actions.find($=>$.id===j.id)});s[o]={...s[o],actions:[...s[o].actions,T,...k]}}return t.type==="sharebookmark"&&((te=s[o].users)==null||te.forEach(k=>{const j=s.findIndex(b=>b.id===k.id);s[j]={...s[j],actions:s[o].actions}}),(re=s[o].groups)==null||re.forEach(k=>{const j=s.findIndex(b=>b.id===k.id);s[j]={...s[j],actions:s[o].actions}})),{rights:s,...g}})},D=async()=>{var t;try{await Q.mutateAsync(m),await X.mutateAsync({entId:(t=A[0])==null?void 0:t.assetId,shares:i.rights}),n.success(p("explorer.shared.status.saved")),h==null||h()}catch(c){console.error("Failed to save share",c),n.error(p("explorer.shared.status.error"))}},me=t=>{x(c=>({...c,rights:i.rights.filter(a=>{var g,s;return a.id!==t.id&&!((g=t.users)!=null&&g.find(o=>o.id===a.id))&&!((s=t.groups)!=null&&s.find(o=>o.id===a.id))})}))},pe=t=>{W(t.target.value)},xe=()=>!M&&!B&&I.length>0&&R.length===0||!M&&B&&I.length>3&&R.length===0,ke=()=>B&&C.length<3,ge=()=>M&&C.length>0,fe=async t=>{var c;if(q(!0),!B&&t.length>=1||B&&t.length>=3){const a=await E.share().searchShareSubjects(u,(c=A[0])==null?void 0:c.assetId,t);J(a);const g=a.filter(s=>!i.rights.find(o=>o.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}));F(g)}else F([]),Promise.resolve();q(!1)};return{currentIsAuthor:()=>{for(const t of A)if(t.creatorId!==(d==null?void 0:d.userId))return!1;return!0},idBookmark:f,myAvatar:v,shareRights:i,shareRightActions:y,showBookmarkInput:w,searchInputValue:C,searchResults:R,bookmarkName:P,showBookmarkMembers:U,debouncedSearchInputValue:I,searchPending:M,setBookmarkName:H,saveBookmark:async t=>{try{const c=await E.directory().saveBookmarks(t,{users:i.rights.filter(a=>a.type==="user").map(a=>a.id),groups:i.rights.filter(a=>a.type==="group").map(a=>a.id),bookmarks:i.rights.filter(a=>a.type==="sharebookmark").map(a=>a.id)});n.success(p("explorer.bookmarked.status.saved")),x(a=>({...a,visibleBookmarks:[...a.visibleBookmarks,{displayName:t,id:c.id}]})),S(f+new Date().getTime().toString()),V(!1)}catch(c){console.error("Failed to save bookmark",c),n.error(p("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:V,handleActionCheckbox:l,handleShare:D,handleDeleteRow:me,handleSearchInputChange:pe,handleSearchResultsChange:async t=>{const c=_.find(g=>g.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(c){let g=[];if(c.type==="sharebookmark"){const s=await E.directory().getBookMarkById(c.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(o=>!i.rights.find(T=>T.id===o.id)).forEach(o=>{g.push({...o,type:"user",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})}),s.groups.filter(o=>!i.rights.find(T=>T.id===o.id)).forEach(o=>{g.push({...o,type:"group",avatarUrl:"",directoryUrl:"",actions:a,isBookmarkMember:!0})})}else g=[{...c,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];x({...i,rights:[...i.rights,...g]}),F(R.filter(s=>s.value!==t[0]))}},showSearchNoResults:xe,showSearchAdmlHint:ke,showSearchLoading:ge,handleBookmarkMembersToggle:()=>{K(!U)},hasRight:(t,c)=>t.actions.filter(a=>c.id===a.id).length>0,showShareRightLine:t=>t.isBookmarkMember&&U||!t.isBookmarkMember}}function Le(){const h=de(),{assetId:m,description:u,thumbnail:p,name:d,public:v,trashed:f,slug:S,"publish-type":i}=h.length>0?h[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[x,y]=r.useState(i||"RESTRAINT"),[N,P]=r.useState({description:u||"",entId:m,name:d,public:!!v,slug:S||"",thumbnail:p,trashed:f,"publish-type":i});return r.useEffect(()=>{x&&P(w=>({...w,"publish-type":x}))},[x]),{radioPublicationValue:x,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{y(w)}}}function Ze({isOpen:h,onSuccess:m,onCancel:u}){const{payloadUpdatePublishType:p,radioPublicationValue:d,handleRadioPublicationChange:v}=Le(),{myAvatar:f,idBookmark:S,shareRights:i,shareRightActions:x,showBookmarkInput:y,searchResults:N,bookmarkName:P,showBookmarkMembers:H,searchPending:w,currentIsAuthor:V,setBookmarkName:C,saveBookmark:W,canSave:I,toggleBookmarkInput:_,handleActionCheckbox:J,handleShare:R,handleDeleteRow:F,handleSearchInputChange:U,handleSearchResultsChange:K,showSearchNoResults:M,showSearchAdmlHint:q,showSearchLoading:B,handleBookmarkMembersToggle:A,hasRight:Q,showShareRightLine:X}=De({payloadUpdatePublishType:p,onSuccess:m,onCancel:u}),{t:n}=ae(),z=r.useRef(null);return Ie.createPortal(e.jsxs(O,{id:"share_modal",size:"lg",isOpen:h,onModalClose:u,children:[e.jsx(O.Header,{onModalClose:u,children:n("share.title")}),e.jsxs(O.Body,{children:[e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:n("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:n("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:n("explorer.modal.share.search.placeholder")})}),x.map(l=>e.jsx("th",{scope:"col",className:"text-center text-white",children:n(l.displayName)},l.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:n("close")})})]})}),e.jsxs("tbody",{children:[V()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(oe,{alt:n("explorer.modal.share.avatar.me.alt"),size:"xs",src:f,variant:"circle"})}),e.jsx("td",{children:n("share.me")}),x.map(l=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ne,{checked:!0,disabled:!0})},l.displayName)),e.jsx("td",{})]}),i==null?void 0:i.rights.map(l=>X(l)&&e.jsxs("tr",{className:l.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[l.type!=="sharebookmark"&&e.jsx(oe,{alt:n("explorer.modal.share.avatar.shared.alt"),size:"xs",src:l.avatarUrl,variant:"circle"}),l.type==="sharebookmark"&&e.jsx(ee,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[l.type==="sharebookmark"&&e.jsx(L,{color:"tertiary",rightIcon:e.jsx(ie,{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:l.displayName}),l.type!=="sharebookmark"&&l.displayName]})}),x.map(D=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ne,{checked:Q(l,D),onChange:()=>J(l,D.id)})},D.displayName)),e.jsx("td",{children:!l.isBookmarkMember&&e.jsx(Be,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Ae,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>F(l)})})]},l.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(L,{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:y?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>_(!y),children:n("share.save.sharebookmark")}),y&&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:z,onChange:()=>{C(()=>{var l;return((l=z.current)==null?void 0:l.value)||""})},placeholder:n("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},S)}),e.jsx(L,{type:"button",color:"primary",variant:"ghost",disabled:P.length===0,leftIcon:e.jsx(Ce,{}),onClick:()=>{W(z.current.value)},className:"text-nowrap",children:n("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:n("explorer.modal.share.search")}),e.jsx(Pe,{message:"Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.",placement:"top",children:e.jsx(Re,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Me,{className:"max-w-512",noValidationIcon:!0,placeholder:q()?n("explorer.search.adml.hint"):n("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:U}),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:n("explorer.search.pending")})]}),M()&&e.jsx("div",{className:"p-4",children:n("portal.no.result")})]}),(N==null?void 0:N.length)>0&&e.jsx("div",{className:"position-absolute w-100 max-w-512 z-1 bg-white shadow rounded-4 d-block show py-12 px-8",children:e.jsx($e,{options:N,hideCheckbox:!0,isMonoSelection:!0,onChange:K})}),e.jsx(ze,{radioPublicationValue:d,onRadioPublicationChange:v})]}),e.jsxs(O.Footer,{children:[e.jsx(L,{type:"button",color:"tertiary",variant:"ghost",onClick:u,children:n("explorer.cancel")}),e.jsx(L,{type:"button",color:"primary",variant:"filled",onClick:R,disabled:!I(),children:n("share")})]})]}),document.getElementById("portal"))}export{Ze as default};
1
+ import{r as o,g as H,j as e,R as ye,d as ce,u as ae,h as ve,i as je,k as Se,l as de,m as Ne,n as we,o as Ie,p as ee,A as Be,a as Ae,M as G,V as Y,q as oe,B as z,s as le,t as Re,v as Me,F as Z,w as Ce,x as Ee,y as Te,z as $e}from"./index.js";import{odeServices as $,APP as Pe}from"/assets/js/edifice-ts-client/index.js";import{H as se}from"./Heading.js";import{T as Fe}from"./Tooltip.js";function Ue(){const[i,u]=o.useState(!1);o.useEffect(()=>{m()},[]);const m=o.useCallback(async()=>{const p=await $.session().isAdml();u(p)},[]);return{isAdml:i}}const he=o.forwardRef(({label:i,disabled:u=!1,checked:m=!1,indeterminate:p=!1,...n},f)=>{const k=o.useRef(null);o.useImperativeHandle(f,()=>({...k.current})),o.useEffect(()=>{k.current.indeterminate=p},[k,p]);const j=o.useId(),a={type:"checkbox",checked:m,disabled:u,ref:k,className:H(n.className,"form-check-input c-pointer"),id:j},x={...n,...a};return e.jsxs("div",{className:"form-check d-flex align-items-center gap-8",children:[e.jsx("input",{...x}),i&&e.jsx("label",{className:"form-check-label",htmlFor:x.id,children:i})]})});he.displayName="Checkbox";const ie=he,ue=({options:i,hideCheckbox:u,isMonoSelection:m,onChange:p,model:n=[]})=>{const[f,k]=o.useState(n),j=a=>{k(m?[a]:x=>{const b=[...x];return x.includes(a)?b.splice(b.indexOf(a),1):b.push(a),b})};return o.useEffect(()=>{p==null||p(f)},[f]),e.jsx(e.Fragment,{children:e.jsx("div",{className:"select-list",children:i==null?void 0:i.map(a=>e.jsxs("div",{className:H("select-list-option",u&&f.includes(a.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":f.includes(a.value),onMouseUp:()=>{j(a.value)},tabIndex:0,onKeyDown:x=>{x.key==="Enter"&&j(a.value)},children:[e.jsx("div",{className:"select-list-option-icon",children:a.icon&&ye.createElement(a.icon,{width:"20px",height:"20px"})}),e.jsx("div",{className:"select-list-option-label",children:a.label}),!u&&e.jsx("div",{className:"select-list-option-checkbox",children:e.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:f.includes(a.value),className:"form-check-input c-pointer",id:"option.value"})})]},a.value))})})};ue.displayName="SelectList";const Le=ue,me=o.forwardRef(({model:i,icon:u,label:m=!1,disabled:p=!1,...n},f)=>{const k=o.useMemo(()=>n.id?n.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[n.id]),a={...{type:"radio",checked:i===n.value,disabled:p,ref:f,className:H(n.className,"form-check-input c-pointer",u&&"d-none"),id:k},...n};return e.jsxs("div",{className:H("form-check d-flex align-items-center gap-8",u&&"ps-0"),children:[e.jsx("input",{...a}),u&&e.jsx("label",{htmlFor:a.id,className:H("c-pointer",i!==n.value&&"text-muted"),children:u}),!u&&m&&e.jsx("label",{className:"form-check-label",htmlFor:a.id,children:m})]})});me.displayName="Radio";const ne=me;function De({radioPublicationValue:i,onRadioPublicationChange:u}){const{appCode:m}=ce(),{t:p}=ae(m);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:p("explorer.publication.steps")}),e.jsx(ne,{label:p("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:i,onChange:n=>u(n.target.value)}),e.jsx(ne,{label:p("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:i,onChange:n=>u(n.target.value)})]})}function ze({radioPublicationValue:i,onRadioPublicationChange:u}){const{app:m}=ve();return m===Pe.BLOG?e.jsx(De,{radioPublicationValue:i,onRadioPublicationChange:u}):e.jsx(e.Fragment,{})}function He({onSuccess:i,payloadUpdatePublishType:u}){const{appCode:m}=ce(),{t:p}=ae(),{user:n,avatar:f}=je(),[k,j]=o.useState(o.useId()),[a,x]=o.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[b,N]=o.useState([]),[P,V]=o.useState(""),[w,q]=o.useState(!1),[R,K]=o.useState(""),I=Se(R,500),[W,_]=o.useState([]),[M,F]=o.useState([]),[U,J]=o.useState(!1),[C,O]=o.useState(!1),{isAdml:B}=Ue(),A=de(),Q=Ne(),X=we(),{hotToast:c}=Ie(Be);o.useEffect(()=>{L()},[]),o.useEffect(()=>{ge(I)},[I]);const L=o.useCallback(async()=>{var t;const r=await $.share().getActionsForApp(m);N(r);const h=await $.share().getRightsForResource(m,(t=A[0])==null?void 0:t.assetId);x(h)},[]),d=(r,h)=>{x(({rights:t,...y})=>{var te,re;const s=[...t],l=s.findIndex(g=>g.id===r.id),E=b.filter(g=>g.id===h)[0];if(s[l].actions.findIndex(g=>g.id===h)>-1){let g=s[l].actions.filter(v=>v.id!==h);const S=b.filter(v=>{var T;return(T=v.requires)==null?void 0:T.includes(h)});g=g.filter(v=>!S.find(T=>T.id===v.id)),s[l]={...s[l],actions:g}}else{const g=b.filter(S=>{var v;return((v=E.requires)==null?void 0:v.includes(S.id))&&!s[l].actions.find(T=>T.id===S.id)});s[l]={...s[l],actions:[...s[l].actions,E,...g]}}return r.type==="sharebookmark"&&((te=s[l].users)==null||te.forEach(g=>{const S=s.findIndex(v=>v.id===g.id);s[S]={...s[S],actions:s[l].actions}}),(re=s[l].groups)==null||re.forEach(g=>{const S=s.findIndex(v=>v.id===g.id);s[S]={...s[S],actions:s[l].actions}})),{rights:s,...y}})},D=async()=>{var r;try{await Q.mutateAsync(u),await X.mutateAsync({entId:(r=A[0])==null?void 0:r.assetId,shares:a.rights}),c.success(p("explorer.shared.status.saved")),i==null||i()}catch(h){console.error("Failed to save share",h),c.error(p("explorer.shared.status.error"))}},pe=r=>{x(h=>({...h,rights:a.rights.filter(t=>{var y,s;return t.id!==r.id&&!((y=r.users)!=null&&y.find(l=>l.id===t.id))&&!((s=r.groups)!=null&&s.find(l=>l.id===t.id))})}))},xe=r=>{K(r.target.value)},ke=()=>!C&&!B&&I.length>0&&M.length===0||!C&&B&&I.length>3&&M.length===0,fe=()=>B&&R.length<3,be=()=>C&&R.length>0,ge=async r=>{var h;if(O(!0),!B&&r.length>=1||B&&r.length>=3){const t=await $.share().searchShareSubjects(m,(h=A[0])==null?void 0:h.assetId,r);_(t);const y=t.filter(s=>!a.rights.find(l=>l.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}));F(y)}else F([]),Promise.resolve();O(!1)};return{currentIsAuthor:()=>{for(const r of A)if(r.creatorId!==(n==null?void 0:n.userId))return!1;return!0},idBookmark:k,myAvatar:f,shareRights:a,shareRightActions:b,showBookmarkInput:w,searchInputValue:R,searchResults:M,bookmarkName:P,showBookmarkMembers:U,debouncedSearchInputValue:I,searchPending:C,setBookmarkName:V,saveBookmark:async r=>{try{const h=await $.directory().saveBookmarks(r,{users:a.rights.filter(t=>t.type==="user").map(t=>t.id),groups:a.rights.filter(t=>t.type==="group").map(t=>t.id),bookmarks:a.rights.filter(t=>t.type==="sharebookmark").map(t=>t.id)});c.success(p("explorer.bookmarked.status.saved")),x(t=>({...t,visibleBookmarks:[...t.visibleBookmarks,{displayName:r,id:h.id}]})),j(k+new Date().getTime().toString()),q(!1)}catch(h){console.error("Failed to save bookmark",h),c.error(p("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:q,handleActionCheckbox:d,handleShare:D,handleDeleteRow:pe,handleSearchInputChange:xe,handleSearchResultsChange:async r=>{const h=W.find(y=>y.id===r[0]),t=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(h){let y=[];if(h.type==="sharebookmark"){const s=await $.directory().getBookMarkById(h.id);y.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:t}),s==null||s.users.filter(l=>!a.rights.find(E=>E.id===l.id)).forEach(l=>{y.push({...l,type:"user",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})}),s.groups.filter(l=>!a.rights.find(E=>E.id===l.id)).forEach(l=>{y.push({...l,type:"group",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})})}else y=[{...h,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];x({...a,rights:[...a.rights,...y]}),F(M.filter(s=>s.value!==r[0]))}},showSearchNoResults:ke,showSearchAdmlHint:fe,showSearchLoading:be,handleBookmarkMembersToggle:()=>{J(!U)},hasRight:(r,h)=>r.actions.filter(t=>h.id===t.id).length>0,showShareRightLine:r=>r.isBookmarkMember&&U||!r.isBookmarkMember}}function Ve(){const i=de(),{assetId:u,description:m,thumbnail:p,name:n,public:f,trashed:k,slug:j,"publish-type":a}=i.length>0?i[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[x,b]=o.useState(a||"RESTRAINT"),[N,P]=o.useState({description:m||"",entId:u,name:n,public:!!f,slug:j||"",thumbnail:p,trashed:k,"publish-type":a});return o.useEffect(()=>{x&&P(w=>({...w,"publish-type":x}))},[x]),{radioPublicationValue:x,payloadUpdatePublishType:N,handleRadioPublicationChange:async w=>{b(w)}}}function ss({isOpen:i,onSuccess:u,onCancel:m}){const{payloadUpdatePublishType:p,radioPublicationValue:n,handleRadioPublicationChange:f}=Ve(),{myAvatar:k,idBookmark:j,shareRights:a,shareRightActions:x,showBookmarkInput:b,searchResults:N,bookmarkName:P,showBookmarkMembers:V,searchPending:w,currentIsAuthor:q,setBookmarkName:R,saveBookmark:K,canSave:I,toggleBookmarkInput:W,handleActionCheckbox:_,handleShare:M,handleDeleteRow:F,handleSearchInputChange:U,handleSearchResultsChange:J,showSearchNoResults:C,showSearchAdmlHint:O,showSearchLoading:B,handleBookmarkMembersToggle:A,hasRight:Q,showShareRightLine:X}=He({payloadUpdatePublishType:p,onSuccess:u,onCancel:m}),{t:c}=ae(),L=o.useRef(null);return Ae.createPortal(e.jsxs(G,{id:"share_modal",size:"lg",isOpen:i,onModalClose:m,children:[e.jsx(G.Header,{onModalClose:m,children:c("share.title")}),e.jsxs(G.Body,{children:[e.jsx(se,{headingStyle:"h4",level:"h3",className:"mb-16",children:c("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:c("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:c("explorer.modal.share.search.placeholder")})}),x.map(d=>e.jsx("th",{scope:"col",className:"text-center text-white",children:c(d.displayName)},d.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:c("close")})})]})}),e.jsxs("tbody",{children:[q()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(oe,{alt:c("explorer.modal.share.avatar.me.alt"),size:"xs",src:k,variant:"circle"})}),e.jsx("td",{children:c("share.me")}),x.map(d=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ie,{checked:!0,disabled:!0})},d.displayName)),e.jsx("td",{})]}),a==null?void 0:a.rights.map(d=>X(d)&&e.jsxs("tr",{className:d.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[d.type!=="sharebookmark"&&e.jsx(oe,{alt:c("explorer.modal.share.avatar.shared.alt"),size:"xs",src:d.avatarUrl,variant:"circle"}),d.type==="sharebookmark"&&e.jsx(ee,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[d.type==="sharebookmark"&&e.jsx(z,{color:"tertiary",rightIcon:e.jsx(le,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:V?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal ps-0",onClick:A,children:d.displayName}),d.type!=="sharebookmark"&&d.displayName]})}),x.map(D=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ie,{checked:Q(d,D),onChange:()=>_(d,D.id)})},D.displayName)),e.jsx("td",{children:!d.isBookmarkMember&&e.jsx(Re,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Me,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>F(d)})})]},d.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(z,{color:"tertiary",leftIcon:e.jsx(ee,{}),rightIcon:e.jsx(le,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:b?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>W(!b),children:c("share.save.sharebookmark")}),b&&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:L,onChange:()=>{R(()=>{var d;return((d=L.current)==null?void 0:d.value)||""})},placeholder:c("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},j)}),e.jsx(z,{type:"button",color:"primary",variant:"ghost",disabled:P.length===0,leftIcon:e.jsx(Ce,{}),onClick:()=>{K(L.current.value)},className:"text-nowrap",children:c("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:c("explorer.modal.share.search")}),e.jsx(Fe,{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(Ee,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Te,{className:"max-w-512",noValidationIcon:!0,placeholder:O()?c("explorer.search.adml.hint"):c("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:U}),B()&&e.jsxs("div",{className:"d-flex align-items-center p-4",children:[e.jsx($e,{isLoading:w}),e.jsx("span",{className:"ps-4",children:c("explorer.search.pending")})]}),C()&&e.jsx("div",{className:"p-4",children:c("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(Le,{options:N,hideCheckbox:!0,isMonoSelection:!0,onChange:J})}),e.jsx(ze,{radioPublicationValue:n,onRadioPublicationChange:f})]}),e.jsxs(G.Footer,{children:[e.jsx(z,{type:"button",color:"tertiary",variant:"ghost",onClick:m,children:c("explorer.cancel")}),e.jsx(z,{type:"button",color:"primary",variant:"filled",onClick:M,disabled:!I(),children:c("share")})]})]}),document.getElementById("portal"))}export{ss as default};
package/dist/TextArea.js CHANGED
@@ -1 +1 @@
1
- import{r as g,g as y,j as a,F as f,t as j,a6 as A,a7 as L,y as N,q as T,a8 as z,a1 as E}from"./index.js";const F=(r,m)=>{const[,o]=g.useState(!1),i=g.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),c=e=>{e.preventDefault(),e.stopPropagation(),o(!1)};return{handleDragging:i,handleDragLeave:c,handleDrop:e=>{var d;c(e);const l=(d=e.dataTransfer)==null?void 0:d.files;m(l),r!=null&&r.current&&l&&(r.current.files=l)}}},O=F,C=g.forwardRef(({label:r,addButtonLabel:m="Add image",deleteButtonLabel:o="Delete image",src:i,className:c,app:p,onUploadImage:e,onDeleteImage:l},d)=>{const s=g.useRef(null),[t,u]=g.useState({name:"",image:i||""}),x=n=>{u({...t,name:"",image:""});const h=n==null?void 0:n[0];if(!h)return;const D={...t,name:h.name,image:URL.createObjectURL(h)};u(D),e(D)},R=()=>{var n;(n=s.current)==null||n.click()},b=()=>{s.current&&(s.current.value="");const n={...t,name:"",image:""};u(n),l()},k=n=>{x(n.target.files)},w=y("image-input",c),{handleDragging:v,handleDragLeave:I,handleDrop:P}=O(s,x);return a.jsxs(f,{id:"image-input",className:w,onDragEnter:v,onDragOver:v,onDragLeave:I,onDrop:P,ref:d,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(j,{"aria-label":m,color:"tertiary",icon:a.jsx(A,{}),onClick:R,type:"button",variant:"ghost"}),a.jsx(j,{"aria-label":o,color:"danger",disabled:!t.image,icon:a.jsx(L,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),a.jsxs(f.Label,{children:[a.jsx("span",{className:"visually-hidden",children:r}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:k,ref:s,size:"sm",type:"file"}),t.image?a.jsx(T,{alt:t.name,src:t.image,size:"xl"}):a.jsx(z,{app:p,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const q=C,$=g.forwardRef(({noValidationIcon:r,placeholder:m,size:o="md",height:i="md",className:c,...p},e)=>{const{id:l,isRequired:d,isReadOnly:s,status:t}=E(),u=y({"form-control":!s,"form-control-lg":o==="lg","form-control-sm":o==="sm","textarea-height-lg":i==="lg","textarea-height-md":i==="md","textarea-height-sm":i==="sm","is-invalid":t==="invalid","is-valid":t==="valid","form-control-plaintext":s,"no-validation-icon":r},c);return a.jsx("textarea",{ref:e,id:l,className:u,placeholder:m,required:d,readOnly:s,...p})});$.displayName="TextArea";const U=$;export{q as I,U as T};
1
+ import{r as g,g as y,j as a,F as f,t as j,a4 as A,a5 as L,y as N,q as T,a6 as z,a0 as E}from"./index.js";const F=(r,m)=>{const[,o]=g.useState(!1),i=g.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),c=e=>{e.preventDefault(),e.stopPropagation(),o(!1)};return{handleDragging:i,handleDragLeave:c,handleDrop:e=>{var d;c(e);const l=(d=e.dataTransfer)==null?void 0:d.files;m(l),r!=null&&r.current&&l&&(r.current.files=l)}}},O=F,C=g.forwardRef(({label:r,addButtonLabel:m="Add image",deleteButtonLabel:o="Delete image",src:i,className:c,app:p,onUploadImage:e,onDeleteImage:l},d)=>{const s=g.useRef(null),[t,u]=g.useState({name:"",image:i||""}),x=n=>{u({...t,name:"",image:""});const h=n==null?void 0:n[0];if(!h)return;const D={...t,name:h.name,image:URL.createObjectURL(h)};u(D),e(D)},R=()=>{var n;(n=s.current)==null||n.click()},b=()=>{s.current&&(s.current.value="");const n={...t,name:"",image:""};u(n),l()},k=n=>{x(n.target.files)},w=y("image-input",c),{handleDragging:v,handleDragLeave:I,handleDrop:P}=O(s,x);return a.jsxs(f,{id:"image-input",className:w,onDragEnter:v,onDragOver:v,onDragLeave:I,onDrop:P,ref:d,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(j,{"aria-label":m,color:"tertiary",icon:a.jsx(A,{}),onClick:R,type:"button",variant:"ghost"}),a.jsx(j,{"aria-label":o,color:"danger",disabled:!t.image,icon:a.jsx(L,{width:"20",height:"20"}),onClick:b,type:"button",variant:"ghost"})]}),a.jsxs(f.Label,{children:[a.jsx("span",{className:"visually-hidden",children:r}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:k,ref:s,size:"sm",type:"file"}),t.image?a.jsx(T,{alt:t.name,src:t.image,size:"xl"}):a.jsx(z,{app:p,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const q=C,$=g.forwardRef(({noValidationIcon:r,placeholder:m,size:o="md",height:i="md",className:c,...p},e)=>{const{id:l,isRequired:d,isReadOnly:s,status:t}=E(),u=y({"form-control":!s,"form-control-lg":o==="lg","form-control-sm":o==="sm","textarea-height-lg":i==="lg","textarea-height-md":i==="md","textarea-height-sm":i==="sm","is-invalid":t==="invalid","is-valid":t==="valid","form-control-plaintext":s,"no-validation-icon":r},c);return a.jsx("textarea",{ref:e,id:l,className:u,placeholder:m,required:d,readOnly:s,...p})});$.displayName="TextArea";const U=$;export{q as I,U as T};
package/dist/Tooltip.js CHANGED
@@ -1 +1 @@
1
- import{r as s,am as v,j as e,g as E}from"./index.js";const j=({children:r,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}=v(i,c,{placement:a,modifiers:[{name:"arrow",options:{element:u}}]}),[f,l]=s.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"d-inline-block position-relative z-2",ref:p,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},children:r}),f&&e.jsxs("div",{className:E("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})]})]})},w=j;export{w as T};
1
+ import{r as s,ak as v,j as e,g as E}from"./index.js";const j=({children:r,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}=v(i,c,{placement:a,modifiers:[{name:"arrow",options:{element:u}}]}),[f,l]=s.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"d-inline-block position-relative z-2",ref:p,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},children:r}),f&&e.jsxs("div",{className:E("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})]})]})},w=j;export{w as T};
Binary file
Binary file
Binary file