tianheng-ui 0.0.53 → 0.0.56

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.53",
4
+ "version": "0.0.56",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -2,7 +2,7 @@
2
2
  <div class="th-table-action" @click.stop>
3
3
  <template v-for="(item, index) in actions">
4
4
  <el-popover
5
- v-if="item.act === 'delete'"
5
+ v-if="item.act === 'delete' && !btnHide(item)"
6
6
  :key="index"
7
7
  v-model="pop"
8
8
  placement="top"
@@ -32,7 +32,7 @@
32
32
  >
33
33
  </el-popover>
34
34
  <el-dropdown
35
- v-else-if="item.act === 'more'"
35
+ v-else-if="item.act === 'more' && !btnHide(item)"
36
36
  :key="index"
37
37
  :trigger="item.trigger || 'click'"
38
38
  :placement="item.placement || 'bottom-end'"
@@ -63,7 +63,7 @@
63
63
  </el-dropdown-menu>
64
64
  </el-dropdown>
65
65
  <el-button
66
- v-else
66
+ v-else-if="!btnHide(item)"
67
67
  :key="index"
68
68
  :style="item.style"
69
69
  :type="item.type"
@@ -107,13 +107,23 @@ export default {
107
107
  computed: {
108
108
  btnDisabled() {
109
109
  return item => {
110
- if (item.disabled instanceof Boolean) {
110
+ if (typeof item.disabled == "boolean") {
111
111
  return item.disabled;
112
112
  }
113
- if (item.disabled instanceof Function) {
113
+ if (typeof item.disabled == "function") {
114
114
  return item.disabled(this.scope);
115
115
  }
116
116
  };
117
+ },
118
+ btnHide() {
119
+ return item => {
120
+ if (typeof item.hide == "boolean") {
121
+ return item.hide;
122
+ }
123
+ if (typeof item.hide == "function") {
124
+ return item.hide(this.scope);
125
+ }
126
+ };
117
127
  }
118
128
  },
119
129
  methods: {
@@ -58,7 +58,7 @@
58
58
  :scope="scope"
59
59
  :option="item"
60
60
  />
61
- <span v-else-if="item.format">
61
+ <span v-else-if="item.formatTime">
62
62
  {{
63
63
  handleFormatTime(
64
64
  scope.row[item.alias || item.prop],
@@ -66,6 +66,9 @@
66
66
  )
67
67
  }}
68
68
  </span>
69
+ <span v-else-if="item.format">
70
+ {{ item.format(scope.row) }}
71
+ </span>
69
72
  <span v-else-if="item.alias">{{ scope.row[item.alias] }}</span>
70
73
  <span v-else>{{ scope.row[item.prop] }}</span>
71
74
  </template>
@@ -126,7 +129,7 @@ export default {
126
129
  selectType: {
127
130
  type: String,
128
131
  default: () => {
129
- return "";
132
+ return "single";
130
133
  }
131
134
  },
132
135
  // 行双击事件
@@ -18,7 +18,7 @@
18
18
  v-if="item.type === 'date'"
19
19
  v-model="params[item.options.prop]"
20
20
  :style="{ width: item.options.width + 'px' }"
21
- :type="item.options.dateType || 'date'"
21
+ :type="item.options.type || 'date'"
22
22
  :format="item.options.format"
23
23
  :value-format="item.options.valueFormat"
24
24
  range-separator="至"
@@ -81,16 +81,11 @@ export default {
81
81
  default: () => {
82
82
  return [];
83
83
  }
84
- },
85
- params: {
86
- type: Object,
87
- default: () => {
88
- return {};
89
- }
90
84
  }
91
85
  },
92
86
  data() {
93
87
  return {
88
+ params: {},
94
89
  datePickerTypes: [
95
90
  "year",
96
91
  "month",
@@ -104,6 +99,23 @@ export default {
104
99
  ]
105
100
  };
106
101
  },
102
+ watch: {
103
+ options: {
104
+ handler(newVal, oldVal) {
105
+ if (newVal && newVal.length) {
106
+ newVal.map(item => {
107
+ this.$set(
108
+ this.params,
109
+ item.options.prop,
110
+ item.options.defaultValue
111
+ );
112
+ });
113
+ }
114
+ },
115
+ deep: true,
116
+ immediate: true
117
+ }
118
+ },
107
119
  methods: {
108
120
  doSearch() {
109
121
  this.$emit("on-search", this.params);