@@ -22,10 +22,16 @@ import {
2222 BoolCodeControl ,
2323 jsonControl ,
2424 jsonValueExposingStateControl ,
25- useMergeCompStyles ,
25+ // useMergeCompStyles,
2626} from "lowcoder-sdk" ;
2727import { i18nObjs , trans } from "./i18n/comps" ;
2828
29+ export enum DEP_TYPE {
30+ CONTRAST_TEXT = 'contrastText' ,
31+ SELF = 'toSelf' ,
32+ }
33+
34+
2935export const CompStyles = [
3036 { name : "textSize" , label : trans ( "style.textSize" ) , textSize : "textSize" } ,
3137 { name : "fontFamily" , label : trans ( "style.fontFamily" ) , fontFamily : "fontFamily" } ,
@@ -250,7 +256,7 @@ const createTaskListLocal = (
250256 width : "33%" ,
251257 paddingTop : rowHeight * 0.3 ,
252258 } }
253- title = { t . name }
259+ title = { t . title }
254260 >
255261 < div className = "Gantt-Task-List_Name-Container" style = { { flexDirection : "row" , display : "flex" , } } >
256262 < div
@@ -275,7 +281,7 @@ const createTaskListLocal = (
275281 } }
276282 onClick = { ( ) => onClick ( t ) }
277283 >
278- { t . name }
284+ { t . title }
279285 </ div >
280286 </ div >
281287 </ div >
@@ -353,7 +359,7 @@ const createTooltip = (
353359 className = { "Gantt-Tooltip_Paragraph Gantt-Tooltip_Paragraph__Information" }
354360 style = { { fontSize : textSize } }
355361 >
356- { task . name }
362+ { task . title }
357363 </ p >
358364 < p className = { "Gantt-Tooltip_Paragraph" } style = { { fontSize : textSize } } >
359365 { `${ startDisplayName } : ${ formatDateShort ( task . start , includeTime ) } ` }
@@ -386,9 +392,9 @@ const getStartEndDateForProject = (tasks: Task[], projectId: string) => {
386392 return [ start , end ] ;
387393} ;
388394
389- const filterTaskFields = ( task : Task ) => ( {
395+ const filterTaskFields = ( task : Task & { barChildren : Omit < OptionPropertyParam , 'label' | 'hideChildren' > [ ] } ) => ( {
390396 id : task . id ,
391- name : task . name ,
397+ title : task . title ,
392398 type : task . type ,
393399 start : task . start ,
394400 end : task . end ,
@@ -397,7 +403,7 @@ const filterTaskFields = (task: Task) => ({
397403 dependencies : task . dependencies ,
398404 barChildren : task . barChildren ? task . barChildren . map ( child => ( {
399405 id : child . id ,
400- name : child . name ,
406+ title : child . title ,
401407 type : child . type ,
402408 start : child . start ,
403409 end : child . end ,
@@ -409,7 +415,7 @@ const filterTaskFields = (task: Task) => ({
409415
410416let GanttOption = new MultiCompBuilder (
411417 {
412- name : StringControl ,
418+ title : StringControl ,
413419 start : jsonControl ( ( data : any ) => new Date ( data ) ) ,
414420 end : jsonControl ( ( data : any ) => new Date ( data ) ) ,
415421 label : StringControl ,
@@ -427,7 +433,7 @@ let GanttOption = new MultiCompBuilder(
427433type OptionPropertyParam = {
428434 start ?: Date ;
429435 end ?: Date ;
430- name ?: string ;
436+ title ?: string ;
431437 label ?: string ;
432438 id ?: string ;
433439 progress ?: number ;
@@ -445,7 +451,7 @@ GanttOption = class extends GanttOption implements OptionCompProperty {
445451 propertyView ( param : any ) {
446452 return (
447453 < >
448- { this . children . name . propertyView ( { label : trans ( "component.name" ) } ) }
454+ { this . children . title . propertyView ( { label : trans ( "component.name" ) } ) }
449455 { this . children . start . propertyView ( { label : trans ( "component.start" ) } ) }
450456 { this . children . end . propertyView ( { label : trans ( "component.end" ) } ) }
451457 { this . children . progress . propertyView ( { label : trans ( "component.progress" ) } ) }
@@ -462,7 +468,7 @@ GanttOption = class extends GanttOption implements OptionCompProperty {
462468
463469export const GanttOptionControl = optionsControl ( GanttOption , {
464470 initOptions : i18nObjs . defaultTasks ,
465- uniqField : "name " ,
471+ uniqField : "id " ,
466472} ) ;
467473
468474const viewModeOptions = [
@@ -475,11 +481,6 @@ const viewModeOptions = [
475481 { label : trans ( "viewModes.year" ) , value : ViewMode . Year } ,
476482] ;
477483
478- export enum DEP_TYPE {
479- CONTRAST_TEXT = "contrastText" ,
480- SELF = "toSelf" ,
481- }
482-
483484function toSelf ( color : string ) {
484485 return color ;
485486}
@@ -539,8 +540,7 @@ let GanttChartCompBase = (function () {
539540 const [ tasks , setTasks ] = useState < Task [ ] > ( props . data ?? [ ] ) ;
540541 const [ dimensions , setDimensions ] = useState ( { width : 480 , height : 300 } ) ;
541542 const [ updatedGanttTasks , setUpdatedGanttTasks ] = useState < Task [ ] > ( [ ] ) ;
542-
543- useMergeCompStyles ( props as Record < string , any > , dispatch ) ;
543+ // useMergeCompStyles(props as Record<string, any>, dispatch);
544544
545545 const { width, height, ref : conRef } = useResizeDetector ( {
546546 onResize : ( ) => {
@@ -588,7 +588,7 @@ let GanttChartCompBase = (function () {
588588 } ;
589589
590590 const handleTaskDelete = ( task : Task ) => {
591- const conf = window . confirm ( "Are you sure about " + task . name + " ?" ) ;
591+ const conf = window . confirm ( "Are you sure about " + task . title + " ?" ) ;
592592 if ( conf ) {
593593 const newTasks = tasks . filter ( t => t . id !== task . id ) ;
594594 setTasks ( newTasks ) ;
@@ -751,7 +751,7 @@ GanttChartCompBase = withMethodExposing(GanttChartCompBase, [
751751 ] ,
752752 } ,
753753 execute : ( comp : any , values : any [ ] ) => {
754- const newTasks = JSON . parse ( values [ 0 ] ) ;
754+ const newTasks = values [ 0 ] ;
755755 comp . children . data . dispatchChangeValueAction ( JSON . stringify ( newTasks , null , 2 ) ) ;
756756 } ,
757757 } ,
0 commit comments