jamespot-react-core 1.1.130 → 1.1.132
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/98.bundle.js
CHANGED
|
@@ -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,r.GF)(e.fields,e.type),c=(0,o.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,r.GF)(e.fields,e.type),c=(0,o.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(548);c().div`
|
|
13
13
|
margin-bottom: 24px;
|
|
14
14
|
`,c().div`
|
|
15
15
|
margin-bottom: 4px;
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
flex: 1;
|
|
109
109
|
display: flex;
|
|
110
110
|
align-items: center;
|
|
111
|
-
`;var W=i(
|
|
111
|
+
`;var W=i(710);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"),F=I.default.registry.getLazyComponent("WidgetArticleImageEditor"),_=I.default.registry.getLazyComponent("WidgetArticleTextEditor"),D=I.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),j=I.default.registry.getLazyComponent("WidgetArticleButtonEditor"),T=I.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),M=I.default.registry.getLazyComponent("WidgetArticleSliderEditor"),z=({uniqid:e})=>{var t,i,n;const o=(0,f.useDispatch)(),r=(0,f.useSelector)(W.$L.selectors.selectToken),a=(0,f.useSelector)((t=>W.$L.selectors.selectWidget(t,e))),c=t=>{a&&o(W.$L.slice.actions.updateWidget({uniqid:e,content:t})),o(W.Wq.slice.actions.flushEditor({uniqid:e}))},s=(t,i)=>{o(void 0!==i?W.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},t)):W.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},d=t=>{o(W.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))};switch(null==a?void 0:a.widget.name){default:return l().createElement(l().Fragment,null,"cannot display editor");case"widget-article-button":return l().createElement(j,{content:a.widget.content,onChange:t=>{o((0,W.O5)(e,t,!1))},onSave:c,onStateChange:s});case"widget-article-attachment":return l().createElement(T,{token:r,content:a.widget.content,onChange:t=>o((0,W.O5)(e,t,!1)),onSave:c,onStateChange:s,onOpen:d});case"widget-article-gallery":return l().createElement(D,{token:r,content:a.widget.content,onChange:t=>o((0,W.O5)(e,t,!1)),onSave:c,onStateChange:s});case"widget-article-text":return l().createElement(_,{onChange:t=>o((0,W.O5)(e,t,!1)),onSave:c,content:a.widget.content});case"widget-article-image":return l().createElement(F,{content:a.widget.content,token:r,onChange:t=>o((0,W.O5)(e,t,!1)),onSave:c,onStateChange:s});case"widget-article-title":return l().createElement(O,{onChange:t=>{o((0,W.O5)(e,t,!1))},onSave:c,content:a.widget.content,onOpen:d});case"widget-article-slider":return void 0!==r?l().createElement(M,{slides:null!==(t=a.widget.content.slides)&&void 0!==t?t:[],loop:null!==(i=a.widget.content.loop)&&void 0!==i&&i,useDots:null===(n=a.widget.content.useDots)||void 0===n||n,onChange:t=>{o((0,W.O5)(e,t,!1))},token:r,onSave:c}):l().createElement(l().Fragment,null,"Token is mandatory")}};var R=i(181);const G=({uniqid:e})=>{const t=(0,f.useDispatch)(),i=(0,R.useIntl)(),n=(0,f.useSelector)((t=>W.$L.selectors.selectWidgetContent(t,e)));return l().createElement("div",{style:{flex:1}},l().createElement(B,{uniqid:e}),n&&n.widgets?n.widgets.map(((o,r)=>{const a=W.$L.definition(o.widget.name);return l().createElement("div",{key:r},l().createElement($,null,l().createElement(L,{onClick:()=>((e,i)=>{t(W.Wq.slice.actions.registerEditor({uniqid:e,name:i}))})(o.widget.uniqid,o.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!==r))]})}))}},l().createElement(y.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},B=({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(Et,{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"}))},P=({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"}))},H=({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 o=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"}},o.label),l().createElement(U,{uniqid:e}),l().createElement(P,{uniqid:e}),l().createElement(H,{uniqid:i.widget.uniqid,layerId:t.uniqid}))})))},N=I.default.registry.getLazyComponent("Button"),Q=({uniqid:e})=>{const t=(0,R.useIntl)(),i=(0,f.useDispatch)(),n=(0,f.useSelector)((t=>W.$L.selectors.selectWidget(t,e))),[r,a]=l().useState(null==n?void 0:n.title),{control:c,watch:s}=(0,o.useForm)({defaultValues:{text:null!=r?r:""},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(N,{onClick:()=>{void 0!==r&&(i(W.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:r})),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")},X=I.default.registry.getLazyComponent("Icon"),Y=({uniqid:e})=>{const t=(0,R.useIntl)(),i=(0,f.useDispatch)(),n=(0,f.useSelector)((t=>W.Wq.selectors.selectEditor(t,e))),o=W.$L.definition(null==n?void 0:n.name),[r,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:r},l().createElement(q,null,o.panel.useWrapper?l().createElement(k,{isActive:"wrapper"===c,onClick:()=>s("wrapper")},l().createElement(X,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useEditor?l().createElement(k,{isActive:"default"===c,onClick:()=>s("default")},l().createElement(X,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),o.panel.useWidgets?l().createElement(Z,{uniqid:e},l().createElement(k,{isActive:"widgets"===c,onClick:()=>s("widgets")},l().createElement(X,{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(K,{uniqid:e,position:n.position}),l().createElement(x,null,t.formatMessage({id:o.label})),l().createElement(w,null,l().createElement(k,{onClick:()=>{i(W.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(X,{name:"icon-times",color:"grey2"})))),l().createElement(C,null,"default"===c&&o.panel.useEditor?l().createElement(z,{uniqid:n.uniqid}):l().createElement(l().Fragment,null),"wrapper"===c&&o.panel.useWrapper?l().createElement(Q,{uniqid:n.uniqid}):l().createElement(l().Fragment,null),"widgets"===c&&o.panel.useWidgets?l().createElement(G,{uniqid:e,namespace:o.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)},K=({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(X,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Z=({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)},ee=c().div`
|
|
112
112
|
position: absolute;
|
|
113
113
|
inset: 0;
|
|
114
114
|
pointer-events: none;
|