@lambo-design/shared 1.0.0-beta.9 → 1.0.0-beta.91

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 (69) hide show
  1. package/config/config.js +2 -2
  2. package/config/themes/atrovirens/atrovirens.css +533 -0
  3. package/config/themes/atrovirens/atrovirens.css.map +1 -0
  4. package/config/themes/atrovirens/atrovirens.less +624 -0
  5. package/config/themes/atrovirens/var.less +627 -0
  6. package/config/themes/blue/blue.css +533 -0
  7. package/config/themes/blue/blue.css.map +1 -0
  8. package/config/themes/blue/blue.less +624 -0
  9. package/config/themes/blue/var.less +637 -0
  10. package/config/themes/default/default.css +300 -8
  11. package/config/themes/default/default.css.map +1 -0
  12. package/config/themes/default/default.less +378 -74
  13. package/config/themes/default/var.less +320 -6
  14. package/config/themes/eap/eap.css +533 -0
  15. package/config/themes/eap/eap.css.map +1 -0
  16. package/config/themes/eap/eap.less +624 -0
  17. package/config/themes/eap/var.less +628 -0
  18. package/config/themes/gold/gold.css +533 -0
  19. package/config/themes/gold/gold.css.map +1 -0
  20. package/config/themes/gold/gold.less +624 -0
  21. package/config/themes/gold/var.less +321 -6
  22. package/config/themes/index.js +12 -3
  23. package/config/themes/lime/lime.css +533 -0
  24. package/config/themes/lime/lime.css.map +1 -0
  25. package/config/themes/lime/lime.less +624 -0
  26. package/config/themes/lime/var.less +321 -6
  27. package/config/themes/orange/orange.css +533 -0
  28. package/config/themes/orange/orange.css.map +1 -0
  29. package/config/themes/orange/orange.less +624 -0
  30. package/config/themes/orange/var.less +629 -0
  31. package/config/themes/red/red.css +533 -0
  32. package/config/themes/red/red.css.map +1 -0
  33. package/config/themes/red/red.less +624 -0
  34. package/config/themes/red/var.less +628 -0
  35. package/config/themes/theme-atrovirens.js +515 -0
  36. package/config/themes/theme-blue.js +521 -0
  37. package/config/themes/theme-default.js +272 -9
  38. package/config/themes/theme-eap.js +515 -0
  39. package/config/themes/theme-gold.js +273 -10
  40. package/config/themes/theme-lime.js +273 -10
  41. package/config/themes/theme-orange.js +516 -0
  42. package/config/themes/theme-red.js +515 -0
  43. package/directives/index.js +23 -0
  44. package/directives/module/draggable.js +56 -0
  45. package/directives/module/permission.js +49 -0
  46. package/index.js +3 -1
  47. package/package.json +23 -20
  48. package/plugin/index.js +12 -0
  49. package/plugin/module/date-format.js +30 -0
  50. package/plugin/module/loading.js +26 -0
  51. package/plugin/module/warn-handler.js +11 -0
  52. package/utils/ajax/interceptors.js +13 -6
  53. package/utils/assist.js +179 -9
  54. package/utils/base64.js +126 -0
  55. package/utils/date.js +343 -300
  56. package/utils/dict/built-in-dict.js +20 -0
  57. package/utils/dict/index.js +75 -0
  58. package/utils/excel.js +122 -21
  59. package/utils/form/validate.js +30 -0
  60. package/utils/lodop.js +5 -0
  61. package/utils/menu/index.js +25 -2
  62. package/utils/modelerUtil.js +4 -1
  63. package/utils/number.js +72 -0
  64. package/utils/platform.js +120 -7
  65. package/utils/theme.js +5 -0
  66. package/config/themes/gold/default.css +0 -241
  67. package/config/themes/gold/default.less +0 -319
  68. package/config/themes/lime/default.css +0 -241
  69. package/config/themes/lime/default.less +0 -319
