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, {
|
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 |
|
58 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
59 |
|
60 |
|
61 | __webpack_require__.p = "/dist/";
|
62 |
|
63 |
|
64 | return __webpack_require__(__webpack_require__.s = 359);
|
65 | })
|
66 |
|
67 | ({
|
68 |
|
69 | 0:
|
70 | (function(module, exports) {
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | module.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 |
|
90 | var type = typeof rawScriptExports.default
|
91 | if (type === 'object' || type === 'function') {
|
92 | esModule = rawScriptExports
|
93 | scriptExports = rawScriptExports.default
|
94 | }
|
95 |
|
96 |
|
97 | var options = typeof scriptExports === 'function'
|
98 | ? scriptExports.options
|
99 | : scriptExports
|
100 |
|
101 |
|
102 | if (compiledTemplate) {
|
103 | options.render = compiledTemplate.render
|
104 | options.staticRenderFns = compiledTemplate.staticRenderFns
|
105 | options._compiled = true
|
106 | }
|
107 |
|
108 |
|
109 | if (functionalTemplate) {
|
110 | options.functional = true
|
111 | }
|
112 |
|
113 |
|
114 | if (scopeId) {
|
115 | options._scopeId = scopeId
|
116 | }
|
117 |
|
118 | var hook
|
119 | if (moduleIdentifier) {
|
120 | hook = function (context) {
|
121 |
|
122 | context =
|
123 | context ||
|
124 | (this.$vnode && this.$vnode.ssrContext) ||
|
125 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
126 |
|
127 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
128 | context = __VUE_SSR_CONTEXT__
|
129 | }
|
130 |
|
131 | if (injectStyles) {
|
132 | injectStyles.call(this, context)
|
133 | }
|
134 |
|
135 | if (context && context._registeredComponents) {
|
136 | context._registeredComponents.add(moduleIdentifier)
|
137 | }
|
138 | }
|
139 |
|
140 |
|
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 |
|
154 | options.beforeCreate = existing
|
155 | ? [].concat(existing, hook)
|
156 | : [hook]
|
157 | } else {
|
158 |
|
159 |
|
160 | options._injectStyles = hook
|
161 |
|
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 | 10:
|
180 | (function(module, exports) {
|
181 |
|
182 | module.exports = require("element-ui/lib/utils/clickoutside");
|
183 |
|
184 | }),
|
185 |
|
186 | 15:
|
187 | (function(module, exports) {
|
188 |
|
189 | module.exports = require("element-ui/lib/button");
|
190 |
|
191 | }),
|
192 |
|
193 | 359:
|
194 | (function(module, exports, __webpack_require__) {
|
195 |
|
196 | "use strict";
|
197 |
|
198 |
|
199 | exports.__esModule = true;
|
200 |
|
201 | var _main = __webpack_require__(360);
|
202 |
|
203 | var _main2 = _interopRequireDefault(_main);
|
204 |
|
205 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
206 |
|
207 |
|
208 | _main2.default.install = function (Vue) {
|
209 | Vue.component(_main2.default.name, _main2.default);
|
210 | };
|
211 |
|
212 | exports.default = _main2.default;
|
213 |
|
214 | }),
|
215 |
|
216 | 360:
|
217 | (function(module, __webpack_exports__, __webpack_require__) {
|
218 |
|
219 | "use strict";
|
220 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
221 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(361);
|
222 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__);
|
223 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_02fb592a_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(377);
|
224 | var normalizeComponent = __webpack_require__(0)
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 | var __vue_template_functional__ = false
|
231 |
|
232 | var __vue_styles__ = null
|
233 |
|
234 | var __vue_scopeId__ = null
|
235 |
|
236 | var __vue_module_identifier__ = null
|
237 | var Component = normalizeComponent(
|
238 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a,
|
239 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_02fb592a_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" ],
|
240 | __vue_template_functional__,
|
241 | __vue_styles__,
|
242 | __vue_scopeId__,
|
243 | __vue_module_identifier__
|
244 | )
|
245 |
|
246 | __webpack_exports__["default"] = (Component.exports);
|
247 |
|
248 |
|
249 | }),
|
250 |
|
251 | 361:
|
252 | (function(module, exports, __webpack_require__) {
|
253 |
|
254 | "use strict";
|
255 |
|
256 |
|
257 | exports.__esModule = true;
|
258 |
|
259 | var _color = __webpack_require__(53);
|
260 |
|
261 | var _color2 = _interopRequireDefault(_color);
|
262 |
|
263 | var _pickerDropdown = __webpack_require__(362);
|
264 |
|
265 | var _pickerDropdown2 = _interopRequireDefault(_pickerDropdown);
|
266 |
|
267 | var _clickoutside = __webpack_require__(10);
|
268 |
|
269 | var _clickoutside2 = _interopRequireDefault(_clickoutside);
|
270 |
|
271 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
272 |
|
273 | exports.default = {
|
274 | name: 'ElColorPicker',
|
275 |
|
276 | props: {
|
277 | value: String,
|
278 | showAlpha: Boolean,
|
279 | colorFormat: String,
|
280 | disabled: Boolean,
|
281 | size: String,
|
282 | popperClass: String,
|
283 | predefine: Array
|
284 | },
|
285 |
|
286 | inject: {
|
287 | elForm: {
|
288 | default: ''
|
289 | },
|
290 | elFormItem: {
|
291 | default: ''
|
292 | }
|
293 | },
|
294 |
|
295 | directives: { Clickoutside: _clickoutside2.default },
|
296 |
|
297 | computed: {
|
298 | displayedColor: function displayedColor() {
|
299 | if (!this.value && !this.showPanelColor) {
|
300 | return 'transparent';
|
301 | }
|
302 |
|
303 | return this.displayedRgb(this.color, this.showAlpha);
|
304 | },
|
305 | _elFormItemSize: function _elFormItemSize() {
|
306 | return (this.elFormItem || {}).elFormItemSize;
|
307 | },
|
308 | colorSize: function colorSize() {
|
309 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
310 | },
|
311 | colorDisabled: function colorDisabled() {
|
312 | return this.disabled || (this.elForm || {}).disabled;
|
313 | }
|
314 | },
|
315 |
|
316 | watch: {
|
317 | value: function value(val) {
|
318 | if (!val) {
|
319 | this.showPanelColor = false;
|
320 | } else if (val && val !== this.color.value) {
|
321 | this.color.fromString(val);
|
322 | }
|
323 | },
|
324 |
|
325 | color: {
|
326 | deep: true,
|
327 | handler: function handler() {
|
328 | this.showPanelColor = true;
|
329 | }
|
330 | },
|
331 | displayedColor: function displayedColor(val) {
|
332 | if (!this.showPicker) return;
|
333 | var currentValueColor = new _color2.default({
|
334 | enableAlpha: this.showAlpha,
|
335 | format: this.colorFormat
|
336 | });
|
337 | currentValueColor.fromString(this.value);
|
338 |
|
339 | var currentValueColorRgb = this.displayedRgb(currentValueColor, this.showAlpha);
|
340 | if (val !== currentValueColorRgb) {
|
341 | this.$emit('active-change', val);
|
342 | }
|
343 | }
|
344 | },
|
345 |
|
346 | methods: {
|
347 | handleTrigger: function handleTrigger() {
|
348 | if (this.colorDisabled) return;
|
349 | this.showPicker = !this.showPicker;
|
350 | },
|
351 | confirmValue: function confirmValue(value) {
|
352 | this.$emit('input', this.color.value);
|
353 | this.$emit('change', this.color.value);
|
354 | this.showPicker = false;
|
355 | },
|
356 | clearValue: function clearValue() {
|
357 | this.$emit('input', null);
|
358 | this.$emit('change', null);
|
359 | this.showPanelColor = false;
|
360 | this.showPicker = false;
|
361 | this.resetColor();
|
362 | },
|
363 | hide: function hide() {
|
364 | this.showPicker = false;
|
365 | this.resetColor();
|
366 | },
|
367 | resetColor: function resetColor() {
|
368 | var _this = this;
|
369 |
|
370 | this.$nextTick(function (_) {
|
371 | if (_this.value) {
|
372 | _this.color.fromString(_this.value);
|
373 | } else {
|
374 | _this.showPanelColor = false;
|
375 | }
|
376 | });
|
377 | },
|
378 | displayedRgb: function displayedRgb(color, showAlpha) {
|
379 | if (!(color instanceof _color2.default)) {
|
380 | throw Error('color should be instance of Color Class');
|
381 | }
|
382 |
|
383 | var _color$toRgb = color.toRgb(),
|
384 | r = _color$toRgb.r,
|
385 | g = _color$toRgb.g,
|
386 | b = _color$toRgb.b;
|
387 |
|
388 | return showAlpha ? 'rgba(' + r + ', ' + g + ', ' + b + ', ' + color.get('alpha') / 100 + ')' : 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
389 | }
|
390 | },
|
391 |
|
392 | mounted: function mounted() {
|
393 | var value = this.value;
|
394 | if (value) {
|
395 | this.color.fromString(value);
|
396 | }
|
397 | this.popperElm = this.$refs.dropdown.$el;
|
398 | },
|
399 | data: function data() {
|
400 | var color = new _color2.default({
|
401 | enableAlpha: this.showAlpha,
|
402 | format: this.colorFormat
|
403 | });
|
404 | return {
|
405 | color: color,
|
406 | showPicker: false,
|
407 | showPanelColor: false
|
408 | };
|
409 | },
|
410 |
|
411 |
|
412 | components: {
|
413 | PickerDropdown: _pickerDropdown2.default
|
414 | }
|
415 | };
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 | }),
|
449 |
|
450 | 362:
|
451 | (function(module, __webpack_exports__, __webpack_require__) {
|
452 |
|
453 | "use strict";
|
454 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
455 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_dropdown_vue__ = __webpack_require__(363);
|
456 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_dropdown_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_dropdown_vue__);
|
457 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_6e6b9d28_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_dropdown_vue__ = __webpack_require__(376);
|
458 | var normalizeComponent = __webpack_require__(0)
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | var __vue_template_functional__ = false
|
465 |
|
466 | var __vue_styles__ = null
|
467 |
|
468 | var __vue_scopeId__ = null
|
469 |
|
470 | var __vue_module_identifier__ = null
|
471 | var Component = normalizeComponent(
|
472 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_dropdown_vue___default.a,
|
473 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_6e6b9d28_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_dropdown_vue__["a" ],
|
474 | __vue_template_functional__,
|
475 | __vue_styles__,
|
476 | __vue_scopeId__,
|
477 | __vue_module_identifier__
|
478 | )
|
479 |
|
480 | __webpack_exports__["default"] = (Component.exports);
|
481 |
|
482 |
|
483 | }),
|
484 |
|
485 | 363:
|
486 | (function(module, exports, __webpack_require__) {
|
487 |
|
488 | "use strict";
|
489 |
|
490 |
|
491 | exports.__esModule = true;
|
492 |
|
493 | var _svPanel = __webpack_require__(364);
|
494 |
|
495 | var _svPanel2 = _interopRequireDefault(_svPanel);
|
496 |
|
497 | var _hueSlider = __webpack_require__(367);
|
498 |
|
499 | var _hueSlider2 = _interopRequireDefault(_hueSlider);
|
500 |
|
501 | var _alphaSlider = __webpack_require__(370);
|
502 |
|
503 | var _alphaSlider2 = _interopRequireDefault(_alphaSlider);
|
504 |
|
505 | var _predefine = __webpack_require__(373);
|
506 |
|
507 | var _predefine2 = _interopRequireDefault(_predefine);
|
508 |
|
509 | var _vuePopper = __webpack_require__(7);
|
510 |
|
511 | var _vuePopper2 = _interopRequireDefault(_vuePopper);
|
512 |
|
513 | var _locale = __webpack_require__(5);
|
514 |
|
515 | var _locale2 = _interopRequireDefault(_locale);
|
516 |
|
517 | var _input = __webpack_require__(6);
|
518 |
|
519 | var _input2 = _interopRequireDefault(_input);
|
520 |
|
521 | var _button = __webpack_require__(15);
|
522 |
|
523 | var _button2 = _interopRequireDefault(_button);
|
524 |
|
525 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | exports.default = {
|
568 | name: 'el-color-picker-dropdown',
|
569 |
|
570 | mixins: [_vuePopper2.default, _locale2.default],
|
571 |
|
572 | components: {
|
573 | SvPanel: _svPanel2.default,
|
574 | HueSlider: _hueSlider2.default,
|
575 | AlphaSlider: _alphaSlider2.default,
|
576 | ElInput: _input2.default,
|
577 | ElButton: _button2.default,
|
578 | Predefine: _predefine2.default
|
579 | },
|
580 |
|
581 | props: {
|
582 | color: {
|
583 | required: true
|
584 | },
|
585 | showAlpha: Boolean,
|
586 | predefine: Array
|
587 | },
|
588 |
|
589 | data: function data() {
|
590 | return {
|
591 | customInput: ''
|
592 | };
|
593 | },
|
594 |
|
595 |
|
596 | computed: {
|
597 | currentColor: function currentColor() {
|
598 | var parent = this.$parent;
|
599 | return !parent.value && !parent.showPanelColor ? '' : parent.color.value;
|
600 | }
|
601 | },
|
602 |
|
603 | methods: {
|
604 | confirmValue: function confirmValue() {
|
605 | this.$emit('pick');
|
606 | },
|
607 | handleConfirm: function handleConfirm() {
|
608 | this.color.fromString(this.customInput);
|
609 | }
|
610 | },
|
611 |
|
612 | mounted: function mounted() {
|
613 | this.$parent.popperElm = this.popperElm = this.$el;
|
614 | this.referenceElm = this.$parent.$el;
|
615 | },
|
616 |
|
617 |
|
618 | watch: {
|
619 | showPopper: function showPopper(val) {
|
620 | var _this = this;
|
621 |
|
622 | if (val === true) {
|
623 | this.$nextTick(function () {
|
624 | var _$refs = _this.$refs,
|
625 | sl = _$refs.sl,
|
626 | hue = _$refs.hue,
|
627 | alpha = _$refs.alpha;
|
628 |
|
629 | sl && sl.update();
|
630 | hue && hue.update();
|
631 | alpha && alpha.update();
|
632 | });
|
633 | }
|
634 | },
|
635 | currentColor: function currentColor(val) {
|
636 | this.customInput = val;
|
637 | }
|
638 | }
|
639 | };
|
640 |
|
641 | }),
|
642 |
|
643 | 364:
|
644 | (function(module, __webpack_exports__, __webpack_require__) {
|
645 |
|
646 | "use strict";
|
647 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
648 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_sv_panel_vue__ = __webpack_require__(365);
|
649 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_sv_panel_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_sv_panel_vue__);
|
650 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_14c2eb92_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_sv_panel_vue__ = __webpack_require__(366);
|
651 | var normalizeComponent = __webpack_require__(0)
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 | var __vue_template_functional__ = false
|
658 |
|
659 | var __vue_styles__ = null
|
660 |
|
661 | var __vue_scopeId__ = null
|
662 |
|
663 | var __vue_module_identifier__ = null
|
664 | var Component = normalizeComponent(
|
665 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_sv_panel_vue___default.a,
|
666 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_14c2eb92_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_sv_panel_vue__["a" ],
|
667 | __vue_template_functional__,
|
668 | __vue_styles__,
|
669 | __vue_scopeId__,
|
670 | __vue_module_identifier__
|
671 | )
|
672 |
|
673 | __webpack_exports__["default"] = (Component.exports);
|
674 |
|
675 |
|
676 | }),
|
677 |
|
678 | 365:
|
679 | (function(module, exports, __webpack_require__) {
|
680 |
|
681 | "use strict";
|
682 |
|
683 |
|
684 | exports.__esModule = true;
|
685 |
|
686 | var _draggable = __webpack_require__(46);
|
687 |
|
688 | var _draggable2 = _interopRequireDefault(_draggable);
|
689 |
|
690 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
691 |
|
692 | exports.default = {
|
693 | name: 'el-sl-panel',
|
694 |
|
695 | props: {
|
696 | color: {
|
697 | required: true
|
698 | }
|
699 | },
|
700 |
|
701 | computed: {
|
702 | colorValue: function colorValue() {
|
703 | var hue = this.color.get('hue');
|
704 | var value = this.color.get('value');
|
705 | return { hue: hue, value: value };
|
706 | }
|
707 | },
|
708 |
|
709 | watch: {
|
710 | colorValue: function colorValue() {
|
711 | this.update();
|
712 | }
|
713 | },
|
714 |
|
715 | methods: {
|
716 | update: function update() {
|
717 | var saturation = this.color.get('saturation');
|
718 | var value = this.color.get('value');
|
719 |
|
720 | var el = this.$el;
|
721 | var width = el.clientWidth,
|
722 | height = el.clientHeight;
|
723 |
|
724 |
|
725 | this.cursorLeft = saturation * width / 100;
|
726 | this.cursorTop = (100 - value) * height / 100;
|
727 |
|
728 | this.background = 'hsl(' + this.color.get('hue') + ', 100%, 50%)';
|
729 | },
|
730 | handleDrag: function handleDrag(event) {
|
731 | var el = this.$el;
|
732 | var rect = el.getBoundingClientRect();
|
733 |
|
734 | var left = event.clientX - rect.left;
|
735 | var top = event.clientY - rect.top;
|
736 | left = Math.max(0, left);
|
737 | left = Math.min(left, rect.width);
|
738 |
|
739 | top = Math.max(0, top);
|
740 | top = Math.min(top, rect.height);
|
741 |
|
742 | this.cursorLeft = left;
|
743 | this.cursorTop = top;
|
744 | this.color.set({
|
745 | saturation: left / rect.width * 100,
|
746 | value: 100 - top / rect.height * 100
|
747 | });
|
748 | }
|
749 | },
|
750 |
|
751 | mounted: function mounted() {
|
752 | var _this = this;
|
753 |
|
754 | (0, _draggable2.default)(this.$el, {
|
755 | drag: function drag(event) {
|
756 | _this.handleDrag(event);
|
757 | },
|
758 | end: function end(event) {
|
759 | _this.handleDrag(event);
|
760 | }
|
761 | });
|
762 |
|
763 | this.update();
|
764 | },
|
765 | data: function data() {
|
766 | return {
|
767 | cursorTop: 0,
|
768 | cursorLeft: 0,
|
769 | background: 'hsl(0, 100%, 50%)'
|
770 | };
|
771 | }
|
772 | };
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 | }),
|
791 |
|
792 | 366:
|
793 | (function(module, __webpack_exports__, __webpack_require__) {
|
794 |
|
795 | "use strict";
|
796 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-color-svpanel",style:({
|
797 | backgroundColor: _vm.background
|
798 | })},[_c('div',{staticClass:"el-color-svpanel__white"}),_c('div',{staticClass:"el-color-svpanel__black"}),_c('div',{staticClass:"el-color-svpanel__cursor",style:({
|
799 | top: _vm.cursorTop + 'px',
|
800 | left: _vm.cursorLeft + 'px'
|
801 | })},[_c('div')])])}
|
802 | var staticRenderFns = []
|
803 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
804 | __webpack_exports__["a"] = (esExports);
|
805 |
|
806 | }),
|
807 |
|
808 | 367:
|
809 | (function(module, __webpack_exports__, __webpack_require__) {
|
810 |
|
811 | "use strict";
|
812 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
813 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_hue_slider_vue__ = __webpack_require__(368);
|
814 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_hue_slider_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_hue_slider_vue__);
|
815 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5e2326ce_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_hue_slider_vue__ = __webpack_require__(369);
|
816 | var normalizeComponent = __webpack_require__(0)
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 | var __vue_template_functional__ = false
|
823 |
|
824 | var __vue_styles__ = null
|
825 |
|
826 | var __vue_scopeId__ = null
|
827 |
|
828 | var __vue_module_identifier__ = null
|
829 | var Component = normalizeComponent(
|
830 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_hue_slider_vue___default.a,
|
831 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5e2326ce_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_hue_slider_vue__["a" ],
|
832 | __vue_template_functional__,
|
833 | __vue_styles__,
|
834 | __vue_scopeId__,
|
835 | __vue_module_identifier__
|
836 | )
|
837 |
|
838 | __webpack_exports__["default"] = (Component.exports);
|
839 |
|
840 |
|
841 | }),
|
842 |
|
843 | 368:
|
844 | (function(module, exports, __webpack_require__) {
|
845 |
|
846 | "use strict";
|
847 |
|
848 |
|
849 | exports.__esModule = true;
|
850 |
|
851 | var _draggable = __webpack_require__(46);
|
852 |
|
853 | var _draggable2 = _interopRequireDefault(_draggable);
|
854 |
|
855 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
856 |
|
857 | exports.default = {
|
858 | name: 'el-color-hue-slider',
|
859 |
|
860 | props: {
|
861 | color: {
|
862 | required: true
|
863 | },
|
864 |
|
865 | vertical: Boolean
|
866 | },
|
867 |
|
868 | data: function data() {
|
869 | return {
|
870 | thumbLeft: 0,
|
871 | thumbTop: 0
|
872 | };
|
873 | },
|
874 |
|
875 |
|
876 | computed: {
|
877 | hueValue: function hueValue() {
|
878 | var hue = this.color.get('hue');
|
879 | return hue;
|
880 | }
|
881 | },
|
882 |
|
883 | watch: {
|
884 | hueValue: function hueValue() {
|
885 | this.update();
|
886 | }
|
887 | },
|
888 |
|
889 | methods: {
|
890 | handleClick: function handleClick(event) {
|
891 | var thumb = this.$refs.thumb;
|
892 | var target = event.target;
|
893 |
|
894 | if (target !== thumb) {
|
895 | this.handleDrag(event);
|
896 | }
|
897 | },
|
898 | handleDrag: function handleDrag(event) {
|
899 | var rect = this.$el.getBoundingClientRect();
|
900 | var thumb = this.$refs.thumb;
|
901 |
|
902 | var hue = void 0;
|
903 |
|
904 | if (!this.vertical) {
|
905 | var left = event.clientX - rect.left;
|
906 | left = Math.min(left, rect.width - thumb.offsetWidth / 2);
|
907 | left = Math.max(thumb.offsetWidth / 2, left);
|
908 |
|
909 | hue = Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 360);
|
910 | } else {
|
911 | var top = event.clientY - rect.top;
|
912 | top = Math.min(top, rect.height - thumb.offsetHeight / 2);
|
913 | top = Math.max(thumb.offsetHeight / 2, top);
|
914 |
|
915 | hue = Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 360);
|
916 | }
|
917 |
|
918 | this.color.set('hue', hue);
|
919 | },
|
920 | getThumbLeft: function getThumbLeft() {
|
921 | if (this.vertical) return 0;
|
922 | var el = this.$el;
|
923 | var hue = this.color.get('hue');
|
924 |
|
925 | if (!el) return 0;
|
926 | var thumb = this.$refs.thumb;
|
927 | return Math.round(hue * (el.offsetWidth - thumb.offsetWidth / 2) / 360);
|
928 | },
|
929 | getThumbTop: function getThumbTop() {
|
930 | if (!this.vertical) return 0;
|
931 | var el = this.$el;
|
932 | var hue = this.color.get('hue');
|
933 |
|
934 | if (!el) return 0;
|
935 | var thumb = this.$refs.thumb;
|
936 | return Math.round(hue * (el.offsetHeight - thumb.offsetHeight / 2) / 360);
|
937 | },
|
938 | update: function update() {
|
939 | this.thumbLeft = this.getThumbLeft();
|
940 | this.thumbTop = this.getThumbTop();
|
941 | }
|
942 | },
|
943 |
|
944 | mounted: function mounted() {
|
945 | var _this = this;
|
946 |
|
947 | var _$refs = this.$refs,
|
948 | bar = _$refs.bar,
|
949 | thumb = _$refs.thumb;
|
950 |
|
951 |
|
952 | var dragConfig = {
|
953 | drag: function drag(event) {
|
954 | _this.handleDrag(event);
|
955 | },
|
956 | end: function end(event) {
|
957 | _this.handleDrag(event);
|
958 | }
|
959 | };
|
960 |
|
961 | (0, _draggable2.default)(bar, dragConfig);
|
962 | (0, _draggable2.default)(thumb, dragConfig);
|
963 | this.update();
|
964 | }
|
965 | };
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | }),
|
980 |
|
981 | 369:
|
982 | (function(module, __webpack_exports__, __webpack_require__) {
|
983 |
|
984 | "use strict";
|
985 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-color-hue-slider",class:{ 'is-vertical': _vm.vertical }},[_c('div',{ref:"bar",staticClass:"el-color-hue-slider__bar",on:{"click":_vm.handleClick}}),_c('div',{ref:"thumb",staticClass:"el-color-hue-slider__thumb",style:({
|
986 | left: _vm.thumbLeft + 'px',
|
987 | top: _vm.thumbTop + 'px'
|
988 | })})])}
|
989 | var staticRenderFns = []
|
990 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
991 | __webpack_exports__["a"] = (esExports);
|
992 |
|
993 | }),
|
994 |
|
995 | 370:
|
996 | (function(module, __webpack_exports__, __webpack_require__) {
|
997 |
|
998 | "use strict";
|
999 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1000 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_alpha_slider_vue__ = __webpack_require__(371);
|
1001 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_alpha_slider_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_alpha_slider_vue__);
|
1002 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5cb212b0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_alpha_slider_vue__ = __webpack_require__(372);
|
1003 | var normalizeComponent = __webpack_require__(0)
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 | var __vue_template_functional__ = false
|
1010 |
|
1011 | var __vue_styles__ = null
|
1012 |
|
1013 | var __vue_scopeId__ = null
|
1014 |
|
1015 | var __vue_module_identifier__ = null
|
1016 | var Component = normalizeComponent(
|
1017 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_alpha_slider_vue___default.a,
|
1018 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5cb212b0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_alpha_slider_vue__["a" ],
|
1019 | __vue_template_functional__,
|
1020 | __vue_styles__,
|
1021 | __vue_scopeId__,
|
1022 | __vue_module_identifier__
|
1023 | )
|
1024 |
|
1025 | __webpack_exports__["default"] = (Component.exports);
|
1026 |
|
1027 |
|
1028 | }),
|
1029 |
|
1030 | 371:
|
1031 | (function(module, exports, __webpack_require__) {
|
1032 |
|
1033 | "use strict";
|
1034 |
|
1035 |
|
1036 | exports.__esModule = true;
|
1037 |
|
1038 | var _draggable = __webpack_require__(46);
|
1039 |
|
1040 | var _draggable2 = _interopRequireDefault(_draggable);
|
1041 |
|
1042 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1043 |
|
1044 | exports.default = {
|
1045 | name: 'el-color-alpha-slider',
|
1046 |
|
1047 | props: {
|
1048 | color: {
|
1049 | required: true
|
1050 | },
|
1051 | vertical: Boolean
|
1052 | },
|
1053 |
|
1054 | watch: {
|
1055 | 'color._alpha': function color_alpha() {
|
1056 | this.update();
|
1057 | },
|
1058 | 'color.value': function colorValue() {
|
1059 | this.update();
|
1060 | }
|
1061 | },
|
1062 |
|
1063 | methods: {
|
1064 | handleClick: function handleClick(event) {
|
1065 | var thumb = this.$refs.thumb;
|
1066 | var target = event.target;
|
1067 |
|
1068 | if (target !== thumb) {
|
1069 | this.handleDrag(event);
|
1070 | }
|
1071 | },
|
1072 | handleDrag: function handleDrag(event) {
|
1073 | var rect = this.$el.getBoundingClientRect();
|
1074 | var thumb = this.$refs.thumb;
|
1075 |
|
1076 |
|
1077 | if (!this.vertical) {
|
1078 | var left = event.clientX - rect.left;
|
1079 | left = Math.max(thumb.offsetWidth / 2, left);
|
1080 | left = Math.min(left, rect.width - thumb.offsetWidth / 2);
|
1081 |
|
1082 | this.color.set('alpha', Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 100));
|
1083 | } else {
|
1084 | var top = event.clientY - rect.top;
|
1085 | top = Math.max(thumb.offsetHeight / 2, top);
|
1086 | top = Math.min(top, rect.height - thumb.offsetHeight / 2);
|
1087 |
|
1088 | this.color.set('alpha', Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 100));
|
1089 | }
|
1090 | },
|
1091 | getThumbLeft: function getThumbLeft() {
|
1092 | if (this.vertical) return 0;
|
1093 | var el = this.$el;
|
1094 | var alpha = this.color._alpha;
|
1095 |
|
1096 | if (!el) return 0;
|
1097 | var thumb = this.$refs.thumb;
|
1098 | return Math.round(alpha * (el.offsetWidth - thumb.offsetWidth / 2) / 100);
|
1099 | },
|
1100 | getThumbTop: function getThumbTop() {
|
1101 | if (!this.vertical) return 0;
|
1102 | var el = this.$el;
|
1103 | var alpha = this.color._alpha;
|
1104 |
|
1105 | if (!el) return 0;
|
1106 | var thumb = this.$refs.thumb;
|
1107 | return Math.round(alpha * (el.offsetHeight - thumb.offsetHeight / 2) / 100);
|
1108 | },
|
1109 | getBackground: function getBackground() {
|
1110 | if (this.color && this.color.value) {
|
1111 | var _color$toRgb = this.color.toRgb(),
|
1112 | r = _color$toRgb.r,
|
1113 | g = _color$toRgb.g,
|
1114 | b = _color$toRgb.b;
|
1115 |
|
1116 | return 'linear-gradient(to right, rgba(' + r + ', ' + g + ', ' + b + ', 0) 0%, rgba(' + r + ', ' + g + ', ' + b + ', 1) 100%)';
|
1117 | }
|
1118 | return null;
|
1119 | },
|
1120 | update: function update() {
|
1121 | this.thumbLeft = this.getThumbLeft();
|
1122 | this.thumbTop = this.getThumbTop();
|
1123 | this.background = this.getBackground();
|
1124 | }
|
1125 | },
|
1126 |
|
1127 | data: function data() {
|
1128 | return {
|
1129 | thumbLeft: 0,
|
1130 | thumbTop: 0,
|
1131 | background: null
|
1132 | };
|
1133 | },
|
1134 | mounted: function mounted() {
|
1135 | var _this = this;
|
1136 |
|
1137 | var _$refs = this.$refs,
|
1138 | bar = _$refs.bar,
|
1139 | thumb = _$refs.thumb;
|
1140 |
|
1141 |
|
1142 | var dragConfig = {
|
1143 | drag: function drag(event) {
|
1144 | _this.handleDrag(event);
|
1145 | },
|
1146 | end: function end(event) {
|
1147 | _this.handleDrag(event);
|
1148 | }
|
1149 | };
|
1150 |
|
1151 | (0, _draggable2.default)(bar, dragConfig);
|
1152 | (0, _draggable2.default)(thumb, dragConfig);
|
1153 | this.update();
|
1154 | }
|
1155 | };
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | }),
|
1176 |
|
1177 | 372:
|
1178 | (function(module, __webpack_exports__, __webpack_require__) {
|
1179 |
|
1180 | "use strict";
|
1181 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-color-alpha-slider",class:{ 'is-vertical': _vm.vertical }},[_c('div',{ref:"bar",staticClass:"el-color-alpha-slider__bar",style:({
|
1182 | background: _vm.background
|
1183 | }),on:{"click":_vm.handleClick}}),_c('div',{ref:"thumb",staticClass:"el-color-alpha-slider__thumb",style:({
|
1184 | left: _vm.thumbLeft + 'px',
|
1185 | top: _vm.thumbTop + 'px'
|
1186 | })})])}
|
1187 | var staticRenderFns = []
|
1188 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
1189 | __webpack_exports__["a"] = (esExports);
|
1190 |
|
1191 | }),
|
1192 |
|
1193 | 373:
|
1194 | (function(module, __webpack_exports__, __webpack_require__) {
|
1195 |
|
1196 | "use strict";
|
1197 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1198 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_predefine_vue__ = __webpack_require__(374);
|
1199 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_predefine_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_predefine_vue__);
|
1200 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_b85c1454_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_predefine_vue__ = __webpack_require__(375);
|
1201 | var normalizeComponent = __webpack_require__(0)
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 | var __vue_template_functional__ = false
|
1208 |
|
1209 | var __vue_styles__ = null
|
1210 |
|
1211 | var __vue_scopeId__ = null
|
1212 |
|
1213 | var __vue_module_identifier__ = null
|
1214 | var Component = normalizeComponent(
|
1215 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_predefine_vue___default.a,
|
1216 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_b85c1454_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_predefine_vue__["a" ],
|
1217 | __vue_template_functional__,
|
1218 | __vue_styles__,
|
1219 | __vue_scopeId__,
|
1220 | __vue_module_identifier__
|
1221 | )
|
1222 |
|
1223 | __webpack_exports__["default"] = (Component.exports);
|
1224 |
|
1225 |
|
1226 | }),
|
1227 |
|
1228 | 374:
|
1229 | (function(module, exports, __webpack_require__) {
|
1230 |
|
1231 | "use strict";
|
1232 |
|
1233 |
|
1234 | exports.__esModule = true;
|
1235 |
|
1236 | var _color = __webpack_require__(53);
|
1237 |
|
1238 | var _color2 = _interopRequireDefault(_color);
|
1239 |
|
1240 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1241 |
|
1242 | exports.default = {
|
1243 | props: {
|
1244 | colors: { type: Array, required: true },
|
1245 | color: { required: true }
|
1246 | },
|
1247 | data: function data() {
|
1248 | return {
|
1249 | rgbaColors: this.parseColors(this.colors, this.color)
|
1250 | };
|
1251 | },
|
1252 |
|
1253 | methods: {
|
1254 | handleSelect: function handleSelect(index) {
|
1255 | this.color.fromString(this.colors[index]);
|
1256 | },
|
1257 | parseColors: function parseColors(colors, color) {
|
1258 | return colors.map(function (value) {
|
1259 | var c = new _color2.default();
|
1260 | c.enableAlpha = true;
|
1261 | c.format = 'rgba';
|
1262 | c.fromString(value);
|
1263 | c.selected = c.value === color.value;
|
1264 | return c;
|
1265 | });
|
1266 | }
|
1267 | },
|
1268 | watch: {
|
1269 | '$parent.currentColor': function $parentCurrentColor(val) {
|
1270 | var color = new _color2.default();
|
1271 | color.fromString(val);
|
1272 |
|
1273 | this.rgbaColors.forEach(function (item) {
|
1274 | item.selected = color.compare(item);
|
1275 | });
|
1276 | },
|
1277 | colors: function colors(newVal) {
|
1278 | this.rgbaColors = this.parseColors(newVal, this.color);
|
1279 | },
|
1280 | color: function color(newVal) {
|
1281 | this.rgbaColors = this.parseColors(this.colors, newVal);
|
1282 | }
|
1283 | }
|
1284 | };
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 | }),
|
1301 |
|
1302 | 375:
|
1303 | (function(module, __webpack_exports__, __webpack_require__) {
|
1304 |
|
1305 | "use strict";
|
1306 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-color-predefine"},[_c('div',{staticClass:"el-color-predefine__colors"},_vm._l((_vm.rgbaColors),function(item,index){return _c('div',{key:_vm.colors[index],staticClass:"el-color-predefine__color-selector",class:{selected: item.selected, 'is-alpha': item._alpha < 100},on:{"click":function($event){_vm.handleSelect(index)}}},[_c('div',{style:({'background-color': item.value})})])}))])}
|
1307 | var staticRenderFns = []
|
1308 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
1309 | __webpack_exports__["a"] = (esExports);
|
1310 |
|
1311 | }),
|
1312 |
|
1313 | 376:
|
1314 | (function(module, __webpack_exports__, __webpack_require__) {
|
1315 |
|
1316 | "use strict";
|
1317 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"el-zoom-in-top"},on:{"after-leave":_vm.doDestroy}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPopper),expression:"showPopper"}],staticClass:"el-color-dropdown"},[_c('div',{staticClass:"el-color-dropdown__main-wrapper"},[_c('hue-slider',{ref:"hue",staticStyle:{"float":"right"},attrs:{"color":_vm.color,"vertical":""}}),_c('sv-panel',{ref:"sl",attrs:{"color":_vm.color}})],1),(_vm.showAlpha)?_c('alpha-slider',{ref:"alpha",attrs:{"color":_vm.color}}):_vm._e(),(_vm.predefine)?_c('predefine',{attrs:{"color":_vm.color,"colors":_vm.predefine}}):_vm._e(),_c('div',{staticClass:"el-color-dropdown__btns"},[_c('span',{staticClass:"el-color-dropdown__value"},[_c('el-input',{attrs:{"size":"mini"},on:{"blur":_vm.handleConfirm},nativeOn:{"keyup":function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"enter",13,$event.key)){ return null; }_vm.handleConfirm($event)}},model:{value:(_vm.customInput),callback:function ($$v) {_vm.customInput=$$v},expression:"customInput"}})],1),_c('el-button',{staticClass:"el-color-dropdown__link-btn",attrs:{"size":"mini","type":"text"},on:{"click":function($event){_vm.$emit('clear')}}},[_vm._v("\n "+_vm._s(_vm.t('el.colorpicker.clear'))+"\n ")]),_c('el-button',{staticClass:"el-color-dropdown__btn",attrs:{"plain":"","size":"mini"},on:{"click":_vm.confirmValue}},[_vm._v("\n "+_vm._s(_vm.t('el.colorpicker.confirm'))+"\n ")])],1)],1)])}
|
1318 | var staticRenderFns = []
|
1319 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
1320 | __webpack_exports__["a"] = (esExports);
|
1321 |
|
1322 | }),
|
1323 |
|
1324 | 377:
|
1325 | (function(module, __webpack_exports__, __webpack_require__) {
|
1326 |
|
1327 | "use strict";
|
1328 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:(_vm.hide),expression:"hide"}],class:[
|
1329 | 'el-color-picker',
|
1330 | _vm.colorDisabled ? 'is-disabled' : '',
|
1331 | _vm.colorSize ? ("el-color-picker--" + _vm.colorSize) : ''
|
1332 | ]},[(_vm.colorDisabled)?_c('div',{staticClass:"el-color-picker__mask"}):_vm._e(),_c('div',{staticClass:"el-color-picker__trigger",on:{"click":_vm.handleTrigger}},[_c('span',{staticClass:"el-color-picker__color",class:{ 'is-alpha': _vm.showAlpha }},[_c('span',{staticClass:"el-color-picker__color-inner",style:({
|
1333 | backgroundColor: _vm.displayedColor
|
1334 | })}),(!_vm.value && !_vm.showPanelColor)?_c('span',{staticClass:"el-color-picker__empty el-icon-close"}):_vm._e()]),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.value || _vm.showPanelColor),expression:"value || showPanelColor"}],staticClass:"el-color-picker__icon el-icon-arrow-down"})]),_c('picker-dropdown',{ref:"dropdown",class:['el-color-picker__panel', _vm.popperClass || ''],attrs:{"color":_vm.color,"show-alpha":_vm.showAlpha,"predefine":_vm.predefine},on:{"pick":_vm.confirmValue,"clear":_vm.clearValue},model:{value:(_vm.showPicker),callback:function ($$v) {_vm.showPicker=$$v},expression:"showPicker"}})],1)}
|
1335 | var staticRenderFns = []
|
1336 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
1337 | __webpack_exports__["a"] = (esExports);
|
1338 |
|
1339 | }),
|
1340 |
|
1341 | 4:
|
1342 | (function(module, exports) {
|
1343 |
|
1344 | module.exports = require("vue");
|
1345 |
|
1346 | }),
|
1347 |
|
1348 | 46:
|
1349 | (function(module, exports, __webpack_require__) {
|
1350 |
|
1351 | "use strict";
|
1352 |
|
1353 |
|
1354 | exports.__esModule = true;
|
1355 |
|
1356 | exports.default = function (element, options) {
|
1357 | if (_vue2.default.prototype.$isServer) return;
|
1358 | var moveFn = function moveFn(event) {
|
1359 | if (options.drag) {
|
1360 | options.drag(event);
|
1361 | }
|
1362 | };
|
1363 | var upFn = function upFn(event) {
|
1364 | document.removeEventListener('mousemove', moveFn);
|
1365 | document.removeEventListener('mouseup', upFn);
|
1366 | document.onselectstart = null;
|
1367 | document.ondragstart = null;
|
1368 |
|
1369 | isDragging = false;
|
1370 |
|
1371 | if (options.end) {
|
1372 | options.end(event);
|
1373 | }
|
1374 | };
|
1375 | element.addEventListener('mousedown', function (event) {
|
1376 | if (isDragging) return;
|
1377 | document.onselectstart = function () {
|
1378 | return false;
|
1379 | };
|
1380 | document.ondragstart = function () {
|
1381 | return false;
|
1382 | };
|
1383 |
|
1384 | document.addEventListener('mousemove', moveFn);
|
1385 | document.addEventListener('mouseup', upFn);
|
1386 | isDragging = true;
|
1387 |
|
1388 | if (options.start) {
|
1389 | options.start(event);
|
1390 | }
|
1391 | });
|
1392 | };
|
1393 |
|
1394 | var _vue = __webpack_require__(4);
|
1395 |
|
1396 | var _vue2 = _interopRequireDefault(_vue);
|
1397 |
|
1398 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1399 |
|
1400 | var isDragging = false;
|
1401 |
|
1402 | }),
|
1403 |
|
1404 | 5:
|
1405 | (function(module, exports) {
|
1406 |
|
1407 | module.exports = require("element-ui/lib/mixins/locale");
|
1408 |
|
1409 | }),
|
1410 |
|
1411 | 53:
|
1412 | (function(module, exports, __webpack_require__) {
|
1413 |
|
1414 | "use strict";
|
1415 |
|
1416 |
|
1417 | exports.__esModule = true;
|
1418 |
|
1419 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
1420 |
|
1421 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1422 |
|
1423 | var hsv2hsl = function hsv2hsl(hue, sat, val) {
|
1424 | return [hue, sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0, hue / 2];
|
1425 | };
|
1426 |
|
1427 |
|
1428 |
|
1429 | var isOnePointZero = function isOnePointZero(n) {
|
1430 | return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
1431 | };
|
1432 |
|
1433 | var isPercentage = function isPercentage(n) {
|
1434 | return typeof n === 'string' && n.indexOf('%') !== -1;
|
1435 | };
|
1436 |
|
1437 |
|
1438 | var bound01 = function bound01(value, max) {
|
1439 | if (isOnePointZero(value)) value = '100%';
|
1440 |
|
1441 | var processPercent = isPercentage(value);
|
1442 | value = Math.min(max, Math.max(0, parseFloat(value)));
|
1443 |
|
1444 |
|
1445 | if (processPercent) {
|
1446 | value = parseInt(value * max, 10) / 100;
|
1447 | }
|
1448 |
|
1449 |
|
1450 | if (Math.abs(value - max) < 0.000001) {
|
1451 | return 1;
|
1452 | }
|
1453 |
|
1454 |
|
1455 | return value % max / parseFloat(max);
|
1456 | };
|
1457 |
|
1458 | var INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
|
1459 |
|
1460 | var toHex = function toHex(_ref) {
|
1461 | var r = _ref.r,
|
1462 | g = _ref.g,
|
1463 | b = _ref.b;
|
1464 |
|
1465 | var hexOne = function hexOne(value) {
|
1466 | value = Math.min(Math.round(value), 255);
|
1467 | var high = Math.floor(value / 16);
|
1468 | var low = value % 16;
|
1469 | return '' + (INT_HEX_MAP[high] || high) + (INT_HEX_MAP[low] || low);
|
1470 | };
|
1471 |
|
1472 | if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
|
1473 |
|
1474 | return '#' + hexOne(r) + hexOne(g) + hexOne(b);
|
1475 | };
|
1476 |
|
1477 | var HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
|
1478 |
|
1479 | var parseHexChannel = function parseHexChannel(hex) {
|
1480 | if (hex.length === 2) {
|
1481 | return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
|
1482 | }
|
1483 |
|
1484 | return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
|
1485 | };
|
1486 |
|
1487 | var hsl2hsv = function hsl2hsv(hue, sat, light) {
|
1488 | sat = sat / 100;
|
1489 | light = light / 100;
|
1490 | var smin = sat;
|
1491 | var lmin = Math.max(light, 0.01);
|
1492 | var sv = void 0;
|
1493 | var v = void 0;
|
1494 |
|
1495 | light *= 2;
|
1496 | sat *= light <= 1 ? light : 2 - light;
|
1497 | smin *= lmin <= 1 ? lmin : 2 - lmin;
|
1498 | v = (light + sat) / 2;
|
1499 | sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
|
1500 |
|
1501 | return {
|
1502 | h: hue,
|
1503 | s: sv * 100,
|
1504 | v: v * 100
|
1505 | };
|
1506 | };
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 | var rgb2hsv = function rgb2hsv(r, g, b) {
|
1513 | r = bound01(r, 255);
|
1514 | g = bound01(g, 255);
|
1515 | b = bound01(b, 255);
|
1516 |
|
1517 | var max = Math.max(r, g, b);
|
1518 | var min = Math.min(r, g, b);
|
1519 | var h = void 0,
|
1520 | s = void 0;
|
1521 | var v = max;
|
1522 |
|
1523 | var d = max - min;
|
1524 | s = max === 0 ? 0 : d / max;
|
1525 |
|
1526 | if (max === min) {
|
1527 | h = 0;
|
1528 | } else {
|
1529 | switch (max) {
|
1530 | case r:
|
1531 | h = (g - b) / d + (g < b ? 6 : 0);
|
1532 | break;
|
1533 | case g:
|
1534 | h = (b - r) / d + 2;
|
1535 | break;
|
1536 | case b:
|
1537 | h = (r - g) / d + 4;
|
1538 | break;
|
1539 | }
|
1540 | h /= 6;
|
1541 | }
|
1542 |
|
1543 | return { h: h * 360, s: s * 100, v: v * 100 };
|
1544 | };
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 | var hsv2rgb = function hsv2rgb(h, s, v) {
|
1551 | h = bound01(h, 360) * 6;
|
1552 | s = bound01(s, 100);
|
1553 | v = bound01(v, 100);
|
1554 |
|
1555 | var i = Math.floor(h);
|
1556 | var f = h - i;
|
1557 | var p = v * (1 - s);
|
1558 | var q = v * (1 - f * s);
|
1559 | var t = v * (1 - (1 - f) * s);
|
1560 | var mod = i % 6;
|
1561 | var r = [v, q, p, p, t, v][mod];
|
1562 | var g = [t, v, v, q, p, p][mod];
|
1563 | var b = [p, p, t, v, v, q][mod];
|
1564 |
|
1565 | return {
|
1566 | r: Math.round(r * 255),
|
1567 | g: Math.round(g * 255),
|
1568 | b: Math.round(b * 255)
|
1569 | };
|
1570 | };
|
1571 |
|
1572 | var Color = function () {
|
1573 | function Color(options) {
|
1574 | _classCallCheck(this, Color);
|
1575 |
|
1576 | this._hue = 0;
|
1577 | this._saturation = 100;
|
1578 | this._value = 100;
|
1579 | this._alpha = 100;
|
1580 |
|
1581 | this.enableAlpha = false;
|
1582 | this.format = 'hex';
|
1583 | this.value = '';
|
1584 |
|
1585 | options = options || {};
|
1586 |
|
1587 | for (var option in options) {
|
1588 | if (options.hasOwnProperty(option)) {
|
1589 | this[option] = options[option];
|
1590 | }
|
1591 | }
|
1592 |
|
1593 | this.doOnChange();
|
1594 | }
|
1595 |
|
1596 | Color.prototype.set = function set(prop, value) {
|
1597 | if (arguments.length === 1 && (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) === 'object') {
|
1598 | for (var p in prop) {
|
1599 | if (prop.hasOwnProperty(p)) {
|
1600 | this.set(p, prop[p]);
|
1601 | }
|
1602 | }
|
1603 |
|
1604 | return;
|
1605 | }
|
1606 |
|
1607 | this['_' + prop] = value;
|
1608 | this.doOnChange();
|
1609 | };
|
1610 |
|
1611 | Color.prototype.get = function get(prop) {
|
1612 | return this['_' + prop];
|
1613 | };
|
1614 |
|
1615 | Color.prototype.toRgb = function toRgb() {
|
1616 | return hsv2rgb(this._hue, this._saturation, this._value);
|
1617 | };
|
1618 |
|
1619 | Color.prototype.fromString = function fromString(value) {
|
1620 | var _this = this;
|
1621 |
|
1622 | if (!value) {
|
1623 | this._hue = 0;
|
1624 | this._saturation = 100;
|
1625 | this._value = 100;
|
1626 |
|
1627 | this.doOnChange();
|
1628 | return;
|
1629 | }
|
1630 |
|
1631 | var fromHSV = function fromHSV(h, s, v) {
|
1632 | _this._hue = Math.max(0, Math.min(360, h));
|
1633 | _this._saturation = Math.max(0, Math.min(100, s));
|
1634 | _this._value = Math.max(0, Math.min(100, v));
|
1635 |
|
1636 | _this.doOnChange();
|
1637 | };
|
1638 |
|
1639 | if (value.indexOf('hsl') !== -1) {
|
1640 | var parts = value.replace(/hsla|hsl|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
1641 | return val !== '';
|
1642 | }).map(function (val, index) {
|
1643 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
1644 | });
|
1645 |
|
1646 | if (parts.length === 4) {
|
1647 | this._alpha = Math.floor(parseFloat(parts[3]) * 100);
|
1648 | } else if (parts.length === 3) {
|
1649 | this._alpha = 100;
|
1650 | }
|
1651 | if (parts.length >= 3) {
|
1652 | var _hsl2hsv = hsl2hsv(parts[0], parts[1], parts[2]),
|
1653 | h = _hsl2hsv.h,
|
1654 | s = _hsl2hsv.s,
|
1655 | v = _hsl2hsv.v;
|
1656 |
|
1657 | fromHSV(h, s, v);
|
1658 | }
|
1659 | } else if (value.indexOf('hsv') !== -1) {
|
1660 | var _parts = value.replace(/hsva|hsv|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
1661 | return val !== '';
|
1662 | }).map(function (val, index) {
|
1663 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
1664 | });
|
1665 |
|
1666 | if (_parts.length === 4) {
|
1667 | this._alpha = Math.floor(parseFloat(_parts[3]) * 100);
|
1668 | } else if (_parts.length === 3) {
|
1669 | this._alpha = 100;
|
1670 | }
|
1671 | if (_parts.length >= 3) {
|
1672 | fromHSV(_parts[0], _parts[1], _parts[2]);
|
1673 | }
|
1674 | } else if (value.indexOf('rgb') !== -1) {
|
1675 | var _parts2 = value.replace(/rgba|rgb|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
1676 | return val !== '';
|
1677 | }).map(function (val, index) {
|
1678 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
1679 | });
|
1680 |
|
1681 | if (_parts2.length === 4) {
|
1682 | this._alpha = Math.floor(parseFloat(_parts2[3]) * 100);
|
1683 | } else if (_parts2.length === 3) {
|
1684 | this._alpha = 100;
|
1685 | }
|
1686 | if (_parts2.length >= 3) {
|
1687 | var _rgb2hsv = rgb2hsv(_parts2[0], _parts2[1], _parts2[2]),
|
1688 | _h = _rgb2hsv.h,
|
1689 | _s = _rgb2hsv.s,
|
1690 | _v = _rgb2hsv.v;
|
1691 |
|
1692 | fromHSV(_h, _s, _v);
|
1693 | }
|
1694 | } else if (value.indexOf('#') !== -1) {
|
1695 | var hex = value.replace('#', '').trim();
|
1696 | var r = void 0,
|
1697 | g = void 0,
|
1698 | b = void 0;
|
1699 |
|
1700 | if (hex.length === 3) {
|
1701 | r = parseHexChannel(hex[0] + hex[0]);
|
1702 | g = parseHexChannel(hex[1] + hex[1]);
|
1703 | b = parseHexChannel(hex[2] + hex[2]);
|
1704 | } else if (hex.length === 6 || hex.length === 8) {
|
1705 | r = parseHexChannel(hex.substring(0, 2));
|
1706 | g = parseHexChannel(hex.substring(2, 4));
|
1707 | b = parseHexChannel(hex.substring(4, 6));
|
1708 | }
|
1709 |
|
1710 | if (hex.length === 8) {
|
1711 | this._alpha = Math.floor(parseHexChannel(hex.substring(6)) / 255 * 100);
|
1712 | } else if (hex.length === 3 || hex.length === 6) {
|
1713 | this._alpha = 100;
|
1714 | }
|
1715 |
|
1716 | var _rgb2hsv2 = rgb2hsv(r, g, b),
|
1717 | _h2 = _rgb2hsv2.h,
|
1718 | _s2 = _rgb2hsv2.s,
|
1719 | _v2 = _rgb2hsv2.v;
|
1720 |
|
1721 | fromHSV(_h2, _s2, _v2);
|
1722 | }
|
1723 | };
|
1724 |
|
1725 | Color.prototype.compare = function compare(color) {
|
1726 | return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
|
1727 | };
|
1728 |
|
1729 | Color.prototype.doOnChange = function doOnChange() {
|
1730 | var _hue = this._hue,
|
1731 | _saturation = this._saturation,
|
1732 | _value = this._value,
|
1733 | _alpha = this._alpha,
|
1734 | format = this.format;
|
1735 |
|
1736 |
|
1737 | if (this.enableAlpha) {
|
1738 | switch (format) {
|
1739 | case 'hsl':
|
1740 | var hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
1741 | this.value = 'hsla(' + _hue + ', ' + Math.round(hsl[1] * 100) + '%, ' + Math.round(hsl[2] * 100) + '%, ' + _alpha / 100 + ')';
|
1742 | break;
|
1743 | case 'hsv':
|
1744 | this.value = 'hsva(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%, ' + _alpha / 100 + ')';
|
1745 | break;
|
1746 | default:
|
1747 | var _hsv2rgb = hsv2rgb(_hue, _saturation, _value),
|
1748 | r = _hsv2rgb.r,
|
1749 | g = _hsv2rgb.g,
|
1750 | b = _hsv2rgb.b;
|
1751 |
|
1752 | this.value = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + _alpha / 100 + ')';
|
1753 | }
|
1754 | } else {
|
1755 | switch (format) {
|
1756 | case 'hsl':
|
1757 | var _hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
1758 | this.value = 'hsl(' + _hue + ', ' + Math.round(_hsl[1] * 100) + '%, ' + Math.round(_hsl[2] * 100) + '%)';
|
1759 | break;
|
1760 | case 'hsv':
|
1761 | this.value = 'hsv(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%)';
|
1762 | break;
|
1763 | case 'rgb':
|
1764 | var _hsv2rgb2 = hsv2rgb(_hue, _saturation, _value),
|
1765 | _r = _hsv2rgb2.r,
|
1766 | _g = _hsv2rgb2.g,
|
1767 | _b = _hsv2rgb2.b;
|
1768 |
|
1769 | this.value = 'rgb(' + _r + ', ' + _g + ', ' + _b + ')';
|
1770 | break;
|
1771 | default:
|
1772 | this.value = toHex(hsv2rgb(_hue, _saturation, _value));
|
1773 | }
|
1774 | }
|
1775 | };
|
1776 |
|
1777 | return Color;
|
1778 | }();
|
1779 |
|
1780 | exports.default = Color;
|
1781 | ;
|
1782 |
|
1783 | }),
|
1784 |
|
1785 | 6:
|
1786 | (function(module, exports) {
|
1787 |
|
1788 | module.exports = require("element-ui/lib/input");
|
1789 |
|
1790 | }),
|
1791 |
|
1792 | 7:
|
1793 | (function(module, exports) {
|
1794 |
|
1795 | module.exports = require("element-ui/lib/utils/vue-popper");
|
1796 |
|
1797 | })
|
1798 |
|
1799 | }); |
\ | No newline at end of file |