@mdsfe/mds-ui
Version:
A set of enterprise-class Vue UI components.
1,432 lines (1,216 loc) • 38.7 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("./tooltip"), require("./inputnumber"));
else if(typeof define === 'function' && define.amd)
define(["./tooltip", "./inputnumber"], factory);
else {
var a = typeof exports === 'object' ? factory(require("./tooltip"), require("./inputnumber")) : factory(root["./tooltip"], root["./inputnumber"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function(__WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__74__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 115);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 115:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./components/style/index.less
var style = __webpack_require__(142);
// EXTERNAL MODULE: ./components/slider/style/index.less
var slider_style = __webpack_require__(245);
// CONCATENATED MODULE: ./components/slider/style/index.js
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/slider/slider.vue?vue&type=template&id=7f345db8&
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{
class: [
_vm.prefixCls + "-wrapper",
{ vertical: _vm.vertical, disable: _vm.disable },
],
},
[
_vm.icon
? _c("mds-icon", {
staticClass: "iconfont iconfont_left",
class: _vm.colorInfo ? "color_info" : "",
attrs: { type: _vm.icon[0] },
})
: _vm._e(),
_c(
"div",
{
ref: "slider",
class: [_vm.prefixCls + "-bar"],
on: { click: _vm.onSliderClick },
},
[
_c("div", {
class: [_vm.prefixCls + "-progress"],
style: _vm.progressStyle,
}),
_c("mds-slider-button", {
model: {
value: _vm.value1,
callback: function ($$v) {
_vm.value1 = $$v
},
expression: "value1",
},
}),
!!_vm.range
? _c("mds-slider-button", {
model: {
value: _vm.value2,
callback: function ($$v) {
_vm.value2 = $$v
},
expression: "value2",
},
})
: _vm._e(),
_vm.withScale
? _vm._l(_vm.stepNum, function (item, index) {
return _c("div", {
key: index,
class: [_vm.prefixCls + "-scale"],
style: { left: (100 / _vm.step) * (index + 1) + "%" },
})
})
: _vm._e(),
],
2
),
_vm.withInput && !_vm.range
? _c("mds-inputnumber", {
class: _vm.prefixCls + "-input",
attrs: {
disabled: _vm.disable,
min: _vm.min,
max: _vm.max,
"controls-position": "right",
},
on: { change: _vm.emitChange },
model: {
value: _vm.valueInput,
callback: function ($$v) {
_vm.valueInput = $$v
},
expression: "valueInput",
},
})
: _vm._e(),
_vm.icon
? _c("mds-icon", {
staticClass: "iconfont iconfont_right",
class: _vm.colorCorrect ? "color_correct" : "",
attrs: { type: _vm.icon[1] },
})
: _vm._e(),
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./components/slider/slider.vue?vue&type=template&id=7f345db8&
// EXTERNAL MODULE: external "./inputnumber"
var external_inputnumber_ = __webpack_require__(74);
var external_inputnumber_default = /*#__PURE__*/__webpack_require__.n(external_inputnumber_);
// EXTERNAL MODULE: external "./tooltip"
var external_tooltip_ = __webpack_require__(43);
var external_tooltip_default = /*#__PURE__*/__webpack_require__.n(external_tooltip_);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/slider/slider-btn.vue?vue&type=template&id=03d9029a&
var slider_btnvue_type_template_id_03d9029a_render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
[
!_vm.withTooltip
? _c("div", {
class: [_vm.prefixCls + "-button"],
style: _vm.patchStyle,
on: {
mousedown: _vm.onTouchStart,
touchstart: _vm.onTouchStart,
touchmove: _vm.onTouchMove,
touchend: _vm.onTouchEnd,
},
})
: _vm._e(),
_vm.withTooltip
? _c(
"mds-tooltip",
{ ref: "tooltip", attrs: { title: "" + _vm.value } },
[
_c("div", {
class: [_vm.prefixCls + "-button"],
style: _vm.patchStyle,
on: {
mousedown: _vm.onTouchStart,
touchstart: _vm.onTouchStart,
touchmove: _vm.onTouchMove,
touchend: _vm.onTouchEnd,
},
}),
]
)
: _vm._e(),
],
1
)
}
var slider_btnvue_type_template_id_03d9029a_staticRenderFns = []
slider_btnvue_type_template_id_03d9029a_render._withStripped = true
// CONCATENATED MODULE: ./components/slider/slider-btn.vue?vue&type=template&id=03d9029a&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/slider/slider-btn.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var slider_btnvue_type_script_lang_js_ = ({
name: 'MdsSliderButton',
components: {
MdsTooltip: external_tooltip_default.a
},
props: {
value: {
type: Number,
default: 0
}
},
data: function data() {
return {
startX: 0,
currentX: 0,
startY: 0,
currentY: 0,
touching: false,
prefixCls: this.$parent.prefixCls,
max: this.$parent.max,
min: this.$parent.min,
step: this.$parent.step,
vertical: this.$parent.vertical,
withTooltip: this.$parent.withTooltip
};
},
watch: {
touching: function touching(val) {
this.$parent.dragging = val;
}
},
computed: {
barLength: function barLength() {
return this.$parent.barLength;
},
disable: function disable() {
return this.$parent.disable;
},
currProgress: function currProgress() {
return (this.value - this.min) / (this.max - this.min);
},
patchStyle: function patchStyle() {
var currPercentage = this.currProgress * 100 + '%';
return this.vertical ? { bottom: currPercentage } : { left: currPercentage };
}
},
methods: {
displayTooltip: function displayTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
},
hideTooltip: function hideTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
},
addEventListeners: function addEventListeners() {
window.addEventListener('mousemove', this.onTouchMove);
window.addEventListener('mouseup', this.onTouchEnd);
this.displayTooltip();
},
removeEventListeners: function removeEventListeners() {
window.removeEventListener('mousemove', this.onTouchMove);
window.removeEventListener('mouseup', this.onTouchEnd);
this.hideTooltip();
},
setValue: function setValue(progress) {
var _this = this;
var adjust = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var valueRange = this.max - this.min;
var percentagePerStep = this.step / valueRange;
var steps = progress / percentagePerStep;
steps = adjust ? Math.round(steps) : steps;
var value = steps * this.step + this.min;
this.$emit('input', value);
this.$nextTick(function () {
_this.displayTooltip();
_this.$refs.tooltip && _this.$refs.tooltip.updatePopper();
});
},
onTouchStart: function onTouchStart(event) {
if (this.disable) return;
event.preventDefault();
this.touching = true;
this.startX = event.clientX || event.touches[0].clientX;
this.startY = event.clientY || event.touches[0].clientY;
this.startProgress = this.currProgress;
this.addEventListeners();
},
onTouchMove: function onTouchMove(event) {
if (this.disable || !this.touching) return;
this.displayTooltip();
var diffProgress = 0;
this.currentX = event.clientX || event.touches[0].clientX;
this.currentY = event.clientY || event.touches[0].clientY;
diffProgress = this.vertical ? (this.startY - this.currentY) / this.barLength : (this.currentX - this.startX) / this.barLength;
var currentProgress = this.startProgress + diffProgress;
this.setValue(currentProgress);
},
onTouchEnd: function onTouchEnd(event) {
var _this2 = this;
setTimeout(function () {
_this2.touching = false;
});
this.removeEventListeners();
}
}
});
// CONCATENATED MODULE: ./components/slider/slider-btn.vue?vue&type=script&lang=js&
/* harmony default export */ var slider_slider_btnvue_type_script_lang_js_ = (slider_btnvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./components/slider/slider-btn.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
slider_slider_btnvue_type_script_lang_js_,
slider_btnvue_type_template_id_03d9029a_render,
slider_btnvue_type_template_id_03d9029a_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "components/slider/slider-btn.vue"
/* harmony default export */ var slider_btn = (component.exports);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/slider/slider.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var slidervue_type_script_lang_js_ = ({
name: 'MdsSlider',
props: {
value: {
type: [Number, Array],
default: 0
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
disable: {
type: Boolean,
default: false
},
withTooltip: {
type: Boolean,
default: false
},
range: {
type: Boolean,
default: false
},
vertical: {
type: Boolean,
default: false
},
withInput: {
type: Boolean,
default: false
},
withScale: {
type: Boolean,
default: false
},
marks: Object,
prefixCls: {
type: String,
default: 'mds-slider'
},
icon: {
type: [Array, Boolean],
default: false
}
},
components: {
MdsInputnumber: external_inputnumber_default.a,
MdsTooltip: external_tooltip_default.a,
MdsSliderButton: slider_btn
},
data: function data() {
return {
value1: null,
dragging: false,
value2: null,
barLength: 1,
valueInput: '0',
colorInfo: false,
colorCorrect: false,
stepNum: 0
};
},
watch: {
value: function value() {
this.setValue();
},
value1: function value1(val) {
if (this.range) {
this.$emit('input', [this.minValue, this.maxValue]);
} else {
this.$emit('input', val);
this.stepNum = Math.floor(val / 10);
}
}
},
computed: {
// valueInput (){
// return `${this.value}`
// },
currProgress: function currProgress() {
if (!this.range) {
return (this.value - this.min) / (this.max - this.min);
}
},
progressStyle: function progressStyle() {
var currPercentage = this.currProgress * 100 + '%';
// 进度条改变时的判断
if (this.currProgress * 100 === 0) {
this.colorInfo = true;
} else if (this.currProgress * 100 === 100) {
this.colorCorrect = true;
} else {
this.colorInfo = false;
this.colorCorrect = false;
}
return this.vertical ? { height: currPercentage } : { width: currPercentage };
}
},
methods: {
onSliderClick: function onSliderClick(event) {
if (this.disable || this.dragging) return;
this.onLayout();
var newVal = 0;
if (this.vertical) {
var sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
newVal = Math.ceil((sliderOffsetBottom - event.clientY) * (this.max - this.min) / this.barLength);
} else {
var sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
newVal = Math.ceil((event.clientX - sliderOffsetLeft) * (this.max - this.min) / this.barLength);
}
this.$emit('input', newVal);
},
emitChange: function emitChange(event) {
this.$emit('input', Number(event));
},
setValue: function setValue() {
// TODO 边界测试
var val = this.value;
if (this.range && Array.isArray(val)) {
this.value1 = val[0];
this.value2 = val[1];
} else if (!this.range && typeof val === 'number' && !isNaN(val)) {
this.value1 = Math.min(this.max, Math.max(this.min, val));
this.valueInput = '' + this.value1;
}
},
onLayout: function onLayout() {
if (this.$refs.slider) {
this.barLength = this.vertical ? this.$refs.slider.clientHeight : this.$refs.slider.clientWidth;
}
}
},
mounted: function mounted() {
this.setValue();
this.onLayout();
}
});
// CONCATENATED MODULE: ./components/slider/slider.vue?vue&type=script&lang=js&
/* harmony default export */ var slider_slidervue_type_script_lang_js_ = (slidervue_type_script_lang_js_);
// EXTERNAL MODULE: ./components/slider/slider.vue?vue&type=style&index=0&lang=css&
var slidervue_type_style_index_0_lang_css_ = __webpack_require__(86);
// CONCATENATED MODULE: ./components/slider/slider.vue
/* normalize component */
var slider_component = Object(componentNormalizer["a" /* default */])(
slider_slidervue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var slider_api; }
slider_component.options.__file = "components/slider/slider.vue"
/* harmony default export */ var slider = (slider_component.exports);
// CONCATENATED MODULE: ./components/slider/index.js
slider.install = function (Vue) {
Vue.component(slider.name, slider);
};
/* harmony default export */ var components_slider = __webpack_exports__["default"] = (slider);
/***/ }),
/***/ 142:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 245:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 43:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__43__;
/***/ }),
/***/ 53:
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/***/ 54:
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {};
var memoize = function (fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
};
var isOldIE = memoize(function () {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
return window && document && document.all && !window.atob;
});
var getElement = (function (fn) {
var memo = {};
return function(selector) {
if (typeof memo[selector] === "undefined") {
memo[selector] = fn.call(this, selector);
}
return memo[selector]
};
})(function (target) {
return document.querySelector(target)
});
var singleton = null;
var singletonCounter = 0;
var stylesInsertedAtTop = [];
var fixUrls = __webpack_require__(59);
module.exports = function(list, options) {
if (typeof DEBUG !== "undefined" && DEBUG) {
if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
options.attrs = typeof options.attrs === "object" ? options.attrs : {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton) options.singleton = isOldIE();
// By default, add <style> tags to the <head> element
if (!options.insertInto) options.insertInto = "head";
// By default, add <style> tags to the bottom of the target
if (!options.insertAt) options.insertAt = "bottom";
var styles = listToStyles(list, options);
addStylesToDom(styles, options);
return function update (newList) {
var mayRemove = [];
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList, options);
addStylesToDom(newStyles, options);
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
};
function addStylesToDom (styles, options) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles (list, options) {
var styles = [];
var newStyles = {};
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
else newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement (options, style) {
var target = getElement(options.insertInto)
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
}
var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if (!lastStyleElementInsertedAtTop) {
target.insertBefore(style, target.firstChild);
} else if (lastStyleElementInsertedAtTop.nextSibling) {
target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
} else {
target.appendChild(style);
}
stylesInsertedAtTop.push(style);
} else if (options.insertAt === "bottom") {
target.appendChild(style);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement (style) {
if (style.parentNode === null) return false;
style.parentNode.removeChild(style);
var idx = stylesInsertedAtTop.indexOf(style);
if(idx >= 0) {
stylesInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement (options) {
var style = document.createElement("style");
options.attrs.type = "text/css";
addAttrs(style, options.attrs);
insertStyleElement(options, style);
return style;
}
function createLinkElement (options) {
var link = document.createElement("link");
options.attrs.type = "text/css";
options.attrs.rel = "stylesheet";
addAttrs(link, options.attrs);
insertStyleElement(options, link);
return link;
}
function addAttrs (el, attrs) {
Object.keys(attrs).forEach(function (key) {
el.setAttribute(key, attrs[key]);
});
}
function addStyle (obj, options) {
var style, update, remove, result;
// If a transform function was defined, run it on the css
if (options.transform && obj.css) {
result = options.transform(obj.css);
if (result) {
// If transform returns a value, use that instead of the original css.
// This allows running runtime transformations on the css.
obj.css = result;
} else {
// If the transform function returns a falsy value, don't add this css.
// This allows conditional loading of css
return function() {
// noop
};
}
}
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = createStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else if (
obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function"
) {
style = createLinkElement(options);
update = updateLink.bind(null, style, options);
remove = function () {
removeStyleElement(style);
if(style.href) URL.revokeObjectURL(style.href);
};
} else {
style = createStyleElement(options);
update = applyToTag.bind(null, style);
remove = function () {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle (newObj) {
if (newObj) {
if (
newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap
) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag (style, index, remove, obj) {
var css = remove ? "" : obj.css;
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) style.removeChild(childNodes[index]);
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag (style, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
style.setAttribute("media", media)
}
if(style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while(style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
function updateLink (link, options, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
/*
If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
and there is no publicPath defined then lets turn convertToAbsoluteUrls
on by default. Otherwise default to the convertToAbsoluteUrls option
directly
*/
var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
if (options.convertToAbsoluteUrls || autoFixUrls) {
css = fixUrls(css);
}
if (sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = link.href;
link.href = URL.createObjectURL(blob);
if(oldSrc) URL.revokeObjectURL(oldSrc);
}
/***/ }),
/***/ 59:
/***/ (function(module, exports) {
/**
* When source maps are enabled, `style-loader` uses a link element with a data-uri to
* embed the css on the page. This breaks all relative urls because now they are relative to a
* bundle instead of the current page.
*
* One solution is to only use full urls, but that may be impossible.
*
* Instead, this function "fixes" the relative urls to be absolute according to the current page location.
*
* A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
*
*/
module.exports = function (css) {
// get current location
var location = typeof window !== "undefined" && window.location;
if (!location) {
throw new Error("fixUrls requires window.location");
}
// blank or null?
if (!css || typeof css !== "string") {
return css;
}
var baseUrl = location.protocol + "//" + location.host;
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
// convert each url(...)
/*
This regular expression is just a way to recursively match brackets within
a string.
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens
( = Start a capturing group
(?: = Start a non-capturing group
[^)(] = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
(?: = Start another non-capturing groups
[^)(]+ = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
[^)(]* = Match anything that isn't a parentheses
\) = Match a end parentheses
) = End Group
*\) = Match anything and then a close parens
) = Close non-capturing group
* = Match anything
) = Close capturing group
\) = Match a close parens
/gi = Get all matches, not the first. Be case insensitive.
*/
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
// strip quotes (if they exist)
var unquotedOrigUrl = origUrl
.trim()
.replace(/^"(.*)"$/, function(o, $1){ return $1; })
.replace(/^'(.*)'$/, function(o, $1){ return $1; });
// already a full url? no change
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
return fullMatch;
}
// convert the url to a full url
var newUrl;
if (unquotedOrigUrl.indexOf("//") === 0) {
//TODO: should we add protocol?
newUrl = unquotedOrigUrl;
} else if (unquotedOrigUrl.indexOf("/") === 0) {
// path should be relative to the base url
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
} else {
// path should be relative to current directory
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
}
// send back the fixed url(...)
return "url(" + JSON.stringify(newUrl) + ")";
});
// send back the fixed css
return fixedCss;
};
/***/ }),
/***/ 64:
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(87);
if(typeof content === 'string') content = [[module.i, content, '']];
// Prepare cssTransformation
var transform;
var options = {}
options.transform = transform
// add the styles to the DOM
var update = __webpack_require__(54)(content, options);
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {}
/***/ }),
/***/ 74:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__74__;
/***/ }),
/***/ 86:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_slider_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64);
/* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_slider_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_slider_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/***/ }),
/***/ 87:
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(53)(false);
// imports
// module
exports.push([module.i, "\n.iconfont{\n font-size: 22px;\n}\n.iconfont_left{\n margin-right: 20px;\n}\n.color_info{\n color: #f60;\n}\n.color_correct{\n color: #00AA00;\n}\n.iconfont_right{\n margin-left: 20px;\n}\n", ""]);
// exports
/***/ })
/******/ });
});