sadais-piui 1.2.7-beta63 → 1.2.7-beta65

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.
@@ -14,7 +14,7 @@
14
14
  'animation-duration': getDuration.css
15
15
  }
16
16
  ]"
17
- @touchmove.stop.prevent="() => {}"
17
+
18
18
  @tap.stop.prevent="handleCloseMask"
19
19
  >
20
20
  <view
@@ -7,7 +7,13 @@
7
7
  :key="idx"
8
8
  class="head"
9
9
  :class="{ fixed: !!col.fixed }"
10
- :style="[col.style, cellStyle, leftMap[idx], rightMap[idx]]"
10
+ :style="[
11
+ col.style,
12
+ cellPaddingStyle,
13
+ headStyle,
14
+ leftMap[idx],
15
+ rightMap[idx],
16
+ ]"
11
17
  >
12
18
  {{ col.name }}
13
19
  </view>
@@ -25,7 +31,7 @@
25
31
  :key="colIdx"
26
32
  class="cell"
27
33
  :class="{ fixed: !!col.fixed }"
28
- :style="[leftMap[colIdx], rightMap[colIdx]]"
34
+ :style="[cellStyle, leftMap[colIdx], rightMap[colIdx]]"
29
35
  >
30
36
  <view
31
37
  class="cell-content-wrap-ph"
@@ -50,16 +56,49 @@
50
56
  :src="row[col.prop]"
51
57
  :style="[col.slot.style]"
52
58
  />
53
- <view v-else-if="col.slot && col.slot.type === 'link'" class="pi-align-center">
54
- <text v-for="(link, linkIdx) in col.slot.links" :key="linkIdx" class="link" :style="[link.style]">{{ link.name }}</text>
59
+ <view
60
+ v-else-if="col.slot && col.slot.type === 'link'"
61
+ class="pi-align-center"
62
+ >
63
+ <text
64
+ v-for="(link, linkIdx) in col.slot.links"
65
+ :key="linkIdx"
66
+ class="link"
67
+ :style="[link.style]"
68
+ >{{ link.name }}</text
69
+ >
55
70
  </view>
56
71
  <block v-else>{{ row[col.prop] }}</block>
57
72
  </view>
58
73
  <view class="cell-content-wrap" :style="[cellContentWrapStyle]">
59
- <image v-if="col.slot && col.slot.type === 'img'" :src="row[col.prop]" :style="[col.slot.style]" />
60
- <image v-else-if="col.slot && col.slot.type === 'rank' && idx < col.slot.condition" :src="row[col.prop]" :style="[col.slot.style]" />
61
- <view v-else-if="col.slot && col.slot.type === 'link'" class="pi-align-center">
62
- <text v-for="(link, linkIdx) in col.slot.links" :key="linkIdx" class="link" :style="[link.style]" @click="handleClickLink({ row, link, linkIdx, rowIdx: idx })">{{ link.name }}</text>
74
+ <image
75
+ v-if="col.slot && col.slot.type === 'img'"
76
+ :src="row[col.prop]"
77
+ :style="[col.slot.style]"
78
+ />
79
+ <image
80
+ v-else-if="
81
+ col.slot &&
82
+ col.slot.type === 'rank' &&
83
+ idx < col.slot.condition
84
+ "
85
+ :src="row[col.prop]"
86
+ :style="[col.slot.style]"
87
+ />
88
+ <view
89
+ v-else-if="col.slot && col.slot.type === 'link'"
90
+ class="pi-align-center"
91
+ >
92
+ <text
93
+ v-for="(link, linkIdx) in col.slot.links"
94
+ :key="linkIdx"
95
+ class="link"
96
+ :style="[link.style]"
97
+ @click="
98
+ handleClickLink({ row, link, linkIdx, rowIdx: idx })
99
+ "
100
+ >{{ link.name }}</text
101
+ >
63
102
  </view>
64
103
  <block v-else>{{ row[col.prop] }}</block>
65
104
  </view>
@@ -99,6 +138,18 @@ export default {
99
138
  // `true`
100
139
  default: tableConfig.stripe,
101
140
  },
141
+ // 头部样式
142
+ headStyle: {
143
+ type: Object,
144
+ // `{}`
145
+ default: () => tableConfig.headStyle,
146
+ },
147
+ // 单元格样式
148
+ cellStyle: {
149
+ type: Object,
150
+ // `{}`
151
+ default: () => tableConfig.cellStyle,
152
+ },
102
153
  },
103
154
  data() {
104
155
  return {
@@ -108,7 +159,7 @@ export default {
108
159
  };
109
160
  },
110
161
  computed: {
111
- cellStyle() {
162
+ cellPaddingStyle() {
112
163
  return {
113
164
  padding: `${this.cellPadding}rpx`,
114
165
  };
@@ -165,15 +216,15 @@ export default {
165
216
  rightMap[i] = { right: isRight(col) ? `${right}px` : "auto" };
166
217
  right += isRight(col) ? list[i].width : 0;
167
218
  }
168
- this.leftMap = leftMap
169
- this.rightMap = rightMap
170
- })
219
+ this.leftMap = leftMap;
220
+ this.rightMap = rightMap;
221
+ });
171
222
  },
172
223
  handleClickLink(info) {
173
- this.$emit('link', info)
174
- }
175
- }
176
- }
224
+ this.$emit("link", info);
225
+ },
226
+ },
227
+ };
177
228
  </script>
178
229
 
179
230
  <style lang="scss" scoped>
package/config/table.js CHANGED
@@ -2,5 +2,7 @@ export default {
2
2
  columns: [],
3
3
  data: [],
4
4
  emptyText: '暂无数据',
5
- stripe: true
5
+ stripe: true,
6
+ headStyle: {},
7
+ cellStyle: {},
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta63",
3
+ "version": "1.2.7-beta65",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,5 +21,8 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/sadais-org/piui/issues"
23
23
  },
24
- "homepage": "https://github.com/sadais-org/piui#readme"
24
+ "homepage": "https://github.com/sadais-org/piui#readme",
25
+ "publishConfig": {
26
+ "registry": "https://registry.npmjs.org/"
27
+ }
25
28
  }