@simon_he/vue-tui 1.0.0 → 1.0.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/dist/{TSelect-BwJJbuTt.js → TSelect-HzILuti9.js} +89 -40
- package/dist/{TTree-DK_DQBYm.js → TTree-ChOot2Bh.js} +108 -26
- package/dist/agent.cjs +673 -165
- package/dist/agent.js +2 -2
- package/dist/experimental.cjs +583 -121
- package/dist/experimental.js +1 -1
- package/dist/index.cjs +215 -76
- package/dist/index.js +2 -2
- package/dist/{tlog-theme-qPBt5rge.js → tlog-theme-CvLFNMwk.js} +539 -100
- package/dist/vue/components/TVirtualRows.d.ts +18 -0
- package/dist/vue/transcript/types.d.ts +4 -0
- package/dist/vue.cjs +215 -76
- package/dist/vue.js +2 -2
- package/package.json +6 -5
package/dist/experimental.js
CHANGED
|
@@ -4,7 +4,7 @@ import "./wheel-scroll-vBRaQ7p-.js";
|
|
|
4
4
|
import "./linkify-D_gzn9Xq.js";
|
|
5
5
|
import "./terminal-selection-DBinO6p5.js";
|
|
6
6
|
import "./frame-perf-C6Xfg85O.js";
|
|
7
|
-
import { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TTranscriptView, TVirtualList, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults } from "./tlog-theme-
|
|
7
|
+
import { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TTranscriptView, TVirtualList, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults } from "./tlog-theme-CvLFNMwk.js";
|
|
8
8
|
import { ref } from "vue";
|
|
9
9
|
|
|
10
10
|
//#region src/vue/log/tlog-session.ts
|
package/dist/index.cjs
CHANGED
|
@@ -14463,22 +14463,40 @@ function normalizeVisibleLimit(value) {
|
|
|
14463
14463
|
function isCommandPaletteRowSelectable(item) {
|
|
14464
14464
|
return Boolean(item && item.kind !== "separator" && item.kind !== "group" && !item.disabled);
|
|
14465
14465
|
}
|
|
14466
|
-
function
|
|
14467
|
-
const q = query.trim()
|
|
14468
|
-
if (!q)
|
|
14469
|
-
return
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14466
|
+
function defaultSubstringEntries(sourceItems, query) {
|
|
14467
|
+
const q = query.trim();
|
|
14468
|
+
if (!q) {
|
|
14469
|
+
return sourceItems.map((item, sourceIndex) => ({
|
|
14470
|
+
item,
|
|
14471
|
+
sourceIndex,
|
|
14472
|
+
match: { score: 0 }
|
|
14473
|
+
}));
|
|
14474
|
+
}
|
|
14475
|
+
const needle = q.toLowerCase();
|
|
14476
|
+
const labelMatches = [];
|
|
14477
|
+
const detailMatches = [];
|
|
14478
|
+
const keywordMatches = [];
|
|
14479
|
+
for (let sourceIndex = 0; sourceIndex < sourceItems.length; sourceIndex++) {
|
|
14480
|
+
const item = sourceItems[sourceIndex];
|
|
14481
|
+
if (item.kind === "separator" || item.kind === "group")
|
|
14482
|
+
continue;
|
|
14483
|
+
const label = String(item.label ?? "");
|
|
14484
|
+
const detail = item.detail == null ? "" : String(item.detail);
|
|
14485
|
+
if (label.toLowerCase().includes(needle)) {
|
|
14486
|
+
labelMatches.push({ item, sourceIndex, match: { score: 100 } });
|
|
14487
|
+
continue;
|
|
14488
|
+
}
|
|
14489
|
+
if (detail.toLowerCase().includes(needle)) {
|
|
14490
|
+
detailMatches.push({ item, sourceIndex, match: { score: 50 } });
|
|
14491
|
+
continue;
|
|
14492
|
+
}
|
|
14493
|
+
if ((item.keywords ?? []).some(
|
|
14494
|
+
(keyword) => String(keyword ?? "").toLowerCase().includes(needle)
|
|
14495
|
+
)) {
|
|
14496
|
+
keywordMatches.push({ item, sourceIndex, match: { score: 10 } });
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14499
|
+
return labelMatches.concat(detailMatches, keywordMatches);
|
|
14482
14500
|
}
|
|
14483
14501
|
function fuzzyMatcher(item, query) {
|
|
14484
14502
|
const q = query.trim().toLowerCase();
|
|
@@ -14646,14 +14664,22 @@ var TCommandPalette = (0, import_vue20.defineComponent)({
|
|
|
14646
14664
|
const filteredEntries = (0, import_vue20.computed)(() => {
|
|
14647
14665
|
const q = query.value.trim();
|
|
14648
14666
|
const sourceItems = props.itemsProvider ? providerItems.value ?? [] : props.items;
|
|
14649
|
-
|
|
14650
|
-
|
|
14667
|
+
if (!props.matcher && props.filterStrategy === "substring") {
|
|
14668
|
+
return defaultSubstringEntries(sourceItems, q);
|
|
14669
|
+
}
|
|
14670
|
+
const matcher = props.matcher ?? fuzzyMatcher;
|
|
14671
|
+
const entries = [];
|
|
14672
|
+
for (let sourceIndex = 0; sourceIndex < sourceItems.length; sourceIndex++) {
|
|
14673
|
+
const item = sourceItems[sourceIndex];
|
|
14651
14674
|
if (item.kind === "separator" || item.kind === "group") {
|
|
14652
|
-
|
|
14675
|
+
if (!q)
|
|
14676
|
+
entries.push({ item, sourceIndex, match: { score: 0 } });
|
|
14677
|
+
continue;
|
|
14653
14678
|
}
|
|
14654
14679
|
const match = matcher(item, q);
|
|
14655
|
-
|
|
14656
|
-
|
|
14680
|
+
if (match)
|
|
14681
|
+
entries.push({ item, sourceIndex, match });
|
|
14682
|
+
}
|
|
14657
14683
|
entries.sort((a, b) => b.match.score - a.match.score || a.sourceIndex - b.sourceIndex);
|
|
14658
14684
|
return entries;
|
|
14659
14685
|
});
|
|
@@ -15273,6 +15299,20 @@ function rowKey(row, index, key) {
|
|
|
15273
15299
|
function sameRowKey(a, b) {
|
|
15274
15300
|
return Object.is(a, b);
|
|
15275
15301
|
}
|
|
15302
|
+
function selectedRowKeyIndex(keys) {
|
|
15303
|
+
if (!keys?.length)
|
|
15304
|
+
return null;
|
|
15305
|
+
const indexed = /* @__PURE__ */ new Set();
|
|
15306
|
+
for (let index = 0; index < keys.length; index++) {
|
|
15307
|
+
if (!(index in keys))
|
|
15308
|
+
continue;
|
|
15309
|
+
const key = keys[index];
|
|
15310
|
+
if (typeof key === "number" && key === 0)
|
|
15311
|
+
return null;
|
|
15312
|
+
indexed.add(key);
|
|
15313
|
+
}
|
|
15314
|
+
return indexed;
|
|
15315
|
+
}
|
|
15276
15316
|
var TTable = (0, import_vue21.defineComponent)({
|
|
15277
15317
|
name: "TTable",
|
|
15278
15318
|
props: {
|
|
@@ -15345,10 +15385,22 @@ var TTable = (0, import_vue21.defineComponent)({
|
|
|
15345
15385
|
const activeRowStyle = (0, import_vue21.computed)(
|
|
15346
15386
|
() => mergeStyle(theme.value.components.TTable?.activeStyle, props.activeStyle)
|
|
15347
15387
|
);
|
|
15388
|
+
const selectedRowKeysIndex = (0, import_vue21.computed)(() => selectedRowKeyIndex(props.selectedRowKeys));
|
|
15348
15389
|
const bodyRows = (0, import_vue21.computed)(() => {
|
|
15349
15390
|
const top = props.header ? 2 : 0;
|
|
15350
15391
|
return props.rows.slice(0, Math.max(0, props.h - top));
|
|
15351
15392
|
});
|
|
15393
|
+
function isRowSelected(key) {
|
|
15394
|
+
if (props.selectedRowKey !== void 0 && sameRowKey(key, props.selectedRowKey))
|
|
15395
|
+
return true;
|
|
15396
|
+
const selectedKeys = props.selectedRowKeys;
|
|
15397
|
+
if (!selectedKeys?.length)
|
|
15398
|
+
return false;
|
|
15399
|
+
const indexed = selectedRowKeysIndex.value;
|
|
15400
|
+
if (indexed)
|
|
15401
|
+
return indexed.has(key);
|
|
15402
|
+
return selectedKeys.some((candidate) => sameRowKey(candidate, key));
|
|
15403
|
+
}
|
|
15352
15404
|
return () => {
|
|
15353
15405
|
const children = [];
|
|
15354
15406
|
if (props.header && props.h > 0) {
|
|
@@ -15426,7 +15478,7 @@ var TTable = (0, import_vue21.defineComponent)({
|
|
|
15426
15478
|
const row = bodyRows.value[index];
|
|
15427
15479
|
const y = (props.header ? 2 : 0) + index;
|
|
15428
15480
|
const key = rowKey(row, index, props.rowKey);
|
|
15429
|
-
const selected =
|
|
15481
|
+
const selected = isRowSelected(key);
|
|
15430
15482
|
const active = props.activeRowKey !== void 0 && sameRowKey(key, props.activeRowKey);
|
|
15431
15483
|
children.push(
|
|
15432
15484
|
(0, import_vue21.h)(
|
|
@@ -15595,44 +15647,59 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15595
15647
|
},
|
|
15596
15648
|
setup(props, { emit }) {
|
|
15597
15649
|
const innerScrollTop = (0, import_vue22.ref)(0);
|
|
15598
|
-
const
|
|
15599
|
-
() => props.
|
|
15650
|
+
const hasLocalFilter = (0, import_vue22.computed)(
|
|
15651
|
+
() => !props.manualFilter && props.filterable && Boolean(props.filter.trim())
|
|
15652
|
+
);
|
|
15653
|
+
const hasLocalSort = (0, import_vue22.computed)(
|
|
15654
|
+
() => !props.manualSort && props.sortable && Boolean(props.sortBy)
|
|
15600
15655
|
);
|
|
15656
|
+
const indexedRows = (0, import_vue22.computed)(() => {
|
|
15657
|
+
if (!hasLocalFilter.value && !hasLocalSort.value)
|
|
15658
|
+
return null;
|
|
15659
|
+
return props.rows.map((row, originalIndex) => ({ row, originalIndex }));
|
|
15660
|
+
});
|
|
15601
15661
|
const filteredRows = (0, import_vue22.computed)(() => {
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15662
|
+
const rows = indexedRows.value;
|
|
15663
|
+
if (!rows)
|
|
15664
|
+
return null;
|
|
15665
|
+
if (!hasLocalFilter.value)
|
|
15666
|
+
return rows;
|
|
15606
15667
|
const query = props.filter.trim().toLowerCase();
|
|
15607
15668
|
if (props.filterPredicate) {
|
|
15608
|
-
return
|
|
15669
|
+
return rows.filter(
|
|
15609
15670
|
({ row, originalIndex }) => props.filterPredicate(row, query, props.columns, originalIndex)
|
|
15610
15671
|
);
|
|
15611
15672
|
}
|
|
15612
|
-
return
|
|
15673
|
+
return rows.filter(
|
|
15613
15674
|
({ row, originalIndex }) => props.columns.some(
|
|
15614
15675
|
(column) => displayValue(column, row, originalIndex).toLowerCase().includes(query)
|
|
15615
15676
|
)
|
|
15616
15677
|
);
|
|
15617
15678
|
});
|
|
15618
15679
|
const sortedRows = (0, import_vue22.computed)(() => {
|
|
15619
|
-
const rows =
|
|
15620
|
-
if (
|
|
15680
|
+
const rows = filteredRows.value;
|
|
15681
|
+
if (!rows)
|
|
15682
|
+
return null;
|
|
15683
|
+
if (!hasLocalSort.value)
|
|
15621
15684
|
return rows;
|
|
15685
|
+
const sorted = [...rows];
|
|
15622
15686
|
const column = props.columns.find((candidate) => candidate.key === props.sortBy);
|
|
15623
|
-
|
|
15687
|
+
sorted.sort((a, b) => {
|
|
15624
15688
|
const result = props.sorter && column ? props.sorter(a.row, b.row, column) : compareValues(a.row[props.sortBy], b.row[props.sortBy]);
|
|
15625
15689
|
return props.sortDirection === "desc" ? -result : result;
|
|
15626
15690
|
});
|
|
15627
|
-
return
|
|
15691
|
+
return sorted;
|
|
15628
15692
|
});
|
|
15629
15693
|
function nonNegativeInteger(value) {
|
|
15630
15694
|
const n = Math.floor(Number(value));
|
|
15631
15695
|
return Number.isFinite(n) ? Math.max(0, n) : 0;
|
|
15632
15696
|
}
|
|
15633
15697
|
const visibleRowCapacity = (0, import_vue22.computed)(() => Math.max(0, nonNegativeInteger(props.h) - 2));
|
|
15698
|
+
function processedRowCount() {
|
|
15699
|
+
return sortedRows.value?.length ?? props.rows.length;
|
|
15700
|
+
}
|
|
15634
15701
|
function maxScrollTop2() {
|
|
15635
|
-
return Math.max(0,
|
|
15702
|
+
return Math.max(0, processedRowCount() - visibleRowCapacity.value);
|
|
15636
15703
|
}
|
|
15637
15704
|
function clampScrollTop2(value) {
|
|
15638
15705
|
return Math.min(maxScrollTop2(), nonNegativeInteger(value));
|
|
@@ -15656,12 +15723,27 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15656
15723
|
},
|
|
15657
15724
|
{ immediate: true }
|
|
15658
15725
|
);
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15726
|
+
function dataEntryAt(absoluteIndex) {
|
|
15727
|
+
const rows = sortedRows.value;
|
|
15728
|
+
if (rows)
|
|
15729
|
+
return rows[absoluteIndex];
|
|
15730
|
+
const row = props.rows[absoluteIndex];
|
|
15731
|
+
return row ? { row, originalIndex: absoluteIndex } : void 0;
|
|
15732
|
+
}
|
|
15733
|
+
function originalIndexForAbsoluteIndex(absoluteIndex) {
|
|
15734
|
+
return dataEntryAt(absoluteIndex)?.originalIndex ?? absoluteIndex;
|
|
15735
|
+
}
|
|
15736
|
+
const visibleRows = (0, import_vue22.computed)(() => {
|
|
15737
|
+
const top = normalizedScrollTop.value;
|
|
15738
|
+
const bottom = top + visibleRowCapacity.value;
|
|
15739
|
+
const rows = sortedRows.value;
|
|
15740
|
+
if (rows)
|
|
15741
|
+
return rows.slice(top, bottom);
|
|
15742
|
+
return props.rows.slice(top, bottom).map((row, index) => ({
|
|
15743
|
+
row,
|
|
15744
|
+
originalIndex: top + index
|
|
15745
|
+
}));
|
|
15746
|
+
});
|
|
15665
15747
|
const tableRows = (0, import_vue22.computed)(() => visibleRows.value.map(({ row }) => row));
|
|
15666
15748
|
const activeAbsoluteIndex = (0, import_vue22.ref)(null);
|
|
15667
15749
|
const activeRowIdentity = (0, import_vue22.ref)(NO_ACTIVE_ROW);
|
|
@@ -15670,7 +15752,7 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15670
15752
|
() => props.columns.map((column) => {
|
|
15671
15753
|
const format = column.format ? (value, row, visibleIndex) => {
|
|
15672
15754
|
const absoluteIndex = normalizedScrollTop.value + visibleIndex;
|
|
15673
|
-
const originalIndex =
|
|
15755
|
+
const originalIndex = originalIndexForAbsoluteIndex(absoluteIndex);
|
|
15674
15756
|
return column.format(value, row, originalIndex);
|
|
15675
15757
|
} : void 0;
|
|
15676
15758
|
if (!props.sortable || column.key !== props.sortBy) {
|
|
@@ -15682,7 +15764,7 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15682
15764
|
);
|
|
15683
15765
|
function originalIndexAt(index) {
|
|
15684
15766
|
const absoluteIndex = normalizedScrollTop.value + index;
|
|
15685
|
-
return
|
|
15767
|
+
return originalIndexForAbsoluteIndex(absoluteIndex);
|
|
15686
15768
|
}
|
|
15687
15769
|
function dataTableRowKey(row, index) {
|
|
15688
15770
|
return rowKey2(row, originalIndexAt(index), props.rowKey);
|
|
@@ -15703,14 +15785,28 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15703
15785
|
const activeRowKey = (0, import_vue22.computed)(
|
|
15704
15786
|
() => activeRowIdentity.value === NO_ACTIVE_ROW ? void 0 : activeRowIdentity.value
|
|
15705
15787
|
);
|
|
15788
|
+
const activeRawRowKey = (0, import_vue22.computed)(() => {
|
|
15789
|
+
if (activeAbsoluteIndex.value == null || sortedRows.value)
|
|
15790
|
+
return NO_ACTIVE_ROW;
|
|
15791
|
+
const index = activeAbsoluteIndex.value;
|
|
15792
|
+
const row = props.rows[index];
|
|
15793
|
+
return row ? rowKey2(row, index, props.rowKey) : NO_ACTIVE_ROW;
|
|
15794
|
+
});
|
|
15795
|
+
function findDataIndexByKey(key) {
|
|
15796
|
+
const rows = sortedRows.value;
|
|
15797
|
+
if (rows) {
|
|
15798
|
+
return rows.findIndex((entry) => Object.is(dataRowKey(entry), key));
|
|
15799
|
+
}
|
|
15800
|
+
return props.rows.findIndex(
|
|
15801
|
+
(row, index) => Object.is(rowKey2(row, index, props.rowKey), key)
|
|
15802
|
+
);
|
|
15803
|
+
}
|
|
15706
15804
|
(0, import_vue22.watch)(
|
|
15707
|
-
() => [props.rowKey,
|
|
15805
|
+
() => [props.rowKey, props.rows, sortedRows.value, activeRowIdentity.value],
|
|
15708
15806
|
() => {
|
|
15709
15807
|
if (activeRowIdentity.value === NO_ACTIVE_ROW)
|
|
15710
15808
|
return;
|
|
15711
|
-
const nextIndex =
|
|
15712
|
-
(entry) => Object.is(dataRowKey(entry), activeRowIdentity.value)
|
|
15713
|
-
);
|
|
15809
|
+
const nextIndex = findDataIndexByKey(activeRowIdentity.value);
|
|
15714
15810
|
if (nextIndex < 0) {
|
|
15715
15811
|
clearActiveRow();
|
|
15716
15812
|
return;
|
|
@@ -15718,9 +15814,22 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15718
15814
|
activeAbsoluteIndex.value = nextIndex;
|
|
15719
15815
|
}
|
|
15720
15816
|
);
|
|
15817
|
+
(0, import_vue22.watch)(
|
|
15818
|
+
() => [props.rowKey, activeRawRowKey.value],
|
|
15819
|
+
([, key]) => {
|
|
15820
|
+
if (activeRowIdentity.value === NO_ACTIVE_ROW)
|
|
15821
|
+
return;
|
|
15822
|
+
if (key === NO_ACTIVE_ROW) {
|
|
15823
|
+
clearActiveRow();
|
|
15824
|
+
return;
|
|
15825
|
+
}
|
|
15826
|
+
if (!Object.is(activeRowIdentity.value, key))
|
|
15827
|
+
activeRowIdentity.value = key;
|
|
15828
|
+
}
|
|
15829
|
+
);
|
|
15721
15830
|
function setActiveAbsoluteIndex(absoluteIndex) {
|
|
15722
|
-
const clamped = Math.max(0, Math.min(
|
|
15723
|
-
const entry =
|
|
15831
|
+
const clamped = Math.max(0, Math.min(processedRowCount() - 1, absoluteIndex));
|
|
15832
|
+
const entry = dataEntryAt(clamped);
|
|
15724
15833
|
if (!entry) {
|
|
15725
15834
|
clearActiveRow();
|
|
15726
15835
|
return null;
|
|
@@ -15796,7 +15905,7 @@ var TDataTable = (0, import_vue22.defineComponent)({
|
|
|
15796
15905
|
const active = setActiveAbsoluteIndex(current);
|
|
15797
15906
|
if (!active)
|
|
15798
15907
|
return;
|
|
15799
|
-
const entry =
|
|
15908
|
+
const entry = dataEntryAt(active.dataIndex);
|
|
15800
15909
|
if (!entry)
|
|
15801
15910
|
return;
|
|
15802
15911
|
const visibleIndex = active.dataIndex - active.scrollTop;
|
|
@@ -18786,6 +18895,49 @@ var TSelect = (0, import_vue28.defineComponent)({
|
|
|
18786
18895
|
const typeaheadQuery = (0, import_vue28.ref)("");
|
|
18787
18896
|
const query = (0, import_vue28.computed)(() => props.query ?? innerQuery.value);
|
|
18788
18897
|
const options = (0, import_vue28.computed)(() => providerOptions.value ?? props.options);
|
|
18898
|
+
function getOptionLabel(opt) {
|
|
18899
|
+
return isOptionObject(opt) ? opt.label : opt;
|
|
18900
|
+
}
|
|
18901
|
+
function getOptionKind(opt) {
|
|
18902
|
+
return isOptionObject(opt) ? opt.kind : void 0;
|
|
18903
|
+
}
|
|
18904
|
+
function getOptionValue(opt, index) {
|
|
18905
|
+
if (props.valueMode === "index")
|
|
18906
|
+
return index;
|
|
18907
|
+
if (props.valueMode === "option")
|
|
18908
|
+
return opt;
|
|
18909
|
+
return isOptionObject(opt) && "value" in opt ? opt.value : getOptionLabel(opt);
|
|
18910
|
+
}
|
|
18911
|
+
const optionValueIndex = (0, import_vue28.computed)(() => {
|
|
18912
|
+
if (props.valueMode === "index")
|
|
18913
|
+
return null;
|
|
18914
|
+
const indexed = /* @__PURE__ */ new Map();
|
|
18915
|
+
const opts = options.value;
|
|
18916
|
+
for (let index = 0; index < opts.length; index++) {
|
|
18917
|
+
const value = getOptionValue(opts[index], index);
|
|
18918
|
+
if (typeof value === "number" && value === 0)
|
|
18919
|
+
continue;
|
|
18920
|
+
if (!indexed.has(value))
|
|
18921
|
+
indexed.set(value, index);
|
|
18922
|
+
}
|
|
18923
|
+
return indexed;
|
|
18924
|
+
});
|
|
18925
|
+
function valuesEqual(a, b) {
|
|
18926
|
+
return Object.is(a, b);
|
|
18927
|
+
}
|
|
18928
|
+
function modelIndex(value, useValueIndex = props.multiple) {
|
|
18929
|
+
if (props.valueMode === "index")
|
|
18930
|
+
return normalizeModelIndex(value);
|
|
18931
|
+
if (useValueIndex) {
|
|
18932
|
+
const indexed = optionValueIndex.value;
|
|
18933
|
+
const cached = indexed?.get(value);
|
|
18934
|
+
if (cached != null)
|
|
18935
|
+
return cached;
|
|
18936
|
+
}
|
|
18937
|
+
return options.value.findIndex(
|
|
18938
|
+
(opt, optIndex) => valuesEqual(getOptionValue(opt, optIndex), value)
|
|
18939
|
+
);
|
|
18940
|
+
}
|
|
18789
18941
|
const initialActive = (() => {
|
|
18790
18942
|
const max = Math.max(0, options.value.length - 1);
|
|
18791
18943
|
if (!props.multiple) {
|
|
@@ -18843,29 +18995,6 @@ var TSelect = (0, import_vue28.defineComponent)({
|
|
|
18843
18995
|
}
|
|
18844
18996
|
innerActive.value = clamp10(active.value, 0, max);
|
|
18845
18997
|
});
|
|
18846
|
-
function getOptionLabel(opt) {
|
|
18847
|
-
return isOptionObject(opt) ? opt.label : opt;
|
|
18848
|
-
}
|
|
18849
|
-
function getOptionKind(opt) {
|
|
18850
|
-
return isOptionObject(opt) ? opt.kind : void 0;
|
|
18851
|
-
}
|
|
18852
|
-
function getOptionValue(opt, index) {
|
|
18853
|
-
if (props.valueMode === "index")
|
|
18854
|
-
return index;
|
|
18855
|
-
if (props.valueMode === "option")
|
|
18856
|
-
return opt;
|
|
18857
|
-
return isOptionObject(opt) && "value" in opt ? opt.value : getOptionLabel(opt);
|
|
18858
|
-
}
|
|
18859
|
-
function valuesEqual(a, b) {
|
|
18860
|
-
return Object.is(a, b);
|
|
18861
|
-
}
|
|
18862
|
-
function modelIndex(value) {
|
|
18863
|
-
if (props.valueMode === "index")
|
|
18864
|
-
return normalizeModelIndex(value);
|
|
18865
|
-
return options.value.findIndex(
|
|
18866
|
-
(opt, optIndex) => valuesEqual(getOptionValue(opt, optIndex), value)
|
|
18867
|
-
);
|
|
18868
|
-
}
|
|
18869
18998
|
function isOptionInteractive(opt) {
|
|
18870
18999
|
if (!opt)
|
|
18871
19000
|
return false;
|
|
@@ -19517,16 +19646,24 @@ var TSelect = (0, import_vue28.defineComponent)({
|
|
|
19517
19646
|
|
|
19518
19647
|
// src/vue/components/TTree.ts
|
|
19519
19648
|
var import_vue29 = require("vue");
|
|
19520
|
-
function flattenTree(nodes, expanded, depth = 0, out = []) {
|
|
19649
|
+
function flattenTree(nodes, expanded, limit, depth = 0, out = []) {
|
|
19650
|
+
if (out.length >= limit)
|
|
19651
|
+
return out;
|
|
19521
19652
|
for (const node of nodes) {
|
|
19653
|
+
if (out.length >= limit)
|
|
19654
|
+
break;
|
|
19522
19655
|
const expandable = Boolean(node.children?.length);
|
|
19523
19656
|
const isExpanded = expanded.has(node.id);
|
|
19524
19657
|
out.push({ node, depth, expandable, expanded: isExpanded });
|
|
19525
19658
|
if (expandable && isExpanded)
|
|
19526
|
-
flattenTree(node.children, expanded, depth + 1, out);
|
|
19659
|
+
flattenTree(node.children, expanded, limit, depth + 1, out);
|
|
19527
19660
|
}
|
|
19528
19661
|
return out;
|
|
19529
19662
|
}
|
|
19663
|
+
function visibleRowLimit(height) {
|
|
19664
|
+
const limit = Math.floor(height);
|
|
19665
|
+
return Number.isFinite(limit) ? Math.max(0, limit) : 0;
|
|
19666
|
+
}
|
|
19530
19667
|
var TTree = (0, import_vue29.defineComponent)({
|
|
19531
19668
|
name: "TTree",
|
|
19532
19669
|
props: {
|
|
@@ -19560,7 +19697,9 @@ var TTree = (0, import_vue29.defineComponent)({
|
|
|
19560
19697
|
const { defaultStyle } = useTerminal();
|
|
19561
19698
|
const baseStyle = (0, import_vue29.computed)(() => mergeStyle(defaultStyle.value, props.style));
|
|
19562
19699
|
const expandedSet = (0, import_vue29.computed)(() => new Set(props.expandedIds));
|
|
19563
|
-
const rows = (0, import_vue29.computed)(
|
|
19700
|
+
const rows = (0, import_vue29.computed)(
|
|
19701
|
+
() => flattenTree(props.nodes, expandedSet.value, visibleRowLimit(props.h))
|
|
19702
|
+
);
|
|
19564
19703
|
function toggle(item) {
|
|
19565
19704
|
if (item.node.disabled || !item.expandable)
|
|
19566
19705
|
return;
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ import { TView, createTheme, linkifyTextSegments, tuiDefaultTheme } from "./link
|
|
|
8
8
|
import "./runtime-rfcZCyJq.js";
|
|
9
9
|
import "./trace-CjzYeIxN.js";
|
|
10
10
|
import "./env-Cl8qmNFN.js";
|
|
11
|
-
import { TAutocompleteInput, TBadge, TCheckbox, TCode, TDataTable, TDivider, TFormField, TLink, TLinkifyText, TList, TPasswordInput, TRadioGroup, TSlider, TSwitch, TTable, TTag, TTree, TerminalProvider, createTInputHostPlugin } from "./TTree-
|
|
11
|
+
import { TAutocompleteInput, TBadge, TCheckbox, TCode, TDataTable, TDivider, TFormField, TLink, TLinkifyText, TList, TPasswordInput, TRadioGroup, TSlider, TSwitch, TTable, TTag, TTree, TerminalProvider, createTInputHostPlugin } from "./TTree-ChOot2Bh.js";
|
|
12
12
|
import "./terminal-selection-DBinO6p5.js";
|
|
13
|
-
import { TBox, TCommandPalette, TDialog, TInput, TSelect, TText, computeCommandPaletteMatchRanges } from "./TSelect-
|
|
13
|
+
import { TBox, TCommandPalette, TDialog, TInput, TSelect, TText, computeCommandPaletteMatchRanges } from "./TSelect-HzILuti9.js";
|
|
14
14
|
import "./frame-perf-C6Xfg85O.js";
|
|
15
15
|
import "./path-mnSgEpCm.js";
|
|
16
16
|
|