gbxlxs 0.3.0 → 0.5.0

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/README.md CHANGED
@@ -75,6 +75,23 @@ editor.dispose();
75
75
 
76
76
  不传 `host` / `embedded` 时即独立模式,编辑器自己处理文件选择、保存与未保存确认。
77
77
 
78
+ ## 只读与隐藏菜单栏
79
+
80
+ `SheetEditor` 与 `gbdocx` / `gbpptx` 共用同一套开关(`guabiutils` 的 `createReadOnlyGuard` 负责 DOM 层,本包在命令层 `guard()` 再挡一次):
81
+
82
+ | 能力 | 构造参数 | 运行时方法 |
83
+ | --- | --- | --- |
84
+ | 只读预览 | `readOnly: true` | `editor.setReadOnly(on)` |
85
+ | 隐藏顶部菜单栏那一行 | `hideMenuBar: true` | `editor.setMenuBarVisible(on)` |
86
+
87
+ ```js
88
+ const editor = new SheetEditor(mountEl, { embedded: true, readOnly: true, hideMenuBar: true, host });
89
+ editor.setReadOnly(false); // 回到可编辑
90
+ editor.setMenuBarVisible(true); // 再显示菜单栏
91
+ ```
92
+
93
+ 只读档下:所有命令(编辑 / 结构 / 格式 / 图表 / 筛选)都在 `guard()` 处返回 `false`,就地编辑、粘贴、拖放、写快捷键被 `guabiutils` 守卫在捕获阶段掐掉,工具栏与公式栏 `inert`,编辑类菜单按钮禁用(只留「视图」),保存按钮禁用;选区、滚动、复制、查找、缩放与工作表切换照常可用。`hideMenuBar` 隐藏 `.sheets-menubar` 整行(含同行文档名与保存按钮),工作表页签与状态栏不受影响。
94
+
78
95
  ## 导入路径
79
96
 
80
97
  `exports` 声明了四个引擎入口与一个 `web/` 通配;`src/` 深层路径仍会被 Node 直接拒掉:
@@ -86,6 +103,7 @@ import { setValue } from 'gbxlxs/ops'; // 只要算子层
86
103
  import { createSheetSession } from 'gbxlxs/session';
87
104
  import { SheetEditor } from 'gbxlxs/web/app/sheets-app.js';
88
105
  import 'gbxlxs/web/styles/sheets.css';
106
+ import 'gbofficeui/styles/office-chrome.css'; // 菜单栏/功能带/公式栏/状态栏共享皮肤
89
107
  import version from 'gbxlxs/package.json' with { type: 'json' };
