@yudaocode/univer-sheets-ui 1.6.215 → 1.6.216
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/lib/cjs/index.js +201 -54
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +198 -54
- package/lib/es/index.js.map +1 -1
- package/lib/types/index.d.ts +41 -8
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -32,7 +32,9 @@ __export(src_exports, {
|
|
|
32
32
|
FillSheetSampleDatasetOperation: () => FillSheetSampleDatasetOperation,
|
|
33
33
|
ISheetsUIFeatureService: () => ISheetsUIFeatureService,
|
|
34
34
|
ImportSheetFileOperation: () => ImportSheetFileOperation,
|
|
35
|
+
OpenSheetIoModalOperation: () => OpenSheetIoModalOperation,
|
|
35
36
|
OpenSheetModalOperation: () => OpenSheetModalOperation,
|
|
37
|
+
SHEETS_EXT_UI_PLUGIN_CONFIG_KEY: () => SHEETS_EXT_UI_PLUGIN_CONFIG_KEY,
|
|
36
38
|
SHEET_INSPECTOR_COMPONENT_KEY: () => SHEET_INSPECTOR_COMPONENT_KEY,
|
|
37
39
|
SHEET_INSPECTOR_SIDEBAR_ID: () => SHEET_INSPECTOR_SIDEBAR_ID,
|
|
38
40
|
SheetInspectorPanel: () => SheetInspectorPanel,
|
|
@@ -45,6 +47,7 @@ __export(src_exports, {
|
|
|
45
47
|
UNIVER_SHEETS_EXT_UI_PLUGIN_NAME: () => UNIVER_SHEETS_EXT_UI_PLUGIN_NAME,
|
|
46
48
|
UniverSheetsExtUIPlugin: () => UniverSheetsExtUIPlugin,
|
|
47
49
|
UpdateSheetsUIFeaturesOperation: () => UpdateSheetsUIFeaturesOperation,
|
|
50
|
+
defaultPluginConfig: () => defaultPluginConfig,
|
|
48
51
|
enUS: () => enUS,
|
|
49
52
|
openSheetInspectorSidebar: () => openSheetInspectorSidebar,
|
|
50
53
|
resolveSheetsUIFeatures: () => resolveSheetsUIFeatures,
|
|
@@ -53,6 +56,10 @@ __export(src_exports, {
|
|
|
53
56
|
});
|
|
54
57
|
module.exports = __toCommonJS(src_exports);
|
|
55
58
|
|
|
59
|
+
// src/controllers/config.schema.ts
|
|
60
|
+
var SHEETS_EXT_UI_PLUGIN_CONFIG_KEY = "yudao-sheets-ext-ui.config";
|
|
61
|
+
var defaultPluginConfig = {};
|
|
62
|
+
|
|
56
63
|
// src/controllers/sheets-ui.controller.ts
|
|
57
64
|
var import_core8 = require("@univerjs/core");
|
|
58
65
|
var import_ui8 = require("@univerjs/ui");
|
|
@@ -103,6 +110,7 @@ var import_univer_sheets = require("@yudaocode/univer-sheets");
|
|
|
103
110
|
// src/services/sheets-ui-feature.service.ts
|
|
104
111
|
var import_core = require("@univerjs/core");
|
|
105
112
|
var import_rxjs = require("rxjs");
|
|
113
|
+
var VALID_MODAL_TABS = ["import", "export", "print", "json"];
|
|
106
114
|
function resolveSheetsUIFeatures(raw) {
|
|
107
115
|
const datasetBinding = Boolean(raw?.datasetBinding);
|
|
108
116
|
const printTemplate = Boolean(raw?.printTemplate);
|
|
@@ -125,26 +133,67 @@ function resolveSheetsUIFeatures(raw) {
|
|
|
125
133
|
builtinPreviewModal: raw?.builtinPreviewModal ?? true
|
|
126
134
|
};
|
|
127
135
|
}
|
|
136
|
+
function normalizeAllowedTabs(tabs) {
|
|
137
|
+
if (!Array.isArray(tabs) || tabs.length === 0) return void 0;
|
|
138
|
+
const deduped = [];
|
|
139
|
+
for (const t of tabs) {
|
|
140
|
+
if (VALID_MODAL_TABS.includes(t) && !deduped.includes(t)) {
|
|
141
|
+
deduped.push(t);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return deduped.length > 0 ? deduped : void 0;
|
|
145
|
+
}
|
|
128
146
|
var ISheetsUIFeatureService = (0, import_core.createIdentifier)(
|
|
129
147
|
"yudao.univer-sheets-ui.feature.service"
|
|
130
148
|
);
|
|
131
149
|
var SheetsUIFeatureService = class extends import_core.Disposable {
|
|
132
|
-
constructor(initial) {
|
|
150
|
+
constructor(initial, initialIoModal) {
|
|
133
151
|
super();
|
|
134
152
|
this._modalOpen$ = new import_rxjs.BehaviorSubject(false);
|
|
135
|
-
this.
|
|
153
|
+
this._invocationOverride = null;
|
|
136
154
|
this.modalOpen$ = this._modalOpen$.asObservable();
|
|
137
|
-
this.modalTab$ = this._modalTab$.asObservable();
|
|
138
155
|
this._features$ = new import_rxjs.BehaviorSubject(resolveSheetsUIFeatures(initial));
|
|
139
156
|
this.features$ = this._features$.asObservable();
|
|
157
|
+
const normalizedBase = {
|
|
158
|
+
...initialIoModal ?? {},
|
|
159
|
+
...normalizeAllowedTabs(initialIoModal?.tabs) ? { tabs: normalizeAllowedTabs(initialIoModal?.tabs) } : {}
|
|
160
|
+
};
|
|
161
|
+
this._baseIoModalConfig = normalizedBase;
|
|
162
|
+
const initDefaultTab = this._clampTabToAllowed(
|
|
163
|
+
normalizedBase.defaultTab ?? "export",
|
|
164
|
+
normalizedBase.tabs
|
|
165
|
+
);
|
|
166
|
+
this._modalTab$ = new import_rxjs.BehaviorSubject(initDefaultTab);
|
|
167
|
+
this.modalTab$ = this._modalTab$.asObservable();
|
|
168
|
+
this._ioModalConfig$ = new import_rxjs.BehaviorSubject(normalizedBase);
|
|
169
|
+
this.ioModalConfig$ = this._ioModalConfig$.asObservable();
|
|
140
170
|
this.disposeWithMe({
|
|
141
171
|
dispose: () => {
|
|
142
172
|
this._features$.complete();
|
|
143
173
|
this._modalOpen$.complete();
|
|
144
174
|
this._modalTab$.complete();
|
|
175
|
+
this._ioModalConfig$.complete();
|
|
145
176
|
}
|
|
146
177
|
});
|
|
147
178
|
}
|
|
179
|
+
_clampTabToAllowed(requested, allowedTabs) {
|
|
180
|
+
const validReq = VALID_MODAL_TABS.includes(requested) ? requested : "export";
|
|
181
|
+
if (Array.isArray(allowedTabs) && allowedTabs.length > 0 && !allowedTabs.includes(validReq)) {
|
|
182
|
+
return allowedTabs[0];
|
|
183
|
+
}
|
|
184
|
+
return validReq;
|
|
185
|
+
}
|
|
186
|
+
_computeEffectiveIoModalConfig() {
|
|
187
|
+
const ov = this._invocationOverride;
|
|
188
|
+
if (!ov) return { ...this._baseIoModalConfig };
|
|
189
|
+
const overrideTabs = normalizeAllowedTabs(ov.tabs);
|
|
190
|
+
return {
|
|
191
|
+
...this._baseIoModalConfig,
|
|
192
|
+
...overrideTabs ? { tabs: overrideTabs } : {},
|
|
193
|
+
...ov.defaultTab !== void 0 ? { defaultTab: ov.defaultTab } : {},
|
|
194
|
+
...ov.showPipelineBadge !== void 0 ? { showPipelineBadge: ov.showPipelineBadge } : {}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
148
197
|
getFeatures() {
|
|
149
198
|
return this._features$.getValue();
|
|
150
199
|
}
|
|
@@ -157,21 +206,58 @@ var SheetsUIFeatureService = class extends import_core.Disposable {
|
|
|
157
206
|
...patch
|
|
158
207
|
});
|
|
159
208
|
}
|
|
209
|
+
getIoModalConfig() {
|
|
210
|
+
return this._computeEffectiveIoModalConfig();
|
|
211
|
+
}
|
|
212
|
+
setIoModalConfig(config) {
|
|
213
|
+
this._baseIoModalConfig = {
|
|
214
|
+
...config,
|
|
215
|
+
...normalizeAllowedTabs(config.tabs) ? { tabs: normalizeAllowedTabs(config.tabs) } : {}
|
|
216
|
+
};
|
|
217
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
218
|
+
this._ioModalConfig$.next(eff);
|
|
219
|
+
const clamped = this._clampTabToAllowed(this._modalTab$.getValue(), eff.tabs);
|
|
220
|
+
if (clamped !== this._modalTab$.getValue()) {
|
|
221
|
+
this._modalTab$.next(clamped);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
160
224
|
isModalOpen() {
|
|
161
225
|
return this._modalOpen$.getValue();
|
|
162
226
|
}
|
|
163
227
|
getModalTab() {
|
|
164
228
|
return this._modalTab$.getValue();
|
|
165
229
|
}
|
|
166
|
-
openModal(
|
|
167
|
-
|
|
230
|
+
openModal(tabOrOptions) {
|
|
231
|
+
if (typeof tabOrOptions === "string") {
|
|
232
|
+
this._invocationOverride = null;
|
|
233
|
+
const eff2 = this._computeEffectiveIoModalConfig();
|
|
234
|
+
this._ioModalConfig$.next(eff2);
|
|
235
|
+
this._modalTab$.next(this._clampTabToAllowed(tabOrOptions, eff2.tabs));
|
|
236
|
+
this._modalOpen$.next(true);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const opts = tabOrOptions ?? {};
|
|
240
|
+
const overrideTabs = normalizeAllowedTabs(opts.tabs);
|
|
241
|
+
this._invocationOverride = overrideTabs !== void 0 || opts.showPipelineBadge !== void 0 ? {
|
|
242
|
+
...overrideTabs !== void 0 ? { tabs: overrideTabs } : {},
|
|
243
|
+
...opts.showPipelineBadge !== void 0 ? { showPipelineBadge: opts.showPipelineBadge } : {}
|
|
244
|
+
} : null;
|
|
245
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
246
|
+
this._ioModalConfig$.next(eff);
|
|
247
|
+
const requestedTab = opts.initialTab ?? opts.tab ?? eff.defaultTab ?? "export";
|
|
248
|
+
this._modalTab$.next(this._clampTabToAllowed(requestedTab, eff.tabs));
|
|
168
249
|
this._modalOpen$.next(true);
|
|
169
250
|
}
|
|
170
251
|
closeModal() {
|
|
171
252
|
this._modalOpen$.next(false);
|
|
253
|
+
if (this._invocationOverride !== null) {
|
|
254
|
+
this._invocationOverride = null;
|
|
255
|
+
this._ioModalConfig$.next(this._computeEffectiveIoModalConfig());
|
|
256
|
+
}
|
|
172
257
|
}
|
|
173
258
|
setModalTab(tab) {
|
|
174
|
-
this.
|
|
259
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
260
|
+
this._modalTab$.next(this._clampTabToAllowed(tab, eff.tabs));
|
|
175
261
|
}
|
|
176
262
|
};
|
|
177
263
|
|
|
@@ -199,13 +285,19 @@ var ToggleSheetInspectorOperation = {
|
|
|
199
285
|
return true;
|
|
200
286
|
}
|
|
201
287
|
};
|
|
288
|
+
function handleOpenModalOperation(accessor, params) {
|
|
289
|
+
accessor.get(ISheetsUIFeatureService).openModal(params);
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
202
292
|
var OpenSheetModalOperation = {
|
|
203
293
|
id: "yudao-sheets-ui.operation.open-modal",
|
|
204
294
|
type: import_core2.CommandType.OPERATION,
|
|
205
|
-
handler:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
295
|
+
handler: handleOpenModalOperation
|
|
296
|
+
};
|
|
297
|
+
var OpenSheetIoModalOperation = {
|
|
298
|
+
id: "yudao-sheets-ui.operation.open-io-modal",
|
|
299
|
+
type: import_core2.CommandType.OPERATION,
|
|
300
|
+
handler: handleOpenModalOperation
|
|
209
301
|
};
|
|
210
302
|
function mergeImportedTemplateMetadata(prevMeta, importedMeta) {
|
|
211
303
|
const next = { ...prevMeta, ...importedMeta };
|
|
@@ -233,8 +325,13 @@ var ImportSheetFileOperation = {
|
|
|
233
325
|
const unitId = workbook.getUnitId();
|
|
234
326
|
return ioService.importSheetWithReport(file, {
|
|
235
327
|
unitId,
|
|
236
|
-
target: params.target
|
|
328
|
+
target: params.target,
|
|
329
|
+
signal: params.signal
|
|
237
330
|
}).then((outcome) => {
|
|
331
|
+
if (params.signal?.aborted) {
|
|
332
|
+
const err = typeof DOMException !== "undefined" ? new DOMException("The operation was aborted.", "AbortError") : Object.assign(new Error("The operation was aborted."), { name: "AbortError" });
|
|
333
|
+
throw err;
|
|
334
|
+
}
|
|
238
335
|
const imported = outcome.snapshot ?? outcome.workbookData;
|
|
239
336
|
const prevMeta = templateService.getTemplateMetadata(unitId);
|
|
240
337
|
const xmlMeta = imported.__templateMetadata ?? {};
|
|
@@ -3986,9 +4083,23 @@ var SheetPreviewAndIoModal = () => {
|
|
|
3986
4083
|
const templateService = (0, import_ui5.useDependency)(import_univer_sheets4.ISheetTemplateService);
|
|
3987
4084
|
const featureService = (0, import_ui5.useDependency)(ISheetsUIFeatureService);
|
|
3988
4085
|
const open = (0, import_ui5.useObservable)(featureService.modalOpen$, featureService.isModalOpen());
|
|
3989
|
-
const
|
|
4086
|
+
const rawTab = (0, import_ui5.useObservable)(featureService.modalTab$, featureService.getModalTab());
|
|
3990
4087
|
const features = (0, import_ui5.useObservable)(featureService.features$, featureService.getFeatures());
|
|
4088
|
+
const ioModalCfg = (0, import_ui5.useObservable)(
|
|
4089
|
+
featureService.ioModalConfig$,
|
|
4090
|
+
featureService.getIoModalConfig()
|
|
4091
|
+
);
|
|
3991
4092
|
const ioAdapter = (0, import_ui5.useObservable)(ioService.adapter$, ioService.getAdapter());
|
|
4093
|
+
const visibleTabs = Array.isArray(ioModalCfg.tabs) && ioModalCfg.tabs.length > 0 ? ioModalCfg.tabs : [
|
|
4094
|
+
"import",
|
|
4095
|
+
"export",
|
|
4096
|
+
...features.printTemplate ? ["print"] : [],
|
|
4097
|
+
"json"
|
|
4098
|
+
];
|
|
4099
|
+
const tab = visibleTabs.includes(rawTab) ? rawTab : visibleTabs[0] ?? "export";
|
|
4100
|
+
const showPipelineBadge = ioModalCfg.showPipelineBadge !== false;
|
|
4101
|
+
const allowImportSection = visibleTabs.includes("import");
|
|
4102
|
+
const allowExportSection = visibleTabs.includes("export") || visibleTabs.includes("print");
|
|
3992
4103
|
const defaultIoTargetPref = (0, import_ui5.useObservable)(
|
|
3993
4104
|
ioService.defaultIoTarget$,
|
|
3994
4105
|
ioService.getDefaultIoTarget()
|
|
@@ -4024,6 +4135,15 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4024
4135
|
const userTouchedTargetRef = (0, import_react4.useRef)(false);
|
|
4025
4136
|
const prevOpenRef = (0, import_react4.useRef)(false);
|
|
4026
4137
|
const fileInputRef = (0, import_react4.useRef)(null);
|
|
4138
|
+
const importRequestIdRef = (0, import_react4.useRef)(0);
|
|
4139
|
+
const importAbortControllerRef = (0, import_react4.useRef)(null);
|
|
4140
|
+
const invalidateInFlightImport = () => {
|
|
4141
|
+
importRequestIdRef.current += 1;
|
|
4142
|
+
if (importAbortControllerRef.current) {
|
|
4143
|
+
importAbortControllerRef.current.abort();
|
|
4144
|
+
importAbortControllerRef.current = null;
|
|
4145
|
+
}
|
|
4146
|
+
};
|
|
4027
4147
|
const [printCfg, setPrintCfg] = (0, import_react4.useState)({
|
|
4028
4148
|
paperOrientation: "A4_LANDSCAPE",
|
|
4029
4149
|
scaleMode: "all",
|
|
@@ -4126,11 +4246,26 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4126
4246
|
});
|
|
4127
4247
|
return () => sub.unsubscribe();
|
|
4128
4248
|
}, [templateService, featureService, workbook]);
|
|
4249
|
+
(0, import_react4.useEffect)(() => {
|
|
4250
|
+
return () => {
|
|
4251
|
+
importRequestIdRef.current += 1;
|
|
4252
|
+
if (importAbortControllerRef.current) {
|
|
4253
|
+
importAbortControllerRef.current.abort();
|
|
4254
|
+
importAbortControllerRef.current = null;
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
4257
|
+
}, []);
|
|
4129
4258
|
(0, import_react4.useEffect)(() => {
|
|
4130
4259
|
const justOpened = open && !prevOpenRef.current;
|
|
4260
|
+
const justClosed = !open && prevOpenRef.current;
|
|
4131
4261
|
prevOpenRef.current = open;
|
|
4262
|
+
if (justClosed) {
|
|
4263
|
+
invalidateInFlightImport();
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4132
4266
|
if (!open || !workbook) return;
|
|
4133
4267
|
if (!justOpened) return;
|
|
4268
|
+
invalidateInFlightImport();
|
|
4134
4269
|
const snap = workbook.save();
|
|
4135
4270
|
const meta = templateService.getTemplateMetadata(workbook.getUnitId());
|
|
4136
4271
|
const initialData = meta.sampleData ?? {};
|
|
@@ -4349,6 +4484,12 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4349
4484
|
}
|
|
4350
4485
|
};
|
|
4351
4486
|
const runStagedImport = async (file, targetOverride) => {
|
|
4487
|
+
const requestId = ++importRequestIdRef.current;
|
|
4488
|
+
if (importAbortControllerRef.current) {
|
|
4489
|
+
importAbortControllerRef.current.abort();
|
|
4490
|
+
}
|
|
4491
|
+
const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
4492
|
+
importAbortControllerRef.current = controller;
|
|
4352
4493
|
const effectiveTarget = targetOverride ?? ioTarget;
|
|
4353
4494
|
setSelectedImportFile(file);
|
|
4354
4495
|
setLastIoAction({ kind: "import", file });
|
|
@@ -4358,8 +4499,12 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4358
4499
|
const unitId = workbook.getUnitId();
|
|
4359
4500
|
const outcome = await ioService.importSheetWithReport(file, {
|
|
4360
4501
|
unitId,
|
|
4361
|
-
target: effectiveTarget
|
|
4502
|
+
target: effectiveTarget,
|
|
4503
|
+
signal: controller?.signal
|
|
4362
4504
|
});
|
|
4505
|
+
if (requestId !== importRequestIdRef.current) {
|
|
4506
|
+
return;
|
|
4507
|
+
}
|
|
4363
4508
|
const snapshot = outcome.snapshot ?? outcome.workbookData;
|
|
4364
4509
|
setPendingImport({
|
|
4365
4510
|
snapshot,
|
|
@@ -4371,6 +4516,9 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4371
4516
|
`\u5DF2\u901A\u8FC7${outcome.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"}\u5B8C\u6210\u89E3\u6790\u300C${outcome.fileName || file.name}\u300D\uFF0C\u8BF7\u786E\u8BA4\u540E\u5E94\u7528\u5230\u8BBE\u8BA1\u5668`
|
|
4372
4517
|
);
|
|
4373
4518
|
} catch (err) {
|
|
4519
|
+
if (requestId !== importRequestIdRef.current || err?.name === "AbortError") {
|
|
4520
|
+
return;
|
|
4521
|
+
}
|
|
4374
4522
|
const exactMessage = err?.message || String(err);
|
|
4375
4523
|
setIoError(exactMessage);
|
|
4376
4524
|
setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${exactMessage}`);
|
|
@@ -4388,6 +4536,14 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4388
4536
|
if (!pendingImport) return;
|
|
4389
4537
|
const unitId = workbook.getUnitId();
|
|
4390
4538
|
const imported = pendingImport.snapshot;
|
|
4539
|
+
const sheetsMap = imported && typeof imported === "object" && imported.sheets && typeof imported.sheets === "object" ? imported.sheets : null;
|
|
4540
|
+
const validSheetIds = sheetsMap ? (Array.isArray(imported?.sheetOrder) && imported.sheetOrder.length > 0 ? imported.sheetOrder : Object.keys(sheetsMap)).filter((sid) => Boolean(sheetsMap[sid])) : [];
|
|
4541
|
+
if (!imported || !sheetsMap || validSheetIds.length === 0) {
|
|
4542
|
+
const errMsg = "\u5BFC\u5165\u5E94\u7528\u5931\u8D25\uFF1A\u6682\u5B58\u7684\u5DE5\u4F5C\u7C3F\u5FEB\u7167\u4E0D\u5305\u542B\u4EFB\u4F55\u6709\u6548\u5DE5\u4F5C\u8868\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u5DE5\u4F5C\u7C3F\u5185\u5BB9";
|
|
4543
|
+
setIoError(errMsg);
|
|
4544
|
+
setStatusTip(errMsg);
|
|
4545
|
+
return;
|
|
4546
|
+
}
|
|
4391
4547
|
const prevMeta = templateService.getTemplateMetadata(unitId);
|
|
4392
4548
|
const xmlMeta = imported.__templateMetadata ?? {};
|
|
4393
4549
|
const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
|
|
@@ -4398,11 +4554,17 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4398
4554
|
...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
|
|
4399
4555
|
...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
|
|
4400
4556
|
};
|
|
4401
|
-
commandService.syncExecuteCommand(import_univer_sheets4.ApplyImportedWorkbookDataCommand.id, {
|
|
4557
|
+
const applied = commandService.syncExecuteCommand(import_univer_sheets4.ApplyImportedWorkbookDataCommand.id, {
|
|
4402
4558
|
unitId,
|
|
4403
4559
|
workbookData: imported,
|
|
4404
4560
|
metadata: nextMeta
|
|
4405
4561
|
});
|
|
4562
|
+
if (!applied) {
|
|
4563
|
+
const errMsg = "\u5BFC\u5165\u5E94\u7528\u5931\u8D25\uFF1A\u65E0\u6CD5\u5199\u5165\u5F53\u524D\u5DE5\u4F5C\u7C3F\uFF08\u5FEB\u7167\u65E0\u6548\u6216\u53D7\u4FDD\u62A4\u9501\u5B9A\uFF09\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4";
|
|
4564
|
+
setIoError(errMsg);
|
|
4565
|
+
setStatusTip(errMsg);
|
|
4566
|
+
return;
|
|
4567
|
+
}
|
|
4406
4568
|
const effectivePrintCfg = nextMeta.printConfig ? { ...printCfg, ...nextMeta.printConfig } : printCfg;
|
|
4407
4569
|
if (nextMeta.printConfig) {
|
|
4408
4570
|
setPrintCfg(effectivePrintCfg);
|
|
@@ -4423,6 +4585,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4423
4585
|
setStatusTip("\u5DF2\u5E94\u7528\u5230\u5F53\u524D\u8BBE\u8BA1\u5668\uFF08\u672A\u843D\u5E93\uFF0C\u8BF7\u4F7F\u7528\u4FDD\u5B58\u64CD\u4F5C\u6301\u4E45\u5316\uFF09");
|
|
4424
4586
|
};
|
|
4425
4587
|
const handleCancelStagedImport = () => {
|
|
4588
|
+
invalidateInFlightImport();
|
|
4426
4589
|
setPendingImport(null);
|
|
4427
4590
|
setIoError(null);
|
|
4428
4591
|
setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4");
|
|
@@ -4506,6 +4669,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4506
4669
|
}
|
|
4507
4670
|
};
|
|
4508
4671
|
const handleCloseModal = () => {
|
|
4672
|
+
invalidateInFlightImport();
|
|
4509
4673
|
const unitId = workbook.getUnitId();
|
|
4510
4674
|
if (tab === "print" || templateService.isPrintDialogOpen(unitId)) {
|
|
4511
4675
|
templateService.closePrintDialog(unitId, true);
|
|
@@ -4537,48 +4701,25 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4537
4701
|
onClick: handleCloseModal,
|
|
4538
4702
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
|
|
4539
4703
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-header", children: [
|
|
4540
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
{
|
|
4544
|
-
type: "button",
|
|
4545
|
-
className: `yudao-sheet-modal-tab ${tab === "import" ? "is-active" : ""}`,
|
|
4546
|
-
onClick: () => featureService.setModalTab("import"),
|
|
4547
|
-
children: t("yudaoSheets.modal.tabImport")
|
|
4548
|
-
}
|
|
4549
|
-
),
|
|
4550
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-sheet-modal-tabs", "data-testid": "yudao-io-modal-tabs", children: visibleTabs.map((tMode) => {
|
|
4705
|
+
const labelKey = tMode === "import" ? "yudaoSheets.modal.tabImport" : tMode === "export" ? "yudaoSheets.modal.tabExport" : tMode === "print" ? "yudaoSheets.modal.tabPrint" : "yudaoSheets.modal.tabJson";
|
|
4706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4551
4707
|
"button",
|
|
4552
4708
|
{
|
|
4553
4709
|
type: "button",
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
type: "button",
|
|
4563
|
-
className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
|
|
4564
|
-
onClick: () => featureService.setModalTab("print"),
|
|
4565
|
-
children: t("yudaoSheets.modal.tabPrint")
|
|
4566
|
-
}
|
|
4567
|
-
),
|
|
4568
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4569
|
-
"button",
|
|
4570
|
-
{
|
|
4571
|
-
type: "button",
|
|
4572
|
-
className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
|
|
4573
|
-
onClick: () => featureService.setModalTab("json"),
|
|
4574
|
-
children: t("yudaoSheets.modal.tabJson")
|
|
4575
|
-
}
|
|
4576
|
-
)
|
|
4577
|
-
] }),
|
|
4710
|
+
"data-testid": `yudao-io-tab-${tMode}`,
|
|
4711
|
+
className: `yudao-sheet-modal-tab ${tab === tMode ? "is-active" : ""}`,
|
|
4712
|
+
onClick: () => featureService.setModalTab(tMode),
|
|
4713
|
+
children: t(labelKey)
|
|
4714
|
+
},
|
|
4715
|
+
tMode
|
|
4716
|
+
);
|
|
4717
|
+
}) }),
|
|
4578
4718
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
4579
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4719
|
+
showPipelineBadge && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4580
4720
|
"span",
|
|
4581
4721
|
{
|
|
4722
|
+
"data-testid": "yudao-io-pipeline-badge",
|
|
4582
4723
|
style: {
|
|
4583
4724
|
fontSize: 11,
|
|
4584
4725
|
padding: "3px 8px",
|
|
@@ -4599,6 +4740,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4599
4740
|
"button",
|
|
4600
4741
|
{
|
|
4601
4742
|
type: "button",
|
|
4743
|
+
"data-testid": "yudao-io-close-btn",
|
|
4602
4744
|
className: "yudao-sheet-btn",
|
|
4603
4745
|
onClick: handleCloseModal,
|
|
4604
4746
|
children: "\xD7"
|
|
@@ -5331,7 +5473,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5331
5473
|
]
|
|
5332
5474
|
}
|
|
5333
5475
|
),
|
|
5334
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
5476
|
+
allowImportSection && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
5335
5477
|
"div",
|
|
5336
5478
|
{
|
|
5337
5479
|
style: {
|
|
@@ -5444,7 +5586,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5444
5586
|
]
|
|
5445
5587
|
}
|
|
5446
5588
|
),
|
|
5447
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5589
|
+
allowExportSection && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5448
5590
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "112px 1fr", gap: 6 }, children: [
|
|
5449
5591
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
5450
5592
|
"select",
|
|
@@ -5514,10 +5656,11 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5514
5656
|
}
|
|
5515
5657
|
),
|
|
5516
5658
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
|
|
5517
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
5659
|
+
allowExportSection && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
5518
5660
|
"div",
|
|
5519
5661
|
{
|
|
5520
5662
|
className: "yudao-sheet-quick-export-bar",
|
|
5663
|
+
"data-testid": "yudao-io-quick-export-bar",
|
|
5521
5664
|
style: {
|
|
5522
5665
|
background: "#F9FAFB",
|
|
5523
5666
|
borderBottom: "1px solid #E3E5EA",
|
|
@@ -8166,6 +8309,7 @@ var SheetsExtUIController = class extends import_core8.Disposable {
|
|
|
8166
8309
|
const ops = [
|
|
8167
8310
|
ToggleSheetInspectorOperation,
|
|
8168
8311
|
OpenSheetModalOperation,
|
|
8312
|
+
OpenSheetIoModalOperation,
|
|
8169
8313
|
ImportSheetFileOperation,
|
|
8170
8314
|
FillSheetSampleDatasetOperation,
|
|
8171
8315
|
UpdateSheetsUIFeaturesOperation
|
|
@@ -8232,7 +8376,7 @@ var UniverSheetsExtUIPlugin = class extends import_core9.Plugin {
|
|
|
8232
8376
|
this._injector.add([
|
|
8233
8377
|
ISheetsUIFeatureService,
|
|
8234
8378
|
{
|
|
8235
|
-
useFactory: () => new SheetsUIFeatureService(this._config.features)
|
|
8379
|
+
useFactory: () => new SheetsUIFeatureService(this._config.features, this._config.ioModal)
|
|
8236
8380
|
}
|
|
8237
8381
|
]);
|
|
8238
8382
|
this._injector.add([
|
|
@@ -8259,7 +8403,9 @@ UniverSheetsExtUIPlugin = __decorateClass([
|
|
|
8259
8403
|
FillSheetSampleDatasetOperation,
|
|
8260
8404
|
ISheetsUIFeatureService,
|
|
8261
8405
|
ImportSheetFileOperation,
|
|
8406
|
+
OpenSheetIoModalOperation,
|
|
8262
8407
|
OpenSheetModalOperation,
|
|
8408
|
+
SHEETS_EXT_UI_PLUGIN_CONFIG_KEY,
|
|
8263
8409
|
SHEET_INSPECTOR_COMPONENT_KEY,
|
|
8264
8410
|
SHEET_INSPECTOR_SIDEBAR_ID,
|
|
8265
8411
|
SheetInspectorPanel,
|
|
@@ -8272,6 +8418,7 @@ UniverSheetsExtUIPlugin = __decorateClass([
|
|
|
8272
8418
|
UNIVER_SHEETS_EXT_UI_PLUGIN_NAME,
|
|
8273
8419
|
UniverSheetsExtUIPlugin,
|
|
8274
8420
|
UpdateSheetsUIFeaturesOperation,
|
|
8421
|
+
defaultPluginConfig,
|
|
8275
8422
|
enUS,
|
|
8276
8423
|
openSheetInspectorSidebar,
|
|
8277
8424
|
resolveSheetsUIFeatures,
|