jamespot-react-core 1.1.139 → 1.1.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/39.bundle.js +16 -16
- package/build/39.bundle.js.map +1 -1
- package/build/app.bundle.js +556 -544
- package/build/app.bundle.js.map +1 -1
- package/package.json +3 -3
package/build/39.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[39],{39:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>ue,DisplayForm:()=>E,EditorsPortal:()=>re,Empty:()=>oe,JRCInputTinyMCEWithExt:()=>pe,JRCInputTinyMCEWithExtRaw:()=>me,TwoColLayout:()=>ve,WidgetList:()=>wt,WidgetWrapperCore:()=>st});var n=i(363),l=i.n(n),r=i(
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[39],{39:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>ue,DisplayForm:()=>E,EditorsPortal:()=>re,Empty:()=>oe,JRCInputTinyMCEWithExt:()=>pe,JRCInputTinyMCEWithExtRaw:()=>me,TwoColLayout:()=>ve,WidgetList:()=>wt,WidgetWrapperCore:()=>st});var n=i(363),l=i.n(n),r=i(397),o=i(603),a=i(754),c=i.n(a),s=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]])}return i};const d=a.css`
|
|
2
2
|
height: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
${({stretch:e})=>e&&d}
|
|
10
10
|
`,p=n.forwardRef(((e,t)=>e.onSubmit?n.createElement(m,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):n.createElement(u,{stretch:e.stretch,ref:t},e.children))),g=c().div`
|
|
11
11
|
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
12
|
-
`,E=n.forwardRef(((e,t)=>{const i=n.useRef(null),[l,a]=(0,o.GF)(e.fields,e.type),c=(0,r.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:d,control:u,reset:m}=c,E=s(c,["handleSubmit","control","reset"]);return n.useImperativeHandle(t,(()=>Object.assign(Object.assign({},E),{handleSubmit:d,control:u,reset:()=>{var e;null===(e=null==i?void 0:i.current)||void 0===e||e.scrollTo(0,0),m()}})),[]),n.createElement(p,{stretch:e.stretch,onSubmit:e.onSubmit?d(e.onSubmit):void 0,ref:i},n.createElement(g,{stretch:e.stretch},l.map((t=>{var{Input:i}=t,l=s(t,["Input"]);return n.createElement(i,Object.assign({key:l.name,control:u},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(u)),e.buttons)}));var f=i(855),y=i(
|
|
12
|
+
`,E=n.forwardRef(((e,t)=>{const i=n.useRef(null),[l,a]=(0,o.GF)(e.fields,e.type),c=(0,r.useForm)({defaultValues:Object.assign(Object.assign({},a),e.defaultValues),criteriaMode:"all"}),{handleSubmit:d,control:u,reset:m}=c,E=s(c,["handleSubmit","control","reset"]);return n.useImperativeHandle(t,(()=>Object.assign(Object.assign({},E),{handleSubmit:d,control:u,reset:()=>{var e;null===(e=null==i?void 0:i.current)||void 0===e||e.scrollTo(0,0),m()}})),[]),n.createElement(p,{stretch:e.stretch,onSubmit:e.onSubmit?d(e.onSubmit):void 0,ref:i},n.createElement(g,{stretch:e.stretch},l.map((t=>{var{Input:i}=t,l=s(t,["Input"]);return n.createElement(i,Object.assign({key:l.name,control:u},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(u)),e.buttons)}));var f=i(855),y=i(230);c().div`
|
|
13
13
|
margin-bottom: 24px;
|
|
14
14
|
`,c().div`
|
|
15
15
|
margin-bottom: 4px;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
display: flex;
|
|
96
96
|
flex: 1;
|
|
97
97
|
align-items: center;
|
|
98
|
-
`,
|
|
98
|
+
`,S=c().div`
|
|
99
99
|
width: 40px;
|
|
100
100
|
display: flex;
|
|
101
101
|
justify-content: center;
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
flex: 1;
|
|
109
109
|
display: flex;
|
|
110
110
|
align-items: center;
|
|
111
|
-
`;var
|
|
111
|
+
`;var W=i(998);const A=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,f.useSelector)((t=>W.Wq.selectors.selectEditor(t,e)));return i&&i.popup&&i.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(h,null,l().createElement(w,null),l().createElement(x,null,"Popup"),l().createElement(w,null,l().createElement(k,{onClick:()=>{t(W.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(y.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},i.view),l().createElement(h,null,l().createElement(y.JRCButton,{onClick:()=>{t(W.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var I=i(888);const O=I.default.registry.getLazyComponent("WidgetArticleTitleEditor"),_=I.default.registry.getLazyComponent("WidgetArticleTextEditor"),F=I.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),M=I.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),T=I.default.registry.getLazyComponent("WidgetArticleSliderEditor"),j=I.default.registry.getLazyComponent("WidgetArticleImageEditor"),D=I.default.registry.getLazyComponent("WidgetButtonEditor"),R=I.default.registry.getLazyComponent("WidgetApiEditor"),z=({uniqid:e})=>{var t,i,n,r,o,a;const c=(0,f.useDispatch)(),s=(0,f.useSelector)(W.$L.selectors.selectToken),d=(0,f.useSelector)((t=>W.$L.selectors.selectWidget(t,e))),u=t=>{d&&c(W.$L.slice.actions.updateWidget({uniqid:e,content:t})),c(W.Wq.slice.actions.flushEditor({uniqid:e}))},m=(t,i)=>{c(void 0!==i?W.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},t)):W.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},p=t=>{c(W.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))};switch(null==d?void 0:d.widget.name){default:return l().createElement(l().Fragment,null,"cannot display editor");case"widget-article-button":return l().createElement(l().Fragment,null,l().createElement(D,Object.assign({},d.widget.content,{onChange:t=>{c((0,W.O5)(e,t,!1))},onSave:()=>u({})})));case"widget-article-attachment":return l().createElement(M,{token:s,content:d.widget.content,onChange:t=>c((0,W.O5)(e,t,!1)),onSave:u,onStateChange:m,onOpen:p});case"widget-article-gallery":return l().createElement(F,{token:s,content:d.widget.content,onChange:t=>c((0,W.O5)(e,t,!1)),onSave:u,onStateChange:m});case"widget-article-text":return l().createElement(_,{onChange:t=>c((0,W.O5)(e,t,!1)),onSave:u,content:d.widget.content});case"widget-article-image":return l().createElement(j,{content:d.widget.content,token:s,onChange:t=>c((0,W.O5)(e,t,!1)),onSave:u,onStateChange:m});case"widget-api":return l().createElement(R,{onChange:t=>c((0,W.O5)(e,t,!1)),provider:e=>{return t=void 0,i=void 0,l=function*(){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>e.result))},new((n=void 0)||(n=Promise))((function(e,r){function o(e){try{c(l.next(e))}catch(e){r(e)}}function a(e){try{c(l.throw(e))}catch(e){r(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((l=l.apply(t,i||[])).next())}));var t,i,n,l},initialUrl:null!==(t=d.widget.content.url)&&void 0!==t?t:"",order:null!==(i=d.widget.content.order)&&void 0!==i?i:"",orderBy:null!==(n=d.widget.content.orderBy)&&void 0!==n?n:"asc"});case"widget-article-title":return l().createElement(O,{onChange:t=>{c((0,W.O5)(e,t,!1))},onSave:u,content:d.widget.content,onOpen:p});case"widget-article-slider":return void 0!==s?l().createElement(T,{slides:null!==(r=d.widget.content.slides)&&void 0!==r?r:[],loop:null!==(o=d.widget.content.loop)&&void 0!==o&&o,useDots:null===(a=d.widget.content.useDots)||void 0===a||a,onChange:t=>{c((0,W.O5)(e,t,!1))},token:s,onSave:u}):l().createElement(l().Fragment,null,"Token is mandatory")}};var G=i(181);const B=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,G.useIntl)(),n=(0,f.useSelector)((t=>W.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(P,{uniqid:e}),n&&n.widgets?n.widgets.map(((r,o)=>{const a=W.$L.definition(r.widget.name);return l().createElement("div",{key:o},l().createElement(L,null,l().createElement($,{onClick:()=>((e,i)=>{t(W.Wq.slice.actions.registerEditor({uniqid:e,name:i}))})(r.widget.uniqid,r.widget.name)},i.formatMessage({id:a.label})),l().createElement(S,{onClick:()=>{n.widgets&&t(W.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},n),{widgets:[...n.widgets.filter(((e,t)=>t!==o))]})}))}},l().createElement(y.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},P=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,f.useSelector)((t=>t.widgets.ids[e].widget.layers),f.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(y.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(V,{uniqid:e,key:t}),elms:i||[]}),l().createElement(wt,{namespace:"default",onChange:i=>{t(W.$L.slice.actions.registerLayer({uniqid:e,widget:i}))},mode:"button"}))},U=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,f.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(W.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!i.locked}}))}},l().createElement(y.JRCIcon,{name:i.locked?"icon-lock":"icon-unlock"}))},H=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,f.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(W.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!i.visible}}))}},l().createElement(y.JRCIcon,{name:i.visible?"icon-eye":"icon-eye-slash"}))},N=({uniqid:e,layerId:t})=>{const i=(0,f.useDispatch)();return l().createElement("div",{onClick:()=>{i(W.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(y.JRCIcon,{name:"icon-trash"}))},V=({uniqid:e})=>{const t=(0,f.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((i,n)=>{const r=W.$L.definition(i.widget.name);return l().createElement("div",{style:{flexDirection:"row",display:"flex"},key:n},l().createElement("div",{style:{flex:1,alignItems:"center"}},r.label),l().createElement(U,{uniqid:e}),l().createElement(H,{uniqid:e}),l().createElement(N,{uniqid:i.widget.uniqid,layerId:t.uniqid}))})))},Q=I.default.registry.getLazyComponent("Button"),X=({uniqid:e})=>{const t=(0,G.useIntl)(),i=(0,f.useDispatch)(),n=(0,f.useSelector)((t=>W.$L.selectors.selectWidget(t,e))),[o,a]=l().useState(null==n?void 0:n.title),{control:c,watch:s}=(0,r.useForm)({defaultValues:{text:null!=o?o:""},criteriaMode:"all"});return l().useEffect((()=>{const e=s((e=>{a(e.text)}));return()=>e.unsubscribe()}),[s]),n?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(y.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement(Q,{onClick:()=>{void 0!==o&&(i(W.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:o})),i(W.Wq.slice.actions.flushEditor({uniqid:e})))},variant:"outlined",minWidth:"100%"},t.formatMessage({id:"EDITOR_Save_Widget"}))):l().createElement(l().Fragment,null,"No wrapper")},Y=I.default.registry.getLazyComponent("Icon"),K=({uniqid:e})=>{const t=(0,G.useIntl)(),i=(0,f.useDispatch)(),n=(0,f.useSelector)((t=>W.Wq.selectors.selectEditor(t,e))),r=W.$L.definition(null==n?void 0:n.name),[o,a]=l().useState(!1),[c,s]=l().useState("default");return l().useEffect((()=>{setTimeout((()=>{a(!0)}),0)})),n?l().createElement("div",{style:{width:440,position:"relative"}},l().createElement(b,{visible:o},l().createElement(q,null,r.panel.useWrapper?l().createElement(k,{isActive:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(Y,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),r.panel.useEditor?l().createElement(k,{isActive:"default"===c,onClick:()=>s("default")},l().createElement(Y,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),r.panel.useWidgets?l().createElement(ee,{uniqid:e},l().createElement(k,{isActive:"widgets"===c,onClick:()=>s("widgets")},l().createElement(Y,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(h,null,l().createElement(Z,{uniqid:e,position:n.position}),l().createElement(x,null,t.formatMessage({id:r.label})),l().createElement(w,null,l().createElement(k,{onClick:()=>{i(W.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Y,{name:"icon-times",color:"grey2"})))),l().createElement(C,null,"default"===c&&r.panel.useEditor?l().createElement(z,{uniqid:n.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&r.panel.useWrapper?l().createElement(X,{uniqid:n.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&r.panel.useWidgets?l().createElement(B,{uniqid:e,namespace:r.name}):l().createElement(l().Fragment,null)))),(null==n?void 0:n.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Z=({uniqid:e,position:t})=>{const i=(0,f.useDispatch)();return l().createElement(w,null,l().createElement(k,{onClick:()=>{i(W.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Y,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},ee=({uniqid:e,children:t})=>{const i=(0,f.useSelector)((t=>W.$L.selectors.selectWidgetState(t,e)));return(null==i?void 0:i.initialized)?t:l().createElement(l().Fragment,null)},te=c().div`
|
|
112
112
|
position: absolute;
|
|
113
113
|
inset: 0;
|
|
114
114
|
pointer-events: none;
|
|
@@ -126,15 +126,15 @@
|
|
|
126
126
|
`,le=c().div`
|
|
127
127
|
width: ${440}px;
|
|
128
128
|
pointer-events: none;
|
|
129
|
-
`,re=()=>{const e=(0,f.useSelector)(
|
|
129
|
+
`,re=()=>{const e=(0,f.useSelector)(W.Wq.selectors.selectEditors);return l().createElement(te,null,e.map(((e,t)=>"left"===e.position?l().createElement(v,{isActive:!1,key:t},l().createElement(ne,null,l().createElement(K,{uniqid:e.uniqid}),l().createElement(ie,{isActive:void 0!==e.popup},l().createElement(A,{uniqid:e.uniqid})),l().createElement(le,null))):l().createElement(v,{isActive:!1,key:t},l().createElement(ne,null,l().createElement(le,null),l().createElement(ie,{isActive:void 0!==e.popup},l().createElement(A,{uniqid:e.uniqid})),l().createElement(K,{uniqid:e.uniqid}))))))},oe=()=>n.createElement(n.Fragment,null),ae=()=>{const[e,t]=(0,n.useState)(),i=(0,G.useIntl)(),l=(0,n.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}}))}),[]),r=(0,n.useMemo)((()=>({develop:e=>new Promise(((t,i)=>{l({reject:i,resolve:t,text:e,capability:"develop"})})),summarize:e=>new Promise(((t,i)=>{l({reject:i,resolve:t,text:e,capability:"summarize"})})),tldr:e=>new Promise(((t,i)=>{l({reject:i,resolve:t,text:e,capability:"tldr"})}))})),[]);return[e,(0,n.useMemo)((()=>y.JTinyMCEExtensionsBuilders.jia(r,i)),[])]};var ce=i(6),se=i.n(ce);const de={response:void 0,loading:!0,error:void 0},ue=({query:e})=>{const t=(0,G.useIntl)(),[i,r]=(0,n.useState)(de),o=(0,n.useCallback)((e=>{r(de),se().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void r({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const i=e.result.text;r({error:void 0,loading:!1,response:i})})).catch((e=>{r({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[]);return(0,n.useEffect)((()=>{e&&e.text.trim().length>0&&o(e)}),[e]),l().createElement(y.JRCModal,{zIndex:50010,open:!!e,closeHandler:()=>{null==e||e.reject()},buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&o(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>i.response&&(null==e?void 0:e.resolve(i.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}]},i.loading&&l().createElement(l().Fragment,null,l().createElement(y.JRCLoader,null),l().createElement(y.JRCTypography,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!i.loading&&i.error&&l().createElement("p",null,i.error),!i.loading&&i.response&&l().createElement("p",null,i.response))},me=e=>{const t=(0,G.useIntl)(),i=(0,f.useDispatch)(),r=(0,a.useTheme)(),o=(0,f.useSelector)(W.Hn.selectors.selectAll),[c,s]=ae(),d=(0,n.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),u=(0,n.useMemo)((()=>d?[s]:[]),[s,d]),m=(0,n.useCallback)((e=>{i(W.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[]),p=(0,n.useMemo)((()=>(0,I.getTinyMCEMentionsQueries)(o,r,m)),[]),g=(0,n.useMemo)((()=>I.default.tinymceCommonOptions),[I.default.tinymceCommonOptions]);return l().createElement(l().Fragment,null,g&&l().createElement(y.JRCInputTinyMCERaw,Object.assign({commonOptions:g,additionalExtensions:u,mentionsQueries:p},e)),l().createElement(ue,{query:c}))},pe=e=>{const t=(0,G.useIntl)(),i=(0,f.useDispatch)(),r=(0,a.useTheme)(),o=(0,f.useSelector)(W.Hn.selectors.selectAll),[c,s]=ae(),d=(0,n.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),u=(0,n.useMemo)((()=>d?[s]:[]),[s,d]),m=(0,n.useCallback)((e=>{i(W.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[]),p=(0,n.useMemo)((()=>(0,I.getTinyMCEMentionsQueries)(o,r,m)),[]),g=(0,n.useMemo)((()=>I.default.tinymceCommonOptions),[I.default.tinymceCommonOptions]);return l().createElement(l().Fragment,null,g&&l().createElement(y.JRCInputTinyMCE,Object.assign({commonOptions:g,additionalExtensions:u,mentionsQueries:p},e)),l().createElement(ue,{query:c}))};var ge=i(248);const Ee=I.default.registry.getLazyComponent("Container"),fe=I.default.registry.getLazyComponent("AppColumn"),ye=I.default.registry.getLazyComponent("MainColumn");function ve({extensionRoute:e,routes:t,description:i,mode:l="center"}){var r;const o=(0,G.useIntl)(),{pathname:a}=(0,ge.useLocation)(),c=Object.values(t),[s,d]=n.useState(null===(r=null==c?void 0:c[0])||void 0===r?void 0:r.key),u=c.map((t=>Object.assign(Object.assign({},t),{label:o.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?o.formatMessage({id:t.group}):void 0})));return n.useEffect((()=>{const t=c.find((t=>a===`/ng/rr/${e}/${t.path}`));t&&d(t.key)}),[a]),n.createElement(n.Suspense,{fallback:n.createElement(n.Fragment,null)},n.createElement(Ee,{mode:l},n.createElement(fe,{mode:l,description:i,tabs:u,activeTab:s||""}),n.createElement(ye,{mode:l},n.createElement(ge.Outlet,null))))}const he=I.default.registry.getLazyComponent("Loader"),we=({name:e,uniqid:t,inplace:i})=>{const n=(0,f.useSelector)((e=>W.$L.selectors.selectWidgetState(e,t))),r=W.$L.definition(e);return(null==n?void 0:n.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(he,null)):(null==n?void 0:n.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==n?void 0:n.initialized)&&i||(null==n?void 0:n.initialized)||i?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:r.img}))},xe=c().div`
|
|
130
130
|
width: 0;
|
|
131
131
|
height: 0;
|
|
132
132
|
overflow: hidden;
|
|
133
|
-
`,be=I.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),Ce=({children:e,initialFiles:t,initialClick:i,multiple:n,accept:r,onUploadStart:o,onUploadEnd:a,onUploadSuccess:c})=>{const s=l().useRef(null),d=(0,f.useSelector)(
|
|
133
|
+
`,be=I.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),Ce=({children:e,initialFiles:t,initialClick:i,multiple:n,accept:r,onUploadStart:o,onUploadEnd:a,onUploadSuccess:c})=>{const s=l().useRef(null),d=(0,f.useSelector)(W.$L.selectors.selectToken),[u,m]=l().useState(0),[p,g]=l().useState(t);return l().useEffect((()=>{var e;i&&(null===(e=s.current)||void 0===e||e.click())}),[i]),l().useEffect((()=>{t.length!==p.length&&g(t)}),[t]),l().useEffect((()=>{c(p)}),[p]),l().useEffect((()=>{0===u&&a()}),[u]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;i&&(null===(e=s.current)||void 0===e||e.click())}},e),l().createElement(xe,null,l().createElement(be,{ref:s,id:"widget-upload-file",name:"editorFiles",content:"",accept:r,multiple:n,token:d,onUploadStart:e=>{void 0!==e&&m((t=>t+e)),"function"==typeof o&&0!==e&&o()},onUploadSuccess:e=>{void 0!==e&&(m((e=>void 0!==e?e-1:0)),g((t=>n?[...t,e]:[e])))}})))},qe=I.default.registry.getLazyComponent("WidgetArticleGallery"),ke=I.default.registry.getLazyComponent("FileViewer"),Le=c().button`
|
|
134
134
|
cursor: pointer;
|
|
135
|
-
`,$e=({widget:e,inplace:t,mode:i})=>{var n,r;const{uniqid:o}=e,{files:a}=e.content,c=(0,f.useDispatch)(),s=(0,f.useSelector)((e=>
|
|
135
|
+
`,$e=({widget:e,inplace:t,mode:i})=>{var n,r;const{uniqid:o}=e,{files:a}=e.content,c=(0,f.useDispatch)(),s=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,o)),f.shallowEqual);return l().useEffect((()=>{c(W.$L.slice.actions.setWidgetState({uniqid:o,mounted:!0}))}),[]),void 0!==a?l().createElement(l().Fragment,null,"edit"===i?l().createElement(qe,{files:a,maxWidth:800,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(r=e.content.column)&&void 0!==r?r:"3",onClick:()=>{}}):l().createElement(ke,{files:a,openWithOptions:[]},(t=>{var i,n;return l().createElement(Le,null,l().createElement(qe,{files:a,maxWidth:600,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(n=e.content.column)&&void 0!==n?n:"3",onClick:e=>t(e)}))})),t&&"edit"===i?l().createElement(Ce,{initialFiles:a,initialClick:s,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&c((0,W.O5)(o,{files:e}))},onUploadStart:()=>{c(W.$L.slice.actions.setWidgetState({uniqid:o,loading:!0}))},onUploadEnd:()=>{c(W.$L.slice.actions.setWidgetState({uniqid:o,loading:!1}))}},l().createElement(y.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Se=I.default.registry.getLazyComponent("WidgetAttachment"),We=I.default.registry.getLazyComponent("FileViewer"),Ae=c().div`
|
|
136
136
|
flex: 1;
|
|
137
|
-
`,Ie=({widget:e,inplace:t,mode:i})=>{const n=(0,G.useIntl)(),{uniqid:r}=e,{files:o}=e.content,a=(0,f.useDispatch)(),c=(0,f.useSelector)((e=>
|
|
137
|
+
`,Ie=({widget:e,inplace:t,mode:i})=>{const n=(0,G.useIntl)(),{uniqid:r}=e,{files:o}=e.content,a=(0,f.useDispatch)(),c=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,r)),f.shallowEqual),s=e=>{a(W.FN.actions.error({label:null!=e?e:n.formatMessage({id:"GLOBAL_Error"})}))},d=()=>{a(W.FN.actions.success({label:n.formatMessage({id:"ATTACHMENTS_Preview_Successfully_Recomputed"})}))};l().useEffect((()=>{a(W.$L.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]);const u=(0,f.useSelector)((e=>W.Mx.selectors.selectById(e,"OnlyOfficeHook"))),m=[{label:n.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&se().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const i=t.result;((e,t,i)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,i)})).catch((()=>{a(W.FN.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],p=u?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:m}]:[];return void 0!==o?l().createElement(Ae,null,"view"!==i?l().createElement(Se,{files:o,onClick:()=>{},onError:s,onRecomputePreview:d}):l().createElement(We,{files:o,openWithOptions:p},(e=>l().createElement(Se,{files:o,onClick:t=>e(t),onError:s,onRecomputePreview:d}))),t&&"view"!==i&&l().createElement(Ce,{initialFiles:o,initialClick:c,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&a((0,W.O5)(r,{files:e}))},onUploadStart:()=>{a(W.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{a(W.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},"edit"===i?l().createElement(y.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)},Oe=I.default.registry.getLazyComponent("WidgetImage"),_e=I.default.registry.getLazyComponent("FileViewer"),Fe=c().div`
|
|
138
138
|
position: absolute;
|
|
139
139
|
inset: 0;
|
|
140
140
|
background-color: rgba(0, 0, 0, 0.4);
|
|
@@ -147,9 +147,9 @@
|
|
|
147
147
|
&:hover {
|
|
148
148
|
opacity: 1;
|
|
149
149
|
}
|
|
150
|
-
`,
|
|
150
|
+
`,Me=c().button`
|
|
151
151
|
cursor: pointer;
|
|
152
|
-
`,
|
|
152
|
+
`,Te={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},je=({widget:e,width:t,inplace:i,mode:n})=>{const{uniqid:r}=e,{file:o,useFilter:a}=e.content,c=(0,f.useDispatch)(),s=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,r)),f.shallowEqual),[d,u]=l().useState(void 0),m=(0,G.useIntl)();return l().useEffect((()=>{c(W.$L.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),l().useEffect((()=>{o&&u(`/imagecache/fitx1200/${o.type}/${o.id}.png?_=${o.dateModified?(e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}})(o.dateModified):Date.now()}`)}),[o]),l().createElement(l().Fragment,null,"edit"===n?void 0!==d?l().createElement(Oe,{maxWidth:null!=t?t:600,uri:d,useFilter:null!=a&&a}):l().createElement(l().Fragment,null):l().createElement(_e,{files:[Object.assign(Object.assign({},Te),{path:d,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(Me,{onClick:()=>e(0)},l().createElement(Oe,{maxWidth:null!=t?t:600,uri:d,useFilter:null!=a&&a})))),i&&"edit"===n?l().createElement(Ce,{initialFiles:[],initialClick:s,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&c((0,W.O5)(r,{file:e[0]}))},onUploadStart:()=>{c(W.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{c(W.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},void 0!==o?l().createElement(Fe,null,m.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(y.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null))},De=c().div`
|
|
153
153
|
flex: 1;
|
|
154
154
|
display: flex;
|
|
155
155
|
flex-direction: row;
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
&:hover {
|
|
175
175
|
background-color: ${e=>e.theme.color.grey1};
|
|
176
176
|
}
|
|
177
|
-
`,Je=({widget:e,inplace:t,mode:i})=>{const{uniqid:n}=e,{text:r,color:o,heading:a}=e.content,c=(0,f.useDispatch)(),s=(0,f.useSelector)((e=>
|
|
177
|
+
`,Je=({widget:e,inplace:t,mode:i})=>{const{uniqid:n}=e,{text:r,color:o,heading:a}=e.content,c=(0,f.useDispatch)(),s=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,n)),f.shallowEqual);return l().createElement(De,null,l().createElement(y.JRCWidgetArticleTitle,{text:r,color:o,heading:a,autoFocus:s,inplace:t,mode:i,onChange:e=>{c((0,W.O5)(n,{text:e}))}}),s&&"edit"===i?l().createElement(Ge,{heading:a,onClick:e=>{c((0,W.O5)(n,{heading:e}))}}):l().createElement(l().Fragment,null))},Ge=({heading:e="h1",onClick:t})=>l().createElement(Re,null,["h1","h2","h3","h4"].map(((i,n)=>l().createElement(ze,{key:n,isActive:e===i,onClick:()=>t(i)},i)))),Be=c().div`
|
|
178
178
|
flex: 1;
|
|
179
179
|
display: flex;
|
|
180
180
|
flex-direction: row;
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
`,Pe=({widget:e})=>{const{url:t,keys:i,order:n,orderBy:r}=e.content,[o,a]=l().useState([]);return l().useEffect((()=>{t&&function(e){return"string"==typeof e&&0!==e.length&&e.startsWith("https://")}(t)?fetch(t,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{Array.isArray(e.result)||console.warn("resposne must be an array"),a(e.result)})):console.warn(`${t} is not a valid url`)}),[t]),l().createElement(Be,null,l().createElement(y.JRCWidgetApi,{data:o,keys:null!=i?i:[],order:null!=n?n:"",orderBy:null!=r?r:"asc"}))},Ue=c().div`
|
|
184
184
|
min-height: 60px;
|
|
185
185
|
cursor: text;
|
|
186
|
-
`,He=({widget:e,mode:t})=>{const{uniqid:i}=e,n=(0,a.useTheme)(),{text:r,color:o,lineHeight:c,linkColor:s,fontSize:d}=e.content,u=(0,f.useDispatch)(),m=(0,f.useSelector)((e=>
|
|
186
|
+
`,He=({widget:e,mode:t})=>{const{uniqid:i}=e,n=(0,a.useTheme)(),{text:r,color:o,lineHeight:c,linkColor:s,fontSize:d}=e.content,u=(0,f.useDispatch)(),m=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,i)),f.shallowEqual),p=(0,f.useSelector)(W.$L.selectors.selectToken),g=(0,f.useSelector)(W.zh.selectors.selectTinyMCECommonOptions);return l().createElement(Ue,null,l().createElement(y.JRCWidgetArticleText,{autoFocus:m,text:null!=r?r:"",color:null!=o?o:n.color.black,lineHeight:null!=c?c:"20",linkColor:null!=s?s:n.color.primary,fontSize:null!=d?d:"20",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t?g:void 0,mode:t,onChange:e=>{u((0,W.O5)(i,{text:e}))}}))},Ne=c().div`
|
|
187
187
|
display: flex;
|
|
188
188
|
flex: 1;
|
|
189
189
|
justify-content: center;
|
|
@@ -195,19 +195,19 @@
|
|
|
195
195
|
flex: 1;
|
|
196
196
|
justify-content: center;
|
|
197
197
|
align-items: center;
|
|
198
|
-
`,Qe=({widget:e,mode:t})=>{const i=(0,f.useDispatch)(),{uniqid:n}=e,{text:r,url:o,target:a,color:c,backgroundColor:s,buttonSize:d,borderRadius:u,variant:m}=e.content;return l().createElement(Ne,{onClick:()=>{"edit"===t&&i(
|
|
198
|
+
`,Qe=({widget:e,mode:t})=>{const i=(0,f.useDispatch)(),{uniqid:n}=e,{text:r,url:o,target:a,color:c,backgroundColor:s,buttonSize:d,borderRadius:u,variant:m}=e.content;return l().createElement(Ne,{onClick:()=>{"edit"===t&&i(W.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}},l().createElement(Ve,{clickable:"edit"!==t},l().createElement(y.JRCWidgetButton,{text:r,url:o,target:a,color:c,backgroundColor:s,buttonSize:d,borderRadius:u,variant:m})))};var Xe=i(5);const Ye=I.default.registry.getLazyComponent("FileViewer"),Ke=c().div`
|
|
199
199
|
flex: 1;
|
|
200
200
|
display: flex;
|
|
201
201
|
flex-direction: row;
|
|
202
202
|
min-height: 60px;
|
|
203
203
|
align-items: center;
|
|
204
|
-
`,Ze={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},et=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},tt=({widget:e,mode:t,width:i})=>{const{uniqid:n}=e,r=(0,Xe.TL)(),o=(0,f.useSelector)((e=>
|
|
204
|
+
`,Ze={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},et=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},tt=({widget:e,mode:t,width:i})=>{const{uniqid:n}=e,r=(0,Xe.TL)(),o=(0,f.useSelector)((e=>W.$L.selectors.isActive(e,n)),f.shallowEqual),a=e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},Ze),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Ze.mimetype,path:e.file?`/imagecache/fitx1200/${e.file.type}/${e.file.id}.png?_=${e.file.dateModified?et(e.file.dateModified):Date.now()}`:void 0})))]:[];return l().useEffect((()=>{o&&"edit"===t&&r(W.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}),[o]),l().createElement(Ke,null,l().createElement(Ye,{files:a,openWithOptions:[]},(o=>{var a,c;return l().createElement(y.JRCWidgetSlider,{slides:void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:`${J.urlBase}imagecache/fitx1200/${e.file.type}/${e.file.id}.png?_=${e.file.dateModified?et(e.file.dateModified):Date.now()}`}):Object.assign(Object.assign({},e),{uri:""})))]:[],maxWidth:null!=i?i:600,useDots:null===(a=e.content.useDots)||void 0===a||a,loop:null!==(c=e.content.loop)&&void 0!==c&&c,startAt:0,onClickSlide:i=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[i];t&&t.file&&o(t.file.id)}}else r(W.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}})})),"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length?l().createElement(y.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{r(W.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}}):l().createElement(l().Fragment,null))},it=({widget:e,width:t,inplace:i=!1,mode:n="view"})=>{const{name:r}=e;switch(r){default:return l().createElement(l().Fragment,null,"cannot display widget (",r,")");case"widget-article-button":return l().createElement(Qe,{widget:e,inplace:i,mode:n});case"widget-article-gallery":return l().createElement($e,{widget:e,inplace:i,mode:n});case"widget-article-attachment":return l().createElement(Ie,{widget:e,inplace:i,mode:n});case"widget-article-image":return l().createElement(je,{widget:e,inplace:i,mode:n,width:null!=t?t:800});case"widget-api":return l().createElement(Pe,{widget:e,inplace:i,mode:n});case"widget-article-slider":return l().createElement(tt,{widget:e,inplace:i,mode:n,width:null!=t?t:800});case"widget-article-title":return l().createElement(Je,{widget:e,inplace:i,mode:n});case"widget-article-text":return l().createElement(He,{widget:e,inplace:i,mode:n})}};var nt=i(769);const lt=c().div`
|
|
205
205
|
position: absolute;
|
|
206
206
|
inset: 0;
|
|
207
207
|
opacity: ${e=>e.opacity};
|
|
208
208
|
background-color: ${e=>e.backgroundColor};
|
|
209
209
|
pointer-events: ${e=>e.pointerEvents};
|
|
210
|
-
`,rt=({uniqid:e,mode:t})=>{const i=(0,f.useSelector)((t=>t.widgets.ids[e].widget.layers),f.shallowEqual);return l().createElement(l().Fragment,null,null==i?void 0:i.map(((e,t)=>l().createElement(ot,{uniqid:e,key:t,mode:"edit"}))))},ot=({uniqid:e,mode:t})=>{const i=(0,f.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(lt,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},i.widgets.map(((e,t)=>l().createElement(at,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(lt,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all"},i.widgets.map(((e,t)=>l().createElement(at,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},at=({uniqid:e,layerId:t,mode:i})=>{const n=(0,f.useDispatch)(),r=(0,f.useSelector)((t=>t.widgets.ids[e]),f.shallowEqual),o=(0,f.useSelector)((e=>e.widgets.layers[t]));return r&&o&&o.position?"view"===i?l().createElement("div",{style:{position:"absolute",top:o.position.y,left:o.position.x}},l().createElement(dt,{uniqid:e,widget:r,mode:i,inplace:!0})):l().createElement(ct,{position:{x:o.position.x,y:o.position.y},onMouseUp:e=>{(o.position&&o.position.x!==e.x||o.position&&o.position.y!==e.y)&&(e=>{n(
|
|
210
|
+
`,rt=({uniqid:e,mode:t})=>{const i=(0,f.useSelector)((t=>t.widgets.ids[e].widget.layers),f.shallowEqual);return l().createElement(l().Fragment,null,null==i?void 0:i.map(((e,t)=>l().createElement(ot,{uniqid:e,key:t,mode:"edit"}))))},ot=({uniqid:e,mode:t})=>{const i=(0,f.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(lt,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},i.widgets.map(((e,t)=>l().createElement(at,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(lt,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all"},i.widgets.map(((e,t)=>l().createElement(at,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},at=({uniqid:e,layerId:t,mode:i})=>{const n=(0,f.useDispatch)(),r=(0,f.useSelector)((t=>t.widgets.ids[e]),f.shallowEqual),o=(0,f.useSelector)((e=>e.widgets.layers[t]));return r&&o&&o.position?"view"===i?l().createElement("div",{style:{position:"absolute",top:o.position.y,left:o.position.x}},l().createElement(dt,{uniqid:e,widget:r,mode:i,inplace:!0})):l().createElement(ct,{position:{x:o.position.x,y:o.position.y},onMouseUp:e=>{(o.position&&o.position.x!==e.x||o.position&&o.position.y!==e.y)&&(e=>{n(W.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(y.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{n(W.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(r.widget.uniqid,r.widget.name)},l().createElement(dt,{uniqid:e,widget:r,mode:i,inplace:!0}))):l().createElement(l().Fragment,null)},ct=({position:e,children:t,onMouseUp:i})=>{const[n,r]=l().useState(!1),[o,a]=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),p=l().useCallback((e=>{if(n&&m.current){const t=c.x+(e.clientX-o.x),i=c.y+(e.clientY-o.y);u({x:t,y:i})}}),[n]),g=()=>{r(!1),i({x:d.x,y:d.y})};return l().useEffect((()=>(document.addEventListener("mousemove",p),document.addEventListener("mouseup",g),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",g)})),[p]),l().createElement("div",{style:{position:"absolute",top:d.y,left:d.x},ref:m,onMouseDown:e=>{r(!0),m.current&&(a({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),s({x:d.x,y:d.y}))}},t)},st=({uniqid:e,widget:t,inplace:i=!0,mode:n,width:r})=>{const o=(0,f.useDispatch)(),a=(0,f.useSelector)((t=>W.$L.selectors.selectWidget(t,e))),c=(0,f.useSelector)((t=>t.widgets.editableMap[e]),f.shallowEqual),s=(0,f.useSelector)((e=>e.widgets.currentEditableWidgetId),f.shallowEqual),d=(0,f.useSelector)((t=>t.widgets.currentEditableWidgetId===e),f.shallowEqual),{ref:u,isComponentVisible:m,setIsComponentVisible:p}=(0,nt.I)(!1);if(l().useEffect((()=>{t&&o(W.$L.slice.actions.registerWidget({uniqid:e,widget:t}))}),[]),l().useEffect((()=>{m||e===s&&o(W.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[m]),l().useEffect((()=>{m!==d&&p(d)}),[d]),void 0===a)return l().createElement(l().Fragment,null,"This widget cannot be desplayed");const g=()=>{"edit"===n?E():"widget-article-button"===a.widget.name&&"link"===a.widget.content.openingType&&a.widget.content.openingTypeLink&&window.open(a.widget.content.openingTypeLink.url,a.widget.content.openingTypeLink.target)},E=()=>{if("view"===n)return;const{widget:e}=a;o(W.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return i&&"view"!==n?l().createElement("div",{style:{minWidth:void 0!==r?r:"100%"},ref:u,onClick:()=>{p(!0),c&&(o(W.$L.slice.actions.setEditableIndex({index:c.index})),o(W.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(it,{width:r,widget:a.widget,inplace:i,mode:n,onClick:g}),l().createElement(rt,{uniqid:e,mode:n}),l().createElement(we,{name:a.widget.name,uniqid:a.widget.uniqid,inplace:i})):l().createElement("div",{style:{flex:1,display:"flex",minWidth:void 0!==r?r:"100%"},onClick:E},l().createElement(it,{widget:a.widget,inplace:i,mode:n,width:r,onClick:g}),l().createElement(rt,{uniqid:e,mode:n}),l().createElement(we,{name:a.widget.name,uniqid:a.widget.uniqid,inplace:i}))},dt=st,ut=c().div`
|
|
211
211
|
display: flex;
|
|
212
212
|
flex-direction: row;
|
|
213
213
|
flex-wrap: wrap;
|
|
@@ -278,5 +278,5 @@
|
|
|
278
278
|
img {
|
|
279
279
|
width: 40px;
|
|
280
280
|
}
|
|
281
|
-
`,yt=I.default.registry.getLazyComponent("Button"),vt=I.default.registry.getLazyComponent("ModalLayout"),ht=I.default.registry.getLazyComponent("ModalContent"),wt=({mode:e,view:t,children:i,namespace:n="default",onChange:r})=>{const[o,a]=l().useState(!1),c=function(e){return"widget-article-image"===e?[
|
|
281
|
+
`,yt=I.default.registry.getLazyComponent("Button"),vt=I.default.registry.getLazyComponent("ModalLayout"),ht=I.default.registry.getLazyComponent("ModalContent"),wt=({mode:e,view:t,children:i,namespace:n="default",onChange:r})=>{const[o,a]=l().useState(!1),c=function(e){return"widget-article-image"===e?[W.$L.definition("widget-article-title"),W.$L.definition("widget-article-button")]:[W.$L.definition("widget-article-title"),W.$L.definition("widget-article-text"),W.$L.definition("widget-article-image"),W.$L.definition("widget-article-button"),W.$L.definition("widget-article-slider"),W.$L.definition("widget-article-attachment")]}(n),s=(0,G.useIntl)(),d={open:o,portalId:"react-modal",variant:"full-height",closeHandler:()=>a(!1)},u=e=>{r(W.$L.factory(e)),a(!1)};return l().createElement(l().Fragment,null,l().createElement(vt,Object.assign({},d),l().createElement(ht,{onClickIconClose:d.closeHandler,title:"widget builder"},l().createElement(ut,null,c.map(((e,t)=>l().createElement(mt,{key:t,onClick:()=>u(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},s.formatMessage({id:e.label})))))))),"custom"===e&&i?l().createElement("div",{onClick:()=>a(!0)},i):l().createElement(l().Fragment,null),"button"===e&&"edit"===t?l().createElement(yt,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},s.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e&&"edit"===t?l().createElement(ut,null,c.map(((e,t)=>l().createElement(mt,{key:t,onClick:()=>u(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},s.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e&&"edit"===t?l().createElement(xt,{widgets:c,onClick:u}):l().createElement(l().Fragment,null))},xt=({widgets:e,onClick:t})=>{const[i,n]=l().useState(!1),r=(0,G.useIntl)();return l().createElement(l().Fragment,null,l().createElement(pt,{open:i},l().createElement(Et,{onClick:()=>n(!i)},r.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(gt,null,e.map(((e,n)=>l().createElement(ft,{key:e.name,open:i,index:n,onClick:()=>t(e.name)},l().createElement("img",{src:e.img}),r.formatMessage({id:e.label})))))))}}}]);
|
|
282
282
|
//# sourceMappingURL=39.bundle.js.map
|