90
108
  ```
91
109
 
package/package.json CHANGED
@@ -1,44 +1,45 @@
1
- {
2
- "name": "gbxlxs",
3
- "version": "0.3.0",
4
- "description": "Standalone spreadsheet (XLSX) engine with a self-contained HTML editor: read/write xlsx, workbook model ops, CSV/HTML import-export and a full spreadsheet UI.",
5
- "type": "module",
6
- "license": "MIT",
7
- "sideEffects": [
8
- "**/*.css"
9
- ],
10
- "main": "./src/index.js",
11
- "exports": {
12
- ".": "./src/index.js",
13
- "./ops": "./src/ops.js",
14
- "./session": "./src/session.js",
15
- "./workbook": "./src/workbook/index.js",
16
- "./web/*": "./web/*",
17
- "./package.json": "./package.json"
18
- },
19
- "files": [
20
- "src",
21
- "web",
22
- "LICENSE"
23
- ],
24
- "scripts": {
25
- "start": "node web/serve.mjs",
26
- "test": "node --test test/editing.test.js test/move.test.js test/references.test.js test/session.test.js test/roundtrip.test.js test/scenarios.test.js test/ops-scenarios.test.js test/formula.test.js test/function-search.test.js test/find-replace.test.js test/advanced-filter.test.js test/structured-refs.test.js test/dynamic-array.test.js test/print.test.js test/threaded-comments.test.js test/shapes.test.js test/table-export.test.js test/charts.test.js test/data-tools.test.js test/preservation.test.js"
27
- },
28
- "dependencies": {
29
- "gbooxml": "^0.1.3",
30
- "guabiutils": "^0.3.0"
31
- },
32
- "keywords": [
33
- "xlsx",
34
- "excel",
35
- "spreadsheet",
36
- "ooxml",
37
- "workbook",
38
- "editor",
39
- "ui"
40
- ],
41
- "engines": {
42
- "node": ">=18"
43
- }
44
- }
1
+ {
2
+ "name": "gbxlxs",
3
+ "version": "0.5.0",
4
+ "description": "Standalone spreadsheet (XLSX) engine with a self-contained HTML editor: read/write xlsx, workbook model ops, CSV/HTML import-export and a full spreadsheet UI.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "main": "./src/index.js",
11
+ "exports": {
12
+ ".": "./src/index.js",
13
+ "./ops": "./src/ops.js",
14
+ "./session": "./src/session.js",
15
+ "./workbook": "./src/workbook/index.js",
16
+ "./web/*": "./web/*",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "src",
21
+ "web",
22
+ "LICENSE"
23
+ ],
24
+ "scripts": {
25
+ "start": "node web/serve.mjs",
26
+ "test": "node --test test/editing.test.js test/move.test.js test/references.test.js test/session.test.js test/roundtrip.test.js test/scenarios.test.js test/ops-scenarios.test.js test/formula.test.js test/function-search.test.js test/find-replace.test.js test/advanced-filter.test.js test/structured-refs.test.js test/dynamic-array.test.js test/print.test.js test/threaded-comments.test.js test/shapes.test.js test/table-export.test.js test/charts.test.js test/data-tools.test.js test/preservation.test.js test/readonly.test.js"
27
+ },
28
+ "dependencies": {
29
+ "gbooxml": "^0.1.3",
30
+ "gbofficeui": "^0.2.0",
31
+ "guabiutils": "^0.3.0"
32
+ },
33
+ "keywords": [
34
+ "xlsx",
35
+ "excel",
36
+ "spreadsheet",
37
+ "ooxml",
38
+ "workbook",
39
+ "editor",
40
+ "ui"
41
+ ],
42
+ "engines": {
43
+ "node": ">=18"
44
+ }
45
+ }
@@ -17,7 +17,7 @@ import { diffRegion } from './history.js';
17
17
  import { invalidateRuleCache } from './rules.js';
18
18
  import { recalculateWorkbook } from '../../../src/workbook/index.js';
19
19
 
20
- export function createSheetCmdCore({ session, selection, history, zoom, onChanged }) {
20
+ export function createSheetCmdCore({ session, selection, history, zoom, onChanged, isReadOnly }) {
21
21
  const getWorkbook = () => session.getWorkbook();
22
22
  const getSheet = () => {
23
23
  const workbook = getWorkbook();
@@ -33,7 +33,10 @@ export function createSheetCmdCore({ session, selection, history, zoom, onChange
33
33
 
34
34
  const hexToRgb = (hex) => String(hex).replace('#', '').slice(-6).toUpperCase();
35
35
 
36
+ // [设计] 只读档与「工作表保护」共用唯一写入闸门:所有命令(编辑/结构/格式/图表/筛选)
37
+ // 都从这里过,切档不必逐个命令改。只读不弹提示——拖拽和键盘会高频触发,弹窗只会吵。
36
38
  const guard = () => {
39
+ if (isReadOnly?.()) return false;
37
40
  if (!isSheetProtected(getSheet())) return true;
38
41
  notify.warning('工作表已保护,无法编辑(在「开始 → 保护」中取消保护)');
39
42
  return false;
@@ -21,7 +21,8 @@ import { PrintPreview } from './ui/print-preview.js';
21
21
  import { openChartDialog } from './ui/chart-dialog.js';
22
22
  import { openNameManagerDialog, openRemoveDuplicatesDialog, openSubtotalDialog, openTextToColumnsDialog } from './ui/data-dialogs.js';
23
23
  import { notify } from './ui/notify.js';
24
- import { bindCtrlWheelZoom, debounce, downloadBlob, isTypingTarget } from 'guabiutils';
24
+ import { icon } from './ui/icons.js';
25
+ import { bindCtrlWheelZoom, createReadOnlyGuard, debounce, downloadBlob, isReadOnlyViewKey, isTypingTarget } from 'guabiutils';
25
26
  import { formulaSuggest } from './ui/formula-suggest.js';
26
27
  import { XLSX_MIME, openXlsxFile, saveXlsxFile, saveXlsxAs } from './ui/file-io.js';
27
28
 
@@ -68,6 +69,11 @@ export class SheetEditor {
68
69
  if (!this.mount) throw new Error('找不到挂载容器');
69
70
  this.embedded = Boolean(options.embedded);
70
71
  this.host = options.host || null;
72
+ // readOnly=禁止写入(命令层 guard + DOM 守卫双闸);hideMenuBar=隐藏顶栏那一行
73
+ this.readOnly = Boolean(options.readOnly);
74
+ this.menuBarVisible = !options.hideMenuBar;
75
+ this.preview = false;
76
+ this.previewRestore = null;
71
77
  this.active = !this.embedded;
72
78
  this.ready = false;
73
79
  this.saving = false;
@@ -94,6 +100,7 @@ export class SheetEditor {
94
100
  history: this.history,
95
101
  zoom: this.zoom,
96
102
  onChanged: () => this.session.markChanged(),
103
+ isReadOnly: () => this.readOnly,
97
104
  });
98
105
 
99
106
  this.painting = false;
@@ -120,20 +127,26 @@ export class SheetEditor {
120
127
  this.autoSaveScheduler = debounce(() => this.autoSaveTick(), 800);
121
128
  this.bindEvents();
122
129
  this.renderAll();
130
+ this.applyMode();
123
131
  }
124
132
 
125
133
  buildShell() {
126
134
  this.root = document.createElement('div');
127
135
  this.root.className = `sheets-app${this.dark ? ' dark' : ''}`;
128
136
  this.root.innerHTML = `
137
+ <div class="gbo-head sheets-head">
138
+ <span class="gbo-head__title"></span>
139
+ <span class="gbo-head__sub" hidden></span>
140
+ <span class="gbo-head__status save-status"></span>
141
+ <span class="gbo-head__spacer"></span>
142
+ <span class="gbo-head__actions">
143
+ <label class="gbo-head__auto"><input type="checkbox" class="gbo-head__autosave" />自动保存</label>
144
+ <button type="button" class="gbo-head__btn gbo-head__btn--primary sheets-save" data-act="save">保存</button>
145
+ </span>
146
+ <button type="button" class="gbo-head__btn gbo-head__preview" data-act="preview" title="预览模式" aria-pressed="false">${icon('view', 14)}<span>预览</span></button>
147
+ </div>
129
148
  <div class="sheets-menubar">
130
149
  <div class="gbx-menubar">${MENU_LABELS.map((m) => `<button type="button" class="gbx-menubar-btn" data-menu="${m.key}">${m.label}</button>`).join('')}</div>
131
- <div class="sheets-docinfo">
132
- <span class="doc-name"></span>
133
- <span class="doc-path"></span>
134
- <span class="save-status"></span>
135
- <button type="button" class="gbx-btn gbx-btn-primary gbx-btn-sm sheets-save" data-act="save">保存</button>
136
- </div>
137
150
  </div>
