@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 +25 -43
- package/lib/cjs/index.js +51 -81
- package/lib/es/index.js +51 -81
- package/lib/index.js +51 -81
- package/lib/umd/index.js +1 -1
- package/package.json +24 -20
package/lib/es/index.js
CHANGED
|
@@ -15,30 +15,6 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
import { AllBorderIcon, CopyIcon, LinkIcon, UnlinkIcon, WriteIcon, XlsxMultiIcon } from "@univerjs/icons";
|
|
16
16
|
import { SheetDataValidationModel } from "@univerjs/sheets-data-validation";
|
|
17
17
|
|
|
18
|
-
//#region src/types/enums/edit-source.ts
|
|
19
|
-
/**
|
|
20
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
21
|
-
*
|
|
22
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
-
* you may not use this file except in compliance with the License.
|
|
24
|
-
* You may obtain a copy of the License at
|
|
25
|
-
*
|
|
26
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
29
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
-
* See the License for the specific language governing permissions and
|
|
32
|
-
* limitations under the License.
|
|
33
|
-
*/
|
|
34
|
-
let HyperLinkEditSourceType = /* @__PURE__ */ function(HyperLinkEditSourceType) {
|
|
35
|
-
HyperLinkEditSourceType["EDITING"] = "editing";
|
|
36
|
-
HyperLinkEditSourceType["VIEWING"] = "viewing";
|
|
37
|
-
HyperLinkEditSourceType["ZEN_EDITOR"] = "zen_mode";
|
|
38
|
-
return HyperLinkEditSourceType;
|
|
39
|
-
}({});
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
18
|
//#region src/common/util.ts
|
|
43
19
|
/**
|
|
44
20
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
@@ -86,7 +62,7 @@ const configSymbol = Symbol(SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY);
|
|
|
86
62
|
const defaultPluginConfig = {};
|
|
87
63
|
|
|
88
64
|
//#endregion
|
|
89
|
-
//#region \0@oxc-project+runtime@0.
|
|
65
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
90
66
|
function __decorateParam(paramIndex, decorator) {
|
|
91
67
|
return function(target, key) {
|
|
92
68
|
decorator(target, key, paramIndex);
|
|
@@ -94,7 +70,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
94
70
|
}
|
|
95
71
|
|
|
96
72
|
//#endregion
|
|
97
|
-
//#region \0@oxc-project+runtime@0.
|
|
73
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
98
74
|
function __decorate(decorators, target, key, desc) {
|
|
99
75
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
100
76
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -234,7 +210,7 @@ SheetsHyperLinkResolverService = __decorate([
|
|
|
234
210
|
], SheetsHyperLinkResolverService);
|
|
235
211
|
|
|
236
212
|
//#endregion
|
|
237
|
-
//#region \0@oxc-project+runtime@0.
|
|
213
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
238
214
|
function _typeof(o) {
|
|
239
215
|
"@babel/helpers - typeof";
|
|
240
216
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -245,7 +221,7 @@ function _typeof(o) {
|
|
|
245
221
|
}
|
|
246
222
|
|
|
247
223
|
//#endregion
|
|
248
|
-
//#region \0@oxc-project+runtime@0.
|
|
224
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
249
225
|
function toPrimitive(t, r) {
|
|
250
226
|
if ("object" != _typeof(t) || !t) return t;
|
|
251
227
|
var e = t[Symbol.toPrimitive];
|
|
@@ -258,14 +234,14 @@ function toPrimitive(t, r) {
|
|
|
258
234
|
}
|
|
259
235
|
|
|
260
236
|
//#endregion
|
|
261
|
-
//#region \0@oxc-project+runtime@0.
|
|
237
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
262
238
|
function toPropertyKey(t) {
|
|
263
239
|
var i = toPrimitive(t, "string");
|
|
264
240
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
265
241
|
}
|
|
266
242
|
|
|
267
243
|
//#endregion
|
|
268
|
-
//#region \0@oxc-project+runtime@0.
|
|
244
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
269
245
|
function _defineProperty(e, r, t) {
|
|
270
246
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
271
247
|
value: t,
|
|
@@ -392,7 +368,7 @@ const CellLinkEdit = () => {
|
|
|
392
368
|
row,
|
|
393
369
|
column: col
|
|
394
370
|
};
|
|
395
|
-
} else if (editing.type ===
|
|
371
|
+
} else if (editing.type === "viewing") {
|
|
396
372
|
var _cell$p, _cell$p2, _range$properties$url, _range$properties2;
|
|
397
373
|
const workbook = univerInstanceService.getUnit(editing.unitId);
|
|
398
374
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
|
|
@@ -475,7 +451,7 @@ const CellLinkEdit = () => {
|
|
|
475
451
|
]);
|
|
476
452
|
useEffect(() => {
|
|
477
453
|
let id = null;
|
|
478
|
-
if (editing && !editing.customRangeId && editing.type ===
|
|
454
|
+
if (editing && !editing.customRangeId && editing.type === "viewing" && Tools.isDefine(editing.row) && Tools.isDefine(editing.col)) {
|
|
479
455
|
const workbook = univerInstanceService.getUnit(editing.unitId, UniverInstanceType.UNIVER_SHEET);
|
|
480
456
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
|
|
481
457
|
const mergeInfo = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergedCell(editing.row, editing.col);
|
|
@@ -509,7 +485,7 @@ const CellLinkEdit = () => {
|
|
|
509
485
|
setIsFocusRangeSelector(type === SheetHyperLinkType.RANGE);
|
|
510
486
|
}, [type]);
|
|
511
487
|
useEffect(() => {
|
|
512
|
-
const render = (editing === null || editing === void 0 ? void 0 : editing.type) ===
|
|
488
|
+
const render = (editing === null || editing === void 0 ? void 0 : editing.type) === "zen_mode" ? renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY) : renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId());
|
|
513
489
|
const disposeCollection = new DisposableCollection();
|
|
514
490
|
if (render) {
|
|
515
491
|
const selectionRenderService = render.with(DocSelectionRenderService);
|
|
@@ -611,7 +587,7 @@ const CellLinkEdit = () => {
|
|
|
611
587
|
return;
|
|
612
588
|
}
|
|
613
589
|
if (editing) if (id) {
|
|
614
|
-
const commandId = editing.type ===
|
|
590
|
+
const commandId = editing.type === "zen_mode" || editing.type === "editing" ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;
|
|
615
591
|
await commandService.executeCommand(commandId, {
|
|
616
592
|
id,
|
|
617
593
|
unitId: editing.unitId,
|
|
@@ -622,10 +598,10 @@ const CellLinkEdit = () => {
|
|
|
622
598
|
},
|
|
623
599
|
row: editing.row,
|
|
624
600
|
column: editing.col,
|
|
625
|
-
documentId: editing.type ===
|
|
601
|
+
documentId: editing.type === "zen_mode" ? DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
|
|
626
602
|
});
|
|
627
603
|
} else {
|
|
628
|
-
const commandId = editing.type ===
|
|
604
|
+
const commandId = editing.type === "zen_mode" || editing.type === "editing" ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;
|
|
629
605
|
await commandService.executeCommand(commandId, {
|
|
630
606
|
unitId: editing.unitId,
|
|
631
607
|
subUnitId: editing.subUnitId,
|
|
@@ -636,10 +612,10 @@ const CellLinkEdit = () => {
|
|
|
636
612
|
payload: formatUrl(type, payload),
|
|
637
613
|
display: showLabel ? display : ""
|
|
638
614
|
},
|
|
639
|
-
documentId: editing.type ===
|
|
615
|
+
documentId: editing.type === "zen_mode" ? DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
|
|
640
616
|
});
|
|
641
617
|
}
|
|
642
|
-
if ((editing === null || editing === void 0 ? void 0 : editing.type) ===
|
|
618
|
+
if ((editing === null || editing === void 0 ? void 0 : editing.type) === "viewing") {
|
|
643
619
|
await commandService.executeCommand(SetWorksheetActiveOperation.id, {
|
|
644
620
|
unitId: editing.unitId,
|
|
645
621
|
subUnitId: editing.subUnitId
|
|
@@ -717,11 +693,11 @@ const CellLinkEdit = () => {
|
|
|
717
693
|
onRangeSelectorDialogVisibleChange: async (visible) => {
|
|
718
694
|
setSelectorDialogVisible(visible);
|
|
719
695
|
if (visible) {
|
|
720
|
-
if (editing.type ===
|
|
696
|
+
if (editing.type === "zen_mode") {
|
|
721
697
|
zenZoneService.hide();
|
|
722
698
|
contextService.setContextValue(FOCUSING_SHEET, true);
|
|
723
699
|
}
|
|
724
|
-
if (editing.type !==
|
|
700
|
+
if (editing.type !== "viewing") editorBridgeService.enableForceKeepVisible();
|
|
725
701
|
setHide(true);
|
|
726
702
|
} else {
|
|
727
703
|
await resolverService.navigateToRange(editing.unitId, editing.subUnitId, {
|
|
@@ -730,7 +706,7 @@ const CellLinkEdit = () => {
|
|
|
730
706
|
startColumn: editing.col,
|
|
731
707
|
endColumn: editing.col
|
|
732
708
|
}, true);
|
|
733
|
-
if (editing.type ===
|
|
709
|
+
if (editing.type === "zen_mode") {
|
|
734
710
|
var _renderManagerService, _docSelectionManagerS;
|
|
735
711
|
await commandService.executeCommand(SetSelectionsOperation.id, {
|
|
736
712
|
unitId: editing.unitId,
|
|
@@ -924,14 +900,14 @@ const CellLinkPopupPure = (props) => {
|
|
|
924
900
|
}), /* @__PURE__ */ jsx("div", {
|
|
925
901
|
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",
|
|
926
902
|
onClick: () => {
|
|
927
|
-
const commandId = type ===
|
|
903
|
+
const commandId = type === "editing" || type === "zen_mode" ? CancelRichHyperLinkCommand.id : CancelHyperLinkCommand.id;
|
|
928
904
|
if (commandService.syncExecuteCommand(commandId, {
|
|
929
905
|
unitId,
|
|
930
906
|
subUnitId,
|
|
931
907
|
id: customRange.rangeId,
|
|
932
908
|
row,
|
|
933
909
|
column: col,
|
|
934
|
-
documentId: type ===
|
|
910
|
+
documentId: type === "zen_mode" ? DOCS_ZEN_EDITOR_UNIT_ID_KEY : editorBridgeService.getCurrentEditorId()
|
|
935
911
|
})) popupService.hideCurrentPopup(void 0, true);
|
|
936
912
|
},
|
|
937
913
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
@@ -1019,7 +995,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1019
995
|
showPopup(location) {
|
|
1020
996
|
if (this._currentPopup && isEqualLink(location, this._currentPopup)) return;
|
|
1021
997
|
this.hideCurrentPopup(void 0, true);
|
|
1022
|
-
if (location.type !==
|
|
998
|
+
if (location.type !== "zen_mode" && this._zenZoneService.visible) return;
|
|
1023
999
|
const currentEditing = this._currentEditing$.getValue();
|
|
1024
1000
|
if (currentEditing && isEqualLink(location, currentEditing)) return;
|
|
1025
1001
|
const { unitId, subUnitId, row, col, customRangeRect, customRange } = location;
|
|
@@ -1034,10 +1010,10 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1034
1010
|
this.hideCurrentPopup(location.type, true);
|
|
1035
1011
|
}
|
|
1036
1012
|
};
|
|
1037
|
-
if (location.type ===
|
|
1013
|
+
if (location.type === "editing") {
|
|
1038
1014
|
if (!customRange) return;
|
|
1039
1015
|
disposable = customRangeRect && this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeRect, popup);
|
|
1040
|
-
} else if (location.type ===
|
|
1016
|
+
} else if (location.type === "zen_mode") {
|
|
1041
1017
|
if (!customRange) return;
|
|
1042
1018
|
disposable = this._docCanvasPopManagerService.attachPopupToRange({
|
|
1043
1019
|
startOffset: customRange.startIndex,
|
|
@@ -1130,7 +1106,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1130
1106
|
}
|
|
1131
1107
|
startAddEditing(link) {
|
|
1132
1108
|
const { unitId, subUnitId, type } = link;
|
|
1133
|
-
if (type ===
|
|
1109
|
+
if (type === "zen_mode") {
|
|
1134
1110
|
var _document$getBody;
|
|
1135
1111
|
const document = this._univerInstanceService.getUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
1136
1112
|
if (!document) return;
|
|
@@ -1142,7 +1118,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1142
1118
|
...link,
|
|
1143
1119
|
label
|
|
1144
1120
|
});
|
|
1145
|
-
} else if (type ===
|
|
1121
|
+
} else if (type === "editing") {
|
|
1146
1122
|
var _range$label;
|
|
1147
1123
|
const range = this._getEditingRange();
|
|
1148
1124
|
if (!range) return;
|
|
@@ -1178,7 +1154,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1178
1154
|
const { unitId, subUnitId } = link;
|
|
1179
1155
|
let customRange;
|
|
1180
1156
|
let label;
|
|
1181
|
-
if (link.type ===
|
|
1157
|
+
if (link.type === "zen_mode") {
|
|
1182
1158
|
var _document$getBody2, _document$getBody3;
|
|
1183
1159
|
const document = this._univerInstanceService.getUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
1184
1160
|
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);
|
|
@@ -1193,7 +1169,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1193
1169
|
endOffset: customRange.endIndex,
|
|
1194
1170
|
collapsed: false
|
|
1195
1171
|
}, this._editPopup, DOCS_ZEN_EDITOR_UNIT_ID_KEY);
|
|
1196
|
-
} else if (link.type ===
|
|
1172
|
+
} else if (link.type === "editing") {
|
|
1197
1173
|
var _customRangeInfo$rect;
|
|
1198
1174
|
const customRangeInfo = getEditingCustomRangePosition(this._injector, link.unitId, link.subUnitId, link.row, link.col, link.customRangeId);
|
|
1199
1175
|
if (!customRangeInfo || !((_customRangeInfo$rect = customRangeInfo.rects) === null || _customRangeInfo$rect === void 0 ? void 0 : _customRangeInfo$rect.length)) return;
|
|
@@ -1251,12 +1227,6 @@ SheetsHyperLinkPopupService = __decorate([
|
|
|
1251
1227
|
|
|
1252
1228
|
//#endregion
|
|
1253
1229
|
//#region src/utils/index.ts
|
|
1254
|
-
let DisableLinkType = /* @__PURE__ */ function(DisableLinkType) {
|
|
1255
|
-
DisableLinkType[DisableLinkType["ALLOWED"] = 0] = "ALLOWED";
|
|
1256
|
-
DisableLinkType[DisableLinkType["DISABLED_BY_CELL"] = 1] = "DISABLED_BY_CELL";
|
|
1257
|
-
DisableLinkType[DisableLinkType["ALLOW_ON_EDITING"] = 2] = "ALLOW_ON_EDITING";
|
|
1258
|
-
return DisableLinkType;
|
|
1259
|
-
}({});
|
|
1260
1230
|
const disables = new Set([
|
|
1261
1231
|
DataValidationType.CHECKBOX,
|
|
1262
1232
|
DataValidationType.LIST,
|
|
@@ -1265,13 +1235,13 @@ const disables = new Set([
|
|
|
1265
1235
|
const getShouldDisableCellLink = (accessor, worksheet, row, col) => {
|
|
1266
1236
|
var _cell$p, _cell$p2;
|
|
1267
1237
|
const cell = worksheet.getCell(row, col);
|
|
1268
|
-
if ((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) return
|
|
1269
|
-
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
|
|
1238
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) return 1;
|
|
1239
|
+
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;
|
|
1270
1240
|
const dataValidationModel = accessor.has(SheetDataValidationModel) ? accessor.get(SheetDataValidationModel) : null;
|
|
1271
1241
|
const rule = dataValidationModel === null || dataValidationModel === void 0 ? void 0 : dataValidationModel.getRuleByLocation(worksheet.getUnitId(), worksheet.getSheetId(), row, col);
|
|
1272
1242
|
if (rule && disables.has(rule.type)) return true;
|
|
1273
|
-
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
|
|
1274
|
-
return
|
|
1243
|
+
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;
|
|
1244
|
+
return 0;
|
|
1275
1245
|
};
|
|
1276
1246
|
const getShouldDisableCurrentCellLink = (accessor) => {
|
|
1277
1247
|
const unit = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
@@ -1281,7 +1251,7 @@ const getShouldDisableCurrentCellLink = (accessor) => {
|
|
|
1281
1251
|
if (!selections.length) return true;
|
|
1282
1252
|
const row = selections[0].range.startRow;
|
|
1283
1253
|
const col = selections[0].range.startColumn;
|
|
1284
|
-
return getShouldDisableCellLink(accessor, worksheet, row, col) ===
|
|
1254
|
+
return getShouldDisableCellLink(accessor, worksheet, row, col) === 1;
|
|
1285
1255
|
};
|
|
1286
1256
|
const shouldDisableAddLink = (accessor) => {
|
|
1287
1257
|
const textSelectionService = accessor.get(DocSelectionManagerService);
|
|
@@ -1336,7 +1306,7 @@ const InsertHyperLinkOperation = {
|
|
|
1336
1306
|
subUnitId: target.subUnitId,
|
|
1337
1307
|
row,
|
|
1338
1308
|
col,
|
|
1339
|
-
type: isZenEditor ?
|
|
1309
|
+
type: isZenEditor ? "zen_mode" : visible.visible ? "editing" : "viewing"
|
|
1340
1310
|
});
|
|
1341
1311
|
}
|
|
1342
1312
|
};
|
|
@@ -1584,17 +1554,17 @@ const getLinkDisable$ = (accessor) => {
|
|
|
1584
1554
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1585
1555
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
1586
1556
|
return ((_editorBridgeService$ = editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.currentEditCellState$.pipe(map((state) => {
|
|
1587
|
-
if (!state) return
|
|
1557
|
+
if (!state) return 1;
|
|
1588
1558
|
const target = getSheetCommandTarget(univerInstanceService, {
|
|
1589
1559
|
unitId: state.unitId,
|
|
1590
1560
|
subUnitId: state.sheetId
|
|
1591
1561
|
});
|
|
1592
|
-
if (!target) return
|
|
1562
|
+
if (!target) return 1;
|
|
1593
1563
|
return getShouldDisableCellLink(accessor, target.worksheet, state.row, state.column);
|
|
1594
1564
|
}), switchMap((disableCell) => {
|
|
1595
|
-
if (disableCell ===
|
|
1565
|
+
if (disableCell === 1) return of(true);
|
|
1596
1566
|
return combineLatest([editorBridgeService ? editorBridgeService.visible$ : of(null), univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC)]).pipe(switchMap(([editing, focusingDoc]) => {
|
|
1597
|
-
return (editing === null || editing === void 0 ? void 0 : editing.visible) ? (focusingDoc === null || focusingDoc === void 0 ? void 0 : focusingDoc.getUnitId()) === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? of(true) : getEditingLinkDisable$(accessor, DOCS_NORMAL_EDITOR_UNIT_ID_KEY) : of(disableCell !==
|
|
1567
|
+
return (editing === null || editing === void 0 ? void 0 : editing.visible) ? (focusingDoc === null || focusingDoc === void 0 ? void 0 : focusingDoc.getUnitId()) === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? of(true) : getEditingLinkDisable$(accessor, DOCS_NORMAL_EDITOR_UNIT_ID_KEY) : of(disableCell !== 0);
|
|
1598
1568
|
}));
|
|
1599
1569
|
}))) !== null && _editorBridgeService$ !== void 0 ? _editorBridgeService$ : of(true)).pipe(switchMap((disableCell) => {
|
|
1600
1570
|
if (disableCell) return of(true);
|
|
@@ -1663,7 +1633,7 @@ const InsertLinkShortcut = {
|
|
|
1663
1633
|
//#endregion
|
|
1664
1634
|
//#region package.json
|
|
1665
1635
|
var name = "@univerjs/sheets-hyper-link-ui";
|
|
1666
|
-
var version = "0.
|
|
1636
|
+
var version = "0.22.0";
|
|
1667
1637
|
|
|
1668
1638
|
//#endregion
|
|
1669
1639
|
//#region src/controllers/auto-fill.controller.ts
|
|
@@ -1887,7 +1857,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1887
1857
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
1888
1858
|
if (!worksheet) return;
|
|
1889
1859
|
if (!renderer.with(HoverRenderController).active) {
|
|
1890
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1860
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
|
|
1891
1861
|
return;
|
|
1892
1862
|
}
|
|
1893
1863
|
const skeleton = renderer === null || renderer === void 0 || (_renderer$with$getSke = renderer.with(SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _renderer$with$getSke === void 0 ? void 0 : _renderer$with$getSke.skeleton;
|
|
@@ -1925,7 +1895,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1925
1895
|
copyPermission,
|
|
1926
1896
|
customRange: currentCell.customRange,
|
|
1927
1897
|
customRangeRect: currentCell.rect,
|
|
1928
|
-
type:
|
|
1898
|
+
type: "viewing",
|
|
1929
1899
|
unitId,
|
|
1930
1900
|
subUnitId,
|
|
1931
1901
|
showAll: Boolean(tr)
|
|
@@ -1942,8 +1912,8 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1942
1912
|
if (state.editorUnitId !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
1943
1913
|
if (!visible.visible) {
|
|
1944
1914
|
subscribe === null || subscribe === void 0 || subscribe.unsubscribe();
|
|
1945
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1946
|
-
this._sheetsHyperLinkPopupService.endEditing(
|
|
1915
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("editing");
|
|
1916
|
+
this._sheetsHyperLinkPopupService.endEditing("editing");
|
|
1947
1917
|
return;
|
|
1948
1918
|
}
|
|
1949
1919
|
const { editorUnitId, unitId, sheetId, row, column } = state;
|
|
@@ -1982,7 +1952,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1982
1952
|
},
|
|
1983
1953
|
editPermission,
|
|
1984
1954
|
copyPermission,
|
|
1985
|
-
type:
|
|
1955
|
+
type: "editing"
|
|
1986
1956
|
});
|
|
1987
1957
|
});
|
|
1988
1958
|
}));
|
|
@@ -1993,13 +1963,13 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1993
1963
|
_initZenEditor() {
|
|
1994
1964
|
this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {
|
|
1995
1965
|
if (visible) {
|
|
1996
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1997
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1998
|
-
this._sheetsHyperLinkPopupService.endEditing(
|
|
1999
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1966
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
|
|
1967
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("editing");
|
|
1968
|
+
this._sheetsHyperLinkPopupService.endEditing("editing");
|
|
1969
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("viewing");
|
|
2000
1970
|
} else {
|
|
2001
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
2002
|
-
this._sheetsHyperLinkPopupService.endEditing(
|
|
1971
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup("zen_mode");
|
|
1972
|
+
this._sheetsHyperLinkPopupService.endEditing("zen_mode");
|
|
2003
1973
|
}
|
|
2004
1974
|
}));
|
|
2005
1975
|
this.disposeWithMe(this._univerInstanceService.focused$.pipe(switchMap((id) => {
|
|
@@ -2020,7 +1990,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
2020
1990
|
col: column
|
|
2021
1991
|
});
|
|
2022
1992
|
if (viewPermission) this._sheetsHyperLinkPopupService.showPopup({
|
|
2023
|
-
type:
|
|
1993
|
+
type: "zen_mode",
|
|
2024
1994
|
unitId,
|
|
2025
1995
|
subUnitId: sheetId,
|
|
2026
1996
|
row,
|
|
@@ -2029,12 +1999,12 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
2029
1999
|
editPermission,
|
|
2030
2000
|
copyPermission
|
|
2031
2001
|
});
|
|
2032
|
-
} else this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
2002
|
+
} else this._sheetsHyperLinkPopupService.hideCurrentPopup("zen_mode");
|
|
2033
2003
|
}));
|
|
2034
2004
|
}
|
|
2035
2005
|
_initTextSelectionListener() {
|
|
2036
2006
|
this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe((selection) => {
|
|
2037
|
-
if (selection && selection.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) this._sheetsHyperLinkPopupService.endEditing(
|
|
2007
|
+
if (selection && selection.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) this._sheetsHyperLinkPopupService.endEditing("editing");
|
|
2038
2008
|
}));
|
|
2039
2009
|
}
|
|
2040
2010
|
_initCommandListener() {
|