ode-explorer 1.0.0-dev.202307041543 → 1.0.0-dev.202307050756
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/EditResourceModal.js +1 -1
- package/dist/FoldersList.js +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,j as e,H as A,p as E,F as x,y as P,W as G,B as T,X as J,k as K,i as z,r as m,m as Q,u as ee,Y as
|
|
1
|
+
import{a as B,j as e,H as A,p as E,F as x,y as P,W as G,B as T,X as J,k as K,i as z,r as m,m as Q,u as ee,Y as te,b as se,M as C,U as F,Z as le}from"./index.js";import{I as ae}from"./ImagePicker.js";import{u as re}from"./index.esm.js";const oe=({appCode:d,correctSlug:a,disableSlug:n,onPublicChange:r,onSlugChange:u,refPublic:c,refSlug:f,register:t,resource:h,slug:p,onCopyToClipBoard:g})=>{const{t:o}=B();return e.jsxs(e.Fragment,{children:[e.jsxs(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),d]}),e.jsx(E,{type:"info",children:o("explorer.resource.editModal.access.alert")}),e.jsxs(x,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(x.Input,{type:"checkbox",role:"switch",...t("enablePublic",{value:h.public,onChange:i=>r(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(x.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(x,{id:"slug",status:a?"invalid":void 0,children:e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[e.jsxs("div",{children:[window.location.origin,window.location.pathname,"/pub/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...t("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:p,onChange:i=>u(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},f),a&&e.jsx("div",{className:"position-absolute",children:e.jsx(G,{children:o("explorer.slug.name.error")})})]}),e.jsx(T,{color:"primary",disabled:n,onClick:()=>{g()},type:"button",leftIcon:e.jsx(J,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})})]})};function ie({resource:d,onSuccess:a,onCancel:n}){const{t:r}=B(),u=K(),c=z(),{reset:f,register:t,handleSubmit:h,setFocus:p,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=m.useId(),[M,b]=m.useState(new Date().getTime()),[$,k]=m.useState(!d.public),[j,S]=m.useState(d.slug||""),[N,v]=m.useState(!1),{hotToast:y}=Q(E),[R,s]=m.useState({name:"",image:c[0].thumbnail}),_=l=>{s(l)},L=()=>{s({name:"",image:""})};function U(l){k(!l),l||(S(""),b(new Date().getTime()))}function V(l){if(!l)return"";const w="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",W="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",X=new RegExp(w.split("").join("|"),"g"),Y=l.toString().toLowerCase().replace(/\s+/g,"-").replace(X,Z=>W.charAt(w.indexOf(Z))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");S(Y)}const q=async function(l){try{await u.mutateAsync({description:l.description,entId:c[0].assetId,name:l.title,public:l.enablePublic,slug:l.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),v(!1),y.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",l.title]}),e.jsxs("p",{children:["Public:",l.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(w){v(!0),console.error(w)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${j}`),y.success(r("explorer.copy.clipboard"))}function H(){f(),n()}const O=`resource_edit_modal_${I}`;return{slug:j,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:t,setFocus:p,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function ue({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:u,currentApp:c}=ee(),t=z()[0],{slug:h,formId:p,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:j,handleDeleteImage:S,onCopyToClipBoard:N,onSlugChange:v,onPublicChange:y}=ie({resource:t,onSuccess:n,onCancel:r}),{data:R}=te(),{t:s}=B();return se.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:s(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(C.Body,{children:[e.jsx(A,{headingStyle:"h4",level:"h3",className:"mb-16",children:s("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:p,onSubmit:$(k),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(ae,{app:c,src:t==null?void 0:t.thumbnail,label:s("explorer.imagepicker.label"),addButtonLabel:s("explorer.imagepicker.button.add"),deleteButtonLabel:s("explorer.imagepicker.button.delete"),onUploadImage:j,onDeleteImage:S,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(x,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:s("title")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.name:"",...b("title",{required:!0,pattern:{value:/^\S/,message:"invalid title"}}),placeholder:s("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),u!=="blog"?e.jsxs(x,{id:"description",isOptional:!0,children:[e.jsx(F,{children:s("description")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.description:"",...b("description"),placeholder:s("explorer.resource.editModal.description.placeholder"),size:"md"})]}):null]})]}),le({workflow:"createPublic",actions:R})&&e.jsx(oe,{appCode:u,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:y,onSlugChange:v,resource:t,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:s("explorer.cancel")}),e.jsx(T,{form:p,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:s(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
|
package/dist/FoldersList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as x,a9 as
|
|
1
|
+
import{u as x,a9 as f,G as h,aa as j,c as y,ab as I,j as c,$ as a}from"./index.js";import{C}from"./Card.js";import"./Tooltip.js";import"./usePopper.js";const b=()=>{const t=document.querySelector("html");return()=>{t&&t.scrollIntoView()}},R=()=>{var d,p;const{currentApp:t}=x(),{data:e,isFetching:u}=f(),n=h(),l=j(),{setSelectedFolders:r,setFolderIds:i,openFolder:m}=y();function g(s){l.includes(s.id)?(i(l.filter(o=>o!==s.id)),r(n.filter(o=>o.id!==s.id))):(i([...l,s.id]),r([...n,s]))}const S=I({from:{opacity:0},to:{opacity:1}}),F=b();return(d=e==null?void 0:e.pages[0])!=null&&d.folders.length?c.jsx(a.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:T}=s;return c.jsx(a.li,{className:"g-col-4",style:{...S},children:c.jsx(C,{app:t,name:T,isFolder:!0,isLoading:u,isSelected:l.includes(s.id),onOpen:()=>{F(),m({folder:s,folderId:s.id})},onSelect:()=>g(s)})},o)})}):null};export{R as default};
|
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ode-explorer=1.0-feat-explorer-SNAPSHOT
|
|
1
|
+
ode-explorer=1.0-feat-explorer-SNAPSHOT 05/07/2023 07:57:33
|
package/package.json
CHANGED