@@ -8,6 +8,7 @@ import ClayIcon from '@clayui/icon';
88import ClayLayout from '@clayui/layout' ;
99import ClayList from '@clayui/list' ;
1010import ClaySticker from '@clayui/sticker' ;
11+ import { ClayTooltipProvider } from '@clayui/tooltip' ;
1112import classNames from 'classnames' ;
1213import { getObjectValueFromPath } from 'frontend-js-web' ;
1314import React , { forwardRef , useContext } from 'react' ;
@@ -25,7 +26,6 @@ import {
2526 IView ,
2627} from '../../utils/types' ;
2728import ViewsContext from '../ViewsContext' ;
28- import Tooltip , { ClayTooltipProvider } from '@clayui/tooltip' ;
2929
3030const Title = ( {
3131 item,
@@ -57,12 +57,14 @@ const ListItem = forwardRef<HTMLLIElement, any>(
5757 (
5858 {
5959 className,
60+ clayListItemProps,
6061 item,
6162 items,
6263 onItemSelectionChange,
6364 schema,
6465 } : {
6566 className : string ;
67+ clayListItemProps : Object ;
6668 item : any ;
6769 items : any [ ] ;
6870 onItemSelectionChange : Function ;
@@ -94,14 +96,12 @@ const ListItem = forwardRef<HTMLLIElement, any>(
9496 active : selectedItemsValue ?. includes ( itemId ) ,
9597 } ) ,
9698 flex : true ,
99+ ...clayListItemProps ,
97100 } ;
98101
99102 return (
100- < ClayList . Item
101- { ...props }
102- ref = { ref }
103- >
104- { ! selectable ? (
103+ < ClayList . Item { ...props } ref = { ref } >
104+ { selectable && (
105105 < ClayList . ItemField className = "justify-content-center selection-control" >
106106 < SelectionInput
107107 checked = {
@@ -117,9 +117,30 @@ const ListItem = forwardRef<HTMLLIElement, any>(
117117 value = { itemId }
118118 />
119119 </ ClayList . ItemField >
120- ) :
121- < ClayList . ItemField className = "justify-content-center selection-control" > </ ClayList . ItemField >
122- }
120+ ) }
121+
122+ { item [ '_isItemValid' ] === false &&
123+ item [ '_warningTooltipText' ] && (
124+ < ClayList . ItemField >
125+ < ClayTooltipProvider >
126+ < span title = { item [ '_warningTooltipText' ] } >
127+ < ClaySticker displayType = "warning" >
128+ < ClayIcon symbol = "exclamation-circle" />
129+ </ ClaySticker >
130+ </ span >
131+ </ ClayTooltipProvider >
132+ </ ClayList . ItemField >
133+ ) }
134+
135+ { item [ '_isItemValid' ] === true && (
136+ < ClayList . ItemField >
137+ < ClayTooltipProvider >
138+ < ClaySticker displayType = "unstyled" >
139+ < ClayIcon symbol = "catalog" />
140+ </ ClaySticker >
141+ </ ClayTooltipProvider >
142+ </ ClayList . ItemField >
143+ ) }
123144
124145 { image && item [ image ] ? (
125146 < ClayList . ItemField >
@@ -133,25 +154,22 @@ const ListItem = forwardRef<HTMLLIElement, any>(
133154 item [ symbol ] && (
134155 < ClayList . ItemField >
135156 < ClayTooltipProvider >
136- < span
137- className = "ml-1 text-secondary"
138- data-tooltip-align = "top"
139- title = { Liferay . Language . get (
140- 'no-visualization-modes-has-been-defined'
141- ) }
157+ < span
158+ className = "ml-1 text-secondary"
159+ data-tooltip-align = "top"
160+ title = { Liferay . Language . get (
161+ 'no-visualization-modes-has-been-defined'
162+ ) }
163+ >
164+ < ClaySticker
165+ { ...( sticker && item [ sticker ] ) }
142166 >
143- < ClaySticker { ...( sticker && item [ sticker ] ) } >
144- { item [ symbol ] && (
145- < ClayIcon symbol = { item [ symbol ] } />
146- ) }
147-
148- </ ClaySticker >
149- </ span >
150-
151-
152- </ ClayTooltipProvider >
153-
154-
167+ { item [ symbol ] && (
168+ < ClayIcon symbol = { item [ symbol ] } />
169+ ) }
170+ </ ClaySticker >
171+ </ span >
172+ </ ClayTooltipProvider >
155173 </ ClayList . ItemField >
156174 )
157175 ) }
@@ -178,54 +196,48 @@ const ListItem = forwardRef<HTMLLIElement, any>(
178196 ) }
179197 </ ClayList . ItemField >
180198
181- < ClayList . ItemField >
182- { ( itemsActions || item . actionDropdownItems ) && (
199+ { ( itemsActions || item . actionDropdownItems ) && (
200+ < ClayList . ItemField >
183201 < Actions
184202 actions = { itemsActions || item . actionDropdownItems }
185203 itemData = { item }
186204 itemId = { itemId }
187205 items = { items }
188206 onItemSelectionChange = { onItemSelectionChange }
189207 />
190- ) }
191- </ ClayList . ItemField >
208+ </ ClayList . ItemField >
209+ ) }
192210 </ ClayList . Item >
193211 ) ;
194212 }
195213) ;
196214
197215const ListItemOptionalDropTarget = ( {
216+ clayListItemProps,
198217 item,
199218 items,
200219 onItemSelectionChange,
201220 schema,
202221} : {
222+ clayListItemProps ?: object ;
203223 item : any ;
204224 items : any [ ] ;
205225 onItemSelectionChange : Function ;
206226 schema : IListSchema ;
207227} ) => {
208228 const { className, dropRef} = useFDSDrop ( { item} ) ;
209229
210- const [ viewsContext ] = useContext ( ViewsContext ) ;
211-
212- const activeView : IView = viewsContext . activeView ;
213-
214230 const props = {
215231 className,
232+ clayListItemProps,
216233 item,
217234 items,
218235 onItemSelectionChange,
219- ref :dropRef ,
236+ ref : dropRef ,
220237 schema,
221238 } ;
222239
223- return (
224- < ListItem
225- { ...props }
226- { ...( activeView . setItemComponentProps ?.( { item, props} ) ?? { } ) }
227- />
228- ) ;
240+ return < ListItem { ...props } /> ;
229241} ;
230242
231243const List = ( {
@@ -241,10 +253,20 @@ const List = ({
241253} ) => {
242254 const { selectedItemsKey} = useContext ( FrontendDataSetContext ) ;
243255
256+ const [ viewsContext ] = useContext ( ViewsContext ) ;
257+
244258 if ( ! items ?. length ) {
245259 return null ;
246260 }
247261
262+ const activeView : IView = viewsContext . activeView ;
263+
264+ const props = {
265+ items,
266+ onItemSelectionChange,
267+ schema,
268+ } ;
269+
248270 return (
249271 < ClayLayout . Sheet
250272 className = { classNames ( 'list-sheet' , {
@@ -262,7 +284,6 @@ const List = ({
262284 { items . map ( ( item : any , index : number ) => (
263285 < ListItemOptionalDropTarget
264286 item = { item }
265- items = { items }
266287 key = {
267288 selectedItemsKey
268289 ? getObjectValueFromPath ( {
@@ -271,8 +292,11 @@ const List = ({
271292 } )
272293 : index
273294 }
274- onItemSelectionChange = { onItemSelectionChange }
275- schema = { schema }
295+ { ...props }
296+ { ...( activeView . setItemComponentProps ?.( {
297+ item,
298+ props,
299+ } ) ?? { } ) }
276300 />
277301 ) ) }
278302 </ ClayList >
0 commit comments