GithubHelp home page GithubHelp logo

Comments (16)

redouan-da avatar redouan-da commented on July 23, 2024 1

Hello, thanks for replying, I really do appreciate it šŸ™.
here is the link of my code : https://github.com/redouan-da/gantt-svelte-angular

from svelte-gantt.

ANovokmet avatar ANovokmet commented on July 23, 2024

Can you try using SvelteGanttComponent as the property interface?

    gantt: SvelteGanttComponent;

from svelte-gantt.

redouan-da avatar redouan-da commented on July 23, 2024

### when i run the project i still got the same error :

`Error: node_modules/svelte-gantt/types/core/drag/dragDropManager.d.ts:2:26 - error TS2307: Cannot find module 'svelte/store' or its corresponding type declarations.

2 import { Writable } from 'svelte/store';
~~~~~~~~~~~~~~

Error: node_modules/svelte-gantt/types/core/store.d.ts:1:26 - error TS2307: Cannot find module 'svelte/store' or its corresponding type declarations.

1 import { Readable } from 'svelte/store';
~~~~~~~~~~~~~~

Error: src/app/app.component.ts:12:10 - error TS2749: 'SvelteGantt' refers to a value, but is being used as a type here. Did you mean 'typeof SvelteGantt'?

12 gantt: SvelteGantt;
`

from svelte-gantt.

ANovokmet avatar ANovokmet commented on July 23, 2024

Hello, sorry I was not able to answer sooner.

Any chance you could push your code to a repo? It would be a great help to me.

from svelte-gantt.

ANovokmet avatar ANovokmet commented on July 23, 2024

Hello, thanks.
I've made the changes here redouan-da/gantt-svelte-angular#1
This makes svelte-gantt work in angular but a few issues I need to fix (I used these workarounds in your project):

Thanks for doing this and helping me discover these issues. Again sorry for taking so long to respond.

from svelte-gantt.

redouan-da avatar redouan-da commented on July 23, 2024

Hello, Tank you very much
Finally it works, good job, I really appreciate your help.
thank you again

from svelte-gantt.

redouan-da avatar redouan-da commented on July 23, 2024

Hello, it's me again šŸ˜šŸ˜…
Now every things works great, tasks are showing but I have a problem listening to events, such as onclick or on select or on change a task.
I tried to use this : mygantt.api.tasks.on.select((task) => console.log('Listener: task selected', task));
but it didn't work (i guess because mygantt is of type SvelteGanttComponent)
Also i tried to use onTaskButtonClick : (task) => console.log('clicked on: ', task) but it didn't work

from svelte-gantt.

ANovokmet avatar ANovokmet commented on July 23, 2024

Yeah, it's just a type issue try

this.gantt.api['tasks'].on.select(task => console.log('listener: task selected:', task));

from svelte-gantt.

redouan-da avatar redouan-da commented on July 23, 2024

Wonderful !! that's worked , thanks šŸ‘Œ

from svelte-gantt.

 avatar commented on July 23, 2024

Hi @ANovokmet , can I set to allow Drag and Drop in ONE LINE. Example: I have 3 tasks in line 1, so I just need DnD these tasks in line 1, not allow DnD to another line.

from svelte-gantt.

niczag avatar niczag commented on July 23, 2024

Hi,

Starting with @redouan-da code i've tried to show two different gantt components in the same page :

  gantt1: SvelteGanttComponent;
  @ViewChild('ganttElt1', { read: ElementRef, static: false }) ganttElt1: ElementRef;

  gantt2: SvelteGanttComponent;
  @ViewChild('ganttElt2', { read: ElementRef, static: false }) ganttElt2: ElementRef;

... ... ...

    this.gantt1 = new SvelteGantt({
      // target a DOM element
      target: this.ganttElt1.nativeElement,
     ... ... ...
    });

    this.gantt2 = new SvelteGantt({
      // target a DOM element
      target: this.ganttElt2.nativeElement,
     ... ... ...
    });
<div #ganttElt1></div>
<div #ganttElt2></div>

But the HTML page always show the same gantt twice (gantt2)

Do you have an idea explaining this behavior ?

Thanks

from svelte-gantt.

redouan-da avatar redouan-da commented on July 23, 2024

@niczag did you find a solution yet ?

from svelte-gantt.

niczag avatar niczag commented on July 23, 2024

Hi @redouan-da ,
I've not find the solution.

My code seems to be good : 2 distincts objects for 2 distincts DOM elements

I suppose that in svelte-gantt only only one Component is instanciate (Singleton, global variable not cloned for a new instance) ???

from svelte-gantt.

ANovokmet avatar ANovokmet commented on July 23, 2024

Hi @redouan-da ,
I've not find the solution.

My code seems to be good : 2 distincts objects for 2 distincts DOM elements

I suppose that in svelte-gantt only only one Component is instanciate (Singleton, global variable not cloned for a new instance) ???

Yes, that is true. More precisely, I think the issue is because the stores holding task and row data are singletons. I will work on the fix as soon as I'm able to.

from svelte-gantt.

niczag avatar niczag commented on July 23, 2024

@ANovokmet , thanks for the confirmation.
I'll be waiting for the fix.

I also have notice a compliance problem between the RowModel interface in the row.d.ts and the availables parameters :

I've enabled the "strict mode" in my angular environnement and with this option activated i've had errors with the rows data

{ id: 1, label: 'Row #1', height: null } as RowModel

because 'label' is not defined in the RowModel interface and 'height' cannot be null.

So i've modified row.d.ts like this :

export interface RowModel {
    id: number;
    label: string;
    classes?: string | string[];
    contentHtml?: string;
    enableDragging?: boolean;
    height: number | null;
    children?: RowModel[];
}

from svelte-gantt.

hnguyen48206 avatar hnguyen48206 commented on July 23, 2024

Does anyone encounter this error while running in Angular?

Type 'SvelteRow' does not satisfy the constraint 'EntityType'.ts(2344)

from svelte-gantt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.