GithubHelp home page GithubHelp logo

anovokmet / svelte-gantt Goto Github PK

View Code? Open in Web Editor NEW
466.0 19.0 102.0 2.35 MB

:calendar: Interactive JavaScript Gantt chart/resource booking component

Home Page: https://anovokmet.github.io/svelte-gantt/

License: MIT License

JavaScript 3.58% TypeScript 44.81% Svelte 51.61%
svelte gantt interactive booking js-gantt javascript-gantt react-gantt angular-gantt vue-gantt svelte-gantt

svelte-gantt's Introduction

svelte-gantt

A lightweight and fast interactive gantt chart/resource booking component made with Svelte. Compatible with any JS library or framework. ZERO dependencies.

GitHub package.json version

svelte-gantt

Features include: Large datasets, drag'n'drop, tree view, zooming in/out, dependencies, date ranges...

DEMO: Large dataset, Tree, Dependencies

Installation

npm install svelte-gantt

Use ES6 imports in your code:

import { SvelteGantt, SvelteGanttTable } from 'svelte-gantt';

or use the IIFE build:

<script src="node_modules/svelte-gantt/index.iife.js"></script>
  1. Initialize svelte-gantt:
var options = {
    /* ... */
};

var gantt = new SvelteGantt({
    // target a DOM element
    target: document.getElementById('example-gantt'),
    // svelte-gantt options
    props: options
});

..or run the example by opening ./public/index.html

Migrating from version 3.x.x-4.x.x

svelte-gantt no longer requires moment. You can still use it as MomentSvelteGanttDateAdapter. All parameters that were previously moment objects became numbers (milliseconds since UNIX epoch).

ALL date parameters should be UNIX timestamps (JavaScript Date and moment objects will still work in most of the cases).

Date parameters can stay moment or JavaScript Date objects because they will be transformed to UNIX timestamps.

CSS is now injected so no need to include svelteGantt.css in your HTML.

Documentation

Pass options object as props to the SvelteGantt constructor. To update use $set, eg.

gantt.$set({
    from: moment().startOf('week').valueOf(),
    to: moment().endOf('week').valueOf()
});
  • rows {Array} Rows to load in the gantt, see below.

  • tasks {Array} Tasks that display in the gantt, see below.

  • timeRanges {Array} Timeranges that display in the gantt, see below.

  • dependencies {Array} Dependencies that display in the gantt, used with the SvelteGanttDependencies module, see below.

  • from {Moment} Datetime timeline starts on.

  • to {Moment} Datetime timeline ends on.

  • minWidth {Number} Minimum width of gantt area in px.

  • fitWidth {Boolean} Should timeline stretch width to fit.

  • highlightedDurations {Object} Pattern for highlighting durations, see below.

  • highlightColor {String} Highlight color (for use with highlightedDurations).

  • magnetUnit {String} Minimum unit of time task date values will round to.

  • magnetOffset {Number} Amount of units task date values will round to.

  • columnUnit {String} Duration unit of columns.

  • columnOffset {Number} Duration width of column.

    • eg. columnUnit: 'minute', columnOffset: 15 will create a column for every 15 minutes.
  • headers {Array} List of headers used for main gantt area.

  • dateAdapter {Object} A date adapter is an object of interface { format(date: number, format: string): string; } that formats a date in UNIX miliseconds to a string using the specified format template, eg. 'MMMM Do'.

  • zoomLevels {Array} List of zoom levels for gantt. Gantt cycles trough these parameters on ctrl+scroll.

  • rowHeight {Number} Height of a single row in px.

  • rowPadding {Number} Padding of a single row in px.

  • ganttTableModules {Array} Modules used in gantt table area.

    • eg. [SvelteGanttTable]
  • ganttBodyModules {Array} Modules used in gantt body area.

    • eg. [SvelteGanttDependencies]
  • reflectOnParentRows {Boolean} When task is assigned to a child row display them on parent rows as well, used when rows are disabled as a tree.

  • reflectOnChildRows {Boolean} When task is assigned to a parent row display them on child rows as well, used when rows are disabled as a tree.

  • classes {String|Array} Custom CSS classes to apply to gantt.

  • resizeHandleWidth {Number} Width of handle for resizing tasks, in px.

  • onTaskButtonClick {Function} Callback for task button clicks.

    • eg. (task) => console.log('clicked on: ', task)
  • taskContent {Function} ,task content factory function.

    • eg. (task) => `<div>Task ${task.model.label}</div>`
  • taskElementHook {Function} ,task element hook function, it is a svelte action.

    • eg. (node, task) => { node.addEventListener('click', console.log); return { destroy() { node.removeEventListener('click', console.log); } }; }
  • tableWidth {Number} Width of table, used with SvelteGanttTable module.

  • tableHeaders {Array} Headers of table, used with SvelteGanttTable module.

  • columnStrokeColor {string} Color of column lines.

    • eg. '#efefef'
  • columnStrokeWidth {number} Width of column lines.

  • layout {'overlap', 'pack'} The layout used to arrange tasks in a row.

    • 'overlap' Overlapping tasks display one over another (default).
    • 'pack' Overlapping tasks shrink and display one above another.
  • enableCreateTask {Boolean} Enables creating new tasks by dragging.

  • onCreateTask {({ from: number; to: number; resourceId: string | number; }) => TaskModel} This function provides the new task model when dragging to create task.

  • onCreatedTask {(task: SvelteTask) => void} Called after task was created by dragging.

