tianheng-ui 0.0.9 → 0.0.13

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.9",
4
+ "version": "0.0.13",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -46,7 +46,7 @@
46
46
  "homepage": "http://element.eleme.io",
47
47
  "keywords": [
48
48
  "tianheng",
49
- "prompt"
49
+ "tianheng-ui"
50
50
  ],
51
51
  "style": "lib/theme-chalk/index.css"
52
52
  }
@@ -1,19 +1,43 @@
1
1
  <template>
2
2
  <div
3
3
  class="th-cell"
4
- :class="[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
  >
8
13
  <i v-if="icon" class="th-cell-icon" :class="icon"></i>
9
14
  <slot v-else name="icon" />
10
15
  <div class="th-cell-content">
11
- <div v-if="title" class="th-cell-title">{{ title }}</div>
16
+ <div
17
+ v-if="title"
18
+ class="th-cell-title"
19
+ :class="[titleClass, active ? titleActive : '', hover ? titleHover : 'title-color']"
20
+ :style="titleStyle"
21
+ >
22
+ {{ title }}
23
+ </div>
12
24
  <slot v-else name="title" />
13
- <div v-if="label" class="th-cell-label">{{ label }}</div>
25
+ <div
26
+ v-if="label"
27
+ class="th-cell-label"
28
+ :class="[labelClass, active ? labelActive : '', hover ? labelHover : '']"
29
+ >
30
+ {{ label }}
31
+ </div>
14
32
  <slot v-else name="label" />
15
33
  </div>
16
- <div v-if="value" class="th-cell-value">{{ value }}</div>
34
+ <div
35
+ v-if="value"
36
+ class="th-cell-value"
37
+ :class="[valueClass, active ? valueActive : '', hover ? valueHover : '']"
38
+ >
39
+ {{ value }}
40
+ </div>
17
41
  <slot v-else />
18
42
  </div>
19
43
  </template>
@@ -26,8 +50,62 @@ export default {
26
50
  value: Number | String,
27
51
  label: String,
28
52
  icon: String,
53
+
29
54
  customStyle: String | Object,
30
- center: Boolean
55
+ titleStyle: String | Object,
56
+
57
+ customClass: String | Object,
58
+ titleClass: String | Object,
59
+ labelClass: String | Object,
60
+ valueClass: String | Object,
61
+
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
+ }
31
109
  },
32
110
  methods: {
33
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
 
@@ -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