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,148 +1,148 @@
1
- <template>
2
- <div class="collapse" :class="{ 'm-b-s': !_isCollapse }">
3
- <el-collapse-transition v-if="$slots.default && showCard">
4
- <div class="collapse-content" v-show="!_isCollapse">
5
- <slot />
6
- </div>
7
- </el-collapse-transition>
8
- <div class="collapse-slot">
9
- <el-button v-if="showCard" class="rotate90" :icon="_isCollapse? 'el-icon-d-arrow-right': 'el-icon-d-arrow-left'" plain onlyicon size="mini" @click="handleToggle"/>
10
- <el-button icon="el-icon-setting" plain onlyicon size="mini" @click="toSettings" />
11
- <slot name="action" />
12
- </div>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- export default {
18
- name: 'CommonCollapse',
19
- props: {
20
- permission: {
21
- type: String,
22
- default: ''
23
- },
24
- value: {
25
- type: Boolean,
26
- default: false
27
- },
28
- showCard: {
29
- type: Boolean,
30
- default: true
31
- }
32
- },
33
- data() {
34
- return {
35
- isCollapse: false
36
- }
37
- },
38
- computed: {
39
- hasUsedVModel() {
40
- return 'value' in this.$options.propsData
41
- },
42
- _isCollapse: {
43
- get() {
44
- return this.hasUsedVModel ? this.value : this.isCollapse
45
- },
46
- set(val) {
47
- if (this.hasUsedVModel) {
48
- this.$emit('input', val)
49
- } else {
50
- this.isCollapse = val
51
- }
52
- }
53
- }
54
- },
55
- methods: {
56
- toSettings() {
57
- this.$emit('toSettings')
58
- },
59
- // 切换 显示/隐藏
60
- handleToggle() {
61
- this._isCollapse = !this._isCollapse
62
- }
63
- }
64
- }
65
- </script>
66
-
67
- <style lang="scss" scoped>
68
- .collapse {
69
- position: relative;
70
- &-slot {
71
- z-index: 99999;
72
- position: absolute;
73
- top: -28px;
74
- right: 0;
75
- height: 24px;
76
- display: flex;
77
- justify-content: space-around;
78
- align-items: center;
79
- .el-icon {
80
- color: var(--color-text-regular);
81
- cursor: pointer;
82
- font-weight: bold;
83
- font-size: 18px;
84
- }
85
- }
86
- }
87
- </style>
88
-
89
- <style lang="scss">
90
- $--button-margin-left: 6px;
91
-
92
- .el-button--primary,
93
- .el-button--default,
94
- .el-button--default.is-plain,
95
- .el-button--warning.is-plain,
96
- .el-button--danger.is-plain {
97
- min-width: 72px;
98
- }
99
-
100
- .el-dropdown__caret-button,
101
- .el-button[onlyicon] {
102
- min-width: auto;
103
- }
104
-
105
- .el-button.button-4em {
106
- min-width: 72px;
107
- }
108
-
109
- .el-button+.el-button {
110
- margin-left: $--button-margin-left;
111
- }
112
-
113
- .el-button+.el-dropdown {
114
- margin-left: $--button-margin-left;
115
- }
116
-
117
- .el-button--mini+.el-button--mini {
118
- margin-left: $--button-margin-left;
119
- }
120
-
121
- .el-button[onlyicon] {
122
-
123
- &.el-button--default,
124
- &.el-button--medium,
125
- &.el-button--small {
126
- padding: 8px;
127
- }
128
-
129
- &.el-button--mini {
130
- padding: 5px;
131
- }
132
- }
133
-
134
- .el-button--info {
135
-
136
- &,
137
- &:focus {
138
- background-color: var(--color-info);
139
- border-color: var(--color-info);
140
- }
141
-
142
- &:hover {
143
- background: var(--color-info-hover);
144
- border-color: var(--color-info-hover);
145
- }
146
- }
147
-
1
+ <template>
2
+ <div class="collapse" :class="{ 'm-b-s': !_isCollapse }">
3
+ <el-collapse-transition v-if="$slots.default && showCard">
4
+ <div class="collapse-content" v-show="!_isCollapse">
5
+ <slot />
6
+ </div>
7
+ </el-collapse-transition>
8
+ <div class="collapse-slot">
9
+ <el-button v-if="showCard" class="rotate90" :icon="_isCollapse? 'el-icon-d-arrow-right': 'el-icon-d-arrow-left'" plain onlyicon size="mini" @click="handleToggle"/>
10
+ <el-button icon="el-icon-setting" plain onlyicon size="mini" @click="toSettings" />
11
+ <slot name="action" />
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ export default {
18
+ name: 'CommonCollapse',
19
+ props: {
20
+ permission: {
21
+ type: String,
22
+ default: ''
23
+ },
24
+ value: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ showCard: {
29
+ type: Boolean,
30
+ default: true
31
+ }
32
+ },
33
+ data() {
34
+ return {
35
+ isCollapse: false
36
+ }
37
+ },
38
+ computed: {
39
+ hasUsedVModel() {
40
+ return 'value' in this.$options.propsData
41
+ },
42
+ _isCollapse: {
43
+ get() {
44
+ return this.hasUsedVModel ? this.value : this.isCollapse
45
+ },
46
+ set(val) {
47
+ if (this.hasUsedVModel) {
48
+ this.$emit('input', val)
49
+ } else {
50
+ this.isCollapse = val
51
+ }
52
+ }
53
+ }
54
+ },
55
+ methods: {
56
+ toSettings() {
57
+ this.$emit('toSettings')
58
+ },
59
+ // 切换 显示/隐藏
60
+ handleToggle() {
61
+ this._isCollapse = !this._isCollapse
62
+ }
63
+ }
64
+ }
65
+ </script>
66
+
67
+ <style lang="scss" scoped>
68
+ .collapse {
69
+ position: relative;
70
+ &-slot {
71
+ z-index: 99999;
72
+ position: absolute;
73
+ top: -28px;
74
+ right: 0;
75
+ height: 24px;
76
+ display: flex;
77
+ justify-content: space-around;
78
+ align-items: center;
79
+ .el-icon {
80
+ color: var(--color-text-regular);
81
+ cursor: pointer;
82
+ font-weight: bold;
83
+ font-size: 18px;
84
+ }
85
+ }
86
+ }
87
+ </style>
88
+
89
+ <style lang="scss">
90
+ $--button-margin-left: 6px;
91
+
92
+ .el-button--primary,
93
+ .el-button--default,
94
+ .el-button--default.is-plain,
95
+ .el-button--warning.is-plain,
96
+ .el-button--danger.is-plain {
97
+ min-width: 72px;
98
+ }
99
+
100
+ .el-dropdown__caret-button,
101
+ .el-button[onlyicon] {
102
+ min-width: auto;
103
+ }
104
+
105
+ .el-button.button-4em {
106
+ min-width: 72px;
107
+ }
108
+
109
+ .el-button+.el-button {
110
+ margin-left: $--button-margin-left;
111
+ }
112
+
113
+ .el-button+.el-dropdown {
114
+ margin-left: $--button-margin-left;
115
+ }
116
+
117
+ .el-button--mini+.el-button--mini {
118
+ margin-left: $--button-margin-left;
119
+ }
120
+
121
+ .el-button[onlyicon] {
122
+
123
+ &.el-button--default,
124
+ &.el-button--medium,
125
+ &.el-button--small {
126
+ padding: 8px;
127
+ }
128
+
129
+ &.el-button--mini {
130
+ padding: 5px;
131
+ }
132
+ }
133
+
134
+ .el-button--info {
135
+
136
+ &,
137
+ &:focus {
138
+ background-color: var(--color-info);
139
+ border-color: var(--color-info);
140
+ }
141
+
142
+ &:hover {
143
+ background: var(--color-info-hover);
144
+ border-color: var(--color-info-hover);
145
+ }
146
+ }
147
+
148
148
  </style>
