ode-explorer 1.0.3-develop-pedago.202310161027 → 1.0.3-develop-pedago.202310171033
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 +2 -2
- package/dist/PublishModal.js +1 -1
- package/dist/ShareResourceModal.js +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/index.html +13 -13
- package/dist/index.js +10 -10
- package/dist/version.txt +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as
|
|
1
|
+
import{u as E,r as B,j as a,H as Y,A as X,F as z,B as O,$ as me,d as ee,p as xe,a0 as be,o as te,l as we,W as Se,s as Be,Q as je,f as _e,a as ke,M as P,Z as q,E as $e,a1 as ve}from"./index.js";import{APP as se}from"/assets/js/edifice-ts-client/index.js";import{u as Ce}from"./index.esm.js";import{I as Ie,T as Ae}from"./TextArea.js";const ze=({appCode:s,isPublic:r,setValue:i,onCopyToClipBoard:e,onPublicChange:t,register:n,resource:l,slug:c,resourceName:o})=>{const{t:d}=E();return B.useEffect(()=>{o===""&&(t(!1),i("enablePublic",!1))},[t,o,i]),a.jsxs(a.Fragment,{children:[a.jsxs(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:[d("explorer.resource.editModal.heading.access"),s]}),a.jsx(X,{type:"info",children:d("explorer.resource.editModal.access.alert")}),a.jsxs(z,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[a.jsx(z.Input,{type:"checkbox",role:"switch",...n("enablePublic",{disabled:!r&&!o,value:l&&l.public,onChange:h=>{t(h.target.checked)}}),className:"form-check-input mt-0",size:"md"}),a.jsx(z.Label,{className:"form-check-label mb-0",children:d("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),r&&!!o&&a.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[a.jsxs("p",{className:"text-break",children:[window.location.origin,window.location.pathname,"/pub/",c]}),a.jsx(O,{color:"primary",disabled:!r,onClick:()=>e(),type:"button",leftIcon:a.jsx(me,{}),variant:"ghost",className:"text-nowrap",children:d("explorer.resource.editModal.access.url.button")})]})]})},W=Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});function Me(s,r){r?r={...W,...r}:r=W;const i=re(r);return i.dispatch(s),i.toString()}const Pe=Object.freeze(["prototype","__proto__","constructor"]);function re(s){let r="",i=new Map;const e=t=>{r+=t};return{toString(){return r},getContext(){return i},dispatch(t){return s.replacer&&(t=s.replacer(t)),this[t===null?"null":typeof t](t)},object(t){if(t&&typeof t.toJSON=="function")return this.object(t.toJSON());const n=Object.prototype.toString.call(t);let l="";const c=n.length;c<10?l="unknown:["+n+"]":l=n.slice(8,c-1),l=l.toLowerCase();let o=null;if((o=i.get(t))===void 0)i.set(t,i.size);else return this.dispatch("[CIRCULAR:"+o+"]");if(typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(t))return e("buffer:"),e(t.toString("utf8"));if(l!=="object"&&l!=="function"&&l!=="asyncfunction")this[l]?this[l](t):s.ignoreUnknown||this.unkown(t,l);else{let d=Object.keys(t);s.unorderedObjects&&(d=d.sort());let h=[];s.respectType!==!1&&!Z(t)&&(h=Pe),s.excludeKeys&&(d=d.filter(u=>!s.excludeKeys(u)),h=h.filter(u=>!s.excludeKeys(u))),e("object:"+(d.length+h.length)+":");const g=u=>{this.dispatch(u),e(":"),s.excludeValues||this.dispatch(t[u]),e(",")};for(const u of d)g(u);for(const u of h)g(u)}},array(t,n){if(n=n===void 0?s.unorderedArrays!==!1:n,e("array:"+t.length+":"),!n||t.length<=1){for(const o of t)this.dispatch(o);return}const l=new Map,c=t.map(o=>{const d=re(s);d.dispatch(o);for(const[h,g]of d.getContext())l.set(h,g);return d.toString()});return i=l,c.sort(),this.array(c,!1)},date(t){return e("date:"+t.toJSON())},symbol(t){return e("symbol:"+t.toString())},unkown(t,n){if(e(n),!!t&&(e(":"),t&&typeof t.entries=="function"))return this.array(Array.from(t.entries()),!0)},error(t){return e("error:"+t.toString())},boolean(t){return e("bool:"+t)},string(t){e("string:"+t.length+":"),e(t)},function(t){e("fn:"),Z(t)?this.dispatch("[native]"):this.dispatch(t.toString()),s.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(t.name)),s.respectFunctionProperties&&this.object(t)},number(t){return e("number:"+t)},xml(t){return e("xml:"+t.toString())},null(){return e("Null")},undefined(){return e("Undefined")},regexp(t){return e("regex:"+t.toString())},uint8array(t){return e("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},uint8clampedarray(t){return e("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},int8array(t){return e("int8array:"),this.dispatch(Array.prototype.slice.call(t))},uint16array(t){return e("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},int16array(t){return e("int16array:"),this.dispatch(Array.prototype.slice.call(t))},uint32array(t){return e("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},int32array(t){return e("int32array:"),this.dispatch(Array.prototype.slice.call(t))},float32array(t){return e("float32array:"),this.dispatch(Array.prototype.slice.call(t))},float64array(t){return e("float64array:"),this.dispatch(Array.prototype.slice.call(t))},arraybuffer(t){return e("arraybuffer:"),this.dispatch(new Uint8Array(t))},url(t){return e("url:"+t.toString())},map(t){e("map:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},set(t){e("set:");const n=[...t];return this.array(n,s.unorderedSets!==!1)},file(t){return e("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},blob(){if(s.ignoreUnknown)return e("[blob]");throw new Error(`Hashing Blob objects is currently not supported
|
|
2
2
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
3
|
-
`)},domwindow(){return e("domwindow")},bigint(t){return e("bigint:"+t.toString())},process(){return e("process")},timer(){return e("timer")},pipe(){return e("pipe")},tcp(){return e("tcp")},udp(){return e("udp")},tty(){return e("tty")},statwatcher(){return e("statwatcher")},securecontext(){return e("securecontext")},connection(){return e("connection")},zlib(){return e("zlib")},context(){return e("context")},nodescript(){return e("nodescript")},httpparser(){return e("httpparser")},dataview(){return e("dataview")},signal(){return e("signal")},fsevent(){return e("fsevent")},tlswrap(){return e("tlswrap")}}}const se="[native code] }",Me=se.length;function q(s){return typeof s!="function"?!1:Function.prototype.toString.call(s).slice(-Me)===se}class b{constructor(r,i){r=this.words=r||[],this.sigBytes=i===void 0?r.length*4:i}toString(r){return(r||Pe).stringify(this)}concat(r){if(this.clamp(),this.sigBytes%4)for(let i=0;i<r.sigBytes;i++){const e=r.words[i>>>2]>>>24-i%4*8&255;this.words[this.sigBytes+i>>>2]|=e<<24-(this.sigBytes+i)%4*8}else for(let i=0;i<r.sigBytes;i+=4)this.words[this.sigBytes+i>>>2]=r.words[i>>>2];return this.sigBytes+=r.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new b([...this.words])}}const Pe={stringify(s){const r=[];for(let i=0;i<s.sigBytes;i++){const e=s.words[i>>>2]>>>24-i%4*8&255;r.push((e>>>4).toString(16),(e&15).toString(16))}return r.join("")}},Re={stringify(s){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=[];for(let e=0;e<s.sigBytes;e+=3){const t=s.words[e>>>2]>>>24-e%4*8&255,n=s.words[e+1>>>2]>>>24-(e+1)%4*8&255,l=s.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=t<<16|n<<8|l;for(let o=0;o<4&&e*8+o*6<s.sigBytes*8;o++)i.push(r.charAt(c>>>6*(3-o)&63))}return i.join("")}},Ne={parse(s){const r=s.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(s.charCodeAt(e)&255)<<24-e%4*8;return new b(i,r)}},Oe={parse(s){return Ne.parse(unescape(encodeURIComponent(s)))}};class Ee{constructor(){this._data=new b,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new b,this._nDataBytes=0}_append(r){typeof r=="string"&&(r=Oe.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes}_doProcessBlock(r,i){}_process(r){let i,e=this._data.sigBytes/(this.blockSize*4);r?e=Math.ceil(e):e=Math.max((e|0)-this._minBufferSize,0);const t=e*this.blockSize,n=Math.min(t*4,this._data.sigBytes);if(t){for(let l=0;l<t;l+=this.blockSize)this._doProcessBlock(this._data.words,l);i=this._data.words.splice(0,t),this._data.sigBytes-=n}return new b(i,n)}}class Ue extends Ee{update(r){return this._append(r),this._process(),this}finalize(r){r&&this._append(r)}}const W=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Fe=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],S=[];class Le extends Ue{constructor(){super(...arguments),this._hash=new b([...W])}reset(){super.reset(),this._hash=new b([...W])}_doProcessBlock(r,i){const e=this._hash.words;let t=e[0],n=e[1],l=e[2],c=e[3],o=e[4],d=e[5],h=e[6],g=e[7];for(let u=0;u<64;u++){if(u<16)S[u]=r[i+u]|0;else{const x=S[u-15],y=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,m=S[u-2],j=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;S[u]=y+S[u-7]+j+S[u-16]}const $=o&d^~o&h,w=t&n^t&l^n&l,v=(t<<30|t>>>2)^(t<<19|t>>>13)^(t<<10|t>>>22),C=(o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25),B=g+C+$+Fe[u]+S[u],A=v+w;g=h,h=d,d=o,o=c+B|0,c=l,l=n,n=t,t=B+A|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+l|0,e[3]=e[3]+c|0,e[4]=e[4]+o|0,e[5]=e[5]+d|0,e[6]=e[6]+h|0,e[7]=e[7]+g|0}finalize(r){super.finalize(r);const i=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(i/4294967296),this._data.words[(e+64>>>9<<4)+15]=i,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Te(s){return new Le().finalize(s).toString(Re)}function Z(s,r={}){const i=typeof s=="string"?s:Ie(s,r);return Te(i).slice(0,10)}var re={};Object.defineProperty(re,"__esModule",{value:!0});const He=s=>{const r="ÀÁÂÃÄÅĄàáâãäåąÒÓÔÕÕÖØòóôõöøÈÉÊËĘèéêëðęÇĆçćÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠŚšśŸÿýŽŹŻžźżŁłŃńàáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîüûñçýỳỹỵỷğışĞİŞ",i="AAAAAAAaaaaaaaOOOOOOOooooooEEEEEeeeeeeCCccDIIIIiiiiUUUUuuuuNnSSssYyyZZZzzzLlNnaaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiuuncyyyyygisGIS",e=r.split("").join("|"),t=new RegExp(`(${e})`,"g");function n(l){return i[r.indexOf(l)]||""}return s.replace(t,n)},Ke=s=>s.split("").map(r=>`\\${r}`).join(""),G=(s,r,i=!1)=>{const e=He(s).trim().toLowerCase(),t=Ke(r);return i?e.replace(/\s+/g,r):e.replace(new RegExp(`[^a-z0-9${t}]+`,"g"),r).replace(new RegExp(`${t}+`,"g"),r).replace(new RegExp(`^${t}`,"g"),"").replace(new RegExp(`${t}$`,"g"),"")},I=(s,r={delimiter:"-",prefix:""})=>{if(r.delimiter||(r.delimiter="-"),r.prefix||(r.prefix=""),!s||typeof s=="boolean")return"";const{delimiter:i,prefix:e}=r;if(typeof s=="boolean")return"";if(typeof s=="string"||typeof s=="number"){const t=G(e,i,!0),n=G(String(s),i);return t?`${t}${i}${n}`:n}return"children"in s?I(s.children):"type"in s?I(s.props.children,r):Symbol.iterator in s?I(Array.from(s).map(t=>I(t,{delimiter:i})).join(i),r):""};var J=re.default=I;function Ve({resource:s,edit:r,onSuccess:i,onCancel:e}){var T;const{appCode:t}=Y(),{t:n}=O(),l=ye(),c=me(),o=X(),d=xe(),{watch:h,reset:g,register:u,handleSubmit:$,setFocus:w,setValue:v,formState:{errors:C,isSubmitting:B,isValid:A}}=$e({mode:"onChange"}),x=k.useId(),y=be(),{hotToast:m}=we(D),[j,f]=k.useState((s==null?void 0:s.slug)||""),[ie,ne]=k.useState(!!(s!=null&&s.public)),[E,U]=k.useState({name:"",image:((T=o[0])==null?void 0:T.thumbnail)||""}),R=h("title"),F=k.useId(),ae=p=>{U(p)},oe=()=>{U({name:"",image:""})};function le(p){ne(p);let _="";s&&s.slug?_=s.slug:_=`${Z({foo:`${R}${F}`})}-${J(R)}`,f(_)}const ce=Se(),{filters:L,trashed:ue}=d,de=["context",{folderId:L.folder,filters:L,trashed:ue}],he=async function(p){var _,H;try{const M=p.enablePublic?s&&s.slug?s.slug:`${Z({foo:`${p.title}${F}`})}-${J(p.title)}`:"";r?await l.mutateAsync({description:p.description||"",entId:(_=o[0])==null?void 0:_.assetId,name:p.title,public:p.enablePublic,slug:M,trashed:(H=o[0])==null?void 0:H.trashed,thumbnail:E}):(ce.invalidateQueries(de),await c.mutateAsync({name:p.title,description:p.description||"",thumbnail:E,folder:(y==null?void 0:y.id)==="default"?void 0:parseInt((y==null?void 0:y.id)||""),public:p.enablePublic,slug:M,app:t})),m.success(a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:n(r?"explorer.resource.updated":"explorer.resource.created")}),a.jsxs("p",{children:["Titre: ",p.title]}),a.jsxs("p",{children:["Description: ",p.description]}),r&&t===ee.BLOG&&a.jsxs("p",{children:["Public:",p.enablePublic?n("explorer.enable.public.yes"):n("explorer.enable.public.no")]})]})),i==null||i()}catch(M){console.error(M)}};function pe(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${j}`),m.success(n("explorer.copy.clipboard"))}function fe(){g(),e()}return{slug:j,isPublic:ie,formId:x,errors:C,isSubmitting:B,isValid:A,resourceName:R,onPublicChange:le,register:u,setFocus:w,setValue:v,handleSubmit:$,onFormCancel:fe,onSubmit:he,handleUploadImage:ae,handleDeleteImage:oe,onCopyToClipBoard:pe}}function Je({isOpen:s,edit:r,onSuccess:i,onCancel:e}){const{appCode:t,currentApp:n}=Y(),c=X()[0],{slug:o,formId:d,isValid:h,isSubmitting:g,isPublic:u,resourceName:$,register:w,handleSubmit:v,onSubmit:C,handleUploadImage:B,handleDeleteImage:A,onCopyToClipBoard:x,onPublicChange:y,setValue:m}=Ve({resource:c,edit:r,onSuccess:i,onCancel:e}),{data:j}=Be(),{t:f}=O();return je.createPortal(a.jsxs(P,{id:"resource_edit_modal",size:"lg",isOpen:s,onModalClose:e,children:[a.jsx(P.Header,{onModalClose:e,children:f(r?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),a.jsxs(P.Body,{children:[a.jsx(Q,{headingStyle:"h4",level:"h3",className:"mb-16",children:f("explorer.resource.editModal.heading.general")}),a.jsxs("form",{id:d,onSubmit:v(C),children:[a.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[a.jsx("div",{children:a.jsx(ve,{app:n,src:c==null?void 0:c.thumbnail,label:f("explorer.imagepicker.label"),addButtonLabel:f("explorer.imagepicker.button.add"),deleteButtonLabel:f("explorer.imagepicker.button.delete"),onUploadImage:B,onDeleteImage:A,className:"align-self-center mt-8"})}),a.jsxs("div",{className:"col",children:[a.jsxs(z,{id:"title",className:"mb-16",isRequired:!0,children:[a.jsx(K,{children:f("title")}),a.jsx(_e,{type:"text",defaultValue:r?c==null?void 0:c.name:"",...w("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:f("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),a.jsxs(z,{id:"description",isOptional:!0,children:[a.jsx(K,{children:f("description")}),a.jsx(Ce,{defaultValue:r?c==null?void 0:c.description:"",...w("description"),placeholder:f("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),t===ee.BLOG&&ke({workflow:"createPublic",actions:j})&&a.jsx(Ae,{appCode:t,isPublic:u,onCopyToClipBoard:x,onPublicChange:y,resource:c,resourceName:$,slug:o,setValue:m,register:w})]})]}),a.jsxs(P.Footer,{children:[a.jsx(N,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:f("explorer.cancel")}),a.jsx(N,{form:d,type:"submit",color:"primary",variant:"filled",disabled:!h||g,children:f(r?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{Je as default};
|
|
3
|
+
`)},domwindow(){return e("domwindow")},bigint(t){return e("bigint:"+t.toString())},process(){return e("process")},timer(){return e("timer")},pipe(){return e("pipe")},tcp(){return e("tcp")},udp(){return e("udp")},tty(){return e("tty")},statwatcher(){return e("statwatcher")},securecontext(){return e("securecontext")},connection(){return e("connection")},zlib(){return e("zlib")},context(){return e("context")},nodescript(){return e("nodescript")},httpparser(){return e("httpparser")},dataview(){return e("dataview")},signal(){return e("signal")},fsevent(){return e("fsevent")},tlswrap(){return e("tlswrap")}}}const ie="[native code] }",Re=ie.length;function Z(s){return typeof s!="function"?!1:Function.prototype.toString.call(s).slice(-Re)===ie}class b{constructor(r,i){r=this.words=r||[],this.sigBytes=i===void 0?r.length*4:i}toString(r){return(r||Ne).stringify(this)}concat(r){if(this.clamp(),this.sigBytes%4)for(let i=0;i<r.sigBytes;i++){const e=r.words[i>>>2]>>>24-i%4*8&255;this.words[this.sigBytes+i>>>2]|=e<<24-(this.sigBytes+i)%4*8}else for(let i=0;i<r.sigBytes;i+=4)this.words[this.sigBytes+i>>>2]=r.words[i>>>2];return this.sigBytes+=r.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new b([...this.words])}}const Ne={stringify(s){const r=[];for(let i=0;i<s.sigBytes;i++){const e=s.words[i>>>2]>>>24-i%4*8&255;r.push((e>>>4).toString(16),(e&15).toString(16))}return r.join("")}},Oe={stringify(s){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=[];for(let e=0;e<s.sigBytes;e+=3){const t=s.words[e>>>2]>>>24-e%4*8&255,n=s.words[e+1>>>2]>>>24-(e+1)%4*8&255,l=s.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=t<<16|n<<8|l;for(let o=0;o<4&&e*8+o*6<s.sigBytes*8;o++)i.push(r.charAt(c>>>6*(3-o)&63))}return i.join("")}},Ee={parse(s){const r=s.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(s.charCodeAt(e)&255)<<24-e%4*8;return new b(i,r)}},Le={parse(s){return Ee.parse(unescape(encodeURIComponent(s)))}};class Ue{constructor(){this._data=new b,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new b,this._nDataBytes=0}_append(r){typeof r=="string"&&(r=Le.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes}_doProcessBlock(r,i){}_process(r){let i,e=this._data.sigBytes/(this.blockSize*4);r?e=Math.ceil(e):e=Math.max((e|0)-this._minBufferSize,0);const t=e*this.blockSize,n=Math.min(t*4,this._data.sigBytes);if(t){for(let l=0;l<t;l+=this.blockSize)this._doProcessBlock(this._data.words,l);i=this._data.words.splice(0,t),this._data.sigBytes-=n}return new b(i,n)}}class Fe extends Ue{update(r){return this._append(r),this._process(),this}finalize(r){r&&this._append(r)}}const G=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Te=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],S=[];class He extends Fe{constructor(){super(...arguments),this._hash=new b([...G])}reset(){super.reset(),this._hash=new b([...G])}_doProcessBlock(r,i){const e=this._hash.words;let t=e[0],n=e[1],l=e[2],c=e[3],o=e[4],d=e[5],h=e[6],g=e[7];for(let u=0;u<64;u++){if(u<16)S[u]=r[i+u]|0;else{const x=S[u-15],y=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,m=S[u-2],_=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;S[u]=y+S[u-7]+_+S[u-16]}const $=o&d^~o&h,v=t&n^t&l^n&l,w=(t<<30|t>>>2)^(t<<19|t>>>13)^(t<<10|t>>>22),C=(o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25),j=g+C+$+Te[u]+S[u],I=w+v;g=h,h=d,d=o,o=c+j|0,c=l,l=n,n=t,t=j+I|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+l|0,e[3]=e[3]+c|0,e[4]=e[4]+o|0,e[5]=e[5]+d|0,e[6]=e[6]+h|0,e[7]=e[7]+g|0}finalize(r){super.finalize(r);const i=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(i/4294967296),this._data.words[(e+64>>>9<<4)+15]=i,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Ke(s){return new He().finalize(s).toString(Oe)}function J(s,r={}){const i=typeof s=="string"?s:Me(s,r);return Ke(i).slice(0,10)}var ne={};Object.defineProperty(ne,"__esModule",{value:!0});const Ve=s=>{const r="ÀÁÂÃÄÅĄàáâãäåąÒÓÔÕÕÖØòóôõöøÈÉÊËĘèéêëðęÇĆçćÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠŚšśŸÿýŽŹŻžźżŁłŃńàáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîüûñçýỳỹỵỷğışĞİŞ",i="AAAAAAAaaaaaaaOOOOOOOooooooEEEEEeeeeeeCCccDIIIIiiiiUUUUuuuuNnSSssYyyZZZzzzLlNnaaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiuuncyyyyygisGIS",e=r.split("").join("|"),t=new RegExp(`(${e})`,"g");function n(l){return i[r.indexOf(l)]||""}return s.replace(t,n)},qe=s=>s.split("").map(r=>`\\${r}`).join(""),Q=(s,r,i=!1)=>{const e=Ve(s).trim().toLowerCase(),t=qe(r);return i?e.replace(/\s+/g,r):e.replace(new RegExp(`[^a-z0-9${t}]+`,"g"),r).replace(new RegExp(`${t}+`,"g"),r).replace(new RegExp(`^${t}`,"g"),"").replace(new RegExp(`${t}$`,"g"),"")},A=(s,r={delimiter:"-",prefix:""})=>{if(r.delimiter||(r.delimiter="-"),r.prefix||(r.prefix=""),!s||typeof s=="boolean")return"";const{delimiter:i,prefix:e}=r;if(typeof s=="boolean")return"";if(typeof s=="string"||typeof s=="number"){const t=Q(e,i,!0),n=Q(String(s),i);return t?`${t}${i}${n}`:n}return"children"in s?A(s.children):"type"in s?A(s.props.children,r):Symbol.iterator in s?A(Array.from(s).map(t=>A(t,{delimiter:i})).join(i),r):""};var D=ne.default=A;function We({resource:s,edit:r,onSuccess:i,onCancel:e}){var K;const{appCode:t}=ee(),{t:n}=E(),l=xe(),c=be(),o=te(),d=we(),{watch:h,reset:g,register:u,handleSubmit:$,setFocus:v,setValue:w,formState:{errors:C,isSubmitting:j,isValid:I}}=Ce({mode:"onChange"}),x=B.useId(),y=Se(),{hotToast:m}=Be(X),[_,R]=B.useState((s==null?void 0:s.slug)||""),[f,ae]=B.useState(!!(s!=null&&s.public)),[L,U]=B.useState(((K=o[0])==null?void 0:K.thumbnail)||""),[oe,F]=B.useState(!1),N=h("title"),T=B.useId(),le=p=>{U(p)},ce=()=>{U("")};function ue(p){ae(p);let k="";s&&s.slug?k=s.slug:k=`${J({foo:`${N}${T}`})}-${D(N)}`,R(k)}const de=je(),{filters:H,trashed:he}=d,pe=["context",{folderId:H.folder,filters:H,trashed:he}],fe=async function(p){var k,V;try{F(!0);const M=p.enablePublic?s&&s.slug?s.slug:`${J({foo:`${p.title}${T}`})}-${D(p.title)}`:"";r?await l.mutateAsync({description:p.description||"",entId:(k=o[0])==null?void 0:k.assetId,name:p.title,public:p.enablePublic,slug:M,trashed:(V=o[0])==null?void 0:V.trashed,thumbnail:L}):(de.invalidateQueries(pe),await c.mutateAsync({name:p.title,description:p.description||"",thumbnail:L,folder:(y==null?void 0:y.id)==="default"?void 0:parseInt((y==null?void 0:y.id)||""),public:p.enablePublic,slug:M,app:t})),m.success(a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:n(r?"explorer.resource.updated":"explorer.resource.created")}),a.jsxs("p",{children:["Titre: ",p.title]}),a.jsxs("p",{children:["Description: ",p.description]}),r&&t===se.BLOG&&a.jsxs("p",{children:["Public:",p.enablePublic?n("explorer.enable.public.yes"):n("explorer.enable.public.no")]})]})),i==null||i()}catch(M){console.error(M)}finally{F(!1)}};function ge(){navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}/pub/${_}`),m.success(n("explorer.copy.clipboard"))}function ye(){g(),e()}return{slug:_,isPublic:f,formId:x,errors:C,isSubmitting:j,isValid:I,resourceName:N,isLoading:oe,onPublicChange:ue,register:u,setFocus:v,setValue:w,handleSubmit:$,onFormCancel:ye,onSubmit:fe,handleUploadImage:le,handleDeleteImage:ce,onCopyToClipBoard:ge}}function De({isOpen:s,edit:r,onSuccess:i,onCancel:e}){const{appCode:t,currentApp:n}=ee(),c=te()[0],{slug:o,formId:d,isValid:h,isSubmitting:g,isPublic:u,resourceName:$,isLoading:v,register:w,handleSubmit:C,onSubmit:j,handleUploadImage:I,handleDeleteImage:x,onCopyToClipBoard:y,onPublicChange:m,setValue:_}=We({resource:c,edit:r,onSuccess:i,onCancel:e}),{data:R}=_e(),{t:f}=E();return ke.createPortal(a.jsxs(P,{id:"resource_edit_modal",size:"lg",isOpen:s,onModalClose:e,children:[a.jsx(P.Header,{onModalClose:e,children:f(r?"explorer.resource.editModal.header.edit":"explorer.resource.editModal.header.create")}),a.jsxs(P.Body,{children:[a.jsx(Y,{headingStyle:"h4",level:"h3",className:"mb-16",children:f("explorer.resource.editModal.heading.general")}),a.jsxs("form",{id:d,onSubmit:C(j),children:[a.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[a.jsx("div",{children:a.jsx(Ie,{app:n,src:c==null?void 0:c.thumbnail,label:f("explorer.imagepicker.label"),addButtonLabel:f("explorer.imagepicker.button.add"),deleteButtonLabel:f("explorer.imagepicker.button.delete"),onUploadImage:I,onDeleteImage:x,className:"align-self-center mt-8"})}),a.jsxs("div",{className:"col",children:[a.jsxs(z,{id:"title",className:"mb-16",isRequired:!0,children:[a.jsx(q,{children:f("title")}),a.jsx($e,{type:"text",defaultValue:r?c==null?void 0:c.name:"",...w("title",{required:!0,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:f("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0})]}),a.jsxs(z,{id:"description",isOptional:!0,children:[a.jsx(q,{children:f("description")}),a.jsx(Ae,{defaultValue:r?c==null?void 0:c.description:"",...w("description"),placeholder:f("explorer.resource.editModal.description.placeholder"),size:"md"})]})]})]}),t===se.BLOG&&ve({workflow:"createPublic",actions:R})&&a.jsx(ze,{appCode:t,isPublic:u,onCopyToClipBoard:y,onPublicChange:m,resource:c,resourceName:$,slug:o,setValue:_,register:w})]})]}),a.jsxs(P.Footer,{children:[a.jsx(O,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:f("explorer.cancel")}),a.jsx(O,{form:d,type:"submit",color:"primary",isLoading:v,variant:"filled",disabled:!h||g,children:f(r?"save":"explorer.create")})]})]}),document.getElementById("portal"))}export{De as default};
|
package/dist/PublishModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as T,a2 as ae,i as re,j as e,d as J,o as Y,s as le,e as te,a3 as K,A as V,u as C,a as se,M as E,H as L,F as N,Z as B,E as H,a4 as j,B as W,b as ie}from"./index.js";import{TransportFrameworkFactory as ce,RESOURCE as ne}from"/assets/js/edifice-ts-client/index.js";import{u as oe}from"./index.esm.js";import{I as be,T as ue}from"./TextArea.js";const Q=T.forwardRef(({options:a,model:t,disabled:i=!1,placeholderOption:c=!1,...p},r)=>{const{isRequired:b,status:g}=ae(),v=T.useId(),I={...p,id:v,disabled:i,ref:r,className:re(p.className,"form-select c-pointer",{"is-invalid":g==="invalid","is-valid":g==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...I,required:b,children:[c&&e.jsx("option",{disabled:!0,selected:t===void 0,children:c}),a==null?void 0:a.map(u=>{const x=typeof u=="object"?u.value:u,o=typeof u=="object"?u.label:u;return e.jsx("option",{value:x,selected:t===x,children:o},x)})]})})});Q.displayName="Select";const U=Q,{http:k}=ce.instance();function G(a){return a.charAt(0).toUpperCase()+a.slice(1)}function pe({onSuccess:a}){const{user:t,currentApp:i}=J(),c=Y(),[p,r]=T.useState({name:"",image:c[0].thumbnail}),[b,g]=T.useState(!1),{hotToast:v}=le(V),{publishApi:I}=te(),{register:u,watch:x,setValue:o,handleSubmit:O,formState:{errors:d,isSubmitting:P,isDirty:F,isValid:_}}=oe({mode:"onChange"}),[m,M]=T.useState([]),[h,q]=T.useState([]),R=s=>{let l=[...m];const n=l.findIndex(y=>y===s);m.includes(s)?l=m.filter((y,A)=>A!==n):l=[...m,s],M(l)},w=s=>{let l=[...h];const n=l.findIndex(y=>y===s);h.includes(s)?l=h.filter((y,A)=>A!==n):l=[...h,s],q(l)};function S(s){r(s)}const f=t?t==null?void 0:t.userId:"";return{watch:x,setValue:o,selectedResources:c,register:u,handleSubmit:O,formState:{errors:d,isSubmitting:P,isDirty:F,isValid:_},publish:async s=>{try{g(!0);let l=new Blob;p.image?l=await k.get(p.image,{responseType:"blob"}):c[0].thumbnail&&(l=await k.get(c[0].thumbnail,{responseType:"blob"}));const n=await k.get(`/userbook/avatar/${f}?thumbnail=48x48`,{responseType:"blob"}),y=await k.get(`/directory/user/${f}/attachment-school`,{responseType:"json"});let A="";i!=null&&i.displayName&&(A=G(i==null?void 0:i.displayName));const X={activityType:m,age:[s.ageMin,s.ageMax],application:K().libraryAppFilter??G(A),cover:l,description:s.description,keyWords:s.keyWords,language:s.language,licence:"CC-BY",resourceId:c[0].assetId,resourceEntId:c[0].assetId,subjectArea:h,teacherAvatar:n,title:s.title,userId:f,userStructureName:y.name||(t==null?void 0:t.structureNames[0])},ee=[ne.BLOG][0],D=await I(ee,X);D.success?v.success(e.jsx(me,{result:D}),{duration:1e4}):v.error(e.jsx(Z,{formData:s})),a==null||a()}catch{v.error(e.jsx(Z,{formData:s}))}finally{g(!1)}},handleDeleteImage:()=>{r({name:"",image:""})},handleUploadImage:S,selectedActivities:m,selectActivities:R,selectedSubjectAreas:h,selectSubjects:w,loaderPublish:b,cover:p}}function de(){const{t:a}=C(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],i=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],c=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:i,languageOptions:c,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function xe({isOpen:a,onSuccess:t,onCancel:i}){var z,s;const{currentApp:c}=J(),[p]=ie(),{t:r}=C(),{register:b,handleSubmit:g,publish:v,formState:{isDirty:I,isValid:u},handleUploadImage:x,selectedActivities:o,selectActivities:O,selectedSubjectAreas:d,selectSubjects:P,handleDeleteImage:F,loaderPublish:_,cover:m}=pe({onSuccess:t}),M=Y(),{activityTypeOptions:h,subjectAreaOptions:q,languageOptions:R,ageOptions:w}=de(),S=r("bpr.form.publication.language"),f=r("bpr.form.publication.age.min"),$=r("bpr.form.publication.age.max");return se.createPortal(e.jsxs(E,{isOpen:a,onModalClose:i,id:"libraryModal",size:"lg",children:[e.jsx(E.Header,{onModalClose:i,children:r("bpr.publish")}),e.jsx(E.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(E.Body,{children:[e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:g(v),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(be,{app:K().libraryAppFilter??c,src:(z=M[0])==null?void 0:z.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:x,onDeleteImage:F,className:"align-self-center"}),!m.image&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(N,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(B,{children:r("bpr.form.publication.title")}),e.jsx(H,{type:"text",defaultValue:(s=M[0])==null?void 0:s.name,...b("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(N,{id:"description",isRequired:!0,children:[e.jsx(B,{children:r("bpr.form.publication.description")}),e.jsx(ue,{...b("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsxs(j,{block:!0,children:[e.jsx(j.Trigger,{size:"md",label:r("bpr.form.publication.type"),badgeContent:o==null?void 0:o.length}),e.jsx(j.Menu,{children:h.map((l,n)=>e.jsx(j.CheckboxItem,{value:l.value,model:o,onChange:()=>O(l.value),children:l.label},n))})]})}),e.jsx("div",{className:"col d-flex",children:e.jsxs(j,{block:!0,children:[e.jsx(j.Trigger,{size:"md",label:r("bpr.form.publication.discipline"),badgeContent:d==null?void 0:d.length}),e.jsx(j.Menu,{children:q.map((l,n)=>e.jsx(j.CheckboxItem,{value:l.value,model:d,onChange:()=>P(l.value),children:l.label},n))})]})}),e.jsx("div",{className:"col",children:e.jsx(N,{id:"language",isRequired:!0,children:e.jsx(U,{...b("language",{required:!0,validate:l=>l!==S}),options:R,placeholderOption:S,defaultValue:S,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(N,{id:"ageMin",isRequired:!0,children:e.jsx(U,{...b("ageMin",{required:!0,validate:(l,n)=>parseInt(l)<=parseInt(n.ageMax)}),options:w,placeholderOption:f,defaultValue:f,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(N,{id:"ageMax",isRequired:!0,children:e.jsx(U,{...b("ageMax",{required:!0,validate:(l,n)=>parseInt(l)>=parseInt(n.ageMin)}),options:w,placeholderOption:$,defaultValue:$,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(N,{id:"keywords",isOptional:!0,children:[e.jsx(B,{children:r("bpr.form.publication.keywords")}),e.jsx(H,{type:"text",...b("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(L,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${p}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(V,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(V,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(E.Footer,{children:[e.jsx(W,{color:"tertiary",onClick:i,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(W,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:_,disabled:!m.image||_||!I||!u||(o==null?void 0:o.length)===0||(d==null?void 0:d.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function me({result:a}){const{t}=C();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function Z({formData:a}){const{t}=C(),i=c=>c.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[i(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),i(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{Z as PublishModalError,me as PublishModalSuccess,xe as default};
|
|
1
|
+
import{r as N,a2 as re,i as le,j as e,d as Y,o as K,s as te,e as se,a3 as Q,A as D,u as k,a as ie,M as S,H as B,F as A,Z as U,E as W,a4 as h,B as G,b as ce}from"./index.js";import{TransportFrameworkFactory as oe,RESOURCE as ne}from"/assets/js/edifice-ts-client/index.js";import{u as be}from"./index.esm.js";import{I as ue,T as pe}from"./TextArea.js";const X=N.forwardRef(({options:a,model:t,disabled:i=!1,placeholderOption:c=!1,...o},r)=>{const{isRequired:n,status:x}=re(),y=N.useId(),j={...o,id:y,disabled:i,ref:r,className:le(o.className,"form-select c-pointer",{"is-invalid":x==="invalid","is-valid":x==="valid"})};return e.jsx(e.Fragment,{children:e.jsxs("select",{...j,required:n,children:[c&&e.jsx("option",{disabled:!0,selected:t===void 0,children:c}),a==null?void 0:a.map(u=>{const v=typeof u=="object"?u.value:u,b=typeof u=="object"?u.label:u;return e.jsx("option",{value:v,selected:t===v,children:b},v)})]})})});X.displayName="Select";const V=X,{http:w}=oe.instance();function Z(a){return a.charAt(0).toUpperCase()+a.slice(1)}function de({onSuccess:a}){var T;const{user:t,currentApp:i}=Y(),c=t?t==null?void 0:t.userId:"",o=K(),[r,n]=N.useState(((T=o[0])==null?void 0:T.thumbnail)||""),[x,y]=N.useState(!1),{hotToast:j}=te(D),{publishApi:u}=se(),{register:v,watch:b,setValue:C,handleSubmit:p,formState:{errors:O,isSubmitting:P,isDirty:E,isValid:_}}=be({mode:"onChange"}),[d,R]=N.useState([]),[m,F]=N.useState([]);return{watch:b,setValue:C,selectedResources:o,register:v,handleSubmit:p,formState:{errors:O,isSubmitting:P,isDirty:E,isValid:_},publish:async l=>{try{y(!0);let s=new Blob;r?s=await w.get(URL.createObjectURL(r),{responseType:"blob"}):o[0].thumbnail&&(s=await w.get(o[0].thumbnail,{responseType:"blob"}));const I=await w.get(`/userbook/avatar/${c}?thumbnail=48x48`,{responseType:"blob"}),g=await w.get(`/directory/user/${c}/attachment-school`,{responseType:"json"});let f="";i!=null&&i.displayName&&(f=Z(i==null?void 0:i.displayName));const ee={activityType:d,age:[l.ageMin,l.ageMax],application:Q().libraryAppFilter??Z(f),cover:s,description:l.description,keyWords:l.keyWords,language:l.language,licence:"CC-BY",resourceId:o[0].assetId,resourceEntId:o[0].assetId,subjectArea:m,teacherAvatar:I,title:l.title,userId:c,userStructureName:g.name||(t==null?void 0:t.structureNames[0])},ae=[ne.BLOG][0],H=await u(ae,ee);H.success?j.success(e.jsx(he,{result:H}),{duration:1e4}):j.error(e.jsx(J,{formData:l})),a==null||a()}catch{j.error(e.jsx(J,{formData:l}))}finally{y(!1)}},handleDeleteImage:()=>{n("")},handleUploadImage:l=>{n(l)},selectedActivities:d,selectActivities:l=>{let s=[...d];const I=s.findIndex(g=>g===l);d.includes(l)?s=d.filter((g,f)=>f!==I):s=[...d,l],R(s)},selectedSubjectAreas:m,selectSubjects:l=>{let s=[...m];const I=s.findIndex(g=>g===l);m.includes(l)?s=m.filter((g,f)=>f!==I):s=[...m,l],F(s)},loaderPublish:x,cover:r}}function me(){const{t:a}=k(),t=[{value:"bpr.activityType.classroomActivity",label:a("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:a("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:a("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:a("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:a("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:a("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:a("bpr.activityType.courseElement")},{value:"bpr.other",label:a("bpr.other")}],i=[{value:"bpr.subjectArea.artActivity",label:a("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:a("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:a("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:a("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:a("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:a("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:a("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:a("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:a("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:a("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:a("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:a("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:a("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:a("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:a("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:a("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:a("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:a("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:a("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:a("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:a("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:a("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:a("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:a("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:a("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:a("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:a("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:a("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:a("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:a("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:a("bpr.subjectArea.technology")},{value:"bpr.other",label:a("bpr.other")}],c=[{value:"de_DE",label:a("de_DE")},{value:"en_EN",label:a("en_EN")},{value:"ar_DZ",label:a("ar_DZ")},{value:"es_ES",label:a("es_ES")},{value:"fr_FR",label:a("fr_FR")},{value:"it_IT",label:a("it_IT")},{value:"ja_JP",label:a("ja_JP")},{value:"zh_CN",label:a("zh_CN")},{value:"pt_PT",label:a("pt_PT")},{value:"ru_RU",label:a("ru_RU")},{value:"bpr.other",label:a("bpr.other")}];return{activityTypeOptions:t,subjectAreaOptions:i,languageOptions:c,ageOptions:["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"]}}function ye({isOpen:a,onSuccess:t,onCancel:i}){var z,T;const{currentApp:c}=Y(),[o]=ce(),{t:r}=k(),{register:n,handleSubmit:x,publish:y,formState:{isDirty:j,isValid:u},handleUploadImage:v,selectedActivities:b,selectActivities:C,selectedSubjectAreas:p,selectSubjects:O,handleDeleteImage:P,loaderPublish:E,cover:_}=de({onSuccess:t}),d=K(),{activityTypeOptions:R,subjectAreaOptions:m,languageOptions:F,ageOptions:q}=me(),M=r("bpr.form.publication.language"),L=r("bpr.form.publication.age.min"),$=r("bpr.form.publication.age.max");return ie.createPortal(e.jsxs(S,{isOpen:a,onModalClose:i,id:"libraryModal",size:"lg",children:[e.jsx(S.Header,{onModalClose:i,children:r("bpr.publish")}),e.jsx(S.Subtitle,{children:r("bpr.form.tip")}),e.jsxs(S.Body,{children:[e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.general")}),e.jsxs("form",{id:"libraryModalForm",onSubmit:x(y),children:[e.jsxs("div",{className:"d-flex mb-24 gap-24",children:[e.jsxs("div",{style:{maxWidth:"160px"},children:[e.jsx("div",{className:"form-label",children:r("bpr.form.publication.cover.title")}),e.jsx(ue,{app:Q().libraryAppFilter??c,src:(z=d[0])==null?void 0:z.thumbnail,label:r("bpr.form.publication.cover.upload.label"),addButtonLabel:r("bpr.form.publication.cover.upload.add"),deleteButtonLabel:r("bpr.form.publication.cover.upload.remove"),onUploadImage:v,onDeleteImage:P,className:"align-self-center"}),!_&&e.jsx("p",{className:"form-text is-invalid",children:e.jsx("em",{children:r("bpr.form.publication.cover.upload.required.image")})})]}),e.jsxs("div",{className:"flex-fill",children:[e.jsxs(A,{id:"title",className:"mb-16",isRequired:!0,children:[e.jsx(U,{children:r("bpr.form.publication.title")}),e.jsx(W,{type:"text",defaultValue:(T=d[0])==null?void 0:T.name,...n("title",{required:!0}),placeholder:r("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),e.jsxs(A,{id:"description",isRequired:!0,children:[e.jsx(U,{children:r("bpr.form.publication.description")}),e.jsx(pe,{...n("description",{required:!0}),placeholder:r("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),e.jsx("hr",{}),e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.heading.infos")}),e.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[e.jsx("div",{className:"col d-flex",children:e.jsxs(h,{block:!0,children:[e.jsx(h.Trigger,{size:"md",label:r("bpr.form.publication.type"),badgeContent:b==null?void 0:b.length}),e.jsx(h.Menu,{children:R.map((l,s)=>e.jsx(h.CheckboxItem,{value:l.value,model:b,onChange:()=>C(l.value),children:l.label},s))})]})}),e.jsx("div",{className:"col d-flex",children:e.jsxs(h,{block:!0,children:[e.jsx(h.Trigger,{size:"md",label:r("bpr.form.publication.discipline"),badgeContent:p==null?void 0:p.length}),e.jsx(h.Menu,{children:m.map((l,s)=>e.jsx(h.CheckboxItem,{value:l.value,model:p,onChange:()=>O(l.value),children:l.label},s))})]})}),e.jsx("div",{className:"col",children:e.jsx(A,{id:"language",isRequired:!0,children:e.jsx(V,{...n("language",{required:!0,validate:l=>l!==M}),options:F,placeholderOption:M,defaultValue:M,"aria-required":!0})})})]}),e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{htmlFor:"",className:"form-label",children:r("bpr.form.publication.age")}),e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-16",children:e.jsx(A,{id:"ageMin",isRequired:!0,children:e.jsx(V,{...n("ageMin",{required:!0,validate:(l,s)=>parseInt(l)<=parseInt(s.ageMax)}),options:q,placeholderOption:L,defaultValue:L,"aria-required":!0})})}),e.jsx("div",{children:e.jsx(A,{id:"ageMax",isRequired:!0,children:e.jsx(V,{...n("ageMax",{required:!0,validate:(l,s)=>parseInt(l)>=parseInt(s.ageMin)}),options:q,placeholderOption:$,defaultValue:$,"aria-required":!0})})})]})]}),e.jsx("div",{className:"mb-24",children:e.jsxs(A,{id:"keywords",isOptional:!0,children:[e.jsx(U,{children:r("bpr.form.publication.keywords")}),e.jsx(W,{type:"text",...n("keyWords"),size:"md",placeholder:r("bpr.form.publication.keywords.placeholder")})]})}),e.jsx("hr",{}),e.jsx(B,{headingStyle:"h4",level:"h3",className:"mb-16",children:r("bpr.form.publication.licence.text")}),e.jsxs("ul",{className:"mb-12",children:[e.jsxs("li",{children:[r("bpr.form.publication.licence.text.1"),e.jsx("img",{className:"ms-8 d-inline-block",src:`${o}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),e.jsx("li",{children:r("bpr.form.publication.licence.text.2")})]}),e.jsx(D,{type:"info",className:"mb-12",children:r("bpr.form.publication.licence.text.3")}),e.jsx(D,{type:"warning",children:r("bpr.form.publication.licence.text.4")})]})]}),e.jsxs(S.Footer,{children:[e.jsx(G,{color:"tertiary",onClick:i,type:"button",variant:"ghost",children:r("cancel")}),e.jsx(G,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:E,disabled:!_||E||!j||!u||(b==null?void 0:b.length)===0||(p==null?void 0:p.length)===0,children:r("bpr.form.submit")})]})]}),document.getElementById("portal"))}function he({result:a}){const{t}=k();return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.success.title")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.1")}),e.jsx("p",{className:"pt-24",children:t("bpr.form.publication.response.success.content.2")}),a.details.front_url&&e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("a",{className:"button right-magnet",href:a.details.front_url,target:"_blank",rel:"noreferrer",children:t("bpr.form.publication.response.success.button")})})]})}function J({formData:a}){const{t}=k(),i=c=>c.match(/^\s/);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"pt-24",children:t("bpr.form.publication.response.error.title")}),e.jsx("p",{className:"pt-24 pb-24",children:e.jsx("strong",{children:t("bpr.form.publication.response.error.content")})}),e.jsxs("ul",{children:[i(a.title)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.title")})}),i(a.description)&&e.jsx("li",{className:"pt-2 pb-2",children:e.jsx("strong",{children:t("bpr.form.publication.response.empty.description")})})]})]})}export{J as PublishModalError,he as PublishModalSuccess,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,i as ge,R as be,d as ne,u as se,H as Z,k as re,l as fe,m as ye,n as ve,o as ce,p as je,q as Se,s as we,t as ee,A as Ne,a as Ie,M as V,V as X,v as oe,C as le,B as z,w as ie,x as Ae,y as Be,F as Y,z as Re,D as Me,E as Ce,G as Ee}from"./index.js";import{odeServices as $,APP as Te}from"/assets/js/edifice-ts-client/index.js";import{T as $e}from"./Tooltip.js";function Pe(){const[d,p]=c.useState(!1);c.useEffect(()=>{u()},[]);const u=c.useCallback(async()=>{const m=await $.session().isAdml();p(m)},[]);return{isAdml:d}}const de=({options:d,hideCheckbox:p,isMonoSelection:u,onChange:m,model:b=[]})=>{const[y,j]=c.useState(b),S=a=>{j(u?[a]:h=>{const x=[...h];return h.includes(a)?x.splice(x.indexOf(a),1):x.push(a),x})};return c.useEffect(()=>{m==null||m(y)},[y]),e.jsx(e.Fragment,{children:e.jsx("div",{className:"select-list",children:d==null?void 0:d.map(a=>e.jsxs("div",{className:ge("select-list-option",p&&y.includes(a.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":y.includes(a.value),onMouseUp:()=>{S(a.value)},tabIndex:0,onKeyDown:h=>{h.key==="Enter"&&S(a.value)},children:[e.jsx("div",{className:"select-list-option-icon",children:a.icon&&be.createElement(a.icon,{width:"20px",height:"20px"})}),e.jsx("div",{className:"select-list-option-label",children:a.label}),!p&&e.jsx("div",{className:"select-list-option-checkbox",children:e.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:y.includes(a.value),className:"form-check-input c-pointer",id:"option.value"})})]},a.value))})})};de.displayName="SelectList";const Ue=de;function Fe({radioPublicationValue:d,onRadioPublicationChange:p}){const{appCode:u}=ne(),{t:m}=se(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(Z,{headingStyle:"h4",level:"h3",className:"mb-16",children:m("explorer.publication.steps")}),e.jsx(re,{label:m("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:d,checked:d==="IMMEDIATE",onChange:b=>p(b.target.value)}),e.jsx(re,{label:m("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:d==="RESTRAINT",model:d,onChange:b=>p(b.target.value)})]})}function De({radioPublicationValue:d,onRadioPublicationChange:p}){const{app:u}=fe();return u===Te.BLOG?e.jsx(Fe,{radioPublicationValue:d,onRadioPublicationChange:p}):e.jsx(e.Fragment,{})}function Le({onSuccess:d,payloadUpdatePublishType:p}){const{appCode:u}=ne(),{t:m}=se(),{user:b,avatar:y}=ye(),[j,S]=c.useState(c.useId()),[a,h]=c.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[x,w]=c.useState([]),[P,H]=c.useState(""),[N,q]=c.useState(!1),[R,G]=c.useState(""),I=ve(R,500),[K,W]=c.useState([]),[M,U]=c.useState([]),[F,_]=c.useState(!1),[C,O]=c.useState(!1),{isAdml:A}=Pe(),B=ce(),J=je(),Q=Se(),{hotToast:l}=we(Ne);c.useEffect(()=>{D()},[]),c.useEffect(()=>{ke(I)},[I]);const D=c.useCallback(async()=>{var t;const r=await $.share().getActionsForApp(u);w(r);const n=await $.share().getRightsForResource(u,(t=B[0])==null?void 0:t.assetId);h(n)},[]),i=(r,n)=>{h(({rights:t,...g})=>{var ae,te;const s=[...t],o=s.findIndex(k=>k.id===r.id),E=x.filter(k=>k.id===n)[0];if(s[o].actions.findIndex(k=>k.id===n)>-1){let k=s[o].actions.filter(f=>f.id!==n);const v=x.filter(f=>{var T;return(T=f.requires)==null?void 0:T.includes(n)});k=k.filter(f=>!v.find(T=>T.id===f.id)),s[o]={...s[o],actions:k}}else{const k=x.filter(v=>{var f;return((f=E.requires)==null?void 0:f.includes(v.id))&&!s[o].actions.find(T=>T.id===v.id)});s[o]={...s[o],actions:[...s[o].actions,E,...k]}}return r.type==="sharebookmark"&&((ae=s[o].users)==null||ae.forEach(k=>{const v=s.findIndex(f=>f.id===k.id);s[v]={...s[v],actions:s[o].actions}}),(te=s[o].groups)==null||te.forEach(k=>{const v=s.findIndex(f=>f.id===k.id);s[v]={...s[v],actions:s[o].actions}})),{rights:s,...g}})},L=async()=>{var r;try{await J.mutateAsync(p),await Q.mutateAsync({entId:(r=B[0])==null?void 0:r.assetId,shares:a.rights}),l.success(m("explorer.shared.status.saved")),d==null||d()}catch(n){console.error("Failed to save share",n),l.error(m("explorer.shared.status.error"))}},he=r=>{h(n=>({...n,rights:a.rights.filter(t=>{var g,s;return t.id!==r.id&&!((g=r.users)!=null&&g.find(o=>o.id===t.id))&&!((s=r.groups)!=null&&s.find(o=>o.id===t.id))})}))},ue=r=>{G(r.target.value)},me=()=>!C&&!A&&I.length>0&&M.length===0||!C&&A&&I.length>3&&M.length===0,pe=()=>A&&R.length<3,xe=()=>C&&R.length>0,ke=async r=>{var n;if(O(!0),!A&&r.length>=1||A&&r.length>=3){const t=await $.share().searchShareSubjects(u,(n=B[0])==null?void 0:n.assetId,r);W(t);const g=t.filter(s=>!a.rights.find(o=>o.id===s.id)).filter(s=>!(s.type==="user"&&s.id===B[0].creatorId)).map(s=>({value:s.id,label:s.displayName,icon:s.type==="sharebookmark"?ee:null}));U(g)}else U([]),Promise.resolve();O(!1)};return{currentIsAuthor:()=>{for(const r of B)if(r.creatorId!==(b==null?void 0:b.userId))return!1;return!0},idBookmark:j,myAvatar:y,shareRights:a,shareRightActions:x,showBookmarkInput:N,searchInputValue:R,searchResults:M,bookmarkName:P,showBookmarkMembers:F,debouncedSearchInputValue:I,searchPending:C,setBookmarkName:H,saveBookmark:async r=>{try{const n=await $.directory().saveBookmarks(r,{users:a.rights.filter(t=>t.type==="user").map(t=>t.id),groups:a.rights.filter(t=>t.type==="group").map(t=>t.id),bookmarks:a.rights.filter(t=>t.type==="sharebookmark").map(t=>t.id)});l.success(m("explorer.bookmarked.status.saved")),h(t=>({...t,visibleBookmarks:[...t.visibleBookmarks,{displayName:r,id:n.id}]})),S(j+new Date().getTime().toString()),q(!1)}catch(n){console.error("Failed to save bookmark",n),l.error(m("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:q,handleActionCheckbox:i,handleShare:L,handleDeleteRow:he,handleSearchInputChange:ue,handleSearchResultsChange:async r=>{const n=K.find(g=>g.id===r[0]),t=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(n){let g=[];if(n.type==="sharebookmark"){const s=await $.directory().getBookMarkById(n.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:t}),s==null||s.users.filter(o=>!a.rights.find(E=>E.id===o.id)).forEach(o=>{g.push({...o,type:"user",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})}),s.groups.filter(o=>!a.rights.find(E=>E.id===o.id)).forEach(o=>{g.push({...o,type:"group",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})})}else g=[{...n,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];h({...a,rights:[...a.rights,...g]}),U(M.filter(s=>s.value!==r[0]))}},showSearchNoResults:me,showSearchAdmlHint:pe,showSearchLoading:xe,handleBookmarkMembersToggle:()=>{_(!F)},hasRight:(r,n)=>r.actions.filter(t=>n.id===t.id).length>0,showShareRightLine:r=>r.isBookmarkMember&&F||!r.isBookmarkMember}}function ze(){const d=ce(),{assetId:p,description:u,thumbnail:m,name:b,public:y,trashed:j,slug:S,"publish-type":a}=d.length>0?d[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[h,x]=c.useState(a||"RESTRAINT"),[w,P]=c.useState({description:u||"",entId:p,name:b,public:!!y,slug:S||"",thumbnail:m,trashed:j,"publish-type":a});return c.useEffect(()=>{h&&P(N=>({...N,"publish-type":h}))},[h]),{radioPublicationValue:h,payloadUpdatePublishType:w,handleRadioPublicationChange:async N=>{x(N)}}}function Ye({isOpen:d,onSuccess:p,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:b,handleRadioPublicationChange:y}=ze(),{myAvatar:j,idBookmark:S,shareRights:a,shareRightActions:h,showBookmarkInput:x,searchResults:w,bookmarkName:P,showBookmarkMembers:H,searchPending:N,currentIsAuthor:q,setBookmarkName:R,saveBookmark:G,canSave:I,toggleBookmarkInput:K,handleActionCheckbox:W,handleShare:M,handleDeleteRow:U,handleSearchInputChange:F,handleSearchResultsChange:_,showSearchNoResults:C,showSearchAdmlHint:O,showSearchLoading:A,handleBookmarkMembersToggle:B,hasRight:J,showShareRightLine:Q}=Le({payloadUpdatePublishType:m,onSuccess:p,onCancel:u}),{t:l}=se(),D=c.useRef(null);return Ie.createPortal(e.jsxs(V,{id:"share_modal",size:"lg",isOpen:d,onModalClose:u,children:[e.jsx(V.Header,{onModalClose:u,children:l("share.title")}),e.jsxs(V.Body,{children:[e.jsx(Z,{headingStyle:"h4",level:"h3",className:"mb-16",children:l("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(X,{children:l("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(X,{children:l("explorer.modal.share.search.placeholder")})}),h.map(i=>e.jsx("th",{scope:"col",className:"text-center text-white",children:l(i.displayName)},i.displayName)),e.jsx("th",{scope:"col",children:e.jsx(X,{children:l("close")})})]})}),e.jsxs("tbody",{children:[q()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(oe,{alt:l("explorer.modal.share.avatar.me.alt"),size:"xs",src:j,variant:"circle"})}),e.jsx("td",{children:l("share.me")}),h.map(i=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(le,{checked:!0,disabled:!0})},i.displayName)),e.jsx("td",{})]}),a==null?void 0:a.rights.map(i=>Q(i)&&e.jsxs("tr",{className:i.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[i.type!=="sharebookmark"&&e.jsx(oe,{alt:l("explorer.modal.share.avatar.shared.alt"),size:"xs",src:i.avatarUrl,variant:"circle"}),i.type==="sharebookmark"&&e.jsx(ee,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[i.type==="sharebookmark"&&e.jsx(z,{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:B,children:i.displayName}),i.type!=="sharebookmark"&&i.displayName]})}),h.map(L=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(le,{checked:J(i,L),onChange:()=>W(i,L.id)})},L.displayName)),e.jsx("td",{children:!i.isBookmarkMember&&e.jsx(Ae,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Be,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>U(i)})})]},i.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(z,{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:x?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>K(!x),children:l("share.save.sharebookmark")}),x&&e.jsx("div",{className:"mt-16",children:e.jsxs(Y,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[e.jsx("div",{className:"flex-fill",children:e.jsx(Y.Input,{ref:D,onChange:()=>{R(()=>{var i;return((i=D.current)==null?void 0:i.value)||""})},placeholder:l("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},S)}),e.jsx(z,{type:"button",color:"primary",variant:"ghost",disabled:P.length===0,leftIcon:e.jsx(Re,{}),onClick:()=>{G(D.current.value)},className:"text-nowrap",children:l("explorer.modal.share.sharebookmark.save")})]})})]}),e.jsx("hr",{}),e.jsxs(Z,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[e.jsx("div",{className:"me-8",children:l("explorer.modal.share.search")}),e.jsx($e,{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(Me,{className:"c-pointer",height:"18"})})]}),e.jsxs(Y,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Ce,{className:"max-w-512",noValidationIcon:!0,placeholder:O()?l("explorer.search.adml.hint"):l("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:F}),A()&&e.jsxs("div",{className:"d-flex align-items-center p-4",children:[e.jsx(Ee,{isLoading:N}),e.jsx("span",{className:"ps-4",children:l("explorer.search.pending")})]}),C()&&e.jsx("div",{className:"p-4",children:l("portal.no.result")})]}),(w==null?void 0:w.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(Ue,{options:w,hideCheckbox:!0,isMonoSelection:!0,onChange:_})}),e.jsx(De,{radioPublicationValue:b,onRadioPublicationChange:y})]}),e.jsxs(V.Footer,{children:[e.jsx(z,{type:"button",color:"tertiary",variant:"ghost",onClick:u,children:l("explorer.cancel")}),e.jsx(z,{type:"button",color:"primary",variant:"filled",onClick:M,disabled:!I(),children:l("share")})]})]}),document.getElementById("portal"))}export{Ye as default};
|
|
1
|
+
import{r as n,j as e,i as fe,R as ye,d as ce,u as ae,H as ee,k as oe,l as ve,m as je,n as Se,o as de,p as we,q as Ne,s as Ie,t as se,A as Ae,a as Be,M as G,V as Y,v as le,C as ie,B as z,w as ne,x as Re,y as Me,F as Z,z as Ce,D as Ee,E as Te,G as $e}from"./index.js";import{odeServices as P,APP as Pe}from"/assets/js/edifice-ts-client/index.js";import{T as Le}from"./Tooltip.js";function Ue(){const[c,p]=n.useState(!1);n.useEffect(()=>{u()},[]);const u=n.useCallback(async()=>{const m=await P.session().isAdml();p(m)},[]);return{isAdml:c}}const he=({options:c,hideCheckbox:p,isMonoSelection:u,onChange:m,model:b=[]})=>{const[y,j]=n.useState(b),S=a=>{j(u?[a]:h=>{const x=[...h];return h.includes(a)?x.splice(x.indexOf(a),1):x.push(a),x})};return n.useEffect(()=>{m==null||m(y)},[y]),e.jsx(e.Fragment,{children:e.jsx("div",{className:"select-list",children:c==null?void 0:c.map(a=>e.jsxs("div",{className:fe("select-list-option",p&&y.includes(a.value)&&"text-secondary fw-bold"),role:"checkbox","aria-checked":y.includes(a.value),onMouseUp:()=>{S(a.value)},tabIndex:0,onKeyDown:h=>{h.key==="Enter"&&S(a.value)},children:[e.jsx("div",{className:"select-list-option-icon",children:a.icon&&ye.createElement(a.icon,{width:"20px",height:"20px"})}),e.jsx("div",{className:"select-list-option-label",children:a.label}),!p&&e.jsx("div",{className:"select-list-option-checkbox",children:e.jsx("input",{readOnly:!0,type:"checkbox",tabIndex:-1,checked:y.includes(a.value),className:"form-check-input c-pointer",id:"option.value"})})]},a.value))})})};he.displayName="SelectList";const Fe=he;function De({radioPublicationValue:c,onRadioPublicationChange:p}){const{appCode:u}=ce(),{t:m}=ae(u);return e.jsxs(e.Fragment,{children:[e.jsx("hr",{}),e.jsx(ee,{headingStyle:"h4",level:"h3",className:"mb-16",children:m("explorer.publication.steps")}),e.jsx(oe,{label:m("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:c,checked:c==="IMMEDIATE",onChange:b=>p(b.target.value)}),e.jsx(oe,{label:m("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:c==="RESTRAINT",model:c,onChange:b=>p(b.target.value)})]})}function ze({radioPublicationValue:c,onRadioPublicationChange:p}){const{app:u}=ve();return u===Pe.BLOG?e.jsx(De,{radioPublicationValue:c,onRadioPublicationChange:p}):e.jsx(e.Fragment,{})}function He({onSuccess:c,payloadUpdatePublishType:p}){const{appCode:u}=ce(),{t:m}=ae(),{user:b,avatar:y}=je(),[j,S]=n.useState(n.useId()),[a,h]=n.useState({rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]}),[x,w]=n.useState([]),[L,H]=n.useState(""),[I,q]=n.useState(!1),[M,K]=n.useState(""),A=Se(M,500),[W,_]=n.useState([]),[C,U]=n.useState([]),[F,J]=n.useState(!1),[E,O]=n.useState(!1),[Q,V]=n.useState(!1),{isAdml:B}=Ue(),R=de(),X=we(),d=Ne(),{hotToast:N}=Ie(Ae);n.useEffect(()=>{l()},[]),n.useEffect(()=>{be(A)},[A]);const l=n.useCallback(async()=>{var t;const r=await P.share().getActionsForApp(u);w(r);const i=await P.share().getRightsForResource(u,(t=R[0])==null?void 0:t.assetId);h(i)},[]),D=(r,i)=>{h(({rights:t,...g})=>{var te,re;const s=[...t],o=s.findIndex(k=>k.id===r.id),T=x.filter(k=>k.id===i)[0];if(s[o].actions.findIndex(k=>k.id===i)>-1){let k=s[o].actions.filter(f=>f.id!==i);const v=x.filter(f=>{var $;return($=f.requires)==null?void 0:$.includes(i)});k=k.filter(f=>!v.find($=>$.id===f.id)),s[o]={...s[o],actions:k}}else{const k=x.filter(v=>{var f;return((f=T.requires)==null?void 0:f.includes(v.id))&&!s[o].actions.find($=>$.id===v.id)});s[o]={...s[o],actions:[...s[o].actions,T,...k]}}return r.type==="sharebookmark"&&((te=s[o].users)==null||te.forEach(k=>{const v=s.findIndex(f=>f.id===k.id);s[v]={...s[v],actions:s[o].actions}}),(re=s[o].groups)==null||re.forEach(k=>{const v=s.findIndex(f=>f.id===k.id);s[v]={...s[v],actions:s[o].actions}})),{rights:s,...g}})},ue=async()=>{var r;try{V(!0),await X.mutateAsync(p),await d.mutateAsync({entId:(r=R[0])==null?void 0:r.assetId,shares:a.rights}),N.success(m("explorer.shared.status.saved")),c==null||c()}catch(i){console.error("Failed to save share",i),N.error(m("explorer.shared.status.error"))}finally{V(!1)}},me=r=>{h(i=>({...i,rights:a.rights.filter(t=>{var g,s;return t.id!==r.id&&!((g=r.users)!=null&&g.find(o=>o.id===t.id))&&!((s=r.groups)!=null&&s.find(o=>o.id===t.id))})}))},pe=r=>{K(r.target.value)},xe=()=>!E&&!B&&A.length>0&&C.length===0||!E&&B&&A.length>3&&C.length===0,ke=()=>B&&M.length<3,ge=()=>E&&M.length>0,be=async r=>{var i;if(O(!0),!B&&r.length>=1||B&&r.length>=3){const t=await P.share().searchShareSubjects(u,(i=R[0])==null?void 0:i.assetId,r);_(t);const g=t.filter(s=>!a.rights.find(o=>o.id===s.id)).filter(s=>!(s.type==="user"&&s.id===R[0].creatorId)).map(s=>({value:s.id,label:s.displayName,icon:s.type==="sharebookmark"?se:null}));U(g)}else U([]),Promise.resolve();O(!1)};return{currentIsAuthor:()=>{for(const r of R)if(r.creatorId!==(b==null?void 0:b.userId))return!1;return!0},idBookmark:j,myAvatar:y,shareRights:a,shareRightActions:x,showBookmarkInput:I,searchInputValue:M,searchResults:C,bookmarkName:L,showBookmarkMembers:F,debouncedSearchInputValue:A,searchPending:E,isLoading:Q,setBookmarkName:H,saveBookmark:async r=>{try{const i=await P.directory().saveBookmarks(r,{users:a.rights.filter(t=>t.type==="user").map(t=>t.id),groups:a.rights.filter(t=>t.type==="group").map(t=>t.id),bookmarks:a.rights.filter(t=>t.type==="sharebookmark").map(t=>t.id)});N.success(m("explorer.bookmarked.status.saved")),h(t=>({...t,visibleBookmarks:[...t.visibleBookmarks,{displayName:r,id:i.id}]})),S(j+new Date().getTime().toString()),q(!1)}catch(i){console.error("Failed to save bookmark",i),N.error(m("explorer.bookmarked.status.error"))}},canSave:()=>!0,toggleBookmarkInput:q,handleActionCheckbox:D,handleShare:ue,handleDeleteRow:me,handleSearchInputChange:pe,handleSearchResultsChange:async r=>{const i=W.find(g=>g.id===r[0]),t=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}];if(i){let g=[];if(i.type==="sharebookmark"){const s=await P.directory().getBookMarkById(i.id);g.push({...s,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:t}),s==null||s.users.filter(o=>!a.rights.find(T=>T.id===o.id)).forEach(o=>{g.push({...o,type:"user",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})}),s.groups.filter(o=>!a.rights.find(T=>T.id===o.id)).forEach(o=>{g.push({...o,type:"group",avatarUrl:"",directoryUrl:"",actions:t,isBookmarkMember:!0})})}else g=[{...i,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];h({...a,rights:[...a.rights,...g]}),U(C.filter(s=>s.value!==r[0]))}},showSearchNoResults:xe,showSearchAdmlHint:ke,showSearchLoading:ge,handleBookmarkMembersToggle:()=>{J(!F)},hasRight:(r,i)=>r.actions.filter(t=>i.id===t.id).length>0,showShareRightLine:r=>r.isBookmarkMember&&F||!r.isBookmarkMember}}function qe(){const c=de(),{assetId:p,description:u,thumbnail:m,name:b,public:y,trashed:j,slug:S,"publish-type":a}=c.length>0?c[0]:{"publish-type":"",assetId:"",description:"",name:"",public:!1,slug:"",thumbnail:"",trashed:!1},[h,x]=n.useState(a||"RESTRAINT"),[w,L]=n.useState({description:u||"",entId:p,name:b,public:!!y,slug:S||"",thumbnail:m,trashed:j,"publish-type":a});return n.useEffect(()=>{h&&L(I=>({...I,"publish-type":h}))},[h]),{radioPublicationValue:h,payloadUpdatePublishType:w,handleRadioPublicationChange:async I=>{x(I)}}}function es({isOpen:c,onSuccess:p,onCancel:u}){const{payloadUpdatePublishType:m,radioPublicationValue:b,handleRadioPublicationChange:y}=qe(),{myAvatar:j,idBookmark:S,shareRights:a,shareRightActions:h,showBookmarkInput:x,searchResults:w,bookmarkName:L,showBookmarkMembers:H,searchPending:I,isLoading:q,currentIsAuthor:M,setBookmarkName:K,saveBookmark:A,canSave:W,toggleBookmarkInput:_,handleActionCheckbox:C,handleShare:U,handleDeleteRow:F,handleSearchInputChange:J,handleSearchResultsChange:E,showSearchNoResults:O,showSearchAdmlHint:Q,showSearchLoading:V,handleBookmarkMembersToggle:B,hasRight:R,showShareRightLine:X}=He({payloadUpdatePublishType:m,onSuccess:p,onCancel:u}),{t:d}=ae(),N=n.useRef(null);return Be.createPortal(e.jsxs(G,{id:"share_modal",size:"lg",isOpen:c,onModalClose:u,children:[e.jsx(G.Header,{onModalClose:u,children:d("share.title")}),e.jsxs(G.Body,{children:[e.jsx(ee,{headingStyle:"h4",level:"h3",className:"mb-16",children:d("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:d("explorer.modal.share.avatar.shared.alt")})}),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:d("explorer.modal.share.search.placeholder")})}),h.map(l=>e.jsx("th",{scope:"col",className:"text-center text-white",children:d(l.displayName)},l.displayName)),e.jsx("th",{scope:"col",children:e.jsx(Y,{children:d("close")})})]})}),e.jsxs("tbody",{children:[M()&&e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:e.jsx(le,{alt:d("explorer.modal.share.avatar.me.alt"),size:"xs",src:j,variant:"circle"})}),e.jsx("td",{children:d("share.me")}),h.map(l=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ie,{checked:!0,disabled:!0})},l.displayName)),e.jsx("td",{})]}),a==null?void 0:a.rights.map(l=>X(l)&&e.jsxs("tr",{className:l.isBookmarkMember?"bg-light":"",children:[e.jsxs("td",{children:[l.type!=="sharebookmark"&&e.jsx(le,{alt:d("explorer.modal.share.avatar.shared.alt"),size:"xs",src:l.avatarUrl,variant:"circle"}),l.type==="sharebookmark"&&e.jsx(se,{})]}),e.jsx("td",{children:e.jsxs("div",{className:"d-flex",children:[l.type==="sharebookmark"&&e.jsx(z,{color:"tertiary",rightIcon:e.jsx(ne,{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:B,children:l.displayName}),l.type!=="sharebookmark"&&l.displayName]})}),h.map(D=>e.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:e.jsx(ie,{checked:R(l,D),onChange:()=>C(l,D.id)})},D.displayName)),e.jsx("td",{children:!l.isBookmarkMember&&e.jsx(Re,{"aria-label":"Delete",color:"tertiary",icon:e.jsx(Me,{}),type:"button",variant:"ghost",title:"Delete",onClick:()=>F(l)})})]},l.id))]})]})}),e.jsxs("div",{className:"mt-16",children:[e.jsx(z,{color:"tertiary",leftIcon:e.jsx(se,{}),rightIcon:e.jsx(ne,{title:"Show",className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:x?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>_(!x),children:d("share.save.sharebookmark")}),x&&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:N,onChange:()=>{K(()=>{var l;return((l=N.current)==null?void 0:l.value)||""})},placeholder:d("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},S)}),e.jsx(z,{type:"button",color:"primary",variant:"ghost",disabled:L.length===0,leftIcon:e.jsx(Ce,{}),onClick:()=>{A(N.current.value)},className:"text-nowrap",children:d("explorer.modal.share.sharebookmark.save")})]})})]}),e.jsx("hr",{}),e.jsxs(ee,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[e.jsx("div",{className:"me-8",children:d("explorer.modal.share.search")}),e.jsx(Le,{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(Ee,{className:"c-pointer",height:"18"})})]}),e.jsxs(Z,{className:"d-flex align-items-center",id:"search",children:[e.jsx(Te,{className:"max-w-512",noValidationIcon:!0,placeholder:Q()?d("explorer.search.adml.hint"):d("explorer.modal.share.search.placeholder"),size:"md",type:"search",onChange:J}),V()&&e.jsxs("div",{className:"d-flex align-items-center p-4",children:[e.jsx($e,{isLoading:I}),e.jsx("span",{className:"ps-4",children:d("explorer.search.pending")})]}),O()&&e.jsx("div",{className:"p-4",children:d("portal.no.result")})]}),(w==null?void 0:w.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(Fe,{options:w,hideCheckbox:!0,isMonoSelection:!0,onChange:E})}),e.jsx(ze,{radioPublicationValue:b,onRadioPublicationChange:y})]}),e.jsxs(G.Footer,{children:[e.jsx(z,{type:"button",color:"tertiary",variant:"ghost",onClick:u,children:d("explorer.cancel")}),e.jsx(z,{type:"button",color:"primary",variant:"filled",isLoading:q,onClick:U,disabled:!W(),children:d("share")})]})]}),document.getElementById("portal"))}export{es as default};
|
package/dist/TextArea.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as g,i as
|
|
1
|
+
import{r as g,i as j,j as a,F as D,x as f,a5 as A,a6 as L,E as N,v as E,a7 as T,a2 as z}from"./index.js";const F=(r,m)=>{const[,o]=g.useState(!1),i=g.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),c=e=>{e.preventDefault(),e.stopPropagation(),o(!1)};return{handleDragging:i,handleDragLeave:c,handleDrop:e=>{var d;c(e);const l=(d=e.dataTransfer)==null?void 0:d.files;m(l),r!=null&&r.current&&l&&(r.current.files=l)}}},O=F,C=g.forwardRef(({label:r,addButtonLabel:m="Add image",deleteButtonLabel:o="Delete image",src:i,className:c,app:p,onUploadImage:e,onDeleteImage:l},d)=>{const s=g.useRef(null),[n,u]=g.useState({name:"",image:i||""}),x=t=>{u({...n,name:"",image:""});const h=t==null?void 0:t[0];if(!h)return;const P={...n,name:h.name,image:URL.createObjectURL(h)};u(P),e(h)},y=()=>{var t;(t=s.current)==null||t.click()},R=()=>{s.current&&(s.current.value="");const t={...n,name:"",image:""};u(t),l()},b=t=>{x(t.target.files)},k=j("image-input",c),{handleDragging:v,handleDragLeave:w,handleDrop:I}=O(s,x);return a.jsxs(D,{id:"image-input",className:k,onDragEnter:v,onDragOver:v,onDragLeave:w,onDrop:I,ref:d,children:[a.jsxs("div",{className:"image-input-actions gap-8",children:[a.jsx(f,{"aria-label":m,color:"tertiary",icon:a.jsx(A,{}),onClick:y,type:"button",variant:"ghost"}),a.jsx(f,{"aria-label":o,color:"danger",disabled:!n.image,icon:a.jsx(L,{width:"20",height:"20"}),onClick:R,type:"button",variant:"ghost"})]}),a.jsxs(D.Label,{children:[a.jsx("span",{className:"visually-hidden",children:r}),a.jsx(N,{accept:"image/*",hidden:!0,onChange:b,ref:s,size:"sm",type:"file"}),n.image?a.jsx(E,{alt:n.name,src:n.image,size:"xl"}):a.jsx(T,{app:p,iconFit:"ratio",size:"160",variant:"rounded"})]})]})});C.displayName="ImagePicker";const q=C,$=g.forwardRef(({noValidationIcon:r,placeholder:m,size:o="md",height:i="md",className:c,...p},e)=>{const{id:l,isRequired:d,isReadOnly:s,status:n}=z(),u=j({"form-control":!s,"form-control-lg":o==="lg","form-control-sm":o==="sm","textarea-height-lg":i==="lg","textarea-height-md":i==="md","textarea-height-sm":i==="sm","is-invalid":n==="invalid","is-valid":n==="valid","form-control-plaintext":s,"no-validation-icon":r},c);return a.jsx("textarea",{ref:e,id:l,className:u,placeholder:m,required:d,readOnly:s,...p})});$.displayName="TextArea";const U=$;export{q as I,U as T};
|
package/dist/index.html
CHANGED
|
@@ -17,22 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
<!-- SET INITIALISATION CONFIG -->
|
|
19
19
|
<script>
|
|
20
|
-
var WORFLOW_ACCESS =
|
|
21
|
-
"net.atos.entng.mindmap.controllers.MindmapController|view";
|
|
20
|
+
var WORFLOW_ACCESS = "org.entcore.blog.controllers.BlogController|blog";
|
|
22
21
|
var WORKFLOW_CREATE =
|
|
23
|
-
"
|
|
24
|
-
var
|
|
25
|
-
"
|
|
26
|
-
var WORKFLOW_EXPORT_PNG =
|
|
27
|
-
"net.atos.entng.mindmap.controllers.MindmapController|exportPngMindmap";
|
|
28
|
-
var WORKFLOW_EXPORT_SVG =
|
|
29
|
-
"net.atos.entng.mindmap.controllers.MindmapController|exportSvgMindmap";
|
|
22
|
+
"org.entcore.blog.controllers.BlogController|create";
|
|
23
|
+
var WORKFLOW_CREATE_PUBLIC =
|
|
24
|
+
"org.entcore.blog.controllers.BlogController|createPublicBlog";
|
|
30
25
|
var WORKFLOW_PUBLISH =
|
|
31
|
-
"
|
|
26
|
+
"org.entcore.blog.controllers.BlogController|publish";
|
|
27
|
+
var WORKFLOW_PRINT = "org.entcore.blog.controllers.BlogController|print";
|
|
32
28
|
var odeConfig = {
|
|
33
|
-
app: "
|
|
34
|
-
types: ["
|
|
35
|
-
libraryAppFilter: "MindMap",
|
|
29
|
+
app: "blog",
|
|
30
|
+
types: ["blog"],
|
|
36
31
|
filters: [
|
|
37
32
|
{ id: "owner", defaultValue: true },
|
|
38
33
|
{ id: "public", defaultValue: false },
|
|
@@ -66,6 +61,11 @@
|
|
|
66
61
|
workflow: WORKFLOW_CREATE,
|
|
67
62
|
target: "tree",
|
|
68
63
|
},
|
|
64
|
+
{
|
|
65
|
+
id: "createPublic",
|
|
66
|
+
workflow: WORKFLOW_CREATE_PUBLIC,
|
|
67
|
+
target: "tree",
|
|
68
|
+
},
|
|
69
69
|
{
|
|
70
70
|
id: "move",
|
|
71
71
|
workflow: WORFLOW_ACCESS,
|