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.

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