UNPKG

9 kBJavaScriptView Raw
1/**
2 * This object contains all possible options. It will check if the types are correct, if required if the option is one
3 * of the allowed values.
4 *
5 * __any__ means that the name of the property does not matter.
6 * __type__ is a required field for all objects and contains the allowed types of all objects
7 */
8let string = 'string';
9let bool = 'boolean';
10let number = 'number';
11let array = 'array';
12let date = 'date';
13let object = 'object'; // should only be in a __type__ property
14let dom = 'dom';
15let moment = 'moment';
16let any = 'any';
17
18let allOptions = {
19 configure: {
20 enabled: { 'boolean': bool},
21 filter: { 'boolean': bool,'function': 'function'},
22 container: {dom},
23 __type__: {object, 'boolean': bool,'function': 'function'}
24 },
25
26 //globals :
27 align: {string},
28 alignCurrentTime: {string, 'undefined': 'undefined'},
29 rtl: { 'boolean': bool, 'undefined': 'undefined'},
30 rollingMode: {
31 follow: { 'boolean': bool },
32 offset: {number,'undefined': 'undefined'},
33 __type__: {object}
34 },
35 onTimeout: {
36 timeoutMs: {number},
37 callback: {'function': 'function'},
38 __type__: {object}
39 },
40 verticalScroll: { 'boolean': bool, 'undefined': 'undefined'},
41 horizontalScroll: { 'boolean': bool, 'undefined': 'undefined'},
42 autoResize: { 'boolean': bool},
43 throttleRedraw: {number}, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
44 clickToUse: { 'boolean': bool},
45 dataAttributes: {string, array},
46 editable: {
47 add: { 'boolean': bool, 'undefined': 'undefined'},
48 remove: { 'boolean': bool, 'undefined': 'undefined'},
49 updateGroup: { 'boolean': bool, 'undefined': 'undefined'},
50 updateTime: { 'boolean': bool, 'undefined': 'undefined'},
51 overrideItems: { 'boolean': bool, 'undefined': 'undefined'},
52 __type__: { 'boolean': bool, object}
53 },
54 end: {number, date, string, moment},
55 format: {
56 minorLabels: {
57 millisecond: {string,'undefined': 'undefined'},
58 second: {string,'undefined': 'undefined'},
59 minute: {string,'undefined': 'undefined'},
60 hour: {string,'undefined': 'undefined'},
61 weekday: {string,'undefined': 'undefined'},
62 day: {string,'undefined': 'undefined'},
63 week: {string,'undefined': 'undefined'},
64 month: {string,'undefined': 'undefined'},
65 quarter: {string,'undefined': 'undefined'},
66 year: {string,'undefined': 'undefined'},
67 __type__: {object, 'function': 'function'}
68 },
69 majorLabels: {
70 millisecond: {string,'undefined': 'undefined'},
71 second: {string,'undefined': 'undefined'},
72 minute: {string,'undefined': 'undefined'},
73 hour: {string,'undefined': 'undefined'},
74 weekday: {string,'undefined': 'undefined'},
75 day: {string,'undefined': 'undefined'},
76 week: {string,'undefined': 'undefined'},
77 month: {string,'undefined': 'undefined'},
78 quarter: {string,'undefined': 'undefined'},
79 year: {string,'undefined': 'undefined'},
80 __type__: {object, 'function': 'function'}
81 },
82 __type__: {object}
83 },
84 moment: {'function': 'function'},
85 groupHeightMode: {string},
86 groupLabelDirection: {string},
87 groupOrder: {string, 'function': 'function'},
88 groupEditable: {
89 add: { 'boolean': bool, 'undefined': 'undefined'},
90 remove: { 'boolean': bool, 'undefined': 'undefined'},
91 order: { 'boolean': bool, 'undefined': 'undefined'},
92 __type__: { 'boolean': bool, object}
93 },
94 groupOrderSwap: {'function': 'function'},
95 height: {string, number},
96 hiddenDates: {
97 start: {date, number, string, moment},
98 end: {date, number, string, moment},
99 repeat: {string},
100 __type__: {object, array}
101 },
102 itemsAlwaysDraggable: {
103 item: { 'boolean': bool, 'undefined': 'undefined'},
104 range: { 'boolean': bool, 'undefined': 'undefined'},
105 __type__: { 'boolean': bool, object}
106 },
107 limitSize: {'boolean': bool},
108 locale:{string},
109 locales:{
110 __any__: {any},
111 __type__: {object}
112 },
113 margin: {
114 axis: {number},
115 item: {
116 horizontal: {number,'undefined': 'undefined'},
117 vertical: {number,'undefined': 'undefined'},
118 __type__: {object,number}
119 },
120 __type__: {object,number}
121 },
122 max: {date, number, string, moment},
123 maxHeight: {number, string},
124 maxMinorChars: {number},
125 min: {date, number, string, moment},
126 minHeight: {number, string},
127 moveable: { 'boolean': bool},
128 multiselect: { 'boolean': bool},
129 multiselectPerGroup: { 'boolean': bool},
130 onAdd: {'function': 'function'},
131 onDropObjectOnItem: {'function': 'function'},
132 onUpdate: {'function': 'function'},
133 onMove: {'function': 'function'},
134 onMoving: {'function': 'function'},
135 onRemove: {'function': 'function'},
136 onAddGroup: {'function': 'function'},
137 onMoveGroup: {'function': 'function'},
138 onRemoveGroup: {'function': 'function'},
139 onInitialDrawComplete: {'function': 'function'},
140 order: {'function': 'function'},
141 orientation: {
142 axis: {string,'undefined': 'undefined'},
143 item: {string,'undefined': 'undefined'},
144 __type__: {string, object}
145 },
146 selectable: { 'boolean': bool},
147 showCurrentTime: { 'boolean': bool},
148 showMajorLabels: { 'boolean': bool},
149 showMinorLabels: { 'boolean': bool},
150 stack: { 'boolean': bool},
151 stackSubgroups: { 'boolean': bool},
152 snap: {'function': 'function', 'null': 'null'},
153 start: {date, number, string, moment},
154 template: {'function': 'function'},
155 loadingScreenTemplate: {'function': 'function'},
156 groupTemplate: {'function': 'function'},
157 visibleFrameTemplate: {string, 'function': 'function'},
158 showTooltips: { 'boolean': bool},
159 tooltip: {
160 followMouse: { 'boolean': bool },
161 overflowMethod: { 'string': ['cap', 'flip'] },
162 __type__: {object}
163 },
164 tooltipOnItemUpdateTime: {
165 template: {'function': 'function'},
166 __type__: { 'boolean': bool, object}
167 },
168 timeAxis: {
169 scale: {string,'undefined': 'undefined'},
170 step: {number,'undefined': 'undefined'},
171 __type__: {object}
172 },
173 type: {string},
174 width: {string, number},
175 zoomable: { 'boolean': bool},
176 zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
177 zoomMax: {number},
178 zoomMin: {number},
179
180 __type__: {object}
181};
182
183let configureOptions = {
184 global: {
185 align: ['center', 'left', 'right'],
186 alignCurrentTime: ['none', 'year', 'month', 'quarter', 'week', 'isoWeek', 'day', 'date', 'hour', 'minute', 'second'],
187 direction: false,
188 autoResize: true,
189 clickToUse: false,
190 // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
191 editable: {
192 add: false,
193 remove: false,
194 updateGroup: false,
195 updateTime: false
196 },
197 end: '',
198 format: {
199 minorLabels: {
200 millisecond:'SSS',
201 second: 's',
202 minute: 'HH:mm',
203 hour: 'HH:mm',
204 weekday: 'ddd D',
205 day: 'D',
206 week: 'w',
207 month: 'MMM',
208 quarter: '[Q]Q',
209 year: 'YYYY'
210 },
211 majorLabels: {
212 millisecond:'HH:mm:ss',
213 second: 'D MMMM HH:mm',
214 minute: 'ddd D MMMM',
215 hour: 'ddd D MMMM',
216 weekday: 'MMMM YYYY',
217 day: 'MMMM YYYY',
218 week: 'MMMM YYYY',
219 month: 'YYYY',
220 quarter: 'YYYY',
221 year: ''
222 }
223 },
224 groupHeightMode: ['auto', 'fixed'],
225 groupLabelDirection: ['horizontal', 'vertical'],
226 //groupOrder: {string, 'function': 'function'},
227 groupsDraggable: false,
228 height: '',
229 //hiddenDates: {object, array},
230 locale: '',
231 margin: {
232 axis: [20, 0, 100, 1],
233 item: {
234 horizontal: [10, 0, 100, 1],
235 vertical: [10, 0, 100, 1]
236 }
237 },
238 max: '',
239 maxHeight: '',
240 maxMinorChars: [7, 0, 20, 1],
241 min: '',
242 minHeight: '',
243 moveable: false,
244 multiselect: false,
245 multiselectPerGroup: false,
246 //onAdd: {'function': 'function'},
247 //onUpdate: {'function': 'function'},
248 //onMove: {'function': 'function'},
249 //onMoving: {'function': 'function'},
250 //onRename: {'function': 'function'},
251 //order: {'function': 'function'},
252 orientation: {
253 axis: ['both', 'bottom', 'top'],
254 item: ['bottom', 'top']
255 },
256 selectable: true,
257 showCurrentTime: false,
258 showMajorLabels: true,
259 showMinorLabels: true,
260 stack: true,
261 stackSubgroups: true,
262 //snap: {'function': 'function', nada},
263 start: '',
264 //template: {'function': 'function'},
265 //timeAxis: {
266 // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'quarter', 'year'],
267 // step: [1, 1, 10, 1]
268 //},
269 showTooltips: true,
270 tooltip: {
271 followMouse: false,
272 overflowMethod: 'flip'
273 },
274 tooltipOnItemUpdateTime: false,
275 type: ['box', 'point', 'range', 'background'],
276 width: '100%',
277 zoomable: true,
278 zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
279 zoomMax: [315360000000000, 10, 315360000000000, 1],
280 zoomMin: [10, 10, 315360000000000, 1]
281 }
282};
283
284export {allOptions, configureOptions};