@arronqzy/react-view 1.0.31 → 1.0.33
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/styles.css
CHANGED
|
@@ -1150,6 +1150,10 @@ video {
|
|
|
1150
1150
|
min-width: 0px;
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
+
.min-w-\[100px\] {
|
|
1154
|
+
min-width: 100px;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1153
1157
|
.min-w-\[120px\] {
|
|
1154
1158
|
min-width: 120px;
|
|
1155
1159
|
}
|
|
@@ -1158,6 +1162,10 @@ video {
|
|
|
1158
1162
|
min-width: 140px;
|
|
1159
1163
|
}
|
|
1160
1164
|
|
|
1165
|
+
.min-w-\[180px\] {
|
|
1166
|
+
min-width: 180px;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1161
1169
|
.min-w-\[92px\] {
|
|
1162
1170
|
min-width: 92px;
|
|
1163
1171
|
}
|
|
@@ -1284,6 +1292,10 @@ video {
|
|
|
1284
1292
|
cursor: crosshair;
|
|
1285
1293
|
}
|
|
1286
1294
|
|
|
1295
|
+
.cursor-default {
|
|
1296
|
+
cursor: default;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1287
1299
|
.cursor-grabbing {
|
|
1288
1300
|
cursor: grabbing;
|
|
1289
1301
|
}
|
|
@@ -1298,6 +1310,12 @@ video {
|
|
|
1298
1310
|
user-select: none;
|
|
1299
1311
|
}
|
|
1300
1312
|
|
|
1313
|
+
.select-text {
|
|
1314
|
+
-webkit-user-select: text;
|
|
1315
|
+
-moz-user-select: text;
|
|
1316
|
+
user-select: text;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1301
1319
|
.resize-none {
|
|
1302
1320
|
resize: none;
|
|
1303
1321
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arronqzy/react-view",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"files": [
|
|
5
5
|
"src",
|
|
6
6
|
"dist",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"@codemirror/lang-json": "^6.0.1",
|
|
31
31
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
32
32
|
"@codemirror/view": "^6.36.2",
|
|
33
|
-
"@arronqzy/i18n": "0.1.13",
|
|
34
33
|
"@arronqzy/ui": "1.0.9",
|
|
35
34
|
"@arronqzy/blueprint-dsl": "1.0.15",
|
|
36
|
-
"@arronqzy/react-blueprint": "1.0.
|
|
35
|
+
"@arronqzy/react-blueprint": "1.0.19",
|
|
37
36
|
"@arronqzy/view-scene3d": "0.1.5",
|
|
37
|
+
"@arronqzy/i18n": "0.1.15",
|
|
38
|
+
"@arronqzy/view-table": "0.1.8",
|
|
38
39
|
"@arronqzy/rx-store": "1.0.8",
|
|
39
|
-
"@arronqzy/webllm-assistant": "0.1.16"
|
|
40
|
-
"@arronqzy/view-table": "0.1.8"
|
|
40
|
+
"@arronqzy/webllm-assistant": "0.1.16"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/react": "^19.0.1",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"eslint": "^8.57.0",
|
|
47
47
|
"typescript": "^5.5.4",
|
|
48
48
|
"@arronqzy/eslint-config": "0.0.0",
|
|
49
|
-
"@arronqzy/
|
|
50
|
-
"@arronqzy/
|
|
49
|
+
"@arronqzy/typescript-config": "1.0.0",
|
|
50
|
+
"@arronqzy/tailwind": "1.0.2"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
@@ -143,6 +143,10 @@ export type ReactViewPanelProps = {
|
|
|
143
143
|
* 省略或空字符串保持历史全局库名。
|
|
144
144
|
*/
|
|
145
145
|
nameSpace?: string | null;
|
|
146
|
+
/** 顶栏「设置 → 关于」展示的 npm 包名,如 @arronqzy/abuilder */
|
|
147
|
+
packageName?: string | null;
|
|
148
|
+
/** 顶栏「设置 → 关于」展示的包版本号 */
|
|
149
|
+
packageVersion?: string | null;
|
|
146
150
|
};
|
|
147
151
|
|
|
148
152
|
function ReactViewPanelInner({
|
|
@@ -150,6 +154,8 @@ function ReactViewPanelInner({
|
|
|
150
154
|
className,
|
|
151
155
|
initialWorkspace = null,
|
|
152
156
|
nameSpace = null,
|
|
157
|
+
packageName = null,
|
|
158
|
+
packageVersion = null,
|
|
153
159
|
}: ReactViewPanelProps) {
|
|
154
160
|
const { t, locale, setLocale } = useI18n();
|
|
155
161
|
const messages = useMemo(() => getPanelMessages(t), [t]);
|
|
@@ -1904,6 +1910,8 @@ function ReactViewPanelInner({
|
|
|
1904
1910
|
setLocale={setLocale}
|
|
1905
1911
|
outputScale={outputScale}
|
|
1906
1912
|
setOutputScale={setOutputScale}
|
|
1913
|
+
packageName={packageName}
|
|
1914
|
+
packageVersion={packageVersion}
|
|
1907
1915
|
/>
|
|
1908
1916
|
<WorkspaceProjectNav
|
|
1909
1917
|
projects={workspaceProjects.projects}
|
|
@@ -107,7 +107,7 @@ export function PanelConfigSidebar({
|
|
|
107
107
|
const matchCountRef = useRef(0);
|
|
108
108
|
const themedScrollbarClass =
|
|
109
109
|
"scrollbar-thin [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-muted/40 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border/80 [&::-webkit-scrollbar-thumb]:hover:bg-border";
|
|
110
|
-
const
|
|
110
|
+
const DEFAULT_EXPANDED_SECTIONS: Record<string, boolean> = {
|
|
111
111
|
nodeInfo: true,
|
|
112
112
|
styleBackground: false,
|
|
113
113
|
styleBorder: false,
|
|
@@ -117,7 +117,14 @@ export function PanelConfigSidebar({
|
|
|
117
117
|
chartAdvancedLayout: false,
|
|
118
118
|
chartAdvancedAxisPointer: false,
|
|
119
119
|
reference: true,
|
|
120
|
-
}
|
|
120
|
+
};
|
|
121
|
+
const [expandedSections, setExpandedSections] = useState<Record<string, boolean>>(
|
|
122
|
+
() => ({ ...DEFAULT_EXPANDED_SECTIONS })
|
|
123
|
+
);
|
|
124
|
+
const expandedSectionsByIdRef = useRef(new Map<string, Record<string, boolean>>());
|
|
125
|
+
const expandedSectionsRef = useRef(expandedSections);
|
|
126
|
+
expandedSectionsRef.current = expandedSections;
|
|
127
|
+
const activeExpandedKeyRef = useRef<string | null>(null);
|
|
121
128
|
|
|
122
129
|
const isChartElement = !!selectedElement && CHART_TYPES.has(selectedElement.materialType ?? "");
|
|
123
130
|
const selectedLayer = selectedElement
|
|
@@ -179,14 +186,27 @@ export function PanelConfigSidebar({
|
|
|
179
186
|
el.scrollTop = top;
|
|
180
187
|
}, [configScrollKey]);
|
|
181
188
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
189
|
+
useLayoutEffect(() => {
|
|
190
|
+
const prevKey = activeExpandedKeyRef.current;
|
|
191
|
+
if (prevKey && prevKey !== configScrollKey) {
|
|
192
|
+
expandedSectionsByIdRef.current.set(prevKey, {
|
|
193
|
+
...expandedSectionsRef.current,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
activeExpandedKeyRef.current = configScrollKey;
|
|
197
|
+
if (!configScrollKey) {
|
|
198
|
+
setExpandedSections({ ...DEFAULT_EXPANDED_SECTIONS });
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const saved = expandedSectionsByIdRef.current.get(configScrollKey);
|
|
202
|
+
if (saved) {
|
|
203
|
+
setExpandedSections({ ...saved });
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const initial = { ...DEFAULT_EXPANDED_SECTIONS };
|
|
207
|
+
expandedSectionsByIdRef.current.set(configScrollKey, initial);
|
|
208
|
+
setExpandedSections(initial);
|
|
209
|
+
}, [configScrollKey]);
|
|
190
210
|
|
|
191
211
|
useEffect(() => {
|
|
192
212
|
if (typeof window === "undefined") return;
|
|
@@ -202,7 +222,12 @@ export function PanelConfigSidebar({
|
|
|
202
222
|
expandedSections[key] ?? defaultValue;
|
|
203
223
|
|
|
204
224
|
const setSectionExpanded = (key: string, next: boolean) => {
|
|
205
|
-
setExpandedSections((prev) =>
|
|
225
|
+
setExpandedSections((prev) => {
|
|
226
|
+
const updated = { ...prev, [key]: next };
|
|
227
|
+
const id = activeExpandedKeyRef.current;
|
|
228
|
+
if (id) expandedSectionsByIdRef.current.set(id, updated);
|
|
229
|
+
return updated;
|
|
230
|
+
});
|
|
206
231
|
};
|
|
207
232
|
|
|
208
233
|
useEffect(() => {
|
|
@@ -220,6 +245,8 @@ export function PanelConfigSidebar({
|
|
|
220
245
|
next.geometryCanvasScript = true;
|
|
221
246
|
next.geometrySketch = true;
|
|
222
247
|
next.referenceCopyStrategy = true;
|
|
248
|
+
const id = activeExpandedKeyRef.current;
|
|
249
|
+
if (id) expandedSectionsByIdRef.current.set(id, next);
|
|
223
250
|
return next;
|
|
224
251
|
});
|
|
225
252
|
window.requestAnimationFrame(() => {
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
MenubarRadioGroup,
|
|
9
9
|
MenubarRadioItem,
|
|
10
10
|
MenubarSeparator,
|
|
11
|
+
MenubarSub,
|
|
12
|
+
MenubarSubContent,
|
|
13
|
+
MenubarSubTrigger,
|
|
11
14
|
MenubarTrigger,
|
|
12
15
|
} from "@arronqzy/ui";
|
|
13
16
|
import type { Locale } from "@arronqzy/i18n";
|
|
@@ -37,6 +40,10 @@ export type PanelMenubarProps = {
|
|
|
37
40
|
setLocale: (locale: Locale) => void;
|
|
38
41
|
outputScale: boolean;
|
|
39
42
|
setOutputScale: (value: boolean) => void;
|
|
43
|
+
/** 产品包名(可选,关于二级菜单不展示) */
|
|
44
|
+
packageName?: string | null;
|
|
45
|
+
/** 产品版本号,如 1.1.32 */
|
|
46
|
+
packageVersion?: string | null;
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export function PanelMenubar({
|
|
@@ -64,13 +71,18 @@ export function PanelMenubar({
|
|
|
64
71
|
setLocale,
|
|
65
72
|
outputScale,
|
|
66
73
|
setOutputScale,
|
|
74
|
+
packageVersion,
|
|
67
75
|
}: PanelMenubarProps) {
|
|
76
|
+
const versionOnly =
|
|
77
|
+
packageVersion && packageVersion.trim()
|
|
78
|
+
? t("panel.menubar.versionValue", { version: packageVersion.trim() })
|
|
79
|
+
: t("panel.menubar.versionUnavailable");
|
|
80
|
+
|
|
68
81
|
return (
|
|
69
82
|
<Menubar className="h-8 border-0 bg-transparent p-0 shadow-none">
|
|
70
83
|
<MenubarMenu>
|
|
71
84
|
<MenubarTrigger className="px-2 py-1 text-xs font-normal">{t("panel.menubar.file")}</MenubarTrigger>
|
|
72
85
|
<MenubarContent className="z-[10100]">
|
|
73
|
-
{/* <MenubarItem onClick={handlePreviewLayer}>{t("panel.workspace.previewDocTitle")}</MenubarItem> */}
|
|
74
86
|
<MenubarItem onClick={handleExport}>{t("panel.menubar.export")}</MenubarItem>
|
|
75
87
|
<MenubarItem onClick={() => importInputRef.current?.click()}>{t("panel.menubar.import")}</MenubarItem>
|
|
76
88
|
</MenubarContent>
|
|
@@ -113,7 +125,7 @@ export function PanelMenubar({
|
|
|
113
125
|
</MenubarMenu>
|
|
114
126
|
<MenubarMenu>
|
|
115
127
|
<MenubarTrigger className="px-2 py-1 text-xs font-normal">{t("panel.menubar.settings")}</MenubarTrigger>
|
|
116
|
-
<MenubarContent className="z-[10100]">
|
|
128
|
+
<MenubarContent className="z-[10100] min-w-[180px]">
|
|
117
129
|
<MenubarRadioGroup
|
|
118
130
|
value={panelFontSize}
|
|
119
131
|
onValueChange={(value) => setPanelFontSize(value as "sm" | "md" | "lg")}
|
|
@@ -141,6 +153,20 @@ export function PanelMenubar({
|
|
|
141
153
|
>
|
|
142
154
|
{t("panel.menubar.outputScale")}
|
|
143
155
|
</MenubarCheckboxItem>
|
|
156
|
+
<MenubarSeparator />
|
|
157
|
+
<MenubarSub>
|
|
158
|
+
<MenubarSubTrigger>{t("panel.menubar.about")}</MenubarSubTrigger>
|
|
159
|
+
<MenubarSubContent className="z-[10100] min-w-[100px]">
|
|
160
|
+
<MenubarItem
|
|
161
|
+
className="cursor-default select-text"
|
|
162
|
+
onSelect={(e) => e.preventDefault()}
|
|
163
|
+
data-abuilder-version={packageVersion ?? undefined}
|
|
164
|
+
title={`${t("panel.menubar.versionLabel")} ${versionOnly}`}
|
|
165
|
+
>
|
|
166
|
+
{versionOnly}
|
|
167
|
+
</MenubarItem>
|
|
168
|
+
</MenubarSubContent>
|
|
169
|
+
</MenubarSub>
|
|
144
170
|
</MenubarContent>
|
|
145
171
|
</MenubarMenu>
|
|
146
172
|
</Menubar>
|