@gloom-sh/terminal 0.20.14 → 0.20.17
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/package.json +1 -1
- package/src/api-client/data.ts +13 -3
- package/src/api-client/index.ts +54 -0
- package/src/api-client/install-experiments.ts +8 -7
- package/src/api-client/paths.ts +2 -1
- package/src/api-client/product-waitlist.ts +63 -0
- package/src/api-client/request.ts +4 -2
- package/src/api-client/types/billing.ts +45 -0
- package/src/api-client/types/econ.ts +3 -0
- package/src/api-client/yearly-plan.ts +132 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/plugin-bindings.ts +3 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
- package/src/app/since-last-visit/keys.ts +26 -0
- package/src/app/since-last-visit/model.ts +266 -0
- package/src/app/since-last-visit/strip.tsx +193 -0
- package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
- package/src/app/since-last-visit/visit-tracker.ts +191 -0
- package/src/app.tsx +15 -0
- package/src/cli/commands/fred-series.ts +3 -1
- package/src/cli/commands/market.ts +8 -4
- package/src/cli/commands/overview.ts +65 -13
- package/src/cli/commands/system.ts +29 -1
- package/src/cli/commands/ticker.ts +12 -5
- package/src/cli/csv-export.ts +73 -0
- package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
- package/src/cli/desktop-pane-shot-browser.ts +2 -1
- package/src/cli/desktop-pane-shot-view.ts +3 -7
- package/src/cli/desktop-pane-shot.ts +29 -30
- package/src/cli/help.ts +5 -2
- package/src/cli/history-rows.ts +24 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/options.ts +29 -1
- package/src/cli/pane-functions/catalog.ts +41 -4
- package/src/cli/pane-functions/function-help.ts +1 -1
- package/src/cli/pane-functions/headless.ts +70 -3
- package/src/cli/pane-functions/index.ts +4 -4
- package/src/cli/pane-functions/resolver.ts +43 -0
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
- package/src/cli/pane-functions/screenshot-payload.ts +3 -0
- package/src/cli/report-tables.ts +37 -8
- package/src/cli/result.ts +3 -6
- package/src/cli/shot-temp-dir.ts +30 -0
- package/src/cli/suffixed-listing-rows.ts +11 -0
- package/src/components/chart/composite/composite-chart.tsx +3 -3
- package/src/components/chart/composite/legend.tsx +37 -7
- package/src/components/command-bar/commands/direct/index.ts +31 -8
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/routes/root/command-items.ts +8 -0
- package/src/components/command-bar/routes/root/results.ts +16 -0
- package/src/components/company-logo.tsx +10 -3
- package/src/components/data-table/sections.ts +6 -1
- package/src/components/layout/pane/title.ts +6 -2
- package/src/components/layout/shell/index.tsx +5 -1
- package/src/components/layout/shell/ticker-link-menu.ts +12 -9
- package/src/components/ticker/badge/format.ts +12 -3
- package/src/components/ticker/badge/index.tsx +9 -3
- package/src/components/ticker/list-table-view.tsx +119 -17
- package/src/components/ui/data-table/display-columns.ts +19 -0
- package/src/components/ui/data-table/hooks.ts +2 -3
- package/src/components/ui/data-table/index.tsx +43 -9
- package/src/components/ui/data-table/types.ts +21 -0
- package/src/components/ui/data-table/visible-range.ts +11 -1
- package/src/core/state/app/layout-reducer.ts +3 -1
- package/src/core/state/app/layout.ts +2 -2
- package/src/data/config/layout.ts +14 -0
- package/src/data/config/store/normalize.ts +11 -1
- package/src/i18n/es.ts +38 -0
- package/src/i18n/ja.ts +38 -0
- package/src/i18n/ko.ts +38 -0
- package/src/i18n/zh-cn.ts +38 -0
- package/src/i18n/zh-tw.ts +38 -0
- package/src/layout/pane-follow.ts +141 -4
- package/src/layout/pane-layout-move.ts +10 -7
- package/src/layout/ticker-navigation.ts +13 -19
- package/src/layout/ticker-retarget.ts +3 -2
- package/src/market-data/market/index-level.ts +19 -0
- package/src/plugins/builtin/account-management/keyboard.ts +14 -0
- package/src/plugins/builtin/account-management/model.ts +2 -0
- package/src/plugins/builtin/account-management/pane.tsx +79 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
- package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
- package/src/plugins/builtin/awards/pane.tsx +12 -10
- package/src/plugins/builtin/changelog/index.tsx +6 -44
- package/src/plugins/builtin/changelog/versions.ts +17 -68
- package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
- package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
- package/src/plugins/builtin/cpi/pane.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/series.ts +2 -2
- package/src/plugins/builtin/debt-maturities/model.ts +1 -1
- package/src/plugins/builtin/earnings/board-model.ts +12 -0
- package/src/plugins/builtin/earnings/board-table.ts +8 -5
- package/src/plugins/builtin/earnings/board.tsx +38 -18
- package/src/plugins/builtin/earnings/highlight.ts +47 -0
- package/src/plugins/builtin/earnings/history-table.ts +1 -1
- package/src/plugins/builtin/earnings/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +2 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
- package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
- package/src/plugins/builtin/econ-statistics/client.ts +11 -10
- package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
- package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
- package/src/plugins/builtin/econ-statistics/view.ts +9 -3
- package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
- package/src/plugins/builtin/exposure/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +6 -4
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +11 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
- package/src/plugins/builtin/market-valuation/view.ts +14 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
- package/src/plugins/builtin/pe-band/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
- package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
- package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
- package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
- package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
- package/src/plugins/builtin/shared/headless-options.ts +1 -1
- package/src/plugins/builtin/shared/series-cache.ts +3 -0
- package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
- package/src/plugins/builtin/social-mentions/model.ts +2 -2
- package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
- package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
- package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
- package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
- package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
- package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
- package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
- package/src/plugins/builtin/time-sales/headless.ts +4 -1
- package/src/plugins/builtin/time-sales/pane.tsx +2 -0
- package/src/plugins/builtin/time-sales/window.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
- package/src/plugins/builtin/treasury-daily/client.ts +23 -11
- package/src/portfolio/column-values.ts +20 -8
- package/src/portfolio/suffixed-listings.ts +3 -1
- package/src/portfolio/watchlist-groups.ts +212 -0
- package/src/react/ticker-source.ts +3 -1
- package/src/renderers/dom/styles.css +7 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
- package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
- package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
- package/src/state/app/bootstrap.ts +11 -0
- package/src/state/app/context/index.tsx +6 -0
- package/src/sync/collections-contributor.ts +5 -2
- package/src/sync/config-merge.ts +10 -2
- package/src/sync/sanitize.ts +28 -0
- package/src/telemetry/usage-counts.ts +17 -0
- package/src/time-series/base-series.ts +3 -0
- package/src/time-series/chart-seed.ts +1 -1
- package/src/time-series/financial-period-coverage.ts +4 -12
- package/src/time-series/ice-credit.ts +1 -0
- package/src/time-series/parsed-history-cache.ts +1 -1
- package/src/time-series/resolve.ts +1 -1
- package/src/time-series/types.ts +1 -0
- package/src/time-series/use-chart-resolution.ts +6 -1
- package/src/types/config.ts +32 -0
- package/src/types/headless.ts +9 -2
- package/src/types/plugin-context.ts +5 -0
- package/src/types/ticker.ts +14 -0
- package/src/ui/ascii-font.ts +1 -4
- package/src/utils/async-deadline.ts +2 -2
- package/src/utils/csv.ts +44 -5
- package/src/utils/futures-generic.ts +3 -0
- package/src/utils/throttled-fetch.ts +15 -1
|
@@ -25,6 +25,7 @@ import type { TickerFinancials, PricePoint } from "../../types/financials";
|
|
|
25
25
|
import type { TickerRecord } from "../../types/ticker";
|
|
26
26
|
import { PRICE_SPARKLINE_COLUMN_ID, PriceSparkline } from "../price-sparkline/view";
|
|
27
27
|
import { DataTableView, type DataTableKeyEvent, type DataTableSelection } from "../data-table/view";
|
|
28
|
+
import { sectionHeaderText } from "../data-table/sections";
|
|
28
29
|
import type { QuoteFlashDirection } from "../quote-flash";
|
|
29
30
|
import type { DataTableColumnReorder } from "../ui";
|
|
30
31
|
import { objectVersion } from "../../utils/object-version";
|
|
@@ -90,7 +91,41 @@ function summaryRecord(row: TickerTableSummaryRow): TickerRecord {
|
|
|
90
91
|
return record;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
/**
|
|
95
|
+
* A section of a ticker table: a header that Enter or a click collapses and
|
|
96
|
+
* expands, and the rows under it.
|
|
97
|
+
*/
|
|
98
|
+
export interface TickerTableGroup {
|
|
99
|
+
/** The same while the group is: its header's row key (`groupRowKey`) and what its collapsed state is kept under. */
|
|
100
|
+
id: string;
|
|
101
|
+
label: string;
|
|
102
|
+
/** Its rows in order, shown or collapsed: the header counts them and an export writes them all. */
|
|
103
|
+
tickers: readonly TickerRecord[];
|
|
104
|
+
collapsed: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const GROUP_ROW_PREFIX = "\u0000group:";
|
|
108
|
+
|
|
109
|
+
/** What the cursor reads on a group's header: no ticker has this key. */
|
|
110
|
+
export function groupRowKey(id: string): string {
|
|
111
|
+
return `${GROUP_ROW_PREFIX}${id}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The group whose header a cursor key is, or null for any other row. */
|
|
115
|
+
export function groupIdOfRowKey(key: string | null): string | null {
|
|
116
|
+
return key?.startsWith(GROUP_ROW_PREFIX) ? key.slice(GROUP_ROW_PREFIX.length) : null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The record a group's header stands in the table's items as, and the group it heads. */
|
|
120
|
+
const groupHeaderOf = new WeakMap<TickerRecord, TickerTableGroup>();
|
|
121
|
+
|
|
122
|
+
function groupHeaderRecord(group: TickerTableGroup): TickerRecord {
|
|
123
|
+
const record = { metadata: { ticker: groupRowKey(group.id), exchange: "", currency: "", name: "", portfolios: [], watchlists: [], positions: [] } } as unknown as TickerRecord;
|
|
124
|
+
groupHeaderOf.set(record, group);
|
|
125
|
+
return record;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const isTickerRow = (item: TickerRecord) => !summaryRowOf.has(item) && !groupHeaderOf.has(item);
|
|
94
129
|
/** Tickers, and the summary rows that take the cursor (CASH); never the others (TOTAL, a period's FX line). */
|
|
95
130
|
const isNavigableRow = (item: TickerRecord) => {
|
|
96
131
|
const summary = summaryRowOf.get(item);
|
|
@@ -145,6 +180,15 @@ export interface TickerListTableViewProps {
|
|
|
145
180
|
emptyHint?: string;
|
|
146
181
|
/** Rows after the tickers that add them up; shown only beside at least one ticker. */
|
|
147
182
|
summaryRows?: readonly TickerTableSummaryRow[];
|
|
183
|
+
/**
|
|
184
|
+
* Sections the rows show under, in this order, each under a header the
|
|
185
|
+
* cursor lands on. `tickers` still holds every row.
|
|
186
|
+
*/
|
|
187
|
+
groups?: readonly TickerTableGroup[];
|
|
188
|
+
/** Collapses or expands a group: Enter on its header, or a click. */
|
|
189
|
+
onToggleGroup?: (id: string) => void;
|
|
190
|
+
/** The pane's own items in a row's menu (right-click, and the pane menu for the cursor row), after the list items. */
|
|
191
|
+
rowMenuItems?: (ticker: TickerRecord) => ContextMenuItem[];
|
|
148
192
|
/**
|
|
149
193
|
* The pane's own key for adding a ticker, which the empty table names. The
|
|
150
194
|
* command bar's key when absent. The pane shows its add control once, in its
|
|
@@ -206,16 +250,24 @@ function getTickerKey(ticker: TickerRecord): string {
|
|
|
206
250
|
return ticker.metadata.ticker;
|
|
207
251
|
}
|
|
208
252
|
|
|
253
|
+
/** The pane's own row items, after the list items and before the actions plugins and the app add. */
|
|
254
|
+
function withPaneRowItems(items: ContextMenuItem[], paneItems: readonly ContextMenuItem[] | undefined): ContextMenuItem[] {
|
|
255
|
+
if (!paneItems?.length) return items;
|
|
256
|
+
const at = items.findIndex((item) => item.id === "ticker:actions-divider");
|
|
257
|
+
return at < 0 ? [...items, ...paneItems] : [...items.slice(0, at), ...paneItems, ...items.slice(at)];
|
|
258
|
+
}
|
|
259
|
+
|
|
209
260
|
/** What right-clicking the row offers, plugin additions included. */
|
|
210
261
|
function tickerRowMenuItems(
|
|
211
262
|
ticker: TickerRecord,
|
|
212
263
|
financials: TickerFinancials | null,
|
|
213
264
|
copyText: (text: string) => Promise<void>,
|
|
265
|
+
paneItems?: readonly ContextMenuItem[],
|
|
214
266
|
): ContextMenuItem[] {
|
|
215
267
|
const registry = getSharedRegistry() ?? null;
|
|
216
268
|
return withPluginContextMenuItems(
|
|
217
269
|
{ kind: "ticker", symbol: ticker.metadata.ticker, ticker, financials },
|
|
218
|
-
tickerContextMenuItems({ ticker, financials, registry, copyText }),
|
|
270
|
+
withPaneRowItems(tickerContextMenuItems({ ticker, financials, registry, copyText }), paneItems),
|
|
219
271
|
registry,
|
|
220
272
|
);
|
|
221
273
|
}
|
|
@@ -230,18 +282,21 @@ export function useTickerRowPaneMenu({
|
|
|
230
282
|
financials,
|
|
231
283
|
enabled,
|
|
232
284
|
accelerators,
|
|
285
|
+
paneItems,
|
|
233
286
|
}: {
|
|
234
287
|
ticker: TickerRecord | null;
|
|
235
288
|
financials: TickerFinancials | null;
|
|
236
289
|
enabled: boolean;
|
|
237
290
|
/** The pane's own keys for these actions, by item id, shown beside them. */
|
|
238
291
|
accelerators?: Readonly<Record<string, string>>;
|
|
292
|
+
/** The pane's own items for this row (`TickerListTableViewProps.rowMenuItems`). */
|
|
293
|
+
paneItems?: readonly ContextMenuItem[];
|
|
239
294
|
}): void {
|
|
240
295
|
const renderer = useRendererHost();
|
|
241
296
|
const registrationId = `ticker-row-menu:${useId()}`;
|
|
242
297
|
usePaneFooter(registrationId, () => {
|
|
243
298
|
if (!enabled || !ticker) return null;
|
|
244
|
-
const items = tickerRowMenuItems(ticker, financials, renderer.copyText.bind(renderer));
|
|
299
|
+
const items = tickerRowMenuItems(ticker, financials, renderer.copyText.bind(renderer), paneItems);
|
|
245
300
|
return {
|
|
246
301
|
order: -1,
|
|
247
302
|
menu: accelerators
|
|
@@ -250,7 +305,7 @@ export function useTickerRowPaneMenu({
|
|
|
250
305
|
: { ...item, accelerator: accelerators[item.id] }))
|
|
251
306
|
: items,
|
|
252
307
|
};
|
|
253
|
-
}, [accelerators, enabled, financials, renderer, ticker]);
|
|
308
|
+
}, [accelerators, enabled, financials, paneItems, renderer, ticker]);
|
|
254
309
|
}
|
|
255
310
|
|
|
256
311
|
export function TickerListTableView({
|
|
@@ -287,6 +342,9 @@ export function TickerListTableView({
|
|
|
287
342
|
emptyHint,
|
|
288
343
|
addTickerShortcut,
|
|
289
344
|
summaryRows,
|
|
345
|
+
groups,
|
|
346
|
+
onToggleGroup,
|
|
347
|
+
rowMenuItems,
|
|
290
348
|
virtualize = true,
|
|
291
349
|
overscan = 4,
|
|
292
350
|
exportName,
|
|
@@ -326,6 +384,8 @@ export function TickerListTableView({
|
|
|
326
384
|
_index: number,
|
|
327
385
|
rowState: { selected: boolean },
|
|
328
386
|
) => {
|
|
387
|
+
// A group's header draws as a header, never as cells.
|
|
388
|
+
if (groupHeaderOf.has(ticker)) return { text: "" };
|
|
329
389
|
const summary = summaryRowOf.get(ticker);
|
|
330
390
|
if (summary) {
|
|
331
391
|
const cell = summary.cells[column.id];
|
|
@@ -364,22 +424,33 @@ export function TickerListTableView({
|
|
|
364
424
|
}, []);
|
|
365
425
|
|
|
366
426
|
const getRowVersion = useCallback((ticker: TickerRecord) => {
|
|
367
|
-
const summary = summaryRowOf.get(ticker);
|
|
427
|
+
const summary = summaryRowOf.get(ticker) ?? groupHeaderOf.get(ticker);
|
|
368
428
|
if (summary) return summary;
|
|
369
429
|
const symbol = ticker.metadata.ticker;
|
|
370
430
|
return `${resolveEpoch}|${objectVersion(financialsMap.get(symbol))}|${safeFlashSymbols.get(symbol) ?? ""}`;
|
|
371
431
|
}, [financialsMap, resolveEpoch, safeFlashSymbols]);
|
|
372
432
|
|
|
433
|
+
// A grouped list's rows name their group in the export, collapsed or not.
|
|
434
|
+
const groupLabels = useMemo(() => groups?.length
|
|
435
|
+
? new Map(groups.flatMap((group) => group.tickers.map((ticker) => [ticker.metadata.ticker, group.label] as const)))
|
|
436
|
+
: null, [groups]);
|
|
373
437
|
// An export ends each row as `quote --csv` does: its session and feed, its listing with the venue, its unit,
|
|
374
438
|
// its source and the ISO time its price was observed. A summary line is no listing.
|
|
375
|
-
const exportIdentity = useMemo(() =>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
439
|
+
const exportIdentity = useMemo(() => {
|
|
440
|
+
const identity = (ticker: TickerRecord) => quoteExportIdentityCells(exportedListingKey(ticker), financialsRef.current.get(ticker.metadata.ticker)?.quote,
|
|
441
|
+
Date.now(),
|
|
442
|
+
// A broker's quote names the broker as its source.
|
|
443
|
+
(providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name);
|
|
444
|
+
return groupLabels
|
|
445
|
+
? {
|
|
446
|
+
headers: ["Group", ...QUOTE_EXPORT_IDENTITY_HEADERS],
|
|
447
|
+
cells: (ticker: TickerRecord) => isTickerRow(ticker) ? [groupLabels.get(ticker.metadata.ticker) ?? "", ...identity(ticker)] : null,
|
|
448
|
+
}
|
|
449
|
+
: {
|
|
450
|
+
headers: QUOTE_EXPORT_IDENTITY_HEADERS,
|
|
451
|
+
cells: (ticker: TickerRecord) => isTickerRow(ticker) ? identity(ticker) : null,
|
|
452
|
+
};
|
|
453
|
+
}, [groupLabels]);
|
|
383
454
|
|
|
384
455
|
const selection = useMemo<DataTableSelection<TickerRecord>>(() => ({
|
|
385
456
|
kind: "id",
|
|
@@ -394,6 +465,8 @@ export function TickerListTableView({
|
|
|
394
465
|
if (isTickerRow(ticker)) onRowActivate?.(ticker);
|
|
395
466
|
}, [onRowActivate]);
|
|
396
467
|
|
|
468
|
+
const rowMenuItemsRef = useRef(rowMenuItems);
|
|
469
|
+
rowMenuItemsRef.current = rowMenuItems;
|
|
397
470
|
const showTickerContextMenu = useCallback((
|
|
398
471
|
ticker: TickerRecord,
|
|
399
472
|
event: TableMouseEvent,
|
|
@@ -407,12 +480,12 @@ export function TickerListTableView({
|
|
|
407
480
|
ticker,
|
|
408
481
|
financials: financials ?? null,
|
|
409
482
|
},
|
|
410
|
-
tickerContextMenuItems({
|
|
483
|
+
withPaneRowItems(tickerContextMenuItems({
|
|
411
484
|
ticker,
|
|
412
485
|
financials: financials ?? null,
|
|
413
486
|
registry,
|
|
414
487
|
copyText: renderer.copyText.bind(renderer),
|
|
415
|
-
}),
|
|
488
|
+
}), rowMenuItemsRef.current?.(ticker)),
|
|
416
489
|
event,
|
|
417
490
|
);
|
|
418
491
|
}, [renderer, showContextMenu]);
|
|
@@ -433,16 +506,43 @@ export function TickerListTableView({
|
|
|
433
506
|
|
|
434
507
|
// Summary rows follow the tickers, as records of their own the table never selects.
|
|
435
508
|
const summaries = useMemo(() => tickers.length && summaryRows?.length ? summaryRows.map(summaryRecord) : [], [summaryRows, tickers.length]);
|
|
436
|
-
|
|
509
|
+
// A grouped list shows each group's header and, unless it is collapsed, its rows.
|
|
510
|
+
const grouped = useMemo(() => groups?.length
|
|
511
|
+
? groups.flatMap((group) => [groupHeaderRecord(group), ...group.collapsed ? [] : group.tickers])
|
|
512
|
+
: null, [groups]);
|
|
513
|
+
const rows = grouped ?? tickers;
|
|
514
|
+
const items = useMemo(() => summaries.length ? [...rows, ...summaries] : rows, [rows, summaries]);
|
|
515
|
+
// An export writes every row, a collapsed group's too, in the groups' order.
|
|
516
|
+
const exportItems = useMemo(() => groups?.length
|
|
517
|
+
? [...groups.flatMap((group) => group.tickers), ...summaries]
|
|
518
|
+
: undefined, [groups, summaries]);
|
|
519
|
+
const toggleGroupRef = useRef(onToggleGroup);
|
|
520
|
+
toggleGroupRef.current = onToggleGroup;
|
|
521
|
+
const renderGroupHeader = useCallback((item: TickerRecord) => {
|
|
522
|
+
const group = groupHeaderOf.get(item);
|
|
523
|
+
return group
|
|
524
|
+
? { text: sectionHeaderText(group.label, group.tickers.length), expanded: !group.collapsed, onMouseDown: () => toggleGroupRef.current?.(group.id) }
|
|
525
|
+
: null;
|
|
526
|
+
}, []);
|
|
527
|
+
// The pane counts the rows in view among its tickers: a header between them is not one.
|
|
528
|
+
const handleVisibleRangeChange = useMemo(() => {
|
|
529
|
+
if (!grouped || !onVisibleRangeChange) return onVisibleRangeChange;
|
|
530
|
+
const tickersBefore = [0];
|
|
531
|
+
for (const item of grouped) tickersBefore.push(tickersBefore.at(-1)! + (groupHeaderOf.has(item) ? 0 : 1));
|
|
532
|
+
const at = (index: number) => tickersBefore[Math.max(0, Math.min(index, grouped.length))]!;
|
|
533
|
+
return ({ start, end }: TickerListVisibleRange) => onVisibleRangeChange({ start: at(start), end: at(end) });
|
|
534
|
+
}, [grouped, onVisibleRangeChange]);
|
|
437
535
|
|
|
438
536
|
// The cursor row's right-click menu, for the keyboard, while the table is focused.
|
|
439
537
|
const cursorTicker = selectedIndex >= 0 ? tickers[selectedIndex] ?? null : null;
|
|
440
538
|
const cursorFinancials = cursorTicker ? financialsMap.get(cursorTicker.metadata.ticker) ?? null : null;
|
|
539
|
+
const cursorPaneItems = useMemo(() => cursorTicker ? rowMenuItems?.(cursorTicker) : undefined, [cursorTicker, rowMenuItems]);
|
|
441
540
|
useTickerRowPaneMenu({
|
|
442
541
|
ticker: cursorTicker,
|
|
443
542
|
financials: cursorFinancials,
|
|
444
543
|
enabled: focused && keyboardNavigation,
|
|
445
544
|
accelerators: rowMenuAccelerators,
|
|
545
|
+
paneItems: cursorPaneItems,
|
|
446
546
|
});
|
|
447
547
|
|
|
448
548
|
return (
|
|
@@ -463,7 +563,9 @@ export function TickerListTableView({
|
|
|
463
563
|
onRowContextMenu={handleRowContextMenu}
|
|
464
564
|
rowContextMenuSurface
|
|
465
565
|
renderCell={renderCell}
|
|
566
|
+
renderSectionHeader={grouped ? renderGroupHeader : undefined}
|
|
466
567
|
exportIdentity={exportIdentity}
|
|
568
|
+
exportItems={exportItems}
|
|
467
569
|
exportName={exportName}
|
|
468
570
|
getRowVersion={getRowVersion}
|
|
469
571
|
emptyStateTitle={emptyTitle}
|
|
@@ -479,7 +581,7 @@ export function TickerListTableView({
|
|
|
479
581
|
scrollRef={scrollRef}
|
|
480
582
|
syncHeaderScroll={syncHeaderScroll}
|
|
481
583
|
onBodyScrollActivity={onBodyScrollActivity}
|
|
482
|
-
onVisibleRangeChange={
|
|
584
|
+
onVisibleRangeChange={handleVisibleRangeChange}
|
|
483
585
|
visibleRangeBuffer={visibleRangeBuffer}
|
|
484
586
|
keyboardNavigation={keyboardNavigation}
|
|
485
587
|
onRootKeyDown={onRootKeyDown}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
2
|
+
import type { DataTableColumn, DataTableProps, DataTableVisibleRange } from "./types";
|
|
3
|
+
|
|
4
|
+
export function dataTableDisplayColumns<T, C extends DataTableColumn>(
|
|
5
|
+
props: Pick<DataTableProps<T, C>, "columns" | "items" | "renderCell" | "renderSectionHeader" | "isSelected">,
|
|
6
|
+
visibleRange?: DataTableVisibleRange | null,
|
|
7
|
+
): C[] {
|
|
8
|
+
if (!props.columns.some((column) => column.omitWhenEmpty)) return props.columns;
|
|
9
|
+
// A row cut at the viewport's edge is not in view; a viewport shorter than a row has only the cut ones.
|
|
10
|
+
const inView = visibleRange && visibleRange.wholeStart !== undefined && visibleRange.wholeEnd !== undefined
|
|
11
|
+
&& visibleRange.wholeEnd > visibleRange.wholeStart ? { start: visibleRange.wholeStart, end: visibleRange.wholeEnd } : visibleRange;
|
|
12
|
+
return props.columns.filter((column) => !column.omitWhenEmpty || props.items.some((item, index) => {
|
|
13
|
+
if (column.omitWhenEmpty === "visible" && inView && (index < inView.start || index >= inView.end)) return false;
|
|
14
|
+
if (props.renderSectionHeader?.(item, index)) return false;
|
|
15
|
+
const cell = props.renderCell(item, column, index, { selected: props.isSelected(item, index) });
|
|
16
|
+
const text = cell.text.trim();
|
|
17
|
+
return text !== "" && text !== MISSING_VALUE;
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useRef } from "react";
|
|
2
2
|
import { useAppDispatch, usePaneInstance } from "../../../state/app/context";
|
|
3
3
|
import type { DataTableProps, DataTableVisibleRange } from "./types";
|
|
4
|
-
import { resolveDataTableVisibleRange } from "./visible-range";
|
|
4
|
+
import { resolveDataTableVisibleRange, sameVisibleRange } from "./visible-range";
|
|
5
5
|
|
|
6
6
|
/** Focuses the pane that owns the table, as every click inside it does. */
|
|
7
7
|
export function useFocusOwningPane(): () => void {
|
|
@@ -37,8 +37,7 @@ export function useVisibleRangeEmitter({
|
|
|
37
37
|
if (
|
|
38
38
|
previous !== null
|
|
39
39
|
&& previous.key === visibleRangeKey
|
|
40
|
-
&& previous.range
|
|
41
|
-
&& previous.range.end === range.end
|
|
40
|
+
&& sameVisibleRange(previous.range, range)
|
|
42
41
|
) return;
|
|
43
42
|
lastVisibleRangeRef.current = { key: visibleRangeKey, range };
|
|
44
43
|
onVisibleRangeChange(range);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type ComponentType, useEffect, useMemo, useRef } from "react";
|
|
1
|
+
import { type ComponentType, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { useRendererHost, useUiHost } from "../../../ui";
|
|
3
3
|
import { OpenTuiDataTable } from "./opentui";
|
|
4
4
|
import type {
|
|
5
5
|
DataTableColumn,
|
|
6
6
|
DataTableProps,
|
|
7
|
+
DataTableVisibleRange,
|
|
7
8
|
} from "./types";
|
|
8
9
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
9
10
|
import { remoteNumberValue, resolveRemoteRowIndex } from "../../../remote/semantic-helpers";
|
|
@@ -13,6 +14,8 @@ import { createDataTableCsv } from "../../data-table/export";
|
|
|
13
14
|
import { headerCase } from "../header-case";
|
|
14
15
|
import { figureColumnCells } from "./render-cell";
|
|
15
16
|
import { useDataTableColumnOrder } from "./use-column-order";
|
|
17
|
+
import { dataTableDisplayColumns } from "./display-columns";
|
|
18
|
+
import { sameVisibleRange } from "./visible-range";
|
|
16
19
|
|
|
17
20
|
export type {
|
|
18
21
|
DataTableCell,
|
|
@@ -38,6 +41,23 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
|
|
|
38
41
|
onColumnMove: ownProps.onColumnMove ?? order.onColumnMove,
|
|
39
42
|
anchoredColumns: ownProps.onColumnMove ? ownProps.anchoredColumns : order.anchoredColumns,
|
|
40
43
|
};
|
|
44
|
+
const [visibleRange, setVisibleRange] = useState<DataTableVisibleRange | null>(null);
|
|
45
|
+
const onVisibleRangeChange = useCallback((range: DataTableVisibleRange) => {
|
|
46
|
+
// A viewport not laid out yet reports no rows: it would hide every in-view
|
|
47
|
+
// column for a frame, so the columns wait for a range with rows in it.
|
|
48
|
+
if (range.end > range.start) setVisibleRange((previous) => previous && sameVisibleRange(previous, range) ? previous : range);
|
|
49
|
+
ownProps.onVisibleRangeChange?.(range);
|
|
50
|
+
}, [ownProps.onVisibleRangeChange]);
|
|
51
|
+
const displayColumns = useMemo(() => dataTableDisplayColumns(props, visibleRange),
|
|
52
|
+
[props.columns, props.items, props.renderCell, props.renderSectionHeader, props.isSelected, visibleRange]);
|
|
53
|
+
const reportProps = {
|
|
54
|
+
...props,
|
|
55
|
+
columns: displayColumns,
|
|
56
|
+
reportColumns: useMemo(() => [
|
|
57
|
+
...props.columns.filter((column) => !displayColumns.includes(column)),
|
|
58
|
+
...props.reportColumns ?? [],
|
|
59
|
+
], [props.columns, displayColumns, props.reportColumns]),
|
|
60
|
+
};
|
|
41
61
|
const paneId = useOptionalPaneInstanceId();
|
|
42
62
|
const renderer = useRendererHost();
|
|
43
63
|
const propsRef = useRef(props);
|
|
@@ -49,7 +69,9 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
|
|
|
49
69
|
if (!paneId || !renderer.saveTextFile) return;
|
|
50
70
|
return registerPaneTableExporter(paneId, (filename) => renderer.saveTextFile!({
|
|
51
71
|
name: filename,
|
|
52
|
-
text: propsRef.current.exportCsv?.() ?? createDataTableCsv(propsRef.current
|
|
72
|
+
text: propsRef.current.exportCsv?.() ?? createDataTableCsv(propsRef.current.exportItems
|
|
73
|
+
? { ...propsRef.current, items: propsRef.current.exportItems }
|
|
74
|
+
: propsRef.current),
|
|
53
75
|
mimeType: "text/csv;charset=utf-8",
|
|
54
76
|
}), () => propsRef.current.exportName);
|
|
55
77
|
}, [paneId, renderer]);
|
|
@@ -104,30 +126,42 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
|
|
|
104
126
|
paneInstanceId: paneId,
|
|
105
127
|
sortColumnId: props.sortColumnId,
|
|
106
128
|
sortDirection: props.sortDirection,
|
|
107
|
-
columns:
|
|
129
|
+
columns: displayColumns.map((column) => ({ id: column.id, label: column.label, ...(column.mayBeBlank ? { mayBeBlank: true } : {}) })),
|
|
108
130
|
rowCount: props.items.length,
|
|
109
131
|
selectedId: firstSelectedId(props),
|
|
110
|
-
...(props.reportEveryRow ? { rows: cachedReportedRows(
|
|
132
|
+
...(props.reportEveryRow ? { rows: cachedReportedRows(reportProps, reportedRowsRef) } : {}),
|
|
111
133
|
}),
|
|
112
134
|
// Read for this table alone: a confirmation names the row a call would open.
|
|
113
|
-
getDetail: () => ({ rows: cachedReportedRows(
|
|
135
|
+
getDetail: () => ({ rows: cachedReportedRows(reportProps, reportedRowsRef) }),
|
|
114
136
|
});
|
|
115
137
|
// Header labels read the same in every table whatever case a pane wrote
|
|
116
138
|
// them in. Exports and automation keep the pane's own labels.
|
|
117
139
|
const columns = useMemo(
|
|
118
|
-
() =>
|
|
140
|
+
() => displayColumns.map((column) => {
|
|
119
141
|
const label = headerCase(column.label);
|
|
120
142
|
return label === column.label ? column : { ...column, label };
|
|
121
143
|
}),
|
|
122
|
-
[
|
|
144
|
+
[displayColumns],
|
|
123
145
|
);
|
|
124
146
|
const HostDataTable = useUiHost().DataTable as
|
|
125
147
|
| ComponentType<DataTableProps<T, C>>
|
|
126
148
|
| undefined;
|
|
149
|
+
const displayProps = {
|
|
150
|
+
...props,
|
|
151
|
+
columns,
|
|
152
|
+
anchoredColumns: props.anchoredColumns == null ? undefined
|
|
153
|
+
: props.columns.slice(0, props.anchoredColumns).filter((column) => displayColumns.includes(column)).length,
|
|
154
|
+
onColumnMove: props.onColumnMove ? (columnId: string, toIndex: number) => {
|
|
155
|
+
const target = displayColumns[toIndex];
|
|
156
|
+
if (target) props.onColumnMove?.(columnId, props.columns.indexOf(target));
|
|
157
|
+
} : undefined,
|
|
158
|
+
onVisibleRangeChange: props.columns.some((column) => column.omitWhenEmpty === "visible")
|
|
159
|
+
? onVisibleRangeChange : props.onVisibleRangeChange,
|
|
160
|
+
};
|
|
127
161
|
if (HostDataTable) {
|
|
128
|
-
return <HostDataTable {...
|
|
162
|
+
return <HostDataTable {...displayProps} />;
|
|
129
163
|
}
|
|
130
|
-
return <OpenTuiDataTable {...
|
|
164
|
+
return <OpenTuiDataTable {...displayProps} />;
|
|
131
165
|
}
|
|
132
166
|
|
|
133
167
|
function resolveTableIndex<T, C extends DataTableColumn>(
|
|
@@ -27,6 +27,15 @@ export type DataTableColumn = Pick<
|
|
|
27
27
|
* column blank in every row as data the pane lost, except this one.
|
|
28
28
|
*/
|
|
29
29
|
mayBeBlank?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Leave this column out of the pane while every data row renders an empty
|
|
32
|
+
* cell or MISSING_VALUE. Use for unavailable coverage, not a pending event
|
|
33
|
+
* (mayBeBlank). "visible" checks just the rows wholly in view, for a
|
|
34
|
+
* chronological history whose older rows have coverage its recent rows
|
|
35
|
+
* lack. Scrolling restores the column when a row has a value. Reports and
|
|
36
|
+
* CSV exports keep the column and its raw cells.
|
|
37
|
+
*/
|
|
38
|
+
omitWhenEmpty?: boolean | "visible";
|
|
30
39
|
};
|
|
31
40
|
|
|
32
41
|
export interface DataTableCell {
|
|
@@ -154,6 +163,13 @@ export interface DataTableVisibleRange {
|
|
|
154
163
|
start: number;
|
|
155
164
|
/** Exclusive end of the visible row range. */
|
|
156
165
|
end: number;
|
|
166
|
+
/**
|
|
167
|
+
* The rows wholly in view, without the buffer, where they are not
|
|
168
|
+
* start/end: a row the viewport cuts at an edge, drawn in part, is left
|
|
169
|
+
* out. A capture that ends on a whole row draws exactly these.
|
|
170
|
+
*/
|
|
171
|
+
wholeStart?: number;
|
|
172
|
+
wholeEnd?: number;
|
|
157
173
|
}
|
|
158
174
|
|
|
159
175
|
export interface DataTableProps<
|
|
@@ -276,6 +292,11 @@ export interface DataTableProps<
|
|
|
276
292
|
* writes its daily curve, as `fn BT --csv --equity` prints it.
|
|
277
293
|
*/
|
|
278
294
|
exportCsv?: () => string;
|
|
295
|
+
/**
|
|
296
|
+
* The rows Export CSV writes in place of `items`, for a table that draws
|
|
297
|
+
* fewer rows than it holds: a watchlist writes the rows of a collapsed group too.
|
|
298
|
+
*/
|
|
299
|
+
exportItems?: T[];
|
|
279
300
|
/**
|
|
280
301
|
* A rendered-view report (`gloom fn`) reads every row, not only those
|
|
281
302
|
* the viewport shows. For a bounded table a reader needs whole, such as an
|
|
@@ -21,7 +21,17 @@ export function resolveDataTableVisibleRange({
|
|
|
21
21
|
const extra = Number.isFinite(buffer) ? Math.max(0, Math.floor(buffer)) : 0;
|
|
22
22
|
const start = Math.min(count, Math.floor(offset / size));
|
|
23
23
|
const end = Math.min(count, Math.max(start, Math.ceil((offset + viewport) / size)));
|
|
24
|
-
|
|
24
|
+
// A pixel of subpixel layout does not cut a row.
|
|
25
|
+
const wholeStart = Math.max(0, Math.min(count, Math.ceil(offset / size - WHOLE_ROW_TOLERANCE)));
|
|
26
|
+
const wholeEnd = Math.min(count, Math.max(wholeStart, Math.floor((offset + viewport) / size + WHOLE_ROW_TOLERANCE)));
|
|
27
|
+
const range = { start: Math.max(0, start - extra), end: Math.min(count, end + extra) };
|
|
28
|
+
return range.start === wholeStart && range.end === wholeEnd ? range : { ...range, wholeStart, wholeEnd };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const WHOLE_ROW_TOLERANCE = 0.05;
|
|
32
|
+
|
|
33
|
+
export function sameVisibleRange(a: DataTableVisibleRange, b: DataTableVisibleRange): boolean {
|
|
34
|
+
return a.start === b.start && a.end === b.end && a.wholeStart === b.wholeStart && a.wholeEnd === b.wholeEnd;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
/** The first visible row, in rows, that brings `targetIndex` into view. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cloneLayout, createBlankLayout, getPlacedPaneInstanceIds, type SavedLayout } from "../../../types/config";
|
|
2
2
|
import { movePaneBack, movePaneToOwnLayout, paneMoveBackTarget } from "../../../layout/pane-layout-move";
|
|
3
|
+
import { relinkPinnedResearchPanes } from "../../../layout/pane-follow";
|
|
3
4
|
import {
|
|
4
5
|
clonePaneStateMap,
|
|
5
6
|
cloneSavedLayout,
|
|
@@ -85,7 +86,8 @@ export function reduceLayoutAction(state: AppState, action: AppAction): AppState
|
|
|
85
86
|
case "UPDATE_LAYOUT":
|
|
86
87
|
return withFocusedPane(
|
|
87
88
|
state,
|
|
88
|
-
|
|
89
|
+
// A research pane the app unlinked follows again when the change gives it a source back.
|
|
90
|
+
{ ...state.config, layout: relinkPinnedResearchPanes(action.layout, state.config.layout) },
|
|
89
91
|
Object.prototype.hasOwnProperty.call(action, "focusedPaneId")
|
|
90
92
|
? { focusedPaneId: action.focusedPaneId ?? null }
|
|
91
93
|
: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compactFloatingZ, getDockLeafLayouts, getDockedPaneIds, removePane, showDockTab, withoutTransientPanes } from "../../../layout/pane-manager";
|
|
2
|
-
import {
|
|
2
|
+
import { pinOrphanedFollower } from "../../../layout/pane-follow";
|
|
3
3
|
import {
|
|
4
4
|
cloneLayout,
|
|
5
5
|
findPaneInstance,
|
|
@@ -627,7 +627,7 @@ export function withFocusedPane(
|
|
|
627
627
|
const normalizedLayout = normalizePaneLayout(config.layout, {
|
|
628
628
|
// Keep a follower alive on its last symbol when its source pane is gone.
|
|
629
629
|
resolveOrphanSymbol: (instanceId) => resolveTickerForPane(state, instanceId),
|
|
630
|
-
pinOrphan:
|
|
630
|
+
pinOrphan: pinOrphanedFollower(state.config.layout),
|
|
631
631
|
externalSourceIds: options.externalSourceIds ?? linkedSourceIds(state),
|
|
632
632
|
});
|
|
633
633
|
const nextConfig = normalizedLayout === config.layout
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
PaneMovedFrom,
|
|
9
9
|
PaneMovedLink,
|
|
10
10
|
PanePlacementMemory,
|
|
11
|
+
PaneUnlinkedFrom,
|
|
11
12
|
} from "../../types/config";
|
|
12
13
|
import type { BrokerContractRef, TickerListingRef } from "../../types/instrument";
|
|
13
14
|
import {
|
|
@@ -148,6 +149,17 @@ function sanitizePaneMovedFrom(value: unknown): PaneMovedFrom | undefined {
|
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
function sanitizePaneUnlinkedFrom(value: unknown): PaneUnlinkedFrom | undefined {
|
|
153
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return undefined;
|
|
154
|
+
const raw = value as Record<string, unknown>;
|
|
155
|
+
if (typeof raw.instanceId !== "string" || !raw.instanceId) return undefined;
|
|
156
|
+
return {
|
|
157
|
+
instanceId: raw.instanceId,
|
|
158
|
+
...(typeof raw.paneId === "string" && raw.paneId ? { paneId: raw.paneId } : {}),
|
|
159
|
+
...(raw.auto === true ? { auto: true as const } : {}),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
151
163
|
function sanitizePlacementMemory(value: unknown): PanePlacementMemory | undefined {
|
|
152
164
|
if (!value || typeof value !== "object") return undefined;
|
|
153
165
|
|
|
@@ -212,6 +224,7 @@ function sanitizePaneInstances(
|
|
|
212
224
|
const binding = sanitizePaneBinding(entry.binding);
|
|
213
225
|
const settings = sanitizePaneSettings(entry.settings);
|
|
214
226
|
const movedFrom = sanitizePaneMovedFrom(entry.movedFrom);
|
|
227
|
+
const unlinkedFrom = sanitizePaneUnlinkedFrom(entry.unlinkedFrom);
|
|
215
228
|
return {
|
|
216
229
|
instanceId,
|
|
217
230
|
paneId,
|
|
@@ -226,6 +239,7 @@ function sanitizePaneInstances(
|
|
|
226
239
|
placementMemory: sanitizePlacementMemory(entry.placementMemory),
|
|
227
240
|
locked: entry.locked === true ? true : undefined,
|
|
228
241
|
...(movedFrom ? { movedFrom } : {}),
|
|
242
|
+
...(unlinkedFrom ? { unlinkedFrom } : {}),
|
|
229
243
|
};
|
|
230
244
|
});
|
|
231
245
|
return instances;
|
|
@@ -24,6 +24,7 @@ import { migrateSavedConfig, type ConfigMigrationHost } from "./migrations";
|
|
|
24
24
|
import { encodeBuiltinDisabledPluginIds, expandBuiltinPluginGroups } from "../../../plugins/ownership";
|
|
25
25
|
import { sanitizeSavedPaneState } from "./pane-state";
|
|
26
26
|
import { isRecord } from "../../../utils/guards";
|
|
27
|
+
import { normalizeWatchlistGroups } from "../../../portfolio/watchlist-groups";
|
|
27
28
|
import { normalizeStoredBaseCurrency } from "../../../utils/base-currency";
|
|
28
29
|
import { debugLog } from "../../../utils/debug-log";
|
|
29
30
|
import { DEFAULT_THEME, themes } from "../../../theme/themes";
|
|
@@ -98,8 +99,10 @@ export function normalizeLoadedConfig(
|
|
|
98
99
|
...sanitizePluginSeedFailure(candidate.pluginSeedFailure),
|
|
99
100
|
...(candidate.portfolioCurrenciesAdopted === true ? { portfolioCurrenciesAdopted: true } : {}),
|
|
100
101
|
...(candidate.presentationMode === true ? { presentationMode: true } : {}),
|
|
102
|
+
...(candidate.sinceLastVisit === false ? { sinceLastVisit: false } : {}),
|
|
101
103
|
...withHeaderMarket(sanitizeHeaderMarketChoice(candidate.headerMarket)),
|
|
102
104
|
...(typeof candidate.timezone === "string" && candidate.timezone.trim() ? { timezone: candidate.timezone.trim() } : {}),
|
|
105
|
+
...(candidate.csvDecimal === "comma" ? { csvDecimal: "comma" as const } : {}),
|
|
103
106
|
disabledSources: sanitizeUniqueStringList(candidate.disabledSources ?? defaults.disabledSources),
|
|
104
107
|
pluginConfig: sanitizePluginConfig(candidate.pluginConfig),
|
|
105
108
|
theme: sanitizeTheme(candidate.theme, defaults.theme),
|
|
@@ -184,6 +187,9 @@ export function normalizeConfigForSave(config: AppConfig): AppConfig {
|
|
|
184
187
|
Object.assign(persisted, withStarPrompt(sanitizeStarPrompt(config.starPrompt)));
|
|
185
188
|
delete persisted.updates;
|
|
186
189
|
Object.assign(persisted, withUpdates(sanitizeUpdatesConfig(config.updates)));
|
|
190
|
+
// Only off is saved; on is the default.
|
|
191
|
+
delete persisted.sinceLastVisit;
|
|
192
|
+
if (config.sinceLastVisit === false) persisted.sinceLastVisit = false;
|
|
187
193
|
|
|
188
194
|
return persisted;
|
|
189
195
|
}
|
|
@@ -429,7 +435,11 @@ function sanitizeWatchlists(value: unknown, fallback: Watchlist[]): Watchlist[]
|
|
|
429
435
|
&& typeof (entry as Watchlist).id === "string"
|
|
430
436
|
&& typeof (entry as Watchlist).name === "string",
|
|
431
437
|
)
|
|
432
|
-
.map((
|
|
438
|
+
.map(({ groups, ...entry }) => {
|
|
439
|
+
// Malformed groups are dropped, and a list left with none has no `groups` at all.
|
|
440
|
+
const kept = normalizeWatchlistGroups(groups);
|
|
441
|
+
return kept ? { ...entry, groups: kept } : entry;
|
|
442
|
+
});
|
|
433
443
|
}
|
|
434
444
|
|
|
435
445
|
function sanitizeBrokerInstances(value: unknown): BrokerInstanceConfig[] {
|
package/src/i18n/es.ts
CHANGED
|
@@ -17,6 +17,7 @@ export const es: Record<string, string> = {
|
|
|
17
17
|
"Linked to {source}": "Vinculado a {source}",
|
|
18
18
|
"Link to {source}": "Vincular a {source}",
|
|
19
19
|
"Unlink from {source}": "Desvincular de {source}",
|
|
20
|
+
"Unlinked": "Desvinculado",
|
|
20
21
|
"Working…": "Procesando…",
|
|
21
22
|
"Searching…": "Buscando…",
|
|
22
23
|
"Loading...": "Cargando...",
|
|
@@ -761,6 +762,43 @@ export const es: Record<string, string> = {
|
|
|
761
762
|
"Status": "Estado",
|
|
762
763
|
"Manage Pro": "Gestionar Pro",
|
|
763
764
|
"Opening...": "Abriendo...",
|
|
765
|
+
"Payment": "Pago",
|
|
766
|
+
"Pay invoice": "Pagar factura",
|
|
767
|
+
"Your Pro payment did not go through.": "Tu pago de Pro no se ha completado.",
|
|
768
|
+
"Could not refresh your account. Try again.": "No se pudo actualizar tu cuenta. Inténtalo de nuevo.",
|
|
769
|
+
"Could not open invoice payment. Try again.": "No se pudo abrir el pago de la factura. Inténtalo de nuevo.",
|
|
770
|
+
"Invoice opened in your browser.": "La factura se ha abierto en tu navegador.",
|
|
771
|
+
"Yearly is {yearly} a year, {savings} less than twelve monthly payments of {monthly} ({twelve}).": "El plan anual cuesta {yearly} al año, {savings} menos que doce pagos mensuales de {monthly} ({twelve}).",
|
|
772
|
+
"The total changed since you reviewed it. Review it again.": "El total ha cambiado desde que lo revisaste. Revísalo de nuevo.",
|
|
773
|
+
"This total has expired. Review it again.": "Este total ha caducado. Revísalo de nuevo.",
|
|
774
|
+
"This review is no longer valid. Review the switch again.": "Esta revisión ya no es válida. Revisa el cambio de nuevo.",
|
|
775
|
+
"Your switch is already going through. Refresh in a moment.": "Tu cambio ya se está procesando. Actualiza en un momento.",
|
|
776
|
+
"Your switch to yearly is waiting for its payment.": "Tu cambio al plan anual está pendiente de pago.",
|
|
777
|
+
"Yearly billing can't be set up for this plan here. Your plan is unchanged.": "No se puede configurar la facturación anual para este plan aquí. Tu plan no ha cambiado.",
|
|
778
|
+
"The switch didn't go through and your plan is unchanged. Try again in a minute.": "El cambio no se ha completado y tu plan no ha cambiado. Inténtalo de nuevo en un minuto.",
|
|
779
|
+
"We couldn't confirm the switch. Refresh your account before trying again.": "No hemos podido confirmar el cambio. Actualiza tu cuenta antes de volver a intentarlo.",
|
|
780
|
+
"Couldn't work out the yearly total. Try again in a minute.": "No se ha podido calcular el total anual. Inténtalo de nuevo en un minuto.",
|
|
781
|
+
"Yearly Pro, today to {date}": "Pro anual, de hoy al {date}",
|
|
782
|
+
"Credit for the rest of this month": "Crédito por el resto de este mes",
|
|
783
|
+
"Tax": "Impuestos",
|
|
784
|
+
"Account credit": "Saldo a favor",
|
|
785
|
+
"Due today": "A pagar hoy",
|
|
786
|
+
"Then {amount} a year plus tax, renewing {date}.": "Después, {amount} al año más impuestos, con renovación el {date}.",
|
|
787
|
+
"Then {amount} a year, renewing {date}.": "Después, {amount} al año, con renovación el {date}.",
|
|
788
|
+
"Your switch to yearly needs the payment confirmed. You stay on monthly billing until it is paid.": "Tu cambio al plan anual necesita que confirmes el pago. Sigues con facturación mensual hasta que se pague.",
|
|
789
|
+
"Unpaid by {date}, the switch is dropped.": "Si no se paga antes del {date}, el cambio se cancela.",
|
|
790
|
+
"Your payment is processing. You move to yearly billing once it clears.": "Tu pago se está procesando. Pasarás a la facturación anual cuando se complete.",
|
|
791
|
+
"You're on yearly billing.": "Ya tienes facturación anual.",
|
|
792
|
+
"Paid {amount} today.": "Has pagado {amount} hoy.",
|
|
793
|
+
"Renews {date} at {amount}.": "Se renueva el {date} por {amount}.",
|
|
794
|
+
"Review Yearly": "Revisar plan anual",
|
|
795
|
+
"Switch to yearly billing": "Cambiar a facturación anual",
|
|
796
|
+
"Your saved payment method is charged today, and your plan stays monthly until it is paid.": "Se cobra hoy a tu método de pago guardado, y tu plan sigue siendo mensual hasta que se pague.",
|
|
797
|
+
"Switching...": "Cambiando...",
|
|
798
|
+
"Pay {amount} and Switch": "Pagar {amount} y cambiar",
|
|
799
|
+
"Switch to Yearly": "Cambiar a anual",
|
|
800
|
+
"Not Now": "Ahora no",
|
|
801
|
+
"Confirm Payment": "Confirmar pago",
|
|
764
802
|
"Upgrade to Pro": "Mejorar a Pro",
|
|
765
803
|
"Change Password": "Cambiar contraseña",
|
|
766
804
|
"Delete Account": "Eliminar cuenta",
|