xianniu-ui 0.1.10-beta → 0.1.11-beta

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": "xianniu-ui",
3
- "version": "0.1.10-beta",
3
+ "version": "0.1.11-beta",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -113,101 +113,14 @@
113
113
  </el-table-column>
114
114
  <el-table-column
115
115
  width="50px"
116
- label="序号"
116
+ label="No."
117
117
  v-if="index && data.length"
118
118
  type="index"
119
119
  ></el-table-column>
120
120
 
121
- <slot name="column">
122
- <template v-for="(item, idx) in columns">
123
- <el-table-column
124
- v-bind="item"
125
- v-on="$listeners"
126
- :key="idx"
127
- v-if="isShowColumn(item)"
128
- >
129
- <template v-if="item.labelMsg">
130
- <template slot="header">
131
- <el-tooltip
132
- class="item"
133
- effect="dark"
134
- :content="item.labelMsg"
135
- placement="right"
136
- >
137
- <span>{{ item.label }} <i class="el-icon-question"></i></span>
138
- </el-tooltip>
139
- </template>
140
- </template>
141
- <template slot-scope="{ row, $index }">
142
- <expandDom
143
- v-if="item.render"
144
- :column="row"
145
- :row="row"
146
- :render="item.render"
147
- :index="$index"
148
- ></expandDom>
149
- <template v-else>
150
- {{ row[item.prop] }}
151
- </template>
152
- <!-- 更多操作 -->
153
- <template v-if="item.more && item.more.options.length">
154
- <template v-for="(itemBtn, idxBtn) in item.more.options">
155
- <expand-dom
156
- v-if="itemBtn.render && itemBtn.show && itemBtn.show(row)"
157
- :key="idxBtn"
158
- :column="itemBtn"
159
- :row="row"
160
- :render="itemBtn.render"
161
- :index="idxBtn"
162
- />
163
- <template v-else>
164
- <el-popconfirm
165
- v-if="itemBtn.isPopConfirm"
166
- :title="
167
- itemBtn.options.title ||
168
- `确定${label(itemBtn, row)}吗?`
169
- "
170
- :key="idxBtn"
171
- :confirm-button-text="itemBtn.options.confirmButtonText"
172
- class="ml-10"
173
- @confirm="handleClick(itemBtn.method, row, $index)"
174
- >
175
- <el-button
176
- :type="itemBtn.type || 'text'"
177
- :size="itemBtn.size || 'mini'"
178
- :icon="itemBtn.icon"
179
- :plain="itemBtn.plain"
180
- slot="reference"
181
- >{{ label(itemBtn, row) }}</el-button
182
- >
183
- </el-popconfirm>
184
- <template v-else>
185
- <el-button
186
- v-if="itemBtn.show ? itemBtn.show(row) : true"
187
- :key="idxBtn"
188
- :disabled="
189
- itemBtn.disabled ? itemBtn.disabled(row) : false
190
- "
191
- :type="itemBtn.type || 'text'"
192
- :size="itemBtn.size || 'mini'"
193
- :icon="itemBtn.icon"
194
- :plain="itemBtn.plain"
195
- @click="handleClick(itemBtn.method, row, $index)"
196
- >{{ label(itemBtn, row) }}</el-button
197
- >
198
- </template>
199
- </template>
200
- </template>
201
- </template>
202
- </template>
203
- </el-table-column>
204
- <!-- <column
205
- :key="idx"
206
- v-if="item.checked === true"
207
- v-bind="item"
208
- ></column> -->
209
- </template>
210
- </slot>
121
+ <template v-for="(item, idx) in columns">
122
+ <column :key="idx" v-if="item.checked === true" v-bind="item"></column>
123
+ </template>
211
124
  </el-table>
212
125
 
213
126
  <template v-if="!$utils.isEmpty(page)">
@@ -223,30 +136,10 @@
223
136
  </template>
224
137
 
225
138
  <script>
139
+ import column from "./column.vue";
226
140
  export default {
227
141
  name: "XnTable",
228
- components: {
229
- expandDom: {
230
- functional: true,
231
- props: {
232
- row: Object,
233
- render: Function,
234
- index: Number,
235
- column: {
236
- type: Object,
237
- default: null,
238
- },
239
- },
240
- render: (h, ctx) => {
241
- const params = {
242
- row: ctx.props.row,
243
- index: ctx.props.index,
244
- };
245
- if (ctx.props.column) params.column = ctx.props.column;
246
- return ctx.props.render(h, params);
247
- },
248
- },
249
- },
142
+ components: { column },
250
143
  props: {
251
144
  tools: {
252
145
  type: Array,
@@ -288,23 +181,7 @@ export default {
288
181
  selectedData: [],
289
182
  };
290
183
  },
291
- computed: {
292
- label() {
293
- return (itemBtn, row) => {
294
- return typeof itemBtn.label === "function"
295
- ? itemBtn.label(row)
296
- : itemBtn.label;
297
- };
298
- },
299
- isShowColumn() {
300
- return (row) => {
301
- if (row.show != undefined) {
302
- return typeof row.show === "function" ? row.show() : row.show;
303
- }
304
- return true;
305
- };
306
- },
307
- },
184
+ computed: {},
308
185
  created() {
309
186
  this.columns.length &&
310
187
  this.columns.forEach((item) => {
@@ -342,15 +219,6 @@ export default {
342
219
  doLayout() {
343
220
  this.$refs.table.doLayout();
344
221
  },
345
- handleClick(method, row, index) {
346
- if (this.$parent) {
347
- this.$parent.$emit("handle-buttons", {
348
- method,
349
- row,
350
- index,
351
- });
352
- }
353
- },
354
222
  },
355
223
  };
356
224
  </script>