web-component-gallery 1.3.12 → 2.0.2
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/dist/923.umd.js +1 -0
- package/dist/index.umd.js +1 -12252
- package/dist/js.umd.js +1 -0
- package/dist/style.css +17 -0
- package/dist/style.umd.js +1 -0
- package/{method → extensions}/AMap.js +1 -5
- package/{plugins/method → extensions}/Dialog.js +2 -2
- package/{lib/lazy_use.js → extensions/index.js} +16 -2
- package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
- package/lib/amap-comp/index.js +18 -0
- package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
- package/lib/amap-comp/style/index.js +1 -0
- package/lib/amap-comp/style/index.less +1 -0
- package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
- package/lib/amap-draw/style/index.js +1 -0
- package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
- package/lib/browse/index.jsx +0 -2
- package/lib/browse/style/index.js +1 -0
- package/lib/button/Button.js +1 -3
- package/lib/button/style/index.js +1 -0
- package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
- package/lib/date-time/style/index.js +1 -0
- package/lib/date-time/style/index.less +7 -0
- package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
- package/lib/descriptions-list/style/index.js +1 -0
- package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
- package/lib/directory/index.js +8 -0
- package/lib/directory/style/index.js +1 -0
- package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
- package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
- package/lib/form-comp/ARadio.vue +70 -0
- package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
- package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
- package/lib/form-comp/ATagsInput.vue +88 -0
- package/lib/form-comp/ATimePicker.vue +127 -0
- package/lib/{form/components → form-comp}/AUpload.vue +2 -17
- package/lib/form-comp/index.js +37 -0
- package/lib/form-comp/style/ACascaderMultiple.less +117 -0
- package/lib/form-comp/style/ARadio.less +0 -0
- package/lib/form-comp/style/ARangePicker.less +11 -0
- package/lib/form-comp/style/ASelectCustom.less +4 -0
- package/lib/form-comp/style/ATagsInput.less +24 -0
- package/lib/form-comp/style/ATimePicker.less +8 -0
- package/lib/form-comp/style/AUpload.less +15 -0
- package/lib/form-comp/style/index.js +1 -0
- package/lib/form-comp/style/index.less +7 -0
- package/lib/index.js +60 -45
- package/lib/modal/index.jsx +4 -6
- package/lib/modal/style/index.js +1 -0
- package/lib/modal/{index.less → style/index.less} +6 -7
- package/{plugins/lib/form → lib/model}/Model.js +1 -3
- package/lib/model/index.js +7 -0
- package/lib/model/style/index.js +1 -0
- package/lib/{form/style/Model.less → model/style/index.less} +10 -10
- package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
- package/lib/{form → model}/utils/resetFields.js +1 -1
- package/lib/no-data/directive.js +65 -0
- package/lib/no-data/index.js +21 -0
- package/lib/no-data/index.vue +35 -0
- package/lib/no-data/style/index.js +1 -0
- package/lib/no-data/style/index.less +15 -0
- package/lib/search/index.js +7 -0
- package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
- package/lib/search/style/index.js +1 -0
- package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
- package/lib/style/mixins.less +1 -1
- package/lib/{svgIcon → svg-icon}/index.vue +1 -17
- package/lib/svg-icon/style/index.js +1 -0
- package/lib/svg-icon/style/index.less +15 -0
- package/lib/table/index.vue +4 -8
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/index.less +12 -13
- package/lib/tree/index.js +2 -11
- package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
- package/lib/tree/style/index.js +1 -0
- package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
- package/lib/weather/index.vue +1 -9
- package/lib/weather/style/index.js +1 -0
- package/lib/weather/style/index.less +7 -0
- package/package.json +16 -34
- package/utils/Axios.js +91 -82
- package/utils/Postcss.js +12 -8
- package/README.md +0 -24
- package/dist/amap.umd.js +0 -12252
- package/dist/avatar.umd.js +0 -5337
- package/dist/button.umd.js +0 -5845
- package/dist/dateTime.umd.js +0 -1287
- package/dist/form.umd.js +0 -9981
- package/dist/multiTab.umd.js +0 -5556
- package/dist/svgIcon.umd.js +0 -1167
- package/dist/table.umd.js +0 -6306
- package/dist/tree.umd.js +0 -5393
- package/dist/weather.umd.js +0 -1167
- package/lib/amap/components/AmapSearch/index.less +0 -16
- package/lib/amap/index.js +0 -13
- package/lib/avatar/index.js +0 -7
- package/lib/avatar/index.vue +0 -47
- package/lib/basic/404.vue +0 -24
- package/lib/dateTime/index.vue +0 -43
- package/lib/form/Model.js +0 -153
- package/lib/form/Search.vue +0 -159
- package/lib/form/components/ACascaderMultiple.vue +0 -766
- package/lib/form/components/ARadio.vue +0 -74
- package/lib/form/components/ATagsInput.vue +0 -93
- package/lib/form/components/ATimePicker.vue +0 -73
- package/lib/form/index.js +0 -55
- package/lib/form/style/Search.less +0 -34
- package/lib/form/utils/render.js +0 -85
- package/lib/iframe/events.js +0 -2
- package/lib/iframe/index.jsx +0 -234
- package/lib/iframe/index.less +0 -19
- package/lib/multiTab/APIEnums.js +0 -17
- package/lib/multiTab/MultiTab.jsx +0 -237
- package/lib/multiTab/RouteAPI.js +0 -71
- package/lib/multiTab/RouteContent.jsx +0 -90
- package/lib/multiTab/RouteKeepAlive.js +0 -183
- package/lib/multiTab/events.js +0 -2
- package/lib/multiTab/index.js +0 -15
- package/lib/multiTab/index.less +0 -73
- package/lib/style/index.less +0 -2
- package/lib/tree/Directory.js +0 -428
- package/lib/tree/Tree.vue +0 -181
- package/lib/tree/style/Tree.less +0 -52
- package/method/Dialog.js +0 -134
- package/method/index.js +0 -12
- package/plugins/lib/amap/AmapDraw.jsx +0 -349
- package/plugins/lib/amap/AmapDraw.less +0 -45
- package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
- package/plugins/lib/amap/index.js +0 -13
- package/plugins/lib/avatar/index.js +0 -7
- package/plugins/lib/avatar/index.vue +0 -47
- package/plugins/lib/basic/404.vue +0 -24
- package/plugins/lib/browse/index.jsx +0 -76
- package/plugins/lib/browse/index.less +0 -4
- package/plugins/lib/button/Button.js +0 -89
- package/plugins/lib/button/index.js +0 -7
- package/plugins/lib/dateTime/index.js +0 -7
- package/plugins/lib/descriptions/index.jsx +0 -108
- package/plugins/lib/descriptions/index.less +0 -15
- package/plugins/lib/form/components/ARadio.vue +0 -74
- package/plugins/lib/form/components/ARangePicker.vue +0 -129
- package/plugins/lib/form/components/ASelectCustom.vue +0 -226
- package/plugins/lib/form/components/ATagsInput.vue +0 -93
- package/plugins/lib/form/components/ATimePicker.vue +0 -73
- package/plugins/lib/form/components/AUpload.vue +0 -183
- package/plugins/lib/form/components/RenderComp.vue +0 -69
- package/plugins/lib/form/index.js +0 -55
- package/plugins/lib/form/style/Model.less +0 -53
- package/plugins/lib/form/utils/resetFields.js +0 -16
- package/plugins/lib/iframe/events.js +0 -2
- package/plugins/lib/iframe/index.jsx +0 -234
- package/plugins/lib/iframe/index.less +0 -19
- package/plugins/lib/index.js +0 -72
- package/plugins/lib/lazy_use.js +0 -40
- package/plugins/lib/modal/index.jsx +0 -53
- package/plugins/lib/modal/index.less +0 -50
- package/plugins/lib/multiTab/APIEnums.js +0 -17
- package/plugins/lib/multiTab/MultiTab.jsx +0 -237
- package/plugins/lib/multiTab/RouteAPI.js +0 -71
- package/plugins/lib/multiTab/RouteContent.jsx +0 -90
- package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
- package/plugins/lib/multiTab/events.js +0 -2
- package/plugins/lib/multiTab/index.js +0 -15
- package/plugins/lib/multiTab/index.less +0 -73
- package/plugins/lib/style/index.less +0 -2
- package/plugins/lib/style/mixins.less +0 -79
- package/plugins/lib/svgIcon/index.js +0 -7
- package/plugins/lib/svgIcon/index.vue +0 -77
- package/plugins/lib/table/index.js +0 -7
- package/plugins/lib/table/index.vue +0 -217
- package/plugins/lib/table/style/index.less +0 -50
- package/plugins/lib/tree/index.js +0 -17
- package/plugins/lib/tree/style/Directory.less +0 -119
- package/plugins/lib/weather/index.js +0 -7
- package/plugins/lib/weather/index.vue +0 -58
- package/plugins/method/AMap.js +0 -368
- package/plugins/method/PageLoading.jsx +0 -106
- package/plugins/method/Theme.js +0 -88
- package/plugins/method/index.js +0 -12
- package/plugins/store/auth.js +0 -31
- package/plugins/store/cache.js +0 -56
- package/plugins/store/chat.js +0 -74
- package/plugins/store/project.js +0 -46
- package/plugins/utils/Axios.js +0 -105
- package/plugins/utils/Base64.js +0 -314
- package/plugins/utils/Filter.js +0 -249
- package/plugins/utils/PostMessage.js +0 -16
- package/plugins/utils/Postcss.js +0 -9
- package/plugins/utils/Rem.js +0 -24
- package/plugins/utils/Request.js +0 -38
- package/plugins/utils/Storage.js +0 -73
- package/plugins/utils/Tree.js +0 -169
- package/plugins/utils/Utils.js +0 -51
- package/plugins/utils/Validate.js +0 -33
- package/plugins/utils/Websocket.js +0 -186
- package/utils/PostMessage.js +0 -16
- package/utils/Request.js +0 -38
- /package/{method → extensions}/PageLoading.jsx +0 -0
- /package/{method → extensions}/Theme.js +0 -0
- /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
- /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
- /package/{plugins/font → font}/PingFang SC.ttf +0 -0
- /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
- /package/{plugins/font → font}/font.css +0 -0
- /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
- /package/lib/browse/{index.less → style/index.less} +0 -0
- /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
- /package/lib/{dateTime → date-time}/index.js +0 -0
- /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
- /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
- /package/lib/{svgIcon → svg-icon}/index.js +0 -0
package/utils/Axios.js
CHANGED
|
@@ -1,105 +1,114 @@
|
|
|
1
|
-
// src/utils/http.js
|
|
2
1
|
import axios from 'axios'
|
|
2
|
+
import storage from './Storage'
|
|
3
|
+
// 根据环境获取存储方式
|
|
4
|
+
const storageMode = process.env.NODE_ENV === 'development' ? 'cookies' : 'local'
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
class RequestManager {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.pendingMap = new Map()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
add(key, controller) {
|
|
12
|
+
this.cancel(key)
|
|
13
|
+
this.pendingMap.set(key, controller)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
remove(key) {
|
|
17
|
+
this.pendingMap.delete(key)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
cancel(key) {
|
|
21
|
+
const controller = this.pendingMap.get(key)
|
|
22
|
+
controller?.abort()
|
|
23
|
+
this.remove(key)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const createService = (options = {}) => {
|
|
28
|
+
const manager = new RequestManager()
|
|
6
29
|
const service = axios.create({
|
|
7
30
|
baseURL: options.baseURL,
|
|
8
|
-
timeout: 15000
|
|
31
|
+
timeout: options.timeout ?? 15000,
|
|
32
|
+
withCredentials: true
|
|
9
33
|
})
|
|
10
34
|
|
|
11
|
-
//
|
|
12
|
-
service.interceptors.request.use(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return config
|
|
26
|
-
},
|
|
27
|
-
error => {
|
|
28
|
-
return Promise.reject(error)
|
|
29
|
-
}
|
|
30
|
-
)
|
|
35
|
+
// 请求拦截
|
|
36
|
+
service.interceptors.request.use(config => {
|
|
37
|
+
const tokenKey = options.tokenKey ?? 'token'
|
|
38
|
+
const token = storage[storageMode].get(tokenKey)
|
|
39
|
+
token && (config.headers[tokenKey] = token)
|
|
40
|
+
|
|
41
|
+
const key = generateRequestKey(config)
|
|
42
|
+
const controller = new AbortController()
|
|
43
|
+
config.signal = controller.signal
|
|
44
|
+
|
|
45
|
+
manager.add(key, controller)
|
|
46
|
+
return config
|
|
47
|
+
})
|
|
31
48
|
|
|
32
|
-
//
|
|
49
|
+
// 响应拦截
|
|
33
50
|
service.interceptors.response.use(
|
|
34
|
-
response =>
|
|
35
|
-
// 请求完成后移除pending状态
|
|
36
|
-
const requestKey = `${response.config.url}-${response.config.method}`
|
|
37
|
-
removePendingRequest(requestKey)
|
|
38
|
-
|
|
39
|
-
// 处理业务逻辑
|
|
40
|
-
const { data, config, headers } = response
|
|
41
|
-
if (config.responseType == 'blob') return { response: data, headers }
|
|
42
|
-
if (data && data.code !== 200) {
|
|
43
|
-
return Promise.reject(response.data.message || '请求错误')
|
|
44
|
-
}
|
|
45
|
-
return response.data.data
|
|
46
|
-
},
|
|
51
|
+
response => handleResponse(response, options, manager),
|
|
47
52
|
error => {
|
|
48
|
-
//
|
|
49
|
-
if (error
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
case 401:
|
|
53
|
-
console.error('认证失效,请重新登录')
|
|
54
|
-
break
|
|
55
|
-
case 403:
|
|
56
|
-
console.error('无权限访问该资源')
|
|
57
|
-
break
|
|
58
|
-
case 500:
|
|
59
|
-
console.error('服务器内部错误,请稍后重试')
|
|
60
|
-
break
|
|
61
|
-
default:
|
|
62
|
-
handleNetworkError(error)
|
|
63
|
-
}
|
|
64
|
-
} else if (error.message.includes('timeout')) {
|
|
65
|
-
console.error('请求超时,请检查网络后重试')
|
|
66
|
-
} else {
|
|
67
|
-
console.error('未知错误,请联系管理员')
|
|
53
|
+
// 请求是否被中断 / 取消
|
|
54
|
+
if (axios.isCancel(error)) {
|
|
55
|
+
console.warn('Request canceled:', error.message)
|
|
56
|
+
return Promise.reject(error)
|
|
68
57
|
}
|
|
69
|
-
|
|
58
|
+
handleError(error.response, options)
|
|
70
59
|
}
|
|
71
60
|
)
|
|
72
61
|
|
|
73
|
-
|
|
62
|
+
// 扩展上传文件方法
|
|
63
|
+
return Object.assign(service, {
|
|
64
|
+
upload: (url, file, onProgress) => {
|
|
65
|
+
const formData = new FormData()
|
|
66
|
+
formData.append('file', file)
|
|
67
|
+
return service.post(url, formData, {
|
|
68
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
69
|
+
onUploadProgress: (progressEvent) => {
|
|
70
|
+
if (progressEvent.lengthComputable && onProgress) {
|
|
71
|
+
const percent = Math.round(
|
|
72
|
+
(progressEvent.loaded * 100) / progressEvent.total
|
|
73
|
+
)
|
|
74
|
+
onProgress(percent)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
})
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function addPendingRequest(key, controller) {
|
|
80
|
-
pendingRequests.set(key, controller)
|
|
82
|
+
function generateRequestKey(config) {
|
|
83
|
+
return `${config.url}-${config.method}-${JSON.stringify(config.params)}`
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
86
|
+
function handleResponse(response, options, manager) {
|
|
87
|
+
const key = generateRequestKey(response.config)
|
|
88
|
+
manager.remove(key)
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
const { data, config, headers } = response
|
|
91
|
+
|
|
92
|
+
if (config.responseType === 'blob') return { data, headers }
|
|
93
|
+
if (data.code && data.code !== 200) return handleError(data, options)
|
|
94
|
+
return data?.data ?? data
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
function handleError(error, options, manager) {
|
|
98
|
+
|
|
99
|
+
const errorMap = {
|
|
100
|
+
401: '认证失效,请重新登录',
|
|
101
|
+
403: '无权限访问该资源',
|
|
102
|
+
500: '服务器内部错误'
|
|
102
103
|
}
|
|
104
|
+
|
|
105
|
+
const status = error.status ?? error.code
|
|
106
|
+
const message = errorMap[status] || error.msg || '网络请求异常'
|
|
107
|
+
|
|
108
|
+
status && options.requestErrorHandler?.({status, message})
|
|
109
|
+
|
|
110
|
+
console.error(message)
|
|
111
|
+
return Promise.reject(error)
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
export default
|
|
114
|
+
export default createService
|
package/utils/Postcss.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
module.exports
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-pxtorem': {
|
|
4
|
+
rootValue: 14, // 基准字体大小,通常是 16 或 37.5
|
|
5
|
+
propList: ['*'], // 需要转换的属性,* 表示全部属性都转换
|
|
6
|
+
unitPrecision: 5, // 允许 REM 单位增长到的十进制数
|
|
7
|
+
selectorBlackList: [], // 忽略转换的选择器
|
|
8
|
+
replace: true, // 替换包含 `px` 的规则,而不是添加替换后的副本
|
|
9
|
+
mediaQuery: false, // 不允许在媒体查询中转换 `px`
|
|
10
|
+
minPixelValue: 0 // 设置要替换的最小像素值
|
|
11
|
+
}
|
|
12
|
+
}
|
|
9
13
|
}
|
package/README.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# web-component-gallery
|
|
2
|
-
|
|
3
|
-
## Project setup
|
|
4
|
-
```
|
|
5
|
-
yarn install
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
### Compiles and hot-reloads for development
|
|
9
|
-
```
|
|
10
|
-
yarn serve
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### Compiles and minifies for production
|
|
14
|
-
```
|
|
15
|
-
yarn build
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Lints and fixes files
|
|
19
|
-
```
|
|
20
|
-
yarn lint
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Customize configuration
|
|
24
|
-
See [Configuration Reference](https://cli.vuejs.org/config/).
|