tianheng-ui 0.0.10 → 0.0.14

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.10",
4
+ "version": "0.0.14",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <div
3
3
  class="th-cell"
4
- :class="[customClass, center ? 'is-center' : '']"
4
+ :class="[
5
+ customClass,
6
+ center ? 'is-center' : '',
7
+ active ? cellActive : '',
8
+ hover ? cellHover : ''
9
+ ]"
5
10
  :style="customStyle"
6
11
  @click="handleClick"
7
12
  >
@@ -11,18 +16,26 @@
11
16
  <div
12
17
  v-if="title"
13
18
  class="th-cell-title"
14
- :class="titleClass"
19
+ :class="[titleClass, active ? titleActive : '', hover ? titleHover : 'title-color']"
15
20
  :style="titleStyle"
16
21
  >
17
22
  {{ title }}
18
23
  </div>
19
24
  <slot v-else name="title" />
20
- <div v-if="label" class="th-cell-label" :class="labelClass">
25
+ <div
26
+ v-if="label"
27
+ class="th-cell-label"
28
+ :class="[labelClass, active ? labelActive : '', hover ? labelHover : '']"
29
+ >
21
30
  {{ label }}
22
31
  </div>
23
32
  <slot v-else name="label" />
24
33
  </div>
25
- <div v-if="value" class="th-cell-value" :class="valueClass">
34
+ <div
35
+ v-if="value"
36
+ class="th-cell-value"
37
+ :class="[valueClass, active ? valueActive : '', hover ? valueHover : '']"
38
+ >
26
39
  {{ value }}
27
40
  </div>
28
41
  <slot v-else />
@@ -37,15 +50,62 @@ export default {
37
50
  value: Number | String,
38
51
  label: String,
39
52
  icon: String,
40
- center: Boolean,
53
+
54
+ customStyle: String | Object,
55
+ titleStyle: String | Object,
41
56
 
42
57
  customClass: String | Object,
43
58
  titleClass: String | Object,
44
59
  labelClass: String | Object,
45
60
  valueClass: String | Object,
46
61
 
47
- customStyle: String | Object,
48
- titleStyle: String | Object
62
+ cellActiveClass: String | Object,
63
+ titleActiveClass: String | Object,
64
+ labelActiveClass: String | Object,
65
+ valueActiveClass: String | Object,
66
+
67
+ cellHoverClass: String | Object,
68
+ titleHoverClass: String | Object,
69
+ labelHoverClass: String | Object,
70
+ valueHoverClass: String | Object,
71
+
72
+ center: Boolean,
73
+ hover: Boolean,
74
+ active: Boolean
75
+ },
76
+ computed: {
77
+ cellActive() {
78
+ if (this.cellActiveClass) return this.cellActiveClass;
79
+ else return "is-active";
80
+ },
81
+ titleActive() {
82
+ if (this.titleActiveClass) return this.titleActiveClass;
83
+ else return "is-active";
84
+ },
85
+ labelActive() {
86
+ if (this.labelActiveClass) return this.labelActiveClass;
87
+ else return "is-active";
88
+ },
89
+ valueActive() {
90
+ if (this.valueActiveClass) return this.valueActiveClass;
91
+ else return "is-active";
92
+ },
93
+ cellHover() {
94
+ if (this.cellHoverClass) return this.cellHoverClass;
95
+ else return "is-hover";
96
+ },
97
+ titleHover() {
98
+ if (this.titleHoverClass) return this.titleHoverClass;
99
+ else return "is-hover";
100
+ },
101
+ labelHover() {
102
+ if (this.labelHoverClass) return this.labelHoverClass;
103
+ else return "is-hover";
104
+ },
105
+ valueHover() {
106
+ if (this.valueHoverClass) return this.valueHoverClass;
107
+ else return "is-hover";
108
+ }
49
109
  },
50
110
  methods: {
51
111
  handleClick(evt) {
@@ -0,0 +1,8 @@
1
+ import TableAction from "./action.vue";
2
+
3
+ /* istanbul ignore next */
4
+ TableAction.install = function(Vue) {
5
+ Vue.component(TableAction.name, TableAction);
6
+ };
7
+
8
+ export default TableAction;
@@ -69,26 +69,27 @@
69
69
 
70
70
  <script>
71
71
  export default {
72
+ name: "ThTableAction",
72
73
  props: {
73
74
  actions: {
74
75
  type: Array,
75
76
  default: () => {
76
77
  return [];
77
- },
78
+ }
78
79
  },
79
80
  permission: {
80
81
  type: Object,
81
- required: false,
82
+ required: false
82
83
  },
83
84
  msg: {
84
85
  type: String,
85
- default: "确定删除本条数据吗?",
86
- },
86
+ default: "确定删除本条数据吗?"
87
+ }
87
88
  },
88
89
  data() {
89
90
  return {
90
91
  pop: false,
91
- loadingDel: false,
92
+ loadingDel: false
92
93
  };
93
94
  },
94
95
  methods: {
@@ -109,13 +110,13 @@ export default {
109
110
  },
110
111
  doDelete(item) {
111
112
  this.loadingDel = true;
112
- const callback = (bool) => {
113
+ const callback = bool => {
113
114
  this.loadingDel = false;
114
115
  this.pop = !bool;
115
116
  };
116
117
  this.$emit("on-delete", item, callback);
117
- },
118
- },
118
+ }
119
+ }
119
120
  };