Header

Represents a row of header cells that render over the gantt.

  • unit {String} Time unit used to display header cells.
    • eg. 'day' will create a cell in the header for each day in the timeline.
  • format {String} Datetime format used to label header cells.
    • eg. 'DD.MM.YYYY', 'HH'
  • offset {Number} Duration width of header cell.
  • sticky {Boolean} Use sticky positioning for header labels.

Formatting

By default svelte-gantt is only able to format a small set of date templates, eg. 'HH:mm'. For more you can use MomentSvelteGanttDateAdapter as dateAdapter or a custom one, as long as it implements the interface { format(date: number, format: string): string; }.

import { MomentSvelteGanttDateAdapter } from 'svelte-gantt';
import moment from 'Moment';

const ganttOptions = {
    dateAdapter = new MomentSvelteGanttDateAdapter(moment)
    ...
}

Table Header

Represents a single column rendered in SvelteGanttTable.

  • title {String} Label to display in the table column header.
  • property {String} Property of row to display in table column cells.
  • width {Number} Width of table column, in px.

Zoom level

Represents a zoom level which cycle on ctrl+scroll.

  • headers {Array} See above.
  • minWidth {Number} See above.
  • fitWidth {Boolean} See above.

Row

Rows are defined as a list of objects. Rows can be rendered as a collapsible tree (rows are collapsed with SvelteGanttTable module). Row objects may have these parameters:

  • id {Number|String} Id of row, every row needs to have a unique one.
  • classes {String|Array} Custom CSS classes to apply to row.
  • contentHtml {String} Html content of row, renders as background to a row.
  • enableDragging {Boolean} enable dragging of tasks to and from this row.
  • enableResize {Boolean} enable resize of tasks on this row.
  • label {String} Label of row, could be any other property, can be displayed with SvelteGanttTable.
  • headerHtml {String} Html content of table row header, displayed in SvelteGanttTable.
  • children {Array} List of children row objects, these can have their own children.
  • expanded {Boolean} {optional} Used when tree view is enabled, controls the expanded state.

Task

Tasks are defined as a list of objects:

  • id {Number|String} Id of task, every task needs to have a unique one.
  • amountDone {Number} Task completion in percent, indicated on task.
  • classes {String|Array} Custom CSS classes to apply to task.
  • from {number} Datetime task starts on.
  • to {number} Datetime task ends on.
  • label {String} Label of task.
  • html {String} Html content of task, will override label.
  • showButton {Boolean} Show button bar.
  • buttonClasses {String|Array} Button classes, useful for fontawesome icons.
  • buttonHtml {String} Html content of button.
  • enableDragging {Boolean} enable dragging of task.
  • enableResize {Boolean} enable resize of task.

Dependencies

Renders a dependency between two tasks. Used by SvelteGanttDependencies module:

  • id {Number|String} Unique id of dependency.
  • fromId {Number|String} Id of dependent task.
  • toId {Number|String} Id of dependency task.
  • stroke {String} Stroke color.
    • eg. 'red' or '#ff0000'
  • strokeWidth {Number} Width of stroke.
  • arrowSize {Number} Size of the arrow head.

