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.

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