@@ -0,0 +1,12 @@
1
+ import DateFormat from "./module/date-format";
2
+ import Loading from "./module/loading";
3
+ import WarnHandler from "./module/warn-handler";
4
+ export default {
5
+ install : function (Vue, options) {
6
+ DateFormat.install(Vue,options);
7
+ Loading.install(Vue.options);
8
+ WarnHandler.install(Vue.options);
9
+ }
10
+
11
+ }
12
+ export { DateFormat , Loading , WarnHandler}
@@ -0,0 +1,30 @@
1
+ export default {
2
+ /**
3
+ * 对Date的扩展,将 Date 转化为指定格式的String
4
+ * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
5
+ * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
6
+ * 例:
7
+ * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
8
+ * (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
9
+ */
10
+ install: function (Vue, options) {
11
+ Date.prototype.Format = function (fmt) {
12
+ let o = {
13
+ "M+": this.getMonth() + 1, //月份
14
+ "d+": this.getDate(), //日
15
+ "H+": this.getHours(), //小时
16
+ "m+": this.getMinutes(), //分
17
+ "s+": this.getSeconds(), //秒
18
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
19
+ "S": this.getMilliseconds() //毫秒
20
+ };
21
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
22
+ for (let k in o)
23
+ if (new RegExp("(" + k + ")").test(fmt)) {
24
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
25
+ }
26
+ return fmt;
27
+ }
28
+
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ //通用Loading
4
+ Vue.prototype.$ShowLoading = function(text){
5
+ this.$Spin.show({
6
+ render: (h) => {
7
+ return h('div', [
8
+ h('Icon', {
9
+ 'class': 'demo-spin-icon-load',
10
+ props: {
11
+ type: 'ios-loading',
12
+ size: 24
13
+ }
14
+ }),
15
+ h('div', text||'Loading')
16
+ ])
17
+ }
18
+ });
19
+ }
20
+
21
+ Vue.prototype.$CloseLoading = function(){
22
+ this.$Spin.hide();
23
+ }
24
+ }
25
+
26
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ Vue.config.warnHandler = function (err, vm, info) {
4
+ if (err.toString().indexOf("Component names should conform to valid custom element name in html5 specification")>0){
5
+ console.warn("[Lambo warn]: " + err + info);
6
+ }else{
7
+ console.error("[Vue warn]: " + err + info);
8
+ }
9
+ }
10
+ }
11
+ }
@@ -5,6 +5,7 @@ import Bus from '../bus';
5
5
 
6
6
 
7
7
  let timer1, timer2;
8
+ let hasDialog = false;
8
9
 
