ode-explorer 1.0.2-dev.202309271636 → 1.0.2-dev.202309271845
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/DeleteModal.js +1 -1
- package/dist/EditFolderModal.js +1 -1
- package/dist/EditResourceModal.js +1 -1
- package/dist/MoveModal.js +1 -1
- package/dist/ShareResourceModal.js +1 -1
- package/dist/index.js +28 -28
- package/dist/version.txt +1 -1
- package/package.json +1 -1
package/dist/DeleteModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as d,D as
|
|
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};
|
package/dist/EditFolderModal.js
CHANGED
|
@@ -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{}};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{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 +1 @@
|
|
|
1
|
-
import{u as
|
|
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};
|
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{}}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,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 +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,...c},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(c.className,"form-check-input c-pointer"),id:S},x={...c,...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,...c},v)=>{const f=r.useMemo(()=>c.id?c.id:(Math.floor(Math.random()*999999999999)+1e12).toString(),[c.id]),i={...{type:"radio",checked:h===c.value,disabled:p,ref:v,className:G(c.className,"form-check-input c-pointer",m&&"d-none"),id:f},...c};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!==c.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:c=>m(c.target.value)}),e.jsx(le,{label:p("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",model:h,onChange:c=>m(c.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:c,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 d=await E.share().getRightsForResource(u,(a=A[0])==null?void 0:a.assetId);x(d)},[]),l=(t,d)=>{x(({rights:a,...g})=>{var te,re;const s=[...a],o=s.findIndex(k=>k.id===t.id),T=y.filter(k=>k.id===d)[0];if(s[o].actions.findIndex(k=>k.id===d)>-1){let k=s[o].actions.filter(b=>b.id!==d);const j=y.filter(b=>{var $;return($=b.requires)==null?void 0:$.includes(d)});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{n.error(p("explorer.shared.status.error"))}},me=t=>{x(d=>({...d,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 d;if(q(!0),!B&&t.length>=1||B&&t.length>=3){const a=await E.share().searchShareSubjects(u,(d=A[0])==null?void 0:d.assetId,t);J(a);const g=a.filter(s=>!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!==(c==null?void 0:c.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 d=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:d.id}]})),S(f+new Date().getTime().toString()),V(!1)}catch{n.error(p("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:V,handleActionCheckbox:l,handleShare:D,handleDeleteRow:me,handleSearchInputChange:pe,handleSearchResultsChange:async t=>{const d=_.find(g=>g.id===t[0]),a=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(d){let g=[];if(d.type==="sharebookmark"){const s=await E.directory().getBookMarkById(d.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:a}),s==null||s.users.filter(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=[{...d,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,d)=>t.actions.filter(a=>d.id===a.id).length>0,showShareRightLine:t=>t.isBookmarkMember&&U||!t.isBookmarkMember}}function Le(){const h=de(),{assetId:m,description:u,thumbnail:p,name:c,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:c,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:c,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:c,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,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};
|