@univerjs/sheets-zen-editor 0.17.0 → 0.18.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.
Files changed (80) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +9 -3
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -144
  16. package/lib/es/index.js +9 -466
  17. package/lib/es/locale/ca-ES.js +1 -14
  18. package/lib/es/locale/en-US.js +1 -14
  19. package/lib/es/locale/es-ES.js +1 -14
  20. package/lib/es/locale/fa-IR.js +1 -14
  21. package/lib/es/locale/fr-FR.js +1 -14
  22. package/lib/es/locale/ja-JP.js +1 -14
  23. package/lib/es/locale/ko-KR.js +1 -14
  24. package/lib/es/locale/ru-RU.js +1 -14
  25. package/lib/es/locale/sk-SK.js +1 -14
  26. package/lib/es/locale/vi-VN.js +1 -14
  27. package/lib/es/locale/zh-CN.js +1 -14
  28. package/lib/es/locale/zh-TW.js +1 -14
  29. package/lib/facade.js +1 -144
  30. package/lib/index.css +82 -1
  31. package/lib/index.js +9 -466
  32. package/lib/locale/ca-ES.js +1 -14
  33. package/lib/locale/en-US.js +1 -14
  34. package/lib/locale/es-ES.js +1 -14
  35. package/lib/locale/fa-IR.js +1 -14
  36. package/lib/locale/fr-FR.js +1 -14
  37. package/lib/locale/ja-JP.js +1 -14
  38. package/lib/locale/ko-KR.js +1 -14
  39. package/lib/locale/ru-RU.js +1 -14
  40. package/lib/locale/sk-SK.js +1 -14
  41. package/lib/locale/vi-VN.js +1 -14
  42. package/lib/locale/zh-CN.js +1 -14
  43. package/lib/locale/zh-TW.js +1 -14
  44. package/lib/types/commands/commands/zen-editor.command.d.ts +16 -1
  45. package/lib/types/config/config.d.ts +16 -1
  46. package/lib/types/controllers/shortcuts/zen-editor.shortcut.d.ts +17 -2
  47. package/lib/types/controllers/zen-editor-ui.controller.d.ts +15 -0
  48. package/lib/types/controllers/zen-editor.controller.d.ts +15 -0
  49. package/lib/types/facade/f-univer.d.ts +16 -1
  50. package/lib/types/facade/f-workbook.d.ts +15 -0
  51. package/lib/types/locale/ca-ES.d.ts +16 -1
  52. package/lib/types/locale/es-ES.d.ts +16 -1
  53. package/lib/types/locale/fa-IR.d.ts +16 -1
  54. package/lib/types/locale/fr-FR.d.ts +16 -1
  55. package/lib/types/locale/ja-JP.d.ts +16 -1
  56. package/lib/types/locale/ko-KR.d.ts +16 -1
  57. package/lib/types/locale/ru-RU.d.ts +16 -1
  58. package/lib/types/locale/sk-SK.d.ts +16 -1
  59. package/lib/types/locale/vi-VN.d.ts +16 -1
  60. package/lib/types/locale/zh-CN.d.ts +16 -1
  61. package/lib/types/locale/zh-TW.d.ts +16 -1
  62. package/lib/types/menu/menu.d.ts +17 -2
  63. package/lib/types/menu/schema.d.ts +16 -1
  64. package/lib/types/plugin.d.ts +16 -1
  65. package/lib/types/services/zen-editor.service.d.ts +18 -3
  66. package/lib/umd/facade.js +1 -1
  67. package/lib/umd/index.js +9 -3
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/en-US.js +1 -1
  70. package/lib/umd/locale/es-ES.js +1 -1
  71. package/lib/umd/locale/fa-IR.js +1 -1
  72. package/lib/umd/locale/fr-FR.js +1 -1
  73. package/lib/umd/locale/ja-JP.js +1 -1
  74. package/lib/umd/locale/ko-KR.js +1 -1
  75. package/lib/umd/locale/ru-RU.js +1 -1
  76. package/lib/umd/locale/sk-SK.js +1 -1
  77. package/lib/umd/locale/vi-VN.js +1 -1
  78. package/lib/umd/locale/zh-CN.js +1 -1
  79. package/lib/umd/locale/zh-TW.js +1 -1
  80. package/package.json +14 -13
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "禪模式編輯"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "取消編輯(禪模式狀態)",
8
- "zen-edit-confirm": "放棄編輯(禪模式狀態)"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`禪模式編輯`},shortcut:{sheet:{"zen-edit-cancel":`取消編輯(禪模式狀態)`,"zen-edit-confirm":`放棄編輯(禪模式狀態)`}}};export{e as default};
@@ -1,4 +1,19 @@
1
- import { ICommand } from '@univerjs/core';
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 { ICommand } from '@univerjs/core';
2
17
  export declare const OpenZenEditorCommand: ICommand;
