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 = 84);
|
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 | 84:
|
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-button",
|
214 | class: [
|
215 | _vm.size ? "el-checkbox-button--" + _vm.size : "",
|
216 | { "is-disabled": _vm.isDisabled },
|
217 | { "is-checked": _vm.isChecked },
|
218 | { "is-focus": _vm.focus }
|
219 | ],
|
220 | attrs: {
|
221 | role: "checkbox",
|
222 | "aria-checked": _vm.isChecked,
|
223 | "aria-disabled": _vm.isDisabled
|
224 | }
|
225 | },
|
226 | [
|
227 | _vm.trueLabel || _vm.falseLabel
|
228 | ? _c("input", {
|
229 | directives: [
|
230 | {
|
231 | name: "model",
|
232 | rawName: "v-model",
|
233 | value: _vm.model,
|
234 | expression: "model"
|
235 | }
|
236 | ],
|
237 | staticClass: "el-checkbox-button__original",
|
238 | attrs: {
|
239 | type: "checkbox",
|
240 | name: _vm.name,
|
241 | disabled: _vm.isDisabled,
|
242 | "true-value": _vm.trueLabel,
|
243 | "false-value": _vm.falseLabel
|
244 | },
|
245 | domProps: {
|
246 | checked: Array.isArray(_vm.model)
|
247 | ? _vm._i(_vm.model, null) > -1
|
248 | : _vm._q(_vm.model, _vm.trueLabel)
|
249 | },
|
250 | on: {
|
251 | change: [
|
252 | function($event) {
|
253 | var $$a = _vm.model,
|
254 | $$el = $event.target,
|
255 | $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
|
256 | if (Array.isArray($$a)) {
|
257 | var $$v = null,
|
258 | $$i = _vm._i($$a, $$v)
|
259 | if ($$el.checked) {
|
260 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
261 | } else {
|
262 | $$i > -1 &&
|
263 | (_vm.model = $$a
|
264 | .slice(0, $$i)
|
265 | .concat($$a.slice($$i + 1)))
|
266 | }
|
267 | } else {
|
268 | _vm.model = $$c
|
269 | }
|
270 | },
|
271 | _vm.handleChange
|
272 | ],
|
273 | focus: function($event) {
|
274 | _vm.focus = true
|
275 | },
|
276 | blur: function($event) {
|
277 | _vm.focus = false
|
278 | }
|
279 | }
|
280 | })
|
281 | : _c("input", {
|
282 | directives: [
|
283 | {
|
284 | name: "model",
|
285 | rawName: "v-model",
|
286 | value: _vm.model,
|
287 | expression: "model"
|
288 | }
|
289 | ],
|
290 | staticClass: "el-checkbox-button__original",
|
291 | attrs: {
|
292 | type: "checkbox",
|
293 | name: _vm.name,
|
294 | disabled: _vm.isDisabled
|
295 | },
|
296 | domProps: {
|
297 | value: _vm.label,
|
298 | checked: Array.isArray(_vm.model)
|
299 | ? _vm._i(_vm.model, _vm.label) > -1
|
300 | : _vm.model
|
301 | },
|
302 | on: {
|
303 | change: [
|
304 | function($event) {
|
305 | var $$a = _vm.model,
|
306 | $$el = $event.target,
|
307 | $$c = $$el.checked ? true : false
|
308 | if (Array.isArray($$a)) {
|
309 | var $$v = _vm.label,
|
310 | $$i = _vm._i($$a, $$v)
|
311 | if ($$el.checked) {
|
312 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
313 | } else {
|
314 | $$i > -1 &&
|
315 | (_vm.model = $$a
|
316 | .slice(0, $$i)
|
317 | .concat($$a.slice($$i + 1)))
|
318 | }
|
319 | } else {
|
320 | _vm.model = $$c
|
321 | }
|
322 | },
|
323 | _vm.handleChange
|
324 | ],
|
325 | focus: function($event) {
|
326 | _vm.focus = true
|
327 | },
|
328 | blur: function($event) {
|
329 | _vm.focus = false
|
330 | }
|
331 | }
|
332 | }),
|
333 | _vm.$slots.default || _vm.label
|
334 | ? _c(
|
335 | "span",
|
336 | {
|
337 | staticClass: "el-checkbox-button__inner",
|
338 | style: _vm.isChecked ? _vm.activeStyle : null
|
339 | },
|
340 | [_vm._t("default", [_vm._v(_vm._s(_vm.label))])],
|
341 | 2
|
342 | )
|
343 | : _vm._e()
|
344 | ]
|
345 | )
|
346 | }
|
347 | var staticRenderFns = []
|
348 | render._withStripped = true
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 | var emitter_ = __webpack_require__(4);
|
355 | var emitter_default = __webpack_require__.n(emitter_);
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
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 | var checkbox_buttonvue_type_script_lang_js_ = ({
|
407 | name: 'ElCheckboxButton',
|
408 |
|
409 | mixins: [emitter_default.a],
|
410 |
|
411 | inject: {
|
412 | elForm: {
|
413 | default: ''
|
414 | },
|
415 | elFormItem: {
|
416 | default: ''
|
417 | }
|
418 | },
|
419 |
|
420 | data: function data() {
|
421 | return {
|
422 | selfModel: false,
|
423 | focus: false,
|
424 | isLimitExceeded: false
|
425 | };
|
426 | },
|
427 |
|
428 |
|
429 | props: {
|
430 | value: {},
|
431 | label: {},
|
432 | disabled: Boolean,
|
433 | checked: Boolean,
|
434 | name: String,
|
435 | trueLabel: [String, Number],
|
436 | falseLabel: [String, Number]
|
437 | },
|
438 | computed: {
|
439 | model: {
|
440 | get: function get() {
|
441 | return this._checkboxGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
|
442 | },
|
443 | set: function set(val) {
|
444 | if (this._checkboxGroup) {
|
445 | this.isLimitExceeded = false;
|
446 | this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
|
447 |
|
448 | this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
|
449 |
|
450 | this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
|
451 | } else if (this.value !== undefined) {
|
452 | this.$emit('input', val);
|
453 | } else {
|
454 | this.selfModel = val;
|
455 | }
|
456 | }
|
457 | },
|
458 |
|
459 | isChecked: function isChecked() {
|
460 | if ({}.toString.call(this.model) === '[object Boolean]') {
|
461 | return this.model;
|
462 | } else if (Array.isArray(this.model)) {
|
463 | return this.model.indexOf(this.label) > -1;
|
464 | } else if (this.model !== null && this.model !== undefined) {
|
465 | return this.model === this.trueLabel;
|
466 | }
|
467 | },
|
468 | _checkboxGroup: function _checkboxGroup() {
|
469 | var parent = this.$parent;
|
470 | while (parent) {
|
471 | if (parent.$options.componentName !== 'ElCheckboxGroup') {
|
472 | parent = parent.$parent;
|
473 | } else {
|
474 | return parent;
|
475 | }
|
476 | }
|
477 | return false;
|
478 | },
|
479 | store: function store() {
|
480 | return this._checkboxGroup ? this._checkboxGroup.value : this.value;
|
481 | },
|
482 | activeStyle: function activeStyle() {
|
483 | return {
|
484 | backgroundColor: this._checkboxGroup.fill || '',
|
485 | borderColor: this._checkboxGroup.fill || '',
|
486 | color: this._checkboxGroup.textColor || '',
|
487 | 'box-shadow': '-1px 0 0 0 ' + this._checkboxGroup.fill
|
488 |
|
489 | };
|
490 | },
|
491 | _elFormItemSize: function _elFormItemSize() {
|
492 | return (this.elFormItem || {}).elFormItemSize;
|
493 | },
|
494 | size: function size() {
|
495 | return this._checkboxGroup.checkboxGroupSize || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
496 | },
|
497 |
|
498 |
|
499 |
|
500 | isLimitDisabled: function isLimitDisabled() {
|
501 | var _checkboxGroup2 = this._checkboxGroup,
|
502 | max = _checkboxGroup2.max,
|
503 | min = _checkboxGroup2.min;
|
504 |
|
505 | return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
|
506 | },
|
507 | isDisabled: function isDisabled() {
|
508 | return this._checkboxGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
|
509 | }
|
510 | },
|
511 | methods: {
|
512 | addToStore: function addToStore() {
|
513 | if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
|
514 | this.model.push(this.label);
|
515 | } else {
|
516 | this.model = this.trueLabel || true;
|
517 | }
|
518 | },
|
519 | handleChange: function handleChange(ev) {
|
520 | var _this = this;
|
521 |
|
522 | if (this.isLimitExceeded) return;
|
523 | var value = void 0;
|
524 | if (ev.target.checked) {
|
525 | value = this.trueLabel === undefined ? true : this.trueLabel;
|
526 | } else {
|
527 | value = this.falseLabel === undefined ? false : this.falseLabel;
|
528 | }
|
529 | this.$emit('change', value, ev);
|
530 | this.$nextTick(function () {
|
531 | if (_this._checkboxGroup) {
|
532 | _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
|
533 | }
|
534 | });
|
535 | }
|
536 | },
|
537 |
|
538 | created: function created() {
|
539 | this.checked && this.addToStore();
|
540 | }
|
541 | });
|
542 |
|
543 | var src_checkbox_buttonvue_type_script_lang_js_ = (checkbox_buttonvue_type_script_lang_js_);
|
544 |
|
545 | var componentNormalizer = __webpack_require__(0);
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 | var component = Object(componentNormalizer["a" ])(
|
556 | src_checkbox_buttonvue_type_script_lang_js_,
|
557 | render,
|
558 | staticRenderFns,
|
559 | false,
|
560 | null,
|
561 | null,
|
562 | null
|
563 |
|
564 | )
|
565 |
|
566 |
|
567 | if (false) { var api; }
|
568 | component.options.__file = "packages/checkbox/src/checkbox-button.vue"
|
569 | var checkbox_button = (component.exports);
|
570 |
|
571 |
|
572 |
|
573 |
|
574 | checkbox_button.install = function (Vue) {
|
575 | Vue.component(checkbox_button.name, checkbox_button);
|
576 | };
|
577 |
|
578 | var packages_checkbox_button = __webpack_exports__["default"] = (checkbox_button);
|
579 |
|
580 | })
|
581 |
|
582 | }); |
\ | No newline at end of file |