t20-common-lib 0.9.14 → 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.
Files changed (41) hide show
  1. package/package.json +64 -86
  2. package/packages/branch-bank-select/index.js +8 -8
  3. package/packages/branch-bank-select/src/main.vue +179 -179
  4. package/packages/common-collapse/index.js +8 -8
  5. package/packages/common-collapse/src/main.vue +147 -147
  6. package/packages/form-page/index.js +8 -8
  7. package/packages/form-page/src/main.vue +55 -55
  8. package/packages/input-number/index.js +8 -0
  9. package/packages/input-number/src/main.vue +184 -0
  10. package/packages/main-page/index.js +8 -8
  11. package/packages/main-page/src/main.vue +43 -43
  12. package/packages/multi-currency-statistics/index.js +8 -8
  13. package/packages/multi-currency-statistics/src/main.vue +229 -229
  14. package/packages/page-header/index.js +8 -8
  15. package/packages/page-header/src/main.vue +95 -95
  16. package/packages/statis-card/index.js +8 -8
  17. package/packages/statis-card/src/main.vue +250 -250
  18. package/packages/tab-page/index.js +8 -8
  19. package/packages/tab-page/src/main.vue +101 -101
  20. package/packages/tab-pane/index.js +8 -8
  21. package/packages/tab-pane/src/main.vue +185 -185
  22. package/packages/table-page/index.js +8 -8
  23. package/packages/table-page/src/main.vue +42 -42
  24. package/packages/theme-chalk/src/common/element-variables.scss +1045 -1045
  25. package/packages/theme-chalk/src/common/normalize.scss +869 -869
  26. package/packages/theme-chalk/src/index.scss +8 -8
  27. package/src/api/common.js +20 -20
  28. package/src/i18n.json +4 -4
  29. package/src/index.js +75 -71
  30. package/src/store/index.js +25 -25
  31. package/src/store/modules/user.js +42 -42
  32. package/src/utils/asciiWidth.js +107 -107
  33. package/src/utils/common.js +12 -12
  34. package/src/utils/date.js +43 -43
  35. package/src/utils/exportFile.js +6 -6
  36. package/src/utils/i18n/cn2hk.json +1270 -1270
  37. package/src/utils/i18n/index.js +69 -69
  38. package/src/utils/repairElementUI.js +141 -141
  39. package/src/utils/tableCellUtils.js +54 -54
  40. package/src/utils/tableheaderFilterpanel.vue +257 -257
  41. package/style/index.css +25 -25
