@crazyhappyone/dsh-tui 0.1.0-alpha.24 → 0.1.0-alpha.26
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/dist/index.js +21 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9530,22 +9530,34 @@ function fieldRow(label, value, selected, columns) {
|
|
|
9530
9530
|
...fittedValue === "" ? [] : [styled(fittedValue, "fgDim")]
|
|
9531
9531
|
];
|
|
9532
9532
|
}
|
|
9533
|
+
function computeSettingsWindow(maxRows, totalRows, errorReason) {
|
|
9534
|
+
if (maxRows === void 0) return SETTINGS_WINDOW;
|
|
9535
|
+
const errorLines = errorReason === void 0 ? 0 : errorReason === EMPTY_TABLE_REASON2 ? 1 : 2;
|
|
9536
|
+
const fixedOverhead = 2 + errorLines;
|
|
9537
|
+
const available = Math.max(1, maxRows - fixedOverhead);
|
|
9538
|
+
if (totalRows <= available) {
|
|
9539
|
+
return totalRows;
|
|
9540
|
+
}
|
|
9541
|
+
return Math.max(1, available - 2);
|
|
9542
|
+
}
|
|
9533
9543
|
function SettingsPane({
|
|
9534
9544
|
rows,
|
|
9535
9545
|
selectedIndex,
|
|
9536
9546
|
editing,
|
|
9537
9547
|
onboarding,
|
|
9538
9548
|
updateError,
|
|
9539
|
-
locale
|
|
9549
|
+
locale,
|
|
9550
|
+
maxRows
|
|
9540
9551
|
}) {
|
|
9541
9552
|
const { columns } = useWindowSize5();
|
|
9542
9553
|
const width = columns > 0 ? columns : 80;
|
|
9543
9554
|
const errorReason = updateError ?? (rows.length === 0 ? EMPTY_TABLE_REASON2 : void 0);
|
|
9544
9555
|
const footnote = onboarding === true ? ONBOARDING_FOOTNOTE : editing ? EDIT_FOOTNOTE : FOOTNOTE2;
|
|
9545
|
-
const
|
|
9546
|
-
const
|
|
9547
|
-
|
|
9548
|
-
|
|
9556
|
+
const windowLimit = computeSettingsWindow(maxRows, rows.length, errorReason);
|
|
9557
|
+
const size = Math.min(windowLimit, rows.length);
|
|
9558
|
+
const start = rows.length <= size ? 0 : Math.min(
|
|
9559
|
+
Math.max(0, selectedIndex - Math.floor(size / 2)),
|
|
9560
|
+
rows.length - size
|
|
9549
9561
|
);
|
|
9550
9562
|
const visible = rows.slice(start, start + size);
|
|
9551
9563
|
return /* @__PURE__ */ jsxs12(Box13, { flexDirection: "column", width: "100%", children: [
|
|
@@ -12955,11 +12967,14 @@ function TuiLoop({
|
|
|
12955
12967
|
switchError: permissionPane.switchError
|
|
12956
12968
|
});
|
|
12957
12969
|
} else if (settingsPane.open) {
|
|
12970
|
+
const settingsEditingRows = settingsPane.editing ? state.text.split("\n").length + 1 : 0;
|
|
12971
|
+
const settingsMaxRows = Math.max(4, rows - 3 - statusRowCount - settingsEditingRows);
|
|
12958
12972
|
content = createElement2(SettingsPane, {
|
|
12959
12973
|
locale,
|
|
12960
12974
|
rows: settingsPane.rows,
|
|
12961
12975
|
selectedIndex: settingsPane.selectedIndex,
|
|
12962
12976
|
editing: settingsPane.editing,
|
|
12977
|
+
maxRows: settingsMaxRows,
|
|
12963
12978
|
...settingsPane.onboarding === void 0 ? {} : { onboarding: settingsPane.onboarding },
|
|
12964
12979
|
...settingsPane.updateError === void 0 ? {} : { updateError: settingsPane.updateError }
|
|
12965
12980
|
});
|
|
@@ -13825,6 +13840,7 @@ export {
|
|
|
13825
13840
|
completeFirst,
|
|
13826
13841
|
composerCursorPosition,
|
|
13827
13842
|
composerFrameAnchor,
|
|
13843
|
+
computeSettingsWindow,
|
|
13828
13844
|
conversationLeft,
|
|
13829
13845
|
conversationWidth,
|
|
13830
13846
|
copyText,
|