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.

239 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 boolean = '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: {boolean},
  20. filter: {boolean,'function': 'function'},
  21. container: {dom},
  22. __type__: {object,boolean,'function': 'function'}
  23. },
  24. //globals :
  25. align: {string},
  26. rtl: {boolean, 'undefined': 'undefined'},
  27. rollingMode: {boolean, 'undefined': 'undefined'},
  28. verticalScroll: {boolean, 'undefined': 'undefined'},
  29. horizontalScroll: {boolean, 'undefined': 'undefined'},
  30. autoResize: {boolean},
  31. clickToUse: {boolean},
  32. dataAttributes: {string, array},
  33. editable: {
  34. add: {boolean, 'undefined': 'undefined'},
  35. remove: {boolean, 'undefined': 'undefined'},
  36. updateGroup: {boolean, 'undefined': 'undefined'},
  37. updateTime: {boolean, 'undefined': 'undefined'},
  38. overrideItems: {boolean, 'undefined': 'undefined'},
  39. __type__: {boolean, 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: {boolean, 'undefined': 'undefined'},
  71. remove: {boolean, 'undefined': 'undefined'},
  72. order: {boolean, 'undefined': 'undefined'},
  73. __type__: {boolean, 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: { boolean: boolean },
  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: {boolean},
  104. multiselect: {boolean},
  105. multiselectPerGroup: {boolean},
  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: {boolean},
  121. showCurrentTime: {boolean},
  122. showMajorLabels: {boolean},
  123. showMinorLabels: {boolean},
  124. stack: {boolean},
  125. snap: {'function': 'function', 'null': 'null'},
  126. start: {date, number, string, moment},
  127. template: {'function': 'function'},
  128. groupTemplate: {'function': 'function'},
  129. tooltipOnItemUpdateTime: {
  130. template: {'function': 'function'},
  131. __type__: {boolean, object}
  132. },
  133. timeAxis: {
  134. scale: {string,'undefined': 'undefined'},
  135. step: {number,'undefined': 'undefined'},
  136. __type__: {object}
  137. },
  138. type: {string},
  139. width: {string, number},
  140. zoomable: {boolean},
  141. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  142. zoomMax: {number},
  143. zoomMin: {number},
  144. __type__: {object}
  145. };
  146. let configureOptions = {
  147. global: {
  148. align: ['center', 'left', 'right'],
  149. direction: false,
  150. autoResize: true,
  151. clickToUse: false,
  152. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  153. editable: {
  154. add: false,
  155. remove: false,
  156. updateGroup: false,
  157. updateTime: false
  158. },
  159. end: '',
  160. format: {
  161. minorLabels: {
  162. millisecond:'SSS',
  163. second: 's',
  164. minute: 'HH:mm',
  165. hour: 'HH:mm',
  166. weekday: 'ddd D',
  167. day: 'D',
  168. month: 'MMM',
  169. year: 'YYYY'
  170. },
  171. majorLabels: {
  172. millisecond:'HH:mm:ss',
  173. second: 'D MMMM HH:mm',
  174. minute: 'ddd D MMMM',
  175. hour: 'ddd D MMMM',
  176. weekday: 'MMMM YYYY',
  177. day: 'MMMM YYYY',
  178. month: 'YYYY',
  179. year: ''
  180. }
  181. },
  182. //groupOrder: {string, 'function': 'function'},
  183. groupsDraggable: false,
  184. height: '',
  185. //hiddenDates: {object, array},
  186. locale: '',
  187. margin: {
  188. axis: [20, 0, 100, 1],
  189. item: {
  190. horizontal: [10, 0, 100, 1],
  191. vertical: [10, 0, 100, 1]
  192. }
  193. },
  194. max: '',
  195. maxHeight: '',
  196. maxMinorChars: [7, 0, 20, 1],
  197. min: '',
  198. minHeight: '',
  199. moveable: false,
  200. multiselect: false,
  201. multiselectPerGroup: false,
  202. //onAdd: {'function': 'function'},
  203. //onUpdate: {'function': 'function'},
  204. //onMove: {'function': 'function'},
  205. //onMoving: {'function': 'function'},
  206. //onRename: {'function': 'function'},
  207. //order: {'function': 'function'},
  208. orientation: {
  209. axis: ['both', 'bottom', 'top'],
  210. item: ['bottom', 'top']
  211. },
  212. selectable: true,
  213. showCurrentTime: false,
  214. showMajorLabels: true,
  215. showMinorLabels: true,
  216. stack: true,
  217. //snap: {'function': 'function', nada},
  218. start: '',
  219. //template: {'function': 'function'},
  220. //timeAxis: {
  221. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  222. // step: [1, 1, 10, 1]
  223. //},
  224. tooltipOnItemUpdateTime: false,
  225. type: ['box', 'point', 'range', 'background'],
  226. width: '100%',
  227. zoomable: true,
  228. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  229. zoomMax: [315360000000000, 10, 315360000000000, 1],
  230. zoomMin: [10, 10, 315360000000000, 1]
  231. }
  232. };
  233. export {allOptions, configureOptions};