9
10
  function requestInterceptors(config) {
10
11
  const params = getUrlParams();
@@ -63,12 +64,18 @@ function responseInterceptors(response) {
63
64
  if (data instanceof Object) {
64
65
  const code = data["code"];
65
66
  if (code === 10106) {
66
- clearTimeout(timer1);
67
- timer1 = setTimeout(function () {
68
- if (confirm("会话已失效,是否重新登录")) {
69
- Bus.$emit("needLogin");
70
- }
71
- }, 500)
67
+ if (!hasDialog) {
68
+ clearTimeout(timer1);
69
+ timer1 = setTimeout(function () {
70
+ hasDialog = true;
71
+ if (confirm("会话已失效,是否重新登录")) {
72
+ hasDialog = false;
73
+ Bus.$emit("needLogin");
74
+ } else {
75
+ hasDialog = false;
76
+ }
77
+ }, 500)
78
+ }
72
79
  }
73
80
  }
74
81
  return response;
package/utils/assist.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // deepCopy
2
2
 
3
+
3
4
  export function deepCopy(data) {
4
5
  let i;
5
6
  const t = typeOf(data);
@@ -24,6 +25,23 @@ export function deepCopy(data) {
24
25
  }
25
26
  return o;
26
27
  }
28
+ export function deepMerge(target, ...sources) {
29
+ if (!sources.length) return target;
30
+ const source = sources.shift();
31
+
32
+ if (isObject(target) && isObject(source)) {
33
+ for (const key in source) {
34
+ if (isObject(source[key])) {
35
+ if (!target[key]) Object.assign(target, { [key]: {} });
36
+ deepMerge(target[key], source[key]);
37
+ } else {
38
+ Object.assign(target, { [key]: source[key] });
39
+ }
40
+ }
41
+ }
42
+
43
+ return deepMerge(target, ...sources);
44
+ }
27
45
 
28
46
  export function typeOf(obj) {
29
47
  const toString = Object.prototype.toString;
@@ -43,16 +61,12 @@ export function typeOf(obj) {
43
61
  }
44
62
 
45
63
  export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
46
- return h('Button', {
64
+ let renderOption = {
47
65
  props: {
48
66
  type: type,
49
67
  size: "small",
50
68
  ghost: true,
51
69
  },
52
- directives: [{
53
- name: "permission",
54
- value: permission
55
- }],
56
70
  style: {
57
71
  margin: '0 2px'
58
72
  },
@@ -61,19 +75,175 @@ export function operateBtn(vm, h, currentRow, operationName, operation, type, pe
61
75
  operation(vm, currentRow);
62
76
  }
63
77
  }
64
- }, operationName);
78
+ }
79
+ if(permission){
80
+ renderOption['directives'] = [{
81
+ name: "permission",
82
+ value: permission
83
+ }]
84
+ }
85
+
86
+ return h('Button', renderOption, operationName);
87
+
65
88
  }
66
89
 
67
- export function operateHref(vm, h, currentRow, operationName, operation) {
68
- return h('a', {
90
+ export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
91
+ let renderOption = {
92
+ style: {
93
+ margin: '0 4px'
94
+ },
69
95
  on: {
70
96
  'click': () => {
71
97
  operation(vm, currentRow);
72
98
  }
73
99
  }
74
- }, operationName);
100
+ }
101
+ if(permission){
102
+ renderOption['directives'] = [{
103
+ name: "permission",
104
+ value: permission
105
+ }]
106
+ }
107
+
108
+ return h('a', renderOption, operationName);
75
109
  }
76
110
 
77
111
  export function isJson(arg) {
78
112
  return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
79
113
  };
114
+
115
+
116
+ export function isObject(item) {
117
+ return (item && typeof item === 'object' && !Array.isArray(item));
118
+ }
119
+
120
+
121
+ export const checkPhone = function (str) {
122
+ var reg = /^1[3456789]\d{9}$/
123
+ // ^1 以1开头
124
+ // [3456789] 第2位,使用原子表里的任意一个原子都可以
125
+ // \d{9}$ 第三位 朝后可以是任意数字 并且最后结尾必须是数字
126
+ if (reg.test(str)) {
127
+ return true
128
+ } else {
129
+ return false
130
+ }
131
+ }
132
+
133
+ export function checkIdCard(idcard) {
134
+ let Errors = new Array(
135
+ '验证通过!',
136
+ '身份证号码位数不对!',
137
+ '身份证号码出生日期超出范围或含有非法字符!',
138
+ '身份证号码校验错误!',
139
+ '身份证地区非法!',
140
+ )
141
+ let area = {
142
+ 11: '北京',
143
+ 12: '天津',
144
+ 13: '河北',
145
+ 14: '山西',
146
+ 15: '内蒙古',
147
+ 21: '辽宁',
148
+ 22: '吉林',
149
+ 23: '黑龙江',
150
+ 31: '上海',
151
+ 32: '江苏',
152
+ 33: '浙江',
153
+ 34: '安徽',
154
+ 35: '福建',
155
+ 36: '江西',
156
+ 37: '山东',
157
+ 41: '河南',
158
+ 42: '湖北',
159
+ 43: '湖南',
160
+ 44: '广东',
161
+ 45: '广西',
162
+ 46: '海南',
163
+ 50: '重庆',
164
+ 51: '四川',
165
+ 52: '贵州',
166
+ 53: '云南',
167
+ 54: '西藏',
168
+ 61: '陕西',
169
+ 62: '甘肃',
170
+ 63: '青海',
171
+ 64: '宁夏',
172
+ 65: '新疆',
173
+ 71: '台湾',
174
+ 81: '香港',
175
+ 82: '澳门',
176
+ 91: '国外',
177
+ }
178
+ let Y, JYM
179
+ let S, M, ereg
180
+ let idcard_array = new Array()
181
+ idcard_array = idcard.split('')
182
+ //地区检验
183
+ if (area[parseInt(idcard.substr(0, 2))] == null) return Errors[4]
184
+ //身份号码位数及格式检验
185
+ switch (idcard.length) {
186
+ case 15:
187
+ if (
188
+ (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 ||
189
+ ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 &&
190
+ (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)
191
+ ) {
192
+ ereg =
193
+ /^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/ //测试出生日期的合法性
194
+ } else {
195
+ ereg =
196
+ /^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/ //测试出生日期的合法性
197
+ }
198
+ if (ereg.test(idcard)) {
199
+ return Errors[0]
200
+ } else {
201
+ return Errors[2]
202
+ }
203
+ case 18:
204
+ if (
205
+ parseInt(idcard.substr(6, 4)) % 4 == 0 ||
206
+ (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)
207
+ ) {
208
+ ereg =
209
+ /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/ //闰年出生日期的合法性正则表达式
210
+ } else {
211
+ ereg =
212
+ /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/ //平年出生日期的合法性正则表达式
213
+ }
214
+ if (ereg.test(idcard)) {
215
+ //测试出生日期的合法性
216
+ //计算校验位
217
+ S =
218
+ (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7 +
219
+ (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9 +
220
+ (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10 +
221
+ (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5 +
222
+ (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8 +
223
+ (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4 +
224
+ (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2 +
225
+ parseInt(idcard_array[7]) * 1 +
226
+ parseInt(idcard_array[8]) * 6 +
227
+ parseInt(idcard_array[9]) * 3
228
+ Y = S % 11
229
+ M = 'F'
230
+ JYM = '10X98765432'
231
+ M = JYM.substr(Y, 1) //判断校验位
232
+ if (M == idcard_array[17]) return Errors[0] //检测ID的校验位
233
+ else return Errors[3]
234
+ } else return Errors[2]
235
+ default:
236
+ return Errors[1]
237
+ }
238
+ }
239
+
240
+ export function getBirthday(a) {
241
+ if (15 == a.length || 18 == a.length) {
242
+ let left = a.length - 12
243
+ let right = a.length - 4
244
+ let b = a.slice(left, right)
245
+ if (8 == b.length) {
246
+ return b.substring(0, 4) + '-' + b.substring(4, 6) + '-' + b.substring(6)
247
+ } else return '1970-01-01' //0;
248
+ } else return '1970-01-01' //1;
249
+ }
@@ -0,0 +1,126 @@
1
+ let Base64 = {
2
+ Base64Chars:
3
+ "abcdefghijklmnopqrstuv" +
4
+ "wxyzABCDEFGHIJKLMNOP" +
5
+ "QRSTUVWXYZ0123456789@*-",
6
+ /**
7
+ * Encode a string to a Base64 string follow Bse64 regular.
8
+ * @param s, a normal string
9
+ * @return a Base64 string
10
+ */
11
+ encode: function (s) {
12
+ if (!s || s.length == 0) return s;
13
+
14
+ var d = "";
15
+ var b = this.ucs2_utf8(s);
16
+ var b0, b1, b2, b3;
17
+ var len = b.length;
18
+ var i = 0;
19
+ while (i < len) {
20
+ var tmp = b[i++];
21
+ b0 = (tmp & 0xfc) >> 2;
22
+ b1 = (tmp & 0x03) << 4;
23
+ if (i < len) {
24
+ tmp = b[i++];
25
+ b1 |= (tmp & 0xf0) >> 4;
26
+ b2 = (tmp & 0x0f) << 2;
27
+ if (i < len) {
28
+ tmp = b[i++];
29
+ b2 |= (tmp & 0xc0) >> 6;
30
+ b3 = tmp & 0x3f;
31
+ } else {
32
+ b3 = 64; // 1 byte "-" is supplement
33
+
34
+ }
35
+ } else {
36
+ b2 = b3 = 64; // 2 bytes "-" are supplement
37
+
38
+ }
39
+
40
+ d += this.Base64Chars.charAt(b0);
41
+ d += this.Base64Chars.charAt(b1);
42
+ d += this.Base64Chars.charAt(b2);
43
+ d += this.Base64Chars.charAt(b3);
44
+ }
45
+
46
+ return d;
47
+
48
+ },
49
+
50
+ /**
51
+ * Encodes a ucs2 string to a utf8 integer array.
52
+ * @param s, a string
53
+ * @return an integer array
54
+ */
55
+ ucs2_utf8: function (s) {
56
+ if (!s) return null;
57
+ var d = new Array();
58
+ if (s == "") return d;
59
+
60
+ var c = 0, i = 0, j = 0;
61
+ var len = s.length;
62
+ while (i < len) {
63
+ c = s.charCodeAt(i++);
64
+ if (c <= 0x7f) {
65
+ // 1 byte
66
+
67
+ d[j++] = c;
68
+ } else if ((c >= 0x80) && (c <= 0x7ff)) {
69
+ // 2 bytes
70
+
71
+ d[j++] = ((c >> 6) & 0x1f) | 0xc0;
72
+ d[j++] = (c & 0x3f) | 0x80;
73
+ } else {
74
+ // 3 bytes
75
+
76
+ d[j++] = (c >> 12) | 0xe0;
77
+ d[j++] = ((c >> 6) & 0x3f) | 0x80;
78
+ d[j++] = (c & 0x3f) | 0x80;
79
+ }
80
+ }
81
+
82
+ return d;
83
+ },
84
+ /**
85
+ * Encodes a utf8 integer array to a ucs2 string.
86
+ * @param s, an integer array
87
+ * @return a string
88
+ */
89
+ utf8_ucs2: function (s) {
90
+ if (!s) return null;
91
+ var len = s.length;
92
+ if (len == 0) return "";
93
+
94
+ var d = "";
95
+ var c = 0, i = 0, tmp = 0;
96
+ while (i < len) {
97
+ c = s[i++];
98
+ if ((c & 0xe0) == 0xe0) {
99
+ // 3 bytes
100
+
101
+ tmp = (c & 0x0f) << 12;
102
+ c = s[i++];
103
+ tmp |= ((c & 0x3f) << 6);
104
+ c = s[i++];
105
+ tmp |= (c & 0x3f);
106
+ } else if ((c & 0xc0) == 0xc0) {
107
+ // 2 bytes
108
+
109
+ tmp = (c & 0x1f) << 6;
110
+ c = s[i++];
111
+ tmp |= (c & 0x3f);
112
+ } else {
113
+ // 1 byte
114
+
115
+ tmp = c;
116
+ }
117
+
118
+ d += String.fromCharCode(tmp);
119
+ }
120
+
121
+ return d;
122
+ }
123
+ };
124
+ export {
125
+ Base64
126
+ }