138
151
  <div class="sheets-body">
139
152
  <div class="sheet-toolbar-host"></div>
@@ -149,20 +162,78 @@ export class SheetEditor {
149
162
  `;
150
163
  this.mount.appendChild(this.root);
151
164
  this.menuBarEl = this.root.querySelector('.gbx-menubar');
152
- this.docNameEl = this.root.querySelector('.doc-name');
153
- this.docPathEl = this.root.querySelector('.doc-path');
165
+ this.menubarRowEl = this.root.querySelector('.sheets-menubar');
166
+ this.docNameEl = this.root.querySelector('.gbo-head__title');
167
+ this.docPathEl = this.root.querySelector('.gbo-head__sub');
154
168
  this.statusEl = this.root.querySelector('.save-status');
155
169
  this.saveBtn = this.root.querySelector('[data-act="save"]');
170
+ this.autosaveEl = this.root.querySelector('.gbo-head__autosave');
171
+ this.previewBtn = this.root.querySelector('[data-act="preview"]');
156
172
  this.toolbarHost = this.root.querySelector('.sheet-toolbar-host');
157
173
  this.formulaHost = this.root.querySelector('.sheet-formula-host');
158
174
  this.gridHost = this.root.querySelector('.sheet-grid-host');
159
175
  this.tabsHost = this.root.querySelector('.sheet-tabs-host');
160
176
  this.statusStateEl = this.root.querySelector('.sb-state');
161
177
  this.statusCalcEl = this.root.querySelector('.sb-calc');
178
+ // 只 inert 功能区按钮带与公式栏:文档头的预览按钮在 inert 之外,预览档里仍可点「退出预览」
179
+ this.guard = createReadOnlyGuard(this.root, {
180
+ editZones: () => [this.root.querySelector('.rb-bar'), this.formulaHost],
181
+ });
182
+ }
183
+
184
+ /** 构造参数落 DOM:装配完成后才调用,此时工具栏、公式栏都已就位 */
185
+ applyMode() {
186
+ this.setMenuBarVisible(this.menuBarVisible);
187
+ if (this.readOnly) this.setReadOnly(true);
188
+ }
189
+
190
+ /** 显示/隐藏顶部菜单栏那一行;文档头(标题/自动保存/保存/预览)不受影响 */
191
+ setMenuBarVisible(on) {
192
+ this.menuBarVisible = !!on;
193
+ this.menubarRowEl.style.display = this.menuBarVisible ? '' : 'none';
194
+ }
195
+
196
+ /** 只读开关:DOM 守卫 + 命令层 guard + 编辑类菜单/保存按钮一起切 */
197
+ setReadOnly(on) {
198
+ this.readOnly = !!on;
199
+ this.guard.setReadOnly(this.readOnly);
200
+ this.renderChrome();
201
+ }
202
+
203
+ /** 预览模式:只读 + 收起菜单/功能带/公式栏;文档头留着,同一按钮或 Esc 退出并恢复原档位 */
204
+ setPreview(on) {
205
+ const next = !!on;
206
+ if (next === this.preview) return;
207
+ if (next) {
208
+ this.previewRestore = { readOnly: this.readOnly, menuBar: this.menuBarVisible };
209
+ this.preview = true;
210
+ this.root.classList.add('gbx-is-preview');
211
+ this.setReadOnly(true);
212
+ this.setMenuBarVisible(false);
213
+ } else {
214
+ const restore = this.previewRestore || { readOnly: false, menuBar: true };
215
+ this.preview = false;
216
+ this.root.classList.remove('gbx-is-preview');
217
+ this.setReadOnly(restore.readOnly);
218
+ this.setMenuBarVisible(restore.menuBar);
219
+ this.previewRestore = null;
220
+ }
221
+ this.renderPreviewBtn();
222
+ }
223
+
224
+ /** 预览档按钮态:同一位置从「预览」切成「退出预览」 */
225
+ renderPreviewBtn() {
226
+ const active = this.preview;
227
+ this.previewBtn.classList.toggle('gbo-head__preview--on', active);
228
+ this.previewBtn.title = active ? '退出预览' : '预览模式';
229
+ this.previewBtn.setAttribute('aria-pressed', String(active));
230
+ this.previewBtn.querySelector('span').textContent = active ? '退出预览' : '预览';
162
231
  }
163
232
 
164
233
  bindEvents() {
165
234
  this.saveBtn.addEventListener('click', () => this.saveNow());
235
+ this.previewBtn.addEventListener('click', () => this.setPreview(!this.preview));
236
+ this.autosaveEl.addEventListener('change', () => this.setAutoSave(this.autosaveEl.checked));
166
237
  this.menuBarEl.addEventListener('click', (event) => {
167
238
  const btn = event.target.closest('[data-menu]');
168
239
  if (!btn) return;
@@ -262,7 +333,14 @@ export class SheetEditor {
262
333
 
263
334
  handleAppKeydown(event) {
264
335
  if (!this.active || event.defaultPrevented) return;
336
+ // 事件落在应用外时 DOM 守卫接不到,全局快捷键入口按同一份白名单再挡一次
337
+ if (this.readOnly && !isReadOnlyViewKey(event)) return;
265
338
  if (document.querySelector('.gbx-modal-mask, .gbx-prompt')) return;
339
+ if (event.key === 'Escape' && this.preview) {
340
+ event.preventDefault();
341
+ this.setPreview(false);
342
+ return;
343
+ }
266
344
  const mod = event.ctrlKey || event.metaKey;
267
345
  if (mod && !event.altKey && (event.key === 'f' || event.key === 'F' || event.key === 'h' || event.key === 'H')) {
268
346
  if (this.grid.editing) this.grid.commitEdit(null);
@@ -350,9 +428,14 @@ export class SheetEditor {
350
428
  this.docPathEl.hidden = !path;
351
429
  const status = this.getStatus();
352
430
  this.statusEl.textContent = status.text;
353
- this.statusEl.className = `save-status ${status.kind ? `gbx-is-${status.kind}` : ''}`.trim();
354
- this.saveBtn.disabled = !this.canSave();
431
+ this.statusEl.className = `gbo-head__status save-status ${status.kind ? `gbx-is-${status.kind}` : ''}`.trim();
432
+ this.saveBtn.disabled = this.readOnly || !this.canSave();
355
433
  this.saveBtn.classList.toggle('gbx-is-busy', status.text === '保存中…');
434
+ this.autosaveEl.checked = this.getAutoSave();
435
+ // 只读档只留「视图」菜单(缩放/主题),其余编辑类菜单按钮直接禁用
436
+ this.menuBarEl.querySelectorAll('[data-menu]').forEach((btn) => {
437
+ btn.disabled = this.readOnly && btn.dataset.menu !== 'view';
438
+ });
356
439
  }
357
440
 
358
441
  renderAll() {
@@ -937,6 +1020,7 @@ export class SheetEditor {
937
1020
  this.threadPanel.dispose();
938
1021
  this.printPreview.dispose();
939
1022
  this.grid.dispose();
1023
+ this.guard.destroy();
940
1024
  this.mount.innerHTML = '';
941
1025
  }
942
1026
  }
@@ -53,7 +53,7 @@ export class SheetToolbar {
53
53
  this.uid = `gbxtb${++toolbarSeq}`;
54
54
  this.fontListId = `${this.uid}-fonts`;
55
55
  this.sizeListId = `${this.uid}-sizes`;
56
- this.mount.className = 'sheet-ribbon';
56
+ this.mount.classList.add('sheet-ribbon');
57
57
  this.mount.innerHTML = `
58
58
  <div class="rb-tabs"></div>
59
59
  <div class="rb-bar"></div>
package/web/index.html CHANGED
@@ -5,7 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>挂逼表格 gbxlxs</title>
7
7
  <link rel="stylesheet" href="/web/styles/base.css" />
8
- <link rel="stylesheet" href="/web/styles/sheets.css" />
8
+ <link rel="stylesheet" href="/web/styles/sheets.css" />
9
+ <link rel="stylesheet" href="/vendor/gbofficeui/office-chrome.css" />
9
10
  <script type="importmap">
10
11
  {
11
12
  "imports": {
package/web/serve.mjs CHANGED
@@ -4,7 +4,8 @@ import { fileURLToPath } from 'node:url';
4
4
  import { startStaticServer } from 'guabiutils/dev-server';
5
5
 
6
6
  const ooxmlSrc = fileURLToPath(new URL('../../gbooxml/src/', import.meta.url));
7
- const utilsSrc = fileURLToPath(new URL('../../guabiutils/src/', import.meta.url));
7
+ const utilsSrc = fileURLToPath(new URL('../../../guabiutils/src/', import.meta.url));
8
+ const officeChrome = fileURLToPath(new URL('../../gbofficeui/styles/', import.meta.url));
8
9
 
9
10
  const { origin } = await startStaticServer({
10
11
  root: fileURLToPath(new URL('..', import.meta.url)),
@@ -14,6 +15,7 @@ const { origin } = await startStaticServer({
14
15
  // 表格的 importmap 有 `gbooxml/opc` 这类省略扩展名的写法,靠 jsFallback 兜到 .js
15
16
  { prefix: '/vendor/gbooxml/', dir: ooxmlSrc, jsFallback: true },
16
17
  { prefix: '/vendor/guabiutils/', dir: utilsSrc },
18
+ { prefix: '/vendor/gbofficeui/', dir: officeChrome },
17
19
  ],
18
20
  });
19
21
 
@@ -1,5 +1,20 @@
1
1
  /* 页面级底座:仅独立运行时引入,供嵌入方使用的 sheets.css 不包含这些全局选择器 */
2
2
 
3
+ html,
4
+ body {
5
+ height: 100%;
6
+ margin: 0;
7
+ }
8
+
9
+ body {
10
+ background: var(--gbx-dt-bg);
11
+ }
12
+
13
+ #app {
14
+ height: 100%;
15
+ min-height: 0;
16
+ }
17
+
3
18
  .gbx-root, .gbx-root * {
4
19
  box-sizing: border-box;
5
20
  scrollbar-color: var(--gbx-dt-scrollbar) transparent;
@@ -30,9 +45,9 @@
30
45
 
31
46
  .gbx-root {
32
47
  color: var(--gbx-dt-text);
33
- background: var(--gbx-dt-bg-2);
48
+ background: var(--gbx-dt-bg);
34
49
  font-family: 'Microsoft YaHei', -apple-system, 'Segoe UI', sans-serif;
35
- font-size: 14px;
50
+ font-size: 13px;
36
51
  }
37
52
 
38
53
  .gbx-root {
@@ -22,14 +22,14 @@
22
22
 
23
23
  .sheets-app {
24
24
  --gbx-sg-bg: #ffffff;
25
- --gbx-sg-text: #1f2329;
26
- --gbx-sg-line: #dfe2e8;
27
- --gbx-sg-head-bg: #f5f6f8;
28
- --gbx-sg-head-hot: #e4e9f2;
29
- --gbx-sg-head-text: #61666d;
30
- --gbx-sg-accent: #2b5df0;
31
- --gbx-sg-select: rgba(43, 93, 240, 0.08);
32
- --gbx-sg-select-edge: rgba(43, 93, 240, 0.55);
25
+ --gbx-sg-text: #171a1f;
26
+ --gbx-sg-line: rgba(23, 26, 31, 0.09);
27
+ --gbx-sg-head-bg: #ffffff;
28
+ --gbx-sg-head-hot: rgba(42, 107, 255, 0.1);
29
+ --gbx-sg-head-text: rgba(23, 26, 31, 0.64);
30
+ --gbx-sg-accent: #2a6bff;
31
+ --gbx-sg-select: rgba(42, 107, 255, 0.08);
32
+ --gbx-sg-select-edge: rgba(42, 107, 255, 0.55);
33
33
  position: relative;
34
34
  display: flex;
35
35
  flex-direction: column;
@@ -70,92 +70,32 @@
70
70
  display: flex;
71
71
  }
72
72
 
73
- /* ==================== 菜单栏与文档头 ==================== */
74
-
75
- .sheets-menubar {
76
- display: flex;
77
- align-items: center;
78
- gap: 2px;
79
- height: 30px;
80
- padding: 0 6px;
81
- background: var(--gbx-dt-bg-2);
82
- border-bottom: 1px solid var(--gbx-dt-border);
83
- flex: none;
84
- min-width: 0;
85
- }
73
+ /* ==================== 只读档 ==================== */
74
+ .sheets-app.gb-is-readonly .sheet-ribbon,
75
+ .sheets-app.gb-is-readonly .sheet-formula-host { opacity: .55; }
86
76
 
87
- .gbx-menubar {
88
- display: flex;
89
- align-items: center;
90
- gap: 2px;
91
- flex: none;
92
- min-width: 0;
93
- overflow-x: auto;
94
- scrollbar-width: none;
95
- }
96
-
97
- .gbx-menubar::-webkit-scrollbar {
77
+ /* ==================== 预览模式 ==================== */
78
+ /* 只留文档头(标题 + 退出预览)、网格与工作表标签;菜单、功能带、公式栏、状态栏与浮层收起 */
79
+ .sheets-app.gbx-is-preview .sheets-menubar,
80
+ .sheets-app.gbx-is-preview .sheet-ribbon,
81
+ .sheets-app.gbx-is-preview .sheet-formula-bar,
82
+ .sheets-app.gbx-is-preview .gbo-head__actions,
83
+ .sheets-app.gbx-is-preview .sheets-statusbar,
84
+ .sheets-app.gbx-is-preview .gbx-find,
85
+ .sheets-app.gbx-is-preview .gbx-filter-panel,
86
+ .sheets-app.gbx-is-preview .gbx-thread-panel {
98
87
  display: none;
99
88
  }
100
89
 
101
- .gbx-menubar-btn {
102
- flex-shrink: 0;
103
- height: 26px;
104
- padding: 0 8px;
105
- border: none;
106
- border-radius: 4px;
107
- background: transparent;
108
- color: var(--gbx-dt-text);
109
- font-size: 12px;
110
- white-space: nowrap;
111
- cursor: pointer;
112
- transition: background-color var(--gbx-dt-duration-fast) ease;
113
- }
114
-
115
- .gbx-menubar-btn:hover {
116
- background: var(--gbx-dt-hover);
117
- }
118
-
119
- .sheets-docinfo {
120
- display: flex;
121
- align-items: center;
122
- gap: 8px;
123
- flex: 1;
124
- min-width: 0;
125
- margin-left: auto;
126
- justify-content: flex-end;
127
- }
128
-
129
- .sheets-docinfo .doc-name {
130
- max-width: 240px;
131
- overflow: hidden;
132
- text-overflow: ellipsis;
133
- white-space: nowrap;
134
- font-size: 13px;
135
- color: var(--gbx-dt-text);
136
- }
137
-
138
- .sheets-docinfo .doc-path {
139
- font-size: 12px;
140
- color: var(--gbx-dt-text-tertiary);
141
- min-width: 0;
142
- overflow: hidden;
143
- text-overflow: ellipsis;
144
- white-space: nowrap;
145
- }
146
-
147
- .sheets-docinfo .save-status {
148
- flex-shrink: 0;
149
- font-size: 12px;
150
- color: var(--gbx-dt-text-tertiary);
151
- white-space: nowrap;
152
- }
90
+ /* ==================== 菜单栏与文档头 ==================== */
91
+ /* 菜单栏 / 文档头 / 功能区 / 公式栏 / 状态栏 / 页签的视觉由 gbofficeui 统一,
92
+ 这里只保留 xlsx 专属状态与骨架。 */
153
93
 
154
- .sheets-docinfo .save-status.gbx-is-dirty {
94
+ .sheets-head .save-status.gbx-is-dirty {
155
95
  color: var(--gbx-dt-accent);
156
96
  }
157
97
 
158
- .sheets-docinfo .save-status.gbx-is-error {
98
+ .sheets-head .save-status.gbx-is-error {
159
99
  color: var(--gbx-dt-danger);
160
100
  }
161
101
 
@@ -168,8 +108,8 @@
168
108
  width: 10px;
169
109
  height: 10px;
170
110
  margin-left: 6px;
171
- border: 2px solid rgba(255, 255, 255, 0.5);
172
- border-top-color: #fff;
111
+ border: 2px solid var(--gbx-dt-accent-soft);
112
+ border-top-color: var(--gbx-dt-accent);
173
113
  border-radius: 50%;
174
114
  animation: gbx-spin 0.8s linear infinite;
175
115
  }
@@ -204,10 +144,7 @@
204
144
  }
205
145
 
206
146
  .gbx-btn:focus-visible,
207
- .rb-btn:focus-visible,
208
- .gbx-menubar-btn:focus-visible,
209
- .gbx-menu-item:focus-visible,
210
- .sheet-tab-add:focus-visible {
147
+ .gbx-menu-item:focus-visible {
211
148
  outline: 2px solid var(--gbx-dt-accent);
212
149
  outline-offset: 2px;
213
150
  }
@@ -249,316 +186,14 @@
249
186
  }
250
187
 
251
188
  /* ==================== Ribbon 工具带 ==================== */
252
-
253
- .sheet-ribbon {
254
- flex: none;
255
- min-width: 0;
256
- background: var(--gbx-sg-head-bg);
257
- border-bottom: 1px solid var(--gbx-sg-line);
258
- }
259
-
260
- .rb-tabs {
261
- display: flex;
262
- align-items: flex-end;
263
- height: 32px;
264
- padding: 0 8px;
265
- user-select: none;
266
- }
267
-
268
- .rb-tab {
269
- display: inline-flex;
270
- align-items: center;
271
- height: 32px;
272
- padding: 0 12px;
273
- border: none;
274
- border-bottom: 3px solid transparent;
275
- background: transparent;
276
- color: var(--gbx-sg-head-text);
277
- font-size: 13px;
278
- font-weight: 600;
279
- cursor: pointer;
280
- transition: color var(--gbx-dt-duration-fast) ease, border-color var(--gbx-dt-duration-fast) ease;
281
- }
282
-
283
- .rb-tab:hover {
284
- color: var(--gbx-sg-text);
285
- }
286
-
287
- .rb-tab.on {
288
- border-bottom-color: var(--gbx-sg-accent);
289
- color: var(--gbx-sg-accent);
290
- }
291
-
292
- .rb-bar {
293
- display: flex;
294
- overflow-x: auto;
295
- overflow-y: hidden;
296
- user-select: none;
297
- scrollbar-width: none;
298
- }
299
-
300
- .rb-bar::-webkit-scrollbar {
301
- display: none;
302
- }
303
-
304
- .rb-group {
305
- position: relative;
306
- display: flex;
307
- flex: none;
308
- padding: 0 8px;
309
- }
310
-
311
- .rb-group::after {
312
- content: '';
313
- position: absolute;
314
- right: 0;
315
- top: 14px;
316
- bottom: 6px;
317
- width: 1px;
318
- background: var(--gbx-sg-line);
319
- }
320
-
321
- .rb-grid {
322
- display: grid;
323
- grid-auto-flow: column;
324
- grid-template-rows: repeat(2, 24px);
325
- align-content: center;
326
- gap: 8px;
327
- padding: 8px 0;
328
- }
329
-
330
- .rb-select {
331
- justify-self: start;
332
- height: 24px;
333
- padding: 0 6px;
334
- border: 1px solid var(--gbx-sg-line);
335
- border-radius: 4px;
336
- background: var(--gbx-sg-bg);
337
- color: var(--gbx-sg-text);
338
- font-size: 12px;
339
- font-family: inherit;
340
- outline: none;
341
- min-width: 0;
342
- }
343
-
344
- .rb-select:hover {
345
- border-color: var(--gbx-sg-head-text);
346
- }
347
-
348
- .rb-select:focus {
349
- border-color: var(--gbx-sg-accent);
350
- box-shadow: 0 0 0 1px var(--gbx-sg-select-edge);
351
- }
352
-
353
- .rb-btn {
354
- display: inline-flex;
355
- align-items: center;
356
- justify-content: center;
357
- justify-self: start;
358
- gap: 4px;
359
- min-width: 24px;
360
- height: 24px;
361
- padding: 0;
362
- border: 1px solid transparent;
363
- border-radius: 4px;
364
- background: transparent;
365
- color: var(--gbx-sg-text);
366
- font-size: 12px;
367
- white-space: nowrap;
368
- cursor: pointer;
369
- transition: background-color 0.12s ease;
370
- }
371
-
372
- .rb-btn:hover {
373
- background: var(--gbx-sg-head-hot);
374
- }
375
-
376
- .rb-btn.on {
377
- background: var(--gbx-sg-select);
378
- border-color: var(--gbx-sg-select-edge);
379
- }
380
-
381
- .rb-btn:disabled {
382
- opacity: 0.4;
383
- cursor: default;
384
- background: transparent;
385
- }
189
+ /* 选项卡 / 分组 / 按钮 / 下拉的视觉由 gbofficeui 统一;这里只留 xlsx 专属微调。 */
386
190
 
387
191
  .rb-btn.sel {
388
192
  padding: 0 4px;
389
193
  }
390
194
 
391
- .rb-btn.text {
392
- padding: 0 8px;
393
- border-color: var(--gbx-sg-line);
394
- background: var(--gbx-sg-bg);
395
- }
396
-
397
- .rb-label {
398
- padding: 0 2px;
399
- }
400
-
401
- .rb-caret {
402
- margin-left: -2px;
403
- color: var(--gbx-sg-head-text);
404
- }
405
-
406
- .rb-big {
407
- display: flex;
408
- flex-direction: column;
409
- justify-self: start;
410
- min-width: 56px;
411
- border-radius: 4px;
412
- overflow: hidden;
413
- }
414
-
415
- .rb-big:hover {
416
- background: var(--gbx-sg-head-hot);
417
- }
418
-
419
- .rb-big.on {
420
- background: var(--gbx-sg-select);
421
- }
422
-
423
- .rb-big-main {
424
- flex: 1;
425
- display: flex;
426
- flex-direction: column;
427
- align-items: center;
428
- justify-content: center;
429
- gap: 2px;
430
- padding: 0 6px;
431
- border: none;
432
- background: transparent;
433
- color: var(--gbx-sg-text);
434
- cursor: pointer;
435
- }
436
-
437
- .rb-big-label {
438
- font-size: 11px;
439
- line-height: 1;
440
- white-space: nowrap;
441
- }
442
-
443
- .rb-big-glyph {
444
- font-size: 14px;
445
- font-weight: 700;
446
- line-height: 1.1;
447
- letter-spacing: -0.5px;
448
- }
449
-
450
- .rb-big-caret {
451
- display: flex;
452
- align-items: center;
453
- justify-content: center;
454
- height: 14px;
455
- border: none;
456
- background: transparent;
457
- color: var(--gbx-sg-head-text);
458
- cursor: pointer;
459
- }
460
-
461
- .rb-cell {
462
- display: flex;
463
- align-items: stretch;
464
- justify-self: start;
465
- }
466
-
467
- .rb-palette {
468
- position: relative;
469
- min-width: 26px;
470
- padding-bottom: 4px;
471
- }
472
-
473
- .rb-swatch {
474
- position: absolute;
475
- left: 4px;
476
- right: 4px;
477
- bottom: 1px;
478
- height: 3px;
479
- border-radius: 1px;
480
- border: 1px solid rgba(127, 127, 127, 0.35);
481
- }
482
-
483
195
  /* ==================== 公式栏 ==================== */
484
-
485
- .sheet-formula-bar {
486
- display: flex;
487
- align-items: center;
488
- gap: 4px;
489
- height: 28px;
490
- padding: 0 8px;
491
- border-bottom: 1px solid var(--gbx-sg-line);
492
- background: var(--gbx-sg-head-bg);
493
- color: var(--gbx-sg-text);
494
- font-size: 12px;
495
- flex: none;
496
- }
497
-
498
- .sheet-formula-bar .fb-addr {
499
- width: 92px;
500
- height: 22px;
501
- border: 1px solid var(--gbx-sg-line);
502
- border-radius: 3px;
503
- padding: 0 6px;
504
- font-size: 12px;
505
- font-family: inherit;
506
- background: transparent;
507
- color: inherit;
508
- outline: none;
509
- text-align: center;
510
- }
511
-
512
- .sheet-formula-bar .fb-addr:focus {
513
- background: rgba(127, 127, 127, 0.08);
514
- border-color: var(--gbx-sg-select-edge);
515
- }
516
-
517
- .sheet-formula-bar .fb-btn {
518
- display: inline-flex;
519
- align-items: center;
520
- justify-content: center;
521
- width: 22px;
522
- height: 22px;
523
- border: none;
524
- border-radius: 3px;
525
- background: transparent;
526
- color: var(--gbx-sg-text);
527
- cursor: pointer;
528
- }
529
-
530
- .sheet-formula-bar .fb-btn:hover:not(:disabled) {
531
- background: var(--gbx-sg-head-hot);
532
- }
533
-
534
- .sheet-formula-bar .fb-btn:disabled {
535
- opacity: 0.35;
536
- cursor: default;
537
- }
538
-
539
- .sheet-formula-bar .fb-fx {
540
- font-style: italic;
541
- color: var(--gbx-sg-head-text);
542
- user-select: none;
543
- }
544
-
545
- .sheet-formula-bar .fb-editor {
546
- flex: 1;
547
- height: 22px;
548
- border: 1px solid transparent;
549
- border-radius: 3px;
550
- padding: 0 6px;
551
- font-size: 12px;
552
- font-family: inherit;
553
- background: transparent;
554
- color: inherit;
555
- outline: none;
556
- }
557
-
558
- .sheet-formula-bar .fb-editor:focus {
559
- background: rgba(127, 127, 127, 0.08);
560
- border-color: var(--gbx-sg-line);
561
- }
196
+ /* 结构由 FormulaBar 生成,视觉由 gbofficeui 统一;此处无本地覆盖。 */
562
197
 
563
198
  /* ==================== 网格 ==================== */
564
199
 
@@ -943,66 +578,10 @@
943
578
  }
944
579
 
945
580
  /* ==================== 状态栏 ==================== */
946
-
947
- .sheets-statusbar {
948
- flex: none;
949
- display: flex;
950
- align-items: center;
951
- justify-content: space-between;
952
- gap: 16px;
953
- height: 24px;
954
- padding: 0 10px;
955
- border-top: 1px solid var(--gbx-sg-line);
956
- background: var(--gbx-sg-bg);
957
- color: var(--gbx-sg-head-text);
958
- font-size: 11px;
959
- user-select: none;
960
- }
961
-
962
- .sheets-statusbar .sb-calc {
963
- color: var(--gbx-sg-text);
964
- font-variant-numeric: tabular-nums;
965
- overflow: hidden;
966
- text-overflow: ellipsis;
967
- white-space: nowrap;
968
- }
581
+ /* 视觉由 gbofficeui 统一;.sb-calc 的数字排版也在共享皮肤内。 */
969
582
 
970
583
  /* ==================== 工作表页签 ==================== */
971
-
972
- .sheet-tabs {
973
- display: flex;
974
- align-items: flex-end;
975
- gap: 2px;
976
- height: 30px;
977
- padding: 3px 8px 0;
978
- background: var(--gbx-sg-head-bg);
979
- border-top: 1px solid var(--gbx-sg-line);
980
- overflow-x: auto;
981
- flex: none;
982
- }
983
-
984
- .sheet-tab {
985
- position: relative;
986
- flex-shrink: 0;
987
- height: 24px;
988
- padding: 0 12px;
989
- border: 1px solid var(--gbx-sg-line);
990
- border-bottom: none;
991
- border-radius: 5px 5px 0 0;
992
- background: var(--gbx-sg-head-bg);
993
- color: var(--gbx-sg-head-text);
994
- font-size: 12px;
995
- line-height: 22px;
996
- white-space: nowrap;
997
- cursor: pointer;
998
- user-select: none;
999
- }
1000
-
1001
- .sheet-tab.gbx-is-active {
1002
- background: var(--gbx-sg-bg);
1003
- color: var(--gbx-sg-text);
1004
- font-weight: 600;
1005
- }
584
+ /* 页签外观由 gbofficeui 统一;xlsx 只保留「工作表颜色」这条专属装饰。 */
1006
585
 
1007
586
  .sheet-tab.has-color::after {
1008
587
  content: '';
@@ -1015,11 +594,6 @@
1015
594
  background: var(--gbx-tab-color);
1016
595
  }
1017
596
 
1018
- .sheet-tab-add {
1019
- padding: 0 8px;
1020
- font-size: 13px;
1021
- }
1022
-
1023
597
  /* ==================== 菜单浮层 ==================== */
1024
598
 
1025
599
  .gbx-menu {
@@ -1599,7 +1173,7 @@
1599
1173
  display: block;
1600
1174
  padding: 6px 8px;
1601
1175
  border-radius: 6px;
1602
- background: var(--gbx-dt-bg-2);
1176
+ background: var(--gbx-dt-bg);
1603
1177
  color: var(--gbx-dt-text-secondary);
1604
1178
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
1605
1179
  font-size: 11px;
@@ -1839,7 +1413,7 @@
1839
1413
  padding: 0 8px;
1840
1414
  border: 1px solid var(--gbx-dt-border-strong);
1841
1415
  border-radius: var(--gbx-dt-radius-sm);
1842
- background: var(--gbx-dt-bg-2);
1416
+ background: var(--gbx-dt-bg);
1843
1417
  color: var(--gbx-dt-text);
1844
1418
  font: inherit;
1845
1419
  outline: none;
@@ -2028,7 +1602,7 @@
2028
1602
  padding: 0 8px;
2029
1603
  border: 1px solid var(--gbx-dt-border-strong);
2030
1604
  border-radius: var(--gbx-dt-radius-sm);
2031
- background: var(--gbx-dt-bg-2);
1605
+ background: var(--gbx-dt-bg);
2032
1606
  color: var(--gbx-dt-text);
2033
1607
  font: inherit;
2034
1608
  outline: none;
@@ -2117,7 +1691,7 @@
2117
1691
  padding: 0 6px;
2118
1692
  border: 1px solid var(--gbx-dt-border-strong);
2119
1693
  border-radius: var(--gbx-dt-radius-sm);
2120
- background: var(--gbx-dt-bg-2);
1694
+ background: var(--gbx-dt-bg);
2121
1695
  color: var(--gbx-dt-text);
2122
1696
  font: inherit;
2123
1697
  outline: none;
@@ -2194,7 +1768,7 @@
2194
1768
  height: 26px;
2195
1769
  border: 1px solid var(--gbx-dt-border-strong);
2196
1770
  border-radius: var(--gbx-dt-radius-sm);
2197
- background: var(--gbx-dt-bg-2);
1771
+ background: var(--gbx-dt-bg);
2198
1772
  color: var(--gbx-dt-text);
2199
1773
  font: inherit;
2200
1774
  }
@@ -2284,7 +1858,7 @@
2284
1858
  padding: 8px;
2285
1859
  border: 1px solid var(--gbx-dt-border);
2286
1860
  border-radius: var(--gbx-dt-radius-sm);
2287
- background: var(--gbx-dt-bg-2);
1861
+ background: var(--gbx-dt-bg);
2288
1862
  }
2289
1863
 
2290
1864
  .gbx-thread.gbx-is-done {
@@ -2372,7 +1946,7 @@
2372
1946
  padding: 6px 8px;
2373
1947
  border: 1px solid var(--gbx-dt-border-strong);
2374
1948
  border-radius: var(--gbx-dt-radius-sm);
2375
- background: var(--gbx-dt-bg-2);
1949
+ background: var(--gbx-dt-bg);
2376
1950
  color: var(--gbx-dt-text);
2377
1951
  font: inherit;
2378
1952
  outline: none;
@@ -2543,7 +2117,7 @@
2543
2117
  justify-content: center;
2544
2118
  color: #777;
2545
2119
  font-size: 9px;
2546
- background: #f1f2f4;
2120
+ background: #fff;
2547
2121
  overflow: hidden;
2548
2122
  }
2549
2123
 
@@ -2610,11 +2184,11 @@
2610
2184
  /* ==================== 窄屏 ==================== */
2611
2185
 
2612
2186
  @media (max-width: 760px) {
2613
- .sheets-docinfo .doc-path {
2187
+ .sheets-head .gbo-head__sub {
2614
2188
  display: none;
2615
2189
  }
2616
2190
 
2617
- .sheets-docinfo .doc-name {
2191
+ .sheets-head .gbo-head__title {
2618
2192
  max-width: 140px;
2619
2193
  }
2620
2194
 
@@ -6,10 +6,10 @@
6
6
  --gbx-dt-accent-soft: rgba(42, 107, 255, 0.14);
7
7
  --gbx-dt-accent-soft-strong: rgba(42, 107, 255, 0.3);
8
8
 
9
- --gbx-dt-surface: #f6f8fb;
9
+ --gbx-dt-surface: #ffffff;
10
10
  --gbx-dt-bg: #ffffff;
11
- --gbx-dt-bg-2: #f7f9fc;
12
- --gbx-dt-bg-3: #fafbfd;
11
+ --gbx-dt-bg-2: #ffffff;
12
+ --gbx-dt-bg-3: #ffffff;
13
13
 
14
14
  --gbx-dt-text: #171a1f;
15
15
  --gbx-dt-text-secondary: rgba(23, 26, 31, 0.64);