3
18
  export declare const CancelZenEditCommand: ICommand;
4
19
  export declare const ConfirmZenEditCommand: ICommand;
@@ -1,4 +1,19 @@
1
- import { MenuConfig } from '@univerjs/ui';
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 { MenuConfig } from '@univerjs/ui';
2
17
  export declare const SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY = "sheets-zen-editor.config";
3
18
  export declare const configSymbol: unique symbol;
4
19
  export interface IUniverSheetsZenEditorConfig {
@@ -1,5 +1,20 @@
1
- import { IContextService } from '@univerjs/core';
2
- import { IShortcutItem } from '@univerjs/ui';
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 { IContextService } from '@univerjs/core';
17
+ import type { IShortcutItem } from '@univerjs/ui';
3
18
  export declare const ZenEditorConfirmShortcut: IShortcutItem;
4
19
  export declare const ZenEditorCancelShortcut: IShortcutItem;
5
20
  /**
@@ -1,3 +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
+ */
1
16
  import { Disposable, ICommandService } from '@univerjs/core';
2
17
  import { IMenuManagerService, IShortcutService, IZenZoneService } from '@univerjs/ui';
3
18
  export declare class ZenEditorUIController extends Disposable {
@@ -1,3 +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
+ */
1
16
  import { RxDisposable } from '@univerjs/core';
2
17
  import { IRenderManagerService } from '@univerjs/engine-render';
3
18
  import { IZenEditorManagerService } from '../services/zen-editor.service';
@@ -1,4 +1,19 @@
1
- import { Injector } from '@univerjs/core';
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 { Injector } from '@univerjs/core';
2
17
  import { FUniver } from '@univerjs/core/facade';
3
18
  /**
4
19
  * @ignore
@@ -1,3 +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
+ */
1
16
  import { FWorkbook } from '@univerjs/sheets/facade';
2
17
  /**
3
18
  * @ignore
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
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';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { IAccessor } from '@univerjs/core';
2
- import { IMenuButtonItem } from '@univerjs/ui';
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 { IAccessor } from '@univerjs/core';
17
+ import type { IMenuButtonItem } from '@univerjs/ui';
3
18
  export declare function ZenEditorMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
@@ -1,2 +1,17 @@
1
- import { MenuSchemaType } from '@univerjs/ui';
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 { MenuSchemaType } from '@univerjs/ui';
2
17
  export declare const menuSchema: MenuSchemaType;
@@ -1,4 +1,19 @@
1
- import { IUniverSheetsZenEditorConfig } from './config/config';
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 { IUniverSheetsZenEditorConfig } from './config/config';
2
17
  import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
18
  export declare class UniverSheetsZenEditorPlugin extends Plugin {
4
19
  private readonly _config;
@@ -1,5 +1,20 @@
1
- import { IDisposable, Nullable } from '@univerjs/core';
2
- import { Observable } from 'rxjs';
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 { IDisposable, Nullable } from '@univerjs/core';
17
+ import type { Observable } from 'rxjs';
3
18
  export interface IZenEditorManagerService {
4
19
  position$: Observable<Nullable<DOMRect>>;
5
20
  dispose(): void;
@@ -15,4 +30,4 @@ export declare class ZenEditorManagerService implements IDisposable {
15
30
  getPosition(): Readonly<Nullable<DOMRect>>;
16
31
  private _refresh;
17
32
  }
18
- export declare const IZenEditorManagerService: import('@wendellhu/redi').IdentifierDecorator<ZenEditorManagerService>;
33
+ export declare const IZenEditorManagerService: import("@wendellhu/redi").IdentifierDecorator<ZenEditorManagerService>;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(t,u){typeof exports=="object"&&typeof module<"u"?u(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-zen-editor"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/docs","@univerjs/sheets-ui","@univerjs/sheets-zen-editor","@univerjs/sheets/facade"],u):(t=typeof globalThis<"u"?globalThis:t||self,u(t.UniverCore,t.UniverCoreFacade,t.UniverDocs,t.UniverSheetsUi,t.UniverSheetsZenEditor,t.UniverSheetsFacade))})(this,(function(t,u,f,S,o,C){"use strict";class p extends u.FUniver{_initSheetZenEditorEvent(n){const m=n.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>m.beforeCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>m.beforeCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params,{keycode:h,eventType:r}=E,s=d.getEditLocation(),g={row:s.row,column:s.column,eventType:r,keycode:h,workbook:c,worksheet:a,isZenEditor:!0,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:e.id===o.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,g),g.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>m.onCommandExecuted(e=>{if(e.id===o.OpenZenEditorCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>m.onCommandExecuted(e=>{if(e.id===o.CancelZenEditCommand.id||e.id===o.ConfirmZenEditCommand.id){const i=this.getCommandSheetTarget(e);if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=e.params,{keycode:E,eventType:h}=v,r=d.getEditLocation(),s={row:r.row,column:r.column,eventType:h,keycode:E,workbook:c,worksheet:a,isZenEditor:!0,isConfirm:e.id===o.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>m.onCommandExecuted(e=>{if(e.id===f.RichTextEditingMutation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:c,worksheet:a}=i,d=n.get(S.IEditorBridgeService),v=n.get(t.IUniverInstanceService),E=e.params;if(!d.isVisible().visible)return;const{unitId:h}=E;if(h===t.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:r,column:s}=d.getEditLocation(),g={workbook:c,worksheet:a,row:r,column:s,value:t.RichTextValue.create(v.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,g)}}})))}_initialize(n){this._initSheetZenEditorEvent(n)}}u.FUniver.extend(p);class l extends C.FWorkbook{startZenEditingAsync(){return this._injector.get(t.ICommandService).executeCommand(o.OpenZenEditorCommand.id)}endZenEditingAsync(n=!0){const m=this._injector.get(t.ICommandService);return n?m.executeCommand(o.ConfirmZenEditCommand.id):m.executeCommand(o.CancelZenEditCommand.id)}}C.FWorkbook.extend(l)}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core`),require(`@univerjs/core/facade`),require(`@univerjs/docs`),require(`@univerjs/sheets-ui`),require(`@univerjs/sheets-zen-editor`),require(`@univerjs/sheets/facade`)):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs`,`@univerjs/sheets-ui`,`@univerjs/sheets-zen-editor`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverCoreFacade,e.UniverDocs,e.UniverSheetsUi,e.UniverSheetsZenEditor,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a){var o=class extends t.FUniver{_initSheetZenEditorEvent(t){let a=t.get(e.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>a.beforeCommandExecuted(n=>{if(n.id===i.OpenZenEditorCommand.id){let i=this.getCommandSheetTarget(n);if(!i)return;let{workbook:a,worksheet:o}=i,s=t.get(r.IEditorBridgeService),{keycode:c,eventType:l}=n.params,u=s.getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:a,worksheet:o,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,d),d.cancel)throw new e.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>a.beforeCommandExecuted(n=>{if(n.id===i.CancelZenEditCommand.id||n.id===i.ConfirmZenEditCommand.id){let a=this.getCommandSheetTarget(n);if(!a)return;let{workbook:o,worksheet:s}=a,c=t.get(r.IEditorBridgeService),l=t.get(e.IUniverInstanceService),{keycode:u,eventType:d}=n.params,f=c.getEditLocation(),p={row:f.row,column:f.column,eventType:d,keycode:u,workbook:o,worksheet:s,isZenEditor:!0,value:e.RichTextValue.create(l.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:n.id===i.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,p),p.cancel)throw new e.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>a.onCommandExecuted(e=>{if(e.id===i.OpenZenEditorCommand.id){let n=this.getCommandSheetTarget(e);if(!n)return;let{workbook:i,worksheet:a}=n,o=t.get(r.IEditorBridgeService),{keycode:s,eventType:c}=e.params,l=o.getEditLocation(),u={row:l.row,column:l.column,eventType:c,keycode:s,workbook:i,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,u)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>a.onCommandExecuted(e=>{if(e.id===i.CancelZenEditCommand.id||e.id===i.ConfirmZenEditCommand.id){let n=this.getCommandSheetTarget(e);if(!n)return;let{workbook:a,worksheet:o}=n,s=t.get(r.IEditorBridgeService),{keycode:c,eventType:l}=e.params,u=s.getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:a,worksheet:o,isZenEditor:!0,isConfirm:e.id===i.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,d)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>a.onCommandExecuted(i=>{if(i.id===n.RichTextEditingMutation.id){let n=this.getActiveSheet();if(!n)return;let{workbook:a,worksheet:o}=n,s=t.get(r.IEditorBridgeService),c=t.get(e.IUniverInstanceService),l=i.params;if(!s.isVisible().visible)return;let{unitId:u}=l;if(u===e.DOCS_ZEN_EDITOR_UNIT_ID_KEY){let{row:t,column:n}=s.getEditLocation(),r={workbook:a,worksheet:o,row:t,column:n,value:e.RichTextValue.create(c.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,r)}}})))}_initialize(e){this._initSheetZenEditorEvent(e)}};t.FUniver.extend(o);var s=class extends a.FWorkbook{startZenEditingAsync(){return this._injector.get(e.ICommandService).executeCommand(i.OpenZenEditorCommand.id)}endZenEditingAsync(t=!0){let n=this._injector.get(e.ICommandService);return t?n.executeCommand(i.ConfirmZenEditCommand.id):n.executeCommand(i.CancelZenEditCommand.id)}};a.FWorkbook.extend(s)});
package/lib/umd/index.js CHANGED
@@ -1,7 +1,13 @@
1
- (function(d,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/sheets"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","@univerjs/sheets","rxjs","react/jsx-runtime","@univerjs/design","react"],r):(d=typeof globalThis<"u"?globalThis:d||self,r(d.UniverSheetsZenEditor={},d.UniverCore,d.UniverDocsUi,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.UniverSheets,d.rxjs,d.React,d.UniverDesign,d.React))})(this,(function(d,r,v,k,f,l,O,D,m,$,_){"use strict";var fe=Object.defineProperty;var _e=(d,r,v)=>r in d?fe(d,r,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[r]=v;var I=(d,r,v)=>_e(d,typeof r!="symbol"?r+"":r,v);var C;const y={id:"zen-editor.command.open-zen-editor",type:r.CommandType.COMMAND,handler:async e=>{var P;const n=e.get(l.IZenZoneService),t=e.get(v.IEditorService),i=e.get(f.IEditorBridgeService),s=e.get(r.IUniverInstanceService),o=e.get(l.ISidebarService);o.visible&&(o.close(),await r.delayAnimationFrame()),n.open();const c=t.getEditor(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=i.getLatestEditCellState();if(a==null)return!1;const u=(P=a.documentLayoutObject.documentModel)==null?void 0:P.getSnapshot();if(u==null)return!1;s.focusUnit(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:g,drawings:p,drawingsOrder:h,tableSource:S,settings:N}=r.Tools.deepClone(u),T={...c.getDocumentData(),body:g,drawings:p,drawingsOrder:h,tableSource:S,settings:N},E=[{startOffset:0,endOffset:0,collapsed:!0}];return c.focus(),c.setDocumentData(T,E),c.clearUndoRedoHistory(),!0}},M={id:"zen-editor.command.cancel-zen-edit",type:r.CommandType.COMMAND,handler:async e=>{const n=e.get(l.IZenZoneService),t=e.get(f.IEditorBridgeService),i=e.get(r.IUniverInstanceService),s=e.get(l.ISidebarService);s.visible&&(s.close(),await r.delayAnimationFrame()),n.close();const o=i.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET);return o?(i.focusUnit(o.getUnitId()),t.refreshEditCellState(),!0):!1}},R={id:"zen-editor.command.confirm-zen-edit",type:r.CommandType.COMMAND,handler:async e=>{var g;const n=e.get(l.IZenZoneService),t=e.get(f.IEditorBridgeService),i=e.get(r.IUniverInstanceService),s=e.get(v.IEditorService),o=e.get(l.ISidebarService);o.visible&&(o.close(),await r.delayAnimationFrame()),n.close();const c=s.getEditor(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=e.get(k.IRenderManagerService),u=i.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET);if(u){const p=u.getUnitId(),h=(g=a.getRenderById(p))==null?void 0:g.with(f.EditingRenderController);if(h){const S=r.Tools.deepClone(c.getDocumentData());S.documentStyle.documentFlavor=r.DocumentFlavor.UNSPECIFIED,h.submitCellData(new r.DocumentDataModel(S))}return i.focusUnit(u.getUnitId()),t.refreshEditCellState(),!0}return!1}},B={name:"@univerjs/sheets-zen-editor",version:"0.17.0"},q="sheets-zen-editor.config",A={};function H(e){const n=e.get(f.IEditorBridgeService);return{id:y.id,type:l.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifyIcon",hidden$:f.getCurrentExclusiveRangeInterest$(e),disabled$:n.currentEditCell$.pipe(D.switchMap(t=>f.getCurrentRangeDisable$(e,{workbookTypes:[O.WorkbookEditablePermission],worksheetTypes:[O.WorksheetEditPermission,O.WorksheetSetCellValuePermission,O.WorksheetSetCellStylePermission],rangeTypes:[O.RangeProtectionPermissionEditPoint]}).pipe(D.map(i=>{var s,o,c,a;return i||((a=(c=(o=(s=t==null?void 0:t.documentLayoutObject.documentModel)==null?void 0:s.getBody())==null?void 0:o.customBlocks)==null?void 0:c.length)!=null?a:0)>0}))))}}const G={[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[y.id]:{order:2,menuItemFactory:H}}}};function j({ref:e,...n}){const{icon:t,id:i,className:s,extend:o,...c}=n,a=`univerjs-icon univerjs-icon-${i} ${s||""}`.trim(),u=_.useRef(`_${Q()}`);return L(t,`${i}`,{defIds:t.defIds,idSuffix:u.current},{ref:e,className:a,...c},o)}function L(e,n,t,i,s){return _.createElement(e.tag,{key:n,...X(e,t,s),...i},(J(e,t).children||[]).map((o,c)=>L(o,`${n}-${e.tag}-${c}`,t,void 0,s)))}function X(e,n,t){const i={...e.attrs};t!=null&&t.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=t.colorChannel1),e.tag==="mask"&&i.id&&(i.id=i.id+n.idSuffix),Object.entries(i).forEach(([o,c])=>{o==="mask"&&typeof c=="string"&&(i[o]=c.replace(/url\(#(.*)\)/,`url(#$1${n.idSuffix})`))});const{defIds:s}=n;return!s||s.length===0||(e.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+n.idSuffix),Object.entries(i).forEach(([o,c])=>{typeof c=="string"&&(i[o]=c.replace(/url\(#(.*)\)/,`url(#$1${n.idSuffix})`))})),i}function J(e,n){var i;const{defIds:t}=n;return!t||t.length===0?e:e.tag==="defs"&&((i=e.children)!=null&&i.length)?{...e,children:e.children.map(s=>typeof s.attrs.id=="string"&&t&&t.includes(s.attrs.id)?{...s,attrs:{...s.attrs,id:s.attrs.id+n.idSuffix}}:s)}:e}function Q(){return Math.random().toString(36).substring(2,8)}j.displayName="UniverIcon";const ee={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},F=_.forwardRef(function(n,t){return _.createElement(j,Object.assign({},n,{id:"check-mark-icon",ref:t,icon:ee}))});F.displayName="CheckMarkIcon";const te={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},V=_.forwardRef(function(n,t){return _.createElement(j,Object.assign({},n,{id:"close-icon",ref:t,icon:te}))});V.displayName="CloseIcon";class ne{constructor(){I(this,"_position",null);I(this,"_position$",new D.BehaviorSubject(null));I(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(n){this._position=n,this._refresh(n)}getPosition(){return this._position}_refresh(n){this._position$.next(n)}}const z=r.createIdentifier("univer.sheet-zen-editor-manager.service"),ie="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",re={id:r.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${r.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:r.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function se(){const e=_.useRef(null),n=l.useDependency(z),t=l.useDependency(v.IEditorService),i=l.useDependency(r.ICommandService);_.useEffect(()=>{const a=e.current;if(!a)return;const u=t.register({editorUnitId:r.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:re,scrollBar:!0,backScrollOffset:100},a),g=new ResizeObserver(()=>{n.setPosition(a.getBoundingClientRect())});return g.observe(a),()=>{u.dispose(),g.unobserve(a)}},[]);function s(){const a=t.getEditor(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),i.executeCommand(M.id)}function o(){const a=t.getEditor(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),i.executeCommand(R.id)}const c="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return m.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white dark:!univer-bg-gray-800",children:[m.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[m.jsx("span",{className:$.clsx(c,`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/docs-ui`),require(`@univerjs/engine-render`),require(`@univerjs/sheets-ui`),require(`@univerjs/ui`),require(`@univerjs/sheets`),require(`rxjs`),require(`@univerjs/design`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs-ui`,`@univerjs/engine-render`,`@univerjs/sheets-ui`,`@univerjs/ui`,`@univerjs/sheets`,`rxjs`,`@univerjs/design`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsZenEditor={},e.UniverCore,e.UniverDocsUi,e.UniverEngineRender,e.UniverSheetsUi,e.UniverUi,e.UniverSheets,e.rxjs,e.UniverDesign,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d={id:`zen-editor.command.open-zen-editor`,type:t.CommandType.COMMAND,handler:async e=>{var r;let o=e.get(a.IZenZoneService),s=e.get(n.IEditorService),c=e.get(i.IEditorBridgeService),l=e.get(t.IUniverInstanceService),u=e.get(a.ISidebarService);u.visible&&(u.close(),await(0,t.delayAnimationFrame)()),o.open();let d=s.getEditor(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(d==null)return!1;let f=c.getLatestEditCellState();if(f==null)return!1;let p=(r=f.documentLayoutObject.documentModel)==null?void 0:r.getSnapshot();if(p==null)return!1;l.focusUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY);let{body:m,drawings:h,drawingsOrder:g,tableSource:_,settings:v}=t.Tools.deepClone(p),y={...d.getDocumentData(),body:m,drawings:h,drawingsOrder:g,tableSource:_,settings:v};return d.focus(),d.setDocumentData(y,[{startOffset:0,endOffset:0,collapsed:!0}]),d.clearUndoRedoHistory(),!0}},f={id:`zen-editor.command.cancel-zen-edit`,type:t.CommandType.COMMAND,handler:async e=>{let n=e.get(a.IZenZoneService),r=e.get(i.IEditorBridgeService),o=e.get(t.IUniverInstanceService),s=e.get(a.ISidebarService);s.visible&&(s.close(),await(0,t.delayAnimationFrame)()),n.close();let c=o.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);return c?(o.focusUnit(c.getUnitId()),r.refreshEditCellState(),!0):!1}},p={id:`zen-editor.command.confirm-zen-edit`,type:t.CommandType.COMMAND,handler:async e=>{let o=e.get(a.IZenZoneService),s=e.get(i.IEditorBridgeService),c=e.get(t.IUniverInstanceService),l=e.get(n.IEditorService),u=e.get(a.ISidebarService);u.visible&&(u.close(),await(0,t.delayAnimationFrame)()),o.close();let d=l.getEditor(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(d==null)return!1;let f=e.get(r.IRenderManagerService),p=c.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(p){var m;let e=p.getUnitId(),n=(m=f.getRenderById(e))==null?void 0:m.with(i.EditingRenderController);if(n){let e=t.Tools.deepClone(d.getDocumentData());e.documentStyle.documentFlavor=t.DocumentFlavor.UNSPECIFIED,n.submitCellData(new t.DocumentDataModel(e))}return c.focusUnit(p.getUnitId()),s.refreshEditCellState(),!0}return!1}};var m=`@univerjs/sheets-zen-editor`,h=`0.18.0`;let g=`sheets-zen-editor.config`;Symbol(g);let _={};function v(e){let t=e.get(i.IEditorBridgeService);return{id:d.id,type:a.MenuItemType.BUTTON,title:`rightClick.zenEditor`,icon:`AmplifyIcon`,hidden$:(0,i.getCurrentExclusiveRangeInterest$)(e),disabled$:t.currentEditCell$.pipe((0,s.switchMap)(t=>(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[o.WorkbookEditablePermission],worksheetTypes:[o.WorksheetEditPermission,o.WorksheetSetCellValuePermission,o.WorksheetSetCellStylePermission],rangeTypes:[o.RangeProtectionPermissionEditPoint]}).pipe((0,s.map)(e=>{var n,r;return e||((n=t==null||(r=t.documentLayoutObject.documentModel)==null||(r=r.getBody())==null||(r=r.customBlocks)==null?void 0:r.length)==null?0:n)>0}))))}}let y={[a.ContextMenuPosition.MAIN_AREA]:{[a.ContextMenuGroup.OTHERS]:{[d.id]:{order:2,menuItemFactory:v}}}};function b({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,l.useRef)(`_${w()}`);return x(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function x(e,t,n,r,i){return(0,l.createElement)(e.tag,{key:t,...S(e,n,i),...r},(C(e,n).children||[]).map((r,a)=>x(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function S(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function C(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function w(){return Math.random().toString(36).substring(2,8)}b.displayName=`UniverIcon`;let T={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},E=(0,l.forwardRef)(function(e,t){return(0,l.createElement)(b,Object.assign({},e,{id:`check-mark-icon`,ref:t,icon:T}))});E.displayName=`CheckMarkIcon`;let D={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z`}}]},O=(0,l.forwardRef)(function(e,t){return(0,l.createElement)(b,Object.assign({},e,{id:`close-icon`,ref:t,icon:D}))});O.displayName=`CloseIcon`;function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function A(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function j(e){var t=A(e,`string`);return k(t)==`symbol`?t:t+``}function M(e,t,n){return(t=j(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=class{constructor(){M(this,`_position`,null),M(this,`_position$`,new s.BehaviorSubject(null)),M(this,`position$`,this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}};let P=(0,t.createIdentifier)(`univer.sheet-zen-editor-manager.service`),F={id:t.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${t.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:1/0},documentFlavor:t.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function I(){let e=(0,l.useRef)(null),r=(0,a.useDependency)(P),i=(0,a.useDependency)(n.IEditorService),o=(0,a.useDependency)(t.ICommandService);(0,l.useEffect)(()=>{let n=e.current;if(!n)return;let a=i.register({editorUnitId:t.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:F,scrollBar:!0,backScrollOffset:100},n),o=new ResizeObserver(()=>{r.setPosition(n.getBoundingClientRect())});return o.observe(n),()=>{a.dispose(),o.unobserve(n)}},[]);function s(){let e=i.getEditor(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY);e==null||e.blur(),o.executeCommand(f.id)}function d(){let e=i.getEditor(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY);e==null||e.blur(),o.executeCommand(p.id)}let m=`univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors`;return(0,u.jsxs)(`div`,{className:`
2
+ univer-absolute univer-inset-0 univer-size-full univer-bg-white
3
+ dark:!univer-bg-gray-800
4
+ `,children:[(0,u.jsxs)(`div`,{className:`
5
+ univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
6
+ univer-justify-center
7
+ `,children:[(0,u.jsx)(`span`,{className:(0,c.clsx)(m,`
2
8
  univer-text-red-500
3
9
  hover:univer-text-red-600
4
- `),onClick:s,children:m.jsx(V,{className:"univer-size-5"})}),m.jsx("span",{className:$.clsx(c,`
10
+ `),onClick:s,children:(0,u.jsx)(O,{className:`univer-size-5`})}),(0,u.jsx)(`span`,{className:(0,c.clsx)(m,`
5
11
  univer-text-green-500
6
12
  hover:univer-text-green-600
7
- `),onClick:o,children:m.jsx(F,{className:"univer-size-5"})})]}),m.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}const oe={id:R.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ENTER|l.MetaKeys.ALT},ce={id:M.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ESC};function Y(e){return e.getContextValue(r.FOCUSING_DOC)&&e.getContextValue(r.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(r.EDITOR_ACTIVATED)&&!e.getContextValue(r.FOCUSING_EDITOR_STANDALONE)}var ae=Object.getOwnPropertyDescriptor,de=(e,n,t,i)=>{for(var s=i>1?void 0:i?ae(n,t):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=c(s)||s);return s},b=(e,n)=>(t,i)=>n(t,i,e);let Z=class extends r.Disposable{constructor(e,n,t,i){super(),this._zenZoneService=e,this._commandService=n,this._menuManagerService=t,this._shortcutService=i,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ie,se))}_initCommands(){[y,M,R].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(G)}_initShortcuts(){[oe,ce].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};Z=de([b(0,l.IZenZoneService),b(1,r.ICommandService),b(2,l.IMenuManagerService),b(3,l.IShortcutService)],Z);var le=Object.getOwnPropertyDescriptor,ue=(e,n,t,i)=>{for(var s=i>1?void 0:i?le(n,t):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=c(s)||s);return s},K=(e,n)=>(t,i)=>n(t,i,e);let U=class extends r.RxDisposable{constructor(e,n){super(),this._zenEditorManagerService=e,this._renderManagerService=n,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(D.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:n,height:t}=e,i=f.getEditorObject(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);i!=null&&requestIdleCallback(()=>{i.engine.resizeBySize(n,t),this._calculatePagePosition(i),this._scrollToTop()})})}_calculatePagePosition(e){const{document:n,scene:t,docBackground:i}=e,s=t==null?void 0:t.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:u}=n;if(s==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:g,height:p}=s;let h=0;const S=u;let N=0,w=0,T=Number.POSITIVE_INFINITY;const{scaleX:E,scaleY:P}=t.getAncestorScale();g>(o+a*2)*E?(h=g/2-o*E/2,h/=E,N=(g-a*2)/E,T=0):(h=a,N=o+a*2,T=(N-g/E)/2),p>c?w=(p-u*2)/P:w=c+u*2,t.resize(N,w),n.translate(h,S),i.translate(h,S);const x=t.getViewport(v.VIEWPORT_KEY.VIEW_MAIN);if(T!==Number.POSITIVE_INFINITY&&x!=null){const he=x.transScroll2ViewportScrollValue(T,0).x;x.scrollToBarPos({x:he})}return this}_scrollToTop(){var t;const e=(t=this._renderManagerService.getRenderById(r.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:t.with(v.DocBackScrollRenderController),n={startOffset:0,endOffset:0};e&&e.scrollToRange(n)}};U=ue([K(0,z),K(1,k.IRenderManagerService)],U);var ge=Object.getOwnPropertyDescriptor,ve=(e,n,t,i)=>{for(var s=i>1?void 0:i?ge(n,t):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=c(s)||s);return s},W=(e,n)=>(t,i)=>n(t,i,e);d.UniverSheetsZenEditorPlugin=(C=class extends r.Plugin{constructor(n=A,t,i){super(),this._config=n,this._injector=t,this._configService=i;const{menu:s,...o}=r.merge({},A,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(q,o),this._initializeDependencies(this._injector)}_initializeDependencies(n){[[Z],[U],[z,{useClass:ne}]].forEach(i=>n.add(i))}onReady(){this._injector.get(Z)}onSteady(){this._injector.get(U)}},I(C,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),I(C,"packageName",B.name),I(C,"version",B.version),I(C,"type",r.UniverInstanceType.UNIVER_SHEET),C),d.UniverSheetsZenEditorPlugin=ve([W(1,r.Inject(r.Injector)),W(2,r.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=M,d.ConfirmZenEditCommand=R,d.OpenZenEditorCommand=y,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
13
+ `),onClick:d,children:(0,u.jsx)(E,{className:`univer-size-5`})})]}),(0,u.jsx)(`div`,{ref:e,className:`univer-absolute univer-inset-0 univer-size-full`})]})}let L={id:p.id,description:`shortcut.sheet.zen-edit-confirm`,group:`4_sheet-edit`,preconditions:e=>z(e),binding:a.KeyCode.ENTER|a.MetaKeys.ALT},R={id:f.id,description:`shortcut.sheet.zen-edit-cancel`,group:`4_sheet-edit`,preconditions:e=>z(e),binding:a.KeyCode.ESC};function z(e){return e.getContextValue(t.FOCUSING_DOC)&&e.getContextValue(t.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(t.EDITOR_ACTIVATED)&&!e.getContextValue(t.FOCUSING_EDITOR_STANDALONE)}function B(e,t){return function(n,r){t(n,r,e)}}function V(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let H=class extends t.Disposable{constructor(e,t,n,r){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=n,this._shortcutService=r,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(`ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT`,I))}_initCommands(){[d,f,p].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(y)}_initShortcuts(){[L,R].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};H=V([B(0,a.IZenZoneService),B(1,t.ICommandService),B(2,a.IMenuManagerService),B(3,a.IShortcutService)],H);let U=class extends t.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe((0,s.takeUntil)(this.dispose$)).subscribe(e=>{if(e==null)return;let{width:n,height:r}=e,a=(0,i.getEditorObject)(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);a!=null&&requestIdleCallback(()=>{a.engine.resizeBySize(n,r),this._calculatePagePosition(a),this._scrollToTop()})})}_calculatePagePosition(e){let{document:t,scene:r,docBackground:i}=e,a=r==null?void 0:r.getParent(),{width:o,height:s,pageMarginLeft:c,pageMarginTop:l}=t;if(a==null||o===1/0||s===1/0)return;let{width:u,height:d}=a,f=0,p=l,m=0,h=0,g=1/0,{scaleX:_,scaleY:v}=r.getAncestorScale();u>(o+c*2)*_?(f=u/2-o*_/2,f/=_,m=(u-c*2)/_,g=0):(f=c,m=o+c*2,g=(m-u/_)/2),h=d>s?(d-l*2)/v:s+l*2,r.resize(m,h),t.translate(f,p),i.translate(f,p);let y=r.getViewport(n.VIEWPORT_KEY.VIEW_MAIN);if(g!==1/0&&y!=null){let e=y.transScroll2ViewportScrollValue(g,0).x;y.scrollToBarPos({x:e})}return this}_scrollToTop(){var e;let r=(e=this._renderManagerService.getRenderById(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:e.with(n.DocBackScrollRenderController);r&&r.scrollToRange({startOffset:0,endOffset:0})}};U=V([B(0,P),B(1,r.IRenderManagerService)],U);let W=class extends t.Plugin{constructor(e=_,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{menu:i,...a}=(0,t.merge)({},_,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(g,a),this._initializeDependencies(this._injector)}_initializeDependencies(e){[[H],[U],[P,{useClass:N}]].forEach(t=>e.add(t))}onReady(){this._injector.get(H)}onSteady(){this._injector.get(U)}};M(W,`pluginName`,`SHEET_ZEN_EDITOR_PLUGIN`),M(W,`packageName`,m),M(W,`version`,h),M(W,`type`,t.UniverInstanceType.UNIVER_SHEET),W=V([B(1,(0,t.Inject)(t.Injector)),B(2,t.IConfigService)],W),e.CancelZenEditCommand=f,e.ConfirmZenEditCommand=p,e.OpenZenEditorCommand=d,Object.defineProperty(e,`UniverSheetsZenEditorPlugin`,{enumerable:!0,get:function(){return W}})});