n20-common-lib 2.2.14 → 2.2.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.2.14",
3
+ "version": "2.2.16",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -55,7 +55,6 @@
55
55
  "qrcode": "*",
56
56
  "resize-detector": "*",
57
57
  "strip-json-comments": "*",
58
- "umy-table": "^1.1.8",
59
58
  "v-viewer": "*",
60
59
  "vuedraggable": "*"
61
60
  },
@@ -96,6 +95,7 @@
96
95
  "svgo": "1.2.0",
97
96
  "swiper": "^8.4.5",
98
97
  "url-loader": "^4.1.1",
98
+ "umy-table": "^1.1.8",
99
99
  "vue": "^2.6.11",
100
100
  "vue-cli-plugin-axios": "~0.0.4",
101
101
  "vue-grid-layout": "^2.3.12",
@@ -1,19 +1,13 @@
1
1
  .el-table--small {
2
2
  font-size: 14px;
3
3
  }
4
-
5
- .el-table--mini .el-table__cell {
6
- padding: 2px 0;
7
- .cell {
8
- padding-left: 4px;
9
- padding-right: 4px;
10
- // line-height: 18px;
11
- }
12
- .el-button--mini,
13
- .el-link {
14
- font-size: 12px;
15
- }
4
+ .el-table--mini {
5
+ font-size: 12px;
16
6
  }
7
+ .el-table th {
8
+ font-weight: $--font-weight-primary;
9
+ }
10
+
17
11
  .el-table--small,
18
12
  .el-table--mini {
19
13
  .el-table__cell {
@@ -27,91 +21,85 @@
27
21
  }
28
22
  }
29
23
 
30
- .el-table th {
31
- font-weight: $--font-weight-primary;
32
- }
33
-
34
- /* 过滤 */
35
- .el-table__column-filter-trigger {
36
- height: 16px;
37
- line-height: 16px;
38
- vertical-align: middle;
39
- position: relative;
40
- bottom: 1px;
41
- }
42
-
43
- .el-table__column-filter-trigger i {
44
- font-size: 16px;
45
- transform: scale(1);
46
- }
47
-
48
- .el-table-filter__bottom {
49
- text-align: center;
50
- }
51
-
52
- /* 排序 */
53
- .el-table .caret-wrapper {
54
- display: inline-flex;
55
- flex-direction: row-reverse;
56
- align-items: center;
57
- width: 16px;
58
- height: 16px;
59
- line-height: 16px;
60
- vertical-align: middle;
61
- }
62
-
63
- .el-table .sort-caret.ascending {
64
- width: 8px;
65
- height: 16px;
66
- border: none;
67
- font-style: normal;
68
- position: static;
69
-
70
- &:hover {
71
- color: $--color-primary-light-6;
72
- }
73
-
74
- &:before {
75
- content: '\e61c';
76
- font-family: 'core-lib-iconfont';
77
- font-size: 12px;
78
- line-height: 12px;
79
- position: relative;
80
- right: 3px;
81
- bottom: 1px;
24
+ .el-table--mini {
25
+ .el-table__cell {
26
+ padding: 2px 0;
27
+ .cell {
28
+ padding-left: 4px;
29
+ padding-right: 4px;
30
+ // line-height: 18px;
31
+ }
32
+ .el-button--mini,
33
+ .el-link {
34
+ font-size: 12px;
35
+ }
82
36
  }
83
37
  }
84
38
 
85
- .el-table .ascending .sort-caret.ascending {
86
- color: $--color-primary;
87
- }
39
+ .el-table {
40
+ /* 排序 */
41
+ .caret-wrapper {
42
+ display: inline-flex;
43
+ flex-direction: row-reverse;
44
+ align-items: center;
45
+ width: 16px;
46
+ height: 16px;
47
+ line-height: 16px;
48
+ vertical-align: middle;
49
+ }
50
+ .sort-caret.ascending,
51
+ .sort-caret.descending {
52
+ width: 8px;
53
+ height: 16px;
54
+ border: none;
55
+ font-style: normal;
56
+ position: static;
88
57
 
89
- .el-table .sort-caret.descending {
90
- width: 8px;
91
- height: 16px;
92
- border: none;
93
- font-style: normal;
94
- position: static;
58
+ &:hover {
59
+ color: $--color-primary-light-6;
60
+ }
95
61
 
96
- &:hover {
97
- color: $--color-primary-light-6;
62
+ &:before {
63
+ content: '\e61c';
64
+ font-family: 'core-lib-iconfont';
65
+ font-size: 12px;
66
+ line-height: 12px;
67
+ position: relative;
68
+ right: 3px;
69
+ bottom: 1px;
70
+ }
98
71
  }
99
-
100
- &:before {
72
+ .sort-caret.descending:before {
101
73
  content: '\e61d';
102
- font-family: 'core-lib-iconfont';
103
- font-size: 12px;
104
- line-height: 12px;
105
74
  position: relative;
106
75
  right: 1px;
107
76
  bottom: 1px;
108
77
  }
78
+
79
+ .ascending .sort-caret.ascending,
80
+ .descending .sort-caret.descending {
81
+ color: $--color-primary;
82
+ }
109
83
  }
110
84
 
111
- .el-table .descending .sort-caret.descending {
112
- color: $--color-primary;
85
+ /* 过滤 */
86
+ .el-table-filter__bottom {
87
+ text-align: center;
88
+ }
89
+ .el-table__column-filter-trigger {
90
+ height: 16px;
91
+ line-height: 16px;
92
+ vertical-align: middle;
93
+ position: relative;
94
+ bottom: 1px;
95
+ i {
96
+ font-size: 16px;
97
+ transform: scale(1);
98
+ }
113
99
  }
114
100
 
115
101
  .table-header-popover.el-popover {
116
102
  padding: 16px;
117
103
  }
104
+
105
+ @import url('../../components/TableSetSize/style.scss');
@@ -32,7 +32,11 @@ function tplFn(row, sc, mck, map = {}) {
32
32
  str += dayjs(row[key]).format('HH:mm:ss')
33
33
  break
34
34
  default:
35
- str += row[key]
35
+ if (/^f/.test(type)) {
36
+ str += numerify(row[key], type.replace(/^f/, ''), Math.floor)
37
+ } else {
38
+ str += row[key]
39
+ }
36
40
  break
37
41
  }
38
42
  }
@@ -6,7 +6,7 @@
6
6
  :header-cell-style="{ 'text-align': 'center' }"
7
7
  :data="data"
8
8
  :height="height"
9
- v-bind="$attrs"
9
+ v-bind="Object.assign({ size: size }, $attrs, sizeBind)"
10
10
  v-on="$listeners"
11
11
  >
12
12
  <template v-for="(item, i) in columns">
@@ -23,6 +23,7 @@
23
23
  v-bind="item"
24
24
  />
25
25
  </template>
26
+ <tableSetSize v-if="showSetsize" :size="sizeC" @update:size="sizeUp" @resize="sizeSet" />
26
27
  </el-table>
27
28
  <ux-table
28
29
  v-else
@@ -69,6 +70,7 @@
69
70
  <script>
70
71
  // import { $lc } from '../../utils/i18n/index'
71
72
  import { colfF, colftF, colf_BD_F, colft_BD_F } from './filters'
73
+ import tableSetSize from '../TableSetSize/index.vue'
72
74
 
73
75
  const columnRender = {
74
76
  props: {
@@ -90,7 +92,8 @@ const columnRender = {
90
92
  export default {
91
93
  name: 'Table',
92
94
  components: {
93
- columnRender
95
+ columnRender,
96
+ tableSetSize
94
97
  },
95
98
  filters: {
96
99
  colfF,
@@ -141,11 +144,22 @@ export default {
141
144
  height: {
142
145
  type: [String, Number],
143
146
  default: undefined
147
+ },
148
+ size: {
149
+ type: String,
150
+ default: 'small'
151
+ },
152
+ showSetsize: {
153
+ type: Boolean,
154
+ default: false
144
155
  }
145
156
  },
146
157
  data() {
158
+ let _this = this
147
159
  return {
148
- colsKey: 0
160
+ colsKey: 0,
161
+ sizeC: _this.size,
162
+ sizeBind: undefined
149
163
  }
150
164
  },
151
165
  provide() {
@@ -157,6 +171,9 @@ export default {
157
171
  watch: {
158
172
  columns() {
159
173
  this.colsKey = this.colsKey + 1
174
+ },
175
+ size(val) {
176
+ this.sizeC = val
160
177
  }
161
178
  },
162
179
  mounted() {
@@ -207,12 +224,24 @@ export default {
207
224
  if (_key) key = _key
208
225
  }
209
226
 
210
- elFilters[key || item.property] = item.column.filterMultiple ? item.values : item.values[0]
227
+ elFilters[key || item.property] = item.values
211
228
  })
212
229
  this.$emit('filter-change', elFilters, arg)
213
230
  },
214
231
  bigExpand(arg) {
215
232
  this.$emit('expand-change', arg.row, arg.expanded, arg)
233
+ },
234
+ sizeUp(size) {
235
+ this.sizeC = size
236
+ this.$emit('update:size', size)
237
+ },
238
+ sizeSet(el) {
239
+ this.sizeBind = el
240
+
241
+ let inTable = this.$refs['el-table']
242
+ if (inTable) {
243
+ inTable.doLayout()
244
+ }
216
245
  }
217
246
  }
218
247
  }
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="el-table-set-size flex-box">
3
+ <div class="el-table-set-size-item m-r-0" :class="sizeC === 'mini' && 'active'" @click="setSize('mini')">
4
+ <img class="icon-mini" src="./mini.png" />
5
+ <div class="text-mini">{{ _lang === 'zh' ? '小行距' : 'mini' }}</div>
6
+ </div>
7
+ <div class="el-table-set-size-item" :class="sizeC === 'small' && 'active'" @click="setSize('small')">
8
+ <img class="icon-small" src="./small.png" />
9
+ <div class="text-small">{{ _lang === 'zh' ? '中行距' : 'small' }}</div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: 'TableSetSize',
17
+ props: {
18
+ size: {
19
+ type: String,
20
+ default: 'small'
21
+ },
22
+ mini: {
23
+ type: Object,
24
+ default: () => ({
25
+ border: false,
26
+ size: 'mini',
27
+ stripe: true
28
+ })
29
+ },
30
+ small: {
31
+ type: Object,
32
+ default: () => ({
33
+ border: true,
34
+ size: 'small',
35
+ stripe: false
36
+ })
37
+ }
38
+ },
39
+ data() {
40
+ let _this = this
41
+ return {
42
+ sizeC: _this.size
43
+ }
44
+ },
45
+ watch: {
46
+ size() {
47
+ this.setSize(this.size, 'pasv')
48
+ }
49
+ },
50
+ created() {
51
+ this.setSize(this.size, 'pasv')
52
+ },
53
+ methods: {
54
+ setSize(type, t) {
55
+ this.sizeC = type
56
+
57
+ if (type === 'mini') {
58
+ this.$emit('resize', this.mini)
59
+ } else if (type === 'small') {
60
+ this.$emit('resize', this.small)
61
+ }
62
+
63
+ if (t !== 'pasv') {
64
+ this.$emit('update:size', type)
65
+ }
66
+ }
67
+ }
68
+ }
69
+ </script>
@@ -0,0 +1,83 @@
1
+ @import '@/assets/css/element-variables.scss';
2
+ .el-table .hidden-columns {
3
+ visibility: initial;
4
+ position: initial;
5
+ height: 0;
6
+ width: 0;
7
+
8
+ > * {
9
+ visibility: hidden;
10
+ }
11
+ > .el-table-set-size {
12
+ visibility: initial;
13
+ }
14
+ }
15
+ .el-table-set-size {
16
+ box-sizing: border-box;
17
+ width: 6px;
18
+ height: 40px;
19
+
20
+ border-radius: 4px 0 0 4px;
21
+
22
+ position: absolute;
23
+ top: 0;
24
+ right: 0;
25
+ z-index: 9;
26
+
27
+ overflow: hidden;
28
+
29
+ transition: all 0.3s;
30
+ &::before {
31
+ content: '';
32
+ position: absolute;
33
+ width: 100%;
34
+ height: 100%;
35
+ background: $--color-primary;
36
+ opacity: 0.7;
37
+ }
38
+
39
+ &:hover {
40
+ width: 88px;
41
+ }
42
+
43
+ &-item {
44
+ margin: 3px 6px;
45
+ width: 36px;
46
+ height: 34px;
47
+ border-radius: 4px;
48
+
49
+ color: $--color-white;
50
+ z-index: 1;
51
+ cursor: pointer;
52
+ &:hover {
53
+ background: $--color-primary;
54
+ }
55
+ &.active {
56
+ background: $--color-primary-hover;
57
+ }
58
+ .icon-small,
59
+ .icon-mini {
60
+ display: block;
61
+ width: 17px;
62
+ height: 14px;
63
+ margin: 4px auto 0;
64
+ }
65
+ .icon-small {
66
+ background: url('./small.png');
67
+ background-size: 100% 100%;
68
+ }
69
+ .icon-mini {
70
+ background: url('./mini.png');
71
+ background-size: 100% 100%;
72
+ }
73
+ .text-small,
74
+ .text-mini {
75
+ margin-top: 3px;
76
+ line-height: 12px;
77
+ font-size: 12px;
78
+ text-align: center;
79
+ transform: scale(0.667);
80
+ transform-origin: 50% 0;
81
+ }
82
+ }
83
+ }
package/src/index.js CHANGED
@@ -38,6 +38,7 @@ import FooterBox from './components/FooterBox/index.vue'
38
38
  import Filters from './components/Filters/index.vue'
39
39
  import Table from './components/Table/index.vue'
40
40
  import TableOperateColumn from './components/TableOperateColumn/index.vue'
41
+ import TableSetSize from './components/TableSetSize'
41
42
  import Button from './components/Button/index.vue'
42
43
  import ButtonGroup from './components/Button/button-group.vue'
43
44
  import ShowColumn from './components/ShowColumn/index.vue'
@@ -152,6 +153,7 @@ const components = [
152
153
  Filters,
153
154
  Table,
154
155
  TableOperateColumn,
156
+ TableSetSize,
155
157
  Button,
156
158
  ButtonGroup,
157
159
  ShowColumn,
@@ -288,6 +290,7 @@ export {
288
290
  Filters,
289
291
  Table,
290
292
  TableOperateColumn,
293
+ TableSetSize,
291
294
  Button,
292
295
  ButtonGroup,
293
296
  ShowColumn,