@cool-office/boards-history-ui 1.2.1 → 1.2.2
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 +7 -4
- package/lib/es/index.js +8 -5
- package/lib/types/src/index.d.ts +2 -2
- package/lib/types/src/plugin.d.ts +1 -1
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var import_boards_history2 = require("@cool-office/boards-history");
|
|
|
31
31
|
var import_core2 = require("@cool-office/core");
|
|
32
32
|
var import_protocol = require("@cool-office/protocol");
|
|
33
33
|
var import_rxjs = require("rxjs");
|
|
34
|
+
var import_restore_button = require("@cool-office/edit-history/restore-button");
|
|
34
35
|
var import_core3 = require("@cool-office/core");
|
|
35
36
|
var import_design = require("@cool-office/design");
|
|
36
37
|
var import_ui2 = require("@cool-office/ui");
|
|
@@ -426,7 +427,7 @@ function BoardHistoryEntry() {
|
|
|
426
427
|
}
|
|
427
428
|
function BoardRevisionHistoryPanel({ source }) {
|
|
428
429
|
const instances = (0, import_ui2.useDependency)(import_core3.IUniverInstanceService), permissions = (0, import_ui2.useDependency)(import_core3.IPermissionService), locale = (0, import_ui2.useDependency)(import_core3.LocaleService), service = (0, import_ui2.useDependency)(BoardHistoryUIService);
|
|
429
|
-
const unitId = (0,
|
|
430
|
+
const unitId = (0, import_restore_button.useHistoryUnitId)(import_core3.UniverInstanceType.UNIVER_BOARD), permissionChange = (0, import_ui2.useObservable)(permissions.permissionPointUpdate$), disposed = (0, import_ui2.useObservable)(instances.unitDisposed$);
|
|
430
431
|
(0, import_ui2.useObservable)(locale.currentLocale$, locale.getCurrentLocale());
|
|
431
432
|
const [open, setOpen] = (0, import_react.useState)(false), [revision, setRevision] = (0, import_react.useState)(0), [versions, setVersions] = (0, import_react.useState)([]), [selected, setSelected] = (0, import_react.useState)("");
|
|
432
433
|
const [nextLabel, setNextLabel] = (0, import_react.useState)(""), [hasMore, setHasMore] = (0, import_react.useState)(false), [loadingMore, setLoadingMore] = (0, import_react.useState)(false);
|
|
@@ -509,7 +510,7 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
509
510
|
}
|
|
510
511
|
});
|
|
511
512
|
};
|
|
512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "univer-fixed univer-bottom-4 univer-right-4 univer-z-50", children: !open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design.Button, { onClick: () => setOpen(true), children: t("\u7248\u672C\u5386\u53F2", "Version history") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "univer-flex univer-max-h-[85vh] univer-w-[32rem] univer-max-w-[92vw] univer-flex-col univer-gap-3 univer-overflow-auto univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-bg-gray-800", "aria-label": t("\u7248\u672C\u5386\u53F2", "Version history"), children: [
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "univer-fixed univer-bottom-4 univer-right-4 univer-z-50", children: !open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design.Button, { onClick: () => setOpen(true), children: t("\u7248\u672C\u5386\u53F2", "Version history") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { style: import_restore_button.revisionPanelStyle, className: "univer-flex univer-max-h-[85vh] univer-w-[32rem] univer-max-w-[92vw] univer-flex-col univer-gap-3 univer-overflow-auto univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-bg-gray-800", "aria-label": t("\u7248\u672C\u5386\u53F2", "Version history"), children: [
|
|
513
514
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "univer-flex univer-items-center univer-justify-between", children: [
|
|
514
515
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("\u7248\u672C\u5386\u53F2", "Version history") }),
|
|
515
516
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
@@ -521,6 +522,8 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
521
522
|
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { role: "alert", children: t("\u65E0\u6CD5\u52A0\u8F7D\u5386\u53F2\uFF0C\u8BF7\u68C0\u67E5\u6743\u9650\u6216\u7248\u672C\u670D\u52A1\u3002", "Unable to load history. Check permissions and the version service.") }),
|
|
522
523
|
status === "ready" && !versions.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { role: "status", children: t("\u6682\u65E0\u5386\u53F2\u7248\u672C\u3002", "No versions yet.") }),
|
|
523
524
|
!!versions.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design.FormLayout, { label: t("\u7248\u672C", "Version"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design.Select, { value: selected, "aria-label": t("\u7248\u672C", "Version"), options: versions.map((version) => ({ value: version.id, label: `${version.creatorName || version.id} \xB7 ${version.startRevision}\u2013${version.endRevision}` })), onChange: setSelected }) }),
|
|
525
|
+
status === "ready" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_restore_button.RevisionRestoreButton, { unitId, type: import_core3.UniverInstanceType.UNIVER_BOARD, revision: versions.find((item) => item.id === selected)?.endRevision, onRestored: () => setRevision((v) => v + 1) }),
|
|
526
|
+
" ",
|
|
524
527
|
hasMore && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design.Button, { disabled: loadingMore, onClick: loadMore, children: t("\u52A0\u8F7D\u66F4\u591A", "Load more") }),
|
|
525
528
|
unsupported && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { role: "status", children: t("\u90E8\u5206\u53D8\u66F4\u65E0\u6CD5\u663E\u793A\u3002", "Some changes cannot be displayed.") }),
|
|
526
529
|
status === "ready" && selected && !changes.length && !unsupported && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: t("\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u663E\u793A\u7684\u53D8\u66F4\u3002", "No changes to display.") }),
|
|
@@ -536,7 +539,7 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
536
539
|
var BoardHistoryUIController = class extends import_core.Disposable {
|
|
537
540
|
constructor(injector, parts) {
|
|
538
541
|
super();
|
|
539
|
-
this.disposeWithMe(parts.registerComponent(import_ui.BuiltInUIPart.
|
|
542
|
+
this.disposeWithMe(parts.registerComponent(import_ui.BuiltInUIPart.GLOBAL, () => (0, import_ui.connectInjector)(BoardHistoryEntry, injector)));
|
|
540
543
|
}
|
|
541
544
|
};
|
|
542
545
|
BoardHistoryUIController = __decorateClass([
|
|
@@ -561,7 +564,7 @@ var CoolBoardsHistoryUIPlugin = class extends import_core.Plugin {
|
|
|
561
564
|
CoolBoardsHistoryUIPlugin.pluginName = "COOL_BOARDS_HISTORY_UI_PLUGIN";
|
|
562
565
|
CoolBoardsHistoryUIPlugin.type = import_core.UniverInstanceType.UNIVER_BOARD;
|
|
563
566
|
CoolBoardsHistoryUIPlugin = __decorateClass([
|
|
564
|
-
(0, import_core.DependentOn)(import_boards_history.CoolBoardsHistoryPlugin,
|
|
567
|
+
(0, import_core.DependentOn)(import_boards_history.CoolBoardsHistoryPlugin, import_edit_history.CoolHistoryGatewayPlugin),
|
|
565
568
|
__decorateParam(1, (0, import_core.Inject)(import_core.Injector))
|
|
566
569
|
], CoolBoardsHistoryUIPlugin);
|
|
567
570
|
// Annotate the CommonJS export names for ESM import in node:
|
package/lib/es/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __decorateParam = (index, decorator) => (target, key) => decorator(target, k
|
|
|
13
13
|
// src/plugin.ts
|
|
14
14
|
import { CoolBoardsHistoryPlugin } from "@cool-office/boards-history";
|
|
15
15
|
import { DependentOn, Disposable as Disposable2, Inject as Inject2, Injector as Injector2, Plugin, UniverInstanceType as UniverInstanceType4 } from "@cool-office/core";
|
|
16
|
-
import { BuiltInUIPart, connectInjector, IUIPartsService
|
|
16
|
+
import { BuiltInUIPart, connectInjector, IUIPartsService } from "@cool-office/ui";
|
|
17
17
|
import { CoolHistoryGatewayPlugin, HistoryGatewayService } from "@cool-office/edit-history";
|
|
18
18
|
|
|
19
19
|
// src/service.ts
|
|
@@ -166,6 +166,7 @@ BoardHistoryUIService = __decorateClass([
|
|
|
166
166
|
], BoardHistoryUIService);
|
|
167
167
|
|
|
168
168
|
// src/revision-view.tsx
|
|
169
|
+
import { RevisionRestoreButton, revisionPanelStyle, useHistoryUnitId } from "@cool-office/edit-history/restore-button";
|
|
169
170
|
import { IPermissionService as IPermissionService3, IUniverInstanceService as IUniverInstanceService3, LocaleService as LocaleService2, UniverInstanceType as UniverInstanceType3 } from "@cool-office/core";
|
|
170
171
|
import { Button as Button2, FormLayout as FormLayout2, Select as Select2 } from "@cool-office/design";
|
|
171
172
|
import { useDependency as useDependency2, useObservable as useObservable2 } from "@cool-office/ui";
|
|
@@ -412,7 +413,7 @@ function BoardHistoryEntry() {
|
|
|
412
413
|
}
|
|
413
414
|
function BoardRevisionHistoryPanel({ source }) {
|
|
414
415
|
const instances = useDependency2(IUniverInstanceService3), permissions = useDependency2(IPermissionService3), locale = useDependency2(LocaleService2), service = useDependency2(BoardHistoryUIService);
|
|
415
|
-
const unitId =
|
|
416
|
+
const unitId = useHistoryUnitId(UniverInstanceType3.UNIVER_BOARD), permissionChange = useObservable2(permissions.permissionPointUpdate$), disposed = useObservable2(instances.unitDisposed$);
|
|
416
417
|
useObservable2(locale.currentLocale$, locale.getCurrentLocale());
|
|
417
418
|
const [open, setOpen] = useState2(false), [revision, setRevision] = useState2(0), [versions, setVersions] = useState2([]), [selected, setSelected] = useState2("");
|
|
418
419
|
const [nextLabel, setNextLabel] = useState2(""), [hasMore, setHasMore] = useState2(false), [loadingMore, setLoadingMore] = useState2(false);
|
|
@@ -495,7 +496,7 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
495
496
|
}
|
|
496
497
|
});
|
|
497
498
|
};
|
|
498
|
-
return /* @__PURE__ */ jsx2("div", { className: "univer-fixed univer-bottom-4 univer-right-4 univer-z-50", children: !open ? /* @__PURE__ */ jsx2(Button2, { onClick: () => setOpen(true), children: t("\u7248\u672C\u5386\u53F2", "Version history") }) : /* @__PURE__ */ jsxs2("section", { className: "univer-flex univer-max-h-[85vh] univer-w-[32rem] univer-max-w-[92vw] univer-flex-col univer-gap-3 univer-overflow-auto univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-bg-gray-800", "aria-label": t("\u7248\u672C\u5386\u53F2", "Version history"), children: [
|
|
499
|
+
return /* @__PURE__ */ jsx2("div", { className: "univer-fixed univer-bottom-4 univer-right-4 univer-z-50", children: !open ? /* @__PURE__ */ jsx2(Button2, { onClick: () => setOpen(true), children: t("\u7248\u672C\u5386\u53F2", "Version history") }) : /* @__PURE__ */ jsxs2("section", { style: revisionPanelStyle, className: "univer-flex univer-max-h-[85vh] univer-w-[32rem] univer-max-w-[92vw] univer-flex-col univer-gap-3 univer-overflow-auto univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-bg-gray-800", "aria-label": t("\u7248\u672C\u5386\u53F2", "Version history"), children: [
|
|
499
500
|
/* @__PURE__ */ jsxs2("div", { className: "univer-flex univer-items-center univer-justify-between", children: [
|
|
500
501
|
/* @__PURE__ */ jsx2("strong", { children: t("\u7248\u672C\u5386\u53F2", "Version history") }),
|
|
501
502
|
/* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -507,6 +508,8 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
507
508
|
status === "error" && /* @__PURE__ */ jsx2("div", { role: "alert", children: t("\u65E0\u6CD5\u52A0\u8F7D\u5386\u53F2\uFF0C\u8BF7\u68C0\u67E5\u6743\u9650\u6216\u7248\u672C\u670D\u52A1\u3002", "Unable to load history. Check permissions and the version service.") }),
|
|
508
509
|
status === "ready" && !versions.length && /* @__PURE__ */ jsx2("div", { role: "status", children: t("\u6682\u65E0\u5386\u53F2\u7248\u672C\u3002", "No versions yet.") }),
|
|
509
510
|
!!versions.length && /* @__PURE__ */ jsx2(FormLayout2, { label: t("\u7248\u672C", "Version"), children: /* @__PURE__ */ jsx2(Select2, { value: selected, "aria-label": t("\u7248\u672C", "Version"), options: versions.map((version) => ({ value: version.id, label: `${version.creatorName || version.id} \xB7 ${version.startRevision}\u2013${version.endRevision}` })), onChange: setSelected }) }),
|
|
511
|
+
status === "ready" && /* @__PURE__ */ jsx2(RevisionRestoreButton, { unitId, type: UniverInstanceType3.UNIVER_BOARD, revision: versions.find((item) => item.id === selected)?.endRevision, onRestored: () => setRevision((v) => v + 1) }),
|
|
512
|
+
" ",
|
|
510
513
|
hasMore && /* @__PURE__ */ jsx2(Button2, { disabled: loadingMore, onClick: loadMore, children: t("\u52A0\u8F7D\u66F4\u591A", "Load more") }),
|
|
511
514
|
unsupported && /* @__PURE__ */ jsx2("div", { role: "status", children: t("\u90E8\u5206\u53D8\u66F4\u65E0\u6CD5\u663E\u793A\u3002", "Some changes cannot be displayed.") }),
|
|
512
515
|
status === "ready" && selected && !changes.length && !unsupported && /* @__PURE__ */ jsx2("div", { children: t("\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u663E\u793A\u7684\u53D8\u66F4\u3002", "No changes to display.") }),
|
|
@@ -524,7 +527,7 @@ function BoardRevisionHistoryPanel({ source }) {
|
|
|
524
527
|
var BoardHistoryUIController = class extends Disposable2 {
|
|
525
528
|
constructor(injector, parts) {
|
|
526
529
|
super();
|
|
527
|
-
this.disposeWithMe(parts.registerComponent(BuiltInUIPart.
|
|
530
|
+
this.disposeWithMe(parts.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(BoardHistoryEntry, injector)));
|
|
528
531
|
}
|
|
529
532
|
};
|
|
530
533
|
BoardHistoryUIController = __decorateClass([
|
|
@@ -549,7 +552,7 @@ var CoolBoardsHistoryUIPlugin = class extends Plugin {
|
|
|
549
552
|
CoolBoardsHistoryUIPlugin.pluginName = "COOL_BOARDS_HISTORY_UI_PLUGIN";
|
|
550
553
|
CoolBoardsHistoryUIPlugin.type = UniverInstanceType4.UNIVER_BOARD;
|
|
551
554
|
CoolBoardsHistoryUIPlugin = __decorateClass([
|
|
552
|
-
DependentOn(CoolBoardsHistoryPlugin,
|
|
555
|
+
DependentOn(CoolBoardsHistoryPlugin, CoolHistoryGatewayPlugin),
|
|
553
556
|
__decorateParam(1, Inject2(Injector2))
|
|
554
557
|
], CoolBoardsHistoryUIPlugin);
|
|
555
558
|
export {
|
package/lib/types/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './plugin';
|
|
2
|
-
export * from './service';
|
|
1
|
+
export * from './plugin.js';
|
|
2
|
+
export * from './service.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IBoardHistorySource, IBoardRevisionHistorySource } from './service';
|
|
1
|
+
import type { IBoardHistorySource, IBoardRevisionHistorySource } from './service.js';
|
|
2
2
|
import { Injector, Plugin, UniverInstanceType } from '@cool-office/core';
|
|
3
3
|
export interface ICoolBoardsHistoryUIConfig {
|
|
4
4
|
source?: IBoardHistorySource | null;
|
package/package.json
CHANGED
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@cool-office/boards": "1.2.
|
|
20
|
-
"@cool-office/boards-history": "1.2.
|
|
19
|
+
"@cool-office/boards": "1.2.2",
|
|
20
|
+
"@cool-office/boards-history": "1.2.2",
|
|
21
21
|
"@cool-office/core": "1.2.0",
|
|
22
22
|
"@cool-office/design": "1.2.0",
|
|
23
|
-
"@cool-office/edit-history": "1.2.
|
|
23
|
+
"@cool-office/edit-history": "1.2.2",
|
|
24
24
|
"@cool-office/protocol": "1.2.0",
|
|
25
25
|
"@cool-office/ui": "1.2.0",
|
|
26
26
|
"react": "19.3.0",
|
|
27
27
|
"rxjs": "7.8.2"
|
|
28
28
|
},
|
|
29
|
-
"version": "1.2.
|
|
29
|
+
"version": "1.2.2",
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|
|
32
32
|
"registry": "https://registry.npmjs.org/"
|