optionsTimeline.js 8.1 KB

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