@yudaocode/univer-sheets-ui 1.6.215 → 1.6.217
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/es/index.js
CHANGED
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
__decorateParam
|
|
12
12
|
} from "./chunk-BRKEJJFQ.js";
|
|
13
13
|
|
|
14
|
+
// src/controllers/config.schema.ts
|
|
15
|
+
var SHEETS_EXT_UI_PLUGIN_CONFIG_KEY = "yudao-sheets-ext-ui.config";
|
|
16
|
+
var defaultPluginConfig = {};
|
|
17
|
+
|
|
14
18
|
// src/controllers/sheets-ui.controller.ts
|
|
15
19
|
import { Disposable as Disposable2, ICommandService as ICommandService6, Inject, Injector } from "@univerjs/core";
|
|
16
20
|
import {
|
|
@@ -79,6 +83,7 @@ import {
|
|
|
79
83
|
// src/services/sheets-ui-feature.service.ts
|
|
80
84
|
import { createIdentifier, Disposable } from "@univerjs/core";
|
|
81
85
|
import { BehaviorSubject } from "rxjs";
|
|
86
|
+
var VALID_MODAL_TABS = ["import", "export", "print", "json"];
|
|
82
87
|
function resolveSheetsUIFeatures(raw) {
|
|
83
88
|
const datasetBinding = Boolean(raw?.datasetBinding);
|
|
84
89
|
const printTemplate = Boolean(raw?.printTemplate);
|
|
@@ -101,26 +106,67 @@ function resolveSheetsUIFeatures(raw) {
|
|
|
101
106
|
builtinPreviewModal: raw?.builtinPreviewModal ?? true
|
|
102
107
|
};
|
|
103
108
|
}
|
|
109
|
+
function normalizeAllowedTabs(tabs) {
|
|
110
|
+
if (!Array.isArray(tabs) || tabs.length === 0) return void 0;
|
|
111
|
+
const deduped = [];
|
|
112
|
+
for (const t of tabs) {
|
|
113
|
+
if (VALID_MODAL_TABS.includes(t) && !deduped.includes(t)) {
|
|
114
|
+
deduped.push(t);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return deduped.length > 0 ? deduped : void 0;
|
|
118
|
+
}
|
|
104
119
|
var ISheetsUIFeatureService = createIdentifier(
|
|
105
120
|
"yudao.univer-sheets-ui.feature.service"
|
|
106
121
|
);
|
|
107
122
|
var SheetsUIFeatureService = class extends Disposable {
|
|
108
|
-
constructor(initial) {
|
|
123
|
+
constructor(initial, initialIoModal) {
|
|
109
124
|
super();
|
|
110
125
|
this._modalOpen$ = new BehaviorSubject(false);
|
|
111
|
-
this.
|
|
126
|
+
this._invocationOverride = null;
|
|
112
127
|
this.modalOpen$ = this._modalOpen$.asObservable();
|
|
113
|
-
this.modalTab$ = this._modalTab$.asObservable();
|
|
114
128
|
this._features$ = new BehaviorSubject(resolveSheetsUIFeatures(initial));
|
|
115
129
|
this.features$ = this._features$.asObservable();
|
|
130
|
+
const normalizedBase = {
|
|
131
|
+
...initialIoModal ?? {},
|
|
132
|
+
...normalizeAllowedTabs(initialIoModal?.tabs) ? { tabs: normalizeAllowedTabs(initialIoModal?.tabs) } : {}
|
|
133
|
+
};
|
|
134
|
+
this._baseIoModalConfig = normalizedBase;
|
|
135
|
+
const initDefaultTab = this._clampTabToAllowed(
|
|
136
|
+
normalizedBase.defaultTab ?? "export",
|
|
137
|
+
normalizedBase.tabs
|
|
138
|
+
);
|
|
139
|
+
this._modalTab$ = new BehaviorSubject(initDefaultTab);
|
|
140
|
+
this.modalTab$ = this._modalTab$.asObservable();
|
|
141
|
+
this._ioModalConfig$ = new BehaviorSubject(normalizedBase);
|
|
142
|
+
this.ioModalConfig$ = this._ioModalConfig$.asObservable();
|
|
116
143
|
this.disposeWithMe({
|
|
117
144
|
dispose: () => {
|
|
118
145
|
this._features$.complete();
|
|
119
146
|
this._modalOpen$.complete();
|
|
120
147
|
this._modalTab$.complete();
|
|
148
|
+
this._ioModalConfig$.complete();
|
|
121
149
|
}
|
|
122
150
|
});
|
|
123
151
|
}
|
|
152
|
+
_clampTabToAllowed(requested, allowedTabs) {
|
|
153
|
+
const validReq = VALID_MODAL_TABS.includes(requested) ? requested : "export";
|
|
154
|
+
if (Array.isArray(allowedTabs) && allowedTabs.length > 0 && !allowedTabs.includes(validReq)) {
|
|
155
|
+
return allowedTabs[0];
|
|
156
|
+
}
|
|
157
|
+
return validReq;
|
|
158
|
+
}
|
|
159
|
+
_computeEffectiveIoModalConfig() {
|
|
160
|
+
const ov = this._invocationOverride;
|
|
161
|
+
if (!ov) return { ...this._baseIoModalConfig };
|
|
162
|
+
const overrideTabs = normalizeAllowedTabs(ov.tabs);
|
|
163
|
+
return {
|
|
164
|
+
...this._baseIoModalConfig,
|
|
165
|
+
...overrideTabs ? { tabs: overrideTabs } : {},
|
|
166
|
+
...ov.defaultTab !== void 0 ? { defaultTab: ov.defaultTab } : {},
|
|
167
|
+
...ov.showPipelineBadge !== void 0 ? { showPipelineBadge: ov.showPipelineBadge } : {}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
124
170
|
getFeatures() {
|
|
125
171
|
return this._features$.getValue();
|
|
126
172
|
}
|
|
@@ -133,21 +179,58 @@ var SheetsUIFeatureService = class extends Disposable {
|
|
|
133
179
|
...patch
|
|
134
180
|
});
|
|
135
181
|
}
|
|
182
|
+
getIoModalConfig() {
|
|
183
|
+
return this._computeEffectiveIoModalConfig();
|
|
184
|
+
}
|
|
185
|
+
setIoModalConfig(config) {
|
|
186
|
+
this._baseIoModalConfig = {
|
|
187
|
+
...config,
|
|
188
|
+
...normalizeAllowedTabs(config.tabs) ? { tabs: normalizeAllowedTabs(config.tabs) } : {}
|
|
189
|
+
};
|
|
190
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
191
|
+
this._ioModalConfig$.next(eff);
|
|
192
|
+
const clamped = this._clampTabToAllowed(this._modalTab$.getValue(), eff.tabs);
|
|
193
|
+
if (clamped !== this._modalTab$.getValue()) {
|
|
194
|
+
this._modalTab$.next(clamped);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
136
197
|
isModalOpen() {
|
|
137
198
|
return this._modalOpen$.getValue();
|
|
138
199
|
}
|
|
139
200
|
getModalTab() {
|
|
140
201
|
return this._modalTab$.getValue();
|
|
141
202
|
}
|
|
142
|
-
openModal(
|
|
143
|
-
|
|
203
|
+
openModal(tabOrOptions) {
|
|
204
|
+
if (typeof tabOrOptions === "string") {
|
|
205
|
+
this._invocationOverride = null;
|
|
206
|
+
const eff2 = this._computeEffectiveIoModalConfig();
|
|
207
|
+
this._ioModalConfig$.next(eff2);
|
|
208
|
+
this._modalTab$.next(this._clampTabToAllowed(tabOrOptions, eff2.tabs));
|
|
209
|
+
this._modalOpen$.next(true);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const opts = tabOrOptions ?? {};
|
|
213
|
+
const overrideTabs = normalizeAllowedTabs(opts.tabs);
|
|
214
|
+
this._invocationOverride = overrideTabs !== void 0 || opts.showPipelineBadge !== void 0 ? {
|
|
215
|
+
...overrideTabs !== void 0 ? { tabs: overrideTabs } : {},
|
|
216
|
+
...opts.showPipelineBadge !== void 0 ? { showPipelineBadge: opts.showPipelineBadge } : {}
|
|
217
|
+
} : null;
|
|
218
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
219
|
+
this._ioModalConfig$.next(eff);
|
|
220
|
+
const requestedTab = opts.initialTab ?? opts.tab ?? eff.defaultTab ?? "export";
|
|
221
|
+
this._modalTab$.next(this._clampTabToAllowed(requestedTab, eff.tabs));
|
|
144
222
|
this._modalOpen$.next(true);
|
|
145
223
|
}
|
|
146
224
|
closeModal() {
|
|
147
225
|
this._modalOpen$.next(false);
|
|
226
|
+
if (this._invocationOverride !== null) {
|
|
227
|
+
this._invocationOverride = null;
|
|
228
|
+
this._ioModalConfig$.next(this._computeEffectiveIoModalConfig());
|
|
229
|
+
}
|
|
148
230
|
}
|
|
149
231
|
setModalTab(tab) {
|
|
150
|
-
this.
|
|
232
|
+
const eff = this._computeEffectiveIoModalConfig();
|
|
233
|
+
this._modalTab$.next(this._clampTabToAllowed(tab, eff.tabs));
|
|
151
234
|
}
|
|
152
235
|
};
|
|
153
236
|
|
|
@@ -175,13 +258,19 @@ var ToggleSheetInspectorOperation = {
|
|
|
175
258
|
return true;
|
|
176
259
|
}
|
|
177
260
|
};
|
|
261
|
+
function handleOpenModalOperation(accessor, params) {
|
|
262
|
+
accessor.get(ISheetsUIFeatureService).openModal(params);
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
178
265
|
var OpenSheetModalOperation = {
|
|
179
266
|
id: "yudao-sheets-ui.operation.open-modal",
|
|
180
267
|
type: CommandType.OPERATION,
|
|
181
|
-
handler:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
268
|
+
handler: handleOpenModalOperation
|
|
269
|
+
};
|
|
270
|
+
var OpenSheetIoModalOperation = {
|
|
271
|
+
id: "yudao-sheets-ui.operation.open-io-modal",
|
|
272
|
+
type: CommandType.OPERATION,
|
|
273
|
+
handler: handleOpenModalOperation
|
|
185
274
|
};
|
|
186
275
|
function mergeImportedTemplateMetadata(prevMeta, importedMeta) {
|
|
187
276
|
const next = { ...prevMeta, ...importedMeta };
|
|
@@ -209,8 +298,13 @@ var ImportSheetFileOperation = {
|
|
|
209
298
|
const unitId = workbook.getUnitId();
|
|
210
299
|
return ioService.importSheetWithReport(file, {
|
|
211
300
|
unitId,
|
|
212
|
-
target: params.target
|
|
301
|
+
target: params.target,
|
|
302
|
+
signal: params.signal
|
|
213
303
|
}).then((outcome) => {
|
|
304
|
+
if (params.signal?.aborted) {
|
|
305
|
+
const err = typeof DOMException !== "undefined" ? new DOMException("The operation was aborted.", "AbortError") : Object.assign(new Error("The operation was aborted."), { name: "AbortError" });
|
|
306
|
+
throw err;
|
|
307
|
+
}
|
|
214
308
|
const imported = outcome.snapshot ?? outcome.workbookData;
|
|
215
309
|
const prevMeta = templateService.getTemplateMetadata(unitId);
|
|
216
310
|
const xmlMeta = imported.__templateMetadata ?? {};
|
|
@@ -3849,9 +3943,23 @@ var SheetPreviewAndIoModal = () => {
|
|
|
3849
3943
|
const templateService = useDependency4(ISheetTemplateService4);
|
|
3850
3944
|
const featureService = useDependency4(ISheetsUIFeatureService);
|
|
3851
3945
|
const open = useObservable4(featureService.modalOpen$, featureService.isModalOpen());
|
|
3852
|
-
const
|
|
3946
|
+
const rawTab = useObservable4(featureService.modalTab$, featureService.getModalTab());
|
|
3853
3947
|
const features = useObservable4(featureService.features$, featureService.getFeatures());
|
|
3948
|
+
const ioModalCfg = useObservable4(
|
|
3949
|
+
featureService.ioModalConfig$,
|
|
3950
|
+
featureService.getIoModalConfig()
|
|
3951
|
+
);
|
|
3854
3952
|
const ioAdapter = useObservable4(ioService.adapter$, ioService.getAdapter());
|
|
3953
|
+
const visibleTabs = Array.isArray(ioModalCfg.tabs) && ioModalCfg.tabs.length > 0 ? ioModalCfg.tabs : [
|
|
3954
|
+
"import",
|
|
3955
|
+
"export",
|
|
3956
|
+
...features.printTemplate ? ["print"] : [],
|
|
3957
|
+
"json"
|
|
3958
|
+
];
|
|
3959
|
+
const tab = visibleTabs.includes(rawTab) ? rawTab : visibleTabs[0] ?? "export";
|
|
3960
|
+
const showPipelineBadge = ioModalCfg.showPipelineBadge !== false;
|
|
3961
|
+
const allowImportSection = visibleTabs.includes("import");
|
|
3962
|
+
const allowExportSection = visibleTabs.includes("export") || visibleTabs.includes("print");
|
|
3855
3963
|
const defaultIoTargetPref = useObservable4(
|
|
3856
3964
|
ioService.defaultIoTarget$,
|
|
3857
3965
|
ioService.getDefaultIoTarget()
|
|
@@ -3887,6 +3995,15 @@ var SheetPreviewAndIoModal = () => {
|
|
|
3887
3995
|
const userTouchedTargetRef = useRef(false);
|
|
3888
3996
|
const prevOpenRef = useRef(false);
|
|
3889
3997
|
const fileInputRef = useRef(null);
|
|
3998
|
+
const importRequestIdRef = useRef(0);
|
|
3999
|
+
const importAbortControllerRef = useRef(null);
|
|
4000
|
+
const invalidateInFlightImport = () => {
|
|
4001
|
+
importRequestIdRef.current += 1;
|
|
4002
|
+
if (importAbortControllerRef.current) {
|
|
4003
|
+
importAbortControllerRef.current.abort();
|
|
4004
|
+
importAbortControllerRef.current = null;
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
3890
4007
|
const [printCfg, setPrintCfg] = useState3({
|
|
3891
4008
|
paperOrientation: "A4_LANDSCAPE",
|
|
3892
4009
|
scaleMode: "all",
|
|
@@ -3989,11 +4106,26 @@ var SheetPreviewAndIoModal = () => {
|
|
|
3989
4106
|
});
|
|
3990
4107
|
return () => sub.unsubscribe();
|
|
3991
4108
|
}, [templateService, featureService, workbook]);
|
|
4109
|
+
useEffect3(() => {
|
|
4110
|
+
return () => {
|
|
4111
|
+
importRequestIdRef.current += 1;
|
|
4112
|
+
if (importAbortControllerRef.current) {
|
|
4113
|
+
importAbortControllerRef.current.abort();
|
|
4114
|
+
importAbortControllerRef.current = null;
|
|
4115
|
+
}
|
|
4116
|
+
};
|
|
4117
|
+
}, []);
|
|
3992
4118
|
useEffect3(() => {
|
|
3993
4119
|
const justOpened = open && !prevOpenRef.current;
|
|
4120
|
+
const justClosed = !open && prevOpenRef.current;
|
|
3994
4121
|
prevOpenRef.current = open;
|
|
4122
|
+
if (justClosed) {
|
|
4123
|
+
invalidateInFlightImport();
|
|
4124
|
+
return;
|
|
4125
|
+
}
|
|
3995
4126
|
if (!open || !workbook) return;
|
|
3996
4127
|
if (!justOpened) return;
|
|
4128
|
+
invalidateInFlightImport();
|
|
3997
4129
|
const snap = workbook.save();
|
|
3998
4130
|
const meta = templateService.getTemplateMetadata(workbook.getUnitId());
|
|
3999
4131
|
const initialData = meta.sampleData ?? {};
|
|
@@ -4212,6 +4344,12 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4212
4344
|
}
|
|
4213
4345
|
};
|
|
4214
4346
|
const runStagedImport = async (file, targetOverride) => {
|
|
4347
|
+
const requestId = ++importRequestIdRef.current;
|
|
4348
|
+
if (importAbortControllerRef.current) {
|
|
4349
|
+
importAbortControllerRef.current.abort();
|
|
4350
|
+
}
|
|
4351
|
+
const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
4352
|
+
importAbortControllerRef.current = controller;
|
|
4215
4353
|
const effectiveTarget = targetOverride ?? ioTarget;
|
|
4216
4354
|
setSelectedImportFile(file);
|
|
4217
4355
|
setLastIoAction({ kind: "import", file });
|
|
@@ -4221,8 +4359,12 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4221
4359
|
const unitId = workbook.getUnitId();
|
|
4222
4360
|
const outcome = await ioService.importSheetWithReport(file, {
|
|
4223
4361
|
unitId,
|
|
4224
|
-
target: effectiveTarget
|
|
4362
|
+
target: effectiveTarget,
|
|
4363
|
+
signal: controller?.signal
|
|
4225
4364
|
});
|
|
4365
|
+
if (requestId !== importRequestIdRef.current) {
|
|
4366
|
+
return;
|
|
4367
|
+
}
|
|
4226
4368
|
const snapshot = outcome.snapshot ?? outcome.workbookData;
|
|
4227
4369
|
setPendingImport({
|
|
4228
4370
|
snapshot,
|
|
@@ -4234,6 +4376,9 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4234
4376
|
`\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`
|
|
4235
4377
|
);
|
|
4236
4378
|
} catch (err) {
|
|
4379
|
+
if (requestId !== importRequestIdRef.current || err?.name === "AbortError") {
|
|
4380
|
+
return;
|
|
4381
|
+
}
|
|
4237
4382
|
const exactMessage = err?.message || String(err);
|
|
4238
4383
|
setIoError(exactMessage);
|
|
4239
4384
|
setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${exactMessage}`);
|
|
@@ -4251,6 +4396,14 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4251
4396
|
if (!pendingImport) return;
|
|
4252
4397
|
const unitId = workbook.getUnitId();
|
|
4253
4398
|
const imported = pendingImport.snapshot;
|
|
4399
|
+
const sheetsMap = imported && typeof imported === "object" && imported.sheets && typeof imported.sheets === "object" ? imported.sheets : null;
|
|
4400
|
+
const validSheetIds = sheetsMap ? (Array.isArray(imported?.sheetOrder) && imported.sheetOrder.length > 0 ? imported.sheetOrder : Object.keys(sheetsMap)).filter((sid) => Boolean(sheetsMap[sid])) : [];
|
|
4401
|
+
if (!imported || !sheetsMap || validSheetIds.length === 0) {
|
|
4402
|
+
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";
|
|
4403
|
+
setIoError(errMsg);
|
|
4404
|
+
setStatusTip(errMsg);
|
|
4405
|
+
return;
|
|
4406
|
+
}
|
|
4254
4407
|
const prevMeta = templateService.getTemplateMetadata(unitId);
|
|
4255
4408
|
const xmlMeta = imported.__templateMetadata ?? {};
|
|
4256
4409
|
const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
|
|
@@ -4261,11 +4414,17 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4261
4414
|
...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
|
|
4262
4415
|
...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
|
|
4263
4416
|
};
|
|
4264
|
-
commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand3.id, {
|
|
4417
|
+
const applied = commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand3.id, {
|
|
4265
4418
|
unitId,
|
|
4266
4419
|
workbookData: imported,
|
|
4267
4420
|
metadata: nextMeta
|
|
4268
4421
|
});
|
|
4422
|
+
if (!applied) {
|
|
4423
|
+
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";
|
|
4424
|
+
setIoError(errMsg);
|
|
4425
|
+
setStatusTip(errMsg);
|
|
4426
|
+
return;
|
|
4427
|
+
}
|
|
4269
4428
|
const effectivePrintCfg = nextMeta.printConfig ? { ...printCfg, ...nextMeta.printConfig } : printCfg;
|
|
4270
4429
|
if (nextMeta.printConfig) {
|
|
4271
4430
|
setPrintCfg(effectivePrintCfg);
|
|
@@ -4286,6 +4445,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4286
4445
|
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");
|
|
4287
4446
|
};
|
|
4288
4447
|
const handleCancelStagedImport = () => {
|
|
4448
|
+
invalidateInFlightImport();
|
|
4289
4449
|
setPendingImport(null);
|
|
4290
4450
|
setIoError(null);
|
|
4291
4451
|
setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4");
|
|
@@ -4369,6 +4529,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4369
4529
|
}
|
|
4370
4530
|
};
|
|
4371
4531
|
const handleCloseModal = () => {
|
|
4532
|
+
invalidateInFlightImport();
|
|
4372
4533
|
const unitId = workbook.getUnitId();
|
|
4373
4534
|
if (tab === "print" || templateService.isPrintDialogOpen(unitId)) {
|
|
4374
4535
|
templateService.closePrintDialog(unitId, true);
|
|
@@ -4400,48 +4561,25 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4400
4561
|
onClick: handleCloseModal,
|
|
4401
4562
|
children: /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
|
|
4402
4563
|
/* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-header", children: [
|
|
4403
|
-
/* @__PURE__ */
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
{
|
|
4407
|
-
type: "button",
|
|
4408
|
-
className: `yudao-sheet-modal-tab ${tab === "import" ? "is-active" : ""}`,
|
|
4409
|
-
onClick: () => featureService.setModalTab("import"),
|
|
4410
|
-
children: t("yudaoSheets.modal.tabImport")
|
|
4411
|
-
}
|
|
4412
|
-
),
|
|
4413
|
-
/* @__PURE__ */ jsx4(
|
|
4564
|
+
/* @__PURE__ */ jsx4("div", { className: "yudao-sheet-modal-tabs", "data-testid": "yudao-io-modal-tabs", children: visibleTabs.map((tMode) => {
|
|
4565
|
+
const labelKey = tMode === "import" ? "yudaoSheets.modal.tabImport" : tMode === "export" ? "yudaoSheets.modal.tabExport" : tMode === "print" ? "yudaoSheets.modal.tabPrint" : "yudaoSheets.modal.tabJson";
|
|
4566
|
+
return /* @__PURE__ */ jsx4(
|
|
4414
4567
|
"button",
|
|
4415
4568
|
{
|
|
4416
4569
|
type: "button",
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
type: "button",
|
|
4426
|
-
className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
|
|
4427
|
-
onClick: () => featureService.setModalTab("print"),
|
|
4428
|
-
children: t("yudaoSheets.modal.tabPrint")
|
|
4429
|
-
}
|
|
4430
|
-
),
|
|
4431
|
-
/* @__PURE__ */ jsx4(
|
|
4432
|
-
"button",
|
|
4433
|
-
{
|
|
4434
|
-
type: "button",
|
|
4435
|
-
className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
|
|
4436
|
-
onClick: () => featureService.setModalTab("json"),
|
|
4437
|
-
children: t("yudaoSheets.modal.tabJson")
|
|
4438
|
-
}
|
|
4439
|
-
)
|
|
4440
|
-
] }),
|
|
4570
|
+
"data-testid": `yudao-io-tab-${tMode}`,
|
|
4571
|
+
className: `yudao-sheet-modal-tab ${tab === tMode ? "is-active" : ""}`,
|
|
4572
|
+
onClick: () => featureService.setModalTab(tMode),
|
|
4573
|
+
children: t(labelKey)
|
|
4574
|
+
},
|
|
4575
|
+
tMode
|
|
4576
|
+
);
|
|
4577
|
+
}) }),
|
|
4441
4578
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
4442
|
-
/* @__PURE__ */ jsxs4(
|
|
4579
|
+
showPipelineBadge && /* @__PURE__ */ jsxs4(
|
|
4443
4580
|
"span",
|
|
4444
4581
|
{
|
|
4582
|
+
"data-testid": "yudao-io-pipeline-badge",
|
|
4445
4583
|
style: {
|
|
4446
4584
|
fontSize: 11,
|
|
4447
4585
|
padding: "3px 8px",
|
|
@@ -4462,6 +4600,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
4462
4600
|
"button",
|
|
4463
4601
|
{
|
|
4464
4602
|
type: "button",
|
|
4603
|
+
"data-testid": "yudao-io-close-btn",
|
|
4465
4604
|
className: "yudao-sheet-btn",
|
|
4466
4605
|
onClick: handleCloseModal,
|
|
4467
4606
|
children: "\xD7"
|
|
@@ -5194,7 +5333,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5194
5333
|
]
|
|
5195
5334
|
}
|
|
5196
5335
|
),
|
|
5197
|
-
/* @__PURE__ */ jsxs4(
|
|
5336
|
+
allowImportSection && /* @__PURE__ */ jsxs4(
|
|
5198
5337
|
"div",
|
|
5199
5338
|
{
|
|
5200
5339
|
style: {
|
|
@@ -5307,7 +5446,7 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5307
5446
|
]
|
|
5308
5447
|
}
|
|
5309
5448
|
),
|
|
5310
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5449
|
+
allowExportSection && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5311
5450
|
/* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "112px 1fr", gap: 6 }, children: [
|
|
5312
5451
|
/* @__PURE__ */ jsxs4(
|
|
5313
5452
|
"select",
|
|
@@ -5377,10 +5516,11 @@ var SheetPreviewAndIoModal = () => {
|
|
|
5377
5516
|
}
|
|
5378
5517
|
),
|
|
5379
5518
|
/* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
|
|
5380
|
-
/* @__PURE__ */ jsxs4(
|
|
5519
|
+
allowExportSection && /* @__PURE__ */ jsxs4(
|
|
5381
5520
|
"div",
|
|
5382
5521
|
{
|
|
5383
5522
|
className: "yudao-sheet-quick-export-bar",
|
|
5523
|
+
"data-testid": "yudao-io-quick-export-bar",
|
|
5384
5524
|
style: {
|
|
5385
5525
|
background: "#F9FAFB",
|
|
5386
5526
|
borderBottom: "1px solid #E3E5EA",
|
|
@@ -8065,6 +8205,7 @@ var SheetsExtUIController = class extends Disposable2 {
|
|
|
8065
8205
|
const ops = [
|
|
8066
8206
|
ToggleSheetInspectorOperation,
|
|
8067
8207
|
OpenSheetModalOperation,
|
|
8208
|
+
OpenSheetIoModalOperation,
|
|
8068
8209
|
ImportSheetFileOperation,
|
|
8069
8210
|
FillSheetSampleDatasetOperation,
|
|
8070
8211
|
UpdateSheetsUIFeaturesOperation
|
|
@@ -8139,7 +8280,7 @@ var UniverSheetsExtUIPlugin = class extends Plugin {
|
|
|
8139
8280
|
this._injector.add([
|
|
8140
8281
|
ISheetsUIFeatureService,
|
|
8141
8282
|
{
|
|
8142
|
-
useFactory: () => new SheetsUIFeatureService(this._config.features)
|
|
8283
|
+
useFactory: () => new SheetsUIFeatureService(this._config.features, this._config.ioModal)
|
|
8143
8284
|
}
|
|
8144
8285
|
]);
|
|
8145
8286
|
this._injector.add([
|
|
@@ -8165,7 +8306,9 @@ export {
|
|
|
8165
8306
|
FillSheetSampleDatasetOperation,
|
|
8166
8307
|
ISheetsUIFeatureService,
|
|
8167
8308
|
ImportSheetFileOperation,
|
|
8309
|
+
OpenSheetIoModalOperation,
|
|
8168
8310
|
OpenSheetModalOperation,
|
|
8311
|
+
SHEETS_EXT_UI_PLUGIN_CONFIG_KEY,
|
|
8169
8312
|
SHEET_INSPECTOR_COMPONENT_KEY,
|
|
8170
8313
|
SHEET_INSPECTOR_SIDEBAR_ID,
|
|
8171
8314
|
SheetInspectorPanel,
|
|
@@ -8178,6 +8321,7 @@ export {
|
|
|
8178
8321
|
UNIVER_SHEETS_EXT_UI_PLUGIN_NAME,
|
|
8179
8322
|
UniverSheetsExtUIPlugin,
|
|
8180
8323
|
UpdateSheetsUIFeaturesOperation,
|
|
8324
|
+
defaultPluginConfig,
|
|
8181
8325
|
enUS,
|
|
8182
8326
|
openSheetInspectorSidebar,
|
|
8183
8327
|
resolveSheetsUIFeatures,
|