Git Product home page Git Product logo

jquery-sked-tape's Introduction

jquery-sked-tape

Schedule component for jQuery that represents events in tape manner.

DEMO

API

Initialization

Usually it looks like:

var $sked = $('#sked').skedTape({
    caption: 'Cities',
    start: yesterday(22, 0), // Timeline starts this date-time
    end: today(12, 0),       // Timeline ends this date-time
    showEventTime: true,     // Whether to show event start-end time
    showEventDuration: true, // Whether to show event duration
    locations: [
        {id: 1, name: 'San Francisco'}, // required properties only
        {
            id: 'london',
            name: 'Sydney',
            order: 1, // optional sorting order
            tzOffset: -10 * 60, // individual timezone (notice that minus sign)
            userData: {...} // optional some custom data to store
        },
        ...
    ],
    events: [
        {
            name: 'Meeting 1',
            location: 'london',
            start: today(4, 15),
            end: today(7, 30)
        },
        // ...
    ]
});

Available constructor options:

  • locations (object) Maps location-id -> location-name.
  • events (Array) An array of event objects (see description below).
  • start, end (Date) Timeline is shown between these date-times.
  • caption (string) The text in left top corner. Default is ''.
  • maxZoom (float) Self-explanatory. Default is 10.
  • zoomStep (float) Zoom up and down increment value. Default is 0.5.
  • zoom (float) Initial zoom level. Minimum possible and default value is 1.
  • showEventTime (bool) Whether to show from-to dates in entries. Default is false.
  • showEventDuration (bool) Whether to show duration in entries. Default is false.
  • showDates (bool) Whether to show dates bar. Default is false.
  • minGapTime (int) Minimum gap between entries to show minutes in milliseconds. Default is 1min.
  • maxGapTime (int) Maximum gap between entries to show minutes in milliseconds. Default is 30min.
  • minGapHiTime (int|false) Minimum gap to DO NOT highlight adjacent entries in milliseconds. Default is false.
  • formatters (object) Custom date/time formatters. See the notes below.
  • scrollWithYWheel (bool) Enables horizontal timeline scrolling with vertical mouse wheel. Default is false.
  • tzOffset (int) The default timezone offset for locations, taking effect when you do not specify it in location descriptor. The default value is a browser's current timezone offset. Take in mind, that the offset value is negative for positive timezones (GMT+N) and positive otherwise (i.e. for Sydney GMT+10 the offset would be -600).
  • timeIndicatorSerifs (bool) Enables showing upper and lower serifs on time indicator line. Default is false.
  • showIntermission (bool) Enables or disables showing intervals between events. Disabled by default.
  • intermissionRange ([int, int]) Interval (in minutes) between events to show intermission time when it is enabled. The default value is [1, 60].
  • showPopovers ("default"|"always"|"never") The default behavior is to show pop-ups for events that are either too small to be visible or partially outside the timeline.

Available event object options:

  • name (string)
  • location (int|string) Location id (key in locations object).
  • start, end (Date)
  • url (string) If set the entry will be rendered as anchor with href=url.
  • className (string) Additional class name for stylizing purposes.
  • disabled (bool) Adds the sked-tape__event--disabled class. Default is false.
  • data (object) The data to set with $.data() method. The eventId is reserved.
  • userData (object) Any custom data you may store here.

Events

Plugin-specific event handlers may be added like this:

// The following handler fires on clicking on an event:
$sked.on('event:click.skedtape', function(e/*, api*/) {
    $sked.skedTape('removeEvent', e.detail.event.id);
    // api.removeEvent(e.detail.event.id)
    // assert(api === e.detail.component)
});

Available events:

  • intersection:click.skedtape

  • intersection:contextmenu.skedtape

  • timeline:click.skedtape

  • timeline:contextmenu.skedtape

  • event:click.skedtape The detail property contains corresponding event object.

  • event:contextmenu.skedtape The detail property contains corresponding event object.

  • event:dragStart.skedtape

  • event:dragStarted.skedtape

  • event:dragEnd.skedtape

  • event:dragEnded.skedtape

  • event:dragEndRefused.skedtape

  • skedtape:event:dragCanceled

  • skedtape:event:addingCanceled

The props in common for all click event/contextmenu events:

  • detail.locationId
  • detail.date Click position converted to datetime on timeline.
  • relatedTarget
  • pageX, offsetX, etc

Custom date/time formatting

To change the way dates are displayed by plugin there're two cases. You may fill up the formatters property during the constructing of every component. And also you may change default settings globally, replacing the formatters within the $.fn.skedTape.format object. ATTENTION Do not replace the object itself - it won't work.

