jamespot-react-core 1.1.193 → 1.1.194
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/{593.593f5002f60d02db0f3c.chunk.js → 593.f9409533153e655b4a27.chunk.js} +19 -19
- package/build/593.f9409533153e655b4a27.chunk.js.map +1 -0
- package/build/app.bundle.js +7 -6
- package/build/app.bundle.js.map +1 -1
- package/build/src/components/TwoColLayout.d.ts +1 -1
- package/build/src/components/types.d.ts +2 -1
- package/build/src/displayer/DisplayForm.component.d.ts +4 -2
- package/build/src/displayer/components/DisplayRender.d.ts +2 -0
- package/build/src/displayer/components/inputs/InputFile.d.ts +4 -0
- package/build/src/displayer/components/inputs/InputImage.d.ts +4 -0
- package/build/src/displayer/components/inputs/InputTaxonomy.d.ts +5 -0
- package/build/src/displayer/formatter.d.ts +2 -0
- package/build/src/displayer/types.d.ts +9 -3
- package/build/src/redux/store.d.ts +8 -4
- package/package.json +4 -4
- package/build/593.593f5002f60d02db0f3c.chunk.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[593],{593:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Rl,DisplayForm:()=>V,Editor:()=>ze,EditorsPortal:()=>dt,Empty:()=>Bl,JRCInputTinyMCEWithExt:()=>Nl,JRCInputTinyMCEWithExtRaw:()=>Jl,MarkdownModal:()=>gn,ModalAudience:()=>Zl,TwoColLayout:()=>lo,WidgetList:()=>Lt,WidgetWrapperCore:()=>Tl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[593],{593:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Rl,DisplayForm:()=>V,Editor:()=>ze,EditorsPortal:()=>dt,Empty:()=>Bl,JRCInputTinyMCEWithExt:()=>Nl,JRCInputTinyMCEWithExtRaw:()=>Jl,MarkdownModal:()=>gn,ModalAudience:()=>Zl,TwoColLayout:()=>lo,WidgetList:()=>Lt,WidgetWrapperCore:()=>Tl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(814),c=n(399),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
cursor: pointer;
|
|
20
20
|
`,x=({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(p,null,[...e].splice(0,t).map(((e,t)=>l().createElement(C,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(b,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(g,{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(E,{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(y,null,e.map(((e,t)=>l().createElement(p,{key:`audience-${t}`,y:"center",gap:a.space.l},l().createElement(g,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(h,{href:`${e.type}/${e.id}`},l().createElement(v,null,e.title)))))))))};var w=n(833),k=n.n(w);const L=d.j.getLazyComponent("Loader"),_=d.j.getLazyComponent("ModalContent"),W=d.j.getLazyComponent("ModalLayout"),q=d.j.getLazyComponent("Typography"),S=a().div`
|
|
21
21
|
padding: ${e=>e.theme.space.md}px;
|
|
22
|
-
`,j={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(j),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(j),k().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(W,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(_,{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(S,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(L,null),l().createElement(q,{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 T=n(655),
|
|
22
|
+
`,j={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(j),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(j),k().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(W,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(_,{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(S,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(L,null),l().createElement(q,{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 T=n(655),I=n(958),A=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 O=o.css`
|
|
23
23
|
height: 100%;
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
${({stretch:e})=>e&&O}
|
|
31
31
|
`,D=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(G,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(z,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),$=a().div`
|
|
32
32
|
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
33
|
-
`,V=(0,i.forwardRef)(((e,t)=>{const
|
|
33
|
+
`,V=(0,i.forwardRef)(((e,t)=>{var{onInit:n}=e,o=A(e,["onInit"]);const a=(0,i.useRef)(null),[r,s]=(0,I.SC)(o.fields,o.type,o.forceMandatory),[c,d]=(0,i.useState)(!1),u=(0,T.useForm)({defaultValues:Object.assign(Object.assign({},s),o.defaultValues),criteriaMode:"all"}),{handleSubmit:m,control:g,reset:p}=u,f=A(u,["handleSubmit","control","reset"]);(0,i.useEffect)((()=>{n&&!c&&(n(f),d(!0))}),[n,f,c]);const E=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const l=null===(i=r.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==l?void 0:l.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}),[r]);return(0,i.useImperativeHandle)(t,(()=>Object.assign(Object.assign({},f),{handleSubmit:m,control:g,reset:()=>{var e;null===(e=null==a?void 0:a.current)||void 0===e||e.scrollTo(0,0),p()},getFormattedValues:()=>E(f.getValues())})),[]),l().createElement(D,{dataCy:o.dataCy,stretch:o.stretch,onSubmit:o.onSubmit?m(o.onSubmit):void 0,ref:a},l().createElement($,{stretch:o.stretch},r.map((e=>{var{Input:t}=e,n=A(e,["Input"]);return l().createElement(t,Object.assign({key:n.name,control:g},n,{dataCy:`${o.dataCy}-${n.name}`,readOnly:o.readOnly}))})),o.extraInputs&&o.extraInputs(g)),o.buttons)}));var F=n(491),R=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 B=d.j.getLazyComponent("ModalForm"),H=d.j.getLazyComponent("Loader"),P=d.j.getLazyComponent("Icon"),U=d.j.getLazyComponent("Typography"),N=d.j.getLazyComponent("Ellipsis"),Y=d.j.getLazyComponent("StyledHref"),Q=a().div`
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
36
|
gap: ${({theme:e})=>e.space.md}px;
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
flex: 1;
|
|
176
176
|
display: flex;
|
|
177
177
|
align-items: center;
|
|
178
|
-
`,d.j.getLazyComponent("Button")),be=d.j.getLazyComponent("Icon"),ve=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,u.GV)((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(ae,null,l().createElement(re,null),l().createElement(se,null,"Popup"),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(be,{name:"icon-times",color:"grey2",size:26.75})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ae,null,l().createElement(he,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var ye=n(939);const Ce=d.j.getLazyComponent("WidgetArticleTitleEditor"),xe=d.j.getLazyComponent("WidgetArticleTextEditor"),we=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ke=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),Le=d.j.getLazyComponent("WidgetArticleSliderEditor"),_e=d.j.getLazyComponent("WidgetArticleImageEditor"),We=d.j.getLazyComponent("WidgetButtonEditor"),qe=d.j.getLazyComponent("WidgetCheckListEditor"),Se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),je=d.j.getLazyComponent("WidgetDatasourceTableEditor"),Me=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Te=d.j.getLazyComponent("WidgetPresenceEditor"),
|
|
178
|
+
`,d.j.getLazyComponent("Button")),be=d.j.getLazyComponent("Icon"),ve=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,u.GV)((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(ae,null,l().createElement(re,null),l().createElement(se,null,"Popup"),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(be,{name:"icon-times",color:"grey2",size:26.75})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(ae,null,l().createElement(he,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var ye=n(939);const Ce=d.j.getLazyComponent("WidgetArticleTitleEditor"),xe=d.j.getLazyComponent("WidgetArticleTextEditor"),we=d.j.getLazyComponent("WidgetArticleGalleryEditor"),ke=d.j.getLazyComponent("WidgetArticleAttachmentEditor"),Le=d.j.getLazyComponent("WidgetArticleSliderEditor"),_e=d.j.getLazyComponent("WidgetArticleImageEditor"),We=d.j.getLazyComponent("WidgetButtonEditor"),qe=d.j.getLazyComponent("WidgetCheckListEditor"),Se=d.j.getLazyComponent("WidgetQuickSurveyEditor"),je=d.j.getLazyComponent("WidgetDatasourceTableEditor"),Me=d.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Te=d.j.getLazyComponent("WidgetPresenceEditor"),Ie=d.j.getLazyComponent("WidgetEmailsImapEditor"),Ae=d.j.getLazyComponent("WidgetContactCardDavEditor"),Oe=d.j.getLazyComponent("WidgetCalendarCalDavEditor"),ze=({uniqid:e})=>{var t,n,i,o,a,r;const d=(0,u.jL)(),m=(0,u.GV)(c.x0.selectors.selectToken),g=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual),p=(0,u.GV)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),le.shallowEqual),f=e=>{var t;return null===(t=c.qn.selectors.selectHook(ye.M.getState(),e))||void 0===t?void 0:t.isActive},E=t=>{g&&d(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),d(c.cr.slice.actions.flushEditor({uniqid:e})),p&&p(t)},h=(t,n)=>{d(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},b=t=>{d(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},v=null==g?void 0:g.widget;return v?(0,w.ensureWidgetArticleButtonType)(v)?l().createElement(We,Object.assign({},v.content,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:()=>E({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(we,{token:m,content:v.content,onChange:t=>d((0,c.vR)(e,t,!1)),onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(ke,{token:m,content:v.content,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h,onOpen:b}):(0,w.ensureWidgetArticleImageType)(v)?l().createElement(_e,{content:v.content,token:m,onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h}):(0,w.ensureWidgetArticleSliderType)(v)?void 0!==m?l().createElement(Le,{slides:null!==(t=v.content.slides)&&void 0!==t?t:[],loop:null!==(n=v.content.loop)&&void 0!==n&&n,useDots:null===(i=v.content.useDots)||void 0===i||i,onChange:t=>{d((0,c.vR)(e,t,!1))},token:m,onSave:E}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,w.ensureWidgetArticleTitleType)(v)?l().createElement(Ce,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content,onOpen:b}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(xe,{onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(Te,Object.assign({onChange:t=>{d((0,c.vR)(e,t,!1))},onSave:E,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(qe,{token:m,uniqid:v.uniqid,content:Object.assign(Object.assign({},v.content),{arr:null===(o=v.content.arr)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetQuickSurveyType)(v)?l().createElement(Se,{token:m,uniqid:v.uniqid,content:v.content,onChangeContent:(e,t)=>{d((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{d(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>d((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetExcelDatasourceTableType)(v)?l().createElement(Me,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(a=v.content.limit)&&void 0!==a?a:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,filebank:k().filebank,wedoc:k().wedoc},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>d(c.y8.actions.error({label:e}))})):(0,w.ensureWidgetEmailsImapType)(v)?l().createElement(Ie,null):(0,w.ensureWidgetContactCardDavType)(v)?l().createElement(Ae,null):(0,w.ensureWidgetCalendarCalDavType)(v)?l().createElement(Oe,null):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(je,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(r=v.content.limit)&&void 0!==r?r:20,hook:{isActive:f},handlers:{jamespot:{datasource:k().datasource,network:k().network,application:k().application,filebank:k().filebank},handleStart:()=>h({busy:!0}),handleCatch:e=>d(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:E,onChange:(t,n)=>d((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>{d(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},Ge=d.j.getLazyComponent("Icon"),De=({uniqid:e,position:t})=>{const n=(0,u.jL)(),i=(0,o.useTheme)();return l().createElement(re,null,l().createElement(Ee,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(Ge,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:i.color.lavender,size:26.75})))},$e=d.j.getLazyComponent("InputColorRaw"),Ve=a().label`
|
|
179
179
|
margin-left: 2px;
|
|
180
180
|
margin-right: 2px;
|
|
181
181
|
margin-bottom: 8px;
|
|
@@ -293,9 +293,9 @@
|
|
|
293
293
|
width: 0;
|
|
294
294
|
height: 0;
|
|
295
295
|
overflow: hidden;
|
|
296
|
-
`,Mt=({children:e,initialFiles:t,initialClick:n,multiple:o,accept:a,onUploadStart:r,onUploadEnd:s,onUploadSuccess:d})=>{const m=(0,i.useRef)(null),g=(0,u.GV)(c.x0.selectors.selectToken),[p,f]=(0,i.useState)(0),[E,h]=(0,i.useState)(t);return(0,i.useEffect)((()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),(0,i.useEffect)((()=>{t.length!==E.length&&h(t)}),[t]),(0,i.useEffect)((()=>{d(E)}),[E]),(0,i.useEffect)((()=>{0===p&&s()}),[p]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}},e),l().createElement(jt,null,l().createElement(St,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:a,multiple:o,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof r&&0!==e&&r()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),h((t=>o?[...t,e]:[e])))}})))},Tt=d.j.getLazyComponent("WidgetAttachment"),
|
|
296
|
+
`,Mt=({children:e,initialFiles:t,initialClick:n,multiple:o,accept:a,onUploadStart:r,onUploadEnd:s,onUploadSuccess:d})=>{const m=(0,i.useRef)(null),g=(0,u.GV)(c.x0.selectors.selectToken),[p,f]=(0,i.useState)(0),[E,h]=(0,i.useState)(t);return(0,i.useEffect)((()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),(0,i.useEffect)((()=>{t.length!==E.length&&h(t)}),[t]),(0,i.useEffect)((()=>{d(E)}),[E]),(0,i.useEffect)((()=>{0===p&&s()}),[p]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=m.current)||void 0===e||e.click())}},e),l().createElement(jt,null,l().createElement(St,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:a,multiple:o,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof r&&0!==e&&r()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),h((t=>o?[...t,e]:[e])))}})))},Tt=d.j.getLazyComponent("WidgetAttachment"),It=d.j.getLazyComponent("WidgetEmptyInplace"),At=d.j.getLazyComponent("FileViewer"),Ot=a().div`
|
|
297
297
|
flex: 1;
|
|
298
|
-
`,zt=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),le.shallowEqual),g=e=>{d(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),f=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&k().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((()=>{d(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],E=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:f}]:[];return void 0!==s?l().createElement(Ot,null,"view"!==n?l().createElement(Tt,{files:s,onClick:()=>{},onError:g}):l().createElement(
|
|
298
|
+
`,zt=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,a)),le.shallowEqual),g=e=>{d(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),f=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&k().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((()=>{d(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],E=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:f}]:[];return void 0!==s?l().createElement(Ot,null,"view"!==n?l().createElement(Tt,{files:s,onClick:()=>{},onError:g}):l().createElement(At,{files:s,openWithOptions:E},(e=>l().createElement(Tt,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(Mt,{initialFiles:s,initialClick:m,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(a,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},"edit"===n?l().createElement(It,{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)},Gt=d.j.getLazyComponent("WidgetButton"),Dt=a().div`
|
|
299
299
|
display: flex;
|
|
300
300
|
flex: 1;
|
|
301
301
|
justify-content: center;
|
|
@@ -394,14 +394,14 @@
|
|
|
394
394
|
fieldset {
|
|
395
395
|
margin: 0.2rem !important;
|
|
396
396
|
}
|
|
397
|
-
`,
|
|
397
|
+
`,In=({placeholder:e,handleClick:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),[a,c]=(0,i.useState)(""),{control:d,watch:m,reset:g}=(0,T.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(Tn,null,l().createElement(s.JRCInputText,{name:"label",control:d,placeholder:e,width:"100%"}),l().createElement(s.JRCButton,{label:n.formatMessage({id:"GLOBAL_Confirm"}),disabled:!a.length,onClick:()=>{t(a),c(""),g()}}))},An=a().div`
|
|
398
398
|
position: absolute;
|
|
399
399
|
inset: 0;
|
|
400
400
|
display: flex;
|
|
401
401
|
justify-content: center;
|
|
402
402
|
align-items: center;
|
|
403
403
|
background-color: rgba(255, 255, 255, 0.4);
|
|
404
|
-
`,On=()=>l().createElement(
|
|
404
|
+
`,On=()=>l().createElement(An,null,l().createElement(s.JRCLoader,{size:"m"})),zn=d.j.getLazyComponent("WidgetCheckList"),Gn=d.j.getLazyComponent("WidgetCheckListEditor"),Dn=(a().div`
|
|
405
405
|
display: flex;
|
|
406
406
|
flex-direction: row;
|
|
407
407
|
justify-content: space-between;
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
padding: 16px;
|
|
418
418
|
`),$n=a().div`
|
|
419
419
|
position: relative;
|
|
420
|
-
`,Vn=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const d=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)(),[C,x]=(0,i.useState)(!1),L=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),_=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),le.shallowEqual),q=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),S=(0,i.useMemo)((()=>W&&W.update),[W]),j=(0,i.useMemo)((()=>W&&W.administrate),[W]),M=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:d.formatMessage({id:"GLOBAL_Error"})}))}),[p,d]),T=(0,i.useCallback)((()=>{f||h||(b(!0),k().network.token().then((e=>{E(e.result),b(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{M(e.errorMsg)})))}),[M,f,h,p]);L?f||E(L):T();const
|
|
420
|
+
`,Vn=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const d=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,u.jL)(),[f,E]=(0,i.useState)(),[h,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)(),[C,x]=(0,i.useState)(!1),L=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),_=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),le.shallowEqual),q=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),S=(0,i.useMemo)((()=>W&&W.update),[W]),j=(0,i.useMemo)((()=>W&&W.administrate),[W]),M=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:d.formatMessage({id:"GLOBAL_Error"})}))}),[p,d]),T=(0,i.useCallback)((()=>{f||h||(b(!0),k().network.token().then((e=>{E(e.result),b(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{M(e.errorMsg)})))}),[M,f,h,p]);L?f||E(L):T();const I=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),A=(0,i.useCallback)((()=>{_&&(x(!0),k().widget.getWidget({uri:_,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&I(m,e.result.content)})).catch((e=>!e.aborted&&M)).finally((()=>x(!1))))}),[m,M,_,I]),O=t=>{p(c.cr.slice.actions.flushAllEditor()),p(c.x0.slice.actions.setToken({token:t})),p(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:w.WidgetsName.CheckList,mode:n}))};(0,i.useEffect)((()=>{f||"edit"!==n||k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,f,p]),(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"})}));y(n)}),[e.content.arr,g]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const t=q.at(-1);t&&_&&t.object.uri===_&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||A())}),[q,e.uniqid,_,M,p,A]);const z=t=>{if(!e.content.arr||!_)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:_,uniqid:e.uniqid,content:n,v2:!0}).then((()=>I(e.uniqid,n))).catch((e=>M(e.errorMsg)))},G=(0,i.useMemo)((()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[g]);return"edit"===n&&t?l().createElement(Dn,null,l().createElement(Gn,{token:f,uniqid:m,content:Object.assign(Object.assign({},g),{arr:null===(a=g.arr)||void 0===a?void 0:a.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),inplace:t,onChangeContent:I,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},v&&l().createElement(s.JRCFileViewer,{files:G,openWithOptions:[]},(t=>l().createElement($n,{key:e.uniqid},l().createElement(zn,{limit:10,initialEntries:v,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{_&&(C||(x(!0),k().widget.checkListRespond({uri:_,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{M(e.message),x(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(In,{handleClick:z,placeholder:d.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),j&&f&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!S)},mode:n,handleOpenEditor:()=>{f?O(f):(x(!0),k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result})),O(e.result)})).finally((()=>x(!1))))}}),C&&l().createElement(On,null)))))},Fn=(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},Rn=d.j.getLazyComponent("Button"),Bn=d.j.getLazyComponent("WidgetTable"),Hn=d.j.getLazyComponent("Loader"),Pn=(a().div``,a().div`
|
|
421
421
|
position: absolute;
|
|
422
422
|
inset: 0;
|
|
423
423
|
display: flex;
|
|
@@ -425,7 +425,7 @@
|
|
|
425
425
|
justify-content: center;
|
|
426
426
|
align-items: center;
|
|
427
427
|
gap: ${e=>e.theme.space.md}px;
|
|
428
|
-
`),Un=({uri:e,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:f,mode:E})=>{const h=(0,u.jL)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,L]=(0,i.useState)([]),[_,W]=(0,i.useState)({order:"ascending",name:"unknown"}),[q,S]=(0,i.useState)(void 0),[j,M]=(0,i.useState)(""),T=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),
|
|
428
|
+
`),Un=({uri:e,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:f,mode:E})=>{const h=(0,u.jL)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,L]=(0,i.useState)([]),[_,W]=(0,i.useState)({order:"ascending",name:"unknown"}),[q,S]=(0,i.useState)(void 0),[j,M]=(0,i.useState)(""),T=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),I=(0,i.useMemo)((()=>"studio"===q?[{type:[j]}]:[]),[q,j]),A=(0,i.useMemo)((()=>"doc"===q?[j]:[]),[q,j]),{rtLastObject:O}=(0,qt.YL)(I,A),z=(0,i.useCallback)((()=>{e&&(v(!0),k().datasource.get(e,w.Format.VIEW).then((e=>{L(e.result.model),C(e.result.data),W(e.result.sort),S(e.result.datasource.datasourceType),M(e.result.datasource.datasourceIdentifier)})).finally((()=>v(!1))))}),[e]);(0,i.useEffect)((()=>{void 0!==e&&0!==m.length&&0===x.length&&z()}),[e,m,x,z]),(0,i.useEffect)((()=>{O&&z()}),[O,z]),(0,i.useEffect)((()=>{e||L([])}),[e]),(0,i.useEffect)((()=>{"view"!==E&&"preview"!==E||h(c.cr.slice.actions.flushAllEditor())}),[E,h]);const G=(0,i.useMemo)((()=>Fn(m,x)),[m,x]);return 0!==m.length||b||"edit"!==E?b?l().createElement(Pn,null,l().createElement(Hn,null)):l().createElement(l().Fragment,null,b||0!==y.length||"edit"===E?l().createElement(Bn,{rows:y,columns:G,limit:t,tableHeadColor:n,tableHeadTextColor:o,tableHeadIconColor:a,tableRowColor:s,tableRowTextColor:d,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:f,tableDefaultSortOrder:_.order,tableDefaultSortName:_.name}):l().createElement(Pn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"}))):l().createElement(l().Fragment,null,l().createElement(Pn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:T.label}),l().createElement(Rn,{label:"GLOBAL_Settings"})))},Nn=d.j.getLazyComponent("Button"),Yn=d.j.getLazyComponent("WidgetTable"),Jn=d.j.getLazyComponent("Loader"),Qn=(a().div``,a().div`
|
|
429
429
|
position: absolute;
|
|
430
430
|
inset: 0;
|
|
431
431
|
display: flex;
|
|
@@ -464,14 +464,14 @@
|
|
|
464
464
|
align-items: center;
|
|
465
465
|
border-radius: ${e=>e.theme.space.sm}px;
|
|
466
466
|
margin: ${e=>e.theme.space.sm}px;
|
|
467
|
-
`),ai=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),{limit:a,limitValue:s,closing:d,isClosed:m}=e.content,{uniqid:g}=e,[p,f]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[E,h]=(0,i.useState)(!1),[b]=(0,i.useState)(new AbortController),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)(),[w,L]=(0,i.useState)(),_=(0,i.useRef)(b),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),le.shallowEqual),q=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),le.shallowEqual),S=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),j=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>d&&m||"edit"===t),[d,m,t]),T=(0,i.useCallback)((()=>{W&&!M&&(j?(h(!0),k().widget.presenceCancel({uri:W,uniqid:g}).catch(S).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,S,W,j,M]),
|
|
467
|
+
`),ai=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,u.jL)(),{limit:a,limitValue:s,closing:d,isClosed:m}=e.content,{uniqid:g}=e,[p,f]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[E,h]=(0,i.useState)(!1),[b]=(0,i.useState)(new AbortController),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)(),[w,L]=(0,i.useState)(),_=(0,i.useRef)(b),W=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),le.shallowEqual),q=(0,u.GV)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),le.shallowEqual),S=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),j=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>d&&m||"edit"===t),[d,m,t]),T=(0,i.useCallback)((()=>{W&&!M&&(j?(h(!0),k().widget.presenceCancel({uri:W,uniqid:g}).catch(S).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,S,W,j,M]),I=(0,i.useCallback)((e=>{W&&!M&&(h(!0),k().widget.presenceRespond({uri:W,uniqid:g,value:e},_.current.signal).catch(S).finally((()=>h(!1))))}),[W,g,S,M]),A=(0,i.useCallback)((()=>{"edit"!==t&&W&&(h(!0),k().widget.presenceGetResponse({uri:W,uniqid:g},_.current.signal).then((e=>{f(e.result)})).catch((e=>!e.aborted&&S())).finally((()=>h(!1))))}),[W,S,g,t]),O=(e,t)=>{W&&k().widget.presenceGetResponseUserList({uri:W,uniqid:g,index:e,page:t,limit:8},_.current.signal).then((e=>{L(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&S))},z=(0,i.useCallback)((()=>{W&&(h(!0),k().widget.getWidget({uri:W,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&S)).finally((()=>h(!1))))}),[o,S,W,g]);return(0,i.useEffect)((()=>{const e=_.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{A()}),[A]),(0,i.useEffect)((()=>{if(!Array.isArray(q))return;const e=q.at(-1);e&&W&&e.object.uri===W&&e.uniqid===g&&("widget-presence-response"===e.fn&&A(),"widget-update"===e.fn&&z())}),[q,A,g,W,z]),l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(li,null,l().createElement(ni,{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:d&&m,handleClickAvailable:()=>1===p.userValue?T():I(1),handleClickUnavailable:()=>0===p.userValue?T():I(0),handleOpenUsersModal:e=>{L({limit:0,page:0,data:[],cnt:0}),x(e),O(e),y(!0)}}),d&&m&&l().createElement(oi,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),d&&!m&&l().createElement(ti,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,mode:t}),E&&l().createElement(On,null),l().createElement(ii,{open:v,usersList:w,title:1===C?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:y,onClose:()=>{L({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{O(null!=C?C:0,e)}})))},ri=d.j.getLazyComponent("WidgetQuickSurvey"),si=d.j.getLazyComponent("WidgetQuickSurveyEditor"),ci=d.j.getLazyComponent("ModalUserList"),di=a().div`
|
|
468
468
|
width: 100%;
|
|
469
469
|
display: flex;
|
|
470
470
|
flex-direction: column;
|
|
471
471
|
gap: 14px;
|
|
472
472
|
${e=>e.withPadding&&"padding: 0 12px;"}
|
|
473
473
|
padding-top: 16px;
|
|
474
|
-
`,ui=({widget:e,inplace:t,mode:n})=>{var o,a,d;const m=(0,r.useIntl)(),g=(0,u.jL)(),{uniqid:p,content:f}=e,[E,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)(!1),[x,L]=(0,i.useState)(),[_,W]=(0,i.useState)(),[q]=(0,i.useState)(new AbortController),S=(0,i.useRef)(q),j=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),le.shallowEqual),
|
|
474
|
+
`,ui=({widget:e,inplace:t,mode:n})=>{var o,a,d;const m=(0,r.useIntl)(),g=(0,u.jL)(),{uniqid:p,content:f}=e,[E,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)(!1),[x,L]=(0,i.useState)(),[_,W]=(0,i.useState)(),[q]=(0,i.useState)(new AbortController),S=(0,i.useRef)(q),j=(0,u.GV)(c.x0.selectors.selectToken,le.shallowEqual),M=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),le.shallowEqual),T=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),le.shallowEqual),I=(0,u.GV)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),le.shallowEqual),A=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),O=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:w.WidgetsName.QuickSurvey}))},z=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),G=(0,i.useCallback)((e=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},S.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[z,M,n]),D=(0,i.useCallback)((()=>{M&&(C(!0),k().widget.getWidget({uri:M,uniqid:p},S.current.signal).then((e=>{A(p,e.result.content)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))}),[p,z,M,A]),$=()=>{if(M&&f.closing){const e=Object.assign(Object.assign({},f),{isClosed:!0});k().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{z()}))}},V=t=>{(t=>{"edit"!==n&&M&&(C(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:f.multi?1:0,uniqid:p},S.current.signal).then((()=>{G(e.uniqid)})).catch((e=>!e.aborted&&z)).finally((()=>C(!1))))})(t)},F=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},S.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&z))},R=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{G(e.uniqid)}),[G,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&&G(e.uniqid),"widget-update"===t.fn&&D())}),[I,M,e.uniqid,D,G]);const B=(0,i.useMemo)((()=>{if(!Array.isArray(f.arr))return[];const e=[];return f.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[f]);return(0,i.useEffect)((()=>{j||"edit"!==n||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,j,g]),"edit"===n&&t?l().createElement(di,{withPadding:!0},l().createElement(si,{token:j,uniqid:p,content:e.content,onChangeContent:A,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>A(p,e),inplace:t})):l().createElement(wn.M,{useRT:()=>{(0,qt.AW)(e.uniqid)}},l().createElement(di,null,l().createElement(s.JRCFileViewer,{files:B,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(ri,{limit:null!==(n=E.totalResponse)&&void 0!==n?n:0,values:null!==(i=f.arr)&&void 0!==i?i:[],userResponses:E.userResponses,userHasAlreadyVoted:E.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:R,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:$,handleProgressBarClick:V,setOpenUsersModal:e=>{L(e),F(e),v(!0)}})})),f.open&&l().createElement(In,{handleClick:e=>{var t;if(!M)return;const n=Object.assign(Object.assign({},f),{arr:[...null!==(t=f.arr)&&void 0!==t?t:[],{title:e}]});k().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"})}),R&&l().createElement(Mn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!R},mode:n,handleOpenEditor:()=>{j?O(j):(C(!0),k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),O(e.result)})).finally((()=>C(!1))))}}),y&&l().createElement(On,null),l().createElement(ci,{open:b,usersList:_,title:null!==(d=null===(a=null===(o=f.arr)||void 0===o?void 0:o[null!=x?x:0])||void 0===a?void 0:a.title)&&void 0!==d?d:"",setOpen:v,handleLoadUsersList:e=>{F(null!=x?x:0,e)},onClose:()=>{W({limit:0,page:0,data:[],cnt:0})}})))},mi=d.j.getLazyComponent("ModalLayout"),gi=d.j.getLazyComponent("ModalContent"),pi=d.j.getLazyComponent("Button"),fi=d.j.getLazyComponent("InputText"),Ei=d.j.getLazyComponent("InputNumber"),hi=d.j.getLazyComponent("InputSelect"),bi=d.j.getLazyComponent("InputPassword"),vi=d.j.getLazyComponent("Typography"),yi=a().div`
|
|
475
475
|
display: flex;
|
|
476
476
|
flex-direction: column;
|
|
477
477
|
opacity: ${e=>e.isLocked?".4":"1.0"};
|
|
@@ -512,12 +512,12 @@
|
|
|
512
512
|
flex-direction: row;
|
|
513
513
|
gap: ${e=>e.theme.space.xs}px;
|
|
514
514
|
align-items: center;
|
|
515
|
-
`),Ti=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):"transparent",fontSize:r&&r["font-size"]?String(r["font-size"]):"16",fontWeight:r&&r["font-weight"]?String(r["font-weight"]):"medium",textAlign:r&&r["text-align"]?String(r["text-align"]):"left"})),[r,a]);return l().createElement(Si,{backroundColor:s.backgroundColor},l().createElement(ji,null,l().createElement(Mi,null,l().createElement(qi,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign,color:s.color}),n&&n(s.color)),t&&t()))},
|
|
515
|
+
`),Ti=({uniqid:e,dropdown:t,subHeader:n})=>{const a=(0,o.useTheme)(),r=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.shallowEqual),s=(0,i.useMemo)((()=>({color:r&&r.color?String(r.color):a.color.black,backgroundColor:r&&r["background-color"]?String(r["background-color"]):"transparent",fontSize:r&&r["font-size"]?String(r["font-size"]):"16",fontWeight:r&&r["font-weight"]?String(r["font-weight"]):"medium",textAlign:r&&r["text-align"]?String(r["text-align"]):"left"})),[r,a]);return l().createElement(Si,{backroundColor:s.backgroundColor},l().createElement(ji,null,l().createElement(Mi,null,l().createElement(qi,{uniqid:e,fontWeight:s.fontWeight,fontSize:s.fontSize,textAlign:s.textAlign,color:s.color}),n&&n(s.color)),t&&t()))},Ii=d.j.getLazyComponent("ButtonDropdown"),Ai=d.j.getLazyComponent("Tooltip"),Oi=a().div`
|
|
516
516
|
margin-right: ${e=>e.theme.space.sm}px;
|
|
517
517
|
button {
|
|
518
518
|
background: ${e=>e.theme.color.white};
|
|
519
519
|
}
|
|
520
|
-
`,zi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(wi).finally(n)}}];return l().createElement(Ti,{uniqid:e,dropdown:()=>t&&l().createElement(Oi,null,l().createElement(
|
|
520
|
+
`,zi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(wi).finally(n)}}];return l().createElement(Ti,{uniqid:e,dropdown:()=>t&&l().createElement(Oi,null,l().createElement(Ai,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Ii,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-edit",label:"",color:"primary",variant:"outlined"})))})},Gi=a().div`
|
|
521
521
|
flex-direction: column;
|
|
522
522
|
display: flex;
|
|
523
523
|
flex: 1;
|
|
@@ -579,7 +579,7 @@
|
|
|
579
579
|
opacity: ${e=>e.opacity};
|
|
580
580
|
background-color: ${e=>e.backgroundColor};
|
|
581
581
|
pointer-events: ${e=>e.pointerEvents};
|
|
582
|
-
`,bl=d.j.getLazyComponent("DoubleClick"),vl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),le.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(yl,{uniqid:e,key:t,mode:"edit"}))))},yl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(hl,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(hl,{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(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Cl=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),le.shallowEqual),a=(0,u.GV)((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(
|
|
582
|
+
`,bl=d.j.getLazyComponent("DoubleClick"),vl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.ids[e].widget.layers),le.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(yl,{uniqid:e,key:t,mode:"edit"}))))},yl=({uniqid:e,mode:t})=>{const n=(0,u.GV)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(hl,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(hl,{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(Cl,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Cl=({uniqid:e,layerId:t,mode:n})=>{const i=(0,u.jL)(),o=(0,u.GV)((t=>t.widgets.ids[e]),le.shallowEqual),a=(0,u.GV)((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(Il,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(xl,{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(bl,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(Il,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},xl=({position:e,children:t,onMouseUp:n})=>{const[o,a]=(0,i.useState)(!1),[r,s]=(0,i.useState)({x:0,y:0}),[c,d]=(0,i.useState)({x:0,y:0}),[u,m]=(0,i.useState)({x:e.x,y:e.y}),g=(0,i.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]),f=(0,i.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]),E=(0,i.useCallback)((()=>{a(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return(0,i.useEffect)((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},wl=d.j.getLazyComponent("Loader"),kl=({uniqid:e,inplace:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)));return(null==n?void 0:n.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(wl,null)):(null==n?void 0:n.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):(null==n||n.initialized,l().createElement(l().Fragment,null))},Ll=a().button`
|
|
583
583
|
position: absolute;
|
|
584
584
|
inset: 0;
|
|
585
585
|
display: flex;
|
|
@@ -622,17 +622,17 @@
|
|
|
622
622
|
background-color: rgba(0, 0, 0, 0.1);
|
|
623
623
|
color: ${e=>e.color?e.color:e.theme.color.black};
|
|
624
624
|
}
|
|
625
|
-
`,Ml=({uniqid:e,name:t,url:n,level:i})=>{var o;const a=c.x0.definition(t),r=(0,u.GV)((t=>2===i?c.x0.selectors.selectWidgetChipCount(t,e):0),le.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual);return l().createElement(jl,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(Sl,{count:r,img:a.img,label:a.label,maxValue:999}))},Tl=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,dataCy:m})=>{const g=(0,u.jL)(),p=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),f=(0,u.GV)((t=>t.widgets.editableMap[e]),le.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),le.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),le.shallowEqual),{isComponentVisible:b,setIsComponentVisible:v}=(0,qt.xv)(!1);(0,i.useEffect)((()=>{t&&g(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&g(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{b||e===E&&g(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[b]),(0,i.useEffect)((()=>{b!==h&&v(h)}),[h]);const y=(0,i.useCallback)((()=>{if(void 0===p||"view"===a)return;g(c.cr.slice.actions.flushAllEditor());const{widget:e}=p;g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[g,a,p]);return void 0===p?l().createElement(l().Fragment,null,"This widget cannot be displayed"):o&&"view"!==a?l().createElement(ql,{uniqid:e,onClick:()=>{v(!0),f&&(g(c.x0.slice.actions.setEditableIndex({index:f.index})),g(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(El,{dataCy:m,width:r,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,levelFallback:(e,t)=>e<=2&&l().createElement(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(ql,{uniqid:e,onClick:y},l().createElement(El,{dataCy:m,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,levelFallback:(e,t)=>e<=2&&l().createElement(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),"edit"===a&&l().createElement(_l,{uniqid:e,name:n.widget.name}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},
|
|
625
|
+
`,Ml=({uniqid:e,name:t,url:n,level:i})=>{var o;const a=c.x0.definition(t),r=(0,u.GV)((t=>2===i?c.x0.selectors.selectWidgetChipCount(t,e):0),le.shallowEqual),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual);return l().createElement(jl,{href:n,target:"_blank",color:null!==(o=String(s.color))&&void 0!==o?o:void 0,rel:"noreferrer","aria-label":a.label},l().createElement(Sl,{count:r,img:a.img,label:a.label,maxValue:999}))},Tl=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,dataCy:m})=>{const g=(0,u.jL)(),p=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),f=(0,u.GV)((t=>t.widgets.editableMap[e]),le.shallowEqual),E=(0,u.GV)((e=>e.widgets.currentEditableWidgetId),le.shallowEqual),h=(0,u.GV)((t=>t.widgets.currentEditableWidgetId===e),le.shallowEqual),{isComponentVisible:b,setIsComponentVisible:v}=(0,qt.xv)(!1);(0,i.useEffect)((()=>{t&&g(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&g(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{b||e===E&&g(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[b]),(0,i.useEffect)((()=>{b!==h&&v(h)}),[h]);const y=(0,i.useCallback)((()=>{if(void 0===p||"view"===a)return;g(c.cr.slice.actions.flushAllEditor());const{widget:e}=p;g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[g,a,p]);return void 0===p?l().createElement(l().Fragment,null,"This widget cannot be displayed"):o&&"view"!==a?l().createElement(ql,{uniqid:e,onClick:()=>{v(!0),f&&(g(c.x0.slice.actions.setEditableIndex({index:f.index})),g(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(El,{dataCy:m,width:r,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,levelFallback:(e,t)=>e<=2&&l().createElement(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o})):l().createElement(ql,{uniqid:e,onClick:y},l().createElement(El,{dataCy:m,widget:Object.assign(Object.assign({},p.widget),p.title&&{title:p.title}),inplace:o,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:d,levelFallback:(e,t)=>e<=2&&l().createElement(Ml,{uniqid:n.widget.uniqid,name:n.widget.name,level:e,url:t})}),l().createElement(vl,{uniqid:e,mode:a}),"edit"===a&&l().createElement(_l,{uniqid:e,name:n.widget.name}),l().createElement(kl,{name:p.widget.name,uniqid:p.widget.uniqid,inplace:o}))},Il=Tl,Al=a().div`
|
|
626
626
|
border-radius: ${e=>e.theme.space.sm}px;
|
|
627
627
|
border: 1px solid ${e=>e.theme.color.grey1};
|
|
628
628
|
background-color: ${e=>e.theme.color.white};
|
|
629
629
|
overflow: hidden;
|
|
630
|
-
`,Ol=d.j.getLazyComponent("Message"),zl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(
|
|
630
|
+
`,Ol=d.j.getLazyComponent("Message"),zl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(Al,{key:e.widget.uniqid},l().createElement(Il,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(Ol,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Gl=d.j.getLazyComponent("Message"),Dl=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,d=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(Al,{key:e.widget.uniqid},l().createElement(Il,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(Gl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var $l=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 Vl=d.j.getLazyComponent("JRCCommentsBloc"),Fl=a().div`
|
|
631
631
|
display: flex;
|
|
632
632
|
flex-direction: column;
|
|
633
633
|
gap: 4px;
|
|
634
634
|
flex: 1;
|
|
635
635
|
width: 100%;
|
|
636
636
|
margin-top: 10px;
|
|
637
|
-
`,Rl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m;const g=(0,r.useIntl)(),p=(0,o.useTheme)(),f=(0,u.jL)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,w]=(0,i.useState)(!1),L=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),W=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),q=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),M=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),T=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),
|
|
638
|
-
//# sourceMappingURL=593.
|
|
637
|
+
`,Rl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m;const g=(0,r.useIntl)(),p=(0,o.useTheme)(),f=(0,u.jL)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!1),[y,C]=(0,i.useState)([]),[x,w]=(0,i.useState)(!1),L=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),W=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),q=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,u.GV)(c.Kx.selectors.selectAll),j=(0,u.GV)(c.OD.selectors.selectPlatformConfig),M=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),T=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),I=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),A=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),O=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,G]=(0,i.useState)(s),[D,$]=(0,i.useState)(null),{open:V,onInsert:F,close:R,ext:B,isActive:H}=cn();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.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])})(T.map((e=>e.id)),e);const P=(0,i.useCallback)((e=>{f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})}))}),[f,g]),U=()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()},N=(0,i.useCallback)((()=>{E||x||(w(!0),k().network.token().then((e=>{h(e.result),w(!1),f(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,E,x,f]),Y=(0,i.useCallback)((t=>$l(void 0,void 0,void 0,(function*(){if(E){v(!0);const n=Object.keys(_).map((e=>(null==y?void 0:y.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:E,idArticle:e,type:a})).then((()=>{C([])})),N()}catch(e){throw P(e.errorMsg),e}finally{v(!1)}}}))),[e,a,N,P,E,_,y]);return(0,i.useEffect)((()=>{N()}),[N]),(0,i.useEffect)((()=>{f(c.Mw.actions.fetchComments({idArticle:e}))}),[e,f]),(0,i.useEffect)((()=>{T&&T.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{f(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),f(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[T,f]),l().createElement(l().Fragment,null,W&&q&&l().createElement(l().Fragment,null,l().createElement(Fl,null,l().createElement(Vl,{canComment:n,loading:b,token:E,comments:T,onComment:Y,onCommentUpdate:t=>$l(void 0,void 0,void 0,(function*(){var n,i;const l=T.find((e=>e.id===t.idComment));if(l)return k().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((()=>{f(c.Mw.actions.fetchComments({idArticle:e})),N()})).catch((e=>{P(e.errorMsg)}))})),onCommentDelete:t=>$l(void 0,void 0,void 0,(function*(){f(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==O?void 0:O.isActive)&&(null==O?void 0:O.create)&&(null===(m=null==O?void 0:O.autorize)||void 0===m?void 0:m.includes("comment"))),widgetListComponent:l().createElement(Lt,{mode:"comment",namespace:"comment",onChange:e=>{C([e]),f(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),h(void 0),N()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(zl,{widgets:y}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Dl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:U,handleWidgetRemove:N}),currentUser:L,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},W),{toolbar:q.commentsToolbar}),mentionsQueries:(0,sn.X)(S,p,P)},onError:P,highlightFields:j.userHighlightFields,userAccountStatus:j.userAccountStatus,userModel:S.find((e=>"user"===e.type)),isWedocActive:!!M,onGetHashError:e=>f(c.y8.actions.error({label:null!=e?e:g.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...A&&I?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==I?void 0:I.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,user:k().user,socialAction:k().socialAction,questionAnswer:k().questionAnswer},socialQuestion:z?Object.assign(Object.assign({},z),{onSelectResponse:e=>{G(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{G(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[B],onReport:t=>$({articleId:e,commentUri:t,articleUri:d})}),l().createElement(mt,null))),H&&l().createElement(gn,{onInsert:F,open:V,close:R}),D&&l().createElement(Z,Object.assign({onClose:()=>$(null)},D)))},Bl=()=>l().createElement(l().Fragment,null);var Hl=n(286);const Pl=()=>{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}},Ul=d.j.getLazyComponent("InputTinyMCE"),Nl=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Pl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Hl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Ul,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},Yl=d.j.getLazyComponent("InputTinyMCERaw"),Jl=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Pl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=cn(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,sn.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Hl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Yl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(gn,{onInsert:f,open:p,close:E}))},Ql=d.j.getLazyComponent("InputAudience"),Xl=d.j.getLazyComponent("Message"),Kl=d.j.getLazyComponent("Modal"),Zl=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const c=(0,r.useIntl)();return l().createElement(Kl,{open:e,closeHandler:t,title:null!=n?n:c.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(Xl,{variant:"warning",message:null!=o?o:c.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Ql,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:c.formatMessage({id:"GLOBAL_Audience"}),name:s}))};var eo=n(737);const to=d.j.getLazyComponent("Container"),no=d.j.getLazyComponent("AppColumn"),io=d.j.getLazyComponent("MainColumn");function lo({extensionRoute:e,routes:t,description:n,mode:o="center",mainColumnProps:a}){var s;const c=(0,r.useIntl)(),{pathname:d}=(0,eo.useLocation)(),u=(0,i.useMemo)((()=>Object.values(t)),[t]),[m,g]=(0,i.useState)(null===(s=null==u?void 0:u[0])||void 0===s?void 0:s.key),p=u.map((t=>Object.assign(Object.assign({},t),{label:c.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?c.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=u.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===d||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,eo.matchPath)(i,d);return t||l}),!1))}));t&&g(t.key)}),[d,u,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(to,{mode:o},l().createElement(no,{mode:o,description:n,tabs:p,activeTab:m||""}),l().createElement(io,Object.assign({mode:o,flex:!0},a),l().createElement(eo.Outlet,null))))}}}]);
|
|
638
|
+
//# sourceMappingURL=593.f9409533153e655b4a27.chunk.js.map
|