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.

232 lines
6.7 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. timeAxis: {
  128. scale: {string,'undefined': 'undefined'},
  129. step: {number,'undefined': 'undefined'},
  130. __type__: {object}
  131. },
  132. type: {string},
  133. width: {string, number},
  134. zoomable: {boolean},
  135. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  136. zoomMax: {number},
  137. zoomMin: {number},
  138. __type__: {object}
  139. };
  140. let configureOptions = {
  141. global: {
  142. align: ['center', 'left', 'right'],
  143. direction: false,
  144. autoResize: true,
  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};