@operato/data-grist 10.29.27 → 10.29.29

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": "10.29.27",
3
+ "version": "10.29.29",
4
4
  "description": "User interface for grid (desktop) and list (mobile)",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -70,12 +70,12 @@
70
70
  "@material/web": "^2.0.0",
71
71
  "@operato/headroom": "^10.29.1",
72
72
  "@operato/i18n": "^10.29.27",
73
- "@operato/input": "^10.29.27",
73
+ "@operato/input": "^10.29.29",
74
74
  "@operato/list-state": "^10.29.27",
75
- "@operato/p13n": "^10.29.27",
76
- "@operato/popup": "^10.29.27",
75
+ "@operato/p13n": "^10.29.29",
76
+ "@operato/popup": "^10.29.29",
77
77
  "@operato/pull-to-refresh": "^10.29.23",
78
- "@operato/styles": "^10.29.23",
78
+ "@operato/styles": "^10.29.29",
79
79
  "@operato/time-calculator": "^10.29.1",
80
80
  "@operato/utils": "^10.29.23",
81
81
  "i18next": "^24.2.1",
@@ -116,5 +116,5 @@
116
116
  "prettier --write"
117
117
  ]
118
118
  },
119
- "gitHead": "aa70087b5929f12cec0506c19f1aec0a83610a79"
119
+ "gitHead": "807f487e5ba47dac781b343133dc2603e405c845"
120
120
  }
@@ -36,11 +36,8 @@ async function grist(mode: 'GRID' | 'LIST' | 'CARD', handler: () => Promise<unkn
36
36
 
37
37
  function emptyNote(el: HTMLElement & { renderRoot: ShadowRoot }): HTMLElement | null {
38
38
  const body = el.renderRoot.querySelector('#grist') as (HTMLElement & { renderRoot: ShadowRoot }) | null
39
- const inBody = body?.renderRoot.querySelector('ox-empty-note') as HTMLElement | null
40
- if (inBody) return inBody
41
- /* GRID draws the note inside its body element. */
42
- const gridBody = body?.renderRoot.querySelector('ox-grid-body') as HTMLElement | null
43
- return (gridBody?.querySelector('ox-empty-note') as HTMLElement | null) ?? null
39
+ /* Every mode draws the note in its own shadow root - GRID on the grid host, not in its body. */
40
+ return (body?.renderRoot.querySelector('ox-empty-note') as HTMLElement | null) ?? null
44
41
  }
45
42
 
46
43
  describe('ox-grist when the fetch fails', () => {
@@ -97,6 +94,30 @@ describe('ox-grist when the fetch fails', () => {
97
94
  expect(note!.getAttribute('title')).to.equal('nothing here yet.')
98
95
  })
99
96
 
97
+ it('GRID: the note stays in the visible grid when the columns are wider than it', async () => {
98
+ const wide = {
99
+ columns: [
100
+ { type: 'string', name: 'id', hidden: true },
101
+ { type: 'string', name: 'a', header: 'a', width: 600 },
102
+ { type: 'string', name: 'b', header: 'b', width: 600 }
103
+ ],
104
+ pagination: { pages: [20] }
105
+ }
106
+ const el = (await fixture(html`
107
+ <ox-grist style="height: 300px; width: 500px" mode="GRID" .config=${wide} .fetchHandler=${async () => ({ total: 0, records: [] as Rec[] })}></ox-grist>
108
+ `)) as HTMLElement & { fetch(): Promise<void>; updateComplete: Promise<unknown>; renderRoot: ShadowRoot }
109
+ await el.fetch()
110
+ await settle()
111
+ await el.updateComplete
112
+
113
+ const note = emptyNote(el)
114
+ expect(note, 'a note is drawn').to.exist
115
+ const box = el.getBoundingClientRect()
116
+ const at = note!.getBoundingClientRect()
117
+ /* Inside the 500px the person sees, not centred in the 1200px of columns. */
118
+ expect(at.left >= box.left && at.right <= box.right, `note ${at.left}-${at.right} within grid ${box.left}-${box.right}`).to.equal(true)
119
+ })
120
+
100
121
  it('rows from before stay, with a band saying they are not a fresh result; a good fetch clears it', async () => {
101
122
  let fail = false
102
123
  const el = await grist('GRID', async () => {
@@ -0,0 +1,19 @@
1
+ import { expect } from '@open-wc/testing'
2
+
3
+ import { RecordCard } from '../src/data-card/record-card.js'
4
+
5
+ /**
6
+ * A card is as tall as its content by default. A list whose cards carry different numbers of lines (a fact row that
7
+ * only some records have) stretches the cards of a row to one height through --data-card-record-card-height.
8
+ */
9
+
10
+ const text = (styles: unknown) =>
11
+ (Array.isArray(styles) ? styles : [styles]).map(s => String((s as { cssText?: string }).cssText ?? s)).join('\n')
12
+
13
+ describe('record card height', () => {
14
+ it('reads --data-card-record-card-height, min-content when not set', () => {
15
+ const css = text(RecordCard.styles)
16
+ const host = css.slice(css.indexOf(':host {'), css.indexOf('}', css.indexOf(':host {')))
17
+ expect(host).to.contain('height: var(--data-card-record-card-height, min-content);')
18
+ })
19
+ })