UNPKG

17.5 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("./icon"));
4 else if(typeof define === 'function' && define.amd)
5 define(["./icon"], factory);
6 else {
7 var a = typeof exports === 'object' ? factory(require("./icon")) : factory(root["./icon"]);
8 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9 }
10})(window, function(__WEBPACK_EXTERNAL_MODULE__8__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ }
51/******/ };
52/******/
53/******/ // define __esModule on exports
54/******/ __webpack_require__.r = function(exports) {
55/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ }
58/******/ Object.defineProperty(exports, '__esModule', { value: true });
59/******/ };
60/******/
61/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
66/******/ __webpack_require__.t = function(value, mode) {
67/******/ if(mode & 1) value = __webpack_require__(value);
68/******/ if(mode & 8) return value;
69/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ var ns = Object.create(null);
71/******/ __webpack_require__.r(ns);
72/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ return ns;
75/******/ };
76/******/
77/******/ // getDefaultExport function for compatibility with non-harmony modules
78/******/ __webpack_require__.n = function(module) {
79/******/ var getter = module && module.__esModule ?
80/******/ function getDefault() { return module['default']; } :
81/******/ function getModuleExports() { return module; };
82/******/ __webpack_require__.d(getter, 'a', getter);
83/******/ return getter;
84/******/ };
85/******/
86/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "/dist/";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = 134);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ 134:
100/***/ (function(module, __webpack_exports__, __webpack_require__) {
101
102"use strict";
103// ESM COMPAT FLAG
104__webpack_require__.r(__webpack_exports__);
105
106// EXTERNAL MODULE: ./components/style/index.less
107var style = __webpack_require__(139);
108
109// EXTERNAL MODULE: ./components/steps/style/index.less
110var steps_style = __webpack_require__(218);
111
112// CONCATENATED MODULE: ./components/steps/style/index.js
113
114
115// EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
116var defineProperty_ = __webpack_require__(3);
117var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
118
119// CONCATENATED MODULE: ./components/steps/steps.js
120
121/* harmony default export */ var steps = ({
122 name: 'MdsSteps',
123 props: {
124 prefixCls: {
125 type: String,
126 default: 'mds-steps'
127 },
128 current: {
129 type: Number,
130 default: 0
131 },
132 direction: {
133 type: String,
134 default: 'horizontal',
135 validator: function validator(value) {
136 return ['horizontal', 'vertical'].indexOf(value) !== -1;
137 }
138 },
139 iconPrefix: {
140 type: String,
141 default: 'mds'
142 },
143 progressDot: {
144 type: Boolean,
145 default: false
146 },
147 space: {
148 type: [String, Number],
149 default: ''
150 },
151 spaceMargin: {
152 type: Number,
153 default: 8
154 },
155 size: {
156 type: String,
157 default: 'default'
158 },
159 status: {
160 type: String,
161 default: 'process'
162 },
163 simple: Boolean
164 },
165 data: function data() {
166 return {
167 lastStepOffsetWidth: 0
168 };
169 },
170
171 methods: {
172 calcStepOffsetWidth: function calcStepOffsetWidth(dom) {
173 var lastStepOffsetWidth = (dom.lastChild.offsetWidth || 0) + 1;
174 this.lastStepOffsetWidth = lastStepOffsetWidth;
175 },
176 updateChildern: function updateChildern() {
177 // const lastIndex = this.$children.length - 1
178 this.$children.forEach(function (component, index) {
179 // const itemWidth = (this.direction === 'vertical' || index === lastIndex) ? '' : `${100 / lastIndex}%`
180 // const adjustMarginRight = (this.direction === 'vertical' || index === lastIndex) ? 0 : -Math.round(this.lastStepOffsetWidth / lastIndex + 1)
181 // component.itemWidth = itemWidth
182 // component.adjustMarginRight = adjustMarginRight
183 // component.stepNumber = index + 1
184
185 // if (this.status === 'error' && index === this.current - 1) {
186 // component.isNextError = true
187 // } else {
188 // component.isNextError = false
189 // }
190
191 // if (index === this.current) {
192 // component.defaultstatus = this.status
193 // } else if (index < this.current) {
194 // component.defaultstatus = 'finish'
195 // } else {
196 // component.defaultstatus = 'wait'
197 // }
198 });
199 }
200 },
201 computed: {
202 classes: function classes() {
203 var prefixCls = this.prefixCls;
204 if (this.simple) {
205 return [prefixCls, prefixCls + '--simple', defineProperty_default()({}, prefixCls + '-' + this.size, !!this.size)];
206 } else {
207 var _ref2;
208
209 var adjustedlabelPlacement = this.progressDot ? 'vertical' : 'horizontal';
210 return [prefixCls, prefixCls + '-' + this.direction, (_ref2 = {}, defineProperty_default()(_ref2, prefixCls + '-' + this.size, !!this.size), defineProperty_default()(_ref2, prefixCls + '-dot', this.progressDot), defineProperty_default()(_ref2, prefixCls + '-label-' + adjustedlabelPlacement, this.direction === 'horizontal'), _ref2)];
211 }
212 }
213 },
214 render: function render(h) {
215 return h(
216 'div',
217 { 'class': this.classes, key: this.current },
218 [this.$slots.default]
219 );
220 }
221});
222
223// step.map((vnode, index) => {
224// const props = vnode.componentOptions.propsData
225// const itemWidth = (this.direction === 'vertical' || index === lastIndex) ? '' : `${100 / lastIndex}%`
226// const adjustMarginRight = (this.direction === 'vertical' || index === lastIndex) ? 0 : -Math.round(this.lastStepOffsetWidth / lastIndex + 1)
227// props.stepNumber = index + 1
228// props.itemWidth = itemWidth
229// props.adjustMarginRight = adjustMarginRight
230// if (this.status === 'error' && index === this.current - 1) {
231// vnode.data.staticClass += `${this.prefixCls}-next-error`
232// }
233
234// if (!props.status) {
235// if (index === this.current) {
236// props.status = this.status
237// } else if (index < this.current) {
238// props.status = 'finish'
239// } else {
240// props.status = 'wait'
241// }
242// }
243
244// return vnode
245// })
246// EXTERNAL MODULE: external "./icon"
247var external_icon_ = __webpack_require__(8);
248var external_icon_default = /*#__PURE__*/__webpack_require__.n(external_icon_);
249
250// CONCATENATED MODULE: ./components/steps/step.js
251
252
253
254/* harmony default export */ var step = ({
255 name: 'MdsStep',
256 props: {
257 prefixCls: {
258 type: String,
259 default: 'mds-steps'
260 },
261 description: String,
262 title: String,
263 icon: String,
264 status: String
265 },
266 data: function data() {
267 return {
268 defaultstatus: '',
269 size: 'default',
270 stepNumber: undefined,
271 isNextError: false,
272 maxWidth: '',
273 paddingLeft: 0,
274 paddingRight: 0,
275 paddingTop: 0,
276 paddingBottom: 0,
277 flexBasis: ''
278 };
279 },
280
281 computed: {
282 classes: function classes() {
283 var prefixCls = this.prefixCls;
284 if (this.simple) {
285 var _ref;
286
287 return [prefixCls + '-simple', prefixCls + '-status-' + this.currentstatus, (_ref = {}, defineProperty_default()(_ref, prefixCls + '-custom', !!this.$slots.icon), defineProperty_default()(_ref, prefixCls + '-next-error', this.isNextError), _ref)];
288 } else {
289 var _ref2;
290
291 return [prefixCls + '-item', prefixCls + '-status-' + this.currentstatus, (_ref2 = {}, defineProperty_default()(_ref2, prefixCls + '-custom', !!this.$slots.icon), defineProperty_default()(_ref2, prefixCls + '-next-error', this.isNextError), _ref2)];
292 }
293 },
294 style: function style() {
295 return {
296 flexBasis: this.flexBasis,
297 maxWidth: this.maxWidth
298 };
299 },
300 tailStyle: function tailStyle() {
301 return {
302 paddingLeft: this.paddingLeft,
303 paddingRight: this.paddingRight,
304 paddingTop: this.paddingTop,
305 paddingBottom: this.paddingBottom
306 };
307 },
308 iconClasses: function iconClasses() {
309 var _ref3;
310
311 var prefixCls = this.prefixCls;
312 var iconPrefix = this.iconPrefix;
313 return [prefixCls + '-icon', iconPrefix + 'icon', (_ref3 = {}, defineProperty_default()(_ref3, iconPrefix + 'icon-' + this.icon, this.icon), defineProperty_default()(_ref3, iconPrefix + 'icon-line-check', !this.icon && this.currentstatus === 'finish'), defineProperty_default()(_ref3, iconPrefix + 'icon-cross', !this.icon && this.currentstatus === 'error'), _ref3)];
314 },
315 progressDot: function progressDot() {
316 return this.$parent.progressDot;
317 },
318 iconPrefix: function iconPrefix() {
319 return this.$parent.iconPrefix;
320 },
321 parentstatus: function parentstatus() {
322 return this.$parent.status;
323 },
324 currentstatus: function currentstatus() {
325 return this.status || this.defaultstatus;
326 },
327 simple: function simple() {
328 return this.$parent.simple;
329 }
330 },
331 components: {
332 MdsIcon: external_icon_default.a
333 },
334 beforeUpdate: function beforeUpdate() {
335 this.calcItemWidth();
336 },
337 mounted: function mounted() {
338 this.calcItemWidth();
339 },
340
341 methods: {
342 calcItemWidth: function calcItemWidth() {
343 var parentNode = this.$el.parentNode;
344 var brotherChildNodes = parentNode.childNodes;
345 var validChildNodes = Array.prototype.slice.call(brotherChildNodes).filter(function (node) {
346 return node.nodeType === 1;
347 });
348 var lastIndex = validChildNodes.length - 1;
349 var isLastChild = validChildNodes[lastIndex] === this.$el;
350 var direction = this.$parent.direction;
351 var index = validChildNodes.indexOf(this.$el);
352 var space = this.$parent.space;
353 var size = this.$parent.size === 'default' ? 32 : 24;
354 var spaceMargin = this.$parent.spaceMargin;
355 this.size = size;
356 this.stepNumber = index + 1;
357 if (isLastChild) {
358 if (direction === 'horizontal') {
359 this.maxWidth = 100 / validChildNodes.length + '%';
360 }
361 } else {
362 this.flexBasis = space ? space[space.length - 1] === '%' ? space : parseFloat(space) + 'px' : 100 / lastIndex + '%';
363 }
364 if (direction === 'vertical') {
365 this.paddingTop = spaceMargin + size + 'px';
366 this.paddingBottom = spaceMargin + 'px';
367 } else {
368 this.paddingLeft = spaceMargin + size + 'px';
369 this.paddingRight = spaceMargin + 'px';
370 }
371 this.isNextError = this.parentstatus === 'error' && index === this.$parent.current - 1;
372 this.defaultstatus = index === this.$parent.current ? this.parentstatus : index < this.$parent.current ? 'finish' : 'wait';
373 }
374 },
375 render: function render(h) {
376 var _this = this;
377
378 var prefixCls = this.prefixCls;
379 if (this.simple) {
380 var renderIcon = function renderIcon() {
381 var iconDot = h('span', { 'class': prefixCls + '-icon-dot' });
382 if (_this.progressDot) {
383 return h(
384 'span',
385 { 'class': prefixCls + '-icon' },
386 [iconDot]
387 );
388 } else if (_this.$slots.icon) {
389 return h(
390 'span',
391 { 'class': prefixCls + '-icon' },
392 [_this.$slots.icon]
393 );
394 } else if (_this.icon || _this.currentstatus === 'finish' || _this.currentstatus === 'error') {
395 return h('span', { 'class': _this.iconClasses });
396 } else {
397 return h(
398 'span',
399 { 'class': prefixCls + '-icon' },
400 [_this.stepNumber]
401 );
402 }
403 };
404 return h(
405 'div',
406 { 'class': this.classes, style: this.style },
407 [h(
408 'div',
409 { 'class': prefixCls + '-tail', style: this.tailStyle },
410 [h('mds-icon', {
411 attrs: { type: 'line-caret-right' }
412 })]
413 ), h(
414 'div',
415 { 'class': prefixCls + '-step' },
416 [h(
417 'div',
418 { 'class': prefixCls + '-head' },
419 [h(
420 'div',
421 { 'class': prefixCls + '-head-inner' },
422 [renderIcon()]
423 )]
424 ), h(
425 'div',
426 { 'class': prefixCls + '-main' },
427 [h(
428 'div',
429 { 'class': prefixCls + '-title' },
430 [h('div', [this.$slots.title || this.title]), h(
431 'div',
432 { 'class': prefixCls + '--simple-icon' },
433 [h('mds-icon', {
434 attrs: { type: 'line-caret-right' }
435 })]
436 )]
437 )]
438 )]
439 )]
440 );
441 } else {
442 var _renderIcon = function _renderIcon() {
443 var iconDot = h('span', { 'class': prefixCls + '-icon-dot' });
444 if (_this.progressDot) {
445 return h(
446 'span',
447 { 'class': prefixCls + '-icon' },
448 [iconDot]
449 );
450 } else if (_this.$slots.icon) {
451 return h(
452 'span',
453 { 'class': prefixCls + '-icon' },
454 [_this.$slots.icon]
455 );
456 } else if (_this.icon || _this.currentstatus === 'finish' || _this.currentstatus === 'error') {
457 return h('span', { 'class': _this.iconClasses });
458 } else {
459 return h(
460 'span',
461 { 'class': prefixCls + '-icon' },
462 [_this.stepNumber]
463 );
464 }
465 };
466 return h(
467 'div',
468 { 'class': this.classes, style: this.style },
469 [h(
470 'div',
471 { 'class': prefixCls + '-tail', style: this.tailStyle },
472 [h('i')]
473 ), h(
474 'div',
475 { 'class': prefixCls + '-step' },
476 [h(
477 'div',
478 { 'class': prefixCls + '-head' },
479 [h(
480 'div',
481 { 'class': prefixCls + '-head-inner' },
482 [_renderIcon()]
483 )]
484 ), h(
485 'div',
486 { 'class': prefixCls + '-main' },
487 [h(
488 'div',
489 { 'class': prefixCls + '-title' },
490 [this.$slots.title || this.title]
491 ), this.description ? h(
492 'div',
493 { 'class': prefixCls + '-description' },
494 [this.description]
495 ) : '']
496 )]
497 )]
498 );
499 }
500 }
501});
502// CONCATENATED MODULE: ./components/steps/index.js
503
504
505
506
507steps.Step = step;
508/* istanbul ignore next */
509steps.install = function (Vue) {
510 Vue.component(steps.name, steps);
511 Vue.component(step.name, step);
512};
513/* harmony default export */ var components_steps = __webpack_exports__["default"] = (steps);
514
515/***/ }),
516
517/***/ 139:
518/***/ (function(module, exports) {
519
520// removed by extract-text-webpack-plugin
521
522/***/ }),
523
524/***/ 218:
525/***/ (function(module, exports) {
526
527// removed by extract-text-webpack-plugin
528
529/***/ }),
530
531/***/ 3:
532/***/ (function(module, exports) {
533
534module.exports = require("babel-runtime/helpers/defineProperty");
535
536/***/ }),
537
538/***/ 8:
539/***/ (function(module, exports) {
540
541module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
542
543/***/ })
544
545/******/ });
546});
\No newline at end of file