Hooks

  • canAddIntoLocation(location, event) Invoked to determine whether an event may be added to a location. The default implementation always returns true. You should avoid mutating the arguments in this hook (that may cause unexpected behaviour).
  • beforeAddIntoLocation(location, event) Invoked after getting a positive result from the canAddIntoLocation() hook just before updating the event. Here you can place any logic that mutates the event object given.
  • postRenderLocation($el, location, canAdd) The mixin is applied to every location's DOM element when rendering the sidebar. he callback takes 3 arguments:
    • $el - jQuery text element node representing the location
    • location - the corresponding location object
    • canAdd - the result of executing the canAddIntoLocation() function. The value is undefined if the function is called while no event is being dragged.
  • postRenderEvent($el, event) The mixin applied to every event DOM element on the timeline after rendering is complete and before actual inserting to the DOM tree of the document. The default implementation does nothing, you may feel free to replace it with your own code that modifies the default representation of events on a timeline.

Development deploy

  1. npm i -g gulp-cli
  2. npm i
  3. gulp build (AOT) or gulp (JIT)

jquery-sked-tape's People

Contributors

bryce13950 avatar dependabot[bot] avatar tokidoki11 avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-sked-tape's Issues

How to change the background color of one event

Hi,
I want to know how to change the background color of an event.
If it can, can you tell me how to set the background color of an event.
If it can't, please update something to set it
Thanks

Return all data of the events array

Hello,
i have question, it's possible to return all the content of the skedTape like all events with the function GetEvents() ? i try to access to the function but nothing seem to work.

Thank you

Is it possible to resize part of the timesheet so that the scroll bar is not displayed?

Hello lexkrstn.
Your library is very useful.

But I would like to ask for advice.
Please let me know if you can.

When the display range is exceeded, scroll bars are automatically displayed on the time sheet.

Is it possible to reduce this scroll bar to an invisible size?

The purpose is to browse timesheets without scrolling in a fixed sized browser.
Scrollbars are displayed when displaying information for one day, so I would like to solve this.

Thank you.

IE 11 long period has some abnormalities

Using IE 11
I set start from 2019/09/02 to 2019/12/31

I found 2 problems:

  1. Date bar is kinda off
  2. Clicking on the timeline, the time value from the event callback is wrong (Somehow I feel its start time minus the period I click)

Screen Image

dates topbar does not go all the way to the end of time interval in modal

I trying to display the scheduler in a bootstrap modal. The topbar with the dates does not stretch all the way to the end of the selected time interval. Instead all dates are clustered together. Scrolling left shows empty white space at the top. Please take a look at the attached screenshots.

Thanks in advance,
AD

screen shot 2019-03-03 at 6 51 47 pm
screen shot 2019-03-03 at 6 52 24 pm
screen shot 2019-03-03 at 6 52 45 pm
screen shot 2019-03-03 at 6 53 09 pm

Add location with error: append is not a function

Hi

I really love this library!

When I add location dynamic with this script:

$tm.skedTape('addLocation', { id: 1, name: 'TEST' })

error happen and the console output log is:

TypeError: this.locations.append is not a function
    at SkedTape.addLocation (jquery.skedTape.js:167)
    at HTMLDivElement.<anonymous> (jquery.skedTape.js:1138)
    at Function.each (jquery.min.js:2)
    at k.fn.init.each (jquery.min.js:2)
    at k.fn.init.$.fn.skedTape (jquery.skedTape.js:1099)

So I survey your code in line 167:

this.locations.append(location);

And I modify this line to:

this.locations.push(location);

Everything works perfect!

Is this fixing a right way? Or my script is wrong for this method?

Autoscroll to current time

Hi

Is there a way to have an auto scroll to current time on init/first display
Also a follow current time during the day

Thanks

How to fix the title time bar and the bottom time bar

Hi,
It's me again.
If the vertical scroll is displayed and scroll to the middle, the title time bar and the bottom time bar will not be display.
Is that any way to fix the title time bar and the bottom time bar?

Consultation on how to write licenses

Hi, lexkrstn.

Your library is very good.

Use this library for your application.

I would like to confirm, but for the notation of the MIT license, can I just copy the contents of the MIT license to the top of the CSS file and Javascipt file?

The contents are as follows.
โ†“
Copyright (c) 2018 lexkrstn
Released under MIT license
https://github.com/lexkrstn/jquery-sked-tape/blob/master/LICENSE

I'm trying to add this text to the beginning of a CSS file and Javascript.
Again, your library is great.

Date tape is still shown in UTC while event is default to GMT

I know we can override the formatter, but for the sake of similarities should we change to LocateDateString by default as well?
Suggesting this change
using localeDate with en-US as default

date: function (date, endian, delim) {
	endian = endian || 'm';
	var nums = date.toLocaleDateString("en-US").split('/');
	nums = endian === 'l' ? [parseInt(nums[1]), parseInt(nums[0]), nums[2]] : nums;
	return nums.join(delim || (endian === 'm' ? '/' : '.'));
},

shrink down to days not hours

Hi,

great work!

For my project, i only need to show one event on a day.
so is it possible to shrink down the view from hour to just the day name?

Regards,
Dominik

Can not able to set Option minGapTimeBetween

