@ai-matrx/office 0.8.28 → 0.8.30
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/CHANGELOG.md +37 -1
- package/dist/docs.cjs +123 -116
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.cts +5 -0
- package/dist/docs.d.ts +5 -0
- package/dist/docs.js +104 -97
- package/dist/docs.js.map +1 -1
- package/dist/sheets-comment-anchors.cjs +13 -4
- package/dist/sheets-comment-anchors.cjs.map +1 -1
- package/dist/sheets-comment-anchors.js +13 -4
- package/dist/sheets-comment-anchors.js.map +1 -1
- package/dist/univer-collab.cjs +49 -5
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.d.cts +7 -0
- package/dist/univer-collab.d.ts +7 -0
- package/dist/univer-collab.js +49 -5
- package/dist/univer-collab.js.map +1 -1
- package/package.json +5 -5
package/dist/univer-collab.d.cts
CHANGED
|
@@ -796,6 +796,13 @@ interface UniverSheetsOtPortOptions {
|
|
|
796
796
|
get(): SheetSelection[] | null | undefined;
|
|
797
797
|
set(selections: SheetSelection[]): void;
|
|
798
798
|
};
|
|
799
|
+
/**
|
|
800
|
+
* The sheet's filter range (`SheetsFilterService.getFilterModel(unitId, subUnitId)?.getRange()`), or null. Univer's
|
|
801
|
+
* filter grows its own range when a value lands in the first row under it, with no mutation (SheetsFilterController,
|
|
802
|
+
* 1.0.4): the port sends that growth as a `set-filter-range`, and keeps a peer's value from growing it a second
|
|
803
|
+
* time on this seat. Without it a seat with a filter diverges from its peers on that write.
|
|
804
|
+
*/
|
|
805
|
+
filterRange?(unitId: string, subUnitId: string): SheetRange | null | undefined;
|
|
799
806
|
/** Replace the workbook's whole content, keeping its unit id. */
|
|
800
807
|
load(snapshot: unknown): void;
|
|
801
808
|
markDirty(): void;
|
package/dist/univer-collab.d.ts
CHANGED
|
@@ -796,6 +796,13 @@ interface UniverSheetsOtPortOptions {
|
|
|
796
796
|
get(): SheetSelection[] | null | undefined;
|
|
797
797
|
set(selections: SheetSelection[]): void;
|
|
798
798
|
};
|
|
799
|
+
/**
|
|
800
|
+
* The sheet's filter range (`SheetsFilterService.getFilterModel(unitId, subUnitId)?.getRange()`), or null. Univer's
|
|
801
|
+
* filter grows its own range when a value lands in the first row under it, with no mutation (SheetsFilterController,
|
|
802
|
+
* 1.0.4): the port sends that growth as a `set-filter-range`, and keeps a peer's value from growing it a second
|
|
803
|
+
* time on this seat. Without it a seat with a filter diverges from its peers on that write.
|
|
804
|
+
*/
|
|
805
|
+
filterRange?(unitId: string, subUnitId: string): SheetRange | null | undefined;
|
|
799
806
|
/** Replace the workbook's whole content, keeping its unit id. */
|
|
800
807
|
load(snapshot: unknown): void;
|
|
801
808
|
markDirty(): void;
|
package/dist/univer-collab.js
CHANGED
|
@@ -4045,6 +4045,7 @@ var ADD_MERGE = "sheet.mutation.add-worksheet-merge";
|
|
|
4045
4045
|
var REMOVE_MERGE = "sheet.mutation.remove-worksheet-merge";
|
|
4046
4046
|
var SHEET_NAME = "sheet.mutation.set-worksheet-name";
|
|
4047
4047
|
var INSERT_SHEET = "sheet.mutation.insert-sheet";
|
|
4048
|
+
var FILTER_RANGE = "sheet.mutation.set-filter-range";
|
|
4048
4049
|
var RESHAPE = /* @__PURE__ */ new Set(["sheet.mutation.set-worksheet-row-count", "sheet.mutation.set-worksheet-column-count", "sheet.mutation.remove-sheet", INSERT_SHEET]);
|
|
4049
4050
|
var UNDO = "univer.command.undo";
|
|
4050
4051
|
var REDO = "univer.command.redo";
|
|
@@ -4086,6 +4087,17 @@ function univerSheetsOtPort(o) {
|
|
|
4086
4087
|
return out;
|
|
4087
4088
|
};
|
|
4088
4089
|
const sheetOrder = () => (o.workbook()?.getSheets() ?? []).map((ws) => ws.getSheetId());
|
|
4090
|
+
const filterOf = (sheet) => {
|
|
4091
|
+
const u = unitId();
|
|
4092
|
+
if (!u || !o.filterRange) return null;
|
|
4093
|
+
try {
|
|
4094
|
+
const r = o.filterRange(u, sheet);
|
|
4095
|
+
return r ? { startRow: r.startRow, endRow: r.endRow, startColumn: r.startColumn, endColumn: r.endColumn } : null;
|
|
4096
|
+
} catch {
|
|
4097
|
+
return null;
|
|
4098
|
+
}
|
|
4099
|
+
};
|
|
4100
|
+
const sameRange = (a, b) => !a && !b || !!a && !!b && a.startRow === b.startRow && a.endRow === b.endRow && a.startColumn === b.startColumn && a.endColumn === b.endColumn;
|
|
4089
4101
|
const openGroup = (label2) => ({ label: label2, order: sheetOrder(), sheets: sheetNames(), names: definedNames(), mutations: [], inverses: [], notShared: null });
|
|
4090
4102
|
const emit = (e) => {
|
|
4091
4103
|
for (const l of [...listeners]) {
|
|
@@ -4135,6 +4147,7 @@ function univerSheetsOtPort(o) {
|
|
|
4135
4147
|
if (copy && "s" in copy) copy.s = styleObject(copy.s);
|
|
4136
4148
|
record.cells.set(`${r}:${c}`, copy);
|
|
4137
4149
|
}
|
|
4150
|
+
record.filter = filterOf(String(p.subUnitId ?? ""));
|
|
4138
4151
|
}
|
|
4139
4152
|
if (info.id === SHEET_NAME) record.name = ws.getName();
|
|
4140
4153
|
pre.set(p, record);
|
|
@@ -4288,6 +4301,15 @@ function univerSheetsOtPort(o) {
|
|
|
4288
4301
|
g.mutations.push(r.m);
|
|
4289
4302
|
g.inverses.push(r.inverse);
|
|
4290
4303
|
}
|
|
4304
|
+
const was = info.id === VALUES ? pre.get(info.params)?.filter : void 0;
|
|
4305
|
+
if (was && !g.notShared) {
|
|
4306
|
+
const sheet = String(info.params.subUnitId ?? "");
|
|
4307
|
+
const now = filterOf(sheet);
|
|
4308
|
+
if (now && !sameRange(was, now)) {
|
|
4309
|
+
g.mutations.push({ id: FILTER_RANGE, params: { subUnitId: sheet, range: json(now), derived: true } });
|
|
4310
|
+
g.inverses.push([{ id: FILTER_RANGE, params: { subUnitId: sheet, range: json(was) } }]);
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4291
4313
|
}
|
|
4292
4314
|
const owedAdd = pre.get(info.params)?.addAfter;
|
|
4293
4315
|
if (owedAdd?.length) runOwn(ADD_MERGE, String(info.params.subUnitId ?? ""), owedAdd, REMOVE_MERGE);
|
|
@@ -4309,6 +4331,27 @@ function univerSheetsOtPort(o) {
|
|
|
4309
4331
|
console.warn("[sheets-ot] could not keep this seat's selection inside the sheet after its own row or column change", err);
|
|
4310
4332
|
}
|
|
4311
4333
|
};
|
|
4334
|
+
const recalcDue = /* @__PURE__ */ new Set();
|
|
4335
|
+
let recalcQueued = false;
|
|
4336
|
+
const recalcFilterSoon = (sheet) => {
|
|
4337
|
+
recalcDue.add(sheet);
|
|
4338
|
+
if (recalcQueued) return;
|
|
4339
|
+
recalcQueued = true;
|
|
4340
|
+
queueMicrotask(() => {
|
|
4341
|
+
recalcQueued = false;
|
|
4342
|
+
const sheets = [...recalcDue];
|
|
4343
|
+
recalcDue.clear();
|
|
4344
|
+
const u = unitId();
|
|
4345
|
+
if (!u) return;
|
|
4346
|
+
for (const s of sheets) {
|
|
4347
|
+
if (o.filterRange && !filterOf(s)) continue;
|
|
4348
|
+
try {
|
|
4349
|
+
cs.syncExecuteCommand("sheet.mutation.re-calc-filter", { unitId: u, subUnitId: s }, { onlyLocal: true });
|
|
4350
|
+
} catch {
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
});
|
|
4354
|
+
};
|
|
4312
4355
|
const followSelection = (m) => {
|
|
4313
4356
|
const sel = o.selections;
|
|
4314
4357
|
if (!sel || !axisOpOf(m) && !RESHAPE.has(m.id)) return;
|
|
@@ -4343,14 +4386,15 @@ function univerSheetsOtPort(o) {
|
|
|
4343
4386
|
const a = forApply(m);
|
|
4344
4387
|
applying = true;
|
|
4345
4388
|
try {
|
|
4389
|
+
const sheet = String(a.params.subUnitId ?? "");
|
|
4390
|
+
const filterWas = a.id === VALUES ? filterOf(sheet) : null;
|
|
4346
4391
|
const ok3 = cs.syncExecuteCommand(a.id, { ...json(a.params), unitId: u }, { fromCollab: true });
|
|
4347
4392
|
if (ok3 === false) throw new Error(`"${m.id}" was refused by the editor`);
|
|
4348
|
-
if (
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
} catch {
|
|
4352
|
-
}
|
|
4393
|
+
if (filterWas) {
|
|
4394
|
+
const now = filterOf(sheet);
|
|
4395
|
+
if (now && !sameRange(filterWas, now)) cs.syncExecuteCommand(FILTER_RANGE, { unitId: u, subUnitId: sheet, range: filterWas }, { onlyLocal: true });
|
|
4353
4396
|
}
|
|
4397
|
+
if (a.id.startsWith("sheet.mutation.set-filter") || isStructuralMutation(a)) recalcFilterSoon(sheet);
|
|
4354
4398
|
} finally {
|
|
4355
4399
|
applying = false;
|
|
4356
4400
|
}
|