1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
41 | }
|
42 | };
|
43 |
|
44 |
|
45 | __webpack_require__.r = function(exports) {
|
46 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
47 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
48 | }
|
49 | Object.defineProperty(exports, '__esModule', { value: true });
|
50 | };
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | __webpack_require__.t = function(value, mode) {
|
58 | if(mode & 1) value = __webpack_require__(value);
|
59 | if(mode & 8) return value;
|
60 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
61 | var ns = Object.create(null);
|
62 | __webpack_require__.r(ns);
|
63 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
64 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
65 | return ns;
|
66 | };
|
67 |
|
68 |
|
69 | __webpack_require__.n = function(module) {
|
70 | var getter = module && module.__esModule ?
|
71 | function getDefault() { return module['default']; } :
|
72 | function getModuleExports() { return module; };
|
73 | __webpack_require__.d(getter, 'a', getter);
|
74 | return getter;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "/dist/";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 83);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
156 | options._ssrRegister = hook
|
157 | } else if (injectStyles) {
|
158 | hook = shadowMode
|
159 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
160 | : injectStyles
|
161 | }
|
162 |
|
163 | if (hook) {
|
164 | if (options.functional) {
|
165 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
169 | var originalRender = options.render
|
170 | options.render = function renderWithStyleInjection (h, context) {
|
171 | hook.call(context)
|
172 | return originalRender(h, context)
|
173 | }
|
174 | } else {
|
175 |
|
176 | var existing = options.beforeCreate
|
177 | options.beforeCreate = existing
|
178 | ? [].concat(existing, hook)
|
179 | : [hook]
|
180 | }
|
181 | }
|
182 |
|
183 | return {
|
184 | exports: scriptExports,
|
185 | options: options
|
186 | }
|
187 | }
|
188 |
|
189 |
|
190 | }),
|
191 |
|
192 | 4:
|
193 | (function(module, exports) {
|
194 |
|
195 | module.exports = require("element-ui/lib/mixins/emitter");
|
196 |
|
197 | }),
|
198 |
|
199 | 83:
|
200 | (function(module, __webpack_exports__, __webpack_require__) {
|
201 |
|
202 | "use strict";
|
203 | __webpack_require__.r(__webpack_exports__);
|
204 |
|
205 |
|
206 | var render = function() {
|
207 | var _vm = this
|
208 | var _h = _vm.$createElement
|
209 | var _c = _vm._self._c || _h
|
210 | return _c(
|
211 | "label",
|
212 | {
|
213 | staticClass: "el-checkbox",
|
214 | class: [
|
215 | _vm.border && _vm.checkboxSize
|
216 | ? "el-checkbox--" + _vm.checkboxSize
|
217 | : "",
|
218 | { "is-disabled": _vm.isDisabled },
|
219 | { "is-bordered": _vm.border },
|
220 | { "is-checked": _vm.isChecked }
|
221 | ],
|
222 | attrs: { id: _vm.id }
|
223 | },
|
224 | [
|
225 | _c(
|
226 | "span",
|
227 | {
|
228 | staticClass: "el-checkbox__input",
|
229 | class: {
|
230 | "is-disabled": _vm.isDisabled,
|
231 | "is-checked": _vm.isChecked,
|
232 | "is-indeterminate": _vm.indeterminate,
|
233 | "is-focus": _vm.focus
|
234 | },
|
235 | attrs: {
|
236 | tabindex: _vm.indeterminate ? 0 : false,
|
237 | role: _vm.indeterminate ? "checkbox" : false,
|
238 | "aria-checked": _vm.indeterminate ? "mixed" : false
|
239 | }
|
240 | },
|
241 | [
|
242 | _c("span", { staticClass: "el-checkbox__inner" }),
|
243 | _vm.trueLabel || _vm.falseLabel
|
244 | ? _c("input", {
|
245 | directives: [
|
246 | {
|
247 | name: "model",
|
248 | rawName: "v-model",
|
249 | value: _vm.model,
|
250 | expression: "model"
|
251 | }
|
252 | ],
|
253 | staticClass: "el-checkbox__original",
|
254 | attrs: {
|
255 | type: "checkbox",
|
256 | "aria-hidden": _vm.indeterminate ? "true" : "false",
|
257 | name: _vm.name,
|
258 | disabled: _vm.isDisabled,
|
259 | "true-value": _vm.trueLabel,
|
260 | "false-value": _vm.falseLabel
|
261 | },
|
262 | domProps: {
|
263 | checked: Array.isArray(_vm.model)
|
264 | ? _vm._i(_vm.model, null) > -1
|
265 | : _vm._q(_vm.model, _vm.trueLabel)
|
266 | },
|
267 | on: {
|
268 | change: [
|
269 | function($event) {
|
270 | var $$a = _vm.model,
|
271 | $$el = $event.target,
|
272 | $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
|
273 | if (Array.isArray($$a)) {
|
274 | var $$v = null,
|
275 | $$i = _vm._i($$a, $$v)
|
276 | if ($$el.checked) {
|
277 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
278 | } else {
|
279 | $$i > -1 &&
|
280 | (_vm.model = $$a
|
281 | .slice(0, $$i)
|
282 | .concat($$a.slice($$i + 1)))
|
283 | }
|
284 | } else {
|
285 | _vm.model = $$c
|
286 | }
|
287 | },
|
288 | _vm.handleChange
|
289 | ],
|
290 | focus: function($event) {
|
291 | _vm.focus = true
|
292 | },
|
293 | blur: function($event) {
|
294 | _vm.focus = false
|
295 | }
|
296 | }
|
297 | })
|
298 | : _c("input", {
|
299 | directives: [
|
300 | {
|
301 | name: "model",
|
302 | rawName: "v-model",
|
303 | value: _vm.model,
|
304 | expression: "model"
|
305 | }
|
306 | ],
|
307 | staticClass: "el-checkbox__original",
|
308 | attrs: {
|
309 | type: "checkbox",
|
310 | "aria-hidden": _vm.indeterminate ? "true" : "false",
|
311 | disabled: _vm.isDisabled,
|
312 | name: _vm.name
|
313 | },
|
314 | domProps: {
|
315 | value: _vm.label,
|
316 | checked: Array.isArray(_vm.model)
|
317 | ? _vm._i(_vm.model, _vm.label) > -1
|
318 | : _vm.model
|
319 | },
|
320 | on: {
|
321 | change: [
|
322 | function($event) {
|
323 | var $$a = _vm.model,
|
324 | $$el = $event.target,
|
325 | $$c = $$el.checked ? true : false
|
326 | if (Array.isArray($$a)) {
|
327 | var $$v = _vm.label,
|
328 | $$i = _vm._i($$a, $$v)
|
329 | if ($$el.checked) {
|
330 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
331 | } else {
|
332 | $$i > -1 &&
|
333 | (_vm.model = $$a
|
334 | .slice(0, $$i)
|
335 | .concat($$a.slice($$i + 1)))
|
336 | }
|
337 | } else {
|
338 | _vm.model = $$c
|
339 | }
|
340 | },
|
341 | _vm.handleChange
|
342 | ],
|
343 | focus: function($event) {
|
344 | _vm.focus = true
|
345 | },
|
346 | blur: function($event) {
|
347 | _vm.focus = false
|
348 | }
|
349 | }
|
350 | })
|
351 | ]
|
352 | ),
|
353 | _vm.$slots.default || _vm.label
|
354 | ? _c(
|
355 | "span",
|
356 | { staticClass: "el-checkbox__label" },
|
357 | [
|
358 | _vm._t("default"),
|
359 | !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
|
360 | ],
|
361 | 2
|
362 | )
|
363 | : _vm._e()
|
364 | ]
|
365 | )
|
366 | }
|
367 | var staticRenderFns = []
|
368 | render._withStripped = true
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 | var emitter_ = __webpack_require__(4);
|
375 | var emitter_default = __webpack_require__.n(emitter_);
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 | var checkboxvue_type_script_lang_js_ = ({
|
437 | name: 'ElCheckbox',
|
438 |
|
439 | mixins: [emitter_default.a],
|
440 |
|
441 | inject: {
|
442 | elForm: {
|
443 | default: ''
|
444 | },
|
445 | elFormItem: {
|
446 | default: ''
|
447 | }
|
448 | },
|
449 |
|
450 | componentName: 'ElCheckbox',
|
451 |
|
452 | data: function data() {
|
453 | return {
|
454 | selfModel: false,
|
455 | focus: false,
|
456 | isLimitExceeded: false
|
457 | };
|
458 | },
|
459 |
|
460 |
|
461 | computed: {
|
462 | model: {
|
463 | get: function get() {
|
464 | return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
|
465 | },
|
466 | set: function set(val) {
|
467 | if (this.isGroup) {
|
468 | this.isLimitExceeded = false;
|
469 | this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
|
470 |
|
471 | this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
|
472 |
|
473 | this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
|
474 | } else {
|
475 | this.$emit('input', val);
|
476 | this.selfModel = val;
|
477 | }
|
478 | }
|
479 | },
|
480 |
|
481 | isChecked: function isChecked() {
|
482 | if ({}.toString.call(this.model) === '[object Boolean]') {
|
483 | return this.model;
|
484 | } else if (Array.isArray(this.model)) {
|
485 | return this.model.indexOf(this.label) > -1;
|
486 | } else if (this.model !== null && this.model !== undefined) {
|
487 | return this.model === this.trueLabel;
|
488 | }
|
489 | },
|
490 | isGroup: function isGroup() {
|
491 | var parent = this.$parent;
|
492 | while (parent) {
|
493 | if (parent.$options.componentName !== 'ElCheckboxGroup') {
|
494 | parent = parent.$parent;
|
495 | } else {
|
496 | this._checkboxGroup = parent;
|
497 | return true;
|
498 | }
|
499 | }
|
500 | return false;
|
501 | },
|
502 | store: function store() {
|
503 | return this._checkboxGroup ? this._checkboxGroup.value : this.value;
|
504 | },
|
505 |
|
506 |
|
507 |
|
508 | isLimitDisabled: function isLimitDisabled() {
|
509 | var _checkboxGroup = this._checkboxGroup,
|
510 | max = _checkboxGroup.max,
|
511 | min = _checkboxGroup.min;
|
512 |
|
513 | return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
|
514 | },
|
515 | isDisabled: function isDisabled() {
|
516 | return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
|
517 | },
|
518 | _elFormItemSize: function _elFormItemSize() {
|
519 | return (this.elFormItem || {}).elFormItemSize;
|
520 | },
|
521 | checkboxSize: function checkboxSize() {
|
522 | var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
523 | return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
|
524 | }
|
525 | },
|
526 |
|
527 | props: {
|
528 | value: {},
|
529 | label: {},
|
530 | indeterminate: Boolean,
|
531 | disabled: Boolean,
|
532 | checked: Boolean,
|
533 | name: String,
|
534 | trueLabel: [String, Number],
|
535 | falseLabel: [String, Number],
|
536 | id: String,
|
537 | controls: String,
|
538 | border: Boolean,
|
539 | size: String
|
540 | },
|
541 |
|
542 | methods: {
|
543 | addToStore: function addToStore() {
|
544 | if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
|
545 | this.model.push(this.label);
|
546 | } else {
|
547 | this.model = this.trueLabel || true;
|
548 | }
|
549 | },
|
550 | handleChange: function handleChange(ev) {
|
551 | var _this = this;
|
552 |
|
553 | if (this.isLimitExceeded) return;
|
554 | var value = void 0;
|
555 | if (ev.target.checked) {
|
556 | value = this.trueLabel === undefined ? true : this.trueLabel;
|
557 | } else {
|
558 | value = this.falseLabel === undefined ? false : this.falseLabel;
|
559 | }
|
560 | this.$emit('change', value, ev);
|
561 | this.$nextTick(function () {
|
562 | if (_this.isGroup) {
|
563 | _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
|
564 | }
|
565 | });
|
566 | }
|
567 | },
|
568 |
|
569 | created: function created() {
|
570 | this.checked && this.addToStore();
|
571 | },
|
572 | mounted: function mounted() {
|
573 |
|
574 | if (this.indeterminate) {
|
575 | this.$el.setAttribute('aria-controls', this.controls);
|
576 | }
|
577 | },
|
578 |
|
579 |
|
580 | watch: {
|
581 | value: function value(_value) {
|
582 | this.dispatch('ElFormItem', 'el.form.change', _value);
|
583 | }
|
584 | }
|
585 | });
|
586 |
|
587 | var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
|
588 |
|
589 | var componentNormalizer = __webpack_require__(0);
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 | var component = Object(componentNormalizer["a" ])(
|
600 | src_checkboxvue_type_script_lang_js_,
|
601 | render,
|
602 | staticRenderFns,
|
603 | false,
|
604 | null,
|
605 | null,
|
606 | null
|
607 |
|
608 | )
|
609 |
|
610 |
|
611 | if (false) { var api; }
|
612 | component.options.__file = "packages/checkbox/src/checkbox.vue"
|
613 | var src_checkbox = (component.exports);
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | src_checkbox.install = function (Vue) {
|
619 | Vue.component(src_checkbox.name, src_checkbox);
|
620 | };
|
621 |
|
622 | var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
|
623 |
|
624 | })
|
625 |
|
626 | }); |
\ | No newline at end of file |