I wanted to put 8 hours gap beetween 2 event, I have tried to assign miliseconds to an option e.g minGapTimeBetween = 28,800,000, but i cant see any effect on UI, its has its default 1 hour
Screenshot

Reverse Row and Col

Hi;
I was wondering if it's possible to switch row and col. Meaning but the time on the side and the room on the top.

Thanks

Popper js

Is this a good approach to the popovers ?
$.each($('.sked-tape__event'), function (index, value) {
$(this).popover({
trigger: 'hover',
content: $(this).find('.sked-tape__center').html().split('<br>')[1],
html: true,
placement: 'right'
});
})

Can I make it working with just your API ?

Uncaught TypeError: $.skedTape is not a function

Hi

Thank you for this library.

I got this error "Uncaught TypeError: $.skedTape is not a function."

Im using codeigniter and this is my code :

$.ajax({
url: "",
type: "GET",
data: {},
dataType: "JSON",
success: function (data)

        {
            if(data.status == 'Success'){
                
                var locations = [
                    {id: '1', name: 'Test1'},
                    {id: '2', name: 'Test 2'}
                ];
                
                var events = [
                    {
                        name: 'ABC1234567',
                        location: '1',
                        start: today(11, 0),
                        end: today(14, 45)
                    },
                ];

                var sked2Config = {
                    caption: 'Location',
                    start: today(8, 0),
                    end: tomorrow(8, 0),
                    showEventTime: true,
                    showEventDuration: true,
                    locations: locations.map(function(location) {
                        var newLocation = $.extend({}, location);
                        delete newLocation.tzOffset;
                        return newLocation;
                    }),
                    // events: events.slice(),
                    tzOffset: 0,
                    sorting: true,
                    orderBy: 'name',
                };
                var $sked2 = $.skedTape(sked2Config);
                $sked2.appendTo('#sked2').skedTape('render');
                $sked2.skedTape('destroy');
                $sked2.skedTape(sked2Config);
            }
        }

});

Please help me...

Please tell me about the display speed problem and the export function.

Hi, lexkrstn.

Your library is very useful.
However, there are some problems.
Can you give me an idea?

There are two problems.

No.1 is a display speed issue.
I want to put out a user time tape for 20,000 lines.

However, it takes more than 30 minutes to display.

Is there a way to improve the display speed?
There is data to display in advance.
Time is taking here.

$ sked2.appendTo ('# TestContainer'). skedTape ('render');

No.2 is about the export function.
I want to output the contents in the form of an excel graph when I press a button on the screen.
Or, I want to output the area as an image.
Does lexkrstn have any plans to add an export function in the future?

switch x and y axis

would it be possible to switch x and y axis, e.g. show locations on top and time on left

Problem with scroll

I set hours from 6:00 to 00:00.
If sked is scrolled before 10:00 everything is working great.
But if i try to set hour of event after 18:00 (10:00 is not visible) weird scroll behavior is firing (on dragStart and dragEnded).

More on Gif:
bug

Resize event

Hi, is it possible to add the resize feature to an event? Thank you in advance, best plugin for schedule!

Add more explanation for tzOffset in README.md

First so thank you for this project.

tzOffset is based minute
At first, I confused when I set tzOffset 9. "Why don't appear any chages?"
When I saw SkedTape.js internal, I knew it. tzOffset is working for minute.
So If you ok to add a little mention for tzOffset. that is good to other people.

change the time zone

its always a good idea that developer can set there own time zone or there's clients time zone.
please update something to set the time zone for GMT

Date bar

    $("div#divSkedTape").skedTape({
        "locations": [ 
            { "id": "asdf", "name": "ASDF" },
            { "id": "qaz", "name": "QAZ" },
            { "id": "qwerty", "name": "Qerty" },
            { "id": "klm", "name": "KLM" }
        ],
        "events": [
            {
                "name": "1",
                "location": "asdf",
                "start": moment("2019-08-10 10:30:00", "YYYY-MM-DD HH:mm:ss", true).toDate(),
                "end": moment("2019-08-10 13:00:00", "YYYY-MM-DD HH:mm:ss", true).toDate(),
                "disabled": true
            }
        ],
        "start": moment("2019-08-10", "YYYY-MM-DD").startOf("day").toDate(),
        "end": moment("2019-08-10", "YYYY-MM-DD").add(1, "days").startOf("day").toDate(),
        "caption": "IJK",
        "showEventTime": true,
        "showEventDuration": true,
        "showDates": true
    });

Date in date bar is incorrect. I expect Aug 10, 2019, but Aug 9, 2019 is displayed.

Can not show in IE11

Hi,

I tried the demo in IE11, and it didn't work.
Can you support the IE11?
IE 11 version is 11.251.16299

Ignore time zone at all

Hello!
How can I completely turn off time zone function?
I need to see on a ruler exact time I specified in my script, regardless time zones.
It is possible? tzOffset: 0 didn't help...
Thanks.

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.