@univerjs/sheets-hyper-link-ui 0.2.2 → 0.2.4-alpha.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 +20 -5
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +507 -471
- package/lib/locale/vi-VN.json +35 -0
- package/lib/locale/zh-TW.json +35 -0
- package/lib/types/controllers/copy-paste.controller.d.ts +1 -2
- package/lib/types/controllers/menu.d.ts +1 -1
- package/lib/types/controllers/set-range.controller.d.ts +7 -5
- package/lib/types/controllers/ui.controller.d.ts +1 -2
- package/lib/types/locale/vi-VN.d.ts +4 -0
- package/lib/types/locale/zh-TW.d.ts +4 -0
- package/lib/types/plugin.d.ts +2 -2
- package/lib/types/services/popup.service.d.ts +2 -3
- package/lib/umd/index.js +2 -2
- package/package.json +24 -22
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hyperLink": {
|
|
3
|
+
"form": {
|
|
4
|
+
"editTitle": "Chỉnh sửa liên kết",
|
|
5
|
+
"addTitle": "Chèn liên kết",
|
|
6
|
+
"label": "Văn bản",
|
|
7
|
+
"labelPlaceholder": "Nhập văn bản",
|
|
8
|
+
"type": "Loại",
|
|
9
|
+
"link": "Liên kết",
|
|
10
|
+
"linkPlaceholder": "Nhập địa chỉ liên kết",
|
|
11
|
+
"range": "Ô",
|
|
12
|
+
"worksheet": "Bảng tính",
|
|
13
|
+
"definedName": "Tên đã xác định",
|
|
14
|
+
"ok": "Xác nhận",
|
|
15
|
+
"cancel": "Hủy",
|
|
16
|
+
"inputError": "Vui lòng nhập",
|
|
17
|
+
"selectError": "Vui lòng chọn",
|
|
18
|
+
"linkError": "Vui lòng nhập liên kết hợp lệ"
|
|
19
|
+
},
|
|
20
|
+
"menu": {
|
|
21
|
+
"add": "Thêm liên kết"
|
|
22
|
+
},
|
|
23
|
+
"message": {
|
|
24
|
+
"noSheet": "Bảng con này đã bị xóa",
|
|
25
|
+
"refError": "Tham chiếu lỗi",
|
|
26
|
+
"hiddenSheet": "Không thể mở bảng con bị ẩn",
|
|
27
|
+
"coped": "Liên kết đã được sao chép vào clipboard"
|
|
28
|
+
},
|
|
29
|
+
"popup": {
|
|
30
|
+
"copy": "Sao chép",
|
|
31
|
+
"edit": "Chỉnh sửa",
|
|
32
|
+
"cancel": "Hủy liên kết"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hyperLink": {
|
|
3
|
+
"form": {
|
|
4
|
+
"editTitle": "編輯連結",
|
|
5
|
+
"addTitle": "插入連結",
|
|
6
|
+
"label": "文本",
|
|
7
|
+
"labelPlaceholder": "輸入文字",
|
|
8
|
+
"type": "類型",
|
|
9
|
+
"link": "連結",
|
|
10
|
+
"linkPlaceholder": "輸入連結位址",
|
|
11
|
+
"range": "單元格",
|
|
12
|
+
"worksheet": "工作表",
|
|
13
|
+
"definedName": "定義的名稱",
|
|
14
|
+
"ok": "確認",
|
|
15
|
+
"cancel": "取消",
|
|
16
|
+
"inputError": "請輸入",
|
|
17
|
+
"selectError": "請選擇",
|
|
18
|
+
"linkError": "請輸入合法的連結"
|
|
19
|
+
},
|
|
20
|
+
"menu": {
|
|
21
|
+
"add": "新增連結"
|
|
22
|
+
},
|
|
23
|
+
"message": {
|
|
24
|
+
"noSheet": "該子表已被刪除",
|
|
25
|
+
"refError": "錯誤的引用",
|
|
26
|
+
"hiddenSheet": "無法開啟被隱藏的子表",
|
|
27
|
+
"coped": "連結已複製到剪貼簿"
|
|
28
|
+
},
|
|
29
|
+
"popup": {
|
|
30
|
+
"copy": "複製",
|
|
31
|
+
"edit": "編輯",
|
|
32
|
+
"cancel": "取消連結"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Disposable } from '@univerjs/core';
|
|
1
|
+
import { Disposable, Injector } from '@univerjs/core';
|
|
2
2
|
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
|
3
3
|
import { ISheetClipboardService } from '@univerjs/sheets-ui';
|
|
4
|
-
import { Injector } from '@wendellhu/redi';
|
|
5
4
|
import { SheetsHyperLinkResolverService } from '../services/resolver.service';
|
|
6
5
|
|
|
7
6
|
export declare class SheetsHyperLinkCopyPasteController extends Disposable {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IMenuItem, IShortcutItem, MenuGroup, MenuItemType, MenuPosition } from '@univerjs/ui';
|
|
2
|
-
import { IAccessor } from '@
|
|
2
|
+
import { IAccessor } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
export declare const insertLinkMenuFactory: (accessor: IAccessor) => IMenuItem;
|
|
5
5
|
export declare const insertLinkMenuToolbarFactory: (accessor: IAccessor) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectionManagerService, SheetInterceptorService } from '@univerjs/sheets';
|
|
1
|
+
import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
3
|
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
|
4
|
+
import { IEditorBridgeService } from '@univerjs/sheets-ui';
|
|
5
5
|
|
|
6
6
|
export declare class SheetHyperLinkSetRangeController extends Disposable {
|
|
7
7
|
private readonly _sheetInterceptorService;
|
|
@@ -9,11 +9,13 @@ export declare class SheetHyperLinkSetRangeController extends Disposable {
|
|
|
9
9
|
private readonly _hyperLinkModel;
|
|
10
10
|
private readonly _selectionManagerService;
|
|
11
11
|
private readonly _univerInstanceService;
|
|
12
|
-
|
|
12
|
+
private readonly _editorBridgeService;
|
|
13
|
+
constructor(_sheetInterceptorService: SheetInterceptorService, _injector: Injector, _hyperLinkModel: HyperLinkModel, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _editorBridgeService: IEditorBridgeService);
|
|
13
14
|
private _initCommandInterceptor;
|
|
15
|
+
private _getCurrentCell;
|
|
14
16
|
private _initAddHyperLinkCommandInterceptor;
|
|
15
17
|
private _initUpdateHyperLinkCommandInterceptor;
|
|
16
18
|
private _initSetRangeValuesCommandInterceptor;
|
|
17
19
|
private _initClearSelectionCommandInterceptor;
|
|
18
|
-
private
|
|
20
|
+
private _initRichTextEditorInterceptor;
|
|
19
21
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Disposable, ICommandService, LocaleService } from '@univerjs/core';
|
|
1
|
+
import { Disposable, ICommandService, Injector, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { MenuConfig, ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
|
|
3
|
-
import { Injector } from '@wendellhu/redi';
|
|
4
3
|
|
|
5
4
|
export interface IUniverSheetsHyperLinkUIConfig {
|
|
6
5
|
menu?: MenuConfig;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Injector } from '@
|
|
2
|
-
import { Plugin, UniverInstanceType } from '@univerjs/core';
|
|
1
|
+
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
3
2
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
3
|
import { IUniverSheetsHyperLinkUIConfig } from './controllers/ui.controller';
|
|
5
4
|
|
|
@@ -11,4 +10,5 @@ export declare class UniverSheetsHyperLinkUIPlugin extends Plugin {
|
|
|
11
10
|
static type: UniverInstanceType;
|
|
12
11
|
constructor(_config: IUniverSheetsHyperLinkUIConfig, _injector: Injector, _renderManagerService: IRenderManagerService);
|
|
13
12
|
onStarting(injector: Injector): void;
|
|
13
|
+
onReady(): void;
|
|
14
14
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ISheetLocationBase } from '@univerjs/sheets';
|
|
2
2
|
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
|
3
3
|
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
|
4
|
-
import { IDisposable } from '@
|
|
5
|
-
import { Disposable } from '@univerjs/core';
|
|
4
|
+
import { IDisposable, Disposable } from '@univerjs/core';
|
|
6
5
|
|
|
7
|
-
interface IHyperLinkPopup {
|
|
6
|
+
export interface IHyperLinkPopup {
|
|
8
7
|
unitId: string;
|
|
9
8
|
subUnitId: string;
|
|
10
9
|
id: string;
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@
|
|
1
|
+
(function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("clsx"),require("@univerjs/design"),require("@univerjs/ui"),require("@univerjs/engine-formula"),require("@univerjs/docs-hyper-link"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/engine-render","rxjs","react","clsx","@univerjs/design","@univerjs/ui","@univerjs/engine-formula","@univerjs/docs-hyper-link","@univerjs/docs"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l.UniverSheetsHyperLink,l.UniverSheetsUi,l.UniverEngineRender,l.rxjs,l.React,l.clsx,l.UniverDesign,l.UniverUi,l.UniverEngineFormula,l.UniverDocsHyperLink,l.UniverDocs))})(this,function(l,a,h,v,f,ue,pe,C,ke,I,O,D,De,Ae){"use strict";var Gn=Object.defineProperty;var Xn=(l,a,h)=>a in l?Gn(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h;var $=(l,a,h)=>Xn(l,typeof a!="symbol"?a+"":a,h);var Ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,xe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Be(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ve(e,t,r),r},he=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._hyperLinkModel=n,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===h.RemoveSheetCommand.id){const n=e.params,r=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=n.subUnitId||((t=r.getActiveSheet())==null?void 0:t.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),d=c.map(S=>({id:v.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:S.id}})),p=c.map(S=>({id:v.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:S}}));return{redos:d,undos:p}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=xe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),he(0,a.Inject(h.SheetInterceptorService)),he(1,a.IUniverInstanceService),he(2,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?Fe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&We(e,t,r),r},Y=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,t,n,r){super(),this._context=e,this._hyperLinkModel=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const t=this._context.unit,n=t.getUnitId(),r=(c=t.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(n);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{e()}))}},l.SheetsHyperLinkRenderController=Ie([Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(f.SheetSkeletonManagerService)),Y(3,ue.IRenderManagerService)],l.SheetsHyperLinkRenderController),l.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._themeService=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(h.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return n(d?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}},l.SheetsHyperLinkRenderManagerController=Ie([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRenderManagerController),Y(0,a.Inject(h.SheetInterceptorService)),Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(a.ThemeService))],l.SheetsHyperLinkRenderManagerController);var Re={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var $e=C,Ye=Symbol.for("react.element"),ze=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ze=$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0};function Ee(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)Ke.call(e,n)&&!Ge.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:Ye,type:i,key:o,ref:s,props:r,_owner:Ze.current}}re.Fragment=ze,re.jsx=Ee,re.jsxs=Ee,be.exports=re;var m=be.exports,U=function(){return U=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},U.apply(this,arguments)},Xe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},$=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Xe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=C.useRef("_".concat(qe()));return Oe(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},U({ref:e,className:c},s),o)});function Oe(i,e,t,n,r){return C.createElement(i.tag,U(U({key:e},Je(i,t,r)),n),(Qe(i,t).children||[]).map(function(o,s){return Oe(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function Je(i,e,t){var n=U({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Qe(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?U(U({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?U(U({},r),{attrs:U(U({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function qe(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var en={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ie=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"all-border-single",ref:e,icon:en}))});ie.displayName="AllBorderSingle";var nn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},we=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"copy-single",ref:e,icon:nn}))});we.displayName="CopySingle";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},oe=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"link-single",ref:e,icon:tn}))});oe.displayName="LinkSingle";var rn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},Me=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"unlink-single",ref:e,icon:rn}))});Me.displayName="UnlinkSingle";var on={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},He=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"write-single",ref:e,icon:on}))});He.displayName="WriteSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ge=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"xlsx",ref:e,icon:sn}))});ge.displayName="Xlsx";var an=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,cn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&an(e,t,r),r},X=(i,e)=>(t,n)=>e(t,n,i);function dn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const h=A.deserializeRangeWithSheet(n).range;return a.isValidRange(h)&&n!==v.ERROR_RANGE?{type:"range",name:A.serializeRangeWithSheet(c,h)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const h=this._definedNamesService.getValueById(o.getUnitId(),r);return h?{type:"defineName",name:h.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const h=o.getSheetBySheetId(t);return h?{type:"sheet",name:h.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=A.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=dn(n,r);await this._commandService.executeCommand(u.SetSelectionsOperation.id,{unitId:e,subUnitId:t,pluginName:u.NORMAL_SELECTION_PLUGIN_NAME,selections:[{range:o}]}),await this._commandService.executeCommand(f.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=cn([X(0,a.IUniverInstanceService),X(1,a.ICommandService),X(2,A.IDefinedNamesService),X(3,O.IMessageService),X(4,y.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function J(i){return a.Tools.isLegalUrl(i)}function un(i){return/^[a-zA-Z]+:\/\//.test(i)}function pn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function Se(i){if(J(i)){const e=un(i)?i:pn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function hn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const mn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},se=()=>{var te;const[i,e]=C.useState(""),[t,n]=C.useState(""),[r,o]=C.useState("link"),[s,c]=C.useState(""),d=T.useDependency(a.LocaleService),h=T.useDependency(A.IDefinedNamesService),g=T.useDependency(a.IUniverInstanceService),_=T.useDependency(l.SheetsHyperLinkPopupService),p=O.useObservable(_.currentEditing$),R=T.useDependency(v.HyperLinkModel),L=T.useDependency(l.SheetsHyperLinkResolverService),k=T.useDependency(a.ICommandService),[P,N]=C.useState(!1),w=C.useRef(!1);C.useEffect(()=>{var S,b,M;if((p==null?void 0:p.row)!==void 0&&p.column!==void 0){const E=R.getHyperLinkByLocationSync(p.unitId,p.subUnitId,p.row,p.column);if(E){const pe=L.parseHyperLink(E.payload);if(e(E.id),n(E.display),pe.type==="outer"){o("link"),c(pe.url),pe.url===E.display&&(w.current=!0);return}else{const W=pe.searchObj;if(W.rangeid){o("rangeid"),c(W.rangeid);return}if(W.range){const Zn=W.gid&&(M=(b=(S=g.getUnit(p.unitId))==null?void 0:S.getSheetBySheetId(W.gid))==null?void 0:b.getName())!=null?M:"";if(o("range"),W.range===v.ERROR_RANGE)c("");else{const Ae=A.serializeRangeWithSheet(Zn,A.deserializeRangeWithSheet(W.range).range);c(Ae),Ae===E.display&&(w.current=!0)}return}if(W.gid){o("gid"),c(W.gid);return}}}const j=g.getUnit(p.unitId),D=j==null?void 0:j.getSheetBySheetId(p.subUnitId),Kn=D==null?void 0:D.getCellRaw(p.row,p.column),Ie=hn(Kn);o("link"),c(""),n((Ie!=null?Ie:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[p,R,L,g]);const x=C.useMemo(()=>s,[r]),Z=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],H=g.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!H)return;const G=H.getHiddenWorksheets(),B=H.getSheets().map(S=>({label:S.getName(),value:S.getSheetId()})).filter(S=>G.indexOf(S.value)===-1),F=Object.values((te=h.getDefinedNameMap(H.getUnitId()))!=null?te:{}).map(S=>({label:S.name,value:S.id})),ne=(S,b)=>{if(S==="link")return Se(b);if(S==="range"){const M=A.deserializeRangeWithSheet(b),E=H.getSheetBySheetName(M.sheetName);if(E)return`#gid=${E.getSheetId()}&range=${A.serializeRange(M.range)}`}return`#${S}=${b}`},Le=O.useEvent(S=>{var E;const b=S[0];if(!b||!a.isValidRange(b.range))return;b.sheetName||(b.sheetName=((E=H.getActiveSheet())==null?void 0:E.getName())||"");const M=A.serializeRangeToRefString(b);c(M),M&&(w.current||!t)&&(n(M),w.current=!0)}),ke=async()=>{if(p&&(i?await k.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:p.unitId,subUnitId:p.subUnitId,id:i,payload:{display:t,payload:ne(r,s)}}):await k.executeCommand(v.AddHyperLinkCommand.id,{unitId:p.unitId,subUnitId:p.subUnitId,link:{id:a.Tools.generateRandomId(),row:p.row,column:p.column,payload:ne(r,s),display:t}})),p){await k.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:p.unitId,subUnitId:p.subUnitId});const S=1;await k.executeCommand(f.ScrollToRangeOperation.id,{range:{startRow:Math.max(p.row-S,0),endRow:p.row+S,startColumn:Math.max(p.column-S,0),endColumn:p.column+S}})}k.executeCommand(Q.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:P&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:S=>{n(S),w.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(I.Select,{options:Z,value:r,onChange:S=>{o(S),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:P?s?J(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:s,onChange:S=>{c(S),S&&(w.current||!t||t===s)&&(n(S),w.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:H.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:x,onChange:Le})}),r==="gid"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:B,value:s,onChange:S=>{var E,j;c(S);const b=(E=B.find(D=>D.value===S))==null?void 0:E.label,M=(j=B.find(D=>D.value===s))==null?void 0:j.label;b&&(w.current||!t||t===M)&&(n(b),w.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:F,value:s,onChange:S=>{var E,j;c(S);const b=(E=F.find(D=>D.value===S))==null?void 0:E.label,M=(j=F.find(D=>D.value===s))==null?void 0:j.label;b&&(w.current||!t||t===M)&&(n(b),w.current=!0)}})}),m.jsxs("div",{className:mn.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{p&&k.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:p.unitId,subUnitId:p.subUnitId}),k.executeCommand(Q.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!J(s)){N(!0);return}ke()},children:d.t("hyperLink.form.ok")})]})]})};se.componentKey="univer.sheet.cell-link-edit";const ae={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),h=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:h?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:se.componentKey}}),!0}},Q={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},le={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=u.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(u.SelectionManagerService).getFirst();if(!(o!=null&&o.primary))return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(ae.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ye={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(Q.id):e.executeCommand(le.id)}},V={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},vn={outer:m.jsx(oe,{}),link:m.jsx(oe,{}),sheet:m.jsx(ge,{}),range:m.jsx(ie,{}),defineName:m.jsx(ie,{}),"range-error":m.jsx(ie,{}),"sheet-error":m.jsx(ge,{})},ce=()=>{const i=T.useDependency(l.SheetsHyperLinkPopupService),e=T.useDependency(v.HyperLinkModel),t=T.useDependency(a.ICommandService),n=T.useDependency(O.IMessageService),r=T.useDependency(a.LocaleService),o=O.useObservable(i.currentPopup$,i.currentPopup),s=T.useDependency(l.SheetsHyperLinkResolverService);if(!o)return null;const{unitId:c,subUnitId:d,id:h}=o,g=e.getHyperLink(c,d,h);if(!g)return null;const _=s.parseHyperLink(g.payload),p=_.type.indexOf("error")>-1;return m.jsxs("div",{className:V.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:Re(V.cellLinkContent,{[V.cellLinkContentError]:p}),onClick:_.handler,children:[m.jsx("div",{className:V.cellLinkType,children:vn[_.type]}),m.jsx(I.Tooltip,{showIfEllipsis:!0,title:_.name,children:m.jsx("span",{className:V.cellLinkUrl,children:_.name})})]}),m.jsxs("div",{className:V.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:Re(V.cellLinkOperation,{[V.cellLinkOperationError]:p}),onClick:()=>{if(!p){if(_.type!=="outer"){const R=new URL(window.location.href);R.hash=_.url.slice(1),navigator.clipboard.writeText(R.href)}else navigator.clipboard.writeText(_.url);n.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(we,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:V.cellLinkOperation,onClick:()=>{t.executeCommand(ae.id,{unitId:c,subUnitId:d,row:g.row,column:g.column})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(He,{})})}),m.jsx("div",{className:V.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:c,subUnitId:d,id:g.id})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Me,{})})})]})]})]})};ce.componentKey="univer.sheet.cell-link-popup";var gn=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Sn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gn(e,t,r),r},je=(i,e)=>(t,n)=>e(t,n,i);const fn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();Y(this,"_currentPopup",null);Y(this,"_currentPopup$",new me.Subject);Y(this,"currentPopup$",this._currentPopup$.asObservable());Y(this,"_currentEditing$",new me.BehaviorSubject(null));Y(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&fn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:ce.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=yn([je(0,y.Inject(v.HyperLinkModel)),je(1,y.Inject(f.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ln=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_n(e,t,r),r},q=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor()}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:d}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:d}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,h)=>{var R,L,k;const g=(k=h==null?void 0:h.v)!=null?k:(L=(R=h==null?void 0:h.p)==null?void 0:R.body)==null?void 0:L.dataStream.slice(0,-2),_=(g!=null?g:"").toString(),p=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!p){if(J(_)){const P=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:P}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:P,row:c,column:d,display:_,payload:Se(_)}}})}return}g===""&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:p.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:p}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.ClearSelectionContentCommand.id||e.id===u.ClearSelectionAllCommand.id||e.id===u.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getFirst(),o=u.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,h)=>{const g=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,h);g&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:g.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:g}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}},l.SheetHyperLinkSetRangeController=Ln([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),q(0,y.Inject(u.SheetInterceptorService)),q(1,y.Inject(y.Injector)),q(2,y.Inject(v.HyperLinkModel)),q(3,y.Inject(u.SelectionManagerService)),q(4,a.IUniverInstanceService)],l.SheetHyperLinkSetRangeController);var kn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var r=n>1?void 0:n?In(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&kn(e,t,r),r},ee=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(me.debounceTime(100)).subscribe(e=>{var p,R;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(R=(p=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:p.with(f.SheetSkeletonManagerService).getUnitSkeleton(e.location.unitId,e.location.subUnitId))==null?void 0:R.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((L,k,P)=>{a.Rectangle.contains(P,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=L,s=k)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookViewPermission],worksheetTypes:[u.WorksheetViewPermission],rangeTypes:[u.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),h=e.location.unitId,g=e.location.subUnitId,_=this._permissionService.composePermission([new u.WorkbookCopyPermission(h).id,new u.WorksheetCopyPermission(h,g).id]).every(L=>L.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:_})}))}},l.SheetsHyperLinkPopupController=Rn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),ee(0,y.Inject(f.HoverManagerService)),ee(1,y.Inject(l.SheetsHyperLinkPopupService)),ee(2,y.Inject(he.IRenderManagerService)),ee(3,y.Inject(a.IPermissionService)),ee(4,y.Inject(f.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const Pn=i=>({id:le.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),bn=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:ye.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),fe={id:ye.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:f.whenSheetEditorFocused};var En=Object.defineProperty,On=Object.getOwnPropertyDescriptor,wn=(i,e,t,n)=>{for(var r=n>1?void 0:n?On(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&En(e,t,r),r},K=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[ce,ce.componentKey],[se,se.componentKey],[oe,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[ae,Q,le,ye].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(Pn(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(bn(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(fe)}},l.SheetsHyperLinkUIController=wn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),K(1,y.Inject(O.ComponentManager)),K(2,a.ICommandService),K(3,y.Inject(a.LocaleService)),K(4,O.IMenuService),K(5,y.Inject(y.Injector)),K(6,y.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);const _e="SHEET_HYPER_LINK_UI_PLUGIN";var Mn=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,jn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Mn(e,t,r),r},Te=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:h}=r,g=f.virtualizeDiscreteRanges([s,c]),[_,p]=g.ranges,{mapFunc:R}=g,L={row:_.startRow,col:_.startColumn},k=f.getAutoFillRepeatRange(_,p),P=[],N=[];return k.forEach(w=>{const x=w.repeatStartCell,Z=w.relativeRange,H={startRow:L.row,startColumn:L.col,endColumn:L.col,endRow:L.row},G={startRow:x.row,startColumn:x.col,endColumn:x.col,endRow:x.row};a.Range.foreach(Z,(B,F)=>{const ne=a.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},H),{row:Le,col:ke}=R(ne.startRow,ne.startColumn),te=this._hyperLinkModel.getHyperLinkByLocation(d,h,Le,ke);if(te){const S=a.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},G),{row:b,col:M}=R(S.startRow,S.startColumn),E=a.Tools.generateRandomId(),j=this._hyperLinkModel.getHyperLinkByLocation(d,h,b,M);j&&P.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:h,id:j.id}}),(f.APPLY_TYPE.COPY===o||f.APPLY_TYPE.SERIES===o)&&(P.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:h,link:{...te,id:E,row:b,column:M}}}),N.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:h,id:E}})),j&&N.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:h,link:j}})}})}),{undos:N,redos:P}},n={id:_e,onFillData:(r,o,s)=>s===f.APPLY_TYPE.COPY||s===f.APPLY_TYPE.ONLY_FORMAT||s===f.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=jn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),Te(0,f.IAutoFillService),Te(1,y.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var Tn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Nn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Un(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Tn(e,t,r),r},de=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();Y(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:_e,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=f.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:h,unitId:g,subUnitId:_}=n;return this._generateMutations(h,{copyType:s,pasteType:c,copyRange:d,unitId:g,subUnitId:_})},onPastePlainText:(t,n)=>{if(J(n)){const r=Se(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:h}=f.virtualizeDiscreteRanges([o]),g=[],_=[];return a.Range.foreach(d,(p,R)=>{const{row:L,col:k}=h(p,R),P=this._hyperLinkModel.getHyperLinkByLocation(s,c,L,k);P&&g.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:P.id}});const N=a.Tools.generateRandomId();g.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:N,row:L,column:k,payload:r}}}),_.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:N}}),P&&_.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:P}})}),{redos:g,undos:_}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=f.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:h}=c;d.forEach((g,_)=>{h.forEach((p,R)=>{var k;const L=this._hyperLinkModel.getHyperLinkByLocation(t,n,g,p);o.setValue(_,R,(k=L==null?void 0:L.id)!=null?k:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(n.copyType===f.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,h],mapFunc:g}=f.virtualizeDiscreteRanges([n.copyRange,t]);return f.getRepeatRange(d,h,!0).forEach(({startRange:p})=>{var R;(R=this._copyInfo)==null||R.matrix.forValue((L,k,P)=>{const N=a.Rectangle.getPositionRange({startRow:L,endRow:L,startColumn:k,endColumn:k},p),w=this._hyperLinkModel.getHyperLink(r,o,P),{row:x,col:Z}=g(N.startRow,N.startColumn),H=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,x,Z),G=a.Tools.generateRandomId();H&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:H.id}}),w&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...w,id:G,row:x,column:Z}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:G}})),H&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:H}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=Nn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),de(0,f.ISheetClipboardService),de(1,y.Inject(v.HyperLinkModel)),de(2,y.Inject(y.Injector)),de(3,y.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Dn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Vn=(i,e,t,n)=>{for(var r=n>1?void 0:n?An(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Dn(e,t,r),r},xn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Vn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),xn(0,y.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var Wn=Object.defineProperty,Bn=Object.getOwnPropertyDescriptor,Fn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Bn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Wn(e,t,r),r},Ce=(i,e)=>(t,n)=>e(t,n,i);let ue=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===fe.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],rangeTypes:[u.RangeProtectionPermissionEditPoint],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ue=Fn([a.OnLifecycle(a.LifecycleStages.Rendered,ue),Ce(0,y.Inject(a.LocaleService)),Ce(1,a.ICommandService),Ce(2,y.Inject(f.SheetPermissionInterceptorBaseController))],ue);var Ue=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t)=>e in i?Ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,zn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ue(e,t,r),r},Ne=(i,e)=>(t,n)=>e(t,n,i),De=(i,e,t)=>Yn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[ue],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n)),this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,l.SheetsHyperLinkRenderController)}},De(l.UniverSheetsHyperLinkUIPlugin,"pluginName",_e),De(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=zn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),Ne(1,y.Inject(y.Injector)),Ne(2,he.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=Q,l.InsertHyperLinkOperation=le,l.InsertLinkShortcut=fe,l.OpenHyperLinkSidebarOperation=ae,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
*/var $e=C,Ye=Symbol.for("react.element"),Ke=Symbol.for("react.fragment"),ze=Object.prototype.hasOwnProperty,Ze=$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0};function Pe(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)ze.call(e,n)&&!Ge.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:Ye,type:i,key:o,ref:s,props:r,_owner:Ze.current}}ne.Fragment=Ke,ne.jsx=Pe,ne.jsxs=Pe,Re.exports=ne;var m=Re.exports,T=function(){return T=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},T.apply(this,arguments)},Xe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},F=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Xe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=C.useRef("_".concat(qe()));return Ee(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},T({ref:e,className:c},s),o)});function Ee(i,e,t,n,r){return C.createElement(i.tag,T(T({key:e},Je(i,t,r)),n),(Qe(i,t).children||[]).map(function(o,s){return Ee(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function Je(i,e,t){var n=T({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Qe(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?T(T({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?T(T({},r),{attrs:T(T({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function qe(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";var en={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},te=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"all-border-single",ref:e,icon:en}))});te.displayName="AllBorderSingle";var nn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"copy-single",ref:e,icon:nn}))});be.displayName="CopySingle";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},re=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"link-single",ref:e,icon:tn}))});re.displayName="LinkSingle";var rn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},Oe=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"unlink-single",ref:e,icon:rn}))});Oe.displayName="UnlinkSingle";var on={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},Me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"write-single",ref:e,icon:on}))});Me.displayName="WriteSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"xlsx",ref:e,icon:sn}))});me.displayName="Xlsx";var an=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,cn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&an(e,t,r),r},G=(i,e)=>(t,n)=>e(t,n,i);function dn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const p=D.deserializeRangeWithSheet(n).range;return a.isValidRange(p)&&n!==v.ERROR_RANGE?{type:"range",name:D.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const p=o.getSheetBySheetId(t);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=D.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=dn(n,r);await this._commandService.executeCommand(h.SetSelectionsOperation.id,{unitId:e,subUnitId:t,selections:[{range:o}]}),await this._commandService.executeCommand(f.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=cn([G(0,a.IUniverInstanceService),G(1,a.ICommandService),G(2,D.IDefinedNamesService),G(3,O.IMessageService),G(4,a.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function X(i){return a.Tools.isLegalUrl(i)}function un(i){return/^[a-zA-Z]+:\/\//.test(i)}function pn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function ve(i){if(X(i)){const e=un(i)?i:pn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function hn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const mn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},ie=()=>{var ee;const[i,e]=C.useState(""),[t,n]=C.useState(""),[r,o]=C.useState("link"),[s,c]=C.useState(""),d=a.useDependency(a.LocaleService),p=a.useDependency(D.IDefinedNamesService),S=a.useDependency(a.IUniverInstanceService),_=a.useDependency(l.SheetsHyperLinkPopupService),u=O.useObservable(_.currentEditing$),k=a.useDependency(v.HyperLinkModel),y=a.useDependency(l.SheetsHyperLinkResolverService),L=a.useDependency(a.ICommandService),[R,H]=C.useState(!1),b=C.useRef(!1);C.useEffect(()=>{var g,P,w;if((u==null?void 0:u.row)!==void 0&&u.column!==void 0){const E=k.getHyperLinkByLocationSync(u.unitId,u.subUnitId,u.row,u.column);if(E){const de=y.parseHyperLink(E.payload);if(e(E.id),n(E.display),de.type==="outer"){o("link"),c(de.url),de.url===E.display&&(b.current=!0);return}else{const V=de.searchObj;if(V.rangeid){o("rangeid"),c(V.rangeid);return}if(V.range){const Zn=V.gid&&(w=(P=(g=S.getUnit(u.unitId))==null?void 0:g.getSheetBySheetId(V.gid))==null?void 0:P.getName())!=null?w:"";if(o("range"),V.range===v.ERROR_RANGE)c("");else{const Ne=D.serializeRangeWithSheet(Zn,D.deserializeRangeWithSheet(V.range).range);c(Ne),Ne===E.display&&(b.current=!0)}return}if(V.gid){o("gid"),c(V.gid);return}}}const j=S.getUnit(u.unitId),N=j==null?void 0:j.getSheetBySheetId(u.subUnitId),zn=N==null?void 0:N.getCellRaw(u.row,u.column),Le=hn(zn);o("link"),c(""),n((Le!=null?Le:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[u,k,y,S]);const U=C.useMemo(()=>s,[r]),B=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],M=S.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!M)return;const Z=M.getHiddenWorksheets(),x=M.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>Z.indexOf(g.value)===-1),W=Object.values((ee=p.getDefinedNameMap(M.getUnitId()))!=null?ee:{}).map(g=>({label:g.name,value:g.id})),q=(g,P)=>{if(g==="link")return ve(P);if(g==="range"){const w=D.deserializeRangeWithSheet(P),E=M.getSheetBySheetName(w.sheetName);if(E)return`#gid=${E.getSheetId()}&range=${D.serializeRange(w.range)}`}return`#${g}=${P}`},_e=O.useEvent(g=>{var E;const P=g[0];if(!P||!a.isValidRange(P.range))return;P.sheetName||(P.sheetName=((E=M.getActiveSheet())==null?void 0:E.getName())||"");const w=D.serializeRangeToRefString(P);c(w),w&&(b.current||!t)&&(n(w),b.current=!0)}),Ce=async()=>{if(u&&(i?await L.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,id:i,payload:{display:t,payload:q(r,s)}}):await L.executeCommand(v.AddHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,link:{id:a.Tools.generateRandomId(),row:u.row,column:u.column,payload:q(r,s),display:t}})),u){await L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId});const g=1;await L.executeCommand(f.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-g,0),endRow:u.row+g,startColumn:Math.max(u.column-g,0),endColumn:u.column+g}})}L.executeCommand(J.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:R&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:g=>{n(g),b.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(I.Select,{options:B,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:R?s?X(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:s,onChange:g=>{c(g),g&&(b.current||!t||t===s)&&(n(g),b.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:M.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:U,onChange:_e})}),r==="gid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:x,value:s,onChange:g=>{var E,j;c(g);const P=(E=x.find(N=>N.value===g))==null?void 0:E.label,w=(j=x.find(N=>N.value===s))==null?void 0:j.label;P&&(b.current||!t||t===w)&&(n(P),b.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:W,value:s,onChange:g=>{var E,j;c(g);const P=(E=W.find(N=>N.value===g))==null?void 0:E.label,w=(j=W.find(N=>N.value===s))==null?void 0:j.label;P&&(b.current||!t||t===w)&&(n(P),b.current=!0)}})}),m.jsxs("div",{className:mn.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{u&&L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId}),L.executeCommand(J.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!X(s)){H(!0);return}Ce()},children:d.t("hyperLink.form.ok")})]})]})};ie.componentKey="univer.sheet.cell-link-edit";const oe={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:ie.componentKey}}),!0}},J={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},se={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=h.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(h.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(oe.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ge={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(J.id):e.executeCommand(se.id)}},A={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},vn={outer:m.jsx(re,{}),link:m.jsx(re,{}),sheet:m.jsx(me,{}),range:m.jsx(te,{}),defineName:m.jsx(te,{}),"range-error":m.jsx(te,{}),"sheet-error":m.jsx(me,{})},ae=()=>{const i=a.useDependency(l.SheetsHyperLinkPopupService),e=a.useDependency(v.HyperLinkModel),t=a.useDependency(a.ICommandService),n=a.useDependency(O.IMessageService),r=a.useDependency(a.LocaleService),[o,s]=C.useState(null),c=a.useDependency(l.SheetsHyperLinkResolverService);if(C.useEffect(()=>{s(i.currentPopup);const y=i.currentPopup$.subscribe(L=>{s(L)});return()=>{y.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:d,subUnitId:p,id:S}=o,_=e.getHyperLink(d,p,S);if(!_)return null;const u=c.parseHyperLink(_.payload),k=u.type.indexOf("error")>-1;return m.jsxs("div",{className:A.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:ke(A.cellLinkContent,{[A.cellLinkContentError]:k}),onClick:u.handler,children:[m.jsx("div",{className:A.cellLinkType,children:vn[u.type]}),m.jsx(I.Tooltip,{showIfEllipsis:!0,title:u.name,children:m.jsx("span",{className:A.cellLinkUrl,children:u.name})})]}),m.jsxs("div",{className:A.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:ke(A.cellLinkOperation,{[A.cellLinkOperationError]:k}),onClick:()=>{if(!k){if(u.type!=="outer"){const y=new URL(window.location.href);y.hash=u.url.slice(1),navigator.clipboard.writeText(y.href)}else navigator.clipboard.writeText(u.url);n.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(be,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(oe.id,{unitId:d,subUnitId:p,row:_.row,column:_.column})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(Me,{})})}),m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:d,subUnitId:p,id:_.id})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Oe,{})})})]})]})]})};ae.componentKey="univer.sheet.cell-link-popup";var gn=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Sn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gn(e,t,r),r},we=(i,e)=>(t,n)=>e(t,n,i);const fn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();$(this,"_currentPopup",null);$(this,"_currentPopup$",new pe.Subject);$(this,"currentPopup$",this._currentPopup$.asObservable());$(this,"_currentEditing$",new pe.BehaviorSubject(null));$(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&fn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:ae.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=yn([we(0,a.Inject(v.HyperLinkModel)),we(1,a.Inject(f.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ln=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_n(e,t,r),r},K=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o,s){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,p)=>{var k,y,L,R,H,b,U;const S=(L=p==null?void 0:p.v)!=null?L:(y=(k=p==null?void 0:p.p)==null?void 0:k.body)==null?void 0:y.dataStream.slice(0,-2),_=(S!=null?S:"").toString(),u=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!u){if(X(_)||(R=p==null?void 0:p.custom)!=null&&R.__link_url){const B=(b=(H=p==null?void 0:p.custom)==null?void 0:H.__link_url)!=null?b:_,M=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:M}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:M,row:c,column:d,display:_,payload:ve(B)}}})}return}(S===""||((U=p==null?void 0:p.custom)==null?void 0:U.__link_url)==="")&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:u.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:u}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.ClearSelectionContentCommand.id||e.id===h.ClearSelectionAllCommand.id||e.id===h.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getCurrentLastSelection(),o=h.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,p)=>{const S=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,p);S&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:S.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:S}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{var r,o,s,c,d,p;if(e!=null&&e.p){const S=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(u=>u.rangeType===a.CustomRangeType.HYPERLINK),_=(s=e.p.resources)==null?void 0:s.find(u=>u.name===De.DOC_HYPER_LINK_PLUGIN);if(S&&_){const u=S.rangeId,k=(p=(d=(c=JSON.parse(_.data))==null?void 0:c.links)==null?void 0:d.find(y=>y.id===u))==null?void 0:p.payload;return n({...e,p:null,v:Ae.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:k}})}}return n(e)}}))}},l.SheetHyperLinkSetRangeController=Ln([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),K(0,a.Inject(h.SheetInterceptorService)),K(1,a.Inject(a.Injector)),K(2,a.Inject(v.HyperLinkModel)),K(3,a.Inject(h.SheetsSelectionsService)),K(4,a.IUniverInstanceService),K(5,f.IEditorBridgeService)],l.SheetHyperLinkSetRangeController);var kn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var r=n>1?void 0:n?In(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&kn(e,t,r),r},Q=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(pe.debounceTime(100)).subscribe(e=>{var u,k;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(k=(u=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:u.with(f.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:k.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((y,L,R)=>{a.Rectangle.contains(R,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=y,s=L)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookViewPermission],worksheetTypes:[h.WorksheetViewPermission],rangeTypes:[h.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),p=e.location.unitId,S=e.location.subUnitId,_=this._permissionService.composePermission([new h.WorkbookCopyPermission(p).id,new h.WorksheetCopyPermission(p,S).id]).every(y=>y.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:_})}))}},l.SheetsHyperLinkPopupController=Rn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),Q(0,a.Inject(f.HoverManagerService)),Q(1,a.Inject(l.SheetsHyperLinkPopupService)),Q(2,a.Inject(ue.IRenderManagerService)),Q(3,a.Inject(a.IPermissionService)),Q(4,a.Inject(f.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const Pn=i=>({id:se.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),En=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:ge.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),Se={id:ge.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:f.whenSheetEditorFocused};var bn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,Mn=(i,e,t,n)=>{for(var r=n>1?void 0:n?On(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&bn(e,t,r),r},z=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[ae,ae.componentKey],[ie,ie.componentKey],[re,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[oe,J,se,ge].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(Pn(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(En(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(Se)}},l.SheetsHyperLinkUIController=Mn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),z(1,a.Inject(O.ComponentManager)),z(2,a.ICommandService),z(3,a.Inject(a.LocaleService)),z(4,O.IMenuService),z(5,a.Inject(a.Injector)),z(6,a.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);const ye="SHEET_HYPER_LINK_UI_PLUGIN";var wn=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,jn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wn(e,t,r),r},He=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:p}=r,S=f.virtualizeDiscreteRanges([s,c]),[_,u]=S.ranges,{mapFunc:k}=S,y={row:_.startRow,col:_.startColumn},L=f.getAutoFillRepeatRange(_,u),R=[],H=[];return L.forEach(b=>{const U=b.repeatStartCell,B=b.relativeRange,M={startRow:y.row,startColumn:y.col,endColumn:y.col,endRow:y.row},Z={startRow:U.row,startColumn:U.col,endColumn:U.col,endRow:U.row};a.Range.foreach(B,(x,W)=>{const q=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},M),{row:_e,col:Ce}=k(q.startRow,q.startColumn),ee=this._hyperLinkModel.getHyperLinkByLocation(d,p,_e,Ce);if(ee){const g=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},Z),{row:P,col:w}=k(g.startRow,g.startColumn),E=a.Tools.generateRandomId(),j=this._hyperLinkModel.getHyperLinkByLocation(d,p,P,w);j&&R.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:j.id}}),(f.APPLY_TYPE.COPY===o||f.APPLY_TYPE.SERIES===o)&&(R.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:{...ee,id:E,row:P,column:w}}}),H.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:E}})),j&&H.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:j}})}})}),{undos:H,redos:R}},n={id:ye,onFillData:(r,o,s)=>s===f.APPLY_TYPE.COPY||s===f.APPLY_TYPE.ONLY_FORMAT||s===f.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=jn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),He(0,f.IAutoFillService),He(1,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var Tn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Nn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Un(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Tn(e,t,r),r},le=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();$(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:ye,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=f.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:p,unitId:S,subUnitId:_}=n;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:d,unitId:S,subUnitId:_})},onPastePlainText:(t,n)=>{if(X(n)){const r=ve(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:p}=f.virtualizeDiscreteRanges([o]),S=[],_=[];return a.Range.foreach(d,(u,k)=>{const{row:y,col:L}=p(u,k),R=this._hyperLinkModel.getHyperLinkByLocation(s,c,y,L);R&&S.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:R.id}});const H=a.Tools.generateRandomId();S.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:H,row:y,column:L,payload:r}}}),_.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:H}}),R&&_.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:R}})}),{redos:S,undos:_}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=f.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:p}=c;d.forEach((S,_)=>{p.forEach((u,k)=>{var L;const y=this._hyperLinkModel.getHyperLinkByLocation(t,n,S,u);o.setValue(_,k,(L=y==null?void 0:y.id)!=null?L:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,p],mapFunc:S}=f.virtualizeDiscreteRanges([n.copyRange,t]);return f.getRepeatRange(d,p,!0).forEach(({startRange:u})=>{var k;(k=this._copyInfo)==null||k.matrix.forValue((y,L,R)=>{const H=a.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:L,endColumn:L},u),b=this._hyperLinkModel.getHyperLink(r,o,R),{row:U,col:B}=S(H.startRow,H.startColumn),M=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,U,B),Z=a.Tools.generateRandomId();M&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:M.id}}),b&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...b,id:Z,row:U,column:B}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:Z}})),M&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:M}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=Nn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),le(0,f.ISheetClipboardService),le(1,a.Inject(v.HyperLinkModel)),le(2,a.Inject(a.Injector)),le(3,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Dn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Vn=(i,e,t,n)=>{for(var r=n>1?void 0:n?An(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Dn(e,t,r),r},Bn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Vn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),Bn(0,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var xn=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Fn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Wn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&xn(e,t,r),r},fe=(i,e)=>(t,n)=>e(t,n,i);let ce=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===Se.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],rangeTypes:[h.RangeProtectionPermissionEditPoint],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ce=Fn([a.OnLifecycle(a.LifecycleStages.Rendered,ce),fe(0,a.Inject(a.LocaleService)),fe(1,a.ICommandService),fe(2,a.Inject(f.SheetPermissionInterceptorBaseController))],ce);var je=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t)=>e in i?je(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Kn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&je(e,t,r),r},Te=(i,e)=>(t,n)=>e(t,n,i),Ue=(i,e,t)=>Yn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[ce],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n))}onReady(){[[l.SheetsHyperLinkRenderController]].forEach(t=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,t))}},Ue(l.UniverSheetsHyperLinkUIPlugin,"pluginName",ye),Ue(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=Kn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),Te(1,a.Inject(a.Injector)),Te(2,ue.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=J,l.InsertHyperLinkOperation=se,l.InsertLinkShortcut=Se,l.OpenHyperLinkSidebarOperation=oe,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-hyper-link-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -50,37 +50,39 @@
|
|
|
50
50
|
"lib"
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@wendellhu/redi": "0.15.5",
|
|
54
53
|
"clsx": ">=2.0.0",
|
|
55
54
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
|
56
55
|
"rxjs": ">=7.0.0",
|
|
57
|
-
"@univerjs/core": "0.2.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/sheets-hyper-link": "0.2.
|
|
64
|
-
"@univerjs/ui": "0.2.
|
|
56
|
+
"@univerjs/core": "0.2.4-alpha.0",
|
|
57
|
+
"@univerjs/docs": "0.2.4-alpha.0",
|
|
58
|
+
"@univerjs/docs-hyper-link": "0.2.4-alpha.0",
|
|
59
|
+
"@univerjs/design": "0.2.4-alpha.0",
|
|
60
|
+
"@univerjs/engine-formula": "0.2.4-alpha.0",
|
|
61
|
+
"@univerjs/engine-render": "0.2.4-alpha.0",
|
|
62
|
+
"@univerjs/sheets-hyper-link": "0.2.4-alpha.0",
|
|
63
|
+
"@univerjs/ui": "0.2.4-alpha.0",
|
|
64
|
+
"@univerjs/sheets-ui": "0.2.4-alpha.0",
|
|
65
|
+
"@univerjs/sheets": "0.2.4-alpha.0"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
|
-
"@univerjs/icons": "^0.1.
|
|
68
|
-
"@univerjs/sheets-hyper-link": "0.2.
|
|
68
|
+
"@univerjs/icons": "^0.1.64",
|
|
69
|
+
"@univerjs/sheets-hyper-link": "0.2.4-alpha.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"@wendellhu/redi": "0.15.5",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
73
73
|
"rxjs": "^7.8.1",
|
|
74
74
|
"typescript": "^5.5.3",
|
|
75
|
-
"vite": "^5.3.
|
|
76
|
-
"vitest": "^
|
|
77
|
-
"@univerjs/
|
|
78
|
-
"@univerjs/
|
|
79
|
-
"@univerjs/
|
|
80
|
-
"@univerjs/
|
|
81
|
-
"@univerjs/
|
|
82
|
-
"@univerjs/
|
|
83
|
-
"@univerjs/
|
|
75
|
+
"vite": "^5.3.4",
|
|
76
|
+
"vitest": "^2.0.3",
|
|
77
|
+
"@univerjs/core": "0.2.4-alpha.0",
|
|
78
|
+
"@univerjs/docs-hyper-link": "0.2.4-alpha.0",
|
|
79
|
+
"@univerjs/docs": "0.2.4-alpha.0",
|
|
80
|
+
"@univerjs/engine-render": "0.2.4-alpha.0",
|
|
81
|
+
"@univerjs/engine-formula": "0.2.4-alpha.0",
|
|
82
|
+
"@univerjs/shared": "0.2.4-alpha.0",
|
|
83
|
+
"@univerjs/sheets": "0.2.4-alpha.0",
|
|
84
|
+
"@univerjs/ui": "0.2.4-alpha.0",
|
|
85
|
+
"@univerjs/sheets-ui": "0.2.4-alpha.0"
|
|
84
86
|
},
|
|
85
87
|
"univerSpace": {
|
|
86
88
|
".": {
|