jamespot-react-core 1.1.183 → 1.1.184
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.4aadbecc6e0740c58434.chunk.js +561 -0
- package/build/724.4aadbecc6e0740c58434.chunk.js.map +1 -0
- package/build/app.bundle.js +81 -69
- package/build/app.bundle.js.map +1 -1
- package/build/socket.sharedworker.36b2317446c7c433029e.js.map +1 -1
- package/build/src/ReactCore.d.ts +10 -4
- package/build/src/components/widgets/wrapper/utils.d.ts +1 -1
- package/build/src/displayer/DisplayForm.component.d.ts +1 -2
- package/build/src/displayer/types.d.ts +1 -0
- package/build/src/displayer/useDisplay.d.ts +1 -2
- package/build/src/registry/CommonRegistry.d.ts +2 -0
- package/build/src/registry/CoreRegistry.d.ts +2 -0
- package/build/src/registry/GlobalRegistry.d.ts +13 -0
- package/build/src/registry/ReactCommonRegistry.d.ts +13 -0
- package/build/src/registry/ReactCoreRegistry.d.ts +13 -0
- package/build/src/registry/index.d.ts +1 -0
- package/build/src/registry/types.common.d.ts +14 -0
- package/build/src/registry/types.core.d.ts +14 -0
- package/build/src/types.d.ts +2 -1
- package/build/src/utils/socket.d.ts +1 -1
- package/build/src/utils/types.d.ts +4 -50
- package/build/src/utils/types.socket.d.ts +48 -0
- package/package.json +3 -3
- package/build/724.4e810912c9eacc41e4bb.chunk.js +0 -559
- package/build/724.4e810912c9eacc41e4bb.chunk.js.map +0 -1
- package/build/src/registry/ReactRegistry.d.ts +0 -13
- package/build/src/registry/Registry.d.ts +0 -2
- package/build/src/registry/types.d.ts +0 -31
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[724],{724:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,Audience:()=>C,Avatar:()=>g,CommentsBloc:()=>qi,DisplayForm:()=>Ii,EditorsPortal:()=>tt,Empty:()=>Oi,JRCInputTinyMCEWithExt:()=>$i,JRCInputTinyMCEWithExtRaw:()=>Fi,MarkdownModal:()=>Ut,ModalAudience:()=>Hi,TwoColLayout:()=>Qi,WidgetList:()=>Se,WidgetWrapperCore:()=>Ei});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(137),c=n(298),d=n(704),u=n(996);const m=u.j.getLazyComponent("Icon"),g=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(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=u.j.getLazyComponent("FlexBox"),E=u.j.getLazyComponent("ModalContent"),f=u.j.getLazyComponent("ModalLayout"),h=u.j.getLazyComponent("StyledHref"),y=u.j.getLazyComponent("Tooltip"),v=u.j.getLazyComponent("Typography"),b=a().div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
margin-bottom: 24px;
|
|
6
|
+
`,x=a().a`
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 40px;
|
|
12
|
+
height: 40px;
|
|
13
|
+
border-radius: 40px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
color: ${e=>e.theme.color.white};
|
|
16
|
+
background-color: ${e=>e.theme.color.lavender};
|
|
17
|
+
border: 4px solid ${e=>e.theme.color.white};
|
|
18
|
+
margin-left: ${e=>e.overlap?"-18px":"0"};
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
`,C=({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(x,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(y,{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(x,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(f,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(E,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(b,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 q=u.j.getLazyComponent("Loader"),W=u.j.getLazyComponent("ModalContent"),j=u.j.getLazyComponent("ModalLayout"),S=u.j.getLazyComponent("Typography"),L=a().div`
|
|
21
|
+
padding: ${e=>e.theme.space.md}px;
|
|
22
|
+
`,A={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(A),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(A),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(j,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(W,{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(L,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(q,null),l().createElement(S,{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(690),I=n(746);var O=n(206),_=n(743);const D=(a().div`
|
|
23
|
+
margin-bottom: 24px;
|
|
24
|
+
`,a().div`
|
|
25
|
+
margin-bottom: 4px;
|
|
26
|
+
`,a().div`
|
|
27
|
+
position: absolute;
|
|
28
|
+
background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
|
|
29
|
+
inset: 0;
|
|
30
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
31
|
+
flex: 1;
|
|
32
|
+
display: flex;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
`),z=a().div`
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
display: flex;
|
|
37
|
+
min-height: 60px;
|
|
38
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey2};
|
|
39
|
+
`,$=a().div`
|
|
40
|
+
width: 60px;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
`,R=a().div`
|
|
45
|
+
flex: 1;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
`,F=a().div`
|
|
50
|
+
position: relative;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
top: 91px;
|
|
53
|
+
width: ${460}px;
|
|
54
|
+
`,G=a().div`
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
${e=>"left"===e.position?"left: 0px;":""}
|
|
58
|
+
${e=>"right"===e.position?"right: -1000px;":""}
|
|
59
|
+
width: ${440}px;
|
|
60
|
+
bottom: 90px;
|
|
61
|
+
display: flex;
|
|
62
|
+
background-color: ${e=>e.theme.color.white};
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
transition: all 0.4s;
|
|
65
|
+
box-shadow: -4px 0px 20px 0px #00000017;
|
|
66
|
+
|
|
67
|
+
&.animate {
|
|
68
|
+
right: 0px;
|
|
69
|
+
}
|
|
70
|
+
`,B=a().div`
|
|
71
|
+
flex: 1;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
padding: 12px;
|
|
75
|
+
overflow: auto;
|
|
76
|
+
margin-bottom: 12px;
|
|
77
|
+
position: relative;
|
|
78
|
+
`,U=a().div`
|
|
79
|
+
position: absolute;
|
|
80
|
+
inset: 0;
|
|
81
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
`,H=a().div`
|
|
86
|
+
position: absolute;
|
|
87
|
+
inset: 0;
|
|
88
|
+
background-color: ${e=>e.theme.color.white};
|
|
89
|
+
padding: ${e=>e.theme.space.md}px;
|
|
90
|
+
`,N=a().div`
|
|
91
|
+
width: ${50}px;
|
|
92
|
+
padding-top: 60px;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
border-right: 1px solid ${e=>e.theme.color.grey2};
|
|
96
|
+
`,P=a().button`
|
|
97
|
+
border-radius: 4px;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
height: 42px;
|
|
100
|
+
margin: 4px;
|
|
101
|
+
width: 42px;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
|
|
106
|
+
&:hover {
|
|
107
|
+
background-color: ${e=>e.theme.color.grey1};
|
|
108
|
+
}
|
|
109
|
+
`,V=(a().div`
|
|
110
|
+
display: flex;
|
|
111
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
112
|
+
border-radius: ${8}px;
|
|
113
|
+
margin-bottom: 24px;
|
|
114
|
+
input {
|
|
115
|
+
width: 100%;
|
|
116
|
+
border: 0;
|
|
117
|
+
height: ${50}px;
|
|
118
|
+
margin: 0;
|
|
119
|
+
}
|
|
120
|
+
`,a().div`
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: row;
|
|
123
|
+
padding: 12px;
|
|
124
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
125
|
+
border-radius: 8px;
|
|
126
|
+
margin-bottom: 4px;
|
|
127
|
+
`),Q=a().div`
|
|
128
|
+
display: flex;
|
|
129
|
+
flex: 1;
|
|
130
|
+
align-items: center;
|
|
131
|
+
`,X=a().div`
|
|
132
|
+
width: 40px;
|
|
133
|
+
display: flex;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
align-items: center;
|
|
136
|
+
`,K=(a().div`
|
|
137
|
+
flex-direction: row;
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
`,a().div`
|
|
141
|
+
flex: 1;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
`,u.j.getLazyComponent("Button")),Y=u.j.getLazyComponent("Icon"),Z=({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(z,null,l().createElement($,null),l().createElement(R,null,"Popup"),l().createElement($,null,l().createElement(P,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(Y,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(z,null,l().createElement(K,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var ee=n(939);const te=u.j.getLazyComponent("WidgetArticleTitleEditor"),ne=u.j.getLazyComponent("WidgetArticleTextEditor"),ie=u.j.getLazyComponent("WidgetArticleGalleryEditor"),le=u.j.getLazyComponent("WidgetArticleAttachmentEditor"),oe=u.j.getLazyComponent("WidgetArticleSliderEditor"),ae=u.j.getLazyComponent("WidgetArticleImageEditor"),re=u.j.getLazyComponent("WidgetButtonEditor"),se=u.j.getLazyComponent("WidgetCheckListEditor"),ce=u.j.getLazyComponent("WidgetQuickSurveyEditor"),de=u.j.getLazyComponent("WidgetDatasourceTableEditor"),ue=u.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),me=u.j.getLazyComponent("WidgetPresenceEditor"),ge=({uniqid:e})=>{var t,n,i,o,a,r;const u=(0,d.useDispatch)(),m=(0,d.useSelector)(c.x0.selectors.selectToken),g=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),p=(0,d.useSelector)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),d.shallowEqual),E=e=>{var t;return null===(t=c.qn.selectors.selectHook(ee.M.getState(),e))||void 0===t?void 0:t.isActive},f=t=>{g&&u(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),u(c.cr.slice.actions.flushEditor({uniqid:e})),p&&p(t)},h=(t,n)=>{u(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=>{u(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},v=null==g?void 0:g.widget;return v?(0,w.ensureWidgetArticleButtonType)(v)?l().createElement(re,Object.assign({},v.content,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:()=>f({})})):(0,w.ensureWidgetArticleGalleryType)(v)?l().createElement(ie,{token:m,content:v.content,onChange:t=>u((0,c.vR)(e,t,!1)),onSave:f,onStateChange:h}):(0,w.ensureWidgetArticleAttachmentType)(v)?l().createElement(le,{token:m,content:v.content,onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h,onOpen:y}):(0,w.ensureWidgetArticleImageType)(v)?l().createElement(ae,{content:v.content,token:m,onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h}):(0,w.ensureWidgetArticleSliderType)(v)?void 0!==m?l().createElement(oe,{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=>{u((0,c.vR)(e,t,!1))},token:m,onSave:f}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,w.ensureWidgetArticleTitleType)(v)?l().createElement(te,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,content:v.content,onOpen:y}):(0,w.ensureWidgetArticleTextType)(v)?l().createElement(ne,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,content:v.content}):(0,w.ensureWidgetPresenceType)(v)?l().createElement(me,Object.assign({onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h},v.content)):(0,w.ensureWidgetCheckListType)(v)?l().createElement(se,{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)=>{u((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{u(c.x0.slice.actions.updateWidgetWrapper(Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))},handleChange:t=>u((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetQuickSurveyType)(v)?l().createElement(ce,{token:m,uniqid:v.uniqid,content:v.content,onChangeContent:(e,t)=>{u((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{u(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>u((0,c.vR)(e,t,!1))}):(0,w.ensureWidgetExcelDatasourceTableType)(v)?l().createElement(ue,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(a=v.content.limit)&&void 0!==a?a:20,hook:{isActive:E},handlers:{jamespot:{datasource:k().datasource,network:k().network,filebank:k().filebank,wedoc:k().wedoc},handleStart:()=>h({busy:!0}),handleCatch:e=>u(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:f,onChange:(t,n)=>u((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>u(c.y8.actions.error({label:e}))})):(0,w.ensureWidgetDatasourceTableType)(v)?l().createElement(de,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(r=v.content.limit)&&void 0!==r?r:20,hook:{isActive:E},handlers:{jamespot:{datasource:k().datasource,network:k().network,application:k().application,filebank:k().filebank},handleStart:()=>h({busy:!0}),handleCatch:e=>u(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:f,onChange:(t,n)=>u((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>{u(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},pe=u.j.getLazyComponent("Icon"),Ee=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement($,null,l().createElement(P,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(pe,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},fe=a().div`
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: row;
|
|
147
|
+
flex-wrap: wrap;
|
|
148
|
+
gap: 10px;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
`,he=a().div`
|
|
151
|
+
border: 1px solid ${e=>e.theme.color.grey2};
|
|
152
|
+
border-radius: 8px;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
padding: 12px;
|
|
155
|
+
position: relative;
|
|
156
|
+
opacity: ${e=>e.available?"1":".4"};
|
|
157
|
+
pointer-events: ${e=>e.available?"all":"none"};
|
|
158
|
+
|
|
159
|
+
.show-on-hover {
|
|
160
|
+
position: absolute;
|
|
161
|
+
inset: 0;
|
|
162
|
+
border-radius: 8px;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
align-items: center;
|
|
165
|
+
display: flex;
|
|
166
|
+
opacity: 0;
|
|
167
|
+
background-color: #ffffffe6;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&:hover {
|
|
171
|
+
.show-on-hover {
|
|
172
|
+
opacity: 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`,ye=a().div`
|
|
176
|
+
border: 2px solid ${e=>e.theme.color.primary};
|
|
177
|
+
height: ${e=>e.open?e.height:"54"}px;
|
|
178
|
+
border-radius: 8px;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: top;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
transition: height 0.4s;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
`,ve=a().div`
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: row;
|
|
188
|
+
flex-wrap: wrap;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
gap: 10px;
|
|
191
|
+
${e=>e.column&&"flex-direction: column;"}
|
|
192
|
+
`,be=a().div`
|
|
193
|
+
min-height: 50px;
|
|
194
|
+
display: flex;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
align-items: center;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
color: ${e=>e.theme.color.primary};
|
|
199
|
+
&:hover {
|
|
200
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
201
|
+
}
|
|
202
|
+
`,xe=a().button`
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
padding: ${e=>e.parentIsColumn?"36px 16px":"0 10px"};
|
|
206
|
+
gap: 10px;
|
|
207
|
+
width: 40%;
|
|
208
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
209
|
+
border-radius: 8px;
|
|
210
|
+
transition: opacity 0.4s ease ${e=>40*e.index}ms;
|
|
211
|
+
opacity: ${e=>e.open?1:0};
|
|
212
|
+
img {
|
|
213
|
+
width: 40px;
|
|
214
|
+
}
|
|
215
|
+
${e=>e.full&&"flex: 1; width: 100%;"}
|
|
216
|
+
${e=>e.parentIsColumn&&"flex-basis: 72px;"}
|
|
217
|
+
${e=>!e.parentIsColumn&&"height: 72px;"}
|
|
218
|
+
&:hover {
|
|
219
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
${(0,s.DashedFocusBorder)()}
|
|
223
|
+
`,Ce=a().div`
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: ${e=>"row"===e.direction?"row":"column"};
|
|
226
|
+
align-items: ${e=>"row"===e.direction?"center":"flex-start"};
|
|
227
|
+
justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
|
|
228
|
+
flex: 1;
|
|
229
|
+
${e=>e.gap&&`gap:${e.gap}px`}
|
|
230
|
+
`,we=u.j.getLazyComponent("Button"),ke=u.j.getLazyComponent("ModalLayout"),qe=u.j.getLazyComponent("ModalContent"),We=u.j.getLazyComponent("Tooltip"),je=u.j.getLazyComponent("IconButton"),Se=({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(w.WidgetsName.ArticleTitle),c.x0.definition(w.WidgetsName.ArticleButton)];case"comment":return[c.x0.definition(w.WidgetsName.CheckList),c.x0.definition(w.WidgetsName.Presence),c.x0.definition(w.WidgetsName.QuickSurvey)];default:return[c.x0.definition(w.WidgetsName.ArticleTitle),c.x0.definition(w.WidgetsName.ArticleText),c.x0.definition(w.WidgetsName.ArticleImage),c.x0.definition(w.WidgetsName.ArticleButton),c.x0.definition(w.WidgetsName.ArticleSlider),c.x0.definition(w.WidgetsName.ArticleAttachment),c.x0.definition(w.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(ke,Object.assign({},m),l().createElement(qe,{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(ve,{column:!0},d.map(((e,t)=>l().createElement(xe,{key:e.name,open:!0,full:!0,parentIsColumn:!0,index:t,onClick:()=>g(e.name)},l().createElement(Ce,{direction:"row",gap:12},l().createElement("img",{src:e.img}),l().createElement(Ce,{direction:"column"},l().createElement("h3",null,u.formatMessage({id:e.label})),l().createElement("p",null,u.formatMessage({id:e.description})))))))):l().createElement(fe,null,d.map(((e,t)=>l().createElement(he,{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(we,{onClick:()=>s(!0),variant:"outlined",minWidth:"100%"},u.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e&&"edit"===t?l().createElement(fe,null,d.map(((e,t)=>l().createElement(he,{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(Le,{widgets:d,onClick:g}):l().createElement(l().Fragment,null),"comment"===e&&"edit"===t?l().createElement(Ae,{onClick:()=>{s(!0)}}):l().createElement(l().Fragment,null))},Le=({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(ye,{open:n,height:s},l().createElement(be,{onClick:()=>o(!n)},a.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(ve,null,e.map(((e,i)=>l().createElement(xe,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},l().createElement("img",{src:e.img}),a.formatMessage({id:e.label})))))))},Ae=({onClick:e})=>{const t=(0,r.useIntl)();return l().createElement(l().Fragment,null,l().createElement(We,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},l().createElement(je,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))},Me=u.j.getLazyComponent("BETA_DragAndDrop"),Te=u.j.getLazyComponent("Icon"),Ie=({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(Oe,{uniqid:e}),o?a.map(((t,r)=>{const s=c.x0.definition(t.widget.name);return l().createElement("div",{key:r},l().createElement(V,null,l().createElement(Q,{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(X,{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,w.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(Te,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},Oe=({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(Me,{onDrag:()=>{},renderEl:(e,t)=>l().createElement($e,{uniqid:e,key:t}),elms:n||[]}),l().createElement(Se,{namespace:"default",onChange:n=>{t(c.x0.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},_e=({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(Te,{name:n.locked?"icon-lock":"icon-unlock"}))},De=({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(Te,{name:n.visible?"icon-eye":"icon-eye-slash"}))},ze=({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(Te,{name:"icon-trash"}))},$e=({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(_e,{uniqid:e}),l().createElement(De,{uniqid:e}),l().createElement(ze,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))};var Re=n(655);const Fe=u.j.getLazyComponent("InputText"),Ge=({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,Re.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(Fe,{name:"text",width:"100%",control:a,placeholder:n.formatMessage({id:"WIDGET_Title"})}):l().createElement(l().Fragment,null)},Be=u.j.getLazyComponent("Loader"),Ue=({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(U,null,l().createElement(Be,{size:"l"})))},He=({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)},Ne=({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(H,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Pe=u.j.getLazyComponent("Button"),Ve=({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(Pe,{onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&k().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"}))},Je=["widget-presence","widget-quick-survey","widget-check-list"],Qe=u.j.getLazyComponent("Icon"),Xe=({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(F,null,l().createElement(G,{ref:a,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(N,null,u.panel.useWrapper?l().createElement(P,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(Qe,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(P,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(Qe,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(He,{uniqid:e},l().createElement(P,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(Qe,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(z,null,l().createElement(Ee,{uniqid:e,position:s.position}),l().createElement(R,null,n.formatMessage({id:u.label})),l().createElement($,null,l().createElement(P,{onClick:()=>{o(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Qe,{name:"icon-times",color:"grey2"})))),l().createElement(B,null,"default"===m&&u.panel.useEditor?l().createElement(ge,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(Ge,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(Ie,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(Ue,{uniqid:e}),l().createElement(Ne,{uniqid:e}),Je.includes(s.name)&&l().createElement(Ve,{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)},Ke=a().div`
|
|
231
|
+
position: absolute;
|
|
232
|
+
inset: 0;
|
|
233
|
+
pointer-events: none;
|
|
234
|
+
z-index: 1;
|
|
235
|
+
`,Ye=a().div`
|
|
236
|
+
flex: 1;
|
|
237
|
+
display: flex;
|
|
238
|
+
margintop: ${90}px;
|
|
239
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
240
|
+
`,Ze=a().div`
|
|
241
|
+
flex: 1;
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-direction: row;
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
`,et=a().div`
|
|
246
|
+
width: ${440}px;
|
|
247
|
+
pointer-events: none;
|
|
248
|
+
`,tt=()=>{const e=(0,d.useSelector)(c.cr.selectors.selectEditors,d.shallowEqual);return l().createElement(Ke,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?l().createElement(D,{isActive:!1,key:t},l().createElement(Ze,null,l().createElement(Xe,{uniqid:e.uniqid,position:e.position}),l().createElement(Ye,{isActive:void 0!==e.popup},l().createElement(Z,{uniqid:e.uniqid})),l().createElement(et,null))):l().createElement(D,{isActive:!1,key:t},l().createElement(Ze,null,l().createElement(et,null),l().createElement(Ye,{isActive:void 0!==e.popup},l().createElement(Z,{uniqid:e.uniqid})),l().createElement(Xe,{uniqid:e.uniqid,position:e.position}))))))},nt=u.j.getLazyComponent("ThemeProvider"),it=()=>{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,_.A)(),e.appendChild(t)),t})(e)),[e]);return t?(0,O.createPortal)(l().createElement(nt,null,l().createElement(tt,null)),t):null};var lt=n(876);const ot=u.j.getLazyComponent("InputFileAdvancedRaw"),at=a().div`
|
|
249
|
+
width: 0;
|
|
250
|
+
height: 0;
|
|
251
|
+
overflow: hidden;
|
|
252
|
+
`,rt=({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(at,null,l().createElement(ot,{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])))}})))},st=u.j.getLazyComponent("WidgetAttachment"),ct=u.j.getLazyComponent("WidgetEmptyInplace"),dt=u.j.getLazyComponent("FileViewer"),ut=a().div`
|
|
253
|
+
flex: 1;
|
|
254
|
+
`,mt=({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&&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((()=>{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(ut,null,"view"!==n?l().createElement(st,{files:s,onClick:()=>{},onError:g}):l().createElement(dt,{files:s,openWithOptions:f},(e=>l().createElement(st,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(rt,{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(ct,{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=u.j.getLazyComponent("WidgetButton"),pt=a().div`
|
|
255
|
+
display: flex;
|
|
256
|
+
flex: 1;
|
|
257
|
+
justify-content: center;
|
|
258
|
+
align-items: center;
|
|
259
|
+
`,Et=a().div`
|
|
260
|
+
pointer-events: ${e=>e.clickable?"all":"none"};
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
display: flex;
|
|
263
|
+
flex: 1;
|
|
264
|
+
justify-content: center;
|
|
265
|
+
align-items: center;
|
|
266
|
+
`,ft=({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(pt,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Et,{clickable:"edit"!==t},l().createElement(gt,{text:a,url:r,target:s,color:u,backgroundColor:m,buttonSize:g,borderRadius:p,variant:E})))},ht=u.j.getLazyComponent("WidgetArticleGallery"),yt=u.j.getLazyComponent("WidgetEmptyInplace"),vt=u.j.getLazyComponent("FileViewer"),bt=a().button`
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
`,xt=({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(ht,{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(vt,{files:r,openWithOptions:[]},(t=>{var n,i;return l().createElement(bt,null,l().createElement(ht,{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(rt,{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(yt,{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)},Ct=u.j.getLazyComponent("WidgetImage"),wt=u.j.getLazyComponent("FileViewer"),kt=u.j.getLazyComponent("WidgetEmptyInplace"),qt=a().div`
|
|
269
|
+
position: absolute;
|
|
270
|
+
inset: 0;
|
|
271
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
272
|
+
pointer-events: none;
|
|
273
|
+
display: flex;
|
|
274
|
+
justify-content: center;
|
|
275
|
+
align-items: center;
|
|
276
|
+
opacity: 0;
|
|
277
|
+
color: ${e=>e.theme.color.white};
|
|
278
|
+
&:hover {
|
|
279
|
+
opacity: 1;
|
|
280
|
+
}
|
|
281
|
+
`,Wt=a().button`
|
|
282
|
+
cursor: pointer;
|
|
283
|
+
`,jt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},St=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},Lt=({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,w.formatImgUrl)({timestamp:s.dateModified?St(s.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:s.uri}))}),[s]),l().createElement(l().Fragment,null,"edit"===o?void 0!==p?l().createElement(Ct,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u}):l().createElement(l().Fragment,null):l().createElement(wt,{files:[Object.assign(Object.assign({},jt),{path:p,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(Wt,{onClick:()=>e(0)},l().createElement(Ct,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u})))),n&&"edit"===o?l().createElement(rt,{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(qt,null,f.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(kt,{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 At=n(750);const Mt=u.j.getLazyComponent("FileViewer"),Tt=u.j.getLazyComponent("WidgetEmptyInplace"),It=u.j.getLazyComponent("WidgetSlider"),Ot=a().div`
|
|
284
|
+
flex: 1;
|
|
285
|
+
display: flex;
|
|
286
|
+
flex-direction: row;
|
|
287
|
+
min-height: 60px;
|
|
288
|
+
align-items: center;
|
|
289
|
+
width: ${e=>e.maxWidth}px;
|
|
290
|
+
`,_t={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},Dt=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},zt=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,a=(0,At.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({},_t),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:_t.mimetype,path:(0,w.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?Dt(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,w.formatImgUrl)({timestamp:e.file.dateModified?Dt(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(Ot,{maxWidth:u&&u<s?u:s},l().createElement(Mt,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(It,{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(Tt,{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))},$t=()=>{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}};var Rt=n(730),Ft=n(201);const Gt=u.j.getLazyComponent("InputTextareaRaw"),Bt=u.j.getLazyComponent("Modal"),Ut=({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(Bt,{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(Ft.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement(Gt,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},Ht=u.j.getLazyComponent("WidgetArticleText"),Nt=a().div`
|
|
291
|
+
width: 100%;
|
|
292
|
+
cursor: text;
|
|
293
|
+
|
|
294
|
+
p {
|
|
295
|
+
word-wrap: break-word;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
a {
|
|
299
|
+
word-wrap: break-word;
|
|
300
|
+
}
|
|
301
|
+
`,Pt=({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:b,ext:x,isActive:C}=$t(),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,Rt.X)(f,a,w)),[f,w,a]);return g?l().createElement(l().Fragment,null):l().createElement(Nt,null,l().createElement(Ht,{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:[x]}),C&&l().createElement(Ut,{onInsert:v,open:y,close:b}))},Vt=u.j.getLazyComponent("WidgetArticleTitle"),Jt=a().div`
|
|
302
|
+
flex: 1;
|
|
303
|
+
display: flex;
|
|
304
|
+
flex-direction: row;
|
|
305
|
+
align-items: center;
|
|
306
|
+
cursor: text;
|
|
307
|
+
`,Qt=a().div`
|
|
308
|
+
display: flex;
|
|
309
|
+
flex-direction: row;
|
|
310
|
+
border-radius: 8px;
|
|
311
|
+
overflow: hidden;
|
|
312
|
+
margin: 4px;
|
|
313
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
314
|
+
`,Xt=a().button`
|
|
315
|
+
display: flex;
|
|
316
|
+
width: 40px;
|
|
317
|
+
height: 40px;
|
|
318
|
+
justify-content: center;
|
|
319
|
+
align-items: center;
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
opacity: ${e=>e.isActive?"1.0":".8"};
|
|
322
|
+
background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
|
|
323
|
+
&:hover {
|
|
324
|
+
background-color: ${e=>e.theme.color.grey1};
|
|
325
|
+
}
|
|
326
|
+
`,Kt=({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(Jt,null,l().createElement(Vt,{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(Yt,{heading:s,onClick:e=>{u((0,c.vR)(o,{heading:e}))}}):l().createElement(l().Fragment,null))},Yt=({heading:e="h1",onClick:t})=>l().createElement(Qt,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(Xt,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),Zt=u.j.getLazyComponent("Button"),en=u.j.getLazyComponent("ModalLayout"),tn=u.j.getLazyComponent("ModalContent"),nn=(a().button`
|
|
327
|
+
padding: ${e=>e.theme.space.md}px;
|
|
328
|
+
`,a().div`
|
|
329
|
+
padding: ${e=>e.theme.space.md}px;
|
|
330
|
+
display: flex;
|
|
331
|
+
flex-direction: row-reverse;
|
|
332
|
+
`),ln=({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(en,{enableClickAwayCloseModal:!0,open:u,closeHandler:()=>m(!1)},l().createElement(tn,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(nn,null,l().createElement(Zt,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().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"}))))}}))))},on=a().div`
|
|
333
|
+
display: flex;
|
|
334
|
+
flex: 1;
|
|
335
|
+
flex-direction: row;
|
|
336
|
+
border-top: 1px solid ${e=>e.theme.color.grey1};
|
|
337
|
+
`,an=a().button`
|
|
338
|
+
display: flex;
|
|
339
|
+
flex: 1;
|
|
340
|
+
justify-content: center;
|
|
341
|
+
align-items: center;
|
|
342
|
+
background-color: ${e=>e.theme.color.white};
|
|
343
|
+
&:hover {
|
|
344
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
345
|
+
}
|
|
346
|
+
`,rn=({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,w.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(on,null,l().createElement(an,{onClick:null!=a?a:f},s.formatMessage({id:"WIDGET_Set_Widget"})),E&&l().createElement(ln,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},sn=a().div`
|
|
347
|
+
position: absolute;
|
|
348
|
+
inset: 0;
|
|
349
|
+
display: flex;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
align-items: center;
|
|
352
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
353
|
+
`,cn=()=>l().createElement(sn,null,l().createElement(s.JRCLoader,{size:"m"})),dn=a().div`
|
|
354
|
+
padding: ${e=>e.theme.space.md}px;
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-direction: row;
|
|
357
|
+
fieldset {
|
|
358
|
+
margin: 0.2rem !important;
|
|
359
|
+
}
|
|
360
|
+
`,un=({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,Re.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(dn,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 mn=n(586);const gn=u.j.getLazyComponent("WidgetCheckList"),pn=u.j.getLazyComponent("WidgetCheckListEditor"),En=(a().div`
|
|
361
|
+
display: flex;
|
|
362
|
+
flex-direction: row;
|
|
363
|
+
justify-content: space-between;
|
|
364
|
+
align-items: center;
|
|
365
|
+
border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
|
|
366
|
+
min-height: 24px;
|
|
367
|
+
border-radius: 4px;
|
|
368
|
+
padding: 4px 8px;
|
|
369
|
+
`,a().div`
|
|
370
|
+
width: 100%;
|
|
371
|
+
display: flex;
|
|
372
|
+
gap: 14px;
|
|
373
|
+
padding: 16px;
|
|
374
|
+
`),fn=a().div`
|
|
375
|
+
position: relative;
|
|
376
|
+
`,hn=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const u=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,d.useDispatch)(),[E,f]=(0,i.useState)(),[h,y]=(0,i.useState)(!1),v=(0,d.useSelector)(c.x0.selectors.selectToken,d.shallowEqual),b=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),d.shallowEqual),x=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),d.shallowEqual),C=(0,d.useSelector)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),d.shallowEqual),q=(0,i.useMemo)((()=>x&&x.update),[x]),W=(0,i.useMemo)((()=>x&&x.administrate),[x]),j=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:u.formatMessage({id:"GLOBAL_Error"})}))}),[p,u]),S=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),L=(0,i.useCallback)((()=>{b&&(y(!0),k().widget.getWidget({uri:b,uniqid:m}).then((e=>{(0,w.ensureWidgetCheckListType)(e.result)&&S(m,e.result.content)})).catch((e=>!e.aborted&&j)).finally((()=>y(!1))))}),[m,j,b,S]),A=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)((()=>{v||"edit"!==n||k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,v,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"})}));f(n)}),[e.content.arr,g]),(0,i.useEffect)((()=>{if(!Array.isArray(C))return;const t=C.at(-1);t&&b&&t.object.uri===b&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||L())}),[C,e.uniqid,b,j,p,L]);const M=t=>{if(!e.content.arr||!b)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});k().widget.updateWidget({uri:b,uniqid:e.uniqid,content:n,v2:!0}).then((()=>S(e.uniqid,n))).catch((e=>j(e.errorMsg)))},T=(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(En,null,l().createElement(pn,{token:v,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:S,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(mn.M,{useRT:()=>{(0,lt.AW)(e.uniqid)}},E&&l().createElement(s.JRCFileViewer,{files:T,openWithOptions:[]},(t=>l().createElement(fn,{key:e.uniqid},l().createElement(gn,{limit:10,initialEntries:E,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{b&&(h||(y(!0),k().widget.checkListRespond({uri:b,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{j(e.message),y(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(un,{handleClick:M,placeholder:u.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),W&&v&&l().createElement(rn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!q)},mode:n,handleOpenEditor:()=>{v?A(v):(y(!0),k().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result})),A(e.result)})).finally((()=>y(!1))))}}),h&&l().createElement(cn,null)))))},yn=(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},vn=u.j.getLazyComponent("Button"),bn=u.j.getLazyComponent("Html"),xn=u.j.getLazyComponent("WidgetTable"),Cn=u.j.getLazyComponent("Loader"),wn=(a().div``,a().div`
|
|
377
|
+
position: absolute;
|
|
378
|
+
inset: 0;
|
|
379
|
+
display: flex;
|
|
380
|
+
flex-direction: column;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
align-items: center;
|
|
383
|
+
gap: ${e=>e.theme.space.md}px;
|
|
384
|
+
`),kn=a().div`
|
|
385
|
+
position: absolute;
|
|
386
|
+
inset: 0;
|
|
387
|
+
display: flex;
|
|
388
|
+
flex-direction: row;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
align-items: center;
|
|
391
|
+
gap: ${e=>e.theme.space.md}px;
|
|
392
|
+
color: ${e=>e.theme.color.primary};
|
|
393
|
+
cursor: pointer;
|
|
394
|
+
opacity: 0;
|
|
395
|
+
border: 1px solid ${e=>e.theme.color.primary};
|
|
396
|
+
&:hover {
|
|
397
|
+
background-color: ${e=>e.theme.color.grey2};
|
|
398
|
+
opacity: 0.9;
|
|
399
|
+
}
|
|
400
|
+
`,qn=({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,At.jL)(),[v,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(!1),[q,W]=(0,i.useState)([]),[j,S]=(0,i.useState)([]),[L,A]=(0,i.useState)({order:"ascending",name:"unknown"}),[M,T]=(0,i.useState)(void 0),[I,O]=(0,i.useState)(""),_=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.DatasourceTable)),[]),D=(0,i.useMemo)((()=>"studio"===M?[{type:[I]}]:[]),[M,I]),z=(0,i.useMemo)((()=>"doc"===M?[I]:[]),[M,I]),{rtLastObject:$}=(0,lt.YL)(D,z),R=(0,i.useCallback)((()=>{t&&(C(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data),A(e.result.sort),T(e.result.datasource.datasourceType),O(e.result.datasource.datasourceIdentifier)})).finally((()=>C(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===j.length&&R()}),[t,m,j,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:w.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(),b(!0))}),[y,e,v,t,F,f]);const G=(0,i.useMemo)((()=>yn(m,j)),[m,j]);return 0!==m.length||x||"edit"!==f?x?l().createElement(wn,null,l().createElement(Cn,null)):l().createElement(l().Fragment,null,x||0!==q.length?l().createElement(xn,{rows:q,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(wn,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(kn,{onClick:F},l().createElement(bn,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:_.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(wn,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:_.label}),l().createElement(vn,{label:"GLOBAL_Settings"})),l().createElement(kn,{onClick:F},l().createElement(bn,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:_.label})}</b>`})))},Wn=u.j.getLazyComponent("Button"),jn=u.j.getLazyComponent("Html"),Sn=u.j.getLazyComponent("WidgetTable"),Ln=u.j.getLazyComponent("Loader"),An=(a().div``,a().div`
|
|
401
|
+
position: absolute;
|
|
402
|
+
inset: 0;
|
|
403
|
+
display: flex;
|
|
404
|
+
flex-direction: column;
|
|
405
|
+
justify-content: center;
|
|
406
|
+
align-items: center;
|
|
407
|
+
gap: ${e=>e.theme.space.md}px;
|
|
408
|
+
`),Mn=a().div`
|
|
409
|
+
position: absolute;
|
|
410
|
+
inset: 0;
|
|
411
|
+
display: flex;
|
|
412
|
+
flex-direction: row;
|
|
413
|
+
justify-content: center;
|
|
414
|
+
align-items: center;
|
|
415
|
+
gap: ${e=>e.theme.space.md}px;
|
|
416
|
+
color: ${e=>e.theme.color.primary};
|
|
417
|
+
cursor: pointer;
|
|
418
|
+
opacity: 0;
|
|
419
|
+
border: 1px solid ${e=>e.theme.color.primary};
|
|
420
|
+
&:hover {
|
|
421
|
+
background-color: ${e=>e.theme.color.grey2};
|
|
422
|
+
opacity: 0.9;
|
|
423
|
+
}
|
|
424
|
+
`,Tn=({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,At.jL)(),[v,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(!1),[q,W]=(0,i.useState)([]),[j,S]=(0,i.useState)([]),L=(0,i.useMemo)((()=>c.x0.definition(w.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===j.length&&(C(!0),k().datasource.get(t,w.Format.VIEW).then((e=>{S(e.result.model),W(e.result.data)})).finally((()=>C(!1))))}),[t,m,j]),(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:w.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(),b(!0))}),[y,e,v,t,A,f]);const M=(0,i.useMemo)((()=>yn(m,j)),[m,j]);return 0!==m.length||x||"edit"!==f?x?l().createElement(An,null,l().createElement(Ln,null)):l().createElement(l().Fragment,null,x||0!==q.length?l().createElement(Sn,{rows:q,columns:M,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:E}):l().createElement(An,null,l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(Mn,{onClick:A},l().createElement(jn,{__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(An,{onClick:A},l().createElement("img",{src:`/img/fast-intranet/${w.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:L.label}),l().createElement(Wn,{label:"GLOBAL_Settings"})),l().createElement(Mn,{onClick:A},l().createElement(jn,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:L.label})}</b>`})))},In=a().div`
|
|
425
|
+
padding: ${e=>e.theme.space.md}px;
|
|
426
|
+
`,On=a().a`
|
|
427
|
+
cursor: pointer;
|
|
428
|
+
color: ${e=>e.theme.color.secondary};
|
|
429
|
+
`,_n=a().div`
|
|
430
|
+
display: flex;
|
|
431
|
+
justify-content: center;
|
|
432
|
+
align-items: center;
|
|
433
|
+
`,Dn=({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});k().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(In,null,l().createElement(_n,null,l().createElement(On,{onClick:g},o.formatMessage({id:"WIDGET_Presence_Closing"})))))},zn=u.j.getLazyComponent("WidgetPresence"),$n=u.j.getLazyComponent("ModalUserList"),Rn=a().div`
|
|
434
|
+
display: flex;
|
|
435
|
+
flex: 1;
|
|
436
|
+
position: relative;
|
|
437
|
+
flex-direction: column;
|
|
438
|
+
`,Fn=(a().div`
|
|
439
|
+
position: absolute;
|
|
440
|
+
inset: 0;
|
|
441
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
442
|
+
display: flex;
|
|
443
|
+
flex: 1;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
align-items: center;
|
|
446
|
+
`,a().div`
|
|
447
|
+
flex: 1;
|
|
448
|
+
display: flex;
|
|
449
|
+
padding: ${e=>e.theme.space.md}px;
|
|
450
|
+
border: 1px dashed ${e=>e.theme.color.orange};
|
|
451
|
+
justify-content: center;
|
|
452
|
+
align-items: center;
|
|
453
|
+
border-radius: ${e=>e.theme.space.sm}px;
|
|
454
|
+
margin: ${e=>e.theme.space.sm}px;
|
|
455
|
+
`),Gn=({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,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(),[w,q]=(0,i.useState)(),W=(0,i.useRef)(y),j=(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)((()=>{j&&!M&&(A?(h(!0),k().widget.presenceCancel({uri:j,uniqid:g}).catch(L).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,L,j,A,M]),I=(0,i.useCallback)((e=>{j&&!M&&(h(!0),k().widget.presenceRespond({uri:j,uniqid:g,value:e},W.current.signal).catch(L).finally((()=>h(!1))))}),[j,g,L,M]),O=(0,i.useCallback)((()=>{"edit"!==t&&j&&(h(!0),k().widget.presenceGetResponse({uri:j,uniqid:g},W.current.signal).then((e=>{E(e.result)})).catch((e=>!e.aborted&&L())).finally((()=>h(!1))))}),[j,L,g,t]),_=(e,t)=>{j&&k().widget.presenceGetResponseUserList({uri:j,uniqid:g,index:e,page:t,limit:8},W.current.signal).then((e=>{q(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&L))},D=(0,i.useCallback)((()=>{j&&(h(!0),k().widget.getWidget({uri:j,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&L)).finally((()=>h(!1))))}),[o,L,j,g]);return(0,i.useEffect)((()=>{const e=W.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{O()}),[O]),(0,i.useEffect)((()=>{if(!Array.isArray(S))return;const e=S.at(-1);e&&j&&e.object.uri===j&&e.uniqid===g&&("widget-presence-response"===e.fn&&O(),"widget-update"===e.fn&&D())}),[S,O,g,j,D]),l().createElement(mn.M,{useRT:()=>{(0,lt.AW)(e.uniqid)}},l().createElement(Rn,null,l().createElement(zn,{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=>{q({limit:0,page:0,data:[],cnt:0}),C(e),_(e),b(!0)}}),u&&m&&l().createElement(Fn,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),u&&!m&&l().createElement(Dn,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(rn,{uniqid:e.uniqid,name:e.name,mode:t}),f&&l().createElement(cn,null),l().createElement($n,{open:v,usersList:w,title:1===x?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:b,onClose:()=>{q({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{_(null!=x?x:0,e)}})))},Bn=u.j.getLazyComponent("WidgetQuickSurvey"),Un=u.j.getLazyComponent("WidgetQuickSurveyEditor"),Hn=u.j.getLazyComponent("ModalUserList"),Nn=a().div`
|
|
456
|
+
width: 100%;
|
|
457
|
+
display: flex;
|
|
458
|
+
flex-direction: column;
|
|
459
|
+
gap: 14px;
|
|
460
|
+
${e=>e.withPadding&&"padding: 0 12px;"}
|
|
461
|
+
padding-top: 16px;
|
|
462
|
+
`,Pn=({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),[b,x]=(0,i.useState)(!1),[C,q]=(0,i.useState)(),[W,j]=(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),O=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),_=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}))},D=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),z=(0,i.useCallback)((e=>{"edit"!==n&&M&&(x(!0),k().widget.quickSurveyGetResponse({uri:M,uniqid:e},L.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))}),[D,M,n]),$=(0,i.useCallback)((()=>{M&&(x(!0),k().widget.getWidget({uri:M,uniqid:p},L.current.signal).then((e=>{O(p,e.result.content)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))}),[p,D,M,O]),R=()=>{if(M&&E.closing){const e=Object.assign(Object.assign({},E),{isClosed:!0});k().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{D()}))}},F=t=>{(t=>{"edit"!==n&&M&&(x(!0),k().widget.quickSurveyRespond({uri:M,index:t,multi:E.multi?1:0,uniqid:p},L.current.signal).then((()=>{z(e.uniqid)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))})(t)},G=(e,t)=>{M&&k().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},L.current.signal).then((e=>{j(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&D))},B=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{z(e.uniqid)}),[z,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&&z(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,z]);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||k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,A,g]),"edit"===n&&t?l().createElement(Nn,{withPadding:!0},l().createElement(Un,{token:A,uniqid:p,content:e.content,onChangeContent:O,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>O(p,e),inplace:t})):l().createElement(mn.M,{useRT:()=>{(0,lt.AW)(e.uniqid)}},l().createElement(Nn,null,l().createElement(s.JRCFileViewer,{files:U,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(Bn,{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=>{q(e),G(e),v(!0)}})})),E.open&&l().createElement(un,{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}]});k().widget.quickSurveyAddEnty({uri:M,uniqid:p,label:e}).then((()=>{g(c.x0.slice.actions.updateWidget({uniqid:p,content:n}))})).catch(D)},placeholder:m.formatMessage({id:"FIELDS_Add_Option"})}),B&&l().createElement(rn,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!B},mode:n,handleOpenEditor:()=>{A?_(A):(x(!0),k().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),_(e.result)})).finally((()=>x(!1))))}}),b&&l().createElement(cn,null),l().createElement(Hn,{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:()=>{j({limit:0,page:0,data:[],cnt:0})}})))},Vn=a().div`
|
|
463
|
+
padding: ${e=>e.theme.space.md}px;
|
|
464
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
465
|
+
`,Jn=({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(Vn,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},Qn=({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,Re.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"})},Xn=u.j.getLazyComponent("Button"),Kn=u.j.getLazyComponent("ModalLayout"),Yn=u.j.getLazyComponent("ModalContent"),Zn=a().div`
|
|
466
|
+
padding: ${e=>e.theme.space.md}px;
|
|
467
|
+
display: flex;
|
|
468
|
+
flex-direction: row-reverse;
|
|
469
|
+
`,ei=a().div`
|
|
470
|
+
flex: 1;
|
|
471
|
+
display: flex;
|
|
472
|
+
flex-direction: row;
|
|
473
|
+
gap: ${e=>e.theme.space.sm}px;
|
|
474
|
+
padding: ${e=>e.theme.space.sm}px;
|
|
475
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
476
|
+
`,ti=a().div`
|
|
477
|
+
flex: 1;
|
|
478
|
+
display: flex;
|
|
479
|
+
fieldset:first-of-type {
|
|
480
|
+
margin: 0px !important;
|
|
481
|
+
}
|
|
482
|
+
`,ni=a().div`
|
|
483
|
+
display: flex;
|
|
484
|
+
gap: ${e=>e.theme.space.sm}px;
|
|
485
|
+
`,ii=({uniqid:e,name:t,handleOpenEditor:n})=>{const o=(0,At.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(ei,null,l().createElement(ti,null,l().createElement(Qn,{uniqid:e})),l().createElement(ni,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(Kn,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>u(!1)},l().createElement(Yn,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Zn,null,l().createElement(Xn,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:g}))))},li=a().div`
|
|
486
|
+
display: flex;
|
|
487
|
+
flex: 1;
|
|
488
|
+
flex-direction: column;
|
|
489
|
+
`,oi=({widget:e,width:t,inplace:n=!1,mode:i="view",onWidgetUpdate:o,cannotDisplayComponent:a})=>{const{name:r}=e;return(0,w.ensureWidgetArticleButtonType)(e)?l().createElement(ft,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleGalleryType)(e)?l().createElement(xt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleAttachmentType)(e)?l().createElement(mt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleImageType)(e)?l().createElement(Lt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleSliderType)(e)?l().createElement(zt,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,w.ensureWidgetArticleTitleType)(e)?l().createElement(Kt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetArticleTextType)(e)?l().createElement(Pt,{widget:e,inplace:n,mode:i}):(0,w.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(li,null,l().createElement(Jn,{uniqid:e.uniqid}),l().createElement(Tn,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetDatasourceTableType)(e)?l().createElement(li,null,l().createElement(Jn,{uniqid:e.uniqid}),l().createElement(qn,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,w.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(li,null,"edit"===i?l().createElement(ii,{name:e.name,uniqid:e.uniqid}):l().createElement(Jn,{uniqid:e.uniqid}),l().createElement(hn,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,w.ensureWidgetPresenceType)(e)?l().createElement(li,null,"edit"===i?l().createElement(ii,{name:e.name,uniqid:e.uniqid}):l().createElement(Jn,{uniqid:e.uniqid}),l().createElement(Gn,{widget:e,inplace:n,mode:i})):(0,w.ensureWidgetQuickSurveyType)(e)?l().createElement(li,null,"edit"===i?l().createElement(ii,{name:e.name,uniqid:e.uniqid}):l().createElement(Jn,{uniqid:e.uniqid}),l().createElement(Pn,{widget:e,inplace:n,mode:i})):a?l().createElement(l().Fragment,null,a(r)):l().createElement(l().Fragment,null,"cannot display widget (",r,")")},ai=(a().div`
|
|
490
|
+
height: 0;
|
|
491
|
+
overflow: hidden;
|
|
492
|
+
`,a().div`
|
|
493
|
+
color: ${e=>e.theme.color.grey3};
|
|
494
|
+
font-style: italic;
|
|
495
|
+
`,a().div`
|
|
496
|
+
display: flex;
|
|
497
|
+
flex: 1;
|
|
498
|
+
width: 100%;
|
|
499
|
+
border: 0;
|
|
500
|
+
min-height: ${50}px;
|
|
501
|
+
margin: 0;
|
|
502
|
+
align-items: center;
|
|
503
|
+
border-radius: ${8}px;
|
|
504
|
+
padding: 8px;
|
|
505
|
+
cursor: pointer;
|
|
506
|
+
gap: 10px;
|
|
507
|
+
color: ${e=>e.color?e.color:e.theme.font.color};
|
|
508
|
+
transition: opacity 0.4s;
|
|
509
|
+
|
|
510
|
+
&:hover {
|
|
511
|
+
img {
|
|
512
|
+
filter: grayscale(0);
|
|
513
|
+
opacity: 1;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
img {
|
|
518
|
+
filter: grayscale(1);
|
|
519
|
+
opacity: 0.4;
|
|
520
|
+
}
|
|
521
|
+
`,a().div`
|
|
522
|
+
position: absolute;
|
|
523
|
+
inset: 0;
|
|
524
|
+
display: flex;
|
|
525
|
+
flex: 1;
|
|
526
|
+
justify-content: center;
|
|
527
|
+
align-items: center;
|
|
528
|
+
min-height: 200px;
|
|
529
|
+
`,a().div`
|
|
530
|
+
display: flex;
|
|
531
|
+
`),ri=a().div`
|
|
532
|
+
position: absolute;
|
|
533
|
+
inset: 0;
|
|
534
|
+
opacity: ${e=>e.opacity};
|
|
535
|
+
background-color: ${e=>e.backgroundColor};
|
|
536
|
+
pointer-events: ${e=>e.pointerEvents};
|
|
537
|
+
`,si=u.j.getLazyComponent("DoubleClick"),ci=({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(di,{uniqid:e,key:t,mode:"edit"}))))},di=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(ri,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(ui,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(ri,{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(ui,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},ui=({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(fi,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(mi,{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(si,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(fi,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},mi=({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)},gi=u.j.getLazyComponent("Loader"),pi=({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(gi,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}))},Ei=({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,lt.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 b=g.widget,x=()=>{"edit"===a?C():(0,w.ensureWidgetArticleButtonType)(b)&&"link"===b.content.openingType&&b.content.openingTypeLink&&window.open(b.content.openingTypeLink.url,b.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(ai,{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(oi,{width:r,widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,onClick:x}),l().createElement(ci,{uniqid:e,mode:a}),l().createElement(pi,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o})):l().createElement(ai,{onClick:C},l().createElement(oi,{widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,width:r,onClick:x,onWidgetUpdate:s,cannotDisplayComponent:u}),l().createElement(ci,{uniqid:e,mode:a}),l().createElement(pi,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o}))},fi=Ei,hi=a().div`
|
|
538
|
+
border-radius: ${e=>e.theme.space.sm}px;
|
|
539
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
540
|
+
background-color: ${e=>e.theme.color.white};
|
|
541
|
+
overflow: hidden;
|
|
542
|
+
`,yi=u.j.getLazyComponent("Message"),vi=({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(hi,{key:e.widget.uniqid},l().createElement(fi,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(yi,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},bi=u.j.getLazyComponent("Message"),xi=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(hi,{key:e.widget.uniqid},l().createElement(fi,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(bi,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var Ci=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 wi=u.j.getLazyComponent("JRCCommentsBloc"),ki=a().div`
|
|
543
|
+
display: flex;
|
|
544
|
+
flex-direction: column;
|
|
545
|
+
gap: 4px;
|
|
546
|
+
flex: 1;
|
|
547
|
+
width: 100%;
|
|
548
|
+
margin-top: 10px;
|
|
549
|
+
`,qi=({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,b]=(0,i.useState)([]),[x,C]=(0,i.useState)(!1),w=(0,d.useSelector)(c.xJ.selectors.get),q=(0,d.useSelector)(c.x0.selectors.selectWidgets),W=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),j=(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))),O=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),_=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),D=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,$]=(0,i.useState)(s),{open:R,onInsert:F,close:G,ext:B,isActive:U}=$t();(0,T.A)(e),((e,t)=>{const n=(0,d.useDispatch)(),l=(0,i.useMemo)((()=>I.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 H=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})}))}),[p,m]),N=()=>{p(c.Mw.actions.fetchComments({idArticle:e})),P()},P=(0,i.useCallback)((()=>{E||x||(C(!0),k().network.token().then((e=>{f(e.result),C(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{H(e.errorMsg)})))}),[H,E,x,p]),V=(0,i.useCallback)((t=>Ci(void 0,void 0,void 0,(function*(){if(E){y(!0);const n=Object.keys(q).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?q[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((()=>{b([])})),P()}catch(e){H(e.errorMsg)}finally{y(!1)}}}))),[e,a,P,H,E,q,v]);return(0,i.useEffect)((()=>{P()}),[P]),(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&&j&&l().createElement(l().Fragment,null,l().createElement(ki,null,l().createElement(wi,{canComment:n,loading:h,token:E,comments:M,onComment:V,onCommentUpdate:t=>Ci(void 0,void 0,void 0,(function*(){var n,i;const l=M.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((()=>{p(c.Mw.actions.fetchComments({idArticle:e})),P()})).catch((e=>{H(e.errorMsg)}))})),onCommentDelete:t=>Ci(void 0,void 0,void 0,(function*(){p(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!!((null==D?void 0:D.isActive)&&(null==D?void 0:D.create)&&(null===(u=null==D?void 0:D.autorize)||void 0===u?void 0:u.includes("comment"))),widgetListComponent:l().createElement(Se,{mode:"comment",namespace:"comment",onChange:e=>{b([e]),p(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),f(void 0),P()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(vi,{widgets:v}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(xi,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:N,handleWidgetRemove:P}),currentUser:w,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},W),{toolbar:j.commentsToolbar}),mentionsQueries:(0,Rt.X)(S,g,H)},onError:H,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:[..._&&O?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==O?void 0:O.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=>{$(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{$(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[B]}),l().createElement(it,null))),U&&l().createElement(Ut,{onInsert:F,open:R,close:G}))};var Wi=n(749),ji=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 Si=o.css`
|
|
550
|
+
height: 100%;
|
|
551
|
+
display: flex;
|
|
552
|
+
flex-direction: column;
|
|
553
|
+
justify-content: space-between;
|
|
554
|
+
`,Li=a().div`
|
|
555
|
+
${({stretch:e})=>e&&Si}
|
|
556
|
+
`,Ai=a().form`
|
|
557
|
+
${({stretch:e})=>e&&Si}
|
|
558
|
+
`,Mi=i.forwardRef(((e,t)=>e.onSubmit?i.createElement(Ai,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):i.createElement(Li,{stretch:e.stretch,ref:t},e.children))),Ti=a().div`
|
|
559
|
+
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
560
|
+
`,Ii=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,o]=(0,Wi.SC)(e.fields,e.type,e.forceMandatory),a=(0,Re.useForm)({defaultValues:Object.assign(Object.assign({},o),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:s,reset:c}=a,d=ji(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(Mi,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:n},i.createElement(Ti,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=ji(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)})),Oi=()=>i.createElement(i.Fragment,null);var _i=n(286);const Di=()=>{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}},zi=u.j.getLazyComponent("InputTinyMCE"),$i=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}=Di(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=$t(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),b=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),x=(0,i.useMemo)((()=>(0,Rt.X)(s,a,b)),[s,b,a]),C=(0,i.useMemo)((()=>_i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(zi,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:x},e)),g&&l().createElement(M,{query:u}),y&&l().createElement(Ut,{onInsert:E,open:p,close:f}))},Ri=u.j.getLazyComponent("InputTinyMCERaw"),Fi=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}=Di(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=$t(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),b=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),x=(0,i.useMemo)((()=>(0,Rt.X)(s,a,b)),[s,b,a]),C=(0,i.useMemo)((()=>_i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(Ri,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:x},e)),g&&l().createElement(M,{query:u}),y&&l().createElement(Ut,{onInsert:E,open:p,close:f}))},Gi=u.j.getLazyComponent("InputAudience"),Bi=u.j.getLazyComponent("Message"),Ui=u.j.getLazyComponent("Modal"),Hi=({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(Ui,{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(Bi,{variant:"warning",message:null!=o?o:u.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Gi,{asyncPromise:e=>k().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 Ni=n(737);const Pi=u.j.getLazyComponent("Container"),Vi=u.j.getLazyComponent("AppColumn"),Ji=u.j.getLazyComponent("MainColumn");function Qi({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,r.useIntl)(),{pathname:s}=(0,Ni.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,Ni.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(Pi,{mode:l},i.createElement(Vi,{mode:l,description:n,tabs:m,activeTab:d||""}),i.createElement(Ji,{mode:l,flex:!0},i.createElement(Ni.Outlet,null))))}}}]);
|
|
561
|
+
//# sourceMappingURL=724.4aadbecc6e0740c58434.chunk.js.map
|