ode-explorer 1.3.3-develop.202402061659 → 1.3.3-develop.202402071721

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.
@@ -1,4 +1,4 @@
1
- import{d as Y,e as ne,b as oe,f as re,g as J,h as ce,i as ae,j as ie,k as le,u as q,a as ue,l as de,m as he,_ as I}from"./index.js";import{h as fe,j as e,B as K,a as pe,z as Re,C as Se,E as me,L as Ee,n as Oe,t as _e,H as ve,J as ye}from"./edifice-react.js";import{r as R,u as Q}from"./react.js";import{odeServices as j,ACTION as u}from"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function Ae({roles:o,rights:t,action:n}){const[d,s]=R.useState(!1),{user:S}=fe(),m=Y();R.useEffect(()=>{E()},[o,t]);const p=async function(a){const r=a instanceof Array?a:[a];if(o instanceof Array){const h=await j.rights().sessionHasAtLeastOneResourceRight(o,r);s(h)}else{const h=await j.rights().sessionHasResourceRight(o,r);s(h)}},l=async function(a){if(o instanceof Array){const r=await j.rights().sessionHasAtLeastOneResourceRightForEachList(o,a);s(r)}else{const r=await j.rights().sessionHasResourceRightForEachList(o,a);s(r)}},E=async function(){var a,r,h;if(o===void 0){s(!0);return}if(m&&((r=(a=t[0])==null?void 0:a.trashedBy)!=null&&r.includes(S==null?void 0:S.userId))&&n==="restore"&&!((h=t[0])!=null&&h.trashed)){s(!0);return}if(t instanceof Array)if(t.length>0)if(typeof t[0]=="string")await p(t);else{const _=t.map(v=>v.rights);await l(_)}else s(!1);else typeof t=="string"?await p(t):await p(t.rights)};return{visible:d,refreshState:E}}function X(){const[o,t]=R.useState(!1),[n,d]=R.useState("void"),[s,S]=R.useState(),m=ne(c=>c.config),p=oe(),l=re(),E=J(),a=ce(),r=ae(),h=Y(),_=ie(),v=le(),{openResource:g,printSelectedResource:w,openFolder:T,clearSelectedItems:L,clearSelectedIds:B}=q(),{data:D}=ue();R.useEffect(()=>{if(l.length===0&&r.length===0){t(!1);return}if(v){t(!1);return}t(!0)},[l,r]);async function H(c){var M;switch((M=document.getElementById("root"))==null||M.setAttribute("aria-hidden","true"),S(c),c.id){case u.OPEN:return l.length>0?g(E[0]):T({folder:a[0],folderId:a[0].id});case u.MOVE:return d("move");case u.PRINT:return w();case u.DELETE:return d("delete");case u.RESTORE:return await x();case u.PUBLISH:return d("publish");case u.UPD_PROPS:case"edit":return se();case u.SHARE:return d("share");default:throw Error(`Unknown action: ${c.id}`)}}function N(c){const M=l.length+r.length,C=l.length===1||r.length===1,G=M===1,F=r.length===0;switch(c.id){case u.OPEN:return G;case u.MANAGE:return C;case u.PUBLISH:return C&&F;case u.UPD_PROPS:return C&&F;case u.SHARE:return F&&C;case u.PRINT:return C&&F;case"edit":return G;default:return!0}}const U=()=>!0;async function x(){try{if(h)await _.mutate();else throw new Error("Cannot restore untrashed resources");y()}catch(c){console.error(c)}}function y(){var c;d("void"),s!=null&&s.id&&((c=document.getElementById(s==null?void 0:s.id))==null||c.focus())}const f=c=>()=>{n===c&&(y(),L(),B())},O=f("move"),k=f("move"),P=f("delete"),z=f("delete"),A=f("publish"),b=f("publish"),i=f("edit_folder"),V=f("edit_folder"),$=f("edit_resource"),Z=f("edit_resource"),W=f("share"),ee=f("share");function se(){l&&l.length>0?d("edit_resource"):d("edit_folder")}function te(c){return c.id==="edit"&&r.length>0?"explorer.rename":`explorer.actions.${c.id}`}return{onRestore:x,actions:h?m==null?void 0:m.trashActions:D,selectedElement:[...E,...a],currentFolderId:p==null?void 0:p.id,overrideLabel:te,handleClick:H,isActivable:h?U:N,isActionBarOpen:o,isMoveModalOpen:n==="move",onMoveCancel:O,onMoveSuccess:k,isDeleteModalOpen:n==="delete",onDeleteCancel:z,onDeleteSuccess:P,isPublishModalOpen:n==="publish",onPublishCancel:b,onPublishSuccess:A,isEditFolderOpen:n==="edit_folder",onEditFolderCancel:V,onEditFolderSuccess:i,isEditResourceOpen:n==="edit_resource",onEditResourceCancel:Z,onEditResourceSuccess:$,isShareResourceOpen:n==="share",onShareResourceCancel:ee,onShareResourceSuccess:W,onClearActionBar:y}}function be({resourceRights:o,roleExpected:t,action:n,children:d,renderWhenForbidden:s}){const{t:S}=Q(),{overrideLabel:m}=X(),{visible:p}=Ae({roles:t,rights:o,action:n==null?void 0:n.id}),{setResourceActionDisable:l}=q(),E=Y();return p?e.jsx(e.Fragment,{children:d}):s?s():E&&!p?e.jsx(K,{type:"button",color:"primary",variant:"filled",onClick:()=>{l(!0)},children:S(m(n))}):e.jsx(e.Fragment,{})}const Ce=R.lazy(async()=>await I(()=>import("./PublishModal.js"),__vite__mapDeps([0,1,2,3]))),Ie=R.lazy(async()=>await I(()=>import("./ResourceModal.js"),__vite__mapDeps([4,1,2,3]))),ge=R.lazy(async()=>await I(()=>import("./DeleteModal.js"),__vite__mapDeps([5,1,2,3,6]))),xe=R.lazy(async()=>await I(()=>import("./MoveModal.js"),__vite__mapDeps([7,1,2,3,6]))),Pe=R.lazy(async()=>await I(()=>import("./FolderModal.js"),__vite__mapDeps([8,1,2,3,6])));function Le(){const{appCode:o}=pe(),{t}=Q(),{actions:n,selectedElement:d,isMoveModalOpen:s,isDeleteModalOpen:S,isPublishModalOpen:m,isActionBarOpen:p,isEditFolderOpen:l,overrideLabel:E,onEditFolderCancel:a,onEditFolderSuccess:r,isEditResourceOpen:h,onEditResourceCancel:_,onEditResourceSuccess:v,isShareResourceOpen:g,onShareResourceCancel:w,onShareResourceSuccess:T,onMoveCancel:L,onMoveSuccess:B,onDeleteCancel:D,onDeleteSuccess:H,onPublishCancel:N,onPublishSuccess:U,isActivable:x,handleClick:y}=X(),O=J()[0],k=de(o),P=he(o),z=Re(p,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return e.jsxs(e.Fragment,{children:[z((A,b)=>b&&e.jsx(Se.div,{className:"position-fixed bottom-0 start-0 end-0 z-3",style:A,children:e.jsx(me,{children:n==null?void 0:n.filter(i=>i.available&&i.target==="actionbar").map(i=>x(i)&&e.jsx(be,{resourceRights:d,roleExpected:i.right,action:i,children:e.jsx(K,{id:i.id,type:"button",color:"primary",variant:"filled",onClick:()=>{y(i)},children:t(E(i))},i.id)},i.id))})})),e.jsxs(R.Suspense,{fallback:e.jsx(Ee,{}),children:[s&&e.jsx(xe,{isOpen:s,onCancel:L,onSuccess:B}),S&&e.jsx(ge,{isOpen:S,onCancel:D,onSuccess:H}),m&&O&&e.jsx(Ce,{isOpen:m,resourceId:O.assetId,onCancel:N,onSuccess:U}),l&&e.jsx(Pe,{edit:!0,isOpen:l,onCancel:a,onSuccess:r}),h&&O&&e.jsx(Ie,{mode:"update",isOpen:h,resourceId:O.assetId,updateResource:P,onCancel:_,onSuccess:v,children:(A,b,i,V,$)=>o==="blog"&&Oe("createPublic",n)&&e.jsx(_e,{appCode:o,isUpdating:b,resource:A,watch:i,setValue:V,register:$})}),g&&O&&e.jsx(ve,{isOpen:g,resourceId:O.assetId,shareResource:k,onCancel:w,onSuccess:T,children:o==="blog"?e.jsx(ye,{resource:O,updateResource:P}):null})]})]})}export{Le as default};
1
+ import{e as Y,f as re,b as ce,h as ae,i as G,j as ie,k as le,l as ue,m as de,d as he,u as J,a as fe,n as pe,o as Re,p as Se,q as Ee,_ as A}from"./index.js";import{h as me,j as s,B as K,a as Oe,z as _e,C as ve,E as Ie,L as be,n as ye,t as Ae,H as Ce,J as xe}from"./edifice-react.js";import{r as S,u as Q}from"./react.js";import{odeServices as F,ACTION as d}from"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function ge({roles:c,rights:n,action:r}){const[h,t]=S.useState(!1),{user:m}=me(),f=Y();S.useEffect(()=>{E()},[c,n]);const R=async function(l){const a=l instanceof Array?l:[l];if(c instanceof Array){const p=await F.rights().sessionHasAtLeastOneResourceRight(c,a);t(p)}else{const p=await F.rights().sessionHasResourceRight(c,a);t(p)}},i=async function(l){if(c instanceof Array){const a=await F.rights().sessionHasAtLeastOneResourceRightForEachList(c,l);t(a)}else{const a=await F.rights().sessionHasResourceRightForEachList(c,l);t(a)}},E=async function(){var l,a,p;if(c===void 0){t(!0);return}if(f&&((a=(l=n[0])==null?void 0:l.trashedBy)!=null&&a.includes(m==null?void 0:m.userId))&&r==="restore"&&!((p=n[0])!=null&&p.trashed)){t(!0);return}if(n instanceof Array)if(n.length>0)if(typeof n[0]=="string")await R(n);else{const O=n.map(_=>_.rights);await i(O)}else t(!1);else typeof n=="string"?await R(n):await R(n.rights)};return{visible:h,refreshState:E}}function X(){const[c,n]=S.useState(!1),[r,h]=S.useState("void"),[t,m]=S.useState(),f=re(e=>e.config),R=ce(),i=ae(),E=G(),l=ie(),a=le(),p=Y(),O=ue(),_=de(),v=he(),{openResource:j,printSelectedResource:w,openFolder:T,clearSelectedItems:L,clearSelectedIds:B}=J(),{data:D}=fe();S.useEffect(()=>{if(i.length===0&&a.length===0){n(!1);return}if(_){n(!1);return}n(!0)},[i,a]);async function H(e){var P;switch((P=document.getElementById("root"))==null||P.setAttribute("aria-hidden","true"),m(e),e.id){case d.OPEN:return i.length>0?j(E[0]):T({folder:l[0],folderId:l[0].id});case d.MOVE:return h("move");case d.PRINT:return w();case d.DELETE:return h("delete");case d.RESTORE:return await C();case d.PUBLISH:return h("publish");case d.UPD_PROPS:case"edit":return te();case"export":return oe();case d.SHARE:return h("share");default:throw Error(`Unknown action: ${e.id}`)}}function N(e){const P=i.length+a.length,y=i.length===1||a.length===1,q=P===1,M=a.length===0;switch(e.id){case d.OPEN:return q;case d.MANAGE:return y;case d.PUBLISH:return y&&M;case d.UPD_PROPS:return y&&M;case d.SHARE:return M&&y;case d.PRINT:return y&&M;case"edit":return q;default:return!0}}const k=()=>!0;async function C(){try{if(p)await O.mutate();else throw new Error("Cannot restore untrashed resources");x()}catch(e){console.error(e)}}function x(){var e;h("void"),t!=null&&t.id&&((e=document.getElementById(t==null?void 0:t.id))==null||e.focus())}const o=e=>()=>{r===e&&(x(),L(),B())},U=o("move"),g=o("move"),z=o("delete"),I=o("delete"),b=o("publish"),u=o("publish"),V=o("edit_folder"),$=o("edit_folder"),Z=o("edit_resource"),W=o("edit_resource"),ee=o("share"),se=o("share");function te(){if(i&&i.length>0){const e=E[0].assetId;(f==null?void 0:f.app)=="scrapbook"?pe({searchParams:v,assetId:e}):h("edit_resource")}else h("edit_folder")}function oe(){if(i&&i.length>0){const e=E[0].assetId;Re({searchParams:v,assetId:e})}}function ne(e){return e.id==="edit"&&a.length>0?"explorer.rename":`explorer.actions.${e.id}`}return{onRestore:C,actions:p?f==null?void 0:f.trashActions:D,selectedElement:[...E,...l],currentFolderId:R==null?void 0:R.id,overrideLabel:ne,handleClick:H,isActivable:p?k:N,isActionBarOpen:c,isMoveModalOpen:r==="move",onMoveCancel:U,onMoveSuccess:g,isDeleteModalOpen:r==="delete",onDeleteCancel:I,onDeleteSuccess:z,isPublishModalOpen:r==="publish",onPublishCancel:u,onPublishSuccess:b,isEditFolderOpen:r==="edit_folder",onEditFolderCancel:$,onEditFolderSuccess:V,isEditResourceOpen:r==="edit_resource",onEditResourceCancel:W,onEditResourceSuccess:Z,isShareResourceOpen:r==="share",onShareResourceCancel:se,onShareResourceSuccess:ee,onClearActionBar:x}}function Pe({resourceRights:c,roleExpected:n,action:r,children:h,renderWhenForbidden:t}){const{t:m}=Q(),{overrideLabel:f}=X(),{visible:R}=ge({roles:n,rights:c,action:r==null?void 0:r.id}),{setResourceActionDisable:i}=J(),E=Y();return R?s.jsx(s.Fragment,{children:h}):t?t():E&&!R?s.jsx(K,{type:"button",color:"primary",variant:"filled",onClick:()=>{i(!0)},children:m(f(r))}):s.jsx(s.Fragment,{})}const Me=S.lazy(async()=>await A(()=>import("./PublishModal.js"),__vite__mapDeps([0,1,2,3]))),Fe=S.lazy(async()=>await A(()=>import("./ResourceModal.js"),__vite__mapDeps([4,1,2,3]))),je=S.lazy(async()=>await A(()=>import("./DeleteModal.js"),__vite__mapDeps([5,1,2,3,6]))),we=S.lazy(async()=>await A(()=>import("./MoveModal.js"),__vite__mapDeps([7,1,2,3,6]))),Te=S.lazy(async()=>await A(()=>import("./FolderModal.js"),__vite__mapDeps([8,1,2,3,6])));function ke(){const{appCode:c}=Oe(),{t:n}=Q(),{actions:r,selectedElement:h,isMoveModalOpen:t,isDeleteModalOpen:m,isPublishModalOpen:f,isActionBarOpen:R,isEditFolderOpen:i,overrideLabel:E,onEditFolderCancel:l,onEditFolderSuccess:a,isEditResourceOpen:p,onEditResourceCancel:O,onEditResourceSuccess:_,isShareResourceOpen:v,onShareResourceCancel:j,onShareResourceSuccess:w,onMoveCancel:T,onMoveSuccess:L,onDeleteCancel:B,onDeleteSuccess:D,onPublishCancel:H,onPublishSuccess:N,isActivable:k,handleClick:C}=X(),o=G()[0],U=Se(c),g=Ee(c),z=_e(R,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return s.jsxs(s.Fragment,{children:[z((I,b)=>b&&s.jsx(ve.div,{className:"position-fixed bottom-0 start-0 end-0 z-3",style:I,children:s.jsx(Ie,{children:r==null?void 0:r.filter(u=>u.available&&u.target==="actionbar").map(u=>k(u)&&s.jsx(Pe,{resourceRights:h,roleExpected:u.right,action:u,children:s.jsx(K,{id:u.id,type:"button",color:"primary",variant:"filled",onClick:()=>{C(u)},children:n(E(u))},u.id)},u.id))})})),s.jsxs(S.Suspense,{fallback:s.jsx(be,{}),children:[t&&s.jsx(we,{isOpen:t,onCancel:T,onSuccess:L}),m&&s.jsx(je,{isOpen:m,onCancel:B,onSuccess:D}),f&&o&&s.jsx(Me,{isOpen:f,resourceId:o.assetId,onCancel:H,onSuccess:N}),i&&s.jsx(Te,{edit:!0,isOpen:i,onCancel:l,onSuccess:a}),p&&o&&s.jsx(Fe,{mode:"update",isOpen:p,resourceId:o.assetId,updateResource:g,onCancel:O,onSuccess:_,children:(I,b,u,V,$)=>c==="blog"&&ye("createPublic",r)&&s.jsx(Ae,{appCode:c,isUpdating:b,resource:I,watch:u,setValue:V,register:$})}),v&&o&&s.jsx(Ce,{isOpen:v,resourceId:o.assetId,shareResource:U,onCancel:j,onSuccess:w,children:c==="blog"?s.jsx(xe,{resource:o,updateResource:g}):null})]})]})}export{ke as default};
2
2
  function __vite__mapDeps(indexes) {
3
3
  if (!__vite__mapDeps.viteFileDeps) {
4
4
  __vite__mapDeps.viteFileDeps = ["PublishModal.js","edifice-react.js","react.js","edifice-icons.js","ResourceModal.js","DeleteModal.js","index.js","MoveModal.js","FolderModal.js"]
package/dist/AppAction.js CHANGED
@@ -1,4 +1,4 @@
1
- import{u as j,a as _,b,c as A,_ as S}from"./index.js";import{l as R,a as h,j as e,B as v,L as O,n as P,t as y}from"./edifice-react.js";import{u as E,r as c}from"./react.js";import{t as I}from"./edifice-icons.js";import"/assets/js/edifice-ts-client/index.js";const $=c.lazy(async()=>await S(()=>import("./ResourceModal.js"),__vite__mapDeps([0,1,2,3])));function w(){const[r,t]=R(),{appCode:a}=h(),{t:n}=E(a),{clearSelectedItems:l,clearSelectedIds:i}=j(),{data:s}=_(),u=s==null?void 0:s.find(o=>o.id==="create"),d=b(),p=A(),m=()=>{l(),i(),t()};return u?e.jsxs(e.Fragment,{children:[e.jsx(v,{type:"button",color:"primary",variant:"filled",leftIcon:e.jsx(I,{}),className:"ms-auto",onClick:m,children:n("explorer.create.title")}),e.jsx(c.Suspense,{fallback:e.jsx(O,{}),children:r&&e.jsx($,{mode:"create",currentFolder:d,createResource:p,isOpen:r,onSuccess:t,onCancel:t,children:(o,x,f,C,g)=>a==="blog"&&P("createPublic",s)&&e.jsx(y,{appCode:a,isUpdating:x,resource:o,watch:f,setValue:C,register:g})})})]}):null}export{w as default};
1
+ import{u as b,a as S,b as _,c as h,d as A,_ as P,g as R}from"./index.js";import{l as v,a as I,j as e,B as O,L as y,n as E,t as T}from"./edifice-react.js";import{u as $,r as n}from"./react.js";import{t as k}from"./edifice-icons.js";import"/assets/js/edifice-ts-client/index.js";const B=n.lazy(async()=>await P(()=>import("./ResourceModal.js"),__vite__mapDeps([0,1,2,3])));function M(){const[o,t]=v(),{appCode:s}=I(),{t:l}=$(s),{clearSelectedItems:i,clearSelectedIds:u}=b(),{data:a}=S(),d=a==null?void 0:a.find(r=>r.id==="create"),c=_(),p=h(),m=A(),f=()=>{if(s=="scrapbook"){R({searchParams:m,folderId:c.id});return}i(),u(),t()};return d?e.jsxs(e.Fragment,{children:[e.jsx(O,{type:"button",color:"primary",variant:"filled",leftIcon:e.jsx(k,{}),className:"ms-auto",onClick:f,children:l("explorer.create.title")}),e.jsx(n.Suspense,{fallback:e.jsx(y,{}),children:o&&e.jsx(B,{mode:"create",currentFolder:c,createResource:p,isOpen:o,onSuccess:t,onCancel:t,children:(r,x,g,C,j)=>s==="blog"&&E("createPublic",a)&&e.jsx(T,{appCode:s,isUpdating:x,resource:r,watch:g,setValue:C,register:j})})})]}):null}export{M as default};
2
2
  function __vite__mapDeps(indexes) {
3
3
  if (!__vite__mapDeps.viteFileDeps) {
4
4
  __vite__mapDeps.viteFileDeps = ["ResourceModal.js","edifice-react.js","react.js","edifice-icons.js"]
@@ -1 +1 @@
1
- import{j as t,M as a,B as n}from"./edifice-react.js";import{u as d,a as c}from"./react.js";import{q as p,r as x,d as h}from"./index.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function m({onSuccess:r}){const s=p(),o=x(),e=h();async function l(){try{e?await s.mutate():await o.mutate(),r==null||r()}catch(i){console.error(i)}}return{isTrashFolder:e,onDelete:l}}function D({isOpen:r,onSuccess:s=()=>({}),onCancel:o=()=>({})}){const{t:e}=d(),{isTrashFolder:l,onDelete:i}=m({onSuccess:s});return c.createPortal(t.jsxs(a,{isOpen:r,onModalClose:o,id:"deleteModal",children:[t.jsx(a.Header,{onModalClose:o,children:e(l?"explorer.delete.title":"explorer.trash.title")}),t.jsx(a.Body,{children:t.jsx("p",{className:"body",children:e(l?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),t.jsxs(a.Footer,{children:[t.jsx(n,{color:"tertiary",onClick:o,type:"button",variant:"ghost",children:e("explorer.cancel")}),t.jsx(n,{color:"danger",onClick:i,type:"button",variant:"filled",children:e(l?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{D as default};
1
+ import{j as t,M as a,B as n}from"./edifice-react.js";import{u as d,a as c}from"./react.js";import{t as p,v as x,e as h}from"./index.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function m({onSuccess:r}){const s=p(),o=x(),e=h();async function l(){try{e?await s.mutate():await o.mutate(),r==null||r()}catch(i){console.error(i)}}return{isTrashFolder:e,onDelete:l}}function D({isOpen:r,onSuccess:s=()=>({}),onCancel:o=()=>({})}){const{t:e}=d(),{isTrashFolder:l,onDelete:i}=m({onSuccess:s});return c.createPortal(t.jsxs(a,{isOpen:r,onModalClose:o,id:"deleteModal",children:[t.jsx(a.Header,{onModalClose:o,children:e(l?"explorer.delete.title":"explorer.trash.title")}),t.jsx(a.Body,{children:t.jsx("p",{className:"body",children:e(l?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),t.jsxs(a.Footer,{children:[t.jsx(n,{color:"tertiary",onClick:o,type:"button",variant:"ghost",children:e("explorer.cancel")}),t.jsx(n,{color:"danger",onClick:i,type:"button",variant:"filled",children:e(l?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}export{D as default};
@@ -1 +1 @@
1
- import{a as i,v as a,j as c,N as m,y as u}from"./edifice-react.js";import{a as x}from"./index.js";import{u as d}from"./react.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function g(){const{appCode:r}=i(),{theme:t}=a(),[l]=u(),{t:s}=d(),{data:n}=x(),e=n==null?void 0:n.find(p=>p.id==="create"),o=()=>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 c.jsx(m,{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:o()})}export{g as default};
1
+ import{a,v as u,j as c,N as d,y as x}from"./edifice-react.js";import{a as m}from"./index.js";import{u as y}from"./react.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function E(){const{appCode:r}=a(),{theme:e}=u(),[n]=x(),{t:s}=y(),{data:l}=m(),t=l==null?void 0:l.find(o=>o.id==="create"),i=()=>t!=null&&t.available&&(e!=null&&e.is1d)?s("explorer.emptyScreen.txt1d.create",{ns:r}):t!=null&&t.available&&!(e!=null&&e.is1d)?s("explorer.emptyScreen.txt2d.create",{ns:r}):!(t!=null&&t.available)&&(e!=null&&e.is1d)?s("explorer.emptyScreen.txt1d.consultation",{ns:r}):s("explorer.emptyScreen.txt2d.consultation",{ns:r}),p=()=>t!=null&&t.available&&(e!=null&&e.is1d)?s("explorer.emptyScreen.title1d.create",{ns:r}):t!=null&&t.available&&!(e!=null&&e.is1d)?s("explorer.emptyScreen.title2d.create",{ns:r}):!(t!=null&&t.available)&&(e!=null&&e.is1d)?s("explorer.emptyScreen.title1d.consultation",{ns:r}):s("explorer.emptyScreen.title2d.consultation",{ns:r});return c.jsx(d,{imageSrc:`${n}/emptyscreen/illu-${r}.svg`,imageAlt:s("explorer.emptyScreen.app.alt",{ns:r}),title:p(),text:i()})}export{E as default};
@@ -1 +1 @@
1
- import{j as r,M as i,F as D,$ as B,k as q,B as y}from"./edifice-react.js";import{e as L,r as C,u as R,a as k}from"./react.js";import{FOLDER as w}from"/assets/js/edifice-ts-client/index.js";import{h as T,b as U,o as V,p as _}from"./index.js";import"./edifice-icons.js";function z({edit:o,onSuccess:e,onClose:m}){var F;const l=T(),t=U(),c=V(),u=_(),f=o?(F=l[0])==null?void 0:F.name:void 0,{reset:a,register:p,handleSubmit:n,setFocus:x,formState:{errors:h,isSubmitting:s,isDirty:I,isValid:g}}=L({mode:"onChange",values:{name:f||""}}),E=C.useId(),M=async function({name:b}){var j;try{if(o){const d=(j=l[0])==null?void 0:j.parentId,v=l[0].id;await u.mutate({folderId:v,parentId:d,name:b}),a(),e==null||e()}else{const d=(t==null?void 0:t.id)||w.DEFAULT;await c.mutate({name:b,parentId:d}),a(),e==null||e()}}catch(d){console.error(d)}};function $(){a(),m()}return{formId:`createModal_${E}`,errors:h,isSubmitting:s,isDirty:I,isValid:g,register:p,setFocus:x,handleSubmit:n,onCancel:$,onSubmit:M}}function Q({isOpen:o,edit:e,onSuccess:m,onCancel:l}){const{t}=R(),{isDirty:c,isValid:u,isSubmitting:f,formId:a,onSubmit:p,onCancel:n,handleSubmit:x,register:h,setFocus:s}=z({edit:e,onSuccess:m,onClose:l});return C.useEffect(()=>{o&&s("name")},[o,s]),o?k.createPortal(r.jsxs(i,{isOpen:o,onModalClose:n,id:"modal_"+a,children:[r.jsx(i.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(i.Body,{children:r.jsx("form",{id:a,onSubmit:x(p),children:r.jsxs(D,{id:"nameFolder",isRequired:!0,children:[r.jsx(B,{children:t("explorer.create.folder.name")}),r.jsx(q,{type:"text",...h("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(i.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:a,type:"submit",color:"primary",variant:"filled",disabled:!c||!u||f,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}export{Q as default};
1
+ import{j as r,M as i,F as D,$ as B,k as q,B as y}from"./edifice-react.js";import{e as L,r as C,u as R,a as k}from"./react.js";import{FOLDER as w}from"/assets/js/edifice-ts-client/index.js";import{j as T,b as U,r as V,s as _}from"./index.js";import"./edifice-icons.js";function z({edit:o,onSuccess:e,onClose:m}){var F;const l=T(),t=U(),c=V(),u=_(),f=o?(F=l[0])==null?void 0:F.name:void 0,{reset:a,register:p,handleSubmit:n,setFocus:x,formState:{errors:h,isSubmitting:s,isDirty:I,isValid:g}}=L({mode:"onChange",values:{name:f||""}}),E=C.useId(),M=async function({name:j}){var b;try{if(o){const d=(b=l[0])==null?void 0:b.parentId,v=l[0].id;await u.mutate({folderId:v,parentId:d,name:j}),a(),e==null||e()}else{const d=(t==null?void 0:t.id)||w.DEFAULT;await c.mutate({name:j,parentId:d}),a(),e==null||e()}}catch(d){console.error(d)}};function $(){a(),m()}return{formId:`createModal_${E}`,errors:h,isSubmitting:s,isDirty:I,isValid:g,register:p,setFocus:x,handleSubmit:n,onCancel:$,onSubmit:M}}function Q({isOpen:o,edit:e,onSuccess:m,onCancel:l}){const{t}=R(),{isDirty:c,isValid:u,isSubmitting:f,formId:a,onSubmit:p,onCancel:n,handleSubmit:x,register:h,setFocus:s}=z({edit:e,onSuccess:m,onClose:l});return C.useEffect(()=>{o&&s("name")},[o,s]),o?k.createPortal(r.jsxs(i,{isOpen:o,onModalClose:n,id:"modal_"+a,children:[r.jsx(i.Header,{onModalClose:n,children:t(e?"explorer.rename.folder":"explorer.create.folder")}),r.jsx(i.Body,{children:r.jsx("form",{id:a,onSubmit:x(p),children:r.jsxs(D,{id:"nameFolder",isRequired:!0,children:[r.jsx(B,{children:t("explorer.create.folder.name")}),r.jsx(q,{type:"text",...h("name",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:t("explorer.create.folder.name"),size:"md","aria-required":!0})]})})}),r.jsxs(i.Footer,{children:[r.jsx(y,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:t("explorer.cancel")}),r.jsx(y,{form:a,type:"submit",color:"primary",variant:"filled",disabled:!c||!u||f,children:t(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}export{Q as default};
@@ -1 +1 @@
1
- import{j as i,P as p,a as S,R as f,u as y,C as m}from"./edifice-react.js";import{v as C}from"./edifice-icons.js";import{h as T,i as I,u as N}from"./index.js";import"./react.js";import"/assets/js/edifice-ts-client/index.js";const g=({app:e,name:c,isSelected:r=!1,isSelectable:l=!0,onClick:t,onSelect:n})=>i.jsx(p,{app:e,isSelectable:l,isSelected:r,onClick:t,onSelect:n,children:d=>i.jsxs(p.Body,{children:[i.jsx(C,{width:"48",height:"48",className:`color-app-${d}`}),i.jsx(p.Title,{children:c})]})});g.displayName="FolderCard";const k=({data:e})=>{var u,a;const{currentApp:c}=S(),r=T(),l=I(),{setSelectedFolders:t,setFolderIds:n,openFolder:d}=N();function h(s){l.includes(s.id)?(n(l.filter(o=>o!==s.id)),t(r.filter(o=>o.id!==s.id))):(n([...l,s.id]),t([...r,s]))}const x=f({from:{opacity:0},to:{opacity:1}}),F=y();return(u=e==null?void 0:e.pages[0])!=null&&u.folders.length?i.jsx(m.ul,{className:"grid ps-0 list-unstyled mb-24",children:(a=e==null?void 0:e.pages[0])==null?void 0:a.folders.map(s=>{const{id:o,name:j}=s;return i.jsx(m.li,{className:"g-col-4 z-1",style:{position:"relative",...x},children:i.jsx(g,{name:j,app:c,isSelected:l.includes(s.id),onClick:()=>{F(),d({folder:s,folderId:s.id})},onSelect:()=>h(s)})},o)})}):null};export{k as default};
1
+ import{j as l,P as p,a as S,R as f,u as y,C as m}from"./edifice-react.js";import{v as C}from"./edifice-icons.js";import{j as T,k as I,u as N}from"./index.js";import"./react.js";import"/assets/js/edifice-ts-client/index.js";const g=({app:e,name:c,isSelected:r=!1,isSelectable:o=!0,onClick:t,onSelect:n})=>l.jsx(p,{app:e,isSelectable:o,isSelected:r,onClick:t,onSelect:n,children:d=>l.jsxs(p.Body,{children:[l.jsx(C,{width:"48",height:"48",className:`color-app-${d}`}),l.jsx(p.Title,{children:c})]})});g.displayName="FolderCard";const b=({data:e})=>{var u,a;const{currentApp:c}=S(),r=T(),o=I(),{setSelectedFolders:t,setFolderIds:n,openFolder:d}=N();function j(s){o.includes(s.id)?(n(o.filter(i=>i!==s.id)),t(r.filter(i=>i.id!==s.id))):(n([...o,s.id]),t([...r,s]))}const x=f({from:{opacity:0},to:{opacity:1}}),F=y();return(u=e==null?void 0:e.pages[0])!=null&&u.folders.length?l.jsx(m.ul,{className:"grid ps-0 list-unstyled mb-24",children:(a=e==null?void 0:e.pages[0])==null?void 0:a.folders.map(s=>{const{id:i,name:h}=s;return l.jsx(m.li,{className:"g-col-4 z-1",style:{position:"relative",...x},children:l.jsx(g,{name:h,app:c,isSelected:o.includes(s.id),onClick:()=>{F(),d({folder:s,folderId:s.id})},onSelect:()=>j(s)})},i)})}):null};export{b as default};
package/dist/MoveModal.js CHANGED
@@ -1 +1 @@
1
- import{d as I,j as o,M as n,T as v,B as h}from"./edifice-react.js";import{r as T,u as M,a as y}from"./react.js";import{s as j,h as b,g as F,u as S,t as w}from"./index.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function E({onSuccess:a}){const[s,r]=T.useState(),l=j(),d=b(),i=F(),{foldTreeItem:c,unfoldTreeItem:m}=S(),u=I();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 x=e=>{var p;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])||((p=t==null?void 0:t.folderIds)==null?void 0:p.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{x(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function $({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=M(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=w();return y.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(v,{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{$ as default};
1
+ import{d as I,j as o,M as n,T as v,B as x}from"./edifice-react.js";import{r as T,u as M,a as y}from"./react.js";import{w as j,j as b,i as F,u as w,x as S}from"./index.js";import"/assets/js/edifice-ts-client/index.js";import"./edifice-icons.js";function E({onSuccess:a}){const[s,r]=T.useState(),l=j(),d=b(),i=F(),{foldTreeItem:c,unfoldTreeItem:m}=w(),u=I();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 h=e=>{var p;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])||((p=t==null?void 0:t.folderIds)==null?void 0:p.length)===0&&e==="default")return!1;return!0};return{disableSubmit:!s,handleTreeItemSelect:e=>{h(e)?r(e):r(void 0)},handleTreeItemFold:c,handleTreeItemUnfold:async e=>await m(e,u),onMove:()=>{f()}}}function $({isOpen:a,onSuccess:s,onCancel:r}){const{t:l}=M(),{handleTreeItemFold:d,handleTreeItemSelect:i,handleTreeItemUnfold:c,onMove:m,disableSubmit:u}=E({onSuccess:s}),f=S();return y.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(v,{data:f,onTreeItemSelect:i,onTreeItemFold:d,onTreeItemUnfold:c})}),o.jsxs(n.Footer,{children:[o.jsx(x,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),o.jsx(x,{color:"primary",onClick:m,type:"button",variant:"filled",disabled:u,children:l("explorer.move")})]})]}),document.getElementById("portal"))}export{$ as default};
@@ -1 +1 @@
1
- import{j as s,P as l,x as z,U as B,V as M,W as O,X as I,Y as y,Z as E,a as L,R as U,_ as G,C as N,B as V}from"./edifice-react.js";import{u as $,r as W,b}from"./react.js";import{w as X,x as Y}from"./edifice-icons.js";import{n as Z,f as _,g as q,u as D,d as H}from"./index.js";import"/assets/js/edifice-ts-client/index.js";const T=({app:i,resource:t,time:p,isSelected:g=!1,isSelectable:j=!0,onClick:c,onSelect:e})=>{const d=`/userbook/avatar/${t==null?void 0:t.creatorId}`;function o(n){const{rights:u,creatorId:v}=n||{};return u.filter(R=>!R.includes(v)).length>=1}const x=o(t),f=t==null?void 0:t.public,{t:h}=$();return s.jsx(l,{app:i,isSelected:g,isSelectable:j,onClick:c,onSelect:e,children:n=>s.jsxs(s.Fragment,{children:[s.jsxs(l.Body,{children:[s.jsx("div",{className:"card-image medium",children:t!=null&&t.thumbnail?s.jsx(z,{alt:"",src:t==null?void 0:t.thumbnail,objectFit:"cover",className:"h-full w-100"}):s.jsx(B,{app:i,iconFit:"ratio",size:"80",variant:"rounded"})}),s.jsxs("div",{className:"text-truncate",children:[s.jsx(l.Title,{children:t==null?void 0:t.name}),s.jsx(l.Text,{children:s.jsx("em",{children:p})})]})]}),s.jsxs(l.Footer,{children:[s.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[d?s.jsx(M,{alt:(t==null?void 0:t.creatorName)||"",size:"xs",src:d,variant:"circle",width:"24",height:"24"}):s.jsx(O,{}),s.jsx(l.Text,{children:t==null?void 0:t.creatorName})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[x&&s.jsx(I,{message:h("tooltip.shared",{ns:n}),placement:"top",children:s.jsx(X,{width:16,height:16})}),f&&s.jsx(I,{message:h("tooltip.public",{ns:n}),placement:"top",children:s.jsx(Y,{width:16,height:16})})]})]})]})})};T.displayName="ResourceCard";y.extend(E);const as=({data:i,fetchNextPage:t})=>{const{currentApp:p,currentLanguage:g}=L(),{t:j}=$(),c=Z(),e=_(),d=q(),{setSelectedResources:o,setResourceIds:x,openResource:f,setResourceIsTrash:h}=D(),n=H(),u=U({from:{opacity:0},to:{opacity:1}}),S=c.pagination.startIdx+c.pagination.pageSize<(c.pagination.maxIdx||0),R=W.useCallback(()=>{t()},[]),C=a=>{n?(h(!0),x([a.id]),o([a])):f(a)};async function F(a){if(e.includes(a.id)){x(e.filter(m=>m!==a.id)),o(d.filter(m=>m.id!==a.id));return}x([...e,a.id]),o([...d,a])}const w=G("grid ps-0 list-unstyled");return s.jsxs(b.Fragment,{children:[s.jsx(N.ul,{className:w,children:i==null?void 0:i.pages.map((a,m)=>s.jsx(b.Fragment,{children:a.resources.map(r=>{const{id:P,updatedAt:k}=r,A=y(k).locale(g).fromNow();return s.jsx(N.li,{className:"g-col-4 z-1",style:{position:"relative",...u},children:s.jsx(T,{app:p,resource:r,time:A,isSelectable:!0,isSelected:e.includes(r.id),onClick:()=>C(r),onSelect:()=>F(r)})},P)})},m))}),S&&s.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:s.jsx(V,{type:"button",color:"secondary",variant:"filled",onClick:R,children:j("explorer.see.more")})})]})};export{as as default};
1
+ import{j as s,P as l,x as z,U as B,V as M,W as O,X as I,Y as y,Z as E,a as L,R as U,_ as G,C as N,B as V}from"./edifice-react.js";import{u as $,r as W,b}from"./react.js";import{w as X,x as Y}from"./edifice-icons.js";import{d as Z,h as _,i as q,u as D,e as H}from"./index.js";import"/assets/js/edifice-ts-client/index.js";const T=({app:i,resource:t,time:p,isSelected:g=!1,isSelectable:j=!0,onClick:c,onSelect:e})=>{const d=`/userbook/avatar/${t==null?void 0:t.creatorId}`;function o(n){const{rights:u,creatorId:v}=n||{};return u.filter(R=>!R.includes(v)).length>=1}const x=o(t),f=t==null?void 0:t.public,{t:h}=$();return s.jsx(l,{app:i,isSelected:g,isSelectable:j,onClick:c,onSelect:e,children:n=>s.jsxs(s.Fragment,{children:[s.jsxs(l.Body,{children:[s.jsx("div",{className:"card-image medium",children:t!=null&&t.thumbnail?s.jsx(z,{alt:"",src:t==null?void 0:t.thumbnail,objectFit:"cover",className:"h-full w-100"}):s.jsx(B,{app:i,iconFit:"ratio",size:"80",variant:"rounded"})}),s.jsxs("div",{className:"text-truncate",children:[s.jsx(l.Title,{children:t==null?void 0:t.name}),s.jsx(l.Text,{children:s.jsx("em",{children:p})})]})]}),s.jsxs(l.Footer,{children:[s.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[d?s.jsx(M,{alt:(t==null?void 0:t.creatorName)||"",size:"xs",src:d,variant:"circle",width:"24",height:"24"}):s.jsx(O,{}),s.jsx(l.Text,{children:t==null?void 0:t.creatorName})]}),s.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[x&&s.jsx(I,{message:h("tooltip.shared",{ns:n}),placement:"top",children:s.jsx(X,{width:16,height:16})}),f&&s.jsx(I,{message:h("tooltip.public",{ns:n}),placement:"top",children:s.jsx(Y,{width:16,height:16})})]})]})]})})};T.displayName="ResourceCard";y.extend(E);const as=({data:i,fetchNextPage:t})=>{const{currentApp:p,currentLanguage:g}=L(),{t:j}=$(),c=Z(),e=_(),d=q(),{setSelectedResources:o,setResourceIds:x,openResource:f,setResourceIsTrash:h}=D(),n=H(),u=U({from:{opacity:0},to:{opacity:1}}),S=c.pagination.startIdx+c.pagination.pageSize<(c.pagination.maxIdx||0),R=W.useCallback(()=>{t()},[]),C=a=>{n?(h(!0),x([a.id]),o([a])):f(a)};async function F(a){if(e.includes(a.id)){x(e.filter(m=>m!==a.id)),o(d.filter(m=>m.id!==a.id));return}x([...e,a.id]),o([...d,a])}const w=G("grid ps-0 list-unstyled");return s.jsxs(b.Fragment,{children:[s.jsx(N.ul,{className:w,children:i==null?void 0:i.pages.map((a,m)=>s.jsx(b.Fragment,{children:a.resources.map(r=>{const{id:P,updatedAt:k}=r,A=y(k).locale(g).fromNow();return s.jsx(N.li,{className:"g-col-4 z-1",style:{position:"relative",...u},children:s.jsx(T,{app:p,resource:r,time:A,isSelectable:!0,isSelected:e.includes(r.id),onClick:()=>C(r),onSelect:()=>F(r)})},P)})},m))}),S&&s.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:s.jsx(V,{type:"button",color:"secondary",variant:"filled",onClick:R,children:j("explorer.see.more")})})]})};export{as as default};