jamespot-react-core 1.1.114 → 1.1.116

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,26 +1,26 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[155],{1155:(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`
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[155],{1155:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>m,EditorsPortal:()=>Oe,Empty:()=>g,TwoColLayout:()=>w,WidgetList:()=>te,WidgetWrapperCore:()=>N});var i=n(7363),l=n.n(i),o=n(3230),a=n(7375),r=n(6754),c=n.n(r),s=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};const d=c().form`
2
2
  ${e=>e.stretch&&"\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n "}
3
- `,d=c().div`
3
+ `,u=c().div`
4
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`
5
+ `,m=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,r]=(0,a.GF)(e.fields,e.type),c=(0,o.useForm)({defaultValues:Object.assign(Object.assign({},r),e.defaultValues),criteriaMode:"all"}),{handleSubmit:m,control:g,reset:p}=c,E=s(c,["handleSubmit","control","reset"]);return i.useImperativeHandle(t,(()=>Object.assign(Object.assign({},E),{handleSubmit:m,control:g,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),p()}})),[]),i.createElement(d,{stretch:e.stretch,onSubmit:m(e.onSubmit),ref:n},i.createElement(u,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=s(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:g},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(g)),e.buttons)})),g=()=>i.createElement(i.Fragment,null);var p=n(2248),E=n(5181),f=n(8804);const y=f.default.registry.getLazyComponent("Container"),v=f.default.registry.getLazyComponent("AppColumn"),h=f.default.registry.getLazyComponent("MainColumn");function w({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,E.useIntl)(),{pathname:r}=(0,p.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(y,{mode:l},i.createElement(v,{mode:l,description:n,tabs:u,activeTab:s||""}),i.createElement(h,{mode:l},i.createElement(p.Outlet,null))))}var b=n(855),x=n(1773);const C=f.default.registry.getLazyComponent("Loader"),L=({name:e,uniqid:t,inplace:n})=>{const i=(0,b.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}))},q=f.default.registry.getLazyComponent("WidgetArticleButton"),T=f.default.registry.getLazyComponent("WidgetArticleGallery"),W=f.default.registry.getLazyComponent("WidgetArticleAttachment"),$=f.default.registry.getLazyComponent("WidgetArticleImage"),I=f.default.registry.getLazyComponent("WidgetArticleTitle"),k=f.default.registry.getLazyComponent("WidgetArticleText"),S=({widget:e,width:t,inplace:n=!1,isComponentVisible:i=!1,mode:o="view",onClick:a})=>{const r=(0,b.useDispatch)(),{name:c,uniqid:s}=e,d=(0,b.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(q,{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(T,{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(W,{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($,{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(I,{isComponentVisible:i,content:e.content,inplace:n,mode:o,onChange:u,onStateChange:m});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(k,{content:e.content,isComponentVisible:i,inplace:n,mode:o,onChange:u,onStateChange:m})}};var _=n(3904);const A={"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 D=n(6),F=n(997);const R=f.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),G=({uniqid:e,initialFiles:t,accept:n,label:i,description:o,multiple:a,token:r,allowAutoOpening:c,onChange:s})=>{const d=(0,b.useDispatch)(),u=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.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(F.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(R,{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,D.apiFileToWidgetFile)(t)])),a||d(x.$L.slice.actions.setWidgetState({uniqid:e,loading:!1}))}})))},O=c().div`
6
6
  position: relative;
7
7
  inset: 0;
8
8
  display: flex;
9
9
  flex: 1;
10
10
  min-height: 180px;
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`
11
+ `,j=({uniqid:e,mode:t})=>{var n;const i=(0,b.useDispatch)(),o=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),a=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.shallowEqual),r=(0,b.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=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].label:"",s=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].description:"",d=A&&A[null==o?void 0:o.widget.name]?A[null==o?void 0:o.widget.name].accept:"",u=!(!A||!A[null==o?void 0:o.widget.name])&&A[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(O,null,l().createElement(G,{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(O,null,l().createElement(G,{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(O,null,l().createElement(G,{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)},z=c().div`
12
12
  position: absolute;
13
13
  inset: 0;
14
14
  opacity: ${e=>e.opacity};
15
15
  background-color: ${e=>e.backgroundColor};
16
16
  pointer-events: ${e=>e.pointerEvents};
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`
17
+ `,M=({uniqid:e,mode:t})=>{const n=(0,b.useSelector)((t=>t.widgets.ids[e].widget.layers),b.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(V,{uniqid:e,key:t,mode:"edit"}))))},V=({uniqid:e,mode:t})=>{const n=(0,b.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(z,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(B,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(z,{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(B,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},B=({uniqid:e,layerId:t,mode:n})=>{const i=(0,b.useDispatch)(),o=(0,b.useSelector)((t=>t.widgets.ids[e]),b.shallowEqual),a=(0,b.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(P,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(J,{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(F.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(x.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(P,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},J=({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)},N=({uniqid:e,widget:t,inplace:n=!0,mode:i,width:o})=>{const a=(0,b.useDispatch)(),r=(0,b.useSelector)((t=>x.$L.selectors.selectWidget(t,e))),c=(0,b.useSelector)((t=>{var n;return null===(n=x.$L.selectors.selectWidgetState(t,e))||void 0===n?void 0:n.busy}),b.shallowEqual),s=(0,b.useSelector)((t=>t.widgets.editableMap[e]),b.shallowEqual),d=(0,b.useSelector)((e=>e.widgets.currentEditableWidgetId),b.shallowEqual),u=(0,b.useSelector)((t=>t.widgets.currentEditableWidgetId===e),b.shallowEqual),{ref:m,isComponentVisible:g,setIsComponentVisible:p}=(0,_.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(S,{width:o,widget:r.widget,inplace:n,isComponentVisible:!!(g||c||u),mode:i,onClick:E}),l().createElement(j,{uniqid:e,mode:i}),l().createElement(M,{uniqid:e,mode:i}),l().createElement(L,{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(S,{widget:r.widget,isComponentVisible:!1,inplace:n,mode:i,width:o,onClick:E}),l().createElement(M,{uniqid:e,mode:i}),l().createElement(L,{name:r.widget.name,uniqid:r.widget.uniqid,inplace:n}))},P=N,U=c().div`
18
18
  display: flex;
19
19
  flex-direction: row;
20
20
  flex-wrap: wrap;
21
21
  gap: 10px;
22
22
  justify-content: center;
23
- `,U=c().div`
23
+ `,H=c().div`
24
24
  border: 1px solid ${e=>e.theme.color.grey2};
25
25
  border-radius: 8px;
26
26
  cursor: pointer;
@@ -45,7 +45,7 @@
45
45
  opacity: 1;
46
46
  }
47
47
  }
48
- `,H=c().div`
48
+ `,X=c().div`
49
49
  border: 2px solid ${e=>e.theme.color.primary};
50
50
  height: ${e=>e.open?"320":"54"}px;
51
51
  border-radius: 8px;
@@ -55,20 +55,20 @@
55
55
  transition: height 0.4s;
56
56
  overflow: hidden;
57
57
  flex-direction: column;
58
- `,X=c().div`
58
+ `,Y=c().div`
59
59
  display: flex;
60
60
  flex-direction: row;
61
61
  flex-wrap: wrap;
62
62
  justify-content: center;
63
63
  gap: 10px;
64
- `,Y=c().div`
64
+ `,K=c().div`
65
65
  min-height: 50px;
66
66
  display: flex;
67
67
  justify-content: center;
68
68
  align-items: center;
69
69
  cursor: pointer;
70
70
  color: ${e=>e.theme.color.primary};
71
- `,K=c().button`
71
+ `,Q=c().button`
72
72
  height: 72px;
73
73
  display: flex;
74
74
  justify-content: center;
@@ -78,7 +78,7 @@
78
78
  border-radius: 8px;
79
79
  transition: opacity 0.4s ease ${e=>40*e.index}ms;
80
80
  opacity: ${e=>e.open?1:0};
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`
81
+ `,Z=f.default.registry.getLazyComponent("Button"),ee=f.default.registry.getLazyComponent("Modal"),te=({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,E.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(ee,Object.assign({},s),l().createElement(U,null,r.map(((e,t)=>l().createElement(H,{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(Z,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},c.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e?l().createElement(U,null,r.map(((e,t)=>l().createElement(H,{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(ne,{widgets:r,onClick:d}):l().createElement(l().Fragment,null))},ne=({widgets:e,onClick:t})=>{const[n,i]=l().useState(!1),o=(0,E.useIntl)();return l().createElement(l().Fragment,null,l().createElement(X,{open:n},l().createElement(K,{onClick:()=>i(!n)},o.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(Y,null,e.map(((e,i)=>l().createElement(Q,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},o.formatMessage({id:e.label})))))))},ie=(c().div`
82
82
  margin-bottom: 24px;
83
83
  `,c().div`
84
84
  margin-bottom: 4px;
@@ -90,22 +90,22 @@
90
90
  flex: 1;
91
91
  display: flex;
92
92
  overflow: hidden;
93
- `),ie=c().div`
93
+ `),le=c().div`
94
94
  flex-direction: row;
95
95
  display: flex;
96
96
  min-height: 60px;
97
97
  border-bottom: 1px solid ${e=>e.theme.color.grey2};
98
- `,le=c().div`
98
+ `,oe=c().div`
99
99
  width: 60px;
100
100
  display: flex;
101
101
  align-items: center;
102
102
  justify-content: center;
103
- `,oe=c().div`
103
+ `,ae=c().div`
104
104
  flex: 1;
105
105
  display: flex;
106
106
  align-items: center;
107
107
  justify-content: center;
108
- `,ae=c().div`
108
+ `,re=c().div`
109
109
  position: absolute;
110
110
  top: 90px;
111
111
  right: ${e=>e.visible?"0":"-1000"}px;
@@ -116,19 +116,19 @@
116
116
  flex-direction: row;
117
117
  transition: all 0.4s;
118
118
  box-shadow: -1px 1px 10px 0px rgb(0 0 0 / 20%);
119
- `,re=c().div`
119
+ `,ce=c().div`
120
120
  flex: 1;
121
121
  display: flex;
122
122
  flex-direction: row;
123
123
  padding: 12px;
124
124
  overflow: auto;
125
- `,ce=c().div`
125
+ `,se=c().div`
126
126
  width: ${50}px;
127
127
  padding-top: 60px;
128
128
  display: flex;
129
129
  flex-direction: column;
130
130
  border-right: 1px solid ${e=>e.theme.color.grey2};
131
- `,se=c().button`
131
+ `,de=c().button`
132
132
  border-radius: 4px;
133
133
  cursor: pointer;
134
134
  height: 42px;
@@ -141,7 +141,7 @@
141
141
  &:hover {
142
142
  background-color: ${e=>e.theme.color.grey1};
143
143
  }
144
- `,de=(c().div`
144
+ `,ue=(c().div`
145
145
  display: flex;
146
146
  border: 1px solid ${e=>e.theme.color.grey1};
147
147
  border-radius: ${8}px;
@@ -159,16 +159,16 @@
159
159
  background-color: ${e=>e.theme.color.grey0};
160
160
  border-radius: 8px;
161
161
  margin-bottom: 4px;
162
- `),ue=c().div`
162
+ `),me=c().div`
163
163
  display: flex;
164
164
  flex: 1;
165
165
  align-items: center;
166
- `,me=c().div`
166
+ `,ge=c().div`
167
167
  width: 40px;
168
168
  display: flex;
169
169
  justify-content: center;
170
170
  align-items: center;
171
- `,ge=(c().div`
171
+ `,pe=(c().div`
172
172
  flex-direction: row;
173
173
  display: flex;
174
174
  align-items: center;
@@ -176,23 +176,23 @@
176
176
  flex: 1;
177
177
  display: flex;
178
178
  align-items: center;
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`
179
+ `,({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.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(le,null,l().createElement(oe,null),l().createElement(ae,null,"Popup"),l().createElement(oe,null,l().createElement(de,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(F.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(le,null,l().createElement(F.JRCButton,{onClick:()=>{t(x.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),Ee=f.default.registry.getLazyComponent("WidgetArticleTitleEditor"),fe=f.default.registry.getLazyComponent("WidgetArticleImageEditor"),ye=f.default.registry.getLazyComponent("WidgetArticleTextEditor"),ve=f.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),he=f.default.registry.getLazyComponent("WidgetArticleButtonEditor"),we=f.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),be=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)(x.$L.selectors.selectToken),i=(0,b.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(he,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(we,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case x.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(ve,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement(ye,{onChange:a,onSave:o,content:i.widget.content});case x.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(fe,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case x.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(Ee,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},xe=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,E.useIntl)(),i=(0,b.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(ue,null,l().createElement(me,{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(ge,{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(F.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Ce=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.useSelector)((t=>t.widgets.ids[e].widget.layers),b.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(F.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(We,{uniqid:e,key:t}),elms:n||[]}),l().createElement(te,{namespace:"default",onChange:n=>{t(x.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Le=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.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(F.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},qe=({uniqid:e})=>{const t=(0,b.useDispatch)(),n=(0,b.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(F.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Te=({uniqid:e,layerId:t})=>{const n=(0,b.useDispatch)();return l().createElement("div",{onClick:()=>{n(x.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(F.JRCIcon,{name:"icon-trash"}))},We=({uniqid:e})=>{const t=(0,b.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(Le,{uniqid:e}),l().createElement(qe,{uniqid:e}),l().createElement(Te,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},$e=f.default.registry.getLazyComponent("Button"),Ie=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,b.useDispatch)(),i=(0,b.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(F.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement($e,{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")},ke=f.default.registry.getLazyComponent("Icon"),Se=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,b.useDispatch)(),i=(0,b.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(re,{visible:a},l().createElement(se,null,o.panel.useWrapper?l().createElement(de,{on:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(ke,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(de,{on:"default"===c,onClick:()=>s("default")},l().createElement(ke,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(Ae,{uniqid:e},l().createElement(de,{on:"widgets"===c,onClick:()=>s("widgets")},l().createElement(ke,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(le,null,l().createElement(_e,{uniqid:e,position:i.position}),l().createElement(ae,null,t.formatMessage({id:o.label})),l().createElement(oe,null,l().createElement(de,{onClick:()=>{n(x.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(ke,{name:"icon-times",color:"grey2"})))),l().createElement(ce,null,"default"===c&&o.panel.useEditor?l().createElement(be,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement(Ie,{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)},_e=({uniqid:e,position:t})=>{const n=(0,b.useDispatch)();return l().createElement(oe,null,l().createElement(de,{onClick:()=>{n(x.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(ke,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Ae=({uniqid:e,children:t})=>{const n=(0,b.useSelector)((t=>x.$L.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},De=c().div`
180
180
  position: absolute;
181
181
  inset: 0;
182
182
  pointer-events: none;
183
183
  z-index: 100;
184
- `,De=c().div`
184
+ `,Fe=c().div`
185
185
  flex: 1;
186
186
  display: flex;
187
187
  margintop: ${90}px;
188
188
  pointer-events: ${e=>e.on?"all":"none"};
189
- `,Fe=c().div`
189
+ `,Re=c().div`
190
190
  flex: 1;
191
191
  display: flex;
192
192
  flex-direction: row;
193
193
  pointer-events: none;
194
- `,Re=c().div`
194
+ `,Ge=c().div`
195
195
  width: ${440}px;
196
196
  pointer-events: none;
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}))))))}}}]);
197
+ `,Oe=()=>{const e=(0,b.useSelector)(x.Wq.selectors.selectEditors);return l().createElement(De,null,e.map(((e,t)=>"left"===e.position?l().createElement(ie,{on:!1,key:t},l().createElement(Re,null,l().createElement(Se,{uniqid:e.uniqid}),l().createElement(Fe,{on:void 0!==e.popup},l().createElement(pe,{uniqid:e.uniqid})),l().createElement(Ge,null))):l().createElement(ie,{on:!1,key:t},l().createElement(Re,null,l().createElement(Ge,null),l().createElement(Fe,{on:void 0!==e.popup},l().createElement(pe,{uniqid:e.uniqid})),l().createElement(Se,{uniqid:e.uniqid}))))))}}}]);
198
198
  //# sourceMappingURL=155.bundle.js.map