@univerjs/sheets-note 1.5.2 → 1.6.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 +1 -1
- package/lib/cjs/facade.js +45 -14
- package/lib/cjs/index.js +95 -31
- package/lib/cjs/locale/ar-SA.js +4 -0
- package/lib/cjs/locale/ca-ES.js +4 -0
- package/lib/cjs/locale/de-DE.js +4 -0
- package/lib/cjs/locale/en-US.js +19 -0
- package/lib/cjs/locale/es-ES.js +4 -0
- package/lib/cjs/locale/fa-IR.js +4 -0
- package/lib/cjs/locale/fr-FR.js +4 -0
- package/lib/cjs/locale/id-ID.js +4 -0
- package/lib/cjs/locale/it-IT.js +4 -0
- package/lib/cjs/locale/ja-JP.js +4 -0
- package/lib/cjs/locale/ko-KR.js +4 -0
- package/lib/cjs/locale/pl-PL.js +4 -0
- package/lib/cjs/locale/pt-BR.js +4 -0
- package/lib/cjs/locale/ru-RU.js +4 -0
- package/lib/cjs/locale/sk-SK.js +4 -0
- package/lib/cjs/locale/vi-VN.js +4 -0
- package/lib/cjs/locale/zh-CN.js +4 -0
- package/lib/cjs/locale/zh-HK.js +4 -0
- package/lib/cjs/locale/zh-TW.js +4 -0
- package/lib/es/facade.js +46 -15
- package/lib/es/index.js +97 -34
- package/lib/es/locale/ar-SA.js +4 -0
- package/lib/es/locale/ca-ES.js +4 -0
- package/lib/es/locale/de-DE.js +4 -0
- package/lib/es/locale/en-US.js +19 -0
- package/lib/es/locale/es-ES.js +4 -0
- package/lib/es/locale/fa-IR.js +4 -0
- package/lib/es/locale/fr-FR.js +4 -0
- package/lib/es/locale/id-ID.js +4 -0
- package/lib/es/locale/it-IT.js +4 -0
- package/lib/es/locale/ja-JP.js +4 -0
- package/lib/es/locale/ko-KR.js +4 -0
- package/lib/es/locale/pl-PL.js +4 -0
- package/lib/es/locale/pt-BR.js +4 -0
- package/lib/es/locale/ru-RU.js +4 -0
- package/lib/es/locale/sk-SK.js +4 -0
- package/lib/es/locale/vi-VN.js +4 -0
- package/lib/es/locale/zh-CN.js +4 -0
- package/lib/es/locale/zh-HK.js +4 -0
- package/lib/es/locale/zh-TW.js +4 -0
- package/lib/facade.js +46 -15
- package/lib/index.js +97 -34
- package/lib/locale/ar-SA.js +4 -0
- package/lib/locale/ca-ES.js +4 -0
- package/lib/locale/de-DE.js +4 -0
- package/lib/locale/en-US.js +19 -0
- package/lib/locale/es-ES.js +4 -0
- package/lib/locale/fa-IR.js +4 -0
- package/lib/locale/fr-FR.js +4 -0
- package/lib/locale/id-ID.js +4 -0
- package/lib/locale/it-IT.js +4 -0
- package/lib/locale/ja-JP.js +4 -0
- package/lib/locale/ko-KR.js +4 -0
- package/lib/locale/pl-PL.js +4 -0
- package/lib/locale/pt-BR.js +4 -0
- package/lib/locale/ru-RU.js +4 -0
- package/lib/locale/sk-SK.js +4 -0
- package/lib/locale/vi-VN.js +4 -0
- package/lib/locale/zh-CN.js +4 -0
- package/lib/locale/zh-HK.js +4 -0
- package/lib/locale/zh-TW.js +4 -0
- package/lib/types/commands/commands/note.command.d.ts +7 -1
- package/lib/types/const.d.ts +6 -0
- package/lib/types/controllers/sheets-note-permission.controller.d.ts +34 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +23 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/types.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/plugin.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +14 -9
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, UniverInstanceType, generateRandomId, merge, sequenceExecuteAsync, touchDependencies } from "@univerjs/core";
|
|
2
|
-
import { CopySheetCommand, RefRangeService, RemoveSheetCommand, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
|
|
1
|
+
import { CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, Plugin, UniverInstanceType, generateRandomId, merge, sequenceExecuteAsync, touchDependencies } from "@univerjs/core";
|
|
2
|
+
import { CopySheetCommand, RangeProtectionPermissionEditPoint, RefRangeService, RemoveSheetCommand, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, UniverSheetsPlugin, WorkbookEditablePermission, WorksheetEditPermission, getSheetCommandTarget, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
|
|
3
3
|
import { Subject, filter, map } from "rxjs";
|
|
4
4
|
|
|
5
|
-
// \0@oxc-project+runtime@0.
|
|
5
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/typeof.js
|
|
6
6
|
function _typeof(o) {
|
|
7
7
|
"@babel/helpers - typeof";
|
|
8
8
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -12,7 +12,7 @@ function _typeof(o) {
|
|
|
12
12
|
}, _typeof(o);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// \0@oxc-project+runtime@0.
|
|
15
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPrimitive.js
|
|
16
16
|
function toPrimitive(t, e) {
|
|
17
17
|
if ("object" != _typeof(t) || !t) return t;
|
|
18
18
|
var r;
|
|
@@ -24,13 +24,13 @@ function toPrimitive(t, e) {
|
|
|
24
24
|
return ("string" === e ? String : Number)(t);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// \0@oxc-project+runtime@0.
|
|
27
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPropertyKey.js
|
|
28
28
|
function toPropertyKey(t) {
|
|
29
29
|
var i = toPrimitive(t, "string");
|
|
30
30
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// \0@oxc-project+runtime@0.
|
|
33
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/defineProperty.js
|
|
34
34
|
function _defineProperty(e, r, t) {
|
|
35
35
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
36
36
|
value: t,
|
|
@@ -283,15 +283,30 @@ const UpdateNotePositionMutation = {
|
|
|
283
283
|
const SheetDeleteNoteCommand = {
|
|
284
284
|
id: "sheet.command.delete-note",
|
|
285
285
|
type: CommandType.COMMAND,
|
|
286
|
-
handler: (accessor) => {
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
handler: (accessor, params) => {
|
|
287
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
288
|
+
let unitId;
|
|
289
|
+
let subUnitId;
|
|
290
|
+
let actualRow;
|
|
291
|
+
let actualColumn;
|
|
292
|
+
if (params) {
|
|
293
|
+
const target = getSheetCommandTarget(univerInstanceService, {
|
|
294
|
+
unitId: params.unitId,
|
|
295
|
+
subUnitId: params.sheetId
|
|
296
|
+
});
|
|
297
|
+
if (!target) return false;
|
|
298
|
+
({unitId, subUnitId} = target);
|
|
299
|
+
actualRow = params.row;
|
|
300
|
+
actualColumn = params.col;
|
|
301
|
+
} else {
|
|
302
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
303
|
+
if (!target) return false;
|
|
304
|
+
const selection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
|
|
305
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return false;
|
|
306
|
+
({unitId, subUnitId} = target);
|
|
307
|
+
({actualColumn, actualRow} = selection.primary);
|
|
308
|
+
}
|
|
309
|
+
const note = accessor.get(SheetsNoteModel).getNote(unitId, subUnitId, {
|
|
295
310
|
row: actualRow,
|
|
296
311
|
col: actualColumn
|
|
297
312
|
});
|
|
@@ -376,7 +391,10 @@ const SheetUpdateNoteCommand = {
|
|
|
376
391
|
id: "sheet.command.update-note",
|
|
377
392
|
type: CommandType.COMMAND,
|
|
378
393
|
handler: (accessor, params) => {
|
|
379
|
-
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService),
|
|
394
|
+
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), {
|
|
395
|
+
unitId: params.unitId,
|
|
396
|
+
subUnitId: params.sheetId
|
|
397
|
+
});
|
|
380
398
|
if (!target) return false;
|
|
381
399
|
const commandService = accessor.get(ICommandService);
|
|
382
400
|
const undoRedoService = accessor.get(IUndoRedoService);
|
|
@@ -436,31 +454,27 @@ const SheetUpdateNoteCommand = {
|
|
|
436
454
|
};
|
|
437
455
|
|
|
438
456
|
// src/const.ts
|
|
457
|
+
const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
|
|
458
|
+
const SHEET_NOTE_TOGGLE_PERMISSIONS = {
|
|
459
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
460
|
+
worksheetTypes: [WorksheetEditPermission]
|
|
461
|
+
};
|
|
439
462
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
443
|
-
* you may not use this file except in compliance with the License.
|
|
444
|
-
* You may obtain a copy of the License at
|
|
445
|
-
*
|
|
446
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
447
|
-
*
|
|
448
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
449
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
450
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
451
|
-
* See the License for the specific language governing permissions and
|
|
452
|
-
* limitations under the License.
|
|
463
|
+
* Notes have no permission point of their own; they follow the cell edit points.
|
|
453
464
|
*/
|
|
454
|
-
const
|
|
465
|
+
const SHEET_NOTE_EDIT_PERMISSIONS = {
|
|
466
|
+
...SHEET_NOTE_TOGGLE_PERMISSIONS,
|
|
467
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
468
|
+
};
|
|
455
469
|
|
|
456
|
-
// \0@oxc-project+runtime@0.
|
|
470
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorateParam.js
|
|
457
471
|
function __decorateParam(paramIndex, decorator) {
|
|
458
472
|
return function(target, key) {
|
|
459
473
|
decorator(target, key, paramIndex);
|
|
460
474
|
};
|
|
461
475
|
}
|
|
462
476
|
|
|
463
|
-
// \0@oxc-project+runtime@0.
|
|
477
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorate.js
|
|
464
478
|
function __decorate(decorators, target, key, desc) {
|
|
465
479
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
466
480
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -626,7 +640,7 @@ SheetsNoteResourceController = __decorate([
|
|
|
626
640
|
|
|
627
641
|
// package.json
|
|
628
642
|
var name = "@univerjs/sheets-note";
|
|
629
|
-
var version = "1.
|
|
643
|
+
var version = "1.6.0";
|
|
630
644
|
|
|
631
645
|
// src/config/config.ts
|
|
632
646
|
/**
|
|
@@ -648,6 +662,53 @@ const SHEETS_NOTE_PLUGIN_CONFIG_KEY = "sheets-note.config";
|
|
|
648
662
|
const configSymbol = Symbol(SHEETS_NOTE_PLUGIN_CONFIG_KEY);
|
|
649
663
|
const defaultPluginConfig = {};
|
|
650
664
|
|
|
665
|
+
// src/controllers/sheets-note-permission.controller.ts
|
|
666
|
+
let SheetsNotePermissionController = class SheetsNotePermissionController extends Disposable {
|
|
667
|
+
constructor(_commandService, _sheetPermissionCheckController, _noteModel, _localeService) {
|
|
668
|
+
super();
|
|
669
|
+
this._commandService = _commandService;
|
|
670
|
+
this._sheetPermissionCheckController = _sheetPermissionCheckController;
|
|
671
|
+
this._noteModel = _noteModel;
|
|
672
|
+
this._localeService = _localeService;
|
|
673
|
+
this._initCommandListener();
|
|
674
|
+
}
|
|
675
|
+
_initCommandListener() {
|
|
676
|
+
this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
|
|
677
|
+
const { id } = command;
|
|
678
|
+
if (id === SheetUpdateNoteCommand.id) {
|
|
679
|
+
const params = command.params;
|
|
680
|
+
if (!params) return;
|
|
681
|
+
const { unitId, sheetId, row, col, note } = params;
|
|
682
|
+
const previous = this._noteModel.getNote(unitId, sheetId, { noteId: note.id });
|
|
683
|
+
const moving = previous && (previous.row !== row || previous.col !== col);
|
|
684
|
+
if (!this._checkCell(unitId, sheetId, row, col) || moving && !this._checkCell(unitId, sheetId, previous.row, previous.col)) this._blockExecute();
|
|
685
|
+
} else if (id === SheetDeleteNoteCommand.id) {
|
|
686
|
+
const params = command.params;
|
|
687
|
+
if (!(params ? this._checkCell(params.unitId, params.sheetId, params.row, params.col) : this._sheetPermissionCheckController.permissionCheckWithoutRange(SHEET_NOTE_EDIT_PERMISSIONS))) this._blockExecute();
|
|
688
|
+
} else if (id === SheetToggleNotePopupCommand.id) {
|
|
689
|
+
if (!this._sheetPermissionCheckController.permissionCheckWithoutRange(SHEET_NOTE_TOGGLE_PERMISSIONS)) this._blockExecute();
|
|
690
|
+
}
|
|
691
|
+
}));
|
|
692
|
+
}
|
|
693
|
+
_checkCell(unitId, sheetId, row, col) {
|
|
694
|
+
return this._sheetPermissionCheckController.permissionCheckWithRanges(SHEET_NOTE_EDIT_PERMISSIONS, [{
|
|
695
|
+
startRow: row,
|
|
696
|
+
startColumn: col,
|
|
697
|
+
endRow: row,
|
|
698
|
+
endColumn: col
|
|
699
|
+
}], unitId, sheetId);
|
|
700
|
+
}
|
|
701
|
+
_blockExecute() {
|
|
702
|
+
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-note.permission.editErr"));
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
SheetsNotePermissionController = __decorate([
|
|
706
|
+
__decorateParam(0, ICommandService),
|
|
707
|
+
__decorateParam(1, Inject(SheetPermissionCheckController)),
|
|
708
|
+
__decorateParam(2, Inject(SheetsNoteModel)),
|
|
709
|
+
__decorateParam(3, Inject(LocaleService))
|
|
710
|
+
], SheetsNotePermissionController);
|
|
711
|
+
|
|
651
712
|
// src/controllers/sheets-note-ref-range.controller.ts
|
|
652
713
|
let SheetsNoteRefRangeController = class SheetsNoteRefRangeController extends Disposable {
|
|
653
714
|
constructor(_refRangeService, _sheetsNoteModel, _selectionManagerService, _commandService) {
|
|
@@ -857,6 +918,7 @@ let UniverSheetsNotePlugin = class UniverSheetsNotePlugin extends Plugin {
|
|
|
857
918
|
[
|
|
858
919
|
[SheetsNoteModel],
|
|
859
920
|
[SheetsNoteController],
|
|
921
|
+
[SheetsNotePermissionController],
|
|
860
922
|
[SheetsNoteResourceController],
|
|
861
923
|
[SheetsNoteRefRangeController]
|
|
862
924
|
].forEach((dependency) => {
|
|
@@ -865,6 +927,7 @@ let UniverSheetsNotePlugin = class UniverSheetsNotePlugin extends Plugin {
|
|
|
865
927
|
touchDependencies(this._injector, [
|
|
866
928
|
[SheetsNoteModel],
|
|
867
929
|
[SheetsNoteController],
|
|
930
|
+
[SheetsNotePermissionController],
|
|
868
931
|
[SheetsNoteResourceController]
|
|
869
932
|
]);
|
|
870
933
|
}
|
|
@@ -882,4 +945,4 @@ UniverSheetsNotePlugin = __decorate([
|
|
|
882
945
|
__decorateParam(2, Inject(Injector))
|
|
883
946
|
], UniverSheetsNotePlugin);
|
|
884
947
|
|
|
885
|
-
export { RemoveNoteMutation, SheetDeleteNoteCommand, SheetToggleNotePopupCommand, SheetUpdateNoteCommand, SheetsNoteModel, SheetsNoteResourceController, ToggleNotePopupMutation, UniverSheetsNotePlugin, UpdateNoteMutation, UpdateNotePositionMutation };
|
|
948
|
+
export { RemoveNoteMutation, SHEET_NOTE_EDIT_PERMISSIONS, SheetDeleteNoteCommand, SheetToggleNotePopupCommand, SheetUpdateNoteCommand, SheetsNoteModel, SheetsNoteResourceController, ToggleNotePopupMutation, UniverSheetsNotePlugin, UpdateNoteMutation, UpdateNotePositionMutation };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/locale/en-US.ts
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
const locale = { "sheets-note": { permission: { editErr: "You do not have permission to edit notes." } } };
|
|
18
|
+
|
|
19
|
+
export { locale as default };
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { ICommand } from '@univerjs/core';
|
|
17
17
|
import type { IUpdateNoteMutationParams } from '../mutations/note.mutation';
|
|
18
|
-
export
|
|
18
|
+
export interface ISheetDeleteNoteCommandParams {
|
|
19
|
+
unitId: string;
|
|
20
|
+
sheetId: string;
|
|
21
|
+
row: number;
|
|
22
|
+
col: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const SheetDeleteNoteCommand: ICommand<ISheetDeleteNoteCommandParams>;
|
|
19
25
|
export declare const SheetToggleNotePopupCommand: ICommand;
|
|
20
26
|
export declare const SheetUpdateNoteCommand: ICommand<IUpdateNoteMutationParams>;
|
package/lib/types/const.d.ts
CHANGED
|
@@ -13,4 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { IPermissionTypes } from '@univerjs/core';
|
|
16
17
|
export declare const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
|
|
18
|
+
export declare const SHEET_NOTE_TOGGLE_PERMISSIONS: IPermissionTypes;
|
|
19
|
+
/**
|
|
20
|
+
* Notes have no permission point of their own; they follow the cell edit points.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SHEET_NOTE_EDIT_PERMISSIONS: IPermissionTypes;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Disposable, ICommandService, LocaleService } from '@univerjs/core';
|
|
17
|
+
import { SheetPermissionCheckController } from '@univerjs/sheets';
|
|
18
|
+
import { SheetsNoteModel } from '../models/sheets-note.model';
|
|
19
|
+
/**
|
|
20
|
+
* Blocks note writes without edit permission in the base package, so headless
|
|
21
|
+
* integrations and the UI share the same enforcement point. Mutations are not
|
|
22
|
+
* checked on purpose: collaboration replay, undo and reference updates run
|
|
23
|
+
* through mutations and must still be applied.
|
|
24
|
+
*/
|
|
25
|
+
export declare class SheetsNotePermissionController extends Disposable {
|
|
26
|
+
private readonly _commandService;
|
|
27
|
+
private readonly _sheetPermissionCheckController;
|
|
28
|
+
private readonly _noteModel;
|
|
29
|
+
private readonly _localeService;
|
|
30
|
+
constructor(_commandService: ICommandService, _sheetPermissionCheckController: SheetPermissionCheckController, _noteModel: SheetsNoteModel, _localeService: LocaleService);
|
|
31
|
+
private _initCommandListener;
|
|
32
|
+
private _checkCell;
|
|
33
|
+
private _blockExecute;
|
|
34
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export * from './commands/commands/note.command';
|
|
17
17
|
export * from './commands/mutations/note.mutation';
|
|
18
18
|
export type { IUniverSheetsNoteConfig } from './config/config';
|
|
19
|
+
export { SHEET_NOTE_EDIT_PERMISSIONS } from './const';
|
|
19
20
|
export * from './controllers/sheets-note-resource.controller';
|
|
20
21
|
export * from './models/sheets-note.model';
|
|
21
22
|
export { UniverSheetsNotePlugin } from './plugin';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
declare const locale: {
|
|
17
|
+
'sheets-note': {
|
|
18
|
+
permission: {
|
|
19
|
+
editErr: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|