t20-common-lib 0.9.14 → 0.10.1

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 (43) 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/date-picker-por/index.js +8 -0
  7. package/packages/date-picker-por/src/main.vue +306 -0
  8. package/packages/form-page/index.js +8 -8
  9. package/packages/form-page/src/main.vue +55 -55
  10. package/packages/input-number/index.js +8 -0
  11. package/packages/input-number/src/main.vue +184 -0
  12. package/packages/main-page/index.js +8 -8
  13. package/packages/main-page/src/main.vue +43 -43
  14. package/packages/multi-currency-statistics/index.js +8 -8
  15. package/packages/multi-currency-statistics/src/main.vue +229 -229
  16. package/packages/page-header/index.js +8 -8
  17. package/packages/page-header/src/main.vue +95 -95
  18. package/packages/statis-card/index.js +8 -8
  19. package/packages/statis-card/src/main.vue +250 -250
  20. package/packages/tab-page/index.js +8 -8
  21. package/packages/tab-page/src/main.vue +101 -101
  22. package/packages/tab-pane/index.js +8 -8
  23. package/packages/tab-pane/src/main.vue +185 -185
  24. package/packages/table-page/index.js +8 -8
  25. package/packages/table-page/src/main.vue +42 -42
  26. package/packages/theme-chalk/src/common/element-variables.scss +1045 -1045
  27. package/packages/theme-chalk/src/common/normalize.scss +869 -869
  28. package/packages/theme-chalk/src/index.scss +8 -8
  29. package/src/api/common.js +20 -20
  30. package/src/i18n.json +4 -4
  31. package/src/index.js +78 -71
  32. package/src/store/index.js +25 -25
  33. package/src/store/modules/user.js +42 -42
  34. package/src/utils/asciiWidth.js +107 -107
  35. package/src/utils/common.js +12 -12
  36. package/src/utils/date.js +43 -43
  37. package/src/utils/exportFile.js +6 -6
  38. package/src/utils/i18n/cn2hk.json +1270 -1270
  39. package/src/utils/i18n/index.js +69 -69
  40. package/src/utils/repairElementUI.js +141 -141
  41. package/src/utils/tableCellUtils.js +54 -54
  42. package/src/utils/tableheaderFilterpanel.vue +257 -257
  43. package/style/index.css +25 -25
@@ -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;
@@ -1,44 +1,44 @@
1
- <template>
2
- <div class="flex-column main-page">
3
- <div v-if="$slots.header" class="header">
4
- <slot name="header"></slot>
5
- </div>
6
- <div v-if="$slots.card || $slots.tab" style="position: relative;">
7
- <slot name="card"></slot>
8
- <div class="tab" v-if="$slots.tab">
9
- <slot name="tab"></slot>
10
- </div>
11
- </div>
12
- <div class="bg-white flex-1 overflow">
13
- <slot></slot>
14
- </div>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- export default {
20
- name: 'MainPage'
21
- }
22
- </script>
23
-
24
- <style lang="scss" scoped>
25
- .tab {
26
- position: absolute;
27
- bottom: -40px;
28
- left: 8px;
29
- }
30
-
31
- .bg-white {
32
- background-color: #fff !important;
33
- }
34
-
35
- .header {
36
- height: 32px;
37
- line-height: 32px;
38
- }
39
-
40
- .main-page {
41
- padding: 0 !important;
42
- background: #f0f2f5;
43
- }
1
+ <template>
2
+ <div class="flex-column main-page">
3
+ <div v-if="$slots.header" class="header">
4
+ <slot name="header"></slot>
5
+ </div>
6
+ <div v-if="$slots.card || $slots.tab" style="position: relative;">
7
+ <slot name="card"></slot>
8
+ <div class="tab" v-if="$slots.tab">
9
+ <slot name="tab"></slot>
10
+ </div>
11
+ </div>
12
+ <div class="bg-white flex-1 overflow">
13
+ <slot></slot>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'MainPage'
21
+ }
22
+ </script>
23
+
24
+ <style lang="scss" scoped>
25
+ .tab {
26
+ position: absolute;
27
+ bottom: -40px;
28
+ left: 8px;
29
+ }
30
+
31
+ .bg-white {
32
+ background-color: #fff !important;
33
+ }
34
+
35
+ .header {
36
+ height: 32px;
37
+ line-height: 32px;
38
+ }
39
+
40
+ .main-page {
41
+ padding: 0 !important;
42
+ background: #f0f2f5;
43
+ }
44
44
  </style>
@@ -1,8 +1,8 @@
1
- import MultiCurrencyStatistics from './src/main';
2
-
3
- /* istanbul ignore next */
4
- MultiCurrencyStatistics.install = function(Vue) {
5
- Vue.component(MultiCurrencyStatistics.name, MultiCurrencyStatistics);
6
- };
7
-
8
- export default MultiCurrencyStatistics;
1
+ import MultiCurrencyStatistics from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ MultiCurrencyStatistics.install = function(Vue) {
5
+ Vue.component(MultiCurrencyStatistics.name, MultiCurrencyStatistics);
6
+ };
7
+
8
+ export default MultiCurrencyStatistics;