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.

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