forked from x-tag/calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xtag.json
66 lines (66 loc) · 7.08 KB
/
xtag.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
"name": "Calendar",
"tagName": "x-calendar",
"version": "0.1.7",
"author": "Leon Zhang, Matthew Claypotch",
"description": "A component acting as a calendar widget that can be manipulated with minimal user-written code/layout.",
"demo": "demo/testpage.html",
"categories": [
"ui"
],
"compatibility": {
"firefox": 5,
"chrome": 4,
"ie": 9,
"opera": 12,
"android": 2.1,
"ios": 4
},
"documentation": {
"description": "A component acting as a calendar widget that can be manipulated with minimal user-written code/layout.",
"attributes": {
"controls": "Controls the visibility of the calendar's navigation controls; usage is similar to the 'controls' attribute of <video> elements",
"multiple": "Controls whether or not multiple calendar dates can be chosen simultaneously",
"span": "Specifies the number of months displayed at once by the calendar",
"view": "Specifies the Date to focus the calendar display on. For example, a view of Dec 25 2013 and a span of 3 would result in a calendar displaying the months of Nov 2013, Dec 2013, and Jan 2014",
"chosen": "Specifies the date or dates that are toggled as chosen on the calendar. Can be specified as either a singular parsable date string or as a JSON string representing a list of both singular dates and [Date, Date] lists of the start and end date for a range of dates",
"notoggle": "If set, the default date-toggling behavior of the UI is disabled. However, dates can still be programmatically chosen/toggled."
},
"events": {
"datetoggleon": "Fired when the UI sets a day as chosen. Passes the following extra datamap in e.detail: 'date' is the actual Date object corresponding to the chosen day, and 'iso' is the ISO-formatted string representation of the date",
"datetoggleoff": "Fired when the UI sets a day as unchosen. Passes the following extra datamap in e.detail: 'date' is the actual Date object corresponding to the unchosen day, and 'iso' is the ISO-formatted string representation of the date",
"datetap": "Fired when the user taps a day without starting a drag-paint over other dates. Passes the following extra datamap in e.detail: 'date' is the actual Date object corresponding to the unchosen day, and 'iso' is the ISO-formatted string representation of the date"
},
"methods": {
"render([preserveNodes])": "Can be called to manually force a refresh of the calendar's HTML elements. Optionally takes a preserveNodes parameter to indicate that the existing DOM elements in the calendar should be not recreated (Useful when the viewing window of the calendar does not need to change)",
"prevMonth()": "Go back one month by updating the 'view' attribute of the calendar.",
"nextMonth()": "Advance one month forward by updating the 'view' attribute of the calendar.",
"toggleDateOn(dateObjToToggle, [append])": "Sets the day corresponding to the given Date object as chosen. Depending on what is given for the append parameter, this either overrides the current chosen dates if append is falsy/not given, or adds to the list of chosen dates, if append is truthy. Also updates the 'chosen' attribute of the calendar",
"toggleDateOff(dateObjToToggle)": "Removes the given date from the calendar's list of chosen dates. Also updates the 'chosen' attribute of the calendar",
"toggleDate(dateObjToToggle, [appendIfAdd])": "Alternates the chosen status of the given date. Takes an 'appendIfAdded' parameter to determine how the new date replaces existing chosen dates if it is toggled on. Also updates the 'chosen' attribute of the calendar",
"hasVisibleDate(dateToCheck, [excludeBadMonths])": "Determines whether or not the given date is in the visible calendar display of dates. Optionally ignores dates outside of the span of fully-visible months."
},
"getters": {
"firstVisibleMonth": "Returns the Date corresponding to the first day in the first fully-visible month displayed by the calendar",
"lastVisibleMonth": "Returns the Date corresponding to the first day in the last fully-visible month displayed by the calendar",
"customRenderFn": "Returns the currently set custom rendering function, if any is set. (See 'customRenderFn' setter documentation for further details)",
"labels": "The labels of a calendar are managed using a datamap of strings. This allows localizers/translators to edit the labels of the calendar. \n This getter returns a deepcopy of the labels datamap.",
"controls": "Returns true if the 'controls' attribute is set and false otherwise",
"multiple": "Returns true if the 'multiple' attribute is set and false otherwise",
"span": "Returns the value of the 'span' attribute",
"view": "Returns the value of the 'view' attribute in form of a Date object if available and null of otherwise",
"chosen": "Returns the value of the 'chosen' attribute as a Date object/null if the 'multiple' attribute is false, and as a list of singular dates and [Date,Date] ranges of dates if the 'multiple' attribute is true",
"disableUIToggle": "Returns true if the 'disable-ui-toggle' attribute is set and false otherwise"
},
"setters": {
"customRenderFn": "Sets an additional function to call on individual days when rendering the calendar. Will be called with three parameters: the day's DOM element, the JS Date corresponding to the day, and the ISO-formatted string version of the date. This is useful when styles need to be more dynamically flexible than the default. IMPORTANT NOTE: because this is intended as an additional callback to be used in rendering, the function itself should not modify attributes in a way that would require a re-render of the calendar, or infinite recursion can result.",
"labels": "When called, will edit the labels of the calendar. \n\n The set value should be a JS object that can contain any of the following key:value pairs:\n- 'prev': a string to display on the previous-month navigation button\n- 'next': a string to display on the next-month navigation button\n- 'months': an array of 12 strings, where the first string corresponds to January, the second to February, etc, all the way up to December.\n- 'weekdays': an array of 7 strings, where the first string corresponds to Sunday, the second to Monday, etc, all the way up to Saturday.\n\nIf the new data given does not have any of these keys, that corresponding label will remain unchanged.",
"controls": "If true, sets the 'controls' attribute. Otherwise, removes the 'controls' attribute.",
"multiple": "If true, sets the 'multiple' attribute. Otherwise, removes the 'multiple' attribute.",
"span": "Sets the value of the 'span' attribute",
"view": "Sets the value of the 'view' attribute. Can be given either a JS Date object or a parsable string corresponding to a date",
"chosen": "Sets the value of the 'chosen' attribute. Can always take either a JS Date Object or a parsable date string. If multiple is true, can also take a list of singular Dates/parasable date string and [Date, Date] lists of the start and end points of a range of date, as well a JSON string corresponding to such a list.",
"disableUIToggle": "If true, sets the 'disable-ui-toggle' attribute. Otherwise, removes the 'disable-ui-toggle' attribute."
}
}
}