@operato/data-grist 1.13.4 → 1.13.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/data-grist",
3
- "version": "1.13.4",
3
+ "version": "1.13.5",
4
4
  "description": "User interface for grid (desktop) and list (mobile)",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/index.js",
@@ -100,5 +100,5 @@
100
100
  "prettier --write"
101
101
  ]
102
102
  },
103
- "gitHead": "8391250ac6c8d747111b2171031de1127b8b67a3"
103
+ "gitHead": "6effe65cf71902acc1ec065b4936760f6fb11d41"
104
104
  }
@@ -267,24 +267,28 @@ export class DataGridHeader extends LitElement {
267
267
  `
268
268
  }
269
269
 
270
- updated(changes: PropertyValues) {
271
- if (changes.has('data')) {
272
- const fixedHeaders = Array.from(this.renderRoot.querySelectorAll('div[fixed]')) as HTMLElement[]
273
- const fixedLefts = [] as number[]
274
- var left = 0
275
- fixedHeaders.forEach((header: HTMLElement) => {
276
- header.style.left = left + 'px'
277
- fixedLefts.push(left)
278
-
279
- const width = header.offsetWidth
280
- left += width
270
+ notifyFixedLeftChange() {
271
+ const fixedHeaders = Array.from(this.renderRoot.querySelectorAll('div[fixed]')) as HTMLElement[]
272
+ const fixedLefts = [] as number[]
273
+ var left = 0
274
+ fixedHeaders.forEach((header: HTMLElement) => {
275
+ header.style.left = left + 'px'
276
+ fixedLefts.push(left)
277
+
278
+ const width = header.offsetWidth
279
+ left += width
280
+ })
281
+
282
+ this.dispatchEvent(
283
+ new CustomEvent('fixed-lefts-change', {
284
+ detail: fixedLefts
281
285
  })
286
+ )
287
+ }
282
288
 
283
- this.dispatchEvent(
284
- new CustomEvent('fixed-lefts-change', {
285
- detail: fixedLefts
286
- })
287
- )
289
+ updated(changes: PropertyValues) {
290
+ if (changes.has('data')) {
291
+ requestAnimationFrame(this.notifyFixedLeftChange.bind(this))
288
292
  }
289
293
 
290
294
  if (changes.has('columns')) {
@@ -512,6 +516,8 @@ export class DataGridHeader extends LitElement {
512
516
  })
513
517
  )
514
518
 
519
+ this.notifyFixedLeftChange()
520
+
515
521
  this._lastAccVal = 0
516
522
  }, 100)
517
523
  }
@@ -144,8 +144,7 @@ const config = {
144
144
  },
145
145
  filter: 'search',
146
146
  sortable: true,
147
- width: 120,
148
- fixed: true
147
+ width: 120
149
148
  },
150
149
  {
151
150
  type: 'string',
@@ -161,7 +160,8 @@ const config = {
161
160
  click: (columns, data, column, record, rowIndex, target) => {
162
161
  alert(`${column!.name} ${record![column!.name]}, row : ${rowIndex}`)
163
162
  }
164
- } as GristEventHandlerSet
163
+ } as GristEventHandlerSet,
164
+ fixed: true
165
165
  },
166
166
  {
167
167
  type: 'email',