@10yun/cv-pc-ui 0.2.4 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dict-area/area-city.js +614 -0
- package/dict-area/area-county.js +3394 -0
- package/dict-area/area-province.js +37 -0
- package/echart-map/js/china-contour.js +46 -0
- package/echart-map/js/china.js +46 -0
- package/echart-map/js/world.js +20 -0
- package/echart-map/json/china-cities.json +1 -0
- package/echart-map/json/china-contour.json +1 -0
- package/echart-map/json/china.json +1 -0
- package/echart-map/json/province/anhui.json +1 -0
- package/echart-map/json/province/aomen.json +1 -0
- package/echart-map/json/province/beijing.json +1 -0
- package/echart-map/json/province/chongqing.json +1 -0
- package/echart-map/json/province/fujian.json +1 -0
- package/echart-map/json/province/gansu.json +1 -0
- package/echart-map/json/province/guangdong.json +1 -0
- package/echart-map/json/province/guangxi.json +1 -0
- package/echart-map/json/province/guizhou.json +1 -0
- package/echart-map/json/province/hainan.json +1 -0
- package/echart-map/json/province/hebei.json +1 -0
- package/echart-map/json/province/heilongjiang.json +1 -0
- package/echart-map/json/province/henan.json +1 -0
- package/echart-map/json/province/hubei.json +1 -0
- package/echart-map/json/province/hunan.json +1 -0
- package/echart-map/json/province/jiangsu.json +1 -0
- package/echart-map/json/province/jiangxi.json +1 -0
- package/echart-map/json/province/jilin.json +1 -0
- package/echart-map/json/province/liaoning.json +1 -0
- package/echart-map/json/province/neimenggu.json +1 -0
- package/echart-map/json/province/ningxia.json +1 -0
- package/echart-map/json/province/qinghai.json +1 -0
- package/echart-map/json/province/shandong.json +1 -0
- package/echart-map/json/province/shanghai.json +1 -0
- package/echart-map/json/province/shanxi.json +1 -0
- package/echart-map/json/province/shanxi1.json +1 -0
- package/echart-map/json/province/sichuan.json +1 -0
- package/echart-map/json/province/taiwan.json +1 -0
- package/echart-map/json/province/tianjin.json +1 -0
- package/echart-map/json/province/xianggang.json +1 -0
- package/echart-map/json/province/xinjiang.json +1 -0
- package/echart-map/json/province/xizang.json +1 -0
- package/echart-map/json/province/yunnan.json +1 -0
- package/echart-map/json/province/zhejiang.json +1 -0
- package/echart-map/json/world.json +1 -0
- package/lib/cv-pc-ui.common.js +5193 -257
- package/lib/cv-pc-ui.common.js.map +1 -1
- package/lib/cv-pc-ui.umd.js +5193 -257
- package/lib/cv-pc-ui.umd.js.map +1 -1
- package/lib/cv-pc-ui.umd.min.js +1 -1
- package/lib/cv-pc-ui.umd.min.js.map +1 -1
- package/package.json +8 -5
- package/src/dict/area-city.js +614 -0
- package/src/dict/area-city2.js +613 -0
- package/src/dict/area-district.js +3394 -0
- package/src/dict/area-province.js +37 -0
- package/src/mixins/cascader.js +1 -2
- package/src/mixins/emitter.js +33 -0
- package/src/mixins/formItem.js +5 -6
- package/src/mixins/input.js +2 -2
- package/src/mixins/migrating.js +54 -0
- package/src/utils/dom.js +227 -0
- package/src/utils/merge.js +15 -0
- package/src/utils/scrollbar-width.js +29 -0
- package/src/utils/types.js +40 -0
- package/src/utils/util.js +241 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
110000: '北京市',
|
|
3
|
+
120000: '天津市',
|
|
4
|
+
130000: '河北省',
|
|
5
|
+
140000: '山西省',
|
|
6
|
+
150000: '内蒙古自治区',
|
|
7
|
+
210000: '辽宁省',
|
|
8
|
+
220000: '吉林省',
|
|
9
|
+
230000: '黑龙江省',
|
|
10
|
+
310000: '上海市',
|
|
11
|
+
320000: '江苏省',
|
|
12
|
+
330000: '浙江省',
|
|
13
|
+
340000: '安徽省',
|
|
14
|
+
350000: '福建省',
|
|
15
|
+
360000: '江西省',
|
|
16
|
+
370000: '山东省',
|
|
17
|
+
410000: '河南省',
|
|
18
|
+
420000: '湖北省',
|
|
19
|
+
430000: '湖南省',
|
|
20
|
+
440000: '广东省',
|
|
21
|
+
450000: '广西壮族自治区',
|
|
22
|
+
460000: '海南省',
|
|
23
|
+
500000: '重庆市',
|
|
24
|
+
510000: '四川省',
|
|
25
|
+
520000: '贵州省',
|
|
26
|
+
530000: '云南省',
|
|
27
|
+
540000: '西藏自治区',
|
|
28
|
+
610000: '陕西省',
|
|
29
|
+
620000: '甘肃省',
|
|
30
|
+
630000: '青海省',
|
|
31
|
+
640000: '宁夏回族自治区',
|
|
32
|
+
650000: '新疆维吾尔自治区',
|
|
33
|
+
710000: '台湾省',
|
|
34
|
+
810000: '香港特别行政区',
|
|
35
|
+
820000: '澳门特别行政区',
|
|
36
|
+
900000: '海外',
|
|
37
|
+
};
|
package/src/mixins/cascader.js
CHANGED
|
@@ -61,7 +61,6 @@ export default {
|
|
|
61
61
|
type: Boolean,
|
|
62
62
|
default: false
|
|
63
63
|
},
|
|
64
|
-
|
|
65
64
|
},
|
|
66
65
|
watch: {
|
|
67
66
|
value() {
|
|
@@ -91,7 +90,7 @@ export default {
|
|
|
91
90
|
},
|
|
92
91
|
computed: {
|
|
93
92
|
// 传给内部组件的数据,内部组件通过 props 接收一个对象,因此把数据整合在一个对象中
|
|
94
|
-
|
|
93
|
+
props2() {
|
|
95
94
|
return Object.assign(this.dataField, { emitPath: this.emitPath }, { multiple: this.multiple })
|
|
96
95
|
}
|
|
97
96
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function broadcast(componentName, eventName, params) {
|
|
2
|
+
this.$children.forEach(child => {
|
|
3
|
+
var name = child.$options.componentName;
|
|
4
|
+
|
|
5
|
+
if (name === componentName) {
|
|
6
|
+
child.$emit.apply(child, [eventName].concat(params));
|
|
7
|
+
} else {
|
|
8
|
+
broadcast.apply(child, [componentName, eventName].concat([params]));
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export default {
|
|
13
|
+
methods: {
|
|
14
|
+
dispatch(componentName, eventName, params) {
|
|
15
|
+
var parent = this.$parent || this.$root;
|
|
16
|
+
var name = parent.$options.componentName;
|
|
17
|
+
|
|
18
|
+
while (parent && (!name || name !== componentName)) {
|
|
19
|
+
parent = parent.$parent;
|
|
20
|
+
|
|
21
|
+
if (parent) {
|
|
22
|
+
name = parent.$options.componentName;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (parent) {
|
|
26
|
+
parent.$emit.apply(parent, [eventName].concat(params));
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
broadcast(componentName, eventName, params) {
|
|
30
|
+
broadcast.call(this, componentName, eventName, params);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
package/src/mixins/formItem.js
CHANGED
|
@@ -49,18 +49,17 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
data() {
|
|
51
51
|
return {
|
|
52
|
-
// 是否处于表单中
|
|
53
|
-
is_form: false,
|
|
54
52
|
// 是否必填
|
|
55
53
|
// localRequired: false,
|
|
56
54
|
// 错误提示信息
|
|
57
55
|
localError: "",
|
|
58
56
|
// 自定义的input错误状态
|
|
59
|
-
validateState: "",
|
|
57
|
+
// validateState: "",
|
|
60
58
|
};
|
|
61
59
|
},
|
|
62
60
|
// data() {
|
|
63
61
|
// return {
|
|
62
|
+
// is_form:false,
|
|
64
63
|
// localVal: this.value //将prop属性绑定到data属性上,以便修改prop属性(Vue不允许直接修改prop属性的值)
|
|
65
64
|
// };
|
|
66
65
|
// },
|
|
@@ -71,9 +70,9 @@ export default {
|
|
|
71
70
|
// },
|
|
72
71
|
beforeMount() {
|
|
73
72
|
// 判断祖先元素是否存在form节点
|
|
74
|
-
if (this.elForm && this.elForm._vnode.data.staticClass === "el-form") {
|
|
75
|
-
|
|
76
|
-
}
|
|
73
|
+
// if (this.elForm && this.elForm._vnode.data.staticClass === "el-form") {
|
|
74
|
+
// this.is_form = true;
|
|
75
|
+
// }
|
|
77
76
|
},
|
|
78
77
|
|
|
79
78
|
methods: {
|
package/src/mixins/input.js
CHANGED
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
},
|
|
58
58
|
// 处理错误提示信息
|
|
59
59
|
_showError(msg) {
|
|
60
|
-
this.validateState = "error";
|
|
60
|
+
// this.validateState = "error";
|
|
61
61
|
this.localError = msg || "请输入正确的" + this.label;
|
|
62
62
|
},
|
|
63
63
|
_diyValidate() {
|
|
@@ -68,7 +68,7 @@ export default {
|
|
|
68
68
|
const localRules = newArr;
|
|
69
69
|
|
|
70
70
|
this.localError = "";
|
|
71
|
-
this.validateState = "";
|
|
71
|
+
// this.validateState = "";
|
|
72
72
|
|
|
73
73
|
for (let i in localRules) {
|
|
74
74
|
let itemRuleStr = localRules[i];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { kebabCase } from '../utils/util';
|
|
2
|
+
/**
|
|
3
|
+
* Show migrating guide in browser console.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* import Migrating from 'element-ui/src/mixins/migrating';
|
|
7
|
+
*
|
|
8
|
+
* mixins: [Migrating]
|
|
9
|
+
*
|
|
10
|
+
* add getMigratingConfig method for your component.
|
|
11
|
+
* getMigratingConfig() {
|
|
12
|
+
* return {
|
|
13
|
+
* props: {
|
|
14
|
+
* 'allow-no-selection': 'allow-no-selection is removed.',
|
|
15
|
+
* 'selection-mode': 'selection-mode is removed.'
|
|
16
|
+
* },
|
|
17
|
+
* events: {
|
|
18
|
+
* selectionchange: 'selectionchange is renamed to selection-change.'
|
|
19
|
+
* }
|
|
20
|
+
* };
|
|
21
|
+
* },
|
|
22
|
+
*/
|
|
23
|
+
export default {
|
|
24
|
+
mounted() {
|
|
25
|
+
if (process.env.NODE_ENV === 'production') return;
|
|
26
|
+
if (!this.$vnode) return;
|
|
27
|
+
const { props = {}, events = {} } = this.getMigratingConfig();
|
|
28
|
+
const { data, componentOptions } = this.$vnode;
|
|
29
|
+
const definedProps = data.attrs || {};
|
|
30
|
+
const definedEvents = componentOptions.listeners || {};
|
|
31
|
+
|
|
32
|
+
for (let propName in definedProps) {
|
|
33
|
+
propName = kebabCase(propName); // compatible with camel case
|
|
34
|
+
if (props[propName]) {
|
|
35
|
+
console.warn(`[Element Migrating][${this.$options.name}][Attribute]: ${props[propName]}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (let eventName in definedEvents) {
|
|
40
|
+
eventName = kebabCase(eventName); // compatible with camel case
|
|
41
|
+
if (events[eventName]) {
|
|
42
|
+
console.warn(`[Element Migrating][${this.$options.name}][Event]: ${events[eventName]}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
getMigratingConfig() {
|
|
48
|
+
return {
|
|
49
|
+
props: {},
|
|
50
|
+
events: {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
package/src/utils/dom.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/* istanbul ignore next */
|
|
2
|
+
|
|
3
|
+
import Vue from 'vue';
|
|
4
|
+
|
|
5
|
+
const isServer = Vue.prototype.$isServer;
|
|
6
|
+
const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
|
|
7
|
+
const MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
8
|
+
const ieVersion = isServer ? 0 : Number(document.documentMode);
|
|
9
|
+
|
|
10
|
+
/* istanbul ignore next */
|
|
11
|
+
const trim = function(string) {
|
|
12
|
+
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
|
|
13
|
+
};
|
|
14
|
+
/* istanbul ignore next */
|
|
15
|
+
const camelCase = function(name) {
|
|
16
|
+
return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
|
|
17
|
+
return offset ? letter.toUpperCase() : letter;
|
|
18
|
+
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/* istanbul ignore next */
|
|
22
|
+
export const on = (function() {
|
|
23
|
+
if (!isServer && document.addEventListener) {
|
|
24
|
+
return function(element, event, handler) {
|
|
25
|
+
if (element && event && handler) {
|
|
26
|
+
element.addEventListener(event, handler, false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
return function(element, event, handler) {
|
|
31
|
+
if (element && event && handler) {
|
|
32
|
+
element.attachEvent('on' + event, handler);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
|
|
38
|
+
/* istanbul ignore next */
|
|
39
|
+
export const off = (function() {
|
|
40
|
+
if (!isServer && document.removeEventListener) {
|
|
41
|
+
return function(element, event, handler) {
|
|
42
|
+
if (element && event) {
|
|
43
|
+
element.removeEventListener(event, handler, false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
return function(element, event, handler) {
|
|
48
|
+
if (element && event) {
|
|
49
|
+
element.detachEvent('on' + event, handler);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
/* istanbul ignore next */
|
|
56
|
+
export const once = function(el, event, fn) {
|
|
57
|
+
var listener = function() {
|
|
58
|
+
if (fn) {
|
|
59
|
+
fn.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
off(el, event, listener);
|
|
62
|
+
};
|
|
63
|
+
on(el, event, listener);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/* istanbul ignore next */
|
|
67
|
+
export function hasClass(el, cls) {
|
|
68
|
+
if (!el || !cls) return false;
|
|
69
|
+
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
|
|
70
|
+
if (el.classList) {
|
|
71
|
+
return el.classList.contains(cls);
|
|
72
|
+
} else {
|
|
73
|
+
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/* istanbul ignore next */
|
|
78
|
+
export function addClass(el, cls) {
|
|
79
|
+
if (!el) return;
|
|
80
|
+
var curClass = el.className;
|
|
81
|
+
var classes = (cls || '').split(' ');
|
|
82
|
+
|
|
83
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
84
|
+
var clsName = classes[i];
|
|
85
|
+
if (!clsName) continue;
|
|
86
|
+
|
|
87
|
+
if (el.classList) {
|
|
88
|
+
el.classList.add(clsName);
|
|
89
|
+
} else if (!hasClass(el, clsName)) {
|
|
90
|
+
curClass += ' ' + clsName;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!el.classList) {
|
|
94
|
+
el.setAttribute('class', curClass);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/* istanbul ignore next */
|
|
99
|
+
export function removeClass(el, cls) {
|
|
100
|
+
if (!el || !cls) return;
|
|
101
|
+
var classes = cls.split(' ');
|
|
102
|
+
var curClass = ' ' + el.className + ' ';
|
|
103
|
+
|
|
104
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
105
|
+
var clsName = classes[i];
|
|
106
|
+
if (!clsName) continue;
|
|
107
|
+
|
|
108
|
+
if (el.classList) {
|
|
109
|
+
el.classList.remove(clsName);
|
|
110
|
+
} else if (hasClass(el, clsName)) {
|
|
111
|
+
curClass = curClass.replace(' ' + clsName + ' ', ' ');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!el.classList) {
|
|
115
|
+
el.setAttribute('class', trim(curClass));
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/* istanbul ignore next */
|
|
120
|
+
export const getStyle = ieVersion < 9 ? function(element, styleName) {
|
|
121
|
+
if (isServer) return;
|
|
122
|
+
if (!element || !styleName) return null;
|
|
123
|
+
styleName = camelCase(styleName);
|
|
124
|
+
if (styleName === 'float') {
|
|
125
|
+
styleName = 'styleFloat';
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
switch (styleName) {
|
|
129
|
+
case 'opacity':
|
|
130
|
+
try {
|
|
131
|
+
return element.filters.item('alpha').opacity / 100;
|
|
132
|
+
} catch (e) {
|
|
133
|
+
return 1.0;
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
|
|
137
|
+
}
|
|
138
|
+
} catch (e) {
|
|
139
|
+
return element.style[styleName];
|
|
140
|
+
}
|
|
141
|
+
} : function(element, styleName) {
|
|
142
|
+
if (isServer) return;
|
|
143
|
+
if (!element || !styleName) return null;
|
|
144
|
+
styleName = camelCase(styleName);
|
|
145
|
+
if (styleName === 'float') {
|
|
146
|
+
styleName = 'cssFloat';
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
var computed = document.defaultView.getComputedStyle(element, '');
|
|
150
|
+
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
return element.style[styleName];
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/* istanbul ignore next */
|
|
157
|
+
export function setStyle(element, styleName, value) {
|
|
158
|
+
if (!element || !styleName) return;
|
|
159
|
+
|
|
160
|
+
if (typeof styleName === 'object') {
|
|
161
|
+
for (var prop in styleName) {
|
|
162
|
+
if (styleName.hasOwnProperty(prop)) {
|
|
163
|
+
setStyle(element, prop, styleName[prop]);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
styleName = camelCase(styleName);
|
|
168
|
+
if (styleName === 'opacity' && ieVersion < 9) {
|
|
169
|
+
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
|
|
170
|
+
} else {
|
|
171
|
+
element.style[styleName] = value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const isScroll = (el, vertical) => {
|
|
177
|
+
if (isServer) return;
|
|
178
|
+
|
|
179
|
+
const determinedDirection = vertical !== null && vertical !== undefined;
|
|
180
|
+
const overflow = determinedDirection
|
|
181
|
+
? vertical
|
|
182
|
+
? getStyle(el, 'overflow-y')
|
|
183
|
+
: getStyle(el, 'overflow-x')
|
|
184
|
+
: getStyle(el, 'overflow');
|
|
185
|
+
|
|
186
|
+
return overflow.match(/(scroll|auto|overlay)/);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const getScrollContainer = (el, vertical) => {
|
|
190
|
+
if (isServer) return;
|
|
191
|
+
|
|
192
|
+
let parent = el;
|
|
193
|
+
while (parent) {
|
|
194
|
+
if ([window, document, document.documentElement].includes(parent)) {
|
|
195
|
+
return window;
|
|
196
|
+
}
|
|
197
|
+
if (isScroll(parent, vertical)) {
|
|
198
|
+
return parent;
|
|
199
|
+
}
|
|
200
|
+
parent = parent.parentNode;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return parent;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const isInContainer = (el, container) => {
|
|
207
|
+
if (isServer || !el || !container) return false;
|
|
208
|
+
|
|
209
|
+
const elRect = el.getBoundingClientRect();
|
|
210
|
+
let containerRect;
|
|
211
|
+
|
|
212
|
+
if ([window, document, document.documentElement, null, undefined].includes(container)) {
|
|
213
|
+
containerRect = {
|
|
214
|
+
top: 0,
|
|
215
|
+
right: window.innerWidth,
|
|
216
|
+
bottom: window.innerHeight,
|
|
217
|
+
left: 0
|
|
218
|
+
};
|
|
219
|
+
} else {
|
|
220
|
+
containerRect = container.getBoundingClientRect();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return elRect.top < containerRect.bottom &&
|
|
224
|
+
elRect.bottom > containerRect.top &&
|
|
225
|
+
elRect.right > containerRect.left &&
|
|
226
|
+
elRect.left < containerRect.right;
|
|
227
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function(target) {
|
|
2
|
+
for (let i = 1, j = arguments.length; i < j; i++) {
|
|
3
|
+
let source = arguments[i] || {};
|
|
4
|
+
for (let prop in source) {
|
|
5
|
+
if (source.hasOwnProperty(prop)) {
|
|
6
|
+
let value = source[prop];
|
|
7
|
+
if (value !== undefined) {
|
|
8
|
+
target[prop] = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
|
|
3
|
+
let scrollBarWidth;
|
|
4
|
+
|
|
5
|
+
export default function() {
|
|
6
|
+
if (Vue.prototype.$isServer) return 0;
|
|
7
|
+
if (scrollBarWidth !== undefined) return scrollBarWidth;
|
|
8
|
+
|
|
9
|
+
const outer = document.createElement('div');
|
|
10
|
+
outer.className = 'el-scrollbar__wrap';
|
|
11
|
+
outer.style.visibility = 'hidden';
|
|
12
|
+
outer.style.width = '100px';
|
|
13
|
+
outer.style.position = 'absolute';
|
|
14
|
+
outer.style.top = '-9999px';
|
|
15
|
+
document.body.appendChild(outer);
|
|
16
|
+
|
|
17
|
+
const widthNoScroll = outer.offsetWidth;
|
|
18
|
+
outer.style.overflow = 'scroll';
|
|
19
|
+
|
|
20
|
+
const inner = document.createElement('div');
|
|
21
|
+
inner.style.width = '100%';
|
|
22
|
+
outer.appendChild(inner);
|
|
23
|
+
|
|
24
|
+
const widthWithScroll = inner.offsetWidth;
|
|
25
|
+
outer.parentNode.removeChild(outer);
|
|
26
|
+
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
27
|
+
|
|
28
|
+
return scrollBarWidth;
|
|
29
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
|
|
3
|
+
export function isString(obj) {
|
|
4
|
+
return Object.prototype.toString.call(obj) === '[object String]';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isObject(obj) {
|
|
8
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isHtmlElement(node) {
|
|
12
|
+
return node && node.nodeType === Node.ELEMENT_NODE;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* - Inspired:
|
|
17
|
+
* https://github.com/jashkenas/underscore/blob/master/modules/isFunction.js
|
|
18
|
+
*/
|
|
19
|
+
let isFunction = (functionToCheck) => {
|
|
20
|
+
var getType = {};
|
|
21
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (typeof /./ !== 'function' && typeof Int8Array !== 'object' && (Vue.prototype.$isServer || typeof document.childNodes !== 'function')) {
|
|
25
|
+
isFunction = function (obj) {
|
|
26
|
+
return typeof obj === 'function' || false;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
isFunction
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const isUndefined = (val) => {
|
|
35
|
+
return val === void 0;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const isDefined = (val) => {
|
|
39
|
+
return val !== undefined && val !== null;
|
|
40
|
+
};
|