120
121
  </script>
121
122
 
@@ -1,8 +1,24 @@
1
1
  import Table from "./index.vue";
2
-
3
2
  /* istanbul ignore next */
4
3
  Table.install = function(Vue) {
5
4
  Vue.component(Table.name, Table);
6
5
  };
7
6
 
8
- export default Table;
7
+ import TableAction from "./action.vue";
8
+ /* istanbul ignore next */
9
+ TableAction.install = function(Vue) {
10
+ Vue.component(TableAction.name, TableAction);
11
+ };
12
+
13
+ import TableTools from "./tools.vue";
14
+ /* istanbul ignore next */
15
+ TableTools.install = function(Vue) {
16
+ Vue.component(TableTools.name, TableTools);
17
+ };
18
+
19
+ import TableSearch from "./search.vue";
20
+ /* istanbul ignore next */
21
+ TableSearch.install = function(Vue) {
22
+ Vue.component(TableSearch.name, TableSearch);
23
+ };
24
+ export default { Table, TableAction, TableTools, TableSearch };
@@ -6,6 +6,7 @@
6
6
  :data="data"
7
7
  :row-key="rowKey"
8
8
  :stripe="stripe"
9
+ :border="border"
9
10
  :highlight-current-row="selectType === 'single'"
10
11
  :tree-props="treeProps"
11
12
  @current-change="handleSingleSelect"
@@ -178,6 +179,12 @@ export default {
178
179
  default: () => {
179
180
  return "加载中";
180
181
  }
182
+ },
183
+ border: {
184
+ type: Boolean,
185
+ default: () => {
186
+ return false;
187
+ }
181
188
  }
182
189
  },
183
190
  data() {
@@ -49,19 +49,20 @@
49
49
 
50
50
  <script>
51
51
  export default {
52
+ name: "ThTableSearch",
52
53
  props: {
53
54
  options: {
54
55
  type: Array,
55
56
  default: () => {
56
57
  return [];
57
- },
58
+ }
58
59
  },
59
60
  params: {
60
61
  type: Object,
61
62
  default: () => {
62
63
  return {};
63
- },
64
- },
64
+ }
65
+ }
65
66
  },
66
67
  data() {
67
68
  return {
@@ -74,8 +75,8 @@ export default {
74
75
  "datetime",
75
76
  "datetimerange",
76
77
  "daterange",
77
- "monthrange",
78
- ],
78
+ "monthrange"
79
+ ]
79
80
  };
80
81
  },
81
82
  methods: {
@@ -85,8 +86,8 @@ export default {
85
86
  doReset() {
86
87
  this.params = {};
87
88
  this.$emit("on-reset", this.params);
88
- },
89
- },
89
+ }
90
+ }
90
91
  };
91
92
  </script>
92
93
 
@@ -48,23 +48,24 @@
48
48
 
49
49
  <script>
50
50
  export default {
51
+ name: "ThTableTools",
51
52
  props: {
52
53
  options: {
53
54
  type: Array,
54
55
  default: () => {
55
56
  return [];
56
- },
57
+ }
57
58
  },
58
59
  selectionDisabled: {
59
60
  type: Boolean,
60
61
  default: () => {
61
62
  return true;
62
- },
63
- },
63
+ }
64
+ }
64
65
  },
65
66
  data() {
66
67
  return {
67
- loadingDel: false,
68
+ loadingDel: false
68
69
  };
69
70
  },
70
71
  methods: {
@@ -82,12 +83,12 @@ export default {
82
83
  },
83
84
  doBatch(item) {
84
85
  this.loadingDel = true;
85
- const callback = (bool) => {
86
+ const callback = bool => {
86
87
  this.loadingDel = false;
87
88
  };
88
89
  this.$emit("on-batch", item, callback);
89
- },
90
- },
90
+ }
91
+ }
91
92
  };
92
93
  </script>
93
94