Time ranges

Renders a block of time spanning all the rows:

  • id {Number|String} Unique id of time range.
  • from {number} Datetime timeRange starts on.
  • to {number} Datetime timeRange ends on.
  • classes {String|Array} Custom CSS classes.
  • label {String} Display label.
  • resizable {Boolean} Should the time range be resizable.

Highlighted durations

Highlight a repeating block of time spanning all rows:

  • unit {String} Time unit of duration, e.g. 'day'.
  • fractions {Array} List of fractions that should be highlighted, e.g. {unit: 'day', fractions: [0,6]} will highlight weekends.

Highlighting will only work correctly if useCanvasColumns is set to false, and if highlighted unit is the same or a constant fraction of the column unit eg. day, hour, minute.

Methods

  • selectTask(id) Selects task by id.

    • id {Number|String} Id of task
  • unselectTasks() Unselects tasks.

  • scrollToTask(id, scrollBehavior) Scrolls the view to a task.

    • id {Number|String} Id of task
    • scrollBehaviour {String} auto or smooth.
  • scrollToRow(id, scrollBehavior) Scrolls the view to a row.

    • id {Number|String} Id of row
    • scrollBehaviour {String} auto or smooth.
  • updateTask(model) Updates or inserts task.

    • model {Task} Task object
  • updateTasks(models) Updates or inserts tasks.

    • models {Array<Task>} Task objects
  • updateRow(model) Updates or inserts row.

    • model {Row} Row object
  • updateRows(models) Updates or inserts rows.

    • models {Array<Row>} Row objects
  • getTask(id) Get task by id.

    • id {Number|String} Id of task
  • getRow(id) Get row by id.

    • id {Number|String} Id of row
  • getTasks(rowId) Get tasks by row id.

    • rowId {Number|String} Id of row

Events

Synchronously run callbacks on specific events. Subscribe to these after gantt is created.

gantt.api.tasks.on.select(task => console.log('Listener: task selected', task));

gantt.api.tasks

  • move (task) Runs while task is moving.
  • switchRow (task, row, previousRow) Runs when user switches row of task.
  • select (task) Runs when user selects task.
  • moveEnd (task) Runs when user stops moving task.
  • change (task) Runs after dropping a task, before it is updated.
  • changed (task) Runs after dropping a task, after it is updated.

Available modules

  • SvelteGanttTable Renders a table on the left side of gantt. Needed for row labels.
  • SvelteGanttDependencies Renders dependencies between tasks.
  • SvelteGanttExternal Enables external DOM elements to be draggable to svelte-gantt. Useful for creating new tasks:
new SvelteGanttExternal(
    // external DOM element
    document.getElementById('newTaskButton'),
    // options
    {
        // reference to instance of svelte-gantt
        gantt,
        // if enabled
        enabled: true,
        // success callback
        // row: row element was dropped on
        // date: date element was dropped on
        // gantt: instance of svelte-gantt
        onsuccess: (row, date, gantt) => {
            // here you can add a task to row, see './public/main.js'
        },
        // called when dragged outside main gantt area
        onfail: () => {},
        // factory function, creates HTMLElement that will follow the mouse
        elementContent: () => {
            const element = document.createElement('div');
            element.innerHTML = 'New Task';
            Object.assign(element.style, {
                position: 'absolute',
                background: '#eee',
                padding: '0.5em 1em',
                fontSize: '12px',
                pointerEvents: 'none'
            });
            return element;
        }
    }
);

Usage with svelte

To use svelte components import from svelte-gantt/svelte:

<script>
    import { SvelteGantt, SvelteGanttTable, MomentSvelteGanttDateAdapter } from 'svelte-gantt/svelte';

    let options = {
        //
    };
</script>
<div class="container">
    <SvelteGantt {...options}></SvelteGantt>
</div>

Development build

If you want to build from sources: Install the dependencies...

cd svelte-gantt
npm install
cd demo
npm install

...then in the project root (cd ..) start Rollup:

npm run demo:dev

Navigate to localhost:5173. You should see your app running. Edit a component file in src, save it, and reload the page to see your changes.

