web-component-gallery 2.2.37 → 2.2.40

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.
@@ -40,7 +40,7 @@
40
40
  }
41
41
 
42
42
  #AmapDraw {
43
- width: 100%;
44
- min-height: 304px;
43
+ min-height: 320px;
44
+ .square(100%);
45
45
  }
46
46
  }
@@ -90,7 +90,7 @@ export default {
90
90
  /* 是否自动查询(默认为true) */
91
91
  autoCall: {
92
92
  type: Boolean,
93
- default: true
93
+ default: false
94
94
  }
95
95
  },
96
96
  computed: {
@@ -2,6 +2,7 @@
2
2
  <!-- 表格容器,根据tableStyle动态设置样式类 -->
3
3
  <div :class="[tableStyle, 'WebComponentTable']" ref="Table">
4
4
  <!-- 表格头部插槽 -->
5
+ {{ $slots.ATableHead }}
5
6
  <div v-if="$slots.ATableHead" class="WebComponentTable__Head" ref="TableHead">
6
7
  <slot name="ATableHead" />
7
8
  </div>
@@ -206,12 +207,12 @@ export default {
206
207
  }
207
208
  },
208
209
  mounted() {
210
+ this.pagination = { ...this.pagination, ...this.paginationParams }
211
+ // 监听父级高度
209
212
  this.initResizeObserver()
210
- this.$nextTick(() => {
211
- setTimeout(this.getTableBodyHeight, 100)
212
- })
213
- this.$bus.$onWindow(this, 'resize', this.getTableBodyHeight)
214
- },
213
+ setTimeout(this.getScrollBodyH, 300)
214
+ this.$bus.$onWindow(this, 'resize', this.getScrollBodyH)
215
+ },
215
216
  beforeDestroy() {
216
217
  if (this.resizeObserver) {
217
218
  this.resizeObserver.disconnect()
@@ -219,29 +220,39 @@ export default {
219
220
  }
220
221
  },
221
222
  methods: {
223
+ // 初始化尺寸观察器
222
224
  initResizeObserver() {
223
- if (typeof ResizeObserver !== 'undefined' && this.$refs.Table) {
225
+ if (typeof ResizeObserver !== 'undefined') {
224
226
  this.resizeObserver = new ResizeObserver(() => {
225
- this.getTableBodyHeight()
227
+ this.getScrollBodyH()
226
228
  })
227
229
  this.resizeObserver.observe(this.$refs.Table)
228
230
  }
229
231
  },
230
- getTableBodyHeight() {
231
- if (!this.$refs.Table || !this.$refs.TableHead || !this.$refs.TablePagination) return
232
-
233
- const tableTitleHeight = this.$refs.TableListTitle ? this.$refs.TableListTitle.offsetHeight : 0
234
- const tableHeader = this.$refs.TableList.querySelector('.ant-table-thead')
235
- const headerHeight = tableHeader ? tableHeader.offsetHeight : 0
236
-
237
- this.tableScrollBody =
238
- this.$refs.Table.clientHeight -
239
- this.$refs.TableHead.offsetHeight -
240
- this.$refs.TablePagination.offsetHeight -
241
- 16 - // 基础间距
242
- tableTitleHeight -
243
- headerHeight -
244
- 24 // 浮动空间缓冲
232
+ /** 根据内容高度计算滚动长度 */
233
+ getScrollBodyH() {
234
+ if (!this.$refs.Table) return
235
+
236
+ const { Table, TableHead, TableListTitle, TablePagination } = this.$refs
237
+ const tableHeader = Table.querySelector('.ant-table-thead')
238
+
239
+ // 获取各部分高度
240
+ const clientHeight = Table.clientHeight
241
+ const headerHeight = TableHead?.offsetHeight || 0
242
+ const tableHeaderHeight = tableHeader?.offsetHeight || 0
243
+ const tableTitleHeight = TableListTitle?.offsetHeight || 0
244
+ const paginationHeight = TablePagination?.offsetHeight || 0
245
+
246
+ // 计算滚动区域高度
247
+ const baseSpacing = 16
248
+ const bufferSpace = 24
249
+ this.tableScrollBody = clientHeight -
250
+ headerHeight -
251
+ tableHeaderHeight -
252
+ tableTitleHeight -
253
+ paginationHeight -
254
+ baseSpacing -
255
+ bufferSpace
245
256
  },
246
257
  handleCheckFile(record, props) {
247
258
  this.$postM({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "2.2.37",
3
+ "version": "2.2.40",
4
4
  "description": "基础vue、antdvue、less实现的私有组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [
package/utils/Filter.js CHANGED
@@ -5,40 +5,30 @@
5
5
  * 距离现在n天前的日期
6
6
  */
7
7
 
8
- export function getDay( day ) {
9
- let today = new Date();
10
-
11
- let targetday_milliseconds=today.getTime() + 1000*60*60*24*day;
12
-
13
- today.setTime(targetday_milliseconds); //注意,这行是关键代码
14
-
15
- let tYear = today.getFullYear();
16
-
17
- let tMonth = today.getMonth();
18
-
19
- let tDate = today.getDate();
20
-
21
- tMonth = doHandleMonth(tMonth + 1);
22
-
23
- tDate = doHandleMonth(tDate);
24
-
25
- return tYear+"-"+tMonth+"-"+tDate;
8
+ export function getDay(day) {
9
+ return getNDaysBefore(day, "{y}-{m}-{d}")
26
10
  }
27
11
 
12
+ // 获取n天前的时间
13
+ export function getNDaysBefore(n, baseTime = null, cFormat) {
14
+ const base = baseTime ? new Date(baseTime) : new Date()
15
+ const targetTime = new Date(base.getTime() - n * 24 * 60 * 60 * 1000)
16
+ return formatDate(targetTime, cFormat)
17
+ }
28
18
 
29
- function doHandleMonth(month){
30
-
31
- let m = month;
32
-
33
- if(month.toString().length == 1){
34
-
35
- m = "0" + month;
36
-
37
- }
38
-
39
- return m;
19
+ // 获取n小时前的时间
20
+ export function getNHoursBefore(n, baseTime = null, cFormat) {
21
+ const base = baseTime ? new Date(baseTime) : new Date()
22
+ const targetTime = new Date(base.getTime() - n * 60 * 60 * 1000)
23
+ return formatDate(targetTime, cFormat)
24
+ }
40
25
 
41
- }
26
+ // 获取n分钟前的时间
27
+ export function getNMinutesBefore(n, baseTime = null, cFormat) {
28
+ const base = baseTime ? new Date(baseTime) : new Date()
29
+ const targetTime = new Date(base.getTime() - n * 60 * 1000)
30
+ return formatDate(targetTime, cFormat)
31
+ }
42
32
 
43
33
 
44
34
  /**