@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.
Files changed (65) hide show
  1. package/dict-area/area-city.js +614 -0
  2. package/dict-area/area-county.js +3394 -0
  3. package/dict-area/area-province.js +37 -0
  4. package/echart-map/js/china-contour.js +46 -0
  5. package/echart-map/js/china.js +46 -0
  6. package/echart-map/js/world.js +20 -0
  7. package/echart-map/json/china-cities.json +1 -0
  8. package/echart-map/json/china-contour.json +1 -0
  9. package/echart-map/json/china.json +1 -0
  10. package/echart-map/json/province/anhui.json +1 -0
  11. package/echart-map/json/province/aomen.json +1 -0
  12. package/echart-map/json/province/beijing.json +1 -0
  13. package/echart-map/json/province/chongqing.json +1 -0
  14. package/echart-map/json/province/fujian.json +1 -0
  15. package/echart-map/json/province/gansu.json +1 -0
  16. package/echart-map/json/province/guangdong.json +1 -0
  17. package/echart-map/json/province/guangxi.json +1 -0
  18. package/echart-map/json/province/guizhou.json +1 -0
  19. package/echart-map/json/province/hainan.json +1 -0
  20. package/echart-map/json/province/hebei.json +1 -0
  21. package/echart-map/json/province/heilongjiang.json +1 -0
  22. package/echart-map/json/province/henan.json +1 -0
  23. package/echart-map/json/province/hubei.json +1 -0
  24. package/echart-map/json/province/hunan.json +1 -0
  25. package/echart-map/json/province/jiangsu.json +1 -0
  26. package/echart-map/json/province/jiangxi.json +1 -0
  27. package/echart-map/json/province/jilin.json +1 -0
  28. package/echart-map/json/province/liaoning.json +1 -0
  29. package/echart-map/json/province/neimenggu.json +1 -0
  30. package/echart-map/json/province/ningxia.json +1 -0
  31. package/echart-map/json/province/qinghai.json +1 -0
  32. package/echart-map/json/province/shandong.json +1 -0
  33. package/echart-map/json/province/shanghai.json +1 -0
  34. package/echart-map/json/province/shanxi.json +1 -0
  35. package/echart-map/json/province/shanxi1.json +1 -0
  36. package/echart-map/json/province/sichuan.json +1 -0
  37. package/echart-map/json/province/taiwan.json +1 -0
  38. package/echart-map/json/province/tianjin.json +1 -0
  39. package/echart-map/json/province/xianggang.json +1 -0
  40. package/echart-map/json/province/xinjiang.json +1 -0
  41. package/echart-map/json/province/xizang.json +1 -0
  42. package/echart-map/json/province/yunnan.json +1 -0
  43. package/echart-map/json/province/zhejiang.json +1 -0
  44. package/echart-map/json/world.json +1 -0
  45. package/lib/cv-pc-ui.common.js +5193 -257
  46. package/lib/cv-pc-ui.common.js.map +1 -1
  47. package/lib/cv-pc-ui.umd.js +5193 -257
  48. package/lib/cv-pc-ui.umd.js.map +1 -1
  49. package/lib/cv-pc-ui.umd.min.js +1 -1
  50. package/lib/cv-pc-ui.umd.min.js.map +1 -1
  51. package/package.json +8 -5
  52. package/src/dict/area-city.js +614 -0
  53. package/src/dict/area-city2.js +613 -0
  54. package/src/dict/area-district.js +3394 -0
  55. package/src/dict/area-province.js +37 -0
  56. package/src/mixins/cascader.js +1 -2
  57. package/src/mixins/emitter.js +33 -0
  58. package/src/mixins/formItem.js +5 -6
  59. package/src/mixins/input.js +2 -2
  60. package/src/mixins/migrating.js +54 -0
  61. package/src/utils/dom.js +227 -0
  62. package/src/utils/merge.js +15 -0
  63. package/src/utils/scrollbar-width.js +29 -0
  64. package/src/utils/types.js +40 -0
  65. package/src/utils/util.js +241 -0
