peity.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/Plugin/peity", ["exports", "jquery", "Plugin", "Config"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("jquery"), require("Plugin"), require("Config"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.jQuery, global.Plugin, global.Config);
  11. global.PluginPeity = mod.exports;
  12. }
  13. })(this, function (_exports, _jquery, _Plugin5, _Config) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.PeityPie = _exports.PeityDonut = _exports.PeityLine = _exports.PeityBar = void 0;
  19. _jquery = babelHelpers.interopRequireDefault(_jquery);
  20. _Plugin5 = babelHelpers.interopRequireDefault(_Plugin5);
  21. var PeityBar =
  22. /*#__PURE__*/
  23. function (_Plugin) {
  24. babelHelpers.inherits(PeityBar, _Plugin);
  25. function PeityBar() {
  26. babelHelpers.classCallCheck(this, PeityBar);
  27. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PeityBar).apply(this, arguments));
  28. }
  29. babelHelpers.createClass(PeityBar, [{
  30. key: "getName",
  31. value: function getName() {
  32. return 'peityBar';
  33. }
  34. }, {
  35. key: "render",
  36. value: function render() {
  37. if (!_jquery.default.fn.peity) {
  38. return;
  39. }
  40. var $el = this.$el;
  41. var options = this.options;
  42. if (options.skin) {
  43. var skinColors = (0, _Config.colors)(options.skin);
  44. if (skinColors) {
  45. options.fill = [skinColors[400]];
  46. }
  47. }
  48. $el.peity('bar', options);
  49. }
  50. }], [{
  51. key: "getDefaults",
  52. value: function getDefaults() {
  53. return {
  54. delimiter: ',',
  55. fill: [(0, _Config.colors)('primary', 400)],
  56. height: 22,
  57. max: null,
  58. min: 0,
  59. padding: 0.1,
  60. width: 44
  61. };
  62. }
  63. }]);
  64. return PeityBar;
  65. }(_Plugin5.default);
  66. _exports.PeityBar = PeityBar;
  67. _Plugin5.default.register('peityBar', PeityBar);
  68. var PeityDonut =
  69. /*#__PURE__*/
  70. function (_Plugin2) {
  71. babelHelpers.inherits(PeityDonut, _Plugin2);
  72. function PeityDonut() {
  73. babelHelpers.classCallCheck(this, PeityDonut);
  74. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PeityDonut).apply(this, arguments));
  75. }
  76. babelHelpers.createClass(PeityDonut, [{
  77. key: "getName",
  78. value: function getName() {
  79. return 'peityDonut';
  80. }
  81. }, {
  82. key: "render",
  83. value: function render() {
  84. if (!_jquery.default.fn.peity) {
  85. return;
  86. }
  87. var $el = this.$el;
  88. var options = this.options;
  89. if (options.skin) {
  90. var skinColors = (0, _Config.colors)(options.skin);
  91. if (skinColors) {
  92. options.fill = [skinColors[700], skinColors[400], skinColors[200]];
  93. }
  94. }
  95. $el.peity('donut', options);
  96. }
  97. }], [{
  98. key: "getDefaults",
  99. value: function getDefaults() {
  100. return {
  101. delimiter: null,
  102. fill: [(0, _Config.colors)('primary', 700), (0, _Config.colors)('primary', 400), (0, _Config.colors)('primary', 200)],
  103. height: null,
  104. innerRadius: null,
  105. radius: 11,
  106. width: null
  107. };
  108. }
  109. }]);
  110. return PeityDonut;
  111. }(_Plugin5.default);
  112. _exports.PeityDonut = PeityDonut;
  113. _Plugin5.default.register('peityDonut', PeityDonut);
  114. var PeityLine =
  115. /*#__PURE__*/
  116. function (_Plugin3) {
  117. babelHelpers.inherits(PeityLine, _Plugin3);
  118. function PeityLine() {
  119. babelHelpers.classCallCheck(this, PeityLine);
  120. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PeityLine).apply(this, arguments));
  121. }
  122. babelHelpers.createClass(PeityLine, [{
  123. key: "getName",
  124. value: function getName() {
  125. return 'peityLine';
  126. }
  127. }, {
  128. key: "render",
  129. value: function render() {
  130. if (!_jquery.default.fn.peity) {
  131. return;
  132. }
  133. var $el = this.$el;
  134. var options = this.options;
  135. if (options.skin) {
  136. var skinColors = (0, _Config.colors)(options.skin);
  137. if (skinColors) {
  138. options.fill = [skinColors[200]];
  139. options.stroke = skinColors[600];
  140. }
  141. }
  142. $el.peity('line', options);
  143. }
  144. }], [{
  145. key: "getDefaults",
  146. value: function getDefaults() {
  147. return {
  148. delimiter: ',',
  149. fill: [(0, _Config.colors)('primary', 200)],
  150. height: 22,
  151. max: null,
  152. min: 0,
  153. stroke: (0, _Config.colors)('primary', 600),
  154. strokeWidth: 1,
  155. width: 44
  156. };
  157. }
  158. }]);
  159. return PeityLine;
  160. }(_Plugin5.default);
  161. _exports.PeityLine = PeityLine;
  162. _Plugin5.default.register('peityLine', PeityLine);
  163. var PeityPie =
  164. /*#__PURE__*/
  165. function (_Plugin4) {
  166. babelHelpers.inherits(PeityPie, _Plugin4);
  167. function PeityPie() {
  168. babelHelpers.classCallCheck(this, PeityPie);
  169. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PeityPie).apply(this, arguments));
  170. }
  171. babelHelpers.createClass(PeityPie, [{
  172. key: "getName",
  173. value: function getName() {
  174. return 'peityPie';
  175. }
  176. }, {
  177. key: "render",
  178. value: function render() {
  179. if (!_jquery.default.fn.peity) {
  180. return;
  181. }
  182. var $el = this.$el;
  183. var options = this.options;
  184. if (options.skin) {
  185. var skinColors = (0, _Config.colors)(options.skin);
  186. if (skinColors) {
  187. options.fill = [skinColors[700], skinColors[400], skinColors[200]];
  188. }
  189. }
  190. $el.peity('pie', options);
  191. }
  192. }], [{
  193. key: "getDefaults",
  194. value: function getDefaults() {
  195. return {
  196. delimiter: null,
  197. fill: [(0, _Config.colors)('primary', 700), (0, _Config.colors)('primary', 400), (0, _Config.colors)('primary', 200)],
  198. height: null,
  199. radius: 11,
  200. width: null
  201. };
  202. }
  203. }]);
  204. return PeityPie;
  205. }(_Plugin5.default);
  206. _exports.PeityPie = PeityPie;
  207. _Plugin5.default.register('peityPie', PeityPie);
  208. });