UNPKG

18.6 kBJavaScriptView Raw
1module.exports =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
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/******/ // define __esModule on exports
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/******/ // create a fake namespace object
53/******/ // mode & 1: value is a module id, require it
54/******/ // mode & 2: merge all properties of value into the ns
55/******/ // mode & 4: return value when already ns object
56/******/ // mode & 8|1: behave like require
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/******/ // getDefaultExport function for compatibility with non-harmony modules
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/******/ // Object.prototype.hasOwnProperty.call
78/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79/******/
80/******/ // __webpack_public_path__
81/******/ __webpack_require__.p = "/dist/";
82/******/
83/******/
84/******/ // Load entry module and return exports
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/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
95/* globals __VUE_SSR_CONTEXT__ */
96
97// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
98// This module is a runtime utility for cleaner component module output and will
99// be included in the final webpack user bundle.
100
101function normalizeComponent (
102 scriptExports,
103 render,
104 staticRenderFns,
105 functionalTemplate,
106 injectStyles,
107 scopeId,
108 moduleIdentifier, /* server only */
109 shadowMode /* vue-cli only */
110) {
111 // Vue.extend constructor export interop
112 var options = typeof scriptExports === 'function'
113 ? scriptExports.options
114 : scriptExports
115
116 // render functions
117 if (render) {
118 options.render = render
119 options.staticRenderFns = staticRenderFns
120 options._compiled = true
121 }
122
123 // functional template
124 if (functionalTemplate) {
125 options.functional = true
126 }
127
128 // scopedId
129 if (scopeId) {
130 options._scopeId = 'data-v-' + scopeId
131 }
132
133 var hook
134 if (moduleIdentifier) { // server build
135 hook = function (context) {
136 // 2.3 injection
137 context =
138 context || // cached call
139 (this.$vnode && this.$vnode.ssrContext) || // stateful
140 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
141 // 2.2 with runInNewContext: true
142 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
143 context = __VUE_SSR_CONTEXT__
144 }
145 // inject component styles
146 if (injectStyles) {
147 injectStyles.call(this, context)
148 }
149 // register component module identifier for async chunk inferrence
150 if (context && context._registeredComponents) {
151 context._registeredComponents.add(moduleIdentifier)
152 }
153 }
154 // used by ssr in case component is cached and beforeCreate
155 // never gets called
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 // for template-only hot-reload because in that case the render fn doesn't
166 // go through the normalizer
167 options._injectStyles = hook
168 // register for functioal component in vue file
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 // inject component registration as beforeCreate hook
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
195module.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// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
206var 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}
367var staticRenderFns = []
368render._withStripped = true
369
370
371// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
372
373// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
374var emitter_ = __webpack_require__(4);
375var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
376
377// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
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/* harmony default export */ 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 /* used to make the isDisabled judgment under max/min props */
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, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
537 controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
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 // 为indeterminate元素 添加aria-controls 属性
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// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
587 /* harmony default export */ var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
588// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
589var componentNormalizer = __webpack_require__(0);
590
591// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
592
593
594
595
596
597/* normalize component */
598
599var component = Object(componentNormalizer["a" /* default */])(
600 src_checkboxvue_type_script_lang_js_,
601 render,
602 staticRenderFns,
603 false,
604 null,
605 null,
606 null
607
608)
609
610/* hot reload */
611if (false) { var api; }
612component.options.__file = "packages/checkbox/src/checkbox.vue"
613/* harmony default export */ var src_checkbox = (component.exports);
614// CONCATENATED MODULE: ./packages/checkbox/index.js
615
616
617/* istanbul ignore next */
618src_checkbox.install = function (Vue) {
619 Vue.component(src_checkbox.name, src_checkbox);
620};
621
622/* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
623
624/***/ })
625
626/******/ });
\No newline at end of file