@@ -1,8 +1,8 @@
1
- import FormPage from './src/main';
2
-
3
- /* istanbul ignore next */
4
- FormPage.install = function(Vue) {
5
- Vue.component(FormPage.name, FormPage);
6
- };
7
-
8
- export default FormPage;
1
+ import FormPage from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ FormPage.install = function(Vue) {
5
+ Vue.component(FormPage.name, FormPage);
6
+ };
7
+
8
+ export default FormPage;
@@ -1,56 +1,56 @@
1
- <template>
2
- <div class="t20-form flex-column">
3
- <div class="m-b-s" v-if="$slots.header">
4
- <slot name="header"></slot>
5
- </div>
6
- <div class="n20-page-content flex-item">
7
- <!--
8
- 锚点 + 表单
9
- <N20-anchor v-model="action" position="right">
10
- <el-form
11
- class="label-width-16em"
12
- :model="formData"
13
- :rules="rules"
14
- label-width="16em"
15
- >
16
- <N20-anchor-item :title="$l('基本信息')" id="1">
17
- <el-form-item :label="$l('支付工具')" prop="settlementTools"></el-form-item>
18
- </N20-anchor-item>
19
- </el-form>
20
- </N20-anchor>
21
- -->
22
- <slot></slot>
23
- </div>
24
- <div class="t20-page-button-shadow flex-box flex-c flex-v" v-if="$slots.footer">
25
- <slot name="footer"></slot>
26
- </div>
27
- </div>
28
- </template>
29
-
30
- <script>
31
- export default {
32
- name: 'FormPage'
33
- }
34
- </script>
35
-
36
- <style lang="scss" scoped>
37
- .t20-form {
38
- padding: 8px 8px 0 !important;
39
- background-color: #ffffff !important;
40
- }
41
-
42
- .t20-page-button-shadow {
43
- position: relative;
44
- height: 44px;
45
- &::before {
46
- content: "";
47
- pointer-events: none;
48
- position: absolute;
49
- top: 0;
50
- height: 100%;
51
- left: -8px;
52
- right: -8px;
53
- box-shadow: 0 -2px 6px 0 rgba(0, 0, 0, .08);
54
- }
55
- }
1
+ <template>
2
+ <div class="t20-form flex-column">
3
+ <div class="m-b-s" v-if="$slots.header">
4
+ <slot name="header"></slot>
5
+ </div>
6
+ <div class="n20-page-content flex-item">
7
+ <!--
8
+ 锚点 + 表单
9
+ <N20-anchor v-model="action" position="right">
10
+ <el-form
11
+ class="label-width-16em"
12
+ :model="formData"
13
+ :rules="rules"
14
+ label-width="16em"
15
+ >
16
+ <N20-anchor-item :title="$l('基本信息')" id="1">
17
+ <el-form-item :label="$l('支付工具')" prop="settlementTools"></el-form-item>
18
+ </N20-anchor-item>
19
+ </el-form>
20
+ </N20-anchor>
21
+ -->
22
+ <slot></slot>
23
+ </div>
24
+ <div class="t20-page-button-shadow flex-box flex-c flex-v" v-if="$slots.footer">
25
+ <slot name="footer"></slot>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ export default {
32
+ name: 'FormPage'
33
+ }
34
+ </script>
35
+
36
+ <style lang="scss" scoped>
37
+ .t20-form {
38
+ padding: 8px 8px 0 !important;
39
+ background-color: #ffffff !important;
40
+ }
41
+
42
+ .t20-page-button-shadow {
43
+ position: relative;
44
+ height: 44px;
45
+ &::before {
46
+ content: "";
47
+ pointer-events: none;
48
+ position: absolute;
49
+ top: 0;
50
+ height: 100%;
51
+ left: -8px;
52
+ right: -8px;
53
+ box-shadow: 0 -2px 6px 0 rgba(0, 0, 0, .08);
54
+ }
55
+ }
56
56
  </style>
