@suds-cli/table 0.0.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/README.md +29 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/keymap.d.ts +15 -0
- package/dist/keymap.d.ts.map +1 -0
- package/dist/keymap.js +37 -0
- package/dist/keymap.js.map +1 -0
- package/dist/model.d.ts +67 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +396 -0
- package/dist/model.js.map +1 -0
- package/dist/styles.d.ts +12 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +12 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @suds-cli/table
|
|
2
|
+
|
|
3
|
+
Tabular data display with scrolling and selection for Suds terminal UIs.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { TableModel } from "@suds-cli/table";
|
|
7
|
+
import { borderStyles } from "@suds-cli/chapstick";
|
|
8
|
+
|
|
9
|
+
const table = TableModel.new({
|
|
10
|
+
columns: [
|
|
11
|
+
{ title: "ID", width: 6 },
|
|
12
|
+
{ title: "Task", width: 20 },
|
|
13
|
+
{ title: "Status", width: 10 },
|
|
14
|
+
],
|
|
15
|
+
rows: [
|
|
16
|
+
["001", "Implement table", "Doing"],
|
|
17
|
+
["002", "Write docs", "Todo"],
|
|
18
|
+
],
|
|
19
|
+
height: 5,
|
|
20
|
+
focused: true,
|
|
21
|
+
bordered: true,
|
|
22
|
+
borderStyle: borderStyles.rounded,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log(table.view());
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { TableModel } from "./model.js";
|
|
2
|
+
export type { TableKeyMap } from "./keymap.js";
|
|
3
|
+
export { defaultKeyMap } from "./keymap.js";
|
|
4
|
+
export type { Column, Row, TableOptions } from "./types.js";
|
|
5
|
+
export type { TableStyles } from "./styles.js";
|
|
6
|
+
export { defaultStyles } from "./styles.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/keymap.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Binding } from "@suds-cli/key";
|
|
2
|
+
/** Key bindings for table navigation. @public */
|
|
3
|
+
export interface TableKeyMap {
|
|
4
|
+
lineUp: Binding;
|
|
5
|
+
lineDown: Binding;
|
|
6
|
+
pageUp: Binding;
|
|
7
|
+
pageDown: Binding;
|
|
8
|
+
halfPageUp: Binding;
|
|
9
|
+
halfPageDown: Binding;
|
|
10
|
+
gotoTop: Binding;
|
|
11
|
+
gotoBottom: Binding;
|
|
12
|
+
}
|
|
13
|
+
/** Default key bindings matching Bubble Tea tables. @public */
|
|
14
|
+
export declare const defaultKeyMap: TableKeyMap;
|
|
15
|
+
//# sourceMappingURL=keymap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAEzD,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,+DAA+D;AAC/D,eAAO,MAAM,aAAa,EAAE,WAiC3B,CAAC"}
|
package/dist/keymap.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { newBinding } from "@suds-cli/key";
|
|
2
|
+
/** Default key bindings matching Bubble Tea tables. @public */
|
|
3
|
+
export const defaultKeyMap = {
|
|
4
|
+
lineUp: newBinding({
|
|
5
|
+
keys: ["up", "k"],
|
|
6
|
+
help: { key: "↑/k", desc: "up" },
|
|
7
|
+
}),
|
|
8
|
+
lineDown: newBinding({
|
|
9
|
+
keys: ["down", "j"],
|
|
10
|
+
help: { key: "↓/j", desc: "down" },
|
|
11
|
+
}),
|
|
12
|
+
pageUp: newBinding({
|
|
13
|
+
keys: ["pgup", "b", "ctrl+u"],
|
|
14
|
+
help: { key: "pgup/b", desc: "page up" },
|
|
15
|
+
}),
|
|
16
|
+
pageDown: newBinding({
|
|
17
|
+
keys: ["pgdown", "f", "ctrl+d"],
|
|
18
|
+
help: { key: "pgdn/f", desc: "page down" },
|
|
19
|
+
}),
|
|
20
|
+
halfPageUp: newBinding({
|
|
21
|
+
keys: ["u"],
|
|
22
|
+
help: { key: "u", desc: "½ page up" },
|
|
23
|
+
}),
|
|
24
|
+
halfPageDown: newBinding({
|
|
25
|
+
keys: ["d"],
|
|
26
|
+
help: { key: "d", desc: "½ page down" },
|
|
27
|
+
}),
|
|
28
|
+
gotoTop: newBinding({
|
|
29
|
+
keys: ["home", "g"],
|
|
30
|
+
help: { key: "home/g", desc: "go to start" },
|
|
31
|
+
}),
|
|
32
|
+
gotoBottom: newBinding({
|
|
33
|
+
keys: ["end", "G"],
|
|
34
|
+
help: { key: "end/G", desc: "go to end" },
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=keymap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.js","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AAczD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,MAAM,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QACjB,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;KACjC,CAAC;IACF,QAAQ,EAAE,UAAU,CAAC;QACnB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;QACnB,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;KACnC,CAAC;IACF,MAAM,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC7B,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;KACzC,CAAC;IACF,QAAQ,EAAE,UAAU,CAAC;QACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC/B,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE;KAC3C,CAAC;IACF,UAAU,EAAE,UAAU,CAAC;QACrB,IAAI,EAAE,CAAC,GAAG,CAAC;QACX,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE;KACtC,CAAC;IACF,YAAY,EAAE,UAAU,CAAC;QACvB,IAAI,EAAE,CAAC,GAAG,CAAC;QACX,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE;KACxC,CAAC;IACF,OAAO,EAAE,UAAU,CAAC;QAClB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;QACnB,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE;KAC7C,CAAC;IACF,UAAU,EAAE,UAAU,CAAC;QACrB,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;QAClB,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE;KAC1C,CAAC;CACH,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Cmd, type Msg } from "@suds-cli/tea";
|
|
2
|
+
import { type TableKeyMap } from "./keymap.js";
|
|
3
|
+
import { type TableStyles } from "./styles.js";
|
|
4
|
+
import type { Column, Row, TableOptions } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Scrollable, selectable table model.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class TableModel {
|
|
10
|
+
readonly columns: Column[];
|
|
11
|
+
readonly rows: Row[];
|
|
12
|
+
readonly cursor: number;
|
|
13
|
+
readonly offset: number;
|
|
14
|
+
readonly focused: boolean;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
readonly width: number;
|
|
17
|
+
readonly autoWidth: boolean;
|
|
18
|
+
readonly keyMap: TableKeyMap;
|
|
19
|
+
readonly styles: TableStyles;
|
|
20
|
+
readonly bordered: boolean;
|
|
21
|
+
readonly columnWidths: number[];
|
|
22
|
+
private constructor();
|
|
23
|
+
/** Create a new table model. */
|
|
24
|
+
static new(options: TableOptions): TableModel;
|
|
25
|
+
/** Tea init hook (no-op). */
|
|
26
|
+
init(): Cmd<Msg>;
|
|
27
|
+
/** Handle key messages when focused. */
|
|
28
|
+
update(msg: Msg): [TableModel, Cmd<Msg>];
|
|
29
|
+
/** Render the header and visible rows as a string. */
|
|
30
|
+
view(): string;
|
|
31
|
+
/** Current selected row, if any. */
|
|
32
|
+
selectedRow(): Row | undefined;
|
|
33
|
+
/** Current selected index. */
|
|
34
|
+
selectedIndex(): number;
|
|
35
|
+
/** Replace columns. */
|
|
36
|
+
setColumns(columns: Column[]): TableModel;
|
|
37
|
+
/** Replace rows. */
|
|
38
|
+
setRows(rows: Row[]): TableModel;
|
|
39
|
+
/** Append a single row. */
|
|
40
|
+
appendRow(row: Row): TableModel;
|
|
41
|
+
/** Remove a row by index. */
|
|
42
|
+
removeRow(index: number): TableModel;
|
|
43
|
+
/** Set the selected index (clamped). */
|
|
44
|
+
setSelectedIndex(index: number): TableModel;
|
|
45
|
+
/** Move the cursor up by n rows. */
|
|
46
|
+
moveUp(n?: number): TableModel;
|
|
47
|
+
/** Move the cursor down by n rows. */
|
|
48
|
+
moveDown(n?: number): TableModel;
|
|
49
|
+
/** Jump to the first row. */
|
|
50
|
+
gotoTop(): TableModel;
|
|
51
|
+
/** Jump to the last row. */
|
|
52
|
+
gotoBottom(): TableModel;
|
|
53
|
+
/** Focus the table. */
|
|
54
|
+
focus(): TableModel;
|
|
55
|
+
/** Blur the table. */
|
|
56
|
+
blur(): TableModel;
|
|
57
|
+
/** Set the visible height (rows). */
|
|
58
|
+
setHeight(height: number): TableModel;
|
|
59
|
+
/** Set the total width. */
|
|
60
|
+
setWidth(width: number): TableModel;
|
|
61
|
+
private renderHeader;
|
|
62
|
+
private renderRow;
|
|
63
|
+
private renderEmptyRow;
|
|
64
|
+
private renderAllRows;
|
|
65
|
+
private with;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8K5D;;;GAGG;AACH,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAEhC,OAAO;IAeP,gCAAgC;IAChC,MAAM,CAAC,GAAG,CAAC,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@ -0,0 +1,396 @@
|
|
|
1
|
+
import { Style, borderStyles, defaultBorderStyle, joinHorizontal, width as textWidth, } from "@suds-cli/chapstick";
|
|
2
|
+
import { matches } from "@suds-cli/key";
|
|
3
|
+
import { KeyMsg } from "@suds-cli/tea";
|
|
4
|
+
import { defaultKeyMap } from "./keymap.js";
|
|
5
|
+
import { defaultStyles } from "./styles.js";
|
|
6
|
+
const ELLIPSIS = "…";
|
|
7
|
+
function clamp(value, min, max) {
|
|
8
|
+
if (Number.isNaN(value))
|
|
9
|
+
return min;
|
|
10
|
+
if (max < min)
|
|
11
|
+
return min;
|
|
12
|
+
return Math.min(max, Math.max(min, value));
|
|
13
|
+
}
|
|
14
|
+
function clampOffset(offset, rowCount, height, cursor) {
|
|
15
|
+
if (height <= 0)
|
|
16
|
+
return 0;
|
|
17
|
+
const maxOffset = Math.max(0, rowCount - height);
|
|
18
|
+
let nextOffset = clamp(offset, 0, maxOffset);
|
|
19
|
+
if (cursor < nextOffset) {
|
|
20
|
+
nextOffset = cursor;
|
|
21
|
+
}
|
|
22
|
+
else if (cursor >= nextOffset + height) {
|
|
23
|
+
nextOffset = Math.max(0, cursor - height + 1);
|
|
24
|
+
}
|
|
25
|
+
return nextOffset;
|
|
26
|
+
}
|
|
27
|
+
function truncateWithEllipsis(text, width) {
|
|
28
|
+
const target = Math.max(0, width);
|
|
29
|
+
if (target === 0)
|
|
30
|
+
return "";
|
|
31
|
+
if (textWidth(text) <= target)
|
|
32
|
+
return text;
|
|
33
|
+
if (target === 1)
|
|
34
|
+
return ELLIPSIS;
|
|
35
|
+
let acc = "";
|
|
36
|
+
for (const ch of text) {
|
|
37
|
+
if (textWidth(acc + ch) >= target) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
acc += ch;
|
|
41
|
+
if (textWidth(acc) === target - 1) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return `${acc}${ELLIPSIS}`;
|
|
46
|
+
}
|
|
47
|
+
function padToWidth(input, width) {
|
|
48
|
+
const current = textWidth(input);
|
|
49
|
+
const missing = Math.max(0, width - current);
|
|
50
|
+
return `${input}${" ".repeat(missing)}`;
|
|
51
|
+
}
|
|
52
|
+
function calculateColumnWidths(columns, totalWidth, bordered) {
|
|
53
|
+
const borderWidth = bordered ? columns.length + 1 : 0;
|
|
54
|
+
const available = Math.max(0, totalWidth - borderWidth);
|
|
55
|
+
const fixed = columns.map((c) => Math.max(0, c.width));
|
|
56
|
+
const totalFixed = fixed.reduce((a, b) => a + b, 0);
|
|
57
|
+
if (totalFixed > available && totalFixed > 0) {
|
|
58
|
+
const scale = available / totalFixed;
|
|
59
|
+
return fixed.map((w) => Math.max(0, Math.floor(w * scale)));
|
|
60
|
+
}
|
|
61
|
+
return fixed;
|
|
62
|
+
}
|
|
63
|
+
function mergeKeyMap(base, overrides) {
|
|
64
|
+
return {
|
|
65
|
+
lineUp: overrides?.lineUp ?? base.lineUp,
|
|
66
|
+
lineDown: overrides?.lineDown ?? base.lineDown,
|
|
67
|
+
pageUp: overrides?.pageUp ?? base.pageUp,
|
|
68
|
+
pageDown: overrides?.pageDown ?? base.pageDown,
|
|
69
|
+
halfPageUp: overrides?.halfPageUp ?? base.halfPageUp,
|
|
70
|
+
halfPageDown: overrides?.halfPageDown ?? base.halfPageDown,
|
|
71
|
+
gotoTop: overrides?.gotoTop ?? base.gotoTop,
|
|
72
|
+
gotoBottom: overrides?.gotoBottom ?? base.gotoBottom,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function mergeStyles(overrides, borderStyleOverride) {
|
|
76
|
+
const base = defaultStyles();
|
|
77
|
+
const merged = {
|
|
78
|
+
...base,
|
|
79
|
+
...overrides,
|
|
80
|
+
};
|
|
81
|
+
if (borderStyleOverride) {
|
|
82
|
+
merged.borderStyle = borderStyleOverride;
|
|
83
|
+
}
|
|
84
|
+
else if (!merged.borderStyle) {
|
|
85
|
+
merged.borderStyle = defaultBorderStyle;
|
|
86
|
+
}
|
|
87
|
+
return merged;
|
|
88
|
+
}
|
|
89
|
+
function totalColumnWidth(columns, bordered) {
|
|
90
|
+
const base = columns.reduce((sum, col) => sum + Math.max(0, col.width), 0);
|
|
91
|
+
return bordered ? base + Math.max(0, columns.length - 1) : base;
|
|
92
|
+
}
|
|
93
|
+
function _innerWidthFrom(widths, bordered, columnCount) {
|
|
94
|
+
const base = widths.reduce((sum, w) => sum + Math.max(0, w), 0);
|
|
95
|
+
return bordered ? base + Math.max(0, columnCount - 1) : base;
|
|
96
|
+
}
|
|
97
|
+
/** Create a fixed-width cell (like lipgloss Width+MaxWidth+Inline). */
|
|
98
|
+
function fixedWidthCell(text, width) {
|
|
99
|
+
if (width <= 0)
|
|
100
|
+
return "";
|
|
101
|
+
const truncated = truncateWithEllipsis(text, width);
|
|
102
|
+
// Use alignHorizontal to ensure padding to target width
|
|
103
|
+
return new Style()
|
|
104
|
+
.width(width)
|
|
105
|
+
.maxWidth(width)
|
|
106
|
+
.alignHorizontal("left")
|
|
107
|
+
.inline(true)
|
|
108
|
+
.render(truncated);
|
|
109
|
+
}
|
|
110
|
+
function _verticalChar(styles) {
|
|
111
|
+
return styles.borderStyle?.left ?? borderStyles.normal.left;
|
|
112
|
+
}
|
|
113
|
+
function wrapWithBorder(line, innerWidth, styles) {
|
|
114
|
+
const width = Math.max(0, innerWidth);
|
|
115
|
+
const padded = padToWidth(line, width);
|
|
116
|
+
const wrapped = `${styles.borderStyle.left}${padded}${styles.borderStyle.right}`;
|
|
117
|
+
return styles.border.render(wrapped);
|
|
118
|
+
}
|
|
119
|
+
function renderTopBorder(innerWidth, styles) {
|
|
120
|
+
const line = `${styles.borderStyle.topLeft}${styles.borderStyle.top.repeat(Math.max(0, innerWidth))}${styles.borderStyle.topRight}`;
|
|
121
|
+
return styles.border.render(line);
|
|
122
|
+
}
|
|
123
|
+
function renderSeparator(innerWidth, styles) {
|
|
124
|
+
const line = `${styles.borderStyle.left}${styles.borderStyle.top.repeat(Math.max(0, innerWidth))}${styles.borderStyle.right}`;
|
|
125
|
+
return styles.border.render(line);
|
|
126
|
+
}
|
|
127
|
+
function renderBottomBorder(innerWidth, styles) {
|
|
128
|
+
const line = `${styles.borderStyle.bottomLeft}${styles.borderStyle.bottom.repeat(Math.max(0, innerWidth))}${styles.borderStyle.bottomRight}`;
|
|
129
|
+
return styles.border.render(line);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Scrollable, selectable table model.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export class TableModel {
|
|
136
|
+
columns;
|
|
137
|
+
rows;
|
|
138
|
+
cursor;
|
|
139
|
+
offset;
|
|
140
|
+
focused;
|
|
141
|
+
height;
|
|
142
|
+
width;
|
|
143
|
+
autoWidth;
|
|
144
|
+
keyMap;
|
|
145
|
+
styles;
|
|
146
|
+
bordered;
|
|
147
|
+
columnWidths;
|
|
148
|
+
constructor(state) {
|
|
149
|
+
this.columns = state.columns;
|
|
150
|
+
this.rows = state.rows;
|
|
151
|
+
this.cursor = state.cursor;
|
|
152
|
+
this.offset = state.offset;
|
|
153
|
+
this.focused = state.focused;
|
|
154
|
+
this.height = state.height;
|
|
155
|
+
this.width = state.width;
|
|
156
|
+
this.autoWidth = state.autoWidth;
|
|
157
|
+
this.keyMap = state.keyMap;
|
|
158
|
+
this.styles = state.styles;
|
|
159
|
+
this.bordered = state.bordered;
|
|
160
|
+
this.columnWidths = state.columnWidths;
|
|
161
|
+
}
|
|
162
|
+
/** Create a new table model. */
|
|
163
|
+
static new(options) {
|
|
164
|
+
const rows = [...(options.rows ?? [])];
|
|
165
|
+
const bordered = options.bordered ?? false;
|
|
166
|
+
const styles = mergeStyles(options.styles, options.borderStyle);
|
|
167
|
+
const width = options.width ?? totalColumnWidth(options.columns, bordered) ?? 0;
|
|
168
|
+
const autoWidth = options.width === undefined;
|
|
169
|
+
const height = Math.max(0, options.height ?? rows.length);
|
|
170
|
+
const columnWidths = autoWidth
|
|
171
|
+
? options.columns.map((c) => Math.max(0, c.width))
|
|
172
|
+
: calculateColumnWidths(options.columns, width, bordered);
|
|
173
|
+
const cursor = clamp(options.focused ? 0 : 0, 0, Math.max(rows.length - 1, 0));
|
|
174
|
+
const offset = clampOffset(0, rows.length, height, cursor);
|
|
175
|
+
return new TableModel({
|
|
176
|
+
columns: [...options.columns],
|
|
177
|
+
rows,
|
|
178
|
+
cursor,
|
|
179
|
+
offset,
|
|
180
|
+
focused: options.focused ?? false,
|
|
181
|
+
height,
|
|
182
|
+
width,
|
|
183
|
+
autoWidth,
|
|
184
|
+
keyMap: mergeKeyMap(defaultKeyMap, options.keyMap),
|
|
185
|
+
styles,
|
|
186
|
+
bordered,
|
|
187
|
+
columnWidths,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** Tea init hook (no-op). */
|
|
191
|
+
init() {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
/** Handle key messages when focused. */
|
|
195
|
+
update(msg) {
|
|
196
|
+
if (!this.focused || !(msg instanceof KeyMsg)) {
|
|
197
|
+
return [this, null];
|
|
198
|
+
}
|
|
199
|
+
if (matches(msg, this.keyMap.lineUp)) {
|
|
200
|
+
return [this.moveUp(1), null];
|
|
201
|
+
}
|
|
202
|
+
if (matches(msg, this.keyMap.lineDown)) {
|
|
203
|
+
return [this.moveDown(1), null];
|
|
204
|
+
}
|
|
205
|
+
if (matches(msg, this.keyMap.pageUp)) {
|
|
206
|
+
return [this.moveUp(this.height || 1), null];
|
|
207
|
+
}
|
|
208
|
+
if (matches(msg, this.keyMap.pageDown)) {
|
|
209
|
+
return [this.moveDown(this.height || 1), null];
|
|
210
|
+
}
|
|
211
|
+
if (matches(msg, this.keyMap.halfPageUp)) {
|
|
212
|
+
return [this.moveUp(Math.max(1, Math.floor(this.height / 2))), null];
|
|
213
|
+
}
|
|
214
|
+
if (matches(msg, this.keyMap.halfPageDown)) {
|
|
215
|
+
return [this.moveDown(Math.max(1, Math.floor(this.height / 2))), null];
|
|
216
|
+
}
|
|
217
|
+
if (matches(msg, this.keyMap.gotoTop)) {
|
|
218
|
+
return [this.gotoTop(), null];
|
|
219
|
+
}
|
|
220
|
+
if (matches(msg, this.keyMap.gotoBottom)) {
|
|
221
|
+
return [this.gotoBottom(), null];
|
|
222
|
+
}
|
|
223
|
+
return [this, null];
|
|
224
|
+
}
|
|
225
|
+
/** Render the header and visible rows as a string. */
|
|
226
|
+
view() {
|
|
227
|
+
const header = this.renderHeader();
|
|
228
|
+
const headerWidth = textWidth(header);
|
|
229
|
+
const start = this.offset;
|
|
230
|
+
const end = Math.min(start + this.height, this.rows.length);
|
|
231
|
+
const visibleRows = this.renderAllRows().slice(start, end);
|
|
232
|
+
// Pad with empty rows if needed
|
|
233
|
+
const paddedRows = [...visibleRows];
|
|
234
|
+
while (paddedRows.length < this.height) {
|
|
235
|
+
paddedRows.push(this.renderEmptyRow());
|
|
236
|
+
}
|
|
237
|
+
// Calculate inner width for borders (max of header and all rows)
|
|
238
|
+
const rowWidth = paddedRows.length > 0 ? textWidth(paddedRows[0] ?? "") : 0;
|
|
239
|
+
const innerWidth = Math.max(headerWidth, rowWidth);
|
|
240
|
+
if (!this.bordered) {
|
|
241
|
+
return [
|
|
242
|
+
padToWidth(header, innerWidth),
|
|
243
|
+
...paddedRows.map((r) => padToWidth(r, innerWidth)),
|
|
244
|
+
].join("\n");
|
|
245
|
+
}
|
|
246
|
+
const wrap = (line) => wrapWithBorder(line, innerWidth, this.styles);
|
|
247
|
+
return [
|
|
248
|
+
renderTopBorder(innerWidth, this.styles),
|
|
249
|
+
wrap(padToWidth(header, innerWidth)),
|
|
250
|
+
renderSeparator(innerWidth, this.styles),
|
|
251
|
+
...paddedRows.map((r) => wrap(padToWidth(r, innerWidth))),
|
|
252
|
+
renderBottomBorder(innerWidth, this.styles),
|
|
253
|
+
].join("\n");
|
|
254
|
+
}
|
|
255
|
+
/** Current selected row, if any. */
|
|
256
|
+
selectedRow() {
|
|
257
|
+
if (this.rows.length === 0)
|
|
258
|
+
return undefined;
|
|
259
|
+
return this.rows[this.cursor];
|
|
260
|
+
}
|
|
261
|
+
/** Current selected index. */
|
|
262
|
+
selectedIndex() {
|
|
263
|
+
return this.cursor;
|
|
264
|
+
}
|
|
265
|
+
/** Replace columns. */
|
|
266
|
+
setColumns(columns) {
|
|
267
|
+
return this.with({
|
|
268
|
+
columns: [...columns],
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/** Replace rows. */
|
|
272
|
+
setRows(rows) {
|
|
273
|
+
return this.with({
|
|
274
|
+
rows: [...rows],
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** Append a single row. */
|
|
278
|
+
appendRow(row) {
|
|
279
|
+
return this.setRows([...this.rows, row]);
|
|
280
|
+
}
|
|
281
|
+
/** Remove a row by index. */
|
|
282
|
+
removeRow(index) {
|
|
283
|
+
if (index < 0 || index >= this.rows.length)
|
|
284
|
+
return this;
|
|
285
|
+
const next = [...this.rows];
|
|
286
|
+
next.splice(index, 1);
|
|
287
|
+
return this.setRows(next);
|
|
288
|
+
}
|
|
289
|
+
/** Set the selected index (clamped). */
|
|
290
|
+
setSelectedIndex(index) {
|
|
291
|
+
return this.with({ cursor: index });
|
|
292
|
+
}
|
|
293
|
+
/** Move the cursor up by n rows. */
|
|
294
|
+
moveUp(n = 1) {
|
|
295
|
+
const delta = Math.max(1, n);
|
|
296
|
+
return this.with({ cursor: this.cursor - delta });
|
|
297
|
+
}
|
|
298
|
+
/** Move the cursor down by n rows. */
|
|
299
|
+
moveDown(n = 1) {
|
|
300
|
+
const delta = Math.max(1, n);
|
|
301
|
+
return this.with({ cursor: this.cursor + delta });
|
|
302
|
+
}
|
|
303
|
+
/** Jump to the first row. */
|
|
304
|
+
gotoTop() {
|
|
305
|
+
return this.with({ cursor: 0 });
|
|
306
|
+
}
|
|
307
|
+
/** Jump to the last row. */
|
|
308
|
+
gotoBottom() {
|
|
309
|
+
return this.with({ cursor: this.rows.length - 1 });
|
|
310
|
+
}
|
|
311
|
+
/** Focus the table. */
|
|
312
|
+
focus() {
|
|
313
|
+
if (this.focused)
|
|
314
|
+
return this;
|
|
315
|
+
return this.with({ focused: true });
|
|
316
|
+
}
|
|
317
|
+
/** Blur the table. */
|
|
318
|
+
blur() {
|
|
319
|
+
if (!this.focused)
|
|
320
|
+
return this;
|
|
321
|
+
return this.with({ focused: false });
|
|
322
|
+
}
|
|
323
|
+
/** Set the visible height (rows). */
|
|
324
|
+
setHeight(height) {
|
|
325
|
+
return this.with({ height });
|
|
326
|
+
}
|
|
327
|
+
/** Set the total width. */
|
|
328
|
+
setWidth(width) {
|
|
329
|
+
return this.with({ width });
|
|
330
|
+
}
|
|
331
|
+
renderHeader() {
|
|
332
|
+
// Match Go: fixed-width cell → header style (with padding) → joinHorizontal
|
|
333
|
+
const cells = this.columns.map((col, i) => {
|
|
334
|
+
const width = this.columnWidths[i] ?? col.width;
|
|
335
|
+
const fixedCell = fixedWidthCell(col.title, width);
|
|
336
|
+
return this.styles.header.render(fixedCell);
|
|
337
|
+
});
|
|
338
|
+
return joinHorizontal(...cells);
|
|
339
|
+
}
|
|
340
|
+
renderRow(row, index) {
|
|
341
|
+
// Match Go: fixed-width cell → cell style (with padding) → join → selected wraps whole row
|
|
342
|
+
const isSelected = this.focused && index === this.cursor;
|
|
343
|
+
const cells = this.columns.map((col, i) => {
|
|
344
|
+
const width = this.columnWidths[i] ?? col.width;
|
|
345
|
+
const value = row[i] ?? "";
|
|
346
|
+
const fixedCell = fixedWidthCell(value, width);
|
|
347
|
+
return this.styles.cell.render(fixedCell);
|
|
348
|
+
});
|
|
349
|
+
const joined = joinHorizontal(...cells);
|
|
350
|
+
// Selected style wraps the entire row (just colors, no padding change)
|
|
351
|
+
if (isSelected) {
|
|
352
|
+
return this.styles.selected.render(joined);
|
|
353
|
+
}
|
|
354
|
+
return joined;
|
|
355
|
+
}
|
|
356
|
+
renderEmptyRow() {
|
|
357
|
+
// Same as renderRow but with empty content
|
|
358
|
+
const cells = this.columns.map((col, i) => {
|
|
359
|
+
const width = this.columnWidths[i] ?? col.width;
|
|
360
|
+
const fixedCell = fixedWidthCell("", width);
|
|
361
|
+
return this.styles.cell.render(fixedCell);
|
|
362
|
+
});
|
|
363
|
+
return joinHorizontal(...cells);
|
|
364
|
+
}
|
|
365
|
+
renderAllRows() {
|
|
366
|
+
return this.rows.map((row, i) => this.renderRow(row, i));
|
|
367
|
+
}
|
|
368
|
+
with(patch) {
|
|
369
|
+
const nextColumns = patch.columns ?? this.columns;
|
|
370
|
+
const nextRows = patch.rows ?? this.rows;
|
|
371
|
+
const nextHeight = patch.height ?? this.height;
|
|
372
|
+
const nextWidth = patch.width ?? this.width;
|
|
373
|
+
const autoWidth = patch.width !== undefined ? false : this.autoWidth;
|
|
374
|
+
const nextBordered = patch.bordered ?? this.bordered;
|
|
375
|
+
const nextColumnWidths = autoWidth
|
|
376
|
+
? nextColumns.map((c) => Math.max(0, c.width))
|
|
377
|
+
: calculateColumnWidths(nextColumns, nextWidth, nextBordered);
|
|
378
|
+
const cursor = clamp(patch.cursor ?? this.cursor, 0, Math.max(nextRows.length - 1, 0));
|
|
379
|
+
const offset = clampOffset(patch.offset ?? this.offset, nextRows.length, nextHeight, cursor);
|
|
380
|
+
return new TableModel({
|
|
381
|
+
columns: [...nextColumns],
|
|
382
|
+
rows: [...nextRows],
|
|
383
|
+
cursor,
|
|
384
|
+
offset,
|
|
385
|
+
focused: patch.focused ?? this.focused,
|
|
386
|
+
height: Math.max(0, nextHeight),
|
|
387
|
+
width: Math.max(0, nextWidth),
|
|
388
|
+
autoWidth,
|
|
389
|
+
keyMap: patch.keyMap ?? this.keyMap,
|
|
390
|
+
styles: patch.styles ?? this.styles,
|
|
391
|
+
bordered: nextBordered,
|
|
392
|
+
columnWidths: nextColumnWidths,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC;YAC7B,SAAS;YACT,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM;YACnC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM;YACnC,QAAQ,EAAE,YAAY;YACtB,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Style, type BorderStyle } from "@suds-cli/chapstick";
|
|
2
|
+
/** Styles applied to parts of the table. @public */
|
|
3
|
+
export interface TableStyles {
|
|
4
|
+
header: Style;
|
|
5
|
+
cell: Style;
|
|
6
|
+
selected: Style;
|
|
7
|
+
border: Style;
|
|
8
|
+
borderStyle: BorderStyle;
|
|
9
|
+
}
|
|
10
|
+
/** Default table styles. @public */
|
|
11
|
+
export declare function defaultStyles(): TableStyles;
|
|
12
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5E,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,KAAK,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,oCAAoC;AACpC,wBAAgB,aAAa,IAAI,WAAW,CAQ3C"}
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Style, borderStyles } from "@suds-cli/chapstick";
|
|
2
|
+
/** Default table styles. @public */
|
|
3
|
+
export function defaultStyles() {
|
|
4
|
+
return {
|
|
5
|
+
header: new Style().bold(true).padding(0, 1),
|
|
6
|
+
cell: new Style().padding(0, 1),
|
|
7
|
+
selected: new Style().background("#7D56F4").foreground("#FFFFFF"),
|
|
8
|
+
border: new Style().foreground("#383838"),
|
|
9
|
+
borderStyle: borderStyles.normal,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAW5E,oCAAoC;AACpC,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/B,QAAQ,EAAE,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;QACjE,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;QACzC,WAAW,EAAE,YAAY,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BorderStyle } from "@suds-cli/chapstick";
|
|
2
|
+
import type { TableKeyMap } from "./keymap.js";
|
|
3
|
+
import type { TableStyles } from "./styles.js";
|
|
4
|
+
/** Column definition for a table. @public */
|
|
5
|
+
export interface Column {
|
|
6
|
+
title: string;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
/** Row data. Each entry corresponds to a column. @public */
|
|
10
|
+
export type Row = string[];
|
|
11
|
+
/** Options for creating a table. @public */
|
|
12
|
+
export interface TableOptions {
|
|
13
|
+
columns: Column[];
|
|
14
|
+
rows?: Row[];
|
|
15
|
+
height?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
focused?: boolean;
|
|
18
|
+
styles?: Partial<TableStyles>;
|
|
19
|
+
keyMap?: Partial<TableKeyMap>;
|
|
20
|
+
bordered?: boolean;
|
|
21
|
+
borderStyle?: BorderStyle;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,6CAA6C;AAC7C,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4DAA4D;AAC5D,MAAM,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AAE3B,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suds-cli/table",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Tabular data display with scrolling and selection for Suds",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@suds-cli/chapstick": "0.0.0",
|
|
13
|
+
"@suds-cli/key": "0.0.0",
|
|
14
|
+
"@suds-cli/tea": "0.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "5.8.2",
|
|
18
|
+
"vitest": "^4.0.15"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"build": "pnpm run clean && tsc -p ./tsconfig.json",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"generate:api-report": "api-extractor run --local",
|
|
28
|
+
"check:api-report": "pnpm run generate:api-report",
|
|
29
|
+
"check:eslint": "pnpm run lint",
|
|
30
|
+
"lint": "eslint \"{src,test}/**/*.{ts,tsx}\""
|
|
31
|
+
}
|
|
32
|
+
}
|