@@ -0,0 +1,241 @@
1
+ import Vue from 'vue';
2
+ import { isString, isObject } from './types';
3
+
4
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
5
+
6
+ export function noop() { };
7
+
8
+ export function hasOwn(obj, key) {
9
+ return hasOwnProperty.call(obj, key);
10
+ };
11
+
12
+ function extend(to, _from) {
13
+ for (let key in _from) {
14
+ to[key] = _from[key];
15
+ }
16
+ return to;
17
+ };
18
+
19
+ export function toObject(arr) {
20
+ var res = {};
21
+ for (let i = 0; i < arr.length; i++) {
22
+ if (arr[i]) {
23
+ extend(res, arr[i]);
24
+ }
25
+ }
26
+ return res;
27
+ };
28
+
29
+ export const getValueByPath = function (object, prop) {
30
+ prop = prop || '';
31
+ const paths = prop.split('.');
32
+ let current = object;
33
+ let result = null;
34
+ for (let i = 0, j = paths.length; i < j; i++) {
35
+ const path = paths[i];
36
+ if (!current) break;
37
+
38
+ if (i === j - 1) {
39
+ result = current[path];
40
+ break;
41
+ }
42
+ current = current[path];
43
+ }
44
+ return result;
45
+ };
46
+
47
+ export function getPropByPath(obj, path, strict) {
48
+ let tempObj = obj;
49
+ path = path.replace(/\[(\w+)\]/g, '.$1');
50
+ path = path.replace(/^\./, '');
51
+
52
+ let keyArr = path.split('.');
53
+ let i = 0;
54
+ for (let len = keyArr.length; i < len - 1; ++i) {
55
+ if (!tempObj && !strict) break;
56
+ let key = keyArr[i];
57
+ if (key in tempObj) {
58
+ tempObj = tempObj[key];
59
+ } else {
60
+ if (strict) {
61
+ throw new Error('please transfer a valid prop path to form item!');
62
+ }
63
+ break;
64
+ }
65
+ }
66
+ return {
67
+ o: tempObj,
68
+ k: keyArr[i],
69
+ v: tempObj ? tempObj[keyArr[i]] : null
70
+ };
71
+ };
72
+
73
+ export const generateId = function () {
74
+ return Math.floor(Math.random() * 10000);
75
+ };
76
+
77
+ export const valueEquals = (a, b) => {
78
+ // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
79
+ if (a === b) return true;
80
+ if (!(a instanceof Array)) return false;
81
+ if (!(b instanceof Array)) return false;
82
+ if (a.length !== b.length) return false;
83
+ for (let i = 0; i !== a.length; ++i) {
84
+ if (a[i] !== b[i]) return false;
85
+ }
86
+ return true;
87
+ };
88
+
89
+ export const escapeRegexpString = (value = '') => String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
90
+
91
+ // TODO: use native Array.find, Array.findIndex when IE support is dropped
92
+ export const arrayFindIndex = function (arr, pred) {
93
+ for (let i = 0; i !== arr.length; ++i) {
94
+ if (pred(arr[i])) {
95
+ return i;
96
+ }
97
+ }
98
+ return -1;
99
+ };
100
+
101
+ export const arrayFind = function (arr, pred) {
102
+ const idx = arrayFindIndex(arr, pred);
103
+ return idx !== -1 ? arr[idx] : undefined;
104
+ };
105
+
106
+ // coerce truthy value to array
107
+ export const coerceTruthyValueToArray = function (val) {
108
+ if (Array.isArray(val)) {
109
+ return val;
110
+ } else if (val) {
111
+ return [val];
112
+ } else {
113
+ return [];
114
+ }
115
+ };
116
+
117
+ export const isIE = function () {
118
+ return !Vue.prototype.$isServer && !isNaN(Number(document.documentMode));
119
+ };
120
+
121
+ export const isEdge = function () {
122
+ return !Vue.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
123
+ };
124
+
125
+ export const isFirefox = function () {
126
+ return !Vue.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
127
+ };
128
+
129
+ export const autoprefixer = function (style) {
130
+ if (typeof style !== 'object') return style;
131
+ const rules = ['transform', 'transition', 'animation'];
132
+ const prefixes = ['ms-', 'webkit-'];
133
+ rules.forEach(rule => {
134
+ const value = style[rule];
135
+ if (rule && value) {
136
+ prefixes.forEach(prefix => {
137
+ style[prefix + rule] = value;
138
+ });
139
+ }
140
+ });
141
+ return style;
142
+ };
143
+
144
+ export const kebabCase = function (str) {
145
+ const hyphenateRE = /([^-])([A-Z])/g;
146
+ return str
147
+ .replace(hyphenateRE, '$1-$2')
148
+ .replace(hyphenateRE, '$1-$2')
149
+ .toLowerCase();
150
+ };
151
+
152
+ export const capitalize = function (str) {
153
+ if (!isString(str)) return str;
154
+ return str.charAt(0).toUpperCase() + str.slice(1);
155
+ };
156
+
157
+ export const looseEqual = function (a, b) {
158
+ const isObjectA = isObject(a);
159
+ const isObjectB = isObject(b);
160
+ if (isObjectA && isObjectB) {
161
+ return JSON.stringify(a) === JSON.stringify(b);
162
+ } else if (!isObjectA && !isObjectB) {
163
+ return String(a) === String(b);
164
+ } else {
165
+ return false;
166
+ }
167
+ };
168
+
169
+ export const arrayEquals = function (arrayA, arrayB) {
170
+ arrayA = arrayA || [];
171
+ arrayB = arrayB || [];
172
+
173
+ if (arrayA.length !== arrayB.length) {
174
+ return false;
175
+ }
176
+
177
+ for (let i = 0; i < arrayA.length; i++) {
178
+ if (!looseEqual(arrayA[i], arrayB[i])) {
179
+ return false;
180
+ }
181
+ }
182
+
183
+ return true;
184
+ };
185
+
186
+ export const isEqual = function (value1, value2) {
187
+ if (Array.isArray(value1) && Array.isArray(value2)) {
188
+ return arrayEquals(value1, value2);
189
+ }
190
+ return looseEqual(value1, value2);
191
+ };
192
+
193
+ export const isEmpty = function (val) {
194
+ // null or undefined
195
+ if (val == null) return true;
196
+
197
+ if (typeof val === 'boolean') return false;
198
+
199
+ if (typeof val === 'number') return !val;
200
+
201
+ if (val instanceof Error) return val.message === '';
202
+
203
+ switch (Object.prototype.toString.call(val)) {
204
+ // String or Array
205
+ case '[object String]':
206
+ case '[object Array]':
207
+ return !val.length;
208
+
209
+ // Map or Set or File
210
+ case '[object File]':
211
+ case '[object Map]':
212
+ case '[object Set]': {
213
+ return !val.size;
214
+ }
215
+ // Plain Object
216
+ case '[object Object]': {
217
+ return !Object.keys(val).length;
218
+ }
219
+ }
220
+
221
+ return false;
222
+ };
223
+
224
+ export function rafThrottle(fn) {
225
+ let locked = false;
226
+ return function (...args) {
227
+ if (locked) return;
228
+ locked = true;
229
+ window.requestAnimationFrame(_ => {
230
+ fn.apply(this, args);
231
+ locked = false;
232
+ });
233
+ };
234
+ }
235
+
236
+ export function objToArray(obj) {
237
+ if (Array.isArray(obj)) {
238
+ return obj;
239
+ }
240
+ return isEmpty(obj) ? [] : [obj];
241
+ }