@@ -0,0 +1,8 @@
1
+ import InputNumber from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ InputNumber.install = function(Vue) {
5
+ Vue.component(InputNumber.name, InputNumber);
6
+ };
7
+
8
+ export default InputNumber;
@@ -0,0 +1,184 @@
1
+ <template>
2
+ <el-input v-bind="$attrs" :value="innerValue" v-on="listeners" @keydown.native="handleKeydown">
3
+ <slot></slot>
4
+ <template slot="prepend">
5
+ <slot name="prepend"></slot>
6
+ </template>
7
+ <template slot="append">
8
+ <slot name="append"></slot>
9
+ </template>
10
+ <template slot="prefix">
11
+ <slot name="prefix"></slot>
12
+ </template>
13
+ <template slot="suffix">
14
+ <slot name="suffix"></slot>
15
+ </template>
16
+ </el-input>
17
+ </template>
18
+
19
+ <script>
20
+ export default {
21
+ name: 'InputNumber',
22
+ inheritAttrs: false,
23
+ model: {
24
+ prop: 'value',
25
+ event: 'input'
26
+ },
27
+ props: {
28
+ value: {
29
+ type: [String, Number],
30
+ default: ''
31
+ },
32
+ allowNegative: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ allowZero: {
37
+ type: Boolean,
38
+ default: true
39
+ }
40
+ },
41
+ data() {
42
+ return {
43
+ innerValue: ''
44
+ }
45
+ },
46
+ computed: {
47
+ listeners() {
48
+ return Object.assign({}, this.$listeners, {
49
+ input: this.handleInput,
50
+ change: this.handleChange,
51
+ blur: this.handleBlur
52
+ })
53
+ }
54
+ },
55
+ watch: {
56
+ value: {
57
+ immediate: true,
58
+ handler(newVal) {
59
+ const sanitized = this.sanitize(newVal, { allowPartial: false })
60
+ if (sanitized === '' && this.innerValue === '-' && this.allowNegative) {
61
+ return
62
+ }
63
+ if (sanitized !== this.innerValue) {
64
+ this.innerValue = sanitized
65
+ }
66
+ const normalizedSanitized = this.normalizeForEmit(sanitized)
67
+ const normalizedIncoming = this.normalizeIncoming(newVal)
68
+ if (normalizedSanitized !== normalizedIncoming) {
69
+ this.emitValue(sanitized)
70
+ }
71
+ }
72
+ },
73
+ allowNegative() {
74
+ this.revalidateCurrent()
75
+ },
76
+ allowZero() {
77
+ this.revalidateCurrent()
78
+ }
79
+ },
80
+ methods: {
81
+ handleInput(value) {
82
+ const sanitized = this.sanitize(value, { allowPartial: true })
83
+ this.innerValue = sanitized
84
+ this.emitValue(sanitized)
85
+ },
86
+ handleBlur(event) {
87
+ const sanitized = this.sanitize(this.innerValue, { allowPartial: false })
88
+ if (sanitized !== this.innerValue) {
89
+ this.innerValue = sanitized
90
+ }
91
+ this.emitValue(sanitized)
92
+ this.$emit('blur', event)
93
+ },
94
+ handleChange(value) {
95
+ const sanitized = this.sanitize(value, { allowPartial: false })
96
+ if (sanitized !== this.innerValue) {
97
+ this.innerValue = sanitized
98
+ }
99
+ this.emitValue(sanitized)
100
+ this.$emit('change', sanitized)
101
+ },
102
+ handleKeydown(event) {
103
+ if (event.ctrlKey || event.metaKey || event.altKey) {
104
+ return
105
+ }
106
+ const allowed = ['Backspace', 'Tab', 'ArrowLeft', 'ArrowRight', 'Delete', 'Enter']
107
+ if (allowed.indexOf(event.key) !== -1) {
108
+ return
109
+ }
110
+ if (event.key === '-') {
111
+ if (!this.allowNegative) {
112
+ event.preventDefault()
113
+ return
114
+ }
115
+ const { value, selectionStart } = event.target
116
+ if (selectionStart !== 0 || value.includes('-')) {
117
+ event.preventDefault()
118
+ }
119
+ return
120
+ }
121
+ if (!/^\d$/.test(event.key)) {
122
+ event.preventDefault()
123
+ }
124
+ },
125
+ normalizeForEmit(value) {
126
+ return value === '-' ? '' : value
127
+ },
128
+ normalizeIncoming(value) {
129
+ if (value === null || value === undefined) {
130
+ return ''
131
+ }
132
+ return String(value).trim()
133
+ },
134
+ sanitize(value, { allowPartial = false } = {}) {
135
+ if (value === null || value === undefined) {
136
+ return ''
137
+ }
138
+ let input = String(value).trim()
139
+ let sign = ''
140
+
141
+ if (input.startsWith('-')) {
142
+ sign = '-'
143
+ input = input.slice(1)
144
+ }
145
+
146
+ input = input.replace(/\D+/g, '')
147
+
148
+ if (!this.allowNegative) {
149
+ sign = ''
150
+ }
151
+
152
+ let sanitized = sign + input
153
+
154
+ if (!input && sign) {
155
+ sanitized = allowPartial && this.allowNegative ? '-' : ''
156
+ }
157
+
158
+ if (sanitized && sanitized !== '-') {
159
+ sanitized = sanitized.replace(/^(-?)0+(?=\d)/, '$1')
160
+ }
161
+
162
+ if (!this.allowZero && sanitized && sanitized !== '-') {
163
+ const numeric = Number(sanitized)
164
+ if (!Number.isNaN(numeric) && numeric === 0) {
165
+ sanitized = ''
166
+ }
167
+ }
168
+
169
+ return sanitized
170
+ },
171
+ emitValue(value) {
172
+ const normalized = this.normalizeForEmit(value)
173
+ this.$emit('input', normalized)
174
+ },
175
+ revalidateCurrent() {
176
+ const sanitized = this.sanitize(this.innerValue, { allowPartial: false })
177
+ if (sanitized !== this.innerValue) {
178
+ this.innerValue = sanitized
179
+ }
180
+ this.emitValue(sanitized)
181
+ }
182
+ }
183
+ }
184
+ </script>
@@ -1,8 +1,8 @@
1
- import MainPage from './src/main';
2
-
3
- /* istanbul ignore next */
4
- MainPage.install = function(Vue) {
5
- Vue.component(MainPage.name, MainPage);
6
- };
7
-
8
- export default MainPage;
1
+ import MainPage from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ MainPage.install = function(Vue) {
5
+ Vue.component(MainPage.name, MainPage);
6
+ };
7
+
8
+ export default MainPage;