jquery.flowchart.min.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*! jQuery.flowchart.js v1.1.0 | jquery.flowchart.min.js | jQuery plugin for flowchart.js. | MIT License | By: Pandao | https://github.com/pandao/jquery.flowchart.js | 2015-03-09 */
  2. (function (factory) {
  3. if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
  4. module.exports = factory
  5. } else {
  6. if (typeof define === "function") {
  7. factory(jQuery, flowchart)
  8. } else {
  9. factory($, flowchart)
  10. }
  11. }
  12. }(function (jQuery, flowchart) {
  13. (function ($) {
  14. $.fn.flowChart = function (options) {
  15. options = options || {};
  16. var defaults = {
  17. 'x': 0,
  18. 'y': 0,
  19. 'line-width': 3,
  20. 'line-length': 50,
  21. 'text-margin': 10,
  22. 'font-size': 14,
  23. 'font-color': 'black',
  24. 'line-color': 'black',
  25. 'element-color': 'black',
  26. 'fill': 'white',
  27. 'yes-text': 'yes',
  28. 'no-text': 'no',
  29. 'arrow-end': 'block',
  30. 'scale': 1,
  31. // style symbol types
  32. 'symbols': {
  33. 'start': {
  34. 'font-color': 'red',
  35. 'element-color': 'green',
  36. 'fill': 'yellow'
  37. },
  38. 'end':{
  39. 'class': 'end-element'
  40. }
  41. },
  42. // even flowstate support ;-)
  43. 'flowstate' : {
  44. 'past' : { 'fill' : '#CCCCCC', 'font-size' : 12},
  45. 'current' : {'fill' : 'yellow', 'font-color' : 'red', 'font-weight' : 'bold'},
  46. 'future' : { 'fill' : '#FFFF99'},
  47. 'request' : { 'fill' : 'blue'},
  48. 'invalid': {'fill' : '#444444'},
  49. 'approved' : { 'fill' : '#58C4A3', 'font-size' : 12, 'yes-text' : 'APPROVED', 'no-text' : 'n/a' },
  50. 'rejected' : { 'fill' : '#C45879', 'font-size' : 12, 'yes-text' : 'n/a', 'no-text' : 'REJECTED' }
  51. }
  52. };
  53. return this.each(function () {
  54. var $this = $(this);
  55. var diagram = flowchart.parse($this.text());
  56. var settings = $.extend(true, defaults, options);
  57. $this.html("");
  58. diagram.drawSVG($this.get(0), settings)
  59. })
  60. }
  61. })(jQuery)
  62. }));