vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
6.9 KiB

  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. */
  8. let string = 'string';
  9. let bool = 'boolean';
  10. let number = 'number';
  11. let array = 'array';
  12. let date = 'date';
  13. let object = 'object'; // should only be in a __type__ property
  14. let dom = 'dom';
  15. let moment = 'moment';
  16. let any = 'any';
  17. let allOptions = {
  18. configure: {
  19. enabled: {bool},
  20. filter: {bool,'function': 'function'},
  21. container: {dom},
  22. __type__: {object,bool,'function': 'function'}
  23. },
  24. //globals :
  25. align: {string},
  26. rtl: {bool, 'undefined': 'undefined'},
  27. rollingMode: {bool, 'undefined': 'undefined'},
  28. verticalScroll: {bool, 'undefined': 'undefined'},
  29. horizontalScroll: {bool, 'undefined': 'undefined'},
  30. autoResize: {bool},
  31. clickToUse: {bool},
  32. dataAttributes: {string, array},
  33. editable: {
  34. add: {bool, 'undefined': 'undefined'},
  35. remove: {bool, 'undefined': 'undefined'},
  36. updateGroup: {bool, 'undefined': 'undefined'},
  37. updateTime: {bool, 'undefined': 'undefined'},
  38. overrideItems: {bool, 'undefined': 'undefined'},
  39. __type__: {bool, object}
  40. },
  41. end: {number, date, string, moment},
  42. format: {
  43. minorLabels: {
  44. millisecond: {string,'undefined': 'undefined'},
  45. second: {string,'undefined': 'undefined'},
  46. minute: {string,'undefined': 'undefined'},
  47. hour: {string,'undefined': 'undefined'},
  48. weekday: {string,'undefined': 'undefined'},
  49. day: {string,'undefined': 'undefined'},
  50. month: {string,'undefined': 'undefined'},
  51. year: {string,'undefined': 'undefined'},
  52. __type__: {object, 'function': 'function'}
  53. },
  54. majorLabels: {
  55. millisecond: {string,'undefined': 'undefined'},
  56. second: {string,'undefined': 'undefined'},
  57. minute: {string,'undefined': 'undefined'},
  58. hour: {string,'undefined': 'undefined'},
  59. weekday: {string,'undefined': 'undefined'},
  60. day: {string,'undefined': 'undefined'},
  61. month: {string,'undefined': 'undefined'},
  62. year: {string,'undefined': 'undefined'},
  63. __type__: {object, 'function': 'function'}
  64. },
  65. __type__: {object}
  66. },
  67. moment: {'function': 'function'},
  68. groupOrder: {string, 'function': 'function'},
  69. groupEditable: {
  70. add: {bool, 'undefined': 'undefined'},
  71. remove: {bool, 'undefined': 'undefined'},
  72. order: {bool, 'undefined': 'undefined'},
  73. __type__: {bool, object}
  74. },
  75. groupOrderSwap: {'function': 'function'},
  76. height: {string, number},
  77. hiddenDates: {
  78. start: {date, number, string, moment},
  79. end: {date, number, string, moment},
  80. repeat: {string},
  81. __type__: {object, array}
  82. },
  83. itemsAlwaysDraggable: {bool},
  84. locale:{string},
  85. locales:{
  86. __any__: {any},
  87. __type__: {object}
  88. },
  89. margin: {
  90. axis: {number},
  91. item: {
  92. horizontal: {number,'undefined': 'undefined'},
  93. vertical: {number,'undefined': 'undefined'},
  94. __type__: {object,number}
  95. },
  96. __type__: {object,number}
  97. },
  98. max: {date, number, string, moment},
  99. maxHeight: {number, string},
  100. maxMinorChars: {number},
  101. min: {date, number, string, moment},
  102. minHeight: {number, string},
  103. moveable: {bool},
  104. multiselect: {bool},
  105. multiselectPerGroup: {bool},
  106. onAdd: {'function': 'function'},
  107. onUpdate: {'function': 'function'},
  108. onMove: {'function': 'function'},
  109. onMoving: {'function': 'function'},
  110. onRemove: {'function': 'function'},
  111. onAddGroup: {'function': 'function'},
  112. onMoveGroup: {'function': 'function'},
  113. onRemoveGroup: {'function': 'function'},
  114. order: {'function': 'function'},
  115. orientation: {
  116. axis: {string,'undefined': 'undefined'},
  117. item: {string,'undefined': 'undefined'},
  118. __type__: {string, object}
  119. },
  120. selectable: {bool},
  121. showCurrentTime: {bool},
  122. showMajorLabels: {bool},
  123. showMinorLabels: {bool},
  124. stack: {bool},
  125. snap: {'function': 'function', 'null': 'null'},
  126. start: {date, number, string, moment},
  127. template: {'function': 'function'},
  128. groupTemplate: {'function': 'function'},
  129. visibleFrameTemplate: {string, 'function': 'function'},
  130. tooltipOnItemUpdateTime: {
  131. template: {'function': 'function'},
  132. __type__: {bool, object}
  133. },
  134. timeAxis: {
  135. scale: {string,'undefined': 'undefined'},
  136. step: {number,'undefined': 'undefined'},
  137. __type__: {object}
  138. },
  139. type: {string},
  140. width: {string, number},
  141. zoomable: {bool},
  142. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  143. zoomMax: {number},
  144. zoomMin: {number},
  145. __type__: {object}
  146. };
  147. let configureOptions = {
  148. global: {
  149. align: ['center', 'left', 'right'],
  150. direction: false,
  151. autoResize: true,
  152. clickToUse: false,
  153. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  154. editable: {
  155. add: false,
  156. remove: false,
  157. updateGroup: false,
  158. updateTime: false
  159. },
  160. end: '',
  161. format: {
  162. minorLabels: {
  163. millisecond:'SSS',
  164. second: 's',
  165. minute: 'HH:mm',
  166. hour: 'HH:mm',
  167. weekday: 'ddd D',
  168. day: 'D',
  169. month: 'MMM',
  170. year: 'YYYY'
  171. },
  172. majorLabels: {
  173. millisecond:'HH:mm:ss',
  174. second: 'D MMMM HH:mm',
  175. minute: 'ddd D MMMM',
  176. hour: 'ddd D MMMM',
  177. weekday: 'MMMM YYYY',
  178. day: 'MMMM YYYY',
  179. month: 'YYYY',
  180. year: ''
  181. }
  182. },
  183. //groupOrder: {string, 'function': 'function'},
  184. groupsDraggable: false,
  185. height: '',
  186. //hiddenDates: {object, array},
  187. locale: '',
  188. margin: {
  189. axis: [20, 0, 100, 1],
  190. item: {
  191. horizontal: [10, 0, 100, 1],
  192. vertical: [10, 0, 100, 1]
  193. }
  194. },
  195. max: '',
  196. maxHeight: '',
  197. maxMinorChars: [7, 0, 20, 1],
  198. min: '',
  199. minHeight: '',
  200. moveable: false,
  201. multiselect: false,
  202. multiselectPerGroup: false,
  203. //onAdd: {'function': 'function'},
  204. //onUpdate: {'function': 'function'},
  205. //onMove: {'function': 'function'},
  206. //onMoving: {'function': 'function'},
  207. //onRename: {'function': 'function'},
  208. //order: {'function': 'function'},
  209. orientation: {
  210. axis: ['both', 'bottom', 'top'],
  211. item: ['bottom', 'top']
  212. },
  213. selectable: true,
  214. showCurrentTime: false,
  215. showMajorLabels: true,
  216. showMinorLabels: true,
  217. stack: true,
  218. //snap: {'function': 'function', nada},
  219. start: '',
  220. //template: {'function': 'function'},
  221. //timeAxis: {
  222. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  223. // step: [1, 1, 10, 1]
  224. //},
  225. tooltipOnItemUpdateTime: false,
  226. type: ['box', 'point', 'range', 'background'],
  227. width: '100%',
  228. zoomable: true,
  229. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  230. zoomMax: [315360000000000, 10, 315360000000000, 1],
  231. zoomMin: [10, 10, 315360000000000, 1]
  232. }
  233. };
  234. export {allOptions, configureOptions};