argus-table 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js +8 -0
- package/dist/argus-table.js +517 -0
- package/dist/argus-table.js.map +1 -0
- package/dist/cdn/argus-table.js +4569 -0
- package/dist/cdn/argus-table.js.map +1 -0
- package/dist/controllers/pin-scroll-controller.js +78 -0
- package/dist/controllers/pin-scroll-controller.js.map +1 -0
- package/dist/controllers/resize-drag.js +44 -0
- package/dist/controllers/resize-drag.js.map +1 -0
- package/dist/controllers/table-controller.js +24 -0
- package/dist/controllers/table-controller.js.map +1 -0
- package/dist/controllers/virtual-controller.js +83 -0
- package/dist/controllers/virtual-controller.js.map +1 -0
- package/dist/core/src/columns/resolve-columns.js +62 -0
- package/dist/core/src/columns/resolve-columns.js.map +1 -0
- package/dist/core/src/state/controllable.js +31 -0
- package/dist/core/src/state/controllable.js.map +1 -0
- package/dist/core/src/table/create-table.js +185 -0
- package/dist/core/src/table/create-table.js.map +1 -0
- package/dist/core/src/virtual/row-pool.js +64 -0
- package/dist/core/src/virtual/row-pool.js.map +1 -0
- package/dist/custom-elements.json +1191 -0
- package/dist/events.js +22 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +236 -0
- package/dist/index.js +3 -0
- package/dist/render/body.js +48 -0
- package/dist/render/body.js.map +1 -0
- package/dist/render/cells.js +27 -0
- package/dist/render/cells.js.map +1 -0
- package/dist/render/content.js +35 -0
- package/dist/render/content.js.map +1 -0
- package/dist/render/header.js +61 -0
- package/dist/render/header.js.map +1 -0
- package/dist/styles/base.js +11 -0
- package/dist/styles/base.js.map +1 -0
- package/package.json +62 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// ../core/src/virtual/row-pool.ts
|
|
2
|
+
/**
|
|
3
|
+
* Assigns pool slots to rendered rows (ADR 0001).
|
|
4
|
+
*
|
|
5
|
+
* A row keeps its slot while it stays rendered. A row entering the window takes a
|
|
6
|
+
* slot freed by a row that left, so its DOM is updated in place rather than created.
|
|
7
|
+
* Rows are returned in slot order ("pool order"); the ADR 0001 addendum ruled out
|
|
8
|
+
* re-sorting them by row index, so assistive tech gets row positions from
|
|
9
|
+
* `aria-rowindex` instead.
|
|
10
|
+
*/
|
|
11
|
+
var RowPool = class {
|
|
12
|
+
#slots = /* @__PURE__ */ new Map();
|
|
13
|
+
#free = [];
|
|
14
|
+
#size = 0;
|
|
15
|
+
#pinned;
|
|
16
|
+
/** Number of slots created so far: the most rows rendered at once. */
|
|
17
|
+
get size() {
|
|
18
|
+
return this.#size;
|
|
19
|
+
}
|
|
20
|
+
/** The row id whose slot is kept while it is out of range, if any. */
|
|
21
|
+
get pinned() {
|
|
22
|
+
return this.#pinned;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Keeps one row's slot, and keeps it rendered, while it is outside the rendered
|
|
26
|
+
* range. Used for the row holding focus. `undefined` releases it.
|
|
27
|
+
*/
|
|
28
|
+
pin(id) {
|
|
29
|
+
this.#pinned = id;
|
|
30
|
+
}
|
|
31
|
+
/** The slot a row holds, or `undefined` when it isn't rendered. */
|
|
32
|
+
slotOf(id) {
|
|
33
|
+
return this.#slots.get(id);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Updates the pool for the rows that should be rendered and returns them, plus the
|
|
37
|
+
* pinned row if it isn't among them, in slot order.
|
|
38
|
+
*/
|
|
39
|
+
update(ids) {
|
|
40
|
+
const keep = new Set(ids);
|
|
41
|
+
if (this.#pinned !== void 0) keep.add(this.#pinned);
|
|
42
|
+
for (const [id, slot] of this.#slots) if (!keep.has(id)) {
|
|
43
|
+
this.#slots.delete(id);
|
|
44
|
+
this.#free.push(slot);
|
|
45
|
+
}
|
|
46
|
+
for (const id of keep) if (!this.#slots.has(id)) this.#slots.set(id, this.#free.pop() ?? this.#size++);
|
|
47
|
+
const entries = [];
|
|
48
|
+
for (const [id, slot] of this.#slots) entries.push({
|
|
49
|
+
id,
|
|
50
|
+
slot
|
|
51
|
+
});
|
|
52
|
+
return entries.sort((a, b) => a.slot - b.slot);
|
|
53
|
+
}
|
|
54
|
+
/** Frees every slot, for example when the data is replaced. */
|
|
55
|
+
clear() {
|
|
56
|
+
this.#slots.clear();
|
|
57
|
+
this.#free = [];
|
|
58
|
+
this.#size = 0;
|
|
59
|
+
this.#pinned = void 0;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export { RowPool };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=row-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-pool.js","names":[],"sources":["../../../../../core/src/virtual/row-pool.ts"],"sourcesContent":["/** A rendered row and the pool slot whose DOM it uses. */\nexport interface PoolEntry {\n id: string;\n slot: number;\n}\n\n/**\n * Assigns pool slots to rendered rows (ADR 0001).\n *\n * A row keeps its slot while it stays rendered. A row entering the window takes a\n * slot freed by a row that left, so its DOM is updated in place rather than created.\n * Rows are returned in slot order (\"pool order\"); the ADR 0001 addendum ruled out\n * re-sorting them by row index, so assistive tech gets row positions from\n * `aria-rowindex` instead.\n */\nexport class RowPool {\n #slots = new Map<string, number>();\n #free: number[] = [];\n #size = 0;\n #pinned: string | undefined;\n\n /** Number of slots created so far: the most rows rendered at once. */\n get size(): number {\n return this.#size;\n }\n\n /** The row id whose slot is kept while it is out of range, if any. */\n get pinned(): string | undefined {\n return this.#pinned;\n }\n\n /**\n * Keeps one row's slot, and keeps it rendered, while it is outside the rendered\n * range. Used for the row holding focus. `undefined` releases it.\n */\n pin(id: string | undefined): void {\n this.#pinned = id;\n }\n\n /** The slot a row holds, or `undefined` when it isn't rendered. */\n slotOf(id: string): number | undefined {\n return this.#slots.get(id);\n }\n\n /**\n * Updates the pool for the rows that should be rendered and returns them, plus the\n * pinned row if it isn't among them, in slot order.\n */\n update(ids: Iterable<string>): PoolEntry[] {\n const keep = new Set(ids);\n if (this.#pinned !== undefined) keep.add(this.#pinned);\n\n for (const [id, slot] of this.#slots) {\n if (!keep.has(id)) {\n this.#slots.delete(id);\n this.#free.push(slot);\n }\n }\n for (const id of keep) {\n if (!this.#slots.has(id)) this.#slots.set(id, this.#free.pop() ?? this.#size++);\n }\n\n const entries: PoolEntry[] = [];\n for (const [id, slot] of this.#slots) entries.push({ id, slot });\n return entries.sort((a, b) => a.slot - b.slot);\n }\n\n /** Frees every slot, for example when the data is replaced. */\n clear(): void {\n this.#slots.clear();\n this.#free = [];\n this.#size = 0;\n this.#pinned = undefined;\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAa,UAAb,MAAqB;CACnB,yBAAS,IAAI,IAAoB;CACjC,QAAkB,CAAC;CACnB,QAAQ;CACR;;CAGA,IAAI,OAAe;EACjB,OAAO,KAAK;CACd;;CAGA,IAAI,SAA6B;EAC/B,OAAO,KAAK;CACd;;;;;CAMA,IAAI,IAA8B;EAChC,KAAK,UAAU;CACjB;;CAGA,OAAO,IAAgC;EACrC,OAAO,KAAK,OAAO,IAAI,EAAE;CAC3B;;;;;CAMA,OAAO,KAAoC;EACzC,MAAM,OAAO,IAAI,IAAI,GAAG;EACxB,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,IAAI,KAAK,OAAO;EAErD,KAAK,MAAM,CAAC,IAAI,SAAS,KAAK,QAC5B,IAAI,CAAC,KAAK,IAAI,EAAE,GAAG;GACjB,KAAK,OAAO,OAAO,EAAE;GACrB,KAAK,MAAM,KAAK,IAAI;EACtB;EAEF,KAAK,MAAM,MAAM,MACf,IAAI,CAAC,KAAK,OAAO,IAAI,EAAE,GAAG,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO;EAGhF,MAAM,UAAuB,CAAC;EAC9B,KAAK,MAAM,CAAC,IAAI,SAAS,KAAK,QAAQ,QAAQ,KAAK;GAAE;GAAI;EAAK,CAAC;EAC/D,OAAO,QAAQ,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;CAC/C;;CAGA,QAAc;EACZ,KAAK,OAAO,MAAM;EAClB,KAAK,QAAQ,CAAC;EACd,KAAK,QAAQ;EACb,KAAK,UAAU,KAAA;CACjB;AACF"}
|