@strapi/admin 4.10.1 → 4.10.2-alpha.0
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/admin/src/components/AuthenticatedApp/index.js +19 -24
- package/admin/src/components/DragLayer/DragLayer.js +53 -0
- package/admin/src/components/DragLayer/index.js +1 -0
- package/admin/src/components/LeftMenu/index.js +2 -2
- package/admin/src/components/Providers/index.js +11 -7
- package/admin/src/content-manager/contexts/index.js +0 -1
- package/admin/src/content-manager/hooks/index.js +0 -1
- package/admin/src/content-manager/hooks/useLazyComponents/index.js +7 -3
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +1 -3
- package/admin/src/content-manager/pages/{ListSettingsView/components/CardPreview.js → App/components/CardDragPreview.js} +28 -28
- package/admin/src/content-manager/pages/App/components/ComponentDragPreview.js +75 -0
- package/admin/src/content-manager/{components/DragLayer → pages/App/components}/RelationDragPreview.js +7 -4
- package/admin/src/content-manager/pages/App/index.js +39 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFieldButton.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/DynamicZoneList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +1 -1
- package/admin/src/content-manager/{components → pages/EditSettingsView/components}/LayoutDndProvider/index.js +3 -4
- package/admin/src/content-manager/pages/EditSettingsView/components/LinkToCTB.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/RowItemsLayout.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/hooks/useLayoutDnd.js +6 -0
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +6 -6
- package/admin/src/hooks/useMenu/index.js +2 -2
- package/admin/src/hooks/useReleaseNotification/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/pages/Admin/Onboarding/index.js +2 -2
- package/admin/src/pages/App/index.js +2 -2
- package/admin/src/pages/HomePage/SocialLinks.js +2 -2
- package/admin/src/pages/MarketplacePage/index.js +2 -2
- package/admin/src/pages/ProfilePage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/updateValues.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -2
- package/admin/src/translations/fr.json +1 -1
- package/build/{5563.905daa13.chunk.js → 5563.986609ed.chunk.js} +2 -2
- package/build/{7259.b7d00cea.chunk.js → 7259.7a48aa2f.chunk.js} +1 -1
- package/build/7725.f717acdd.chunk.js +213 -0
- package/build/Admin-authenticatedApp.2fab70e4.chunk.js +79 -0
- package/build/{Admin_InternalErrorPage.15c6bf07.chunk.js → Admin_InternalErrorPage.96ceaae1.chunk.js} +1 -1
- package/build/{Admin_homePage.f9309c6d.chunk.js → Admin_homePage.9f7c0bb1.chunk.js} +5 -5
- package/build/{Admin_marketplace.56bc1008.chunk.js → Admin_marketplace.a60cde15.chunk.js} +5 -5
- package/build/{Admin_pluginsPage.f6b52ee9.chunk.js → Admin_pluginsPage.9e6fa51c.chunk.js} +1 -1
- package/build/{Admin_profilePage.9112cffc.chunk.js → Admin_profilePage.1b337b73.chunk.js} +2 -2
- package/build/{Admin_settingsPage.4604a16c.chunk.js → Admin_settingsPage.56e9641c.chunk.js} +2 -2
- package/build/{Upload_ConfigureTheView.eaaec495.chunk.js → Upload_ConfigureTheView.4fc648b5.chunk.js} +1 -1
- package/build/admin-app.9bfe4ec7.chunk.js +63 -0
- package/build/{admin-edit-roles-page.8a4063f7.chunk.js → admin-edit-roles-page.d0c9497b.chunk.js} +24 -24
- package/build/{admin-edit-users.7e14d85f.chunk.js → admin-edit-users.ba27c532.chunk.js} +2 -2
- package/build/{admin-roles-list.329c1f63.chunk.js → admin-roles-list.c759daa3.chunk.js} +1 -1
- package/build/{admin-users.d02de059.chunk.js → admin-users.ad5dd832.chunk.js} +2 -2
- package/build/{api-tokens-create-page.97595e12.chunk.js → api-tokens-create-page.973d2816.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.cd36e30e.chunk.js → api-tokens-edit-page.29725c5e.chunk.js} +1 -1
- package/build/{api-tokens-list-page.6757c7b9.chunk.js → api-tokens-list-page.66c4fbdd.chunk.js} +2 -2
- package/build/{audit-logs-settings-page.19d90bda.chunk.js → audit-logs-settings-page.45cb4fb5.chunk.js} +1 -1
- package/build/content-manager.a0ff6cad.chunk.js +1111 -0
- package/build/{content-type-builder-list-view.9c2c020c.chunk.js → content-type-builder-list-view.5ff685ec.chunk.js} +1 -1
- package/build/{content-type-builder.68af11d2.chunk.js → content-type-builder.4737a30c.chunk.js} +3 -3
- package/build/{email-settings-page.1095e1ab.chunk.js → email-settings-page.dc07d518.chunk.js} +1 -1
- package/build/{fr-json.5947cf63.chunk.js → fr-json.73494bf5.chunk.js} +1 -1
- package/build/{i18n-settings-page.d95b32df.chunk.js → i18n-settings-page.8219dd99.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.964e7203.js +2597 -0
- package/build/{review-workflows-settings.f7890c40.chunk.js → review-workflows-settings.089d7ec5.chunk.js} +1 -1
- package/build/{runtime~main.d4c8d6a2.js → runtime~main.c9593d59.js} +1 -1
- package/build/{sso-settings-page.1dd4886e.chunk.js → sso-settings-page.f44d95d8.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.ec2ca215.chunk.js → transfer-tokens-create-page.170acee6.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.22bf28e5.chunk.js → transfer-tokens-edit-page.6cf23295.chunk.js} +1 -1
- package/build/{transfer-tokens-list-page.cf8c77f2.chunk.js → transfer-tokens-list-page.c3fec4c1.chunk.js} +2 -2
- package/build/{upload-settings.945fdcfa.chunk.js → upload-settings.dd2d987c.chunk.js} +1 -1
- package/build/{upload.a86b1054.chunk.js → upload.c8479232.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.5b5a9baa.chunk.js → users-advanced-settings-page.c36cfd59.chunk.js} +1 -1
- package/build/{users-email-settings-page.e5506eb4.chunk.js → users-email-settings-page.2716ce8e.chunk.js} +5 -5
- package/build/{users-providers-settings-page.e32089c2.chunk.js → users-providers-settings-page.0d6304a5.chunk.js} +1 -1
- package/build/{users-roles-settings-page.20656f92.chunk.js → users-roles-settings-page.eeb3a339.chunk.js} +1 -1
- package/build/{webhook-edit-page.a3b62049.chunk.js → webhook-edit-page.f4db86f3.chunk.js} +2 -2
- package/build/{webhook-list-page.ca38eeef.chunk.js → webhook-list-page.30d73114.chunk.js} +1 -1
- package/ee/server/services/review-workflows/review-workflows.js +1 -1
- package/ee/server/utils/persisted-tables.js +3 -0
- package/jest.config.front.js +1 -0
- package/package.json +9 -9
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +0 -95
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Overlay.js +0 -42
- package/admin/src/components/AutoReloadOverlayBlockerProvider/index.js +0 -99
- package/admin/src/components/Notifications/Notification/index.js +0 -159
- package/admin/src/components/Notifications/index.js +0 -46
- package/admin/src/components/Notifications/reducer.js +0 -47
- package/admin/src/components/OverlayBlocker/index.js +0 -67
- package/admin/src/content-manager/components/DragLayer/ComponentDragPreview.js +0 -83
- package/admin/src/content-manager/components/DragLayer/index.js +0 -85
- package/admin/src/content-manager/contexts/LayoutDnd.js +0 -5
- package/admin/src/content-manager/hooks/useCallbackRef.js +0 -23
- package/admin/src/content-manager/hooks/useLayoutDnd.js +0 -6
- package/admin/src/content-manager/pages/ListSettingsView/utils/ellipsisCardTitle.js +0 -7
- package/build/8694.6522968d.chunk.js +0 -247
- package/build/Admin-authenticatedApp.5562aedc.chunk.js +0 -79
- package/build/admin-app.014adc27.chunk.js +0 -110
- package/build/content-manager.84f81966.chunk.js +0 -1130
- package/build/main.841e0dcb.js +0 -2280
|
@@ -1,1130 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{42814:function(et,Re){"use strict";Re.Z=()=>null},25970:function(et,Re,d){"use strict";d.r(Re),d.d(Re,{App:function(){return ta},default:function(){return Km}});var e=d(32735),Me=d(74758),J=d(53038),y=d(43383),Ie=d(27649),ye=d(82055),Ze=d(96709),Q=d(67879),ze=d(98978),xe=d.n(ze),Oe=d(83983),pe=d(47510),Te=d(74506),De=d(60216),n=d.n(De),vt=(0,e.createContext)();function st({attributes:t,buttonData:o,children:r,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:p,relationsLayout:u,removeField:m,selectedItemName:f,setEditFieldToSelect:g,...E}){return e.createElement(vt.Provider,{value:{attributes:t,buttonData:o,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:p,relationsLayout:u,removeField:m,selectedItemName:f,setEditFieldToSelect:g,...E}},r)}st.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},st.propTypes={attributes:n().object,buttonData:n().array,children:n().node.isRequired,goTo:n().func,layout:n().array,metadatas:n().object,moveItem:n().func,moveRow:n().func,onAddData:n().func,relationsLayout:n().array,removeField:n().func,selectedItemName:n().string,setEditFieldToSelect:n().func};var ut=st,Be=d(25708),S=d(8471),w=d(87933),H=d(49372),de=d(47081),Ne=d(68625),He=d(35331),mt=t=>t.length>20?`${t.substring(0,20)}...`:t;const Qe=(0,S.ZP)(w.k)`
|
|
2
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
3
|
-
|
|
4
|
-
&:last-child {
|
|
5
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
6
|
-
}
|
|
7
|
-
`,at=(0,S.ZP)(Qe)`
|
|
8
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
9
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
10
|
-
cursor: all-scroll;
|
|
11
|
-
|
|
12
|
-
svg {
|
|
13
|
-
width: ${12/16}rem;
|
|
14
|
-
height: ${12/16}rem;
|
|
15
|
-
}
|
|
16
|
-
`,pt=(0,S.ZP)(w.k)`
|
|
17
|
-
display: inline-flex;
|
|
18
|
-
max-height: ${32/16}rem;
|
|
19
|
-
opacity: ${({transparent:t})=>t?0:1};
|
|
20
|
-
background-color: ${({theme:t,isSibling:o})=>o?t.colors.neutral100:t.colors.primary100};
|
|
21
|
-
border: 1px solid
|
|
22
|
-
${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
|
|
23
|
-
|
|
24
|
-
svg {
|
|
25
|
-
width: ${10/16}rem;
|
|
26
|
-
height: ${10/16}rem;
|
|
27
|
-
|
|
28
|
-
path {
|
|
29
|
-
fill: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
${H.Z} {
|
|
34
|
-
color: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
${at} {
|
|
38
|
-
border-right: 1px solid
|
|
39
|
-
${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
|
|
40
|
-
}
|
|
41
|
-
`,tt=({labelField:t,transparent:o,isSibling:r})=>{const s=mt(t);return e.createElement(pt,{hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r},e.createElement(w.k,{gap:3},e.createElement(at,{alignItems:"center"},e.createElement(de.Z,null)),e.createElement(H.Z,{fontWeight:"bold"},s)),e.createElement(w.k,{paddingLeft:3},e.createElement(Qe,{alignItems:"center"},e.createElement(Ne.Z,null)),e.createElement(Qe,{alignItems:"center"},e.createElement(He.Z,null))))};tt.defaultProps={isSibling:!1,transparent:!1},tt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};var it=tt,P=d(72850),be=d(50563),qe=d(16899),Se=d(4038);const Ct=(0,S.ZP)(P.x)`
|
|
42
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
43
|
-
`,ne=(0,S.ZP)(P.x)`
|
|
44
|
-
height: ${32/16}rem;
|
|
45
|
-
width: ${32/16}rem;
|
|
46
|
-
border-radius: 50%;
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
|
|
51
|
-
svg {
|
|
52
|
-
height: ${6/16}rem;
|
|
53
|
-
width: ${11/16}rem;
|
|
54
|
-
> path {
|
|
55
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`,le=S.ZP.button`
|
|
59
|
-
border: none;
|
|
60
|
-
background: transparent;
|
|
61
|
-
display: block;
|
|
62
|
-
width: 100%;
|
|
63
|
-
text-align: unset;
|
|
64
|
-
padding: 0;
|
|
65
|
-
`,ue=({displayedValue:t})=>e.createElement(Ct,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,y.Q1)(300)},e.createElement(w.k,{justifyContent:"space-between"},e.createElement(le,{type:"button"},e.createElement(w.k,null,e.createElement(ne,{background:"neutral200"},e.createElement(qe.Z,null)),e.createElement(w.k,{gap:2,paddingLeft:6,maxWidth:(0,y.Q1)(150)},e.createElement(H.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(P.x,{paddingLeft:3},e.createElement(w.k,null,e.createElement(be.h,{noBorder:!0},e.createElement(Se.Z,null)),e.createElement(P.x,{paddingLeft:2},e.createElement(be.h,{noBorder:!0},e.createElement(de.Z,null)))))));ue.propTypes={displayedValue:n().string.isRequired};var he=ue,Pe=d(41234),je=d(99140),h=d(95952);const ge={DRAFT:"draft",PUBLISHED:"published"},ke=5,Fe=10;var Ge=d(51968);const qt=(t,o,{onCancel:r,onDropItem:s,onGrabItem:a,onMoveItem:l})=>{const[i,c]=(0,e.useState)(!1),p=g=>{i&&(g==="UP"?l(o-1,o):g==="DOWN"&&l(o+1,o))},u=()=>{i?(s&&s(o),c(!1)):(a&&a(o),c(!0))},m=()=>{i&&(c(!1),r&&r(o))};return g=>{if(t&&!(g.key==="Tab"&&!i))switch(g.preventDefault(),g.key){case" ":case"Enter":u();break;case"Escape":m();break;case"ArrowDown":case"ArrowRight":p("DOWN");break;case"ArrowUp":case"ArrowLeft":p("UP");break;default:}}},Ke=(t,{type:o="STRAPI_DND",index:r,item:s={},onStart:a,onEnd:l,onGrabItem:i,onDropItem:c,onCancel:p,onMoveItem:u,dropSensitivity:m="regular"})=>{const f=(0,e.useRef)(null),[{handlerId:g},E]=(0,Te.useDrop)({accept:o,collect(M){return{handlerId:M.getHandlerId()}},hover(M,F){if(!f.current)return;const D=M.index,C=r;if(D!==C){if(m==="regular"){const T=f.current.getBoundingClientRect(),x=(T.bottom-T.top)/2,W=F.getClientOffset().y-T.top;if(D<C&&W<x||D>C&&W>x)return}u(C,D),M.index=C}}}),[{isDragging:b},v,k]=(0,Te.useDrag)({type:o,item(){a&&a();const{width:M}=f.current?.getBoundingClientRect()??{};return{index:r,width:M,...s}},end(){l&&l()},canDrag:t,isDragging:s.id?M=>s.id===M.getItem().id:void 0,collect:M=>({isDragging:M.isDragging()})}),I=qt(t,r,{onGrabItem:i,onDropItem:c,onCancel:p,onMoveItem:u});return[{handlerId:g,isDragging:b,handleKeyDown:I},f,E,v,k]},lt=50,Ot=4,Uo=(0,S.ZP)(w.k)`
|
|
66
|
-
width: 100%;
|
|
67
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
68
|
-
min-width: 0;
|
|
69
|
-
|
|
70
|
-
& > div[role='button'] {
|
|
71
|
-
cursor: all-scroll;
|
|
72
|
-
}
|
|
73
|
-
`,Vo=(0,S.ZP)(w.k)`
|
|
74
|
-
width: 100%;
|
|
75
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
76
|
-
min-width: 0;
|
|
77
|
-
`,bn=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:s,disabled:a,endAction:l,iconButtonAriaLabel:i,style:c,id:p,index:u,name:m,onCancel:f,onDropItem:g,onGrabItem:E,status:b,updatePositionOfRelation:v,...k})=>{const[{handlerId:I,isDragging:M,handleKeyDown:F},D,C,T,x]=Ke(s&&!a,{type:`${h._Q.RELATION}_${m}`,index:u,item:{displayedValue:r,status:b,id:p},onGrabItem:E,onDropItem:g,onCancel:f,onMoveItem:v,dropSensitivity:"immediate"}),Z=(0,h.FE)(D,T);return(0,e.useEffect)(()=>{x((0,Ge.rX)())},[x]),e.createElement(P.x,{style:c,as:"li",ref:C,"aria-describedby":t,cursor:s?"all-scroll":"default"},M?e.createElement(na,null):e.createElement(w.k,{paddingTop:2,paddingBottom:2,paddingLeft:s?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:a?"neutral150":"neutral0",justifyContent:"space-between",ref:s?Z:void 0,"data-handler-id":I,...k},e.createElement(Uo,{gap:1},s?e.createElement(be.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:F,disabled:a},e.createElement(de.Z,null)):null,e.createElement(Vo,{justifyContent:"space-between"},o)),l&&e.createElement(P.x,{paddingLeft:4},l)))},na=()=>e.createElement(P.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${Ot}px)`});bn.defaultProps={ariaDescribedBy:"",canDrag:!1,displayValue:"",disabled:!1,endAction:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,style:void 0,status:void 0,updatePositionOfRelation:void 0},bn.propTypes={ariaDescribedBy:n().string,canDrag:n().bool,children:n().node.isRequired,displayValue:n().string,disabled:n().bool,endAction:n().node,iconButtonAriaLabel:n().string.isRequired,id:n().number.isRequired,index:n().number.isRequired,name:n().string.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,status:n().string,style:n().shape({height:n().number,left:n().number,position:n().string,right:n().number,width:n().string}),updatePositionOfRelation:n().func};var oa=d(41044),ra=d(50428),sa=d(87107),aa=d(28847),Ho=d(7563),Lt=d(3685),ia=d(67014),la=d(47851),en=d(63919),Qo=d(44647);const En=({children:t,loadMore:o,search:r,totalNumberOfRelations:s,size:a,...l})=>e.createElement(e.Fragment,null,e.createElement(w.k,{paddingBottom:s>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(w.k,{direction:"column",alignItems:"stretch",basis:a<=6?"100%":"70%",gap:1,...l},r),o),t);En.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},En.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};const ca=(0,S.ZP)(P.x)`
|
|
78
|
-
position: relative;
|
|
79
|
-
overflow-x: hidden;
|
|
80
|
-
overflow-y: auto;
|
|
81
|
-
|
|
82
|
-
&:before,
|
|
83
|
-
&:after {
|
|
84
|
-
position: absolute;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 4px;
|
|
87
|
-
z-index: 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&:before {
|
|
91
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
92
|
-
content: '';
|
|
93
|
-
background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
94
|
-
top: 0;
|
|
95
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="top"?1:0};
|
|
96
|
-
transition: opacity 0.2s ease-in-out;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:after {
|
|
100
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
101
|
-
content: '';
|
|
102
|
-
background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
103
|
-
bottom: 0;
|
|
104
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
|
|
105
|
-
transition: opacity 0.2s ease-in-out;
|
|
106
|
-
}
|
|
107
|
-
`,vn=({children:t,overflow:o,...r})=>e.createElement(ca,{overflowDirection:o,...r},t);vn.defaultProps={overflow:""},vn.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};var da=d(88994);const ua=S.ZP.div`
|
|
108
|
-
flex-shrink: 0;
|
|
109
|
-
width: ${(0,y.Q1)(6)};
|
|
110
|
-
height: ${(0,y.Q1)(6)};
|
|
111
|
-
margin-right: ${({theme:t})=>t.spaces[2]};
|
|
112
|
-
background-color: ${({theme:t,isDraft:o})=>t.colors[o?"secondary600":"success600"]};
|
|
113
|
-
border-radius: 50%;
|
|
114
|
-
`,Go=t=>{const{formatMessage:o}=(0,Q.Z)(),r=da.c.Option,{publicationState:s,mainField:a,id:l}=t.data;if(s){const i=s==="draft",c={id:(0,h.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},p={id:(0,h.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=o(i?c:p);return e.createElement(r,{...t},e.createElement(w.k,null,e.createElement(ua,{title:u,isDraft:i}),e.createElement(H.Z,{ellipsis:!0},a??l)))}return e.createElement(r,{...t},a??l)};Go.propTypes={isFocused:n().bool.isRequired,data:n().shape({id:n().number.isRequired,isDraft:n().bool,mainField:n().string,publicationState:n().oneOfType([n().string,n().bool])}).isRequired};var me=d(15062),Ko=t=>t["content-manager_editViewLayoutManager"].currentLayout,gt=()=>{const t=(0,me.v9)(Ko),o=(0,e.useCallback)(r=>t?.components?.[r]??{},[t]);return{...t,getComponentLayout:o}},Ue=d(84306),ma=d(99381),nt=d.n(ma),pa=d(33795),L=d.n(pa),ga=d(3040),_=d.n(ga);const Yo=(t,o)=>o.find(r=>r.uid===t),fa=(t,o)=>{const r=ha(t,o),s=Xo(r.contentType,o),a=ya(r.contentType,r.components);return _()(r,["contentType","layouts","edit"],s),_()(r,["contentType","layouts","list"],a),Object.keys(r.components).forEach(l=>{const i=Xo(r.components[l],o);_()(r,["components",l,"layouts","edit"],i)}),r},ha=(t,o)=>{const r=(0,h.w8)(nt()(t),o,"contentType"),{components:s,contentType:a}=r,l=i=>Object.keys(i.metadatas).reduce((c,p)=>{const u=L()(i,["attributes",p],{});let m=i.metadatas[p];if(u.type==="relation"){const f=Yo(u.targetModel,o),g=m.edit.mainField,E={name:g,schema:L()(f,["attributes",g])};m={list:{...m.list,mainField:E},edit:{...m.edit,mainField:E}}}return c[p]=m,c},{});return _()(r,["contentType","metadatas"],l(a)),Object.keys(s).forEach(i=>{const c=s[i],p=l(c);_()(r,["components",i,"metadatas"],p)}),r},Xo=(t,o)=>t.layouts.edit.reduce((r,s)=>{const a=s.map(l=>{const i=L()(t,["attributes",l.name],{}),c={...l,fieldSchema:i,metadatas:L()(t,["metadatas",l.name,"edit"],{})};if(i.type==="relation"){const u=Yo(i.targetModel,o).pluginOptions||{};_()(c,"targetModelPluginOptions",u),_()(c,"queryInfos",{shouldDisplayRelationLink:ba(t,l.name,o)})}return c});return r.push(a),r},[]),ya=(t,o)=>t.layouts.list.reduce((s,a)=>{const l=L()(t,["attributes",a],{}),i=L()(t,["metadatas",a,"list"],{}),c=l.type;if(c==="relation")return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),s;if(c==="component"){const p=o[l.component],u=p.settings.mainField,m=p.attributes[u];return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:{...i,mainField:{...m,name:u}}}),s}return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),s},[]),ba=(t,o,r)=>{const s=L()(t,["attributes",o,"targetModel"],"");return Ea(r).includes(s)},Ea=t=>t.filter(o=>o.isDisplayed).map(({uid:o})=>o);var Jo=fa,tn=d(97889);const va={error:null,isLoading:!0,layout:{},layouts:{}};var Ca=(t,o)=>(0,tn.ZP)(t,r=>{switch(o.type){case"GET_DATA":{r.isLoading=!0,r.error=null,r.layout={};break}case"GET_DATA_SUCCEEDED":{const s=o.data.contentType.uid;r.layout=o.data,r.layouts[s]=o.data,r.isLoading=!1;break}case"GET_DATA_ERROR":{r.isLoading=!1,r.error=o.error;break}case"SET_LAYOUT_FROM_STATE":{r.error=null,r.layout=t.layouts[o.uid];break}case"UPDATE_LAYOUT":{const s=t.layout;r.layout={...s,contentType:{uid:s.contentType.uid,...o.newLayout.contentType}},r.layouts[s.contentType.uid]={...s,contentType:{uid:s.contentType.uid,...o.newLayout.contentType}};break}default:return r}}),wt=d(98178),Ra=d(34947);const xt=()=>t=>t["content-manager_app"]||Ra.E,lp=()=>createSelector(xt(),t=>t),cp=()=>createSelector(xt(),t=>t.models),Ta=()=>(0,wt.P1)(xt(),t=>({collectionTypeLinks:t.collectionTypeLinks,singleTypeLinks:t.singleTypeLinks})),Cn=()=>(0,wt.P1)(xt(),({components:t,models:o})=>({schemas:[...t,...o]})),_o=(0,wt.P1)(xt(),t=>t.fieldSizes);var dp=null,er=t=>{const[{error:o,isLoading:r,layout:s,layouts:a},l]=(0,e.useReducer)(Ca,va),i=(0,e.useMemo)(Cn,[]),{schemas:c}=(0,me.v9)(g=>i(g),me.wU),p=(0,e.useRef)(!0),{get:u}=(0,y.kY)(),m=(0,e.useCallback)(async(g,E)=>{if(a[g]){l({type:"SET_LAYOUT_FROM_STATE",uid:g});return}l({type:"GET_DATA"});try{const b=(0,h.IF)(`content-types/${g}/configuration`),{data:{data:v}}=await u(b,{cancelToken:E.token});l({type:"GET_DATA_SUCCEEDED",data:Jo(v,c)})}catch(b){if(Ue.Z.isCancel(b))return;p.current&&console.error(b),p.current&&l({type:"GET_DATA_ERROR",error:b})}},[a,c,u]);(0,e.useEffect)(()=>()=>{p.current=!1},[]),(0,e.useEffect)(()=>{const E=Ue.Z.CancelToken.source();return m(t,E),()=>{E.cancel("Operation canceled by the user.")}},[t,m]);const f=(0,e.useCallback)(g=>{l({type:"UPDATE_LAYOUT",newLayout:Jo(g,c)})},[c]);return{error:o,isLoading:r,layout:s,updateLayout:f}},Ma=t=>t["content-manager_app"].collectionTypeLinks,ct=d(33348),Da=d(85973),tr=d.n(Da);const nr=(t,o)=>Object.keys(t).reduce((r,s)=>{const a=t[s],l=L()(o,[s],a);return tr()(a)?{...r,[s]:nr(a,l)}:(r[s]=l,r)},{});var ka=(t,o,r)=>{const s=t.find(({to:m})=>m.includes(o));if(!s)return"/";const{to:a,search:l}=s,i=(0,ct.parse)(l),c=(0,ct.parse)(r.substring(1)),p=nr(i,c);return`${a}?${(0,ct.stringify)(p,{encode:!1})}`},or=t=>{const[{rawQuery:o}]=(0,y.Kx)(),r=(0,me.v9)(Ma);return ka(r,t,o)},Rt=()=>(0,e.useContext)(vt),rr=()=>{const{search:t}=(0,J.TH)(),o=t?(0,ct.parse)(t.substring(1)):{};return o.plugins?(0,ct.stringify)({plugins:o.plugins},{encode:!1}):""},sr=d(89334);const Ia=(t,o,r)=>({type:sr.m,permissions:t,__meta__:{plugins:o,containerName:r}}),Oa=()=>({type:sr.Q}),La=t=>t["content-manager_rbacManager"].permissions,wa=t=>t.rbacProvider.collectionTypesRelatedPermissions;var ar=(t,o,r="listView")=>{const s=(0,me.v9)(wa),a=(0,me.v9)(La),l=(0,me.I0)(),i=s[o];return(0,e.useEffect)(()=>i?(l(Ia(i,t?t.plugins:null,r)),()=>{l(Oa())}):()=>{},[i,l,t,r]),a};const bp=(0,e.createContext)();var Ep=null;const vp=()=>useContext(WysiwygContext);var Cp=null;const ir=t=>{const o=(0,e.useRef)();return(0,e.useEffect)(()=>{o.current=t},[t]),o.current},lr=(0,S.ZP)(ra.r)`
|
|
115
|
-
display: block;
|
|
116
|
-
|
|
117
|
-
> span {
|
|
118
|
-
white-space: nowrap;
|
|
119
|
-
overflow: hidden;
|
|
120
|
-
text-overflow: ellipsis;
|
|
121
|
-
display: block;
|
|
122
|
-
}
|
|
123
|
-
`,cr=S.ZP.button`
|
|
124
|
-
svg path {
|
|
125
|
-
fill: ${({theme:t,disabled:o})=>o?t.colors.neutral600:t.colors.neutral500};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&:hover svg path,
|
|
129
|
-
&:focus svg path {
|
|
130
|
-
fill: ${({theme:t,disabled:o})=>!o&&t.colors.neutral600};
|
|
131
|
-
}
|
|
132
|
-
`,Rn=({canReorder:t,description:o,disabled:r,error:s,iconButtonAriaLabel:a,id:l,name:i,numberOfRelationsToDisplay:c,label:p,labelAction:u,labelLoadMore:m,labelDisconnectRelation:f,listAriaDescription:g,liveText:E,loadingMessage:b,onCancel:v,onDropItem:k,onGrabItem:I,noRelationsMessage:M,onRelationConnect:F,onRelationLoadMore:D,onRelationDisconnect:C,onRelationReorder:T,onSearchNextPage:x,onSearch:Z,placeholder:W,publicationStateTranslations:N,required:G,relations:$,searchResults:Y,size:j})=>{const[X,q]=(0,e.useState)(null),[z,R]=(0,e.useState)(""),B=(0,e.useRef)(),V=(0,e.useRef)(),{data:K}=Y,O=$.data,A=O.length??0,oe=(0,e.useMemo)(()=>A>c?Math.min(A,c)*(lt+Ot)+lt/2:Math.min(A,c)*(lt+Ot),[A,c]),ee=!!m&&$.hasNextPage,ae=(0,e.useMemo)(()=>K.flat().filter(Boolean).map(re=>({...re,value:re.id,label:re.mainField})),[K]);(0,e.useEffect)(()=>{if(A<=c)return R("");const re=Je=>{const Wo=Je.target.parentNode.scrollHeight,Et=Je.target.scrollHeight-Je.target.scrollTop;return Je.target.scrollTop===0?R("bottom"):R(Et===Wo?"top":"top-bottom")},Ce=V?.current;return!$.isLoading&&O.length>0&&Ce&&V.current.addEventListener("scroll",re),()=>{Ce&&Ce.removeEventListener("scroll",re)}},[$,O,c,A]);const[U,ie]=(0,e.useState)(!1),$e=(0,e.useRef)(),dt=(0,e.useRef)([]);(0,e.useEffect)(()=>(ae.length>0&&dt.current.length===0&&ie(re=>(re&&($e.current=setTimeout(()=>{ie(!0)},10)),!1)),()=>{dt.current=ae||[]}),[ae]),(0,e.useEffect)(()=>()=>{$e.current&&clearTimeout($e.current)},[]);const Yt=()=>{ie(!1)},Xt=()=>{ie(!0),Z()},Jt=(re,Ce)=>{T&&re>=0&&re<O.length&&T(Ce,re)},Ve=ir(O.length),Xe=(0,e.useRef)(),_t=()=>{Xe.current="loadMore",D()};(0,e.useEffect)(()=>{Xe.current==="onChange"&&O.length!==Ve?B.current.scrollToItem(O.length,"end"):Xe.current==="loadMore"&&O.length!==Ve&&B.current.scrollToItem(0,"start"),Xe.current=void 0},[Ve,O]);const bt=`${i}-item-instructions`;return e.createElement(sa.g,{error:s,name:i,hint:o,id:l,required:G},e.createElement(En,{totalNumberOfRelations:A,size:j,search:e.createElement(e.Fragment,null,e.createElement(aa.Q,{action:u},p),e.createElement(y.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:Go},options:ae,isDisabled:r,isLoading:Y.isLoading,error:s,inputId:l,isSearchable:!0,isClear:!0,loadingMessage:()=>b,onChange:re=>{q(null),F(re),Xe.current="onChange"},onInputChange:re=>{q(re),Z(re)},onMenuClose:Yt,onMenuOpen:Xt,menuIsOpen:U,noOptionsMessage:()=>M,onMenuScrollToBottom:()=>{Y.hasNextPage&&x()},placeholder:W,name:i,value:X})),loadMore:ee&&e.createElement(Ho.A,{disabled:$.isLoading||$.isFetchingNextPage,onClick:_t,loading:$.isLoading||$.isFetchingNextPage,startIcon:e.createElement(Qo.Z,null)},m)},O.length>0&&e.createElement(vn,{overflow:z},e.createElement(Lt.T,{id:bt},g),e.createElement(Lt.T,{"aria-live":"assertive"},E),e.createElement(oa.t7,{height:oe,ref:B,outerRef:V,itemCount:A,itemSize:lt+Ot,itemData:{name:i,ariaDescribedBy:bt,canDrag:t,disabled:r,handleCancel:v,handleDropItem:k,handleGrabItem:I,iconButtonAriaLabel:a,labelDisconnectRelation:f,onRelationDisconnect:C,publicationStateTranslations:N,relations:O,updatePositionOfRelation:Jt},itemKey:re=>`${O[re].mainField}_${O[re].id}`,innerElementType:"ol"},Tn)),(o||s)&&e.createElement(P.x,{paddingTop:2},e.createElement(ia.J,null),e.createElement(la.c,null))))},xa=n().shape({data:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),hasNextPage:n().bool,isFetchingNextPage:n().bool.isRequired,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired}),Pa=n().shape({data:n().arrayOf(n().shape({id:n().number.isRequired,href:n().string,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])})),hasNextPage:n().bool,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired});Rn.defaultProps={canReorder:!1,description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,liveText:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,required:!1,relations:{data:[]},searchResults:{data:[]}},Rn.propTypes={error:n().string,canReorder:n().bool,description:n().string,disabled:n().bool,iconButtonAriaLabel:n().string.isRequired,id:n().string.isRequired,label:n().string.isRequired,labelAction:n().element,labelLoadMore:n().string,labelDisconnectRelation:n().string.isRequired,listAriaDescription:n().string.isRequired,liveText:n().string,loadingMessage:n().string.isRequired,name:n().string.isRequired,noRelationsMessage:n().string.isRequired,numberOfRelationsToDisplay:n().number.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,onRelationConnect:n().func.isRequired,onRelationDisconnect:n().func.isRequired,onRelationLoadMore:n().func.isRequired,onRelationReorder:n().func.isRequired,onSearch:n().func.isRequired,onSearchNextPage:n().func.isRequired,placeholder:n().string.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,required:n().bool,searchResults:Pa,size:n().number.isRequired,relations:xa};const Tn=({data:t,index:o,style:r})=>{const{ariaDescribedBy:s,canDrag:a,disabled:l,handleCancel:i,handleDropItem:c,handleGrabItem:p,iconButtonAriaLabel:u,name:m,labelDisconnectRelation:f,onRelationDisconnect:g,publicationStateTranslations:E,relations:b,updatePositionOfRelation:v}=t,{publicationState:k,href:I,mainField:M,id:F}=b[o],D=k==="draft"?"secondary":"success";return e.createElement(bn,{ariaDescribedBy:s,canDrag:a,disabled:l,displayValue:String(M??F),iconButtonAriaLabel:u,id:F,index:o,name:m,endAction:e.createElement(cr,{"data-testid":`remove-relation-${F}`,disabled:l,type:"button",onClick:()=>g(b[o]),"aria-label":f},e.createElement(je.J,{width:"12px",as:He.Z})),onCancel:i,onDropItem:c,onGrabItem:p,status:k||void 0,style:{...r,bottom:r.bottom??0+Ot,height:r.height??0-Ot},updatePositionOfRelation:v},e.createElement(P.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(en.u,{description:M??`${F}`},I?e.createElement(lr,{to:I},M??F):e.createElement(H.Z,{textColor:l?"neutral600":"primary600",ellipsis:!0},M??F))),k&&e.createElement(Pe.q,{variant:D,showBullet:!1,size:"S"},e.createElement(H.Z,{fontWeight:"bold",textColor:`${D}700`},E[k])))};Tn.defaultProps={data:{}},Tn.propTypes={data:n().shape({ariaDescribedBy:n().string.isRequired,canDrag:n().bool.isRequired,disabled:n().bool.isRequired,handleCancel:n().func,handleDropItem:n().func,handleGrabItem:n().func,iconButtonAriaLabel:n().string.isRequired,labelDisconnectRelation:n().string.isRequired,name:n().string.isRequired,onRelationDisconnect:n().func.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,relations:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),updatePositionOfRelation:n().func.isRequired}),index:n().number.isRequired,style:n().object.isRequired};var Fa=Rn;const dr=({status:t,displayedValue:o,width:r})=>{const{formatMessage:s}=(0,Q.Z)(),a={[ge.DRAFT]:s({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ge.PUBLISHED]:s({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},l=t===ge.DRAFT?"secondary":"success";return e.createElement(P.x,{style:{width:r}},e.createElement(w.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(Uo,{gap:1},e.createElement(be.h,{noBorder:!0},e.createElement(de.Z,null)),e.createElement(Vo,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(P.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(lr,null,e.createElement(H.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(Pe.q,{variant:l,showBullet:!1,size:"S"},e.createElement(H.Z,{fontWeight:"bold",textColor:`${l}700`},a[t])))),e.createElement(P.x,{paddingLeft:4},e.createElement(cr,{type:"button"},e.createElement(je.J,{width:"12px",as:He.Z})))))};dr.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};const Sa={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function Aa(t,o,r){if(!t||!o)return{display:"none"};const{x:s,y:a}=r,l=`translate(${s}px, ${a}px)`;return{transform:l,WebkitTransform:l}}var $a=()=>{const{itemType:t,isDragging:o,item:r,initialOffset:s,currentOffset:a,mouseOffset:l}=(0,Te.useDragLayer)(c=>({item:c.getItem(),itemType:c.getItemType(),initialOffset:c.getInitialSourceClientOffset(),currentOffset:c.getSourceClientOffset(),isDragging:c.isDragging(),mouseOffset:c.getClientOffset()}));if(!o)return null;const[i]=t.split("_");return e.createElement(ut,null,e.createElement("div",{style:Sa},e.createElement("div",{style:Aa(s,a,l),className:"col-md-2"},[Be.Z.EDIT_FIELD,Be.Z.FIELD].includes(t)&&e.createElement(it,{labelField:r.labelField}),i===Be.Z.COMPONENT&&e.createElement(he,{displayedValue:r.displayedValue}),i===Be.Z.DYNAMIC_ZONE&&e.createElement(he,{displayedValue:r.displayedValue}),i===Be.Z.RELATION&&e.createElement(dr,{displayedValue:r.displayedValue,status:r.status,width:r.width}))))},ur=(0,e.createContext)(),Za=d(47533),mr=(0,e.createContext)(),nn=d(46339),pr=d(4460);const Ba=()=>({type:pr.c}),Na=(t,o)=>({type:pr.O,layout:t,query:o});var qa=d(8266),ft=d.n(qa),Pt=d(17e3),Ye=d(15335),Le=d(5803),ja=d(2669),Wa=d(66694),za=()=>(0,e.useContext)(Wa.ux),gr=t=>{const{getAdminInjectedComponents:o}=za(),[r,s,a]=t.split(".");return o(r,s,a)};const fr=({area:t,...o})=>gr(t).map(s=>e.createElement(s.Component,{key:s.name,...o}));fr.propTypes={area:n().string.isRequired};var on=fr;function Ua(t,o){return r=>{const s=o(r.name);return e.createElement(t,{...r,...s})}}var Va=Ua;function Ha(t){const{addComponentToDynamicZone:o,createActionAllowedFields:r,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentField:i,removeComponentFromDynamicZone:c,readActionAllowedFields:p,updateActionAllowedFields:u}=(0,y.Wq)(),m=(0,e.useMemo)(()=>L()(l,[t],[]).map(E=>({componentUid:E.__component,id:E.id??E.__temp_key__})),[l,t]),f=(0,e.useMemo)(()=>(s?r:u).includes(t),[t,s,r,u]),g=(0,e.useMemo)(()=>(s?[]:p).includes(t),[t,s,p]);return{addComponentToDynamicZone:o,formErrors:a,isCreatingEntry:s,isFieldAllowed:f,isFieldReadable:g,moveComponentField:i,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:m}}var Qa=Ha,Mn=d(83828),Dn=d(61762),kn=d(89966),Ga=d(61868),Ka=d.n(Ga);function Ya(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var Xa=Ya,Ja=d(88708),jt=d.n(Ja);function _a({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:p,formErrors:u}=(0,y.Wq)(),{contentType:m}=gt(),f=(0,e.useMemo)(()=>{const M=L()(m,["attributes"],{});return Object.keys(M).filter(D=>L()(M,[D,"type"],"")==="dynamiczone")},[m]),g=(0,e.useMemo)(()=>a?s:p,[a,s,p]),E=L()(l,o,null),b=(0,e.useMemo)(()=>(0,h.Ts)(o),[o]),v=(0,e.useMemo)(()=>t&&a||g.filter(D=>D===b[0]).length>0?!0:g.map(D=>D.split(".")).filter(D=>D.length<b.length?!1:jt()(D,b.length).join(".")===b.join(".")).length>0,[t,a,g,b]),k=(0,e.useMemo)(()=>t||f.includes(b[0])?!0:(a?[]:c).map(D=>D.split(".")).filter(D=>D.length<b.length?!1:jt()(D,b.length).join(".")===b.join(".")).length>0,[t,f,b,a,c]),I=(0,e.useMemo)(()=>a||v?!1:k,[v,k,a]);return{addNonRepeatableComponentToField:r,formErrors:u,hasChildrenAllowedFields:v,hasChildrenReadableFields:k,isCreatingEntry:a,isReadOnly:I,removeComponentFromField:i,componentValue:E}}var ei=_a;const ti=(0,S.ZP)(P.x)`
|
|
133
|
-
svg path {
|
|
134
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
135
|
-
}
|
|
136
|
-
`,In=({intlLabel:t,id:o,labelAction:r,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,Q.Z)(),p=t?.id?c(t):s;return e.createElement(P.x,{paddingBottom:1},e.createElement(w.k,null,e.createElement(H.Z,{textColor:"neutral800",htmlFor:o||s,variant:"pi",fontWeight:"bold",as:"label"},p,l&&e.createElement(e.Fragment,null,"\xA0(",a,")"),i&&e.createElement(H.Z,{textColor:"danger600"},"*")),r&&e.createElement(ti,{paddingLeft:1},r)))};In.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},In.propTypes={id:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,numberOfEntries:n().number,required:n().bool,showNumberOfEntries:n().bool};var ni=In,hr=d(86308);const oi=S.ZP.span`
|
|
137
|
-
> svg {
|
|
138
|
-
width: ${(0,y.Q1)(24)};
|
|
139
|
-
height: ${(0,y.Q1)(24)};
|
|
140
|
-
> circle {
|
|
141
|
-
fill: ${({theme:t})=>t.colors.primary200};
|
|
142
|
-
}
|
|
143
|
-
> path {
|
|
144
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
`,On=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(P.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(w.k,{direction:"column",gap:2},e.createElement(w.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(oi,null,e.createElement(hr.Z,null))),e.createElement(w.k,{justifyContent:"center"},e.createElement(H.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:(0,h.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(H.Z,{textColor:"danger600",variant:"pi"},s(t,{...t.values})))};On.defaultProps={error:void 0,isReadOnly:!1},On.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var yr=On,ri=d(9086),si=d.n(ri),ai=d(87702),Ln=d.n(ai),Ip=d(27217),ii=d(88591),li=d.n(ii),wn=d(59845),ci=d(20871),di=d.n(ci),ui=d(48375),br=d.n(ui),mi=d(31089),pi=d.n(mi),gi=d(16043),fi=d.n(gi),hi=d(5109),yi=d.n(hi),bi=d(47955),Ei=d.n(bi),vi=d(95706),Ci=d.n(vi),Ri=d(6658),Ti=d.n(Ri),Mi=d(36407),Di=d.n(Mi);(async()=>{await d.e(7347).then(d.bind(d,74194))})();const Ft=new(li())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,wn.getLanguage)(o))return'<pre class="hljs language-'+Ft.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,wn.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,wn.highlightAuto)(t);return'<pre class="hljs language-'+Ft.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+Ft.utils.escapeHtml(t)+"</code></pre>"}}).use(di()).use(br(),"warning").use(br(),"tip").use(pi()).use(fi()).use(yi()).use(Ei()).use(Ci()).use(Ti()).use(Di());Ft.renderer.rules.footnote_ref=(t,o,r,s,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(t,o,r,s,a)+"</span></sup>",Ft.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var ki=Ft,Ii=d(13993),Er=d.n(Ii);const Oi={...Er().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var Li=t=>Er()(t,Oi),wi=S.ZP.div`
|
|
148
|
-
position: absolute;
|
|
149
|
-
top: 0;
|
|
150
|
-
width: 100%;
|
|
151
|
-
height: 100%;
|
|
152
|
-
overflow: auto;
|
|
153
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
154
|
-
font-size: ${14/16}rem;
|
|
155
|
-
background-color: ${({theme:t})=>t.colors.neutral0};
|
|
156
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
157
|
-
line-height: ${({theme:t})=>t.lineHeights[6]};
|
|
158
|
-
|
|
159
|
-
h1,
|
|
160
|
-
h2,
|
|
161
|
-
h3,
|
|
162
|
-
h4,
|
|
163
|
-
h5,
|
|
164
|
-
h6 {
|
|
165
|
-
margin-block-start: ${({theme:t})=>t.spaces[2]};
|
|
166
|
-
margin-block-end: ${({theme:t})=>t.spaces[2]};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
p {
|
|
170
|
-
margin-bottom: ${({theme:t})=>t.spaces[2]};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
h1 {
|
|
174
|
-
font-size: ${36/16}rem;
|
|
175
|
-
font-weight: 600;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
h2 {
|
|
179
|
-
font-size: ${30/16}rem;
|
|
180
|
-
font-weight: 500;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
h3 {
|
|
184
|
-
font-size: ${24/16}rem;
|
|
185
|
-
font-weight: 500;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
h4 {
|
|
189
|
-
font-size: ${20/16}rem;
|
|
190
|
-
font-weight: 500;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
strong {
|
|
194
|
-
font-weight: 800;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
em {
|
|
198
|
-
font-style: italic;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
blockquote {
|
|
202
|
-
margin-top: ${({theme:t})=>t.spaces[8]};
|
|
203
|
-
margin-bottom: ${({theme:t})=>t.spaces[7]};
|
|
204
|
-
font-size: ${14/16}rem;
|
|
205
|
-
font-weight: 400;
|
|
206
|
-
border-left: 4px solid ${({theme:t})=>t.colors.neutral150};
|
|
207
|
-
font-style: italic;
|
|
208
|
-
padding: ${({theme:t})=>t.spaces[2]} ${({theme:t})=>t.spaces[5]};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
img {
|
|
212
|
-
max-width: 100%;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
table {
|
|
216
|
-
thead {
|
|
217
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
218
|
-
|
|
219
|
-
th {
|
|
220
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
tr {
|
|
224
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
225
|
-
}
|
|
226
|
-
th,
|
|
227
|
-
td {
|
|
228
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
229
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
230
|
-
border-bottom: 0;
|
|
231
|
-
border-top: 0;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
pre,
|
|
236
|
-
code {
|
|
237
|
-
font-size: ${14/16}rem;
|
|
238
|
-
border-radius: 4px;
|
|
239
|
-
/*
|
|
240
|
-
Hard coded since the color is the same between themes,
|
|
241
|
-
theme.colors.neutral800 changes between themes.
|
|
242
|
-
|
|
243
|
-
Matches the color of the JSON Input component.
|
|
244
|
-
*/
|
|
245
|
-
background-color: #32324d;
|
|
246
|
-
max-width: 100%;
|
|
247
|
-
overflow: auto;
|
|
248
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/* Inline code */
|
|
252
|
-
p,
|
|
253
|
-
pre,
|
|
254
|
-
td {
|
|
255
|
-
> code {
|
|
256
|
-
color: #839496;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
ol {
|
|
261
|
-
list-style-type: decimal;
|
|
262
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
263
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
264
|
-
margin-inline-start: 0px;
|
|
265
|
-
margin-inline-end: 0px;
|
|
266
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
267
|
-
|
|
268
|
-
ol,
|
|
269
|
-
ul {
|
|
270
|
-
margin-block-start: 0px;
|
|
271
|
-
margin-block-end: 0px;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
ul {
|
|
276
|
-
list-style-type: disc;
|
|
277
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
278
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
279
|
-
margin-inline-start: 0px;
|
|
280
|
-
margin-inline-end: 0px;
|
|
281
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
282
|
-
|
|
283
|
-
ul,
|
|
284
|
-
ol {
|
|
285
|
-
margin-block-start: 0px;
|
|
286
|
-
margin-block-end: 0px;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
`;const xn=({data:t})=>{const o=(0,e.useMemo)(()=>Li(ki.render(t.replaceAll("\\n",`
|
|
290
|
-
`)||"")),[t]);return e.createElement(wi,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};xn.defaultProps={data:""},xn.propTypes={data:n().string};var vr=(0,e.memo)(xn);const xi=S.ZP.div`
|
|
291
|
-
cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
|
|
292
|
-
height: 100%;
|
|
293
|
-
/* BASICS */
|
|
294
|
-
.CodeMirror-placeholder {
|
|
295
|
-
color: ${({theme:t})=>t.colors.neutral600} !important;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.CodeMirror {
|
|
299
|
-
/* Set height, width, borders, and global font properties here */
|
|
300
|
-
font-size: ${14/16}rem;
|
|
301
|
-
height: ${({isExpandMode:t})=>t?"100%":"290px"};
|
|
302
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
303
|
-
direction: ltr;
|
|
304
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
305
|
-
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/* PADDING */
|
|
309
|
-
|
|
310
|
-
.CodeMirror-lines {
|
|
311
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
312
|
-
/* Vertical padding around content */
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.CodeMirror-scrollbar-filler,
|
|
316
|
-
.CodeMirror-gutter-filler {
|
|
317
|
-
/* The little square between H and V scrollbars */
|
|
318
|
-
background-color: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/* GUTTER */
|
|
322
|
-
|
|
323
|
-
.CodeMirror-gutters {
|
|
324
|
-
border-right: 1px solid #ddd;
|
|
325
|
-
background-color: #f7f7f7;
|
|
326
|
-
white-space: nowrap;
|
|
327
|
-
}
|
|
328
|
-
.CodeMirror-linenumbers {
|
|
329
|
-
}
|
|
330
|
-
.CodeMirror-linenumber {
|
|
331
|
-
padding: 0 3px 0 5px;
|
|
332
|
-
min-width: 20px;
|
|
333
|
-
text-align: right;
|
|
334
|
-
color: #999;
|
|
335
|
-
white-space: nowrap;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.CodeMirror-guttermarker {
|
|
339
|
-
color: black;
|
|
340
|
-
}
|
|
341
|
-
.CodeMirror-guttermarker-subtle {
|
|
342
|
-
color: #999;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/* CURSOR */
|
|
346
|
-
|
|
347
|
-
.CodeMirror-cursor {
|
|
348
|
-
border-left: 1px solid black;
|
|
349
|
-
border-right: none;
|
|
350
|
-
width: 0;
|
|
351
|
-
}
|
|
352
|
-
/* Shown when moving in bi-directional text */
|
|
353
|
-
.CodeMirror div.CodeMirror-secondarycursor {
|
|
354
|
-
border-left: 1px solid silver;
|
|
355
|
-
}
|
|
356
|
-
.cm-fat-cursor .CodeMirror-cursor {
|
|
357
|
-
width: auto;
|
|
358
|
-
border: 0 !important;
|
|
359
|
-
background: #7e7;
|
|
360
|
-
}
|
|
361
|
-
.cm-fat-cursor div.CodeMirror-cursors {
|
|
362
|
-
/* z-index: 1; */
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.cm-fat-cursor-mark {
|
|
366
|
-
background-color: rgba(20, 255, 20, 0.5);
|
|
367
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
368
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
369
|
-
animation: blink 1.06s steps(1) infinite;
|
|
370
|
-
}
|
|
371
|
-
.cm-animate-fat-cursor {
|
|
372
|
-
width: auto;
|
|
373
|
-
border: 0;
|
|
374
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
375
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
376
|
-
animation: blink 1.06s steps(1) infinite;
|
|
377
|
-
background-color: #7e7;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/* Can style cursor different in overwrite (non-insert) mode */
|
|
381
|
-
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.cm-tab {
|
|
385
|
-
display: inline-block;
|
|
386
|
-
text-decoration: inherit;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.CodeMirror-rulers {
|
|
390
|
-
position: absolute;
|
|
391
|
-
left: 0;
|
|
392
|
-
right: 0;
|
|
393
|
-
top: -50px;
|
|
394
|
-
bottom: 0;
|
|
395
|
-
overflow: hidden;
|
|
396
|
-
}
|
|
397
|
-
.CodeMirror-ruler {
|
|
398
|
-
border-left: 1px solid #ccc;
|
|
399
|
-
top: 0;
|
|
400
|
-
bottom: 0;
|
|
401
|
-
position: absolute;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
/* DEFAULT THEME */
|
|
405
|
-
|
|
406
|
-
.cm-header,
|
|
407
|
-
.cm-strong {
|
|
408
|
-
font-weight: bold;
|
|
409
|
-
}
|
|
410
|
-
.cm-em {
|
|
411
|
-
font-style: italic;
|
|
412
|
-
}
|
|
413
|
-
.cm-link {
|
|
414
|
-
text-decoration: underline;
|
|
415
|
-
}
|
|
416
|
-
.cm-strikethrough {
|
|
417
|
-
text-decoration: line-through;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.CodeMirror-composing {
|
|
421
|
-
border-bottom: 2px solid;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/* Default styles for common addons */
|
|
425
|
-
|
|
426
|
-
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
427
|
-
color: #0b0;
|
|
428
|
-
}
|
|
429
|
-
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
430
|
-
color: #a22;
|
|
431
|
-
}
|
|
432
|
-
.CodeMirror-matchingtag {
|
|
433
|
-
background: rgba(255, 150, 0, 0.3);
|
|
434
|
-
}
|
|
435
|
-
.CodeMirror-activeline-background {
|
|
436
|
-
background: #e8f2ff;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/* STOP */
|
|
440
|
-
|
|
441
|
-
/* The rest of this file contains styles related to the mechanics of
|
|
442
|
-
the editor. You probably shouldn't touch them. */
|
|
443
|
-
|
|
444
|
-
.CodeMirror {
|
|
445
|
-
position: relative;
|
|
446
|
-
overflow: hidden;
|
|
447
|
-
background: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
.CodeMirror-scroll {
|
|
451
|
-
overflow: scroll !important; /* Things will break if this is overridden */
|
|
452
|
-
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
453
|
-
/* See overflow: hidden in .CodeMirror */
|
|
454
|
-
margin-bottom: -50px;
|
|
455
|
-
margin-right: -50px;
|
|
456
|
-
padding-bottom: 50px;
|
|
457
|
-
height: 100%;
|
|
458
|
-
outline: none; /* Prevent dragging from highlighting the element */
|
|
459
|
-
position: relative;
|
|
460
|
-
}
|
|
461
|
-
.CodeMirror-sizer {
|
|
462
|
-
position: relative;
|
|
463
|
-
border-right: 50px solid transparent;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
467
|
-
before actual scrolling happens, thus preventing shaking and
|
|
468
|
-
flickering artifacts. */
|
|
469
|
-
.CodeMirror-vscrollbar,
|
|
470
|
-
.CodeMirror-hscrollbar,
|
|
471
|
-
.CodeMirror-scrollbar-filler,
|
|
472
|
-
.CodeMirror-gutter-filler {
|
|
473
|
-
position: absolute;
|
|
474
|
-
z-index: 1;
|
|
475
|
-
display: none;
|
|
476
|
-
outline: none;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
.CodeMirror-vscrollbar {
|
|
480
|
-
right: 0;
|
|
481
|
-
top: 0;
|
|
482
|
-
overflow-x: hidden;
|
|
483
|
-
overflow-y: scroll;
|
|
484
|
-
}
|
|
485
|
-
.CodeMirror-hscrollbar {
|
|
486
|
-
bottom: 0;
|
|
487
|
-
left: 0;
|
|
488
|
-
overflow-y: hidden;
|
|
489
|
-
overflow-x: scroll;
|
|
490
|
-
}
|
|
491
|
-
.CodeMirror-scrollbar-filler {
|
|
492
|
-
right: 0;
|
|
493
|
-
bottom: 0;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
.CodeMirror-lines {
|
|
497
|
-
cursor: text;
|
|
498
|
-
min-height: 1px; /* prevents collapsing before first draw */
|
|
499
|
-
}
|
|
500
|
-
/* Reset some styles that the rest of the page might have set */
|
|
501
|
-
.CodeMirror pre.CodeMirror-line,
|
|
502
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
503
|
-
-moz-border-radius: 0;
|
|
504
|
-
-webkit-border-radius: 0;
|
|
505
|
-
border-radius: 0;
|
|
506
|
-
border-width: 0;
|
|
507
|
-
background: transparent;
|
|
508
|
-
font-family: inherit;
|
|
509
|
-
font-size: inherit;
|
|
510
|
-
margin: 0;
|
|
511
|
-
white-space: pre;
|
|
512
|
-
word-wrap: normal;
|
|
513
|
-
line-height: 1.5;
|
|
514
|
-
color: inherit;
|
|
515
|
-
/* z-index: 2; */
|
|
516
|
-
position: relative;
|
|
517
|
-
overflow: visible;
|
|
518
|
-
-webkit-tap-highlight-color: transparent;
|
|
519
|
-
-webkit-font-variant-ligatures: contextual;
|
|
520
|
-
font-variant-ligatures: contextual;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
524
|
-
z-index: 2;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.CodeMirror-wrap pre.CodeMirror-line,
|
|
528
|
-
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
529
|
-
word-wrap: break-word;
|
|
530
|
-
white-space: pre-wrap;
|
|
531
|
-
word-break: normal;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
.CodeMirror-linebackground {
|
|
535
|
-
position: absolute;
|
|
536
|
-
left: 0;
|
|
537
|
-
right: 0;
|
|
538
|
-
top: 0;
|
|
539
|
-
bottom: 0;
|
|
540
|
-
z-index: 0;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
.CodeMirror-linewidget {
|
|
544
|
-
position: relative;
|
|
545
|
-
/* z-index: 2; */
|
|
546
|
-
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
.CodeMirror-widget {
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
.CodeMirror-rtl pre {
|
|
553
|
-
direction: rtl;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
.CodeMirror-code {
|
|
557
|
-
outline: none;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/* Force content-box sizing for the elements where we expect it */
|
|
561
|
-
.CodeMirror-scroll,
|
|
562
|
-
.CodeMirror-sizer,
|
|
563
|
-
.CodeMirror-gutter,
|
|
564
|
-
.CodeMirror-gutters,
|
|
565
|
-
.CodeMirror-linenumber {
|
|
566
|
-
-moz-box-sizing: content-box;
|
|
567
|
-
box-sizing: content-box;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
.CodeMirror-measure {
|
|
571
|
-
position: absolute;
|
|
572
|
-
width: 100%;
|
|
573
|
-
height: 0;
|
|
574
|
-
overflow: hidden;
|
|
575
|
-
visibility: hidden;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
.CodeMirror-cursor {
|
|
579
|
-
position: absolute;
|
|
580
|
-
pointer-events: none;
|
|
581
|
-
border-color: ${({theme:t})=>`${t.colors.neutral800}`};
|
|
582
|
-
}
|
|
583
|
-
.CodeMirror-measure pre {
|
|
584
|
-
position: static;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
div.CodeMirror-cursors {
|
|
588
|
-
visibility: hidden;
|
|
589
|
-
position: relative;
|
|
590
|
-
+ div {
|
|
591
|
-
z-index: 0 !important;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
div.CodeMirror-dragcursors {
|
|
596
|
-
visibility: visible;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
.CodeMirror-focused div.CodeMirror-cursors {
|
|
600
|
-
visibility: visible;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
.CodeMirror-selected {
|
|
604
|
-
background: ${({theme:t})=>t.colors.neutral200};
|
|
605
|
-
/* z-index: -10; */
|
|
606
|
-
}
|
|
607
|
-
.CodeMirror-crosshair {
|
|
608
|
-
cursor: crosshair;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/* Used to force a border model for a node */
|
|
612
|
-
.cm-force-border {
|
|
613
|
-
padding-right: 0.1px;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
/* See issue #2901 */
|
|
617
|
-
.cm-tab-wrap-hack:after {
|
|
618
|
-
content: '';
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
/* Help users use markselection to safely style text background */
|
|
622
|
-
span.CodeMirror-selectedtext {
|
|
623
|
-
background: none;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
span {
|
|
627
|
-
color: ${({theme:t})=>t.colors.neutral800} !important;
|
|
628
|
-
}
|
|
629
|
-
`;var Pn=d(69783);const We=(0,S.ZP)(be.h)`
|
|
630
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
631
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
|
632
|
-
outline-offset: -2px !important;
|
|
633
|
-
|
|
634
|
-
svg {
|
|
635
|
-
width: ${18/16}rem;
|
|
636
|
-
height: ${18/16}rem;
|
|
637
|
-
}
|
|
638
|
-
`,Pi=(0,S.ZP)(We)`
|
|
639
|
-
svg {
|
|
640
|
-
width: ${8/16}rem;
|
|
641
|
-
height: ${8/16}rem;
|
|
642
|
-
}
|
|
643
|
-
`,Cr=(0,S.ZP)(be.o)`
|
|
644
|
-
margin-left: ${({theme:t})=>t.spaces[4]};
|
|
645
|
-
`,Rr=(0,S.ZP)(be.h)`
|
|
646
|
-
margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
|
|
647
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
648
|
-
|
|
649
|
-
svg {
|
|
650
|
-
width: ${18/16}rem;
|
|
651
|
-
height: ${18/16}rem;
|
|
652
|
-
}
|
|
653
|
-
`,Fi=(0,S.ZP)(be.o)`
|
|
654
|
-
margin-right: ${({theme:t})=>`${t.spaces[2]}`};
|
|
655
|
-
`,Si=S.ZP.div`
|
|
656
|
-
position: relative;
|
|
657
|
-
height: calc(100% - 48px);
|
|
658
|
-
`,Ai=(0,S.ZP)(Pn.Y)`
|
|
659
|
-
background-color: transparent;
|
|
660
|
-
border: none;
|
|
661
|
-
align-items: center;
|
|
662
|
-
|
|
663
|
-
svg {
|
|
664
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
665
|
-
path {
|
|
666
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
667
|
-
width: ${12/16}rem;
|
|
668
|
-
height: ${12/16}rem;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
`;var rn=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,$i=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Zi=/[*+-]\s/;function Bi(t){if(t.getOption("disableInput"))return Ln().Pass;for(var o=t.listSelections(),r=[],s=0;s<o.length;s++){var a=o[s].head,l=t.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,p=t.getLine(a.line),u=rn.exec(p),m=/^\s*$/.test(p.slice(0,a.ch));if(!o[s].empty()||!i&&!c||!u||m){t.execCommand("newlineAndIndent");return}if($i.test(p)){var f=c&&/>\s*$/.test(p),g=!/>\s*$/.test(p);(f||g)&&t.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),r[s]=`
|
|
672
|
-
`}else{var E=u[1],b=u[5],v=!(Zi.test(u[2])||u[2].indexOf(">")>=0),k=v?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");r[s]=`
|
|
673
|
-
`+E+k+b,v&&Ni(t,a)}}t.replaceSelections(r)}function Ni(t,o){var r=o.line,s=0,a=0,l=rn.exec(t.getLine(r)),i=l[1];do{s+=1;var c=r+s,p=t.getLine(c),u=rn.exec(p);if(u){var m=u[1],f=parseInt(l[3],10)+s-a,g=parseInt(u[3],10),E=g;if(i===m&&!isNaN(g))f===g&&(E=g+1),f>g&&(E=f+1),t.replaceRange(p.replace(rn,m+E+u[4]+u[5]),{line:c,ch:0},{line:c,ch:p.length});else{if(i.length>m.length||i.length<m.length&&s===1)return;a+=1}}}while(u)}var qi=Bi;const Fn=({disabled:t,editorRef:o,error:r,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:p,value:u})=>{const m=(0,e.useRef)(i);return(0,e.useEffect)(()=>{o.current=Ln().fromTextArea(p.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),Ln().commands.newlineAndIndentContinueMarkdownList=qi,o.current.on("change",f=>{m.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[o,p,l,c]),(0,e.useEffect)(()=>{u&&!o.current.hasFocus()&&o.current.setValue(u)},[o,u]),(0,e.useEffect)(()=>{s||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,s,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement(Si,null,e.createElement(xi,{isExpandMode:a,disabled:t||s},e.createElement("textarea",{ref:p})),s&&e.createElement(vr,{data:u}))};Fn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},Fn.propTypes={disabled:n().bool,editorRef:n().shape({current:n().any}).isRequired,error:n().string,isPreviewMode:n().bool,isExpandMode:n().bool,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().string,textareaRef:n().shape({current:n().any}).isRequired,value:n().string};var ji=Fn,ot=d(80084),we=d(84967),Ee=d(41415),Wi=d(4101),Tr=d(67563),Mr=d(73906),Dr=d(49844),kr=d(99283),Ir=d(49825),zi=d(83139),Ui=d(35635),Vi=d(20063),Hi=d(80601),Qi=d(11417),Gi=d(43231),Ki=d(65663);const Sn=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,p]=(0,e.useState)(!1),{formatMessage:u}=(0,Q.Z)(),m=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,e.useRef)(),g=()=>{p(E=>!E)};return t||s?e.createElement(P.x,{padding:2,background:"neutral100"},e.createElement(w.k,{justifyContent:"space-between"},e.createElement(w.k,null,e.createElement(ot.P,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},e.createElement(we.W,{value:"h1"},"h1"),e.createElement(we.W,{value:"h2"},"h2"),e.createElement(we.W,{value:"h3"},"h3"),e.createElement(we.W,{value:"h4"},"h4"),e.createElement(we.W,{value:"h5"},"h5"),e.createElement(we.W,{value:"h6"},"h6")),e.createElement(Cr,null,e.createElement(We,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Mr.Z,null)}),e.createElement(We,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Dr.Z,null)}),e.createElement(We,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(kr.Z,null)})),e.createElement(Rr,{disabled:!0,id:"more",label:"More",icon:e.createElement(Ir.Z,null)})),!r&&e.createElement(Ee.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):e.createElement(P.x,{padding:2,background:"neutral100"},e.createElement(w.k,{justifyContent:"space-between"},e.createElement(w.k,null,e.createElement(ot.P,{id:"selectTitle",placeholder:m,size:"S",onChange:E=>a(E,o)},e.createElement(we.W,{value:"h1"},"h1"),e.createElement(we.W,{value:"h2"},"h2"),e.createElement(we.W,{value:"h3"},"h3"),e.createElement(we.W,{value:"h4"},"h4"),e.createElement(we.W,{value:"h5"},"h5"),e.createElement(we.W,{value:"h6"},"h6")),e.createElement(Cr,null,e.createElement(We,{onClick:()=>a("Bold",o),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Mr.Z,null)}),e.createElement(We,{onClick:()=>a("Italic",o),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Dr.Z,null)}),e.createElement(We,{onClick:()=>a("Underline",o),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(kr.Z,null)})),e.createElement(Rr,{ref:f,onClick:g,id:"more",label:"More",icon:e.createElement(Ir.Z,null)}),c&&e.createElement(Wi.J2,{centered:!0,source:f,spacing:4,id:"popover"},e.createElement(Tr.i,{onEscape:g,restoreFocus:!1},e.createElement(w.k,null,e.createElement(Fi,null,e.createElement(We,{onClick:()=>a("Strikethrough",o,g),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(zi.Z,null)}),e.createElement(We,{onClick:()=>a("BulletList",o,g),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(Ui.Z,null)}),e.createElement(We,{onClick:()=>a("NumberList",o,g),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Vi.Z,null)})),e.createElement(be.o,null,e.createElement(We,{onClick:()=>a("Code",o,g),id:"Code",label:"Code",name:"Code",icon:e.createElement(Hi.Z,null)}),e.createElement(We,{onClick:()=>{g(),l()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Qi.Z,null)}),e.createElement(Pi,{onClick:()=>a("Link",o,g),id:"Link",label:"Link",name:"Link",icon:e.createElement(Gi.Z,null)}),e.createElement(We,{onClick:()=>a("Quote",o,g),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Ki.Z,null)})))))),i&&e.createElement(Ee.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};Sn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},Sn.propTypes={disabled:n().bool.isRequired,editorRef:n().shape({current:n().any}).isRequired,isExpandMode:n().bool.isRequired,isPreviewMode:n().bool,onActionClick:n().func,onToggleMediaLib:n().func,onTogglePreviewMode:n().func};var Yi=Sn,Xi=d(18070);const An=({onToggleExpand:t})=>{const{formatMessage:o}=(0,Q.Z)();return e.createElement(P.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(w.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(Ai,{id:"expand",onClick:t},e.createElement(H.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(Xi.Z,null))))};An.defaultProps={onToggleExpand(){}},An.propTypes={onToggleExpand:n().func};var Ji=An;const $n=({id:t,error:o,name:r,hint:s})=>s.length===0||o?null:e.createElement(H.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},s);$n.defaultProps={id:void 0,error:void 0,hint:""},$n.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var _i=$n;const Or=(t,o)=>{let r;switch(t){case"Strikethrough":r=`~~${o}~~`;break;case"Bold":r=`**${o}**`;break;case"Italic":r=`_${o}_`;break;case"Underline":r=`<u>${o}</u>`;break;case"Code":r=`\`\`\`
|
|
674
|
-
${o}
|
|
675
|
-
\`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},Lr=t=>{let o,r={start:t.length,end:0};switch(t){case"Strikethrough":o=`~~${t}~~`,r.end=2;break;case"Bold":o=`**${t}**`,r.end=2;break;case"Italic":o=`_${t}_`,r.end=1;break;case"alt":o=`[${t}]()`,r.end=3;break;case"Underline":o=`<u>${t}</u>`,r.end=4;break;case"Code":o=`\`\`\`
|
|
676
|
-
${t}
|
|
677
|
-
\`\`\``,r.end=3;break;case"Link":o=`[${t}](link)`,r.end=7;break;case"Quote":o=`>${t}`,r.end=0;break;default:o=""}return{editedText:o,selection:r}},wr=t=>{let o;switch(t){case"BulletList":o="- ";break;case"NumberList":o="1. ";break;case"h1":o="# ";break;case"h2":o="## ";break;case"h3":o="### ";break;case"h4":o="#### ";break;case"h5":o="##### ";break;case"h6":o="###### ";break;default:return""}return o},xr=(t,o)=>{const r=t.current.getSelection();let s;if(r){const a=Or(o,r);t.current.replaceSelection(a),t.current.focus()}else{s=Lr(o),t.current.replaceSelection(s.editedText),t.current.focus();const{line:a,ch:l}=t.current.getCursor(),i=l-s.selection.end,c=l-s.selection.end-s.selection.start;t.current.setSelection({line:a,ch:c},{line:a,ch:i})}},el=(t,o)=>{const r=t.current.getDoc(),s=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const a=r.listSelections();let l=null;t.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=r.getLine(c[0]).startsWith(s));for(let p=c[0];p<=c[1];p++)if(l)r.getLine(p).startsWith(s)&&r.replaceRange("",{line:p,ch:0},{line:p,ch:s.length});else{const u=o==="BulletList"?"- ":`${p+1}. `;r.replaceRange(u,{line:p,ch:0})}})})}else{let{line:a}=r.getCursor();const l=wr(o),i=t.current.getLine(a),c=l+i;t.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),t.current.replaceSelection(c)}t.current.focus()},tl=(t,o)=>{let{line:r}=t.current.getCursor();const s=wr(o),a=t.current.getLine(r),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;t.current.setSelection({line:r,ch:0},{line:r,ch:a.length}),t.current.replaceSelection(i),setTimeout(()=>{const c=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:c})},0)},nl=(t,o)=>{let{line:r,ch:s}=t.current.getCursor();o.forEach((a,l)=>{let i=t.current.getLine(r).length;t.current.setCursor({line:r,ch:i}),(l>0||l===0&&s!==0)&&(i=t.current.getLine(r).length,t.current.setCursor({line:r,ch:i}),r++,t.current.replaceSelection(`
|
|
678
|
-
`)),a.mime.includes("image")?t.current.replaceSelection(``):t.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>t.current.focus(),0)},ol=(t,o,r,s,a)=>{const l=Or(o,a),i=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
|
|
679
|
-
`),t.current.replaceSelection(l),o==="Code"){let{line:c}=t.current.getCursor();t.current.setCursor({line:c-1,ch:a.length})}t.current.replaceRange(i,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},rl=(t,o,r,s)=>{const a=Lr(o),l=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:r,ch:s}),t.current.replaceSelection(`
|
|
680
|
-
`),t.current.replaceSelection(a.editedText),o==="Code")r+=2,t.current.setSelection({line:r,ch:0},{line:r,ch:4});else{r+=1;let{ch:i}=t.current.getCursor(),c=i-a.selection.end,p=i-a.selection.end-a.selection.start;t.current.setSelection({line:r,ch:p},{line:r,ch:c})}t.current.replaceRange(l,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},sl=(t,o)=>{const r=t.current.getSelection();let{line:s}=t.current.getCursor(),a=t.current.getLine(s).length;r?ol(t,o,s,a,r):rl(t,o,s,a)};var al=d(71933),il=d(74464);const ll=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,cl=(0,S.ZP)(w.k)`
|
|
681
|
-
background: ${({theme:t})=>ll(t.colors.neutral800,.2)};
|
|
682
|
-
`,dl=(0,S.ZP)(P.x)`
|
|
683
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
684
|
-
`,ul=(0,S.ZP)(Pn.Y)`
|
|
685
|
-
background-color: transparent;
|
|
686
|
-
border: none;
|
|
687
|
-
align-items: center;
|
|
688
|
-
|
|
689
|
-
svg {
|
|
690
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
691
|
-
|
|
692
|
-
path {
|
|
693
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
694
|
-
width: ${12/16}rem;
|
|
695
|
-
height: ${12/16}rem;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
`,Zn=({children:t,isExpandMode:o,error:r,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,Q.Z)();return(0,y.F5)(o),o?e.createElement(al.h,{role:"dialog","aria-modal":!1},e.createElement(Tr.i,{onEscape:a},e.createElement(cl,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},e.createElement(P.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(w.k,{height:"100%",alignItems:"flex-start"},e.createElement(dl,{flex:"1",height:"100%"},t),e.createElement(w.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(w.k,{height:(0,y.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(ul,{onClick:a},e.createElement(H.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(il.Z,null))),e.createElement(P.x,{position:"relative",height:"100%",width:"100%"},e.createElement(vr,{data:s})))))))):e.createElement(P.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};Zn.defaultProps={error:void 0,previewContent:""},Zn.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const ml=(0,S.ZP)(P.x)`
|
|
699
|
-
svg path {
|
|
700
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
701
|
-
}
|
|
702
|
-
`,pl=(0,S.ZP)(H.Z)`
|
|
703
|
-
line-height: 0;
|
|
704
|
-
`,Bn=({hint:t,disabled:o,error:r,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:c,value:p,required:u})=>{const{formatMessage:m}=(0,Q.Z)(),f=(0,e.useRef)(null),g=(0,e.useRef)(null),[E,b]=(0,e.useState)(!1),[v,k]=(0,e.useState)(!1),[I,M]=(0,e.useState)(!1),{components:F}=(0,y.yX)(),D=F["media-library"],C=()=>k($=>!$),T=()=>b($=>!$),x=()=>{b(!1),M($=>!$)},Z=($,Y,j)=>{switch($){case"Link":case"Strikethrough":{xr(Y,$),j();break}case"Code":case"Quote":{sl(Y,$),j();break}case"Bold":case"Italic":case"Underline":{xr(Y,$);break}case"BulletList":case"NumberList":{el(Y,$),j();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{tl(Y,$);break}default:}},W=$=>{const Y=$.map(j=>({alt:j.alternativeText||j.name,url:(0,y.CR)(j.url),mime:j.mime}));nl(g,Y),k(!1)},N=c?m({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",G=s.id?m({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):l;return e.createElement(e.Fragment,null,e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(w.k,{gap:1},e.createElement(H.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},G,u&&e.createElement(pl,{textColor:"danger600"},"*")),a&&e.createElement(ml,{paddingLeft:1},a)),e.createElement(Zn,{isExpandMode:I,error:r,previewContent:p,onCollapse:x},e.createElement(Yi,{isExpandMode:I,editorRef:g,isPreviewMode:E,onActionClick:Z,onToggleMediaLib:C,onTogglePreviewMode:I?void 0:T,disabled:o}),e.createElement(ji,{disabled:o,isExpandMode:I,editorRef:g,error:r,isPreviewMode:E,name:l,onChange:i,placeholder:N,textareaRef:f,value:p}),!I&&e.createElement(Ji,{onToggleExpand:x})),e.createElement(_i,{hint:t,name:l,error:r})),r&&e.createElement(P.x,{paddingTop:1},e.createElement(H.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),v&&e.createElement(D,{onClose:C,onSelectAssets:W}))};Bn.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},Bn.propTypes={hint:n().oneOfType([n().string,n().array]),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,value:n().string};var gl=Bn,Nn=d(10369),fl=d(38705),Wt=d(69932),hl=d(27169),Pr=d(75536),yl=/^[A-Za-z0-9-_.~]*$/,bl=d(63642);const El=(0,S.ZP)(bl.E)`
|
|
705
|
-
svg {
|
|
706
|
-
height: 1rem;
|
|
707
|
-
width: 1rem;
|
|
708
|
-
path {
|
|
709
|
-
fill: ${({theme:t})=>t.colors.neutral400};
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
svg:hover {
|
|
714
|
-
path {
|
|
715
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
`,Fr=(0,S.ZP)(w.k)`
|
|
719
|
-
svg {
|
|
720
|
-
height: ${12/16}rem;
|
|
721
|
-
width: ${12/16}rem;
|
|
722
|
-
|
|
723
|
-
path {
|
|
724
|
-
fill: ${({theme:t,available:o})=>o?t.colors.success600:t.colors.danger600};
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
`,vl=S.F4`
|
|
728
|
-
from {
|
|
729
|
-
transform: rotate(0deg);
|
|
730
|
-
}
|
|
731
|
-
to {
|
|
732
|
-
transform: rotate(359deg);
|
|
733
|
-
}
|
|
734
|
-
`,Cl=(0,S.ZP)(w.k)`
|
|
735
|
-
animation: ${vl} 2s infinite linear;
|
|
736
|
-
`,qn=({attribute:t,contentTypeUID:o,hint:r,disabled:s,error:a,intlLabel:l,labelAction:i,name:c,onChange:p,value:u,placeholder:m,required:f})=>{const{modifiedData:g,initialData:E,layout:b}=(0,y.Wq)(),[v,k]=(0,e.useState)(!1),[I,M]=(0,e.useState)(null),F=(0,Pr.Z)(u,300),D=(0,e.useRef)(),C=(0,y.lm)(),{formatAPIError:T}=(0,y.So)(),x=E[c],{formatMessage:Z}=(0,Q.Z)(),W=b?.options?.timestamps??0,N=!E[W],G=(0,Pr.Z)(g[t.targetField],300),[$,Y]=(0,e.useState)(!1),[j,X]=(0,e.useState)(null),{post:q}=(0,y.kY)(),z=l.id?Z({id:l.id,defaultMessage:l.defaultMessage},{...l.values}):c,R=m?Z({id:m.id,defaultMessage:m.defaultMessage},{...m.values}):"";D.current=async(A=!1)=>{k(!0);try{const{data:{data:oe}}=await q((0,h.IF)("uid/generate"),{contentTypeUID:o,field:c,data:g});p({target:{name:c,value:oe,type:"text"}},A),k(!1)}catch(oe){k(!1),C({type:"warning",message:T(oe)})}};const B=async()=>{if(u){k(!0);try{const{data:A}=await q((0,h.IF)("uid/check-availability"),{contentTypeUID:o,field:c,value:u?u.trim():""});k(!1),M(A)}catch(A){k(!1),C({type:"warning",message:T(A)})}}};(0,e.useEffect)(()=>{!u&&t.required&&D.current(!0)},[t.required,D,u]),(0,e.useEffect)(()=>{F?.trim().match(yl)&&F!==x&&B(),F||M(null)},[x,F]),(0,e.useEffect)(()=>{let A;return I?.isAvailable&&(A=setTimeout(()=>{M(null)},4e3)),()=>{A&&clearTimeout(A)}},[I]),(0,e.useEffect)(()=>{!$&&N&&G&&g[t.targetField]&&!u&&D.current(!0)},[G,$,N]);const V=()=>{X(Z({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},K=()=>{X(null)},O=A=>{A.target.value&&N&&Y(!0),p(A)};return e.createElement(Nn.o,{disabled:s,error:a,endAction:e.createElement(w.k,{position:"relative",gap:1},I&&!j&&e.createElement(Fr,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!I?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},I?.isAvailable?e.createElement(fl.Z,null):e.createElement(Wt.Z,null),e.createElement(H.Z,{textColor:I.isAvailable?"success600":"danger600",variant:"pi"},Z(I.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!s&&e.createElement(e.Fragment,null,j&&e.createElement(Fr,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(H.Z,{textColor:"primary600",variant:"pi"},j)),e.createElement(El,{onClick:()=>D.current(),label:Z({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:V,onMouseLeave:K},v?e.createElement(Cl,{"data-testid":"loading-wrapper"},e.createElement(hl.Z,null)):e.createElement(Qo.Z,null)))),hint:r,label:z,labelAction:i,name:c,onChange:O,placeholder:R,value:u||"",required:f})};qn.propTypes={attribute:n().shape({targetField:n().string,required:n().bool}).isRequired,contentTypeUID:n().string.isRequired,disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,hint:n().oneOfType([n().string,n().array])},qn.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var Rl=qn,Tl=d(88423),jn=d.n(Tl),Tt=d(20108);function Ml(t,o){return r=>{const s=o(r);return e.createElement(t,{...r,...s})}}var Dl=Ml;function kl({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:s,queryInfos:a}){const{isCreatingEntry:l,createActionAllowedFields:i,readActionAllowedFields:c,updateActionAllowedFields:p,slug:u,modifiedData:m}=(0,y.Wq)(),f=(0,e.useMemo)(()=>o===!0?!0:(l?i:p).includes(s),[l,i,s,o,p]),g=(0,e.useMemo)(()=>r?!0:(l?[]:c).includes(s),[l,r,s,c]),E=s.split(".");let b;t&&(b=L()(m,E.slice(0,-1))?.id);const v=(0,e.useMemo)(()=>l?null:t?b?(0,h.IF)(`relations/${t}/${b}/${E.at(-1)}`):null:(0,h.IF)(`relations/${u}/${m.id}/${s.split(".").at(-1)}`),[l,t,u,m.id,s,b,E]),k=(0,e.useMemo)(()=>t?(0,h.IF)(`relations/${t}/${s.split(".").at(-1)}`):(0,h.IF)(`relations/${u}/${s.split(".").at(-1)}`),[t,u,s]);return{componentId:b,isComponentRelation:Boolean(t),queryInfos:{...a,endpoints:{search:k,relation:v}},isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:g}}var Il=kl;function Ol(t,o){return`${(0,h.IF)(`collectionType/${t}/${o??""}`)}`}const Wn=(t,{shouldAddLink:o,mainFieldName:r,targetModel:s})=>{const a={...t};return o&&(a.href=Ol(s,a.id)),a.publicationState=!1,a?.publishedAt!==void 0&&(a.publicationState=a.publishedAt?ge.PUBLISHED:ge.DRAFT),a.mainField=a[r],a},Ll=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:s}={})=>[...t].map(a=>Wn(a,{shouldAddLink:o,mainFieldName:r,targetModel:s})),wl=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:s=[]}=r??{};return{...t,data:s.map(a=>a?.results.map(l=>Wn(l,{mainFieldName:o}))).filter(Boolean).flat()}},xl=(t=[],o=[])=>{const r=t.reduce((a,l)=>o.find(i=>i.id===l.id)?a:[...a,l.id],[]),s=o.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[r,s]},Pl=t=>{const o=e.useRef(t);return e.useEffect(()=>{o.current=t}),e.useMemo(()=>(...r)=>o.current?.(...r),[])},Fl=(t,{relation:o,search:r})=>{const[s,a]=(0,e.useState)({}),[l,i]=(0,e.useState)(0),{get:c}=(0,y.kY)(),p=async({pageParam:C=1})=>{try{const{data:T}=await c(o?.endpoint,{params:{...o.pageParams??{},page:C}});return i(C),T}catch{return null}},u=async({pageParam:C=1})=>{try{const{data:T}=await c(r.endpoint,{params:{...r.pageParams??{},...s,page:C}});return T}catch{return null}},{onLoad:m,normalizeArguments:f={}}=o,g=(0,Tt.useInfiniteQuery)(["relation",...t],p,{cacheTime:0,enabled:o.enabled,getNextPageParam(C){const T=!C?.pagination;if(!(!C||T||C?.pagination.page>=C?.pagination.pageCount))return C.pagination.page+1},select:C=>({...C,pages:C.pages.map(T=>{if(!T)return T;const{data:x,results:Z,pagination:W}=T,N=!!x;let G=[];return N?G=[x]:Z&&(G=[...Z].reverse()),{pagination:W,results:G}})})}),{pageGoal:E}=o,{status:b,data:v,fetchNextPage:k,hasNextPage:I}=g;(0,e.useEffect)(()=>{E>l&&I&&b==="success"&&k({pageParam:l+1})},[E,l,k,I,b]);const M=Pl(m);(0,e.useEffect)(()=>{if(b==="success"&&v&&v.pages?.at(-1)?.results&&M){const C=Ll(v.pages.at(-1).results,f);M(C)}},[b,M,v]);const F=(0,Tt.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(s)],u,{enabled:Object.keys(s).length>0,getNextPageParam(C){if(!(!C?.pagination||C.pagination.page>=C.pagination.pageCount))return C.pagination.page+1}});return{relations:g,search:F,searchFor:(C,T={})=>{a({...T,_q:C})}}},Sr=(t,o)=>r=>{const s=r.split(".");return s.reduce((a,l,i)=>{const c=L()(t,a),p=L()(o,[...s.slice(0,i),l,"__temp_key__"]);if(Array.isArray(c)&&typeof p=="number"){const u=c.findIndex(m=>m.__temp_key__===p);return a.push(u.toString()),a}return a.push(l),a},[])},zn=({error:t,componentId:o,isComponentRelation:r,editable:s,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:p,labelAction:u,mainField:m,name:f,queryInfos:{endpoints:g,defaultParams:E,shouldDisplayRelationLink:b},placeholder:v,required:k,relationType:I,size:M,targetModel:F})=>{const[D,C]=(0,e.useState)(""),{formatMessage:T}=(0,Q.Z)(),{slug:x,initialData:Z,modifiedData:W,relationConnect:N,relationDisconnect:G,relationLoad:$,relationReorder:Y}=(0,y.Wq)(),j=f.split("."),X=Sr(Z,W)(f),q=L()(W,f,[]),z=Math.ceil(L()(Z,f,[]).length/ke),{relations:R,search:B,searchFor:V}=Fl([x,X.join("."),W.id,E],{relation:{enabled:!!g.relation,endpoint:g.relation,pageGoal:z,pageParams:{...E,pageSize:ke},onLoad(re){$({target:{initialDataPath:["initialData",...X],modifiedDataPath:["modifiedData",...j],value:re}})},normalizeArguments:{mainFieldName:m.name,shouldAddLink:b,targetModel:F}},search:{endpoint:g.search,pageParams:{...E,entityId:i?void 0:r?o:Z.id,pageSize:Fe}}}),K=(0,e.useMemo)(()=>I.toLowerCase().includes("morph"),[I]),O=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(I),A=(0,e.useMemo)(()=>K?!0:i?!s:!c&&p||!s,[K,i,s,c,p]),oe=re=>{const Ce=Wn(re,{mainFieldName:m.name,shouldAddLink:b,targetModel:F});N({name:f,value:Ce,toOneRelation:O})},ee=re=>{G({name:f,id:re.id})},ae=()=>{R.fetchNextPage()},U=(re="")=>{const[Ce,Je]=xl(q,L()(Z,f));V(re,{idsToInclude:Je,idsToOmit:Ce})},ie=()=>{B.fetchNextPage()},$e=re=>`${re+1} of ${q.length}`,dt=(re,Ce)=>{const Je=q[re];C(T({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:Je.mainField??Je.id,position:$e(Ce)})),Y({name:f,newIndex:Ce,oldIndex:re})},Yt=re=>{const Ce=q[re];C(T({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:Ce.mainField??Ce.id,position:$e(re)}))},Xt=re=>{const Ce=q[re];C(T({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:Ce.mainField??Ce.id,position:$e(re)}))},Jt=re=>{const Ce=q[re];C(T({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:Ce.mainField??Ce.id}))};if(!c&&i||!i&&!c&&!p)return e.createElement(y.X0,{name:f,intlLabel:l,labelAction:u});const Ve=q.length,Xe=(L()(Z,X)??[]).length,_t=R.data?.pages[0]?.pagination?.total??0,bt=!R.data&&Ve===Xe?Ve:Ve-Xe+_t;return e.createElement(Fa,{error:t,canReorder:!O,description:a,disabled:A,iconButtonAriaLabel:T({id:(0,h.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:f,label:`${T({id:l.id,defaultMessage:l.defaultMessage})} ${bt>0?`(${bt})`:""}`,labelAction:u,labelLoadMore:i?null:T({id:(0,h.OB)("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:T({id:(0,h.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:T({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:D,loadingMessage:T({id:(0,h.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:f,noRelationsMessage:T({id:(0,h.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:ke,onDropItem:Xt,onGrabItem:Yt,onCancel:Jt,onRelationConnect:oe,onRelationDisconnect:ee,onRelationLoadMore:ae,onRelationReorder:dt,onSearch:re=>U(re),onSearchNextPage:()=>ie(),placeholder:T(v||{id:(0,h.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[ge.DRAFT]:T({id:(0,h.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ge.PUBLISHED]:T({id:(0,h.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:jn()({...R,data:q},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:k,searchResults:wl(B,{mainFieldName:m.name}),size:M})};zn.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},zn.propTypes={componentId:n().number,editable:n().bool,error:n().string,description:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,isCreatingEntry:n().bool.isRequired,isComponentRelation:n().bool,isFieldAllowed:n().bool,isFieldReadable:n().bool.isRequired,mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired}).isRequired,name:n().string.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,relationType:n().string.isRequired,size:n().number.isRequired,targetModel:n().string.isRequired,queryInfos:n().shape({defaultParams:n().shape({locale:n().string}),endpoints:n().shape({relation:n().string,search:n().string.isRequired}).isRequired,shouldDisplayRelationLink:n().bool.isRequired}).isRequired};const Sl=(0,e.memo)(zn);var Al=Dl(Sl,Il);function $l(t,o){return r=>{const s=o(r.keys);return e.createElement(t,{...r,...s})}}var Zl=$l,Bl=(t,o=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:o,hidden:o},key:"__enum_option_null",value:""},...t.map(r=>({metadatas:{intlLabel:{id:r,defaultMessage:r},hidden:!1,disabled:!1},key:r,value:r}))],Nl=d(59578),ql=d.n(Nl),jl=(t="")=>{switch(ql()(t)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return t;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return t||"text"}},Wl=t=>{let o;return t==="float"||t==="decimal"?o=.01:o=1,o};function zl(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:p}=(0,y.Wq)(),u=(0,e.useMemo)(()=>s?o:p,[s,o,p]),m=(0,e.useMemo)(()=>s?[]:i,[s,i]),f=L()(a,t,null);return{allowedFields:u,formErrors:r,isCreatingEntry:s,onChange:l,readableFields:m,shouldNotRunValidations:c,value:f}}var Ul=zl,Ar=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function Un({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:s,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:p,readableFields:u,shouldNotRunValidations:m,queryInfos:f,value:g,size:E,customFieldInputs:b}){const{fields:v}=(0,y.yX)(),{formatMessage:k}=(0,Q.Z)(),{contentType:I}=gt(),M=(0,e.useMemo)(()=>!L()(c,"editable",!0),[c]),{type:F,customField:D}=r,C=L()(s,[l],null),T=(0,e.useMemo)(()=>(0,h.Ts)(l),[l]),x=(0,e.useMemo)(()=>{const oe=si()(r,m?[...Ar,"required","minLength"]:Ar),ee=r.regex||null;if(ee){const ae=new RegExp(ee);ae&&(oe.regex=ae)}return oe},[r,m]),Z=(0,e.useMemo)(()=>L()(x,["required"],!1),[x]),W=(0,e.useMemo)(()=>{const oe=L()(I,["attributes"],{});return L()(oe,[T[0],"type"],null)==="dynamiczone"},[I,T]),N=(0,e.useMemo)(()=>jl(F),[F]),G=(0,e.useMemo)(()=>F==="media"&&!g?[]:g,[F,g]),$=(0,e.useMemo)(()=>Wl(F),[F]),Y=(0,e.useMemo)(()=>{const oe=T.join(".");if(t.includes(oe))return!0;if(W)return t.includes(T[0]);if(T.length>1){const ae=jt()(T,T.length-1).join(".");return t.includes(ae)}return!1},[t,T,W]),j=(0,e.useMemo)(()=>{const oe=T.join(".");if(u.includes(oe))return!0;if(W)return u.includes(T[0]);if(T.length>1){const ae=jt()(T,T.length-1).join(".");return u.includes(ae)}return!1},[u,T,W]),X=(0,e.useMemo)(()=>j||Y,[Y,j]),q=(0,e.useMemo)(()=>a?M:j&&!Y?!0:M,[M,a,Y,j]),z=(0,e.useMemo)(()=>Bl(r.enum||[],Z),[r,Z]),{label:R,description:B,placeholder:V,visible:K}=c,O=(0,e.useMemo)(()=>{if(!c.step||N!=="datetime"&&N!=="time")return $;if(!G)return c.step;let oe;return N==="datetime"?oe=parseInt(G.substr(14,2),10):N==="time"&&(oe=parseInt(G.slice(-2),10)),oe%c.step===0?c.step:$},[N,G,c.step,$]);if(K===!1)return null;if(!X)return e.createElement(y.X0,{description:B?{id:B,defaultMessage:B}:null,intlLabel:{id:R,defaultMessage:R},labelAction:i,error:C&&k(C),name:l,required:Z});if(F==="relation")return e.createElement(Al,{...c,...r,componentUid:o,description:c.description?k({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:Y,isUserAllowedToReadField:j,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:f,size:E,value:g,error:C&&k(C)});const A={uid:Rl,media:v.media,wysiwyg:gl,...v,...b};return e.createElement(y.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:R,defaultMessage:R},isNullable:N==="bool"&&[null,void 0].includes(r.default),description:B?{id:B,defaultMessage:B}:null,disabled:q,error:C,labelAction:i,contentTypeUID:I.uid,customInputs:A,multiple:r.multiple||!1,name:l,onChange:p,options:z,placeholder:V?{id:V,defaultMessage:V}:null,required:r.required||!1,step:O,type:D||N,value:G,withDefaultValue:!1})}Un.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},Un.propTypes={allowedFields:n().array.isRequired,componentUid:n().string,fieldSchema:n().object.isRequired,formErrors:n().object,keys:n().string.isRequired,isCreatingEntry:n().bool.isRequired,labelAction:n().element,metadatas:n().object.isRequired,onChange:n().func.isRequired,readableFields:n().array.isRequired,size:n().number,shouldNotRunValidations:n().bool.isRequired,value:n().any,queryInfos:n().shape({containsKey:n().string,defaultParams:n().object,endPoint:n().string}),customFieldInputs:n().object};const Vl=(0,e.memo)(Un,ft());var Vn=Zl(Vl,Ul);const zt=new Map;var Hn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(zt)),s=t.filter(p=>!zt.get(p)),[a,l]=(0,e.useState)(()=>!!s.length),i=(0,y.mZ)();(0,e.useEffect)(()=>{const p=m=>{r(m),l(!1)},u=async(m,f)=>{const g=await Promise.all(f);m.forEach((E,b)=>{zt.set(E,g[b].default)}),p(Object.fromEntries(zt))};if(s.length>0){l(!0);const m=s.map(f=>i.get(f).components.Input());m.length>0&&u(s,m)}},[s,i]);const c=(0,e.useCallback)(()=>{zt.clear(),r({})},[]);return{isLazyLoading:a,lazyComponentStore:o,cleanup:c}};const Qn=({componentUid:t,isFromDynamicZone:o,isNested:r,name:s})=>{const{getComponentLayout:a}=gt(),i=(0,e.useMemo)(()=>a(t),[t,a]).layouts.edit,{lazyComponentStore:c}=Hn();return e.createElement(P.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:6},i.map((p,u)=>e.createElement(Ye.r,{gap:4,key:u},p.map(({name:m,size:f,metadatas:g,fieldSchema:E,queryInfos:b})=>{const v=E.type==="component",k=`${s}.${m}`;if(v){const I=E.component;return e.createElement(Le.P,{col:f,s:12,xs:12,key:m},e.createElement(sn,{componentUid:I,intlLabel:{id:g.label,defaultMessage:g.label},isNested:!0,isRepeatable:E.repeatable,max:E.max,min:E.min,name:k,required:E.required||!1}))}return e.createElement(Le.P,{col:f,key:m,s:12,xs:12},e.createElement(Vn,{componentUid:t,keys:k,fieldSchema:E,metadatas:g,queryInfos:b,size:f,customFieldInputs:c}))})))))};Qn.defaultProps={isFromDynamicZone:!1,isNested:!1},Qn.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var Hl=Qn,Ut=d(19406),Ql=d(41119),$r=d.n(Ql);const Gl=S.ZP.span`
|
|
737
|
-
display: block;
|
|
738
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
739
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
740
|
-
outline-offset: -1px;
|
|
741
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
742
|
-
`;var Kl=()=>e.createElement(Gl,{padding:6,background:"primary100"});const Yl=(0,S.ZP)(be.h)`
|
|
743
|
-
background-color: transparent;
|
|
744
|
-
|
|
745
|
-
svg {
|
|
746
|
-
path {
|
|
747
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
&:hover {
|
|
752
|
-
svg {
|
|
753
|
-
path {
|
|
754
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
`,Xl=(0,S.ZP)(w.k)`
|
|
759
|
-
& .drag-handle {
|
|
760
|
-
background: unset;
|
|
761
|
-
|
|
762
|
-
svg {
|
|
763
|
-
path {
|
|
764
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:void 0};
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
&:hover {
|
|
769
|
-
svg {
|
|
770
|
-
path {
|
|
771
|
-
/* keeps the hover style of the accordion */
|
|
772
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
`,Gn=({componentFieldName:t,componentUid:o,fields:r,index:s,isOpen:a,isReadOnly:l,mainField:i,moveComponentField:c,onClickToggle:p,toggleCollapses:u,onGrabItem:m,onDropItem:f,onCancel:g})=>{const{modifiedData:E,removeRepeatableField:b,triggerFormValidation:v}=(0,y.Wq)(),k=$r()(L()(E,[...t.split("."),i],"")),I=(0,e.useRef)(null),{formatMessage:M}=(0,Q.Z)(),F=t.split(".").slice(0,-1).join("."),[{handlerId:D,isDragging:C,handleKeyDown:T},x,Z,W,N]=Ke(!l,{type:`${h._Q.COMPONENT}_${F}`,index:s,item:{displayedValue:k},onMoveItem:c,onStart(){u()},onEnd(){v()},onGrabItem:m,onDropItem:f,onCancel:g});(0,e.useEffect)(()=>{N((0,Ge.rX)(),{captureDraggingState:!1})},[N,s]);const G=(0,h.FE)(I,W),$=(0,h.FE)(x,Z),{lazyComponentStore:Y}=Hn();return e.createElement(P.x,{ref:$},C?e.createElement(Kl,null):e.createElement(Mn.U,{expanded:a,onToggle:p,id:t,size:"S"},e.createElement(Dn.B,{action:l?null:e.createElement(Xl,{gap:0,expanded:a},e.createElement(Yl,{expanded:a,noBorder:!0,onClick:()=>{b(t),u()},label:M({id:(0,h.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(Se.Z,null)}),e.createElement(be.h,{className:"drag-handle",ref:G,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:j=>j.stopPropagation(),"data-handler-id":D,label:M({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:T},e.createElement(de.Z,null))),title:k,togglePosition:"left"}),e.createElement(kn.v,null,e.createElement(w.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((j,X)=>e.createElement(Ye.r,{gap:4,key:X},j.map(({name:q,fieldSchema:z,metadatas:R,queryInfos:B,size:V})=>{const K=z.type==="component",O=`${t}.${q}`;if(K){const A=z.component;return e.createElement(Le.P,{col:V,s:12,xs:12,key:q},e.createElement(sn,{componentUid:A,intlLabel:{id:R.label,defaultMessage:R.label},isRepeatable:z.repeatable,isNested:!0,name:O,max:z.max,min:z.min,required:z.required}))}return e.createElement(Le.P,{key:O,col:V,s:12,xs:12},e.createElement(Vn,{componentUid:o,fieldSchema:z,keys:O,metadatas:R,queryInfos:B,size:V,customFieldInputs:Y}))})))))))};Gn.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},Gn.propTypes={componentFieldName:n().string.isRequired,componentUid:n().string,fields:n().array,index:n().number.isRequired,isOpen:n().bool,isReadOnly:n().bool,mainField:n().string.isRequired,moveComponentField:n().func.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onClickToggle:n().func.isRequired,toggleCollapses:n().func};var Jl=(0,e.memo)(Gn),Zr=d(861);const _l=(0,S.ZP)(P.x)`
|
|
778
|
-
overflow: hidden;
|
|
779
|
-
border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
780
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
781
|
-
border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
782
|
-
border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
|
|
783
|
-
`,ec=(0,S.ZP)(P.x)`
|
|
784
|
-
border-bottom: none;
|
|
785
|
-
|
|
786
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
|
787
|
-
& > div > div {
|
|
788
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
789
|
-
border-top-color: transparent;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/* the top accordion _does_ need a border though */
|
|
793
|
-
& > div:first-child > div {
|
|
794
|
-
border-top: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
/* Reset all the border-radius' */
|
|
798
|
-
& > div > div,
|
|
799
|
-
& > div > div > div {
|
|
800
|
-
border-radius: unset;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
/* Give the border radius back to the first accordion */
|
|
804
|
-
& > div:first-child > div,
|
|
805
|
-
& > div:first-child > div > div {
|
|
806
|
-
border-radius: ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius} 0 0;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
& > div > div[data-strapi-expanded='true'] {
|
|
810
|
-
border: 1px solid ${({theme:t})=>t.colors.primary600};
|
|
811
|
-
}
|
|
812
|
-
`,Kn=({children:t,error:o})=>{const{formatMessage:r}=(0,Q.Z)();return e.createElement(Zr.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(P.x,{paddingTop:1},e.createElement(H.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};Kn.defaultProps={error:void 0},Kn.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};function tc(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const nc=(0,S.ZP)(Ho.A)`
|
|
813
|
-
height: 100%;
|
|
814
|
-
width: 100%;
|
|
815
|
-
border-radius: 0 0 4px 4px;
|
|
816
|
-
display: flex;
|
|
817
|
-
justify-content: center;
|
|
818
|
-
span {
|
|
819
|
-
font-weight: 600;
|
|
820
|
-
font-size: 14px;
|
|
821
|
-
}
|
|
822
|
-
`,Yn=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:s,max:a,min:l,name:i})=>{const{addRepeatableComponentToField:c,formErrors:p,moveComponentField:u}=(0,y.Wq)(),m=(0,y.lm)(),{formatMessage:f}=(0,Q.Z)(),[g,E]=(0,e.useState)(""),[b,v]=(0,e.useState)(""),{getComponentLayout:k,components:I}=gt(),M=(0,e.useMemo)(()=>k(t),[t,k]),F=(0,e.useMemo)(()=>(0,h.Uo)(o||[])+1,[o]),D=tc(i,p),C=l-r,T=L()(p,i,{id:""}).id.includes("min"),x=()=>{E("")},Z=()=>{s||(r<a?(c(i,M,I,T),E(F)):r>=a&&m({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}}))},W=(R,B)=>{v(f({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${B}`,position:$(R)})),u({name:i,newIndex:R,currentIndex:B})},N=L()(M,["settings","mainField"],"id"),G=R=>()=>{E(g===R?"":R)},$=R=>`${R+1} of ${r}`,Y=R=>{v(f({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${R}`}))},j=R=>{v(f({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${i}.${R}`,position:$(R)}))},X=R=>{v(f({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${R}`,position:$(R)}))};let q=p[i];if(T?q={id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:C}}:D.some(R=>R.split(".").length>1)&&!T&&(q={id:(0,h.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(yr,{error:q,isReadOnly:s,onClick:Z});const z=`${i}-item-instructions`;return e.createElement(P.x,{hasRadius:!0},e.createElement(Lt.T,{id:z},f({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(Lt.T,{"aria-live":"assertive"},b),e.createElement(Kn,{error:q,ariaDescribedBy:z},e.createElement(ec,{"aria-describedby":z},o.map(({__temp_key__:R},B)=>e.createElement(Jl,{componentFieldName:`${i}.${B}`,componentUid:t,fields:M.layouts.edit,key:R,index:B,isOpen:g===R,isReadOnly:s,mainField:N,moveComponentField:W,onClickToggle:G(R),toggleCollapses:x,onCancel:Y,onDropItem:X,onGrabItem:j}))),e.createElement(_l,null,e.createElement(w.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(nc,{disabled:s,onClick:Z,startIcon:e.createElement(Ut.Z,null)},f({id:(0,h.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};Yn.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},Yn.propTypes={componentUid:n().string.isRequired,componentValue:n().oneOfType([n().array,n().object]),componentValueLength:n().number,isReadOnly:n().bool,max:n().number,min:n().number,name:n().string.isRequired};var oc=(0,e.memo)(Yn);const Xn=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:p,min:u,name:m,hasChildrenAllowedFields:f,hasChildrenReadableFields:g,isReadOnly:E,componentValue:b,removeComponentFromField:v,required:k})=>{const{formatMessage:I}=(0,Q.Z)(),M=Ka()(b),F=b!==null||a,D=!l&&F&&!a&&f,{getComponentLayout:C,components:T}=gt(),x=(0,e.useMemo)(()=>C(o),[o,C]);if(!f&&s)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:m});if(!f&&!s&&!g)return e.createElement(y.X0,{labelAction:c,intlLabel:r,name:m});const Z=()=>{t(m,x,T)};return e.createElement(P.x,null,e.createElement(w.k,{justifyContent:"space-between"},r&&e.createElement(ni,{intlLabel:r,labelAction:c,name:m,numberOfEntries:M,showNumberOfEntries:l,required:k}),D&&e.createElement(be.h,{label:I({id:(0,h.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(Se.Z,null),noBorder:!0,onClick:()=>{v(m,o)}})),e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:1},!l&&!F&&e.createElement(yr,{isReadOnly:E,onClick:Z}),!l&&F&&e.createElement(Hl,{componentUid:o,isFromDynamicZone:a,isNested:i,name:m}),l&&e.createElement(oc,{componentValue:b,componentValueLength:M,componentUid:o,isReadOnly:E,max:p,min:u,name:m})))};Xn.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Xn.propTypes={addNonRepeatableComponentToField:n().func.isRequired,componentUid:n().string.isRequired,componentValue:n().oneOfType([n().object,n().array]),hasChildrenAllowedFields:n().bool,hasChildrenReadableFields:n().bool,isCreatingEntry:n().bool.isRequired,isFromDynamicZone:n().bool,isReadOnly:n().bool,isRepeatable:n().bool,isNested:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),labelAction:n().element,max:n().number,min:n().number,name:n().string.isRequired,removeComponentFromField:n().func.isRequired,required:n().bool};const rc=(0,e.memo)(Xn,ft());var sn=Xa(rc,ei);const sc=(0,S.ZP)(w.k)`
|
|
823
|
-
/*
|
|
824
|
-
we need to remove the background from the button but we can't
|
|
825
|
-
wrap the element in styled because it breaks the forwardedAs which
|
|
826
|
-
we need for drag handler to work on firefox
|
|
827
|
-
*/
|
|
828
|
-
div[role='button'] {
|
|
829
|
-
background: transparent;
|
|
830
|
-
}
|
|
831
|
-
`,ac=(0,S.ZP)(be.h)`
|
|
832
|
-
background-color: transparent;
|
|
833
|
-
|
|
834
|
-
svg path {
|
|
835
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
|
|
836
|
-
}
|
|
837
|
-
`,ic=(0,S.ZP)(P.x)`
|
|
838
|
-
> div:first-child {
|
|
839
|
-
box-shadow: ${({theme:t})=>t.shadows.tableShadow};
|
|
840
|
-
}
|
|
841
|
-
`,lc=(0,S.ZP)(P.x)`
|
|
842
|
-
border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
|
|
843
|
-
`,cc=(0,S.ZP)(P.x)`
|
|
844
|
-
width: ${({theme:t})=>t.spaces[2]};
|
|
845
|
-
height: ${({theme:t})=>t.spaces[4]};
|
|
846
|
-
`,dc=S.ZP.span`
|
|
847
|
-
display: block;
|
|
848
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
849
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
850
|
-
outline-offset: -1px;
|
|
851
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
852
|
-
`,uc=(0,S.ZP)(P.x)`
|
|
853
|
-
list-style: none;
|
|
854
|
-
padding: 0;
|
|
855
|
-
margin: 0;
|
|
856
|
-
`,Jn=({componentUid:t,formErrors:o,index:r,isFieldAllowed:s,name:a,onRemoveComponentClick:l,onMoveComponent:i,onGrabItem:c,onDropItem:p,onCancel:u})=>{const[m,f]=(0,e.useState)(!0),{formatMessage:g}=(0,Q.Z)(),{getComponentLayout:E}=gt(),{modifiedData:b}=(0,y.Wq)(),{icon:v,friendlyName:k,mainValue:I}=(0,e.useMemo)(()=>{const j=E(t),{info:{icon:X,displayName:q}}=j,z=L()(j,["settings","mainField"],"id"),R=L()(b,[a,r,z])??"",B=z==="id"?"":String(R).trim(),V=B.length>0?` - ${B}`:B;return{friendlyName:q,icon:X,mainValue:V}},[t,E,b,a,r]),M=Object.keys(o).filter(j=>{const X=j.split(".");return`${X[0]}.${X[1]}`==`${a}.${r}`});let F;M.length>0&&(F=g({id:(0,h.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const D=()=>{f(j=>!j)},[{handlerId:C,isDragging:T,handleKeyDown:x},Z,W,N,G]=Ke(s,{type:`${h._Q.DYNAMIC_ZONE}_${a}`,index:r,item:{displayedValue:`${k}${I}`,icon:v},onMoveItem:i,onGrabItem:c,onDropItem:p,onCancel:u});(0,e.useEffect)(()=>{G((0,Ge.rX)(),{captureDraggingState:!1})},[G,r]);const $=(0,h.FE)(Z,W),Y=s?e.createElement(sc,{gap:0,expanded:m},e.createElement(ac,{noBorder:!0,label:g({id:(0,h.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:k}),onClick:l},e.createElement(Se.Z,null)),e.createElement(be.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:j=>j.stopPropagation(),"data-handler-id":C,ref:N,label:g({id:(0,h.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:x},e.createElement(de.Z,null))):null;return e.createElement(uc,{as:"li"},e.createElement(w.k,{justifyContent:"center"},e.createElement(cc,{background:"neutral200"})),e.createElement(ic,{ref:$,hasRadius:!0},T?e.createElement(dc,{padding:6,background:"primary100"}):e.createElement(Mn.U,{expanded:m,onToggle:D,size:"S",error:F},e.createElement(Dn.B,{action:Y,title:`${k}${I}`,togglePosition:"left"}),e.createElement(kn.v,null,e.createElement(lc,{background:"neutral0"},e.createElement(sn,{componentUid:t,icon:v,name:`${a}.${r}`,isFromDynamicZone:!0}))))))};Jn.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Jn.propTypes={componentUid:n().string.isRequired,formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};var mc=Jn;const _n=(0,S.ZP)(hr.Z)`
|
|
857
|
-
transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
|
|
858
|
-
> circle {
|
|
859
|
-
fill: ${({theme:t,$hasError:o})=>o?t.colors.danger200:t.colors.neutral150};
|
|
860
|
-
}
|
|
861
|
-
> path {
|
|
862
|
-
fill: ${({theme:t,$hasError:o})=>o?t.colors.danger600:t.colors.neutral600};
|
|
863
|
-
}
|
|
864
|
-
`,pc=(0,S.ZP)(Pn.Y)`
|
|
865
|
-
border-radius: 26px;
|
|
866
|
-
border-color: ${({theme:t})=>t.colors.neutral150};
|
|
867
|
-
background: ${({theme:t})=>t.colors.neutral0};
|
|
868
|
-
padding-top: ${({theme:t})=>t.spaces[3]};
|
|
869
|
-
padding-right: ${({theme:t})=>t.spaces[4]};
|
|
870
|
-
padding-bottom: ${({theme:t})=>t.spaces[3]};
|
|
871
|
-
padding-left: ${({theme:t})=>t.spaces[4]};
|
|
872
|
-
|
|
873
|
-
box-shadow: ${({theme:t})=>t.shadows.filterShadow};
|
|
874
|
-
|
|
875
|
-
svg {
|
|
876
|
-
height: ${({theme:t})=>t.spaces[6]};
|
|
877
|
-
width: ${({theme:t})=>t.spaces[6]};
|
|
878
|
-
> path {
|
|
879
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
&:hover {
|
|
883
|
-
color: ${({theme:t})=>t.colors.primary600} !important;
|
|
884
|
-
${H.Z} {
|
|
885
|
-
color: ${({theme:t})=>t.colors.primary600} !important;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
${_n} {
|
|
889
|
-
> circle {
|
|
890
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
891
|
-
}
|
|
892
|
-
> path {
|
|
893
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
&:active {
|
|
898
|
-
${H.Z} {
|
|
899
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
900
|
-
}
|
|
901
|
-
${_n} {
|
|
902
|
-
> circle {
|
|
903
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
904
|
-
}
|
|
905
|
-
> path {
|
|
906
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
`,gc=(0,S.ZP)(P.x)`
|
|
911
|
-
height: 100%;
|
|
912
|
-
`,eo=({hasError:t,hasMaxError:o,hasMinError:r,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:p})=>{const{formatMessage:u}=(0,Q.Z)(),m=u({id:(0,h.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),f=u({id:"app.utils.close-label",defaultMessage:"Close"});let g=a?f:m;return o&&!a&&(g=u({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),r&&!a&&(g=u({id:(0,h.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),e.createElement(w.k,{justifyContent:"center"},e.createElement(P.x,{style:{cursor:s?"not-allowed":"pointer"}},e.createElement(pc,{type:"button",onClick:p,disabled:s,hasError:t},e.createElement(w.k,null,e.createElement(gc,{"aria-hidden":!0,paddingRight:2},e.createElement(_n,{$isOpen:a,$hasError:t&&!a})),e.createElement(H.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!a?"danger600":"neutral500"},g)))))};eo.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},eo.propTypes={label:n().string,hasError:n().bool,hasMaxError:n().bool,hasMinError:n().bool,isDisabled:n().bool,isOpen:n().bool,missingComponentNumber:n().number,name:n().string.isRequired,onClick:n().func.isRequired};var fc=eo;const hc=(0,S.ZP)(P.x)`
|
|
913
|
-
border-radius: ${(0,y.Q1)(26)};
|
|
914
|
-
`,to=({label:t,labelAction:o,name:r,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,Q.Z)(),c=i({id:t||r,defaultMessage:t||r});return e.createElement(w.k,{justifyContent:"center"},e.createElement(P.x,null,e.createElement(hc,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(w.k,{direction:"column",justifyContent:"center"},e.createElement(w.k,{maxWidth:(0,y.Q1)(356)},e.createElement(H.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),e.createElement(H.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&e.createElement(H.Z,{textColor:"danger600"},"*"),o&&e.createElement(P.x,{paddingLeft:1},o)),l&&e.createElement(P.x,{paddingTop:1,maxWidth:(0,y.Q1)(356)},e.createElement(H.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};to.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},to.propTypes={intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),label:n().string,labelAction:n().element,name:n().string.isRequired,numberOfComponents:n().number,required:n().bool};var yc=to,bc=d(81346),Br=d.n(bc);const an=5,ln=8,Ec=(0,S.ZP)(w.k)`
|
|
915
|
-
border-radius: ${({showBackground:t})=>t?"50%":0};
|
|
916
|
-
color: ${({theme:t})=>t.colors.neutral600};
|
|
917
|
-
height: ${({theme:t,size:o})=>t.spaces[o==="S"?an:ln]};
|
|
918
|
-
width: ${({theme:t,size:o})=>t.spaces[o==="S"?an:ln]};
|
|
919
|
-
|
|
920
|
-
svg {
|
|
921
|
-
height: ${({theme:t,size:o})=>t.spaces[o==="S"?an-2:ln-3]};
|
|
922
|
-
width: ${({theme:t,size:o})=>t.spaces[o==="S"?an-2:ln-3]};
|
|
923
|
-
}
|
|
924
|
-
`;function cn({showBackground:t=!0,size:o="M"}){return e.createElement(Ec,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e.createElement("path",{d:"M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z",fill:"currentColor"})))}cn.defaultProps={showBackground:!0,size:"M"},cn.propTypes={showBackground:n().bool,size:n().string};const vc=(0,S.ZP)(P.x)`
|
|
925
|
-
flex-shrink: 0;
|
|
926
|
-
height: ${(0,y.Q1)(84)};
|
|
927
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
928
|
-
background: ${({theme:t})=>t.colors.neutral100};
|
|
929
|
-
border-radius: ${({theme:t})=>t.borderRadius};
|
|
930
|
-
display: flex;
|
|
931
|
-
justify-content: center;
|
|
932
|
-
align-items: center;
|
|
933
|
-
|
|
934
|
-
&:focus,
|
|
935
|
-
&:hover {
|
|
936
|
-
border: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
937
|
-
background: ${({theme:t})=>t.colors.primary100};
|
|
938
|
-
|
|
939
|
-
${H.Z} {
|
|
940
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
/* > Flex > ComponentIcon */
|
|
944
|
-
> div > div:first-child {
|
|
945
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
946
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
`;function no({children:t,onClick:o}){return e.createElement(vc,{as:"button",type:"button",onClick:o,hasRadius:!0},e.createElement(w.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(cn,null),e.createElement(H.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},t)))}no.defaultProps={onClick(){}},no.propTypes={children:n().node.isRequired,onClick:n().func};const Cc=S.ZP.div`
|
|
950
|
-
display: grid;
|
|
951
|
-
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
952
|
-
grid-gap: ${({theme:t})=>t.spaces[1]};
|
|
953
|
-
`,oo=({category:t,components:o,variant:r,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,Q.Z)(),c=()=>{l(t)};return e.createElement(Mn.U,{expanded:s,onToggle:c,size:"S"},e.createElement(Dn.B,{variant:r,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(kn.v,null,e.createElement(P.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(Cc,null,o.map(({componentUid:p,info:{displayName:u}})=>e.createElement(no,{key:p,onClick:a(p)},i({id:u,defaultMessage:u})))))))};oo.defaultProps={components:[],isOpen:!1,variant:"primary"},oo.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};var Rc=oo;const ro=({components:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:s}=(0,Q.Z)(),{getComponentLayout:a}=gt(),[l,i]=(0,e.useState)(""),c=(0,e.useMemo)(()=>{const m=t.map(g=>{const{category:E,info:b}=a(g);return{componentUid:g,category:E,info:b}}),f=Br()(m,"category");return Object.keys(f).reduce((g,E)=>(g.push({category:E,components:f[E]}),g),[])},[t,a]);(0,e.useEffect)(()=>{o&&c.length>0&&i(c[0].category)},[o,c]);const p=m=>()=>{r(m),i("")},u=m=>{i(f=>f===m?"":m)};return o?e.createElement(P.x,{paddingBottom:6},e.createElement(P.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(w.k,{justifyContent:"center"},e.createElement(H.Z,{fontWeight:"bold",textColor:"neutral600"},s({id:(0,h.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(P.x,{paddingTop:2},e.createElement(Zr.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:m,components:f},g)=>e.createElement(Rc,{key:m,category:m,components:f,onAddComponent:p,isOpen:m===l,onToggle:u,variant:g%2===1?"primary":"secondary"})))))):null};ro.defaultProps={components:[],isOpen:!1},ro.propTypes={components:n().array,isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Tc=ro;const so=({name:t,addComponentToDynamicZone:o,formErrors:r,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentField:c,removeComponentFromDynamicZone:p,dynamicDisplayedComponents:u,fieldSchema:m,metadatas:f})=>{const[g,E]=(0,e.useState)(!1),[b,v]=(0,e.useState)(""),{formatMessage:k}=(0,Q.Z)(),I=(0,y.lm)(),{getComponentLayout:M,components:F}=gt(),D=u.length,C=f.description?{id:f.description,defaultMessage:f.description}:null,{max:T=1/0,min:x=-1/0}=m,Z=(0,e.useMemo)(()=>Object.keys(r).filter(O=>O===t).map(O=>r[O]),[r,t]),W=x-D,N=Z.length>0,G=Z.length>0&&L()(Z,[0,"id"],"").includes("min"),$=N&&L()(Z,[0,"id"],"")==="components.Input.error.validation.max",Y=O=>{E(!1);const A=M(O);o(t,A,F,N)},j=()=>{D<T?E(O=>!O):I({type:"info",message:{id:(0,h.OB)("components.notification.info.maximum-requirement")}})},X=(O,A)=>{v(k({id:(0,h.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${A}`,position:q(O)})),c({name:t,newIndex:O,currentIndex:A})},q=O=>`${O+1} of ${u.length}`,z=O=>{v(k({id:(0,h.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${O}`}))},R=O=>{v(k({id:(0,h.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${t}.${O}`,position:q(O)}))},B=O=>{v(k({id:(0,h.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${O}`,position:q(O)}))},V=(O,A)=>()=>{p(O,A)};if(!a&&(s||!l&&!s))return e.createElement(y.X0,{description:C,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:t});const K=`${t}-item-instructions`;return e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:6},D>0&&e.createElement(P.x,null,e.createElement(yc,{intlDescription:C,label:f.label,labelAction:i,name:t,numberOfComponents:D,required:m.required||!1}),e.createElement(Lt.T,{id:K},k({id:(0,h.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(Lt.T,{"aria-live":"assertive"},b),e.createElement("ol",{"aria-describedby":K},u.map(({componentUid:O,id:A},oe)=>e.createElement(mc,{componentUid:O,formErrors:r,key:`${O}-${A}`,index:oe,isFieldAllowed:a,name:t,onMoveComponent:X,onRemoveComponentClick:V(t,oe),onCancel:z,onDropItem:B,onGrabItem:R})))),e.createElement(fc,{hasError:N,hasMaxError:$,hasMinError:G,isDisabled:!a,label:f.label,missingComponentNumber:W,isOpen:g,name:t,onClick:j}),e.createElement(Tc,{isOpen:g,components:m.components??[],onClickAddComponent:Y}))};so.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},so.propTypes={addComponentToDynamicZone:n().func.isRequired,dynamicDisplayedComponents:n().arrayOf(n().shape({componentUid:n().string.isRequired,id:n().number.isRequired})),fieldSchema:n().shape({components:n().array.isRequired,max:n().number,min:n().number,required:n().bool}),formErrors:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isFieldAllowed:n().bool.isRequired,isFieldReadable:n().bool.isRequired,labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,moveComponentField:n().func.isRequired,name:n().string.isRequired,removeComponentFromDynamicZone:n().func.isRequired};const Mc=(0,e.memo)(so,ft());var Dc=Va(Mc,Qa),ht=d(41578);const dn=()=>({type:ht.ZA}),ao=t=>({type:ht.Id,data:t}),io=(t,o=!1)=>({type:ht.TP,rawQuery:t,isSingleType:o}),Nr=()=>({type:ht.c2}),qr=(t,o)=>({type:ht.w7,componentsDataStructure:t,contentTypeDataStructure:o}),fe=t=>({type:ht.d0,status:t}),yt=t=>({type:ht.t9,data:t}),kc=()=>({type:ht.tE});var lo=t=>t["content-manager_editViewCrudReducer"];const co=({allLayoutData:t,children:o,slug:r,id:s,origin:a})=>{const l=(0,Tt.useQueryClient)(),i=(0,y.lm)(),{setCurrentStep:c}=(0,y.c1)(),{trackUsage:p}=(0,y.rS)(),{push:u,replace:m}=(0,J.k6)(),[{rawQuery:f}]=(0,y.Kx)(),g=(0,me.I0)(),{componentsDataStructure:E,contentTypeDataStructure:b,data:v,isLoading:k,status:I}=(0,me.v9)(lo),M=or(r),{formatAPIError:F}=(0,y.So)(h.OB),D=(0,e.useRef)(!0),C=(0,e.useRef)(p),T=(0,e.useRef)(t),x=(0,y.kY)(),{put:Z,post:W,del:N}=x,G=s===null,$=(0,e.useMemo)(()=>G&&!a?null:(0,h.IF)(`collection-types/${r}/${a||s}`),[r,s,G,a]),Y=(0,e.useCallback)(O=>a?(0,y.w6)(O,T.current.contentType,T.current.components):O,[a]),j=(0,e.useCallback)(O=>{const A=(0,h.kc)(O,T.current.contentType,T.current.components);return(0,y.dU)(A,T.current.contentType,T.current.components)},[]);(0,e.useEffect)(()=>{const O=Object.keys(t.components).reduce((ee,ae)=>{const U=(0,h.Di)(L()(t,["components",ae,"attributes"],{}),t.components);return ee[ae]=(0,y.dU)(U,t.components[ae],t.components),ee},{}),A=(0,h.Di)(t.contentType.attributes,t.components),oe=(0,y.dU)(A,t.contentType,t.components);g(qr(O,oe))},[t,g]),(0,e.useEffect)(()=>()=>{g(Nr())},[g]),(0,e.useEffect)(()=>{const A=Ue.Z.CancelToken.source(),oe=async ae=>{g(dn());try{const{data:U}=await x.get($,{cancelToken:ae.token});g(ao(j(Y(U))))}catch(U){if(Ue.Z.isCancel(U))return;const ie=L()(U,"response.status",null);if(ie===404){u(M);return}ie===403&&(i({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),u(M))}},ee=async()=>{await g(dn()),await g(io(f))};return D.current?($?oe(A):ee(),()=>{A.cancel("Operation canceled by the user.")}):()=>{}},[x,Y,j,u,$,g,f,M,i]);const X=(0,e.useCallback)(O=>{i({type:"warning",message:F(O)})},[i,F]),q=(0,e.useCallback)(async O=>{try{C.current("willDeleteEntry",O);const{data:A}=await N((0,h.IF)(`collection-types/${r}/${s}`));return i({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),C.current("didDeleteEntry",O),m(M),Promise.resolve(A)}catch(A){return C.current("didNotDeleteEntry",{error:A,...O}),Promise.reject(A)}},[s,r,i,N,M,m]),z=(0,e.useCallback)(async(O,A)=>{const oe=`${(0,h.IF)(`collection-types/${r}`)}${f}`;try{g(fe("submit-pending"));const{data:ee}=await W(oe,O);return C.current("didCreateEntry",A),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),g(yt(j(ee))),g(fe("resolved")),m(`/content-manager/collectionType/${r}/${ee.id}${f}`),Promise.resolve(ee)}catch(ee){return X(ee),C.current("didNotCreateEntry",{error:ee,trackerProperty:A}),g(fe("resolved")),Promise.reject(ee)}},[j,X,m,r,g,f,i,c,l,W]),R=(0,e.useCallback)(async()=>{try{C.current("willCheckDraftRelations");const O=(0,h.IF)(`collection-types/${r}/${s}/actions/numberOfDraftRelations`);g(fe("draft-relation-check-pending"));const A=await x.get(O);return C.current("didCheckDraftRelations"),g(fe("resolved")),A.data.data}catch(O){return X(O),g(fe("resolved")),Promise.reject(O)}},[X,s,r,g,x]),B=(0,e.useCallback)(async()=>{try{C.current("willPublishEntry");const O=(0,h.IF)(`collection-types/${r}/${s}/actions/publish`);g(fe("publish-pending"));const{data:A}=await W(O);return C.current("didPublishEntry"),g(yt(j(A))),g(fe("resolved")),i({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),Promise.resolve(A)}catch(O){return X(O),g(fe("resolved")),Promise.reject(O)}},[j,X,s,r,g,i,W]),V=(0,e.useCallback)(async(O,A)=>{const oe=(0,h.IF)(`collection-types/${r}/${s}`);try{C.current("willEditEntry",A),g(fe("submit-pending"));const{data:ee}=await Z(oe,O);return C.current("didEditEntry",{trackerProperty:A}),i({type:"success",message:{id:(0,h.OB)("success.record.save")}}),l.invalidateQueries(["relation"]),g(yt(j(ee))),g(fe("resolved")),Promise.resolve(ee)}catch(ee){return C.current("didNotEditEntry",{error:ee,trackerProperty:A}),X(ee),g(fe("resolved")),Promise.reject(ee)}},[j,X,r,s,g,i,l,Z]),K=(0,e.useCallback)(async()=>{const O=(0,h.IF)(`collection-types/${r}/${s}/actions/unpublish`);g(fe("unpublish-pending"));try{C.current("willUnpublishEntry");const{data:A}=await W(O);return C.current("didUnpublishEntry"),i({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),g(yt(j(A))),g(fe("resolved")),Promise.resolve(A)}catch(A){return g(fe("resolved")),X(A),Promise.reject(A)}},[j,X,s,r,g,i,W]);return o({componentsDataStructure:E,contentTypeDataStructure:b,data:v,isCreatingEntry:G,isLoadingForData:k,onDelete:q,onPost:z,onPublish:B,onDraftRelationCheck:R,onPut:V,onUnpublish:K,status:I,redirectionLink:M})};co.defaultProps={id:null,origin:null},co.propTypes={allLayoutData:n().exact({components:n().object.isRequired,contentType:n().shape({apiID:n().string.isRequired,attributes:n().object.isRequired,info:n().object.isRequired,isDisplayed:n().bool.isRequired,kind:n().string.isRequired,layouts:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,pluginOptions:n().object,settings:n().object.isRequired,uid:n().string.isRequired}).isRequired}).isRequired,children:n().func.isRequired,id:n().string,origin:n().string,slug:n().string.isRequired};var Ic=(0,e.memo)(co,ft()),Oc=d(86834),Ae=d.n(Oc),Lc=d(89793),Vt=d.n(Lc),wc=d(56236),xc=d.n(wc),Pc=d(10268),jr=d.n(Pc),uo=d(99526),Wr=(t,o,r,s)=>{const a=t.slice();return a.splice(o,1),a.splice(r,0,s),a},Fc=d(77236),Sc=d.n(Fc);const Ac=({browserState:t,serverState:o},r,s)=>{const a=o,l=t,i=(u,m)=>L()(u,["attributes",m,"type"],""),c=(u,m)=>L()(u,["attributes",...m],""),p=(u,m,f,g)=>Object.keys(u).reduce((E,b)=>{const v=g?`${g}.${b}`:b,k=i(f,b),I=L()(u,b),M=L()(m,b),F=c(f,[b,"component"]),D=c(f,[b,"repeatable"]);let C;switch(k){case"json":C=JSON.parse(I);break;case"time":{C=I,I&&I.split(":").length<3&&(C=`${I}:00`);break}case"media":c(f,[b,"multiple"])===!0?C=I?I.filter(T=>!(T instanceof File)):null:C=L()(I,0)instanceof File?null:L()(I,"id",null);break;case"component":D?C=I&&I.map((T,x)=>p(T,(M??[])[x],s[F],`${v}.${x}`)):C=I&&p(I,M,s[F],v);break;case"relation":{const T=Sr(a,l)(v).join(".");let x=L()(a,T,[]);const Z=I.reduce((N,G,$,Y)=>{const j=x.find(q=>q.id===G.id),X=Y[$+1];if(!j||j.__temp_key__!==G.__temp_key__){const q=X?{before:X.id}:{end:!0};return[...N,{id:G.id,position:q}]}return N},[]);C={disconnect:x.reduce((N,G)=>I.find($=>$.id===G.id)?N:[...N,{id:G.id}],[]),connect:Z.reverse()};break}case"dynamiczone":C=I.map((T,x)=>p(T,(M??[])[x],s[T.__component],`${v}.${x}`));break;default:C=$c(I,"id")}return E[b]=C,E},{});return p(t,o,r,"")},$c=(t,o)=>Sc()(t)?t.map(r=>r[o]?r[o]:r):tr()(t)?t[o]:t;var Zc=Ac,Bc=d(51355),Nc=d.n(Bc),qc=d(95919),jc=d.n(qc),Wc=d(78746),St=d.n(Wc),ve=d(24346);function Ht(t){return["integer","biginteger","decimal","float","number"].includes(t)}ve.kM(ve.nK,"defined",function(){return this.test("defined",y.I0.required,t=>t!==void 0)}),ve.kM(ve.IX,"notEmptyMin",function(t){return this.test("notEmptyMin",y.I0.min,o=>Ae()(o)?!0:o.length>=t)}),ve.kM(ve.Z_,"isInferior",function(t,o){return this.test("isInferior",t,function(r){return!r||Number.isNaN(St()(r))?!0:St()(o)>=St()(r)})}),ve.kM(ve.Z_,"isSuperior",function(t,o){return this.test("isSuperior",t,function(r){return!r||Number.isNaN(St()(r))?!0:St()(r)>=St()(o)})});const zc=t=>L()(t,["attributes"],{}),mo=(t,{components:o},r={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const s=zc(t);return ve.Ry().shape(Object.keys(s).reduce((a,l)=>{const i=s[l];if(i.type!=="relation"&&i.type!=="component"&&i.type!=="dynamiczone"){const c=Uc(i.type,i,r);a[l]=c}if(i.type==="relation"&&(a[l]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(i.relationType)?ve.Ry().nullable():ve.IX().nullable()),i.type==="component"){const c=mo(o[i.component],{components:o},{...r,isFromComponent:!0});if(i.repeatable===!0){const{min:u,max:m,required:f}=i;let g=ve.Vo(E=>{let b=ve.IX().of(c);return u?f?b=b.min(u,y.I0.min):f!==!0&&Ae()(E)?b=b.nullable():b=b.min(u,y.I0.min):f&&!r.isDraft&&(b=b.min(1,y.I0.required)),m&&(b=b.max(m,y.I0.max)),b});return a[l]=g,a}const p=ve.Vo(u=>u!==void 0?i.required===!0&&!r.isDraft?c.defined():c.nullable():i.required===!0?ve.Ry().defined():ve.Ry().nullable());return a[l]=p,a}if(i.type==="dynamiczone"){let c=ve.IX().of(ve.Vo(({__component:m})=>mo(o[m],{components:o},{...r,isFromComponent:!0})));const{max:p,min:u}=i;u?i.required?c=c.test("min",y.I0.min,m=>r.isCreatingEntry?m&&m.length>=u:m===void 0?!0:m!==null&&m.length>=u).test("required",y.I0.required,m=>r.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):c=c.notEmptyMin(u):i.required&&!r.isDraft&&(c=c.test("required",y.I0.required,m=>r.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),p&&(c=c.max(p,y.I0.max)),a[l]=c}return a},{}))},Uc=(t,o,r)=>{let s=ve.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(t)&&(s=ve.Z_()),t==="json"&&(s=ve.nK(y.I0.json).test("isJSON",y.I0.json,a=>{if(!a||!a.length)return!0;try{return JSON.parse(a),!0}catch{return!1}}).nullable().test("required",y.I0.required,a=>!(o.required&&(!a||!a.length)))),t==="email"&&(s=s.email(y.I0.email)),["number","integer","float","decimal"].includes(t)&&(s=ve.Rx().transform(a=>jc()(a)?void 0:a).typeError()),t==="biginteger"&&(s=ve.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(t)&&(s=ve.hT()),Object.keys(o).forEach(a=>{const l=o[a];if(l||!Nc()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{r.isDraft||(t==="password"&&r.isCreatingEntry&&(s=s.required(y.I0.required)),t!=="password"&&(r.isCreatingEntry?s=s.required(y.I0.required):s=s.test("required",y.I0.required,i=>i===void 0&&!r.isFromComponent?!0:Ht(t)?i===0?!0:!!i:t==="boolean"?i!=null:t==="date"||t==="datetime"?typeof i=="string"?!Ae()(i):!Ae()(i?.toString()):!Ae()(i))));break}case"max":{t==="biginteger"?s=s.isInferior(y.I0.max,l):s=s.max(l,y.I0.max);break}case"maxLength":s=s.max(l,y.I0.maxLength);break;case"min":{t==="biginteger"?s=s.isSuperior(y.I0.min,l):s=s.min(l,y.I0.min);break}case"minLength":{r.isDraft||(s=s.min(l,y.I0.minLength));break}case"regex":s=s.matches(new RegExp(l),{message:y.I0.regex,excludeEmptyString:!o.required});break;case"lowercase":["text","textarea","email","string"].includes(t)&&(s=s.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(t)&&(s=s.strict().uppercase());break;case"positive":Ht(t)&&(s=s.positive());break;case"negative":Ht(t)&&(s=s.negative());break;default:s=s.nullable()}}),s};var zr=mo;const un=(t,o=()=>!1,r=void 0)=>{const s=(a,l,{ignoreFalseyValues:i=!1,path:c=[],parent:p=l}={})=>Object.entries(l).reduce((u,[m,f])=>{if(i&&(u==null||u[m]===void 0||u[m]===null))return u;if(o(f,{path:[...c,m],parent:p})&&(u[m]=typeof r=="function"?r(u[m],{path:[...c,m],parent:u}):r),f.type==="component"){const g=t[f.component].attributes;!f.repeatable&&u[m]&&typeof u[m]=="object"?u[m]=s(u[m],g,{ignoreFalseyValues:i,path:[...c,m],parent:l[m]}):f.repeatable&&Array.isArray(u[m])&&(u[m]=u[m].map((E,b)=>s(E,g,{ignoreFalseyValues:i,path:[...c,m,b],parent:l[m]})))}else f.type==="dynamiczone"&&Array.isArray(u[m])&&(u[m]=u[m].map((g,E)=>{const b=t[g.__component].attributes;return s(g,b,{ignoreFalseyValues:i,path:[...c,m,E],parent:l[m]})}));return u},{...a});return s},Vc={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var Hc=(t,o)=>(0,tn.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:s,allComponents:a}=o,l={...t.componentsDataStructure[s.uid]},c=un(a,p=>p.type==="relation",[])(l,s.attributes);_()(r,["modifiedData",...o.keys],c);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:s,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=o;i&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=s[0]);const c=L()(t,["modifiedData",...s],[]),p=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[l.uid],__component:l.uid,__temp_key__:(0,h.Uo)(c)+1}:{...t.componentsDataStructure[l.uid],__temp_key__:(0,h.Uo)(c)+1},m=un(a,g=>g.type==="relation",[])(p,l.attributes),f=Array.isArray(c)?[...c,m]:[m];_()(r,["modifiedData",...s],f);break}case"LOAD_RELATION":{const{initialDataPath:s,modifiedDataPath:a,value:l}=o,i=L()(t,s),c=L()(t,a),p=i?l.filter(f=>!i.some(g=>g.id===f.id)):l,u=(0,uo.zJ)(null,c[0]?.__temp_key__,p.length),m=p.map((f,g)=>({...f,__temp_key__:u[g]}));_()(r,s,jr()([...m,...i],"id")),_()(r,a,jr()([...m,...c],"id"));break}case"CONNECT_RELATION":{const s=["modifiedData",...o.keys],{value:a,toOneRelation:l}=o;if(l)_()(r,s,[a]);else{const i=L()(t,s),[c]=(0,uo.zJ)(i.at(-1)?.__temp_key__,null,1),p=[...i,{...a,__temp_key__:c}];_()(r,s,p)}break}case"DISCONNECT_RELATION":{const s=["modifiedData",...o.keys],{id:a}=o,i=L()(t,[...s]).filter(c=>c.id!==a);_()(r,s,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:s,newIndex:a,keys:l}=o,i=["modifiedData",...l],c=L()(t,[...i]),p=c[s],u=[...c];if(o.type==="REORDER_RELATION"){const m=s>a?c[a-1]?.__temp_key__:c[a]?.__temp_key__,f=s>a?c[a]?.__temp_key__:c[a+1]?.__temp_key__,[g]=(0,uo.zJ)(m,f,1);u.splice(s,1),u.splice(a,0,{...p,__temp_key__:g})}else u.splice(s,1),u.splice(a,0,p);_()(r,i,u);break}case"INIT_FORM":{const{initialValues:s,components:a={},attributes:l={},setModifiedDataOnly:i}=o,c=nt()(s),u=un(a,g=>g.type==="relation",(g,{path:E})=>t.modifiedData?.id===c.id&&L()(t.modifiedData,E)?L()(t.modifiedData,E):[])(c,l),f=un(a,g=>g.type==="dynamiczone"||g.type==="component"&&!g.repeatable,g=>Array.isArray(g)?g.map((E,b)=>({...E,__temp_key__:b})):{...g,__temp_key__:0})(u,l,{ignoreFalseyValues:!0});i||(r.initialData=f),r.modifiedData=f,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=o;l&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[a],c=o.type==="MOVE_COMPONENT_UP"?s-1:s+1,p=t.modifiedData[a][s],u=Wr(i,s,c,p);_()(r,["modifiedData",o.dynamicZoneName],u);break}case"MOVE_FIELD":{const s=L()(t,["modifiedData",...o.keys],[]).slice(),a=L()(t,["modifiedData",...o.keys,o.dragIndex]),l=Wr(s,o.dragIndex,o.overIndex,a);_()(r,["modifiedData",...o.keys],l);break}case"ON_CHANGE":{const[s]=o.keys;if(o.shouldSetInitialValue&&_()(r,["initialData",...o.keys],o.value),o.keys.length===2&&L()(t,["modifiedData",s])===null){_()(r,["modifiedData",s],{[o.keys[1]]:o.value});break}_()(r,["modifiedData",...o.keys],o.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{o.shouldCheckErrors&&(r.shouldCheckErrors=!t.shouldCheckErrors),r.modifiedData[o.dynamicZoneName].splice(o.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...o.keys];_()(r,s,null);break}case"REMOVE_PASSWORD_FIELD":{xc()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=o.keys.length-1,a=["modifiedData",...jt()(o.keys,s)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const i=L()(t,a).slice();i.splice(parseInt(o.keys[s],10),1),_()(r,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{r.componentsDataStructure=o.componentsDataStructure,r.contentTypeDataStructure=o.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{r.modifiedDZName=null,r.formErrors=o.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...o.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return r}});const po=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:p,isCreatingEntry:u,isLoadingForData:m,isSingleType:f,onPost:g,onPublish:E,onDraftRelationCheck:b,onPut:v,onUnpublish:k,readActionAllowedFields:I,redirectToPreviousPage:M,slug:F,status:D,updateActionAllowedFields:C})=>{const[T,x]=(0,e.useReducer)(Hc,Vc),{formErrors:Z,initialData:W,modifiedData:N,modifiedDZName:G,shouldCheckErrors:$,publishConfirmation:Y}=T,{setModifiedDataOnly:j}=(0,me.v9)(lo),X=(0,me.I0)(),q=(0,y.lm)(),{lockApp:z,unlockApp:R}=(0,y.o1)(),B=L()(t,["contentType"],{}),V=(0,e.useMemo)(()=>L()(B,["options","draftAndPublish"],!1),[B]),K=(0,e.useMemo)(()=>V&&!W.publishedAt,[V,W.publishedAt]),{trackUsage:O}=(0,y.rS)(),{formatMessage:A}=(0,Q.Z)(),oe=(0,e.useRef)(O),ee=(0,e.useMemo)(()=>m||u?!1:o===!1&&r===!1,[m,u,o,r]);(0,e.useEffect)(()=>{D==="resolved"?R():z()},[z,R,D]),(0,e.useEffect)(()=>{m||Xe()},[$]),(0,e.useEffect)(()=>{const se=Object.keys(Z);if(se.length>0){const te=se[0],ce=document.getElementById(te);ce&&ce.focus()}},[Z]),(0,e.useEffect)(()=>{ee&&q({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}})},[ee,q]),(0,e.useEffect)(()=>{x({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:ae}=t,U=ir(p);(0,e.useEffect)(()=>{p&&B?.attributes&&!Vt()(U,p)&&(x({type:"INIT_FORM",initialValues:p,components:ae,attributes:B.attributes,setModifiedDataOnly:j}),j&&X(kc()))},[p,B,ae,j,X,U]);const ie=(0,e.useCallback)(se=>(te,ce,_e,Dt=!1)=>{oe.current("didAddComponentToDynamicZone"),x({type:se,keys:te.split("."),componentLayoutData:ce,allComponents:_e,shouldCheckErrors:Dt})},[]),$e=ie("ADD_COMPONENT_TO_DYNAMIC_ZONE"),dt=(0,e.useCallback)((se,te,ce)=>{x({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:se.split("."),componentLayoutData:te,allComponents:ce})},[]),Yt=(0,e.useCallback)(({name:se,value:te,toOneRelation:ce})=>{x({type:"CONNECT_RELATION",keys:se.split("."),value:te,toOneRelation:ce})},[]),Xt=(0,e.useCallback)(({target:{initialDataPath:se,modifiedDataPath:te,value:ce}})=>{x({type:"LOAD_RELATION",modifiedDataPath:te,initialDataPath:se,value:ce})},[]),Jt=ie("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Ve=(0,e.useMemo)(()=>{const se={isCreatingEntry:u,isDraft:K,isFromComponent:!1};return zr(B,{components:t.components||{}},se)},[t.components,B,u,K]),Xe=(0,e.useCallback)(async(se={})=>{let te={};const ce=nt()(N);Ae()(ce)||_()(ce,se.path,se.value);try{await Ve.validate(ce,{abortEarly:!1})}catch(_e){te=(0,y.CJ)(_e),G&&(te=Object.keys(te).reduce((Dt,zo)=>(zo.split(".")[0]!==G&&(Dt[zo]=te[zo]),Dt),{}))}x({type:"SET_FORM_ERRORS",errors:te})},[G,N,Ve]),_t=(0,e.useCallback)(({target:{name:se,value:te,type:ce}},_e=!1)=>{let Dt=te;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ce)&&!te&&te!==0&&(Dt=null),ce==="password"&&!te){x({type:"REMOVE_PASSWORD_FIELD",keys:se.split(".")});return}x({type:"ON_CHANGE",keys:se.split("."),value:Dt,shouldSetInitialValue:_e})},[]),bt=(0,e.useCallback)((se,te)=>Zc({browserState:se,serverState:te},B,t.components),[t.components,B]),re=(0,e.useMemo)(()=>V?K?{status:"draft"}:{}:{},[V,K]),Ce=(0,e.useCallback)(async se=>(se.preventDefault(),x({type:"RESET_PUBLISH_CONFIRMATION"})),[]),Je=(0,e.useCallback)(async se=>{se.preventDefault();let te={};try{await Ve.validate(N,{abortEarly:!1})}catch(ce){te=(0,y.CJ)(ce)}try{if(Ae()(te)){const ce=bt(N,W);u?await g(ce,re):await v(ce,re)}}catch(ce){te={...te,...(0,y.nn)(ce,{getTrad:h.OB})}}x({type:"SET_FORM_ERRORS",errors:te})},[bt,u,N,W,g,v,re,Ve]),Wo=(0,e.useCallback)(async()=>{const se=zr(B,{components:L()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),te=await b();if(!Y.show&&te>0){x({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:te}});return}x({type:"RESET_PUBLISH_CONFIRMATION"});let ce={};try{await se.validate(N,{abortEarly:!1})}catch(_e){ce=(0,y.CJ)(_e)}try{Ae()(ce)&&await E()}catch(_e){ce={...ce,...(0,y.nn)(_e,{getTrad:h.OB})}}x({type:"SET_FORM_ERRORS",errors:ce})},[t,B,u,N,Y.show,E,b]),Et=(0,e.useCallback)(se=>{const te=Object.keys(Z).some(_e=>_e.split(".")[0]===se);return!Ae()(Z)&&te},[Z]),Ym=(0,e.useCallback)((se,te)=>{oe.current("changeComponentsOrder"),x({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:se,currentIndex:te,shouldCheckErrors:Et(se)})},[Et]),Xm=(0,e.useCallback)((se,te)=>{oe.current("changeComponentsOrder"),x({type:"MOVE_COMPONENT_UP",dynamicZoneName:se,currentIndex:te,shouldCheckErrors:Et(se)})},[Et]),Jm=(0,e.useCallback)(({name:se,newIndex:te,currentIndex:ce})=>{x({type:"MOVE_COMPONENT_FIELD",keys:se.split("."),newIndex:te,oldIndex:ce})},[]),_m=(0,e.useCallback)(({name:se,id:te})=>{x({type:"DISCONNECT_RELATION",keys:se.split("."),id:te})},[]),ep=(0,e.useCallback)(({name:se,oldIndex:te,newIndex:ce})=>{x({type:"REORDER_RELATION",keys:se.split("."),oldIndex:te,newIndex:ce})},[]),tp=(0,e.useCallback)((se,te)=>{oe.current("removeComponentFromDynamicZone"),x({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:se,index:te,shouldCheckErrors:Et(se)})},[Et]),np=(0,e.useCallback)((se,te)=>{x({type:"REMOVE_COMPONENT_FROM_FIELD",keys:se.split("."),componentUid:te})},[]),op=(0,e.useCallback)((se,te)=>{x({type:"REMOVE_REPEATABLE_FIELD",keys:se.split("."),componentUid:te})},[]),rp=(0,e.useCallback)(()=>{x({type:"TRIGGER_FORM_VALIDATION"})},[]);return ee?e.createElement(J.l_,{to:c}):N?e.createElement(y.W1.Provider,{value:{addComponentToDynamicZone:$e,addNonRepeatableComponentToField:dt,addRepeatableComponentToField:Jt,allLayoutData:t,checkFormErrors:Xe,createActionAllowedFields:i,formErrors:Z,hasDraftAndPublish:V,initialData:W,isCreatingEntry:u,isSingleType:f,shouldNotRunValidations:K,status:D,layout:B,modifiedData:N,moveComponentField:Jm,moveComponentDown:Ym,moveComponentUp:Xm,onChange:_t,onPublish:Wo,onUnpublish:k,readActionAllowedFields:I,redirectToPreviousPage:M,removeComponentFromDynamicZone:tp,removeComponentFromField:np,removeRepeatableField:op,relationConnect:Yt,relationDisconnect:_m,relationLoad:Xt,relationReorder:ep,slug:F,triggerFormValidation:rp,updateActionAllowedFields:C,onPublishPromptDismissal:Ce,publishConfirmation:Y}},m||!u&&!W.id?e.createElement(Ie.o,{"aria-busy":"true"},e.createElement(y.dO,null)):e.createElement(e.Fragment,null,e.createElement(J.NL,{when:!Vt()(N,W),message:A({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:Je},s))):null};po.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},po.propTypes={allLayoutData:n().object.isRequired,allowedActions:n().object.isRequired,children:n().node.isRequired,componentsDataStructure:n().object.isRequired,contentTypeDataStructure:n().object.isRequired,createActionAllowedFields:n().array.isRequired,from:n().string,initialValues:n().object,isCreatingEntry:n().bool.isRequired,isLoadingForData:n().bool.isRequired,isSingleType:n().bool.isRequired,onPost:n().func.isRequired,onPublish:n().func.isRequired,onDraftRelationCheck:n().func.isRequired,onPut:n().func.isRequired,onUnpublish:n().func.isRequired,readActionAllowedFields:n().array.isRequired,redirectToPreviousPage:n().func,slug:n().string.isRequired,status:n().string.isRequired,updateActionAllowedFields:n().array.isRequired};var Qc=po,Mt=t=>(0,h.IF)(`single-types/${t}`),Gc=t=>Object.values(t||{}).reduce((o,r)=>Object.assign(o,r),{}),Ur=(t={})=>{const{plugins:o,_q:r,...s}={...t,...Gc(t.plugins)};return r&&_()(s,"_q",encodeURIComponent(r)),`${(0,ct.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};const Vr=({allLayoutData:t,children:o,slug:r})=>{const s=(0,Tt.useQueryClient)(),{trackUsage:a}=(0,y.rS)(),{push:l}=(0,J.k6)(),{setCurrentStep:i}=(0,y.c1)(),c=(0,e.useRef)(a),[p,u]=(0,e.useState)(!0),[{query:m,rawQuery:f}]=(0,y.Kx)(),g=Ur(m),E=(0,y.lm)(),b=(0,me.I0)(),{formatAPIError:v}=(0,y.So)(h.OB),k=(0,y.kY)(),{post:I,put:M,del:F}=k,{componentsDataStructure:D,contentTypeDataStructure:C,data:T,isLoading:x,status:Z}=(0,me.v9)(lo),W=(0,e.useCallback)(z=>{const R=(0,h.kc)(z,t.contentType,t.components);return(0,y.dU)(R,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{b(Nr())},[b]),(0,e.useEffect)(()=>{const z=Object.keys(t.components).reduce((V,K)=>{const O=(0,h.Di)(L()(t,["components",K,"attributes"],{}),t.components);return V[K]=(0,y.dU)(O,t.components[K],t.components),V},{}),R=(0,h.Di)(t.contentType.attributes,t.components),B=(0,y.dU)(R,t.contentType,t.components);b(qr(z,B))},[t,b]),(0,e.useEffect)(()=>{const R=Ue.Z.CancelToken.source();return(async V=>{b(dn()),u(!0);try{const{data:K}=await k.get(Mt(`${r}${g}`),{cancelToken:V.token});b(ao(W(K))),u(!1)}catch(K){if(Ue.Z.isCancel(K))return;const O=L()(K,"response.status",null);O===404&&b(io(f,!0)),O===403&&(E({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),l("/"))}})(R),()=>R.cancel("Operation canceled by the user.")},[k,W,l,r,b,g,f,E]);const N=(0,e.useCallback)(z=>{E({type:"warning",message:v(z)})},[E,v]),G=(0,e.useCallback)(async z=>{try{c.current("willDeleteEntry",z);const{data:R}=await F(Mt(`${r}${g}`));return E({type:"success",message:{id:(0,h.OB)("success.record.delete")}}),c.current("didDeleteEntry",z),u(!0),b(io(f,!0)),Promise.resolve(R)}catch(R){return c.current("didNotDeleteEntry",{error:R,...z}),N(R),Promise.reject(R)}},[F,r,N,E,g,b,f]),$=(0,e.useCallback)(async(z,R)=>{const B=Mt(`${r}${f}`);try{b(fe("submit-pending"));const{data:V}=await M(B,z);return c.current("didCreateEntry",R),E({type:"success",message:{id:(0,h.OB)("success.record.save")}}),i("contentManager.success"),s.invalidateQueries(["relation"]),b(yt(W(V))),u(!1),b(fe("resolved")),Promise.resolve(V)}catch(V){return c.current("didNotCreateEntry",{error:V,trackerProperty:R}),N(V),b(fe("resolved")),Promise.reject(V)}},[M,W,N,r,b,f,E,i,s]),Y=(0,e.useCallback)(async()=>{try{c.current("willCheckDraftRelations");const z=Mt(`${r}/actions/numberOfDraftRelations`);b(fe("draft-relation-check-pending"));const R=await k.get(z);return c.current("didCheckDraftRelations"),b(fe("resolved")),R.data.data}catch(z){return N(z),b(fe("resolved")),Promise.reject(z)}},[k,N,r,b]),j=(0,e.useCallback)(async()=>{try{c.current("willPublishEntry");const z=Mt(`${r}/actions/publish${g}`);b(fe("publish-pending"));const{data:R}=await I(z);return c.current("didPublishEntry"),E({type:"success",message:{id:(0,h.OB)("success.record.publish")}}),b(yt(W(R))),b(fe("resolved")),Promise.resolve(R)}catch(z){return N(z),b(fe("resolved")),Promise.reject(z)}},[I,W,N,r,g,b,E]),X=(0,e.useCallback)(async(z,R)=>{const B=Mt(`${r}${f}`);try{c.current("willEditEntry",R),b(fe("submit-pending"));const{data:V}=await M(B,z);return E({type:"success",message:{id:(0,h.OB)("success.record.save")}}),c.current("didEditEntry",{trackerProperty:R}),s.invalidateQueries(["relation"]),b(yt(W(V))),b(fe("resolved")),Promise.resolve(V)}catch(V){return N(V),c.current("didNotEditEntry",{error:V,trackerProperty:R}),b(fe("resolved")),Promise.reject(V)}},[M,W,N,r,b,f,E,s]),q=(0,e.useCallback)(async()=>{const z=Mt(`${r}/actions/unpublish${g}`);b(fe("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:R}=await I(z);c.current("didUnpublishEntry"),E({type:"success",message:{id:(0,h.OB)("success.record.unpublish")}}),b(yt(W(R))),b(fe("resolved"))}catch(R){b(fe("resolved")),N(R)}},[I,W,E,N,r,b,g]);return o({componentsDataStructure:D,contentTypeDataStructure:C,data:T,isCreatingEntry:p,isLoadingForData:x,onDelete:G,onPost:$,onDraftRelationCheck:Y,onPublish:j,onPut:X,onUnpublish:q,redirectionLink:"/",status:Z})};Vr.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var Kc=(0,e.memo)(Vr),Yc=d(56243);function Xc(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var Jc=Xc;function _c(){const{initialData:t,hasDraftAndPublish:o}=(0,y.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var ed=_c;const td=(0,S.ZP)(Yc.Z)`
|
|
954
|
-
width: ${(0,y.Q1)(6)};
|
|
955
|
-
height: ${(0,y.Q1)(6)};
|
|
956
|
-
* {
|
|
957
|
-
fill: ${({theme:t,$bulletColor:o})=>t.colors[o]};
|
|
958
|
-
}
|
|
959
|
-
`,Hr=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,Q.Z)();if(!t)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=o?s.published:s.draft;return e.createElement(P.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...a.box},e.createElement(P.x,{as:w.k},e.createElement(td,{$bulletColor:a.bulletColor}),e.createElement(P.x,{paddingLeft:3},e.createElement(H.Z,{textColor:a.textColor},r({id:(0,h.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(H.Z,{fontWeight:"bold",textColor:a.textColor},o&&r({id:(0,h.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,h.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Hr.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var nd=Jc(Hr,ed),At=d(66456),mn=d(29439),pn=d(22342),gn=d(96166),fn=d(88693);function od(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var rd=od;function sd(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:p,publishConfirmation:u,onPublishPromptDismissal:m}=(0,y.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:p,publishConfirmation:u,onPublishPromptDismissal:m}}var ad=sd;const Qr=(0,S.ZP)(w.k)`
|
|
960
|
-
text-align: center;
|
|
961
|
-
`,Gr=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:s,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:p,onPublish:u,onUnpublish:m,status:f,publishConfirmation:{show:g,draftCount:E},onPublishPromptDismissal:b})=>{const{goBack:v}=(0,J.k6)(),[k,I]=(0,e.useState)(!1),{formatMessage:M}=(0,Q.Z)(),F=L()(c,["settings","mainField"],"id"),D=L()(c,["info","displayName"],"NOT FOUND"),C=!Vt()(s,p)||a&&!Ae()(p);let x=M({id:(0,h.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(x=s[F]||D),l&&(x=D);let Z=null;if(a&&o&&(Z=e.createElement(w.k,{gap:2},i&&e.createElement(Ee.z,{disabled:!0,startIcon:e.createElement(At.Z,null),variant:"secondary"},M({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(Ee.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},M({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&t){const $=i&&r,Y=!Ae()(s.publishedAt),j=Y?f==="unpublish-pending":f==="publish-pending",X=Y?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},q=Y?()=>I(!0):()=>u();Z=e.createElement(w.k,null,$&&e.createElement(Ee.z,{disabled:C,loading:j,onClick:q,startIcon:e.createElement(At.Z,null),variant:"secondary"},M(X)),e.createElement(P.x,{paddingLeft:$?2:0},e.createElement(Ee.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},M({id:(0,h.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const W=()=>I($=>!$),N=()=>{W(),m()},G=`${M({id:(0,h.OB)("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return e.createElement(e.Fragment,null,e.createElement(ye.T,{title:x.toString(),primaryAction:Z,subtitle:G,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(mn.Z,null),onClick:$=>{$.preventDefault(),v()},to:"/"},M({id:"global.back",defaultMessage:"Back"}))}),e.createElement(pn.V,{onClose:W,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},e.createElement(gn.a,{icon:e.createElement(Wt.Z,null)},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(w.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(H.Z,{id:"confirm-description"},M({id:(0,h.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(w.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(H.Z,{id:"confirm-description"},M({id:(0,h.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(fn.c,{startAction:e.createElement(Ee.z,{onClick:W,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(Ee.z,{variant:"danger-light",onClick:N},M({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(pn.V,{onClose:b,title:M({id:(0,h.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:g},e.createElement(gn.a,{icon:e.createElement(Wt.Z,null)},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Qr,{justifyContent:"center"},e.createElement(H.Z,{id:"confirm-description"},E,M({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:$=>e.createElement(H.Z,{fontWeight:"bold"},$),count:E}))),e.createElement(Qr,{justifyContent:"center"},e.createElement(H.Z,{id:"confirm-description"},M({id:(0,h.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(fn.c,{startAction:e.createElement(Ee.z,{onClick:b,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(Ee.z,{variant:"success",onClick:u},M({id:(0,h.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};Gr.propTypes={allowedActions:n().shape({canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canPublish:n().bool.isRequired}).isRequired,initialData:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isSingleType:n().bool.isRequired,status:n().string.isRequired,layout:n().object.isRequired,hasDraftAndPublish:n().bool.isRequired,modifiedData:n().object.isRequired,onPublish:n().func.isRequired,onUnpublish:n().func.isRequired,publishConfirmation:n().shape({show:n().bool.isRequired,draftCount:n().number.isRequired}).isRequired,onPublishPromptDismissal:n().func.isRequired};const id=(0,e.memo)(Gr,ft());var ld=rd(id,ad),cd=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,s=i=>L()(r,[i,"type"],"");let a=0;const l=[];return o.forEach(i=>{const c=i.some(({name:p})=>s(p)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&Ae()(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},dd=d(91815),ud=d.n(dd),md=d(3704),Kr=d.n(md),pd=(t,o)=>{const r=s=>{const a=(0,y.ZT)(t,[{action:`plugin::content-manager.explorer.${s}`,subject:o}]);return ud()(Kr()(a,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}},gd=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(r)]};function fd(t,o){return r=>{const s=o();return e.createElement(t,{...r,...s})}}var hd=fd;function yd(){const{hasDraftAndPublish:t,modifiedData:o}=(0,y.Wq)();let r={};return t&&(r=Ae()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var bd=yd;const Yr=({onDelete:t,trackerProperty:o})=>{const[r,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(!1),{formatMessage:i}=(0,Q.Z)(),{formatAPIError:c}=(0,y.So)(h.OB),p=(0,y.lm)(),u=()=>s(f=>!f),m=async()=>{try{l(!0),await t(o),l(!1),u()}catch(f){l(!1),u(),p({type:"warning",message:c(f)})}};return e.createElement(e.Fragment,null,e.createElement(Ee.z,{onClick:u,size:"S",startIcon:e.createElement(Se.Z,null),variant:"danger-light"},i({id:(0,h.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(y.QH,{isConfirmButtonLoading:a,isOpen:r,onConfirm:m,onToggleDialog:u}))};Yr.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Ed=(0,e.memo)(Yr,ft());var vd=hd(Ed,bd);const go=({columns:t,customFieldInputs:o})=>e.createElement(Ye.r,{gap:4},t.map(({fieldSchema:r,labelAction:s,metadatas:a,name:l,size:i,queryInfos:c})=>{if(r.type==="component"){const{component:u,max:m,min:f,repeatable:g=!1,required:E=!1}=r;return e.createElement(Le.P,{col:i,s:12,xs:12,key:u},e.createElement(sn,{componentUid:u,labelAction:s,isRepeatable:g,intlLabel:{id:a.label,defaultMessage:a.label},max:m,min:f,name:l,required:E}))}return e.createElement(Le.P,{col:i,key:l,s:12,xs:12},e.createElement(Vn,{size:i,fieldSchema:r,keys:l,labelAction:s,metadatas:a,queryInfos:c,customFieldInputs:o}))}));go.defaultProps={customFieldInputs:{}},go.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var Cd=go;const fo=t=>t["content-manager_editViewLayoutManager"].currentLayout,Rd=(0,wt.P1)(fo,t=>cd(t?.contentType??{})),Td=(0,wt.P1)(fo,t=>gd(t)),Md=(()=>window&&window.strapi&&window.strapi.isEE?d(28243).Z:d(73710).Z)(),Xr=Oe.Z.contentManager,Dd=[{action:"plugin::content-type-builder.read",subject:null}],ho=t=>{let{allowedActions:o,isSingleType:r,goBack:s,slug:a,id:l,origin:i,userPermissions:c}=t;const{trackUsage:p}=(0,y.rS)(),{formatMessage:u}=(0,Q.Z)(),{layout:m,formattedContentTypeLayout:f,customFieldUids:g}=(0,me.v9)(T=>({layout:fo(T),formattedContentTypeLayout:Rd(T),customFieldUids:Td(T)})),{isLazyLoading:E,lazyComponentStore:b}=Hn(g),{createActionAllowedFields:v,readActionAllowedFields:k,updateActionAllowedFields:I}=pd(c,a),M=r?Xr.singleTypesConfigurations:Xr.collectionTypesConfigurations,F=`/content-manager/${r?"singleType":"collectionType"}/${a}/configurations/edit`,D=r?Kc:Ic,C=T=>T.every(x=>x.every(Z=>Z.fieldSchema.type==="dynamiczone"));return E?e.createElement(y.dO,null):e.createElement(D,{allLayoutData:m,slug:a,id:l,origin:i},T=>{let{componentsDataStructure:x,contentTypeDataStructure:Z,data:W,isCreatingEntry:N,isLoadingForData:G,onDelete:$,onPost:Y,onPublish:j,onDraftRelationCheck:X,onPut:q,onUnpublish:z,redirectionLink:R,status:B}=T;return e.createElement(Qc,{allowedActions:o,allLayoutData:m,createActionAllowedFields:v,componentsDataStructure:x,contentTypeDataStructure:Z,from:R,initialValues:W,isCreatingEntry:N,isLoadingForData:G,isSingleType:r,onPost:Y,onPublish:j,onDraftRelationCheck:X,onPut:q,onUnpublish:z,readActionAllowedFields:k,redirectToPreviousPage:s,slug:a,status:B,updateActionAllowedFields:I},e.createElement(Ie.o,{"aria-busy":B!=="resolved"},e.createElement(ld,{allowedActions:o}),e.createElement(Pt.D,null,e.createElement(Ye.r,{gap:4},e.createElement(Le.P,{col:9,s:12},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:6},f.map((V,K)=>{if(C(V)){const{0:{0:{name:O,fieldSchema:A,metadatas:oe,labelAction:ee}}}=V;return e.createElement(P.x,{key:K},e.createElement(Ye.r,{gap:4},e.createElement(Le.P,{col:12,s:12,xs:12},e.createElement(Dc,{name:O,fieldSchema:A,labelAction:ee,metadatas:oe}))))}return e.createElement(P.x,{key:K,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:6},V.map((O,A)=>e.createElement(Cd,{columns:O,customFieldInputs:b,key:A}))))}))),e.createElement(Le.P,{col:3,s:12},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(nd,null),e.createElement(P.x,{as:"aside","aria-labelledby":"additional-information",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},e.createElement(Md,null),e.createElement(on,{area:"contentManager.editView.informations"})),e.createElement(P.x,{as:"aside","aria-labelledby":"links"},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(on,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(y.jW,{permissions:Dd},e.createElement(y.Qj,{onClick:()=>{p("willEditEditLayout")},size:"S",startIcon:e.createElement(Ne.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,h.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(y.jW,{permissions:M},e.createElement(y.Qj,{size:"S",startIcon:e.createElement(ja.Z,null),style:{width:"100%"},to:F,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),o.canDelete&&!N&&e.createElement(vd,{onDelete:$})))))))))})};ho.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},ho.propTypes={allowedActions:n().shape({canRead:n().bool.isRequired,canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canDelete:n().bool.isRequired}).isRequired,id:n().string,isSingleType:n().bool,goBack:n().func.isRequired,origin:n().string,slug:n().string.isRequired,userPermissions:n().array};var kd=(0,e.memo)(ho);const yo=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.userPermissions);return r?e.createElement(y.dO,null):e.createElement(kd,{...t,allowedActions:s})};yo.defaultProps={permissions:[]},yo.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var Id=(0,e.memo)(yo,ft());const Jr=({layout:t,...o})=>{const r=(0,me.v9)(Ko),s=(0,me.I0)(),[{query:a}]=(0,y.Kx)(),{runHookWaterfall:l}=(0,y.j1)(),i=ar(a,o.slug,"editView");return(0,e.useEffect)(()=>{const c=l(nn.Eo,{layout:t,query:a});return s(Na(c.layout,a)),()=>{s(Ba())}},[t,s,a,l]),!r||!i?e.createElement(y.dO,null):e.createElement(Id,{...o,userPermissions:i})};Jr.propTypes={layout:n().shape({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,settings:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().object.isRequired}).isRequired}).isRequired};var hn=Jr,Od=d(23940),Qt=d.n(Od),_r=d(9026);const bo=t=>t.reduce((o,r)=>o+r.size,0),Ld=t=>t.reduce((o,r,s)=>{const a={rowId:s,rowContent:r};return o.concat(a)},[]),$t=t=>t.reduce((o,r)=>{let s=[];const a=r.rowContent.reduce((c,p)=>{const u=bo(c);return p.name==="_TEMP_"||(u+p.size<=12?c.push(p):s.push(p)),c},[]),l=o.length===0?0:Math.max.apply(Math,o.map(c=>c.rowId))+1,i=bo(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),o.push({rowId:l,rowContent:a}),s.length>0){const c=bo(s);c<12&&s.push({name:"_TEMP_",size:12-c}),o.push({rowId:l+1,rowContent:s}),s=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),wd=t=>t.reduce((o,r)=>{const s=r.rowContent.filter(a=>a.name!=="_TEMP_");return o.concat([s])},[]),xd=(t,o=[])=>o.reduce((r,{rowContent:s})=>{const a=s.find(l=>l.name===t)?.size??null;return a&&(r=a),r},null),Pd=(t,o,r=[])=>r.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===t?{...a,size:o}:a),s)),es=6,Eo={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var Fd=(t=Eo,o)=>(0,tn.ZP)(t,r=>{const s=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const a=L()(t,s,[]),{fromIndex:l,toIndex:i}=o;_()(r,s,(0,h.W3)(a,l,i));break}case"ON_ADD_FIELD":{const a=nt()(t),l=L()(a,["modifiedData","attributes",o.name],{}),i=o.fieldSizes[l?.customField]?.default??o.fieldSizes[l?.type]?.default??es,c=L()(a,s,[]).length,p=[...s,c-1,"rowContent"],u=L()(a,p,[]);let m=L()(a,s,[]);Array.isArray(u)?_()(m,[c>0?c-1:0,"rowContent"],[...u,{name:o.name,size:i}]):_()(m,[c>0?c-1:0,"rowContent"],[{name:o.name,size:i}]);const f=$t(m);_()(r,s,f);break}case"ON_CHANGE":{_()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{_()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{_()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const a=L()(t,[...s,o.rowIndex,"rowContent"],[]);let l=nt()(t);if(a.length===1||a.length===2&&L()(a,[1,"name"],"")==="_TEMP_"){const c=L()(t,s,[]);_()(l,s,c.filter((p,u)=>o.rowIndex!==u))}else _()(l,[...s,o.rowIndex,"rowContent"],a.filter((c,p)=>p!==o.fieldIndex));const i=$t(L()(l,s,[]));_()(r,s,i);break}case"REORDER_DIFF_ROW":{const a=L()(t,[...s,o.dragRowIndex,"rowContent"],[]),l=L()(t,[...s,o.hoverRowIndex,"rowContent"],[]),i=L()(t,[...s,o.dragRowIndex,"rowContent",o.dragIndex],{}),c=[...l,i];let p=nt()(t);_()(p,[...s,o.dragRowIndex,"rowContent"],a.filter((m,f)=>o.dragIndex!==f)),_()(p,[...s,o.hoverRowIndex,"rowContent"],(0,h.W3)(c,c.length-1,o.hoverIndex));const u=$t(L()(p,s,[]));_()(r,s,u);break}case"REORDER_ROW":{const a=nt()(t),l=L()(a,[...s,o.dragRowIndex,"rowContent"],[]);_()(a,[...s,o.dragRowIndex,"rowContent"],(0,h.W3)(l,o.dragIndex,o.hoverIndex));const i=$t(L()(a,s,[]));_()(r,s,i);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:L()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:xd(o.name,t.modifiedData?.layouts?.edit)??es};break}case"SUBMIT_META_FORM":{_()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const a=nt()(L()(t,s,[])),l=Pd(t.metaToEdit,t.metaForm.size,a);l.length>0&&_()(r,s,$t(l));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}}),Sd=(t,o,r)=>{let s=nt()(o);return _()(s,["layouts","edit"],$t(Ld(o.layouts.edit))),{...t,initialData:s,modifiedData:s,componentLayouts:r}},rt=d(34853),ts=d(45112);const ns=({componentUid:t})=>{const{componentLayouts:o}=Rt(),{formatMessage:r}=(0,Q.Z)(),s=L()(o,[t],{}),a=L()(s,["layouts","edit"],[]);return e.createElement(P.x,{padding:3},a.map((l,i)=>e.createElement(Ye.r,{gap:4,key:i},l.map(c=>e.createElement(Le.P,{key:c.name,col:c.size},e.createElement(P.x,{paddingTop:2},e.createElement(w.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(H.Z,{textColor:"neutral800"},c.name))))))),e.createElement(P.x,{paddingTop:2},e.createElement(y.rU,{startIcon:e.createElement(ts.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,pe.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};ns.propTypes={componentUid:n().string.isRequired};var Ad=ns,Zt=d(14911);const $d=(0,S.ZP)(w.k)`
|
|
962
|
-
text-decoration: none;
|
|
963
|
-
|
|
964
|
-
&:focus,
|
|
965
|
-
&:hover {
|
|
966
|
-
${({theme:t})=>`
|
|
967
|
-
background-color: ${t.colors.primary100};
|
|
968
|
-
border-color: ${t.colors.primary200};
|
|
969
|
-
|
|
970
|
-
${H.Z} {
|
|
971
|
-
color: ${t.colors.primary600};
|
|
972
|
-
}
|
|
973
|
-
`}
|
|
974
|
-
|
|
975
|
-
/* > ComponentIcon */
|
|
976
|
-
> div:first-child {
|
|
977
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
978
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
`,os=({components:t})=>{const{componentLayouts:o}=Rt();return e.createElement(w.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement($d,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:r,padding:2,direction:"column",borderColor:"neutral200",as:Zt.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(cn,null),e.createElement(P.x,{paddingTop:1},e.createElement(H.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};os.propTypes={components:n().arrayOf(n().string).isRequired};var Zd=os;const rs=(0,S.ZP)(be.h)`
|
|
982
|
-
background-color: transparent;
|
|
983
|
-
path {
|
|
984
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
985
|
-
}
|
|
986
|
-
`,vo=({attribute:t,onEditField:o,onDeleteField:r,children:s})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(P.x,{overflow:"hidden",width:"100%"},e.createElement(w.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(H.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),e.createElement(w.k,null,e.createElement(rs,{label:a({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:o,icon:e.createElement(Ne.Z,null),noBorder:!0}),e.createElement(rs,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:r,icon:e.createElement(Se.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Ad,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(Zd,{components:t.components}))};vo.defaultProps={attribute:void 0},vo.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),onEditField:n().func.isRequired,onDeleteField:n().func.isRequired,children:n().string.isRequired};var Bd=vo;const Nd=(0,S.ZP)(w.k)`
|
|
987
|
-
position: relative;
|
|
988
|
-
${({isFirst:t,isLast:o,hasHorizontalPadding:r})=>t?`
|
|
989
|
-
padding-right: 4px;
|
|
990
|
-
`:o?`
|
|
991
|
-
padding-left: 4px;
|
|
992
|
-
`:r?`
|
|
993
|
-
padding: 0 4px;
|
|
994
|
-
`:""}
|
|
995
|
-
${({showRightCarret:t,showLeftCarret:o,theme:r})=>t?`
|
|
996
|
-
&:after {
|
|
997
|
-
content: '';
|
|
998
|
-
position: absolute;
|
|
999
|
-
right: -1px;
|
|
1000
|
-
background-color: ${r.colors.primary600};
|
|
1001
|
-
width: 2px;
|
|
1002
|
-
height: 100%;
|
|
1003
|
-
align-self: stretch;
|
|
1004
|
-
z-index: 1;
|
|
1005
|
-
}
|
|
1006
|
-
`:o?`
|
|
1007
|
-
&:before {
|
|
1008
|
-
content: '';
|
|
1009
|
-
position: absolute;
|
|
1010
|
-
left: -1px;
|
|
1011
|
-
background-color: ${r.colors.primary600};
|
|
1012
|
-
width: 2px;
|
|
1013
|
-
height: 100%;
|
|
1014
|
-
align-self: stretch;
|
|
1015
|
-
z-index: 1;
|
|
1016
|
-
}
|
|
1017
|
-
`:""};
|
|
1018
|
-
`,qd=(0,S.ZP)(de.Z)`
|
|
1019
|
-
height: ${12/16}rem;
|
|
1020
|
-
width: ${12/16}rem;
|
|
1021
|
-
path {
|
|
1022
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1023
|
-
}
|
|
1024
|
-
`,jd=(0,S.ZP)(w.k)`
|
|
1025
|
-
display: ${({dragStart:t})=>t?"none":"flex"};
|
|
1026
|
-
opacity: ${({isDragging:t,isFullSize:o,isHidden:r})=>t&&!o?.2:t&&o||r?0:1};
|
|
1027
|
-
`,Wd=(0,S.ZP)(w.k)`
|
|
1028
|
-
cursor: all-scroll;
|
|
1029
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
1030
|
-
`,Co=({attribute:t,children:o,index:r,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:p,rowIndex:u,size:m})=>{const[f,g]=(0,e.useState)(!1),E=i==="_TEMP_",{setIsDraggingSibling:b}=Rt(),v=m===12,k=(0,e.useRef)(null),I=(0,e.useRef)(null),[{clientOffset:M,isOver:F},D]=(0,Te.useDrop)({accept:h._Q.EDIT_FIELD,hover(q,z){if(!I.current||q.size!==12)return;const R=z.getItem().index,B=r,V=z.getItem().rowIndex,K=u;if(R===B&&V===K)return;const O=I.current.getBoundingClientRect(),A=(O.bottom-O.top)/2,ee=z.getClientOffset().y-O.top;V<K&&ee<A||V>K&&ee>A||(l(V,K),q.rowIndex=K,q.itemIndex=B)},drop(q,z){if(!I.current)return;const R=z.getItem().index,B=r,V=z.getItem().rowIndex,K=u;if(q.size===12||R===B&&V===K)return;const O=I.current.getBoundingClientRect();if(Math.abs(z.getClientOffset().x-O.left)>O.width/1.8){a(R,B+1,V,K),q.itemIndex=B+1,q.rowIndex=K;return}a(R,B,V,K),q.itemIndex=B,q.rowIndex=K},collect:q=>({canDrop:q.canDrop(),clientOffset:q.getClientOffset(),isOver:q.isOver(),isOverCurrent:q.isOver({shallow:!0}),itemType:q.getItemType()})}),[{isDragging:C,getItem:T},x,Z]=(0,Te.useDrag)({type:h._Q.EDIT_FIELD,item(){return b(!0),{index:r,labelField:o,rowIndex:u,name:i,size:m}},canDrag(){return i!=="_TEMP_"},collect:q=>({isDragging:q.isDragging(),getItem:q.getItem()}),end(){b(!1)}});(0,e.useEffect)(()=>{Z((0,Ge.rX)(),{captureDraggingState:!0})},[Z]);const W={dragRef:x(k),dropRef:D(I)};let N=!1,G=!1;if(I.current&&M){const q=I.current.getBoundingClientRect();N=F&&T.size!==12&&Math.abs(M.x-q.left)<q.width/2,G=F&&T.size!==12&&Math.abs(M.x-q.left)>q.width/2,i==="_TEMP_"&&(N=F&&T.size!==12,G=!1)}const $=()=>t&&v?`${74/16}rem`:`${32/16}rem`,Y=r===0&&!v,j=r===s&&!v,X=r!==0&&!v;return e.createElement(Le.P,{col:m},e.createElement(Nd,{ref:W.dropRef,showLeftCarret:N,showRightCarret:G,isFirst:Y,isLast:j,hasHorizontalPadding:X,onDrag:()=>{v&&!f&&g(!0)},onDragEnd:()=>{v&&g(!1)}},f&&v&&e.createElement(P.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(jd,{width:v&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:$(),alignItems:"stretch",isDragging:C,dragStart:f,isFullSize:v,isHidden:E},e.createElement(Wd,{as:"span",type:"button",ref:W.dragRef,onClick:q=>q.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(qd,null)),!E&&e.createElement(Bd,{attribute:t,onEditField:p,onDeleteField:c},o))))};Co.defaultProps={attribute:void 0},Co.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),children:n().string.isRequired,index:n().number.isRequired,moveItem:n().func.isRequired,moveRow:n().func.isRequired,name:n().string.isRequired,onDeleteField:n().func.isRequired,onEditField:n().func.isRequired,rowIndex:n().number.isRequired,lastIndex:n().number.isRequired,size:n().number.isRequired};var zd=Co;const ss=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:p,moveRow:u,moveItem:m}=Rt(),f=L()(c,[t.name],{}),g=L()(p,["metadatas",t.name,"edit","label"],"");return e.createElement(zd,{onEditField:()=>i(t.name),onDeleteField:()=>o(r,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:t.name,size:t.size,moveRow:u,moveItem:m},g||t.name)};ss.propTypes={index:n().number.isRequired,lastIndex:n().number.isRequired,onRemoveField:n().func.isRequired,rowId:n().number.isRequired,rowIndex:n().number.isRequired,rowItem:n().object.isRequired};var Ud=ss;const as=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(Ye.r,null,t.rowContent.map((s,a)=>e.createElement(Ud,{key:s.name,rowItem:s,index:a,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));as.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var Vd=as;const Hd=[{action:"plugin::content-type-builder.read",subject:null}];var Qd=()=>{const{trackUsage:t}=(0,y.rS)(),{formatMessage:o}=(0,Q.Z)(),{slug:r,modifiedData:s,isContentTypeView:a}=Rt(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=L()(s,"category",""),p=l==="content-types"?r:`${c}/${r}`,u=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(y.jW,{permissions:Hd},e.createElement(y.Qj,{to:`${i}/${p}`,onClick:u,size:"S",startIcon:e.createElement(Ne.Z,null),variant:"secondary"},o({id:(0,pe.Z)(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))};const is=({editLayout:t,fields:o,onRemoveField:r,onAddField:s})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(w.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(P.x,null,e.createElement(H.Z,{fontWeight:"bold"},a({id:(0,h.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(P.x,null,e.createElement(H.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(Qd,null)),e.createElement(P.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},t.map((l,i)=>e.createElement(Vd,{key:l.rowId,row:l,rowIndex:i,onRemoveField:r})),e.createElement(rt.O,{id:"label",label:a({id:(0,h.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:Ee.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(Ut.Z,null),endIcon:null,variant:"secondary",disabled:o.length===0},o.map(l=>e.createElement(rt.s,{key:l,onClick:()=>s(l)},l))))))};is.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var Gd=is,ls=d(85025),cs=d(55225),ds=d(31600),us=d(11406),Gt=d(32031),Kd=d(73779),yn=d(88675),Yd=d(22348),ms=d(7184),Ro=d(43475),Xd=d(82512),To=d(83218),Jd=d(872),_d=d(17757),eu=d(1176),tu=d(15431);const ps={biginteger:e.createElement(Gt.Z,null),boolean:e.createElement(Kd.Z,null),date:e.createElement(yn.Z,null),datetime:e.createElement(yn.Z,null),decimal:e.createElement(Gt.Z,null),email:e.createElement(Yd.Z,null),enum:e.createElement(ms.Z,null),enumeration:e.createElement(ms.Z,null),file:e.createElement(Ro.Z,null),files:e.createElement(Ro.Z,null),float:e.createElement(Gt.Z,null),integer:e.createElement(Gt.Z,null),media:e.createElement(Ro.Z,null),number:e.createElement(Gt.Z,null),relation:e.createElement(Xd.Z,null),string:e.createElement(To.Z,null),text:e.createElement(To.Z,null),richtext:e.createElement(To.Z,null),time:e.createElement(yn.Z,null),timestamp:e.createElement(yn.Z,null),json:e.createElement(Jd.Z,null),uid:e.createElement(_d.Z,null),component:e.createElement(eu.Z,null),dynamiczone:e.createElement(tu.Z,null)},Mo=({type:t,customFieldUid:o})=>{const r=(0,y.mZ)();let s=ps[t];if(o){const l=r.get(o).icon;l&&(s=e.createElement(P.x,{marginRight:3,width:7,height:6},e.createElement(l,null)))}return ps[t]?s:null};Mo.defaultProps={customFieldUid:null},Mo.propTypes={type:n().string.isRequired,customFieldUid:n().string};var gs=Mo,nu=t=>t.reduce((o,r)=>{const s=r?.attributes??{},a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(s?.[l]?.type??""));return o[r.uid]=a,o},{}),fs=t=>{let o;switch(t){case"description":case"label":case"placeholder":o="text";break;case"mainField":o="select";break;case"editable":o="bool";break;default:o=""}const r=t==="mainField"?(0,h.OB)("containers.SettingPage.editSettings.entry.title"):(0,h.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},Kt=d(9139);const Do=({type:t,options:o,onChange:r,value:s,name:a,...l})=>{const{formatMessage:i}=(0,Q.Z)();switch(t){case"text":return e.createElement(Nn.o,{onChange:r,value:s,name:a,...l});case"bool":return e.createElement(Kt.s,{onChange:c=>{r({target:{name:a,value:c.target.checked}})},checked:s,name:a,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...l});case"select":return e.createElement(ot.P,{value:s,name:a,onChange:c=>r({target:{name:a,value:c}}),...l},o.map(c=>e.createElement(we.W,{key:c,value:c},c)));default:return null}};Do.defaultProps={options:void 0},Do.propTypes={type:n().string.isRequired,options:n().arrayOf(n().string),onChange:n().func.isRequired,value:n().oneOfType([n().string,n().bool]).isRequired,name:n().string.isRequired};var ou=Do;const ru=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],su=[1,5,10,15,30,60],au=["datetime","time"],hs=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,Q.Z)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=Rt(),c=(0,e.useMemo)(Cn,[]),{schemas:p}=(0,me.v9)(D=>c(D),me.wU),u=(0,me.v9)(_o),m=(0,e.useMemo)(()=>{if(!a)return[];const D=L()(s,["metadatas",a,"edit"],{});return Object.keys(D).filter(C=>C!=="visible")},[a,s]),f=(0,e.useMemo)(()=>nu(p),[p]),g=(0,e.useCallback)(D=>{if(D!=="relation"&&D!=="component")return[];const C=D==="component"?"component":"targetModel",T=L()(s,["attributes",a,C],"");return L()(f,[T],[])},[a,f,s]),E=m.map(D=>{const C=L()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(D)||C==="component"&&D!=="label"||["media","json","boolean"].includes(C)&&D==="placeholder"||D==="step"?null:e.createElement(Le.P,{col:6,key:D},e.createElement(ou,{type:fs(D).type,hint:D==="mainField"?r({id:(0,pe.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:L()(fs(D),"label.id","app.utils.defaultMessage")}),name:D,onChange:t,value:L()(i,["metadata",D],""),options:g(C)}))}),{type:b,customField:v}=l[a],{isResizable:k}=u[v]??u[b],I=e.createElement(Le.P,{col:6,key:"size"},e.createElement(ot.P,{value:i?.size,name:"size",onChange:D=>{o({name:a,value:D})},label:r({id:(0,pe.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},ru.map(([D,C])=>e.createElement(we.W,{key:D,value:D},C)))),M=au.includes(l[a].type),F=e.createElement(Le.P,{col:6,key:"step"},e.createElement(ot.P,{value:L()(i,["metadata","step"],1),name:"step",onChange:D=>t({target:{name:"step",value:D}}),label:r({id:(0,pe.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},su.map(D=>e.createElement(we.W,{key:D,value:D},D))));return e.createElement(e.Fragment,null,E,k&&I,M&&F)};hs.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var iu=hs;const lu=(0,S.ZP)(w.k)`
|
|
1031
|
-
svg {
|
|
1032
|
-
width: ${32/16}rem;
|
|
1033
|
-
height: ${24/16}rem;
|
|
1034
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
1035
|
-
}
|
|
1036
|
-
`,ko=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=Rt(),{formatMessage:c}=(0,Q.Z)(),p=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return e.createElement(ls.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:s},e.createElement(cs.x,null,e.createElement(lu,null,e.createElement(gs,{type:p(),customFieldUid:l}),e.createElement(H.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:Qt()(i)})))),e.createElement(ds.f,null,e.createElement(Ye.r,{gap:4},e.createElement(iu,{onMetaChange:o,onSizeChange:r}))),e.createElement(us.m,{startActions:e.createElement(Ee.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Ee.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};ko.defaultProps={customFieldUid:null},ko.propTypes={customFieldUid:n().string,onSubmit:n().func.isRequired,onToggle:n().func.isRequired,onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired,type:n().string.isRequired};var cu=ko,du=(t,o,r)=>{const{put:s}=(0,y.tg)();return s((0,h.IF)(r?`content-types/${o}/configuration`:`components/${o}/configuration`),t)};const Io=({mainLayout:t,components:o,isContentTypeView:r,slug:s,updateLayout:a})=>{const[l,i]=(0,e.useReducer)(Fd,Eo,()=>Sd(Eo,t,o)),[c,p]=(0,e.useState)(!1),{trackUsage:u}=(0,y.rS)(),m=(0,y.lm)(),{goBack:f}=(0,J.k6)(),[g,E]=(0,e.useState)(!1),[b,v]=(0,e.useState)(!1),{componentLayouts:k,initialData:I,modifiedData:M,metaToEdit:F,metaForm:D}=l,{formatMessage:C}=(0,Q.Z)(),T=L()(t,["info","displayName"],""),x=L()(M,["attributes"],{}),Z=(0,me.v9)(_o),W=Object.keys(x).filter(U=>{const ie=L()(x,[U,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ie)&&!!ie}),N=L()(M,["layouts","edit"],[]),G=Kr()(N,"rowContent"),$=Object.keys(M.attributes).filter(U=>L()(M,["metadatas",U,"edit","visible"],!1)===!0).filter(U=>G.findIndex(ie=>ie.name===U)===-1).sort(),Y=({target:{name:U,value:ie}})=>{i({type:"ON_CHANGE",keys:U.split("."),value:ie})},j=()=>{E(U=>!U)},X=()=>{v(U=>!U)},q=({target:{name:U,value:ie}})=>{i({type:"ON_CHANGE_META",keys:U.split("."),value:ie})},z=({name:U,value:ie})=>{i({type:"ON_CHANGE_SIZE",name:U,value:ie})},R=U=>{U.preventDefault(),i({type:"SUBMIT_META_FORM"}),j()},B=U=>{U.preventDefault(),X()},V=(0,Tt.useMutation)(U=>du(U,s,r),{onSuccess({data:U}){a&&a(U.data),i({type:"SUBMIT_SUCCEEDED"}),X(),u("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:K}=V,O=()=>{const U=jn()(nt()(M),["layouts","metadatas","settings"]);_()(U,"layouts.edit",wd(U.layouts.edit)),V.mutate(U)},A=(U,ie)=>{i({type:"MOVE_RELATION",fromIndex:U,toIndex:ie})},oe=(U,ie)=>{i({type:"MOVE_FIELD",fromIndex:U,toIndex:ie})},ee=(U,ie,$e,dt)=>{i($e===dt?{type:"REORDER_ROW",dragRowIndex:$e,dragIndex:U,hoverIndex:ie}:{type:"REORDER_DIFF_ROW",dragIndex:U,hoverIndex:ie,dragRowIndex:$e,hoverRowIndex:dt})},ae=(U,ie)=>{i({type:"MOVE_ROW",fromIndex:U,toIndex:ie})};return e.createElement(ut,{isContentTypeView:r,attributes:x,modifiedData:M,slug:s,componentLayouts:k,selectedField:F,fieldForm:D,onMoveRelation:A,onMoveField:oe,moveRow:ae,moveItem:ee,setEditFieldToSelect:U=>{i({type:"SET_FIELD_TO_EDIT",name:U}),j()},isDraggingSibling:c,setIsDraggingSibling:p},e.createElement(Ie.o,null,e.createElement("form",{onSubmit:B},e.createElement(ye.T,{title:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${Qt()(T)}`},{name:Qt()(T)}),subtitle:C({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(y.rU,{startIcon:e.createElement(mn.Z,null),onClick:U=>{U.preventDefault(),f()},to:"/"},C({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(Ee.z,{disabled:Vt()(I,M),startIcon:e.createElement(At.Z,null),type:"submit"},C({id:"global.save",defaultMessage:"Save"}))}),e.createElement(Pt.D,null,e.createElement(P.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(H.Z,{variant:"delta",as:"h2"},C({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(Ye.r,null,e.createElement(Le.P,{col:6,s:12},e.createElement(ot.P,{label:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:C({id:(0,h.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:U=>{Y({target:{name:"settings.mainField",value:U===""?null:U}})},value:M.settings.mainField},W.map(U=>e.createElement(we.W,{key:U,value:U},U))))),e.createElement(P.x,{paddingTop:2,paddingBottom:2},e.createElement(_r.i,null)),e.createElement(H.Z,{variant:"delta",as:"h3"},C({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(Gd,{attributes:x,editLayout:N,fields:$,onAddField:U=>{i({type:"ON_ADD_FIELD",name:U,fieldSizes:Z})},onRemoveField:(U,ie)=>{i({type:"REMOVE_FIELD",rowIndex:U,fieldIndex:ie})}})))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(At.Z,null),isConfirmButtonLoading:K,isOpen:b,onToggleDialog:X,onConfirm:O,variantRightButton:"success-light"})),g&&e.createElement(cu,{onSubmit:R,onToggle:j,onMetaChange:q,onSizeChange:z,type:L()(x,[F,"type"],""),customFieldUid:L()(x,[F,"customField"],"")})))};Io.defaultProps={isContentTypeView:!1,updateLayout:null},Io.propTypes={components:n().object.isRequired,isContentTypeView:n().bool,mainLayout:n().shape({attributes:n().object.isRequired,info:n().object.isRequired,layouts:n().shape({list:n().array.isRequired,edit:n().array.isRequired}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired}).isRequired,slug:n().string.isRequired,updateLayout:n().func};var Oo=Io,Bt=d(37617);const uu=()=>({type:Bt.ZA}),mu=(t,o)=>({type:Bt.Id,pagination:t,data:o}),pu=()=>({type:Bt.MP});function gu(){return{type:Bt.c2}}const fu=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:Bt.Zz}},Lo=t=>({type:Bt.Rp,target:t});var ys=d(6680),wo=d(94638),bs=d(99223),hu=d(70664);const yu=()=>t=>t["content-manager_listView"]||hu.E,bu=()=>(0,wt.P1)(yu(),t=>t),Es=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var Eu=bu,vu=d(35658),Cu=d(94547),xo=d(19786),Ru=d(44426),Tu=d(47765),Mu=d(8997),Du=d(69033);const ku=(0,S.ZP)(w.k)`
|
|
1037
|
-
position: relative;
|
|
1038
|
-
border-radius: 50%;
|
|
1039
|
-
width: 26px;
|
|
1040
|
-
height: 26px;
|
|
1041
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
1042
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
1043
|
-
padding-left: 1px;
|
|
1044
|
-
|
|
1045
|
-
span {
|
|
1046
|
-
line-height: 0.6rem;
|
|
1047
|
-
font-size: 0.6rem;
|
|
1048
|
-
}
|
|
1049
|
-
`,vs=({children:t,...o})=>e.createElement(ku,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(H.Z,{variant:"sigma",textColor:"neutral600"},t));vs.propTypes={children:n().string.isRequired};var Cs=vs;const Po=({url:t,mime:o,alternativeText:r,name:s,ext:a,formats:l})=>{const i=(0,y.CR)(t);if(o.includes("image")){const u=l?.thumbnail?.url||null,m=(0,y.CR)(u)||i;return e.createElement(Du.q,{src:m,alt:r||s,preview:!0})}const c=(0,y.mD)(a),p=s.length>100?`${s.substring(0,100)}...`:s;return e.createElement(en.u,{description:p},e.createElement(Cs,null,c))};Po.defaultProps={alternativeText:null,formats:null},Po.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var Rs=Po,Iu=d(25898);const Ts=({value:t})=>e.createElement(Iu.H,null,t.map((o,r)=>{const s=`${o.id}${r}`;if(r===3){const a=`+${t.length-3}`;return e.createElement(Cs,{key:s,preview:!1},a)}return r>3?null:e.createElement(Rs,{key:s,...o})}));Ts.propTypes={value:n().arrayOf(n().shape({alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired})).isRequired};var Ou=Ts,Ms=d(6518),Lu=d(97405),wu=d(96315);const Ds=({type:t,value:o})=>{const{formatDate:r,formatTime:s,formatNumber:a}=(0,Q.Z)();let l=o;if(t==="date"&&(l=r((0,wu.Z)(o),{dateStyle:"full"})),t==="datetime"&&(l=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,c,p]=o.split(":"),u=new Date;u.setHours(i),u.setMinutes(c),u.setSeconds(p),l=s(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(l=a(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(l=a(o,{maximumFractionDigits:0})),$r()(l)};Ds.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Nt=Ds;const xu=(0,S.ZP)(H.Z)`
|
|
1050
|
-
max-width: 500px;
|
|
1051
|
-
`,Pu=async(t,o,r)=>{const{data:{results:s,pagination:a}}=await r(t);return o(),{results:s,pagination:a}},ks=({fieldSchema:t,metadatas:o,name:r,entityId:s,value:a,contentType:l})=>{const{formatMessage:i}=(0,Q.Z)(),{notifyStatus:c}=(0,wo.G)(),p=(0,e.useMemo)(()=>(0,h.IF)(`relations/${l.uid}/${s}/${r.split(".")[0]}`),[s,r,l]),[u,m]=(0,e.useState)(!1),{get:f}=(0,y.kY)(),g=e.createElement(w.k,{gap:1,wrap:"nowrap"},e.createElement(Ms.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),E=()=>{const k=i({id:(0,h.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(k)},{data:b,status:v}=(0,Tt.useQuery)([t.targetModel,s],()=>Pu(p,E,f),{enabled:u,staleTime:0,select:k=>({...k,results:[...k.results].reverse()})});return e.createElement(P.x,{...y.UW},e.createElement(rt.O,{label:g,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},v!=="success"&&e.createElement(rt.s,{"aria-disabled":!0},e.createElement(Lu.a,{small:!0},i({id:(0,h.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),v==="success"&&e.createElement(e.Fragment,null,b?.results.map(k=>e.createElement(rt.s,{key:k.id,"aria-disabled":!0},e.createElement(xu,{ellipsis:!0},e.createElement(Nt,{type:o.mainField.schema.type,value:k[o.mainField.name]||k.id})))),b?.pagination.total>10&&e.createElement(rt.s,{"aria-disabled":!0,"aria-label":i({id:(0,h.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(H.Z,null,"\u2026")))))};ks.propTypes={contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({relation:n().string,targetModel:n().string,type:n().string.isRequired}).isRequired,metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,name:n().string.isRequired,entityId:n().oneOfType([n().string,n().number]).isRequired,value:n().object.isRequired};var Fu=ks;const Su=(0,S.ZP)(H.Z)`
|
|
1052
|
-
max-width: 500px;
|
|
1053
|
-
`,Is=({metadatas:t,value:o})=>e.createElement(Su,{textColor:"neutral800",ellipsis:!0},e.createElement(Nt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));Is.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,value:n().object.isRequired};var Au=Is;const $u=(0,S.ZP)(H.Z)`
|
|
1054
|
-
max-width: 500px;
|
|
1055
|
-
`,Os=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,Q.Z)(),{mainField:{type:s,name:a}}=o,l=e.createElement(e.Fragment,null,e.createElement(Ms.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(P.x,{...y.UW},e.createElement(rt.O,{label:l,size:"S"},t.map(i=>e.createElement(rt.s,{key:i.id,"aria-disabled":!0},e.createElement($u,{ellipsis:!0},e.createElement(Nt,{type:s,value:i[a]||i.id}))))))};Os.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var Zu=Os;const Bu=(0,S.ZP)(H.Z)`
|
|
1056
|
-
max-width: 250px;
|
|
1057
|
-
`,Ls=({value:t,metadatas:o})=>{const{mainField:r}=o,s=t[r.name];return e.createElement(en.u,{label:s},e.createElement(Bu,{textColor:"neutral800",ellipsis:!0},e.createElement(Nt,{type:r.type,value:s})))};Ls.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var Nu=Ls,qu=d(80022),ws=d.n(qu);function xs(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}function ju(t,o,r,s){if(t==="component"){const{mainField:{name:a,type:l}}=r;if(s?.repeatable)return o.length>0;const i=o?.[a];return a==="id"&&![void 0,null].includes(i)?!0:Ht(l)&&l!=="biginteger"&&a!=="id"?ws()(i):!Ae()(i)}return t==="relation"?xs(s.relation)?!Ae()(o):o?.count>0:Ht(t)&&t!=="biginteger"?ws()(o):t==="boolean"?o!==null:!Ae()(o)}const Ps=(0,S.ZP)(H.Z)`
|
|
1058
|
-
max-width: 300px;
|
|
1059
|
-
`,Fo=({content:t,fieldSchema:o,metadatas:r,name:s,rowId:a,contentType:l})=>{const{type:i}=o;if(!ju(i,t,r,o))return e.createElement(H.Z,{textColor:"neutral800"},"-");switch(i){case"media":return o.multiple?e.createElement(Ou,{value:t}):e.createElement(Rs,{...t});case"relation":return xs(o.relation)?e.createElement(Au,{metadatas:r,value:t}):e.createElement(Fu,{fieldSchema:o,metadatas:r,value:t,name:s,entityId:a,contentType:l});case"component":return o.repeatable===!0?e.createElement(Zu,{value:t,metadatas:r}):e.createElement(Nu,{value:t,metadatas:r});case"string":return e.createElement(en.u,{description:t},e.createElement(Ps,{ellipsis:!0,textColor:"neutral800"},e.createElement(Nt,{type:i,value:t})));default:return e.createElement(Ps,{ellipsis:!0,textColor:"neutral800"},e.createElement(Nt,{type:i,value:t}))}};Fo.defaultProps={content:void 0},Fo.propTypes={content:n().any,contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({component:n().string,multiple:n().bool,type:n().string.isRequired,repeatable:n().bool,relation:n().string}).isRequired,metadatas:n().object.isRequired,name:n().string.isRequired,rowId:n().oneOfType([n().string,n().number]).isRequired};var Wu=Fo;const So=({canCreate:t,canDelete:o,contentType:r,headers:s,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:p,rows:u})=>{const{push:m,location:{pathname:f}}=(0,J.k6)(),{formatMessage:g}=(0,Q.Z)(),{trackUsage:E}=(0,y.rS)(),b=rr();return e.createElement(vu.p,null,u.map((v,k)=>{const I=a.findIndex(F=>F===v.id)!==-1,M=g({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:k});return e.createElement(Cu.Tr,{key:v.id,...(0,y.X7)({fn(){E("willEditEntryFromList"),m({pathname:`${f}/${v.id}`,state:{from:f},search:b})},condition:p})},c&&e.createElement(xo.Td,{...y.UW},e.createElement(Ru.C,{"aria-label":g({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Mu.Pp)(v.firstname,v.lastname)}),checked:I,onChange:()=>{i({name:v.id,value:!I})}})),s.map(({key:F,cellFormatter:D,name:C,...T})=>e.createElement(xo.Td,{key:F},typeof D=="function"?D(v,{key:F,name:C,...T}):e.createElement(Wu,{content:v[C.split(".")[0]],name:C,contentType:r,...T,rowId:v.id}))),p&&e.createElement(xo.Td,null,e.createElement(w.k,{justifyContent:"end",...y.UW},e.createElement(be.h,{forwardedAs:Zt.rU,onClick:()=>{E("willEditEntryFromButton")},to:{pathname:`${f}/${v.id}`,state:{from:f},search:b},label:g({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:M}),noBorder:!0,icon:e.createElement(Ne.Z,null)}),t&&e.createElement(P.x,{paddingLeft:1},e.createElement(be.h,{forwardedAs:Zt.rU,to:{pathname:`${f}/create/clone/${v.id}`,state:{from:f},search:b},label:g({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:M}),noBorder:!0,icon:e.createElement(Tu.Z,null)})),o&&e.createElement(P.x,{paddingLeft:1},e.createElement(be.h,{onClick:()=>{E("willDeleteEntryFromList"),l(v.id)},label:g({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:M}),noBorder:!0,icon:e.createElement(Se.Z,null)})))))}))};So.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},So.propTypes={canCreate:n().bool,canDelete:n().bool,contentType:n().shape({uid:n().string.isRequired}).isRequired,entriesToDelete:n().array,headers:n().array.isRequired,onClickDelete:n().func,onSelectRow:n().func,rows:n().array,withBulkActions:n().bool,withMainAction:n().bool};var zu=So;const Fs=({area:t,...o})=>{const r=gr(t);return r?e.createElement("ul",null,r.map(s=>s.Component(o)?e.createElement(P.x,{key:s.name,padding:3,style:{textAlign:"center"}},e.createElement(s.Component,{...o})):null)):null};Fs.propTypes={area:n().string.isRequired};var Ss=Fs;const As=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:s})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(pn.V,{onClose:r,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(gn.a,{icon:e.createElement(Wt.Z,null)},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(w.k,{justifyContent:"center"},e.createElement(H.Z,{id:"confirm-description"},a({id:(0,h.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),e.createElement(w.k,null,e.createElement(Ss,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(fn.c,{startAction:e.createElement(Ee.z,{onClick:r,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(Ee.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Se.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};As.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var Uu=As;const $s=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:s})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(pn.V,{onClose:r,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(gn.a,{icon:e.createElement(Wt.Z,null)},e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(w.k,{justifyContent:"center"},e.createElement(H.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(w.k,null,e.createElement(Ss,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(fn.c,{startAction:e.createElement(Ee.z,{onClick:r,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(Ee.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(Se.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};$s.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var Vu=$s;function Zs({isPublished:t}){const{formatMessage:o}=(0,Q.Z)(),r=t?"success":"secondary";return e.createElement(Pe.q,{showBullet:!1,variant:r,size:"S",width:"min-content"},e.createElement(H.Z,{fontWeight:"bold",textColor:`${r}700`},o({id:(0,h.OB)(`containers.List.${t?"published":"draft"}`),defaultMessage:t?"Published":"Draft"})))}Zs.propTypes={isPublished:n().bool.isRequired};const Hu=(()=>window&&window.strapi&&window.strapi.isEE?d(57047).Z:d(42814).Z)(),Ao=t=>{let{canCreate:o,canDelete:r,contentTypeName:s,action:a,isBulkable:l,isLoading:i,onConfirmDelete:c,onConfirmDeleteAll:p,layout:u,rows:m}=t;const{runHookWaterfall:f}=(0,y.j1)(),g=u.contentType.options?.draftAndPublish??!1,{formatMessage:E}=(0,Q.Z)(),b=(0,me.v9)(Es),v=(0,e.useMemo)(()=>{const I=f(nn.No,{displayedHeaders:b,layout:u}).displayedHeaders.map(F=>{const{fieldSchema:D,metadatas:C,name:T}=F;return{...F,metadatas:{...C,label:E({id:(0,h.OB)(`containers.ListPage.table-headers.${T}`),defaultMessage:C.label})},name:D.type==="relation"?`${T}.${C.mainField.name}`:T}});g&&I.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:E({id:(0,h.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(F){let{publishedAt:D}=F;return e.createElement(Zs,{isPublished:!!D})}});const M=Hu(u);return M&&I.push(M),I},[f,b,u,g,E]);return e.createElement(y.tM,{components:{ConfirmDialogDelete:Vu,ConfirmDialogDeleteAll:Uu},contentType:s,action:a,isLoading:i,headers:v,onConfirmDelete:c,onConfirmDeleteAll:p,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:m,withBulkActions:!0,withMainAction:r&&l},e.createElement(zu,{canCreate:o,canDelete:r,contentType:u.contentType,headers:v,rows:m,withBulkActions:!0,withMainAction:r&&l}))};Ao.defaultProps={action:void 0},Ao.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,contentTypeName:n().string.isRequired,action:n().node,isBulkable:n().bool.isRequired,isLoading:n().bool.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,onConfirmDelete:n().func.isRequired,onConfirmDeleteAll:n().func.isRequired,rows:n().array.isRequired};var Qu=Ao;const Gu=["json","component","media","richtext","dynamiczone","password"],Ku=["createdAt","updatedAt"];var Yu=(t,o)=>{const{allPermissions:r}=(0,y.vn)(),s=(0,y.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),a=L()(s,["0","properties","fields"],[]);return Object.keys(L()(t,["attributes"]),{}).filter(c=>{const p=L()(t,["attributes",c],{});return!(!p.type||Gu.includes(p.type)||!a.includes(c)&&c!=="id"&&!Ku.includes(c))}).sort()},Xu=d(5644);const Bs=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:s}=(0,Q.Z)(),a=(0,e.useRef)(),{trackUsage:l}=(0,y.rS)(),i=()=>{o||l("willFilterEntries"),r(c=>!c)};return e.createElement(e.Fragment,null,e.createElement(P.x,{paddingTop:1,paddingBottom:1},e.createElement(Ee.z,{variant:"tertiary",ref:a,startIcon:e.createElement(Xu.Z,null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(y.J5,{displayedFilters:t,isVisible:o,onToggle:i,source:a})),e.createElement(y.W$,{filtersSchema:t}))};Bs.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var Ju=Bs;const Ns=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:s}=(0,Q.Z)(),l=Yu(t,o).map(i=>{const c=t.attributes[i],{type:p,enum:u}=c,m={name:"didFilterEntries",properties:{useRelation:p==="relation"}},{mainField:f,label:g}=r[i].list;return{name:i,metadatas:{label:s({id:g,defaultMessage:g})},fieldSchema:{type:p,options:u,mainField:f},trackedEvent:m}});return e.createElement(Ju,{displayedFilters:l})};Ns.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var _u=Ns,em=t=>Object.keys(t).reduce((r,s)=>{const a=t[s];return(0,h.ko)(a)&&r.push(s),r},[]).sort();const qs=({layout:t})=>{const o=(0,me.I0)(),r=(0,me.v9)(Es),{trackUsage:s}=(0,y.rS)(),{formatMessage:a}=(0,Q.Z)(),l=em(t.contentType.attributes).map(p=>{const u=t.contentType.metadatas[p].list;return{name:p,intlLabel:{id:u.label,defaultMessage:u.label}}}),i=r.map(({name:p})=>p),c=p=>{if(s("didChangeDisplayedFields"),p.length<i.length){const u=i.filter(m=>p.indexOf(m)===-1);o(Lo({name:u[0],value:!0}))}else{const u=p.filter(m=>i.indexOf(m)===-1);o(Lo({name:u[0],value:!1}))}};return e.createElement(P.x,{paddingTop:1,paddingBottom:1},e.createElement(ot.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:p=>a({id:(0,pe.Z)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:p.length}),multi:!0,size:"S"},l.map(p=>e.createElement(we.W,{key:p.name,value:p.name},a({id:p.intlLabel.id||p.name,defaultMessage:p.intlLabel.defaultMessage||p.name})))))};qs.propTypes={layout:n().shape({contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired};var tm=(0,e.memo)(qs);const $o=({pagination:t})=>e.createElement(P.x,{paddingTop:4},e.createElement(w.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(y.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(y.tU,{pagination:t})));$o.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},$o.propTypes={pagination:n().shape({page:n().number,pageCount:n().number,pageSize:n().number,total:n().number})};var nm=$o;const om=Oe.Z.contentManager,rm=(0,S.ZP)(P.x)`
|
|
1060
|
-
svg {
|
|
1061
|
-
path {
|
|
1062
|
-
fill: ${({theme:t})=>t.colors.neutral900};
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
`;function js({canCreate:t,canDelete:o,canRead:r,data:s,getData:a,getDataSucceeded:l,isLoading:i,layout:c,pagination:p,slug:u}){const{total:m}=p,{contentType:f}=c,{metadatas:g,settings:{bulkable:E,filterable:b,searchable:v}}=f,k=(0,y.lm)(),{trackUsage:I}=(0,y.rS)(),{refetchPermissions:M}=(0,y.vn)(),F=(0,e.useRef)(I),D=(0,e.useRef)(M),{notifyStatus:C}=(0,wo.G)(),{formatAPIError:T}=(0,y.So)(h.OB);(0,y.go)();const[{query:x}]=(0,y.Kx)(),Z=Ur(x),W=(0,ct.stringify)({plugins:x.plugins},{encode:!1}),{pathname:N}=(0,J.TH)(),{push:G}=(0,J.k6)(),{formatMessage:$}=(0,Q.Z)(),Y=f.options?.draftAndPublish??!1,j=(0,y.kY)(),{post:X,del:q}=j,z=(0,e.useRef)(""),R=(0,e.useCallback)(async(ee,ae)=>{a();try{const U=ae?{cancelToken:ae.token}:null,{data:{results:ie,pagination:$e}}=await j.get(ee,U);C($({id:(0,h.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:$e.count})),l($e,ie)}catch(U){if(Ue.Z.isCancel(U))return;if((U?.response?.status??null)===403){await D.current(),k({type:"info",message:{id:(0,h.OB)("permissions.not-allowed.update")}}),G("/");return}k({type:"warning",message:{id:(0,h.OB)("error.model.fetch")}})}},[$,a,l,C,G,k,j]),B=(0,e.useCallback)(async ee=>{try{await X((0,h.IF)(`collection-types/${u}/actions/bulkDelete`),{ids:ee});const ae=(0,h.IF)(`collection-types/${u}${Z}`);R(ae),F.current("didBulkDeleteEntries")}catch(ae){k({type:"warning",message:T(ae)})}},[R,Z,u,k,T,X]),V=(0,e.useCallback)(async ee=>{try{await q((0,h.IF)(`collection-types/${u}/${ee}`));const ae=(0,h.IF)(`collection-types/${u}${Z}`);R(ae),k({type:"success",message:{id:(0,h.OB)("success.record.delete")}})}catch(ae){k({type:"warning",message:T(ae)})}},[u,Z,R,k,T,q]);(0,e.useEffect)(()=>{const ae=Ue.Z.CancelToken.source(),U=r,ie=(0,h.IF)(`collection-types/${u}${Z}`);return U&&ie.includes(z.current)&&R(ie,ae),()=>{z.current=u,ae.cancel("Operation canceled by the user.")}},[r,a,u,Z,l,R]);const K=$({id:(0,h.OB)("header.name"),defaultMessage:"Content"}),O=$({id:f.info.displayName,defaultMessage:f.info.displayName||K}),A=r?$({id:(0,h.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,oe=ee=>t?e.createElement(Ee.z,{...ee,forwardedAs:Zt.rU,onClick:()=>{const ae=Y?{status:"draft"}:{};F.current("willCreateEntry",ae)},to:{pathname:`${N}/create`,search:x.plugins?W:""},startIcon:e.createElement(Ut.Z,null),style:{textDecoration:"none"}},$({id:(0,h.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(Ie.o,{"aria-busy":i},e.createElement(ye.T,{primaryAction:oe(),subtitle:A,title:O,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(mn.Z,null),to:"/content-manager/"},$({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(bs.Z,{endActions:e.createElement(on,{area:"contentManager.listView.actions"})}),r&&e.createElement(bs.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(on,{area:"contentManager.listView.actions"}),e.createElement(tm,{layout:c}),e.createElement(y.jW,{permissions:om.collectionTypesConfigurations},e.createElement(rm,{paddingTop:1,paddingBottom:1},e.createElement(be.h,{onClick:()=>{I("willEditListLayout")},forwardedAs:Zt.rU,to:{pathname:`${u}/configurations/list`,search:W},icon:e.createElement(ts.Z,null),label:$({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,v&&e.createElement(y.m,{label:$({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:O}),placeholder:$({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),b&&e.createElement(_u,{contentType:f,slug:u,metadatas:g}))}),e.createElement(Pt.D,null,r?e.createElement(e.Fragment,null,e.createElement(Qu,{canCreate:t,canDelete:o,contentTypeName:O,onConfirmDeleteAll:B,onConfirmDelete:V,isBulkable:E,isLoading:i,layout:c,rows:s,action:oe({variant:"secondary"})}),e.createElement(nm,{pagination:{pageCount:p?.pageCount||1}})):e.createElement(y.ZF,null)))}js.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,isLoading:n().bool.isRequired,getData:n().func.isRequired,getDataSucceeded:n().func.isRequired,pagination:n().shape({total:n().number.isRequired,pageCount:n().number}).isRequired,slug:n().string.isRequired};const sm=Eu();function am(t){return(0,ys.bindActionCreators)({getData:uu,getDataSucceeded:mu,onChangeListHeaders:Lo,onResetListHeaders:pu},t)}const im=(0,me.$j)(sm,am);var lm=(0,ys.compose)(im)((0,e.memo)(js,ft()));const Zo=t=>{const o=(0,e.useMemo)(()=>(0,h.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:s}=(0,y.ss)(o,t.permissions);return r?e.createElement(y.dO,null):e.createElement(lm,{...t,...s})};Zo.defaultProps={permissions:[]},Zo.propTypes={permissions:n().array,slug:n().string.isRequired};var cm=(0,e.memo)(Zo,(t,o)=>{const r=(0,y.e5)(t,o);return Object.keys(r).filter(a=>a!=="state").length>0});const Ws=({layout:t,...o})=>{const r=(0,me.I0)(),{replace:s}=(0,J.k6)(),[{query:a,rawQuery:l}]=(0,y.Kx)(),i=ar(a,o.slug,"listView"),c=or(o.slug);return(0,e.useEffect)(()=>{l||s(c)},[l,s,c]),(0,e.useEffect)(()=>{r(fu(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(gu())},[r]),i?e.createElement(cm,{...o,layout:t,permissions:i}):null};Ws.propTypes={layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired,pluginOptions:n().object}).isRequired}).isRequired,slug:n().string.isRequired};var dm=Ws,um=(t,o)=>{const{put:r}=(0,y.tg)();return r((0,h.IF)(`content-types/${o}/configuration`),t)};const Bo=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:s}=(0,Q.Z)(),{settings:a,metadatas:l}=t;return e.createElement(w.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(H.Z,{variant:"delta",as:"h2"},s({id:(0,h.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(w.k,{justifyContent:"space-between",gap:4},e.createElement(P.x,{width:"100%"},e.createElement(Kt.s,{label:s({id:(0,h.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{o({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),e.createElement(P.x,{width:"100%"},e.createElement(Kt.s,{label:s({id:(0,h.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{o({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),e.createElement(P.x,{width:"100%"},e.createElement(Kt.s,{label:s({id:(0,h.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{o({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),e.createElement(Ye.r,{gap:4},e.createElement(Le.P,{s:12,col:6},e.createElement(ot.P,{label:s({id:(0,h.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:(0,h.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>o({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(i=>e.createElement(we.W,{key:i,value:i},i)))),e.createElement(Le.P,{s:12,col:3},e.createElement(ot.P,{label:s({id:(0,h.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>o({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},r.map(i=>e.createElement(we.W,{key:i,value:i},l[i].list.label||i)))),e.createElement(Le.P,{s:12,col:3},e.createElement(ot.P,{label:s({id:(0,h.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>o({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>e.createElement(we.W,{key:i,value:i},i))))))};Bo.defaultProps={modifiedData:{},sortOptions:[]},Bo.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var mm=Bo;const No=S.ZP.button`
|
|
1066
|
-
display: flex;
|
|
1067
|
-
align-items: center;
|
|
1068
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
1069
|
-
|
|
1070
|
-
&:last-child {
|
|
1071
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
1072
|
-
}
|
|
1073
|
-
`,zs=(0,S.ZP)(No)`
|
|
1074
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
1075
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
1076
|
-
cursor: all-scroll;
|
|
1077
|
-
|
|
1078
|
-
svg {
|
|
1079
|
-
width: ${12/16}rem;
|
|
1080
|
-
height: ${12/16}rem;
|
|
1081
|
-
}
|
|
1082
|
-
`,pm=(0,S.ZP)(w.k)`
|
|
1083
|
-
max-height: ${32/16}rem;
|
|
1084
|
-
cursor: pointer;
|
|
1085
|
-
|
|
1086
|
-
svg {
|
|
1087
|
-
width: ${10/16}rem;
|
|
1088
|
-
height: ${10/16}rem;
|
|
1089
|
-
|
|
1090
|
-
path {
|
|
1091
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
&:hover {
|
|
1096
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
1097
|
-
border-color: ${({theme:t})=>t.colors.primary200};
|
|
1098
|
-
|
|
1099
|
-
svg {
|
|
1100
|
-
path {
|
|
1101
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
${H.Z} {
|
|
1106
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
${zs} {
|
|
1110
|
-
border-right: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
`,gm=(0,S.ZP)(P.x)`
|
|
1114
|
-
&:last-child {
|
|
1115
|
-
padding-right: ${({theme:t})=>t.spaces[3]};
|
|
1116
|
-
}
|
|
1117
|
-
`,Us=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:p}=(0,Q.Z)(),u=(0,e.useRef)(null),m=(0,e.useRef)(null),[,f]=(0,e.useState)(!1),g=(0,e.useRef)(),E=mt(r),b=()=>{g.current&&g.current.click()},[,v]=(0,Te.useDrop)({accept:h._Q.FIELD,hover(D,C){if(!m.current)return;const T=D.index,x=t;if(T===x)return;const Z=m.current.getBoundingClientRect(),W=(Z.right-Z.left)/2,G=C.getClientOffset().x-Z.left;T>x&&G>W||T<x&&G<W||(a(T,x),D.index=x)}}),[{isDragging:k},I,M]=(0,Te.useDrag)({type:h._Q.FIELD,item(){return{index:t,labelField:r,name:i}},collect:D=>({isDragging:D.isDragging()}),end(){c(!1)}});(0,e.useEffect)(()=>{M((0,Ge.rX)(),{captureDraggingState:!1})},[M]),(0,e.useEffect)(()=>{k&&c(!0)},[k,c]),(0,e.useEffect)(()=>{o||f(D=>!D)},[o]);const F={dragRef:I(u),dropRef:v(m)};return e.createElement(gm,{ref:F?F.dropRef:null},k&&e.createElement(it,{transparent:!0,labelField:E}),!k&&o&&e.createElement(it,{isSibling:!0,labelField:E}),!k&&!o&&e.createElement(pm,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:k},e.createElement(w.k,{gap:3},e.createElement(zs,{as:"span","aria-label":p({id:(0,h.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:D=>D.stopPropagation(),ref:F.dragRef,type:"button"},e.createElement(de.Z,null)),e.createElement(H.Z,{fontWeight:"bold"},E)),e.createElement(w.k,{paddingLeft:3},e.createElement(No,{ref:g,onClick:D=>{D.stopPropagation(),s(i)},"aria-label":p({id:(0,h.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(Ne.Z,null)),e.createElement(No,{onClick:l,"data-testid":`delete-${i}`,"aria-label":p({id:(0,h.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(He.Z,null)))))};Us.propTypes={index:n().number.isRequired,isDraggingSibling:n().bool.isRequired,labelField:n().string.isRequired,name:n().string.isRequired,onClickEditField:n().func.isRequired,onMoveField:n().func.isRequired,onRemoveField:n().func.isRequired,setIsDraggingSibling:n().func.isRequired};var fm=Us;const Vs=(0,S.ZP)(P.x)`
|
|
1118
|
-
flex: ${({size:t})=>t};
|
|
1119
|
-
`,hm=(0,S.ZP)(Vs)`
|
|
1120
|
-
overflow-x: scroll;
|
|
1121
|
-
overflow-y: hidden;
|
|
1122
|
-
`,ym=(0,S.ZP)(Vs)`
|
|
1123
|
-
max-width: ${32/16}rem;
|
|
1124
|
-
`,Hs=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,Q.Z)(),[p,u]=(0,e.useState)(!1),[m,f]=(0,e.useState)(null),g=(0,e.useRef)();function E(...v){f("add"),s(...v)}function b(...v){f("remove"),i(...v)}return(0,e.useEffect)(()=>{m==="add"&&g?.current&&(g.current.scrollLeft=g.current.scrollWidth)},[t,m]),e.createElement(e.Fragment,null,e.createElement(P.x,{paddingBottom:4},e.createElement(H.Z,{variant:"delta",as:"h2"},c({id:(0,h.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(w.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(hm,{size:"1",paddingBottom:4,ref:g},e.createElement(w.k,{gap:3},t.map((v,k)=>e.createElement(fm,{key:v,index:k,isDraggingSibling:p,onMoveField:l,onClickEditField:a,onRemoveField:I=>b(I,k),name:v,labelField:r[v].list.label||v,setIsDraggingSibling:u})))),e.createElement(ym,{size:"auto",paddingBottom:4},e.createElement(rt.O,{label:c({id:(0,h.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:be.h,icon:e.createElement(Ut.Z,null),disabled:o.length<=0,"data-testid":"add-field"},o.map(v=>e.createElement(rt.s,{key:v,onClick:()=>E(v)},r[v].list.label||v))))))};Hs.propTypes={displayedFields:De.PropTypes.array.isRequired,listRemainingFields:De.PropTypes.array.isRequired,metadatas:De.PropTypes.objectOf(De.PropTypes.shape({list:De.PropTypes.shape({label:De.PropTypes.string})})).isRequired,onAddField:De.PropTypes.func.isRequired,onClickEditField:De.PropTypes.func.isRequired,onMoveField:De.PropTypes.func.isRequired,onRemoveField:De.PropTypes.func.isRequired};var bm=Hs;const Em=(0,S.ZP)(w.k)`
|
|
1125
|
-
svg {
|
|
1126
|
-
width: ${32/16}rem;
|
|
1127
|
-
height: ${24/16}rem;
|
|
1128
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
1129
|
-
}
|
|
1130
|
-
`,Qs=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,Q.Z)(),p=t[r].relationType;let u=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(p)&&(u=!0),e.createElement(ls.P,{onClose:s,labelledBy:"title"},e.createElement("form",{onSubmit:l},e.createElement(cs.x,null,e.createElement(Em,null,e.createElement(gs,{type:i}),e.createElement(H.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,h.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:Qt()(r)})))),e.createElement(ds.f,null,e.createElement(Ye.r,{gap:4},e.createElement(Le.P,{s:12,col:6},e.createElement(Nn.o,{id:"label-input",label:c({id:(0,h.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>a(m),value:o.label,hint:c({id:(0,h.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(Le.P,{s:12,col:6},e.createElement(Kt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:c({id:(0,h.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>a({target:{name:"sortable",value:m.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(us.m,{startActions:e.createElement(Ee.z,{onClick:s,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Ee.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Qs.propTypes={attributes:n().objectOf(n().shape({relationType:n().string})).isRequired,fieldForm:n().shape({label:n().string,sortable:n().bool}).isRequired,fieldToEdit:n().string.isRequired,onChangeEditLabel:n().func.isRequired,onCloseModal:n().func.isRequired,onSubmit:n().func.isRequired,type:n().string.isRequired};var vm=Qs,Cm=(t,o)=>({...t,initialData:o,modifiedData:o});const qo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var Rm=(t=qo,o)=>(0,tn.ZP)(t,r=>{const s=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const a=L()(t,s,[]);_()(r,s,[...a,o.item]);break}case"MOVE_FIELD":{const a=L()(t,s,[]),{originalIndex:l,atIndex:i}=o;_()(r,s,(0,h.W3)(a,l,i));break}case"ON_CHANGE":{_()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{_()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const a=L()(t,s,[]);_()(r,s,a.filter((l,i)=>o.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=o;r.fieldToEdit=a,r.fieldForm.label=L()(r,["modifiedData","metadatas",a,"list","label"],""),r.fieldForm.sortable=L()(r,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",t.fieldToEdit,"list"];_()(r,[...a,"label"],t.fieldForm.label),_()(r,[...a,"sortable"],t.fieldForm.sortable);break}default:return r}});const Tm=["media","richtext","dynamiczone","relation","component","json"],Gs=({layout:t,slug:o})=>{const{formatMessage:r}=(0,Q.Z)(),{trackUsage:s}=(0,y.rS)(),a=rr(),l=(0,y.lm)(),{refetchData:i}=(0,e.useContext)(ur),[c,p]=(0,e.useState)(!1),u=()=>p(R=>!R),[m,f]=(0,e.useReducer)(Rm,qo,()=>Cm(qo,t)),{fieldToEdit:g,fieldForm:E,initialData:b,modifiedData:v}=m,k=!Ae()(E),{attributes:I}=t,M=v.layouts.list,F=()=>{const{settings:{pageSize:R,defaultSortBy:B,defaultSortOrder:V},kind:K,uid:O}=b,A=`${B}:${V}`,oe=`${(0,ct.stringify)({page:1,pageSize:R,sort:A},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${K}/${O}?${oe}`},D=({target:{name:R,value:B}})=>{f({type:"ON_CHANGE",keys:R,value:R==="settings.pageSize"?parseInt(B,10):B})},C=async()=>{const R=jn()(v,["layouts","settings","metadatas"]);$.mutate(R)},T=R=>{f({type:"ADD_FIELD",item:R})},x=(R,B)=>{R.stopPropagation(),M.length===1?l({type:"info",message:{id:(0,h.OB)("notification.info.minimumFields")}}):f({type:"REMOVE_FIELD",index:B})},Z=R=>{R.preventDefault(),u(),s("willSaveContentTypeLayout")},W=R=>{f({type:"SET_FIELD_TO_EDIT",fieldToEdit:R})},N=()=>{f({type:"UNSET_FIELD_TO_EDIT"})},G=R=>{R.preventDefault(),f({type:"SUBMIT_FIELD_FORM"}),N()},$=(0,Tt.useMutation)(R=>um(R,o),{onSuccess(){s("didEditListSettings"),i()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=$,j=({target:{name:R,value:B}})=>{f({type:"ON_CHANGE_FIELD_METAS",name:R,value:B})},X=Object.entries(I).reduce((R,B)=>{const[V,K]=B,O=(0,h.ko)(K),A=M.includes(V);return O&&!A&&R.push(V),R},[]).sort(),q=Object.entries(I).reduce((R,B)=>{const[V,{type:K}]=B;return Tm.includes(K)||R.push(V),R},[]),z=(R,B)=>{f({type:"MOVE_FIELD",originalIndex:R,atIndex:B})};return e.createElement(Ze.A,null,e.createElement(Ie.o,{"aria-busy":Y},e.createElement("form",{onSubmit:Z},e.createElement(ye.T,{navigationAction:e.createElement(y.rU,{startIcon:e.createElement(mn.Z,null),to:F,id:"go-back"},r({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(Ee.z,{size:"S",startIcon:e.createElement(At.Z,null),disabled:Vt()(v,b),type:"submit"},r({id:"global.save",defaultMessage:"Save"})),subtitle:r({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:r({id:(0,h.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:Qt()(v.info.displayName)})}),e.createElement(Pt.D,null,e.createElement(P.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(mm,{modifiedData:v,onChange:D,sortOptions:q}),e.createElement(P.x,{paddingTop:6,paddingBottom:6},e.createElement(_r.i,null)),e.createElement(bm,{listRemainingFields:X,displayedFields:M,onAddField:T,onClickEditField:W,onMoveField:z,onRemoveField:x,metadatas:v.metadatas}))),e.createElement(y.QH,{bodyText:{id:(0,h.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(At.Z,null),isConfirmButtonLoading:Y,isOpen:c,onToggleDialog:u,onConfirm:C,variantRightButton:"success-light"})),k&&e.createElement(vm,{attributes:I,fieldForm:E,fieldToEdit:g,onChangeEditLabel:j,onCloseModal:N,onSubmit:G,type:L()(I,[g,"type"],"text")})))};Gs.propTypes={layout:n().shape({uid:n().string.isRequired,settings:n().shape({bulkable:n().bool,defaultSortBy:n().string,defaultSortOrder:n().string,filterable:n().bool,pageSize:n().number,searchable:n().bool}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().objectOf(n().shape({type:n().string})).isRequired}).isRequired,slug:n().string.isRequired};var Mm=(0,e.memo)(Gs),Dm=()=>e.createElement(P.x,{padding:8},e.createElement(y.Hn,null));const Ks=Oe.Z.contentManager,Ys=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=er(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let m={},f={};return s.contentType&&(m=(0,h.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((g,E)=>(g[E]=(0,h.du)(s.components[E]),g),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||r)return e.createElement(y.dO,null);const p=({location:{state:m},history:{goBack:f},match:{params:{id:g,origin:E}}},b)=>e.createElement(b,{slug:t,layout:s,state:m,goBack:f,id:g,origin:E}),u=[{path:"create/clone/:origin",comp:hn},{path:"create",comp:hn},{path:":id",comp:hn},{path:"",comp:dm}].map(({path:m,comp:f})=>e.createElement(J.AW,{key:m,path:`${o}/${m}`,render:g=>p(g,f)}));return e.createElement(Za.ErrorBoundary,{FallbackComponent:Dm},e.createElement(mr.Provider,{value:s},e.createElement(J.rs,null,e.createElement(J.AW,{path:`${o}/configurations/list`},e.createElement(y.O4,{permissions:Ks.collectionTypesConfigurations},e.createElement(Mm,{layout:l,slug:t,updateLayout:a}))),e.createElement(J.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Ks.collectionTypesConfigurations},e.createElement(Oo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),u)))};Ys.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var km=(0,e.memo)(Ys),Xs=d(57678);const Im=Oe.Z.contentManager,Om=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)(Xs.Z,Xs.q),s=(0,e.useMemo)(Cn,[]),{schemas:a}=(0,me.v9)(c=>s(c),me.wU),{uid:l}=(0,J.UO)(),{get:i}=(0,y.kY)();return(0,e.useEffect)(()=>{const p=Ue.Z.CancelToken.source();return(async m=>{try{r(dn());const{data:{data:f}}=await i((0,h.IF)(`components/${l}/configuration`),{cancelToken:m.token});r(ao((0,h.w8)(f,a,"component")))}catch(f){if(Ue.Z.isCancel(f))return;console.error(f)}})(p),()=>{p.cancel("Operation canceled by the user.")}},[l,a,i]),t?e.createElement(y.dO,null):e.createElement(y.O4,{permissions:Im.componentsConfigurations},e.createElement(Oo,{components:o.components,mainLayout:o.component,slug:l}))};var Lm=(0,e.memo)(Om),wm=d(9695),xm=d(54725),Pm=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,y.go)(),e.createElement(Ie.o,null,e.createElement(ye.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(Pt.D,null,e.createElement(wm.x,{action:e.createElement(y.Qj,{variant:"secondary",startIcon:e.createElement(Ut.Z,null),to:"/plugins/content-type-builder/content-types/create-content-type"},t({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:t({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:e.createElement(xm.Z,{width:"10rem"}),shadow:"tableShadow"})))},Fm=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,y.go)(),e.createElement(Ie.o,null,e.createElement(ye.T,{title:t({id:(0,h.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(Pt.D,null,e.createElement(y.ZF,null)))};const Sm=Oe.Z.contentManager,Js=({match:{params:{slug:t},url:o}})=>{const{isLoading:r,layout:s,updateLayout:a}=er(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let c={},p={};return s.contentType&&(p=(0,h.du)(s.contentType)),s.components&&(c=Object.keys(s.components).reduce((u,m)=>(u[m]=(0,h.du)(s.components[m]),u),{})),{rawContentTypeLayout:p,rawComponentsLayouts:c}},[s]);return r?e.createElement(y.dO,null):e.createElement(mr.Provider,{value:s},e.createElement(J.rs,null,e.createElement(J.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:Sm.singleTypesConfigurations},e.createElement(Oo,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),e.createElement(J.AW,{path:o,render:({location:{state:c},history:{goBack:p}})=>e.createElement(hn,{layout:s,slug:t,isSingleType:!0,state:c,goBack:p})})))};Js.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Am=(0,e.memo)(Js),$m=d(90700),Zm=d(78090),Bm=d(77013),Nm=d(79318),qm=d(66618),jm=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:s}=(0,Q.Z)(),a=(0,e.useMemo)(Ta,[]),{collectionTypeLinks:l,singleTypeLinks:i}=(0,me.v9)(a,me.wU),{startsWith:c}=(0,y.L0)(s,{sensitivity:"base"}),p=(0,y.Xe)(s,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,pe.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:l},{id:"singleTypes",title:{id:(0,pe.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(E=>({...E,links:E.links.filter(b=>c(b.title,t)).sort((b,v)=>p.compare(b.title,v.title)).map(b=>({...b,title:r({id:b.title,defaultMessage:b.title})}))})),[l,t,i,c,r,p]),m=()=>{o("")},f=({target:{value:E}})=>{o(E)},g=r({id:(0,pe.Z)("header.name"),defaultMessage:"Content"});return e.createElement($m.m,{ariaLabel:g},e.createElement(Zm.p,{label:g,searchable:!0,value:t,onChange:f,onClear:m,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(Bm.Z,null,u.map(E=>{const b=r({id:E.title.id,defaultMessage:E.title.defaultMessage},E.title.values);return e.createElement(Nm.D,{key:E.id,label:b,badgeLabel:E.links.length.toString()},E.links.map(v=>{const k=v.search?`?${v.search}`:"";return e.createElement(qm.E,{as:Zt.OL,key:v.uid,to:`${v.to}${k}`},v.title)}))})))},jo=d(92886);const Wm=()=>({type:jo.fn}),zm=()=>({type:jo.sZ}),Um=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:s,fieldSizes:a})=>({type:jo.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:s,contentTypeSchemas:r,fieldSizes:a}}),_s=(t,o,r=[])=>t.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=o==="collectionTypes"?a:l,c=r.find(({uid:u})=>u===s.uid);let p=null;if(c){const u={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};p=(0,ct.stringify)(u,{encode:!1})}return{permissions:i,search:p,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}});var Vm=(t,o)=>{const r=Object.entries(Br()(t,"kind")).map(([l,i])=>({name:l,links:i})),[s,a]=xe()(r,"name");return{collectionTypeSectionLinks:_s(s?.links||[],"collectionTypes",o),singleTypeSectionLinks:_s(a?.links??[],"singleTypes")}},ea=(t,o)=>o.map(({permissions:r})=>(0,y.qX)(t,r)),Hm=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:s}=(0,y.tg)();try{const{data:{data:a}}=await s((0,h.IF)("content-types-settings")),{collectionTypeSectionLinks:l,singleTypeSectionLinks:i}=Vm(t,a),c=await Promise.all(ea(o,l)),p=l.filter((f,g)=>c[g]),u=await Promise.all(ea(o,i)),m=i.filter((f,g)=>u[g]);return{authorizedCollectionTypeLinks:p,authorizedSingleTypeLinks:m}}catch(a){return console.error(a),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},Qm=()=>{const t=(0,me.I0)(),o=(0,y.lm)(),r=(0,me.v9)(xt()),s=(0,e.useRef)(),{allPermissions:a}=(0,y.vn)(),{runHookWaterfall:l}=(0,y.j1)(),c=Ue.Z.CancelToken.source(),{notifyStatus:p}=(0,wo.G)(),{formatMessage:u}=(0,Q.Z)(),{get:m}=(0,y.kY)(),f=async()=>{t(Wm());try{const{data:{data:{components:g,contentTypes:E,fieldSizes:b}}}=await m((0,h.IF)("init"),{cancelToken:c.token});p(u({id:(0,h.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const v=await Hm({models:E,userPermissions:a,toggleNotification:o}),{ctLinks:k}=l(nn.LK,{ctLinks:v.authorizedCollectionTypeLinks,models:E}),{stLinks:I}=l(nn.dV,{stLinks:v.authorizedSingleTypeLinks,models:E}),M=Um({authorizedCollectionTypeLinks:k,authorizedSingleTypeLinks:I,contentTypeSchemas:E,components:g,fieldSizes:b});t(M)}catch(g){if(Ue.Z.isCancel(g))return;console.error(g),o({type:"warning",message:{id:"notification.error"}})}};return s.current=f,(0,e.useEffect)(()=>(s.current(),()=>{c.cancel("Operation canceled by the user."),t(zm())}),[t,o]),{...r,refetchData:s.current}};const Gm=Oe.Z.contentManager,ta=()=>{const t=(0,J.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:s,models:a,refetchData:l}=Qm(),i=xe()([...r,...s],g=>g.title.toLowerCase()),{pathname:c}=(0,J.TH)(),{formatMessage:p}=(0,Q.Z)(),{startSection:u}=(0,y.c1)(),m=(0,e.useRef)(u);if((0,e.useEffect)(()=>{m.current&&m.current("contentManager")},[]),o==="loading")return e.createElement(Ie.o,{"aria-busy":"true"},e.createElement(ye.T,{title:p({id:(0,pe.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(y.dO,null));const f=a.filter(({isDisplayed:g})=>g);return i.length===0&&f.length>0&&c!=="/content-manager/403"?e.createElement(J.l_,{to:"/content-manager/403"}):f.length===0&&c!=="/content-manager/no-content-types"?e.createElement(J.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(J.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(Ze.A,{sideNav:e.createElement(jm,null)},e.createElement($a,null),e.createElement(ur.Provider,{value:{refetchData:l}},e.createElement(J.rs,null,e.createElement(J.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(y.O4,{permissions:Gm.componentsConfigurations},e.createElement(Lm,null))),e.createElement(J.AW,{path:"/content-manager/collectionType/:slug",component:km}),e.createElement(J.AW,{path:"/content-manager/singleType/:slug",component:Am}),e.createElement(J.AW,{path:"/content-manager/403"},e.createElement(Fm,null)),e.createElement(J.AW,{path:"/content-manager/no-content-types"},e.createElement(Pm,null)),e.createElement(J.AW,{path:"",component:y.Hn}))))};function Km(){const{formatMessage:t}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(Me.q,{title:t({id:(0,pe.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(ta,null))}},92914:function(et,Re,d){"use strict";d.d(Re,{Z:function(){return H}});var e=d(32735),Me=d(60216),J=d.n(Me),y=d(67879),Ie=d(43383),ye=d(87933),Ze=d(49372),Q=d(72850),ze=d(9026),xe=d(95952);const Oe=60*1e3,pe=Oe*60,Te=pe*24,De=Te*30,n=Te*365;var vt=de=>de<Oe?{unit:"second",value:-Math.round(de/1e3)}:de<pe?{unit:"minute",value:-Math.round(de/Oe)}:de<Te?{unit:"hour",value:-Math.round(de/pe)}:de<De?{unit:"day",value:-Math.round(de/Te)}:de<n?{unit:"month",value:-Math.round(de/De)}:{unit:"year",value:-Math.round(de/n)},st=d(8997);const ut=()=>{const{formatMessage:de}=(0,y.Z)();return e.createElement(ye.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ze.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},de({id:(0,xe.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(Q.x,null,e.createElement(ze.i,null)))},Be=({label:de,value:Ne})=>e.createElement(ye.k,{justifyContent:"space-between"},e.createElement(Ze.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},de),e.createElement(Ze.Z,{as:"dd",variant:"pi",textColor:"neutral600"},Ne));Be.propTypes={label:J().string.isRequired,value:J().string.isRequired};const S=()=>{const{formatMessage:de,formatRelativeTime:Ne}=(0,y.Z)(),{initialData:He,isCreatingEntry:It}=(0,Ie.Wq)(),mt=(0,e.useRef)(Date.now()),Qe=(tt,it)=>{const{firstname:P,lastname:be,username:qe}=He[it]??{},Se=P??"",Ct=be??"",ne=qe??(0,st.Pp)(Se,Ct),ue=(He[tt]?new Date(He[tt]).getTime():Date.now())-mt.current,{unit:he,value:Pe}=vt(-ue);return{at:Ne(Pe,he,{numeric:"auto"}),by:It?"-":ne}},at=Qe("updatedAt","updatedBy"),pt=Qe("createdAt","createdBy");return e.createElement(ye.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(ye.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:de({id:(0,xe.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:pt.at}),e.createElement(Be,{label:de({id:(0,xe.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:pt.by})),e.createElement(ye.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Be,{label:de({id:(0,xe.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:at.at}),e.createElement(Be,{label:de({id:(0,xe.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:at.by})))},w=({children:de})=>e.createElement(ye.k,{direction:"column",alignItems:"stretch",gap:4},de);w.propTypes={children:J().oneOfType([J().arrayOf(J().node),J().node]).isRequired};var H={Root:w,Title:ut,Body:S}},73710:function(et,Re,d){"use strict";d.d(Re,{Z:function(){return y}});var e=d(32735),Me=d(92914);function J(){return e.createElement(Me.Z.Root,null,e.createElement(Me.Z.Title,null),e.createElement(Me.Z.Body,null))}var y=J},25708:function(et,Re){"use strict";Re.Z={COMPONENT:"component",EDIT_FIELD:"editField",FIELD:"field",DYNAMIC_ZONE:"dynamicZone",RELATION:"relation"}},47510:function(et,Re){"use strict";const d=e=>`content-manager.${e}`;Re.Z=d},95952:function(et,Re,d){"use strict";d.d(Re,{_Q:function(){return pt.Z},W3:function(){return y},ko:function(){return Q},FE:function(){return xe},Di:function(){return De},du:function(){return st},TA:function(){return S},Ts:function(){return Ne},Uo:function(){return It},IF:function(){return Qe},OB:function(){return at.Z},w8:function(){return be},kc:function(){return Ct}});var e=d(99381),Me=d.n(e),y=(ne,le,ue)=>{if(Array.isArray(ne)&&le>=0&&ue>=0&&le<=ne.length-1&&ue<=ne.length-1){const he=Me()(ne),Pe=he.splice(le,1);return he.splice(ue,0,Pe[0]),he}return ne},Ie=d(59578),ye=d.n(Ie),Q=ne=>{const le=ne.type;return le==="relation"?!ye()(ne.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(le)&&!!le};const ze=(ne,le)=>{typeof ne=="function"?ne(le):ne!=null&&(ne.current=le)},xe=(...ne)=>le=>ne.forEach(ue=>ze(ue,le));var Oe=d(33795),pe=d.n(Oe);const Te=(ne,le)=>Object.keys(ne).reduce((ue,he)=>{const Pe=pe()(ne,[he],{}),{default:je,component:h,type:ge,required:ke,min:Fe,repeatable:Ge}=Pe;if(je!==void 0&&(ue[he]=je),ge==="component"){const qt=le?.[h]?.attributes??{},Ke=Te(qt,le);if(ke===!0&&(ue[he]=Ge===!0?[]:Ke),Fe&&Ge===!0&&ke){ue[he]=[];for(let lt=0;lt<Fe;lt+=1)ue[he].push(Ke)}}return ge==="dynamiczone"&&ke===!0&&(ue[he]=[]),ue},{});var De=Te,n=d(9086),kt=d.n(n),st=({layouts:ne,metadatas:le,...ue})=>{const he=ne.list.map(h=>h.name?h.name:h),Pe=Object.keys(le).reduce((h,ge)=>{const ke=pe()(le,[ge],{});let Fe=ke.edit;return Fe.mainField&&(Fe={...Fe,mainField:ke.edit.mainField.name}),{...h,[ge]:{edit:Fe,list:kt()(ke.list,["mainField"])}}},{}),je=ne.edit.map(h=>h.map(({name:ge,size:ke})=>({name:ge,size:ke})));return{...ue,layouts:{edit:je,list:he},metadatas:Pe}};const ut=(ne,le)=>ne.map(ue=>({...ue,subject:le}));var S=ne=>{const le={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(le).reduce((ue,he)=>(ue[he]=ut(le[he],ne),ue),{})},w=d(95919),H=d.n(w),Ne=ne=>ne.split(".").filter(le=>H()(parseInt(le,10))),It=ne=>{if(ne.length===0)return-1;const le=Math.max.apply(Math,ne.map(ue=>ue.__temp_key__??0));return Number.isNaN(le)?-1:le},Qe=ne=>`/content-manager/${ne}`,at=d(47510),pt=d(25708),tt=d(3040),it=d.n(tt),be=(ne,le,ue)=>{const he=ge=>le.find(ke=>ke.uid===ge),Pe=Object.assign({},ne),je=ne[ue].uid,h=he(je);return it()(Pe,[ue],{...ne[ue],...h}),Object.keys(ne.components).forEach(ge=>{const ke=he(ge);it()(Pe,["components",ge],{...ne.components[ge],...ke})}),Pe},qe=d(43383),Ct=(ne,le,ue)=>{const he=(Pe,je)=>Object.keys(Pe).reduce((h,ge)=>{const ke=(0,qe.UN)(je,ge),Fe=pe()(Pe,ge),Ge=(0,qe.k2)(je,[ge,"component"]),qt=(0,qe.k2)(je,[ge,"repeatable"]);return ke==="dynamiczone"?(h[ge]=Fe.map(Ke=>he(Ke,ue[Ke.__component])),h):ke==="component"?(qt?h[ge]=Fe&&Fe.map(Ke=>he(Ke,ue[Ge])):h[ge]=Fe&&he(Fe,ue[Ge]),h):(ke!=="password"&&(h[ge]=Fe),h)},{});return he(ne,le)}},75536:function(et,Re,d){"use strict";var e=d(32735);const Me=(J,y)=>{const[Ie,ye]=(0,e.useState)(J);return(0,e.useEffect)(()=>{const Ze=setTimeout(()=>{ye(J)},y);return()=>{clearTimeout(Ze)}},[J,y]),Ie};Re.Z=Me},57047:function(et,Re,d){"use strict";d.d(Re,{Z:function(){return ze}});var e=d(32735),Me=d(67879),J=d(49372),y=d(60216),Ie=d.n(y);function ye({name:xe}){return e.createElement(J.Z,{fontWeight:"regular",textColor:"neutral700"},xe)}ye.propTypes={name:Ie().string.isRequired};var Ze=ye,Q=d(47510),ze=xe=>{const{formatMessage:Oe}=(0,Me.Z)();return(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&xe.contentType.options?.reviewWorkflows)??!1?{key:"__strapi_reviewWorkflows_stage_temp_key__",name:"strapi_reviewWorkflows_stage",fieldSchema:{type:"custom"},metadatas:{label:Oe({id:(0,Q.Z)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}),searchable:!1,sortable:!1},cellFormatter({strapi_reviewWorkflows_stage:Te}){return Te?e.createElement(Ze,{name:Te.name}):e.createElement(J.Z,{textColor:"neutral800"},"-")}}:null}},28243:function(et,Re,d){"use strict";d.d(Re,{Z:function(){return De}});var e=d(32735),Me=d(43383),J=d(87107),y=d(87933),Ie=d(28847),ye=d(97405),Ze=d(47851),Q=d(67879),ze=d(20108),xe=d(67350),Oe=d(92914);const pe="strapi_reviewWorkflows_stage";function Te(){const{initialData:n,isCreatingEntry:kt,layout:{uid:vt},isSingleType:st,onChange:ut}=(0,Me.Wq)(),{put:Be}=(0,Me.kY)(),S=n?.[pe]??null,w=Object.prototype.hasOwnProperty.call(n,pe),{formatMessage:H}=(0,Q.Z)(),{formatAPIError:de}=(0,Me.So)(),Ne=(0,Me.lm)(),{workflows:{data:He,isLoading:It}={}}=(0,xe.n)(),mt=He?.[0]??null,{error:Qe,isLoading:at,mutateAsync:pt}=(0,ze.useMutation)(async({entityId:qe,stageId:Se,uid:Ct})=>{const ne=st?"single-types":"collection-types",{data:{data:le}}=await Be(`/admin/content-manager/${ne}/${Ct}/${qe}/stage`,{data:{id:Se}});return ut({target:{name:pe,value:le[pe]}},!0),le},{onSuccess(){Ne({type:"success",message:{id:"notification.success.saved",defaultMessage:"Saved"}})}}),tt=S===null&&!It&&!kt&&H({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),P=Qe&&de(Qe)||tt||null,be=async({value:qe})=>{try{await pt({entityId:n.id,stageId:qe,uid:vt})}catch{}};return e.createElement(Oe.Z.Root,null,e.createElement(Oe.Z.Title,null),w&&!kt&&e.createElement(J.g,{error:P,name:pe,id:pe},e.createElement(y.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(Ie.Q,null,H({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"})),e.createElement(Me.JV,{components:{LoadingIndicator:()=>e.createElement(ye.a,{small:!0})},error:P,inputId:pe,isLoading:at,isSearchable:!1,isClearable:!1,name:pe,onChange:be,options:mt?mt.stages.map(({id:qe,name:Se})=>({value:qe,label:Se})):[],value:{value:S?.id,label:S?.name}}),e.createElement(Ze.c,null))),e.createElement(Oe.Z.Body,null))}var De=Te},67350:function(et,Re,d){"use strict";d.d(Re,{n:function(){return Ie}});var e=d(20108),Me=d(43383);const J="review-workflows",y="/admin/review-workflows";function Ie(ye){const{get:Ze}=(0,Me.kY)(),Q=(0,e.useQueryClient)(),ze=[J,ye??"default"];async function xe({params:Te={populate:"stages"}}){try{const{data:{data:De}}=await Ze(`${y}/workflows/${ye??""}`,{params:Te});return De}catch{return null}}async function Oe(){await Q.refetchQueries(ze)}return{workflows:(0,e.useQuery)(ze,xe),refetchWorkflow:Oe}}},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);
|