byt-ui 0.1.29 → 1.2.1
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/README.md +131 -101
- package/lib/byt-ui.common.js +89407 -90448
- package/lib/byt-ui.css +1 -1
- package/lib/byt-ui.umd.js +110299 -111340
- package/lib/byt-ui.umd.min.js +125 -125
- package/package.json +4 -3
- package/packages/index.js +3 -2
- package/packages/plugins/index.js +2 -2
- package/packages/plugins/vxe-table.js +29 -8
- package/packages/common/modules/sentry.js +0 -186
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "byt-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "byt组件库",
|
|
6
6
|
"author": {
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"moment": "^2.29.4",
|
|
27
27
|
"vue": "^2.6.14",
|
|
28
28
|
"vue-i18n": "8",
|
|
29
|
-
"vxe-
|
|
29
|
+
"vxe-pc-ui": "3.8.9",
|
|
30
|
+
"vxe-table": "3.17.6",
|
|
30
31
|
"xe-utils": "^3.5.6"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
38
39
|
"@vue/cli-service": "~5.0.0",
|
|
39
40
|
"babel-plugin-component": "^1.1.1",
|
|
40
|
-
"babel-plugin-import": "1.13.
|
|
41
|
+
"babel-plugin-import": "^1.13.8",
|
|
41
42
|
"babel-preset-env": "^1.7.0",
|
|
42
43
|
"copy-webpack-plugin": "^13.0.0",
|
|
43
44
|
"eslint": "^7.32.0",
|
package/packages/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2022-09-15 17:02:55
|
|
5
|
-
* @LastEditTime: 2025-
|
|
5
|
+
* @LastEditTime: 2025-08-07 11:07:32
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
// import Vue from 'vue'
|
|
@@ -12,7 +12,7 @@ import components from './components.js'
|
|
|
12
12
|
import Common from './common/index'
|
|
13
13
|
|
|
14
14
|
// 第三方依赖
|
|
15
|
-
import { useElementUI, useVxeTable } from './plugins'
|
|
15
|
+
import { useElementUI, useVxeTable, useVxeUI } from './plugins'
|
|
16
16
|
import locale from './locale'
|
|
17
17
|
|
|
18
18
|
const Cmps = {}
|
|
@@ -25,6 +25,7 @@ const install = function (Vue, opts = {}) {
|
|
|
25
25
|
locale.use(opts.locale);
|
|
26
26
|
locale.i18n(Vue, opts.i18n);
|
|
27
27
|
useElementUI(Vue, opts);
|
|
28
|
+
useVxeUI(Vue, opts);
|
|
28
29
|
useVxeTable(Vue, opts);
|
|
29
30
|
components.map(component => {
|
|
30
31
|
Vue.component(component.name, component);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2025-03-12 10:56:47
|
|
5
|
-
* @LastEditTime: 2025-
|
|
5
|
+
* @LastEditTime: 2025-08-07 11:06:27
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
export { useElementUI } from './element-ui'
|
|
9
|
-
export { useVxeTable } from './vxe-table'
|
|
9
|
+
export { useVxeTable, useVxeUI } from './vxe-table'
|
|
@@ -2,31 +2,52 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2024-06-26 11:20:33
|
|
5
|
-
* @LastEditTime: 2025-
|
|
5
|
+
* @LastEditTime: 2025-08-07 11:50:00
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
import { t } from '../locale';
|
|
9
|
+
// 导入主题变量,也可以重写主题变量
|
|
10
|
+
import 'vxe-table/styles/cssvar.scss'
|
|
11
|
+
import 'vxe-pc-ui/styles/cssvar.scss'
|
|
12
|
+
// 框架按需加载少引入一个scss文件,必须手动引入;
|
|
13
|
+
import 'vxe-pc-ui/styles/theme/base.scss';
|
|
14
|
+
import {
|
|
15
|
+
VxeIcon,
|
|
16
|
+
VxeInput,
|
|
17
|
+
VxeTooltip,
|
|
18
|
+
VxeSelect,
|
|
19
|
+
VxeOption
|
|
20
|
+
} from 'vxe-pc-ui'
|
|
9
21
|
import {
|
|
10
22
|
// 全局实例对象
|
|
11
|
-
VXETable,
|
|
23
|
+
VxeUI as VXETable,
|
|
12
24
|
// 可选组件
|
|
13
|
-
VxeIcon,
|
|
14
25
|
VxeTable,
|
|
15
26
|
VxeColumn,
|
|
16
27
|
VxeColgroup,
|
|
17
|
-
|
|
28
|
+
VxeGrid,
|
|
29
|
+
VxeToolbar
|
|
18
30
|
} from 'vxe-table'
|
|
19
31
|
|
|
32
|
+
export const useVxeUI = function (Vue, opts = {}) {
|
|
33
|
+
Vue.use(VxeIcon)
|
|
34
|
+
Vue.use(VxeInput)
|
|
35
|
+
Vue.use(VxeInput)
|
|
36
|
+
Vue.use(VxeTooltip)
|
|
37
|
+
Vue.use(VxeSelect)
|
|
38
|
+
Vue.use(VxeOption)
|
|
39
|
+
}
|
|
40
|
+
|
|
20
41
|
export const useVxeTable = function (Vue, opts = {}) {
|
|
21
42
|
VXETable.setConfig({
|
|
22
43
|
size: opts.size || 'small',
|
|
44
|
+
zIndex: opts.zIndex || 3000,
|
|
23
45
|
i18n: (key, value) => t(key, value)
|
|
24
46
|
})
|
|
25
|
-
|
|
26
|
-
// 可选组件
|
|
27
|
-
Vue.use(VxeIcon)
|
|
47
|
+
VXETable.setTheme('light')
|
|
28
48
|
Vue.use(VxeTable)
|
|
29
49
|
Vue.use(VxeColumn)
|
|
30
50
|
Vue.use(VxeColgroup)
|
|
31
|
-
Vue.use(
|
|
51
|
+
Vue.use(VxeGrid)
|
|
52
|
+
Vue.use(VxeToolbar)
|
|
32
53
|
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Author: 王国火
|
|
4
|
-
* @Date: 2024-04-18 15:37:44
|
|
5
|
-
* @LastEditTime: 2024-04-23 09:30:29
|
|
6
|
-
* @LastEditors: 王国火
|
|
7
|
-
*/
|
|
8
|
-
import * as sentry from '@sentry/vue'
|
|
9
|
-
import { getCookie } from './cookie'
|
|
10
|
-
import { getStore } from './store'
|
|
11
|
-
class Sentry {
|
|
12
|
-
constructor(config = {}) {
|
|
13
|
-
const { axios, Vue, project, router, options = {}} = config
|
|
14
|
-
this.axios = axios;
|
|
15
|
-
this.Vue = Vue || window.Vue;
|
|
16
|
-
this.project = project;
|
|
17
|
-
this.router = router;
|
|
18
|
-
this.options = options;
|
|
19
|
-
this.sentryModule = sentry
|
|
20
|
-
// 注册调用获取dsn;
|
|
21
|
-
this.register();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getUserInfo() {
|
|
25
|
-
// 处理要提交的用户信息
|
|
26
|
-
const { fullPath } = this.router.currentRoute;
|
|
27
|
-
const userInfo = getCookie('userInfo') || getStore('userInfo');
|
|
28
|
-
const tenantId = getCookie('tenantId') || ''
|
|
29
|
-
const params = {
|
|
30
|
-
path: fullPath,
|
|
31
|
-
title: document.title,
|
|
32
|
-
ip: window.location.host
|
|
33
|
-
}
|
|
34
|
-
let opts = {};
|
|
35
|
-
if (userInfo) {
|
|
36
|
-
const info = JSON.parse(userInfo);
|
|
37
|
-
const { username, email } = info;
|
|
38
|
-
opts = Object.assign(params, info, {
|
|
39
|
-
id: tenantId,
|
|
40
|
-
username,
|
|
41
|
-
email
|
|
42
|
-
})
|
|
43
|
-
} else {
|
|
44
|
-
opts = params
|
|
45
|
-
}
|
|
46
|
-
return opts
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
captureEvent({
|
|
50
|
-
message = '',
|
|
51
|
-
level = 'info',
|
|
52
|
-
tags = {
|
|
53
|
-
type: 'xhr-error',
|
|
54
|
-
category: 'xhr-category'
|
|
55
|
-
},
|
|
56
|
-
extra = {},
|
|
57
|
-
breadcrumbs = []
|
|
58
|
-
}) {
|
|
59
|
-
// 错误上报
|
|
60
|
-
sentry.captureEvent({
|
|
61
|
-
message,
|
|
62
|
-
level,
|
|
63
|
-
tags,
|
|
64
|
-
extra,
|
|
65
|
-
breadcrumbs
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
init(dsn) {
|
|
69
|
-
// init调用
|
|
70
|
-
const params = {
|
|
71
|
-
Vue: this.Vue,
|
|
72
|
-
dsn,
|
|
73
|
-
logErrors: false,
|
|
74
|
-
integrations: [
|
|
75
|
-
sentry.browserTracingIntegration(),
|
|
76
|
-
sentry.replayIntegration({
|
|
77
|
-
maskAllText: false,
|
|
78
|
-
blockAllMedia: false
|
|
79
|
-
}),
|
|
80
|
-
sentry.breadcrumbsIntegration({
|
|
81
|
-
// 关闭控制台打印捕获
|
|
82
|
-
console: false
|
|
83
|
-
})
|
|
84
|
-
],
|
|
85
|
-
initialScope: (scope) => {
|
|
86
|
-
return scope
|
|
87
|
-
},
|
|
88
|
-
beforeSend: (e) => {
|
|
89
|
-
// 请求发送前添加用户信息
|
|
90
|
-
e.user = this.getUserInfo();
|
|
91
|
-
return e;
|
|
92
|
-
},
|
|
93
|
-
beforeSendTransaction: (e) => {
|
|
94
|
-
// 请求发送前添加用户信息,修改transaction为title
|
|
95
|
-
const spans = e.spans;
|
|
96
|
-
const spanTemp = spans.find(
|
|
97
|
-
(item) => item.getSpanJSON().description == e.tags.transaction
|
|
98
|
-
);
|
|
99
|
-
if (spanTemp) {
|
|
100
|
-
e.user = JSON.parse(spanTemp.getSpanJSON().data.user);
|
|
101
|
-
} else {
|
|
102
|
-
e.user = this.getUserInfo();
|
|
103
|
-
}
|
|
104
|
-
e.transaction = spanTemp
|
|
105
|
-
? spanTemp.getSpanJSON().description
|
|
106
|
-
: document.title;
|
|
107
|
-
return e;
|
|
108
|
-
},
|
|
109
|
-
// 任何请求都会调用的函数,处理请求status_code不是200时,或者code=1,自定义上报错误信息
|
|
110
|
-
beforeBreadcrumb: (scope, hint) => {
|
|
111
|
-
if (scope.category == 'xhr') {
|
|
112
|
-
const statusCode = scope.data.status_code;
|
|
113
|
-
const response = JSON.parse(hint.xhr.responseText);
|
|
114
|
-
const { code, msg } = response;
|
|
115
|
-
switch (statusCode * 1) {
|
|
116
|
-
case 200:
|
|
117
|
-
if (code == 1) {
|
|
118
|
-
this.captureEvent({
|
|
119
|
-
message: msg,
|
|
120
|
-
level: 'error',
|
|
121
|
-
extra: {
|
|
122
|
-
message: hint.xhr.__sentry_xhr_v3__,
|
|
123
|
-
type: 'request'
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
default:
|
|
129
|
-
this.captureEvent({
|
|
130
|
-
message: msg,
|
|
131
|
-
level: 'error',
|
|
132
|
-
extra: {
|
|
133
|
-
message: hint.xhr.__sentry_xhr_v3__,
|
|
134
|
-
type: 'request'
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return scope
|
|
141
|
-
},
|
|
142
|
-
// 版本号,默认情况下会自动设置或读取环境变量中 SENTRY_RELEASE 的值,一般需要搭配其他插件配套使用。
|
|
143
|
-
release: this.project, // 区分项目版本号
|
|
144
|
-
// Sentry SDK 将任何上下文数据标准化到给定的深度。任何包含结构比这更深的数据的 key 都将使用其类型([Object] 或 [Array])进行修剪和标记,而不会进一步遍历树。默认情况下,步行执行 3 级深度。
|
|
145
|
-
normalizeDepth: 3, // 默认3
|
|
146
|
-
// 该变量控制应捕获的面包屑总量。该默认为100,但您可以将其设置为任何数字。但是,您应该知道Sentry有一个最大有效负载大小,任何超过该有效负载大小的事件都将被丢弃。
|
|
147
|
-
maxBreadcrumbs: 50,
|
|
148
|
-
// Performance Monitoring
|
|
149
|
-
tracesSampleRate: 1.0, // Capture 100% of the transactions
|
|
150
|
-
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
|
|
151
|
-
tracePropagationTargets: ['localhost'],
|
|
152
|
-
// Session Replay
|
|
153
|
-
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
|
154
|
-
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
|
|
155
|
-
}
|
|
156
|
-
// 允许自定义配置覆盖、合并默认配置
|
|
157
|
-
sentry.init(Object.assign({}, params, this.options))
|
|
158
|
-
}
|
|
159
|
-
register() {
|
|
160
|
-
this.axios({
|
|
161
|
-
url: '/leo-tech-bridge/sysParam/getSentryDsn',
|
|
162
|
-
method: 'GET',
|
|
163
|
-
showError: false
|
|
164
|
-
}).then(res => {
|
|
165
|
-
// 需要兼容商城和业务中台
|
|
166
|
-
const val = res instanceof Object ? res.data : res;
|
|
167
|
-
if (val) {
|
|
168
|
-
// 重新处理拼接dsn地址
|
|
169
|
-
const localhost = window.location;
|
|
170
|
-
const result = val.split('@');
|
|
171
|
-
const dsn = `${localhost.protocol}//${result[0]}@${localhost.host}${result[1]}`;
|
|
172
|
-
this.init(dsn);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export default {
|
|
179
|
-
install(Vue, options) {
|
|
180
|
-
const sentry = new Sentry(Object.assign({
|
|
181
|
-
Vue
|
|
182
|
-
}, options))
|
|
183
|
-
Vue.prototype.$sentry = sentry
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|