@lambo-design/shared 1.0.0-beta.243 → 1.0.0-beta.246

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 (201) hide show
  1. package/config/config.js +51 -51
  2. package/config/env.js +4 -4
  3. package/config/index.js +7 -7
  4. package/config/themes/atrovirens/atrovirens.css +576 -575
  5. package/config/themes/atrovirens/atrovirens.css.map +1 -1
  6. package/config/themes/atrovirens/atrovirens.less +668 -667
  7. package/config/themes/atrovirens/var.less +675 -674
  8. package/config/themes/blue/blue.css +576 -575
  9. package/config/themes/blue/blue.css.map +1 -1
  10. package/config/themes/blue/blue.less +670 -669
  11. package/config/themes/blue/var.less +678 -677
  12. package/config/themes/blue-white/blue-white.css +576 -575
  13. package/config/themes/blue-white/blue-white.css.map +1 -1
  14. package/config/themes/blue-white/blue-white.less +670 -669
  15. package/config/themes/blue-white/var.less +677 -676
  16. package/config/themes/blue-white-tight/blue-white-tight.css +577 -576
  17. package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -1
  18. package/config/themes/blue-white-tight/blue-white-tight.less +672 -672
  19. package/config/themes/blue-white-tight/var.less +678 -677
  20. package/config/themes/danqing/danqing.css +576 -575
  21. package/config/themes/danqing/danqing.css.map +1 -1
  22. package/config/themes/danqing/danqing.less +669 -668
  23. package/config/themes/danqing/danqing.wxss +576 -572
  24. package/config/themes/danqing/var.less +680 -679
  25. package/config/themes/deep/deep.css +576 -575
  26. package/config/themes/deep/deep.css.map +1 -1
  27. package/config/themes/deep/deep.less +670 -669
  28. package/config/themes/deep/var.less +678 -677
  29. package/config/themes/default/default.css +576 -575
  30. package/config/themes/default/default.css.map +1 -1
  31. package/config/themes/default/default.less +672 -671
  32. package/config/themes/default/var.less +678 -677
  33. package/config/themes/eap/eap.css +576 -575
  34. package/config/themes/eap/eap.css.map +1 -1
  35. package/config/themes/eap/eap.less +672 -671
  36. package/config/themes/eap/var.less +678 -677
  37. package/config/themes/gold/gold.css +576 -575
  38. package/config/themes/gold/gold.css.map +1 -1
  39. package/config/themes/gold/gold.less +672 -671
  40. package/config/themes/gold/var.less +678 -677
  41. package/config/themes/index.js +28 -28
  42. package/config/themes/lime/lime.css +576 -575
  43. package/config/themes/lime/lime.css.map +1 -1
  44. package/config/themes/lime/lime.less +672 -671
  45. package/config/themes/lime/var.less +679 -678
  46. package/config/themes/orange/orange.css +576 -575
  47. package/config/themes/orange/orange.css.map +1 -1
  48. package/config/themes/orange/orange.less +672 -671
  49. package/config/themes/orange/var.less +679 -678
  50. package/config/themes/red/red.css +576 -575
  51. package/config/themes/red/red.css.map +1 -1
  52. package/config/themes/red/red.less +672 -671
  53. package/config/themes/red/var.less +678 -677
  54. package/config/themes/theme-atrovirens.js +559 -558
  55. package/config/themes/theme-blue.js +559 -558
  56. package/config/themes/theme-bw.js +559 -558
  57. package/config/themes/theme-bwt.js +561 -559
  58. package/config/themes/theme-danqing.js +559 -558
  59. package/config/themes/theme-deep.js +559 -558
  60. package/config/themes/theme-default.js +559 -558
  61. package/config/themes/theme-eap.js +559 -558
  62. package/config/themes/theme-gold.js +559 -558
  63. package/config/themes/theme-lime.js +559 -558
  64. package/config/themes/theme-orange.js +560 -559
  65. package/config/themes/theme-red.js +559 -558
  66. package/config/themes/theme-white.js +558 -557
  67. package/config/themes/white/var.less +676 -675
  68. package/config/themes/white/white.css +576 -575
  69. package/config/themes/white/white.css.map +1 -1
  70. package/config/themes/white/white.less +669 -668
  71. package/directives/index.js +23 -23
  72. package/directives/module/draggable.js +56 -56
  73. package/directives/module/permission.js +49 -49
  74. package/directives/module/print.js +1 -1
  75. package/directives/module/vue-print-nb/README.md +63 -63
  76. package/directives/module/vue-print-nb/print.js +94 -94
  77. package/directives/module/vue-print-nb/printarea.js +532 -532
  78. package/index.js +10 -10
  79. package/nstyles/common.less +197 -197
  80. package/nstyles/components/404.less +46 -46
  81. package/nstyles/components/button.less +34 -34
  82. package/nstyles/components/date-picker.less +37 -37
  83. package/nstyles/components/drawer.less +20 -20
  84. package/nstyles/components/dropdown.less +18 -18
  85. package/nstyles/components/excel-flow.less +72 -72
  86. package/nstyles/components/form.less +313 -313
  87. package/nstyles/components/index.less +23 -23
  88. package/nstyles/components/layout/collect.less +10 -10
  89. package/nstyles/components/layout/detail-view.less +107 -107
  90. package/nstyles/components/layout/full-screen.less +7 -7
  91. package/nstyles/components/layout/index.less +7 -7
  92. package/nstyles/components/layout/other-menu.less +142 -142
  93. package/nstyles/components/layout/page-view.less +101 -101
  94. package/nstyles/components/layout/sider-trigger.less +41 -41
  95. package/nstyles/components/layout/tags-nav.less +113 -113
  96. package/nstyles/components/modal.less +85 -85
  97. package/nstyles/components/n-button.less +131 -131
  98. package/nstyles/components/n-image-preview.less +131 -131
  99. package/nstyles/components/n-model/index.less +19 -19
  100. package/nstyles/components/n-model/report-index.less +43 -43
  101. package/nstyles/components/n-panel.less +40 -40
  102. package/nstyles/components/n-picker.less +37 -37
  103. package/nstyles/components/n-sign.less +17 -17
  104. package/nstyles/components/n-tooltip.less +10 -10
  105. package/nstyles/components/panel.less +31 -31
  106. package/nstyles/components/select.less +3 -3
  107. package/nstyles/components/sign.less +27 -27
  108. package/nstyles/components/table.less +315 -315
  109. package/nstyles/components/tree.less +158 -158
  110. package/nstyles/components/upload.less +164 -164
  111. package/nstyles/index.less +5 -5
  112. package/nstyles/reset.less +65 -65
  113. package/nstyles/third/ag.less +174 -174
  114. package/nstyles/third/index.less +11 -11
  115. package/nstyles/third/view-design.less +366 -366
  116. package/nstyles/variables/base.less +143 -143
  117. package/nstyles/variables/index.less +4 -4
  118. package/nstyles/variables/theme/default/button.less +7 -7
  119. package/nstyles/variables/theme/default/common.less +57 -57
  120. package/nstyles/variables/theme/default/index.less +7 -7
  121. package/nstyles/variables/theme/default/layout.less +40 -40
  122. package/nstyles/variables/theme/default/table.less +37 -37
  123. package/nstyles/variables/theme/default/tag.less +3 -3
  124. package/nstyles/variables/theme/default/upload.less +3 -3
  125. package/nstyles/variables/theme/index.less +13 -13
  126. package/nstyles/variables/theme/lsv/button.less +7 -0
  127. package/nstyles/variables/theme/lsv/common.less +39 -0
  128. package/nstyles/variables/theme/lsv/index.less +5 -0
  129. package/nstyles/variables/theme/lsv/layout.less +21 -0
  130. package/nstyles/variables/theme/lsv/table.less +20 -0
  131. package/nstyles/variables/theme/lsv/tag.less +3 -0
  132. package/nstyles/variables/theme/small/button.less +7 -7
  133. package/nstyles/variables/theme/small/common.less +39 -39
  134. package/nstyles/variables/theme/small/index.less +5 -5
  135. package/nstyles/variables/theme/small/layout.less +21 -21
  136. package/nstyles/variables/theme/small/table.less +17 -17
  137. package/nstyles/variables/theme/small/tag.less +3 -3
  138. package/package.json +1 -1
  139. package/plugin/index.js +12 -12
  140. package/plugin/module/date-format.js +30 -30
  141. package/plugin/module/loading.js +26 -26
  142. package/plugin/module/warn-handler.js +11 -11
  143. package/styles/variables.less +21 -21
  144. package/utils/ajax/cacheconf.js +19 -19
  145. package/utils/ajax/content-type.js +30 -30
  146. package/utils/ajax/index.js +12 -12
  147. package/utils/ajax/interceptors.js +97 -97
  148. package/utils/ajax/sseFetchUtil.js +71 -71
  149. package/utils/assist.js +147 -147
  150. package/utils/base64.js +126 -126
  151. package/utils/blob.js +47 -47
  152. package/utils/bus.js +3 -3
  153. package/utils/crypto/index.js +48 -48
  154. package/utils/crypto/md5.js +152 -152
  155. package/utils/crypto/sm3.js +235 -235
  156. package/utils/date.js +381 -381
  157. package/utils/dict/built-in-dict.js +20 -20
  158. package/utils/dict/index.js +167 -167
  159. package/utils/dom.js +38 -38
  160. package/utils/event.js +72 -72
  161. package/utils/excel.js +655 -655
  162. package/utils/file.js +19 -19
  163. package/utils/form/validate.js +29 -29
  164. package/utils/half-year.js +68 -68
  165. package/utils/index.js +41 -41
  166. package/utils/json.js +29 -29
  167. package/utils/lodop.js +165 -165
  168. package/utils/menu/before-close.js +17 -17
  169. package/utils/menu/index.js +395 -395
  170. package/utils/mime_type.js +67 -67
  171. package/utils/modelerUtil.js +227 -227
  172. package/utils/n/api.js +22 -22
  173. package/utils/n/date.js +57 -57
  174. package/utils/n/index.js +9 -9
  175. package/utils/n/is-type.js +176 -176
  176. package/utils/n/number.js +144 -144
  177. package/utils/n/permission-cache.js +11 -11
  178. package/utils/n/reuqest/axiosN.js +17 -17
  179. package/utils/n/reuqest/content-type.js +19 -19
  180. package/utils/n/reuqest/interceptors.js +95 -95
  181. package/utils/n/reuqest/url-params.js +12 -12
  182. package/utils/n/storage.js +51 -51
  183. package/utils/n/token.js +51 -51
  184. package/utils/n/user-cache.js +11 -11
  185. package/utils/n/user.js +34 -34
  186. package/utils/n/uuid.js +16 -16
  187. package/utils/n-generator-routers.js +208 -208
  188. package/utils/n-router.js +205 -205
  189. package/utils/n-theme.js +30 -30
  190. package/utils/number.js +180 -180
  191. package/utils/oss.js +57 -57
  192. package/utils/platform.js +1343 -1334
  193. package/utils/quarter.js +58 -58
  194. package/utils/storage.js +198 -198
  195. package/utils/theme.js +138 -138
  196. package/utils/transform.js +204 -204
  197. package/utils/type.js +102 -102
  198. package/utils/util.js +795 -795
  199. package/utils/validator.js +181 -181
  200. package/utils/vxetable/index.js +25 -25
  201. package/utils/zoomScroll.js +9 -9
