ode-explorer 1.0.0-dev.202307070707 → 1.0.0-dev.202307070750

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 +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 se,b as te,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:j,register:s,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",...s("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",...s("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")},j),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:j,register:s,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),[f,v]=m.useState(d.slug||""),[N,S]=m.useState(!1),{hotToast:y}=Q(E),[R,l]=m.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(v(""),b(new Date().getTime()))}function V(t){if(!t)return"";const w="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",W="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",X=new RegExp(w.split("").join("|"),"g"),Y=t.toString().toLowerCase().replace(/\s+/g,"-").replace(X,Z=>W.charAt(w.indexOf(Z))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");v(Y)}const q=async function(t){try{await u.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),S(!1),y.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",t.title]}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{children:["Public:"," ",t.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(w){S(!0),console.error(w)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${f}`),y.success(r("explorer.copy.clipboard"))}function H(){j(),n()}const O=`resource_edit_modal_${I}`;return{slug:f,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,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(),s=z()[0],{slug:h,formId:p,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:f,handleDeleteImage:v,onCopyToClipBoard:N,onSlugChange:S,onPublicChange:y}=ie({resource:s,onSuccess:n,onCancel:r}),{data:R}=se(),{t:l}=B();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:l(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:l("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:s==null?void 0:s.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:f,onDeleteImage:v,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:l("title")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),u!=="blog"?e.jsxs(x,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("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:S,resource:s,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:p,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
1
+ import{a as B,j as e,H as A,p as E,F as m,y as P,W as G,B as T,X as J,k as K,i as z,r as p,m as Q,u as ee,Y as se,b as te,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:x,refPublic:c,refSlug:j,register:s,resource:h,slug:u,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(m,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[e.jsx(m.Input,{type:"checkbox",role:"switch",...s("enablePublic",{value:h.public,onChange:i=>r(i.target.checked)}),className:"form-check-input mt-0",size:"md"},c),e.jsx(m.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),e.jsx(m,{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",...s("safeSlug",{validate:{required:i=>!i&&!n?o("explorer.slug.name.mandatory"):!0},disabled:n,value:u,onChange:i=>x(i.target.value)}),size:"md",placeholder:o("explorer.resource.editModal.access.url.extension")},j),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(),x=K(),c=z(),{reset:j,register:s,handleSubmit:h,setFocus:u,formState:{errors:g,isSubmitting:o,isValid:i}}=re({mode:"onChange"}),I=p.useId(),[M,b]=p.useState(new Date().getTime()),[$,k]=p.useState(!d.public),[f,v]=p.useState(d.slug||""),[N,S]=p.useState(!1),{hotToast:y}=Q(E),[R,l]=p.useState({name:"",image:c[0].thumbnail}),_=t=>{l(t)},L=()=>{l({name:"",image:""})};function U(t){k(!t),t||(v(""),b(new Date().getTime()))}function V(t){if(!t)return"";const w="àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœøṕŕßśșțùúüûǘẃẍÿź·/_,:;",W="aaaaaaaaceeeeghiiiimnnnooooooprssstuuuuuwxyz------",X=new RegExp(w.split("").join("|"),"g"),Y=t.toString().toLowerCase().replace(/\s+/g,"-").replace(X,Z=>W.charAt(w.indexOf(Z))).replace(/&/g,"-and-").replace(/[^\w\\-]+/g,"").replace(/\\-\\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");v(Y)}const q=async function(t){try{await x.mutateAsync({description:t.description,entId:c[0].assetId,name:t.title,public:t.enablePublic,slug:t.safeSlug,trashed:c[0].trashed,thumbnail:R.image}),S(!1),y.success(e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:r("explorer.resource.updated")}),e.jsxs("p",{children:["Titre: ",t.title]}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{children:["Public:"," ",t.enablePublic?r("explorer.enable.public.yes"):r("explorer.enable.public.no")]})]})),a==null||a()}catch(w){S(!0),console.error(w)}};function D(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${f}`),y.success(r("explorer.copy.clipboard"))}function H(){j(),n()}const O=`resource_edit_modal_${I}`;return{slug:f,disableSlug:$,formId:O,errors:g,isSubmitting:o,isValid:i,versionSlug:M,correctSlug:N,onPublicChange:U,onSlugChange:V,register:s,setFocus:u,handleSubmit:h,onFormCancel:H,onSubmit:q,handleUploadImage:_,handleDeleteImage:L,onCopyToClipBoard:D}}function ue({isOpen:d,edit:a,onSuccess:n,onCancel:r}){const{appCode:x,currentApp:c}=ee(),s=z()[0],{slug:h,formId:u,isValid:g,isSubmitting:o,disableSlug:i,versionSlug:I,correctSlug:M,register:b,handleSubmit:$,onSubmit:k,handleUploadImage:f,handleDeleteImage:v,onCopyToClipBoard:N,onSlugChange:S,onPublicChange:y}=ie({resource:s,onSuccess:n,onCancel:r}),{data:R}=se(),{t:l}=B();return te.createPortal(e.jsxs(C,{id:"resource_edit_modal",size:"lg",isOpen:d,onModalClose:r,children:[e.jsx(C.Header,{onModalClose:r,children:l(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:l("explorer.resource.editModal.heading.general")}),e.jsxs("form",{id:u,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:s==null?void 0:s.thumbnail,label:l("explorer.imagepicker.label"),addButtonLabel:l("explorer.imagepicker.button.add"),deleteButtonLabel:l("explorer.imagepicker.button.delete"),onUploadImage:f,onDeleteImage:v,className:"align-self-center"}),e.jsxs("div",{className:"col",children:[e.jsxs(m,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(F,{children:l("title")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.name:"",...b("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:l("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(m,{id:"description",isOptional:!0,children:[e.jsx(F,{children:l("description")}),e.jsx(P,{type:"text",defaultValue:a?s==null?void 0:s.description:"",...b("description"),placeholder:l("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),le({workflow:"createPublic",actions:R})&&e.jsx(oe,{appCode:x,correctSlug:M,disableSlug:i,onCopyToClipBoard:N,onPublicChange:y,onSlugChange:S,resource:s,slug:h,versionSlug:I,register:b})]})]}),e.jsxs(C.Footer,{children:[e.jsx(T,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:l("explorer.cancel")}),e.jsx(T,{form:u,type:"submit",color:"primary",variant:"filled",disabled:!g||o,children:l(a?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{ue as default};
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-feat-explorer-SNAPSHOT 07/07/2023 07:08:30
1
+ ode-explorer=1.0-feat-explorer-SNAPSHOT 07/07/2023 07:51:24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.0.0-dev.202307070707",
3
+ "version": "1.0.0-dev.202307070750",
4
4
  "description": "Open Digital Education Explorer",
5
5
  "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
6
  "bugs": {