@xilonglab/vue-main 0.8.18 → 0.9.3

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": "@xilonglab/vue-main",
3
- "version": "0.8.18",
3
+ "version": "0.9.3",
4
4
  "description": "xilong vue main",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
package/packages/index.js CHANGED
@@ -41,6 +41,7 @@ import XlReviewDialog from './dialog/XlReviewDialog.vue'
41
41
 
42
42
  // Main Components
43
43
  import XlDataView from './main/XlDataView.vue'
44
+ import XlDataTable from './main/XlDataTable.vue'
44
45
  import XlDataReview from './main/XlDataReview.vue'
45
46
  import XlDataFormDialog from './main/XlDataFormDialog.vue'
46
47
  import XlDataReviewDialog from './main/XlDataReviewDialog.vue'
@@ -93,6 +94,7 @@ const components = [
93
94
  XlReviewDialog,
94
95
  // Main Components
95
96
  XlDataView,
97
+ XlDataTable,
96
98
  XlDataReview,
97
99
  XlDataFormDialog,
98
100
  XlDataReviewDialog,
@@ -0,0 +1,138 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlDataTable" })
3
+
4
+ import { inject, computed } from 'vue'
5
+
6
+ const props = defineProps({
7
+ selectable: {
8
+ type: Boolean,
9
+ default: false,
10
+ },
11
+ columns: {
12
+ type: Array,
13
+ default: () => [],
14
+ },
15
+ showSummary: {
16
+ type: Boolean,
17
+ default: true,
18
+ },
19
+ rowClick: {
20
+ type: Function,
21
+ default: () => { },
22
+ },
23
+ summaryMethod: {
24
+ type: Function,
25
+ },
26
+ showIndex: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ disableAdd: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ pagination: {
35
+ type: Object,
36
+ default() {
37
+ return {
38
+ pageNum: 1,
39
+ pageSize: 20,
40
+ total: 0,
41
+ };
42
+ },
43
+ },
44
+ spanMethod: {
45
+ type: Function,
46
+ default: () => { },
47
+ },
48
+ headerCellStyle: {
49
+ type: Function,
50
+ default: () => { },
51
+ },
52
+ rowClassName: {
53
+ type: Function,
54
+ default: () => { },
55
+ },
56
+ rowKey: {
57
+ type: Function,
58
+ default: () => { },
59
+ },
60
+ rowDblClick: {
61
+ type: Function,
62
+ default: () => { },
63
+ },
64
+ selectionChange: {
65
+ type: Function,
66
+ default: () => { },
67
+ },
68
+ layout: {
69
+ type: String,
70
+ default: 'prev, pager, next, jumper'
71
+ }
72
+ });
73
+
74
+ const { refs, api, params, obj, total } = inject('injections')
75
+ </script>
76
+
77
+
78
+ <template>
79
+ <xl-query-page-table v-show="params.view != 'chart'" :ref="refs.table" :api="api" :params="params"
80
+ v-bind="$props" :summary-method="summaryMethod?summaryMethod:()=>({0:total})" :sort-change="(data) => api.sort(data)">
81
+ <template v-for="col in columns" :key="col.prop">
82
+ <template v-if="!col.hidden">
83
+ <xl-datetime-col
84
+ v-if="col.type === 'datetime'"
85
+ :l="col.label"
86
+ :p="col.prop"
87
+ />
88
+ <xl-map-col
89
+ v-else-if="col.type === 'map'"
90
+ :l="col.label"
91
+ :p="col.prop"
92
+ :width="col.width"
93
+ :map="col.map"
94
+ />
95
+ <xl-status-col
96
+ v-else-if="col.type === 'status'"
97
+ :l="col.label"
98
+ :p="col.prop"
99
+ :map="col.map"
100
+ />
101
+ <xl-review-col
102
+ v-else-if="col.type === 'review'"
103
+ :l="col.label"
104
+ :p="col.prop"
105
+ />
106
+ <xl-clamp-col
107
+ v-else-if="col.type === 'clamp'"
108
+ :l="col.label"
109
+ :p="col.prop"
110
+ :width="col.width"
111
+ />
112
+ <xl-bool-col
113
+ v-else-if="col.type === 'bool'"
114
+ :l="col.label"
115
+ :p="col.prop"
116
+ :width="col.width"
117
+ />
118
+ <xl-col
119
+ v-else
120
+ :l="col.label"
121
+ :p="col.prop"
122
+ :width="col.width"
123
+ />
124
+ </template>
125
+ </template>
126
+ <slot name="columns" />
127
+ </xl-query-page-table>
128
+ </template>
129
+
130
+
131
+ <style lang="less">
132
+ .xl-data-table {
133
+ div.cell {
134
+ padding: 0 !important;
135
+
136
+ }
137
+ }
138
+ </style>
@@ -178,22 +178,6 @@ const { refs, api, params, obj, chartOptions, total } = inject('injections')
178
178
  :columns="columns"
179
179
  :callback="callback"
180
180
  >
181
- <el-row>
182
- <template v-for="col in columns" :key="col.prop">
183
- <xl-form-col
184
- v-if="col.form"
185
- :span="col.form.span"
186
- :l="col.label"
187
- :p="col.prop"
188
- >
189
- <component
190
- :is="`xl-${col.form.type || 'input'}`"
191
- v-model="obj[col.prop]"
192
- v-bind="col.form || {}"
193
- />
194
- </xl-form-col>
195
- </template>
196
- </el-row>
197
181
  <slot name="items" />
198
182
  </xl-data-form-dialog>
199
183
  <slot name="others" />