UNPKG

19.8 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("./_mixin/emitter"));
4 else if(typeof define === 'function' && define.amd)
5 define(["./_mixin/emitter"], factory);
6 else {
7 var a = typeof exports === 'object' ? factory(require("./_mixin/emitter")) : factory(root["./_mixin/emitter"]);
8 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9 }
10})(window, function(__WEBPACK_EXTERNAL_MODULE__12__) {
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 = 39);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ 0:
100/***/ (function(module, __webpack_exports__, __webpack_require__) {
101
102"use strict";
103/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
104/* globals __VUE_SSR_CONTEXT__ */
105
106// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
107// This module is a runtime utility for cleaner component module output and will
108// be included in the final webpack user bundle.
109
110function normalizeComponent (
111 scriptExports,
112 render,
113 staticRenderFns,
114 functionalTemplate,
115 injectStyles,
116 scopeId,
117 moduleIdentifier, /* server only */
118 shadowMode /* vue-cli only */
119) {
120 // Vue.extend constructor export interop
121 var options = typeof scriptExports === 'function'
122 ? scriptExports.options
123 : scriptExports
124
125 // render functions
126 if (render) {
127 options.render = render
128 options.staticRenderFns = staticRenderFns
129 options._compiled = true
130 }
131
132 // functional template
133 if (functionalTemplate) {
134 options.functional = true
135 }
136
137 // scopedId
138 if (scopeId) {
139 options._scopeId = 'data-v-' + scopeId
140 }
141
142 var hook
143 if (moduleIdentifier) { // server build
144 hook = function (context) {
145 // 2.3 injection
146 context =
147 context || // cached call
148 (this.$vnode && this.$vnode.ssrContext) || // stateful
149 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
150 // 2.2 with runInNewContext: true
151 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
152 context = __VUE_SSR_CONTEXT__
153 }
154 // inject component styles
155 if (injectStyles) {
156 injectStyles.call(this, context)
157 }
158 // register component module identifier for async chunk inferrence
159 if (context && context._registeredComponents) {
160 context._registeredComponents.add(moduleIdentifier)
161 }
162 }
163 // used by ssr in case component is cached and beforeCreate
164 // never gets called
165 options._ssrRegister = hook
166 } else if (injectStyles) {
167 hook = shadowMode
168 ? function () {
169 injectStyles.call(
170 this,
171 (options.functional ? this.parent : this).$root.$options.shadowRoot
172 )
173 }
174 : injectStyles
175 }
176
177 if (hook) {
178 if (options.functional) {
179 // for template-only hot-reload because in that case the render fn doesn't
180 // go through the normalizer
181 options._injectStyles = hook
182 // register for functional component in vue file
183 var originalRender = options.render
184 options.render = function renderWithStyleInjection (h, context) {
185 hook.call(context)
186 return originalRender(h, context)
187 }
188 } else {
189 // inject component registration as beforeCreate hook
190 var existing = options.beforeCreate
191 options.beforeCreate = existing
192 ? [].concat(existing, hook)
193 : [hook]
194 }
195 }
196
197 return {
198 exports: scriptExports,
199 options: options
200 }
201}
202
203
204/***/ }),
205
206/***/ 12:
207/***/ (function(module, exports) {
208
209module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
210
211/***/ }),
212
213/***/ 139:
214/***/ (function(module, exports) {
215
216// removed by extract-text-webpack-plugin
217
218/***/ }),
219
220/***/ 165:
221/***/ (function(module, exports) {
222
223// removed by extract-text-webpack-plugin
224
225/***/ }),
226
227/***/ 24:
228/***/ (function(module, exports) {
229
230module.exports = require("babel-runtime/helpers/toConsumableArray");
231
232/***/ }),
233
234/***/ 3:
235/***/ (function(module, exports) {
236
237module.exports = require("babel-runtime/helpers/defineProperty");
238
239/***/ }),
240
241/***/ 39:
242/***/ (function(module, __webpack_exports__, __webpack_require__) {
243
244"use strict";
245// ESM COMPAT FLAG
246__webpack_require__.r(__webpack_exports__);
247
248// EXPORTS
249__webpack_require__.d(__webpack_exports__, "MdsCheckbox", function() { return /* reexport */ checkbox_checkbox; });
250__webpack_require__.d(__webpack_exports__, "MdsCheckboxGroup", function() { return /* reexport */ checkbox_group; });
251
252// EXTERNAL MODULE: ./components/style/index.less
253var style = __webpack_require__(139);
254
255// EXTERNAL MODULE: ./components/checkbox/style/index.less
256var checkbox_style = __webpack_require__(165);
257
258// CONCATENATED MODULE: ./components/checkbox/style/index.js
259
260
261// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/checkbox/checkbox.vue?vue&type=template&id=0689a564&
262var render = function () {
263 var _vm = this
264 var _h = _vm.$createElement
265 var _c = _vm._self._c || _h
266 return _c(
267 "label",
268 { class: _vm.disabledClasses, on: { click: _vm.handleClick } },
269 [
270 _c("span", { class: _vm.classes }, [
271 _c("input", {
272 class: _vm.prefixCls + "-input",
273 attrs: { type: "checkbox" },
274 }),
275 _c("span", { class: _vm.prefixCls + "-inner" }),
276 ]),
277 _vm.$slots.default !== undefined
278 ? _c("span", [_vm._t("default")], 2)
279 : _vm._e(),
280 ]
281 )
282}
283var staticRenderFns = []
284render._withStripped = true
285
286
287// CONCATENATED MODULE: ./components/checkbox/checkbox.vue?vue&type=template&id=0689a564&
288
289// EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
290var defineProperty_ = __webpack_require__(3);
291var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
292
293// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/checkbox/checkbox.vue?vue&type=script&lang=js&
294
295//
296//
297//
298//
299//
300//
301//
302//
303//
304//
305//
306//
307
308/* harmony default export */ var checkboxvue_type_script_lang_js_ = ({
309 name: 'MdsCheckbox',
310 props: {
311 checked: {
312 type: Boolean,
313 default: false
314 },
315 value: {
316 default: ''
317 },
318 modelVal: {
319 default: ''
320 },
321 label: {
322 type: String,
323 default: ''
324 },
325 disabled: {
326 type: Boolean,
327 default: false
328 },
329 indeterminate: {
330 type: Boolean,
331 default: false
332 },
333 prefixCls: {
334 type: String,
335 default: 'mds-checkbox'
336 },
337 isTransfer: {
338 type: Boolean,
339 default: false
340 }
341 },
342 model: {
343 prop: 'modelVal',
344 event: 'change'
345 },
346 data: function data() {
347 return {
348 _Group: null,
349 checkedValue: this.checked
350 };
351 },
352
353 computed: {
354 classes: function classes() {
355 var _ref;
356
357 var prefixCls = this.prefixCls;
358 return ['' + prefixCls, (_ref = {}, defineProperty_default()(_ref, prefixCls + '-checked', this.checkedValue && !this.indeterminate), defineProperty_default()(_ref, prefixCls + '-disabled', this.disabled), defineProperty_default()(_ref, prefixCls + '-indeterminate', this.indeterminate), _ref)];
359 },
360 disabledClasses: function disabledClasses() {
361 var prefixCls = this.prefixCls;
362 var isTransfer = this.isTransfer;
363
364 if (isTransfer) {
365 var _ref2;
366
367 return ['' + prefixCls, (_ref2 = {}, defineProperty_default()(_ref2, 'mds-transfer-disabled', this.disabled), defineProperty_default()(_ref2, 'mds-transfer-checked', this.checked), defineProperty_default()(_ref2, prefixCls + '-wrapper', true), _ref2)];
368 }
369 return ['' + prefixCls, defineProperty_default()({}, prefixCls + '-wrapper', true)];
370 },
371 isGroup: function isGroup() {
372 this.parent = this.$parent;
373 while (this.parent) {
374 if (this.parent.$options.name !== 'MdsCheckboxGroup') {
375 this.parent = this.parent.$parent;
376 } else {
377 this._Group = this.parent;
378 return true;
379 }
380 }
381 return false;
382 }
383 },
384 mounted: function mounted() {
385 // 初始化传递值
386 !this.isGroup && (this.checkedValue = this.modelVal === '' ? this.checkedValue : this.modelVal);
387 this.isGroup && (this.checkedValue = this._Group.value.includes(this.value));
388 this.isGroup && this._Group.addItems(this);
389 },
390 destroyed: function destroyed() {
391 this.isGroup && this._Group.removeItems(this);
392 },
393
394 watch: {
395 checked: function checked(val) {
396 this.checkedValue = val;
397 },
398 modelVal: function modelVal(val) {
399 this.checkedValue = val;
400 }
401 },
402 methods: {
403 handleClick: function handleClick(e) {
404 if (!this.disabled && e && e.target.tagName.toUpperCase() === 'INPUT') {
405 this.checkedValue = !this.checkedValue;
406 if (this._Group && !this._Group.isOptions) {
407 this._Group.slotCheck(this.value, this.checkedValue);
408 } else {
409 this.$emit('change', this.checkedValue, this.value);
410 }
411 }
412 }
413 }
414});
415// CONCATENATED MODULE: ./components/checkbox/checkbox.vue?vue&type=script&lang=js&
416 /* harmony default export */ var checkbox_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
417// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
418var componentNormalizer = __webpack_require__(0);
419
420// CONCATENATED MODULE: ./components/checkbox/checkbox.vue
421
422
423
424
425
426/* normalize component */
427
428var component = Object(componentNormalizer["a" /* default */])(
429 checkbox_checkboxvue_type_script_lang_js_,
430 render,
431 staticRenderFns,
432 false,
433 null,
434 null,
435 null
436
437)
438
439/* hot reload */
440if (false) { var api; }
441component.options.__file = "components/checkbox/checkbox.vue"
442/* harmony default export */ var checkbox_checkbox = (component.exports);
443// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/checkbox/checkbox-group.vue?vue&type=template&id=4cdfddd6&
444var checkbox_groupvue_type_template_id_4cdfddd6_render = function () {
445 var _vm = this
446 var _h = _vm.$createElement
447 var _c = _vm._self._c || _h
448 return _c(
449 "div",
450 { class: _vm.prefixCls + " " + _vm.direction },
451 [
452 _vm._l(_vm.items, function (item, index) {
453 return _c(
454 "checkbox",
455 {
456 key: index,
457 class: _vm.prefixCls + "-item",
458 style: { dispaly: _vm.block },
459 attrs: {
460 checked: item.checked,
461 disabled: _vm.disable(item),
462 isTransfer: _vm.isTransfer,
463 value: item.value,
464 },
465 on: { change: _vm.change },
466 },
467 [_vm._v(_vm._s(item.label) + "\n ")]
468 )
469 }),
470 !_vm.isOptions ? _vm._t("default") : _vm._e(),
471 ],
472 2
473 )
474}
475var checkbox_groupvue_type_template_id_4cdfddd6_staticRenderFns = []
476checkbox_groupvue_type_template_id_4cdfddd6_render._withStripped = true
477
478
479// CONCATENATED MODULE: ./components/checkbox/checkbox-group.vue?vue&type=template&id=4cdfddd6&
480
481// EXTERNAL MODULE: external "babel-runtime/helpers/toConsumableArray"
482var toConsumableArray_ = __webpack_require__(24);
483var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_);
484
485// EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
486var assign_ = __webpack_require__(6);
487var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
488
489// EXTERNAL MODULE: external "./_mixin/emitter"
490var emitter_ = __webpack_require__(12);
491var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
492
493// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/checkbox/checkbox-group.vue?vue&type=script&lang=js&
494
495
496//
497//
498//
499//
500//
501//
502//
503//
504//
505//
506//
507//
508//
509//
510//
511//
512//
513
514
515
516
517/* harmony default export */ var checkbox_groupvue_type_script_lang_js_ = ({
518 name: 'MdsCheckboxGroup',
519 mixins: [emitter_default.a],
520 components: { Checkbox: checkbox_checkbox },
521 props: {
522 disabled: {
523 type: Boolean,
524 default: false
525 },
526 options: {
527 type: Array,
528 default: function _default() {
529 return [];
530 }
531 },
532 prefixCls: {
533 type: String,
534 default: 'mds-checkbox-group'
535 },
536 value: {
537 type: Array,
538 default: function _default() {
539 return [];
540 }
541 },
542 direction: {
543 type: String,
544 default: ''
545 },
546 isTransfer: {
547 type: Boolean,
548 default: false
549 }
550 },
551 data: function data() {
552 return {
553 slotItems: []
554 };
555 },
556
557 computed: {
558 items: function items() {
559 var _this = this;
560
561 return this.options.map(function (item) {
562 var _item = item.constructor === String ? { label: item, value: item } : item;
563 return assign_default()({}, _item, { checked: _this.value.includes(_item.value) });
564 });
565 },
566 isOptions: function isOptions() {
567 return this.options.length !== 0;
568 }
569 },
570 methods: {
571 change: function change(checked, val) {
572 this.items.map(function (item) {
573 if (item.value === val) {
574 item.checked = checked;
575 }
576 });
577 var value = this.items.filter(function (item) {
578 return item.checked === true;
579 }).map(function (item) {
580 return item.value;
581 });
582 this.$emit('input', value);
583 this.$emit('change', value, this.items, { value: val, checked: checked });
584 this.dispatch('MdsFormItem', 'formItemChange', value);
585 },
586 slotCheck: function slotCheck(val, flag) {
587 var value = [].concat(toConsumableArray_default()(this.value));
588 if (flag) {
589 value.push(val);
590 } else {
591 value = value.filter(function (item) {
592 return item !== val;
593 });
594 }
595 this.$emit('input', value);
596 this.$emit('change', value, { value: val, checked: flag });
597 this.dispatch('MdsFormItem', 'formItemChange', value);
598 },
599 disable: function disable(item) {
600 return this.disabled || item.disabled === true;
601 },
602 addItems: function addItems(vm) {
603 if (!this.isOptions) {
604 this.slotItems.push(vm);
605 }
606 },
607 removeItems: function removeItems(vm) {
608 if (!this.isOptions) {
609 this.slotItems = this.slotItems.filter(function (item) {
610 return item !== vm;
611 });
612 }
613 }
614 },
615 watch: {
616 value: function value() {
617 var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
618
619 if (!this.isOptions) {
620 this.slotItems.map(function (item) {
621 if (val.includes(item.value)) {
622 item.checkedValue = true;
623 } else {
624 item.checkedValue = false;
625 }
626 });
627 }
628 }
629 }
630});
631// CONCATENATED MODULE: ./components/checkbox/checkbox-group.vue?vue&type=script&lang=js&
632 /* harmony default export */ var checkbox_checkbox_groupvue_type_script_lang_js_ = (checkbox_groupvue_type_script_lang_js_);
633// CONCATENATED MODULE: ./components/checkbox/checkbox-group.vue
634
635
636
637
638
639/* normalize component */
640
641var checkbox_group_component = Object(componentNormalizer["a" /* default */])(
642 checkbox_checkbox_groupvue_type_script_lang_js_,
643 checkbox_groupvue_type_template_id_4cdfddd6_render,
644 checkbox_groupvue_type_template_id_4cdfddd6_staticRenderFns,
645 false,
646 null,
647 null,
648 null
649
650)
651
652/* hot reload */
653if (false) { var checkbox_group_api; }
654checkbox_group_component.options.__file = "components/checkbox/checkbox-group.vue"
655/* harmony default export */ var checkbox_group = (checkbox_group_component.exports);
656// CONCATENATED MODULE: ./components/checkbox/index.js
657
658
659
660
661checkbox_checkbox.Group = checkbox_group;
662
663
664/* istanbul ignore next */
665checkbox_checkbox.install = function (Vue) {
666 Vue.component(checkbox_checkbox.name, checkbox_checkbox);
667 Vue.component(checkbox_group.name, checkbox_group);
668};
669/* harmony default export */ var components_checkbox = __webpack_exports__["default"] = (checkbox_checkbox);
670
671/***/ }),
672
673/***/ 6:
674/***/ (function(module, exports) {
675
676module.exports = require("babel-runtime/core-js/object/assign");
677
678/***/ })
679
680/******/ });
681});
\No newline at end of file