bi-element-ui 1.1.97 → 1.1.98

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 (49) hide show
  1. package/.browserslistrc +3 -3
  2. package/.eslintignore +1 -1
  3. package/.prettierrc +8 -8
  4. package/.prettierrc.json +8 -8
  5. package/.vscode/extensions.json +3 -3
  6. package/.vscode/settings.json +2 -2
  7. package/README.md +148 -148
  8. package/cypress.json +3 -3
  9. package/lib/bi-element-ui.common.js +114885 -114885
  10. package/lib/bi-element-ui.css +2 -2
  11. package/lib/bi-element-ui.umd.js +114885 -114885
  12. package/lib/bi-element-ui.umd.min.js +47 -47
  13. package/package-lock2.json +17309 -17309
  14. package/package.json +1 -1
  15. package/pnpm-lock.yaml +13329 -0
  16. package/src/App.vue +2 -0
  17. package/src/components/BiDatePicker/datePickerOption.js +163 -163
  18. package/src/components/BiDatePicker/index.vue +59 -59
  19. package/src/components/BiTable/columu.vue +81 -81
  20. package/src/components/BiTable/forced.js +63 -63
  21. package/src/components/BiTable/index.js +6 -6
  22. package/src/components/BiTable/render.vue +13 -13
  23. package/src/components/BiTable/table.vue +179 -179
  24. package/src/components/BiTableColumn/Group.vue +275 -275
  25. package/src/components/BiTableColumn/api.js +16 -16
  26. package/src/components/BiTooltipIcon/index.vue +63 -63
  27. package/src/components/EditBtn.vue +15 -15
  28. package/src/components/FreeButton/index.vue +50 -50
  29. package/src/components/Pagination/index.vue +91 -91
  30. package/src/components/Pagination/scrollTo.js +65 -65
  31. package/src/main.js +3 -1
  32. package/src/router/index.js +49 -44
  33. package/src/store/index.js +11 -11
  34. package/src/utils/auth.js +66 -0
  35. package/src/utils/index.js +296 -0
  36. package/src/utils/request.js +81 -0
  37. package/src/views/Date.vue +96 -96
  38. package/src/views/Home.vue +11 -8
  39. package/src/views/Layout.vue +34 -34
  40. package/src/views/Log.vue +18 -0
  41. package/src/views/Scene.vue +111 -111
  42. package/src/views/showData.vue +2 -2
  43. package/tests/e2e/.eslintrc.js +10 -10
  44. package/tests/e2e/plugins/index.js +25 -25
  45. package/tests/e2e/specs/test.js +8 -8
  46. package/tests/e2e/support/commands.js +25 -25
  47. package/tests/e2e/support/index.js +20 -20
  48. package/tests/unit/example.spec.js +13 -13
  49. package//345/211/215/347/253/257ui/346/240/267/345/274/217/350/247/204/350/214/203.md +101 -101
