dfish-widget 1.0.114 → 1.0.116

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/lib/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import lodash from 'lodash';
2
2
  import jquery from 'jquery';
3
3
  import http from 'axios';
4
4
  import Qs from 'qs';
5
- import { nextTick, h, mergeProps, toRaw, resolveComponent, openBlock, createElementBlock, createStaticVNode, createElementVNode, createBlock, withCtx, Fragment, createVNode, renderList, toDisplayString, createTextVNode, createCommentVNode, inject, provide, renderSlot, Teleport, computed, resolveDirective, withDirectives, unref, ref, onMounted, watch, normalizeStyle, normalizeClass, TransitionGroup, getCurrentInstance, createSlots, resolveDynamicComponent, withModifiers } from 'vue';
5
+ import { nextTick, h, mergeProps, toRaw, resolveComponent, openBlock, createElementBlock, createStaticVNode, createElementVNode, createBlock, withCtx, Fragment, createVNode, renderList, toDisplayString, createTextVNode, createCommentVNode, inject, provide, renderSlot, Teleport, computed, resolveDirective, withDirectives, unref, markRaw, ref, onMounted, watch, normalizeStyle, normalizeClass, TransitionGroup, getCurrentInstance, createSlots, resolveDynamicComponent, withModifiers } from 'vue';
6
6
  import ResizeObserver$1 from 'resize-observer-polyfill';
7
7
 
8
8
  let u = navigator.userAgent.toLowerCase();
@@ -5008,40 +5008,47 @@ var script$_ = {
5008
5008
  },
5009
5009
  data() {
5010
5010
  return {
5011
- sticky: {left: null, right: null, observers: []},
5012
- }
5013
- },
5014
- mounted() {
5015
- this.$watch('hasSticky', (v) => {
5016
- this.$nextTick(() => this.observeSticky());
5017
- }, {immediate: true});
5018
- this.$el.setAttribute('w-scroll-x', 'left');
5019
- if ($$1.br.chrome && $$1.br.chrome <= 60) { //低版本谷歌表格宽度有变化时,sticky的td内容会不可见。因此执行一个强制重新渲染的步骤
5020
- new ResizeObserver$1(() => {
5021
- this.$el.setAttribute('w-compact-resize-sticky', '');
5022
- requestAnimationFrame(() => this.$el.removeAttribute('w-compact-resize-sticky'));
5023
- }).observe(this.$el);
5011
+ sticky: markRaw({left: null, right: null, observers: []}),
5024
5012
  }
5025
5013
  },