Build the package

To build the package yourself:

  1. Clone or download repository.
  2. Run the package build:
npm install
npm run package
  1. The package is built in ./dist

TBD

  • Context-menus (click on row, task or dependency)

svelte-gantt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svelte-gantt's Issues

Week view is not display fitWidth

Hello,
I can't show the weekly view in a compressed form, but the gantt looked like that in old versions. In the new version, when I click on the bar above the dates, it switches to that view. How can I get that fixed view to come?

Task selected class

Whenever a task is clicked on or dragged/moved, the following CSS class always stays: .sg-task.selected.svelte-19txnoa. It would be good if and when the user clicks out somewhere else on the page (not necessarily on another task - anywhere on the page really), for the selected class to be removed from the task. I think this may require some event listener (but not exactly sure).

Cannot have duplicate keys in a keyed each

Hello,
I am reading machine and task data from database. I have 25 machine, 40 task records in my database. I am getting this error after 27th task. I don't get an error when I change my query to get first 26 tasks. What could cause the problem?
I write console.log command in index.js function validate_each_keys. Get error when double undefined records.

error

Sapper import issue

When trying to use with sapper I'm getting the following error.

\node_modules\svelte-gantt\index.js:1
import moment, { duration } from 'moment';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Task bar drawing start position error

If the 'from' property is not set to the whole time, the starting position of the task bar is drawn incorrectly and will move forward.
The following figure is the official example. Draw the correct screenshot. The 'from' property value is '8:00'.
image

But if i change the 'from' property's value to '8:30', the starting position of the task bar is drawn incorrectly and will move forward.
The screenshot is as follows:
image

strange behavior with timeRanges

Hi,
I pass several timeRanges to the gantt:
image

The gantt first loads the timeRanges:
image

When I change the day, a timeRange is still there, even if it was the day before:
image

I would have expected the timeRanges to only be there on the defined days.

Thank you.

Handling for deselection of .sg-selected and .sg-hover

Right now I have some styles for these two classes, but when I hover off of the gantt or when I click on an already selected row, I would assume that both the hover style and the selected style would be toggled off, but they both remain on. (can provide video if needed)
Is it possible to implement these?

Click the head time to enter the the details bug

After clicking the head time to enter the details, you can no longer return to the current view. You can only enter the later time details.
Step 1. Click '15.04.2022'
image
Step 2. Click the blank space in the box, can enter the details '16.04.2022'
image
Step 3. How can I return to '14.04.2022'?

GanttOptions: Cannot destructure property 'toggle' of '__vite_ssr_import_1__.getContext(...)' as it is undefined.

Hi

I am currently trying to create a first draft of a Gantt chart using this library. So far so good, but as soon as I want to include GanttOptions as well, the error message mentioned in the title comes up.
The message is triggered on the line: let { toggle, optionsStream } = getContext('options'); in GanttOptions.svelte. However, I have already checked everything several times and I can't find any error.
Does anyone know what the problem could be?

Thanks a lot

Mike

RowModel Types

Hi! 👋

Firstly, thanks for your work on this project! 🙂

In my opinion the types I'm using seem to be working.
I'm not sure about the id. Afaik it can be a string too.

label is defined in the README but missing in the interface.
height works fine without providing it. So I will assume it's optional.

Aliyss

Here is the diff that solved my problem:

