jamespot-react-core 1.1.118 → 1.1.120
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/562.bundle.js +4 -4
- package/build/562.bundle.js.map +1 -1
- package/build/app.bundle.js +417 -293
- package/build/app.bundle.js.map +1 -1
- package/build/assets/jamespot-216.084c33ac57c64ed8cbae80ae279351f9.png +0 -0
- package/build/assets/jamespot-blue-216.90c747d6f7f5e5300e42a88f1caaf1ed.png +0 -0
- package/build/src/components/TwoColLayout.d.ts +1 -0
- package/build/src/registry/ext-component-list.d.ts +2 -0
- package/build/src/utils/router.d.ts +6 -2
- package/package.json +4 -4
package/build/562.bundle.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
${e=>e.stretch&&"\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n "}
|
|
3
3
|
`,u=c().div`
|
|
4
4
|
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
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(248),E=n(181),f=n(556);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 x=n(855),b=n(
|
|
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(248),E=n(181),f=n(556);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:t.absolutePath?t.path:`/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 x=n(855),b=n(57);const C=f.default.registry.getLazyComponent("Loader"),L=({name:e,uniqid:t,inplace:n})=>{const i=(0,x.useSelector)((e=>b.$L.selectors.selectWidgetState(e,t))),o=b.$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}))};var q=n(839);const $=c().div`
|
|
6
6
|
width: 0;
|
|
7
7
|
height: 0;
|
|
8
8
|
overflow: hidden;
|
|
9
|
-
`,W=f.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),k=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:a,onUploadEnd:r,onUploadSuccess:c})=>{const s=l().useRef(null),d=(0,x.useSelector)(b.$L.selectors.selectToken),[u,m]=l().useState(0),[g,p]=l().useState(t);return l().useEffect((()=>{var e;n&&(null===(e=s.current)||void 0===e||e.click())}),[n]),l().useEffect((()=>{t.length!==g.length&&p(t)}),[t]),l().useEffect((()=>{c(g)}),[g]),l().useEffect((()=>{0===u&&r()}),[u]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=s.current)||void 0===e||e.click())}},e),l().createElement($,null,l().createElement(W,{ref:s,id:"widget-upload-file",name:"editorFiles",content:"",accept:o,multiple:i,token:d,onUploadStart:e=>{void 0!==e&&m((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(m((e=>void 0!==e?e-1:0)),p((t=>i?[...t,e]:[e])))}})))},S=f.default.registry.getLazyComponent("WidgetArticleGallery"),I=f.default.registry.getLazyComponent("FileViewer"),T=({widget:e,inplace:t,mode:n,onStateChange:i})=>{var o,a;const{uniqid:r}=e,{files:c}=e.content,s=(0,x.useDispatch)(),d=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,r))),u=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,r)),x.shallowEqual);return l().useEffect((()=>{i({mounted:!0})}),[]),void 0!==c?l().createElement(l().Fragment,null,"edit"===n?l().createElement(S,{files:c,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(I,{files:c,openWithOptions:{}},(t=>{var n,i;return l().createElement(S,{files:c,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)})})),t&&"edit"===n?l().createElement(k,{initialFiles:c,initialClick:u,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{"widget-article-gallery"===(null==d?void 0:d.widget.name)&&s(b.$L.slice.actions.updateWidget({uniqid:r,content:{files:e}}))},onUploadStart:()=>{s(b.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{s(b.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(q.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)};var A=n(6),_=n.n(A);const D=f.default.registry.getLazyComponent("WidgetArticleAttachment"),F=f.default.registry.getLazyComponent("FileViewer"),j=({widget:e,inplace:t,mode:n,onStateChange:i})=>{const{uniqid:o}=e,{files:a}=e.content,r=(0,x.useDispatch)(),c=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,o))),s=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,o)),x.shallowEqual);l().useEffect((()=>{i({mounted:!0})}),[]);const d=[{label:"Wedoc",onClick:e=>{e&&_().
|
|
9
|
+
`,W=f.default.registry.getLazyComponent("DEPRECATEDFormInputFile"),k=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:a,onUploadEnd:r,onUploadSuccess:c})=>{const s=l().useRef(null),d=(0,x.useSelector)(b.$L.selectors.selectToken),[u,m]=l().useState(0),[g,p]=l().useState(t);return l().useEffect((()=>{var e;n&&(null===(e=s.current)||void 0===e||e.click())}),[n]),l().useEffect((()=>{t.length!==g.length&&p(t)}),[t]),l().useEffect((()=>{c(g)}),[g]),l().useEffect((()=>{0===u&&r()}),[u]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=s.current)||void 0===e||e.click())}},e),l().createElement($,null,l().createElement(W,{ref:s,id:"widget-upload-file",name:"editorFiles",content:"",accept:o,multiple:i,token:d,onUploadStart:e=>{void 0!==e&&m((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(m((e=>void 0!==e?e-1:0)),p((t=>i?[...t,e]:[e])))}})))},S=f.default.registry.getLazyComponent("WidgetArticleGallery"),I=f.default.registry.getLazyComponent("FileViewer"),T=({widget:e,inplace:t,mode:n,onStateChange:i})=>{var o,a;const{uniqid:r}=e,{files:c}=e.content,s=(0,x.useDispatch)(),d=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,r))),u=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,r)),x.shallowEqual);return l().useEffect((()=>{i({mounted:!0})}),[]),void 0!==c?l().createElement(l().Fragment,null,"edit"===n?l().createElement(S,{files:c,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(I,{files:c,openWithOptions:{}},(t=>{var n,i;return l().createElement(S,{files:c,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)})})),t&&"edit"===n?l().createElement(k,{initialFiles:c,initialClick:u,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{"widget-article-gallery"===(null==d?void 0:d.widget.name)&&s(b.$L.slice.actions.updateWidget({uniqid:r,content:{files:e}}))},onUploadStart:()=>{s(b.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{s(b.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(q.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)};var A=n(6),_=n.n(A);const D=f.default.registry.getLazyComponent("WidgetArticleAttachment"),F=f.default.registry.getLazyComponent("FileViewer"),j=({widget:e,inplace:t,mode:n,onStateChange:i})=>{const{uniqid:o}=e,{files:a}=e.content,r=(0,x.useDispatch)(),c=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,o))),s=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,o)),x.shallowEqual);l().useEffect((()=>{i({mounted:!0})}),[]);const d=[{label:"Wedoc",onClick:e=>{e&&_().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const n=t.result;((e,t,n)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,n)})).catch((()=>{r(b.FN.actions.error({label:"Unable to open this file"},6e3))}))}}],u=(0,x.useSelector)((e=>b.Mx.selectors.selectById(e,"OnlyOfficeHook")))?{"application/vnd.openxmlformats-officedocument.wordprocessingml.document":d,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":d,"application/vnd.openxmlformats-officedocument.presentationml.presentation":d}:{};return void 0!==a?l().createElement(l().Fragment,null,"view"!==n?l().createElement(D,{files:a,onClick:()=>{}}):l().createElement(F,{files:a,openWithOptions:u},(e=>l().createElement(D,{files:a,onClick:t=>e(t)}))),t&&"view"!==n?l().createElement(k,{initialFiles:a,initialClick:s,multiple:!0,accept:"*",onUploadSuccess:e=>{"widget-article-attachment"===(null==c?void 0:c.widget.name)&&r(b.$L.slice.actions.updateWidget({uniqid:o,content:{files:e}}))},onUploadStart:()=>{r(b.$L.slice.actions.setWidgetState({uniqid:o,loading:!0}))},onUploadEnd:()=>{r(b.$L.slice.actions.setWidgetState({uniqid:o,loading:!1}))}},"edit"===n?l().createElement(q.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)):l().createElement(l().Fragment,null)},R=f.default.registry.getLazyComponent("WidgetArticleImage"),O=c().div`
|
|
10
10
|
position: absolute;
|
|
11
11
|
inset: 0;
|
|
12
12
|
background-color: rgba(0, 0, 0, 0.4);
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
&:hover {
|
|
20
20
|
opacity: 1;
|
|
21
21
|
}
|
|
22
|
-
`,G=({widget:e,inplace:t,mode:n,onStateChange:i})=>{const{uniqid:o}=e,{file:a,displayAs:r,useFilter:c,backgroundPosition:s,backgroundSize:d,borderRadius:u}=e.content,m=(0,x.useDispatch)(),g=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,o))),p=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,o)),x.shallowEqual),f=(0,E.useIntl)();return l().useEffect((()=>{i({mounted:!0})}),[]),l().createElement(l().Fragment,null,l().createElement(
|
|
22
|
+
`,G=({widget:e,inplace:t,mode:n,onStateChange:i})=>{const{uniqid:o}=e,{file:a,displayAs:r,useFilter:c,backgroundPosition:s,backgroundSize:d,borderRadius:u}=e.content,m=(0,x.useDispatch)(),g=(0,x.useSelector)((e=>b.$L.selectors.selectWidget(e,o))),p=(0,x.useSelector)((e=>b.$L.selectors.isActive(e,o)),x.shallowEqual),f=(0,E.useIntl)();return l().useEffect((()=>{i({mounted:!0})}),[]),l().createElement(l().Fragment,null,l().createElement(R,{maxWidth:"view"!==n?800:600,uri:void 0!==a?`/imagecache/fitx1200/fileArticle/${a.id}.png`:void 0,displayAs:null!=r?r:"image",borderRadius:null!=u?u:"8",useFilter:null!=c&&c,backgroundPosition:null!=s?s:"center",backgroundSize:null!=d?d:"auto"}),t&&"edit"===n?l().createElement(k,{initialFiles:[],initialClick:p,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{"widget-article-image"===(null==g?void 0:g.widget.name)&&void 0!==e[0]&&m(b.$L.slice.actions.updateWidget({uniqid:o,content:{file:e[0]}}))},onUploadStart:()=>{m(b.$L.slice.actions.setWidgetState({uniqid:o,loading:!0}))},onUploadEnd:()=>{m(b.$L.slice.actions.setWidgetState({uniqid:o,loading:!1}))}},void 0!==a?l().createElement(O,null,f.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(q.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))},z=c().div`
|
|
23
23
|
flex: 1;
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: row;
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
flex: 1;
|
|
214
214
|
display: flex;
|
|
215
215
|
align-items: center;
|
|
216
|
-
`,({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>b.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(ge,null,l().createElement(pe,null),l().createElement(Ee,null,"Popup"),l().createElement(pe,null,l().createElement(he,{onClick:()=>{t(b.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(q.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ge,null,l().createElement(q.JRCButton,{onClick:()=>{t(b.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),Le=f.default.registry.getLazyComponent("WidgetArticleTitleEditor"),qe=f.default.registry.getLazyComponent("WidgetArticleImageEditor"),$e=f.default.registry.getLazyComponent("WidgetArticleTextEditor"),We=f.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),ke=f.default.registry.getLazyComponent("WidgetArticleButtonEditor"),Se=f.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),Ie=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)(b.$L.selectors.selectToken),i=(0,x.useSelector)((t=>b.$L.selectors.selectWidget(t,e))),o=n=>{i&&t(b.$L.slice.actions.updateWidget({uniqid:e,content:n})),t(b.Wq.slice.actions.flushEditor({uniqid:e}))},a=(n,i)=>t(b.$L.slice.actions.updateWidget({uniqid:e,content:n,override:i})),r=(n,i)=>{t(void 0!==i?b.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},n)):b.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},n)))},c=n=>{t(b.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 b.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(ke,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(Se,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case b.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(We,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement($e,{onChange:a,onSave:o,content:i.widget.content});case b.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(qe,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(Le,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},Te=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,E.useIntl)(),i=(0,x.useSelector)((t=>b.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(Ae,{uniqid:e}),i&&i.widgets?i.widgets.map(((o,a)=>{const r=b.$L.definition(o.widget.name);return l().createElement("div",{key:a},l().createElement(we,null,l().createElement(xe,{onClick:()=>((e,n)=>{t(b.Wq.slice.actions.registerEditor({uniqid:e,name:n}))})(o.widget.uniqid,o.widget.name)},n.formatMessage({id:r.label})),l().createElement(be,{onClick:()=>{i.widgets&&t(b.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},i),{widgets:[...i.widgets.filter(((e,t)=>t!==a))]})}))}},l().createElement(q.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Ae=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.ids[e].widget.layers),x.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(q.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(je,{uniqid:e,key:t}),elms:n||[]}),l().createElement(de,{namespace:"default",onChange:n=>{t(b.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},_e=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(b.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(q.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},De=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(b.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(q.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Fe=({uniqid:e,layerId:t})=>{const n=(0,x.useDispatch)();return l().createElement("div",{onClick:()=>{n(b.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(q.JRCIcon,{name:"icon-trash"}))},je=({uniqid:e})=>{const t=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=b.$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(_e,{uniqid:e}),l().createElement(De,{uniqid:e}),l().createElement(Fe,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},
|
|
216
|
+
`,({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>b.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(ge,null,l().createElement(pe,null),l().createElement(Ee,null,"Popup"),l().createElement(pe,null,l().createElement(he,{onClick:()=>{t(b.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(q.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ge,null,l().createElement(q.JRCButton,{onClick:()=>{t(b.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)}),Le=f.default.registry.getLazyComponent("WidgetArticleTitleEditor"),qe=f.default.registry.getLazyComponent("WidgetArticleImageEditor"),$e=f.default.registry.getLazyComponent("WidgetArticleTextEditor"),We=f.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),ke=f.default.registry.getLazyComponent("WidgetArticleButtonEditor"),Se=f.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),Ie=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)(b.$L.selectors.selectToken),i=(0,x.useSelector)((t=>b.$L.selectors.selectWidget(t,e))),o=n=>{i&&t(b.$L.slice.actions.updateWidget({uniqid:e,content:n})),t(b.Wq.slice.actions.flushEditor({uniqid:e}))},a=(n,i)=>t(b.$L.slice.actions.updateWidget({uniqid:e,content:n,override:i})),r=(n,i)=>{t(void 0!==i?b.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},n)):b.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},n)))},c=n=>{t(b.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 b.$L.const.WIDGET_ARTICLE_BUTTON:return l().createElement(ke,{content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_ATTACHMENT:return l().createElement(Se,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r,onOpen:c});case b.$L.const.WIDGET_ARTICLE_GALLERY:return l().createElement(We,{token:n,content:i.widget.content,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_TEXT:return l().createElement($e,{onChange:a,onSave:o,content:i.widget.content});case b.$L.const.WIDGET_ARTICLE_IMAGE:return l().createElement(qe,{content:i.widget.content,token:n,onChange:a,onSave:o,onStateChange:r});case b.$L.const.WIDGET_ARTICLE_TITLE:return l().createElement(Le,{onChange:a,onSave:o,content:i.widget.content,onOpen:c})}},Te=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,E.useIntl)(),i=(0,x.useSelector)((t=>b.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(Ae,{uniqid:e}),i&&i.widgets?i.widgets.map(((o,a)=>{const r=b.$L.definition(o.widget.name);return l().createElement("div",{key:a},l().createElement(we,null,l().createElement(xe,{onClick:()=>((e,n)=>{t(b.Wq.slice.actions.registerEditor({uniqid:e,name:n}))})(o.widget.uniqid,o.widget.name)},n.formatMessage({id:r.label})),l().createElement(be,{onClick:()=>{i.widgets&&t(b.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},i),{widgets:[...i.widgets.filter(((e,t)=>t!==a))]})}))}},l().createElement(q.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Ae=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.ids[e].widget.layers),x.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(q.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(je,{uniqid:e,key:t}),elms:n||[]}),l().createElement(de,{namespace:"default",onChange:n=>{t(b.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},_e=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(b.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(q.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},De=({uniqid:e})=>{const t=(0,x.useDispatch)(),n=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(b.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(q.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Fe=({uniqid:e,layerId:t})=>{const n=(0,x.useDispatch)();return l().createElement("div",{onClick:()=>{n(b.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(q.JRCIcon,{name:"icon-trash"}))},je=({uniqid:e})=>{const t=(0,x.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=b.$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(_e,{uniqid:e}),l().createElement(De,{uniqid:e}),l().createElement(Fe,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},Re=f.default.registry.getLazyComponent("Button"),Oe=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,x.useDispatch)(),i=(0,x.useSelector)((t=>b.$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(q.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"EDITOR_Widget_Wrapper_Title"})}),l().createElement(Re,{onClick:()=>{void 0!==a&&(n(b.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:a})),n(b.Wq.slice.actions.flushEditor({uniqid:e})))},variant:"outlined",minWidth:"100%"},t.formatMessage({id:"EDITOR_Save_Widget"}))):l().createElement(l().Fragment,null,"No wrapper")},Ge=f.default.registry.getLazyComponent("Icon"),ze=({uniqid:e})=>{const t=(0,E.useIntl)(),n=(0,x.useDispatch)(),i=(0,x.useSelector)((t=>b.Wq.selectors.selectEditor(t,e))),o=b.$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(fe,{visible:a},l().createElement(ve,null,o.panel.useWrapper?l().createElement(he,{isActive:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(Ge,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(he,{isActive:"default"===c,onClick:()=>s("default")},l().createElement(Ge,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(Ue,{uniqid:e},l().createElement(he,{isActive:"widgets"===c,onClick:()=>s("widgets")},l().createElement(Ge,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(ge,null,l().createElement(Me,{uniqid:e,position:i.position}),l().createElement(Ee,null,t.formatMessage({id:o.label})),l().createElement(pe,null,l().createElement(he,{onClick:()=>{n(b.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Ge,{name:"icon-times",color:"grey2"})))),l().createElement(ye,null,"default"===c&&o.panel.useEditor?l().createElement(Ie,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement(Oe,{uniqid:i.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&o.panel.useWidgets?l().createElement(Te,{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)},Me=({uniqid:e,position:t})=>{const n=(0,x.useDispatch)();return l().createElement(pe,null,l().createElement(he,{onClick:()=>{n(b.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ge,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Ue=({uniqid:e,children:t})=>{const n=(0,x.useSelector)((t=>b.$L.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},Je=c().div`
|
|
217
217
|
position: absolute;
|
|
218
218
|
inset: 0;
|
|
219
219
|
pointer-events: none;
|