@@ -1,69 +1,69 @@
1
- import locale from 'element-ui/lib/locale'
2
- import langEn from 'element-ui/lib/locale/lang/en'
3
- import langTh from 'element-ui/lib/locale/lang/th'
4
- import langVi from 'element-ui/lib/locale/lang/vi'
5
- import langTw from 'element-ui/lib/locale/lang/zh-TW'
6
-
7
- import i18n_map_local from '../../i18n.json'
8
- import zhHk from './cn2hk.json' // 简体繁体映射
9
- // 语言枚举
10
- // const langEm = { 中文: 'zh', 中文简体: 'zh-cn', 中文繁体: 'zh-hk', 英文: 'en', 德文: 'de', 法文: 'fr' }
11
-
12
- let pageLang = window.localStorage.getItem('pageLang') // 当前页面的语言
13
- let $i18n_map_root = {} // 全局的国际化
14
-
15
- export function $l(zh, map = {}, arg) {
16
- let val = ''
17
- if (!pageLang || pageLang === 'zh-cn') {
18
- val = zh
19
- } else if (pageLang === 'zh-hk') {
20
- val = cn2hk(zh)
21
- } else {
22
- let key = pageLang
23
- let valMap = map[zh] || $i18n_map_root[zh] || {}
24
- val = valMap[key] !== undefined ? valMap[key] : zh
25
- }
26
- if (arg && val) {
27
- for (let k in arg) {
28
- val = val.replace(k, arg[k])
29
- }
30
- }
31
- return val
32
- }
33
- function cn2hk(zh = '') {
34
- let _zh = ''
35
- for (let i = 0; i < zh.length; i++) {
36
- let v = zh[i]
37
- let v_hk = zhHk[v]
38
- v_hk ? (_zh += v_hk) : (_zh += v)
39
- }
40
- return _zh
41
- }
42
-
43
- export function $lc(zh, map) {
44
- return $l(zh, map || i18n_map_local)
45
- }
46
-
47
- const directive = {}
48
- directive.install = (Vue, map = {}) => {
49
- if (pageLang === 'en') {
50
- locale.use(langEn)
51
- } else if (pageLang === 'zh-hk') {
52
- locale.use(langTw)
53
- } else if (pageLang === 'th') {
54
- locale.use(langTh)
55
- } else if (pageLang === 'vi') {
56
- locale.use(langVi)
57
- }
58
-
59
- $i18n_map_root = map
60
-
61
- Vue.prototype._lang = !pageLang || pageLang === 'zh-cn' || pageLang === 'zh-hk' ? 'zh' : pageLang
62
- Vue.prototype.$l = $l
63
- Vue.filter('$l', $l)
64
-
65
- Vue.prototype.$lc = $lc
66
- Vue.filter('$lc', $lc)
67
- }
68
-
69
- export default directive
1
+ import locale from 'element-ui/lib/locale'
2
+ import langEn from 'element-ui/lib/locale/lang/en'
3
+ import langTh from 'element-ui/lib/locale/lang/th'
4
+ import langVi from 'element-ui/lib/locale/lang/vi'
5
+ import langTw from 'element-ui/lib/locale/lang/zh-TW'
6
+
7
+ import i18n_map_local from '../../i18n.json'
8
+ import zhHk from './cn2hk.json' // 简体繁体映射
9
+ // 语言枚举
10
+ // const langEm = { 中文: 'zh', 中文简体: 'zh-cn', 中文繁体: 'zh-hk', 英文: 'en', 德文: 'de', 法文: 'fr' }
11
+
12
+ let pageLang = window.localStorage.getItem('pageLang') // 当前页面的语言
13
+ let $i18n_map_root = {} // 全局的国际化
14
+
15
+ export function $l(zh, map = {}, arg) {
16
+ let val = ''
17
+ if (!pageLang || pageLang === 'zh-cn') {
18
+ val = zh
19
+ } else if (pageLang === 'zh-hk') {
20
+ val = cn2hk(zh)
21
+ } else {
22
+ let key = pageLang
23
+ let valMap = map[zh] || $i18n_map_root[zh] || {}
24
+ val = valMap[key] !== undefined ? valMap[key] : zh
25
+ }
26
+ if (arg && val) {
27
+ for (let k in arg) {
28
+ val = val.replace(k, arg[k])
29
+ }
30
+ }
31
+ return val
32
+ }
33
+ function cn2hk(zh = '') {
34
+ let _zh = ''
35
+ for (let i = 0; i < zh.length; i++) {
36
+ let v = zh[i]
37
+ let v_hk = zhHk[v]
38
+ v_hk ? (_zh += v_hk) : (_zh += v)
39
+ }
40
+ return _zh
41
+ }
42
+
43
+ export function $lc(zh, map) {
44
+ return $l(zh, map || i18n_map_local)
45
+ }
46
+
47
+ const directive = {}
48
+ directive.install = (Vue, map = {}) => {
49
+ if (pageLang === 'en') {
50
+ locale.use(langEn)
51
+ } else if (pageLang === 'zh-hk') {
52
+ locale.use(langTw)
53
+ } else if (pageLang === 'th') {
54
+ locale.use(langTh)
55
+ } else if (pageLang === 'vi') {
56
+ locale.use(langVi)
57
+ }
58
+
59
+ $i18n_map_root = map
60
+
61
+ Vue.prototype._lang = !pageLang || pageLang === 'zh-cn' || pageLang === 'zh-hk' ? 'zh' : pageLang
62
+ Vue.prototype.$l = $l
63
+ Vue.filter('$l', $l)
64
+
65
+ Vue.prototype.$lc = $lc
66
+ Vue.filter('$lc', $lc)
67
+ }
68
+
69
+ export default directive
@@ -1,141 +1,141 @@
1
- import Vue from 'vue'
2
- import ElementUI from 'element-ui'
3
-
4
- function setPropsDefault(component, props) {
5
- let c_props = component.props
6
- Object.keys(props).forEach((key) => {
7
- c_props[key] = Object.assign({}, c_props[key], props[key])
8
- })
9
- }
10
- function setMethodsDefault(component, methods) {
11
- let c_methods = component.methods
12
- Object.keys(methods).forEach((key) => {
13
- c_methods[key] = methods[key]
14
- })
15
- }
16
-
17
- setPropsDefault(ElementUI.TableColumn, {
18
- filterPlacement: {
19
- default: 'bottom'
20
- }
21
- })
22
-
23
- setPropsDefault(ElementUI.Dropdown, {
24
- placement: {
25
- default: 'bottom'
26
- }
27
- })
28
-
29
- setPropsDefault(ElementUI.Dialog, {
30
- appendToBody: {
31
- default: true
32
- }
33
- })
34
-
35
- import getWidth from './asciiWidth'
36
-
37
- setMethodsDefault(ElementUI.TableColumn, {
38
- setColumnWidth(column) {
39
- if (this.realWidth) {
40
- column.width = this.realWidth
41
- }
42
- if (this.realMinWidth) {
43
- column.minWidth = this.realMinWidth
44
- }
45
- if (!column.minWidth) {
46
- if (!column.width) {
47
- let labelW = getWidth(column.label)
48
-
49
- let sortable = column.sortable ? 24 : 0
50
- let filters = column.filters ? 16 : 0
51
- column.minWidth = Math.max(80, labelW + 22 + sortable + filters)
52
- } else {
53
- column.minWidth = 80
54
- }
55
- }
56
- column.realWidth = column.width === undefined ? column.minWidth : column.width
57
- return column
58
- }
59
- })
60
-
61
- // 美化表头搜索
62
- import FilterPanel from './tableheaderFilterpanel.vue'
63
- function hasClass(el, cls) {
64
- if (!el || !cls) return false
65
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.')
66
- if (el.classList) {
67
- return el.classList.contains(cls)
68
- } else {
69
- return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1
70
- }
71
- }
72
- if (ElementUI.Table.components.TableHeader) {
73
- setMethodsDefault(ElementUI.Table.components.TableHeader, {
74
- handleFilterClick(event, column) {
75
- event.stopPropagation()
76
- const target = event.target
77
- let cell = target.tagName === 'TH' ? target : target.parentNode
78
- if (hasClass(cell, 'noclick')) return
79
- cell = cell.querySelector('.el-table__column-filter-trigger') || cell
80
- const table = this.$parent
81
-
82
- let filterPanel = this.filterPanels[column.id]
83
-
84
- if (filterPanel && column.filterOpened) {
85
- filterPanel.showPopper = false
86
- return
87
- }
88
-
89
- if (!filterPanel) {
90
- filterPanel = new Vue(FilterPanel)
91
- this.filterPanels[column.id] = filterPanel
92
- if (column.filterPlacement) {
93
- filterPanel.placement = column.filterPlacement
94
- }
95
- filterPanel.table = table
96
- filterPanel.cell = cell
97
- filterPanel.column = column
98
- !this.$isServer && filterPanel.$mount(document.createElement('div'))
99
- }
100
-
101
- setTimeout(() => {
102
- filterPanel.showPopper = true
103
- }, 16)
104
- }
105
- })
106
- }
107
-
108
- /* 对ElementUI硬优化 */
109
- import Popper from 'element-ui/lib/utils/popper.js'
110
- function repairPopper() {
111
- if (!Popper.prototype.repairR) {
112
- Popper.prototype.repairR = true
113
-
114
- let __getBoundaries = Popper.prototype._getBoundaries
115
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
116
- const boundaries = __getBoundaries.call(this, data, padding, boundariesElement)
117
-
118
- if (this._options.boundariesElement === 'viewport') {
119
- const root = window
120
- const body = root.document.body
121
- const html = root.document.documentElement
122
- let width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth)
123
- let height = Math.max(
124
- body.scrollHeight,
125
- body.offsetHeight,
126
- html.clientHeight,
127
- html.scrollHeight,
128
- html.offsetHeight
129
- )
130
-
131
- boundaries.right = boundaries.right - root.document.documentElement.clientWidth + width
132
- boundaries.bottom = boundaries.bottom - root.document.documentElement.clientHeight + height
133
- }
134
- return boundaries
135
- }
136
- }
137
- }
138
-
139
- export default function () {
140
- repairPopper()
141
- }
1
+ import Vue from 'vue'
2
+ import ElementUI from 'element-ui'
3
+
4
+ function setPropsDefault(component, props) {
5
+ let c_props = component.props
6
+ Object.keys(props).forEach((key) => {
7
+ c_props[key] = Object.assign({}, c_props[key], props[key])
8
+ })
9
+ }
10
+ function setMethodsDefault(component, methods) {
11
+ let c_methods = component.methods
12
+ Object.keys(methods).forEach((key) => {
13
+ c_methods[key] = methods[key]
14
+ })
15
+ }
16
+
17
+ setPropsDefault(ElementUI.TableColumn, {
18
+ filterPlacement: {
19
+ default: 'bottom'
20
+ }
21
+ })
22
+
23
+ setPropsDefault(ElementUI.Dropdown, {
24
+ placement: {
25
+ default: 'bottom'
26
+ }
27
+ })
28
+
29
+ setPropsDefault(ElementUI.Dialog, {
30
+ appendToBody: {
31
+ default: true
32
+ }
33
+ })
34
+
35
+ import getWidth from './asciiWidth'
36
+
37
+ setMethodsDefault(ElementUI.TableColumn, {
38
+ setColumnWidth(column) {
39
+ if (this.realWidth) {
40
+ column.width = this.realWidth
41
+ }
42
+ if (this.realMinWidth) {
43
+ column.minWidth = this.realMinWidth
44
+ }
45
+ if (!column.minWidth) {
46
+ if (!column.width) {
47
+ let labelW = getWidth(column.label)
48
+
49
+ let sortable = column.sortable ? 24 : 0
50
+ let filters = column.filters ? 16 : 0
51
+ column.minWidth = Math.max(80, labelW + 22 + sortable + filters)
52
+ } else {
53
+ column.minWidth = 80
54
+ }
55
+ }
56
+ column.realWidth = column.width === undefined ? column.minWidth : column.width
57
+ return column
58
+ }
59
+ })
60
+
61
+ // 美化表头搜索
62
+ import FilterPanel from './tableheaderFilterpanel.vue'
63
+ function hasClass(el, cls) {
64
+ if (!el || !cls) return false
65
+ if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.')
66
+ if (el.classList) {
67
+ return el.classList.contains(cls)
68
+ } else {
69
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1
70
+ }
71
+ }
72
+ if (ElementUI.Table.components.TableHeader) {
73
+ setMethodsDefault(ElementUI.Table.components.TableHeader, {
74
+ handleFilterClick(event, column) {
75
+ event.stopPropagation()
76
+ const target = event.target
77
+ let cell = target.tagName === 'TH' ? target : target.parentNode
78
+ if (hasClass(cell, 'noclick')) return
79
+ cell = cell.querySelector('.el-table__column-filter-trigger') || cell
80
+ const table = this.$parent
81
+
82
+ let filterPanel = this.filterPanels[column.id]
83
+
84
+ if (filterPanel && column.filterOpened) {
85
+ filterPanel.showPopper = false
86
+ return
87
+ }
88
+
89
+ if (!filterPanel) {
90
+ filterPanel = new Vue(FilterPanel)
91
+ this.filterPanels[column.id] = filterPanel
92
+ if (column.filterPlacement) {
93
+ filterPanel.placement = column.filterPlacement
94
+ }
95
+ filterPanel.table = table
96
+ filterPanel.cell = cell
97
+ filterPanel.column = column
98
+ !this.$isServer && filterPanel.$mount(document.createElement('div'))
99
+ }
100
+
101
+ setTimeout(() => {
102
+ filterPanel.showPopper = true
103
+ }, 16)
104
+ }
105
+ })
106
+ }
107
+
108
+ /* 对ElementUI硬优化 */
109
+ import Popper from 'element-ui/lib/utils/popper.js'
110
+ function repairPopper() {
111
+ if (!Popper.prototype.repairR) {
112
+ Popper.prototype.repairR = true
113
+
114
+ let __getBoundaries = Popper.prototype._getBoundaries
115
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
116
+ const boundaries = __getBoundaries.call(this, data, padding, boundariesElement)
117
+
118
+ if (this._options.boundariesElement === 'viewport') {
119
+ const root = window
120
+ const body = root.document.body
121
+ const html = root.document.documentElement
122
+ let width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth)
123
+ let height = Math.max(
124
+ body.scrollHeight,
125
+ body.offsetHeight,
126
+ html.clientHeight,
127
+ html.scrollHeight,
128
+ html.offsetHeight
129
+ )
130
+
131
+ boundaries.right = boundaries.right - root.document.documentElement.clientWidth + width
132
+ boundaries.bottom = boundaries.bottom - root.document.documentElement.clientHeight + height
133
+ }
134
+ return boundaries
135
+ }
136
+ }
137
+ }
138
+
139
+ export default function () {
140
+ repairPopper()
141
+ }
@@ -1,54 +1,54 @@
1
- const COLUMN_WIDTH = {
2
- SEQ: 62, // 序号
3
- UNIT_NAME: 240, // 单位名称
4
- ACCOUNT_NO: 190, // 账号
5
- ACCOUNT_NAME: 240, // 账户名称
6
- BANK_NAME: 142, // 银行名称
7
- BRANCH_BANK_NAME: 268, // 支行名称
8
- CURRENCY_NAME: 114, // 币种名称
9
- CURRENCY_NO: 114, // 币种编号
10
- BILL_NO: 240, // 票据编号
11
- PERSONAL_NAME: 100, // 个人名称
12
- MONEY: 190, // 金额
13
- DATE: 130, // 日期
14
- DATE_TIME: 180, // 日期时间
15
- DATE_RANGE: 220, // 日期范围
16
- ADDRESS: 268, // 地址
17
- RATE: 110, // 汇率
18
- CONTRACT_NO: 230, // 合同编号
19
- OPERATE: 180, // 操作
20
- DEFAULT: 170 // 默认
21
- }
22
- /**
23
- * 获取对应字段的宽度
24
- * @param {String} field 字段名
25
- * @param {String} fieldType 字段类型
26
- */
27
- export function getColumnWidth(field, fieldType = 'DEFAULT') {
28
- // 返回对应字段的宽度,如果没有则返回默认宽度
29
- return COLUMN_WIDTH[fieldType] || COLUMN_WIDTH.DEFAULT;
30
-
31
- }
32
-
33
- const COLUMN_ALIGN = {
34
- SEQ: 'center', // 序号
35
- UNIT_NAME: 'left', // 单位名称
36
- BRANCH_BANK_NAME: 'left', // 支行名称
37
- ACCOUNT_NAME: 'left', // 账户名称
38
- BILL_NO: 'left', // 票据编号
39
- MONEY: 'right', // 金额
40
- ADDRESS: 'left', // 地址
41
- RATE: 'right', // 汇率
42
- REMARK: 'left', // 备注
43
- DEFAULT: 'center' // 默认
44
- }
45
-
46
- /**
47
- * 获取对应字段对齐方式
48
- * @param {String} field 字段名
49
- * @param {String} fieldType 字段类型
50
- */
51
- export function getCellAlign(field, fieldType = 'DEFAULT') {
52
- // 返回对应字段的宽度,如果没有则返回默认宽度
53
- return COLUMN_ALIGN[fieldType] || COLUMN_ALIGN.DEFAULT;
54
- }
1
+ const COLUMN_WIDTH = {
2
+ SEQ: 62, // 序号
3
+ UNIT_NAME: 240, // 单位名称
4
+ ACCOUNT_NO: 190, // 账号
5
+ ACCOUNT_NAME: 240, // 账户名称
6
+ BANK_NAME: 142, // 银行名称
7
+ BRANCH_BANK_NAME: 268, // 支行名称
8
+ CURRENCY_NAME: 114, // 币种名称
9
+ CURRENCY_NO: 114, // 币种编号
10
+ BILL_NO: 240, // 票据编号
11
+ PERSONAL_NAME: 100, // 个人名称
12
+ MONEY: 190, // 金额
13
+ DATE: 130, // 日期
14
+ DATE_TIME: 180, // 日期时间
15
+ DATE_RANGE: 220, // 日期范围
16
+ ADDRESS: 268, // 地址
17
+ RATE: 110, // 汇率
18
+ CONTRACT_NO: 230, // 合同编号
19
+ OPERATE: 180, // 操作
20
+ DEFAULT: 170 // 默认
21
+ }
22
+ /**
23
+ * 获取对应字段的宽度
24
+ * @param {String} field 字段名
25
+ * @param {String} fieldType 字段类型
26
+ */
27
+ export function getColumnWidth(field, fieldType = 'DEFAULT') {
28
+ // 返回对应字段的宽度,如果没有则返回默认宽度
29
+ return COLUMN_WIDTH[fieldType] || COLUMN_WIDTH.DEFAULT;
30
+
31
+ }
32
+
33
+ const COLUMN_ALIGN = {
34
+ SEQ: 'center', // 序号
35
+ UNIT_NAME: 'left', // 单位名称
36
+ BRANCH_BANK_NAME: 'left', // 支行名称
37
+ ACCOUNT_NAME: 'left', // 账户名称
38
+ BILL_NO: 'left', // 票据编号
39
+ MONEY: 'right', // 金额
40
+ ADDRESS: 'left', // 地址
41
+ RATE: 'right', // 汇率
42
+ REMARK: 'left', // 备注
43
+ DEFAULT: 'center' // 默认
44
+ }
45
+
46
+ /**
47
+ * 获取对应字段对齐方式
48
+ * @param {String} field 字段名
49
+ * @param {String} fieldType 字段类型
50
+ */
51
+ export function getCellAlign(field, fieldType = 'DEFAULT') {
52
+ // 返回对应字段的宽度,如果没有则返回默认宽度
53
+ return COLUMN_ALIGN[fieldType] || COLUMN_ALIGN.DEFAULT;
54
+ }