jamespot-react-core 1.1.181 → 1.1.182
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/724.bundle.js +76 -76
- package/build/724.bundle.js.map +1 -1
- package/build/app.bundle.js +14 -10
- package/build/app.bundle.js.map +1 -1
- package/build/src/ReactCore.d.ts +1 -1
- package/build/src/components/TwoColLayout.d.ts +1 -18
- package/build/src/components/comments/CommentsBlocCommentWidgetsWrapper.d.ts +1 -2
- package/build/src/components/tinymce/JRCInputTinyMCEWithExt.d.ts +1 -1
- package/build/src/components/tinymce/extension/AIModal.d.ts +1 -1
- package/build/src/components/types.d.ts +17 -1
- package/build/src/components/widgets/wrapper/JRCWidgetArticleTextWrapper.d.ts +1 -1
- package/build/src/components/widgets/wrapper/JRCWidgetDatasourceTableWrapper.d.ts +1 -2
- package/build/src/components/widgets/wrapper/utils.d.ts +1 -1
- package/build/src/displayer/components/DisplayRender.d.ts +2 -2
- package/build/src/displayer/components/inputs/InputCheckbox.d.ts +1 -1
- package/build/src/displayer/types.d.ts +1 -1
- package/build/src/initReactCore.d.ts +0 -0
- package/build/src/initTinymce.d.ts +33 -0
- package/build/src/redux/initStore.d.ts +1 -0
- package/build/src/redux/slice/Article.slice.d.ts +61 -0
- package/build/src/redux/slice/User.slice.d.ts +61 -0
- package/build/src/registry/ReactRegistry.d.ts +13 -0
- package/build/src/registry/Registry.d.ts +2 -15
- package/build/src/utils/types.d.ts +1 -1
- package/package.json +7 -4
package/build/724.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[724],{724:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[724],{724:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>T,Audience:()=>w,Avatar:()=>p,CommentsBloc:()=>qn,DisplayForm:()=>In,EditorsPortal:()=>zi,Empty:()=>Di,JRCInputTinyMCEWithExt:()=>Gi,JRCInputTinyMCEWithExtRaw:()=>Ui,MarkdownModal:()=>Fe,ModalAudience:()=>Vi,TwoColLayout:()=>Yi,WidgetList:()=>Z,WidgetWrapperCore:()=>pn});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(711),c=n(939),d=n(704),u=n(455);const m=u.O.getLazyComponent("JRCAvatar"),g=u.O.getLazyComponent("Icon"),p=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(g,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(m,Object.assign({},e))},E=u.O.getLazyComponent("FlexBox"),f=u.O.getLazyComponent("ModalContent"),h=u.O.getLazyComponent("ModalLayout"),y=u.O.getLazyComponent("StyledHref"),v=u.O.getLazyComponent("Tooltip"),x=u.O.getLazyComponent("Typography"),b=a().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
|
-
`,w=({audience:e,limit:t=2})=>{const n=(0,
|
|
20
|
+
`,w=({audience:e,limit:t=2})=>{const n=(0,r.useIntl)(),a=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(E,null,[...e].splice(0,t).map(((e,t)=>l().createElement(C,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(v,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(p,{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(C,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(h,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(f,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(b,null,e.map(((e,t)=>l().createElement(E,{key:`audience-${t}`,y:"center",gap:a.space.l},l().createElement(p,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(y,{href:`${e.type}/${e.id}`},l().createElement(x,null,e.title)))))))))};var k=n(833),q=n.n(k);const W=u.O.getLazyComponent("Loader"),O=u.O.getLazyComponent("ModalContent"),S=u.O.getLazyComponent("ModalLayout"),L=u.O.getLazyComponent("Typography"),A=a().div`
|
|
21
21
|
padding: ${e=>e.theme.space.md}px;
|
|
22
|
-
`,M={response:void 0,loading:!0,error:void 0},
|
|
22
|
+
`,M={response:void 0,loading:!0,error:void 0},T=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(M),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(M),q().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void a({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const n=e.result.text;a({error:void 0,loading:!1,response:n})})).catch((e=>{a({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,i.useEffect)((()=>{e&&e.text.trim().length>0&&c(e)}),[e,c]),l().createElement(S,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(O,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&c(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(A,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(W,null),l().createElement(L,{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 I=n(690),_=n(746);var j=n(206),z=n(743);const D=u.O.getLazyComponent("EditorsPortal"),$=u.O.getLazyComponent("ThemeProvider"),R=()=>{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=(0,z.A)(),e.appendChild(t)),t})(e)),[e]);return t?(0,j.createPortal)(l().createElement($,null,l().createElement(D,null)),t):null},F=a().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
|
+
`,G=a().div`
|
|
29
29
|
border: 1px solid ${e=>e.theme.color.grey2};
|
|
30
30
|
border-radius: 8px;
|
|
31
31
|
cursor: pointer;
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
opacity: 1;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,B=a().div`
|
|
54
54
|
border: 2px solid ${e=>e.theme.color.primary};
|
|
55
55
|
height: ${e=>e.open?e.height:"54"}px;
|
|
56
56
|
border-radius: 8px;
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
transition: height 0.4s;
|
|
61
61
|
overflow: hidden;
|
|
62
62
|
flex-direction: column;
|
|
63
|
-
`,
|
|
63
|
+
`,U=a().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
|
${e=>e.column&&"flex-direction: column;"}
|
|
70
|
-
`,
|
|
70
|
+
`,H=a().div`
|
|
71
71
|
min-height: 50px;
|
|
72
72
|
display: flex;
|
|
73
73
|
justify-content: center;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
&:hover {
|
|
78
78
|
background-color: ${e=>e.theme.color.grey0};
|
|
79
79
|
}
|
|
80
|
-
`,
|
|
80
|
+
`,N=a().button`
|
|
81
81
|
display: flex;
|
|
82
82
|
align-items: center;
|
|
83
83
|
padding: ${e=>e.parentIsColumn?"36px 16px":"0 10px"};
|
|
@@ -98,38 +98,38 @@
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
${(0,s.DashedFocusBorder)()}
|
|
101
|
-
`,
|
|
101
|
+
`,P=a().div`
|
|
102
102
|
display: flex;
|
|
103
103
|
flex-direction: ${e=>"row"===e.direction?"row":"column"};
|
|
104
104
|
align-items: ${e=>"row"===e.direction?"center":"flex-start"};
|
|
105
105
|
justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
|
|
106
106
|
flex: 1;
|
|
107
107
|
${e=>e.gap&&`gap:${e.gap}px`}
|
|
108
|
-
`,
|
|
108
|
+
`,V=u.O.getLazyComponent("Button"),Q=u.O.getLazyComponent("ModalLayout"),K=u.O.getLazyComponent("ModalContent"),X=u.O.getLazyComponent("Tooltip"),Y=u.O.getLazyComponent("IconButton"),Z=({mode:e,view:t,children:n,namespace:i="default",onChange:o})=>{const[a,s]=l().useState(!1),d=function(e){switch(e){case"widget-article-image":return[c.x0.definition(k.WidgetsName.ArticleTitle),c.x0.definition(k.WidgetsName.ArticleButton)];case"comment":return[c.x0.definition(k.WidgetsName.CheckList),c.x0.definition(k.WidgetsName.Presence),c.x0.definition(k.WidgetsName.QuickSurvey)];default:return[c.x0.definition(k.WidgetsName.ArticleTitle),c.x0.definition(k.WidgetsName.ArticleText),c.x0.definition(k.WidgetsName.ArticleImage),c.x0.definition(k.WidgetsName.ArticleButton),c.x0.definition(k.WidgetsName.ArticleSlider),c.x0.definition(k.WidgetsName.ArticleAttachment),c.x0.definition(k.WidgetsName.Presence)]}}(i),u=(0,r.useIntl)(),m={open:a,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(Q,Object.assign({},m),l().createElement(K,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>s(!1)}]:void 0,title:u.formatMessage({id:"WIDGET_Builder"})},"comment"===e?l().createElement(U,{column:!0},d.map(((e,t)=>l().createElement(N,{key:e.name,open:!0,full:!0,parentIsColumn:!0,index:t,onClick:()=>g(e.name)},l().createElement(P,{direction:"row",gap:12},l().createElement("img",{src:e.img}),l().createElement(P,{direction:"column"},l().createElement("h3",null,u.formatMessage({id:e.label})),l().createElement("p",null,u.formatMessage({id:e.description})))))))):l().createElement(F,null,d.map(((e,t)=>l().createElement(G,{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(V,{onClick:()=>s(!0),variant:"outlined",minWidth:"100%"},u.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e&&"edit"===t?l().createElement(F,null,d.map(((e,t)=>l().createElement(G,{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(ee,{widgets:d,onClick:g}):l().createElement(l().Fragment,null),"comment"===e&&"edit"===t?l().createElement(te,{onClick:()=>{s(!0)}}):l().createElement(l().Fragment,null))},ee=({widgets:e,onClick:t})=>{const[n,o]=l().useState(!1),a=(0,r.useIntl)(),s=(0,i.useMemo)((()=>80*Math.ceil(e.length/2)+50+10),[e]);return l().createElement(l().Fragment,null,l().createElement(B,{open:n,height:s},l().createElement(H,{onClick:()=>o(!n)},a.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(U,null,e.map(((e,i)=>l().createElement(N,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},l().createElement("img",{src:e.img}),a.formatMessage({id:e.label})))))))},te=({onClick:e})=>{const t=(0,r.useIntl)();return l().createElement(l().Fragment,null,l().createElement(X,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},l().createElement(Y,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))};var ne=n(876);const ie=u.O.getLazyComponent("InputFileAdvancedRaw"),le=a().div`
|
|
109
109
|
width: 0;
|
|
110
110
|
height: 0;
|
|
111
111
|
overflow: hidden;
|
|
112
|
-
`,
|
|
112
|
+
`,oe=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:a,onUploadEnd:r,onUploadSuccess:s})=>{const u=l().useRef(null),m=(0,d.useSelector)(c.x0.selectors.selectToken),[g,p]=l().useState(0),[E,f]=l().useState(t);return l().useEffect((()=>{var e;n&&(null===(e=u.current)||void 0===e||e.click())}),[n]),l().useEffect((()=>{t.length!==E.length&&f(t)}),[t]),l().useEffect((()=>{s(E)}),[E]),l().useEffect((()=>{0===g&&r()}),[g]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=u.current)||void 0===e||e.click())}},e),l().createElement(le,null,l().createElement(ie,{ref:u,id:"widget-upload-file",name:"editorFiles",content:"",accept:o,multiple:i,token:m,onUploadStart:e=>{void 0!==e&&p((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(p((e=>void 0!==e?e-1:0)),f((t=>i?[...t,e]:[e])))}})))},ae=u.O.getLazyComponent("WidgetAttachment"),re=u.O.getLazyComponent("WidgetEmptyInplace"),se=u.O.getLazyComponent("FileViewer"),ce=a().div`
|
|
113
113
|
flex: 1;
|
|
114
|
-
`,
|
|
114
|
+
`,de=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual),g=e=>{u(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),E=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&q().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((()=>{u(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],f=p?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:E}]:[];return void 0!==s?l().createElement(ce,null,"view"!==n?l().createElement(ae,{files:s,onClick:()=>{},onError:g}):l().createElement(se,{files:s,openWithOptions:f},(e=>l().createElement(ae,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(oe,{initialFiles:s,initialClick:m,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&u((0,c.vR)(a,{files:e}))},onUploadStart:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},"edit"===n?l().createElement(re,{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)},ue=u.O.getLazyComponent("WidgetButton"),me=a().div`
|
|
115
115
|
display: flex;
|
|
116
116
|
flex: 1;
|
|
117
117
|
justify-content: center;
|
|
118
118
|
align-items: center;
|
|
119
|
-
`,
|
|
119
|
+
`,ge=a().div`
|
|
120
120
|
pointer-events: ${e=>e.clickable?"all":"none"};
|
|
121
121
|
cursor: pointer;
|
|
122
122
|
display: flex;
|
|
123
123
|
flex: 1;
|
|
124
124
|
justify-content: center;
|
|
125
125
|
align-items: center;
|
|
126
|
-
`,
|
|
126
|
+
`,pe=({widget:e,mode:t})=>{const n=(0,d.useDispatch)(),{uniqid:o}=e,{text:a,url:r,target:s,color:u,backgroundColor:m,buttonSize:g,borderRadius:p,variant:E}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(me,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(ge,{clickable:"edit"!==t},l().createElement(ue,{text:a,url:r,target:s,color:u,backgroundColor:m,buttonSize:g,borderRadius:p,variant:E})))},Ee=u.O.getLazyComponent("WidgetArticleGallery"),fe=u.O.getLazyComponent("WidgetEmptyInplace"),he=u.O.getLazyComponent("FileViewer"),ye=a().button`
|
|
127
127
|
cursor: pointer;
|
|
128
|
-
`,
|
|
128
|
+
`,ve=({widget:e,inplace:t,mode:n})=>{var i,o;const{uniqid:a}=e,{files:r}=e.content,s=(0,d.useDispatch)(),u=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual);return l().useEffect((()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),void 0!==r?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ee,{files:r,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(he,{files:r,openWithOptions:[]},(t=>{var n,i;return l().createElement(ye,null,l().createElement(Ee,{files:r,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(oe,{initialFiles:r,initialClick:u,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&s((0,c.vR)(a,{files:e}))},onUploadStart:()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},l().createElement(fe,{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)},xe=u.O.getLazyComponent("WidgetImage"),be=u.O.getLazyComponent("FileViewer"),Ce=u.O.getLazyComponent("WidgetEmptyInplace"),we=a().div`
|
|
129
129
|
position: absolute;
|
|
130
130
|
inset: 0;
|
|
131
131
|
background-color: rgba(0, 0, 0, 0.4);
|
|
132
|
-
pointer-
|
|
132
|
+
pointer-events: none;
|
|
133
133
|
display: flex;
|
|
134
134
|
justify-content: center;
|
|
135
135
|
align-items: center;
|
|
@@ -138,16 +138,16 @@
|
|
|
138
138
|
&:hover {
|
|
139
139
|
opacity: 1;
|
|
140
140
|
}
|
|
141
|
-
`,
|
|
141
|
+
`,ke=a().button`
|
|
142
142
|
cursor: pointer;
|
|
143
|
-
`,
|
|
143
|
+
`,qe={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},We=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Oe=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:a}=e,{file:s,useFilter:u}=e.content,m=(0,d.useDispatch)(),g=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual),[p,E]=(0,i.useState)(void 0),f=(0,r.useIntl)();return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s}))}),[s]),(0,i.useEffect)((()=>{s&&E((0,k.formatImgUrl)({timestamp:s.dateModified?We(s.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:s.uri}))}),[s]),l().createElement(l().Fragment,null,"edit"===o?void 0!==p?l().createElement(xe,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u}):l().createElement(l().Fragment,null):l().createElement(be,{files:[Object.assign(Object.assign({},qe),{path:p,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(ke,{onClick:()=>e(0)},l().createElement(xe,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u})))),n&&"edit"===o?l().createElement(oe,{initialFiles:[],initialClick:g,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&m((0,c.vR)(a,{file:e[0]}))},onUploadStart:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==s?l().createElement(we,null,f.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(Ce,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null))};var Se=n(750);const Le=u.O.getLazyComponent("FileViewer"),Ae=u.O.getLazyComponent("WidgetEmptyInplace"),Me=u.O.getLazyComponent("WidgetSlider"),Te=a().div`
|
|
144
144
|
flex: 1;
|
|
145
145
|
display: flex;
|
|
146
146
|
flex-direction: row;
|
|
147
147
|
min-height: 60px;
|
|
148
148
|
align-items: center;
|
|
149
149
|
width: ${e=>e.maxWidth}px;
|
|
150
|
-
`,Ie={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},
|
|
150
|
+
`,Ie={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},_e=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},je=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,a=(0,Se.jL)(),r=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,o)),d.shallowEqual),s=null!=n?n:600,[u,m]=(0,i.useState)(void 0),g=(0,i.useRef)(null),p=(0,i.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},Ie),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Ie.mimetype,path:(0,k.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?_e(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),E=(0,i.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,k.formatImgUrl)({timestamp:e.file.dateModified?_e(e.file.dateModified):Date.now(),size:`fitx${u&&u<s?u:s}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,u,s]);(0,i.useEffect)((()=>{r&&"edit"===t&&a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}),[r]),(0,i.useEffect)((()=>{const e=()=>{g.current&&m(g.current?g.current.offsetWidth:s)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[g]),(0,i.useEffect)((()=>{m(g.current?g.current.offsetWidth:s)}),[g]),(0,i.useEffect)((()=>{a(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const f=(0,i.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,i.useCallback)((()=>{a(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===u?l().createElement("div",{ref:g,style:{width:"100%"}}):l().createElement(Te,{maxWidth:u&&u<s?u:s},l().createElement(Le,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(Me,{slides:E,maxWidth:u&&u<s?u:s,useDots:null===(i=e.content.useDots)||void 0===i||i,loop:null!==(r=e.content.loop)&&void 0!==r&&r,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 a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}})})),f?l().createElement(Ae,{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))};var ze=n(912),De=n(201);const $e=u.O.getLazyComponent("InputTextareaRaw"),Re=u.O.getLazyComponent("Modal"),Fe=({onInsert:e,open:t,close:n})=>{const o=(0,r.useIntl)(),[a,s]=l().useState(""),c=(0,i.useCallback)((()=>{s(""),n()}),[n]);return l().createElement(Re,{title:o.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:c,enableClickAwayCloseModal:!0,buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:c},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Insert"}),color:"valid",disabled:!a,clickHandler:()=>{e(De.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement($e,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},Ge=()=>{const e=(0,r.useIntl)(),[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)();return{open:t,onInsert:e=>{null==l||l.execCommand("InsertHTML",!1,e)},close:()=>n(!1),ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.markdown((e=>{o(e),n(!0)}),e)),[e]),isActive:!0}},Be=ze.default.registry.getLazyComponent("WidgetArticleText"),Ue=a().div`
|
|
151
151
|
width: 100%;
|
|
152
152
|
cursor: text;
|
|
153
153
|
p {
|
|
@@ -156,20 +156,20 @@
|
|
|
156
156
|
a {
|
|
157
157
|
word-wrap: break-word;
|
|
158
158
|
}
|
|
159
|
-
`,
|
|
159
|
+
`,He=({widget:e,mode:t})=>{const{uniqid:n}=e,a=(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),E=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),f=(0,d.useSelector)(c.Kx.selectors.selectAll),h=(0,r.useIntl)(),{open:y,onInsert:v,close:x,ext:b,isActive:C}=Ge(),w=(0,i.useCallback)((e=>{u(c.y8.actions.error({label:null!=e?e:h.formatMessage({id:"GLOBAL_Error"})}))}),[u,h]);(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:n,empty:!s||0===s.length}))}),[s]);const k=(0,i.useMemo)((()=>(0,ze.getTinyMCEMentionsQueries)(f,a,w)),[f,w,a]);return g?l().createElement(l().Fragment,null):l().createElement(Ue,null,l().createElement(Be,{autoFocus:m,text:null!=s?s:"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&E?{commonOptions:E,mentionsQueries:k}:void 0,mode:t,onChange:e=>{u((0,c.vR)(n,{text:e}))},additionalExtensions:[b]}),C&&l().createElement(Fe,{onInsert:v,open:y,close:x}))},Ne=u.O.getLazyComponent("WidgetArticleTitle"),Pe=a().div`
|
|
160
160
|
flex: 1;
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: row;
|
|
163
163
|
align-items: center;
|
|
164
164
|
cursor: text;
|
|
165
|
-
`,
|
|
165
|
+
`,Ve=a().div`
|
|
166
166
|
display: flex;
|
|
167
167
|
flex-direction: row;
|
|
168
168
|
border-radius: 8px;
|
|
169
169
|
overflow: hidden;
|
|
170
170
|
margin: 4px;
|
|
171
171
|
border: 1px solid ${e=>e.theme.color.grey1};
|
|
172
|
-
`,
|
|
172
|
+
`,Je=a().button`
|
|
173
173
|
display: flex;
|
|
174
174
|
width: 40px;
|
|
175
175
|
height: 40px;
|
|
@@ -181,18 +181,18 @@
|
|
|
181
181
|
&:hover {
|
|
182
182
|
background-color: ${e=>e.theme.color.grey1};
|
|
183
183
|
}
|
|
184
|
-
`,
|
|
184
|
+
`,Qe=({widget:e,inplace:t,mode:n})=>{const{uniqid:o}=e,{text:a,color:r,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:!a||0===a.length}))}),[a]),l().createElement(Pe,null,l().createElement(Ne,{text:a,color:r,heading:s,autoFocus:m,inplace:t,mode:n,onChange:e=>{u((0,c.vR)(o,{text:e}))}}),m&&"edit"===n?l().createElement(Ke,{heading:s,onClick:e=>{u((0,c.vR)(o,{heading:e}))}}):l().createElement(l().Fragment,null))},Ke=({heading:e="h1",onClick:t})=>l().createElement(Ve,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(Je,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),Xe=u.O.getLazyComponent("Button"),Ye=u.O.getLazyComponent("ModalLayout"),Ze=u.O.getLazyComponent("ModalContent"),et=(a().button`
|
|
185
185
|
padding: ${e=>e.theme.space.md}px;
|
|
186
186
|
`,a().div`
|
|
187
187
|
padding: ${e=>e.theme.space.md}px;
|
|
188
188
|
display: flex;
|
|
189
189
|
flex-direction: row-reverse;
|
|
190
|
-
`),
|
|
190
|
+
`),tt=({id:e,type:t,uniqid:n})=>{const o=(0,d.useDispatch)(),a=(0,r.useIntl)(),[u,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),u&&l().createElement(Ye,{enableClickAwayCloseModal:!0,open:u,closeHandler:()=>m(!1)},l().createElement(Ze,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(et,null,l().createElement(Xe,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{q().widget.removeWidget({id:e,type:t,uniqid:n}).then((()=>{o(c.x0.slice.actions.flushWidget({uniqid:n}))})).catch((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}}))))},nt=a().div`
|
|
191
191
|
display: flex;
|
|
192
192
|
flex: 1;
|
|
193
193
|
flex-direction: row;
|
|
194
194
|
border-top: 1px solid ${e=>e.theme.color.grey1};
|
|
195
|
-
`,
|
|
195
|
+
`,it=a().button`
|
|
196
196
|
display: flex;
|
|
197
197
|
flex: 1;
|
|
198
198
|
justify-content: center;
|
|
@@ -201,21 +201,21 @@
|
|
|
201
201
|
&:hover {
|
|
202
202
|
background-color: ${e=>e.theme.color.grey0};
|
|
203
203
|
}
|
|
204
|
-
`,
|
|
204
|
+
`,lt=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObject(e,t)),d.shallowEqual),g=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),d.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),E=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),f=(0,i.useCallback)((()=>{u(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,u,e,n]);return p&&(0,k.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(nt,null,l().createElement(it,{onClick:null!=a?a:f},s.formatMessage({id:"WIDGET_Set_Widget"})),E&&l().createElement(tt,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},ot=a().div`
|
|
205
205
|
position: absolute;
|
|
206
206
|
inset: 0;
|
|
207
207
|
display: flex;
|
|
208
208
|
justify-content: center;
|
|
209
209
|
align-items: center;
|
|
210
210
|
background-color: rgba(255, 255, 255, 0.4);
|
|
211
|
-
`,
|
|
211
|
+
`,at=()=>l().createElement(ot,null,l().createElement(s.JRCLoader,{size:"m"}));var rt=n(655);const st=a().div`
|
|
212
212
|
padding: ${e=>e.theme.space.md}px;
|
|
213
213
|
display: flex;
|
|
214
214
|
flex-direction: row;
|
|
215
215
|
fieldset {
|
|
216
216
|
margin: 0.2rem !important;
|
|
217
217
|
}
|
|
218
|
-
`,
|
|
218
|
+
`,ct=({placeholder:e,handleClick:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),[a,c]=(0,i.useState)(""),{control:u,watch:m,reset:g}=(0,rt.useForm)({defaultValues:{label:a},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=m((e=>{var t;c(null!==(t=e.label)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[m,o]),l().createElement(st,null,l().createElement(s.JRCInputText,{name:"label",control:u,placeholder:e,width:"100%"}),l().createElement(s.JRCButton,{label:n.formatMessage({id:"GLOBAL_Confirm"}),disabled:!a.length,onClick:()=>{t(a),c(""),g()}}))};var dt=n(586);const ut=u.O.getLazyComponent("WidgetCheckList"),mt=u.O.getLazyComponent("WidgetCheckListEditor"),gt=(a().div`
|
|
219
219
|
display: flex;
|
|
220
220
|
flex-direction: row;
|
|
221
221
|
justify-content: space-between;
|
|
@@ -229,9 +229,9 @@
|
|
|
229
229
|
display: flex;
|
|
230
230
|
gap: 14px;
|
|
231
231
|
padding: 16px;
|
|
232
|
-
`),
|
|
232
|
+
`),pt=a().div`
|
|
233
233
|
position: relative;
|
|
234
|
-
`,
|
|
234
|
+
`,Et=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{const a=(0,r.useIntl)(),{uniqid:u,content:m}=e,g=(0,d.useDispatch)(),[p,E]=(0,i.useState)(),[f,h]=(0,i.useState)(!1),y=(0,d.useSelector)(c.x0.selectors.selectToken,d.shallowEqual),v=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),d.shallowEqual),x=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,u)),d.shallowEqual),b=(0,d.useSelector)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),d.shallowEqual),C=(0,i.useMemo)((()=>x&&x.update),[x]),w=(0,i.useMemo)((()=>x&&x.administrate),[x]),W=(0,i.useCallback)((e=>{g(c.y8.actions.error({label:null!=e?e:a.formatMessage({id:"GLOBAL_Error"})}))}),[g,a]),O=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),S=(0,i.useCallback)((()=>{v&&(h(!0),q().widget.getWidget({uri:v,uniqid:u}).then((e=>{(0,k.ensureWidgetCheckListType)(e.result)&&O(u,e.result.content)})).catch((e=>!e.aborted&&W)).finally((()=>h(!1))))}),[u,W,v,O]),L=t=>{g(c.cr.slice.actions.flushAllEditor()),g(c.x0.slice.actions.setToken({token:t})),g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:k.WidgetsName.CheckList,mode:n}))};(0,i.useEffect)((()=>{y||"edit"!==n||q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,y,g]),(0,i.useEffect)((()=>{var t;const n=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,n,i,l;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",file:null!==(n=e.file)&&void 0!==n?n:void 0,checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(l=e.user)&&void 0!==l?l:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));E(n)}),[e.content.arr,m]),(0,i.useEffect)((()=>{if(!Array.isArray(b))return;const t=b.at(-1);t&&v&&t.object.uri===v&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||S())}),[b,e.uniqid,v,W,g,S]);const A=t=>{if(!e.content.arr||!v)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});q().widget.updateWidget({uri:v,uniqid:e.uniqid,content:n,v2:!0}).then((()=>O(e.uniqid,n))).catch((e=>W(e.errorMsg)))},M=(0,i.useMemo)((()=>{if(!Array.isArray(m.arr))return[];const e=[];return m.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[m]);return"edit"===n&&t?l().createElement(gt,null,l().createElement(mt,{token:y,uniqid:u,content:m,inplace:t,onChangeContent:O,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>g((0,c.vR)(e.uniqid,t))})):l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},p&&l().createElement(s.JRCFileViewer,{files:M,openWithOptions:[]},(t=>l().createElement(pt,{key:e.uniqid},l().createElement(ut,{limit:10,initialEntries:p,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{v&&(f||(h(!0),q().widget.checkListRespond({uri:v,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{W(e.message),h(!1)}))))})(e.uniqid,t)}),m.edit&&l().createElement(ct,{handleClick:A,placeholder:a.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),w&&y&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!m.edit&&!C)},mode:n,handleOpenEditor:()=>{y?L(y):(h(!0),q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),L(e.result)})).finally((()=>h(!1))))}}),f&&l().createElement(at,null)))))},ft=(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},ht=u.O.getLazyComponent("Button"),yt=u.O.getLazyComponent("Html"),vt=u.O.getLazyComponent("WidgetTable"),xt=u.O.getLazyComponent("Loader"),bt=(a().div``,a().div`
|
|
235
235
|
position: absolute;
|
|
236
236
|
inset: 0;
|
|
237
237
|
display: flex;
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
justify-content: center;
|
|
240
240
|
align-items: center;
|
|
241
241
|
gap: ${e=>e.theme.space.md}px;
|
|
242
|
-
`),
|
|
242
|
+
`),Ct=a().div`
|
|
243
243
|
position: absolute;
|
|
244
244
|
inset: 0;
|
|
245
245
|
display: flex;
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
background-color: ${e=>e.theme.color.grey2};
|
|
256
256
|
opacity: 0.9;
|
|
257
257
|
}
|
|
258
|
-
`,
|
|
258
|
+
`,wt=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:E,mode:f})=>{const h=(0,r.useIntl)(),y=(0,Se.jL)(),[v,x]=(0,i.useState)(!1),[b,C]=(0,i.useState)(!1),[w,W]=(0,i.useState)([]),[O,S]=(0,i.useState)([]),[L,A]=(0,i.useState)({order:"ascending",name:"unknown"}),[M,T]=(0,i.useState)(void 0),[I,_]=(0,i.useState)(""),j=(0,i.useMemo)((()=>c.x0.definition(k.WidgetsName.DatasourceTable)),[]),z=(0,i.useMemo)((()=>"studio"===M?[{type:[I]}]:[]),[M,I]),D=(0,i.useMemo)((()=>"doc"===M?[I]:[]),[M,I]),{rtLastObject:$}=(0,ne.YL)(z,D),R=(0,i.useCallback)((()=>{t&&(C(!0),q().datasource.get(t,k.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data),A(e.result.sort),T(e.result.datasource.datasourceType),_(e.result.datasource.datasourceIdentifier)})).finally((()=>C(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===O.length&&R()}),[t,m,O,R]),(0,i.useEffect)((()=>{$&&R()}),[$,R]),(0,i.useEffect)((()=>{t||S([])}),[t]);const F=(0,i.useCallback)((()=>{y(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>{y(c.cr.slice.actions.registerEditor({uniqid:e,name:k.WidgetsName.DatasourceTable}))}),0)}),[y,e]);(0,i.useEffect)((()=>{"view"!==f&&"preview"!==f||y(c.cr.slice.actions.flushAllEditor())}),[f,y]),(0,i.useEffect)((()=>{v||t||"edit"!==f||(F(),x(!0))}),[y,e,v,t,F,f]);const G=(0,i.useMemo)((()=>ft(m,O)),[m,O]);return 0!==m.length||b||"edit"!==f?b?l().createElement(bt,null,l().createElement(xt,null)):l().createElement(l().Fragment,null,b||0!==w.length?l().createElement(vt,{rows:w,columns:G,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:E,tableDefaultSortOrder:L.order,tableDefaultSortName:L.name}):l().createElement(bt,null,l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(Ct,{onClick:F},l().createElement(yt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:j.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(bt,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:j.label}),l().createElement(ht,{label:"GLOBAL_Settings"})),l().createElement(Ct,{onClick:F},l().createElement(yt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:j.label})}</b>`})))},kt=u.O.getLazyComponent("Button"),qt=u.O.getLazyComponent("Html"),Wt=u.O.getLazyComponent("WidgetTable"),Ot=u.O.getLazyComponent("Loader"),St=(a().div``,a().div`
|
|
259
259
|
position: absolute;
|
|
260
260
|
inset: 0;
|
|
261
261
|
display: flex;
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
justify-content: center;
|
|
264
264
|
align-items: center;
|
|
265
265
|
gap: ${e=>e.theme.space.md}px;
|
|
266
|
-
`),
|
|
266
|
+
`),Lt=a().div`
|
|
267
267
|
position: absolute;
|
|
268
268
|
inset: 0;
|
|
269
269
|
display: flex;
|
|
@@ -279,21 +279,21 @@
|
|
|
279
279
|
background-color: ${e=>e.theme.color.grey2};
|
|
280
280
|
opacity: 0.9;
|
|
281
281
|
}
|
|
282
|
-
`,
|
|
282
|
+
`,At=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:E,mode:f})=>{const h=(0,r.useIntl)(),y=(0,Se.jL)(),[v,x]=(0,i.useState)(!1),[b,C]=(0,i.useState)(!1),[w,W]=(0,i.useState)([]),[O,S]=(0,i.useState)([]),L=(0,i.useMemo)((()=>c.x0.definition(k.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===O.length&&(C(!0),q().datasource.get(t,k.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data)})).finally((()=>C(!1))))}),[t,m,O]),(0,i.useEffect)((()=>{t||S([])}),[t]);const A=(0,i.useCallback)((()=>{y(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>y(c.cr.slice.actions.registerEditor({uniqid:e,name:k.WidgetsName.ExcelDatasourceTable}))),0)}),[y,e]);(0,i.useEffect)((()=>{"view"!==f&&"preview"!==f||y(c.cr.slice.actions.flushAllEditor())}),[f,y]),(0,i.useEffect)((()=>{v||t||"edit"!==f||(A(),x(!0))}),[y,e,v,t,A,f]);const M=(0,i.useMemo)((()=>ft(m,O)),[m,O]);return 0!==m.length||b||"edit"!==f?b?l().createElement(St,null,l().createElement(Ot,null)):l().createElement(l().Fragment,null,b||0!==w.length?l().createElement(Wt,{rows:w,columns:M,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:E}):l().createElement(St,null,l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(Lt,{onClick:A},l().createElement(qt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:L.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(St,{onClick:A},l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:L.label}),l().createElement(kt,{label:"GLOBAL_Settings"})),l().createElement(Lt,{onClick:A},l().createElement(qt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:L.label})}</b>`})))},Mt=a().div`
|
|
283
283
|
padding: ${e=>e.theme.space.md}px;
|
|
284
|
-
`,
|
|
284
|
+
`,Tt=a().a`
|
|
285
285
|
cursor: pointer;
|
|
286
286
|
color: ${e=>e.theme.color.secondary};
|
|
287
|
-
`,
|
|
287
|
+
`,It=a().div`
|
|
288
288
|
display: flex;
|
|
289
289
|
justify-content: center;
|
|
290
290
|
align-items: center;
|
|
291
|
-
`,
|
|
291
|
+
`,_t=({mode:e,uniqid:t,content:n})=>{const o=(0,r.useIntl)(),a=(0,d.useDispatch)(),s=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectUri(e,t)),d.shallowEqual),u=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),d.shallowEqual),m=(0,i.useMemo)((()=>!(!u||!u.update)),[u]),g=(0,i.useCallback)((()=>{if("edit"===e||!m||!s)return;const i=Object.assign(Object.assign({},n),{isClosed:!0});q().widget.updateWidget({uri:s,uniqid:t,content:i,v2:!0}).then((()=>a(c.x0.slice.actions.updateWidget({uniqid:t,content:i})))).catch((()=>a(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}),[e,t,m,s,n,a]);return l().createElement(l().Fragment,null,m&&!n.isClosed&&l().createElement(Mt,null,l().createElement(It,null,l().createElement(Tt,{onClick:g},o.formatMessage({id:"WIDGET_Presence_Closing"})))))},jt=u.O.getLazyComponent("WidgetPresence"),zt=u.O.getLazyComponent("ModalUserList"),Dt=a().div`
|
|
292
292
|
display: flex;
|
|
293
293
|
flex: 1;
|
|
294
294
|
position: relative;
|
|
295
295
|
flex-direction: column;
|
|
296
|
-
|
|
296
|
+
`,$t=(a().div`
|
|
297
297
|
position: absolute;
|
|
298
298
|
inset: 0;
|
|
299
299
|
background-color: rgba(255, 255, 255, 0.7);
|
|
@@ -307,44 +307,44 @@
|
|
|
307
307
|
padding: ${e=>e.theme.space.md}px;
|
|
308
308
|
border: 1px dashed ${e=>e.theme.color.orange};
|
|
309
309
|
justify-content: center;
|
|
310
|
-
align-
|
|
310
|
+
align-items: center;
|
|
311
311
|
border-radius: ${e=>e.theme.space.sm}px;
|
|
312
312
|
margin: ${e=>e.theme.space.sm}px;
|
|
313
|
-
`),
|
|
313
|
+
`),Rt=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),{limit:a,limitValue:s,closing:u,isClosed:m}=e.content,{uniqid:g}=e,[p,E]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[f,h]=(0,i.useState)(!1),[y]=(0,i.useState)(new AbortController),[v,x]=(0,i.useState)(!1),[b,C]=(0,i.useState)(),[w,k]=(0,i.useState)(),W=(0,i.useRef)(y),O=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),d.shallowEqual),S=(0,d.useSelector)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),d.shallowEqual),L=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),A=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>u&&m||"edit"===t),[u,m,t]),T=(0,i.useCallback)((()=>{O&&!M&&(A?(h(!0),q().widget.presenceCancel({uri:O,uniqid:g}).catch(L).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,L,O,A,M]),I=(0,i.useCallback)((e=>{O&&!M&&(h(!0),q().widget.presenceRespond({uri:O,uniqid:g,value:e},W.current.signal).catch(L).finally((()=>h(!1))))}),[O,g,L,M]),_=(0,i.useCallback)((()=>{"edit"!==t&&O&&(h(!0),q().widget.presenceGetResponse({uri:O,uniqid:g},W.current.signal).then((e=>{E(e.result)})).catch((e=>!e.aborted&&L())).finally((()=>h(!1))))}),[O,L,g,t]),j=(e,t)=>{O&&q().widget.presenceGetResponseUserList({uri:O,uniqid:g,index:e,page:t,limit:8},W.current.signal).then((e=>{k(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&L))},z=(0,i.useCallback)((()=>{O&&(h(!0),q().widget.getWidget({uri:O,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&L)).finally((()=>h(!1))))}),[o,L,O,g]);return(0,i.useEffect)((()=>{const e=W.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{_()}),[_]),(0,i.useEffect)((()=>{if(!Array.isArray(S))return;const e=S.at(-1);e&&O&&e.object.uri===O&&e.uniqid===g&&("widget-presence-response"===e.fn&&_(),"widget-update"===e.fn&&z())}),[S,_,g,O,z]),l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},l().createElement(Dt,null,l().createElement(jt,{limit:a,limitValue:s,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:null==p?void 0:p.userAvailableTotal,userUnavailableTotal:null==p?void 0:p.userUnavailableTotal,isClosed:u&&m,handleClickAvailable:()=>1===p.userValue?T():I(1),handleClickUnavailable:()=>0===p.userValue?T():I(0),handleOpenUsersModal:e=>{k({limit:0,page:0,data:[],cnt:0}),C(e),j(e),x(!0)}}),u&&m&&l().createElement($t,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),u&&!m&&l().createElement(_t,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,mode:t}),f&&l().createElement(at,null),l().createElement(zt,{open:v,usersList:w,title:1===b?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:x,onClose:()=>{k({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{j(null!=b?b:0,e)}})))},Ft=u.O.getLazyComponent("WidgetQuickSurvey"),Gt=u.O.getLazyComponent("WidgetQuickSurveyEditor"),Bt=u.O.getLazyComponent("ModalUserList"),Ut=a().div`
|
|
314
314
|
width: 100%;
|
|
315
315
|
display: flex;
|
|
316
316
|
flex-direction: column;
|
|
317
317
|
gap: 14px;
|
|
318
318
|
${e=>e.withPadding&&"padding: 0 12px;"}
|
|
319
319
|
padding-top: 16px;
|
|
320
|
-
`,
|
|
320
|
+
`,Ht=({widget:e,inplace:t,mode:n})=>{var o,a,u;const m=(0,r.useIntl)(),g=(0,d.useDispatch)(),{uniqid:p,content:E}=e,[f,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[y,v]=(0,i.useState)(!1),[x,b]=(0,i.useState)(!1),[C,w]=(0,i.useState)(),[W,O]=(0,i.useState)(),[S]=(0,i.useState)(new AbortController),L=(0,i.useRef)(S),A=(0,d.useSelector)(c.x0.selectors.selectToken,d.shallowEqual),M=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),d.shallowEqual),T=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),d.shallowEqual),I=(0,d.useSelector)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),d.shallowEqual),_=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),j=t=>{g(c.cr.slice.actions.flushAllEditor()),g(c.x0.slice.actions.setToken({token:t})),g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:k.WidgetsName.QuickSurvey}))},z=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),D=(0,i.useCallback)((e=>{"edit"!==n&&M&&(b(!0),q().widget.quickSurveyGetResponse({uri:M,uniqid:e},L.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&z)).finally((()=>b(!1))))}),[z,M,n]),$=(0,i.useCallback)((()=>{M&&(b(!0),q().widget.getWidget({uri:M,uniqid:p},L.current.signal).then((e=>{_(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>b(!1))))}),[p,z,M,_]),R=()=>{if(M&&E.closing){const e=Object.assign(Object.assign({},E),{isClosed:!0});q().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{z()}))}},F=t=>{(t=>{"edit"!==n&&M&&(b(!0),q().widget.quickSurveyRespond({uri:M,index:t,multi:E.multi?1:0,uniqid:p},L.current.signal).then((()=>{D(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>b(!1))))})(t)},G=(e,t)=>{M&&q().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},L.current.signal).then((e=>{O(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},B=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{D(e.uniqid)}),[D,e.uniqid]),(0,i.useEffect)((()=>{if(!Array.isArray(I))return;const t=I.at(-1);t&&M&&t.object.uri===M&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&D(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,D]);const U=(0,i.useMemo)((()=>{if(!Array.isArray(E.arr))return[];const e=[];return E.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[E]);return(0,i.useEffect)((()=>{A||"edit"!==n||q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,A,g]),"edit"===n&&t?l().createElement(Ut,{withPadding:!0},l().createElement(Gt,{token:A,uniqid:p,content:e.content,onChangeContent:_,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>_(p,e),inplace:t})):l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},l().createElement(Ut,null,l().createElement(s.JRCFileViewer,{files:U,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(Ft,{limit:null!==(n=f.totalResponse)&&void 0!==n?n:0,values:null!==(i=E.arr)&&void 0!==i?i:[],userResponses:f.userResponses,userHasAlreadyVoted:f.userLoggedResponses.length>0,canCloseSurvey:null!==(o=e.content.closing)&&void 0!==o&&o,isClosed:null!==(a=e.content.isClosed)&&void 0!==a&&a,open:null!==(r=e.content.open)&&void 0!==r&&r,anonymize:null!==(s=e.content.anonymize)&&void 0!==s&&s,seeResponseAfter:null!==(c=e.content.seeResponseAfter)&&void 0!==c&&c,canUpdate:B,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:R,handleProgressBarClick:F,setOpenUsersModal:e=>{w(e),G(e),v(!0)}})})),E.open&&l().createElement(ct,{handleClick:e=>{var t;if(!M)return;const n=Object.assign(Object.assign({},E),{arr:[...null!==(t=E.arr)&&void 0!==t?t:[],{title:e}]});q().widget.quickSurveyAddEnty({uri:M,uniqid:p,label:e}).then((()=>{g(c.x0.slice.actions.updateWidget({uniqid:p,content:n}))})).catch(z)},placeholder:m.formatMessage({id:"FIELDS_Add_Option"})}),B&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!B},mode:n,handleOpenEditor:()=>{A?j(A):(b(!0),q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),j(e.result)})).finally((()=>b(!1))))}}),x&&l().createElement(at,null),l().createElement(Bt,{open:y,usersList:W,title:null!==(u=null===(a=null===(o=E.arr)||void 0===o?void 0:o[null!=C?C:0])||void 0===a?void 0:a.title)&&void 0!==u?u:"",setOpen:v,handleLoadUsersList:e=>{G(null!=C?C:0,e)},onClose:()=>{O({limit:0,page:0,data:[],cnt:0})}})))},Nt=a().div`
|
|
321
321
|
padding: ${e=>e.theme.space.md}px;
|
|
322
322
|
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
323
|
-
|
|
323
|
+
`,Pt=({uniqid:e})=>{var t;const n=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(Nt,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},Vt=({uniqid:e})=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>{var n;return null===(n=c.x0.selectors.selectWidget(t,e))||void 0===n?void 0:n.title}),d.shallowEqual),{control:a,watch:u}=(0,rt.useForm)({defaultValues:{widgetTitle:o},criteriaMode:"all"});return(0,i.useEffect)((()=>{const t=u((t=>{n(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))}));return()=>t.unsubscribe()}),[u,n,e]),l().createElement(s.JRCInputText,{name:"widgetTitle",control:a,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Jt=u.O.getLazyComponent("Button"),Qt=u.O.getLazyComponent("ModalLayout"),Kt=u.O.getLazyComponent("ModalContent"),Xt=a().div`
|
|
324
324
|
padding: ${e=>e.theme.space.md}px;
|
|
325
325
|
display: flex;
|
|
326
326
|
flex-direction: row-reverse;
|
|
327
|
-
`,
|
|
327
|
+
`,Yt=a().div`
|
|
328
328
|
flex: 1;
|
|
329
329
|
display: flex;
|
|
330
330
|
flex-direction: row;
|
|
331
331
|
gap: ${e=>e.theme.space.sm}px;
|
|
332
332
|
padding: ${e=>e.theme.space.sm}px;
|
|
333
333
|
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
334
|
-
`,
|
|
334
|
+
`,Zt=a().div`
|
|
335
335
|
flex: 1;
|
|
336
336
|
display: flex;
|
|
337
337
|
fieldset:first-of-type {
|
|
338
338
|
margin: 0px !important;
|
|
339
339
|
}
|
|
340
|
-
`,
|
|
340
|
+
`,en=a().div`
|
|
341
341
|
display: flex;
|
|
342
342
|
gap: ${e=>e.theme.space.sm}px;
|
|
343
|
-
`,
|
|
343
|
+
`,tn=({uniqid:e,name:t,handleOpenEditor:n})=>{const o=(0,Se.jL)(),a=(0,r.useIntl)(),[d,u]=(0,i.useState)(!1),m=(0,i.useCallback)((()=>{o(c.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))}),[e,o,t]),g=(0,i.useCallback)((()=>{o(c.x0.slice.actions.flushWidget({uniqid:e}))}),[e,o]);return l().createElement(l().Fragment,null,l().createElement(Yt,null,l().createElement(Zt,null,l().createElement(Vt,{uniqid:e})),l().createElement(en,null,l().createElement(s.JRCIconButton,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:null!=n?n:m,title:a.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),l().createElement(s.JRCIconButton,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:a.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})}))),d&&l().createElement(Qt,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>u(!1)},l().createElement(Kt,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Xt,null,l().createElement(Jt,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:g}))))},nn=a().div`
|
|
344
344
|
display: flex;
|
|
345
345
|
flex: 1;
|
|
346
346
|
flex-direction: column;
|
|
347
|
-
`,
|
|
347
|
+
`,ln=({widget:e,width:t,inplace:n=!1,mode:i="view",onWidgetUpdate:o,cannotDisplayComponent:a})=>{const{name:r}=e;return(0,k.ensureWidgetArticleButtonType)(e)?l().createElement(pe,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleGalleryType)(e)?l().createElement(ve,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleAttachmentType)(e)?l().createElement(de,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleImageType)(e)?l().createElement(Oe,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleSliderType)(e)?l().createElement(je,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,k.ensureWidgetArticleTitleType)(e)?l().createElement(Qe,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleTextType)(e)?l().createElement(He,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(nn,null,l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(At,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,k.ensureWidgetDatasourceTableType)(e)?l().createElement(nn,null,l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(wt,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,k.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Et,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,k.ensureWidgetPresenceType)(e)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Rt,{widget:e,inplace:n,mode:i})):(0,k.ensureWidgetQuickSurveyType)(e)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Ht,{widget:e,inplace:n,mode:i})):a?l().createElement(l().Fragment,null,a(r)):l().createElement(l().Fragment,null,"cannot display widget (",r,")")},on=(a().div`
|
|
348
348
|
height: 0;
|
|
349
349
|
overflow: hidden;
|
|
350
350
|
`,a().div`
|
|
@@ -386,36 +386,36 @@
|
|
|
386
386
|
min-height: 200px;
|
|
387
387
|
`,a().div`
|
|
388
388
|
display: flex;
|
|
389
|
-
`),
|
|
389
|
+
`),an=a().div`
|
|
390
390
|
position: absolute;
|
|
391
391
|
inset: 0;
|
|
392
392
|
opacity: ${e=>e.opacity};
|
|
393
393
|
background-color: ${e=>e.backgroundColor};
|
|
394
394
|
pointer-events: ${e=>e.pointerEvents};
|
|
395
|
-
`,
|
|
395
|
+
`,rn=u.O.getLazyComponent("DoubleClick"),sn=({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(cn,{uniqid:e,key:t,mode:"edit"}))))},cn=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(an,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(dn,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(an,{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(dn,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},dn=({uniqid:e,layerId:t,mode:n})=>{const i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>t.widgets.ids[e]),d.shallowEqual),a=(0,d.useSelector)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(En,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(un,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(c.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(rn,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(En,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},un=({position:e,children:t,onMouseUp:n})=>{const[o,a]=l().useState(!1),[r,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=>{a(!0),g.current&&(s({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),E=l().useCallback((e=>{if(o&&g.current){const t=c.x+(e.clientX-r.x),n=c.y+(e.clientY-r.y);m({x:t,y:n})}}),[r.x,r.y,o,c.x,c.y]),f=(0,i.useCallback)((()=>{a(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return l().useEffect((()=>(document.addEventListener("mousemove",E),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",f)})),[E,f]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},mn=u.O.getLazyComponent("Loader"),gn=({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(mn,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}))},pn=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:u})=>{const m=(0,d.useDispatch)(),g=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),p=(0,d.useSelector)((t=>t.widgets.editableMap[e]),d.shallowEqual),E=(0,d.useSelector)((e=>e.widgets.currentEditableWidgetId),d.shallowEqual),f=(0,d.useSelector)((t=>t.widgets.currentEditableWidgetId===e),d.shallowEqual),{ref:h,isComponentVisible:y,setIsComponentVisible:v}=(0,ne.xv)(!1);if((0,i.useEffect)((()=>{t&&m(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&m(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{y||e===E&&m(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[y]),(0,i.useEffect)((()=>{y!==f&&v(f)}),[f]),void 0===g)return l().createElement(l().Fragment,null,"This widget cannot be displayed");const x=g.widget,b=()=>{"edit"===a?C():(0,k.ensureWidgetArticleButtonType)(x)&&"link"===x.content.openingType&&x.content.openingTypeLink&&window.open(x.content.openingTypeLink.url,x.content.openingTypeLink.target)},C=()=>{if("view"===a)return;const{widget:e}=g;m(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return o&&"view"!==a?l().createElement(on,{ref:h,onClick:()=>{v(!0),p&&(m(c.x0.slice.actions.setEditableIndex({index:p.index})),m(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(ln,{width:r,widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,onClick:b}),l().createElement(sn,{uniqid:e,mode:a}),l().createElement(gn,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o})):l().createElement(on,{onClick:C},l().createElement(ln,{widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,width:r,onClick:b,onWidgetUpdate:s,cannotDisplayComponent:u}),l().createElement(sn,{uniqid:e,mode:a}),l().createElement(gn,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o}))},En=pn,fn=a().div`
|
|
396
396
|
border-radius: ${e=>e.theme.space.sm}px;
|
|
397
397
|
border: 1px solid ${e=>e.theme.color.grey1};
|
|
398
398
|
background-color: ${e=>e.theme.color.white};
|
|
399
399
|
overflow: hidden;
|
|
400
|
-
`,
|
|
400
|
+
`,hn=u.O.getLazyComponent("Message"),yn=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,d.useSelector)(c.x0.selectors.selectFlushedWidgets,d.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(fn,{key:e.widget.uniqid},l().createElement(En,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(hn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},vn=u.O.getLazyComponent("Message"),xn=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,u=(0,d.useSelector)(c.x0.selectors.selectFlushedWidgets,d.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!u.includes(e.widget.uniqid))).map((e=>e&&l().createElement(fn,{key:e.widget.uniqid},l().createElement(En,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(vn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var bn=n(730),Cn=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(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(a,r)}s((i=i.apply(e,t||[])).next())}))};const wn=u.O.getLazyComponent("JRCCommentsBloc"),kn=a().div`
|
|
401
401
|
display: flex;
|
|
402
402
|
flex-direction: column;
|
|
403
403
|
gap: 4px;
|
|
404
404
|
flex: 1;
|
|
405
405
|
width: 100%;
|
|
406
406
|
margin-top: 10px;
|
|
407
|
-
`,
|
|
407
|
+
`,qn=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s})=>{var u;const m=(0,r.useIntl)(),g=(0,o.useTheme)(),p=(0,d.useDispatch)(),[E,f]=(0,i.useState)(),[h,y]=(0,i.useState)(!1),[v,x]=(0,i.useState)([]),[b,C]=(0,i.useState)(!1),w=(0,d.useSelector)(c.xJ.selectors.get),k=(0,d.useSelector)(c.x0.selectors.selectWidgets),W=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),O=(0,d.useSelector)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,d.useSelector)(c.Kx.selectors.selectAll),L=(0,d.useSelector)(c.OD.selectors.selectPlatformConfig),A=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,d.useSelector)((t=>c.Mw.selectors.commentList(t,e))),T=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),j=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),z=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[D,$]=(0,i.useState)(s),{open:F,onInsert:G,close:B,ext:U,isActive:H}=Ge();(0,I.A)(e),((e,t)=>{const n=(0,d.useDispatch)(),l=(0,i.useMemo)((()=>_.A),[]),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])})(M.map((e=>e.id)),e);const N=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})}))}),[p,m]),P=()=>{p(c.Mw.actions.fetchComments({idArticle:e})),V()},V=(0,i.useCallback)((()=>{E||b||(C(!0),q().network.token().then((e=>{f(e.result),C(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{N(e.errorMsg)})))}),[N,E,b,p]),J=(0,i.useCallback)((t=>Cn(void 0,void 0,void 0,(function*(){if(E){y(!0);const n=Object.keys(k).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?k[e]:null)).filter((e=>null!==e));try{yield q().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:E,idArticle:e,type:a})).then((()=>{x([])})),V()}catch(e){N(e.errorMsg)}finally{y(!1)}}}))),[e,a,V,N,E,k,v]);return(0,i.useEffect)((()=>{V()}),[V]),(0,i.useEffect)((()=>{p(c.Mw.actions.fetchComments({idArticle:e}))}),[e,p]),(0,i.useEffect)((()=>{M&&M.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{p(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[M,p]),l().createElement(l().Fragment,null,W&&O&&l().createElement(l().Fragment,null,l().createElement(kn,null,l().createElement(wn,{canComment:n,loading:h,token:E,comments:M,onComment:J,onCommentUpdate:t=>Cn(void 0,void 0,void 0,(function*(){var n,i;const l=M.find((e=>e.id===t.idComment));if(l)return q().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((()=>{p(c.Mw.actions.fetchComments({idArticle:e})),V()})).catch((e=>{N(e.errorMsg)}))})),onCommentDelete:e=>Cn(void 0,void 0,void 0,(function*(){q().article.deleteComment(e).catch(N)})),isWidgetActive:!!((null==z?void 0:z.isActive)&&(null==z?void 0:z.create)&&(null===(u=null==z?void 0:z.autorize)||void 0===u?void 0:u.includes("comment"))),widgetListComponent:l().createElement(Z,{mode:"comment",namespace:"comment",onChange:e=>{x([e]),p(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),f(void 0),V()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(yn,{widgets:v}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(xn,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:P,handleWidgetRemove:V}),currentUser:w,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},W),{toolbar:O.commentsToolbar}),mentionsQueries:(0,bn.X)(S,g,N)},onError:N,highlightFields:L.userHighlightFields,userAccountStatus:L.userAccountStatus,userModel:S.find((e=>"user"===e.type)),isWedocActive:!!A,onGetHashError:e=>p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...j&&T?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==T?void 0:T.drives)],variant:t,handlers:{drive:q().drive,filebank:q().filebank,file:q().file,user:q().user,socialAction:q().socialAction,questionAnswer:q().questionAnswer},socialQuestion:D?Object.assign(Object.assign({},D),{onSelectResponse:e=>{$(Object.assign(Object.assign({},D),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{$(Object.assign(Object.assign({},D),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[U]}),l().createElement(R,null))),H&&l().createElement(Fe,{onInsert:G,open:F,close:B}))};var Wn=n(749),On=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 Sn=o.css`
|
|
408
408
|
height: 100%;
|
|
409
409
|
display: flex;
|
|
410
410
|
flex-direction: column;
|
|
411
411
|
justify-content: space-between;
|
|
412
|
-
`,
|
|
413
|
-
${({stretch:e})=>e&&
|
|
414
|
-
`,
|
|
415
|
-
${({stretch:e})=>e&&
|
|
416
|
-
`,
|
|
412
|
+
`,Ln=a().div`
|
|
413
|
+
${({stretch:e})=>e&&Sn}
|
|
414
|
+
`,An=a().form`
|
|
415
|
+
${({stretch:e})=>e&&Sn}
|
|
416
|
+
`,Mn=i.forwardRef(((e,t)=>e.onSubmit?i.createElement(An,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):i.createElement(Ln,{stretch:e.stretch,ref:t},e.children))),Tn=a().div`
|
|
417
417
|
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
418
|
-
`,
|
|
418
|
+
`,In=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,o]=(0,Wn.SC)(e.fields,e.type,e.forceMandatory),a=(0,rt.useForm)({defaultValues:Object.assign(Object.assign({},o),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:s,reset:c}=a,d=On(a,["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;case"toggle":t[n]=e[n]?"1":"0";break;default:t[n]=e[n]}})),t}),[l]);return i.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:r,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(Mn,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:n},i.createElement(Tn,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=On(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)})),_n=(a().div`
|
|
419
419
|
margin-bottom: 24px;
|
|
420
420
|
`,a().div`
|
|
421
421
|
margin-bottom: 4px;
|
|
@@ -427,27 +427,27 @@
|
|
|
427
427
|
flex: 1;
|
|
428
428
|
display: flex;
|
|
429
429
|
overflow: hidden;
|
|
430
|
-
`),
|
|
430
|
+
`),jn=a().div`
|
|
431
431
|
flex-direction: row;
|
|
432
432
|
display: flex;
|
|
433
433
|
min-height: 60px;
|
|
434
434
|
border-bottom: 1px solid ${e=>e.theme.color.grey2};
|
|
435
|
-
`,
|
|
435
|
+
`,zn=a().div`
|
|
436
436
|
width: 60px;
|
|
437
437
|
display: flex;
|
|
438
438
|
align-items: center;
|
|
439
439
|
justify-content: center;
|
|
440
|
-
`,
|
|
440
|
+
`,Dn=a().div`
|
|
441
441
|
flex: 1;
|
|
442
442
|
display: flex;
|
|
443
443
|
align-items: center;
|
|
444
444
|
justify-content: center;
|
|
445
|
-
|
|
445
|
+
`,$n=a().div`
|
|
446
446
|
position: relative;
|
|
447
447
|
overflow: hidden;
|
|
448
448
|
top: 91px;
|
|
449
449
|
width: ${460}px;
|
|
450
|
-
`,
|
|
450
|
+
`,Rn=a().div`
|
|
451
451
|
position: absolute;
|
|
452
452
|
top: 0;
|
|
453
453
|
${e=>"left"===e.position?"left: 0px;":""}
|
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
&.animate {
|
|
464
464
|
right: 0px;
|
|
465
465
|
}
|
|
466
|
-
`,
|
|
466
|
+
`,Fn=a().div`
|
|
467
467
|
flex: 1;
|
|
468
468
|
display: flex;
|
|
469
469
|
flex-direction: column;
|
|
@@ -471,25 +471,25 @@
|
|
|
471
471
|
overflow: auto;
|
|
472
472
|
margin-bottom: 12px;
|
|
473
473
|
position: relative;
|
|
474
|
-
`,
|
|
474
|
+
`,Gn=a().div`
|
|
475
475
|
position: absolute;
|
|
476
476
|
inset: 0;
|
|
477
477
|
background-color: rgba(255, 255, 255, 0.8);
|
|
478
478
|
display: flex;
|
|
479
479
|
align-items: center;
|
|
480
480
|
justify-content: center;
|
|
481
|
-
|
|
481
|
+
`,Bn=a().div`
|
|
482
482
|
position: absolute;
|
|
483
483
|
inset: 0;
|
|
484
484
|
background-color: ${e=>e.theme.color.white};
|
|
485
485
|
padding: ${e=>e.theme.space.md}px;
|
|
486
|
-
`,
|
|
486
|
+
`,Un=a().div`
|
|
487
487
|
width: ${50}px;
|
|
488
488
|
padding-top: 60px;
|
|
489
489
|
display: flex;
|
|
490
490
|
flex-direction: column;
|
|
491
491
|
border-right: 1px solid ${e=>e.theme.color.grey2};
|
|
492
|
-
`,
|
|
492
|
+
`,Hn=a().button`
|
|
493
493
|
border-radius: 4px;
|
|
494
494
|
cursor: pointer;
|
|
495
495
|
height: 42px;
|
|
@@ -502,7 +502,7 @@
|
|
|
502
502
|
&:hover {
|
|
503
503
|
background-color: ${e=>e.theme.color.grey1};
|
|
504
504
|
}
|
|
505
|
-
`,
|
|
505
|
+
`,Nn=(a().div`
|
|
506
506
|
display: flex;
|
|
507
507
|
border: 1px solid ${e=>e.theme.color.grey1};
|
|
508
508
|
border-radius: ${8}px;
|
|
@@ -520,16 +520,16 @@
|
|
|
520
520
|
background-color: ${e=>e.theme.color.grey0};
|
|
521
521
|
border-radius: 8px;
|
|
522
522
|
margin-bottom: 4px;
|
|
523
|
-
`),
|
|
523
|
+
`),Pn=a().div`
|
|
524
524
|
display: flex;
|
|
525
525
|
flex: 1;
|
|
526
526
|
align-items: center;
|
|
527
|
-
`,
|
|
527
|
+
`,Vn=a().div`
|
|
528
528
|
width: 40px;
|
|
529
529
|
display: flex;
|
|
530
530
|
justify-content: center;
|
|
531
531
|
align-items: center;
|
|
532
|
-
`,
|
|
532
|
+
`,Jn=(a().div`
|
|
533
533
|
flex-direction: row;
|
|
534
534
|
display: flex;
|
|
535
535
|
align-items: center;
|
|
@@ -537,23 +537,23 @@
|
|
|
537
537
|
flex: 1;
|
|
538
538
|
display: flex;
|
|
539
539
|
align-items: center;
|
|
540
|
-
`,u.default.registry.getLazyComponent("Button")),Nn=u.default.registry.getLazyComponent("Icon"),Pn=({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(Mn,null,l().createElement(In,null),l().createElement(On,null,"Popup"),l().createElement(In,null,l().createElement(Fn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(Nn,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(Mn,null,l().createElement(Hn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)},Vn=u.default.registry.getLazyComponent("WidgetArticleTitleEditor"),Jn=u.default.registry.getLazyComponent("WidgetArticleTextEditor"),Qn=u.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),Kn=u.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),Yn=u.default.registry.getLazyComponent("WidgetArticleSliderEditor"),Xn=u.default.registry.getLazyComponent("WidgetArticleImageEditor"),Zn=u.default.registry.getLazyComponent("WidgetButtonEditor"),ei=u.default.registry.getLazyComponent("WidgetCheckListEditor"),ti=u.default.registry.getLazyComponent("WidgetQuickSurveyEditor"),ni=u.default.registry.getLazyComponent("WidgetDatasourceTableEditor"),ii=u.default.registry.getLazyComponent("WidgetExcelDatasourceTableEditor"),li=u.default.registry.getLazyComponent("WidgetPresenceEditor"),ri=({uniqid:e})=>{var t,n,i,r,a;const o=(0,d.useDispatch)(),s=(0,d.useSelector)(c.x0.selectors.selectToken),m=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),g=(0,d.useSelector)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),d.shallowEqual),p=e=>{var t;return null===(t=c.qn.selectors.selectHook(u.default.store.getState(),e))||void 0===t?void 0:t.isActive},f=t=>{m&&o(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),o(c.cr.slice.actions.flushEditor({uniqid:e})),g&&g(t)},E=(t,n)=>{o(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},y=t=>{o(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},h=null==m?void 0:m.widget;return h?(0,k.ensureWidgetArticleButtonType)(h)?l().createElement(Zn,Object.assign({},h.content,{onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:()=>f({})})):(0,k.ensureWidgetArticleGalleryType)(h)?l().createElement(Qn,{token:s,content:h.content,onChange:t=>o((0,c.vR)(e,t,!1)),onSave:f,onStateChange:E}):(0,k.ensureWidgetArticleAttachmentType)(h)?l().createElement(Kn,{token:s,content:h.content,onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:f,onStateChange:E,onOpen:y}):(0,k.ensureWidgetArticleImageType)(h)?l().createElement(Xn,{content:h.content,token:s,onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:f,onStateChange:E}):(0,k.ensureWidgetArticleSliderType)(h)?void 0!==s?l().createElement(Yn,{slides:null!==(t=h.content.slides)&&void 0!==t?t:[],loop:null!==(n=h.content.loop)&&void 0!==n&&n,useDots:null===(i=h.content.useDots)||void 0===i||i,onChange:t=>{o((0,c.vR)(e,t,!1))},token:s,onSave:f}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,k.ensureWidgetArticleTitleType)(h)?l().createElement(Vn,{onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:f,content:h.content,onOpen:y}):(0,k.ensureWidgetArticleTextType)(h)?l().createElement(Jn,{onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:f,content:h.content}):(0,k.ensureWidgetPresenceType)(h)?l().createElement(li,Object.assign({onChange:t=>{o((0,c.vR)(e,t,!1))},onSave:f,onStateChange:E},h.content)):(0,k.ensureWidgetCheckListType)(h)?l().createElement(ei,{token:s,uniqid:h.uniqid,content:h.content,onChangeContent:(e,t)=>{o((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{o(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>o((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetQuickSurveyType)(h)?l().createElement(ti,{token:s,uniqid:h.uniqid,content:h.content,onChangeContent:(e,t)=>{o((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{o(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>o((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetExcelDatasourceTableType)(h)?l().createElement(ii,Object.assign({},h.content,{uri:h.content.uri,limit:null!==(r=h.content.limit)&&void 0!==r?r:20,hook:{isActive:p},handlers:{jamespot:{datasource:q().datasource,network:q().network,filebank:q().filebank,wedoc:q().wedoc},handleStart:()=>E({busy:!0}),handleCatch:e=>o(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>E({busy:!1})},onSave:f,onChange:(t,n)=>o((0,c.vR)(e,t,null!=n&&n)),onStateChange:E,onError:e=>o(c.y8.actions.error({label:e}))})):(0,k.ensureWidgetDatasourceTableType)(h)?l().createElement(ni,Object.assign({},h.content,{uri:h.content.uri,limit:null!==(a=h.content.limit)&&void 0!==a?a:20,hook:{isActive:p},handlers:{jamespot:{datasource:q().datasource,network:q().network,application:q().application,filebank:q().filebank},handleStart:()=>E({busy:!0}),handleCatch:e=>o(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>E({busy:!1})},onSave:f,onChange:(t,n)=>o((0,c.vR)(e,t,null!=n&&n)),onStateChange:E,onError:e=>{o(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},ai=u.default.registry.getLazyComponent("Icon"),oi=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement(In,null,l().createElement(Fn,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(ai,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},si=u.default.registry.getLazyComponent("BETA_DragAndDrop"),ci=u.default.registry.getLazyComponent("Icon"),di=({uniqid:e})=>{var t;const n=(0,d.useDispatch)(),i=(0,o.useIntl)(),r=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,a=(null==r?void 0:r.content)&&"widgets"in r.content&&r.content.widgets?r.content.widgets:[];return l().createElement("div",{style:{flex:1}},l().createElement(ui,{uniqid:e}),r?a.map(((t,o)=>{const s=c.x0.definition(t.widget.name);return l().createElement("div",{key:o},l().createElement(Gn,null,l().createElement(Bn,{onClick:()=>((e,t)=>{n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:s.label})),l().createElement(Un,{onClick:()=>{n(c.x0.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},r.content),{widgets:[...a.filter(((e,t)=>t!==o)).map((e=>((0,k.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(ci,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},ui=({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(si,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(fi,{uniqid:e,key:t}),elms:n||[]}),l().createElement(X,{namespace:"default",onChange:n=>{t(c.x0.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},mi=({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(ci,{name:n.locked?"icon-lock":"icon-unlock"}))},gi=({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(ci,{name:n.visible?"icon-eye":"icon-eye-slash"}))},pi=({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(ci,{name:"icon-trash"}))},fi=({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 r=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"}},r.label),l().createElement(mi,{uniqid:e}),l().createElement(gi,{uniqid:e}),l().createElement(pi,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},Ei=u.default.registry.getLazyComponent("InputText"),yi=({uniqid:e})=>{var t;const n=(0,o.useIntl)(),i=(0,d.useDispatch)(),r=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),{control:a,watch:s}=(0,et.useForm)({defaultValues:{text:null!==(t=null==r?void 0:r.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});return l().useEffect((()=>{const t=s((t=>{i(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[s,e,i]),r?l().createElement(Ei,{name:"text",width:"100%",control:a,placeholder:n.formatMessage({id:"WIDGET_Title"})}):l().createElement(l().Fragment,null)},hi=u.default.registry.getLazyComponent("Loader"),vi=({uniqid:e})=>{var t;const n=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(Dn,null,l().createElement(hi,{size:"l"})))},xi=({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)},bi=({uniqid:e})=>{var t;const n=(0,o.useIntl)();return(null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement($n,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Ci=u.default.registry.getLazyComponent("Button"),wi=({uniqid:e,mode:t})=>{const n=(0,o.useIntl)(),i=(0,d.useDispatch)(),r=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),a=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),d.shallowEqual);return l().createElement(Ci,{onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=r&&r.widget&&r.widget.content;a&&r&&l&&("view"==t&&q().widget.updateWidget({uri:a,uniqid:e,title:r.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},ki=u.default.registry.getLazyComponent("Icon"),qi=["widget-presence","widget-quick-survey","widget-check-list"],Wi=({uniqid:e,position:t})=>{const n=(0,o.useIntl)(),r=(0,d.useDispatch)(),a=(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((()=>{a&&a.current&&(a.current.className=a.current.className+" animate")}),0)}),[]),s?l().createElement(_n,null,l().createElement(jn,{ref:a,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(Rn,null,u.panel.useWrapper?l().createElement(Fn,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(ki,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(Fn,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(ki,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(xi,{uniqid:e},l().createElement(Fn,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(ki,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(Mn,null,l().createElement(oi,{uniqid:e,position:s.position}),l().createElement(On,null,n.formatMessage({id:u.label})),l().createElement(In,null,l().createElement(Fn,{onClick:()=>{r(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(ki,{name:"icon-times",color:"grey2"})))),l().createElement(zn,null,"default"===m&&u.panel.useEditor?l().createElement(ri,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(yi,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(di,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(vi,{uniqid:e}),l().createElement(bi,{uniqid:e}),qi.includes(s.name)&&l().createElement(wi,{uniqid:e,mode:s.mode})))),(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)},Si=a().div`
|
|
540
|
+
`,u.O.getLazyComponent("Button")),Qn=u.O.getLazyComponent("Icon"),Kn=({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(jn,null,l().createElement(zn,null),l().createElement(Dn,null,"Popup"),l().createElement(zn,null,l().createElement(Hn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(Qn,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(jn,null,l().createElement(Jn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var Xn=n(320);const Yn=u.O.getLazyComponent("WidgetArticleTitleEditor"),Zn=u.O.getLazyComponent("WidgetArticleTextEditor"),ei=u.O.getLazyComponent("WidgetArticleGalleryEditor"),ti=u.O.getLazyComponent("WidgetArticleAttachmentEditor"),ni=u.O.getLazyComponent("WidgetArticleSliderEditor"),ii=u.O.getLazyComponent("WidgetArticleImageEditor"),li=u.O.getLazyComponent("WidgetButtonEditor"),oi=u.O.getLazyComponent("WidgetCheckListEditor"),ai=u.O.getLazyComponent("WidgetQuickSurveyEditor"),ri=u.O.getLazyComponent("WidgetDatasourceTableEditor"),si=u.O.getLazyComponent("WidgetExcelDatasourceTableEditor"),ci=u.O.getLazyComponent("WidgetPresenceEditor"),di=({uniqid:e})=>{var t,n,i,o,a;const r=(0,d.useDispatch)(),s=(0,d.useSelector)(c.x0.selectors.selectToken),u=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),m=(0,d.useSelector)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),d.shallowEqual),g=e=>{var t;return null===(t=c.qn.selectors.selectHook(Xn.M.getState(),e))||void 0===t?void 0:t.isActive},p=t=>{u&&r(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),r(c.cr.slice.actions.flushEditor({uniqid:e})),m&&m(t)},E=(t,n)=>{r(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},f=t=>{r(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},h=null==u?void 0:u.widget;return h?(0,k.ensureWidgetArticleButtonType)(h)?l().createElement(li,Object.assign({},h.content,{onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:()=>p({})})):(0,k.ensureWidgetArticleGalleryType)(h)?l().createElement(ei,{token:s,content:h.content,onChange:t=>r((0,c.vR)(e,t,!1)),onSave:p,onStateChange:E}):(0,k.ensureWidgetArticleAttachmentType)(h)?l().createElement(ti,{token:s,content:h.content,onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:p,onStateChange:E,onOpen:f}):(0,k.ensureWidgetArticleImageType)(h)?l().createElement(ii,{content:h.content,token:s,onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:p,onStateChange:E}):(0,k.ensureWidgetArticleSliderType)(h)?void 0!==s?l().createElement(ni,{slides:null!==(t=h.content.slides)&&void 0!==t?t:[],loop:null!==(n=h.content.loop)&&void 0!==n&&n,useDots:null===(i=h.content.useDots)||void 0===i||i,onChange:t=>{r((0,c.vR)(e,t,!1))},token:s,onSave:p}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,k.ensureWidgetArticleTitleType)(h)?l().createElement(Yn,{onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:p,content:h.content,onOpen:f}):(0,k.ensureWidgetArticleTextType)(h)?l().createElement(Zn,{onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:p,content:h.content}):(0,k.ensureWidgetPresenceType)(h)?l().createElement(ci,Object.assign({onChange:t=>{r((0,c.vR)(e,t,!1))},onSave:p,onStateChange:E},h.content)):(0,k.ensureWidgetCheckListType)(h)?l().createElement(oi,{token:s,uniqid:h.uniqid,content:h.content,onChangeContent:(e,t)=>{r((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{r(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>r((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetQuickSurveyType)(h)?l().createElement(ai,{token:s,uniqid:h.uniqid,content:h.content,onChangeContent:(e,t)=>{r((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{r(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>r((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetExcelDatasourceTableType)(h)?l().createElement(si,Object.assign({},h.content,{uri:h.content.uri,limit:null!==(o=h.content.limit)&&void 0!==o?o:20,hook:{isActive:g},handlers:{jamespot:{datasource:q().datasource,network:q().network,filebank:q().filebank,wedoc:q().wedoc},handleStart:()=>E({busy:!0}),handleCatch:e=>r(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>E({busy:!1})},onSave:p,onChange:(t,n)=>r((0,c.vR)(e,t,null!=n&&n)),onStateChange:E,onError:e=>r(c.y8.actions.error({label:e}))})):(0,k.ensureWidgetDatasourceTableType)(h)?l().createElement(ri,Object.assign({},h.content,{uri:h.content.uri,limit:null!==(a=h.content.limit)&&void 0!==a?a:20,hook:{isActive:g},handlers:{jamespot:{datasource:q().datasource,network:q().network,application:q().application,filebank:q().filebank},handleStart:()=>E({busy:!0}),handleCatch:e=>r(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>E({busy:!1})},onSave:p,onChange:(t,n)=>r((0,c.vR)(e,t,null!=n&&n)),onStateChange:E,onError:e=>{r(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},ui=u.O.getLazyComponent("Icon"),mi=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement(zn,null,l().createElement(Hn,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(ui,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},gi=u.O.getLazyComponent("BETA_DragAndDrop"),pi=u.O.getLazyComponent("Icon"),Ei=({uniqid:e})=>{var t;const n=(0,d.useDispatch)(),i=(0,r.useIntl)(),o=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,a=(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(fi,{uniqid:e}),o?a.map(((t,r)=>{const s=c.x0.definition(t.widget.name);return l().createElement("div",{key:r},l().createElement(Nn,null,l().createElement(Pn,{onClick:()=>((e,t)=>{n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:s.label})),l().createElement(Vn,{onClick:()=>{n(c.x0.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},o.content),{widgets:[...a.filter(((e,t)=>t!==r)).map((e=>((0,k.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(pi,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},fi=({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(gi,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(xi,{uniqid:e,key:t}),elms:n||[]}),l().createElement(Z,{namespace:"default",onChange:n=>{t(c.x0.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},hi=({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(pi,{name:n.locked?"icon-lock":"icon-unlock"}))},yi=({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(pi,{name:n.visible?"icon-eye":"icon-eye-slash"}))},vi=({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(pi,{name:"icon-trash"}))},xi=({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(hi,{uniqid:e}),l().createElement(yi,{uniqid:e}),l().createElement(vi,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},bi=u.O.getLazyComponent("InputText"),Ci=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),{control:a,watch:s}=(0,rt.useForm)({defaultValues:{text:null!==(t=null==o?void 0:o.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});return l().useEffect((()=>{const t=s((t=>{i(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[s,e,i]),o?l().createElement(bi,{name:"text",width:"100%",control:a,placeholder:n.formatMessage({id:"WIDGET_Title"})}):l().createElement(l().Fragment,null)},wi=u.O.getLazyComponent("Loader"),ki=({uniqid:e})=>{var t;const n=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(Gn,null,l().createElement(wi,{size:"l"})))},qi=({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)},Wi=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(Bn,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Oi=u.O.getLazyComponent("Button"),Si=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),a=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),d.shallowEqual);return l().createElement(Oi,{onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&q().widget.updateWidget({uri:a,uniqid:e,title:o.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},Li=["widget-presence","widget-quick-survey","widget-check-list"],Ai=u.O.getLazyComponent("Icon"),Mi=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),a=(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((()=>{a&&a.current&&(a.current.className=a.current.className+" animate")}),0)}),[]),s?l().createElement($n,null,l().createElement(Rn,{ref:a,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(Un,null,u.panel.useWrapper?l().createElement(Hn,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(Ai,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(Hn,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(Ai,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(qi,{uniqid:e},l().createElement(Hn,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(Ai,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(jn,null,l().createElement(mi,{uniqid:e,position:s.position}),l().createElement(Dn,null,n.formatMessage({id:u.label})),l().createElement(zn,null,l().createElement(Hn,{onClick:()=>{o(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Ai,{name:"icon-times",color:"grey2"})))),l().createElement(Fn,null,"default"===m&&u.panel.useEditor?l().createElement(di,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(Ci,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(Ei,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(ki,{uniqid:e}),l().createElement(Wi,{uniqid:e}),Li.includes(s.name)&&l().createElement(Si,{uniqid:e,mode:s.mode})))),(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)},Ti=a().div`
|
|
541
541
|
position: absolute;
|
|
542
542
|
inset: 0;
|
|
543
543
|
pointer-events: none;
|
|
544
544
|
z-index: 1;
|
|
545
|
-
`,
|
|
545
|
+
`,Ii=a().div`
|
|
546
546
|
flex: 1;
|
|
547
547
|
display: flex;
|
|
548
548
|
margintop: ${90}px;
|
|
549
549
|
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
550
|
-
`,
|
|
550
|
+
`,_i=a().div`
|
|
551
551
|
flex: 1;
|
|
552
552
|
display: flex;
|
|
553
553
|
flex-direction: row;
|
|
554
554
|
pointer-events: none;
|
|
555
|
-
`,
|
|
555
|
+
`,ji=a().div`
|
|
556
556
|
width: ${440}px;
|
|
557
557
|
pointer-events: none;
|
|
558
|
-
`,
|
|
558
|
+
`,zi=()=>{const e=(0,d.useSelector)(c.cr.selectors.selectEditors,d.shallowEqual);return l().createElement(Ti,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?l().createElement(_n,{isActive:!1,key:t},l().createElement(_i,null,l().createElement(Mi,{uniqid:e.uniqid,position:e.position}),l().createElement(Ii,{isActive:void 0!==e.popup},l().createElement(Kn,{uniqid:e.uniqid})),l().createElement(ji,null))):l().createElement(_n,{isActive:!1,key:t},l().createElement(_i,null,l().createElement(ji,null),l().createElement(Ii,{isActive:void 0!==e.popup},l().createElement(Kn,{uniqid:e.uniqid})),l().createElement(Mi,{uniqid:e.uniqid,position:e.position}))))))},Di=()=>i.createElement(i.Fragment,null);var $i=n(286);const Ri=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(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}),[]),o=(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)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},Fi=u.O.getLazyComponent("InputTinyMCE"),Gi=e=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),a=(0,o.useTheme)(),s=(0,d.useSelector)(c.Kx.selectors.selectAll),{query:u,ext:m,isActive:g}=Ri(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=Ge(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),x=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),b=(0,i.useMemo)((()=>(0,bn.X)(s,a,x)),[s,x,a]),C=(0,i.useMemo)((()=>$i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(Fi,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:b},e)),g&&l().createElement(T,{query:u}),y&&l().createElement(Fe,{onInsert:E,open:p,close:f}))},Bi=u.O.getLazyComponent("InputTinyMCERaw"),Ui=e=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),a=(0,o.useTheme)(),s=(0,d.useSelector)(c.Kx.selectors.selectAll),{query:u,ext:m,isActive:g}=Ri(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=Ge(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),x=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),b=(0,i.useMemo)((()=>(0,bn.X)(s,a,x)),[s,x,a]),C=(0,i.useMemo)((()=>$i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(Bi,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:b},e)),g&&l().createElement(T,{query:u}),y&&l().createElement(Fe,{onInsert:E,open:p,close:f}))},Hi=u.O.getLazyComponent("InputAudience"),Ni=u.O.getLazyComponent("Message"),Pi=u.O.getLazyComponent("Modal"),Vi=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const u=(0,r.useIntl)(),m=(0,d.useSelector)(c.Bx.selectors.selectNetworkPublic);return l().createElement(Pi,{open:e,closeHandler:t,title:null!=n?n:u.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement(Ni,{variant:"warning",message:null!=o?o:u.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Hi,{asyncPromise:e=>q().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:u.formatMessage({id:"GLOBAL_Audience"}),name:s,defaultCustomOptions:m?[{uri:m.uri,title:m.title,resetOptions:!0,icon:"icon-fs-wall"}]:[]}))};var Ji=n(737);const Qi=u.O.getLazyComponent("Container"),Ki=u.O.getLazyComponent("AppColumn"),Xi=u.O.getLazyComponent("MainColumn");function Yi({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,r.useIntl)(),{pathname:s}=(0,Ji.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:a.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?a.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>{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,Ji.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(Qi,{mode:l},i.createElement(Ki,{mode:l,description:n,tabs:m,activeTab:d||""}),i.createElement(Xi,{mode:l,flex:!0},i.createElement(Ji.Outlet,null))))}}}]);
|
|
559
559
|
//# sourceMappingURL=724.bundle.js.map
|