5026
5014
  methods: {
5027
5015
  observeSticky() {
5028
- const observe = (e) => this.initFixedCells('left').concat(this.initFixedCells('right'));
5029
5016
  for (let ob of this.sticky.observers) {
5030
5017
  ob.disconnect();
5031
5018
  }
5032
5019
  let observers = [];
5033
- $$1.lodash.each(observe(), cell => {
5034
- let ob = new ResizeObserver$1(observe);
5020
+ $$1.lodash.each(this.initFixedCells(), cell => {
5021
+ let ob = new ResizeObserver$1(this.setFixedStyle);
5035
5022
  ob.observe(cell);
5036
5023
  observers.push(ob);
5037
5024
  });
5038
5025
  this.sticky.observers = observers;
5039
5026
  },
5040
- initFixedCells(dir) {
5027
+ setFixedStyle() {
5028
+ this.initFixedCells();
5029
+ let r = {};
5030
+ if (this.sticky.left) {
5031
+ this.sticky.left.forEach(v => r[`--w-td-fixed-left-${v.colIndex}`] = `${v.offset}px`);
5032
+ }
5033
+ if (this.sticky.right) {
5034
+ this.sticky.right.forEach(v => r[`--w-td-fixed-right-${v.colIndex}`] = `${v.offset}px`);
5035
+ }
5036
+ if (this.$el) {
5037
+ for (let k in r) {
5038
+ this.$el.style.setProperty(k, r[k]);
5039
+ }
5040
+ }
5041
+ },
5042
+ initFixedCells() {
5043
+ return this.getFixedCells('left').concat(this.getFixedCells('right'))
5044
+ },
5045
+ getFixedCells(dir) {
5041
5046
  let sticky = null;
5042
5047
  let offset = 0;
5043
5048
  let fixedCells = $$1.lodash.map(this.$el.querySelector(`thead`).querySelectorAll(`td[w-fixed="${dir}"]`));
5044
- if (dir === 'right') fixedCells.reverse();
5049
+ if (dir === 'right') {
5050
+ fixedCells.reverse();
5051
+ }
5045
5052
  fixedCells.forEach(td => {
5046
5053
  (sticky || (sticky = [])).push({colIndex: td.cellIndex, offset});
5047
5054
  offset += td.offsetWidth;
@@ -5072,7 +5079,7 @@ var script$_ = {
5072
5079
  colgroup() {
5073
5080
  return $$1.slotsChildren(this.slotHooks.columns.children).map(v => v.props)
5074
5081
  },
5075
- hasSticky() {
5082
+ stickyState() {
5076
5083
  let s = '';
5077
5084
  for (let col of this.colgroup) {
5078
5085
  if (col.fixed) s += col.fixed;
@@ -5082,15 +5089,27 @@ var script$_ = {
5082
5089
  html_class() {
5083
5090
  return ['f-flex-column', this.x.face && 'z-face-' + this.x.face]
5084
5091
  },
5085
- html_style() {
5086
- let r = {};
5087
- if (this.sticky.left) {
5088
- this.sticky.left.forEach(v => r[`--w-td-fixed-left-${v.colIndex}`] = `${v.offset}px`);
5089
- }
5090
- if (this.sticky.right) {
5091
- this.sticky.right.forEach(v => r[`--w-td-fixed-right-${v.colIndex}`] = `${v.offset}px`);
5092
- }
5093
- return r
5092
+ // html_style() {
5093
+ // let r = {}
5094
+ // if (this.sticky.left) {
5095
+ // this.sticky.left.forEach(v => r[`--w-td-fixed-left-${v.colIndex}`] = `${v.offset}px`)
5096
+ // }
5097
+ // if (this.sticky.right) {
5098
+ // this.sticky.right.forEach(v => r[`--w-td-fixed-right-${v.colIndex}`] = `${v.offset}px`)
5099
+ // }
5100
+ // return r
5101
+ // }
5102
+ },
5103
+ mounted() {
5104
+ this.$watch('stickyState', (v) => {
5105
+ this.$nextTick(() => this.observeSticky());
5106
+ }, {immediate: true});
5107
+ this.$el.setAttribute('w-scroll-x', 'left');
5108
+ if ($$1.br.chrome && $$1.br.chrome <= 60) { //低版本谷歌表格宽度有变化时,sticky的td内容会不可见。因此执行一个强制重新渲染的步骤
5109
+ new ResizeObserver$1(() => {
5110
+ this.$el.setAttribute('w-compact-resize-sticky', '');
5111
+ requestAnimationFrame(() => this.$el.removeAttribute('w-compact-resize-sticky'));
5112
+ }).observe(this.$el);
5094
5113
  }
5095
5114
  }
5096
5115
  };
@@ -5216,7 +5235,7 @@ var script$V = {
5216
5235
  style.minWidth = $$1.unitSize(mw);
5217
5236
  }
5218
5237
  }
5219
- this.rows = {};
5238
+ this.rows = markRaw({});
5220
5239
  return h('div', {
5221
5240
  class: 'w-table-tbl-wrap'
5222
5241
  }, h('table', {
@@ -5306,7 +5325,7 @@ var script$U = {
5306
5325
  });
5307
5326
  }
5308
5327
  },
5309
- html_slots() {
5328
+ html_slots() {
5310
5329
  return this.html_scroll_slots(this.html_tbody())
5311
5330
  }
5312
5331
  },