diff --git a/node_modules/svelte-gantt/types/core/row.d.ts b/node_modules/svelte-gantt/types/core/row.d.ts
index a2469e2..5e65ca3 100644
--- a/node_modules/svelte-gantt/types/core/row.d.ts
+++ b/node_modules/svelte-gantt/types/core/row.d.ts
@@ -1,9 +1,10 @@
 export interface RowModel {
-    id: number;
+    id: number | string;
+    label: string;
     classes?: string | string[];
     contentHtml?: string;
     enableDragging?: boolean;
-    height: number;
+    height?: number;
     /** Child rows in expandable tree */
     children?: RowModel[];
     /** Content of row header, html string */

React / Vanilla JS question

Love this gantt chart, it's awesome, thanks for all your work and under the MIT license.

My issue is I need it in React. I see a few options:

  • fork it, rip out svelte stuff and replace with JSX
  • collaborate with you making it React compatible
  • collaborate with you making it vanilla JS, that way anyone (React / Vue / Svelte) can import it.

Curious to hear your thoughts on this.

Dependencies module

Cool library thanks!
Is the dependencies module currently wired up? I followed the code as best I could but couldn't see how to get it going.

Using svelte-gantt in angular

I’m working on a small project of mine where I’m looking to use a time line calendar, I'm trying to use svelte-gantt in my angular project, I didn’t find any example for implement this in angular.

I tried using this example but I got this error :
"TS2749: 'SvelteGantt' refers to a value, but is being used as a type here. Did you mean 'typeof SvelteGantt'?"

here is my component.ts

`
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
import * as moment from 'moment';
import { SvelteGantt } from 'svelte-gantt';

@component({
selector: 'app-root',
template: '<div #ganttElement style="height: 100%; width: 100%;">'

})
export class AppComponent implements AfterViewInit {

/* here where the error shows */
gantt: SvelteGantt; // TS2749: 'SvelteGantt' refers to a value, but is being used as a type here. Did you mean 'typeof SvelteGantt'?

@ViewChild('ganttElement', {static: false}) ganttElement: ElementRef;

ngAfterViewInit() {
this.gantt = new SvelteGantt({
// target a DOM element
target: this.ganttElement.nativeElement,
// svelte-gantt options
props: {
tasks: [],
rows: [],
from: moment().startOf('week'),
to: moment().endOf('week')
}
});

}
}
`

DependencyModel - stroke and strokeWidth property is not working as mentioned in document

In my project I have integrated the dependency module of gantt chart. But what I observe stroke and strokeWidth property is not working as mentioned in document. Is this a open issue or something I am missing.

Do you please share any demo having dependency module integrated with mentioned properties.

I have created the dependency array in below way.

const objDependacy = {
id: new Date().valueOf(),
fromId: '#componentFromId#'
toId: '#componentToId#',
stroke: 'black',
strokeWidth: 15,
arrowSize: 1,
};
this.dependancies.push(objDependacy);`

timeRange classes not working

Nice work on the chart!
But I dont seem to be able to add classes to the timeRanges
It works for the tasks

timeRanges: [
      {
        id: 1,
        from: Date.parse("2022-05-16T12:25"),
        to: Date.parse("2022-05-16T12:50"),
        classes: "green",
        label: "test",
      },
      {
        id: 2,
        from: Date.parse("2022-05-16T14:25"),
        to: Date.parse("2022-05-16T14:50"),
        classes: ["currentTime"],
        label: "test2",
      },
    ]

image
image

version "4.0.3-beta"

Scrolling from left to right of the Gantt chart

I want to be able to scroll from left to right for example from 00:00 from today to 00:00 of tomorrow without displaying all hours all at once. I am aware I can set the currentEnd...but that will mean all hours from 00:00 to next day 00:00 are displayed in one go. Instead scrolling would be good. How could I do that please?

API won't return tasks that use a string as an id

I've been trying to use a string (uuid) instead of a number to identify my tasks and rows. This somehow seems to be broken though:
When using my test data as shown below then the component will load and display everything as expected.
As soon as I try to access a task event via API (i.e. gantt.api.tasks.on.select) though, the callback is run but only receives an empty object instead of the task. When changing the ids to some numbers then everything works properly again.

I tried to look into your code but I am not familiar enough with javascript to figure out what the issue might be.

import { time } from '../utils';

export const data = {
    rows: [{
        id: "bda66280-7a1b-4c63-baaa-fcd59fda7628",
        label: "Petunia Mulliner"
    }],
    tasks: [{
        id: "d4a5e677-ac25-4266-879d-2694e861df07",
        resourceId: "bda66280-7a1b-4c63-baaa-fcd59fda7628",
        label: "LPCVD",
        "from": time("9:00"),
        "to": time("11:00"),
        classes: "orange"
    }],
    dependencies: []
}

Height auto

This is how gantt stays if we don't set the height.

image

I could put height auto, simply using:

.sg-timeline-body { flex: 0 1 auto !important; }

image

Maybe should be something to include by default, or maybe using an optional prop.

lazy loading? moment.js settings probability?

This project is awesome. I love it so much.
I have some problem when I using this.

  1. Does it have lazy loading support?
  2. How can we set the moment.js settings?
    (ex. setting localization or which day of the week in year for global setting in gantt)

Allow more styling options for columns

As #20 suggested, it would be good if columns could be styled with css. Much better for performance would be to still use background-image but allow columns to be styled using gantt options.

Maybe something like

    columnStrokeWidth: 1,
    columnStrokeColor: '#ccc',

Dev mode setup

Hello,
I would be glad to help on this project and on some of the issues since I'm having some of them too and using your gantt in my projects.
But I'm having a hard time making the dev mode work correctly since your big update.
Looks like the documentation is not accurate anymore and I don't know how to setup it the right way.
If you or anyone could give the proper way to setup the dev mode it would be awesome so I could do proper PR and help maintain this cool project :)

Thanks

Local dev environment

Hey,

Let me begin with a big thank you for generously open-sourcing your hard work around Gantt charts. There are few free options available out there so really appreciate the efforts and the intention.

I tried running the demo/docs project but found the following console errors. There seems to be an issue around Svelte Routing.

Screenshot 2021-12-06 at 5 48 34 PM

I'm planning to consume, enhance, and contribute back to this project. Could you please let me know the steps / provide me with a document to set up the project for local development? I followed this but it seems it is not up to date https://github.com/ANovokmet/svelte-gantt#development-build.

Thanks in advance.

Manaday

Time Ranges Resize and Time Range Lable box Click event

Hello,

is there any way I can generate time ranges resize event and get time range object with resize time, also time range label box click event and get time range object

I've try but no success

Please help me out

Thanks in advance

Read only mode

Is it possible to disable all events for tasks? I mean make some kind of read-only mode

Thank you

Can svelte-gantt be used in SSR?

Right now svelte-gantt is used in onMount only for client-side rendering, is it possible for it to render server side as well and not rely on document?

Drag to Gantt does not round task time

@ANovokmet When using SvelteGanttExternal to implement the functionality to drag a new task to the Gantt chart, it does not round/respect the default magnetOffset which is 15. For example, even on https://anovokmet.github.io/svelte-gantt/, if you use the drag to Gantt functionality, and try dragging it leaving the mouse somewhere in the middle of lines e.g. at 08:06am, this will work. And then the console log also proves this as well. So it is not respecting the default magnetOffset. However, afterwards, when moving the newly added task, it does respect it.

EDIT: Found another bug when dragging a new task to the Gantt:

When dragging a new task to the Gantt chart, by default, the colour whilst dragging is blue. However, when dropping the task i.e. letting go off the mouse, the task maybe a different colour like orange. Would be good if the task bar had the same colour whilst being dragging as it would when it is dropped.

Possibility to override/deactivate the onDateSelected method

Hello,
It would be nice to be able to override and/or deactivate the onDateSelected function launched with the on:click event in the ColumnHeaderRow component. My specific need being to change the headers units and/or the columnUnit after clicking on the ColumnHeader. Or at least deactivate the possibility to click on the headers so it won't mess with my layout (ie different units depending of the timescale used)

ColumnHeaderRow.svelte (rows 52 - 57)
{#each _headers as _header} <div class="column-header-cell" class:sticky={header.sticky} style="width:{_header.width}px" on:click="{() => dispatch('dateSelected', { from: _header.from, to: _header.to, unit: _header.unit })}"> <div class="column-header-cell-label">{_header.label || 'N/A'}</div> </div> {/each}

Gantt.svelte (rows 393 - 396)
function onDateSelected(event) { $_from = event.detail.from; $_to = event.detail.to; }

I can maybe try it and do a pull request if you don't have time to treat this. Since I need it for my projects, I'll implement it anyway locally otherwise.

Thank you for your time and you response

[Suggestion] Extend features of table (filter, group, sort, ...)

Hey guys, wouldnt it be nice to have extend table features (e.g. group by column/filter/sorting/...)?

I found this example for grouping, to show the feature (it would be awesome to have reflections on the parent of each dynamic group):
https://svelte.dev/repl/8e810d253d4e4d86a41a6ff02729c6b6?version=3.48.0

'Header Less Table' (used in the REPL) seems to be discontinued for 'Tanstack Table'.

Looking at this, layout of rows doesnt seem so different from rowStore used in 'Svelte Gantt' (https://tanstack.com/table/v8/docs/api/core/row). Maybe they are willing to include missing row properties like Y-Positions and AllParents.

Any thoughts?

NPM package?

Hey, really nice library. It is hard to find Gantt charts with permissive licenses.

Any thoughts on publishing an NPM package? I think it'd really help adoption.

Task background-color

Hello,
I'm currently trying to learn about initiate the svelte-gantt.
and I try to create a copy from the example that you have in /demo/src/route/tree.svelte and just do exactly the same configuration for the options, especially for tasks.

image.

It is set as "orange" on classes for example of the first three task example.

But I'm still got the default task background-color for that which is blue
image

Anything else that need to be configured to get the "orange" task background-color just like the example?

image

thank you for your time.

Styles are missing when using in ES6 import

Whenn i follow the way to import ES6 style in my App.svelte file:

import { SvelteGantt, SvelteGanttTable } from 'svelte-gantt';

It works, but most of the styles for the tasks are missing.
Shouldn't they be also included when I'm having tasks in the Gannt or do I really have to include them directly from node_modules my self?

Overlapping Events, Event Bar below other

Hello,

Is there a way to have overlapping events in a row below each other and not visually overlapping?

Any hint how to achieve that, is appreciated!

edit: I see, it was discussed already
#19 (comment)
Any news regarding this?

Thanks
Martin

Cannot read properties of undefined (reading 'height')

Hey
Thank you for the generous open-source, i am getting the following error while i try to add task from API using updateTasks method.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'height') which leads to getHeight(model) { return this.row(model.resourceId).height - 2 * this.rowPadding; } yes i have mapped children array id to resourceId, thank you

Drag and Drop Issue

Hello

I'm working on Angular@12 and [email protected]

I face one issue when drag and drop new task,
when week view selected and drop new task at last week day then new task not plot exact drop time (position) instead plot few hours early.

also plot working fine starting week days, when you drop new task incremental day then it plot few hours ago and increase plot hours.

please check below example

https://stackblitz.com/edit/angular-ivy-sm719e

Thanks in advance

Build issues

Hello, first of all thank you for your amazing gantt.

I have found some bugs related with your tools/build.js, but I can't create a pull request..

Greetings, Fábio

Dependency error with moment.js

$ npm run dev

> [email protected] dev
> svelte-kit dev

Pre-bundling dependencies:
  svelte/store
  svelte
  svelte-gantt
  svelte/animate
  svelte/easing
  (...and 3 more)
(this will be run only when your dependencies or config have changed)
 > node_modules/svelte-gantt/index.js:1:17: error: No matching export in "node_modules/moment/src/moment.js" for import "duration"
    1 │ import moment, { duration } from 'moment';~~~~~~~~

> Build failed with 1 error:
node_modules/svelte-gantt/index.js:1:17: error: No matching export in "node_modules/moment/src/moment.js" for import "duration"
Error: Build failed with 1 error:
node_modules/svelte-gantt/index.js:1:17: error: No matching export in "node_modules/moment/src/moment.js" for import "duration"
    at failureErrorWithLog (/home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:1493:15)
    at /home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:1151:28
    at runOnEndCallbacks (/home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:941:63)
    at buildResponseToResult (/home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:1149:7)
    at /home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:1258:14
    at /home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/home/skyf0l/repos/RoomIt/frontend/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (events.js:400:28)
    at Socket.emit (domain.js:475:12)

With my package.json:

{
  "name": "RoomIt",
  "version": "0.0.1",
  "scripts": {
    "dev": "svelte-kit dev",
    "build": "svelte-kit build",
    "preview": "svelte-kit preview",
    "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
    "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
  },
  "devDependencies": {
    "@sveltejs/kit": "next",
    "prettier": "^2.4.1",
    "prettier-plugin-svelte": "^2.4.0",
    "svelte": "^3.34.0"
  },
  "type": "module",
  "dependencies": {
    "@fontsource/fira-mono": "^4.5.0",
    "@lukeed/uuid": "^2.0.0",
    "cookie": "^0.4.1",
    "svelte-gantt": "^3.0.4-beta"
  }
}

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.