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.

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