dfish-widget 1.0.104 → 1.0.106

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
@@ -5004,12 +5004,13 @@ var script$_ = {
5004
5004
  },
5005
5005
  data() {
5006
5006
  return {
5007
- sticky: {left: null, right: null},
5007
+ sticky: {left: null, right: null, observers: []},
5008
5008
  }
5009
5009
  },
5010
5010
  mounted() {
5011
- const observe = (e) => this.initFixedCells('left').concat(this.initFixedCells('right'));
5012
- $$1.lodash.each(observe(), v => new ResizeObserver$1(observe).observe(v));
5011
+ this.$watch('hasSticky', (v) => {
5012
+ this.$nextTick(() => this.observeSticky());
5013
+ }, {immediate: true});
5013
5014
  this.$el.setAttribute('w-scroll-x', 'left');
5014
5015
  if ($$1.br.chrome && $$1.br.chrome <= 60) { //低版本谷歌表格宽度有变化时,sticky的td内容会不可见。因此执行一个强制重新渲染的步骤
5015
5016
  new ResizeObserver$1(() => {
@@ -5019,6 +5020,19 @@ var script$_ = {
5019
5020
  }
5020
5021
  },
5021
5022
  methods: {
5023
+ observeSticky() {
5024
+ const observe = (e) => this.initFixedCells('left').concat(this.initFixedCells('right'));
5025
+ for (let ob of this.sticky.observers) {
5026
+ ob.disconnect();
5027
+ }
5028
+ let observers = [];
5029
+ $$1.lodash.each(observe(), cell => {
5030
+ let ob = new ResizeObserver$1(observe);
5031
+ ob.observe(cell);
5032
+ observers.push(ob);
5033
+ });
5034
+ this.sticky.observers = observers;
5035
+ },
5022
5036
  initFixedCells(dir) {
5023
5037
  let sticky = null;
5024
5038
  let offset = 0;
@@ -5054,6 +5068,13 @@ var script$_ = {
5054
5068
  colgroup() {
5055
5069
  return $$1.slotsChildren(this.slotHooks.columns.children).map(v => v.props)
5056
5070
  },
5071
+ hasSticky() {
5072
+ let s = '';
5073
+ for (let col of this.colgroup) {
5074
+ if (col.fixed) s += col.fixed;
5075
+ }
5076
+ return s
5077
+ },
5057
5078
  html_class() {
5058
5079
  return ['f-flex-column', this.x.face && 'z-face-' + this.x.face]
5059
5080
  },