@univerjs/sheets-hyper-link-ui 0.21.1 → 0.22.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 CHANGED
@@ -1,60 +1,42 @@
1
1
  # @univerjs/sheets-hyper-link-ui
2
2
 
3
- ## Package Overview
4
-
5
- | Package Name | UMD Namespace | Version | License | Downloads | Contains CSS | Contains i18n locales |
6
- | --- | --- | --- | --- | --- | :---: | :---: |
7
- | `@univerjs/sheets-hyper-link-ui` | `UniverSheetsHyperLinkUi` | [![][npm-version-shield]][npm-version-link] | ![][npm-license-shield] | ![][npm-downloads-shield] | ⭕️ | ⭕️ |
8
-
9
- ## Introduction
3
+ [![npm version](https://img.shields.io/npm/v/@univerjs/sheets-hyper-link-ui?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-hyper-link-ui)
4
+ [![license](https://img.shields.io/npm/l/@univerjs/sheets-hyper-link-ui?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-hyper-link-ui)
5
+ [![downloads](https://img.shields.io/npm/dm/@univerjs/sheets-hyper-link-ui?style=flat-square)](https://npmjs.com/package/@univerjs/sheets-hyper-link-ui)
10
6
 
11
- `@univerjs/sheets-hyper-link-ui` provides a hyperlink feature that allows users to create links for quick access to resources both within and outside of the spreadsheet, including web pages, files, email addresses, or other locations in the workbook.
7
+ `@univerjs/sheets-hyper-link-ui` adds hyperlink menus, dialogs, rendering, and interaction UI for Univer Sheets.
12
8
 
13
- ## Usage
9
+ ## Package Overview
14
10
 
15
- ### Installation
11
+ | Package | UMD global | CSS | Locales | Facade entry |
12
+ | --- | --- | :---: | :---: | :---: |
13
+ | `@univerjs/sheets-hyper-link-ui` | `UniverSheetsHyperLinkUi` | Yes | Yes | Yes |
16
14
 
17
- ```shell
18
- # Using npm
19
- npm install @univerjs/sheets-hyper-link-ui
15
+ ## Installation
20
16
 
21
- # Using pnpm
17
+ ```sh
22
18
  pnpm add @univerjs/sheets-hyper-link-ui
19
+ # or
20
+ npm install @univerjs/sheets-hyper-link-ui
23
21
  ```
24
22
 
25
- ### Register the plugin
23
+ Keep all `@univerjs/*` packages on the same version.
24
+
25
+ ## Usage
26
26
 
27
- ```typescript
27
+ ```ts
28
+ import '@univerjs/sheets-hyper-link-ui/lib/index.css';
29
+ import EnUS from '@univerjs/sheets-hyper-link-ui/locale/en-US';
28
30
  import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
29
31
 
30
32
  univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);
31
- ```
32
33
 
33
- ### API
34
- ```typescript
35
- // All commands
36
- import { AddHyperLinkCommand, type IAddHyperLinkCommandParams } from '@univerjs/sheets-hyper-link-ui';
37
- import { RemoveHyperLinkCommand, CancelHyperLinkCommand, type IRemoveHyperLinkCommandParams } from '@univerjs/sheets-hyper-link-ui';
38
- import { UpdateHyperLinkCommand, type IUpdateHyperLinkCommandParams } from '@univerjs/sheets-hyper-link-ui';
39
-
40
- // Add hyperlink by command
41
- const commandService = univer.__getInjector().get(ICommandService);
42
-
43
- commandService.executeCommand(AddHyperLinkCommand.id, {
44
- unitId: 'unitId',
45
- subUnitId: 'subUnitId',
46
- link: {
47
- // comment content
48
- payload: 'https://univer.ai',
49
- id: '1',
50
- row: 0,
51
- column: 0
52
- },
53
- } as IAddCommentCommandParams);
34
+ // Merge EnUS into your Univer locale map when this package contributes UI text.
54
35
  ```
55
36
 
56
- <!-- Links -->
57
- [npm-version-shield]: https://img.shields.io/npm/v/@univerjs/sheets-hyper-link-ui?style=flat-square
58
- [npm-version-link]: https://npmjs.com/package/@univerjs/sheets-hyper-link-ui
59
- [npm-license-shield]: https://img.shields.io/npm/l/@univerjs/sheets-hyper-link-ui?style=flat-square
60
- [npm-downloads-shield]: https://img.shields.io/npm/dm/@univerjs/sheets-hyper-link-ui?style=flat-square
37
+ ## Resources
38
+
39
+ - [Documentation](https://docs.univer.ai)
40
+ - [NPM package](https://npmjs.com/package/@univerjs/sheets-hyper-link-ui)
41
+ - [GitHub repository](https://github.com/dream-num/univer)
42
+
package/lib/cjs/index.js CHANGED
@@ -16,30 +16,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
16
16
  let _univerjs_icons = require("@univerjs/icons");
17
17
  let _univerjs_sheets_data_validation = require("@univerjs/sheets-data-validation");
18
18
 
19
- //#region src/types/enums/edit-source.ts
20
- /**
21
- * Copyright 2023-present DreamNum Co., Ltd.
22
- *
23
- * Licensed under the Apache License, Version 2.0 (the "License");
24
- * you may not use this file except in compliance with the License.
25
- * You may obtain a copy of the License at
26
- *
27
- * http://www.apache.org/licenses/LICENSE-2.0
28
- *
29
- * Unless required by applicable law or agreed to in writing, software
30
- * distributed under the License is distributed on an "AS IS" BASIS,
31
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
- * See the License for the specific language governing permissions and
33
- * limitations under the License.
34
- */
35
- let HyperLinkEditSourceType = /* @__PURE__ */ function(HyperLinkEditSourceType) {
36
- HyperLinkEditSourceType["EDITING"] = "editing";
37
- HyperLinkEditSourceType["VIEWING"] = "viewing";
38
- HyperLinkEditSourceType["ZEN_EDITOR"] = "zen_mode";
39
- return HyperLinkEditSourceType;
40
- }({});
41
-
42
- //#endregion
43
19
  //#region src/common/util.ts
44
20
  /**
45
21
  * Copyright 2023-present DreamNum Co., Ltd.
@@ -87,7 +63,7 @@ const configSymbol = Symbol(SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY);
87
63
  const defaultPluginConfig = {};
88
64
 
89
65
  //#endregion
90
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
66
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
91
67
  function __decorateParam(paramIndex, decorator) {
92
68
  return function(target, key) {
93
69
  decorator(target, key, paramIndex);
@@ -95,7 +71,7 @@ function __decorateParam(paramIndex, decorator) {
95
71
  }
96
72
 
97
73
  //#endregion
98
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
74
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
99
75
  function __decorate(decorators, target, key, desc) {
100
76
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
101
77
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -235,7 +211,7 @@ SheetsHyperLinkResolverService = __decorate([
235
211
  ], SheetsHyperLinkResolverService);
236
212
 
237
213
  //#endregion
238
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
214
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
239
215
  function _typeof(o) {
240
216
  "@babel/helpers - typeof";
241
217
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -246,7 +222,7 @@ function _typeof(o) {
246
222
  }
247
223
 
248
224
  //#endregion
249
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
225
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
250
226
  function toPrimitive(t, r) {
251
227
  if ("object" != _typeof(t) || !t) return t;
252
228
  var e = t[Symbol.toPrimitive];
@@ -259,14 +235,14 @@ function toPrimitive(t, r) {
259
235
  }
260
236
 
261
237
  //#endregion
262
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
238
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
263
239
  function toPropertyKey(t) {
264
240
  var i = toPrimitive(t, "string");
265
241
  return "symbol" == _typeof(i) ? i : i + "";
266
242
  }
267
243
 
268
244
  //#endregion
269
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
245
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
270
246
  function _defineProperty(e, r, t) {
271
247
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
272
248
  value: t,
@@ -393,7 +369,7 @@ const CellLinkEdit = () => {
393
369
  row,
394
370
  column: col
395
371
  };
396
- } else if (editing.type === HyperLinkEditSourceType.VIEWING) {
372
+ } else if (editing.type === "viewing") {
397
373
  var _cell$p, _cell$p2, _range$properties$url, _range$properties2;
398
374
  const workbook = univerInstanceService.getUnit(editing.unitId);
399
375
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
@@ -476,7 +452,7 @@ const CellLinkEdit = () => {
476
452
  ]);
477
453
  (0, react.useEffect)(() => {
478
454
  let id = null;
479
- if (editing && !editing.customRangeId && editing.type === HyperLinkEditSourceType.VIEWING && _univerjs_core.Tools.isDefine(editing.row) && _univerjs_core.Tools.isDefine(editing.col)) {
455
+ if (editing && !editing.customRangeId && editing.type === "viewing" && _univerjs_core.Tools.isDefine(editing.row) && _univerjs_core.Tools.isDefine(editing.col)) {
480
456
  const workbook = univerInstanceService.getUnit(editing.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
481
457
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
482
458
  const mergeInfo = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergedCell(editing.row, editing.col);
@@ -510,7 +486,7 @@ const CellLinkEdit = () => {
510
486
  setIsFocusRangeSelector(type === _univerjs_sheets_hyper_link.SheetHyperLinkType.RANGE);
511
487
  }, [type]);
512
488
  (0, react.useEffect)(() => {
513
- const render = (editing === null || editing === void 0 ? void 0 : editing.type) === HyperLinkEditSourceType.ZEN_EDITOR ? renderManagerService.getRenderById(_univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY) : renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId());
489
+ const render = (editing === null || editing === void 0 ? void 0 : editing.type) === "zen_mode" ? renderManagerService.getRenderById(_univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY) : renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId());
514
490
  const disposeCollection = new _univerjs_core.DisposableCollection();
515
491
  if (render) {
516
492
  const selectionRenderService = render.with(_univerjs_docs_ui.DocSelectionRenderService);
@@ -612,7 +588,7 @@ const CellLinkEdit = () => {
612
588
  return;
613
589
  }
614
590
  if (editing) if (id) {
615
- const commandId = editing.type === HyperLinkEditSourceType.ZEN_EDITOR || editing.type === HyperLinkEditSourceType.EDITING ? _univerjs_sheets_hyper_link.UpdateRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.UpdateHyperLinkCommand.id;
591
+ const commandId = editing.type === "zen_mode" || editing.type === "editing" ? _univerjs_sheets_hyper_link.UpdateRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.UpdateHyperLinkCommand.id;
616
592
  await commandService.executeCommand(commandId, {
617
593
  id,
618
594
  unitId: editing.unitId,
@@ -623,10 +599,10 @@ const CellLinkEdit = () => {
623
599
  },
624
600
  row: editing.row,
625
601
  column: editing.col,
626
- documentId: editing.type === HyperLinkEditSourceType.ZEN_EDITOR ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
602
+ documentId: editing.type === "zen_mode" ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
627
603
  });
628
604
  } else {
629
- const commandId = editing.type === HyperLinkEditSourceType.ZEN_EDITOR || editing.type === HyperLinkEditSourceType.EDITING ? _univerjs_sheets_hyper_link.AddRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.AddHyperLinkCommand.id;
605
+ const commandId = editing.type === "zen_mode" || editing.type === "editing" ? _univerjs_sheets_hyper_link.AddRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.AddHyperLinkCommand.id;
630
606
  await commandService.executeCommand(commandId, {
631
607
  unitId: editing.unitId,
632
608
  subUnitId: editing.subUnitId,
@@ -637,10 +613,10 @@ const CellLinkEdit = () => {
637
613
  payload: formatUrl(type, payload),
638
614
  display: showLabel ? display : ""
639
615
  },
640
- documentId: editing.type === HyperLinkEditSourceType.ZEN_EDITOR ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
616
+ documentId: editing.type === "zen_mode" ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
641
617
  });
642
618
  }
643
- if ((editing === null || editing === void 0 ? void 0 : editing.type) === HyperLinkEditSourceType.VIEWING) {
619
+ if ((editing === null || editing === void 0 ? void 0 : editing.type) === "viewing") {
644
620
  await commandService.executeCommand(_univerjs_sheets.SetWorksheetActiveOperation.id, {
645
621
  unitId: editing.unitId,
646
622
  subUnitId: editing.subUnitId
@@ -718,11 +694,11 @@ const CellLinkEdit = () => {
718
694
  onRangeSelectorDialogVisibleChange: async (visible) => {
719
695
  setSelectorDialogVisible(visible);
720
696
  if (visible) {
721
- if (editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {
697
+ if (editing.type === "zen_mode") {
722
698
  zenZoneService.hide();
723
699
  contextService.setContextValue(_univerjs_core.FOCUSING_SHEET, true);
724
700
  }
725
- if (editing.type !== HyperLinkEditSourceType.VIEWING) editorBridgeService.enableForceKeepVisible();
701
+ if (editing.type !== "viewing") editorBridgeService.enableForceKeepVisible();
726
702
  setHide(true);
727
703
  } else {
728
704
  await resolverService.navigateToRange(editing.unitId, editing.subUnitId, {
@@ -731,7 +707,7 @@ const CellLinkEdit = () => {
731
707
  startColumn: editing.col,
732
708
  endColumn: editing.col
733
709
  }, true);
734
- if (editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {
710
+ if (editing.type === "zen_mode") {
735
711
  var _renderManagerService, _docSelectionManagerS;
736
712
  await commandService.executeCommand(_univerjs_sheets.SetSelectionsOperation.id, {
737
713
  unitId: editing.unitId,
@@ -925,14 +901,14 @@ const CellLinkPopupPure = (props) => {
925
901
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
926
902
  className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
927
903
  onClick: () => {
928
- const commandId = type === HyperLinkEditSourceType.EDITING || type === HyperLinkEditSourceType.ZEN_EDITOR ? _univerjs_sheets_hyper_link.CancelRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.CancelHyperLinkCommand.id;
904
+ const commandId = type === "editing" || type === "zen_mode" ? _univerjs_sheets_hyper_link.CancelRichHyperLinkCommand.id : _univerjs_sheets_hyper_link.CancelHyperLinkCommand.id;
929
905
  if (commandService.syncExecuteCommand(commandId, {
930
906
  unitId,
931
907
  subUnitId,
932
908
  id: customRange.rangeId,
933
909
  row,
934
910
  column: col,
935
- documentId: type === HyperLinkEditSourceType.ZEN_EDITOR ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
911
+ documentId: type === "zen_mode" ? _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
936
912
  })) popupService.hideCurrentPopup(void 0, true);
937
913
  },
938
914
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
@@ -1020,7 +996,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1020
996
  showPopup(location) {
1021
997
  if (this._currentPopup && isEqualLink(location, this._currentPopup)) return;
1022
998
  this.hideCurrentPopup(void 0, true);
1023
- if (location.type !== HyperLinkEditSourceType.ZEN_EDITOR && this._zenZoneService.visible) return;
999
+ if (location.type !== "zen_mode" && this._zenZoneService.visible) return;
1024
1000
  const currentEditing = this._currentEditing$.getValue();
1025
1001
  if (currentEditing && isEqualLink(location, currentEditing)) return;
1026
1002
  const { unitId, subUnitId, row, col, customRangeRect, customRange } = location;
@@ -1035,10 +1011,10 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1035
1011
  this.hideCurrentPopup(location.type, true);
1036
1012
  }
1037
1013
  };
1038
- if (location.type === HyperLinkEditSourceType.EDITING) {
1014
+ if (location.type === "editing") {
1039
1015
  if (!customRange) return;
1040
1016
  disposable = customRangeRect && this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeRect, popup);
1041
- } else if (location.type === HyperLinkEditSourceType.ZEN_EDITOR) {
1017
+ } else if (location.type === "zen_mode") {
1042
1018
  if (!customRange) return;
1043
1019
  disposable = this._docCanvasPopManagerService.attachPopupToRange({
1044
1020
  startOffset: customRange.startIndex,
@@ -1131,7 +1107,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1131
1107
  }
1132
1108
  startAddEditing(link) {
1133
1109
  const { unitId, subUnitId, type } = link;
1134
- if (type === HyperLinkEditSourceType.ZEN_EDITOR) {
1110
+ if (type === "zen_mode") {
1135
1111
  var _document$getBody;
1136
1112
  const document = this._univerInstanceService.getUnit(_univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
1137
1113
  if (!document) return;
@@ -1143,7 +1119,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1143
1119
  ...link,
1144
1120
  label
1145
1121
  });
1146
- } else if (type === HyperLinkEditSourceType.EDITING) {
1122
+ } else if (type === "editing") {
1147
1123
  var _range$label;
1148
1124
  const range = this._getEditingRange();
1149
1125
  if (!range) return;
@@ -1179,7 +1155,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1179
1155
  const { unitId, subUnitId } = link;
1180
1156
  let customRange;
1181
1157
  let label;
1182
- if (link.type === HyperLinkEditSourceType.ZEN_EDITOR) {
1158
+ if (link.type === "zen_mode") {
1183
1159
  var _document$getBody2, _document$getBody3;
1184
1160
  const document = this._univerInstanceService.getUnit(_univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
1185
1161
  customRange = document === null || document === void 0 || (_document$getBody2 = document.getBody()) === null || _document$getBody2 === void 0 || (_document$getBody2 = _document$getBody2.customRanges) === null || _document$getBody2 === void 0 ? void 0 : _document$getBody2.find((range) => range.rangeId === link.customRangeId);
@@ -1194,7 +1170,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends _uni
1194
1170
  endOffset: customRange.endIndex,
1195
1171
  collapsed: false
1196
1172
  }, this._editPopup, _univerjs_core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);
1197
- } else if (link.type === HyperLinkEditSourceType.EDITING) {
1173
+ } else if (link.type === "editing") {
1198
1174
  var _customRangeInfo$rect;
1199
1175
  const customRangeInfo = (0, _univerjs_sheets_ui.getEditingCustomRangePosition)(this._injector, link.unitId, link.subUnitId, link.row, link.col, link.customRangeId);
1200
1176
  if (!customRangeInfo || !((_customRangeInfo$rect = customRangeInfo.rects) === null || _customRangeInfo$rect === void 0 ? void 0 : _customRangeInfo$rect.length)) return;
@@ -1252,12 +1228,6 @@ SheetsHyperLinkPopupService = __decorate([
1252
1228
 
1253
1229
  //#endregion
1254
1230
  //#region src/utils/index.ts
1255
- let DisableLinkType = /* @__PURE__ */ function(DisableLinkType) {
1256
- DisableLinkType[DisableLinkType["ALLOWED"] = 0] = "ALLOWED";
1257
- DisableLinkType[DisableLinkType["DISABLED_BY_CELL"] = 1] = "DISABLED_BY_CELL";
1258
- DisableLinkType[DisableLinkType["ALLOW_ON_EDITING"] = 2] = "ALLOW_ON_EDITING";
1259
- return DisableLinkType;
1260
- }({});
1261
1231
  const disables = new Set([
1262
1232
  _univerjs_core.DataValidationType.CHECKBOX,
1263
1233
  _univerjs_core.DataValidationType.LIST,
@@ -1266,13 +1236,13 @@ const disables = new Set([
1266
1236
  const getShouldDisableCellLink = (accessor, worksheet, row, col) => {
1267
1237
  var _cell$p, _cell$p2;
1268
1238
  const cell = worksheet.getCell(row, col);
1269
- if ((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) return DisableLinkType.DISABLED_BY_CELL;
1270
- if (cell === null || cell === void 0 || (_cell$p = cell.p) === null || _cell$p === void 0 || (_cell$p = _cell$p.body) === null || _cell$p === void 0 || (_cell$p = _cell$p.customBlocks) === null || _cell$p === void 0 ? void 0 : _cell$p.length) return DisableLinkType.DISABLED_BY_CELL;
1239
+ if ((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) return 1;
1240
+ if (cell === null || cell === void 0 || (_cell$p = cell.p) === null || _cell$p === void 0 || (_cell$p = _cell$p.body) === null || _cell$p === void 0 || (_cell$p = _cell$p.customBlocks) === null || _cell$p === void 0 ? void 0 : _cell$p.length) return 1;
1271
1241
  const dataValidationModel = accessor.has(_univerjs_sheets_data_validation.SheetDataValidationModel) ? accessor.get(_univerjs_sheets_data_validation.SheetDataValidationModel) : null;
1272
1242
  const rule = dataValidationModel === null || dataValidationModel === void 0 ? void 0 : dataValidationModel.getRuleByLocation(worksheet.getUnitId(), worksheet.getSheetId(), row, col);
1273
1243
  if (rule && disables.has(rule.type)) return true;
1274
- if (cell === null || cell === void 0 || (_cell$p2 = cell.p) === null || _cell$p2 === void 0 || (_cell$p2 = _cell$p2.drawingsOrder) === null || _cell$p2 === void 0 ? void 0 : _cell$p2.length) return DisableLinkType.ALLOW_ON_EDITING;
1275
- return DisableLinkType.ALLOWED;
1244
+ if (cell === null || cell === void 0 || (_cell$p2 = cell.p) === null || _cell$p2 === void 0 || (_cell$p2 = _cell$p2.drawingsOrder) === null || _cell$p2 === void 0 ? void 0 : _cell$p2.length) return 2;
1245
+ return 0;
1276
1246
  };
1277
1247
  const getShouldDisableCurrentCellLink = (accessor) => {
1278
1248
  const unit = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
@@ -1282,7 +1252,7 @@ const getShouldDisableCurrentCellLink = (accessor) => {
1282
1252
  if (!selections.length) return true;
1283
1253
  const row = selections[0].range.startRow;
1284
1254
  const col = selections[0].range.startColumn;
1285
- return getShouldDisableCellLink(accessor, worksheet, row, col) === DisableLinkType.DISABLED_BY_CELL;
1255
+ return getShouldDisableCellLink(accessor, worksheet, row, col) === 1;
1286
1256
  };
1287
1257
  const shouldDisableAddLink = (accessor) => {
1288
1258
  const textSelectionService = accessor.get(_univerjs_docs.DocSelectionManagerService);
@@ -1337,7 +1307,7 @@ const InsertHyperLinkOperation = {
1337
1307
  subUnitId: target.subUnitId,
1338
1308
  row,
1339
1309
  col,
1340
- type: isZenEditor ? HyperLinkEditSourceType.ZEN_EDITOR : visible.visible ? HyperLinkEditSourceType.EDITING : HyperLinkEditSourceType.VIEWING
1310
+ type: isZenEditor ? "zen_mode" : visible.visible ? "editing" : "viewing"
1341
1311
  });
1342
1312
  }
1343
1313
  };
@@ -1585,17 +1555,17 @@ const getLinkDisable$ = (accessor) => {
1585
1555
  const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
1586
1556
  const editorBridgeService = accessor.has(_univerjs_sheets_ui.IEditorBridgeService) ? accessor.get(_univerjs_sheets_ui.IEditorBridgeService) : null;
1587
1557
  return ((_editorBridgeService$ = editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.currentEditCellState$.pipe((0, rxjs.map)((state) => {
1588
- if (!state) return DisableLinkType.DISABLED_BY_CELL;
1558
+ if (!state) return 1;
1589
1559
  const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService, {
1590
1560
  unitId: state.unitId,
1591
1561
  subUnitId: state.sheetId
1592
1562
  });
1593
- if (!target) return DisableLinkType.DISABLED_BY_CELL;
1563
+ if (!target) return 1;
1594
1564
  return getShouldDisableCellLink(accessor, target.worksheet, state.row, state.column);
1595
1565
  }), (0, rxjs.switchMap)((disableCell) => {
1596
- if (disableCell === DisableLinkType.DISABLED_BY_CELL) return (0, rxjs.of)(true);
1566
+ if (disableCell === 1) return (0, rxjs.of)(true);
1597
1567
  return (0, rxjs.combineLatest)([editorBridgeService ? editorBridgeService.visible$ : (0, rxjs.of)(null), univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC)]).pipe((0, rxjs.switchMap)(([editing, focusingDoc]) => {
1598
- return (editing === null || editing === void 0 ? void 0 : editing.visible) ? (focusingDoc === null || focusingDoc === void 0 ? void 0 : focusingDoc.getUnitId()) === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? (0, rxjs.of)(true) : getEditingLinkDisable$(accessor, _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) : (0, rxjs.of)(disableCell !== DisableLinkType.ALLOWED);
1568
+ return (editing === null || editing === void 0 ? void 0 : editing.visible) ? (focusingDoc === null || focusingDoc === void 0 ? void 0 : focusingDoc.getUnitId()) === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? (0, rxjs.of)(true) : getEditingLinkDisable$(accessor, _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) : (0, rxjs.of)(disableCell !== 0);
1599
1569
  }));
1600
1570
  }))) !== null && _editorBridgeService$ !== void 0 ? _editorBridgeService$ : (0, rxjs.of)(true)).pipe((0, rxjs.switchMap)((disableCell) => {
1601
1571
  if (disableCell) return (0, rxjs.of)(true);
@@ -1664,7 +1634,7 @@ const InsertLinkShortcut = {
1664
1634
  //#endregion
1665
1635
  //#region package.json
1666
1636
  var name = "@univerjs/sheets-hyper-link-ui";
1667
- var version = "0.21.1";
1637
+ var version = "0.22.0";
1668
1638
 
1669
1639
  //#endregion
1670
1640
  //#region src/controllers/auto-fill.controller.ts
@@ -1888,7 +1858,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
1888
1858
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
1889
1859
  if (!worksheet) return;
1890
1860
  if (!renderer.with(_univerjs_sheets_ui.HoverRenderController).active) {
1891
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);
1861
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
1892
1862
  return;
1893
1863
  }
1894
1864
  const skeleton = renderer === null || renderer === void 0 || (_renderer$with$getSke = renderer.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _renderer$with$getSke === void 0 ? void 0 : _renderer$with$getSke.skeleton;
@@ -1926,7 +1896,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
1926
1896
  copyPermission,
1927
1897
  customRange: currentCell.customRange,
1928
1898
  customRangeRect: currentCell.rect,
1929
- type: HyperLinkEditSourceType.VIEWING,
1899
+ type: "viewing",
1930
1900
  unitId,
1931
1901
  subUnitId,
1932
1902
  showAll: Boolean(tr)
@@ -1943,8 +1913,8 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
1943
1913
  if (state.editorUnitId !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
1944
1914
  if (!visible.visible) {
1945
1915
  subscribe === null || subscribe === void 0 || subscribe.unsubscribe();
1946
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING);
1947
- this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);
1916
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("editing");
1917
+ this._sheetsHyperLinkPopupService.endEditing("editing");
1948
1918
  return;
1949
1919
  }
1950
1920
  const { editorUnitId, unitId, sheetId, row, column } = state;
@@ -1983,7 +1953,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
1983
1953
  },
1984
1954
  editPermission,
1985
1955
  copyPermission,
1986
- type: HyperLinkEditSourceType.EDITING
1956
+ type: "editing"
1987
1957
  });
1988
1958
  });
1989
1959
  }));
@@ -1994,13 +1964,13 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
1994
1964
  _initZenEditor() {
1995
1965
  this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {
1996
1966
  if (visible) {
1997
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);
1998
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING);
1999
- this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);
2000
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);
1967
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
1968
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("editing");
1969
+ this._sheetsHyperLinkPopupService.endEditing("editing");
1970
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
2001
1971
  } else {
2002
- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR);
2003
- this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.ZEN_EDITOR);
1972
+ this._sheetsHyperLinkPopupService.hideCurrentPopup("zen_mode");
1973
+ this._sheetsHyperLinkPopupService.endEditing("zen_mode");
2004
1974
  }
2005
1975
  }));
2006
1976
  this.disposeWithMe(this._univerInstanceService.focused$.pipe((0, rxjs.switchMap)((id) => {
@@ -2021,7 +1991,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
2021
1991
  col: column
2022
1992
  });
2023
1993
  if (viewPermission) this._sheetsHyperLinkPopupService.showPopup({
2024
- type: HyperLinkEditSourceType.ZEN_EDITOR,
1994
+ type: "zen_mode",
2025
1995
  unitId,
2026
1996
  subUnitId: sheetId,
2027
1997
  row,
@@ -2030,12 +2000,12 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
2030
2000
  editPermission,
2031
2001
  copyPermission
2032
2002
  });
2033
- } else this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR);
2003
+ } else this._sheetsHyperLinkPopupService.hideCurrentPopup("zen_mode");
2034
2004
  }));
2035
2005
  }
2036
2006
  _initTextSelectionListener() {
2037
2007
  this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe((selection) => {
2038
- if (selection && selection.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);
2008
+ if (selection && selection.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) this._sheetsHyperLinkPopupService.endEditing("editing");
2039
2009
  }));
2040
2010
  }
2041
2011
  _initCommandListener() {