dfish-widget 1.0.115 → 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
@@ -5013,17 +5013,19 @@ var script$_ = {
5013
5013
  },
5014
5014
  methods: {
5015
5015
  observeSticky() {
5016
- const observe = (e) => this.initFixedCells('left').concat(this.initFixedCells('right'));
5017
5016
  for (let ob of this.sticky.observers) {
5018
5017
  ob.disconnect();
5019
5018
  }
5020
5019
  let observers = [];
5021
- $$1.lodash.each(observe(), cell => {
5022
- let ob = new ResizeObserver$1(observe);
5020
+ $$1.lodash.each(this.initFixedCells(), cell => {
5021
+ let ob = new ResizeObserver$1(this.setFixedStyle);
5023
5022
  ob.observe(cell);
5024
5023
  observers.push(ob);
5025
5024
  });
5026
5025
  this.sticky.observers = observers;
5026
+ },
5027
+ setFixedStyle() {
5028
+ this.initFixedCells();
5027
5029
  let r = {};
5028
5030
  if (this.sticky.left) {
5029
5031
  this.sticky.left.forEach(v => r[`--w-td-fixed-left-${v.colIndex}`] = `${v.offset}px`);
@@ -5037,11 +5039,16 @@ var script$_ = {
5037
5039
  }
5038
5040
  }
5039
5041
  },
5040
- initFixedCells(dir) {
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;
@@ -5094,7 +5101,7 @@ var script$_ = {
5094
5101
  // }
5095
5102
  },
5096
5103
  mounted() {
5097
- this.$watch('hasSticky', (v) => {
5104
+ this.$watch('stickyState', (v) => {
5098
5105
  this.$nextTick(() => this.observeSticky());
5099
5106
  }, {immediate: true});
5100
5107
  this.$el.setAttribute('w-scroll-x', 'left');