dsh-plugin-core-demo 0.13.0 → 0.14.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/client.js +210 -93
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -5460,28 +5460,32 @@ function tableShell(skinClass, props, options = {}) {
|
|
|
5460
5460
|
flatFoot ? "dshpc-table--foot-no-bottom" : "",
|
|
5461
5461
|
props.className ?? ""
|
|
5462
5462
|
].filter((s) => s !== "").join(" ");
|
|
5463
|
+
const groupFoot = footerRows.length > 0 || sentinelRow !== null ? (0, import_react23.createElement)("tbody", { key: "group-foot", className: "dshpc-table__body" }, ...footerRows, sentinelRow) : null;
|
|
5463
5464
|
const groups = props.groups ?? [];
|
|
5464
|
-
const body = groups.length > 0 ?
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
"
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5465
|
+
const body = groups.length > 0 ? [
|
|
5466
|
+
...groups.map((group, groupIndex) => (0, import_react23.createElement)(
|
|
5467
|
+
"tbody",
|
|
5468
|
+
{ key: group.key, className: "dshpc-table__body dshpc-table__group-body" },
|
|
5469
|
+
// 通栏标题行:横跨所有列,充当这一组的「大标题」。
|
|
5470
|
+
(0, import_react23.createElement)("tr", { className: "dshpc-table__group-row" }, (0, import_react23.createElement)(
|
|
5471
|
+
"th",
|
|
5472
|
+
{
|
|
5473
|
+
className: "dshpc-table__group-cell",
|
|
5474
|
+
scope: "colgroup",
|
|
5475
|
+
colSpan: leaves.length > 0 ? leaves.length : void 0
|
|
5476
|
+
},
|
|
5477
|
+
// 标题的固定标签(短竖线)与排版归 SectionHead —— Table 只负责把标题装进通栏。
|
|
5478
|
+
(0, import_react23.createElement)(SectionHead, {
|
|
5479
|
+
title: group.title,
|
|
5480
|
+
accent: props.groupAccent ?? "default",
|
|
5481
|
+
flush: true
|
|
5482
|
+
})
|
|
5483
|
+
)),
|
|
5484
|
+
...headRows.map((cells, level) => headRowOf(cells, `g${groupIndex}-${level}`)),
|
|
5485
|
+
...dataRowsOf(group.rows, 0)
|
|
5481
5486
|
)),
|
|
5482
|
-
...
|
|
5483
|
-
|
|
5484
|
-
)) : [
|
|
5487
|
+
...groupFoot === null ? [] : [groupFoot]
|
|
5488
|
+
] : [
|
|
5485
5489
|
(0, import_react23.createElement)("tbody", { key: "body", className: "dshpc-table__body" }, props.loading === true && (props.rows?.length ?? 0) === 0 ? loadingRow : props.rows !== void 0 && props.rows.length > 0 ? dataRowsOf(props.rows) : emptyRow, ...footerRows, sentinelRow)
|
|
5486
5490
|
];
|
|
5487
5491
|
return (0, import_react23.createElement)(
|
|
@@ -5531,10 +5535,15 @@ function Table(props) {
|
|
|
5531
5535
|
ensureComponentStyles("table-plain", TABLE_PLAIN_CSS);
|
|
5532
5536
|
const pager = props.pagination;
|
|
5533
5537
|
const grouped = (props.groups?.length ?? 0) > 0;
|
|
5534
|
-
const infinite = pager === void 0
|
|
5538
|
+
const infinite = pager === void 0;
|
|
5535
5539
|
const sentinelRef = useLoadMoreSentinel(props, infinite);
|
|
5536
5540
|
if (pager === void 0 || grouped) {
|
|
5537
|
-
return tableShell(
|
|
5541
|
+
return tableShell(
|
|
5542
|
+
"dshpc-table--plain",
|
|
5543
|
+
// 分页模式下摘掉加载相关 props,避免同表两套翻页。
|
|
5544
|
+
pager === void 0 ? props : { ...props, onLoadMore: void 0, loadingMore: void 0, hasMore: void 0, noMoreText: void 0 },
|
|
5545
|
+
{ sentinelRef: infinite ? sentinelRef : void 0 }
|
|
5546
|
+
);
|
|
5538
5547
|
}
|
|
5539
5548
|
const pageSize = Math.max(1, Math.floor(pager.pageSize ?? 10));
|
|
5540
5549
|
const allRows = props.rows ?? [];
|
|
@@ -58766,8 +58775,8 @@ var docData = {
|
|
|
58766
58775
|
"en": "Skins are separate components and separate files \u2014 no variant: Table imports only its own skin CSS; future TableGrid (grid lines) / TableZebra (zebra stripes) are sibling components importing their own skins. Importing one packs only that one \u2014 choosing a table never drags the other skin into the bundle."
|
|
58767
58776
|
},
|
|
58768
58777
|
{
|
|
58769
|
-
"zh": "\u8FB9\u754C\uFF1A\u4E0D\u8D1F\u8D23\u53D6\u6570 / \u6392\u5E8F / \u865A\u62DF\u6EDA\u52A8\uFF1B\u6A2A\u5411\u6EDA\u52A8\u5BB9\u5668\u4E0E\u5706\u89D2\u88C1\u526A\u5F52\u8C03\u7528\u65B9\uFF1B\u8868\u5934\u4E0D\u505A\u5438\u9876\uFF08\u5206\u7EC4\u8868\u5934\u662F\u591A\u884C\uFF0C\u7EDF\u4E00 top:0 \u4F1A\u5728\u6EDA\u52A8\u65F6\u4E92\u76F8\u76D6\u4F4F\uFF09\u3002\u5206\u9875\u53EF\u9009\uFF1A\u7ED9 `pagination` \u5C31\u8BA9\u8868\u683C\u81EA\u5DF1\u5207\u7247\u5E76\u5728\u8868\u4E0B\u6446\u9875\u7801\uFF08\u8BE6\u89C1 Pagination \u4E00\u8282\uFF09\uFF0C\u4E0D\u7ED9\u5C31\u5B8C\u5168\u4E0D\u5206\u9875\u3002\u6CA1\u6709\u6570\u636E\u65F6\u663E\u793A\u5185\u7F6E\u7A7A\u6001\uFF08emptyText \u53EF\u8986\u76D6\uFF09\u3002\u52A0\u8F7D\u6001\u4E24\u79CD\uFF0C\u90FD\u53EA\u653E\u56FE\u6807\u3001\u4E0D\u663E\u793A\u6587\u6848\uFF1A\u9996\u5C4F\u4E00\u6761\u6570\u636E\u90FD\u6CA1\u6709\u65F6\u7528 `loading`\uFF08\u5C45\u4E2D\u4E09\u5757\u52A0\u8F7D\u52A8\u753B\u3001\u6700\u5927\u53F7\uFF0C\u8F83\u9AD8\u5360\u4F4D\uFF0C\u4E0D\u906E\u6321\u5DF2\u6709\u6570\u636E\uFF09\uFF0C\u5DF2\u6709\u6570\u636E\u7FFB\u4E0B\u4E00\u9875\u65F6\u7528 `loadingMore`\uFF08\u5E95\u90E8\u4E00\u884C\u3001\u4E2D\u53F7\u4E09\u5757\u52A8\u753B\uFF1B\u6574\u884C\u901A\u680F\uFF0C\u4E0E\u4E0A\u65B9\u6570\u636E\u884C\u4E4B\u95F4\u8865\u4E00\u6761\u5B9E\u7EBF\uFF0C\u5DE6\u53F3\u4E24\u6761\u5728 borders=all / x \u65F6\u7531\u8868\u7EA7\u5916\u6846\u515C\u4F4F\u3001y / none \u672C\u6765\u5C31\u6CA1\u6709\uFF0C\u4E14 y / none \u65F6\u72B6\u6001\u884C\u4E0B\u65B9\u90A3\u6761\u8868\u5E95\u7EBF\u4E5F\u4E00\u8D77\u53BB\u6389\uFF0C\u53EA\u7559\u4E0A\u65B9\u4E00\u6761\u5B9E\u7EBF\uFF09\uFF1B\u6EDA\u52A8\u52A0\u8F7D\u7531 `onLoadMore` \u672C\u8EAB\u5F53\u5F00\u5173 \u2014\u2014 \u4F20\u4E86\u5C31\u76D1\u542C\u5E95\u90E8\u3001\u6EDA\u5230\u9644\u8FD1\u81EA\u52A8\u8C03\u4E00\u6B21\uFF0C\u5230\u5E95\uFF08`hasMore: false`\uFF09\u663E\u793A\u300C\u6CA1\u6709\u66F4\u591A\u6570\u636E\u300D\uFF08`noMoreText` \u6362\u6587\u6848 / `false` \u4E0D\u6E32\u67D3\uFF09\u3002\u6EDA\u52A8\u52A0\u8F7D\u4E0E `pagination`
|
|
58770
|
-
"en": "Boundaries: no fetching / sorting / virtual scrolling; the horizontal scroll container and rounded clipping are the caller\u2019s; headers do not stick (the grouped header spans multiple rows, and a single top:0 would overlap itself while scrolling). Paging is optional: pass `pagination` and the table slices rows itself and renders the pager underneath (see the Pagination section); omit it and nothing pages. With no rows, a built-in empty state shows (override with emptyText). Two loading states, icon only with no visible copy: `loading` for a first load with no rows at all (centred three-block loader at the largest size, a taller placeholder that never covers existing rows), and `loadingMore` when appending the next page (one full-width bottom row with the middle-size three-block loader; a solid rule is added above it, while the left/right edges come from the table frame when borders=all / x and are absent for y / none \u2014 and for y / none the bottom table rule under the status row is dropped too, so only the rule above it remains). Scroll loading uses `onLoadMore` itself as the switch: pass it and the table watches the bottom and calls it once when you get near; at the end (`hasMore: false`) it shows \u201CNo more data\u201D (`noMoreText` to change the copy / `false` to render nothing). Scroll loading is mutually exclusive with `pagination
|
|
58778
|
+
"zh": "\u8FB9\u754C\uFF1A\u4E0D\u8D1F\u8D23\u53D6\u6570 / \u6392\u5E8F / \u865A\u62DF\u6EDA\u52A8\uFF1B\u6A2A\u5411\u6EDA\u52A8\u5BB9\u5668\u4E0E\u5706\u89D2\u88C1\u526A\u5F52\u8C03\u7528\u65B9\uFF1B\u8868\u5934\u4E0D\u505A\u5438\u9876\uFF08\u5206\u7EC4\u8868\u5934\u662F\u591A\u884C\uFF0C\u7EDF\u4E00 top:0 \u4F1A\u5728\u6EDA\u52A8\u65F6\u4E92\u76F8\u76D6\u4F4F\uFF09\u3002\u5206\u9875\u53EF\u9009\uFF1A\u7ED9 `pagination` \u5C31\u8BA9\u8868\u683C\u81EA\u5DF1\u5207\u7247\u5E76\u5728\u8868\u4E0B\u6446\u9875\u7801\uFF08\u8BE6\u89C1 Pagination \u4E00\u8282\uFF09\uFF0C\u4E0D\u7ED9\u5C31\u5B8C\u5168\u4E0D\u5206\u9875\u3002\u6CA1\u6709\u6570\u636E\u65F6\u663E\u793A\u5185\u7F6E\u7A7A\u6001\uFF08emptyText \u53EF\u8986\u76D6\uFF09\u3002\u52A0\u8F7D\u6001\u4E24\u79CD\uFF0C\u90FD\u53EA\u653E\u56FE\u6807\u3001\u4E0D\u663E\u793A\u6587\u6848\uFF1A\u9996\u5C4F\u4E00\u6761\u6570\u636E\u90FD\u6CA1\u6709\u65F6\u7528 `loading`\uFF08\u5C45\u4E2D\u4E09\u5757\u52A0\u8F7D\u52A8\u753B\u3001\u6700\u5927\u53F7\uFF0C\u8F83\u9AD8\u5360\u4F4D\uFF0C\u4E0D\u906E\u6321\u5DF2\u6709\u6570\u636E\uFF09\uFF0C\u5DF2\u6709\u6570\u636E\u7FFB\u4E0B\u4E00\u9875\u65F6\u7528 `loadingMore`\uFF08\u5E95\u90E8\u4E00\u884C\u3001\u4E2D\u53F7\u4E09\u5757\u52A8\u753B\uFF1B\u6574\u884C\u901A\u680F\uFF0C\u4E0E\u4E0A\u65B9\u6570\u636E\u884C\u4E4B\u95F4\u8865\u4E00\u6761\u5B9E\u7EBF\uFF0C\u5DE6\u53F3\u4E24\u6761\u5728 borders=all / x \u65F6\u7531\u8868\u7EA7\u5916\u6846\u515C\u4F4F\u3001y / none \u672C\u6765\u5C31\u6CA1\u6709\uFF0C\u4E14 y / none \u65F6\u72B6\u6001\u884C\u4E0B\u65B9\u90A3\u6761\u8868\u5E95\u7EBF\u4E5F\u4E00\u8D77\u53BB\u6389\uFF0C\u53EA\u7559\u4E0A\u65B9\u4E00\u6761\u5B9E\u7EBF\uFF09\uFF1B\u6EDA\u52A8\u52A0\u8F7D\u7531 `onLoadMore` \u672C\u8EAB\u5F53\u5F00\u5173 \u2014\u2014 \u4F20\u4E86\u5C31\u76D1\u542C\u5E95\u90E8\u3001\u6EDA\u5230\u9644\u8FD1\u81EA\u52A8\u8C03\u4E00\u6B21\uFF0C\u5230\u5E95\uFF08`hasMore: false`\uFF09\u663E\u793A\u300C\u6CA1\u6709\u66F4\u591A\u6570\u636E\u300D\uFF08`noMoreText` \u6362\u6587\u6848 / `false` \u4E0D\u6E32\u67D3\uFF09\u3002\u6EDA\u52A8\u52A0\u8F7D\u4E0E `pagination` \u4E92\u65A5\uFF1B`groups` \u6A21\u5F0F\u53EF\u7528\uFF0C\u5E95\u90E8\u72B6\u6001\u884C\u4E0E\u54E8\u5175\u6392\u5728\u6700\u540E\u4E00\u7EC4\u4E4B\u540E\u3002",
|
|
58779
|
+
"en": "Boundaries: no fetching / sorting / virtual scrolling; the horizontal scroll container and rounded clipping are the caller\u2019s; headers do not stick (the grouped header spans multiple rows, and a single top:0 would overlap itself while scrolling). Paging is optional: pass `pagination` and the table slices rows itself and renders the pager underneath (see the Pagination section); omit it and nothing pages. With no rows, a built-in empty state shows (override with emptyText). Two loading states, icon only with no visible copy: `loading` for a first load with no rows at all (centred three-block loader at the largest size, a taller placeholder that never covers existing rows), and `loadingMore` when appending the next page (one full-width bottom row with the middle-size three-block loader; a solid rule is added above it, while the left/right edges come from the table frame when borders=all / x and are absent for y / none \u2014 and for y / none the bottom table rule under the status row is dropped too, so only the rule above it remains). Scroll loading uses `onLoadMore` itself as the switch: pass it and the table watches the bottom and calls it once when you get near; at the end (`hasMore: false`) it shows \u201CNo more data\u201D (`noMoreText` to change the copy / `false` to render nothing). Scroll loading is mutually exclusive with `pagination`; it works in `groups` mode, with the status row and sentinel placed after the last group."
|
|
58771
58780
|
}
|
|
58772
58781
|
],
|
|
58773
58782
|
"api": [
|
|
@@ -58924,8 +58933,8 @@ var docData = {
|
|
|
58924
58933
|
"type": "() => void",
|
|
58925
58934
|
"def": "\u2014",
|
|
58926
58935
|
"desc": {
|
|
58927
|
-
"zh": "\u6EDA\u52A8\u5230\u5E95\u81EA\u52A8\u52A0\u8F7D\u4E0B\u4E00\u9875\uFF1A\u8FD9\u4E2A props \u672C\u8EAB\u5C31\u662F\u5F00\u5173 \u2014\u2014 \u4F20\u4E86\u5C31\u88C5\u5E95\u90E8\u54E8\u5175\u5E76\u76D1\u542C\uFF0C\u4E0D\u4F20\u5B8C\u5168\u4E0D\u76D1\u542C\uFF1B\u52A0\u8F7D\u4E2D / \u5230\u5E95\u4E0D\u91CD\u590D\u89E6\u53D1\u3002\u4E0E pagination
|
|
58928
|
-
"en": "Auto-load the next page when scrolled near the bottom: this prop is the switch \u2014 pass it to install the sentinel and watch, omit it and nothing listens; guarded while loading or at the end. Mutually exclusive with pagination
|
|
58936
|
+
"zh": "\u6EDA\u52A8\u5230\u5E95\u81EA\u52A8\u52A0\u8F7D\u4E0B\u4E00\u9875\uFF1A\u8FD9\u4E2A props \u672C\u8EAB\u5C31\u662F\u5F00\u5173 \u2014\u2014 \u4F20\u4E86\u5C31\u88C5\u5E95\u90E8\u54E8\u5175\u5E76\u76D1\u542C\uFF0C\u4E0D\u4F20\u5B8C\u5168\u4E0D\u76D1\u542C\uFF1B\u52A0\u8F7D\u4E2D / \u5230\u5E95\u4E0D\u91CD\u590D\u89E6\u53D1\u3002\u4E0E pagination \u4E92\u65A5\uFF1Bgroups \u6A21\u5F0F\u53EF\u7528\uFF08\u72B6\u6001\u884C\u6392\u5728\u6700\u540E\u4E00\u7EC4\u4E4B\u540E\uFF09",
|
|
58937
|
+
"en": "Auto-load the next page when scrolled near the bottom: this prop is the switch \u2014 pass it to install the sentinel and watch, omit it and nothing listens; guarded while loading or at the end. Mutually exclusive with pagination; works in groups mode (status row after the last group)"
|
|
58929
58938
|
}
|
|
58930
58939
|
},
|
|
58931
58940
|
{
|
|
@@ -62081,6 +62090,29 @@ function sortEntries(entries2) {
|
|
|
62081
62090
|
function listPathOf(dir) {
|
|
62082
62091
|
return dir === "" ? "." : dir;
|
|
62083
62092
|
}
|
|
62093
|
+
function createRequestGate() {
|
|
62094
|
+
let active = null;
|
|
62095
|
+
return {
|
|
62096
|
+
begin() {
|
|
62097
|
+
active?.abort();
|
|
62098
|
+
const next = new AbortController();
|
|
62099
|
+
active = next;
|
|
62100
|
+
return {
|
|
62101
|
+
signal: next.signal,
|
|
62102
|
+
current: () => active === next && !next.signal.aborted
|
|
62103
|
+
};
|
|
62104
|
+
},
|
|
62105
|
+
abort() {
|
|
62106
|
+
active?.abort();
|
|
62107
|
+
active = null;
|
|
62108
|
+
}
|
|
62109
|
+
};
|
|
62110
|
+
}
|
|
62111
|
+
function isAborted(signal, error) {
|
|
62112
|
+
if (signal?.aborted === true)
|
|
62113
|
+
return true;
|
|
62114
|
+
return typeof error === "object" && error !== null && error.name === "AbortError";
|
|
62115
|
+
}
|
|
62084
62116
|
function createRootCache() {
|
|
62085
62117
|
const map = /* @__PURE__ */ new Map();
|
|
62086
62118
|
return {
|
|
@@ -62117,17 +62149,21 @@ function relativizeToRoot(cache5, sessionId, dir) {
|
|
|
62117
62149
|
return dir.slice(norm.length + 1);
|
|
62118
62150
|
return dir;
|
|
62119
62151
|
}
|
|
62120
|
-
async function findAnyFileAbs(workspaceFiles2, sessionId, startDir) {
|
|
62152
|
+
async function findAnyFileAbs(workspaceFiles2, sessionId, startDir, signal) {
|
|
62121
62153
|
const stat = workspaceFiles2.stat;
|
|
62122
62154
|
if (stat === void 0)
|
|
62123
62155
|
return null;
|
|
62124
62156
|
let frontier = [startDir];
|
|
62125
62157
|
for (let depth = 0; depth < 3 && frontier.length > 0; depth++) {
|
|
62158
|
+
if (signal?.aborted)
|
|
62159
|
+
return null;
|
|
62126
62160
|
const nextDirs = [];
|
|
62127
62161
|
for (const dir of frontier.slice(0, 5)) {
|
|
62162
|
+
if (signal?.aborted)
|
|
62163
|
+
return null;
|
|
62128
62164
|
let entries2;
|
|
62129
62165
|
try {
|
|
62130
|
-
const parsed = listingOf(await workspaceFiles2.list(sessionId, listPathOf(dir)));
|
|
62166
|
+
const parsed = listingOf(await workspaceFiles2.list(sessionId, listPathOf(dir), signal));
|
|
62131
62167
|
if (parsed === null || isFailed(parsed))
|
|
62132
62168
|
continue;
|
|
62133
62169
|
entries2 = parsed.entries;
|
|
@@ -62138,7 +62174,7 @@ async function findAnyFileAbs(workspaceFiles2, sessionId, startDir) {
|
|
|
62138
62174
|
if (file !== void 0) {
|
|
62139
62175
|
const rel = relJoin(dir, file.name);
|
|
62140
62176
|
try {
|
|
62141
|
-
const abs = absolutePathOf(await stat(sessionId, rel));
|
|
62177
|
+
const abs = absolutePathOf(await stat(sessionId, rel, signal));
|
|
62142
62178
|
if (abs !== null)
|
|
62143
62179
|
return { absolutePath: abs, relativePath: rel };
|
|
62144
62180
|
} catch {
|
|
@@ -62153,7 +62189,7 @@ async function findAnyFileAbs(workspaceFiles2, sessionId, startDir) {
|
|
|
62153
62189
|
}
|
|
62154
62190
|
return null;
|
|
62155
62191
|
}
|
|
62156
|
-
async function absolutizeDir(cache5, workspaceFiles2, sessionId, dir, canonical, entries2) {
|
|
62192
|
+
async function absolutizeDir(cache5, workspaceFiles2, sessionId, dir, canonical, entries2, signal) {
|
|
62157
62193
|
if (isAbsoluteish(dir))
|
|
62158
62194
|
return dir;
|
|
62159
62195
|
const rel = canonical !== "" ? canonical : dir;
|
|
@@ -62167,14 +62203,14 @@ async function absolutizeDir(cache5, workspaceFiles2, sessionId, dir, canonical,
|
|
|
62167
62203
|
if (file !== void 0) {
|
|
62168
62204
|
try {
|
|
62169
62205
|
const sub = relJoin(rel, file.name);
|
|
62170
|
-
const abs = absolutePathOf(await stat(sessionId, sub));
|
|
62206
|
+
const abs = absolutePathOf(await stat(sessionId, sub, signal));
|
|
62171
62207
|
if (abs?.endsWith(`/${file.name}`) === true && learnRoot(cache5, sessionId, sub, abs) !== null) {
|
|
62172
62208
|
return abs.slice(0, abs.length - file.name.length - 1);
|
|
62173
62209
|
}
|
|
62174
62210
|
} catch {
|
|
62175
62211
|
}
|
|
62176
62212
|
}
|
|
62177
|
-
const found = await findAnyFileAbs(workspaceFiles2, sessionId, rel);
|
|
62213
|
+
const found = await findAnyFileAbs(workspaceFiles2, sessionId, rel, signal);
|
|
62178
62214
|
if (found === null)
|
|
62179
62215
|
return dir;
|
|
62180
62216
|
const root = learnRoot(cache5, sessionId, found.relativePath, found.absolutePath);
|
|
@@ -62270,14 +62306,14 @@ function BytesPreview(props) {
|
|
|
62270
62306
|
const [url, setUrl] = (0, import_react65.useState)(null);
|
|
62271
62307
|
const [failed, setFailed] = (0, import_react65.useState)(null);
|
|
62272
62308
|
(0, import_react65.useEffect)(() => {
|
|
62273
|
-
|
|
62309
|
+
const controller = new AbortController();
|
|
62274
62310
|
let objectUrl = null;
|
|
62275
62311
|
setUrl(null);
|
|
62276
62312
|
setFailed(null);
|
|
62277
|
-
props.workspaceFiles.readBytes(props.sessionId, props.path, {}).then((res) => {
|
|
62278
|
-
|
|
62279
|
-
if (!alive)
|
|
62313
|
+
props.workspaceFiles.readBytes(props.sessionId, props.path, {}, controller.signal).then((res) => {
|
|
62314
|
+
if (controller.signal.aborted)
|
|
62280
62315
|
return;
|
|
62316
|
+
const data2 = bytesOf(res);
|
|
62281
62317
|
if (data2 === null) {
|
|
62282
62318
|
console.warn("[dsh-plugin-core:explorer] readBytes \u8FD4\u56DE\u4F53\u65E0\u6CD5\u89E3\u6790\u4E3A\u5B57\u8282", props.path, res);
|
|
62283
62319
|
setFailed({ key: "previewBadPayload" });
|
|
@@ -62291,11 +62327,12 @@ function BytesPreview(props) {
|
|
|
62291
62327
|
objectUrl = URL.createObjectURL(blob);
|
|
62292
62328
|
setUrl(objectUrl);
|
|
62293
62329
|
}).catch((error) => {
|
|
62294
|
-
if (
|
|
62295
|
-
|
|
62330
|
+
if (isAborted(controller.signal, error))
|
|
62331
|
+
return;
|
|
62332
|
+
setFailed(errView(error));
|
|
62296
62333
|
});
|
|
62297
62334
|
return () => {
|
|
62298
|
-
|
|
62335
|
+
controller.abort();
|
|
62299
62336
|
if (objectUrl !== null)
|
|
62300
62337
|
URL.revokeObjectURL(objectUrl);
|
|
62301
62338
|
};
|
|
@@ -62324,10 +62361,16 @@ function TextPreview(props) {
|
|
|
62324
62361
|
const [loading, setLoading] = (0, import_react66.useState)(false);
|
|
62325
62362
|
const [failed, setFailed] = (0, import_react66.useState)(null);
|
|
62326
62363
|
const accRef = (0, import_react66.useRef)("");
|
|
62364
|
+
const abortRef = (0, import_react66.useRef)(null);
|
|
62327
62365
|
const load = (0, import_react66.useCallback)(async (offset4, append2) => {
|
|
62366
|
+
abortRef.current?.abort();
|
|
62367
|
+
const controller = new AbortController();
|
|
62368
|
+
abortRef.current = controller;
|
|
62328
62369
|
setLoading(true);
|
|
62329
62370
|
try {
|
|
62330
|
-
const parsed = textPageOf(await props.workspaceFiles.read(props.sessionId, props.path, offset4 > 0 ? { offset: offset4 } : {}));
|
|
62371
|
+
const parsed = textPageOf(await props.workspaceFiles.read(props.sessionId, props.path, offset4 > 0 ? { offset: offset4 } : {}, controller.signal));
|
|
62372
|
+
if (controller.signal.aborted)
|
|
62373
|
+
return;
|
|
62331
62374
|
if (parsed === null) {
|
|
62332
62375
|
console.warn("[dsh-plugin-core:explorer] read \u8FD4\u56DE\u4F53\u65E0\u6CD5\u89E3\u6790\u4E3A\u6587\u672C\u9875", props.path);
|
|
62333
62376
|
setFailed({ key: "previewBadPayload" });
|
|
@@ -62354,9 +62397,12 @@ function TextPreview(props) {
|
|
|
62354
62397
|
}
|
|
62355
62398
|
setNextOffset(parsed.eof ? null : parsed.offset + parsed.lines);
|
|
62356
62399
|
} catch (error) {
|
|
62400
|
+
if (isAborted(controller.signal, error))
|
|
62401
|
+
return;
|
|
62357
62402
|
setFailed(errView(error));
|
|
62358
62403
|
} finally {
|
|
62359
|
-
|
|
62404
|
+
if (!controller.signal.aborted)
|
|
62405
|
+
setLoading(false);
|
|
62360
62406
|
}
|
|
62361
62407
|
}, [props.workspaceFiles, props.sessionId, props.path, props.maxBytes]);
|
|
62362
62408
|
(0, import_react66.useEffect)(() => {
|
|
@@ -62366,6 +62412,9 @@ function TextPreview(props) {
|
|
|
62366
62412
|
setNextOffset(null);
|
|
62367
62413
|
setFailed(null);
|
|
62368
62414
|
void load(0, false);
|
|
62415
|
+
return () => {
|
|
62416
|
+
abortRef.current?.abort();
|
|
62417
|
+
};
|
|
62369
62418
|
}, [load]);
|
|
62370
62419
|
if (failed !== null)
|
|
62371
62420
|
return (0, import_react66.createElement)("div", { className: "dshpc-fb__note" }, tt(failed.key, failed.params));
|
|
@@ -62418,13 +62467,13 @@ function HtmlPreview(props) {
|
|
|
62418
62467
|
(0, import_react67.useEffect)(() => {
|
|
62419
62468
|
if (props.sourceView)
|
|
62420
62469
|
return;
|
|
62421
|
-
|
|
62470
|
+
const controller = new AbortController();
|
|
62422
62471
|
setDoc(null);
|
|
62423
62472
|
setFailed(null);
|
|
62424
|
-
props.workspaceFiles.readBytes(props.sessionId, props.path, {}).then((res) => {
|
|
62425
|
-
|
|
62426
|
-
if (!alive)
|
|
62473
|
+
props.workspaceFiles.readBytes(props.sessionId, props.path, {}, controller.signal).then((res) => {
|
|
62474
|
+
if (controller.signal.aborted)
|
|
62427
62475
|
return;
|
|
62476
|
+
const data2 = bytesOf(res);
|
|
62428
62477
|
if (data2 === null) {
|
|
62429
62478
|
console.warn("[dsh-plugin-core:explorer] readBytes \u8FD4\u56DE\u4F53\u65E0\u6CD5\u89E3\u6790\u4E3A\u5B57\u8282", props.path, res);
|
|
62430
62479
|
setFailed({ key: "previewBadPayload" });
|
|
@@ -62441,11 +62490,12 @@ function HtmlPreview(props) {
|
|
|
62441
62490
|
}
|
|
62442
62491
|
setDoc(html2);
|
|
62443
62492
|
}).catch((error) => {
|
|
62444
|
-
if (
|
|
62445
|
-
|
|
62493
|
+
if (isAborted(controller.signal, error))
|
|
62494
|
+
return;
|
|
62495
|
+
setFailed(errView(error));
|
|
62446
62496
|
});
|
|
62447
62497
|
return () => {
|
|
62448
|
-
|
|
62498
|
+
controller.abort();
|
|
62449
62499
|
};
|
|
62450
62500
|
}, [props.workspaceFiles, props.sessionId, props.path, props.sourceView]);
|
|
62451
62501
|
if (props.sourceView) {
|
|
@@ -62474,17 +62524,17 @@ function OfficePreview(props) {
|
|
|
62474
62524
|
const [url, setUrl] = (0, import_react68.useState)(null);
|
|
62475
62525
|
const [failed, setFailed] = (0, import_react68.useState)(null);
|
|
62476
62526
|
(0, import_react68.useEffect)(() => {
|
|
62477
|
-
|
|
62527
|
+
const controller = new AbortController();
|
|
62478
62528
|
let objectUrl = null;
|
|
62479
62529
|
setUrl(null);
|
|
62480
62530
|
setFailed(null);
|
|
62481
62531
|
const face = props.officeToPdf;
|
|
62482
62532
|
if (face === null)
|
|
62483
62533
|
return;
|
|
62484
|
-
face.render(props.sessionId, props.path, "foreground").then((res) => {
|
|
62485
|
-
|
|
62486
|
-
if (!alive)
|
|
62534
|
+
face.render(props.sessionId, props.path, "foreground", controller.signal).then((res) => {
|
|
62535
|
+
if (controller.signal.aborted)
|
|
62487
62536
|
return;
|
|
62537
|
+
const data2 = bytesOf(res);
|
|
62488
62538
|
if (data2 === null || "failed" in data2) {
|
|
62489
62539
|
setFailed(errView(data2 === null ? void 0 : data2.failed));
|
|
62490
62540
|
return;
|
|
@@ -62493,11 +62543,12 @@ function OfficePreview(props) {
|
|
|
62493
62543
|
objectUrl = URL.createObjectURL(blob);
|
|
62494
62544
|
setUrl(objectUrl);
|
|
62495
62545
|
}).catch((error) => {
|
|
62496
|
-
if (
|
|
62497
|
-
|
|
62546
|
+
if (isAborted(controller.signal, error))
|
|
62547
|
+
return;
|
|
62548
|
+
setFailed(errView(error));
|
|
62498
62549
|
});
|
|
62499
62550
|
return () => {
|
|
62500
|
-
|
|
62551
|
+
controller.abort();
|
|
62501
62552
|
if (objectUrl !== null)
|
|
62502
62553
|
URL.revokeObjectURL(objectUrl);
|
|
62503
62554
|
};
|
|
@@ -62638,11 +62689,32 @@ function FileBrowser(props) {
|
|
|
62638
62689
|
const [childCache, setChildCache] = (0, import_react70.useState)({});
|
|
62639
62690
|
const [rootNonce, setRootNonce] = (0, import_react70.useState)(0);
|
|
62640
62691
|
const [outside, setOutside] = (0, import_react70.useState)(false);
|
|
62692
|
+
const revision = props.revision ?? 0;
|
|
62693
|
+
const listGateRef = (0, import_react70.useRef)(null);
|
|
62694
|
+
if (listGateRef.current === null)
|
|
62695
|
+
listGateRef.current = createRequestGate();
|
|
62696
|
+
const listGate = listGateRef.current;
|
|
62697
|
+
const rootGateRef = (0, import_react70.useRef)(null);
|
|
62698
|
+
if (rootGateRef.current === null)
|
|
62699
|
+
rootGateRef.current = createRequestGate();
|
|
62700
|
+
const rootGate = rootGateRef.current;
|
|
62701
|
+
const childAbortsRef = (0, import_react70.useRef)(/* @__PURE__ */ new Map());
|
|
62702
|
+
const abortChildren = (0, import_react70.useCallback)(() => {
|
|
62703
|
+
for (const controller of childAbortsRef.current.values())
|
|
62704
|
+
controller.abort();
|
|
62705
|
+
childAbortsRef.current.clear();
|
|
62706
|
+
}, []);
|
|
62707
|
+
const dirRef = (0, import_react70.useRef)("");
|
|
62708
|
+
const listingRef = (0, import_react70.useRef)(null);
|
|
62709
|
+
(0, import_react70.useLayoutEffect)(() => {
|
|
62710
|
+
dirRef.current = dir;
|
|
62711
|
+
listingRef.current = listing;
|
|
62712
|
+
}, [dir, listing]);
|
|
62641
62713
|
const hostWorkspaces = (0, import_react70.useSyncExternalStore)(workspaceList.subscribe, workspaceList.getSnapshot);
|
|
62642
62714
|
const anchors = props.workspaceAnchors ?? hostWorkspaces;
|
|
62643
62715
|
const anchorMatch = (0, import_react70.useMemo)(() => workspaceAnchorForPath(props.path, anchors), [props.path, anchors]);
|
|
62644
62716
|
const listSessionId = anchorMatch?.sessionId ?? props.sessionId;
|
|
62645
|
-
const noteOutside = (parsed) => {
|
|
62717
|
+
const noteOutside = (0, import_react70.useCallback)((parsed) => {
|
|
62646
62718
|
if (parsed === null || parsed === void 0)
|
|
62647
62719
|
return;
|
|
62648
62720
|
if (!isFailed(parsed)) {
|
|
@@ -62652,8 +62724,10 @@ function FileBrowser(props) {
|
|
|
62652
62724
|
const code3 = bareCode(parsed.failed);
|
|
62653
62725
|
if (code3 === "outside-workspace" || code3 === "not-found")
|
|
62654
62726
|
setOutside(true);
|
|
62655
|
-
};
|
|
62727
|
+
}, []);
|
|
62656
62728
|
const fetchDir = (0, import_react70.useCallback)((targetDir) => {
|
|
62729
|
+
const token = listGate.begin();
|
|
62730
|
+
abortChildren();
|
|
62657
62731
|
setDir(targetDir);
|
|
62658
62732
|
setViewing(null);
|
|
62659
62733
|
setListErr(null);
|
|
@@ -62661,7 +62735,9 @@ function FileBrowser(props) {
|
|
|
62661
62735
|
setMode("loading");
|
|
62662
62736
|
setOpenDirs(/* @__PURE__ */ new Set());
|
|
62663
62737
|
setChildCache({});
|
|
62664
|
-
props.workspaceFiles.list(listSessionId, listPathOf(targetDir)).then((result) => {
|
|
62738
|
+
props.workspaceFiles.list(listSessionId, listPathOf(targetDir), token.signal).then((result) => {
|
|
62739
|
+
if (!token.current())
|
|
62740
|
+
return;
|
|
62665
62741
|
const parsed = listingOf(result);
|
|
62666
62742
|
noteOutside(parsed);
|
|
62667
62743
|
if (isFailed(parsed)) {
|
|
@@ -62678,10 +62754,12 @@ function FileBrowser(props) {
|
|
|
62678
62754
|
setTruncated(parsed.truncated);
|
|
62679
62755
|
setMode("dir");
|
|
62680
62756
|
}).catch((error) => {
|
|
62757
|
+
if (isAborted(token.signal, error))
|
|
62758
|
+
return;
|
|
62681
62759
|
setListErr(errView(error));
|
|
62682
62760
|
setMode("error");
|
|
62683
62761
|
});
|
|
62684
|
-
}, [listSessionId, props.workspaceFiles]);
|
|
62762
|
+
}, [abortChildren, listGate, listSessionId, noteOutside, props.workspaceFiles]);
|
|
62685
62763
|
const loadDir = (0, import_react70.useCallback)((targetDir) => {
|
|
62686
62764
|
if (targetDir === dir) {
|
|
62687
62765
|
fetchDir(targetDir);
|
|
@@ -62690,7 +62768,21 @@ function FileBrowser(props) {
|
|
|
62690
62768
|
fetchDir(targetDir);
|
|
62691
62769
|
}, [dir, fetchDir]);
|
|
62692
62770
|
(0, import_react70.useEffect)(() => {
|
|
62693
|
-
|
|
62771
|
+
const parent = dirnameOf(props.path);
|
|
62772
|
+
const name2 = baseNameOfPath(props.path);
|
|
62773
|
+
const knownFile = listingRef.current?.some((entry) => entry.name === name2 && entry.type === "file") === true;
|
|
62774
|
+
if (props.path !== "" && dirRef.current !== "" && parent === dirRef.current && knownFile) {
|
|
62775
|
+
setViewing(props.path);
|
|
62776
|
+
setMode("file");
|
|
62777
|
+
setSourceView(false);
|
|
62778
|
+
setReloadNonce((n) => n + 1);
|
|
62779
|
+
setListErr(null);
|
|
62780
|
+
setMenuOpen(false);
|
|
62781
|
+
return;
|
|
62782
|
+
}
|
|
62783
|
+
const token = listGate.begin();
|
|
62784
|
+
const rootToken = rootGate.begin();
|
|
62785
|
+
abortChildren();
|
|
62694
62786
|
setMode("loading");
|
|
62695
62787
|
setListErr(null);
|
|
62696
62788
|
setViewing(null);
|
|
@@ -62704,8 +62796,8 @@ function FileBrowser(props) {
|
|
|
62704
62796
|
return;
|
|
62705
62797
|
void (async () => {
|
|
62706
62798
|
try {
|
|
62707
|
-
const parsed = listingOf(await props.workspaceFiles.list(listSessionId, listPathOf(currentDir)));
|
|
62708
|
-
if (!
|
|
62799
|
+
const parsed = listingOf(await props.workspaceFiles.list(listSessionId, listPathOf(currentDir), rootToken.signal));
|
|
62800
|
+
if (!rootToken.current() || parsed === null || isFailed(parsed))
|
|
62709
62801
|
return;
|
|
62710
62802
|
const stat = props.workspaceFiles.stat;
|
|
62711
62803
|
if (stat === void 0)
|
|
@@ -62714,14 +62806,18 @@ function FileBrowser(props) {
|
|
|
62714
62806
|
const file = parsed.entries.find((entry) => entry.type === "file");
|
|
62715
62807
|
if (file !== void 0) {
|
|
62716
62808
|
const sub = rel === "" ? file.name : `${rel}/${file.name}`;
|
|
62717
|
-
const abs = await stat(listSessionId, sub).catch(() => null);
|
|
62809
|
+
const abs = await stat(listSessionId, sub, rootToken.signal).catch(() => null);
|
|
62810
|
+
if (!rootToken.current())
|
|
62811
|
+
return;
|
|
62718
62812
|
const absPath = typeof abs?.absolutePath === "string" ? abs.absolutePath : null;
|
|
62719
62813
|
if (absPath !== null && learnRoot(rootCache, listSessionId, sub, absPath) !== null) {
|
|
62720
62814
|
setRootNonce((n) => n + 1);
|
|
62721
62815
|
return;
|
|
62722
62816
|
}
|
|
62723
62817
|
}
|
|
62724
|
-
const found = await findAnyFileAbs(props.workspaceFiles, listSessionId, rel);
|
|
62818
|
+
const found = await findAnyFileAbs(props.workspaceFiles, listSessionId, rel, rootToken.signal);
|
|
62819
|
+
if (!rootToken.current())
|
|
62820
|
+
return;
|
|
62725
62821
|
if (found !== null && learnRoot(rootCache, listSessionId, found.relativePath, found.absolutePath) !== null) {
|
|
62726
62822
|
setRootNonce((n) => n + 1);
|
|
62727
62823
|
}
|
|
@@ -62729,14 +62825,14 @@ function FileBrowser(props) {
|
|
|
62729
62825
|
}
|
|
62730
62826
|
})();
|
|
62731
62827
|
};
|
|
62732
|
-
props.workspaceFiles.list(listSessionId, listPathOf(props.path)).then(async (result) => {
|
|
62733
|
-
if (!
|
|
62828
|
+
props.workspaceFiles.list(listSessionId, listPathOf(props.path), token.signal).then(async (result) => {
|
|
62829
|
+
if (!token.current())
|
|
62734
62830
|
return;
|
|
62735
62831
|
const parsed = listingOf(result);
|
|
62736
62832
|
if (!isFailed(parsed) && parsed !== null) {
|
|
62737
62833
|
setOutside(false);
|
|
62738
|
-
const absDir = await absolutizeDir(rootCache, props.workspaceFiles, listSessionId, props.path, parsed.path, parsed.entries);
|
|
62739
|
-
if (!
|
|
62834
|
+
const absDir = await absolutizeDir(rootCache, props.workspaceFiles, listSessionId, props.path, parsed.path, parsed.entries, token.signal);
|
|
62835
|
+
if (!token.current())
|
|
62740
62836
|
return;
|
|
62741
62837
|
setDir(absDir);
|
|
62742
62838
|
setListing(parsed.entries);
|
|
@@ -62745,29 +62841,31 @@ function FileBrowser(props) {
|
|
|
62745
62841
|
ensureRootLearned(absDir);
|
|
62746
62842
|
return;
|
|
62747
62843
|
}
|
|
62748
|
-
let
|
|
62844
|
+
let parentDir = dirnameOf(props.path);
|
|
62749
62845
|
if (!isAbsoluteish(props.path)) {
|
|
62750
62846
|
const stat = props.workspaceFiles.stat;
|
|
62751
62847
|
if (stat !== void 0) {
|
|
62752
62848
|
try {
|
|
62753
|
-
const res = await stat(listSessionId, props.path);
|
|
62849
|
+
const res = await stat(listSessionId, props.path, token.signal);
|
|
62850
|
+
if (!token.current())
|
|
62851
|
+
return;
|
|
62754
62852
|
const abs = typeof res.absolutePath === "string" ? res.absolutePath : null;
|
|
62755
62853
|
if (abs !== null) {
|
|
62756
|
-
|
|
62854
|
+
parentDir = dirnameOf(abs);
|
|
62757
62855
|
learnRoot(rootCache, listSessionId, props.path, abs);
|
|
62758
62856
|
}
|
|
62759
62857
|
} catch {
|
|
62760
62858
|
}
|
|
62761
62859
|
}
|
|
62762
62860
|
}
|
|
62763
|
-
if (!
|
|
62861
|
+
if (!token.current())
|
|
62764
62862
|
return;
|
|
62765
|
-
setDir(
|
|
62863
|
+
setDir(parentDir);
|
|
62766
62864
|
setViewing(props.path);
|
|
62767
62865
|
setMode("file");
|
|
62768
|
-
ensureRootLearned(
|
|
62769
|
-
props.workspaceFiles.list(listSessionId, listPathOf(
|
|
62770
|
-
if (!
|
|
62866
|
+
ensureRootLearned(parentDir);
|
|
62867
|
+
props.workspaceFiles.list(listSessionId, listPathOf(parentDir), token.signal).then((pres) => {
|
|
62868
|
+
if (!token.current())
|
|
62771
62869
|
return;
|
|
62772
62870
|
const pl = listingOf(pres);
|
|
62773
62871
|
noteOutside(pl);
|
|
@@ -62777,19 +62875,21 @@ function FileBrowser(props) {
|
|
|
62777
62875
|
}
|
|
62778
62876
|
}).catch(() => {
|
|
62779
62877
|
});
|
|
62780
|
-
}).catch(() => {
|
|
62781
|
-
if (!
|
|
62878
|
+
}).catch((error) => {
|
|
62879
|
+
if (!token.current() || isAborted(token.signal, error))
|
|
62782
62880
|
return;
|
|
62783
|
-
const
|
|
62784
|
-
setDir(
|
|
62881
|
+
const parentDir = dirnameOf(props.path);
|
|
62882
|
+
setDir(parentDir);
|
|
62785
62883
|
setViewing(props.path);
|
|
62786
62884
|
setMode("file");
|
|
62787
|
-
ensureRootLearned(
|
|
62885
|
+
ensureRootLearned(parentDir);
|
|
62788
62886
|
});
|
|
62789
62887
|
return () => {
|
|
62790
|
-
|
|
62888
|
+
listGate.abort();
|
|
62889
|
+
rootGate.abort();
|
|
62791
62890
|
};
|
|
62792
|
-
}, [props.workspaceFiles, props.path, rootCache,
|
|
62891
|
+
}, [abortChildren, listGate, listSessionId, noteOutside, props.workspaceFiles, props.path, revision, rootCache, rootGate]);
|
|
62892
|
+
(0, import_react70.useEffect)(() => () => abortChildren(), [abortChildren]);
|
|
62793
62893
|
(0, import_react70.useLayoutEffect)(() => {
|
|
62794
62894
|
const region = regionRef.current;
|
|
62795
62895
|
const measure = measureRef.current;
|
|
@@ -62833,15 +62933,25 @@ function FileBrowser(props) {
|
|
|
62833
62933
|
return next;
|
|
62834
62934
|
});
|
|
62835
62935
|
if (!(path in childCache)) {
|
|
62936
|
+
childAbortsRef.current.get(path)?.abort();
|
|
62937
|
+
const controller = new AbortController();
|
|
62938
|
+
childAbortsRef.current.set(path, controller);
|
|
62836
62939
|
setChildCache((prev) => ({ ...prev, [path]: { status: "loading" } }));
|
|
62837
|
-
props.workspaceFiles.list(listSessionId, listPathOf(path)).then((result) => {
|
|
62940
|
+
props.workspaceFiles.list(listSessionId, listPathOf(path), controller.signal).then((result) => {
|
|
62941
|
+
if (controller.signal.aborted)
|
|
62942
|
+
return;
|
|
62838
62943
|
const parsed = listingOf(result);
|
|
62839
62944
|
setChildCache((prev) => ({
|
|
62840
62945
|
...prev,
|
|
62841
62946
|
[path]: isFailed(parsed) || parsed === null ? { status: "error", error: errView(isFailed(parsed) ? parsed.failed : void 0) } : { status: "ready", entries: parsed.entries, truncated: parsed.truncated }
|
|
62842
62947
|
}));
|
|
62843
62948
|
}).catch((error) => {
|
|
62949
|
+
if (isAborted(controller.signal, error))
|
|
62950
|
+
return;
|
|
62844
62951
|
setChildCache((prev) => ({ ...prev, [path]: { status: "error", error: errView(error) } }));
|
|
62952
|
+
}).finally(() => {
|
|
62953
|
+
if (childAbortsRef.current.get(path) === controller)
|
|
62954
|
+
childAbortsRef.current.delete(path);
|
|
62845
62955
|
});
|
|
62846
62956
|
}
|
|
62847
62957
|
}, [childCache, props.workspaceFiles, listSessionId]);
|
|
@@ -63089,6 +63199,11 @@ function PreviewBody(props) {
|
|
|
63089
63199
|
const anchors = options.workspaceAnchors ?? hostWorkspaces;
|
|
63090
63200
|
const entryTitle = workspaceAnchorForPath(options.path ?? "", anchors)?.title ?? options.rootName ?? "";
|
|
63091
63201
|
const [picked, setPicked] = (0, import_react71.useState)(null);
|
|
63202
|
+
const [seenRevision, setSeenRevision] = (0, import_react71.useState)(props.revision);
|
|
63203
|
+
if (seenRevision !== props.revision) {
|
|
63204
|
+
setSeenRevision(props.revision);
|
|
63205
|
+
setPicked(null);
|
|
63206
|
+
}
|
|
63092
63207
|
const wsTitle = picked ?? entryTitle;
|
|
63093
63208
|
const sessionId = anchorSessionForTitle(anchors, wsTitle) ?? options.sessionId ?? pickWorkspaceAnchor(anchors)?.sessionId ?? "";
|
|
63094
63209
|
const switchable = anchors.filter((a) => (a.sessionIds?.length ?? 0) > 0).map((a) => a.title);
|
|
@@ -63100,6 +63215,8 @@ function PreviewBody(props) {
|
|
|
63100
63215
|
sessionId,
|
|
63101
63216
|
// 点过工作区就从它的根列(原 path 属于旧工作区,带着只会 404 / 跳回入口文件)。
|
|
63102
63217
|
path: picked === null ? options.path : "",
|
|
63218
|
+
// 重开令牌:同 path 再点一次也要回到该文件 / 重读内容(只重跑初始 effect,不重挂)。
|
|
63219
|
+
revision: props.revision,
|
|
63103
63220
|
rootName: wsTitle === "" ? options.rootName : wsTitle,
|
|
63104
63221
|
workspaces: switchable.length > 0 ? switchable : options.workspaces,
|
|
63105
63222
|
onSelectWorkspace: (name2) => {
|
|
@@ -63218,7 +63335,7 @@ function openFilePreview(options) {
|
|
|
63218
63335
|
if (dock.isCollapsed(PREVIEW_PANEL_ID))
|
|
63219
63336
|
dock.expand(PREVIEW_PANEL_ID);
|
|
63220
63337
|
const internalSwitch = o.onSelectWorkspace === void 0;
|
|
63221
|
-
const
|
|
63338
|
+
const revision = ++openSeq;
|
|
63222
63339
|
root.render((0, import_react71.createElement)(
|
|
63223
63340
|
"div",
|
|
63224
63341
|
// 高度吃调用方给的 --dshpc-dock-h(demo 的页面行给 100%);退化成视口高是整页场景。
|
|
@@ -63235,12 +63352,12 @@ function openFilePreview(options) {
|
|
|
63235
63352
|
width: pinnedWidth ?? o.width ?? 460,
|
|
63236
63353
|
minWidth: o.minWidth ?? 320,
|
|
63237
63354
|
maxWidth: o.maxWidth
|
|
63238
|
-
}, o.content !== void 0 ? o.content() : internalSwitch ? (0, import_react71.createElement)(PreviewBody, {
|
|
63239
|
-
key: contentKey,
|
|
63355
|
+
}, o.content !== void 0 ? (0, import_react71.createElement)(import_react71.Fragment, { key: `custom:${revision}` }, o.content()) : internalSwitch ? (0, import_react71.createElement)(PreviewBody, { options: o, onClose: close, revision }) : (0, import_react71.createElement)(FileBrowser, {
|
|
63240
63356
|
workspaceFiles: o.workspaceFiles,
|
|
63241
63357
|
officeToPdf: o.officeToPdf ?? null,
|
|
63242
63358
|
sessionId: o.sessionId,
|
|
63243
63359
|
path: o.path,
|
|
63360
|
+
revision,
|
|
63244
63361
|
rootName: o.rootName,
|
|
63245
63362
|
workspaces: o.workspaces,
|
|
63246
63363
|
workspaceAnchors: o.workspaceAnchors,
|
|
@@ -64261,9 +64378,9 @@ function ReferencePage() {
|
|
|
64261
64378
|
"tbody",
|
|
64262
64379
|
null,
|
|
64263
64380
|
[
|
|
64264
|
-
[t3("buildCore"), `v${"0.
|
|
64265
|
-
[t3("buildDemo"), `v${"0.
|
|
64266
|
-
[t3("buildStamp"), "
|
|
64381
|
+
[t3("buildCore"), `v${"0.14.1"}`],
|
|
64382
|
+
[t3("buildDemo"), `v${"0.14.1"}`],
|
|
64383
|
+
[t3("buildStamp"), "261031-102704-451"]
|
|
64267
64384
|
].map(
|
|
64268
64385
|
([label, value]) => (0, import_react75.createElement)(
|
|
64269
64386
|
"tr",
|
|
@@ -64586,9 +64703,9 @@ function DemoPage() {
|
|
|
64586
64703
|
lineHeight: "14px"
|
|
64587
64704
|
}
|
|
64588
64705
|
},
|
|
64589
|
-
(0, import_react77.createElement)("span", null, `core v${"0.
|
|
64590
|
-
(0, import_react77.createElement)("span", null, `demo v${"0.
|
|
64591
|
-
(0, import_react77.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "
|
|
64706
|
+
(0, import_react77.createElement)("span", null, `core v${"0.14.1"}`),
|
|
64707
|
+
(0, import_react77.createElement)("span", null, `demo v${"0.14.1"}`),
|
|
64708
|
+
(0, import_react77.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261031-102704-451")
|
|
64592
64709
|
)
|
|
64593
64710
|
)
|
|
64594
64711
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-core-demo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
|
|
5
5
|
"icon": "./assets/icon-components.svg",
|
|
6
6
|
"keywords": [
|