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__) {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
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 |
|
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 |
|
62 |
|
63 |
|
64 |
|
65 |
|
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 |
|
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 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "/dist/";
|
91 |
|
92 |
|
93 |
|
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 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | function normalizeComponent (
|
111 | scriptExports,
|
112 | render,
|
113 | staticRenderFns,
|
114 | functionalTemplate,
|
115 | injectStyles,
|
116 | scopeId,
|
117 | moduleIdentifier, /* server only */
|
118 | shadowMode /* vue-cli only */
|
119 | ) {
|
120 |
|
121 | var options = typeof scriptExports === 'function'
|
122 | ? scriptExports.options
|
123 | : scriptExports
|
124 |
|
125 |
|
126 | if (render) {
|
127 | options.render = render
|
128 | options.staticRenderFns = staticRenderFns
|
129 | options._compiled = true
|
130 | }
|
131 |
|
132 |
|
133 | if (functionalTemplate) {
|
134 | options.functional = true
|
135 | }
|
136 |
|
137 |
|
138 | if (scopeId) {
|
139 | options._scopeId = 'data-v-' + scopeId
|
140 | }
|
141 |
|
142 | var hook
|
143 | if (moduleIdentifier) {
|
144 | hook = function (context) {
|
145 |
|
146 | context =
|
147 | context ||
|
148 | (this.$vnode && this.$vnode.ssrContext) ||
|
149 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
150 |
|
151 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
152 | context = __VUE_SSR_CONTEXT__
|
153 | }
|
154 |
|
155 | if (injectStyles) {
|
156 | injectStyles.call(this, context)
|
157 | }
|
158 |
|
159 | if (context && context._registeredComponents) {
|
160 | context._registeredComponents.add(moduleIdentifier)
|
161 | }
|
162 | }
|
163 |
|
164 |
|
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 |
|
180 |
|
181 | options._injectStyles = hook
|
182 |
|
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 |
|
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 |
|
209 | module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
210 |
|
211 | }),
|
212 |
|
213 | 139:
|
214 | (function(module, exports) {
|
215 |
|
216 |
|
217 |
|
218 | }),
|
219 |
|
220 | 165:
|
221 | (function(module, exports) {
|
222 |
|
223 |
|
224 |
|
225 | }),
|
226 |
|
227 | 24:
|
228 | (function(module, exports) {
|
229 |
|
230 | module.exports = require("babel-runtime/helpers/toConsumableArray");
|
231 |
|
232 | }),
|
233 |
|
234 | 3:
|
235 | (function(module, exports) {
|
236 |
|
237 | module.exports = require("babel-runtime/helpers/defineProperty");
|
238 |
|
239 | }),
|
240 |
|
241 | 39:
|
242 | (function(module, __webpack_exports__, __webpack_require__) {
|
243 |
|
244 | "use strict";
|
245 |
|
246 | __webpack_require__.r(__webpack_exports__);
|
247 |
|
248 |
|
249 | __webpack_require__.d(__webpack_exports__, "MdsCheckbox", function() { return checkbox_checkbox; });
|
250 | __webpack_require__.d(__webpack_exports__, "MdsCheckboxGroup", function() { return checkbox_group; });
|
251 |
|
252 |
|
253 | var style = __webpack_require__(139);
|
254 |
|
255 |
|
256 | var checkbox_style = __webpack_require__(165);
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | var 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 | }
|
283 | var staticRenderFns = []
|
284 | render._withStripped = true
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | var defineProperty_ = __webpack_require__(3);
|
291 | var defineProperty_default = __webpack_require__.n(defineProperty_);
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 | 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 |
|
416 | var checkbox_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
|
417 |
|
418 | var componentNormalizer = __webpack_require__(0);
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 | var component = Object(componentNormalizer["a" ])(
|
429 | checkbox_checkboxvue_type_script_lang_js_,
|
430 | render,
|
431 | staticRenderFns,
|
432 | false,
|
433 | null,
|
434 | null,
|
435 | null
|
436 |
|
437 | )
|
438 |
|
439 |
|
440 | if (false) { var api; }
|
441 | component.options.__file = "components/checkbox/checkbox.vue"
|
442 | var checkbox_checkbox = (component.exports);
|
443 |
|
444 | var 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 | }
|
475 | var checkbox_groupvue_type_template_id_4cdfddd6_staticRenderFns = []
|
476 | checkbox_groupvue_type_template_id_4cdfddd6_render._withStripped = true
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 | var toConsumableArray_ = __webpack_require__(24);
|
483 | var toConsumableArray_default = __webpack_require__.n(toConsumableArray_);
|
484 |
|
485 |
|
486 | var assign_ = __webpack_require__(6);
|
487 | var assign_default = __webpack_require__.n(assign_);
|
488 |
|
489 |
|
490 | var emitter_ = __webpack_require__(12);
|
491 | var emitter_default = __webpack_require__.n(emitter_);
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 | 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 |
|
632 | var checkbox_checkbox_groupvue_type_script_lang_js_ = (checkbox_groupvue_type_script_lang_js_);
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 | var checkbox_group_component = Object(componentNormalizer["a" ])(
|
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 |
|
653 | if (false) { var checkbox_group_api; }
|
654 | checkbox_group_component.options.__file = "components/checkbox/checkbox-group.vue"
|
655 | var checkbox_group = (checkbox_group_component.exports);
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 | checkbox_checkbox.Group = checkbox_group;
|
662 |
|
663 |
|
664 |
|
665 | checkbox_checkbox.install = function (Vue) {
|
666 | Vue.component(checkbox_checkbox.name, checkbox_checkbox);
|
667 | Vue.component(checkbox_group.name, checkbox_group);
|
668 | };
|
669 | var components_checkbox = __webpack_exports__["default"] = (checkbox_checkbox);
|
670 |
|
671 | }),
|
672 |
|
673 | 6:
|
674 | (function(module, exports) {
|
675 |
|
676 | module.exports = require("babel-runtime/core-js/object/assign");
|
677 |
|
678 | })
|
679 |
|
680 | });
|
681 | }); |
\ | No newline at end of file |