jamespot-react-core 1.1.158 → 1.1.160
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/{770.bundle.js → 945.bundle.js} +47 -47
- package/build/945.bundle.js.map +1 -0
- package/build/app.bundle.js +1180 -1200
- package/build/app.bundle.js.map +1 -1
- package/build/socket.sharedworker.36b2317446c7c433029e.js +2 -0
- package/build/socket.sharedworker.36b2317446c7c433029e.js.map +1 -0
- package/build/src/components/widgets/wrapper/JRCWidgetDatasourceTableWrapper.d.ts +2 -2
- package/build/src/components/widgets/wrapper/JRCWidgetExcelDatasourceTableWrapper.d.ts +2 -2
- package/build/src/components/widgets/wrapper/utils.d.ts +1 -21
- package/build/src/displayer/types.d.ts +13 -2
- package/build/src/utils/types.d.ts +1 -0
- package/package.json +4 -5
- package/build/770.bundle.js.map +0 -1
- package/build/socket.sharedworker.dd3721cc98a91b6cf80a.js +0 -2
- package/build/socket.sharedworker.dd3721cc98a91b6cf80a.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[945],{945:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>h,Audience:()=>p,Avatar:()=>u,CommentsBloc:()=>mt,DisplayForm:()=>bt,EditorsPortal:()=>pn,Empty:()=>fn,JRCInputTinyMCEWithExt:()=>yn,JRCInputTinyMCEWithExtRaw:()=>vn,ModalAudience:()=>hn,TwoColLayout:()=>kn,WidgetList:()=>R,WidgetWrapperCore:()=>Qe});var i=n(594),l=n.n(i),o=n(196),r=n.n(o),a=n(493),s=n(775),c=n(64),d=n(704);const u=e=>{var t;const n=(0,o.useTheme)(),i=(0,d.useSelector)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(s.JRCIcon,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},m=r().div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
border: 4px solid ${e=>e.theme.color.white};
|
|
18
18
|
margin-left: ${e=>e.overlap?"-18px":"0"};
|
|
19
19
|
cursor: pointer;
|
|
20
|
-
`,p=({audience:e,limit:t=2})=>{const n=(0,a.useIntl)(),r=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCFlexBox,null,[...e].splice(0,t).map(((e,t)=>l().createElement(g,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(s.JRCTooltip,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(u,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0}))))),e.length>t&&l().createElement(g,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(s.JRCModalLayout,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(s.JRCModalContent,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(m,null,e.map(((e,t)=>l().createElement(s.JRCFlexBox,{key:`audience-${t}`,y:"center",gap:r.space.l},l().createElement(u,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(s.JRCStyledHref,{href:`${e.type}/${e.id}`},l().createElement(s.JRCTypography,null,e.title)))))))))};var f=n(
|
|
20
|
+
`,p=({audience:e,limit:t=2})=>{const n=(0,a.useIntl)(),r=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCFlexBox,null,[...e].splice(0,t).map(((e,t)=>l().createElement(g,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(s.JRCTooltip,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(u,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0}))))),e.length>t&&l().createElement(g,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(s.JRCModalLayout,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(s.JRCModalContent,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(m,null,e.map(((e,t)=>l().createElement(s.JRCFlexBox,{key:`audience-${t}`,y:"center",gap:r.space.l},l().createElement(u,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(s.JRCStyledHref,{href:`${e.type}/${e.id}`},l().createElement(s.JRCTypography,null,e.title)))))))))};var f=n(833),E=n.n(f);const y=r().div`
|
|
21
21
|
padding: ${e=>e.theme.space.md}px;
|
|
22
|
-
`,
|
|
22
|
+
`,v={response:void 0,loading:!0,error:void 0},h=({query:e})=>{const t=(0,a.useIntl)(),[n,r]=(0,i.useState)(v),c=(0,o.useTheme)(),d=(0,i.useCallback)((e=>{r(v),E().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 n=e.result.text;r({error:void 0,loading:!1,response:n})})).catch((e=>{r({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,i.useEffect)((()=>{e&&e.text.trim().length>0&&d(e)}),[e,d]),l().createElement(s.JRCModalLayout,{zIndex:c.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(s.JRCModalContent,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&d(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>n.response&&(null==e?void 0:e.resolve(n.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},l().createElement(y,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(s.JRCLoader,null),l().createElement(s.JRCTypography,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!n.loading&&n.error&&l().createElement("p",null,n.error),!n.loading&&n.response&&l().createElement("p",null,n.response))))};var x=n(124);const b=r().div`
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: row;
|
|
25
25
|
flex-wrap: wrap;
|
|
26
26
|
gap: 10px;
|
|
27
27
|
justify-content: center;
|
|
28
|
-
`,
|
|
28
|
+
`,C=r().div`
|
|
29
29
|
border: 1px solid ${e=>e.theme.color.grey2};
|
|
30
30
|
border-radius: 8px;
|
|
31
31
|
cursor: pointer;
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
transition: height 0.4s;
|
|
61
61
|
overflow: hidden;
|
|
62
62
|
flex-direction: column;
|
|
63
|
-
`,
|
|
63
|
+
`,k=r().div`
|
|
64
64
|
display: flex;
|
|
65
65
|
flex-direction: row;
|
|
66
66
|
flex-wrap: wrap;
|
|
67
67
|
justify-content: center;
|
|
68
68
|
gap: 10px;
|
|
69
|
-
`,
|
|
69
|
+
`,W=r().div`
|
|
70
70
|
min-height: 50px;
|
|
71
71
|
display: flex;
|
|
72
72
|
justify-content: center;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
&:hover {
|
|
77
77
|
background-color: ${e=>e.theme.color.grey0};
|
|
78
78
|
}
|
|
79
|
-
`,
|
|
79
|
+
`,S=r().button`
|
|
80
80
|
height: 72px;
|
|
81
81
|
display: flex;
|
|
82
82
|
align-items: center;
|
|
@@ -91,20 +91,20 @@
|
|
|
91
91
|
width: 40px;
|
|
92
92
|
}
|
|
93
93
|
${e=>e.full&&"flex: 1"}
|
|
94
|
-
`,
|
|
94
|
+
`,A=r().div`
|
|
95
95
|
display: flex;
|
|
96
96
|
flex-direction: ${e=>"row"===e.direction?"row":"column"};
|
|
97
97
|
align-items: ${e=>"row"===e.direction?"center":"flex-start"};
|
|
98
98
|
justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
|
|
99
99
|
flex: 1;
|
|
100
100
|
${e=>e.gap&&`gap:${e.gap}px`}
|
|
101
|
-
`,q=
|
|
101
|
+
`,q=x.default.registry.getLazyComponent("Button"),T=x.default.registry.getLazyComponent("ModalLayout"),M=x.default.registry.getLazyComponent("ModalContent"),I=x.default.registry.getLazyComponent("Tooltip"),L=x.default.registry.getLazyComponent("IconButton"),R=({mode:e,view:t,children:n,namespace:i="default",onChange:o})=>{const[r,s]=l().useState(!1),d=function(e){switch(e){case"widget-article-image":return[c.x0.definition(f.WidgetsName.ArticleTitle),c.x0.definition(f.WidgetsName.ArticleButton)];case"comment":return[c.x0.definition(f.WidgetsName.CheckList)];default:return[c.x0.definition(f.WidgetsName.ArticleTitle),c.x0.definition(f.WidgetsName.ArticleText),c.x0.definition(f.WidgetsName.ArticleImage),c.x0.definition(f.WidgetsName.ArticleButton),c.x0.definition(f.WidgetsName.ArticleSlider),c.x0.definition(f.WidgetsName.ArticleAttachment)]}}(i),u=(0,a.useIntl)(),m={open:r,portalId:"react-modal",variant:"full-height",closeHandler:()=>s(!1)},g=e=>{o(c.x0.factory(e)),s(!1)};return l().createElement(l().Fragment,null,l().createElement(T,Object.assign({},m),l().createElement(M,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:l().createElement(a.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>s(!1)}]:void 0,title:u.formatMessage({id:"WIDGET_Builder"})},"comment"===e?l().createElement(k,null,d.map(((e,t)=>l().createElement(S,{key:e.name,open:!0,full:!0,index:t,onClick:()=>g(e.name)},l().createElement(A,{direction:"row",gap:12},l().createElement("img",{src:e.img}),l().createElement(A,{direction:"column"},l().createElement("h3",null,u.formatMessage({id:e.label})),l().createElement("p",null,u.formatMessage({id:e.description})))))))):l().createElement(b,null,d.map(((e,t)=>l().createElement(C,{key:t,onClick:()=>g(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))))),"custom"===e&&n?l().createElement("div",{onClick:()=>s(!0)},n):l().createElement(l().Fragment,null),"button"===e&&"edit"===t?l().createElement(q,{onClick:()=>s(!0),variant:"outlined",minWidth:"100%"},u.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e&&"edit"===t?l().createElement(b,null,d.map(((e,t)=>l().createElement(C,{key:t,onClick:()=>g(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e&&"edit"===t?l().createElement(_,{widgets:d,onClick:g}):l().createElement(l().Fragment,null),"comment"===e&&"edit"===t?l().createElement(O,{onClick:()=>{s(!0)}}):l().createElement(l().Fragment,null))},_=({widgets:e,onClick:t})=>{const[n,i]=l().useState(!1),o=(0,a.useIntl)();return l().createElement(l().Fragment,null,l().createElement(w,{open:n},l().createElement(W,{onClick:()=>i(!n)},o.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(k,null,e.map(((e,i)=>l().createElement(S,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},l().createElement("img",{src:e.img}),o.formatMessage({id:e.label})))))))},O=({onClick:e})=>{const t=(0,a.useIntl)();return l().createElement(l().Fragment,null,l().createElement(I,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},l().createElement(L,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))},D=r().div`
|
|
102
102
|
flex: 1;
|
|
103
103
|
display: flex;
|
|
104
104
|
flex-direction: row;
|
|
105
105
|
min-height: 60px;
|
|
106
106
|
align-items: center;
|
|
107
|
-
`,
|
|
107
|
+
`,F=({widget:e})=>{const{url:t,keys:n,order:i,orderBy:o}=e.content,[r,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(D,null,l().createElement(s.JRCWidgetApi,{data:r,keys:null!=n?n:[],order:null!=i?i:"",orderBy:null!=o?o:"asc"}))};var j=n(229);const $=(e,t)=>{const n=[];return e.filter((e=>e.isVisible)).forEach((e=>{const i=t.find((t=>t.name===e.name));i&&n.push(i)})),n},z=x.default.registry.getLazyComponent("WidgetTable"),B=x.default.registry.getLazyComponent("Loader"),G=(r().div``,r().div`
|
|
108
108
|
position: absolute;
|
|
109
109
|
inset: 0;
|
|
110
110
|
display: flex;
|
|
@@ -128,27 +128,27 @@
|
|
|
128
128
|
background-color: ${e=>e.theme.color.grey2};
|
|
129
129
|
opacity: 0.9;
|
|
130
130
|
}
|
|
131
|
-
`,N=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:r,tableHeadIconColor:d,tableRowColor:u,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:y,tableSizedColumnsWidth:
|
|
131
|
+
`,N=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:r,tableHeadIconColor:d,tableRowColor:u,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:y,tableSizedColumnsWidth:v,mode:h})=>{const x=(0,a.useIntl)(),b=(0,j.jL)(),[C,w]=(0,i.useState)(!1),[k,W]=(0,i.useState)(!1),[S,A]=(0,i.useState)([]),[q,T]=(0,i.useState)([]),[M,I]=(0,i.useState)({order:"ascending",name:"unknown"}),L=(0,i.useMemo)((()=>c.x0.definition(f.WidgetsName.DatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&(W(!0),E().datasource.get(t,f.Format.VIEW).then((e=>{T(e.result.model),A(e.result.data),I(e.result.sort)})).finally((()=>W(!1))))}),[t,g,q]),(0,i.useEffect)((()=>{t||T([])}),[t]);const R=(0,i.useCallback)((()=>{b(c.cr.slice.actions.flushAllEditor()),b(c.cr.slice.actions.registerEditor({uniqid:e,name:f.WidgetsName.DatasourceTable}))}),[b,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||b(c.cr.slice.actions.flushAllEditor())}),[h,b]),(0,i.useEffect)((()=>{C||t||"edit"!==h||(R(),w(!0))}),[b,e,C,t,R,h]);const _=(0,i.useMemo)((()=>$(g,q)),[g,q]);return 0!==g.length||k||"edit"!==h?k?l().createElement(G,null,l().createElement(B,null)):l().createElement(l().Fragment,null,k||0!==S.length?l().createElement(z,{rows:S,columns:_,limit:n,tableHeadColor:o,tableHeadTextColor:r,tableHeadIconColor:d,tableRowColor:u,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:y,tableSizedColumnsWidth:v,tableDefaultSortOrder:M.order,tableDefaultSortName:M.name}):l().createElement(G,null,l().createElement("img",{src:`/img/fast-intranet/${f.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(a.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(H,{onClick:R},l().createElement(s.JRCHtml,{__html:`${x.formatMessage({id:"WIDGET_Set_Widget"})} <b>${x.formatMessage({id:L.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(G,{onClick:R},l().createElement("img",{src:`/img/fast-intranet/${f.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(a.FormattedMessage,{id:L.label}),l().createElement(s.JRCButton,{label:"GLOBAL_Settings"})),l().createElement(H,{onClick:R},l().createElement(s.JRCHtml,{__html:`${x.formatMessage({id:"WIDGET_Set_Widget"})} <b>${x.formatMessage({id:L.label})}</b>`})))},U=r().div`
|
|
132
132
|
width: 0;
|
|
133
133
|
height: 0;
|
|
134
134
|
overflow: hidden;
|
|
135
|
-
`,P=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:r,onUploadEnd:a,onUploadSuccess:u})=>{const m=l().useRef(null),g=(0,d.useSelector)(c
|
|
135
|
+
`,P=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:r,onUploadEnd:a,onUploadSuccess:u})=>{const m=l().useRef(null),g=(0,d.useSelector)(c.x0.selectors.selectToken),[p,f]=l().useState(0),[E,y]=l().useState(t);return l().useEffect((()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),l().useEffect((()=>{t.length!==E.length&&y(t)}),[t]),l().useEffect((()=>{u(E)}),[E]),l().useEffect((()=>{0===p&&a()}),[p]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}},e),l().createElement(U,null,l().createElement(s.JRCInputFileAdvancedRaw,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:o,multiple:i,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof r&&0!==e&&r()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),y((t=>i?[...t,e]:[e])))}})))},V=x.default.registry.getLazyComponent("WidgetAttachment"),Q=x.default.registry.getLazyComponent("FileViewer"),K=r().div`
|
|
136
136
|
flex: 1;
|
|
137
|
-
`,
|
|
137
|
+
`,X=({widget:e,inplace:t,mode:n})=>{const o=(0,a.useIntl)(),{uniqid:r}=e,{files:u}=e.content,m=(0,d.useDispatch)(),g=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,r)),d.shallowEqual),p=e=>{m(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:r,empty:!u||0===u.length}))}),[u]);const f=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),y=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&E().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const n=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,n)})).catch((()=>{m(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],v=f?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:y}]:[];return void 0!==u?l().createElement(K,null,"view"!==n?l().createElement(V,{files:u,onClick:()=>{},onError:p}):l().createElement(Q,{files:u,openWithOptions:v},(e=>l().createElement(V,{files:u,onClick:t=>e(t),onError:p}))),t&&"view"!==n&&l().createElement(P,{initialFiles:u,initialClick:g,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&m((0,c.vR)(r,{files:e}))},onUploadStart:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},"edit"===n?l().createElement(s.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)},Y=r().div`
|
|
138
138
|
display: flex;
|
|
139
139
|
flex: 1;
|
|
140
140
|
justify-content: center;
|
|
141
141
|
align-items: center;
|
|
142
|
-
`,
|
|
142
|
+
`,Z=r().div`
|
|
143
143
|
pointer-events: ${e=>e.clickable?"all":"none"};
|
|
144
144
|
cursor: pointer;
|
|
145
145
|
display: flex;
|
|
146
146
|
flex: 1;
|
|
147
147
|
justify-content: center;
|
|
148
148
|
align-items: center;
|
|
149
|
-
`,ee=({widget:e,mode:t})=>{const n=(0,d.useDispatch)(),{uniqid:o}=e,{text:r,url:a,target:u,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E}=e.content;return(0,i.useEffect)((()=>{n(c
|
|
149
|
+
`,ee=({widget:e,mode:t})=>{const n=(0,d.useDispatch)(),{uniqid:o}=e,{text:r,url:a,target:u,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!r||0===r.length}))}),[r]),l().createElement(Y,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Z,{clickable:"edit"!==t},l().createElement(s.JRCWidgetButton,{text:r,url:a,target:u,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E})))},te=x.default.registry.getLazyComponent("WidgetArticleGallery"),ne=x.default.registry.getLazyComponent("FileViewer"),ie=r().button`
|
|
150
150
|
cursor: pointer;
|
|
151
|
-
`,le=({widget:e,inplace:t,mode:n})=>{var i,o;const{uniqid:r}=e,{files:a}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c
|
|
151
|
+
`,le=({widget:e,inplace:t,mode:n})=>{var i,o;const{uniqid:r}=e,{files:a}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,r)),d.shallowEqual);return l().useEffect((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),void 0!==a?l().createElement(l().Fragment,null,"edit"===n?l().createElement(te,{files:a,maxWidth:800,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(o=e.content.column)&&void 0!==o?o:"3",onClick:()=>{}}):l().createElement(ne,{files:a,openWithOptions:[]},(t=>{var n,i;return l().createElement(ie,null,l().createElement(te,{files:a,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(P,{initialFiles:a,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&u((0,c.vR)(r,{files:e}))},onUploadStart:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(s.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)},oe=x.default.registry.getLazyComponent("WidgetImage"),re=x.default.registry.getLazyComponent("FileViewer"),ae=r().div`
|
|
152
152
|
position: absolute;
|
|
153
153
|
inset: 0;
|
|
154
154
|
background-color: rgba(0, 0, 0, 0.4);
|
|
@@ -163,14 +163,14 @@
|
|
|
163
163
|
}
|
|
164
164
|
`,se=r().button`
|
|
165
165
|
cursor: pointer;
|
|
166
|
-
`,ce={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},de=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},ue=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:r}=e,{file:u,useFilter:m}=e.content,g=(0,d.useDispatch)(),p=(0,d.useSelector)((e=>c
|
|
166
|
+
`,ce={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},de=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},ue=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:r}=e,{file:u,useFilter:m}=e.content,g=(0,d.useDispatch)(),p=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,r)),d.shallowEqual),[E,y]=(0,i.useState)(void 0),v=(0,a.useIntl)();return(0,i.useEffect)((()=>{g(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),(0,i.useEffect)((()=>{g(c.x0.slice.actions.setWidgetState({uniqid:r,empty:!u}))}),[u]),(0,i.useEffect)((()=>{u&&y((0,f.formatImgUrl)({timestamp:u.dateModified?de(u.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:u.uri}))}),[u]),l().createElement(l().Fragment,null,"edit"===o?void 0!==E?l().createElement(oe,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=m&&m}):l().createElement(l().Fragment,null):l().createElement(re,{files:[Object.assign(Object.assign({},ce),{path:E,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(se,{onClick:()=>e(0)},l().createElement(oe,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=m&&m})))),n&&"edit"===o?l().createElement(P,{initialFiles:[],initialClick:p,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&g((0,c.vR)(r,{file:e[0]}))},onUploadStart:()=>{g(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{g(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},void 0!==u?l().createElement(ae,null,v.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(s.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))},me=x.default.registry.getLazyComponent("FileViewer"),ge=r().div`
|
|
167
167
|
flex: 1;
|
|
168
168
|
display: flex;
|
|
169
169
|
flex-direction: row;
|
|
170
170
|
min-height: 60px;
|
|
171
171
|
align-items: center;
|
|
172
172
|
width: ${e=>e.maxWidth}px;
|
|
173
|
-
`,pe={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},fe=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Ee=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,r=(0,
|
|
173
|
+
`,pe={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},fe=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Ee=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,r=(0,j.jL)(),a=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,o)),d.shallowEqual),u=null!=n?n:600,[m,g]=(0,i.useState)(void 0),p=(0,i.useRef)(null),E=(0,i.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},pe),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:pe.mimetype,path:(0,f.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?fe(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),y=(0,i.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,f.formatImgUrl)({timestamp:e.file.dateModified?fe(e.file.dateModified):Date.now(),size:`fitx${m&&m<u?m:u}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,m,u]);(0,i.useEffect)((()=>{a&&"edit"===t&&r(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}),[a]),(0,i.useEffect)((()=>{const e=()=>{p.current&&g(p.current?p.current.offsetWidth:u)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[p]),(0,i.useEffect)((()=>{g(p.current?p.current.offsetWidth:u)}),[p]),(0,i.useEffect)((()=>{r(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const v=(0,i.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,i.useCallback)((()=>{r(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[r,e.uniqid,e.name]);return void 0===m?l().createElement("div",{ref:p,style:{width:"100%"}}):l().createElement(ge,{maxWidth:m&&m<u?m:u},l().createElement(me,{files:E,openWithOptions:[]},(n=>{var i,a;return l().createElement(s.JRCWidgetSlider,{slides:y,maxWidth:m&&m<u?m:u,useDots:null===(i=e.content.useDots)||void 0===i||i,loop:null!==(a=e.content.loop)&&void 0!==a&&a,startAt:0,onClickSlide:i=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[i];t&&t.file&&n(t.file.id)}}else r(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}})})),v?l().createElement(s.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:h}):l().createElement(l().Fragment,null))},ye=x.default.registry.getLazyComponent("WidgetArticleText"),ve=r().div`
|
|
174
174
|
cursor: text;
|
|
175
175
|
p {
|
|
176
176
|
word-wrap: break-word;
|
|
@@ -178,13 +178,13 @@
|
|
|
178
178
|
a {
|
|
179
179
|
word-wrap: break-word;
|
|
180
180
|
}
|
|
181
|
-
`,
|
|
181
|
+
`,he=({widget:e,mode:t})=>{const{uniqid:n}=e,r=(0,o.useTheme)(),{text:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,n)),d.shallowEqual),g=(0,d.useSelector)((e=>{var t;return null===(t=c.x0.selectors.selectWidgetState(e,n))||void 0===t?void 0:t.busy})),p=(0,d.useSelector)(c.x0.selectors.selectToken),f=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),E=(0,d.useSelector)(c.Kx.selectors.selectAll),y=(0,a.useIntl)(),v=(0,i.useCallback)((e=>{u(c.y8.actions.error({label:null!=e?e:y.formatMessage({id:"GLOBAL_Error"})}))}),[u,y]);(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:n,empty:!s||0===s.length}))}),[s]);const h=(0,i.useMemo)((()=>(0,x.getTinyMCEMentionsQueries)(E,r,v)),[E,v,r]);return g?l().createElement(l().Fragment,null):l().createElement(ve,null,l().createElement(ye,{autoFocus:m,text:null!=s?s:"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&f?{tinymceScriptSrc:"https://ecosysteme.jamespot.pro/js/tinymce/tinymce.min.js",commonOptions:f,mentionsQueries:h}:void 0,mode:t,onChange:e=>{u((0,c.vR)(n,{text:e}))}}))},xe=x.default.registry.getLazyComponent("WidgetArticleTitle"),be=r().div`
|
|
182
182
|
flex: 1;
|
|
183
183
|
display: flex;
|
|
184
184
|
flex-direction: row;
|
|
185
185
|
align-items: center;
|
|
186
186
|
cursor: text;
|
|
187
|
-
`,
|
|
187
|
+
`,Ce=r().div`
|
|
188
188
|
display: flex;
|
|
189
189
|
flex-direction: row;
|
|
190
190
|
border-radius: 8px;
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
&:hover {
|
|
204
204
|
background-color: ${e=>e.theme.color.grey1};
|
|
205
205
|
}
|
|
206
|
-
`,
|
|
206
|
+
`,ke=({widget:e,inplace:t,mode:n})=>{const{uniqid:o}=e,{text:r,color:a,heading:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,o)),d.shallowEqual);return(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!r||0===r.length}))}),[r]),l().createElement(be,null,l().createElement(xe,{text:r,color:a,heading:s,autoFocus:m,inplace:t,mode:n,onChange:e=>{u((0,c.vR)(o,{text:e}))}}),m&&"edit"===n?l().createElement(We,{heading:s,onClick:e=>{u((0,c.vR)(o,{heading:e}))}}):l().createElement(l().Fragment,null))},We=({heading:e="h1",onClick:t})=>l().createElement(Ce,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(we,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),Se=J.react.registry.getLazyComponent("WidgetCheckList"),Ae=J.react.registry.getLazyComponent("WidgetCheckListEditor"),qe=J.react.registry.getLazyComponent("Typography"),Te=(r().div`
|
|
207
207
|
display: flex;
|
|
208
208
|
flex-direction: row;
|
|
209
209
|
justify-content: space-between;
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
div:last-child {
|
|
230
230
|
align-self: flex-end;
|
|
231
231
|
}
|
|
232
|
-
`),
|
|
232
|
+
`),Me=r().div`
|
|
233
233
|
width: 100%;
|
|
234
234
|
flex: 1;
|
|
235
235
|
display: flex;
|
|
@@ -237,18 +237,18 @@
|
|
|
237
237
|
align-items: flex-start;
|
|
238
238
|
justify-content: center;
|
|
239
239
|
gap: 8px;
|
|
240
|
-
`,
|
|
240
|
+
`,Ie=r().div`
|
|
241
241
|
display: flex;
|
|
242
242
|
gap: 14px;
|
|
243
243
|
padding: 10px 10px 0 10px;
|
|
244
244
|
border-radius: 8px;
|
|
245
245
|
background-color: ${({theme:e})=>e.color.white};
|
|
246
246
|
border: 1px solid ${e=>e.theme.color.grey2};
|
|
247
|
-
`,
|
|
247
|
+
`,Le=r().div`
|
|
248
248
|
width: 100%;
|
|
249
249
|
padding-bottom: 12px;
|
|
250
250
|
border-bottom: ${e=>e.border?`1px solid ${e.theme.color.grey1}`:0};
|
|
251
|
-
`,
|
|
251
|
+
`,Re=({widget:e,commentId:t,inplace:n,mode:o,editRight:r,deleteRight:u,onRemove:m,onWidgetUpdate:g})=>{const p=(0,a.useIntl)(),{uniqid:y,content:v}=e,h=(0,d.useDispatch)(),[x,b]=(0,i.useState)(),[C,w]=(0,i.useState)(!1),[k,W]=(0,i.useState)(),[S,A]=(0,i.useState)(!1),q=(0,d.useSelector)((e=>c.x0.selectors.selectWidget(e,y))),T=(0,d.useSelector)(c.xJ.selectors.get),M=(0,i.useCallback)((e=>{h(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})}))}),[h,p]),I=e=>{h(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},L=()=>{h(c.x0.slice.actions.flushWidget({uniqid:y})),m&&m(y),w(!1)},R=t=>{h(c.cr.slice.actions.flushAllEditor()),h(c.x0.slice.actions.setToken({token:t})),h(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:f.WidgetsName.CheckList}))};return(0,i.useEffect)((()=>{var t;const n=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,n,i;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",checked:null!==(n=e.value)&&void 0!==n&&n},e.links&&{links:e.links}),e.user&&{user:null!==(i=e.user)&&void 0!==i?i:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));b(n)}),[e.content.arr,v]),(0,i.useEffect)((()=>{k||S||(A(!0),E().network.token().then((e=>{W(e.result),A(!1)})).catch((e=>{M(e.errorMsg)})))}),[M,k,S]),"edit"===o&&n?l().createElement(l().Fragment,null,l().createElement(Ie,null,l().createElement(Me,null,l().createElement(Le,{border:!0},l().createElement("label",null,p.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"})),l().createElement(s.JRCInputTextRaw,{id:p.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),required:!0,placeholder:p.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),type:"text",value:null==q?void 0:q.title,onChange:e=>{const{value:t}=e.target;I({uniqid:y,title:t})},margin:"2px",width:"100%"})),l().createElement(Ae,{token:k,uniqid:y,content:v,onChangeContent:(e,t)=>{h((0,c.vR)(e,t))},onChangeWrapper:I,openEditorPanel:R,onRemoveWidget:L})))):l().createElement(l().Fragment,null,x&&l().createElement("div",{key:e.uniqid,style:{width:"100%"}},l().createElement(Se,{title:null==q?void 0:q.title,limit:10,initialEntries:x,onFileClick:()=>{},onItemCheckListChange:(n,i)=>((e,n,i)=>{if(!t)return;const l={arr:null==i?void 0:i.map((e=>{var t,n;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({title:e.text},e.id&&{id:e.id}),e.links&&{links:e.links}),e.mimetype&&{mimetypes:e.mimetype}),T&&e.checked&&{user:{id:null!==(n=null===(t=e.user)||void 0===t?void 0:t.id)&&void 0!==n?n:T.id,mainType:"user",type:"user"}}),e.checked&&{value:e.checked})}))};h((0,c.vR)(e,l)),E().widget.checkListRespond({id:t,type:"comment",idUser:null==T?void 0:T.id,uniqid:e,index:n}).then((()=>{g&&g()})).catch((e=>{M(e.message)}))})(e.uniqid,n,i)}),r&&l().createElement(l().Fragment,null,l().createElement(Te,null,l().createElement("div",{style:{cursor:"pointer"},onClick:()=>{k?R(k):M(p.formatMessage({id:"GLOBAL_Error"}))}},l().createElement(qe,{size:"s"},p.formatMessage({id:"COMMENT_WIDGET_Configure"}))),u&&l().createElement("div",null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>w(!0),icon:"icon-trash"})))),l().createElement(s.JRCModal,{buttons:[{color:"cancel",clickHandler:()=>w(!1),children:l().createElement(a.FormattedMessage,{id:"GLOBAL_Cancel"})},{color:"danger",clickHandler:L,children:l().createElement(a.FormattedMessage,{id:"GLOBAL_Delete"})}],open:C,closeHandler:()=>w(!1),title:p.formatMessage({id:"GLOBAL_Delete"})},p.formatMessage({id:"COMMENT_WIDGET_Delete_Widget"}))))},_e=x.default.registry.getLazyComponent("WidgetTable"),Oe=x.default.registry.getLazyComponent("Loader"),De=(r().div``,r().div`
|
|
252
252
|
position: absolute;
|
|
253
253
|
inset: 0;
|
|
254
254
|
display: flex;
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
justify-content: center;
|
|
257
257
|
align-items: center;
|
|
258
258
|
gap: ${e=>e.theme.space.md}px;
|
|
259
|
-
`),
|
|
259
|
+
`),Fe=r().div`
|
|
260
260
|
position: absolute;
|
|
261
261
|
inset: 0;
|
|
262
262
|
display: flex;
|
|
@@ -272,13 +272,13 @@
|
|
|
272
272
|
background-color: ${e=>e.theme.color.grey2};
|
|
273
273
|
opacity: 0.9;
|
|
274
274
|
}
|
|
275
|
-
`,
|
|
275
|
+
`,je=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:r,tableHeadIconColor:d,tableRowColor:u,tableRowTextColor:m,tableColumnsData:g=[],tableBorderRadius:p,tableSizedColumns:y,tableSizedColumnsWidth:v,mode:h})=>{const x=(0,a.useIntl)(),b=(0,j.jL)(),[C,w]=(0,i.useState)(!1),[k,W]=(0,i.useState)(!1),[S,A]=(0,i.useState)([]),[q,T]=(0,i.useState)([]),M=(0,i.useMemo)((()=>c.x0.definition(f.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==g.length&&0===q.length&&(W(!0),E().datasource.get(t,f.Format.VIEW).then((e=>{T(e.result.model),A(e.result.data)})).finally((()=>W(!1))))}),[t,g,q]),(0,i.useEffect)((()=>{t||T([])}),[t]);const I=(0,i.useCallback)((()=>{b(c.cr.slice.actions.flushAllEditor()),b(c.cr.slice.actions.registerEditor({uniqid:e,name:f.WidgetsName.ExcelDatasourceTable}))}),[b,e]);(0,i.useEffect)((()=>{"view"!==h&&"preview"!==h||b(c.cr.slice.actions.flushAllEditor())}),[h,b]),(0,i.useEffect)((()=>{C||t||"edit"!==h||(I(),w(!0))}),[b,e,C,t,I,h]);const L=(0,i.useMemo)((()=>$(g,q)),[g,q]);return 0!==g.length||k||"edit"!==h?k?l().createElement(De,null,l().createElement(Oe,null)):l().createElement(l().Fragment,null,k||0!==S.length?l().createElement(_e,{rows:S,columns:L,limit:n,tableHeadColor:o,tableHeadTextColor:r,tableHeadIconColor:d,tableRowColor:u,tableRowTextColor:m,tableBorderRadius:p,tableColumnsData:g,tableSizedColumns:y,tableSizedColumnsWidth:v}):l().createElement(De,null,l().createElement("img",{src:`/img/fast-intranet/${f.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(a.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===h?l().createElement(Fe,{onClick:I},l().createElement(s.JRCHtml,{__html:`${x.formatMessage({id:"WIDGET_Set_Widget"})} <b>${x.formatMessage({id:M.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(De,{onClick:I},l().createElement("img",{src:`/img/fast-intranet/${f.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(a.FormattedMessage,{id:M.label}),l().createElement(s.JRCButton,{label:"GLOBAL_Settings"})),l().createElement(Fe,{onClick:I},l().createElement(s.JRCHtml,{__html:`${x.formatMessage({id:"WIDGET_Set_Widget"})} <b>${x.formatMessage({id:M.label})}</b>`})))},$e=({widget:e,commentId:t,width:n,inplace:i=!1,mode:o="view",editRight:r,deleteRight:a,onWidgetUpdate:s,onRemove:c,cannotDisplayComponent:d})=>{const{name:u}=e;return(0,f.ensureWidgetArticleButtonType)(e)?l().createElement(ee,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetArticleGalleryType)(e)?l().createElement(le,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetArticleAttachmentType)(e)?l().createElement(X,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetArticleImageType)(e)?l().createElement(ue,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetApiType)(e)?l().createElement(F,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetArticleSliderType)(e)?l().createElement(Ee,{widget:e,inplace:i,mode:o,width:null!=n?n:800}):(0,f.ensureWidgetArticleTitleType)(e)?l().createElement(ke,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetArticleTextType)(e)?l().createElement(he,{widget:e,inplace:i,mode:o}):(0,f.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(je,Object.assign({},e.content,{uniqid:e.uniqid,mode:o})):(0,f.ensureWidgetDatasourceTableType)(e)?l().createElement(N,Object.assign({},e.content,{uniqid:e.uniqid,mode:o})):(0,f.ensureWidgetCheckListType)(e)?l().createElement(Re,{widget:e,commentId:t,inplace:i,mode:o,editRight:null!=r&&r,deleteRight:null!=a&&a,onRemove:c,onWidgetUpdate:s}):d?l().createElement(l().Fragment,null,d(u)):l().createElement(l().Fragment,null,"cannot display widget (",u,")")},ze=r().div`
|
|
276
276
|
position: absolute;
|
|
277
277
|
inset: 0;
|
|
278
278
|
opacity: ${e=>e.opacity};
|
|
279
279
|
background-color: ${e=>e.backgroundColor};
|
|
280
280
|
pointer-events: ${e=>e.pointerEvents};
|
|
281
|
-
`,Be=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(Je,{uniqid:e,key:t,mode:"edit"}))))},Je=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(ze,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Ge,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(ze,{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(Ge,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Ge=({uniqid:e,layerId:t,mode:n})=>{const i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>t.widgets.ids[e]),d.shallowEqual),r=(0,d.useSelector)((e=>e.widgets.layers[t]));return o&&r&&r.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:r.position.y,left:r.position.x}},l().createElement(Ke,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(He,{position:{x:r.position.x,y:r.position.y},onMouseUp:e=>{(r.position&&r.position.x!==e.x||r.position&&r.position.y!==e.y)&&(e=>{i(c
|
|
281
|
+
`,Be=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(Je,{uniqid:e,key:t,mode:"edit"}))))},Je=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(ze,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Ge,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(ze,{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(Ge,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Ge=({uniqid:e,layerId:t,mode:n})=>{const i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>t.widgets.ids[e]),d.shallowEqual),r=(0,d.useSelector)((e=>e.widgets.layers[t]));return o&&r&&r.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:r.position.y,left:r.position.x}},l().createElement(Ke,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(He,{position:{x:r.position.x,y:r.position.y},onMouseUp:e=>{(r.position&&r.position.x!==e.x||r.position&&r.position.y!==e.y)&&(e=>{i(c.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(s.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(Ke,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},He=({position:e,children:t,onMouseUp:n})=>{const[o,r]=l().useState(!1),[a,s]=l().useState({x:0,y:0}),[c,d]=l().useState({x:0,y:0}),[u,m]=l().useState({x:e.x,y:e.y}),g=l().useRef(null),p=(0,i.useCallback)((e=>{r(!0),g.current&&(s({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),f=l().useCallback((e=>{if(o&&g.current){const t=c.x+(e.clientX-a.x),n=c.y+(e.clientY-a.y);m({x:t,y:n})}}),[a.x,a.y,o,c.x,c.y]),E=(0,i.useCallback)((()=>{r(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return l().useEffect((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},Ne=x.default.registry.getLazyComponent("Loader"),Ue=({name:e,uniqid:t,inplace:n})=>{const i=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetState(e,t))),o=c.x0.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(Ne,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 Pe=n(986);r().div`
|
|
282
282
|
height: 0;
|
|
283
283
|
overflow: hidden;
|
|
284
284
|
`,r().div`
|
|
@@ -320,25 +320,25 @@
|
|
|
320
320
|
min-height: 200px;
|
|
321
321
|
`;const Ve=r().div`
|
|
322
322
|
display: flex;
|
|
323
|
-
`,Qe=({uniqid:e,widgetObject:t,commentId:n,widget:o,inplace:r=!0,mode:a,width:s,editRight:u,deleteRight:m,onWidgetUpdate:g,onRemove:p,cannotDisplayComponent:E})=>{const y=(0,d.useDispatch)(),
|
|
323
|
+
`,Qe=({uniqid:e,widgetObject:t,commentId:n,widget:o,inplace:r=!0,mode:a,width:s,editRight:u,deleteRight:m,onWidgetUpdate:g,onRemove:p,cannotDisplayComponent:E})=>{const y=(0,d.useDispatch)(),v=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),h=(0,d.useSelector)((t=>t.widgets.editableMap[e]),d.shallowEqual),x=(0,d.useSelector)((e=>e.widgets.currentEditableWidgetId),d.shallowEqual),b=(0,d.useSelector)((t=>t.widgets.currentEditableWidgetId===e),d.shallowEqual),{ref:C,isComponentVisible:w,setIsComponentVisible:k}=(0,Pe.x)(!1);if((0,i.useEffect)((()=>{t&&y(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{o&&y(c.x0.slice.actions.registerWidget({uniqid:e,widget:o}))}),[]),(0,i.useEffect)((()=>{w||e===x&&y(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[w]),(0,i.useEffect)((()=>{w!==b&&k(b)}),[b]),void 0===v)return l().createElement(l().Fragment,null,"This widget cannot be displayed");const W=v.widget,S=()=>{"edit"===a?A():(0,f.ensureWidgetArticleButtonType)(W)&&"link"===W.content.openingType&&W.content.openingTypeLink&&window.open(W.content.openingTypeLink.url,W.content.openingTypeLink.target)},A=()=>{if("view"===a)return;const{widget:e}=v;y(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return r&&"view"!==a?l().createElement(Ve,{ref:C,onClick:()=>{k(!0),h&&(y(c.x0.slice.actions.setEditableIndex({index:h.index})),y(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement($e,{width:s,widget:v.widget,inplace:r,mode:a,onClick:S,onRemove:p}),l().createElement(Be,{uniqid:e,mode:a}),l().createElement(Ue,{name:v.widget.name,uniqid:v.widget.uniqid,inplace:r})):l().createElement(Ve,{onClick:A},l().createElement($e,{widget:Object.assign(Object.assign({},v.widget),v.title&&{title:v.title}),commentId:n,inplace:r,mode:a,width:s,onClick:S,editRight:u,deleteRight:m,onWidgetUpdate:g,onRemove:p,cannotDisplayComponent:E}),l().createElement(Be,{uniqid:e,mode:a}),l().createElement(Ue,{name:v.widget.name,uniqid:v.widget.uniqid,inplace:r}))},Ke=Qe;var Xe,Ye=n(700),Ze=n(206),et=new Uint8Array(16);function tt(){if(!Xe&&!(Xe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xe(et)}const nt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var it=[],lt=0;lt<256;++lt)it.push((lt+256).toString(16).substr(1));const ot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&nt.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},rt=function(e,t,n){var i=(e=e||{}).random||(e.rng||tt)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var l=0;l<16;++l)t[n+l]=i[l];return t}return ot(i)},at=J.react.registry.getLazyComponent("EditorsPortal"),st=J.react.registry.getLazyComponent("ThemeProvider"),ct=()=>{const e=document.getElementById("react-portals"),t=(0,i.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=rt(),e.appendChild(t)),t})(e)),[e]);return t?(0,Ze.createPortal)(l().createElement(st,null,l().createElement(at,null)),t):null};var dt=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function r(e){try{s(i.next(e))}catch(e){o(e)}}function a(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}s((i=i.apply(e,t||[])).next())}))};const ut=r().div`
|
|
324
324
|
display: flex;
|
|
325
325
|
flex-direction: column;
|
|
326
326
|
gap: 4px;
|
|
327
327
|
flex: 1;
|
|
328
328
|
width: 100%;
|
|
329
329
|
margin-top: 10px;
|
|
330
|
-
`,mt=({articleId:e,variant:t="inline",canComment:n})=>{var r;const u=(0,a.useIntl)(),m=(0,o.useTheme)(),g=(0,d.useDispatch)(),[p,f]=(0,i.useState)(),[y,
|
|
330
|
+
`,mt=({articleId:e,variant:t="inline",canComment:n})=>{var r;const u=(0,a.useIntl)(),m=(0,o.useTheme)(),g=(0,d.useDispatch)(),[p,f]=(0,i.useState)(),[y,v]=(0,i.useState)(!1),[h,b]=(0,i.useState)([]),[C,w]=(0,i.useState)(!1),k=(0,d.useSelector)(c.xJ.selectors.get),W=(0,d.useSelector)(c.x0.selectors.selectWidgets),S=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),A=(0,d.useSelector)(c.Kx.selectors.selectAll),q=(0,d.useSelector)(c.OD.selectors.selectPlatformConfig),T=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,d.useSelector)((t=>c.Mw.selectors.commentList(t,e))),I=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),L=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),_=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"WidgetHook")));(0,Ye.A)(e),((e,t)=>{const n=(0,d.useDispatch)(),l=(0,i.useMemo)((()=>x.default.socket),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(null==M?void 0:M.list.map((e=>e.id)),e);const O=(0,i.useCallback)((e=>{g(c.y8.actions.error({label:null!=e?e:u.formatMessage({id:"GLOBAL_Error"})}))}),[g,u]),D=()=>{g(c.Mw.actions.fetchComments({idArticle:e})),F()},F=(0,i.useCallback)((()=>{p||C||(w(!0),E().network.token().then((e=>{f(e.result),w(!1)})).catch((e=>{O(e.errorMsg)})))}),[O,p,C]),j=(0,i.useCallback)((t=>dt(void 0,void 0,void 0,(function*(){if(p){v(!0);const n=Object.keys(W).map((e=>(null==h?void 0:h.some((t=>t.widget.uniqid===e)))?W[e]:null)).filter((e=>null!==e));try{yield E().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:p,idArticle:e})).then((()=>{h.forEach((e=>{g(c.x0.slice.actions.flushWidget({uniqid:e.widget.uniqid}))})),b([])})),F()}catch(e){O(e.errorMsg)}finally{v(!1)}}}))),[e,g,F,O,p,W,h]);return(0,i.useEffect)((()=>{F()}),[F]),(0,i.useEffect)((()=>{g(c.Mw.actions.fetchComments({idArticle:e}))}),[]),l().createElement(l().Fragment,null,S&&l().createElement(l().Fragment,null,l().createElement(ut,null,l().createElement(s.JRCCommentsBloc,{canComment:n,loading:y,token:p,comments:null==M?void 0:M.list,onComment:j,onCommentUpdate:t=>dt(void 0,void 0,void 0,(function*(){var n,i;const l=null==M?void 0:M.list.find((e=>e.id===t.idComment));if(l)return E().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{g(c.Mw.actions.fetchComments({idArticle:e})),F()})).catch((e=>{O(e.errorMsg)}))})),onCommentDelete:e=>dt(void 0,void 0,void 0,(function*(){E().article.deleteComment(e).catch(O)})),isWidgetActive:!!((null==_?void 0:_.isActive)&&(null==_?void 0:_.create)&&(null===(r=null==_?void 0:_.autorize)||void 0===r?void 0:r.includes("comment"))),widgetListComponent:l().createElement(R,{mode:"comment",namespace:"comment",onChange:e=>{b([...h,e]),g(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e}))},view:"edit"}),newWidgetsWrapperComponent:l().createElement(l().Fragment,null,h.map((e=>e&&e.widget&&l().createElement("div",{key:e.widget.uniqid},l().createElement(Ke,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",onRemove:e=>b(h.filter((t=>t.widget.uniqid!==e))),cannotDisplayComponent:e=>l().createElement(s.JRCMessage,{variant:"info",message:u.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})}))))),existingWidgetsWrapperComponent:(t,n,i,o=!0,r,a=!1,d=!1)=>l().createElement(l().Fragment,null,null==n?void 0:n.map((n=>n&&l().createElement("div",{key:n.widget.uniqid},l().createElement(Ke,{uniqid:n.widget.uniqid,widgetObject:t,commentId:r,widget:n,inplace:o,mode:i,editRight:a,deleteRight:d,onWidgetUpdate:D,onRemove:t=>{E().widget.removeWidget({id:r,type:"comment",uniqid:t}).then((()=>{g(c.Mw.actions.fetchComments({idArticle:e})),F()})).catch((e=>{O(e.errorMsg)}))},cannotDisplayComponent:e=>l().createElement(s.JRCMessage,{variant:"info",message:u.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})}))))),currentUser:k,tinyMCEConfig:{commonOptions:S,mentionsQueries:(0,x.getTinyMCEMentionsQueries)(A,m,O)},onError:O,highlightFields:q.userHighlightFields,userAccountStatus:q.userAccountStatus,userModel:A.find((e=>"user"===e.type)),isWedocActive:!!T,onGetHashError:e=>g(c.y8.actions.error({label:null!=e?e:u.formatMessage({id:"GLOBAL_Error"})})),activeDrives:J.debug.UploadFromDrives?[...L&&I?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==I?void 0:I.drives)]:[],socialActionAdd:({targetId:e,targetType:t,type:n})=>E().socialAction.add({targetType:t,targetId:e,type:n}),deleteFile:e=>dt(void 0,void 0,void 0,(function*(){p&&(yield E().file.deleteFile(e,"attachment",p))})),fetchUser:e=>E().user.get(e),fetchUserFields:(e,t)=>E().user.getFields(e,t),fetchSocialActionUserList:({targetId:e,targetType:t,type:n})=>E().socialAction.getUsers({targetType:t,targetId:e,type:n}),removeLike:({targetId:e,targetType:t,type:n})=>E().socialAction.remove({targetType:t,targetId:e,type:n}),variant:t,fileBankRequests:{getBanks:()=>E().filebank.getBanks(),getFolders:e=>E().filebank.getFolders(e),getDocuments:e=>E().filebank.getDocuments(e),copyFile:e=>E().file.copy(e)}}),l().createElement(ct,null))))};var gt=n(655),pt=n(208),ft=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 Et=o.css`
|
|
331
331
|
height: 100%;
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: space-between;
|
|
335
335
|
`,yt=r().div`
|
|
336
336
|
${({stretch:e})=>e&&Et}
|
|
337
|
-
`,
|
|
337
|
+
`,vt=r().form`
|
|
338
338
|
${({stretch:e})=>e&&Et}
|
|
339
|
-
`,
|
|
339
|
+
`,ht=i.forwardRef(((e,t)=>e.onSubmit?i.createElement(vt,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):i.createElement(yt,{stretch:e.stretch,ref:t},e.children))),xt=r().div`
|
|
340
340
|
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
341
|
-
`,
|
|
341
|
+
`,bt=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,o]=(0,pt.SC)(e.fields,e.type,e.forceMandatory),r=(0,gt.useForm)({defaultValues:Object.assign(Object.assign({},o),e.defaultValues),criteriaMode:"all"}),{handleSubmit:a,control:s,reset:c}=r,d=ft(r,["handleSubmit","control","reset"]),u=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const o=null===(i=l.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==o?void 0:o.type){case"audience":t[n]=e[n].map((e=>e.uri)).join(",");break;case"taxonomy":t[n]=e[n].map((e=>e.title)).join(",");break;default:t[n]=e[n]}})),t}),[l]);return i.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:a,control:s,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),c()},getFormattedValues:()=>u(d.getValues())})),[]),i.createElement(ht,{stretch:e.stretch,onSubmit:e.onSubmit?a(e.onSubmit):void 0,ref:n},i.createElement(xt,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=ft(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:s},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(s)),e.buttons)})),Ct=(r().div`
|
|
342
342
|
margin-bottom: 24px;
|
|
343
343
|
`,r().div`
|
|
344
344
|
margin-bottom: 4px;
|
|
@@ -355,22 +355,22 @@
|
|
|
355
355
|
display: flex;
|
|
356
356
|
min-height: 60px;
|
|
357
357
|
border-bottom: 1px solid ${e=>e.theme.color.grey2};
|
|
358
|
-
`,
|
|
358
|
+
`,kt=r().div`
|
|
359
359
|
width: 60px;
|
|
360
360
|
display: flex;
|
|
361
361
|
align-items: center;
|
|
362
362
|
justify-content: center;
|
|
363
|
-
`,
|
|
363
|
+
`,Wt=r().div`
|
|
364
364
|
flex: 1;
|
|
365
365
|
display: flex;
|
|
366
366
|
align-items: center;
|
|
367
367
|
justify-content: center;
|
|
368
|
-
`,
|
|
368
|
+
`,St=r().div`
|
|
369
369
|
position: relative;
|
|
370
370
|
overflow: hidden;
|
|
371
371
|
top: 91px;
|
|
372
372
|
width: ${460}px;
|
|
373
|
-
`,
|
|
373
|
+
`,At=r().div`
|
|
374
374
|
position: absolute;
|
|
375
375
|
top: 0;
|
|
376
376
|
${e=>"left"===e.position?"left: 0px;":""}
|
|
@@ -393,20 +393,20 @@
|
|
|
393
393
|
padding: 12px;
|
|
394
394
|
overflow: auto;
|
|
395
395
|
margin-bottom: 12px;
|
|
396
|
-
|
|
396
|
+
`,Tt=r().div`
|
|
397
397
|
position: absolute;
|
|
398
398
|
inset: 0;
|
|
399
399
|
background-color: rgba(255, 255, 255, 0.8);
|
|
400
400
|
display: flex;
|
|
401
401
|
align-items: center;
|
|
402
402
|
justify-content: center;
|
|
403
|
-
`,
|
|
403
|
+
`,Mt=r().div`
|
|
404
404
|
width: ${50}px;
|
|
405
405
|
padding-top: 60px;
|
|
406
406
|
display: flex;
|
|
407
407
|
flex-direction: column;
|
|
408
408
|
border-right: 1px solid ${e=>e.theme.color.grey2};
|
|
409
|
-
`,
|
|
409
|
+
`,It=r().button`
|
|
410
410
|
border-radius: 4px;
|
|
411
411
|
cursor: pointer;
|
|
412
412
|
height: 42px;
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
&:hover {
|
|
420
420
|
background-color: ${e=>e.theme.color.grey1};
|
|
421
421
|
}
|
|
422
|
-
`,
|
|
422
|
+
`,Lt=(r().div`
|
|
423
423
|
display: flex;
|
|
424
424
|
border: 1px solid ${e=>e.theme.color.grey1};
|
|
425
425
|
border-radius: ${8}px;
|
|
@@ -437,16 +437,16 @@
|
|
|
437
437
|
background-color: ${e=>e.theme.color.grey0};
|
|
438
438
|
border-radius: 8px;
|
|
439
439
|
margin-bottom: 4px;
|
|
440
|
-
`),
|
|
440
|
+
`),Rt=r().div`
|
|
441
441
|
display: flex;
|
|
442
442
|
flex: 1;
|
|
443
443
|
align-items: center;
|
|
444
|
-
`,
|
|
444
|
+
`,_t=r().div`
|
|
445
445
|
width: 40px;
|
|
446
446
|
display: flex;
|
|
447
447
|
justify-content: center;
|
|
448
448
|
align-items: center;
|
|
449
|
-
`,
|
|
449
|
+
`,Ot=(r().div`
|
|
450
450
|
flex-direction: row;
|
|
451
451
|
display: flex;
|
|
452
452
|
align-items: center;
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
flex: 1;
|
|
455
455
|
display: flex;
|
|
456
456
|
align-items: center;
|
|
457
|
-
`,({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>c.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(wt,null,l().createElement(Wt,null),l().createElement(kt,null,"Popup"),l().createElement(Wt,null,l().createElement(Tt,{onClick:()=>{t(c.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(s.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(wt,null,l().createElement(s.JRCButton,{onClick:()=>{t(c.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)});const Ft=b.default.registry.getLazyComponent("WidgetArticleTitleEditor"),Rt=b.default.registry.getLazyComponent("WidgetArticleTextEditor"),Dt=b.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),jt=b.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),zt=b.default.registry.getLazyComponent("WidgetArticleSliderEditor"),Bt=b.default.registry.getLazyComponent("WidgetArticleImageEditor"),Jt=b.default.registry.getLazyComponent("WidgetButtonEditor"),Gt=b.default.registry.getLazyComponent("WidgetApiEditor"),Ht=b.default.registry.getLazyComponent("WidgetCheckListEditor"),Nt=b.default.registry.getLazyComponent("WidgetDatasourceTableEditor"),Ut=b.default.registry.getLazyComponent("WidgetExcelDatasourceTableEditor"),Pt=({uniqid:e})=>{var t,n,i,o,r,s,u,m;const g=(0,a.useIntl)(),p=(0,d.useDispatch)(),y=(0,d.useSelector)(c.$L.selectors.selectToken),h=(0,d.useSelector)((t=>c.$L.selectors.selectWidget(t,e)),d.shallowEqual),v=(0,d.useSelector)((t=>c.$L.selectors.selectWidgetObject(t,e)),d.shallowEqual),C=t=>{h&&p(c.$L.slice.actions.updateWidget({uniqid:e,content:t})),p(c.Wq.slice.actions.flushEditor({uniqid:e}))},x=(t,n)=>{p(void 0!==n?c.$L.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},w=t=>{p(c.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))},W=null==h?void 0:h.widget;if(!W)return null;if((0,f.ensureWidgetArticleButtonType)(W))return l().createElement(Jt,Object.assign({},W.content,{onChange:t=>{p((0,c.O5)(e,t,!1))},onSave:()=>C({})}));if((0,f.ensureWidgetArticleGalleryType)(W))return l().createElement(Dt,{token:y,content:W.content,onChange:t=>p((0,c.O5)(e,t,!1)),onSave:C,onStateChange:x});if((0,f.ensureWidgetArticleAttachmentType)(W))return l().createElement(jt,{token:y,content:W.content,onChange:t=>{p((0,c.O5)(e,t,!1))},onSave:C,onStateChange:x,onOpen:w});if((0,f.ensureWidgetArticleImageType)(W))return l().createElement(Bt,{content:W.content,token:y,onChange:t=>{p((0,c.O5)(e,t,!1))},onSave:C,onStateChange:x});if((0,f.ensureWidgetApiType)(W))return l().createElement(Gt,{onChange:t=>p((0,c.O5)(e,t,!1)),provider:e=>{return t=void 0,n=void 0,l=function*(){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>e.result))},new((i=void 0)||(i=Promise))((function(e,o){function r(e){try{s(l.next(e))}catch(e){o(e)}}function a(e){try{s(l.throw(e))}catch(e){o(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}s((l=l.apply(t,n||[])).next())}));var t,n,i,l},initialUrl:null!==(t=W.content.url)&&void 0!==t?t:"",order:null!==(n=W.content.order)&&void 0!==n?n:"",orderBy:null!==(i=W.content.orderBy)&&void 0!==i?i:"asc"});if((0,f.ensureWidgetArticleSliderType)(W))return void 0!==y?l().createElement(zt,{slides:null!==(o=W.content.slides)&&void 0!==o?o:[],loop:null!==(r=W.content.loop)&&void 0!==r&&r,useDots:null===(s=W.content.useDots)||void 0===s||s,onChange:t=>{p((0,c.O5)(e,t,!1))},token:y,onSave:C}):l().createElement(l().Fragment,null,"Token is mandatory");if((0,f.ensureWidgetArticleTitleType)(W))return l().createElement(Ft,{onChange:t=>{p((0,c.O5)(e,t,!1))},onSave:C,content:W.content,onOpen:w});if((0,f.ensureWidgetArticleTextType)(W))return l().createElement(Rt,{onChange:t=>{p((0,c.O5)(e,t,!1))},onSave:C,content:W.content});if((0,f.ensureWidgetCheckListType)(W))return l().createElement(Ht,{token:y,uniqid:W.uniqid,content:W.content,onChangeContent:(e,t)=>{p((0,c.O5)(e,t,!1))},onChangeWrapper:e=>{p(c.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},onSave:(e,t)=>{var n;void 0!==(n=v)&&void 0!==n.id&&void 0!==n.type?E().widget.updateWidget({id:v.id,uniqid:e,type:v.type,title:h.title,content:t}).then((()=>{C(t)})).catch((e=>{var t;p(c.FN.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:g.formatMessage({id:"GLOBAL_Error"})}))})):C(t)}});if((0,f.ensureWidgetExcelDatasourceTableType)(W))return l().createElement(Ut,Object.assign({},W.content,{uri:W.content.uri,limit:null!==(u=W.content.limit)&&void 0!==u?u:20,onSave:C,onChange:(t,n)=>p((0,c.O5)(e,t,null!=n&&n)),onStateChange:x,onError:e=>{p(c.FN.actions.error({label:e}))}}));if((0,f.ensureWidgetDatasourceTableType)(W)){const t=c.Mx.selectors.selectById(b.default.store.getState(),"StudioHook"),n=c.Mx.selectors.selectById(b.default.store.getState(),"FileBankHook");return l().createElement(Nt,Object.assign({},W.content,{uri:W.content.uri,limit:null!==(m=W.content.limit)&&void 0!==m?m:20,editorAppDependencies:{useStudio:!!t,useFileBank:!!n},onSave:C,onChange:(t,n)=>p((0,c.O5)(e,t,null!=n&&n)),onStateChange:x,onError:e=>{p(c.FN.actions.error({label:e}))}}))}return l().createElement(l().Fragment,null,"cannot display editor")},Vt=({uniqid:e})=>{var t;const n=(0,d.useDispatch)(),i=(0,a.useIntl)(),o=null===(t=(0,d.useSelector)((t=>c.$L.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,r=(null==o?void 0:o.content)&&"widgets"in o.content&&o.content.widgets?o.content.widgets:[];return l().createElement("div",{style:{flex:1}},l().createElement(Qt,{uniqid:e}),o?r.map(((t,a)=>{const d=c.$L.definition(t.widget.name);return l().createElement("div",{key:a},l().createElement(Mt,null,l().createElement(It,{onClick:()=>((e,t)=>{n(c.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:d.label})),l().createElement(Ot,{onClick:()=>{n(c.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},o.content),{widgets:[...r.filter(((e,t)=>t!==a)).map((e=>((0,f.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(s.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Qt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(s.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(Yt,{uniqid:e,key:t}),elms:n||[]}),l().createElement(I,{namespace:"default",onChange:n=>{t(c.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Kt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(s.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},Zt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(s.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Xt=({uniqid:e,layerId:t})=>{const n=(0,d.useDispatch)();return l().createElement("div",{onClick:()=>{n(c.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(s.JRCIcon,{name:"icon-trash"}))},Yt=({uniqid:e})=>{const t=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=c.$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(Kt,{uniqid:e}),l().createElement(Zt,{uniqid:e}),l().createElement(Xt,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},en=b.default.registry.getLazyComponent("Button"),tn=({uniqid:e})=>{const t=(0,a.useIntl)(),n=(0,d.useDispatch)(),i=(0,d.useSelector)((t=>c.$L.selectors.selectWidget(t,e))),[o,r]=l().useState(null==i?void 0:i.title),{control:u,watch:m}=(0,gt.useForm)({defaultValues:{text:null!=o?o:""},criteriaMode:"all"});return l().useEffect((()=>{const e=m((e=>{r(e.text)}));return()=>e.unsubscribe()}),[m]),i?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}},l().createElement(s.JRCInputText,{name:"text",control:u,placeholder:t.formatMessage({id:"WIDGET_Title"})}),l().createElement(en,{onClick:()=>{void 0!==o&&(n(c.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:o})),n(c.Wq.slice.actions.flushEditor({uniqid:e})))},minWidth:"100%"},t.formatMessage({id:"GLOBAL_Save"}))):l().createElement(l().Fragment,null,"No wrapper")},nn=b.default.registry.getLazyComponent("Loader"),ln=({uniqid:e})=>{var t;const n=null===(t=(0,d.useSelector)((t=>c.$L.selectors.selectWidgetState(t,e))))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement($t,null,l().createElement(nn,{size:"l"})))},on=b.default.registry.getLazyComponent("Icon"),rn=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement(Wt,null,l().createElement(Tt,{onClick:()=>{n(c.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(on,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},an=({uniqid:e,children:t})=>{var n;return(null===(n=(0,d.useSelector)((t=>c.$L.selectors.selectWidgetState(t,e))))||void 0===n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},sn=b.default.registry.getLazyComponent("Icon"),cn=({uniqid:e,position:t})=>{const n=(0,a.useIntl)(),o=(0,d.useDispatch)(),r=(0,i.useRef)(null),s=(0,d.useSelector)((t=>c.Wq.selectors.selectEditor(t,e)),d.shallowEqual),u=c.$L.definition(null==s?void 0:s.name),[m,g]=l().useState("default");return(0,i.useEffect)((()=>{setTimeout((()=>{r&&r.current&&(r.current.className=r.current.className+" animate")}),0)}),[]),s?l().createElement(Lt,null,l().createElement(St,{ref:r,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(At,null,u.panel.useWrapper?l().createElement(Tt,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(sn,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(Tt,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(sn,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(an,{uniqid:e},l().createElement(Tt,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(sn,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(wt,null,l().createElement(rn,{uniqid:e,position:s.position}),l().createElement(kt,null,n.formatMessage({id:u.label})),l().createElement(Wt,null,l().createElement(Tt,{onClick:()=>{o(c.Wq.slice.actions.flushEditor({uniqid:e}))}},l().createElement(sn,{name:"icon-times",color:"grey2"})))),l().createElement(qt,null,"default"===m&&u.panel.useEditor?l().createElement(Pt,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(tn,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(Vt,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(ln,{uniqid:e})))),(null==s?void 0:s.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},dn=r().div`
|
|
457
|
+
`,({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>c.cr.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(wt,null,l().createElement(kt,null),l().createElement(Wt,null,"Popup"),l().createElement(kt,null,l().createElement(It,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(s.JRCIcon,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(wt,null,l().createElement(s.JRCButton,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)});const Dt=x.default.registry.getLazyComponent("WidgetArticleTitleEditor"),Ft=x.default.registry.getLazyComponent("WidgetArticleTextEditor"),jt=x.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),$t=x.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),zt=x.default.registry.getLazyComponent("WidgetArticleSliderEditor"),Bt=x.default.registry.getLazyComponent("WidgetArticleImageEditor"),Jt=x.default.registry.getLazyComponent("WidgetButtonEditor"),Gt=x.default.registry.getLazyComponent("WidgetApiEditor"),Ht=x.default.registry.getLazyComponent("WidgetCheckListEditor"),Nt=x.default.registry.getLazyComponent("WidgetDatasourceTableEditor"),Ut=x.default.registry.getLazyComponent("WidgetExcelDatasourceTableEditor"),Pt=({uniqid:e})=>{var t,n,i,o,r,s,u,m;const g=(0,a.useIntl)(),p=(0,d.useDispatch)(),y=(0,d.useSelector)(c.x0.selectors.selectToken),v=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),h=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObject(t,e)),d.shallowEqual),b=t=>{v&&p(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),p(c.cr.slice.actions.flushEditor({uniqid:e}))},C=(t,n)=>{p(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},w=t=>{p(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},k=null==v?void 0:v.widget;if(!k)return null;if((0,f.ensureWidgetArticleButtonType)(k))return l().createElement(Jt,Object.assign({},k.content,{onChange:t=>{p((0,c.vR)(e,t,!1))},onSave:()=>b({})}));if((0,f.ensureWidgetArticleGalleryType)(k))return l().createElement(jt,{token:y,content:k.content,onChange:t=>p((0,c.vR)(e,t,!1)),onSave:b,onStateChange:C});if((0,f.ensureWidgetArticleAttachmentType)(k))return l().createElement($t,{token:y,content:k.content,onChange:t=>{p((0,c.vR)(e,t,!1))},onSave:b,onStateChange:C,onOpen:w});if((0,f.ensureWidgetArticleImageType)(k))return l().createElement(Bt,{content:k.content,token:y,onChange:t=>{p((0,c.vR)(e,t,!1))},onSave:b,onStateChange:C});if((0,f.ensureWidgetApiType)(k))return l().createElement(Gt,{onChange:t=>p((0,c.vR)(e,t,!1)),provider:e=>{return t=void 0,n=void 0,l=function*(){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>e.result))},new((i=void 0)||(i=Promise))((function(e,o){function r(e){try{s(l.next(e))}catch(e){o(e)}}function a(e){try{s(l.throw(e))}catch(e){o(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}s((l=l.apply(t,n||[])).next())}));var t,n,i,l},initialUrl:null!==(t=k.content.url)&&void 0!==t?t:"",order:null!==(n=k.content.order)&&void 0!==n?n:"",orderBy:null!==(i=k.content.orderBy)&&void 0!==i?i:"asc"});if((0,f.ensureWidgetArticleSliderType)(k))return void 0!==y?l().createElement(zt,{slides:null!==(o=k.content.slides)&&void 0!==o?o:[],loop:null!==(r=k.content.loop)&&void 0!==r&&r,useDots:null===(s=k.content.useDots)||void 0===s||s,onChange:t=>{p((0,c.vR)(e,t,!1))},token:y,onSave:b}):l().createElement(l().Fragment,null,"Token is mandatory");if((0,f.ensureWidgetArticleTitleType)(k))return l().createElement(Dt,{onChange:t=>{p((0,c.vR)(e,t,!1))},onSave:b,content:k.content,onOpen:w});if((0,f.ensureWidgetArticleTextType)(k))return l().createElement(Ft,{onChange:t=>{p((0,c.vR)(e,t,!1))},onSave:b,content:k.content});if((0,f.ensureWidgetCheckListType)(k))return l().createElement(Ht,{token:y,uniqid:k.uniqid,content:k.content,onChangeContent:(e,t)=>{p((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},onSave:(e,t)=>{var n;void 0!==(n=h)&&void 0!==n.id&&void 0!==n.type?E().widget.updateWidget({id:h.id,uniqid:e,type:h.type,title:v.title,content:t}).then((()=>{b(t)})).catch((e=>{var t;p(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:g.formatMessage({id:"GLOBAL_Error"})}))})):b(t)}});if((0,f.ensureWidgetExcelDatasourceTableType)(k))return l().createElement(Ut,Object.assign({},k.content,{uri:k.content.uri,limit:null!==(u=k.content.limit)&&void 0!==u?u:20,onSave:b,onChange:(t,n)=>p((0,c.vR)(e,t,null!=n&&n)),onStateChange:C,onError:e=>{p(c.y8.actions.error({label:e}))}}));if((0,f.ensureWidgetDatasourceTableType)(k)){const t=c.lg.selectors.selectById(x.default.store.getState(),"StudioHook"),n=c.lg.selectors.selectById(x.default.store.getState(),"FileBankHook");return l().createElement(Nt,Object.assign({},k.content,{uri:k.content.uri,limit:null!==(m=k.content.limit)&&void 0!==m?m:20,editorAppDependencies:{useStudio:!!t,useFileBank:!!n},onSave:b,onChange:(t,n)=>p((0,c.vR)(e,t,null!=n&&n)),onStateChange:C,onError:e=>{p(c.y8.actions.error({label:e}))}}))}return l().createElement(l().Fragment,null,"cannot display editor")},Vt=({uniqid:e})=>{var t;const n=(0,d.useDispatch)(),i=(0,a.useIntl)(),o=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,r=(null==o?void 0:o.content)&&"widgets"in o.content&&o.content.widgets?o.content.widgets:[];return l().createElement("div",{style:{flex:1}},l().createElement(Qt,{uniqid:e}),o?r.map(((t,a)=>{const d=c.x0.definition(t.widget.name);return l().createElement("div",{key:a},l().createElement(Lt,null,l().createElement(Rt,{onClick:()=>((e,t)=>{n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:d.label})),l().createElement(_t,{onClick:()=>{n(c.x0.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},o.content),{widgets:[...r.filter(((e,t)=>t!==a)).map((e=>((0,f.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(s.JRCIcon,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Qt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(s.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(Zt,{uniqid:e,key:t}),elms:n||[]}),l().createElement(R,{namespace:"default",onChange:n=>{t(c.x0.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Kt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.x0.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(s.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},Xt=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.x0.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(s.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Yt=({uniqid:e,layerId:t})=>{const n=(0,d.useDispatch)();return l().createElement("div",{onClick:()=>{n(c.x0.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(s.JRCIcon,{name:"icon-trash"}))},Zt=({uniqid:e})=>{const t=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=c.x0.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(Kt,{uniqid:e}),l().createElement(Xt,{uniqid:e}),l().createElement(Yt,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},en=x.default.registry.getLazyComponent("Button"),tn=({uniqid:e})=>{const t=(0,a.useIntl)(),n=(0,d.useDispatch)(),i=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),[o,r]=l().useState(null==i?void 0:i.title),{control:u,watch:m}=(0,gt.useForm)({defaultValues:{text:null!=o?o:""},criteriaMode:"all"});return l().useEffect((()=>{const e=m((e=>{r(e.text)}));return()=>e.unsubscribe()}),[m]),i?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}},l().createElement(s.JRCInputText,{name:"text",control:u,placeholder:t.formatMessage({id:"WIDGET_Title"})}),l().createElement(en,{onClick:()=>{void 0!==o&&(n(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:o})),n(c.cr.slice.actions.flushEditor({uniqid:e})))},minWidth:"100%"},t.formatMessage({id:"GLOBAL_Save"}))):l().createElement(l().Fragment,null,"No wrapper")},nn=x.default.registry.getLazyComponent("Loader"),ln=({uniqid:e})=>{var t;const n=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e))))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(Tt,null,l().createElement(nn,{size:"l"})))},on=x.default.registry.getLazyComponent("Icon"),rn=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement(kt,null,l().createElement(It,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(on,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},an=({uniqid:e,children:t})=>{var n;return(null===(n=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e))))||void 0===n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},sn=x.default.registry.getLazyComponent("Icon"),cn=({uniqid:e,position:t})=>{const n=(0,a.useIntl)(),o=(0,d.useDispatch)(),r=(0,i.useRef)(null),s=(0,d.useSelector)((t=>c.cr.selectors.selectEditor(t,e)),d.shallowEqual),u=c.x0.definition(null==s?void 0:s.name),[m,g]=l().useState("default");return(0,i.useEffect)((()=>{setTimeout((()=>{r&&r.current&&(r.current.className=r.current.className+" animate")}),0)}),[]),s?l().createElement(St,null,l().createElement(At,{ref:r,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(Mt,null,u.panel.useWrapper?l().createElement(It,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(sn,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(It,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(sn,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(an,{uniqid:e},l().createElement(It,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(sn,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},l().createElement(wt,null,l().createElement(rn,{uniqid:e,position:s.position}),l().createElement(Wt,null,n.formatMessage({id:u.label})),l().createElement(kt,null,l().createElement(It,{onClick:()=>{o(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(sn,{name:"icon-times",color:"grey2"})))),l().createElement(qt,null,"default"===m&&u.panel.useEditor?l().createElement(Pt,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(tn,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(Vt,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(ln,{uniqid:e})))),(null==s?void 0:s.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},dn=r().div`
|
|
458
458
|
position: absolute;
|
|
459
459
|
inset: 0;
|
|
460
460
|
pointer-events: none;
|
|
@@ -472,5 +472,5 @@
|
|
|
472
472
|
`,gn=r().div`
|
|
473
473
|
width: ${440}px;
|
|
474
474
|
pointer-events: none;
|
|
475
|
-
`,pn=()=>{const e=(0,d.useSelector)(c.
|
|
476
|
-
//# sourceMappingURL=
|
|
475
|
+
`,pn=()=>{const e=(0,d.useSelector)(c.cr.selectors.selectEditors,d.shallowEqual);return l().createElement(dn,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?l().createElement(Ct,{isActive:!1,key:t},l().createElement(mn,null,l().createElement(cn,{uniqid:e.uniqid,position:e.position}),l().createElement(un,{isActive:void 0!==e.popup},l().createElement(Ot,{uniqid:e.uniqid})),l().createElement(gn,null))):l().createElement(Ct,{isActive:!1,key:t},l().createElement(mn,null,l().createElement(gn,null),l().createElement(un,{isActive:void 0!==e.popup},l().createElement(Ot,{uniqid:e.uniqid})),l().createElement(cn,{uniqid:e.uniqid,position:e.position}))))))},fn=()=>i.createElement(i.Fragment,null),En=()=>{const[e,t]=(0,i.useState)(),n=(0,a.useIntl)(),l=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),o=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{l({reject:i,resolve:n,text:e,capability:t})}))),[l]),r=(0,i.useMemo)((()=>({develop:e=>o(e,"develop"),summarize:e=>o(e,"summarize"),tldr:e=>o(e,"tldr"),en:e=>o(e,"en"),es:e=>o(e,"es"),formal:e=>o(e,"formal"),funny:e=>o(e,"funny")})),[o]);return[e,(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(r,n)),[n,r])]},yn=e=>{const t=(0,a.useIntl)(),n=(0,d.useDispatch)(),r=(0,o.useTheme)(),u=(0,d.useSelector)(c.Kx.selectors.selectAll),[m,g]=En(),p=(0,i.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}),[]),f=(0,i.useMemo)((()=>p?[g]:[]),[g,p]),E=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),y=(0,i.useMemo)((()=>(0,x.getTinyMCEMentionsQueries)(u,r,E)),[u,E,r]),v=(0,i.useMemo)((()=>x.default.tinymceCommonOptions),[]);return l().createElement(l().Fragment,null,v&&l().createElement(s.JRCInputTinyMCE,Object.assign({commonOptions:v,additionalExtensions:f,mentionsQueries:y},e)),l().createElement(h,{query:m}))},vn=e=>{const t=(0,a.useIntl)(),n=(0,d.useDispatch)(),r=(0,o.useTheme)(),u=(0,d.useSelector)(c.Kx.selectors.selectAll),[m,g]=En(),p=(0,i.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}),[]),f=(0,i.useMemo)((()=>p?[g]:[]),[g,p]),E=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),y=(0,i.useMemo)((()=>(0,x.getTinyMCEMentionsQueries)(u,r,E)),[u,E,r]),v=(0,i.useMemo)((()=>x.default.tinymceCommonOptions),[]);return l().createElement(l().Fragment,null,v&&l().createElement(s.JRCInputTinyMCERaw,Object.assign({commonOptions:v,additionalExtensions:f,mentionsQueries:y},e)),l().createElement(h,{query:m}))},hn=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:r,name:u="publishTo"})=>{const m=(0,a.useIntl)(),g=(0,d.useSelector)(c.Bx.selectors.selectNetworkPublic);return l().createElement(s.JRCModal,{open:e,closeHandler:t,title:null!=n?n:m.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(a.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(a.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),r()}}]},l().createElement(s.JRCMessage,{variant:"warning",message:null!=o?o:m.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(s.JRCInputAudience,{asyncPromise:e=>E().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:m.formatMessage({id:"GLOBAL_Audience"}),name:u,defaultCustomOptions:g?[{uri:g.uri,title:g.title,resetOptions:!0,icon:"icon-fs-wall"}]:[]}))};var xn=n(737);const bn=x.default.registry.getLazyComponent("Container"),Cn=x.default.registry.getLazyComponent("AppColumn"),wn=x.default.registry.getLazyComponent("MainColumn");function kn({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const r=(0,a.useIntl)(),{pathname:s}=(0,xn.useLocation)(),c=(0,i.useMemo)((()=>Object.values(t)),[t]),[d,u]=i.useState(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.key),m=c.map((t=>Object.assign(Object.assign({},t),{label:r.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?r.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===s||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,xn.matchPath)(i,s);return t||l}),!1))}));t&&u(t.key)}),[s,c,e]),i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(bn,{mode:l},i.createElement(Cn,{mode:l,description:n,tabs:m,activeTab:d||""}),i.createElement(wn,{mode:l},i.createElement(xn.Outlet,null))))}}}]);
|
|
476
|
+
//# sourceMappingURL=945.bundle.js.map
|