@fusion.dev/helix-headless 0.6.0 → 0.7.1
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/custom-elements.json +236 -29
- package/dist/data-table/root/data-table-root.d.ts +138 -28
- package/dist/data-table/root/data-table-root.js +110 -21
- package/dist/data-table/root/order.d.ts +25 -0
- package/dist/data-table/root/order.js +6 -3
- package/package.json +5 -5
- package/types/jsx.d.ts +154 -50
- package/types/vue.d.ts +40 -14
package/custom-elements.json
CHANGED
|
@@ -17182,6 +17182,14 @@
|
|
|
17182
17182
|
}
|
|
17183
17183
|
],
|
|
17184
17184
|
"cssParts": [
|
|
17185
|
+
{
|
|
17186
|
+
"description": "The room the rows below the window would have taken. Windowed only.",
|
|
17187
|
+
"name": "after"
|
|
17188
|
+
},
|
|
17189
|
+
{
|
|
17190
|
+
"description": "The room the rows above the window would have taken. Windowed only.",
|
|
17191
|
+
"name": "before"
|
|
17192
|
+
},
|
|
17185
17193
|
{
|
|
17186
17194
|
"description": "One cell.",
|
|
17187
17195
|
"name": "cell"
|
|
@@ -17286,13 +17294,13 @@
|
|
|
17286
17294
|
},
|
|
17287
17295
|
{
|
|
17288
17296
|
"kind": "field",
|
|
17289
|
-
"name": "
|
|
17297
|
+
"name": "estimate",
|
|
17290
17298
|
"type": {
|
|
17291
|
-
"text": "
|
|
17299
|
+
"text": "number"
|
|
17292
17300
|
},
|
|
17293
|
-
"default": "
|
|
17294
|
-
"description": "
|
|
17295
|
-
"attribute": "
|
|
17301
|
+
"default": "32",
|
|
17302
|
+
"description": "How tall a row is taken to be before it has been drawn, in pixels.\n\nOnly read while `windowed`, and a starting guess rather than a claim: a\ncell that wraps makes its row taller than its neighbors, and the window\nreplaces this with what each row came to as it draws. It still has to be\nclose, because it is what the scrollbar is built from before anything has\nbeen measured.",
|
|
17303
|
+
"attribute": "estimate"
|
|
17296
17304
|
},
|
|
17297
17305
|
{
|
|
17298
17306
|
"kind": "field",
|
|
@@ -17305,13 +17313,13 @@
|
|
|
17305
17313
|
},
|
|
17306
17314
|
{
|
|
17307
17315
|
"kind": "field",
|
|
17308
|
-
"name": "
|
|
17316
|
+
"name": "key",
|
|
17309
17317
|
"type": {
|
|
17310
17318
|
"text": "string"
|
|
17311
17319
|
},
|
|
17312
17320
|
"default": "''",
|
|
17313
|
-
"description": "
|
|
17314
|
-
"attribute": "
|
|
17321
|
+
"description": "The field naming a row's stable identity.\n\n**Needed before selection exists, not after.** Lit keys the rendered rows by\nit, so a sort moves a row's element rather than rewriting every cell in\nplace, which is what keeps focus inside a cell and keeps a CSS transition\nattached to the row it belongs to. Left unset the index is the key, which is\ncorrect only while nothing reorders: it is why this defaults to something\nthat works and is worth setting anyway.",
|
|
17322
|
+
"attribute": "key"
|
|
17315
17323
|
},
|
|
17316
17324
|
{
|
|
17317
17325
|
"kind": "field",
|
|
@@ -17324,13 +17332,13 @@
|
|
|
17324
17332
|
},
|
|
17325
17333
|
{
|
|
17326
17334
|
"kind": "field",
|
|
17327
|
-
"name": "
|
|
17335
|
+
"name": "label",
|
|
17328
17336
|
"type": {
|
|
17329
|
-
"text": "
|
|
17337
|
+
"text": "string"
|
|
17330
17338
|
},
|
|
17331
|
-
"default": "'
|
|
17332
|
-
"description": "
|
|
17333
|
-
"attribute": "
|
|
17339
|
+
"default": "''",
|
|
17340
|
+
"description": "Accessible name for the grid.",
|
|
17341
|
+
"attribute": "label"
|
|
17334
17342
|
},
|
|
17335
17343
|
{
|
|
17336
17344
|
"kind": "field",
|
|
@@ -17341,6 +17349,16 @@
|
|
|
17341
17349
|
"description": "The page on show, from 1.\n\nClamped on the way out, so what this reports is the page it drew: a\nbookmarked link to page 99 of a result that has since shrunk reads back as\nthe last page rather than as 99.",
|
|
17342
17350
|
"attribute": "page"
|
|
17343
17351
|
},
|
|
17352
|
+
{
|
|
17353
|
+
"kind": "field",
|
|
17354
|
+
"name": "mode",
|
|
17355
|
+
"type": {
|
|
17356
|
+
"text": "'client' | 'server'"
|
|
17357
|
+
},
|
|
17358
|
+
"default": "'client'",
|
|
17359
|
+
"description": "Whether this element does the work or asks the consumer to.\n\n`client` filters, sorts and pages `rows` itself. `server` applies none of\nthem: `rows` is the page, `total` is the size of the whole result, and the\nthree events are requests the consumer answers by fetching. Past some size\nthe client cannot hold the data, so this is not an optimization, it is the\nonly mode that works, and it is here from the start because adding it later\ninverts the data flow.",
|
|
17360
|
+
"attribute": "mode"
|
|
17361
|
+
},
|
|
17344
17362
|
{
|
|
17345
17363
|
"kind": "field",
|
|
17346
17364
|
"name": "rows",
|
|
@@ -17369,6 +17387,17 @@
|
|
|
17369
17387
|
"description": "How many rows the whole result has, where this element cannot count them.\n\nOnly read in `server` mode, where `rows` is one page and its length says\nnothing about the result. Ignored in `client` mode rather than trusted,\nbecause two sources for one count is the mistake, and here the array is the\none that cannot be stale.",
|
|
17370
17388
|
"attribute": "total"
|
|
17371
17389
|
},
|
|
17390
|
+
{
|
|
17391
|
+
"kind": "field",
|
|
17392
|
+
"name": "windowed",
|
|
17393
|
+
"type": {
|
|
17394
|
+
"text": "boolean"
|
|
17395
|
+
},
|
|
17396
|
+
"default": "false",
|
|
17397
|
+
"description": "Draws the rows in view and stands empty space in for the rest.\n\n**Not a `mode`.** `mode` says where the rows come from and who filtered\nthem; this says how many of the ones we hold get drawn. They are\nindependent: a consumer fetching five thousand rows a chunk at a time wants\n`mode=\"server\"` and this at once, and folding this into `mode` would be an\nAPI that forbids that combination for no reason.\n\n**Composes with `paginated` rather than excluding it.** A window over a\npage is coherent -- the page is the slice of the result, the window is the\npart of that slice on screen -- and the arithmetic is the same either way,\nso there is nothing to forbid. Together they suit a table paging at a\nthousand rows, where the page is a reasonable fetch and a poor render.\n\nOff by default. Windowing costs a scroll listener, a measurement per row\ndrawn, and a `block-size` on the scrolling box, and a table of twenty rows\nshould pay none of them.",
|
|
17398
|
+
"attribute": "windowed",
|
|
17399
|
+
"reflects": true
|
|
17400
|
+
},
|
|
17372
17401
|
{
|
|
17373
17402
|
"kind": "field",
|
|
17374
17403
|
"name": "paginated",
|
|
@@ -17423,6 +17452,72 @@
|
|
|
17423
17452
|
"privacy": "private",
|
|
17424
17453
|
"default": "undefined"
|
|
17425
17454
|
},
|
|
17455
|
+
{
|
|
17456
|
+
"kind": "field",
|
|
17457
|
+
"name": "virtualize",
|
|
17458
|
+
"privacy": "private",
|
|
17459
|
+
"readonly": true,
|
|
17460
|
+
"default": "new VirtualizeController(this, { /* Null while `windowed` is off, which is what keeps the controller inert rather than conditionally constructed: a controller is built once and this property can change at runtime. */ container: () => this.windowed ? this.renderRoot.querySelector<HTMLElement>('[part=\"table\"]') : null, count: () => this.available, estimate: () => this.estimate, /* Always measured when windowing at all. The uniform path converts offset to index by division and is right when rows are one height; a grid whose cells wrap is the case it is wrong for. */ measured: () => this.windowed, rows: () => (this.windowed ? this.drawn() : []), })"
|
|
17461
|
+
},
|
|
17462
|
+
{
|
|
17463
|
+
"kind": "method",
|
|
17464
|
+
"name": "drawn",
|
|
17465
|
+
"privacy": "private",
|
|
17466
|
+
"return": {
|
|
17467
|
+
"type": {
|
|
17468
|
+
"text": "{ element: HTMLElement; index: number }[]"
|
|
17469
|
+
}
|
|
17470
|
+
},
|
|
17471
|
+
"description": "The rows in the shadow tree, each with the row of the page it drew.\n\n**Read off `data-index` rather than counted.** `hostUpdated` runs before\n`updated`, so what is in the tree when the controller asks is the previous\nwindow; counting from the current one would record the right heights\nagainst the wrong rows every time the window moved."
|
|
17472
|
+
},
|
|
17473
|
+
{
|
|
17474
|
+
"kind": "field",
|
|
17475
|
+
"name": "available",
|
|
17476
|
+
"type": {
|
|
17477
|
+
"text": "number"
|
|
17478
|
+
},
|
|
17479
|
+
"privacy": "private",
|
|
17480
|
+
"description": "How many rows there are to window over: the page, or the result.\n\n**Read off the held arrangement rather than counted afresh**, because the\ncontroller asks this on every scroll and `matched` walks the whole result\nwhenever a filter is on. Held, a scroll through a filtered table of five\nthousand rows costs a lookup; counted, it costs five thousand comparisons a\nframe, which is the cost windowing was added to avoid.\n\n`matched` still answers where nothing is windowing, which is the path that\nholds nothing and should not start.",
|
|
17481
|
+
"readonly": true
|
|
17482
|
+
},
|
|
17483
|
+
{
|
|
17484
|
+
"kind": "field",
|
|
17485
|
+
"name": "held",
|
|
17486
|
+
"type": {
|
|
17487
|
+
"text": "{ key: string; source: readonly DataRow[]; value: Arranged } | undefined"
|
|
17488
|
+
},
|
|
17489
|
+
"privacy": "private",
|
|
17490
|
+
"description": "The arranged result, kept between renders.\n\n**A window moves and the order does not.** Every scroll that reveals a row\nre-renders, and deriving that render from `rows` would filter and sort the\nwhole result again each time: 23.7ms at five thousand rows, three frames\nspent before a cell is drawn. Held against the inputs that change it, a\nscroll costs a slice.\n\nOnly the windowed path uses this. A paged table re-renders when the reader\nasks for a page, which is rare enough that holding a second copy of the\nresult to save a sort is the wrong trade."
|
|
17491
|
+
},
|
|
17492
|
+
{
|
|
17493
|
+
"kind": "method",
|
|
17494
|
+
"name": "arrange",
|
|
17495
|
+
"privacy": "private",
|
|
17496
|
+
"return": {
|
|
17497
|
+
"type": {
|
|
17498
|
+
"text": "Arranged"
|
|
17499
|
+
}
|
|
17500
|
+
}
|
|
17501
|
+
},
|
|
17502
|
+
{
|
|
17503
|
+
"kind": "method",
|
|
17504
|
+
"name": "windowOf",
|
|
17505
|
+
"privacy": "private",
|
|
17506
|
+
"return": {
|
|
17507
|
+
"type": {
|
|
17508
|
+
"text": "DataRow[]"
|
|
17509
|
+
}
|
|
17510
|
+
},
|
|
17511
|
+
"parameters": [
|
|
17512
|
+
{
|
|
17513
|
+
"name": "rows",
|
|
17514
|
+
"type": {
|
|
17515
|
+
"text": "DataRow[]"
|
|
17516
|
+
}
|
|
17517
|
+
}
|
|
17518
|
+
],
|
|
17519
|
+
"description": "The part of a page the reader can see, which is every row when not windowed."
|
|
17520
|
+
},
|
|
17426
17521
|
{
|
|
17427
17522
|
"kind": "field",
|
|
17428
17523
|
"name": "tableColumns",
|
|
@@ -17491,13 +17586,13 @@
|
|
|
17491
17586
|
}
|
|
17492
17587
|
}
|
|
17493
17588
|
],
|
|
17494
|
-
"description": "Says so when a table is asked to draw more than it comfortably can.\n\n**The component renders every row it is given and defaults to doing so.**\n`defaultPageSize` is `0`, so `paginated` is false unless a consumer asks,\nwhich means the out-of-the-box arrangement is the unbounded one and nothing\nabout it says that a result of any size will simply be drawn.\n\n**Windowing was refused
|
|
17589
|
+
"description": "Says so when a table is asked to draw more than it comfortably can.\n\n**The component renders every row it is given and defaults to doing so.**\n`defaultPageSize` is `0`, so `paginated` is false unless a consumer asks,\nwhich means the out-of-the-box arrangement is the unbounded one and nothing\nabout it says that a result of any size will simply be drawn.\n\n**Windowing was refused here, and is now `windowed`.** The refusal is kept\nbecause most of it was right, and because what changed is not that somebody\ndisagreed with it. It rested on four claims: that a third mechanism would\nfight `paginated` and `mode=\"server\"`; that a grid has rows of different\nheights; that it needs a sticky header; and that `aria-rowindex` has to keep\ndescribing a result the element no longer holds in full.\n\nThree stopped being true. `VirtualizeController` learnt to measure each row\nand place the next by what the one above came to, which is the variable\nheights. `aria-rowindex` was already result-relative because paging needed\nit, so a window is a second offset on arithmetic that existed. And the\nsticky header is one `position: sticky` on the heading cells rather than on\n`[part=\"head\"]`, which is `display: contents` and generates no box to stick\n-- that is why it looked hard and is not.\n\nThe first was avoided rather than answered. `windowed` is not a `mode` and\ndoes not exclude `paginated`: it says how much of what we hold gets drawn,\nwhere `mode` says where it came from, so there is no third axis to fight the\nother two. What survives is the cost, which is why windowing is off by\ndefault and why this warning still fires for a table that has none of them.\n\nWarned once per element, in a browser only: a warning during a server render\nis one nobody can act on and one that would print per request."
|
|
17495
17590
|
},
|
|
17496
17591
|
{
|
|
17497
17592
|
"kind": "field",
|
|
17498
17593
|
"name": "view",
|
|
17499
17594
|
"type": {
|
|
17500
|
-
"text": "{ matched: number
|
|
17595
|
+
"text": "{\n available: number\n matched: number\n rows: DataRow[]\n total: number\n }"
|
|
17501
17596
|
},
|
|
17502
17597
|
"privacy": "private",
|
|
17503
17598
|
"description": "The rows to draw, and the counts around them.\n\nIn `server` mode this element applies nothing: `rows` is already the page,\n`total` is the result, and both counts come from the consumer. Anything else\nwould be this element filtering a page it was handed, which narrows one\nscreen and calls it a search.",
|
|
@@ -17767,7 +17862,63 @@
|
|
|
17767
17862
|
}
|
|
17768
17863
|
}
|
|
17769
17864
|
],
|
|
17770
|
-
"description": "A row's place in the whole result, counting the header as row 1.\n\n**The number describes the result and not the window**, which is the whole\nreason a virtualized or paged grid needs `aria-rowindex` at all: a screen\nreader on page three should hear row 41, and a grid whose indices restart at\nevery page tells a reader the result is twenty rows long however many it has."
|
|
17865
|
+
"description": "A row's place in the whole result, counting the header as row 1.\n\n**The number describes the result and not the window**, which is the whole\nreason a virtualized or paged grid needs `aria-rowindex` at all: a screen\nreader on page three should hear row 41, and a grid whose indices restart at\nevery page tells a reader the result is twenty rows long however many it has.\n\nA window is the second offset and stacks on the page: with both on, row one\nof the window is the page's start plus how far down the page it begins."
|
|
17866
|
+
},
|
|
17867
|
+
{
|
|
17868
|
+
"kind": "field",
|
|
17869
|
+
"name": "placement",
|
|
17870
|
+
"type": {
|
|
17871
|
+
"text": "string"
|
|
17872
|
+
},
|
|
17873
|
+
"privacy": "private",
|
|
17874
|
+
"description": "What decides which row is at which index, as one comparable value.\n\nNot the rows themselves: those are compared by identity beside this, and a\nconsumer handing back an equal array is handing back the same rows in the\nsame order whatever object it is.",
|
|
17875
|
+
"readonly": true
|
|
17876
|
+
},
|
|
17877
|
+
{
|
|
17878
|
+
"kind": "field",
|
|
17879
|
+
"name": "measuredAgainst",
|
|
17880
|
+
"type": {
|
|
17881
|
+
"text": "string"
|
|
17882
|
+
},
|
|
17883
|
+
"privacy": "private",
|
|
17884
|
+
"default": "''",
|
|
17885
|
+
"description": "The signature the recorded heights were measured against."
|
|
17886
|
+
},
|
|
17887
|
+
{
|
|
17888
|
+
"kind": "field",
|
|
17889
|
+
"name": "windowStart",
|
|
17890
|
+
"type": {
|
|
17891
|
+
"text": "number"
|
|
17892
|
+
},
|
|
17893
|
+
"privacy": "private",
|
|
17894
|
+
"description": "Where the window begins in the page, which is the top when there is none.",
|
|
17895
|
+
"readonly": true
|
|
17896
|
+
},
|
|
17897
|
+
{
|
|
17898
|
+
"kind": "method",
|
|
17899
|
+
"name": "renderSpacer",
|
|
17900
|
+
"privacy": "private",
|
|
17901
|
+
"return": {
|
|
17902
|
+
"type": {
|
|
17903
|
+
"text": "TemplateResult | typeof nothing"
|
|
17904
|
+
}
|
|
17905
|
+
},
|
|
17906
|
+
"parameters": [
|
|
17907
|
+
{
|
|
17908
|
+
"name": "end",
|
|
17909
|
+
"type": {
|
|
17910
|
+
"text": "'after' | 'before'"
|
|
17911
|
+
}
|
|
17912
|
+
}
|
|
17913
|
+
],
|
|
17914
|
+
"description": "The room the rows outside the window would have taken.\n\n**`role=\"presentation\"`, because this is geometry standing inside a\n`rowgroup`.** A bare `div` there is a child the role does not allow, and a\nscreen reader walking the rows would meet something that is not one. The\nroom itself is what keeps the scrollbar honest: a box that scrolls twenty\nrows while claiming ten thousand gives a thumb the size of its track."
|
|
17915
|
+
},
|
|
17916
|
+
{
|
|
17917
|
+
"kind": "field",
|
|
17918
|
+
"name": "handleScroll",
|
|
17919
|
+
"privacy": "private",
|
|
17920
|
+
"readonly": true,
|
|
17921
|
+
"description": "The controller owns the geometry; this is only what tells it to look again."
|
|
17771
17922
|
},
|
|
17772
17923
|
{
|
|
17773
17924
|
"kind": "field",
|
|
@@ -18163,13 +18314,13 @@
|
|
|
18163
18314
|
"fieldName": "defaultSort"
|
|
18164
18315
|
},
|
|
18165
18316
|
{
|
|
18166
|
-
"name": "
|
|
18317
|
+
"name": "estimate",
|
|
18167
18318
|
"type": {
|
|
18168
|
-
"text": "
|
|
18319
|
+
"text": "number"
|
|
18169
18320
|
},
|
|
18170
|
-
"default": "
|
|
18171
|
-
"description": "
|
|
18172
|
-
"fieldName": "
|
|
18321
|
+
"default": "32",
|
|
18322
|
+
"description": "How tall a row is taken to be before it has been drawn, in pixels.\n\nOnly read while `windowed`, and a starting guess rather than a claim: a\ncell that wraps makes its row taller than its neighbors, and the window\nreplaces this with what each row came to as it draws. It still has to be\nclose, because it is what the scrollbar is built from before anything has\nbeen measured.",
|
|
18323
|
+
"fieldName": "estimate"
|
|
18173
18324
|
},
|
|
18174
18325
|
{
|
|
18175
18326
|
"name": "sort",
|
|
@@ -18180,13 +18331,13 @@
|
|
|
18180
18331
|
"fieldName": "sort"
|
|
18181
18332
|
},
|
|
18182
18333
|
{
|
|
18183
|
-
"name": "
|
|
18334
|
+
"name": "key",
|
|
18184
18335
|
"type": {
|
|
18185
18336
|
"text": "string"
|
|
18186
18337
|
},
|
|
18187
18338
|
"default": "''",
|
|
18188
|
-
"description": "
|
|
18189
|
-
"fieldName": "
|
|
18339
|
+
"description": "The field naming a row's stable identity.\n\n**Needed before selection exists, not after.** Lit keys the rendered rows by\nit, so a sort moves a row's element rather than rewriting every cell in\nplace, which is what keeps focus inside a cell and keeps a CSS transition\nattached to the row it belongs to. Left unset the index is the key, which is\ncorrect only while nothing reorders: it is why this defaults to something\nthat works and is worth setting anyway.",
|
|
18340
|
+
"fieldName": "key"
|
|
18190
18341
|
},
|
|
18191
18342
|
{
|
|
18192
18343
|
"name": "filter",
|
|
@@ -18197,13 +18348,13 @@
|
|
|
18197
18348
|
"fieldName": "filter"
|
|
18198
18349
|
},
|
|
18199
18350
|
{
|
|
18200
|
-
"name": "
|
|
18351
|
+
"name": "label",
|
|
18201
18352
|
"type": {
|
|
18202
|
-
"text": "
|
|
18353
|
+
"text": "string"
|
|
18203
18354
|
},
|
|
18204
|
-
"default": "'
|
|
18205
|
-
"description": "
|
|
18206
|
-
"fieldName": "
|
|
18355
|
+
"default": "''",
|
|
18356
|
+
"description": "Accessible name for the grid.",
|
|
18357
|
+
"fieldName": "label"
|
|
18207
18358
|
},
|
|
18208
18359
|
{
|
|
18209
18360
|
"name": "page",
|
|
@@ -18213,6 +18364,15 @@
|
|
|
18213
18364
|
"description": "The page on show, from 1.\n\nClamped on the way out, so what this reports is the page it drew: a\nbookmarked link to page 99 of a result that has since shrunk reads back as\nthe last page rather than as 99.",
|
|
18214
18365
|
"fieldName": "page"
|
|
18215
18366
|
},
|
|
18367
|
+
{
|
|
18368
|
+
"name": "mode",
|
|
18369
|
+
"type": {
|
|
18370
|
+
"text": "'client' | 'server'"
|
|
18371
|
+
},
|
|
18372
|
+
"default": "'client'",
|
|
18373
|
+
"description": "Whether this element does the work or asks the consumer to.\n\n`client` filters, sorts and pages `rows` itself. `server` applies none of\nthem: `rows` is the page, `total` is the size of the whole result, and the\nthree events are requests the consumer answers by fetching. Past some size\nthe client cannot hold the data, so this is not an optimization, it is the\nonly mode that works, and it is here from the start because adding it later\ninverts the data flow.",
|
|
18374
|
+
"fieldName": "mode"
|
|
18375
|
+
},
|
|
18216
18376
|
{
|
|
18217
18377
|
"name": "page-size",
|
|
18218
18378
|
"type": {
|
|
@@ -18230,6 +18390,15 @@
|
|
|
18230
18390
|
"description": "How many rows the whole result has, where this element cannot count them.\n\nOnly read in `server` mode, where `rows` is one page and its length says\nnothing about the result. Ignored in `client` mode rather than trusted,\nbecause two sources for one count is the mistake, and here the array is the\none that cannot be stale.",
|
|
18231
18391
|
"fieldName": "total"
|
|
18232
18392
|
},
|
|
18393
|
+
{
|
|
18394
|
+
"name": "windowed",
|
|
18395
|
+
"type": {
|
|
18396
|
+
"text": "boolean"
|
|
18397
|
+
},
|
|
18398
|
+
"default": "false",
|
|
18399
|
+
"description": "Draws the rows in view and stands empty space in for the rest.\n\n**Not a `mode`.** `mode` says where the rows come from and who filtered\nthem; this says how many of the ones we hold get drawn. They are\nindependent: a consumer fetching five thousand rows a chunk at a time wants\n`mode=\"server\"` and this at once, and folding this into `mode` would be an\nAPI that forbids that combination for no reason.\n\n**Composes with `paginated` rather than excluding it.** A window over a\npage is coherent -- the page is the slice of the result, the window is the\npart of that slice on screen -- and the arithmetic is the same either way,\nso there is nothing to forbid. Together they suit a table paging at a\nthousand rows, where the page is a reasonable fetch and a poor render.\n\nOff by default. Windowing costs a scroll listener, a measurement per row\ndrawn, and a `block-size` on the scrolling box, and a table of twenty rows\nshould pay none of them.",
|
|
18400
|
+
"fieldName": "windowed"
|
|
18401
|
+
},
|
|
18233
18402
|
{
|
|
18234
18403
|
"name": "paginated",
|
|
18235
18404
|
"type": {
|
|
@@ -18490,6 +18659,36 @@
|
|
|
18490
18659
|
],
|
|
18491
18660
|
"description": "One page of rows, clamped.\n\nA page past the end returns the last page rather than nothing, because the\nusual way to be past the end is a bookmarked link after the result shrank, and\nan empty table is a worse answer than the last page of a smaller one. The\nsame clamp `helix-pagination` already applies to what it reports."
|
|
18492
18661
|
},
|
|
18662
|
+
{
|
|
18663
|
+
"kind": "function",
|
|
18664
|
+
"name": "arranged",
|
|
18665
|
+
"return": {
|
|
18666
|
+
"type": {
|
|
18667
|
+
"text": "Arranged"
|
|
18668
|
+
}
|
|
18669
|
+
},
|
|
18670
|
+
"parameters": [
|
|
18671
|
+
{
|
|
18672
|
+
"name": "rows",
|
|
18673
|
+
"type": {
|
|
18674
|
+
"text": "readonly DataRow[]"
|
|
18675
|
+
}
|
|
18676
|
+
},
|
|
18677
|
+
{
|
|
18678
|
+
"name": "axes",
|
|
18679
|
+
"type": {
|
|
18680
|
+
"text": "readonly Axis[]"
|
|
18681
|
+
}
|
|
18682
|
+
},
|
|
18683
|
+
{
|
|
18684
|
+
"name": "{ query, spec }",
|
|
18685
|
+
"type": {
|
|
18686
|
+
"text": "{ query: string; spec: string }"
|
|
18687
|
+
}
|
|
18688
|
+
}
|
|
18689
|
+
],
|
|
18690
|
+
"description": "Filtering and sorting, with nothing taken off the end.\n\n**Split out of `ordered` because a window moves and this does not.** A table\ndrawing a window on a result re-renders every time a scroll reveals a row,\nand deriving that render from the whole result means filtering and sorting it\nagain each time: 23.7ms at five thousand rows, a frame budget spent three\ntimes over before a cell is drawn. A caller that keeps this between renders\npays it once per change to the data rather than once per frame.\n\nThe two steps stay together for the reason `ordered` gives below: sorting a\npage is the classic bug, and one function doing both is what makes calling\nthem in the wrong order impossible."
|
|
18691
|
+
},
|
|
18493
18692
|
{
|
|
18494
18693
|
"kind": "function",
|
|
18495
18694
|
"name": "ordered",
|
|
@@ -18570,6 +18769,14 @@
|
|
|
18570
18769
|
"module": "src/data-table/root/order.ts"
|
|
18571
18770
|
}
|
|
18572
18771
|
},
|
|
18772
|
+
{
|
|
18773
|
+
"kind": "js",
|
|
18774
|
+
"name": "arranged",
|
|
18775
|
+
"declaration": {
|
|
18776
|
+
"name": "arranged",
|
|
18777
|
+
"module": "src/data-table/root/order.ts"
|
|
18778
|
+
}
|
|
18779
|
+
},
|
|
18573
18780
|
{
|
|
18574
18781
|
"kind": "js",
|
|
18575
18782
|
"name": "ordered",
|
|
@@ -46,6 +46,8 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
|
|
|
46
46
|
* @event {HelixNavigateEvent} helix-navigate - Fired when a reader asks for another page, and cancelable.
|
|
47
47
|
* @event {HelixSortEvent} helix-sort - Fired when a reader asks for a different order, and cancelable.
|
|
48
48
|
*
|
|
49
|
+
* @csspart after - The room the rows below the window would have taken. Windowed only.
|
|
50
|
+
* @csspart before - The room the rows above the window would have taken. Windowed only.
|
|
49
51
|
* @csspart cell - One cell.
|
|
50
52
|
* @csspart empty - Shown when no rows match.
|
|
51
53
|
* @csspart footer - The region below the grid.
|
|
@@ -86,16 +88,15 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
86
88
|
*/
|
|
87
89
|
defaultSort: string;
|
|
88
90
|
/**
|
|
89
|
-
*
|
|
91
|
+
* How tall a row is taken to be before it has been drawn, in pixels.
|
|
90
92
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* that works and is worth setting anyway.
|
|
93
|
+
* Only read while `windowed`, and a starting guess rather than a claim: a
|
|
94
|
+
* cell that wraps makes its row taller than its neighbors, and the window
|
|
95
|
+
* replaces this with what each row came to as it draws. It still has to be
|
|
96
|
+
* close, because it is what the scrollbar is built from before anything has
|
|
97
|
+
* been measured.
|
|
97
98
|
*/
|
|
98
|
-
|
|
99
|
+
estimate: number;
|
|
99
100
|
/**
|
|
100
101
|
* The order, as `field:direction`.
|
|
101
102
|
*
|
|
@@ -106,9 +107,16 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
106
107
|
get sort(): string;
|
|
107
108
|
set sort(next: string);
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
+
* The field naming a row's stable identity.
|
|
111
|
+
*
|
|
112
|
+
* **Needed before selection exists, not after.** Lit keys the rendered rows by
|
|
113
|
+
* it, so a sort moves a row's element rather than rewriting every cell in
|
|
114
|
+
* place, which is what keeps focus inside a cell and keeps a CSS transition
|
|
115
|
+
* attached to the row it belongs to. Left unset the index is the key, which is
|
|
116
|
+
* correct only while nothing reorders: it is why this defaults to something
|
|
117
|
+
* that works and is worth setting anyway.
|
|
110
118
|
*/
|
|
111
|
-
|
|
119
|
+
key: string;
|
|
112
120
|
/**
|
|
113
121
|
* What the rows are narrowed to, as one query across every column.
|
|
114
122
|
*
|
|
@@ -119,16 +127,9 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
119
127
|
get filter(): string;
|
|
120
128
|
set filter(next: string);
|
|
121
129
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* `client` filters, sorts and pages `rows` itself. `server` applies none of
|
|
125
|
-
* them: `rows` is the page, `total` is the size of the whole result, and the
|
|
126
|
-
* three events are requests the consumer answers by fetching. Past some size
|
|
127
|
-
* the client cannot hold the data, so this is not an optimization, it is the
|
|
128
|
-
* only mode that works, and it is here from the start because adding it later
|
|
129
|
-
* inverts the data flow.
|
|
130
|
+
* Accessible name for the grid.
|
|
130
131
|
*/
|
|
131
|
-
|
|
132
|
+
label: string;
|
|
132
133
|
/**
|
|
133
134
|
* The page on show, from 1.
|
|
134
135
|
*
|
|
@@ -138,6 +139,17 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
138
139
|
*/
|
|
139
140
|
get page(): number;
|
|
140
141
|
set page(next: number);
|
|
142
|
+
/**
|
|
143
|
+
* Whether this element does the work or asks the consumer to.
|
|
144
|
+
*
|
|
145
|
+
* `client` filters, sorts and pages `rows` itself. `server` applies none of
|
|
146
|
+
* them: `rows` is the page, `total` is the size of the whole result, and the
|
|
147
|
+
* three events are requests the consumer answers by fetching. Past some size
|
|
148
|
+
* the client cannot hold the data, so this is not an optimization, it is the
|
|
149
|
+
* only mode that works, and it is here from the start because adding it later
|
|
150
|
+
* inverts the data flow.
|
|
151
|
+
*/
|
|
152
|
+
mode: 'client' | 'server';
|
|
141
153
|
/**
|
|
142
154
|
* The whole result, in the order it arrived.
|
|
143
155
|
*
|
|
@@ -170,6 +182,26 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
170
182
|
* one that cannot be stale.
|
|
171
183
|
*/
|
|
172
184
|
total: number;
|
|
185
|
+
/**
|
|
186
|
+
* Draws the rows in view and stands empty space in for the rest.
|
|
187
|
+
*
|
|
188
|
+
* **Not a `mode`.** `mode` says where the rows come from and who filtered
|
|
189
|
+
* them; this says how many of the ones we hold get drawn. They are
|
|
190
|
+
* independent: a consumer fetching five thousand rows a chunk at a time wants
|
|
191
|
+
* `mode="server"` and this at once, and folding this into `mode` would be an
|
|
192
|
+
* API that forbids that combination for no reason.
|
|
193
|
+
*
|
|
194
|
+
* **Composes with `paginated` rather than excluding it.** A window over a
|
|
195
|
+
* page is coherent -- the page is the slice of the result, the window is the
|
|
196
|
+
* part of that slice on screen -- and the arithmetic is the same either way,
|
|
197
|
+
* so there is nothing to forbid. Together they suit a table paging at a
|
|
198
|
+
* thousand rows, where the page is a reasonable fetch and a poor render.
|
|
199
|
+
*
|
|
200
|
+
* Off by default. Windowing costs a scroll listener, a measurement per row
|
|
201
|
+
* drawn, and a `block-size` on the scrolling box, and a table of twenty rows
|
|
202
|
+
* should pay none of them.
|
|
203
|
+
*/
|
|
204
|
+
windowed: boolean;
|
|
173
205
|
/**
|
|
174
206
|
* Whether to draw a pagination under the grid.
|
|
175
207
|
*
|
|
@@ -185,6 +217,46 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
185
217
|
private pageState;
|
|
186
218
|
private pageSizeState;
|
|
187
219
|
private paginatedState;
|
|
220
|
+
private readonly virtualize;
|
|
221
|
+
/**
|
|
222
|
+
* The rows in the shadow tree, each with the row of the page it drew.
|
|
223
|
+
*
|
|
224
|
+
* **Read off `data-index` rather than counted.** `hostUpdated` runs before
|
|
225
|
+
* `updated`, so what is in the tree when the controller asks is the previous
|
|
226
|
+
* window; counting from the current one would record the right heights
|
|
227
|
+
* against the wrong rows every time the window moved.
|
|
228
|
+
*/
|
|
229
|
+
private drawn;
|
|
230
|
+
/**
|
|
231
|
+
* How many rows there are to window over: the page, or the result.
|
|
232
|
+
*
|
|
233
|
+
* **Read off the held arrangement rather than counted afresh**, because the
|
|
234
|
+
* controller asks this on every scroll and `matched` walks the whole result
|
|
235
|
+
* whenever a filter is on. Held, a scroll through a filtered table of five
|
|
236
|
+
* thousand rows costs a lookup; counted, it costs five thousand comparisons a
|
|
237
|
+
* frame, which is the cost windowing was added to avoid.
|
|
238
|
+
*
|
|
239
|
+
* `matched` still answers where nothing is windowing, which is the path that
|
|
240
|
+
* holds nothing and should not start.
|
|
241
|
+
*/
|
|
242
|
+
private get available();
|
|
243
|
+
/**
|
|
244
|
+
* The arranged result, kept between renders.
|
|
245
|
+
*
|
|
246
|
+
* **A window moves and the order does not.** Every scroll that reveals a row
|
|
247
|
+
* re-renders, and deriving that render from `rows` would filter and sort the
|
|
248
|
+
* whole result again each time: 23.7ms at five thousand rows, three frames
|
|
249
|
+
* spent before a cell is drawn. Held against the inputs that change it, a
|
|
250
|
+
* scroll costs a slice.
|
|
251
|
+
*
|
|
252
|
+
* Only the windowed path uses this. A paged table re-renders when the reader
|
|
253
|
+
* asks for a page, which is rare enough that holding a second copy of the
|
|
254
|
+
* result to save a sort is the wrong trade.
|
|
255
|
+
*/
|
|
256
|
+
private held;
|
|
257
|
+
private arrange;
|
|
258
|
+
/** The part of a page the reader can see, which is every row when not windowed. */
|
|
259
|
+
private windowOf;
|
|
188
260
|
/** The columns declared as children, in the order they are written. */
|
|
189
261
|
get tableColumns(): HelixHeadlessTableColumn[];
|
|
190
262
|
/** The columns reduced to what the ordering needs. */
|
|
@@ -212,15 +284,26 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
212
284
|
* which means the out-of-the-box arrangement is the unbounded one and nothing
|
|
213
285
|
* about it says that a result of any size will simply be drawn.
|
|
214
286
|
*
|
|
215
|
-
* **Windowing was refused
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
287
|
+
* **Windowing was refused here, and is now `windowed`.** The refusal is kept
|
|
288
|
+
* because most of it was right, and because what changed is not that somebody
|
|
289
|
+
* disagreed with it. It rested on four claims: that a third mechanism would
|
|
290
|
+
* fight `paginated` and `mode="server"`; that a grid has rows of different
|
|
291
|
+
* heights; that it needs a sticky header; and that `aria-rowindex` has to keep
|
|
292
|
+
* describing a result the element no longer holds in full.
|
|
293
|
+
*
|
|
294
|
+
* Three stopped being true. `VirtualizeController` learnt to measure each row
|
|
295
|
+
* and place the next by what the one above came to, which is the variable
|
|
296
|
+
* heights. `aria-rowindex` was already result-relative because paging needed
|
|
297
|
+
* it, so a window is a second offset on arithmetic that existed. And the
|
|
298
|
+
* sticky header is one `position: sticky` on the heading cells rather than on
|
|
299
|
+
* `[part="head"]`, which is `display: contents` and generates no box to stick
|
|
300
|
+
* -- that is why it looked hard and is not.
|
|
301
|
+
*
|
|
302
|
+
* The first was avoided rather than answered. `windowed` is not a `mode` and
|
|
303
|
+
* does not exclude `paginated`: it says how much of what we hold gets drawn,
|
|
304
|
+
* where `mode` says where it came from, so there is no third axis to fight the
|
|
305
|
+
* other two. What survives is the cost, which is why windowing is off by
|
|
306
|
+
* default and why this warning still fires for a table that has none of them.
|
|
224
307
|
*
|
|
225
308
|
* Warned once per element, in a browser only: a warning during a server render
|
|
226
309
|
* is one nobody can act on and one that would print per request.
|
|
@@ -327,8 +410,35 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
327
410
|
* reason a virtualized or paged grid needs `aria-rowindex` at all: a screen
|
|
328
411
|
* reader on page three should hear row 41, and a grid whose indices restart at
|
|
329
412
|
* every page tells a reader the result is twenty rows long however many it has.
|
|
413
|
+
*
|
|
414
|
+
* A window is the second offset and stacks on the page: with both on, row one
|
|
415
|
+
* of the window is the page's start plus how far down the page it begins.
|
|
330
416
|
*/
|
|
331
417
|
private rowIndex;
|
|
418
|
+
/**
|
|
419
|
+
* What decides which row is at which index, as one comparable value.
|
|
420
|
+
*
|
|
421
|
+
* Not the rows themselves: those are compared by identity beside this, and a
|
|
422
|
+
* consumer handing back an equal array is handing back the same rows in the
|
|
423
|
+
* same order whatever object it is.
|
|
424
|
+
*/
|
|
425
|
+
private get placement();
|
|
426
|
+
/** The signature the recorded heights were measured against. */
|
|
427
|
+
private measuredAgainst;
|
|
428
|
+
/** Where the window begins in the page, which is the top when there is none. */
|
|
429
|
+
private get windowStart();
|
|
430
|
+
/**
|
|
431
|
+
* The room the rows outside the window would have taken.
|
|
432
|
+
*
|
|
433
|
+
* **`role="presentation"`, because this is geometry standing inside a
|
|
434
|
+
* `rowgroup`.** A bare `div` there is a child the role does not allow, and a
|
|
435
|
+
* screen reader walking the rows would meet something that is not one. The
|
|
436
|
+
* room itself is what keeps the scrollbar honest: a box that scrolls twenty
|
|
437
|
+
* rows while claiming ten thousand gives a thumb the size of its track.
|
|
438
|
+
*/
|
|
439
|
+
private renderSpacer;
|
|
440
|
+
/** The controller owns the geometry; this is only what tells it to look again. */
|
|
441
|
+
private readonly handleScroll;
|
|
332
442
|
protected render(): TemplateResult;
|
|
333
443
|
/**
|
|
334
444
|
* Listens on the host, not on the slot the columns are assigned to.
|