gbxlxs 0.3.0 → 0.4.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,6 +1,6 @@
1
1
  {
2
2
  "name": "gbxlxs",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
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
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,10 +23,11 @@
23
23
  ],
24
24
  "scripts": {
25
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"
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
27
  },
28
28
  "dependencies": {
29
29
  "gbooxml": "^0.1.3",
30
+ "gbofficeui": "^0.1.0",
30
31
  "guabiutils": "^0.3.0"
31
32
  },
32
33
  "keywords": [
@@ -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,7 @@ 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 { bindCtrlWheelZoom, createReadOnlyGuard, debounce, downloadBlob, isReadOnlyViewKey, isTypingTarget } from 'guabiutils';
25
25
  import { formulaSuggest } from './ui/formula-suggest.js';
26
26
  import { XLSX_MIME, openXlsxFile, saveXlsxFile, saveXlsxAs } from './ui/file-io.js';
27
27
 
@@ -68,6 +68,11 @@ export class SheetEditor {
68
68
  if (!this.mount) throw new Error('找不到挂载容器');
69
69
  this.embedded = Boolean(options.embedded);
70
70
  this.host = options.host || null;
71
+ // readOnly=禁止写入(命令层 guard + DOM 守卫双闸);hideMenuBar=隐藏顶栏那一行
72
+ this.readOnly = Boolean(options.readOnly);
73
+ this.menuBarVisible = !options.hideMenuBar;
74
+ this.preview = false;
75
+ this.previewRestore = null;
71
76
  this.active = !this.embedded;
72
77
  this.ready = false;
73
78
  this.saving = false;
@@ -94,6 +99,7 @@ export class SheetEditor {
94
99
  history: this.history,
95
100
  zoom: this.zoom,
96
101
  onChanged: () => this.session.markChanged(),
102
+ isReadOnly: () => this.readOnly,
97
103
  });
98
104
 
99
105
  this.painting = false;
@@ -120,6 +126,7 @@ export class SheetEditor {
120
126
  this.autoSaveScheduler = debounce(() => this.autoSaveTick(), 800);
121
127
  this.bindEvents();
122
128
  this.renderAll();
129
+ this.applyMode();
123
130
  }
124
131
 
125
132
  buildShell() {
@@ -149,6 +156,7 @@ export class SheetEditor {
149
156
  `;
150
157
  this.mount.appendChild(this.root);
151
158
  this.menuBarEl = this.root.querySelector('.gbx-menubar');
159
+ this.menubarRowEl = this.root.querySelector('.sheets-menubar');
152
160
  this.docNameEl = this.root.querySelector('.doc-name');
153
161
  this.docPathEl = this.root.querySelector('.doc-path');
154
162
  this.statusEl = this.root.querySelector('.save-status');
@@ -159,6 +167,51 @@ export class SheetEditor {
159
167
  this.tabsHost = this.root.querySelector('.sheet-tabs-host');
160
168
  this.statusStateEl = this.root.querySelector('.sb-state');
161
169
  this.statusCalcEl = this.root.querySelector('.sb-calc');
170
+ // 只 inert 功能区按钮带与公式栏:选项卡行里的预览按钮要保持可点(选项卡只切视图,放行无写风险)
171
+ this.guard = createReadOnlyGuard(this.root, {
172
+ editZones: () => [this.root.querySelector('.rb-bar'), this.formulaHost],
173
+ });
174
+ }
175
+
176
+ /** 构造参数落 DOM:装配完成后才调用,此时工具栏、公式栏都已就位 */
177
+ applyMode() {
178
+ this.setMenuBarVisible(this.menuBarVisible);
179
+ if (this.readOnly) this.setReadOnly(true);
180
+ }
181
+
182
+ /** 显示/隐藏顶部菜单栏那一行(含同行文档名与保存按钮) */
183
+ setMenuBarVisible(on) {
184
+ this.menuBarVisible = !!on;
185
+ this.menubarRowEl.style.display = this.menuBarVisible ? '' : 'none';
186
+ }
187
+
188
+ /** 只读开关:DOM 守卫 + 命令层 guard + 编辑类菜单/保存按钮一起切 */
189
+ setReadOnly(on) {
190
+ this.readOnly = !!on;
191
+ this.guard.setReadOnly(this.readOnly);
192
+ this.renderChrome();
193
+ }
194
+
195
+ /** 预览模式:只读 + 收起菜单/功能带/公式栏;同一按钮或 Esc 退出并恢复原档位 */
196
+ setPreview(on) {
197
+ const next = !!on;
198
+ if (next === this.preview) return;
199
+ if (next) {
200
+ this.previewRestore = { readOnly: this.readOnly, menuBar: this.menuBarVisible };
201
+ this.preview = true;
202
+ this.root.classList.add('gbx-is-preview');
203
+ this.toolbar.setPreview(true);
204
+ this.setReadOnly(true);
205
+ this.setMenuBarVisible(false);
206
+ } else {
207
+ const restore = this.previewRestore || { readOnly: false, menuBar: true };
208
+ this.preview = false;
209
+ this.root.classList.remove('gbx-is-preview');
210
+ this.toolbar.setPreview(false);
211
+ this.setReadOnly(restore.readOnly);
212
+ this.setMenuBarVisible(restore.menuBar);
213
+ this.previewRestore = null;
214
+ }
162
215
  }
163
216
 
164
217
  bindEvents() {
@@ -262,7 +315,14 @@ export class SheetEditor {
262
315
 
263
316
  handleAppKeydown(event) {
264
317
  if (!this.active || event.defaultPrevented) return;
318
+ // 事件落在应用外时 DOM 守卫接不到,全局快捷键入口按同一份白名单再挡一次
319
+ if (this.readOnly && !isReadOnlyViewKey(event)) return;
265
320
  if (document.querySelector('.gbx-modal-mask, .gbx-prompt')) return;
321
+ if (event.key === 'Escape' && this.preview) {
322
+ event.preventDefault();
323
+ this.setPreview(false);
324
+ return;
325
+ }
266
326
  const mod = event.ctrlKey || event.metaKey;
267
327
  if (mod && !event.altKey && (event.key === 'f' || event.key === 'F' || event.key === 'h' || event.key === 'H')) {
268
328
  if (this.grid.editing) this.grid.commitEdit(null);
@@ -351,8 +411,12 @@ export class SheetEditor {
351
411
  const status = this.getStatus();
352
412
  this.statusEl.textContent = status.text;
353
413
  this.statusEl.className = `save-status ${status.kind ? `gbx-is-${status.kind}` : ''}`.trim();
354
- this.saveBtn.disabled = !this.canSave();
414
+ this.saveBtn.disabled = this.readOnly || !this.canSave();
355
415
  this.saveBtn.classList.toggle('gbx-is-busy', status.text === '保存中…');
416
+ // 只读档只留「视图」菜单(缩放/主题),其余编辑类菜单按钮直接禁用
417
+ this.menuBarEl.querySelectorAll('[data-menu]').forEach((btn) => {
418
+ btn.disabled = this.readOnly && btn.dataset.menu !== 'view';
419
+ });
356
420
  }
357
421
 
358
422
  renderAll() {
@@ -937,6 +1001,7 @@ export class SheetEditor {
937
1001
  this.threadPanel.dispose();
938
1002
  this.printPreview.dispose();
939
1003
  this.grid.dispose();
1004
+ this.guard.destroy();
940
1005
  this.mount.innerHTML = '';
941
1006
  }
942
1007
  }
@@ -62,6 +62,14 @@ export class SheetToolbar {
62
62
  `;
63
63
  this.tabsEl = this.mount.querySelector('.rb-tabs');
64
64
  this.barEl = this.mount.querySelector('.rb-bar');
65
+ this.previewBtn = document.createElement('button');
66
+ this.previewBtn.type = 'button';
67
+ this.previewBtn.className = 'rb-preview';
68
+ this.previewBtn.title = '预览模式';
69
+ this.previewBtn.setAttribute('aria-pressed', 'false');
70
+ this.previewBtn.innerHTML = `${icon('view', 14)}<span>预览</span>`;
71
+ this.previewBtn.addEventListener('click', () => this.app.setPreview(!this.app.preview));
72
+ this.tabsEl.appendChild(this.previewBtn);
65
73
  this.tabsEl.addEventListener('click', (event) => {
66
74
  const btn = event.target.closest('[data-tab]');
67
75
  if (!btn) return;
@@ -86,6 +94,15 @@ export class SheetToolbar {
86
94
  return this.app.commands;
87
95
  }
88
96
 
97
+ /** 预览档按钮态:同一位置从「预览」切成「退出预览」 */
98
+ setPreview(on) {
99
+ const active = !!on;
100
+ this.previewBtn.classList.toggle('on', active);
101
+ this.previewBtn.title = active ? '退出预览' : '预览模式';
102
+ this.previewBtn.setAttribute('aria-pressed', String(active));
103
+ this.previewBtn.querySelector('span').textContent = active ? '退出预览' : '预览';
104
+ }
105
+
89
106
  get selection() {
90
107
  return this.app.selection;
91
108
  }
@@ -862,6 +879,8 @@ export class SheetToolbar {
862
879
 
863
880
  render() {
864
881
  this.tabsEl.innerHTML = TABS.map((t) => `<button type="button" class="rb-tab${t.key === this.tab ? ' on' : ''}" data-tab="${t.key}">${t.label}</button>`).join('');
882
+ // 预览按钮不参与 tab 重绘:每次重建后补回行尾,避免 render 把它冲掉
883
+ this.tabsEl.appendChild(this.previewBtn);
865
884
  this.barEl.innerHTML = this.groups()
866
885
  .map((group) => `<div class="rb-group"><div class="rb-grid">${group.items.map((item) => this.renderItem(item)).join('')}</div></div>`)
867
886
  .join('');
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,86 +70,28 @@
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-toolbar-host,
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 .rb-bar,
81
+ .sheets-app.gbx-is-preview .sheet-formula-bar,
82
+ .sheets-app.gbx-is-preview .sheets-statusbar,
83
+ .sheets-app.gbx-is-preview .gbx-find,
84
+ .sheets-app.gbx-is-preview .gbx-filter-panel,
85
+ .sheets-app.gbx-is-preview .gbx-thread-panel {
98
86
  display: none;
99
87
  }
100
-
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;
88
+ .sheets-app.gbx-is-preview .rb-tab {
89
+ display: none;
145
90
  }
146
91
 
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
- }
92
+ /* ==================== 菜单栏与文档头 ==================== */
93
+ /* 菜单栏 / 文档头 / 功能区 / 公式栏 / 状态栏 / 页签的视觉由 gbofficeui 统一,
94
+ 这里只保留 xlsx 专属状态与骨架。 */
153
95
 
154
96
  .sheets-docinfo .save-status.gbx-is-dirty {
155
97
  color: var(--gbx-dt-accent);
@@ -168,8 +110,8 @@
168
110
  width: 10px;
169
111
  height: 10px;
170
112
  margin-left: 6px;
171
- border: 2px solid rgba(255, 255, 255, 0.5);
172
- border-top-color: #fff;
113
+ border: 2px solid var(--gbx-dt-accent-soft);
114
+ border-top-color: var(--gbx-dt-accent);
173
115
  border-radius: 50%;
174
116
  animation: gbx-spin 0.8s linear infinite;
175
117
  }
@@ -204,10 +146,7 @@
204
146
  }
205
147
 
206
148
  .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 {
149
+ .gbx-menu-item:focus-visible {
211
150
  outline: 2px solid var(--gbx-dt-accent);
212
151
  outline-offset: 2px;
213
152
  }
@@ -249,316 +188,14 @@
249
188
  }
250
189
 
251
190
  /* ==================== 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
- }
191
+ /* 选项卡 / 分组 / 按钮 / 下拉的视觉由 gbofficeui 统一;这里只留 xlsx 专属微调。 */
386
192
 
387
193
  .rb-btn.sel {
388
194
  padding: 0 4px;
389
195
  }
390
196
 
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
197
  /* ==================== 公式栏 ==================== */
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
- }
198
+ /* 结构由 FormulaBar 生成,视觉由 gbofficeui 统一;此处无本地覆盖。 */
562
199
 
563
200
  /* ==================== 网格 ==================== */
564
201
 
@@ -943,66 +580,10 @@
943
580
  }
944
581
 
945
582
  /* ==================== 状态栏 ==================== */
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
- }
583
+ /* 视觉由 gbofficeui 统一;.sb-calc 的数字排版也在共享皮肤内。 */
969
584
 
970
585
  /* ==================== 工作表页签 ==================== */
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
- }
586
+ /* 页签外观由 gbofficeui 统一;xlsx 只保留「工作表颜色」这条专属装饰。 */
1006
587
 
1007
588
  .sheet-tab.has-color::after {
1008
589
  content: '';
@@ -1015,11 +596,6 @@
1015
596
  background: var(--gbx-tab-color);
1016
597
  }
1017
598
 
1018
- .sheet-tab-add {
1019
- padding: 0 8px;
1020
- font-size: 13px;
1021
- }
1022
-
1023
599
  /* ==================== 菜单浮层 ==================== */
1024
600
 
1025
601
  .gbx-menu {
@@ -1599,7 +1175,7 @@
1599
1175
  display: block;
1600
1176
  padding: 6px 8px;
1601
1177
  border-radius: 6px;
1602
- background: var(--gbx-dt-bg-2);
1178
+ background: var(--gbx-dt-bg);
1603
1179
  color: var(--gbx-dt-text-secondary);
1604
1180
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
1605
1181
  font-size: 11px;
@@ -1839,7 +1415,7 @@
1839
1415
  padding: 0 8px;
1840
1416
  border: 1px solid var(--gbx-dt-border-strong);
1841
1417
  border-radius: var(--gbx-dt-radius-sm);
1842
- background: var(--gbx-dt-bg-2);
1418
+ background: var(--gbx-dt-bg);
1843
1419
  color: var(--gbx-dt-text);
1844
1420
  font: inherit;
1845
1421
  outline: none;
@@ -2028,7 +1604,7 @@
2028
1604
  padding: 0 8px;
2029
1605
  border: 1px solid var(--gbx-dt-border-strong);
2030
1606
  border-radius: var(--gbx-dt-radius-sm);
2031
- background: var(--gbx-dt-bg-2);
1607
+ background: var(--gbx-dt-bg);
2032
1608
  color: var(--gbx-dt-text);
2033
1609
  font: inherit;
2034
1610
  outline: none;
@@ -2117,7 +1693,7 @@
2117
1693
  padding: 0 6px;
2118
1694
  border: 1px solid var(--gbx-dt-border-strong);
2119
1695
  border-radius: var(--gbx-dt-radius-sm);
2120
- background: var(--gbx-dt-bg-2);
1696
+ background: var(--gbx-dt-bg);
2121
1697
  color: var(--gbx-dt-text);
2122
1698
  font: inherit;
2123
1699
  outline: none;
@@ -2194,7 +1770,7 @@
2194
1770
  height: 26px;
2195
1771
  border: 1px solid var(--gbx-dt-border-strong);
2196
1772
  border-radius: var(--gbx-dt-radius-sm);
2197
- background: var(--gbx-dt-bg-2);
1773
+ background: var(--gbx-dt-bg);
2198
1774
  color: var(--gbx-dt-text);
2199
1775
  font: inherit;
2200
1776
  }
@@ -2284,7 +1860,7 @@
2284
1860
  padding: 8px;
2285
1861
  border: 1px solid var(--gbx-dt-border);
2286
1862
  border-radius: var(--gbx-dt-radius-sm);
2287
- background: var(--gbx-dt-bg-2);
1863
+ background: var(--gbx-dt-bg);
2288
1864
  }
2289
1865
 
2290
1866
  .gbx-thread.gbx-is-done {
@@ -2372,7 +1948,7 @@
2372
1948
  padding: 6px 8px;
2373
1949
  border: 1px solid var(--gbx-dt-border-strong);
2374
1950
  border-radius: var(--gbx-dt-radius-sm);
2375
- background: var(--gbx-dt-bg-2);
1951
+ background: var(--gbx-dt-bg);
2376
1952
  color: var(--gbx-dt-text);
2377
1953
  font: inherit;
2378
1954
  outline: none;
@@ -2543,7 +2119,7 @@
2543
2119
  justify-content: center;
2544
2120
  color: #777;
2545
2121
  font-size: 9px;
2546
- background: #f1f2f4;
2122
+ background: #fff;
2547
2123
  overflow: hidden;
2548
2124
  }
2549
2125
 
@@ -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);