UNPKG

13.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, {
41/******/ configurable: false,
42/******/ enumerable: true,
43/******/ get: getter
44/******/ });
45/******/ }
46/******/ };
47/******/
48/******/ // getDefaultExport function for compatibility with non-harmony modules
49/******/ __webpack_require__.n = function(module) {
50/******/ var getter = module && module.__esModule ?
51/******/ function getDefault() { return module['default']; } :
52/******/ function getModuleExports() { return module; };
53/******/ __webpack_require__.d(getter, 'a', getter);
54/******/ return getter;
55/******/ };
56/******/
57/******/ // Object.prototype.hasOwnProperty.call
58/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
59/******/
60/******/ // __webpack_public_path__
61/******/ __webpack_require__.p = "/dist/";
62/******/
63/******/ // Load entry module and return exports
64/******/ return __webpack_require__(__webpack_require__.s = 134);
65/******/ })
66/************************************************************************/
67/******/ ({
68
69/***/ 0:
70/***/ (function(module, exports) {
71
72/* globals __VUE_SSR_CONTEXT__ */
73
74// IMPORTANT: Do NOT use ES2015 features in this file.
75// This module is a runtime utility for cleaner component module output and will
76// be included in the final webpack user bundle.
77
78module.exports = function normalizeComponent (
79 rawScriptExports,
80 compiledTemplate,
81 functionalTemplate,
82 injectStyles,
83 scopeId,
84 moduleIdentifier /* server only */
85) {
86 var esModule
87 var scriptExports = rawScriptExports = rawScriptExports || {}
88
89 // ES6 modules interop
90 var type = typeof rawScriptExports.default
91 if (type === 'object' || type === 'function') {
92 esModule = rawScriptExports
93 scriptExports = rawScriptExports.default
94 }
95
96 // Vue.extend constructor export interop
97 var options = typeof scriptExports === 'function'
98 ? scriptExports.options
99 : scriptExports
100
101 // render functions
102 if (compiledTemplate) {
103 options.render = compiledTemplate.render
104 options.staticRenderFns = compiledTemplate.staticRenderFns
105 options._compiled = true
106 }
107
108 // functional template
109 if (functionalTemplate) {
110 options.functional = true
111 }
112
113 // scopedId
114 if (scopeId) {
115 options._scopeId = scopeId
116 }
117
118 var hook
119 if (moduleIdentifier) { // server build
120 hook = function (context) {
121 // 2.3 injection
122 context =
123 context || // cached call
124 (this.$vnode && this.$vnode.ssrContext) || // stateful
125 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
126 // 2.2 with runInNewContext: true
127 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
128 context = __VUE_SSR_CONTEXT__
129 }
130 // inject component styles
131 if (injectStyles) {
132 injectStyles.call(this, context)
133 }
134 // register component module identifier for async chunk inferrence
135 if (context && context._registeredComponents) {
136 context._registeredComponents.add(moduleIdentifier)
137 }
138 }
139 // used by ssr in case component is cached and beforeCreate
140 // never gets called
141 options._ssrRegister = hook
142 } else if (injectStyles) {
143 hook = injectStyles
144 }
145
146 if (hook) {
147 var functional = options.functional
148 var existing = functional
149 ? options.render
150 : options.beforeCreate
151
152 if (!functional) {
153 // inject component registration as beforeCreate hook
154 options.beforeCreate = existing
155 ? [].concat(existing, hook)
156 : [hook]
157 } else {
158 // for template-only hot-reload because in that case the render fn doesn't
159 // go through the normalizer
160 options._injectStyles = hook
161 // register for functioal component in vue file
162 options.render = function renderWithStyleInjection (h, context) {
163 hook.call(context)
164 return existing(h, context)
165 }
166 }
167 }
168
169 return {
170 esModule: esModule,
171 exports: scriptExports,
172 options: options
173 }
174}
175
176
177/***/ }),
178
179/***/ 134:
180/***/ (function(module, exports, __webpack_require__) {
181
182"use strict";
183
184
185exports.__esModule = true;
186
187var _component = __webpack_require__(135);
188
189var _component2 = _interopRequireDefault(_component);
190
191function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
192
193/* istanbul ignore next */
194_component2.default.install = function (Vue) {
195 Vue.component(_component2.default.name, _component2.default);
196};
197
198exports.default = _component2.default;
199
200/***/ }),
201
202/***/ 135:
203/***/ (function(module, __webpack_exports__, __webpack_require__) {
204
205"use strict";
206Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_component_vue__ = __webpack_require__(136);
208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_component_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_component_vue__);
209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_80721fd0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_component_vue__ = __webpack_require__(137);
210var normalizeComponent = __webpack_require__(0)
211/* script */
212
213/* template */
214
215/* template functional */
216 var __vue_template_functional__ = false
217/* styles */
218var __vue_styles__ = null
219/* scopeId */
220var __vue_scopeId__ = null
221/* moduleIdentifier (server only) */
222var __vue_module_identifier__ = null
223var Component = normalizeComponent(
224 __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_component_vue___default.a,
225 __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_80721fd0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_component_vue__["a" /* default */],
226 __vue_template_functional__,
227 __vue_styles__,
228 __vue_scopeId__,
229 __vue_module_identifier__
230)
231
232/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
233
234
235/***/ }),
236
237/***/ 136:
238/***/ (function(module, exports, __webpack_require__) {
239
240"use strict";
241
242
243exports.__esModule = true;
244
245var _focus = __webpack_require__(19);
246
247var _focus2 = _interopRequireDefault(_focus);
248
249var _migrating = __webpack_require__(8);
250
251var _migrating2 = _interopRequireDefault(_migrating);
252
253function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
254
255//
256//
257//
258//
259//
260//
261//
262//
263//
264//
265//
266//
267//
268//
269//
270//
271//
272//
273//
274//
275//
276//
277//
278//
279//
280//
281//
282//
283//
284//
285//
286//
287//
288//
289//
290//
291//
292
293exports.default = {
294 name: 'ElSwitch',
295 mixins: [(0, _focus2.default)('input'), _migrating2.default],
296 inject: {
297 elForm: {
298 default: ''
299 }
300 },
301 props: {
302 value: {
303 type: [Boolean, String, Number],
304 default: false
305 },
306 disabled: {
307 type: Boolean,
308 default: false
309 },
310 width: {
311 type: Number,
312 default: 40
313 },
314 activeIconClass: {
315 type: String,
316 default: ''
317 },
318 inactiveIconClass: {
319 type: String,
320 default: ''
321 },
322 activeText: String,
323 inactiveText: String,
324 activeColor: {
325 type: String,
326 default: ''
327 },
328 inactiveColor: {
329 type: String,
330 default: ''
331 },
332 activeValue: {
333 type: [Boolean, String, Number],
334 default: true
335 },
336 inactiveValue: {
337 type: [Boolean, String, Number],
338 default: false
339 },
340 name: {
341 type: String,
342 default: ''
343 },
344 id: String
345 },
346 data: function data() {
347 return {
348 coreWidth: this.width
349 };
350 },
351 created: function created() {
352 if (!~[this.activeValue, this.inactiveValue].indexOf(this.value)) {
353 this.$emit('input', this.inactiveValue);
354 }
355 },
356
357 computed: {
358 checked: function checked() {
359 return this.value === this.activeValue;
360 },
361 switchDisabled: function switchDisabled() {
362 return this.disabled || (this.elForm || {}).disabled;
363 }
364 },
365 watch: {
366 checked: function checked() {
367 this.$refs.input.checked = this.checked;
368 if (this.activeColor || this.inactiveColor) {
369 this.setBackgroundColor();
370 }
371 }
372 },
373 methods: {
374 handleChange: function handleChange(event) {
375 var _this = this;
376
377 this.$emit('input', !this.checked ? this.activeValue : this.inactiveValue);
378 this.$emit('change', !this.checked ? this.activeValue : this.inactiveValue);
379 this.$nextTick(function () {
380 // set input's checked property
381 // in case parent refuses to change component's value
382 _this.$refs.input.checked = _this.checked;
383 });
384 },
385 setBackgroundColor: function setBackgroundColor() {
386 var newColor = this.checked ? this.activeColor : this.inactiveColor;
387 this.$refs.core.style.borderColor = newColor;
388 this.$refs.core.style.backgroundColor = newColor;
389 },
390 switchValue: function switchValue() {
391 !this.switchDisabled && this.handleChange();
392 },
393 getMigratingConfig: function getMigratingConfig() {
394 return {
395 props: {
396 'on-color': 'on-color is renamed to active-color.',
397 'off-color': 'off-color is renamed to inactive-color.',
398 'on-text': 'on-text is renamed to active-text.',
399 'off-text': 'off-text is renamed to inactive-text.',
400 'on-value': 'on-value is renamed to active-value.',
401 'off-value': 'off-value is renamed to inactive-value.',
402 'on-icon-class': 'on-icon-class is renamed to active-icon-class.',
403 'off-icon-class': 'off-icon-class is renamed to inactive-icon-class.'
404 }
405 };
406 }
407 },
408 mounted: function mounted() {
409 /* istanbul ignore if */
410 this.coreWidth = this.width || 40;
411 if (this.activeColor || this.inactiveColor) {
412 this.setBackgroundColor();
413 }
414 this.$refs.input.checked = this.checked;
415 }
416};
417
418/***/ }),
419
420/***/ 137:
421/***/ (function(module, __webpack_exports__, __webpack_require__) {
422
423"use strict";
424var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-switch",class:{ 'is-disabled': _vm.switchDisabled, 'is-checked': _vm.checked },attrs:{"role":"switch","aria-checked":_vm.checked,"aria-disabled":_vm.switchDisabled},on:{"click":_vm.switchValue}},[_c('input',{ref:"input",staticClass:"el-switch__input",attrs:{"type":"checkbox","id":_vm.id,"name":_vm.name,"true-value":_vm.activeValue,"false-value":_vm.inactiveValue,"disabled":_vm.switchDisabled},on:{"change":_vm.handleChange,"keydown":function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"enter",13,$event.key)){ return null; }_vm.switchValue($event)}}}),(_vm.inactiveIconClass || _vm.inactiveText)?_c('span',{class:['el-switch__label', 'el-switch__label--left', !_vm.checked ? 'is-active' : '']},[(_vm.inactiveIconClass)?_c('i',{class:[_vm.inactiveIconClass]}):_vm._e(),(!_vm.inactiveIconClass && _vm.inactiveText)?_c('span',{attrs:{"aria-hidden":_vm.checked}},[_vm._v(_vm._s(_vm.inactiveText))]):_vm._e()]):_vm._e(),_c('span',{ref:"core",staticClass:"el-switch__core",style:({ 'width': _vm.coreWidth + 'px' })}),(_vm.activeIconClass || _vm.activeText)?_c('span',{class:['el-switch__label', 'el-switch__label--right', _vm.checked ? 'is-active' : '']},[(_vm.activeIconClass)?_c('i',{class:[_vm.activeIconClass]}):_vm._e(),(!_vm.activeIconClass && _vm.activeText)?_c('span',{attrs:{"aria-hidden":!_vm.checked}},[_vm._v(_vm._s(_vm.activeText))]):_vm._e()]):_vm._e()])}
425var staticRenderFns = []
426var esExports = { render: render, staticRenderFns: staticRenderFns }
427/* harmony default export */ __webpack_exports__["a"] = (esExports);
428
429/***/ }),
430
431/***/ 19:
432/***/ (function(module, exports) {
433
434module.exports = require("element-ui/lib/mixins/focus");
435
436/***/ }),
437
438/***/ 8:
439/***/ (function(module, exports) {
440
441module.exports = require("element-ui/lib/mixins/migrating");
442
443/***/ })
444
445/******/ });
\No newline at end of file