t20-common-lib 0.9.13 → 0.10.0
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/package.json +64 -85
- package/packages/branch-bank-select/index.js +8 -8
- package/packages/branch-bank-select/src/main.vue +179 -179
- package/packages/common-collapse/index.js +8 -8
- package/packages/common-collapse/src/main.vue +147 -147
- package/packages/form-page/index.js +8 -8
- package/packages/form-page/src/main.vue +55 -55
- package/packages/input-number/index.js +8 -0
- package/packages/input-number/src/main.vue +184 -0
- package/packages/main-page/index.js +8 -8
- package/packages/main-page/src/main.vue +43 -43
- package/packages/multi-currency-statistics/index.js +8 -8
- package/packages/multi-currency-statistics/src/main.vue +229 -229
- package/packages/page-header/index.js +8 -8
- package/packages/page-header/src/main.vue +95 -95
- package/packages/statis-card/index.js +8 -8
- package/packages/statis-card/src/main.vue +250 -250
- package/packages/tab-page/index.js +8 -8
- package/packages/tab-page/src/main.vue +101 -101
- package/packages/tab-pane/index.js +8 -8
- package/packages/tab-pane/src/main.vue +185 -185
- package/packages/table-page/index.js +8 -8
- package/packages/table-page/src/main.vue +42 -42
- package/packages/theme-chalk/src/common/element-variables.scss +1045 -1045
- package/packages/theme-chalk/src/common/normalize.scss +869 -869
- package/packages/theme-chalk/src/index.scss +8 -8
- package/src/api/common.js +20 -20
- package/src/i18n.json +4 -4
- package/src/index.js +75 -71
- package/src/store/index.js +25 -25
- package/src/store/modules/user.js +42 -42
- package/src/utils/asciiWidth.js +107 -107
- package/src/utils/common.js +12 -12
- package/src/utils/date.js +43 -43
- package/src/utils/exportFile.js +6 -6
- package/src/utils/i18n/cn2hk.json +1270 -1270
- package/src/utils/i18n/index.js +69 -69
- package/src/utils/repairElementUI.js +141 -141
- package/src/utils/tableCellUtils.js +54 -54
- package/src/utils/tableheaderFilterpanel.vue +257 -257
- package/style/index.css +26 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@import '~normalize.css';
|
|
2
|
-
|
|
3
|
-
@import './common/element-variables.scss';
|
|
4
|
-
@import './common/normalize.scss';
|
|
5
|
-
/* 改变 icon 字体路径变量,必需 */
|
|
6
|
-
$--font-path: '~element-ui/lib/theme-chalk/fonts';
|
|
7
|
-
@import '~element-ui/packages/theme-chalk/src/index';
|
|
8
|
-
|
|
1
|
+
@import '~normalize.css';
|
|
2
|
+
|
|
3
|
+
@import './common/element-variables.scss';
|
|
4
|
+
@import './common/normalize.scss';
|
|
5
|
+
/* 改变 icon 字体路径变量,必需 */
|
|
6
|
+
$--font-path: '~element-ui/lib/theme-chalk/fonts';
|
|
7
|
+
@import '~element-ui/packages/theme-chalk/src/index';
|
|
8
|
+
|
package/src/api/common.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
// import request from '@/utils/request'
|
|
2
|
-
|
|
3
|
-
// 单位本位币
|
|
4
|
-
export function getUnitCurrency(unitNo) {
|
|
5
|
-
// return request({
|
|
6
|
-
// url: `/api/bems/1.0/unit/${unitNo}`,
|
|
7
|
-
// method: 'get',
|
|
8
|
-
// loading: false
|
|
9
|
-
// })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// 币种
|
|
13
|
-
export function getCurrency(data, headers = {}) {
|
|
14
|
-
// return request({
|
|
15
|
-
// url: '/api/nstc-mdm/1.0/currency',
|
|
16
|
-
// method: 'get',
|
|
17
|
-
// params: data,
|
|
18
|
-
// loading: false,
|
|
19
|
-
// headers
|
|
20
|
-
// })
|
|
1
|
+
// import request from '@/utils/request'
|
|
2
|
+
|
|
3
|
+
// 单位本位币
|
|
4
|
+
export function getUnitCurrency(unitNo) {
|
|
5
|
+
// return request({
|
|
6
|
+
// url: `/api/bems/1.0/unit/${unitNo}`,
|
|
7
|
+
// method: 'get',
|
|
8
|
+
// loading: false
|
|
9
|
+
// })
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 币种
|
|
13
|
+
export function getCurrency(data, headers = {}) {
|
|
14
|
+
// return request({
|
|
15
|
+
// url: '/api/nstc-mdm/1.0/currency',
|
|
16
|
+
// method: 'get',
|
|
17
|
+
// params: data,
|
|
18
|
+
// loading: false,
|
|
19
|
+
// headers
|
|
20
|
+
// })
|
|
21
21
|
}
|
package/src/i18n.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"此处只可设置个人自定义常用审批意见,全局需到工作流审批意见设置中设置": {
|
|
3
|
-
"en": "You can only set personal custom common phrases here. The global setting needs to be set in the workflow approval opinion setting."
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"此处只可设置个人自定义常用审批意见,全局需到工作流审批意见设置中设置": {
|
|
3
|
+
"en": "You can only set personal custom common phrases here. The global setting needs to be set in the workflow approval opinion setting."
|
|
4
|
+
}
|
|
5
5
|
}
|
package/src/index.js
CHANGED
|
@@ -1,72 +1,76 @@
|
|
|
1
|
-
/** 全局指令 */
|
|
2
|
-
import fitlers from './filters/index'
|
|
3
|
-
import repairEl from './utils/repairElementUI'
|
|
4
|
-
import { getColumnWidth, getCellAlign } from './utils/tableCellUtils'
|
|
5
|
-
import { getExportFileName } from './utils/exportFile'
|
|
6
|
-
// 导入组件
|
|
7
|
-
import MainPage from '../packages/main-page/index.js'
|
|
8
|
-
import TablePage from '../packages/table-page/index.js'
|
|
9
|
-
import FormPage from '../packages/form-page/index.js'
|
|
10
|
-
import TabPane from '../packages/tab-pane/index.js'
|
|
11
|
-
import StatisCard from '../packages/statis-card/index.js'
|
|
12
|
-
import PageHeader from '../packages/page-header/index.js'
|
|
13
|
-
import CommonCollapse from '../packages/common-collapse/index.js'
|
|
14
|
-
import MultiCurrencyStatistics from '../packages/multi-currency-statistics/index.js'
|
|
15
|
-
import BranchBankSelect from '../packages/branch-bank-select/index.js'
|
|
16
|
-
import TabPage from '../packages/tab-page/index.js'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
name
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
/** 全局指令 */
|
|
2
|
+
import fitlers from './filters/index'
|
|
3
|
+
import repairEl from './utils/repairElementUI'
|
|
4
|
+
import { getColumnWidth, getCellAlign } from './utils/tableCellUtils'
|
|
5
|
+
import { getExportFileName } from './utils/exportFile'
|
|
6
|
+
// 导入组件
|
|
7
|
+
import MainPage from '../packages/main-page/index.js'
|
|
8
|
+
import TablePage from '../packages/table-page/index.js'
|
|
9
|
+
import FormPage from '../packages/form-page/index.js'
|
|
10
|
+
import TabPane from '../packages/tab-pane/index.js'
|
|
11
|
+
import StatisCard from '../packages/statis-card/index.js'
|
|
12
|
+
import PageHeader from '../packages/page-header/index.js'
|
|
13
|
+
import CommonCollapse from '../packages/common-collapse/index.js'
|
|
14
|
+
import MultiCurrencyStatistics from '../packages/multi-currency-statistics/index.js'
|
|
15
|
+
import BranchBankSelect from '../packages/branch-bank-select/index.js'
|
|
16
|
+
import TabPage from '../packages/tab-page/index.js'
|
|
17
|
+
import InputNumber from '../packages/input-number/index.js'
|
|
18
|
+
|
|
19
|
+
// 存储组件列表
|
|
20
|
+
const components = [
|
|
21
|
+
MainPage,
|
|
22
|
+
TablePage,
|
|
23
|
+
FormPage,
|
|
24
|
+
TabPane,
|
|
25
|
+
StatisCard,
|
|
26
|
+
CommonCollapse,
|
|
27
|
+
PageHeader,
|
|
28
|
+
MultiCurrencyStatistics,
|
|
29
|
+
BranchBankSelect,
|
|
30
|
+
TabPage,
|
|
31
|
+
InputNumber
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
// 定义 install 方法,接收 Vue 作为参数
|
|
35
|
+
const install = function (Vue, opts = { prefix: 'T20', i18nConfig: {} }) {
|
|
36
|
+
components.forEach((component) => {
|
|
37
|
+
let name = component.name
|
|
38
|
+
if (!name) return console.error('必须设置组件名称:', component)
|
|
39
|
+
|
|
40
|
+
name = opts.prefix + name.replace(name[0], name[0].toUpperCase())
|
|
41
|
+
Vue.component(name, component)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
Object.keys(fitlers).forEach((key) => {
|
|
45
|
+
Vue.filter(key + 'Format', fitlers[key])
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 判断是否是直接引入文件
|
|
50
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
51
|
+
install(window.Vue)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
install
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
// 以下是具体的组件列表
|
|
60
|
+
MainPage,
|
|
61
|
+
TablePage,
|
|
62
|
+
FormPage,
|
|
63
|
+
StatisCard,
|
|
64
|
+
CommonCollapse,
|
|
65
|
+
TabPane,
|
|
66
|
+
PageHeader,
|
|
67
|
+
TabPage,
|
|
68
|
+
MultiCurrencyStatistics,
|
|
69
|
+
BranchBankSelect,
|
|
70
|
+
InputNumber,
|
|
71
|
+
// 工具方法
|
|
72
|
+
repairEl,
|
|
73
|
+
getColumnWidth,
|
|
74
|
+
getCellAlign,
|
|
75
|
+
getExportFileName
|
|
72
76
|
}
|
package/src/store/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import Vuex from 'vuex'
|
|
3
|
-
import getters from './getters'
|
|
4
|
-
|
|
5
|
-
Vue.use(Vuex)
|
|
6
|
-
|
|
7
|
-
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
|
8
|
-
const modulesFiles = require.context('./modules', true, /\.js$/)
|
|
9
|
-
|
|
10
|
-
// you do not need `import app from './modules/app'`
|
|
11
|
-
// it will auto require all vuex module from modules file
|
|
12
|
-
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
|
|
13
|
-
// set './app.js' => 'app'
|
|
14
|
-
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
|
|
15
|
-
const value = modulesFiles(modulePath)
|
|
16
|
-
modules[moduleName] = value.default
|
|
17
|
-
return modules
|
|
18
|
-
}, {})
|
|
19
|
-
|
|
20
|
-
const store = new Vuex.Store({
|
|
21
|
-
modules,
|
|
22
|
-
getters
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export default store
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import Vuex from 'vuex'
|
|
3
|
+
import getters from './getters'
|
|
4
|
+
|
|
5
|
+
Vue.use(Vuex)
|
|
6
|
+
|
|
7
|
+
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
|
8
|
+
const modulesFiles = require.context('./modules', true, /\.js$/)
|
|
9
|
+
|
|
10
|
+
// you do not need `import app from './modules/app'`
|
|
11
|
+
// it will auto require all vuex module from modules file
|
|
12
|
+
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
|
|
13
|
+
// set './app.js' => 'app'
|
|
14
|
+
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
|
|
15
|
+
const value = modulesFiles(modulePath)
|
|
16
|
+
modules[moduleName] = value.default
|
|
17
|
+
return modules
|
|
18
|
+
}, {})
|
|
19
|
+
|
|
20
|
+
const store = new Vuex.Store({
|
|
21
|
+
modules,
|
|
22
|
+
getters
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export default store
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { getUnitCurrency, getCurrency } from '@/api/common.js'
|
|
2
|
-
|
|
3
|
-
const state = {
|
|
4
|
-
defaultCurrencyNo: '',
|
|
5
|
-
defaultCurrencyName: ''
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const mutations = {
|
|
9
|
-
SET_DEFAULTCURRENCYNO: (state, currencyNo) => {
|
|
10
|
-
state.defaultCurrencyNo = currencyNo
|
|
11
|
-
},
|
|
12
|
-
SET_DEFAULTCURRENCYNAME: (state, currencyName) => {
|
|
13
|
-
state.defaultCurrencyName = currencyName
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const actions = {
|
|
18
|
-
async getDefaultCurrency({commit}) {
|
|
19
|
-
const userInfo = JSON.parse(sessionStorage.getItem('User_Info'))
|
|
20
|
-
// const resUnit = await getUnitCurrency(userInfo.custNo) //归集主体
|
|
21
|
-
// if (resUnit.currencyNo) {
|
|
22
|
-
// console.log("🚀 ~ getDefaultCurrency ~ resUnit.currencyNo:", resUnit.currencyNo)
|
|
23
|
-
// commit('SET_DEFAULTCURRENCYNO', resUnit.currencyNo)
|
|
24
|
-
// commit('SET_DEFAULTCURRENCYNAME', resUnit.currencyName)
|
|
25
|
-
// } else {
|
|
26
|
-
// const list = await getCurrency({ isEnable: 1 }, false)
|
|
27
|
-
// const allCurrency = list.find(item => item.currencyType === 0)
|
|
28
|
-
// if (allCurrency) {
|
|
29
|
-
// commit('SET_DEFAULTCURRENCYNO', allCurrency.currencyNo)
|
|
30
|
-
// commit('SET_DEFAULTCURRENCYNAME', allCurrency.currencyName)
|
|
31
|
-
// }
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default {
|
|
38
|
-
namespaced: true,
|
|
39
|
-
state,
|
|
40
|
-
mutations,
|
|
41
|
-
actions
|
|
42
|
-
}
|
|
1
|
+
import { getUnitCurrency, getCurrency } from '@/api/common.js'
|
|
2
|
+
|
|
3
|
+
const state = {
|
|
4
|
+
defaultCurrencyNo: '',
|
|
5
|
+
defaultCurrencyName: ''
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const mutations = {
|
|
9
|
+
SET_DEFAULTCURRENCYNO: (state, currencyNo) => {
|
|
10
|
+
state.defaultCurrencyNo = currencyNo
|
|
11
|
+
},
|
|
12
|
+
SET_DEFAULTCURRENCYNAME: (state, currencyName) => {
|
|
13
|
+
state.defaultCurrencyName = currencyName
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const actions = {
|
|
18
|
+
async getDefaultCurrency({commit}) {
|
|
19
|
+
const userInfo = JSON.parse(sessionStorage.getItem('User_Info'))
|
|
20
|
+
// const resUnit = await getUnitCurrency(userInfo.custNo) //归集主体
|
|
21
|
+
// if (resUnit.currencyNo) {
|
|
22
|
+
// console.log("🚀 ~ getDefaultCurrency ~ resUnit.currencyNo:", resUnit.currencyNo)
|
|
23
|
+
// commit('SET_DEFAULTCURRENCYNO', resUnit.currencyNo)
|
|
24
|
+
// commit('SET_DEFAULTCURRENCYNAME', resUnit.currencyName)
|
|
25
|
+
// } else {
|
|
26
|
+
// const list = await getCurrency({ isEnable: 1 }, false)
|
|
27
|
+
// const allCurrency = list.find(item => item.currencyType === 0)
|
|
28
|
+
// if (allCurrency) {
|
|
29
|
+
// commit('SET_DEFAULTCURRENCYNO', allCurrency.currencyNo)
|
|
30
|
+
// commit('SET_DEFAULTCURRENCYNAME', allCurrency.currencyName)
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
namespaced: true,
|
|
39
|
+
state,
|
|
40
|
+
mutations,
|
|
41
|
+
actions
|
|
42
|
+
}
|
package/src/utils/asciiWidth.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
// 设置表头最小宽度,保证表头不换行
|
|
2
|
-
const ASCII_W = {
|
|
3
|
-
' ': 4.125,
|
|
4
|
-
0: 8.21875,
|
|
5
|
-
1: 8.21875,
|
|
6
|
-
2: 8.21875,
|
|
7
|
-
3: 8.21875,
|
|
8
|
-
4: 8.21875,
|
|
9
|
-
5: 8.21875,
|
|
10
|
-
6: 8.21875,
|
|
11
|
-
7: 8.21875,
|
|
12
|
-
8: 8.21875,
|
|
13
|
-
9: 8.21875,
|
|
14
|
-
'!': 4.375,
|
|
15
|
-
'"': 6.109375,
|
|
16
|
-
'#': 8.9375,
|
|
17
|
-
$: 8.21875,
|
|
18
|
-
'%': 12.46875,
|
|
19
|
-
'&': 12.1875,
|
|
20
|
-
"'": 3.59375,
|
|
21
|
-
'(': 4.6875,
|
|
22
|
-
')': 4.6875,
|
|
23
|
-
'*': 6.375,
|
|
24
|
-
'+': 10.390625,
|
|
25
|
-
',': 3.375,
|
|
26
|
-
'-': 6.0625,
|
|
27
|
-
'.': 3.375,
|
|
28
|
-
'/': 5.984375,
|
|
29
|
-
':': 3.375,
|
|
30
|
-
';': 3.375,
|
|
31
|
-
'<': 10.390625,
|
|
32
|
-
'=': 10.390625,
|
|
33
|
-
'>': 10.390625,
|
|
34
|
-
'?': 6.765625,
|
|
35
|
-
'@': 14.4375,
|
|
36
|
-
A: 9.859375,
|
|
37
|
-
B: 8.796875,
|
|
38
|
-
C: 9.375,
|
|
39
|
-
D: 10.671875,
|
|
40
|
-
E: 7.703125,
|
|
41
|
-
F: 7.4375,
|
|
42
|
-
G: 10.421875,
|
|
43
|
-
H: 10.828125,
|
|
44
|
-
I: 4.125,
|
|
45
|
-
J: 5.546875,
|
|
46
|
-
K: 8.890625,
|
|
47
|
-
L: 7.1875,
|
|
48
|
-
M: 13.6875,
|
|
49
|
-
N: 11.390625,
|
|
50
|
-
O: 11.421875,
|
|
51
|
-
P: 8.578125,
|
|
52
|
-
Q: 11.421875,
|
|
53
|
-
R: 9.140625,
|
|
54
|
-
S: 8.09375,
|
|
55
|
-
T: 8.03125,
|
|
56
|
-
U: 10.453125,
|
|
57
|
-
V: 9.46875,
|
|
58
|
-
W: 14.25,
|
|
59
|
-
X: 9.03125,
|
|
60
|
-
Y: 8.453125,
|
|
61
|
-
Z: 8.6875,
|
|
62
|
-
'[': 4.6875,
|
|
63
|
-
'\\': 5.828125,
|
|
64
|
-
']': 4.6875,
|
|
65
|
-
'^': 10.390625,
|
|
66
|
-
_: 6.28125,
|
|
67
|
-
'`': 4.140625,
|
|
68
|
-
a: 7.75,
|
|
69
|
-
b: 8.953125,
|
|
70
|
-
c: 7.03125,
|
|
71
|
-
d: 8.96875,
|
|
72
|
-
e: 7.953125,
|
|
73
|
-
f: 4.859375,
|
|
74
|
-
g: 8.96875,
|
|
75
|
-
h: 8.625,
|
|
76
|
-
i: 3.734375,
|
|
77
|
-
j: 3.75,
|
|
78
|
-
k: 7.625,
|
|
79
|
-
l: 3.734375,
|
|
80
|
-
m: 13.125,
|
|
81
|
-
n: 8.640625,
|
|
82
|
-
o: 8.90625,
|
|
83
|
-
p: 8.953125,
|
|
84
|
-
q: 8.96875,
|
|
85
|
-
r: 5.40625,
|
|
86
|
-
s: 6.546875,
|
|
87
|
-
t: 5.21875,
|
|
88
|
-
u: 8.640625,
|
|
89
|
-
v: 7.359375,
|
|
90
|
-
w: 11.0625,
|
|
91
|
-
x: 7.109375,
|
|
92
|
-
y: 7.421875,
|
|
93
|
-
z: 6.890625,
|
|
94
|
-
'{': 4.6875,
|
|
95
|
-
'|': 3.78125,
|
|
96
|
-
'}': 4.6875,
|
|
97
|
-
'~': 10.390625
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export default function getWidth(label) {
|
|
101
|
-
label = label || ''
|
|
102
|
-
let labels = label.match(/./gu) || []
|
|
103
|
-
let labelW = 0
|
|
104
|
-
labels.forEach((s) => (labelW += ASCII_W[s] || 14))
|
|
105
|
-
|
|
106
|
-
return labelW
|
|
107
|
-
}
|
|
1
|
+
// 设置表头最小宽度,保证表头不换行
|
|
2
|
+
const ASCII_W = {
|
|
3
|
+
' ': 4.125,
|
|
4
|
+
0: 8.21875,
|
|
5
|
+
1: 8.21875,
|
|
6
|
+
2: 8.21875,
|
|
7
|
+
3: 8.21875,
|
|
8
|
+
4: 8.21875,
|
|
9
|
+
5: 8.21875,
|
|
10
|
+
6: 8.21875,
|
|
11
|
+
7: 8.21875,
|
|
12
|
+
8: 8.21875,
|
|
13
|
+
9: 8.21875,
|
|
14
|
+
'!': 4.375,
|
|
15
|
+
'"': 6.109375,
|
|
16
|
+
'#': 8.9375,
|
|
17
|
+
$: 8.21875,
|
|
18
|
+
'%': 12.46875,
|
|
19
|
+
'&': 12.1875,
|
|
20
|
+
"'": 3.59375,
|
|
21
|
+
'(': 4.6875,
|
|
22
|
+
')': 4.6875,
|
|
23
|
+
'*': 6.375,
|
|
24
|
+
'+': 10.390625,
|
|
25
|
+
',': 3.375,
|
|
26
|
+
'-': 6.0625,
|
|
27
|
+
'.': 3.375,
|
|
28
|
+
'/': 5.984375,
|
|
29
|
+
':': 3.375,
|
|
30
|
+
';': 3.375,
|
|
31
|
+
'<': 10.390625,
|
|
32
|
+
'=': 10.390625,
|
|
33
|
+
'>': 10.390625,
|
|
34
|
+
'?': 6.765625,
|
|
35
|
+
'@': 14.4375,
|
|
36
|
+
A: 9.859375,
|
|
37
|
+
B: 8.796875,
|
|
38
|
+
C: 9.375,
|
|
39
|
+
D: 10.671875,
|
|
40
|
+
E: 7.703125,
|
|
41
|
+
F: 7.4375,
|
|
42
|
+
G: 10.421875,
|
|
43
|
+
H: 10.828125,
|
|
44
|
+
I: 4.125,
|
|
45
|
+
J: 5.546875,
|
|
46
|
+
K: 8.890625,
|
|
47
|
+
L: 7.1875,
|
|
48
|
+
M: 13.6875,
|
|
49
|
+
N: 11.390625,
|
|
50
|
+
O: 11.421875,
|
|
51
|
+
P: 8.578125,
|
|
52
|
+
Q: 11.421875,
|
|
53
|
+
R: 9.140625,
|
|
54
|
+
S: 8.09375,
|
|
55
|
+
T: 8.03125,
|
|
56
|
+
U: 10.453125,
|
|
57
|
+
V: 9.46875,
|
|
58
|
+
W: 14.25,
|
|
59
|
+
X: 9.03125,
|
|
60
|
+
Y: 8.453125,
|
|
61
|
+
Z: 8.6875,
|
|
62
|
+
'[': 4.6875,
|
|
63
|
+
'\\': 5.828125,
|
|
64
|
+
']': 4.6875,
|
|
65
|
+
'^': 10.390625,
|
|
66
|
+
_: 6.28125,
|
|
67
|
+
'`': 4.140625,
|
|
68
|
+
a: 7.75,
|
|
69
|
+
b: 8.953125,
|
|
70
|
+
c: 7.03125,
|
|
71
|
+
d: 8.96875,
|
|
72
|
+
e: 7.953125,
|
|
73
|
+
f: 4.859375,
|
|
74
|
+
g: 8.96875,
|
|
75
|
+
h: 8.625,
|
|
76
|
+
i: 3.734375,
|
|
77
|
+
j: 3.75,
|
|
78
|
+
k: 7.625,
|
|
79
|
+
l: 3.734375,
|
|
80
|
+
m: 13.125,
|
|
81
|
+
n: 8.640625,
|
|
82
|
+
o: 8.90625,
|
|
83
|
+
p: 8.953125,
|
|
84
|
+
q: 8.96875,
|
|
85
|
+
r: 5.40625,
|
|
86
|
+
s: 6.546875,
|
|
87
|
+
t: 5.21875,
|
|
88
|
+
u: 8.640625,
|
|
89
|
+
v: 7.359375,
|
|
90
|
+
w: 11.0625,
|
|
91
|
+
x: 7.109375,
|
|
92
|
+
y: 7.421875,
|
|
93
|
+
z: 6.890625,
|
|
94
|
+
'{': 4.6875,
|
|
95
|
+
'|': 3.78125,
|
|
96
|
+
'}': 4.6875,
|
|
97
|
+
'~': 10.390625
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default function getWidth(label) {
|
|
101
|
+
label = label || ''
|
|
102
|
+
let labels = label.match(/./gu) || []
|
|
103
|
+
let labelW = 0
|
|
104
|
+
labels.forEach((s) => (labelW += ASCII_W[s] || 14))
|
|
105
|
+
|
|
106
|
+
return labelW
|
|
107
|
+
}
|
package/src/utils/common.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export function generateUUID() {
|
|
2
|
-
let d = new Date().getTime();
|
|
3
|
-
if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
|
|
4
|
-
d += performance.now(); //use high-precision timer if available
|
|
5
|
-
}
|
|
6
|
-
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
7
|
-
const r = (d + Math.random()*16)%16 | 0;
|
|
8
|
-
d = Math.floor(d/16);
|
|
9
|
-
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
|
|
10
|
-
});
|
|
11
|
-
return uuid;
|
|
12
|
-
}
|
|
1
|
+
export function generateUUID() {
|
|
2
|
+
let d = new Date().getTime();
|
|
3
|
+
if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
|
|
4
|
+
d += performance.now(); //use high-precision timer if available
|
|
5
|
+
}
|
|
6
|
+
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
7
|
+
const r = (d + Math.random()*16)%16 | 0;
|
|
8
|
+
d = Math.floor(d/16);
|
|
9
|
+
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
|
|
10
|
+
});
|
|
11
|
+
return uuid;
|
|
12
|
+
}
|