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.

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