@@ -1,97 +1,97 @@
1
- import qs from 'qs'
2
- import cacheRules from "./cacheconf";
3
- import {getToken,getUrlParams} from '../platform'
4
- import Bus from '../bus';
5
-
6
-
7
- let timer1, timer2;
8
- let hasDialog = false;
9
-
10
- function requestInterceptors(config) {
11
- const params = getUrlParams();
12
-
13
- let token = getToken();
14
- if (token) {
15
- config.headers.token = token;
16
- }
17
-
18
- //sso_token认证
19
- if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
20
- config.params = Object.assign({
21
- sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
22
- sso_id: params.sso_id
23
- }, config.params)
24
- }
25
-
26
- //oauth认证
27
- if (params.hasOwnProperty('token')) {
28
- if (config.url.indexOf('?') === -1) {
29
- config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
30
- } else {
31
- config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
32
- }
33
- }
34
-
35
- if (config.method === 'post') {
36
- // payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
37
- // 为true时用于匹配@requestBody定义参数的接口
38
- // 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
39
- if (!config.payload) {
40
- config.data = qs.stringify(config.data)
41
- }
42
- } else if (config.method === 'get') {
43
- for (let rule of cacheRules) {
44
- if (rule.test(config.url)) {
45
- return config;
46
- }
47
- }
48
- if (config.url.indexOf('?') === -1) {
49
- config.url = config.url + "?t=" + new Date().getTime();
50
- } else {
51
- config.url = config.url + "&t=" + new Date().getTime();
52
- }
53
- }
54
- return config;
55
- }
56
-
57
- function requestError(error) {
58
- console.error("服务器内部异常,请稍候再试",error);
59
- return Promise.reject(error);
60
- }
61
-
62
- function responseInterceptors(response) {
63
- const data = response.data;
64
- if (data instanceof Object) {
65
- const code = data["code"];
66
- if (code === 10106) {
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
- }
79
- }
80
- }
81
- return response;
82
- }
83
-
84
- function responseError(error) {
85
- clearTimeout(timer2);
86
- timer2 = setTimeout(function () {
87
- console.error("服务器内部异常,请稍候再试");
88
- }, 500)
89
- return Promise.reject(error);
90
- }
91
-
92
- export default {
93
- requestInterceptors,
94
- responseInterceptors,
95
- requestError,
96
- responseError
97
- }
1
+ import qs from 'qs'
2
+ import cacheRules from "./cacheconf";
3
+ import {getToken,getUrlParams} from '../platform'
4
+ import Bus from '../bus';
5
+
6
+
7
+ let timer1, timer2;
8
+ let hasDialog = false;
9
+
10
+ function requestInterceptors(config) {
11
+ const params = getUrlParams();
12
+
13
+ let token = getToken();
14
+ if (token) {
15
+ config.headers.token = token;
16
+ }
17
+
18
+ //sso_token认证
19
+ if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
20
+ config.params = Object.assign({
21
+ sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
22
+ sso_id: params.sso_id
23
+ }, config.params)
24
+ }
25
+
26
+ //oauth认证
27
+ if (params.hasOwnProperty('token')) {
28
+ if (config.url.indexOf('?') === -1) {
29
+ config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
30
+ } else {
31
+ config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
32
+ }
33
+ }
34
+
35
+ if (config.method === 'post') {
36
+ // payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
37
+ // 为true时用于匹配@requestBody定义参数的接口
38
+ // 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
39
+ if (!config.payload) {
40
+ config.data = qs.stringify(config.data)
41
+ }
42
+ } else if (config.method === 'get') {
43
+ for (let rule of cacheRules) {
44
+ if (rule.test(config.url)) {
45
+ return config;
46
+ }
47
+ }
48
+ if (config.url.indexOf('?') === -1) {
49
+ config.url = config.url + "?t=" + new Date().getTime();
50
+ } else {
51
+ config.url = config.url + "&t=" + new Date().getTime();
52
+ }
53
+ }
54
+ return config;
55
+ }
56
+
57
+ function requestError(error) {
58
+ console.error("服务器内部异常,请稍候再试",error);
59
+ return Promise.reject(error);
60
+ }
61
+
62
+ function responseInterceptors(response) {
63
+ const data = response.data;
64
+ if (data instanceof Object) {
65
+ const code = data["code"];
66
+ if (code === 10106) {
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
+ }
79
+ }
80
+ }
81
+ return response;
82
+ }
83
+
84
+ function responseError(error) {
85
+ clearTimeout(timer2);
86
+ timer2 = setTimeout(function () {
87
+ console.error("服务器内部异常,请稍候再试");
88
+ }, 500)
89
+ return Promise.reject(error);
90
+ }
91
+
92
+ export default {
93
+ requestInterceptors,
94
+ responseInterceptors,
95
+ requestError,
96
+ responseError
97
+ }
@@ -1,71 +1,71 @@
1
- class CustomEventSource {
2
- constructor(url, options) {
3
- this.url = url;
4
- this.options = options || {};
5
- this.listeners = {};
6
- this.connect();
7
- }
8
-
9
- connect() {
10
- fetch(this.url, { ...this.options, method: 'POST' })
11
- .then(response => {
12
- if (response.ok && response.body) {
13
- const reader = response.body.getReader();
14
- this.read(reader);
15
- } else {
16
- throw new Error('Failed to connect to the SSE endpoint.');
17
- }
18
- })
19
- .catch(error => {
20
- console.error('Connection error:', error);
21
- this.dispatchEvent('message_finished',error);
22
- });
23
- }
24
-
25
- read(reader) {
26
- reader.read().then(({done,value}) => {
27
- if (done) {
28
- this.dispatchEvent('message_finished');
29
- } else {
30
- const decoder = new TextDecoder('utf-8');
31
- const chunk = decoder.decode(value, { stream: true });
32
- if (chunk) {
33
- const lines = chunk.split('\n');
34
- for (let line of lines) {
35
- if (line.startsWith('data:')) {
36
- const data = line.substring(5).trim(); // 去掉 'data:' 前缀
37
- if (data) {
38
- this.dispatchEvent('message', { data: data });
39
- }
40
- } else if (line.startsWith("{") && line.endsWith("}")) {
41
- this.dispatchEvent('message', { data: line });
42
- }
43
- }
44
- }
45
-
46
- this.read(reader);
47
- }
48
- }).catch(error => {
49
- console.error('Read error:', error);
50
- this.dispatchEvent('message_finished',error);
51
- });
52
- }
53
-
54
- addEventListener(type, listener) {
55
- if (!this.listeners[type]) {
56
- this.listeners[type] = [];
57
- }
58
- this.listeners[type].push(listener);
59
- }
60
-
61
- dispatchEvent(type, event) {
62
- if (this.listeners[type]) {
63
- this.listeners[type].forEach(listener => listener(event));
64
- }
65
- }
66
- }
67
-
68
- export default CustomEventSource;
69
- export {
70
- CustomEventSource
71
- }
1
+ class CustomEventSource {
2
+ constructor(url, options) {
3
+ this.url = url;
4
+ this.options = options || {};
5
+ this.listeners = {};
6
+ this.connect();
7
+ }
8
+
9
+ connect() {
10
+ fetch(this.url, { ...this.options, method: 'POST' })
11
+ .then(response => {
12
+ if (response.ok && response.body) {
13
+ const reader = response.body.getReader();
14
+ this.read(reader);
15
+ } else {
16
+ throw new Error('Failed to connect to the SSE endpoint.');
17
+ }
18
+ })
19
+ .catch(error => {
20
+ console.error('Connection error:', error);
21
+ this.dispatchEvent('message_finished',error);
22
+ });
23
+ }
24
+
25
+ read(reader) {
26
+ reader.read().then(({done,value}) => {
27
+ if (done) {
28
+ this.dispatchEvent('message_finished');
29
+ } else {
30
+ const decoder = new TextDecoder('utf-8');
31
+ const chunk = decoder.decode(value, { stream: true });
32
+ if (chunk) {
33
+ const lines = chunk.split('\n');
34
+ for (let line of lines) {
35
+ if (line.startsWith('data:')) {
36
+ const data = line.substring(5).trim(); // 去掉 'data:' 前缀
37
+ if (data) {
38
+ this.dispatchEvent('message', { data: data });
39
+ }
40
+ } else if (line.startsWith("{") && line.endsWith("}")) {
41
+ this.dispatchEvent('message', { data: line });
42
+ }
43
+ }
44
+ }
45
+
46
+ this.read(reader);
47
+ }
48
+ }).catch(error => {
49
+ console.error('Read error:', error);
50
+ this.dispatchEvent('message_finished',error);
51
+ });
52
+ }
53
+
54
+ addEventListener(type, listener) {
55
+ if (!this.listeners[type]) {
56
+ this.listeners[type] = [];
57
+ }
58
+ this.listeners[type].push(listener);
59
+ }
60
+
61
+ dispatchEvent(type, event) {
62
+ if (this.listeners[type]) {
63
+ this.listeners[type].forEach(listener => listener(event));
64
+ }
65
+ }
66
+ }
67
+
68
+ export default CustomEventSource;
69
+ export {
70
+ CustomEventSource
71
+ }
package/utils/assist.js CHANGED
@@ -1,147 +1,147 @@
1
- // deepCopy
2
-
3
-
4
- export function deepCopy(data) {
5
- let i;
6
- const t = typeOf(data);
7
- let o;
8
-
9
- if (t === 'array') {
10
- o = [];
11
- } else if (t === 'object') {
12
- o = {};
13
- } else {
14
- return data;
15
- }
16
-
17
- if (t === 'array') {
18
- for (i = 0; i < data.length; i++) {
19
- o.push(deepCopy(data[i]));
20
- }
21
- } else if (t === 'object') {
22
- for (i in data) {
23
- o[i] = deepCopy(data[i]);
24
- }
25
- }
26
- return o;
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
- }
45
-
46
- export function typeOf(obj) {
47
- const toString = Object.prototype.toString;
48
- const map = {
49
- '[object Boolean]': 'boolean',
50
- '[object Number]': 'number',
51
- '[object String]': 'string',
52
- '[object Function]': 'function',
53
- '[object Array]': 'array',
54
- '[object Date]': 'date',
55
- '[object RegExp]': 'regExp',
56
- '[object Undefined]': 'undefined',
57
- '[object Null]': 'null',
58
- '[object Object]': 'object'
59
- };
60
- return map[toString.call(obj)];
61
- }
62
-
63
- export function operateBtn(vm, h, currentRow, operationName, operation, type, permission, disabled = false) {
64
- let renderOption = {
65
- props: {
66
- type: type,
67
- size: "small",
68
- ghost: true,
69
- disabled: disabled
70
- },
71
- style: {
72
- margin: '0 2px'
73
- },
74
- on: {
75
- 'click': () => {
76
- operation(vm, currentRow);
77
- }
78
- }
79
- }
80
- if(permission){
81
- renderOption['directives'] = [{
82
- name: "permission",
83
- value: permission
84
- }]
85
- }
86
-
87
- return h('Button', renderOption, operationName);
88
-
89
- }
90
-
91
- export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
92
- let renderOption = {
93
- style: {
94
- margin: '0 4px'
95
- },
96
- on: {
97
- 'click': () => {
98
- operation(vm, currentRow);
99
- }
100
- }
101
- }
102
- if(permission){
103
- renderOption['directives'] = [{
104
- name: "permission",
105
- value: permission
106
- }]
107
- }
108
-
109
- return h('a', renderOption, operationName);
110
- }
111
-
112
- export function operateMore(vm, h, operation) {
113
- return h("Dropdown", {
114
- style: {
115
- marginLeft: "4px",
116
- },
117
- props: {
118
- transfer: true,
119
- }
120
- }, [
121
- h("a", {
122
- style: {
123
- margin: '0 4px',
124
- borderBottom: '0px solid #CC9900',
125
- }
126
- }, [
127
- h("span", "更多"),
128
- h("Icon", {
129
- props: {
130
- type: "ios-arrow-down"
131
- },
132
- })
133
- ]),
134
- h('DropdownMenu', {
135
- slot: "list",
136
- }, operation)
137
- ]);
138
- }
139
-
140
- export function isJson(arg) {
141
- return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
142
- };
143
-
144
-
145
- export function isObject(item) {
146
- return (item && typeof item === 'object' && !Array.isArray(item));
147
- }
1
+ // deepCopy
2
+
3
+
4
+ export function deepCopy(data) {
5
+ let i;
6
+ const t = typeOf(data);
7
+ let o;
8
+
9
+ if (t === 'array') {
10
+ o = [];
11
+ } else if (t === 'object') {
12
+ o = {};
13
+ } else {
14
+ return data;
15
+ }
16
+
17
+ if (t === 'array') {
18
+ for (i = 0; i < data.length; i++) {
19
+ o.push(deepCopy(data[i]));
20
+ }
21
+ } else if (t === 'object') {
22
+ for (i in data) {
23
+ o[i] = deepCopy(data[i]);
24
+ }
25
+ }
26
+ return o;
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
+ }
45
+
46
+ export function typeOf(obj) {
47
+ const toString = Object.prototype.toString;
48
+ const map = {
49
+ '[object Boolean]': 'boolean',
50
+ '[object Number]': 'number',
51
+ '[object String]': 'string',
52
+ '[object Function]': 'function',
53
+ '[object Array]': 'array',
54
+ '[object Date]': 'date',
55
+ '[object RegExp]': 'regExp',
56
+ '[object Undefined]': 'undefined',
57
+ '[object Null]': 'null',
58
+ '[object Object]': 'object'
59
+ };
60
+ return map[toString.call(obj)];
61
+ }
62
+
63
+ export function operateBtn(vm, h, currentRow, operationName, operation, type, permission, disabled = false) {
64
+ let renderOption = {
65
+ props: {
66
+ type: type,
67
+ size: "small",
68
+ ghost: true,
69
+ disabled: disabled
70
+ },
71
+ style: {
72
+ margin: '0 2px'
73
+ },
74
+ on: {
75
+ 'click': () => {
76
+ operation(vm, currentRow);
77
+ }
78
+ }
79
+ }
80
+ if(permission){
81
+ renderOption['directives'] = [{
82
+ name: "permission",
83
+ value: permission
84
+ }]
85
+ }
86
+
87
+ return h('Button', renderOption, operationName);
88
+
89
+ }
90
+
91
+ export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
92
+ let renderOption = {
93
+ style: {
94
+ margin: '0 4px'
95
+ },
96
+ on: {
97
+ 'click': () => {
98
+ operation(vm, currentRow);
99
+ }
100
+ }
101
+ }
102
+ if(permission){
103
+ renderOption['directives'] = [{
104
+ name: "permission",
105
+ value: permission
106
+ }]
107
+ }
108
+
109
+ return h('a', renderOption, operationName);
110
+ }
111
+
112
+ export function operateMore(vm, h, operation) {
113
+ return h("Dropdown", {
114
+ style: {
115
+ marginLeft: "4px",
116
+ },
117
+ props: {
118
+ transfer: true,
119
+ }
120
+ }, [
121
+ h("a", {
122
+ style: {
123
+ margin: '0 4px',
124
+ borderBottom: '0px solid #CC9900',
125
+ }
126
+ }, [
127
+ h("span", "更多"),
128
+ h("Icon", {
129
+ props: {
130
+ type: "ios-arrow-down"
131
+ },
132
+ })
133
+ ]),
134
+ h('DropdownMenu', {
135
+ slot: "list",
136
+ }, operation)
137
+ ]);
138
+ }
139
+
140
+ export function isJson(arg) {
141
+ return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
142
+ };
143
+
144
+
145
+ export function isObject(item) {
146
+ return (item && typeof item === 'object' && !Array.isArray(item));
147
+ }