shijiplus-web-plugin 0.1.52 → 0.1.53

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,10 +1,10 @@
1
1
  {
2
2
  "name": "shijiplus-web-plugin",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "files": [
5
5
  "src"
6
6
  ],
7
- "description": "A company project",
7
+ "description": "A company project update table component fixedheader",
8
8
  "author": "jia",
9
9
  "license": "ISC",
10
10
  "private": false,
@@ -179,59 +179,7 @@ export default {
179
179
  watch: {
180
180
  fixedHeader: {
181
181
  handler(val) {
182
- this.$nextTick(() => {
183
- let tHeight = this.$refs.plusTableInnerRef.clientHeight
184
- let tableWidth = this.$refs.plusTableInnerRef.clientWidth
185
-
186
- // 获取元素的所有计算样式
187
- var styles = window.getComputedStyle(this.$refs.plusTableInnerRef)
188
-
189
- var styleHeight = parseFloat(styles.getPropertyValue('height'))
190
- // 如果您只想获取特定方向的padding值,例如padding-top
191
- var paddingLeft = parseFloat(styles.getPropertyValue('padding-left'))
192
- var paddingRight = parseFloat(
193
- styles.getPropertyValue('padding-right')
194
- )
195
- var paddingTop = parseFloat(styles.getPropertyValue('padding-top'))
196
- var paddingBottom = parseFloat(
197
- styles.getPropertyValue('padding-bottom')
198
- )
199
- if (paddingLeft) {
200
- tableWidth -= paddingLeft
201
- }
202
- if (paddingRight) {
203
- tableWidth -= paddingRight
204
- }
205
- if (paddingTop) {
206
- tHeight -= paddingTop
207
- }
208
- if (paddingBottom) {
209
- tHeight -= paddingBottom
210
- }
211
- this.tableWidth = tableWidth
212
- if (this.$refs.searchAreaRef) {
213
- tHeight -= this.$refs.searchAreaRef.clientHeight
214
- }
215
- if (this.$refs.headerRef) {
216
- tHeight -= this.$refs.headerRef.clientHeight
217
- }
218
- if (this.$refs.footerRef) {
219
- tHeight -= this.$refs.footerRef.clientHeight
220
- }
221
- if (val) {
222
- this.height = tHeight
223
- } else {
224
- let tableWrap =
225
- this.$refs.plusTableInnerRef.getElementsByClassName(
226
- 'ivu-table-wrapper'
227
- )[0]
228
- if (tableWrap) {
229
- if (!this.data.data || !this.data.data.length) {
230
- tableWrap.style.minHeight = tHeight + 'px'
231
- }
232
- }
233
- }
234
- })
182
+ this.calcTableHeight(0)
235
183
  },
236
184
  deep: true,
237
185
  immediate: true
@@ -377,6 +325,65 @@ export default {
377
325
  }
378
326
  },
379
327
  methods: {
328
+ calcTableHeight(count) {
329
+ this.$nextTick(() => {
330
+ let tHeight = this.$refs.plusTableInnerRef.clientHeight
331
+ if (!tHeight && count < 3) {
332
+ setTimeout(() => {
333
+ this.calcTableHeight(count + 1)
334
+ }, 100)
335
+ return
336
+ }
337
+ let tableWidth = this.$refs.plusTableInnerRef.clientWidth
338
+
339
+ // 获取元素的所有计算样式
340
+ var styles = window.getComputedStyle(this.$refs.plusTableInnerRef)
341
+
342
+ var styleHeight = parseFloat(styles.getPropertyValue('height'))
343
+ // 如果您只想获取特定方向的padding值,例如padding-top
344
+ var paddingLeft = parseFloat(styles.getPropertyValue('padding-left'))
345
+ var paddingRight = parseFloat(styles.getPropertyValue('padding-right'))
346
+ var paddingTop = parseFloat(styles.getPropertyValue('padding-top'))
347
+ var paddingBottom = parseFloat(
348
+ styles.getPropertyValue('padding-bottom')
349
+ )
350
+ if (paddingLeft) {
351
+ tableWidth -= paddingLeft
352
+ }
353
+ if (paddingRight) {
354
+ tableWidth -= paddingRight
355
+ }
356
+ if (paddingTop) {
357
+ tHeight -= paddingTop
358
+ }
359
+ if (paddingBottom) {
360
+ tHeight -= paddingBottom
361
+ }
362
+ this.tableWidth = tableWidth
363
+ if (this.$refs.searchAreaRef) {
364
+ tHeight -= this.$refs.searchAreaRef.clientHeight
365
+ }
366
+ if (this.$refs.headerRef) {
367
+ tHeight -= this.$refs.headerRef.clientHeight
368
+ }
369
+ if (this.$refs.footerRef) {
370
+ tHeight -= this.$refs.footerRef.clientHeight
371
+ }
372
+ if (this.fixedHeader) {
373
+ this.height = tHeight
374
+ } else {
375
+ let tableWrap =
376
+ this.$refs.plusTableInnerRef.getElementsByClassName(
377
+ 'ivu-table-wrapper'
378
+ )[0]
379
+ if (tableWrap) {
380
+ if (!this.data.data || !this.data.data.length) {
381
+ tableWrap.style.minHeight = tHeight + 'px'
382
+ }
383
+ }
384
+ }
385
+ })
386
+ },
380
387
  slotValue(col, row) {
381
388
  return (col.computeValue && col.computeValue(row)) || row[col.key]
382
389
  },
@@ -187,56 +187,7 @@ export default {
187
187
  watch: {
188
188
  fixedHeader: {
189
189
  handler(val) {
190
- this.$nextTick(() => {
191
- let tHeight = this.$refs.plusTableInnerRef.clientHeight
192
- let tableWidth = this.$refs.plusTableInnerRef.clientWidth
193
-
194
- // 获取元素的所有计算样式
195
- var styles = window.getComputedStyle(this.$refs.plusTableInnerRef)
196
-
197
- var styleHeight = parseFloat(styles.getPropertyValue('height'))
198
- // 如果您只想获取特定方向的padding值,例如padding-top
199
- var paddingLeft = parseFloat(styles.getPropertyValue('padding-left'))
200
- var paddingRight = parseFloat(
201
- styles.getPropertyValue('padding-right')
202
- )
203
- var paddingTop = parseFloat(styles.getPropertyValue('padding-top'))
204
- var paddingBottom = parseFloat(
205
- styles.getPropertyValue('padding-bottom')
206
- )
207
- if (paddingLeft) {
208
- tableWidth -= paddingLeft
209
- }
210
- if (paddingRight) {
211
- tableWidth -= paddingRight
212
- }
213
- if (paddingTop) {
214
- tHeight -= paddingTop
215
- }
216
- if (paddingBottom) {
217
- tHeight -= paddingBottom
218
- }
219
- this.tableWidth = tableWidth
220
- if (this.$refs.searchAreaRef) {
221
- tHeight -= this.$refs.searchAreaRef.clientHeight
222
- }
223
- if (this.$refs.footerRef) {
224
- tHeight -= this.$refs.footerRef.clientHeight
225
- }
226
- if (val) {
227
- this.height = tHeight
228
- } else {
229
- let tableWrap =
230
- this.$refs.plusTableInnerRef.getElementsByClassName(
231
- 'ivu-table-wrapper'
232
- )[0]
233
- if (tableWrap) {
234
- if (!this.data.data || !this.data.data.length) {
235
- tableWrap.style.minHeight = tHeight + 'px'
236
- }
237
- }
238
- }
239
- })
190
+ this.calcTableHeight(0)
240
191
  },
241
192
  deep: true,
242
193
  immediate: true
@@ -382,6 +333,65 @@ export default {
382
333
  }
383
334
  },
384
335
  methods: {
336
+ calcTableHeight(count) {
337
+ this.$nextTick(() => {
338
+ let tHeight = this.$refs.plusTableInnerRef.clientHeight
339
+ if (!tHeight && count < 3) {
340
+ setTimeout(() => {
341
+ this.calcTableHeight(count + 1)
342
+ }, 100)
343
+ return
344
+ }
345
+ let tableWidth = this.$refs.plusTableInnerRef.clientWidth
346
+
347
+ // 获取元素的所有计算样式
348
+ var styles = window.getComputedStyle(this.$refs.plusTableInnerRef)
349
+
350
+ var styleHeight = parseFloat(styles.getPropertyValue('height'))
351
+ // 如果您只想获取特定方向的padding值,例如padding-top
352
+ var paddingLeft = parseFloat(styles.getPropertyValue('padding-left'))
353
+ var paddingRight = parseFloat(styles.getPropertyValue('padding-right'))
354
+ var paddingTop = parseFloat(styles.getPropertyValue('padding-top'))
355
+ var paddingBottom = parseFloat(
356
+ styles.getPropertyValue('padding-bottom')
357
+ )
358
+ if (paddingLeft) {
359
+ tableWidth -= paddingLeft
360
+ }
361
+ if (paddingRight) {
362
+ tableWidth -= paddingRight
363
+ }
364
+ if (paddingTop) {
365
+ tHeight -= paddingTop
366
+ }
367
+ if (paddingBottom) {
368
+ tHeight -= paddingBottom
369
+ }
370
+ this.tableWidth = tableWidth
371
+ if (this.$refs.searchAreaRef) {
372
+ tHeight -= this.$refs.searchAreaRef.clientHeight
373
+ }
374
+ if (this.$refs.headerRef) {
375
+ tHeight -= this.$refs.headerRef.clientHeight
376
+ }
377
+ if (this.$refs.footerRef) {
378
+ tHeight -= this.$refs.footerRef.clientHeight
379
+ }
380
+ if (this.fixedHeader) {
381
+ this.height = tHeight
382
+ } else {
383
+ let tableWrap =
384
+ this.$refs.plusTableInnerRef.getElementsByClassName(
385
+ 'ivu-table-wrapper'
386
+ )[0]
387
+ if (tableWrap) {
388
+ if (!this.data.data || !this.data.data.length) {
389
+ tableWrap.style.minHeight = tHeight + 'px'
390
+ }
391
+ }
392
+ }
393
+ })
394
+ },
385
395
  slotValue(col, row) {
386
396
  return (col.computeValue && col.computeValue(row)) || row[col.key]
387
397
  },