@@ -1,44 +1,49 @@
1
- import Vue from 'vue'
2
- import VueRouter from 'vue-router'
3
- import Home from '../views/Home.vue'
4
-
5
- Vue.use(VueRouter)
6
-
7
- const routes = [
8
- {
9
- path: '/',
10
- name: 'Home',
11
- component: Home
12
- },
13
- // {
14
- // path: '/scene',
15
- // name: 'Scene',
16
- // component: () => import(/* webpackChunkName: "about" */ '../views/Scene.vue')
17
- // },
18
- {
19
- path: '/date',
20
- name: 'Date',
21
- component: () => import(/* webpackChunkName: "about" */ '../views/Date.vue')
22
- },
23
- {
24
- path: '/layout',
25
- name: 'Layout',
26
- component: () => import(/* webpackChunkName: "about" */ '../views/Layout.vue')
27
- },
28
- {
29
- path: '/table',
30
- name: 'Table',
31
- component: () => import(/* webpackChunkName: "about" */ '../views/Table.vue')
32
- },
33
- {
34
- path: '/showData',
35
- name: 'showData',
36
- component: () => import(/* webpackChunkName: "about" */ '../views/showData.vue')
37
- }
38
- ]
39
-
40
- const router = new VueRouter({
41
- routes
42
- })
43
-
44
- export default router
1
+ import Vue from 'vue'
2
+ import VueRouter from 'vue-router'
3
+ import Home from '../views/Home.vue'
4
+
5
+ Vue.use(VueRouter)
6
+
7
+ const routes = [
8
+ {
9
+ path: '/',
10
+ name: 'Home',
11
+ component: Home
12
+ },
13
+ // {
14
+ // path: '/scene',
15
+ // name: 'Scene',
16
+ // component: () => import(/* webpackChunkName: "about" */ '../views/Scene.vue')
17
+ // },
18
+ {
19
+ path: '/date',
20
+ name: 'Date',
21
+ component: () => import(/* webpackChunkName: "about" */ '../views/Date.vue')
22
+ },
23
+ {
24
+ path: '/layout',
25
+ name: 'Layout',
26
+ component: () => import(/* webpackChunkName: "about" */ '../views/Layout.vue')
27
+ },
28
+ {
29
+ path: '/table',
30
+ name: 'Table',
31
+ component: () => import(/* webpackChunkName: "about" */ '../views/Table.vue')
32
+ },
33
+ {
34
+ path: '/showData',
35
+ name: 'showData',
36
+ component: () => import(/* webpackChunkName: "about" */ '../views/showData.vue')
37
+ },
38
+ {
39
+ path: '/log',
40
+ name: 'log',
41
+ component: () => import(/* webpackChunkName: "about" */ '../views/Log.vue')
42
+ }
43
+ ]
44
+
45
+ const router = new VueRouter({
46
+ routes
47
+ })
48
+
49
+ export default router
@@ -1,11 +1,11 @@
1
- import Vue from 'vue'
2
- import Vuex from 'vuex'
3
-
4
- Vue.use(Vuex)
5
-
6
- export default new Vuex.Store({
7
- state: {},
8
- mutations: {},
9
- actions: {},
10
- modules: {}
11
- })
1
+ import Vue from 'vue'
2
+ import Vuex from 'vuex'
3
+
4
+ Vue.use(Vuex)
5
+
6
+ export default new Vuex.Store({
7
+ state: {},
8
+ mutations: {},
9
+ actions: {},
10
+ modules: {}
11
+ })
@@ -0,0 +1,66 @@
1
+ import Cookies from 'js-cookie'
2
+
3
+ const tokenKey = 'authorization'
4
+ const UaKey = 'UA'
5
+ const CorpIdKey = 'CorpId'
6
+ const AppKeyKey = 'AppKeyKey'
7
+
8
+ export function getToken() {
9
+ return Cookies.get(tokenKey)
10
+ }
11
+
12
+ export function setToken(token) {
13
+ console.log(token)
14
+ return Cookies.set(tokenKey, token, {
15
+ expires: 3650
16
+ })
17
+ }
18
+
19
+ export function removeToken() {
20
+ return Cookies.remove(tokenKey)
21
+ }
22
+
23
+ export function getUa() {
24
+ return Cookies.get(UaKey) || 'pc'
25
+ }
26
+
27
+ export function setUa() {
28
+ const UA = navigator.userAgent.toLowerCase()
29
+ if (UA.indexOf('dingtalk') > -1) {
30
+ return Cookies.set(UaKey, 'dingtalk', {
31
+ expires: 3650
32
+ })
33
+ } else {
34
+ return Cookies.set(UaKey, 'pc', {
35
+ expires: 3650
36
+ })
37
+ }
38
+ }
39
+
40
+ export function removeUa() {
41
+ return Cookies.remove(UaKey)
42
+ }
43
+
44
+ export function getCorpId() {
45
+ return localStorage.getItem(CorpIdKey)
46
+ }
47
+
48
+ export function setCorpId(corpId) {
49
+ return localStorage.setItem(CorpIdKey, corpId)
50
+ }
51
+
52
+ export function removeCorpId() {
53
+ return localStorage.removeItem(CorpIdKey)
54
+ }
55
+
56
+ export function getAppKey() {
57
+ return localStorage.getItem(AppKeyKey)
58
+ }
59
+
60
+ export function setAppKey(app_key) {
61
+ return localStorage.setItem(AppKeyKey, app_key)
62
+ }
63
+
64
+ export function removeAppKey() {
65
+ return localStorage.removeItem(AppKeyKey)
66
+ }
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Created by PanJiaChen on 16/11/18.
3
+ */
4
+
5
+ /**
6
+ * Parse the time to string
7
+ * @param {(Object|string|number)} time
8
+ * @param {string} cFormat
9
+ * @returns {string | null}
10
+ */
11
+ export function parseTime(time, cFormat) {
12
+ if (arguments.length === 0 || !time) {
13
+ return null
14
+ }
15
+ const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
16
+ let date
17
+ if (typeof time === 'object') {
18
+ date = time
19
+ } else {
20
+ if (typeof time === 'string') {
21
+ if (/^[0-9]+$/.test(time)) {
22
+ // support "1548221490638"
23
+ time = parseInt(time)
24
+ } else {
25
+ // support safari
26
+ // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
27
+ time = time.replace(new RegExp(/-/gm), '/')
28
+ }
29
+ }
30
+
31
+ if (typeof time === 'number' && time.toString().length === 10) {
32
+ time = time * 1000
33
+ }
34
+ date = new Date(time)
35
+ }
36
+ const formatObj = {
37
+ y: date.getFullYear(),
38
+ m: date.getMonth() + 1,
39
+ d: date.getDate(),
40
+ h: date.getHours(),
41
+ i: date.getMinutes(),
42
+ s: date.getSeconds(),
43
+ a: date.getDay()
44
+ }
45
+ const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
46
+ const value = formatObj[key]
47
+ // Note: getDay() returns 0 on Sunday
48
+ if (key === 'a') {
49
+ return ['日', '一', '二', '三', '四', '五', '六'][value]
50
+ }
51
+ return value.toString().padStart(2, '0')
52
+ })
53
+ return time_str
54
+ }
55
+
56
+ /**
57
+ * @param {number} time
58
+ * @param {string} option
59
+ * @returns {string}
60
+ */
61
+ export function formatTime(time, option) {
62
+ if (('' + time).length === 10) {
63
+ time = parseInt(time) * 1000
64
+ } else {
65
+ time = +time
66
+ }
67
+ const d = new Date(time)
68
+ const now = Date.now()
69
+
70
+ const diff = (now - d) / 1000
71
+
72
+ if (diff < 30) {
73
+ return '刚刚'
74
+ } else if (diff < 3600) {
75
+ // less 1 hour
76
+ return Math.ceil(diff / 60) + '分钟前'
77
+ } else if (diff < 3600 * 24) {
78
+ return Math.ceil(diff / 3600) + '小时前'
79
+ } else if (diff < 3600 * 24 * 2) {
80
+ return '1天前'
81
+ }
82
+ if (option) {
83
+ return parseTime(time, option)
84
+ } else {
85
+ return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
86
+ }
87
+ }
88
+
89
+ /**
90
+ * @param {string} url
91
+ * @returns {Object}
92
+ */
93
+ export function param2Obj(url) {
94
+ const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
95
+ if (!search) {
96
+ return {}
97
+ }
98
+ const obj = {}
99
+ const searchArr = search.split('&')
100
+ searchArr.forEach((v) => {
101
+ const index = v.indexOf('=')
102
+ if (index !== -1) {
103
+ const name = v.substring(0, index)
104
+ const val = v.substring(index + 1, v.length)
105
+ obj[name] = val
106
+ }
107
+ })
108
+ return obj
109
+ }
110
+
111
+ export function browserType() {
112
+ // 权重:系统 + 系统版本 > 平台 > 内核 + 载体 + 内核版本 + 载体版本 > 外壳 + 外壳版本
113
+ const ua = navigator.userAgent.toLowerCase()
114
+ const testUa = (regexp) => regexp.test(ua)
115
+ const testVs = (regexp) => {
116
+ const res = ua.match(regexp) || ''
117
+
118
+ return res
119
+ .toString()
120
+ .replace(/[^0-9|_.]/g, '')
121
+ .replace(/_/g, '.')
122
+ }
123
+ // 系统
124
+ let system = 'other'
125
+ if (testUa(/windows|win32|win64|wow32|wow64/g)) {
126
+ system = 'windows' // windows系统
127
+ } else if (testUa(/macintosh|macintel/g)) {
128
+ system = 'macos' // macos系统
129
+ } else if (testUa(/x11/g)) {
130
+ system = 'linux' // linux系统
131
+ } else if (testUa(/android|adr/g)) {
132
+ system = 'android' // android系统
133
+ } else if (testUa(/ios|iphone|ipad|ipod|iwatch/g)) {
134
+ system = 'ios' // ios系统
135
+ }
136
+ // 系统版本
137
+ let systemVs = 'unknow'
138
+ if (system === 'windows') {
139
+ if (testUa(/windows nt 5.0|windows 2000/g)) {
140
+ systemVs = '2000'
141
+ } else if (testUa(/windows nt 5.1|windows xp/g)) {
142
+ systemVs = 'xp'
143
+ } else if (testUa(/windows nt 5.2|windows 2003/g)) {
144
+ systemVs = '2003'
145
+ } else if (testUa(/windows nt 6.0|windows vista/g)) {
146
+ systemVs = 'vista'
147
+ } else if (testUa(/windows nt 6.1|windows 7/g)) {
148
+ systemVs = '7'
149
+ } else if (testUa(/windows nt 6.2|windows 8/g)) {
150
+ systemVs = '8'
151
+ } else if (testUa(/windows nt 6.3|windows 8.1/g)) {
152
+ systemVs = '8.1'
153
+ } else if (testUa(/windows nt 10.0|windows 10/g)) {
154
+ systemVs = '10'
155
+ }
156
+ } else if (system === 'macos') {
157
+ systemVs = testVs(/os x [\d._]+/g)
158
+ } else if (system === 'android') {
159
+ systemVs = testVs(/android [\d._]+/g)
160
+ } else if (system === 'ios') {
161
+ systemVs = testVs(/os [\d._]+/g)
162
+ }
163
+ // 平台
164
+ let platform = 'unknow'
165
+ if (system === 'windows' || system === 'macos' || system === 'linux') {
166
+ platform = 'desktop' // 桌面端
167
+ } else if (system === 'android' || system === 'ios' || testUa(/mobile/g)) {
168
+ platform = 'mobile' // 移动端
169
+ }
170
+ // 内核和载体
171
+ let engine = 'unknow'
172
+ let supporter = 'unknow'
173
+ if (testUa(/applewebkit/g)) {
174
+ engine = 'webkit' // webkit内核
175
+ if (testUa(/edge/g)) {
176
+ supporter = 'edge' // edge浏览器
177
+ } else if (testUa(/opr/g)) {
178
+ supporter = 'opera' // opera浏览器
179
+ } else if (testUa(/chrome/g)) {
180
+ supporter = 'chrome' // chrome浏览器
181
+ } else if (testUa(/safari/g)) {
182
+ supporter = 'safari' // safari浏览器
183
+ } else if (testUa(/dingtalk/g)) {
184
+ supporter = 'dingtalk' // 钉钉浏览器
185
+ }
186
+ } else if (testUa(/gecko/g) && testUa(/firefox/g)) {
187
+ engine = 'gecko' // gecko内核
188
+ supporter = 'firefox' // firefox浏览器
189
+ } else if (testUa(/presto/g)) {
190
+ engine = 'presto' // presto内核
191
+ supporter = 'opera' // opera浏览器
192
+ } else if (testUa(/trident|compatible|msie/g)) {
193
+ engine = 'trident' // trident内核
194
+ supporter = 'iexplore' // iexplore浏览器
195
+ }
196
+ // 内核版本
197
+ let engineVs = 'unknow'
198
+ if (engine === 'webkit') {
199
+ engineVs = testVs(/applewebkit\/[\d._]+/g)
200
+ } else if (engine === 'gecko') {
201
+ engineVs = testVs(/gecko\/[\d._]+/g)
202
+ } else if (engine === 'presto') {
203
+ engineVs = testVs(/presto\/[\d._]+/g)
204
+ } else if (engine === 'trident') {
205
+ engineVs = testVs(/trident\/[\d._]+/g)
206
+ }
207
+ // 载体版本
208
+ let supporterVs = 'unknow'
209
+ if (supporter === 'chrome') {
210
+ supporterVs = testVs(/chrome\/[\d._]+/g)
211
+ } else if (supporter === 'safari') {
212
+ supporterVs = testVs(/version\/[\d._]+/g)
213
+ } else if (supporter === 'firefox') {
214
+ supporterVs = testVs(/firefox\/[\d._]+/g)
215
+ } else if (supporter === 'opera') {
216
+ supporterVs = testVs(/opr\/[\d._]+/g)
217
+ } else if (supporter === 'iexplore') {
218
+ supporterVs = testVs(/(msie [\d._]+)|(rv:[\d._]+)/g)
219
+ } else if (supporter === 'edge') {
220
+ supporterVs = testVs(/edge\/[\d._]+/g)
221
+ } else if (supporter === 'dingtalk') {
222
+ supporterVs = testVs(/dingtalk\/[\d._]+/)
223
+ }
224
+ // 外壳和外壳版本
225
+ let shell = 'none'
226
+ let shellVs = 'unknow'
227
+ if (testUa(/micromessenger/g)) {
228
+ shell = 'wechat' // 微信浏览器
229
+ shellVs = testVs(/micromessenger\/[\d._]+/g)
230
+ } else if (testUa(/qqbrowser/g)) {
231
+ shell = 'qq' // QQ浏览器
232
+ shellVs = testVs(/qqbrowser\/[\d._]+/g)
233
+ } else if (testUa(/ucbrowser/g)) {
234
+ shell = 'uc' // UC浏览器
235
+ shellVs = testVs(/ucbrowser\/[\d._]+/g)
236
+ } else if (testUa(/qihu 360se/g)) {
237
+ shell = '360' // 360浏览器(无版本)
238
+ } else if (testUa(/2345explorer/g)) {
239
+ shell = '2345' // 2345浏览器
240
+ shellVs = testVs(/2345explorer\/[\d._]+/g)
241
+ } else if (testUa(/metasr/g)) {
242
+ shell = 'sougou' // 搜狗浏览器(无版本)
243
+ } else if (testUa(/lbbrowser/g)) {
244
+ shell = 'liebao' // 猎豹浏览器(无版本)
245
+ } else if (testUa(/maxthon/g)) {
246
+ shell = 'maxthon' // 遨游浏览器
247
+ shellVs = testVs(/maxthon\/[\d._]+/g)
248
+ }
249
+ return Object.assign(
250
+ {
251
+ engine, // webkit gecko presto trident
252
+ engineVs,
253
+ platform, // desktop mobile
254
+ supporter, // chrome safari firefox opera iexplore edge
255
+ supporterVs,
256
+ system, // windows macos linux android ios
257
+ systemVs
258
+ },
259
+ shell === 'none' ? {} : { shell, shellVs }
260
+ )
261
+ }
262
+
263
+ export function pathResolve(...paths) {
264
+ // 1. 将所有路径合并成一个字符串
265
+ let resolvedPath = ''
266
+
267
+ for (const path of paths) {
268
+ // 如果路径是绝对路径,直接赋值
269
+ if (path.startsWith('/')) {
270
+ resolvedPath = path
271
+ } else {
272
+ // 否则,拼接路径
273
+ resolvedPath = `${resolvedPath}/${path}`.replace(/\/+/g, '/')
274
+ }
275
+ }
276
+
277
+ // 2. 处理路径中的.和..部分
278
+ const parts = resolvedPath.split('/')
279
+
280
+ const stack = []
281
+ for (const part of parts) {
282
+ if (part === '' || part === '.') {
283
+ // 忽略空和当前目录
284
+ continue
285
+ } else if (part === '..') {
286
+ // 返回上级目录
287
+ stack.pop()
288
+ } else {
289
+ // 添加有效部分
290
+ stack.push(part)
291
+ }
292
+ }
293
+
294
+ // 3. 返回最终的绝对路径
295
+ return '/' + stack.join('/')
296
+ }
@@ -0,0 +1,81 @@
1
+ import axios from 'axios'
2
+ import { Message } from 'bi-eleme'
3
+ import { getToken, getUa } from '@/utils/auth.js'
4
+ import { browserType } from '@/utils/index'
5
+
6
+ // create an axios instance
7
+ const service = axios.create({
8
+ baseURL: 'zhangquan-dev', // url = base url + request url
9
+ // withCredentials: true, // send cookies when cross-domain requests
10
+ timeout: 100000 // request timeout
11
+ })
12
+ console.log(process.env.VUE_APP_BASE_API)
13
+
14
+ // request interceptor
15
+ service.interceptors.request.use(
16
+ (config) => {
17
+ // do something before request is sent
18
+ config.headers['AuthKey'] = 'authtpe84dzfl3iq62'
19
+ config.headers['Login-Env'] = getUa()
20
+ config.headers['Login-Device'] = JSON.stringify(browserType())
21
+ if (getToken()) {
22
+ // let each request carry token
23
+ // ['X-Token'] is a custom headers key
24
+ // please modify it according to the actual situation
25
+ config.headers['authorization'] = getToken()
26
+ }
27
+ return config
28
+ },
29
+ (error) => {
30
+ // do something with request error
31
+ console.log(error) // for debug
32
+ return Promise.reject(error)
33
+ }
34
+ )
35
+
36
+ // response interceptor
37
+ service.interceptors.response.use(
38
+ /**
39
+ * If you want to get http information such as headers or status
40
+ * Please return response => response
41
+ */
42
+
43
+ /**
44
+ * Determine the request status by custom code
45
+ * Here is just an example
46
+ * You can also judge the status by HTTP Status Code
47
+ */
48
+ (response) => {
49
+ const res = response.data
50
+
51
+ // if the custom code is not 20000, it is judged as an error.
52
+ if (res.status_code !== 1) {
53
+ if (res.status_code !== 101) {
54
+ // 101 是需要二次确认的状态码
55
+ Message({
56
+ message: res.msg || 'Error',
57
+ type: 'error',
58
+ duration: 5 * 1000
59
+ })
60
+ }
61
+ // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
62
+ if (res.status_code === -100) {
63
+ // to re-login
64
+ }
65
+ return res
66
+ } else {
67
+ return res
68
+ }
69
+ },
70
+ (error) => {
71
+ console.log('err' + error) // for debug
72
+ Message({
73
+ message: error.msg,
74
+ type: 'error',
75
+ duration: 5 * 1000
76
+ })
77
+ return Promise.reject(error)
78
+ }
79
+ )
80
+
81
+ export default service