ode-explorer 1.0.0-dev.202306211553 → 1.0.0-dev.202306221044
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/version.txt +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as J,k as K,i as z,r as c,m as Q,j as e,p as D,u as Y,a as Z,M as y,H as _,F as d,U as E,y as P,W as ee,B,X as se}from"./index.js";import{I as le}from"./ImagePicker.js";import{u as te}from"./index.esm.js";function re({resource:p,onSuccess:a,onCancel:v}){const{i18n:r}=J(),s=K(),u=z(),{reset:
|
|
1
|
+
import{f as J,k as K,i as z,r as c,m as Q,j as e,p as D,u as Y,a as Z,M as y,H as _,F as d,U as E,y as P,W as ee,B,X as se}from"./index.js";import{I as le}from"./ImagePicker.js";import{u as te}from"./index.esm.js";function re({resource:p,onSuccess:a,onCancel:v}){const{i18n:r}=J(),s=K(),u=z(),{reset:w,register:F,handleSubmit:t,setFocus:C,formState:{errors:m,isSubmitting:I,isValid:$}}=te({mode:"onChange"}),i=c.useId(),[M,x]=c.useState(new Date().getTime()),[n,k]=c.useState(!p.public),[g,h]=c.useState(p.slug||""),[N,b]=c.useState(!1),{hotToast:f}=Q(D),[R,j]=c.useState({name:"",image:u[0].thumbnail}),T=l=>{j(l)},o=()=>{j({name:"",image:""})};function L(l){k(!l),l||(h(""),x(new Date().getTime()))}function U(l){if(!l)return"";const S="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",O="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",W=new RegExp(S.split("").join("|"),"g"),X=l.toString().toLowerCase().replace(/\s+/g,"-").replace(W,G=>O.charAt(S.indexOf(G))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");h(X)}const V=async function(l){try{await s.mutateAsync({description:l.description,entId:u[0].assetId,name:l.title,public:l.enablePublic,slug:l.safeSlug,trashed:u[0].trashed,thumbnail:R.image}),b(!1),f.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:["Description: ",l.description]}),e.jsxs("p",{children:["Public:"," ",l.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(S){b(!0),console.error(S)}};function q(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${g}`),f.success(r("explorer.copy.clipboard"))}function A(){w(),v()}const H=`resource_edit_modal_${i}`;return{slug:g,disableSlug:n,formId:H,errors:m,isSubmitting:I,isValid:$,versionSlug:M,correctSlug:N,onPublicChange:L,onSlugChange:U,register:F,setFocus:C,handleSubmit:t,onFormCancel:A,onSubmit:V,handleUploadImage:T,handleDeleteImage:o,onCopyToClipBoard:q}}function ne({isOpen:p,edit:a,onSuccess:v,onCancel:r}){const{i18n:s,appCode:u,currentApp:w}=Y(),t=z()[0],{slug:C,formId:m,isValid:I,isSubmitting:$,disableSlug:i,versionSlug:M,correctSlug:x,register:n,handleSubmit:k,onSubmit:g,handleUploadImage:h,handleDeleteImage:N,onCopyToClipBoard:b,onSlugChange:f,onPublicChange:R}=re({resource:t,onSuccess:v,onCancel:r}),j=`${new Date().getTime()}_${i}`,T=`${M}_slug`;return Z.createPortal(e.jsxs(y,{id:"resource_edit_modal",size:"lg",isOpen:p,onModalClose:r,children:[e.jsx(y.Header,{onModalClose:r,children:s(a?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),e.jsxs(y.Body,{children:[e.jsx(_,{headingStyle:"h4",level:"h3",className:"mb-16",children:s("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:m,onSubmit:k(g),children:[e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 mb-24",children:[e.jsx(le,{app:w,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:h,onDeleteImage:N,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(d,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(E,{children:s("title")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.name:"",...n("title",{required:!0}),placeholder:s("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(d,{id:"description",isOptional:!0,children:[e.jsx(E,{children:s("description")}),e.jsx(P,{type:"text",defaultValue:a?t==null?void 0:t.description:"",...n("description"),placeholder:s("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),e.jsxs(_,{headingStyle:"h4",level:"h3",className:"mb-16",children:[s("explorer.resource.editModal.heading.access"),u]}),e.jsx(D,{type:"info",children:s("explorer.resource.editModal.access.alert")}),e.jsxs(d,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(d.Input,{type:"checkbox",role:"switch",...n("enablePublic",{value:t.public,onChange:o=>R(o.target.checked)}),className:"form-check-input mt-0",size:"md"},j),e.jsx(d.Label,{className:"form-check-label mb-0",children:s("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(d,{id:"slug",status:x?"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,"/"]}),e.jsxs("div",{className:"flex-fill",children:[e.jsx(P,{type:"text",...n("safeSlug",{validate:{required:o=>!o&&!i?s("explorer.slug.name.mandatory"):!0},disabled:i,value:C,onChange:o=>f(o.target.value)}),size:"md",placeholder:s("explorer.resource.editModal.access.url.extension")},T),x&&e.jsx("div",{className:"position-absolute",children:e.jsx(ee,{children:s("explorer.slug.name.error")})})]}),e.jsx(B,{color:"primary",disabled:i,onClick:()=>{b(t.slug)},type:"button",leftIcon:e.jsx(se,{}),variant:"ghost",className:"text-nowrap",children:s("explorer.resource.editModal.access.url.button")})]})})]})]}),e.jsxs(y.Footer,{children:[e.jsx(B,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:s("explorer.cancel")}),e.jsx(B,{form:m,type:"submit",color:"primary",variant:"filled",disabled:!I||$,children:s(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ne 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 22/06/2023 10:44:29
|
package/package.json
CHANGED