UNPKG

18.5 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 = 105);
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/***/ 105:
193/***/ (function(module, __webpack_exports__, __webpack_require__) {
194
195"use strict";
196__webpack_require__.r(__webpack_exports__);
197
198// 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&
199var render = function() {
200 var _vm = this
201 var _h = _vm.$createElement
202 var _c = _vm._self._c || _h
203 return _c(
204 "label",
205 {
206 staticClass: "el-checkbox",
207 class: [
208 _vm.border && _vm.checkboxSize
209 ? "el-checkbox--" + _vm.checkboxSize
210 : "",
211 { "is-disabled": _vm.isDisabled },
212 { "is-bordered": _vm.border },
213 { "is-checked": _vm.isChecked }
214 ],
215 attrs: {
216 role: "checkbox",
217 "aria-checked": _vm.indeterminate ? "mixed" : _vm.isChecked,
218 "aria-disabled": _vm.isDisabled,
219 id: _vm.id
220 }
221 },
222 [
223 _c(
224 "span",
225 {
226 staticClass: "el-checkbox__input",
227 class: {
228 "is-disabled": _vm.isDisabled,
229 "is-checked": _vm.isChecked,
230 "is-indeterminate": _vm.indeterminate,
231 "is-focus": _vm.focus
232 },
233 attrs: { "aria-checked": "mixed" }
234 },
235 [
236 _c("span", { staticClass: "el-checkbox__inner" }),
237 _vm.trueLabel || _vm.falseLabel
238 ? _c("input", {
239 directives: [
240 {
241 name: "model",
242 rawName: "v-model",
243 value: _vm.model,
244 expression: "model"
245 }
246 ],
247 staticClass: "el-checkbox__original",
248 attrs: {
249 type: "checkbox",
250 "aria-hidden": "true",
251 name: _vm.name,
252 disabled: _vm.isDisabled,
253 "true-value": _vm.trueLabel,
254 "false-value": _vm.falseLabel
255 },
256 domProps: {
257 checked: Array.isArray(_vm.model)
258 ? _vm._i(_vm.model, null) > -1
259 : _vm._q(_vm.model, _vm.trueLabel)
260 },
261 on: {
262 change: [
263 function($event) {
264 var $$a = _vm.model,
265 $$el = $event.target,
266 $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
267 if (Array.isArray($$a)) {
268 var $$v = null,
269 $$i = _vm._i($$a, $$v)
270 if ($$el.checked) {
271 $$i < 0 && (_vm.model = $$a.concat([$$v]))
272 } else {
273 $$i > -1 &&
274 (_vm.model = $$a
275 .slice(0, $$i)
276 .concat($$a.slice($$i + 1)))
277 }
278 } else {
279 _vm.model = $$c
280 }
281 },
282 _vm.handleChange
283 ],
284 focus: function($event) {
285 _vm.focus = true
286 },
287 blur: function($event) {
288 _vm.focus = false
289 }
290 }
291 })
292 : _c("input", {
293 directives: [
294 {
295 name: "model",
296 rawName: "v-model",
297 value: _vm.model,
298 expression: "model"
299 }
300 ],
301 staticClass: "el-checkbox__original",
302 attrs: {
303 type: "checkbox",
304 "aria-hidden": "true",
305 disabled: _vm.isDisabled,
306 name: _vm.name
307 },
308 domProps: {
309 value: _vm.label,
310 checked: Array.isArray(_vm.model)
311 ? _vm._i(_vm.model, _vm.label) > -1
312 : _vm.model
313 },
314 on: {
315 change: [
316 function($event) {
317 var $$a = _vm.model,
318 $$el = $event.target,
319 $$c = $$el.checked ? true : false
320 if (Array.isArray($$a)) {
321 var $$v = _vm.label,
322 $$i = _vm._i($$a, $$v)
323 if ($$el.checked) {
324 $$i < 0 && (_vm.model = $$a.concat([$$v]))
325 } else {
326 $$i > -1 &&
327 (_vm.model = $$a
328 .slice(0, $$i)
329 .concat($$a.slice($$i + 1)))
330 }
331 } else {
332 _vm.model = $$c
333 }
334 },
335 _vm.handleChange
336 ],
337 focus: function($event) {
338 _vm.focus = true
339 },
340 blur: function($event) {
341 _vm.focus = false
342 }
343 }
344 })
345 ]
346 ),
347 _vm.$slots.default || _vm.label
348 ? _c(
349 "span",
350 { staticClass: "el-checkbox__label" },
351 [
352 _vm._t("default"),
353 !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
354 ],
355 2
356 )
357 : _vm._e()
358 ]
359 )
360}
361var staticRenderFns = []
362render._withStripped = true
363
364
365// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
366
367// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
368var emitter_ = __webpack_require__(4);
369var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
370
371// 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&
372//
373//
374//
375//
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/* harmony default export */ var checkboxvue_type_script_lang_js_ = ({
432 name: 'ElCheckbox',
433
434 mixins: [emitter_default.a],
435
436 inject: {
437 elForm: {
438 default: ''
439 },
440 elFormItem: {
441 default: ''
442 }
443 },
444
445 componentName: 'ElCheckbox',
446
447 data: function data() {
448 return {
449 selfModel: false,
450 focus: false,
451 isLimitExceeded: false
452 };
453 },
454
455
456 computed: {
457 model: {
458 get: function get() {
459 return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
460 },
461 set: function set(val) {
462 if (this.isGroup) {
463 this.isLimitExceeded = false;
464 this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
465
466 this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
467
468 this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
469 } else {
470 this.$emit('input', val);
471 this.selfModel = val;
472 }
473 }
474 },
475
476 isChecked: function isChecked() {
477 if ({}.toString.call(this.model) === '[object Boolean]') {
478 return this.model;
479 } else if (Array.isArray(this.model)) {
480 return this.model.indexOf(this.label) > -1;
481 } else if (this.model !== null && this.model !== undefined) {
482 return this.model === this.trueLabel;
483 }
484 },
485 isGroup: function isGroup() {
486 var parent = this.$parent;
487 while (parent) {
488 if (parent.$options.componentName !== 'ElCheckboxGroup') {
489 parent = parent.$parent;
490 } else {
491 this._checkboxGroup = parent;
492 return true;
493 }
494 }
495 return false;
496 },
497 store: function store() {
498 return this._checkboxGroup ? this._checkboxGroup.value : this.value;
499 },
500
501
502 /* used to make the isDisabled judgment under max/min props */
503 isLimitDisabled: function isLimitDisabled() {
504 var _checkboxGroup = this._checkboxGroup,
505 max = _checkboxGroup.max,
506 min = _checkboxGroup.min;
507
508 return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
509 },
510 isDisabled: function isDisabled() {
511 return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
512 },
513 _elFormItemSize: function _elFormItemSize() {
514 return (this.elFormItem || {}).elFormItemSize;
515 },
516 checkboxSize: function checkboxSize() {
517 var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
518 return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
519 }
520 },
521
522 props: {
523 value: {},
524 label: {},
525 indeterminate: Boolean,
526 disabled: Boolean,
527 checked: Boolean,
528 name: String,
529 trueLabel: [String, Number],
530 falseLabel: [String, Number],
531 id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
532 controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
533 border: Boolean,
534 size: String
535 },
536
537 methods: {
538 addToStore: function addToStore() {
539 if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
540 this.model.push(this.label);
541 } else {
542 this.model = this.trueLabel || true;
543 }
544 },
545 handleChange: function handleChange(ev) {
546 var _this = this;
547
548 if (this.isLimitExceeded) return;
549 var value = void 0;
550 if (ev.target.checked) {
551 value = this.trueLabel === undefined ? true : this.trueLabel;
552 } else {
553 value = this.falseLabel === undefined ? false : this.falseLabel;
554 }
555 this.$emit('change', value, ev);
556 this.$nextTick(function () {
557 if (_this.isGroup) {
558 _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
559 }
560 });
561 }
562 },
563
564 created: function created() {
565 this.checked && this.addToStore();
566 },
567 mounted: function mounted() {
568 // 为indeterminate元素 添加aria-controls 属性
569 if (this.indeterminate) {
570 this.$el.setAttribute('aria-controls', this.controls);
571 }
572 },
573
574
575 watch: {
576 value: function value(_value) {
577 this.dispatch('ElFormItem', 'el.form.change', _value);
578 }
579 }
580});
581// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
582 /* harmony default export */ var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
583// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
584var componentNormalizer = __webpack_require__(0);
585
586// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
587
588
589
590
591
592/* normalize component */
593
594var component = Object(componentNormalizer["a" /* default */])(
595 src_checkboxvue_type_script_lang_js_,
596 render,
597 staticRenderFns,
598 false,
599 null,
600 null,
601 null
602
603)
604
605/* hot reload */
606if (false) { var api; }
607component.options.__file = "packages/checkbox/src/checkbox.vue"
608/* harmony default export */ var src_checkbox = (component.exports);
609// CONCATENATED MODULE: ./packages/checkbox/index.js
610
611
612/* istanbul ignore next */
613src_checkbox.install = function (Vue) {
614 Vue.component(src_checkbox.name, src_checkbox);
615};
616
617/* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
618
619/***/ }),
620
621/***/ 4:
622/***/ (function(module, exports) {
623
624module.exports = require("element-ui/lib/mixins/emitter");
625
626/***/ })
627
628/******/ });
\No newline at end of file