step.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/ // Check if module is in cache
  8. /******/ if(installedModules[moduleId])
  9. /******/ return installedModules[moduleId].exports;
  10. /******/ // Create a new module (and put it into the cache)
  11. /******/ var module = installedModules[moduleId] = {
  12. /******/ exports: {},
  13. /******/ id: moduleId,
  14. /******/ loaded: false
  15. /******/ };
  16. /******/ // Execute the module function
  17. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  18. /******/ // Flag the module as loaded
  19. /******/ module.loaded = true;
  20. /******/ // Return the exports of the module
  21. /******/ return module.exports;
  22. /******/ }
  23. /******/ // expose the modules object (__webpack_modules__)
  24. /******/ __webpack_require__.m = modules;
  25. /******/ // expose the module cache
  26. /******/ __webpack_require__.c = installedModules;
  27. /******/ // __webpack_public_path__
  28. /******/ __webpack_require__.p = "/dist/";
  29. /******/ // Load entry module and return exports
  30. /******/ return __webpack_require__(0);
  31. /******/ })
  32. /************************************************************************/
  33. /******/ ({
  34. /***/ 0:
  35. /***/ function(module, exports, __webpack_require__) {
  36. module.exports = __webpack_require__(281);
  37. /***/ },
  38. /***/ 3:
  39. /***/ function(module, exports) {
  40. module.exports = function normalizeComponent (
  41. rawScriptExports,
  42. compiledTemplate,
  43. scopeId,
  44. cssModules
  45. ) {
  46. var esModule
  47. var scriptExports = rawScriptExports = rawScriptExports || {}
  48. // ES6 modules interop
  49. var type = typeof rawScriptExports.default
  50. if (type === 'object' || type === 'function') {
  51. esModule = rawScriptExports
  52. scriptExports = rawScriptExports.default
  53. }
  54. // Vue.extend constructor export interop
  55. var options = typeof scriptExports === 'function'
  56. ? scriptExports.options
  57. : scriptExports
  58. // render functions
  59. if (compiledTemplate) {
  60. options.render = compiledTemplate.render
  61. options.staticRenderFns = compiledTemplate.staticRenderFns
  62. }
  63. // scopedId
  64. if (scopeId) {
  65. options._scopeId = scopeId
  66. }
  67. // inject cssModules
  68. if (cssModules) {
  69. var computed = options.computed || (options.computed = {})
  70. Object.keys(cssModules).forEach(function (key) {
  71. var module = cssModules[key]
  72. computed[key] = function () { return module }
  73. })
  74. }
  75. return {
  76. esModule: esModule,
  77. exports: scriptExports,
  78. options: options
  79. }
  80. }
  81. /***/ },
  82. /***/ 281:
  83. /***/ function(module, exports, __webpack_require__) {
  84. 'use strict';
  85. exports.__esModule = true;
  86. var _step = __webpack_require__(282);
  87. var _step2 = _interopRequireDefault(_step);
  88. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  89. /* istanbul ignore next */
  90. _step2.default.install = function (Vue) {
  91. Vue.component(_step2.default.name, _step2.default);
  92. };
  93. exports.default = _step2.default;
  94. /***/ },
  95. /***/ 282:
  96. /***/ function(module, exports, __webpack_require__) {
  97. var Component = __webpack_require__(3)(
  98. /* script */
  99. __webpack_require__(283),
  100. /* template */
  101. __webpack_require__(284),
  102. /* scopeId */
  103. null,
  104. /* cssModules */
  105. null
  106. )
  107. module.exports = Component.exports
  108. /***/ },
  109. /***/ 283:
  110. /***/ function(module, exports) {
  111. 'use strict';
  112. exports.__esModule = true;
  113. //
  114. //
  115. //
  116. //
  117. //
  118. //
  119. //
  120. //
  121. //
  122. //
  123. //
  124. //
  125. //
  126. //
  127. //
  128. //
  129. //
  130. //
  131. //
  132. //
  133. //
  134. //
  135. //
  136. //
  137. //
  138. //
  139. //
  140. //
  141. //
  142. //
  143. //
  144. //
  145. //
  146. //
  147. //
  148. //
  149. //
  150. //
  151. //
  152. //
  153. //
  154. //
  155. //
  156. //
  157. //
  158. //
  159. exports.default = {
  160. name: 'ElStep',
  161. props: {
  162. title: String,
  163. icon: String,
  164. description: String,
  165. status: String
  166. },
  167. data: function data() {
  168. return {
  169. index: -1,
  170. style: {},
  171. lineStyle: {},
  172. mainOffset: 0,
  173. isLast: false,
  174. internalStatus: ''
  175. };
  176. },
  177. beforeCreate: function beforeCreate() {
  178. this.$parent.steps.push(this);
  179. },
  180. computed: {
  181. currentStatus: function currentStatus() {
  182. return this.status || this.internalStatus;
  183. }
  184. },
  185. methods: {
  186. updateStatus: function updateStatus(val) {
  187. var prevChild = this.$parent.$children[this.index - 1];
  188. if (val > this.index) {
  189. this.internalStatus = this.$parent.finishStatus;
  190. } else if (val === this.index) {
  191. this.internalStatus = this.$parent.processStatus;
  192. } else {
  193. this.internalStatus = 'wait';
  194. }
  195. if (prevChild) prevChild.calcProgress(this.internalStatus);
  196. },
  197. calcProgress: function calcProgress(status) {
  198. var step = 100;
  199. var style = {};
  200. style.transitionDelay = 150 * this.index + 'ms';
  201. if (status === this.$parent.processStatus) {
  202. step = 50;
  203. } else if (status === 'wait') {
  204. step = 0;
  205. style.transitionDelay = -150 * this.index + 'ms';
  206. }
  207. style.borderWidth = step ? '1px' : 0;
  208. this.$parent.direction === 'vertical' ? style.height = step + '%' : style.width = step + '%';
  209. this.lineStyle = style;
  210. },
  211. adjustPosition: function adjustPosition() {
  212. this.style = {};
  213. this.$parent.stepOffset = this.$el.getBoundingClientRect().width / (this.$parent.steps.length - 1);
  214. }
  215. },
  216. mounted: function mounted() {
  217. var _this = this;
  218. var parent = this.$parent;
  219. var isCenter = parent.center;
  220. var len = parent.steps.length;
  221. var isLast = this.isLast = parent.steps[parent.steps.length - 1] === this;
  222. var space = typeof parent.space === 'number' ? parent.space + 'px' : parent.space ? parent.space : 100 / (isCenter ? len - 1 : len) + '%';
  223. if (parent.direction === 'horizontal') {
  224. this.style = { width: space };
  225. if (parent.alignCenter) {
  226. this.mainOffset = -this.$refs.title.getBoundingClientRect().width / 2 + 16 + 'px';
  227. }
  228. isCenter && isLast && this.adjustPosition();
  229. } else {
  230. if (!isLast) {
  231. this.style = { height: space };
  232. }
  233. }
  234. var unwatch = this.$watch('index', function (val) {
  235. _this.$watch('$parent.active', _this.updateStatus, { immediate: true });
  236. unwatch();
  237. });
  238. }
  239. };
  240. /***/ },
  241. /***/ 284:
  242. /***/ function(module, exports) {
  243. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  244. return _c('div', {
  245. staticClass: "el-step",
  246. class: ['is-' + _vm.$parent.direction],
  247. style: ([_vm.style, _vm.isLast ? '' : {
  248. marginRight: -_vm.$parent.stepOffset + 'px'
  249. }])
  250. }, [_c('div', {
  251. staticClass: "el-step__head",
  252. class: ['is-' + _vm.currentStatus, {
  253. 'is-text': !_vm.icon
  254. }]
  255. }, [_c('div', {
  256. staticClass: "el-step__line",
  257. class: ['is-' + _vm.$parent.direction, {
  258. 'is-icon': _vm.icon
  259. }],
  260. style: (_vm.isLast ? '' : {
  261. marginRight: _vm.$parent.stepOffset + 'px'
  262. })
  263. }, [_c('i', {
  264. staticClass: "el-step__line-inner",
  265. style: (_vm.lineStyle)
  266. })]), _c('span', {
  267. staticClass: "el-step__icon"
  268. }, [(_vm.currentStatus !== 'success' && _vm.currentStatus !== 'error') ? _vm._t("icon", [(_vm.icon) ? _c('i', {
  269. class: ['el-icon-' + _vm.icon]
  270. }) : _c('div', [_vm._v(_vm._s(_vm.index + 1))])]) : _c('i', {
  271. class: ['el-icon-' + (_vm.currentStatus === 'success' ? 'check' : 'close')]
  272. })], 2)]), _c('div', {
  273. staticClass: "el-step__main",
  274. style: ({
  275. marginLeft: _vm.mainOffset
  276. })
  277. }, [_c('div', {
  278. ref: "title",
  279. staticClass: "el-step__title",
  280. class: ['is-' + _vm.currentStatus]
  281. }, [_vm._t("title", [_vm._v(_vm._s(_vm.title))])], 2), _c('div', {
  282. staticClass: "el-step__description",
  283. class: ['is-' + _vm.currentStatus]
  284. }, [_vm._t("description", [_vm._v(_vm._s(_vm.description))])], 2)])])
  285. },staticRenderFns: []}
  286. /***/ }
  287. /******/ });