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. horizontalScroll: {boolean, 'undefined': 'undefined'},
  28. autoResize: {boolean},
  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, 'function': 'function'}
  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, 'function': 'function'}
  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. clickToUse: false,
  145. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  146. editable: {
  147. add: false,
  148. remove: false,
  149. updateGroup: false,
  150. updateTime: false
  151. },
  152. end: '',
  153. format: {
  154. minorLabels: {
  155. millisecond:'SSS',
  156. second: 's',
  157. minute: 'HH:mm',
  158. hour: 'HH:mm',
  159. weekday: 'ddd D',
  160. day: 'D',
  161. month: 'MMM',
  162. year: 'YYYY'
  163. },
  164. majorLabels: {
  165. millisecond:'HH:mm:ss',
  166. second: 'D MMMM HH:mm',
  167. minute: 'ddd D MMMM',
  168. hour: 'ddd D MMMM',
  169. weekday: 'MMMM YYYY',
  170. day: 'MMMM YYYY',
  171. month: 'YYYY',
  172. year: ''
  173. }
  174. },
  175. //groupOrder: {string, 'function': 'function'},
  176. groupsDraggable: false,
  177. height: '',
  178. //hiddenDates: {object, array},
  179. locale: '',
  180. margin: {
  181. axis: [20, 0, 100, 1],
  182. item: {
  183. horizontal: [10, 0, 100, 1],
  184. vertical: [10, 0, 100, 1]
  185. }
  186. },
  187. max: '',
  188. maxHeight: '',
  189. maxMinorChars: [7, 0, 20, 1],
  190. min: '',
  191. minHeight: '',
  192. moveable: false,
  193. multiselect: false,
  194. multiselectPerGroup: false,
  195. //onAdd: {'function': 'function'},
  196. //onUpdate: {'function': 'function'},
  197. //onMove: {'function': 'function'},
  198. //onMoving: {'function': 'function'},
  199. //onRename: {'function': 'function'},
  200. //order: {'function': 'function'},
  201. orientation: {
  202. axis: ['both', 'bottom', 'top'],
  203. item: ['bottom', 'top']
  204. },
  205. selectable: true,
  206. showCurrentTime: false,
  207. showMajorLabels: true,
  208. showMinorLabels: true,
  209. stack: true,
  210. //snap: {'function': 'function', nada},
  211. start: '',
  212. //template: {'function': 'function'},
  213. //timeAxis: {
  214. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  215. // step: [1, 1, 10, 1]
  216. //},
  217. type: ['box', 'point', 'range', 'background'],
  218. width: '100%',
  219. zoomable: true,
  220. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  221. zoomMax: [315360000000000, 10, 315360000000000, 1],
  222. zoomMin: [10, 10, 315360000000000, 1]
  223. }
  224. };
  225. export {allOptions, configureOptions};