jamespot-react-core 1.1.111 → 1.1.113

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,22 +1,26 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[706],{9706:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>r,EditorsPortal:()=>Fe,Empty:()=>c,TwoColLayout:()=>E,WidgetList:()=>Q,WidgetWrapperCore:()=>V});var i=n(7363),l=n.n(i),o=n(3230),a=n(7375);const r=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,r]=(0,a.GF)(e.fields,e.type),{handleSubmit:c,control:s,reset:d}=(0,o.useForm)({defaultValues:Object.assign(Object.assign({},r),e.defaultValues),criteriaMode:"all"});return i.useImperativeHandle(t,(()=>({reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),d()}})),[]),i.createElement("form",{onSubmit:c(e.onSubmit),ref:n},l.map((t=>{var{Input:n}=t,l=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n}(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:s},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(s),e.buttons)})),c=()=>i.createElement(i.Fragment,null);var s=n(2248),d=n(5181),u=n(5550);const m=u.default.registry.getLazyComponent("Container"),g=u.default.registry.getLazyComponent("AppColumn"),p=u.default.registry.getLazyComponent("MainColumn");function E({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,d.useIntl)(),{pathname:r}=(0,s.useLocation)(),c=Object.values(t),[u,E]=i.useState(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.key),y=c.map((t=>Object.assign(Object.assign({},t),{label:a.formatMessage({id:t.label}),href:`/ng/rr/${e}/${t.path}`,group:t.group?a.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>r===`/ng/rr/${e}/${t.path}`));t&&E(t.key)}),[r]),i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(m,{mode:l},i.createElement(g,{mode:l,description:n,tabs:y,activeTab:u||""}),i.createElement(p,{mode:l},i.createElement(s.Outlet,null))))}var y=n(855),f=n(1773);const v=u.default.registry.getLazyComponent("Loader"),w=({name:e,uniqid:t,inplace:n})=>{const i=(0,y.useSelector)((e=>f.$L.selectors.selectWidgetState(e,t))),o=f.$L.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(v,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},h=u.default.registry.getLazyComponent("WidgetArticleButton"),C=u.default.registry.getLazyComponent("WidgetArticleGallery"),b=u.default.registry.getLazyComponent("WidgetArticleAttachment"),x=u.default.registry.getLazyComponent("WidgetArticleImage"),L=u.default.registry.getLazyComponent("WidgetArticleTitle"),q=u.default.registry.getLazyComponent("WidgetArticleText"),T=({widget:e,width:t,inplace:n=!1,isComponentVisible:i=!1,mode:o="view",onClick:a})=>{const r=(0,y.useDispatch)(),{name:c,uniqid:s}=e,d=(0,y.useSelector)(f.$L.selectors.selectToken),u=(e,t)=>r(f.$L.slice.actions.updateWidget({uniqid:s,content:e,override:t})),m=e=>r(f.$L.slice.actions.setWidgetState(Object.assign({uniqid:s},e)));switch(c){default:return l().createElement(l().Fragment,null,"cannot display widget (",c,")");case f.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(h,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case f.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(C,{width:t,token:d,isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case f.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(b,{token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m});case f.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(x,{width:null!=t?t:800,token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case f.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(L,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case f.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(q,{content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m})}};var W=n(3904),I=n(6754),$=n.n(I);const k={"widget-article-image":{accept:"image/png, image/jpeg, image/jpg",multiple:!1,label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description"},"widget-article-gallery":{accept:"image/png, image/jpeg, image/jpg",multiple:!0,label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"},"widget-article-attachment":{accept:"*",multiple:!0,label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"}};var S=n(6),_=n(997);const A=u.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),D=({uniqid:e,initialFiles:t,accept:n,label:i,description:o,multiple:a,token:r,allowAutoOpening:c,onChange:s})=>{const d=(0,y.useDispatch)(),u=(0,y.useSelector)((t=>t.widgets.currentEditableWidgetId===e),y.shallowEqual),m=l().useRef(null),[g,p]=l().useState(0),[E,v]=l().useState(0),[w,h]=l().useState(null!=t?t:[]);return l().useEffect((()=>{g===E&&d(f.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}),[g]),l().useEffect((()=>{s(w.map((e=>e)))}),[w]),l().useEffect((()=>{var t;u&&c&&(null===(t=m.current)||void 0===t||t.click(),d(f.$L.slice.actions.setWidgetState({uniqid:e,mounted:!0})))}),[u]),l().createElement(l().Fragment,null,l().createElement(_.JRCWidgetEmptyInplace,{url:"widget-article-image-placeholder.png",label:i,description:o,onClick:()=>{var e;u&&(null===(e=m.current)||void 0===e||e.click())}}),l().createElement("div",{style:{height:0,width:0,overflow:"hidden"}},l().createElement(A,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:n,multiple:a,token:r,onUploadStart:t=>{void 0!==t&&v((e=>e+t)),d(f.$L.slice.actions.setWidgetState({uniqid:e,loading:!0}))},onUploadSuccess:t=>{p((e=>e+1)),void 0!==t&&h((e=>[...e,(0,S.apiFileToWidgetFile)(t)])),a||d(f.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}})))},F=$().div`
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[706],{9706:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>u,EditorsPortal:()=>Ge,Empty:()=>m,TwoColLayout:()=>h,WidgetList:()=>ee,WidgetWrapperCore:()=>J});var i=n(7363),l=n.n(i),o=n(3230),a=n(7375),r=n(6754),c=n.n(r);const s=c().form`
2
+ ${e=>e.stretch&&"\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n "}
3
+ `,d=c().div`
4
+ ${e=>e.stretch&&"\n flex: 1;\n"}
5
+ `,u=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,r]=(0,a.GF)(e.fields,e.type),{handleSubmit:c,control:u,reset:m}=(0,o.useForm)({defaultValues:Object.assign(Object.assign({},r),e.defaultValues),criteriaMode:"all"});return i.useImperativeHandle(t,(()=>({reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),m()}})),[]),i.createElement(s,{stretch:e.stretch,onSubmit:c(e.onSubmit),ref:n},i.createElement(d,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n}(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:u},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(u)),e.buttons)})),m=()=>i.createElement(i.Fragment,null);var g=n(2248),p=n(5181),E=n(8804);const f=E.default.registry.getLazyComponent("Container"),y=E.default.registry.getLazyComponent("AppColumn"),v=E.default.registry.getLazyComponent("MainColumn");function h({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,p.useIntl)(),{pathname:r}=(0,g.useLocation)(),c=Object.values(t),[s,d]=i.useState(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.key),u=c.map((t=>Object.assign(Object.assign({},t),{label:a.formatMessage({id:t.label}),href:`/ng/rr/${e}/${t.path}`,group:t.group?a.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>r===`/ng/rr/${e}/${t.path}`));t&&d(t.key)}),[r]),i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(f,{mode:l},i.createElement(y,{mode:l,description:n,tabs:u,activeTab:s||""}),i.createElement(v,{mode:l},i.createElement(g.Outlet,null))))}var w=n(855),x=n(1773);const C=E.default.registry.getLazyComponent("Loader"),b=({name:e,uniqid:t,inplace:n})=>{const i=(0,w.useSelector)((e=>x.$L.selectors.selectWidgetState(e,t))),o=x.$L.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(C,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},L=E.default.registry.getLazyComponent("WidgetArticleButton"),q=E.default.registry.getLazyComponent("WidgetArticleGallery"),T=E.default.registry.getLazyComponent("WidgetArticleAttachment"),W=E.default.registry.getLazyComponent("WidgetArticleImage"),$=E.default.registry.getLazyComponent("WidgetArticleTitle"),I=E.default.registry.getLazyComponent("WidgetArticleText"),k=({widget:e,width:t,inplace:n=!1,isComponentVisible:i=!1,mode:o="view",onClick:a})=>{const r=(0,w.useDispatch)(),{name:c,uniqid:s}=e,d=(0,w.useSelector)(x.$L.selectors.selectToken),u=(e,t)=>r(x.$L.slice.actions.updateWidget({uniqid:s,content:e,override:t})),m=e=>r(x.$L.slice.actions.setWidgetState(Object.assign({uniqid:s},e)));switch(c){default:return l().createElement(l().Fragment,null,"cannot display widget (",c,")");case x.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(L,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(q,{width:t,token:d,isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(T,{token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(W,{width:null!=t?t:800,token:d,content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onClick:a,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement($,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(I,{content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m})}};var S=n(3904);const _={"widget-article-image":{accept:"image/png, image/jpeg, image/jpg",multiple:!1,label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description"},"widget-article-gallery":{accept:"image/png, image/jpeg, image/jpg",multiple:!0,label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"},"widget-article-attachment":{accept:"*",multiple:!0,label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description"}};var A=n(6),D=n(997);const F=E.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),R=({uniqid:e,initialFiles:t,accept:n,label:i,description:o,multiple:a,token:r,allowAutoOpening:c,onChange:s})=>{const d=(0,w.useDispatch)(),u=(0,w.useSelector)((t=>t.widgets.currentEditableWidgetId===e),w.shallowEqual),m=l().useRef(null),[g,p]=l().useState(0),[E,f]=l().useState(0),[y,v]=l().useState(null!=t?t:[]);return l().useEffect((()=>{g===E&&d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}),[g]),l().useEffect((()=>{s(y.map((e=>e)))}),[y]),l().useEffect((()=>{var t;u&&c&&(null===(t=m.current)||void 0===t||t.click(),d(x.$L.slice.actions.setWidgetState({uniqid:e,mounted:!0})))}),[u]),l().createElement(l().Fragment,null,l().createElement(D.JRCWidgetEmptyInplace,{url:"widget-article-image-placeholder.png",label:i,description:o,onClick:()=>{var e;u&&(null===(e=m.current)||void 0===e||e.click())}}),l().createElement("div",{style:{height:0,width:0,overflow:"hidden"}},l().createElement(F,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:n,multiple:a,token:r,onUploadStart:t=>{void 0!==t&&f((e=>e+t)),d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!0}))},onUploadSuccess:t=>{p((e=>e+1)),void 0!==t&&v((e=>[...e,(0,A.apiFileToWidgetFile)(t)])),a||d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}})))},G=c().div`
2
6
  position: relative;
3
7
  inset: 0;
4
8
  display: flex;
5
9
  flex: 1;
6
10
  min-height: 180px;
7
- `,R=({uniqid:e,mode:t})=>{var n;const i=(0,y.useDispatch)(),o=(0,y.useSelector)((t=>f.$L.selectors.selectWidget(t,e))),a=(0,y.useSelector)((t=>t.widgets.currentEditableWidgetId===e),y.shallowEqual),r=(0,y.useSelector)(f.$L.selectors.selectToken);if(l().useEffect((()=>{a&&(null==o?void 0:o.widget.name)&&(i(f.Wq.slice.actions.flushAllEditor()),i(f.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name})))}),[a]),void 0===o)return l().createElement(l().Fragment,null);const c=k&&k[null==o?void 0:o.widget.name]?k[null==o?void 0:o.widget.name].label:"",s=k&&k[null==o?void 0:o.widget.name]?k[null==o?void 0:o.widget.name].description:"",d=k&&k[null==o?void 0:o.widget.name]?k[null==o?void 0:o.widget.name].accept:"",u=!(!k||!k[null==o?void 0:o.widget.name])&&k[null==o?void 0:o.widget.name].multiple;switch(null==o?void 0:o.widget.name){case"widget-article-gallery":const a=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==a?void 0:a.length)?24:0}},l().createElement(F,null,l().createElement(D,{label:c,description:s,initialFiles:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==a?void 0:a.length),onChange:t=>{Array.isArray(t)&&t.forEach((t=>{i(f.$L.slice.actions.updateWidget({uniqid:e,content:{files:a?[...a,t]:[t]}}))}))}}))):l().createElement(l().Fragment,null);case"widget-article-attachment":const m=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==m?void 0:m.length)?24:0}},l().createElement(F,null,l().createElement(D,{label:c,description:s,initialFiles:null!=m?m:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==m?void 0:m.length),onChange:t=>{Array.isArray(t)&&i(f.$L.slice.actions.updateWidget({uniqid:e,content:{files:t}}))}}))):l().createElement(l().Fragment,null);case"widget-article-image":return void 0===r||"edit"!==t||o.widget.content.file?l().createElement("div",{style:{position:"absolute",inset:0},onClick:()=>{i(f.Wq.slice.actions.flushAllEditor()),i(f.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name}))}}):l().createElement(l().Fragment,null,l().createElement(F,null,l().createElement(D,{label:c,description:s,initialFiles:null!==(n=o.widget.content.file)&&void 0!==n?n:[],accept:d,multiple:!1,uniqid:e,token:r,allowAutoOpening:!o.widget.content.file,onChange:t=>{t&&t[0]&&i(f.$L.slice.actions.updateWidget({uniqid:e,content:{file:t[0]}}))}})))}return l().createElement(l().Fragment,null)},G=$().div`
11
+ `,O=({uniqid:e,mode:t})=>{var n;const i=(0,w.useDispatch)(),o=(0,w.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),a=(0,w.useSelector)((t=>t.widgets.currentEditableWidgetId===e),w.shallowEqual),r=(0,w.useSelector)(x.$L.selectors.selectToken);if(l().useEffect((()=>{a&&(null==o?void 0:o.widget.name)&&(i(x.Wq.slice.actions.flushAllEditor()),i(x.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name})))}),[a]),void 0===o)return l().createElement(l().Fragment,null);const c=_&&_[null==o?void 0:o.widget.name]?_[null==o?void 0:o.widget.name].label:"",s=_&&_[null==o?void 0:o.widget.name]?_[null==o?void 0:o.widget.name].description:"",d=_&&_[null==o?void 0:o.widget.name]?_[null==o?void 0:o.widget.name].accept:"",u=!(!_||!_[null==o?void 0:o.widget.name])&&_[null==o?void 0:o.widget.name].multiple;switch(null==o?void 0:o.widget.name){case"widget-article-gallery":const a=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==a?void 0:a.length)?24:0}},l().createElement(G,null,l().createElement(R,{label:c,description:s,initialFiles:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==a?void 0:a.length),onChange:t=>{Array.isArray(t)&&t.forEach((t=>{i(x.$L.slice.actions.updateWidget({uniqid:e,content:{files:a?[...a,t]:[t]}}))}))}}))):l().createElement(l().Fragment,null);case"widget-article-attachment":const m=o.widget.content.files;return void 0!==r&&"edit"===t?l().createElement("div",{style:{marginTop:(null==m?void 0:m.length)?24:0}},l().createElement(G,null,l().createElement(R,{label:c,description:s,initialFiles:null!=m?m:[],accept:d,multiple:u,uniqid:e,token:r,allowAutoOpening:!(null==m?void 0:m.length),onChange:t=>{Array.isArray(t)&&i(x.$L.slice.actions.updateWidget({uniqid:e,content:{files:t}}))}}))):l().createElement(l().Fragment,null);case"widget-article-image":return void 0===r||"edit"!==t||o.widget.content.file?l().createElement("div",{style:{position:"absolute",inset:0},onClick:()=>{i(x.Wq.slice.actions.flushAllEditor()),i(x.Wq.slice.actions.registerEditor({uniqid:e,name:null==o?void 0:o.widget.name}))}}):l().createElement(l().Fragment,null,l().createElement(G,null,l().createElement(R,{label:c,description:s,initialFiles:null!==(n=o.widget.content.file)&&void 0!==n?n:[],accept:d,multiple:!1,uniqid:e,token:r,allowAutoOpening:!o.widget.content.file,onChange:t=>{t&&t[0]&&i(x.$L.slice.actions.updateWidget({uniqid:e,content:{file:t[0]}}))}})))}return l().createElement(l().Fragment,null)},j=c().div`
8
12
  position: absolute;
9
13
  inset: 0;
10
14
  opacity: ${e=>e.opacity};
11
15
  background-color: ${e=>e.backgroundColor};
12
16
  pointer-events: ${e=>e.pointerEvents};
13
- `,O=({uniqid:e,mode:t})=>{const n=(0,y.useSelector)((t=>t.widgets.ids[e].widget.layers),y.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(j,{uniqid:e,key:t,mode:"edit"}))))},j=({uniqid:e,mode:t})=>{const n=(0,y.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(G,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(z,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(G,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(z,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},z=({uniqid:e,layerId:t,mode:n})=>{const i=(0,y.useDispatch)(),o=(0,y.useSelector)((t=>t.widgets.ids[e]),y.shallowEqual),a=(0,y.useSelector)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(B,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(M,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(f.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(_.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(f.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(B,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},M=({position:e,children:t,onMouseUp:n})=>{const[i,o]=l().useState(!1),[a,r]=l().useState({x:0,y:0}),[c,s]=l().useState({x:0,y:0}),[d,u]=l().useState({x:e.x,y:e.y}),m=l().useRef(null),g=l().useCallback((e=>{if(i&&m.current){const t=c.x+(e.clientX-a.x),n=c.y+(e.clientY-a.y);u({x:t,y:n})}}),[i]),p=()=>{o(!1),n({x:d.x,y:d.y})};return l().useEffect((()=>(document.addEventListener("mousemove",g),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p)})),[g]),l().createElement("div",{style:{position:"absolute",top:d.y,left:d.x},ref:m,onMouseDown:e=>{o(!0),m.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),s({x:d.x,y:d.y}))}},t)},V=({uniqid:e,widget:t,inplace:n=!0,mode:i,width:o})=>{const a=(0,y.useDispatch)(),r=(0,y.useSelector)((t=>f.$L.selectors.selectWidget(t,e))),c=(0,y.useSelector)((t=>{var n;return null===(n=f.$L.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.busy}),y.shallowEqual),s=(0,y.useSelector)((t=>t.widgets.editableMap[e]),y.shallowEqual),d=(0,y.useSelector)((e=>e.widgets.currentEditableWidgetId),y.shallowEqual),u=(0,y.useSelector)((t=>t.widgets.currentEditableWidgetId===e),y.shallowEqual),{ref:m,isComponentVisible:g,setIsComponentVisible:p}=(0,W.I)(!1);if(l().useEffect((()=>{t&&a(f.$L.slice.actions.registerWidget({uniqid:e,widget:t}))}),[]),l().useEffect((()=>{g||e===d&&a(f.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[g]),l().useEffect((()=>{g!==u&&p(u)}),[u]),void 0===r)return l().createElement(l().Fragment,null,"This widget cannot be desplayed");const E=()=>{"edit"===i?v():"widget-article-button"===r.widget.name&&"link"===r.widget.content.openingType&&r.widget.content.openingTypeLink&&window.open(r.widget.content.openingTypeLink.url,r.widget.content.openingTypeLink.target)},v=()=>{if("view"===i)return;const{widget:e}=r;a(f.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return n&&"view"!==i?l().createElement("div",{style:{minWidth:void 0!==o?o:"100%"},ref:m,onClick:()=>{p(!0),s&&(a(f.$L.slice.actions.setEditableIndex({index:s.index})),a(f.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(T,{width:o,widget:r.widget,inplace:n,isComponentVisible:!!(g||c||u),mode:i,onClick:E}),l().createElement(R,{uniqid:e,mode:i}),l().createElement(O,{uniqid:e,mode:i}),l().createElement(w,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n})):l().createElement("div",{style:{flex:1,display:"flex",minWidth:void 0!==o?o:"100%"},onClick:v},l().createElement(T,{widget:r.widget,isComponentVisible:!1,inplace:n,mode:i,width:o,onClick:E}),l().createElement(O,{uniqid:e,mode:i}),l().createElement(w,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n}))},B=V,J=$().div`
17
+ `,z=({uniqid:e,mode:t})=>{const n=(0,w.useSelector)((t=>t.widgets.ids[e].widget.layers),w.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(M,{uniqid:e,key:t,mode:"edit"}))))},M=({uniqid:e,mode:t})=>{const n=(0,w.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(j,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(V,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(j,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(V,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},V=({uniqid:e,layerId:t,mode:n})=>{const i=(0,w.useDispatch)(),o=(0,w.useSelector)((t=>t.widgets.ids[e]),w.shallowEqual),a=(0,w.useSelector)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(N,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(B,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(x.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(D.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(x.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(N,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},B=({position:e,children:t,onMouseUp:n})=>{const[i,o]=l().useState(!1),[a,r]=l().useState({x:0,y:0}),[c,s]=l().useState({x:0,y:0}),[d,u]=l().useState({x:e.x,y:e.y}),m=l().useRef(null),g=l().useCallback((e=>{if(i&&m.current){const t=c.x+(e.clientX-a.x),n=c.y+(e.clientY-a.y);u({x:t,y:n})}}),[i]),p=()=>{o(!1),n({x:d.x,y:d.y})};return l().useEffect((()=>(document.addEventListener("mousemove",g),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p)})),[g]),l().createElement("div",{style:{position:"absolute",top:d.y,left:d.x},ref:m,onMouseDown:e=>{o(!0),m.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),s({x:d.x,y:d.y}))}},t)},J=({uniqid:e,widget:t,inplace:n=!0,mode:i,width:o})=>{const a=(0,w.useDispatch)(),r=(0,w.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),c=(0,w.useSelector)((t=>{var n;return null===(n=x.$L.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.busy}),w.shallowEqual),s=(0,w.useSelector)((t=>t.widgets.editableMap[e]),w.shallowEqual),d=(0,w.useSelector)((e=>e.widgets.currentEditableWidgetId),w.shallowEqual),u=(0,w.useSelector)((t=>t.widgets.currentEditableWidgetId===e),w.shallowEqual),{ref:m,isComponentVisible:g,setIsComponentVisible:p}=(0,S.I)(!1);if(l().useEffect((()=>{t&&a(x.$L.slice.actions.registerWidget({uniqid:e,widget:t}))}),[]),l().useEffect((()=>{g||e===d&&a(x.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[g]),l().useEffect((()=>{g!==u&&p(u)}),[u]),void 0===r)return l().createElement(l().Fragment,null,"This widget cannot be desplayed");const E=()=>{"edit"===i?f():"widget-article-button"===r.widget.name&&"link"===r.widget.content.openingType&&r.widget.content.openingTypeLink&&window.open(r.widget.content.openingTypeLink.url,r.widget.content.openingTypeLink.target)},f=()=>{if("view"===i)return;const{widget:e}=r;a(x.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return n&&"view"!==i?l().createElement("div",{style:{minWidth:void 0!==o?o:"100%"},ref:m,onClick:()=>{p(!0),s&&(a(x.$L.slice.actions.setEditableIndex({index:s.index})),a(x.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(k,{width:o,widget:r.widget,inplace:n,isComponentVisible:!!(g||c||u),mode:i,onClick:E}),l().createElement(O,{uniqid:e,mode:i}),l().createElement(z,{uniqid:e,mode:i}),l().createElement(b,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n})):l().createElement("div",{style:{flex:1,display:"flex",minWidth:void 0!==o?o:"100%"},onClick:f},l().createElement(k,{widget:r.widget,isComponentVisible:!1,inplace:n,mode:i,width:o,onClick:E}),l().createElement(z,{uniqid:e,mode:i}),l().createElement(b,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n}))},N=J,P=c().div`
14
18
  display: flex;
15
19
  flex-direction: row;
16
20
  flex-wrap: wrap;
17
21
  gap: 10px;
18
22
  justify-content: center;
19
- `,N=$().div`
23
+ `,U=c().div`
20
24
  border: 1px solid ${e=>e.theme.color.grey2};
21
25
  border-radius: 8px;
22
26
  cursor: pointer;
@@ -41,7 +45,7 @@
41
45
  opacity: 1;
42
46
  }
43
47
  }
44
- `,P=$().div`
48
+ `,H=c().div`
45
49
  border: 2px solid ${e=>e.theme.color.primary};
46
50
  height: ${e=>e.open?"320":"54"}px;
47
51
  border-radius: 8px;
@@ -51,20 +55,20 @@
51
55
  transition: height 0.4s;
52
56
  overflow: hidden;
53
57
  flex-direction: column;
54
- `,U=$().div`
58
+ `,X=c().div`
55
59
  display: flex;
56
60
  flex-direction: row;
57
61
  flex-wrap: wrap;
58
62
  justify-content: center;
59
63
  gap: 10px;
60
- `,H=$().div`
64
+ `,Y=c().div`
61
65
  min-height: 50px;
62
66
  display: flex;
63
67
  justify-content: center;
64
68
  align-items: center;
65
69
  cursor: pointer;
66
70
  color: ${e=>e.theme.color.primary};
67
- `,X=$().button`
71
+ `,K=c().button`
68
72
  height: 72px;
69
73
  display: flex;
70
74
  justify-content: center;
@@ -74,11 +78,11 @@
74
78
  border-radius: 8px;
75
79
  transition: opacity 0.4s ease ${e=>40*e.index}ms;
76
80
  opacity: ${e=>e.open?1:0};
77
- `,Y=u.default.registry.getLazyComponent("Button"),K=u.default.registry.getLazyComponent("Modal"),Q=({mode:e,children:t,namespace:n="default",onChange:i})=>{const[o,a]=l().useState(!1),r=function(e){return"widget-article-image"===e?[f.$L.definition(f.$L.const.WIDGET_ARTICLE_TITLE),f.$L.definition(f.$L.const.WIDGET_ARTICLE_BUTTON)]:[f.$L.definition(f.$L.const.WIDGET_ARTICLE_TITLE),f.$L.definition(f.$L.const.WIDGET_ARTICLE_TEXT),f.$L.definition(f.$L.const.WIDGET_ARTICLE_IMAGE),f.$L.definition(f.$L.const.WIDGET_ARTICLE_BUTTON),f.$L.definition(f.$L.const.WIDGET_ARTICLE_GALLERY),f.$L.definition(f.$L.const.WIDGET_ARTICLE_ATTACHMENT)]}(n),c=(0,d.useIntl)(),s={open:o,title:"widget builder",showIconClose:!0,portalId:"react-modal",isFullHeight:!0,closeHandler:()=>a(!1)},u=e=>{i(f.$L.factory(e)),a(!1)};return l().createElement(l().Fragment,null,l().createElement(K,Object.assign({},s),l().createElement(J,null,r.map(((e,t)=>l().createElement(N,{key:t,onClick:()=>u(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label}))))))),"custom"===e&&t?l().createElement("div",{onClick:()=>a(!0)},t):l().createElement(l().Fragment,null),"button"===e?l().createElement(Y,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},c.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e?l().createElement(J,null,r.map(((e,t)=>l().createElement(N,{key:t,onClick:()=>u(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e?l().createElement(Z,{widgets:r,onClick:u}):l().createElement(l().Fragment,null))},Z=({widgets:e,onClick:t})=>{const[n,i]=l().useState(!1),o=(0,d.useIntl)();return l().createElement(l().Fragment,null,l().createElement(P,{open:n},l().createElement(H,{onClick:()=>i(!n)},o.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(U,null,e.map(((e,i)=>l().createElement(X,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},o.formatMessage({id:e.label})))))))},ee=($().div`
81
+ `,Q=E.default.registry.getLazyComponent("Button"),Z=E.default.registry.getLazyComponent("Modal"),ee=({mode:e,children:t,namespace:n="default",onChange:i})=>{const[o,a]=l().useState(!1),r=function(e){return"widget-article-image"===e?[x.$L.definition(x.$L.const.WIDGET_ARTICLE_TITLE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_BUTTON)]:[x.$L.definition(x.$L.const.WIDGET_ARTICLE_TITLE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_TEXT),x.$L.definition(x.$L.const.WIDGET_ARTICLE_IMAGE),x.$L.definition(x.$L.const.WIDGET_ARTICLE_BUTTON),x.$L.definition(x.$L.const.WIDGET_ARTICLE_GALLERY),x.$L.definition(x.$L.const.WIDGET_ARTICLE_ATTACHMENT)]}(n),c=(0,p.useIntl)(),s={open:o,title:"widget builder",showIconClose:!0,portalId:"react-modal",isFullHeight:!0,closeHandler:()=>a(!1)},d=e=>{i(x.$L.factory(e)),a(!1)};return l().createElement(l().Fragment,null,l().createElement(Z,Object.assign({},s),l().createElement(P,null,r.map(((e,t)=>l().createElement(U,{key:t,onClick:()=>d(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label}))))))),"custom"===e&&t?l().createElement("div",{onClick:()=>a(!0)},t):l().createElement(l().Fragment,null),"button"===e?l().createElement(Q,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},c.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e?l().createElement(P,null,r.map(((e,t)=>l().createElement(U,{key:t,onClick:()=>d(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},c.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e?l().createElement(te,{widgets:r,onClick:d}):l().createElement(l().Fragment,null))},te=({widgets:e,onClick:t})=>{const[n,i]=l().useState(!1),o=(0,p.useIntl)();return l().createElement(l().Fragment,null,l().createElement(H,{open:n},l().createElement(Y,{onClick:()=>i(!n)},o.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(X,null,e.map(((e,i)=>l().createElement(K,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},o.formatMessage({id:e.label})))))))},ne=(c().div`
78
82
  margin-bottom: 24px;
79
- `,$().div`
83
+ `,c().div`
80
84
  margin-bottom: 4px;
81
- `,$().div`
85
+ `,c().div`
82
86
  position: absolute;
83
87
  background-color: ${e=>e.on?"rgba(0,0,0,.1)":"transparent"};
84
88
  inset: 0;
@@ -86,22 +90,22 @@
86
90
  flex: 1;
87
91
  display: flex;
88
92
  overflow: hidden;
89
- `),te=$().div`
93
+ `),ie=c().div`
90
94
  flex-direction: row;
91
95
  display: flex;
92
96
  min-height: 60px;
93
97
  border-bottom: 1px solid ${e=>e.theme.color.grey2};
94
- `,ne=$().div`
98
+ `,le=c().div`
95
99
  width: 60px;
96
100
  display: flex;
97
101
  align-items: center;
98
102
  justify-content: center;
99
- `,ie=$().div`
103
+ `,oe=c().div`
100
104
  flex: 1;
101
105
  display: flex;
102
106
  align-items: center;
103
107
  justify-content: center;
104
- `,le=$().div`
108
+ `,ae=c().div`
105
109
  position: absolute;
106
110
  top: 90px;
107
111
  right: ${e=>e.visible?"0":"-1000"}px;
@@ -112,19 +116,19 @@
112
116
  flex-direction: row;
113
117
  transition: all 0.4s;
114
118
  box-shadow: -1px 1px 10px 0px rgb(0 0 0 / 20%);
115
- `,oe=$().div`
119
+ `,re=c().div`
116
120
  flex: 1;
117
121
  display: flex;
118
122
  flex-direction: row;
119
123
  padding: 12px;
120
124
  overflow: auto;
121
- `,ae=$().div`
125
+ `,ce=c().div`
122
126
  width: ${50}px;
123
127
  padding-top: 60px;
124
128
  display: flex;
125
129
  flex-direction: column;
126
130
  border-right: 1px solid ${e=>e.theme.color.grey2};
127
- `,re=$().button`
131
+ `,se=c().button`
128
132
  border-radius: 4px;
129
133
  cursor: pointer;
130
134
  height: 42px;
@@ -137,7 +141,7 @@
137
141
  &:hover {
138
142
  background-color: ${e=>e.theme.color.grey1};
139
143
  }
140
- `,ce=($().div`
144
+ `,de=(c().div`
141
145
  display: flex;
142
146
  border: 1px solid ${e=>e.theme.color.grey1};
143
147
  border-radius: ${8}px;
@@ -148,47 +152,47 @@
148
152
  height: ${50}px;
149
153
  margin: 0;
150
154
  }
151
- `,$().div`
155
+ `,c().div`
152
156
  display: flex;
153
157
  flex-direction: row;
154
158
  padding: 12px;
155
159
  background-color: ${e=>e.theme.color.grey0};
156
160
  border-radius: 8px;
157
161
  margin-bottom: 4px;
158
- `),se=$().div`
162
+ `),ue=c().div`
159
163
  display: flex;
160
164
  flex: 1;
161
165
  align-items: center;
162
- `,de=$().div`
166
+ `,me=c().div`
163
167
  width: 40px;
164
168
  display: flex;
165
169
  justify-content: center;
166
170
  align-items: center;
167
- `,ue=($().div`
171
+ `,ge=(c().div`
168
172
  flex-direction: row;
169
173
  display: flex;
170
174
  align-items: center;
171
- `,$().div`
175
+ `,c().div`
172
176
  flex: 1;
173
177
  display: flex;
174
178
  align-items: center;
175
- `,({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,y.useSelector)((t=>f.Wq.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(te,null,l().createElement(ne,null),l().createElement(ie,null,"Popup"),l().createElement(ne,null,l().createElement(re,{onClick:()=>{t(f.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(_.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(te,null,l().createElement(_.JRCButton,{onClick:()=>{t(f.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),me=u.default.registry.getLazyComponent("WidgetArticleTitleEditor"),ge=u.default.registry.getLazyComponent("WidgetArticleImageEditor"),pe=u.default.registry.getLazyComponent("WidgetArticleTextEditor"),Ee=u.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),ye=u.default.registry.getLazyComponent("WidgetArticleButtonEditor"),fe=u.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),ve=({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,y.useSelector)(f.$L.selectors.selectToken),i=(0,y.useSelector)((t=>f.$L.selectors.selectWidget(t,e))),o=n=>{i&&t(f.$L.slice.actions.updateWidget({uniqid:e,content:n})),t(f.Wq.slice.actions.flushEditor({uniqid:e}))},a=(n,i)=>t(f.$L.slice.actions.updateWidget({uniqid:e,content:n,override:i})),r=(n,i)=>{t(void 0!==i?f.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},n)):f.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},n)))},c=n=>{t(f.Wq.slice.actions.registerEditorPopup({uniqid:e,view:n}))};switch(null==i?void 0:i.widget.name){default:return l().createElement(l().Fragment,null,"cannot display editor");case f.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(ye,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case f.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(fe,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case f.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(Ee,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case f.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(pe,{onChange:a,onSave:o,content:i.widget.content});case f.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(ge,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case f.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(me,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},we=({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,d.useIntl)(),i=(0,y.useSelector)((t=>f.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(he,{uniqid:e}),i&&i.widgets?i.widgets.map(((o,a)=>{const r=f.$L.definition(o.widget.name);return l().createElement("div",{key:a},l().createElement(ce,null,l().createElement(se,{onClick:()=>((e,n)=>{t(f.Wq.slice.actions.registerEditor({uniqid:e,name:n}))})(o.widget.uniqid,o.widget.name)},n.formatMessage({id:r.label})),l().createElement(de,{onClick:()=>{i.widgets&&t(f.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},i),{widgets:[...i.widgets.filter(((e,t)=>t!==a))]})}))}},l().createElement(_.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},he=({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,y.useSelector)((t=>t.widgets.ids[e].widget.layers),y.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(_.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(Le,{uniqid:e,key:t}),elms:n||[]}),l().createElement(Q,{namespace:"default",onChange:n=>{t(f.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Ce=({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,y.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(f.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(_.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},be=({uniqid:e})=>{const t=(0,y.useDispatch)(),n=(0,y.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(f.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(_.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},xe=({uniqid:e,layerId:t})=>{const n=(0,y.useDispatch)();return l().createElement("div",{onClick:()=>{n(f.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(_.JRCIcon,{name:"icon-trash"}))},Le=({uniqid:e})=>{const t=(0,y.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=f.$L.definition(n.widget.name);return l().createElement("div",{style:{flexDirection:"row",display:"flex"},key:i},l().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),l().createElement(Ce,{uniqid:e}),l().createElement(be,{uniqid:e}),l().createElement(xe,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},qe=u.default.registry.getLazyComponent("Button"),Te=({uniqid:e})=>{const t=(0,d.useIntl)(),n=(0,y.useDispatch)(),i=(0,y.useSelector)((t=>f.$L.selectors.selectWidget(t,e))),[a,r]=l().useState(null==i?void 0:i.title),{control:c,watch:s}=(0,o.useForm)({defaultValues:{text:null!=a?a:""},criteriaMode:"all"});return l().useEffect((()=>{const e=s((e=>{r(e.text)}));return()=>e.unsubscribe()}),[s]),i?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(_.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement(qe,{onClick:()=>{void 0!==a&&(n(f.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:a})),n(f.Wq.slice.actions.flushEditor({uniqid:e})))},variant:"outlined",minWidth:"100%"},t.formatMessage({id:"EDITOR_Save_Widget"}))):l().createElement(l().Fragment,null,"No wrapper")},We=u.default.registry.getLazyComponent("Icon"),Ie=({uniqid:e})=>{const t=(0,d.useIntl)(),n=(0,y.useDispatch)(),i=(0,y.useSelector)((t=>f.Wq.selectors.selectEditor(t,e))),o=f.$L.definition(null==i?void 0:i.name),[a,r]=l().useState(!1),[c,s]=l().useState("default");return l().useEffect((()=>{setTimeout((()=>{r(!0)}),0)})),i?l().createElement("div",{style:{width:440,position:"relative"}},l().createElement(le,{visible:a},l().createElement(ae,null,o.panel.useWrapper?l().createElement(re,{on:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(We,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(re,{on:"default"===c,onClick:()=>s("default")},l().createElement(We,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(ke,{uniqid:e},l().createElement(re,{on:"widgets"===c,onClick:()=>s("widgets")},l().createElement(We,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(te,null,l().createElement($e,{uniqid:e,position:i.position}),l().createElement(ie,null,t.formatMessage({id:o.label})),l().createElement(ne,null,l().createElement(re,{onClick:()=>{n(f.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(We,{name:"icon-times",color:"grey2"})))),l().createElement(oe,null,"default"===c&&o.panel.useEditor?l().createElement(ve,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement(Te,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&o.panel.useWidgets?l().createElement(we,{uniqid:e,namespace:o.name}):l().createElement(l().Fragment,null)))),(null==i?void 0:i.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},$e=({uniqid:e,position:t})=>{const n=(0,y.useDispatch)();return l().createElement(ne,null,l().createElement(re,{onClick:()=>{n(f.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(We,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},ke=({uniqid:e,children:t})=>{const n=(0,y.useSelector)((t=>f.$L.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},Se=$().div`
179
+ `,({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,w.useSelector)((t=>x.Wq.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(ie,null,l().createElement(le,null),l().createElement(oe,null,"Popup"),l().createElement(le,null,l().createElement(se,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(D.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ie,null,l().createElement(D.JRCButton,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),pe=E.default.registry.getLazyComponent("WidgetArticleTitleEditor"),Ee=E.default.registry.getLazyComponent("WidgetArticleImageEditor"),fe=E.default.registry.getLazyComponent("WidgetArticleTextEditor"),ye=E.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),ve=E.default.registry.getLazyComponent("WidgetArticleButtonEditor"),he=E.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),we=({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,w.useSelector)(x.$L.selectors.selectToken),i=(0,w.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),o=n=>{i&&t(x.$L.slice.actions.updateWidget({uniqid:e,content:n})),t(x.Wq.slice.actions.flushEditor({uniqid:e}))},a=(n,i)=>t(x.$L.slice.actions.updateWidget({uniqid:e,content:n,override:i})),r=(n,i)=>{t(void 0!==i?x.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},n)):x.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},n)))},c=n=>{t(x.Wq.slice.actions.registerEditorPopup({uniqid:e,view:n}))};switch(null==i?void 0:i.widget.name){default:return l().createElement(l().Fragment,null,"cannot display editor");case x.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(ve,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(he,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case x.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(ye,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(fe,{onChange:a,onSave:o,content:i.widget.content});case x.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(Ee,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(pe,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},xe=({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,p.useIntl)(),i=(0,w.useSelector)((t=>x.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(Ce,{uniqid:e}),i&&i.widgets?i.widgets.map(((o,a)=>{const r=x.$L.definition(o.widget.name);return l().createElement("div",{key:a},l().createElement(de,null,l().createElement(ue,{onClick:()=>((e,n)=>{t(x.Wq.slice.actions.registerEditor({uniqid:e,name:n}))})(o.widget.uniqid,o.widget.name)},n.formatMessage({id:r.label})),l().createElement(me,{onClick:()=>{i.widgets&&t(x.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},i),{widgets:[...i.widgets.filter(((e,t)=>t!==a))]})}))}},l().createElement(D.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Ce=({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,w.useSelector)((t=>t.widgets.ids[e].widget.layers),w.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(D.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(Te,{uniqid:e,key:t}),elms:n||[]}),l().createElement(ee,{namespace:"default",onChange:n=>{t(x.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},be=({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,w.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(x.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(D.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},Le=({uniqid:e})=>{const t=(0,w.useDispatch)(),n=(0,w.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(x.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(D.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},qe=({uniqid:e,layerId:t})=>{const n=(0,w.useDispatch)();return l().createElement("div",{onClick:()=>{n(x.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(D.JRCIcon,{name:"icon-trash"}))},Te=({uniqid:e})=>{const t=(0,w.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=x.$L.definition(n.widget.name);return l().createElement("div",{style:{flexDirection:"row",display:"flex"},key:i},l().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),l().createElement(be,{uniqid:e}),l().createElement(Le,{uniqid:e}),l().createElement(qe,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},We=E.default.registry.getLazyComponent("Button"),$e=({uniqid:e})=>{const t=(0,p.useIntl)(),n=(0,w.useDispatch)(),i=(0,w.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),[a,r]=l().useState(null==i?void 0:i.title),{control:c,watch:s}=(0,o.useForm)({defaultValues:{text:null!=a?a:""},criteriaMode:"all"});return l().useEffect((()=>{const e=s((e=>{r(e.text)}));return()=>e.unsubscribe()}),[s]),i?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(D.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement(We,{onClick:()=>{void 0!==a&&(n(x.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:a})),n(x.Wq.slice.actions.flushEditor({uniqid:e})))},variant:"outlined",minWidth:"100%"},t.formatMessage({id:"EDITOR_Save_Widget"}))):l().createElement(l().Fragment,null,"No wrapper")},Ie=E.default.registry.getLazyComponent("Icon"),ke=({uniqid:e})=>{const t=(0,p.useIntl)(),n=(0,w.useDispatch)(),i=(0,w.useSelector)((t=>x.Wq.selectors.selectEditor(t,e))),o=x.$L.definition(null==i?void 0:i.name),[a,r]=l().useState(!1),[c,s]=l().useState("default");return l().useEffect((()=>{setTimeout((()=>{r(!0)}),0)})),i?l().createElement("div",{style:{width:440,position:"relative"}},l().createElement(ae,{visible:a},l().createElement(ce,null,o.panel.useWrapper?l().createElement(se,{on:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(Ie,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(se,{on:"default"===c,onClick:()=>s("default")},l().createElement(Ie,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(_e,{uniqid:e},l().createElement(se,{on:"widgets"===c,onClick:()=>s("widgets")},l().createElement(Ie,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(ie,null,l().createElement(Se,{uniqid:e,position:i.position}),l().createElement(oe,null,t.formatMessage({id:o.label})),l().createElement(le,null,l().createElement(se,{onClick:()=>{n(x.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Ie,{name:"icon-times",color:"grey2"})))),l().createElement(re,null,"default"===c&&o.panel.useEditor?l().createElement(we,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement($e,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&o.panel.useWidgets?l().createElement(xe,{uniqid:e,namespace:o.name}):l().createElement(l().Fragment,null)))),(null==i?void 0:i.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Se=({uniqid:e,position:t})=>{const n=(0,w.useDispatch)();return l().createElement(le,null,l().createElement(se,{onClick:()=>{n(x.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ie,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},_e=({uniqid:e,children:t})=>{const n=(0,w.useSelector)((t=>x.$L.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},Ae=c().div`
176
180
  position: absolute;
177
181
  inset: 0;
178
182
  pointer-events: none;
179
183
  z-index: 100;
180
- `,_e=$().div`
184
+ `,De=c().div`
181
185
  flex: 1;
182
186
  display: flex;
183
187
  margintop: ${90}px;
184
188
  pointer-events: ${e=>e.on?"all":"none"};
185
- `,Ae=$().div`
189
+ `,Fe=c().div`
186
190
  flex: 1;
187
191
  display: flex;
188
192
  flex-direction: row;
189
193
  pointer-events: none;
190
- `,De=$().div`
194
+ `,Re=c().div`
191
195
  width: ${440}px;
192
196
  pointer-events: none;
193
- `,Fe=()=>{const e=(0,y.useSelector)(f.Wq.selectors.selectEditors);return l().createElement(Se,null,e.map(((e,t)=>"left"===e.position?l().createElement(ee,{on:!1,key:t},l().createElement(Ae,null,l().createElement(Ie,{uniqid:e.uniqid}),l().createElement(_e,{on:void 0!==e.popup},l().createElement(ue,{uniqid:e.uniqid})),l().createElement(De,null))):l().createElement(ee,{on:!1,key:t},l().createElement(Ae,null,l().createElement(De,null),l().createElement(_e,{on:void 0!==e.popup},l().createElement(ue,{uniqid:e.uniqid})),l().createElement(Ie,{uniqid:e.uniqid}))))))}}}]);
197
+ `,Ge=()=>{const e=(0,w.useSelector)(x.Wq.selectors.selectEditors);return l().createElement(Ae,null,e.map(((e,t)=>"left"===e.position?l().createElement(ne,{on:!1,key:t},l().createElement(Fe,null,l().createElement(ke,{uniqid:e.uniqid}),l().createElement(De,{on:void 0!==e.popup},l().createElement(ge,{uniqid:e.uniqid})),l().createElement(Re,null))):l().createElement(ne,{on:!1,key:t},l().createElement(Fe,null,l().createElement(Re,null),l().createElement(De,{on:void 0!==e.popup},l().createElement(ge,{uniqid:e.uniqid})),l().createElement(ke,{uniqid:e.uniqid}))))))}}}]);
194
198
  //# sourceMappingURL=706.bundle.js.map